From 01c51230c36cc226e9bd38a7e986144070fa7d45 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Thu, 19 Feb 2009 21:41:10 -0600 Subject: [PATCH] Add support for multiple possible kernel binary paths for gentoo bug #255085 --- ChangeLog | 5 +++++ arch/sparc64/config.sh | 2 +- gen_compile.sh | 16 ++++++++++++---- gen_funcs.sh | 21 +++++++++++++++++++++ gen_package.sh | 26 ++++++++++++++++++++------ 5 files changed, 59 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index dfbe9d7..fdcc51c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ # Copyright 1999-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 20 Feb 2009; Andrew Gaffney arch/sparc64/config.sh, + gen_compile.sh, gen_funcs.sh, gen_package.sh: + Add support for multiple possible kernel binary paths for gentoo bug + #255085 + 04 Feb 2009; Andrew Gaffney defaults/linuxrc: Comment out the exec line for console=*, since it seems to blow up when the param isn't a true device node, such as ttyS0,115200n8 diff --git a/arch/sparc64/config.sh b/arch/sparc64/config.sh index 9bdb11b..d3edb96 100755 --- a/arch/sparc64/config.sh +++ b/arch/sparc64/config.sh @@ -5,7 +5,7 @@ # KERNEL_MAKE_DIRECTIVE="vmlinux" KERNEL_MAKE_DIRECTIVE_2="image" -KERNEL_BINARY="arch/sparc64/boot/image" +KERNEL_BINARY="arch/sparc64/boot/image arch/sparc/boot/image" COMPRESS_INITRD=yes USECOLOR="no" diff --git a/gen_compile.sh b/gen_compile.sh index 40ba84e..3379b61 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -298,10 +298,18 @@ compile_kernel() { print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..." compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel fi + + local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY}) + local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2}) + if [ -z "${tmp_kernel_binary}" ] + then + gen_die "Cannot locate kernel binary" + fi + if ! isTrue "${CMD_NOINSTALL}" then copy_image_with_preserve "kernel" \ - "${KERNEL_BINARY}" \ + "${tmp_kernel_binary}" \ "kernel-${KNAME}-${ARCH}-${KV}" copy_image_with_preserve "System.map" \ @@ -311,17 +319,17 @@ compile_kernel() { if isTrue "${GENZIMAGE}" then copy_image_with_preserve "kernelz" \ - "${KERNEL_BINARY_2}" \ + "${tmp_kernel_binary2}" \ "kernelz-${KV}" fi else - cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" || + cp "${tmp_kernel_binary}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die "Could not copy the kernel binary to ${TMPDIR}!" cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die "Could not copy System.map to ${TMPDIR}!" if isTrue "${GENZIMAGE}" then - cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" || + cp "${tmp_kernel_binary2}" "${TMPDIR}/kernelz-${KV}" || gen_die "Could not copy the kernelz binary to ${TMPDIR}!" fi fi diff --git a/gen_funcs.sh b/gen_funcs.sh index 0363ac1..9c3a7ec 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -524,3 +524,24 @@ check_distfiles() { fi done } + +find_kernel_binary() { + local kernel_binary=$* + local curdir=$(pwd) + + cd "${KERNEL_DIR}" + for i in ${kernel_binary} + do + if [ -e "${i}" ] + then + tmp_kernel_binary=$i + break + fi + done +# if [ -z "${tmp_kernel_binary}" ] +# then +# gen_die "Cannot locate kernel binary!" +# fi + cd "${curdir}" + echo "${tmp_kernel_binary}" +} diff --git a/gen_package.sh b/gen_package.sh index 7126009..3b0c046 100755 --- a/gen_package.sh +++ b/gen_package.sh @@ -13,12 +13,18 @@ gen_minkernpackage() { /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernelz-${ARCH}-${KV} fi else + local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY}) + local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2}) + if [ -z "${tmp_kernel_binary}" ] + then + gen_die "Cannot locate kernel binary" + fi cd "${KERNEL_DIR}" - cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!' + cp "${tmp_kernel_binary}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!' cp ".config" "${TEMP}/minkernpackage/config-${ARCH}-${KV}" || gen_die 'Could not the copy kernel config for the min kernel package!' if isTrue "${GENZIMAGE}" then - cp "${KERNEL_BINARY_2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package" + cp "${tmp_kernel_binary2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package" fi fi @@ -60,15 +66,23 @@ gen_kerncache() print_info 1 'Creating kernel cache' rm -rf "${TEMP}/kerncache" > /dev/null 2>&1 mkdir "${TEMP}/kerncache" || gen_die 'Could not make a directory for the kernel cache!' + + local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY}) + local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2}) + if [ -z "${tmp_kernel_binary}" ] + then + gen_die "Cannot locate kernel binary" + fi + cd "${KERNEL_DIR}" - cp "${KERNEL_BINARY}" "${TEMP}/kerncache/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy kernel for the kernel package!' + cp "${tmp_kernel_binary}" "${TEMP}/kerncache/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy kernel for the kernel package!' cp "${KERNEL_DIR}/.config" "${TEMP}/kerncache/config-${ARCH}-${KV}" cp "${KERNEL_CONFIG}" "${TEMP}/kerncache/config-${ARCH}-${KV}.orig" cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}" if isTrue "${GENZIMAGE}" - then - cp "${KERNEL_BINARY_2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package" - fi + then + cp "${tmp_kernel_binary2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package" + fi echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config" echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config" -- 2.26.2