# 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
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() {
--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
"System.map" \
"System.map-${KNAME}-${ARCH}-${KV}"
- if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+ if isTrue "${GENZIMAGE}"
then
copy_image_with_preserve "kernelz" \
"${KERNEL_BINARY_2}" \
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}!"
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
then
mkdir -p `dirname ${KERNCACHE}`
fi
+
+ if ! isTrue "${BUILD_INITRD}"
+ then
+ INTEGRATED_INITRAMFS=0
+ fi
get_KV
}
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}" \
"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
}
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
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
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
"${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}" \
# 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
[ ! -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}"
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