From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RuJng-00043G-U0 for garchives@archives.gentoo.org; Mon, 06 Feb 2012 08:19:49 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5730DE05FE; Mon, 6 Feb 2012 08:19:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2B662E05FE for ; Mon, 6 Feb 2012 08:19:36 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3F66E1B4041 for ; Mon, 6 Feb 2012 08:19:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B14AF8004F for ; Mon, 6 Feb 2012 08:19:34 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1079122ea0c1733024dbebadd2ae8ad2c88a9bee.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: ChangeLog gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 1079122ea0c1733024dbebadd2ae8ad2c88a9bee Date: Mon, 6 Feb 2012 08:19:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: c14c25d5-fca6-4ec5-b755-916914c3a422 X-Archives-Hash: 22e6be08924753b5f60f2ee90fd66f43 commit: 1079122ea0c1733024dbebadd2ae8ad2c88a9bee Author: Richard Yao cs stonybrook edu> AuthorDate: Wed Feb 1 03:20:49 2012 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Mon Feb 6 08:19:17 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/genkernel.git= ;a=3Dcommit;h=3D1079122e copy_binaries: utility function to pick up a binary and needed libs The existing multipath functionality manually picks up a binary and lots of needed libraries manually, and sometimes misses libraries if the binary was linked against something else. Use lddtree from app-misc/pax-utils to get all libraries with the binary. The only ones that will be missed are those that are dlopen()ed. cpio is used for copying to preserve directory structure. lddtree usage replaces a larger manual function from calling ldd, that was also vulnerable to injections. Signed-off-by: Robin H. Johnson gentoo.org> (commit message rewritten) --- ChangeLog | 4 ++++ gen_initramfs.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc8be73..5115896 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ # Distributed under the GPL v2 # $Id$ =20 + 06 Feb 2012: Richard Yao gen_initramfs.sh: + copy_binaries utility function for putting binaries and librares into + initramfs (see git commit for full details). + 06 Feb 2012; Robin H. Johnson defaults/initrd.scr= ipts: Support virtio devices, and provide fallback of all remaining devices. =20 diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 32a1b1e..b96e36e 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -3,6 +3,15 @@ =20 CPIO_ARGS=3D"--quiet -o -H newc" =20 +copy_binaries() { + + local destdir=3D$1 files=3D$2 + + # Copy files + lddtree $files | tr ')(' '\n' |awk '/=3D>/{ if($3 ~ /^\//){print $3}}'= | sort | uniq | cpio -p --make-directories --dereference --quiet $destdi= r + +} + append_base_layout() { if [ -d "${TEMP}/initramfs-base-temp" ] then