3.3. Construction

This section is written using ramdisk seven (/dev/ram7) to build the root image. There is nothing particularly special about ramdisk seven and it is possible to use any of the other available ramdisks provided they are not already in use.

3.3.1. Create a ramdisk

bash# dd if=/dev/zero of=/dev/ram7 bs=1k count=4096
bash# mke2fs -m0 /dev/ram7 4096
bash# mount /dev/ram7 /mnt

3.3.2. Rebuild the BASH shell

bash# cd /usr/src/bash-3.0
bash# make distclean
bash# export CC="gcc -mcpu=i386"
bash# ./configure --enable-minimal-config --host=i386-pc-linux-gnu
bash# make
bash# strip bash

3.3.3. Determine which libraries are required

bash# ldd bash

View the output from the ldd command. It should look similar to the example below.

bash# ldd bash
  libdl.so.2 => /lib/libdl.so.2 (0x4001d000)
  libc.so.6 => /lib/libc.so.6 (0x40020000)
  /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Note

Some systems may have a slightly different library set up. For example, you may see libc.so.6 => /lib/tls/libc.so.6 rather than libc.so.6 => /lib/libc.so.6 as shown in the example. If your ldd output does not match the example then use the path given by your ldd command when completing the next step.

3.3.4. Copy BASH and its libraries to the ramdisk

bash# mkdir /mnt/bin
bash# cp bash /mnt/bin
bash# ln -s bash /mnt/bin/sh
bash# mkdir /mnt/lib
bash# strip --strip-unneeded -o /mnt/lib/libdl.so.2 /lib/libdl.so.2
bash# strip --strip-unneeded -o /mnt/lib/libc.so.6 /lib/libc.so.6
bash# strip --strip-unneeded -o /mnt/lib/ld-linux.so.2 /lib/ld-linux.so.2
bash# chmod +x /mnt/lib/ld-linux.so.2

Note

Using strip -o might seem an odd way to copy library files from the development system to the ramdisk. What it does is strip the symbols while the file is in transit from the source location to the destination. This has the effect of stripping symbols from the library on the ramdisk without altering the libraries on the development system. Unfortunately file permissions are lost when copying libraries this way which is why the chmod +x command is then used to set the execute flag for the rootdisk's dynamic loader.

3.3.5. Create a console device

bash# mkdir /mnt/dev
bash# mknod /mnt/dev/console c 5 1

3.3.6. Compress the ramdisk image

bash# cd /
bash# umount /dev/ram7
bash# dd if=/dev/ram7 of=~/phase2-image bs=1k count=4096
bash# gzip -9 ~/phase2-image

3.3.7. Copy the compressed image to diskette

Insert the floppy labeled "root disk" into drive fd0.

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

mirror server hosted at Truenetwork, Russian Federation.