Next: Other Useful Resources
Up: Getting Linux into Small
Previous: Using the Boot Disks
Contents
We showed you how to create a boot diskette with one set of
features. Now you know how to do this, you should be able to customize
it to your needs. You can turn it into a full featured rescue disk, an
installation disk for your brand new Linux distribution, a
demonstration disk or an embedded project, such as a router or print
server.
First try to add kernel module support. Modules come in very handy for
devices that are seldom used or are only available on some target
systems. Serial ports, network adapters and SCSI features may be
candidates for compiling as modules, as well as additional file
systems. In order to use modules you have to
do the following:
- Reconfigure the kernel with module support enabled. Configure
certain features to be compiled as modules.
- Rebuild the kernel.
- Run the additional make step make modules.
- Copy the kernel to the boot disk (and run LILO if necessary).
- Copy the modules to the root file system or a different
diskette.
- Rebuild busybox with the insmod and rmmod commands
enabled. Move this to the root file system as well.
- If you use a RAM disk, you should recreate a RAM disk image,
compress it and rerun LILO on your boot disk . If you hadn't made a
shell script to perform all these tasks, you should do by now.
One additional feature that you might try (it only exists in 2.4
kernels) is the devfs file system. Instead of a /dev
directory with hundreds of useless device node you mount a pseudo file
system on the /dev directory, not unlike the /proc file
system. There the device nodes appear for only the devices that exist.
After module support you may want to add network support. Once you
have added an Ethernet adapter to your old 386, you can connect it to
your LAN and you do not need diskettes so often. With a little bit of
luck, this still runs on a 4MB machine, but forget about using a RAM
disk.
- Rebuild the kernel with networking enabled. Of course you have
to rebuild the modules as well.
- Rebuild Busybox with network commands enabled (ifconfig, telnet,
ping etc.)
- Copy all relevant files to their respective places.
- Recreate the RAM disk image and rerun LILO if appropriate.
You can add additional programs and libraries to the target system.
- Many programs need curses. The ncurses library is reported
to be usable with uClibc. You must recompile it in order to
achieve this. You will probably need a stripped down termcap file on
your target system as well.
- With ncurses and the standard libraries of uClibc,
you should really be able to compile a lot of programs that do not
require X.
- Some make files try to run the programs you have just
built. This can be a problem. It should be possible to copy the uClibc shared libraries to the /lib directory of the host
system, as their names are different from the glibc
libraries. The programs linked against glibc will still work
and the uClibc programs will work too. I just haven't tried
this, so don't do it on a life-critical system or if you haven't
made a backup.
- Even gcc and X are reported to work with uClibc, so give them a try! A target system with uClibc as
the only C library should therefore be able to run a C development
environment and X. Building this is certainly not for beginners.
The RAM disk version of the boot disk runs on a 4MB machine, the
version without RAM disk should run with 3MB or RAM, but nothing so
far has run on a machine with just 2MB of RAM. In the good old days,
people ran Linux routinely on such machines and it should still be
possible with modern (if not the newest) software. Some hints:
- Do not use a RAM disk.
- Remove more features from the kernel. RAM disk support can be
removed, use the disk-only driver instead of the more functional IDE
driver, remove file systems such as FAT and ISO9660. If you do have
a 387 in that 2MB box, get rid of math emulation.
- Use an older kernel, 2.2 or even 2.0. Note: if you use 2.0,
remember to use the -O none option on mke2fs if you make a
file system for the target system. Kernel 2.0 does not understand
some features added by later kernels.
- Remove more functions from busybox. This should not help much as
busybox will be demand loaded. Parts that are not demanded, will not
be loaded. It may help to a certain degree. Features like color ls and command line editing can be removed and a more primitive
shell can be utilized.
- Remove init and start /bin/sh directly at startup.
- If this lets you do do fdisk, mkswap and swapon, you can get swapping enabled on the target system. From
there you should be fine.
Next: Other Useful Resources
Up: Getting Linux into Small
Previous: Using the Boot Disks
Contents
Lennart Benschop
2003-05-29