Mini Linux Busybox + Kernel + Compile New Softwares to rootfs

James Bowlin bitjam at gmail.com
Mon Aug 11 03:33:47 UTC 2014


On Sun, Aug 10, 2014 at 01:24 PM, Steven Honeyman said:

> I'd like a look at that script if you wouldn't mind? Just out of
> curiosity more than anything, could come in handy one day!

I've attached a tarball that contains the script and nothing else.
I worked on it last night to make it more useful to me and to
make it more presentable to others.  Here is the usage:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usage: grab-libs [options] <program>

Create a $program-libs directory in the CWD and copy all libs
needed to run the program into that directory.  If an absolute
path the the program is not included then we search for the
program on a reasonable path:

    /usr/local/bin /usr/sbin /usr/bin /sbin /bin

Options:
   -h --help       Show this help
   -f --force      Overwrite $program-libs directory
   -p --prefix     Directory prefix for grabbing libs
   -v --verbose    Print more

Short options can be stacked.  Example:

    grab-libs -fvp <directory> <program>

The --prefix option allows you to grab libraries from, for
example, a mounted squashfs file even if the architecture (64 or
32 bit) does not match that of the host system.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The --prefix option is pretty neat.  It allow you to grab
libraries out of a mounted squashfs file or out of a copy of a
filesystem.  For example if you have a squashfs of a Linux
filesystem (such as those found in many live iso files) mounted
at /mnt/sq1 then the following command will extract the libs need
for the "ls" command:

    ./grab-libs --prefix /mnt/sq1 ls

I need to do a chroot into the prefix directory.  If you are not
root I use sudo to run the chroot.  I look for the ls command at
the usual places under the prefix directory and then I extract
the names of the libs it needs inside the chroot.  If the command
you want is not in the usual places then just provide the full
path:

  ./grab-libs --prefix /mnt/sq1 /bin/ls

I have not tested it extensively so there are probably a few bugs
still in it but I don't think it will do any damage.  the target
filesystem needs to have the ldd command at /usr/bin/ldd.  I
could search for it in the usual places.  It works here without
mounting anything (/dev/, /sys, /proc) in the prefix directory so
I have omitted that step. 


Peace, James

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grab-libs-0.1.tgz
Type: application/x-compressed-tar
Size: 1686 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140810/5c7a4455/attachment-0001.bin>


More information about the busybox mailing list