diff options
author | Richard Yao <ryao@cs.stonybrook.edu> | 2012-01-27 20:08:58 -0500 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-01-28 20:17:00 +0000 |
commit | 73520cb6b2e2479bf230d114d0dcb90f6ccd100c (patch) | |
tree | 087679e3f36c084f78901218e5f3fd937cae2277 /gen_initramfs.sh | |
parent | Bump version to 3.4.24 (diff) | |
download | genkernel-73520cb6b2e2479bf230d114d0dcb90f6ccd100c.tar.gz genkernel-73520cb6b2e2479bf230d114d0dcb90f6ccd100c.tar.bz2 genkernel-73520cb6b2e2479bf230d114d0dcb90f6ccd100c.zip |
Implement --[no-]compress-initramfs option to complement --[no-]integrated-initramfs
When using an integrated initramfs (including in kernel during build),
it's better NOT to compress the initramfs, as the kernel build process
will then be re-compressing it. This can provide space savings on disk
as well as potential time & memory savings (one less decompress pass is
needed before the kernel can use the initramfs).
This functionality was previously available in the undocumented
COMPRESS_INITRD variable.
Code-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
(commit message rewritten).
Diffstat (limited to 'gen_initramfs.sh')
-rwxr-xr-x | gen_initramfs.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gen_initramfs.sh b/gen_initramfs.sh index cfcfe979..32a1b1e0 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -631,6 +631,7 @@ append_data() { } create_initramfs() { + local compress_ext="" print_info 1 "initramfs: >> Initializing..." # Create empty cpio @@ -673,16 +674,23 @@ create_initramfs() { append_data 'overlay' fi - gzip -9 "${CPIO}" - mv -f "${CPIO}.gz" "${CPIO}" + # Implement support for disabling compression + if isTrue "${COMPRESS_INITRD}" + then + compress_ext=".gz" + print_info 1 " >> Compressing cpio data..." + gzip -9 "${CPIO}" || gen_die "Compression failed" + mv -f "${CPIO}.gz" "${CPIO}" || gen_die "Rename failed" + fi + if isTrue "${INTEGRATED_INITRAMFS}" then # cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/usr/initramfs_data.cpio.gz - mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio.gz + mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio${compress_ext} # sed -i "s|^.*CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"|" ${KERNEL_DIR}/.config sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_DIR}/.config - echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config + echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio${compress_ext}\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config fi if isTrue "${CMD_INSTALL}" |