Busybox upgraded in initrd

I was testing USB storage detection at bootup, using the 2.6.27.4 kernel (source from Ubuntu), and found something really odd. The 'init' script runs 'dmesg' to see how many USB drives are found, and waits in a loop until the scan is complete. Inside the initrd, I ran 'dmesg' and it gave these lines:

<7> usb-storage: device found at 2
<7> usb-storage: device found at 2
<7> usb-storage: device found at 3
<7> usb-storage: device scan complete
<7> usb-storage: device scan complete

The above is interspersed with other lines. The weird thing is the duplicate line, and that causes the wait loop to wait for the timeout, which is 25 seconds, as the loop just compares the number of "device found" lines and waits until there are the same number of "device scan complete" lines.

What the 'init' script does is loop for a full 25 seconds, whereas a couple of seconds would have most likely been enough. I fixed it by putting a 'sort -u' to get rid of the duplicate lines, but the problem was that the initrd did not have a 'sort' application.

That leads me to Busybox. The initrd has Busybox version 1.4.1, however the latest is 1.12.1, so I downloaded and compiled that statically in a uClibc root f.s. I enabled a lot more applets, including 'sort'.


Posted on 11 Nov 2008, 18:29


No comments posted yet.