Next: Other Essential Binaries
Up: Getting Linux into Small
Previous: Building uClibc
Contents
First cd into the myboot/busybox-0.60.3 subdirectory.
Edit the file Conf.h as follows:
- Add or remove support for programs you do or do not want. For
each program there is a #define BB_XXX line that can be
commented out or not. Uncomment the BB_VI line, as you would
probably need an editor. Leave the network related programs
commented out if you do not enable network support, otherwise
uncomment them. In our example we will not use network support. It's
basically your choice what to put in or not. Though it may be
possible to start Linux with an interactive shell instead of init,
we will leave the init program in.
- Uncomment the BB_FEATURE_USE_TERMIOS line.
Edit the Makefile as follows:
- Append -m386 to the CFLAGS_EXTRA line.
- Uncomment the CC= line below the comment about uClibc and
change it to CC=/home/lennartb/myboot/uclibc-dev/bin/gcc
- You could enable LFS support, as you already have selected it in
the uClibc library as well.
Now build the program.
make
make PREFIX=/home/lennartb/myboot/rootfs install
Because you have linked with the dynamic uClibc library and
these are not installed in the host system's /lib directory,
the program cannot run. There is a trick to work around it: by using
the chroot command, you can run a program whose root directory is the
specified directory. Become root and type the following command:
/usr/sbin/chroot /home/lennartb/myboot/rootfs /bin/sh
The shell that you are now in is the shell inside the
/home/lennartb/myboot/rootfs directory. This shell thinks that
this rootfs directory is in fact the root directory: even the
shared libraries of uClibc in the /lib directory will be
found. Type the command ls / and it will be clear. Exit the chroot subshell with Control-D and everything will be back to normal.
Now you have most common Unix utilities including an editor and a
shell and you've spent only 576kB of disk space!
Next: Other Essential Binaries
Up: Getting Linux into Small
Previous: Building uClibc
Contents
Lennart Benschop
2003-05-29