4.3.3. Install binaries from GNU coreutils
Download a recent version of coreutils from ftp://ftp.gnu.org/gnu/coreutils/
bash# cd /usr/src/coreutils−5.2.1
bash# export CC="gcc −mcpu=i386"
bash# ./configure −−host=i386−pc−linux−gnu
bash# make
bash# cd src
bash# cp cat chgrp chmod chown cp date dd df ~/staging/bin
bash# cp hostname ln ls mkdir mkfifo mknod ~/staging/bin
bash# cp mv rm rmdir stty su sync uname ~/staging/bin
4.3.4. Copy additional libraries
Check library requirements by using ldd on some of the new binaries.
bash# ldd ~/staging/bin/cat
bash# ldd ~/staging/bin/ls
bash# ldd ~/staging/bin/su
bash# ls ~/staging/lib
Note the differences in the required libraries, as shown by the ldd command, and the libraries present in the
staging area, as shown by the ls command, then copy any missing libraries to the staging area.
bash# cp /lib/librt.so.1 ~/staging/lib
bash# cp /lib/libpthread.so.0 ~/staging/lib
bash# cp /lib/libcrypt.so.1 ~/staging/lib
4.3.5. Strip binaries and libraries
bash# strip ~/staging/bin/*
bash# strip −−strip−unneeded ~/staging/lib/*
4.3.6. Create a compressed root disk image
bash# cd /
bash# dd if=/dev/zero of=/dev/ram7 bs=1k count=4096
bash# mke2fs −m0 /dev/ram7 4096
bash# mount /dev/ram7 /mnt
bash# cp −dpR ~/staging/* /mnt
bash# umount /dev/ram7
bash# dd if=/dev/ram7 of=~/phase3−image bs=1k count=4096
bash# gzip −9 ~/phase3−image
The process for creating the compressed root disk image will change very little throughout the remaining
chapters. Writing a small script to handle this function can be a great time saver.
4.3.7. Write the root disk image to floppy
Insert the diskette labeled "root disk" into drive fd0.
bash# dd if=~/phase3−image.gz of=/dev/fd0 bs=1k
Pocket Linux Guide
Chapter 4. Some Basic Utilities
18