Busybox 1.18.5 in initramfs

Up until now, the initramfs has used Busybox 1.4.2, an old version. I intend to compile a recent kernel and investigate reported problems with USB, and some code I contemplate putting into the 'init' script in the initramfs needs the 'xargs' application -- which the old Busybox doesn't have (or rather, is not configured to have xargs), so I decided to upgrade Busybox.

The initramfs is using full versions of 'cp', 'find', 'grep', 'losetup', 'lsmod', 'modinfo', and 'modprobe', as the old Busybox applets are inadequate. With the upgrade, I have checked out whether the BB applets are now suitable. Unfortunately, mostly not.

For BB 1.18.5, I have had to keep these full programs:

-u option is not supported.

-noleaf, -not options not supported.

needed options not supported.

Broken, is supposed to treat 'usb-storage' and 'usb_storage' as equivalent. Also, does not return all informnation ('Depends:' field is missing).

inadequate. modprobe still does not support a modalias on commandline.

However, I have promoted 'grep' and 'rev' to use the Busybox applets.

The new Busybox static executable is now in Woof, along with the '.config' file (also now have the 'bbconfig' applet, that prints out the configure settings).
I did a test build, seems to work ok.

Posted on 10 Jul 2011, 10:36


Posted on 10 Jul 2011, 21:13 by BarryK
xargs applet no good
After going through all of the above, I have discovered that the Busybox 'xargs' applet does not support the '-l' option, what I consider to be the most useful option for xargs and what I need to use in the 'init' script.

So, I have compiled the 'findutils' package statically in uClibc and got 'xargs' from it.

Posted on 11 Jul 2011, 14:06 by technosaurus
cp -u alternative
for cp -u , I modded the code like this:

[ '$SRC' -nt '$DEST' ] && cp -f $SRC $DEST

and just in case you need same filesystem support

[ `stat -c %d $SRC |uniq` != `stat -c %d $DEST` ] && cp ...

another "*" from my init notes:
if you choose BUSYBOX_PREFER_APPLETS (for a considerable speed increase), make sure not to configure applets that require full versions (otherwise use full path)

Hopefully the square brackets survive the posting???

Posted on 11 Jul 2011, 16:22 by BarryK
Re cp -u
Umm, I don't understand. The -u works on a per-file basis. So,

cp -u src dest

if src is a directory (with subdirectories and files), then the -u will be checked against every file copied, and only copied if newer.

Similarly, keeping to the same filesystem applies to all sub-directories to be copied.