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

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@631 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Andrew Gaffney 17 years ago
parent 1664faa9df
commit d176b8c104

@ -2,6 +2,15 @@
# Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: $ # $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: 13 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> gen_initramfs.sh:
Argh...Changing the right line helps Argh...Changing the right line helps

@ -126,6 +126,9 @@ longusage() {
echo " Specifies specific firmware files to copy. This" echo " Specifies specific firmware files to copy. This"
echo " overrides --firmware-dir. For multiple files," echo " overrides --firmware-dir. For multiple files,"
echo " separate the filenames with a comma" 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() { usage() {
@ -474,8 +477,9 @@ parse_cmdline() {
--genzimage) --genzimage)
KERNEL_MAKE_DIRECTIVE_2='zImage.initrd' KERNEL_MAKE_DIRECTIVE_2='zImage.initrd'
KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd' KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd'
ENABLE_PEGASOS_HACKS="yes" CMD_GENZIMAGE="yes"
print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}" # ENABLE_PEGASOS_HACKS="yes"
# print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}"
;; ;;
--disklabel) --disklabel)
CMD_DISKLABEL=1 CMD_DISKLABEL=1

@ -332,7 +332,7 @@ compile_kernel() {
"System.map" \ "System.map" \
"System.map-${KNAME}-${ARCH}-${KV}" "System.map-${KNAME}-${ARCH}-${KV}"
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${GENZIMAGE}"
then then
copy_image_with_preserve "kernelz" \ copy_image_with_preserve "kernelz" \
"${KERNEL_BINARY_2}" \ "${KERNEL_BINARY_2}" \
@ -343,7 +343,7 @@ compile_kernel() {
gen_die "Could not copy the kernel binary to ${TMPDIR}!" gen_die "Could not copy the kernel binary to ${TMPDIR}!"
cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" || cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
gen_die "Could not copy System.map to ${TMPDIR}!" gen_die "Could not copy System.map to ${TMPDIR}!"
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${GENZIMAGE}"
then then
cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" || cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
gen_die "Could not copy the kernelz binary to ${TMPDIR}!" gen_die "Could not copy the kernelz binary to ${TMPDIR}!"

@ -117,6 +117,8 @@ determine_real_args() {
set_config_with_override 1 FIRMWARE CMD_FIRMWARE 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_DIR CMD_FIRMWARE_DIR "/lib/firmware"
set_config_with_override 2 FIRMWARE_FILES CMD_FIRMWARE_FILES 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=`arch_replace "${BOOTDIR}"`
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
@ -198,5 +200,10 @@ determine_real_args() {
mkdir -p `dirname ${KERNCACHE}` mkdir -p `dirname ${KERNCACHE}`
fi fi
if ! isTrue "${BUILD_INITRD}"
then
INTEGRATED_INITRAMFS=0
fi
get_KV get_KV
} }

@ -492,21 +492,15 @@ create_initramfs() {
gzip -9 "${CPIO}" gzip -9 "${CPIO}"
mv -f "${CPIO}.gz" "${CPIO}" mv -f "${CPIO}.gz" "${CPIO}"
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${INTEGRATED_INITRAMFS}"
then 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 cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz
fi fi
if ! isTrue "${CMD_NOINSTALL}" if ! isTrue "${CMD_NOINSTALL}"
then then
if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' ] if ! isTrue "${INTEGRATED_INITRAMFS}"
then then
copy_image_with_preserve "initramfs" \ copy_image_with_preserve "initramfs" \
"${TMPDIR}/initramfs-${KV}" \ "${TMPDIR}/initramfs-${KV}" \

@ -348,10 +348,10 @@ create_initrd() {
"initrd-${KNAME}-${ARCH}-${KV}" "initrd-${KNAME}-${ARCH}-${KV}"
fi fi
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] # if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
then # then
# Pegasos hack for merging the initramfs into the kernel at compile time # # 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 && # cp ${TMPDIR}/initrd-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz &&
rm ${TMPDIR}/initrd-${KV} # rm ${TMPDIR}/initrd-${KV}
fi # fi
} }

@ -8,7 +8,7 @@ gen_minkernpackage() {
then then
/bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernel-${ARCH}-${KV} /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernel-${ARCH}-${KV}
/bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} config-${ARCH}-${KV} /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} config-${ARCH}-${KV}
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${GENZIMAGE}"
then then
/bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernelz-${ARCH}-${KV} /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernelz-${ARCH}-${KV}
fi fi
@ -16,13 +16,13 @@ gen_minkernpackage() {
cd "${KERNEL_DIR}" cd "${KERNEL_DIR}"
cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!' 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!' 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 then
cp "${KERNEL_BINARY_2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package" cp "${KERNEL_BINARY_2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package"
fi fi
fi fi
if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' ] if ! isTrue "${INTEGRATED_INITRAMFS}"
then then
if [ "${KERN_24}" != '1' ] if [ "${KERN_24}" != '1' ]
then 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_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}/.config" "${TEMP}/kerncache/config-${ARCH}-${KV}"
cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}" cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}"
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${GENZIMAGE}"
then then
cp "${KERNEL_BINARY_2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package" cp "${KERNEL_BINARY_2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package"
fi fi
@ -98,7 +98,7 @@ gen_kerncache_extract_kernel()
"${TEMP}/kernel-${ARCH}-${KV}" \ "${TEMP}/kernel-${ARCH}-${KV}" \
"kernel-${KNAME}-${ARCH}-${KV}" "kernel-${KNAME}-${ARCH}-${KV}"
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ] if isTrue "${GENZIMAGE}"
then then
copy_image_with_preserve "kernelz" \ copy_image_with_preserve "kernelz" \
"${TEMP}/kernelz-${ARCH}-${KV}" \ "${TEMP}/kernelz-${ARCH}-${KV}" \

@ -231,10 +231,6 @@ then
# KV may have changed due to the configuration # KV may have changed due to the configuration
get_KV 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 # Compile modules
if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ] if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ]
then then
@ -247,13 +243,6 @@ then
[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels [ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}" cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
fi fi
if [ "${KERNCACHE}" != "" ]
then
if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq 0 ]
then
gen_kerncache
fi
fi
fi fi
if ! isTrue "${CMD_NOINSTALL}" if ! isTrue "${CMD_NOINSTALL}"
@ -326,10 +315,8 @@ else
print_info 1 'initrd: Not building since only the kernel was requested...' print_info 1 'initrd: Not building since only the kernel was requested...'
fi fi
# Pegasos fix if isTrue "${INTEGRATED_INITRAMFS}" || [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' -o ${BUILD_INITRAMFS} -eq 1 ]
then then
# Compile kernel, intergrating the initrd into it for Pegasos & mips
compile_kernel compile_kernel
# We skipped the kernel build and kerncache generation # We skipped the kernel build and kerncache generation

Loading…
Cancel
Save