that if the root filesystem is going to be run from a ramdisk, it may as well be built on a ramdisk. All we have
to do is create a second extended filesystem on a ramdisk device, mount it and copy files to it. Once the
filesystem is populated with all the files that the root disk needs, we simply unmount it, compress it and write
it out to floppy.
For this to work, we need to make sure the system used for building has ramdisk support. If ramdisk is
not available it is also possible to use a loopback device. See the Bootdisk−HOWTO for more
information on using loopback devices.
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)
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
Pocket Linux Guide
Chapter 3. Saving Space 13