Get rid of the ENABLE_PEGASOS_HACKS hacks
authorAndrew Gaffney <agaffney@gentoo.org>
Thu, 13 Mar 2008 01:33:15 +0000 (01:33 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Thu, 13 Mar 2008 01:33:15 +0000 (01:33 +0000)
Add INTEGRATED_INITRAMFS option to optionally insert the generated initramfs directly into the kernel image
Change default build order to build the kernel last to facilitate the INTEGRATED_INITRAMFS option
Add GENZIMAGE option and change various checks from ENABLE_PEGASOS_HACKS to GENZIMAGE

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@631 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_cmdline.sh
gen_compile.sh
gen_determineargs.sh
gen_initramfs.sh
gen_initrd.sh
gen_package.sh
genkernel

index fb466e5ff77e921d446a124a7889ebeb3a7c0299..3b2a60423c0efb0b99d01c622390b2aa0ee731a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,15 @@
 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  13 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> gen_cmdline.sh,
+  gen_compile.sh, gen_determineargs.sh, gen_initramfs.sh, gen_initrd.sh,
+  gen_package.sh, genkernel:
+  Get rid of the ENABLE_PEGASOS_HACKS hacks Add INTEGRATED_INITRAMFS option to
+  optionally insert the generated initramfs directly into the kernel image
+  Change default build order to build the kernel last to facilitate the
+  INTEGRATED_INITRAMFS option Add GENZIMAGE option and change various checks
+  from ENABLE_PEGASOS_HACKS to GENZIMAGE
+
   13 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> gen_initramfs.sh:
   Argh...Changing the right line helps
 
index 7b0e58b93b3aa1a8575483a0ec2dc9723080fcb6..6823da44b10d9182229834cf4119f82285e092e8 100755 (executable)
@@ -126,6 +126,9 @@ longusage() {
   echo "                               Specifies specific firmware files to copy. This"
   echo "                               overrides --firmware-dir. For multiple files,"
   echo "                               separate the filenames with a comma"
+  echo "       --integrated-initramfs"
+  echo "                               Build the generated initramfs into the kernel instead of"
+  echo "                               keeping it as a separate file"
 }
 
 usage() {
@@ -474,8 +477,9 @@ parse_cmdline() {
                --genzimage)
                        KERNEL_MAKE_DIRECTIVE_2='zImage.initrd'
                        KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd'
-                       ENABLE_PEGASOS_HACKS="yes"
-                       print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}"
+                       CMD_GENZIMAGE="yes"
+#                      ENABLE_PEGASOS_HACKS="yes"
+#                      print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}"
                        ;;
                --disklabel)
                        CMD_DISKLABEL=1
