logo

bootstrap-initrd

Linux initrd generator to bootstrap a POSIX-ish system from a reasonably small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: ba8bcb2791540d31174b6c7daaf44e62c0e692ec
parent 0006b04f9b2f4be2131b6a0d63dd3f16374bdb5d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 31 Mar 2022 18:36:59 +0200

Switch from hacky ldd to lddtree

Diffstat:

Mmake-initrd.sh11++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/make-initrd.sh b/make-initrd.sh @@ -45,15 +45,8 @@ chmod 755 init || die "init chmod" ln bin/mksh bin/sh bin/busybox --install usr/bin -for bin in $(find bin); do - if ldd "$bin" >/dev/null - then - for lib in $(ldd "$bin" | sed -nre 's,.* (/.*lib.*/.*.so.*) .*,\1,p') - do - filename=$(basename "$lib") - test -e "/lib/${filename}" || cp "$lib" lib - done - fi +for lib in $(find bin -type f -exec lddtree -l {} + | grep -v bin/ | sort | uniq); do + cp "$lib" lib/ done if find . -print0 | cpio --null -ov --format=newc | xz -9 --check=crc32 > "../${out_base}.cpio.xz"; then