Add support for multiple possible kernel binary paths for gentoo bug #255085
authorAndrew Gaffney <agaffney@gentoo.org>
Fri, 20 Feb 2009 03:41:10 +0000 (21:41 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Fri, 20 Feb 2009 03:41:10 +0000 (21:41 -0600)
ChangeLog
arch/sparc64/config.sh
gen_compile.sh
gen_funcs.sh
gen_package.sh

index dfbe9d7a8ed565455c33ccca7d808bf65f1aa7a0..fdcc51c49e50456febfe3572e821683cfe7f03d1 100644 (file)
--- 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 <agaffney@gentoo.org> 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 <agaffney@gentoo.org> 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
index 9bdb11b256a62de2ee50eae2851d1db0a0a935ea..d3edb96405bc404f70168f519664a8cf1018b50c 100755 (executable)
@@ -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"
index 40ba84ef1b5b019ed72d16419265282a6f770ae1..3379b616a83a96361bedbb445030790349e3ecad 100755 (executable)
@@ -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
index 0363ac1b63a0ff03d2ad0091b1201287a790b53b..9c3a7ec071ff48302a5db774fedd70a2645a1e4f 100755 (executable)
@@ -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}"
+}
index 712600980fa6b4b9baba855409fc9d7d4a9acf51..3b0c046e754fe8976fcef51e1c6997a444d17bb5 100755 (executable)
@@ -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"