[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: what's the best small shell for initrd?



Hello Russel,

On Tue, Jul 17, 2001 at 09:28:03PM +0200, Russell Coker wrote:
> How can we make the smallest image for initrd?
> 
> Currently /bin/sleep drags in libpthread, libm, and librt.
> 
> Also insmod, modprobe, raidstart, and echo are all linked with libc6.

As already answered by others, you can have insmod in BusyBox with another
bunch of tools, and BB statically compiled against uClibc is something like
260ko _not_ compressed. Since modprobe finally calls insmod, you can emulate
it via a script, so a good small shell accepting scripts is mandatory.
> 
> How difficult is the ash shell to hack on?
> 
> Would anyone be interested in a version of ash that's statically linked and 
> which incorporates the functionality of insmod, modprobe, raidstart, and 
> sleep (without dragging in libpthread etc)?

There are already several versions of ash in Debian. I have made a "port" of
the last OpenBSD version so that it compiles against Glibc and uClibc, and
one can find it here :

http://cvs.pingoo.org/cgi-bin/cvsweb/dei/chiron/ash

For example, statically compiled against uClibc, with historic the result is
a 200ko executable. Without historic: a little more than 100ko.

But if one wants a great shell with historic, completion, `which' like
functionnality and so on, the best choice is Public Domain Korn Shell
`pdksh'. This compiles without problem against glibc, and one just add
"-D_GETOPT_H" with optimization of size flags to compile against uClibc.

pdksh, statically compiled against uClibc, with historic, completion and so
on is 178ko. This SHOULD be the system shell of a Debian system :-^
[a system shell _must_ be statically compiled].

With all combined, you can have easily less than 400K initrd.

BB and uClibc are great...

Cheers,
-- 
Thierry LARONDE, Centre de Ressources Informatiques, Archamps - France
http://www.cri74.org/



Reply to: