From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 06291138200 for ; Sun, 9 Jun 2013 09:58:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5A0F3E07FB; Sun, 9 Jun 2013 09:58:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 95F2CE081D for ; Sun, 9 Jun 2013 09:58:22 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AA2E033E30A for ; Sun, 9 Jun 2013 09:58:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 55229E5462 for ; Sun, 9 Jun 2013 09:58:20 +0000 (UTC) From: "Richard Yao" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Richard Yao" Message-ID: <1370771856.b4cccb138ec881c3c1e0610873d0a8a2f6a580fa.ryao@gentoo> Subject: [gentoo-commits] proj/genkernel:ryao commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: ryao X-VCS-Committer-Name: Richard Yao X-VCS-Revision: b4cccb138ec881c3c1e0610873d0a8a2f6a580fa X-VCS-Branch: ryao Date: Sun, 9 Jun 2013 09:58:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f0213295-5f4e-495b-99f7-35399192ba36 X-Archives-Hash: e81fedbfb56616a95d2068a2688e5e0a commit: b4cccb138ec881c3c1e0610873d0a8a2f6a580fa Author: Richard Yao gentoo org> AuthorDate: Thu Jun 6 03:14:18 2013 +0000 Commit: Richard Yao gentoo org> CommitDate: Sun Jun 9 09:57:36 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=b4cccb13 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 gentoo.org> --- gen_initramfs.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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.