Next: Building Busybox
Up: Making Linux Installation Disks
Previous: First Preparation
Contents
The trickiest part to get right is probably the C library, especially
because we want to use shared libraries. The space savings are
tremendous and once this is done right, you can fit many more
utilities on a diskette. The directory where the shared libraries exist
on the target system (where they will be used) is different from the
directory where they exist on the host system. Without special tricks,
the binaries that are compiled with uClibc won't run on the host
system.
First create the following subdirectories under the myboot
directory.
- uclibc-dev is the directory that contains everything you
need to compile programs with uClibc. It contains the include
files for the uClibc library and special versions of gcc
and similar programs. In fact it is a kind of cross-compiler, albeit
for the same processor architecture.
- rootfs is the directory where everything goes that will be
on your bootable diskette.
Next cd into the myboot/uClibc-0.9.20 directory. There run the
following command:
make menuconfig
Next set the following configuration options in the menu:
- Target architecture features and options: set target CPU to 486 and
leave the rest at the defaults. Do not forget to set the correct kernel
source. Fill in $(MYBOOT)/linux-2.4.21. MYBOOT must be in normal
(round) parentheses.
- General Library settings: disable support for global constructors and
destructors and profiling, leave the rest at the defaults.
- Networking support: enable RPC support, it's useful for NFS mounts.
- Library installation options. This it the trickiest part.
- Set shared Library Loader path (first item) to /lib. This is
the libraries will be loaded on the target diskette, so any prefix must be
left out.
- Set uClibc environment directory (second item) to
$(MYBOOT)/uclibc-dev. This is where all files will end up that are needed
by the C compiler when compiling and linking programs with uClibc.
Run the following commands to make and install the library. Note that
we do not install the library as root as we do not install it in
a system-wide directory.
make
make install
make PREFIX=$MYBOOT/rootfs install_target
The first command compiles the libraries, the second command installs
the development code into the uclibc-dev directory and the last
command installs the shared libraries into the rootfs directory. These
will end up on the root file system of the bootable diskette.
Compiling with uClibc can be as simple as putting the uclibc-dev
directory first in your path and just running make. Note that
you cannot run the programs you have just made on the host system.
Next: Building Busybox
Up: Making Linux Installation Disks
Previous: First Preparation
Contents
Lennart Benschop
2003-07-16