Subject: Re: [blfs-dev] initramfs Jeremy Huntwork wrote: > On 2/21/12 8:51 PM, Bruce Dubbs wrote: >> Very interesting. I took your scripts and hacked them a bit. I set it up > > Oh, one other thing that I was going to do at some point but also hadn't > gotten around to yet was to pull in the required dynamic libs, well, > dynamically. Perhaps parse output from ldd on the binaries and bring in > the required libs instead of hard-coding them in the script. Like this? $ cat list-libs.sh #!/bin/sh binfiles="sh cat cp dd killall ls lsmod mkdir mknod mount " binfiles="$binfiles umount sed sleep ln rm uname" sbinfiles="udevadm udevd modprobe blkid switch_root mdadm" $unsorted=$(mktemp /tmp/unsorted.XXXXXXXXXX) for f in $binfiles; do ldd /bin/$f | sed "s/\t//" | cut -d" " -f1 >> $unsorted done for f in $sbinfiles; do ldd /sbin/$f | sed "s/\t//" | cut -d" " -f1 >> $unsorted done sort $unsorted | uniq | while read lib ; do if [ "$lib" == "linux-vdso.so.1" ] || [ "$lib" == "linux-gate.so.1" ]; then continue fi basename $lib done rm $unsorted -------------- $ sh list-libs.sh ld-linux-x86-64.so.2 libblkid.so.1 libc.so.6 libdl.so.2 libhistory.so.6 libncursesw.so.5 libpthread.so.0 libreadline.so.6 librt.so.1 libuuid.so.1 libz.so.1 -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page |