Busybox recompiled for initramfs

The initramfs ("initial ramdisk") has busybox version 1.4.2, statically compiled with uClibc. That was last done on 12 Nov. 2008. I have now recompiled it, kept the same version, and added more applets, plus enhanced the features of some. Fascinating, the busybox executable has grown from 253KB to 272KB, only 19KB, even though I have turned on help-text for each applet (the help text is internally compressed).

I have reasons for wanting these extra applets, as will come clear in time. Here is the Fossil commit:

http://bkhome.org/fossil/woof.cgi/vinfo/8fbef54932b0355f6d3bb62fe6a98ecf4a56e875

I turned on support for '--help', so am able to provide the following information:

NEW APPLETS

dc

Usage: dc expression ...

This is a Tiny RPN calculator that understands the
following operations: +, add, -, sub, *, mul, /, div, %, mod, **, exp, and, or, not, eor.
For example: 'dc 2 2 add' -> 4, and 'dc 8 8 \* 2 2 + /' -> 16.

Options:
p - Prints the value on the top of the stack, without altering the stack
f - Prints the entire contents of the stack without altering anything
o - Pops the value off the top of the stack and uses it to set the output radix
Only 10 and 16 are supported

halt
Usage: halt [-d<delay>] [-n<nosync>] [-f<force>]

Halt the system

Options:
-d Delay interval for halting
-n No call to sync()
-f Force halt (don't go through init)

loadfont
Usage: loadfont < font

Load a console font from standard input

loadkmap
Usage: loadkmap < keymap

Load a binary keyboard translation table from standard input

more
Usage: more [FILE ...]

View FILE or standard input one screenful at a time

pipe_progress
No help available

poweroff
Usage: poweroff [-d<delay>] [-n<nosync>] [-f<force>]

Halt and shut off power

Options:
-d Delay interval for halting
-n No call to sync()
-f Force power off (don't go through init)

reboot
Usage: reboot [-d<delay>] [-n<nosync>] [-f<force>]

Reboot the system

Options:
-d Delay interval for rebooting
-n No call to sync()
-f Force reboot (don't go through init)

setkeycodes
Usage: setkeycodes SCANCODE KEYCODE ...

Set entries into the kernel's scancode-to-keycode map,
allowing unusual keyboards to generate usable keycodes.

SCANCODE may be either xx or e0xx (hexadecimal),
and KEYCODE is given in decimal

setlogcons
Usage: setlogcons N

Redirect the kernel output to console N (0 for current)


ENHANCED APPLETS
The following applets existed before, but I have enhanced their features...

pidof

Usage: pidof process-name [OPTION] [process-name ...]

List the PIDs of all processes with names that match the
names on the command line
Options:
-s Display only a single PID
-o Omit given pid
Use %PPID to omit the parent pid of pidof itself

readlink
Usage: readlink [-f] FILE

Display the value of a symbolic link

Options:
-f Canonicalize by following all symlinks

tr
Usage: tr [-cds] STRING1 [STRING2]

Translate, squeeze, and/or delete characters from
standard input, writing to standard output

Options:
-c Take complement of STRING1
-d Delete input characters coded STRING1
-s Squeeze multiple output characters of STRING2 into one character

...it is not documented here, but enhanced functionality is to convert between upper-case and lower-case.



Posted on 20 Nov 2009, 17:48


Comments:

Posted on 20 Nov 2009, 24:25 by clarf
Busybox in Puppy 214x
Hi Barry, Those new and enhacend applets seems interesting, it could help to improve the initial ram disk features in all Puppy versions.

Is there a fast way to update initramfs from 214X with your enhaced Busybox?. Should I think that copying the busybox binary (and symlinks) to the uncompressed initrd directory is enough?.

Thanks in advance for any information you could give me.

clarf




Posted on 21 Nov 2009, 6:28 by BarryK
busybox
yes, certainly, the new busybox could be put into the initrd of any version of puppy.

Doing that on it's own though, won't achieve anything, just set the stage for improvements to the 'init' script.



Posted on 21 Nov 2009, 7:08 by clarf
Init development
yes Barry, thatīs the idea improvements to the init script and also make the init development easier.

I had problems in 214X trying to test/debug my code, because in 214R (base Puppy for 214X) Dougal removed some basic applets in Busybox and command line help, so I learned what Busybox is in the hard way...

Another dirt question Barry, I saw that many initrd files are based in ext2 FS, What could be the advantage using ext3 FS (if any)?.

Thanks again and excuse me if I ask too much.

clarf


Posted on 21 Nov 2009, 7:43 by BarryK
Busybox
Another dirt question Barry, I saw that many initrd files are based in ext2 FS, What could be the advantage using ext3 FS (if any)?.

I'm not sure what you mean by this. The pupsave file? That is ext2 because it gets mounted by a loop device, and it is not recommended to use a loop device with a journaled filesystem.

You can get the busybox binary out of my Woof tarball:

http://bkhome.org/binaries/woof/



Posted on 21 Nov 2009, 10:46 by clarf
initrd FS
Thanks for the info Barry,

but I mean about initrd.gz, when I want to create a initrd FS I use something like:

dd if=/dev/zero of=initrd bs=1024 count=1500

mke2fs -F -m 0 -b 1024 initrd 1500


mk2fs can create a ext2 or ext3 FS, Is there any difference for the resulting initial ramdisk (initrd)?.

Hope not making a real stupid question, but thereīs little info about initrd FS.

Thanks in advance.

clarf



Posted on 21 Nov 2009, 15:51 by BarryK
ext2 initrd
Ha ha, that's ancient history!

Yes, for Puppy 2.x the initrd has to be ext2, that's what the kernel understands.

Later puppies, not sure what version it started with, maybe 4.0, the "initrd" is now an "initramfs" that is has the initramfs filesystem, not ext2. It is created as a cpio archive, not a file with ext2 f.s.

One advantage of the initramfs is that it can be any size, not restricted to whatever is specified for a ramdisk. The kernel is able to manage it in RAM more efficiently.



Posted on 22 Nov 2009, 22:14 by clarf
Thanks
Thanks for the explanation Barry.

Iīll try to follow development in newer Puppy series and Woof system, somehow Iīm living in the past:). Although keep developing/support 214X (some propaganda here...)

Greetings,
clarf