A.3.2.1.3. Audio
bash# mknod −m664 ~/staging/dev/dsp c 14 3
bash# mknod −m664 ~/staging/dev/mixer c 14 0
A.3.2.2. Install the gunzip binary
bash# cd /usr/src/gzip−1.2.4a
bash# export CC="gcc −mcpu=i386"
bash# ./configure −−host=i386−pc−linux−gnu
bash# make
bash# strip gzip
bash# cp gzip ~/staging/bin
bash# ln −s gzip ~/staging/bin/gunzip
Don't forget to verify library requirements, check the ownership and check permissions on the gzip binary.
A.3.2.3. Write a startup script to mount a compressed floppy
Use a text editor to create the following script and save it as ~/staging/etc/init.d/usr_image
#!/bin/sh
#
# usr_image − load compressed images from floppy into ramdisk and
# mount on /usr.
#
echo −n "Is there a compressed diskette to load for /usr [y/N]? "
read REPLY
if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then
echo −n "Please insert the /usr floppy into fd0 and press <ENTER>."
read REPLY
echo "Clearing /dev/ram1."
dd if=/dev/zero of=/dev/ram1 bs=1k count=4096
echo "Loading compressed image from /dev/fd0 into /dev/ram1..."
(dd if=/dev/fd0 bs=1k | gunzip −cq) >/dev/ram1 2>/dev/null
fsck −fp /dev/ram1
if [ $? −gt 1 ]; then
echo "Filesystem errors on /dev/ram1! Manual intervention required."
else
echo "Mounting /usr."
mount /dev/ram1 /usr
fi
fi
#
# end of usr_image
Configure the script to run right after root is mounted.
bash# ln −s ../init.d/usr_image ~/staging/etc/rcS.d/S21usr_image
A.3.2.4. Create a compressed root disk
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
Pocket Linux Guide
Appendix A. Hosting Applications 52