Next: First Preparation
Up: Getting Linux into Small
Previous: Contents
Contents
Subsections
This document serves as an instruction to build a minimal Linux system
for use on rescue diskettes, installation diskettes and embedded
projects.
The Bootdisk Howto from the Linux Documentation Project also describes
how to build a bootable diskette, but a diskette created in this way
has a few shortcomings:
- It carries a lot of ballast such as inittab, getty and
login. For a simple to use rescue disk, these programs and their
associated configuration files are not necessary.
- It contains full featured GNU shell utilities that occupy a lot
of space.
- It contains the real GNU C libraries, which are very large indeed.
Therefore a boot disk created in this way contains not many useful
programs and it needs a comparatively large RAM disk to load. If you
have 8MB of RAM, this works, but you can forget this on a 4MB or even
2MB machine.
There are two excellent software packages that are specially designed
for saving precious memory and disk space when you are on a tight budget:
- Busybox
is a
combination of a Unix shell and many common Unix utility programs in
a single executable. The size of Busybox is about half that of the
typical bash shell and at that it already contains a few dozen
Unix commands, ranging from ls to gzip. These are
trimmed down versions of course, but adequate in most cases.
- uClibc
is a
scaled down Unix library. The GNU C library is huge, has every
feature on the planet and adheres to every conceivable standard on
every conceivable platform. uClibc is adequate for many applications
and uses much less space.
While the use of Busybox on rescue disks is common, uClibc is rarely
used. There are toolkits to create Busybox based diskettes, but IMHO there is
no good instructional document that describes how to create a bootable Linux
diskette with both Busybox and uClibc. The BootE
diskette
is a bootable Linux diskette with Busybox and uClibc. When I wrote the original text, there used to be no
instructions on the site how to customize that disk to your needs, but now at
least there is a tar archive with useful scripts and documentation.
In order to achieve huge space savings, we need to recompile
everything from source.
Suppose we have an old 386 machine in the basement that comes with
only 4MB of RAM. We want to show our friends that this old beast can
still run Linux.
We must be able to perform the following tasks:
- Partition a hard disk.
- Make a swap partition on the hard disk an use it.
- Create an ext2 file system on the hard disk and make it usable as the
root file system.
- Mount diskettes and a hard disk.
- Edit files.
So basically we have everything to install a Linux root file system on
the hard disk.
In order to get a Linux system up and running we need the following items:
- A boot loader. This program is loaded by the PC BIOS and this
makes it possible to load another program, such as the Linux kernel.
- the Linux kernel. This is the heart of the operating system.
- a root file system. This is the file system that is mounted when
the kernel is started. The first program that runs (typically /sbin/init has to be in the root file system. The root file system
can exist on a diskette, it can be loaded in RAM at boot time or it
can exist on the hard disk.
The root file system has to contain the following items:
- Binaries that we want to run.
- Startup scripts and other configuration files.
- Shared libraries.
- Device files.
- Mount points.
The host system is the computer on which we build the bootable
diskette. It is assumed to be a fairly modern PC with a modern
installation of Linux. We will assume that it is a Pentium with at
least 32MB of RAM.
Also we assume that it contains a modern Linux system that contains
the following software:
- Linux kernel 2.4
- recent gcc (2.95 or later)
- Loop devices (a kernel feature that allows you to mount a file
system on a file instead of a block device).
- Bzip2
- a recent LILO
You will need lots of hard disk space. Around 300MB would be
enough. The unpacked Linux kernel source tree alone takes around 150MB
these days. Paradoxically enough the end result will fit on a single
1.44MB diskette.
The target system is an old 386 PC with 4MB of RAM or more and zero,
one or two hard disks.
Next: First Preparation
Up: Getting Linux into Small
Previous: Contents
Contents
Lennart Benschop
2003-05-29