site  contact  subhomenews

Busybox 1.18.5 in initramfs

July 10, 2011 — BarryK
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:

cp
-u option is not supported.

find
-noleaf, -not options not supported.

losetup
needed options not supported.

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

modprobe
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.

Comments

xargs applet no good
Username: BarryK
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.

cp -u alternative
Username: technosaurus
"for cp -u , I modded the code like this: [code] [ '$SRC' -nt '$DEST' ] && cp -f $SRC $DEST [/code] and just in case you need same filesystem support --one-file-system|-x) [code] [ `stat -c %d $SRC |uniq` != `stat -c %d $DEST` ] && cp ... [/code] 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???

Re cp -u
Username: BarryK
"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.


Tags: woof