diff options
author | Richard Yao <ryao@gentoo.org> | 2013-06-05 23:14:18 -0400 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2013-06-09 09:56:25 -0400 |
commit | f40842d6b6565aeb9df673efd88578b545056e53 (patch) | |
tree | 0fdfa56438f19783fc5397edf6ea8bd8d7b016c1 | |
parent | Add more module loading features (diff) | |
download | genkernel-f40842d6b6565aeb9df673efd88578b545056e53.tar.gz genkernel-f40842d6b6565aeb9df673efd88578b545056e53.tar.bz2 genkernel-f40842d6b6565aeb9df673efd88578b545056e53.zip |
Remove duplicate files from initramfs
genkernel's initramfs image is built incrementally by appending to the
cpio file. The introduction of copy_binaries resulted in copying
libraries from the host system, which causes the cpio to include certain
libraries multiple times whenever different stages depended upon the
same library. We address this by extracting the cpio to a temporary
directory and then compressing it again to "finalize" it. The extraction
eliminates the duplicate files.
This makes generated initramfs images slightly smaller and in theory,
should make the initramfs load slightly faster.
Signed-off-by: Richard Yao <ryao@gentoo.org>
-rwxr-xr-x | gen_initramfs.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 9b354a4..f53f528 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -800,6 +800,20 @@ create_initramfs() { append_data 'overlay' fi + # Finalize cpio by removing duplicate files + print_info 1 " >> Finalizing cpio..." + local TDIR="${TEMP}/initramfs-final" + mkdir -p "${TDIR}" + cd "${TDIR}" + + cpio --quiet -i -F "${CPIO}" 2> /dev/null \ + || gen_die "extracting cpio for finalization" + find . -print | cpio ${CPIO_ARGS} -F "${CPIO}" 2>/dev/null \ + || gen_die "recompressing cpio" + + cd "${TEMP}" + rm -r "${TDIR}" + if isTrue "${INTEGRATED_INITRAMFS}" then # Explicitly do not compress if we are integrating into the kernel. |