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.
bash#
dd if=/dev/zero of=/dev/ram7 bs=1k count=4096bash#
mke2fs -m0 /dev/ram7 4096bash#
mount /dev/ram7 /mnt
bash#
cd /usr/src/bash-3.0bash#
make distcleanbash#
export CC="gcc -mcpu=i386"bash#
./configure --enable-minimal-config --host=i386-pc-linux-gnubash#
makebash#
strip bash
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.
bash#
mkdir /mnt/binbash#
cp bash /mnt/binbash#
ln -s bash /mnt/bin/shbash#
mkdir /mnt/libbash#
strip --strip-unneeded -o /mnt/lib/libdl.so.2 /lib/libdl.so.2bash#
strip --strip-unneeded -o /mnt/lib/libc.so.6 /lib/libc.so.6bash#
strip --strip-unneeded -o /mnt/lib/ld-linux.so.2 /lib/ld-linux.so.2bash#
chmod +x /mnt/lib/ld-linux.so.2
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.
bash#
cd /bash#
umount /dev/ram7bash#
dd if=/dev/ram7 of=~/phase2-image bs=1k count=4096bash#
gzip -9 ~/phase2-image