index a200ac4b6f46fcccae0b7a1053b44f9c7a49bdd3..57a093e76b9f8fbaa4899940d282ea572e155060 100644 (file)
@@ -332,7 +332,7 @@ compile_kernel() {
                        "System.map" \
                        "System.map-${KNAME}-${ARCH}-${KV}"
 
-               if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+               if isTrue "${GENZIMAGE}"
                then
                        copy_image_with_preserve "kernelz" \
                                "${KERNEL_BINARY_2}" \
@@ -343,7 +343,7 @@ compile_kernel() {
                        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 [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+               if isTrue "${GENZIMAGE}"
                then
                        cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
                                gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
index 7203364e43888ca862e92bd9bfa69903084b2ad7..55e88366c7db2bb6ce269901e50af2c3beb103c8 100644 (file)
@@ -117,6 +117,8 @@ determine_real_args() {
        set_config_with_override 1 FIRMWARE             CMD_FIRMWARE
        set_config_with_override 2 FIRMWARE_DIR         CMD_FIRMWARE_DIR         "/lib/firmware"
        set_config_with_override 2 FIRMWARE_FILES       CMD_FIRMWARE_FILES
+       set_config_with_override 1 INTEGRATED_INITRAMFS CMD_INTEGRATED_INITRAMFS
+       set_config_with_override 1 GENZIMAGE            CMD_GENZIMAGE
 
                BOOTDIR=`arch_replace "${BOOTDIR}"`
                BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
@@ -197,6 +199,11 @@ determine_real_args() {
        then
                mkdir -p `dirname ${KERNCACHE}`
        fi
+
+       if ! isTrue "${BUILD_INITRD}"
+       then
+               INTEGRATED_INITRAMFS=0
+       fi
        
        get_KV
 }
index af0664216ec508225294f98ef23df3363e0b2ba1..69f20f58b78a8b70f4406ba9f93b1e45d2dcb781 100644 (file)
@@ -492,21 +492,15 @@ create_initramfs() {
        gzip -9 "${CPIO}"
        mv -f "${CPIO}.gz" "${CPIO}"
 
-       if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+       if isTrue "${INTEGRATED_INITRAMFS}"
        then
-                       # Pegasos hack for merging the initramfs into the kernel at compile time
-                       cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/arch/powerpc/boot/ramdisk.image.gz &&
-                       rm ${TMPDIR}/initramfs-${KV}
-       elif [ ${BUILD_INITRAMFS} -eq '1' ]
-       then
-               # Mips also mimics Pegasos to merge the initramfs into the kernel
                cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
                gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz
        fi
 
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' ]
+               if ! isTrue "${INTEGRATED_INITRAMFS}"
                then
                        copy_image_with_preserve "initramfs" \
                                "${TMPDIR}/initramfs-${KV}" \
index 0a5155e5c232d59ae2611c5d59815849ee664de8..6b20c8d1b957dc351be3ce5d73038220aef0d0ff 100644 (file)
@@ -348,10 +348,10 @@ create_initrd() {
                        "initrd-${KNAME}-${ARCH}-${KV}"
        fi
 
-        if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
-        then
-               # Pegasos hack for merging the initramfs into the kernel at compile time
-               cp ${TMPDIR}/initrd-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz &&
-               rm ${TMPDIR}/initrd-${KV}
-       fi
+#      if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+#      then
+#              # Pegasos hack for merging the initramfs into the kernel at compile time
+#              cp ${TMPDIR}/initrd-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz &&
+#              rm ${TMPDIR}/initrd-${KV}
+#      fi
 }
index a4e9bd2612baf7fcdce184fc019f3e3ffe76353c..d5b54a73ee647db385e8ec82fa6c00e6398d2f57 100644 (file)
@@ -8,7 +8,7 @@ gen_minkernpackage() {
        then
                /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernel-${ARCH}-${KV}
                /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} config-${ARCH}-${KV}
-               if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+               if isTrue "${GENZIMAGE}"
                then
                        /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernelz-${ARCH}-${KV}
                fi
@@ -16,13 +16,13 @@ gen_minkernpackage() {
                cd "${KERNEL_DIR}"
                cp "${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 [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+               if isTrue "${GENZIMAGE}"
                then
                        cp "${KERNEL_BINARY_2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package"
                fi
        fi
        
-       if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' ]
+       if ! isTrue "${INTEGRATED_INITRAMFS}"
        then
                if [ "${KERN_24}" != '1' ]
                then
@@ -69,7 +69,7 @@ gen_kerncache()
        cp "${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_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}"
-       if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+       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
@@ -98,7 +98,7 @@ gen_kerncache_extract_kernel()
                "${TEMP}/kernel-${ARCH}-${KV}" \
                "kernel-${KNAME}-${ARCH}-${KV}"
 
-       if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+       if isTrue "${GENZIMAGE}"
        then
                copy_image_with_preserve "kernelz" \
                        "${TEMP}/kernelz-${ARCH}-${KV}" \
index 5d75a0bffd02aed65f456e5acb5ca488430c436c..4187f9e432248d17b7c864e05e00cf2e29b4bcc7 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -231,10 +231,6 @@ then
        # KV may have changed due to the configuration
        get_KV
 
-       # Compile kernel; If using --genzimage, or building a mips kernel, skip
-       # compile until after initrd/initramfs is done
-       [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq '0' ] && compile_kernel
-
        # Compile modules
        if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ]
        then
@@ -247,13 +243,6 @@ then
                [ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
                cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
        fi
-       if [ "${KERNCACHE}" != "" ]
-       then
-               if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq 0 ]
-               then
-                       gen_kerncache
-               fi
-       fi
 fi
 
 if ! isTrue "${CMD_NOINSTALL}"
@@ -326,10 +315,8 @@ else
        print_info 1 'initrd: Not building since only the kernel was requested...'
 fi
 
-# Pegasos fix
-if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' -o ${BUILD_INITRAMFS} -eq 1 ]
+if isTrue "${INTEGRATED_INITRAMFS}" || [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
 then
-       # Compile kernel, intergrating the initrd into it for Pegasos & mips
        compile_kernel
 
        # We skipped the kernel build and kerncache generation