4.3. Construction

Rather than copying files directly to the ramdisk, we can make things easier by setting up a staging area. The staging area will give us room to work without worrying about the space constraints of the ramdisk. It will also provide a way to save our work and make it easier to enhance the rootdisk in later phases of the project.

The staging procedure will work like this:

  1. Create a directory structure as defined in the FHS.

  2. Copy in the files from phase 2's root disk.

  3. Build the four new packages from source code.

  4. Install files into the correct FHS directories.

  5. Strip the binaries to save space.

  6. Check library dependencies.

  7. Copy to the whole directory structure to the ramdisk.

  8. Compress the ramdisk and write it out to floppy.

4.3.1. Create a staging area

bash# mkdir ~/staging
bash# cd ~/staging
bash# mkdir bin boot dev etc home lib mnt opt proc root sbin tmp usr var
bash# mkdir var/log var/run

4.3.2. Copy contents of phase 2 rootdisk

bash# dd if=~/phase2-image.gz | gunzip -c > /dev/ram7
bash# mount /dev/ram7 /mnt
bash# cp -dpR /mnt/* ~/staging
bash# umount /dev/ram7
bash# rmdir ~/staging/lost+found

4.3.3. Install "cat" from GNU Textutils

bash# cd /usr/src/textutils-2.1
bash# ./configure --host=i386-pc-linux-gnu
bash# make
bash# cd src
bash# cp cat ~/staging/bin

4.3.4. Install binaries from GNU fileutils

bash# cd /usr/src/fileutils-4.1
bash# ./configure --host=i386-pc-linux-gnu
bash# make
bash# cd src
bash# cp chgrp chmod chown cp dd df ln ls ~/staging/bin
bash# cp mkdir mkfifo mknod mv rm rmdir sync ~/staging/bin

4.3.5. Install binaries from sh-utils

bash# cd /usr/src/sh-utils-2.0
bash# ./configure --host=i386-pc-linux-gnu
bash# make
bash# cd src
bash# cp date hostname stty su uname ~/staging/bin

4.3.6. Copy additional libraries

bash# ldd ~/staging/bin/cat
bash# ldd ~/staging/bin/ls
bash# ldd ~/staging/bin/su
bash# ls ~/staging/lib
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.7. Strip binaries and libraries

bash# strip ~/staging/bin/*
bash# strip --strip-unneeded ~/staging/lib/*

4.3.8. 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
bash# mount /dev/ram7 /mnt
bash# cp -dpR ~/staging/* /mnt
bash# umount /dev/ram7
bash# dd if=/dev/ram7 of=~/phase3-image bs=1k
bash# gzip -9 ~/phase3-image

4.3.9. Write the root disk image to floppy

Insert the diskette labled "root disk" into drive fd0.

bash# dd if=~/phase3-image.gz of=/dev/fd0 bs=1k