1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/sh
# Low mem initrd Disk maker. Enrique Zanardi, June 1998
# This is free software under the GNU General Public License.
. ./common.sh
export LANG=C
if [ $# != 0 ]; then
echo "Usage: "$0" " 1>&2
exit -1
fi
PROGRAM=utilities/lowmemrd/linuxrc
# Set this to the block device for the floppy disk.
floppy=$(tempfile -p fimg)
mnt=${tmpdir}/boot-floppies/mnt.lowmemrd
(cd utilities/lowmemrd; make)
# Try to unmount anything that should not be mounted.
(umount $mnt; umount $floppy; true)2>/dev/null >/dev/null
make_tmpdir $mnt
blocks=`/bin/ls -l $PROGRAM |awk '{print $5}'`
blocks=`expr ${blocks} / 1024 + 30`
# Zero the entire disk, so that when I compress the raw disk image,
# unused blocks will compress well.
dd if=/dev/zero of=$floppy bs=1k count=${blocks}
# Make a Minix filesystem.
/sbin/mkfs.minix -n14 -i 380 $floppy ${blocks}
# Mount the disk.
mount -t minix -o loop $floppy $mnt
mkdir $mnt/dev
(cd $mnt/dev; /sbin/MAKEDEV fd0 fd1 hda hdb hdc hdd sda sdb sdc sdd)
mknod $mnt/dev/tty1 c 4 1
mkdir $mnt/proc
mkdir $mnt/mnt
chmod 555 $mnt/proc
cp $PROGRAM $mnt/linuxrc
chmod 755 $mnt/linuxrc
# Adjust the owner and permissions
chown -R root.root $mnt/*
# Umount the floppy and copy it to a compressed raw disk image file.
df $mnt
umount $mnt
rmdir $mnt
(rm -f lowmemrd.bin ;true)
gzip -9f <$floppy >lowmemrd.bin
ls -l lowmemrd.bin
rm -f $floppy
exit 0
|