#!/bin/sh # Create a compressed ramdisk file, based on the directory $DREF. # This script no longer has to be run as root, thanks to genext2fs. # I _still_ like scripts that are short and legible. # # Note: genext2fs as provided here is limited to 8 MByte file systems. # See http://home.attbi.com/~vr_sundar/genext2fs.html # for patches designed to remove that restriction. # Larry Doolittle January 2002 DREF=$1 # configuration: RDSIZE=4096 # RAM disk size in units of kBytes FILE=rdisk # final output is $FILE.gz PATH=$PREFIX/bin:$PATH # may help find genext2fs # No more configuration should be needed below. # Proofread at will. set -e if [ ! -n "$DREF" -o ! -d "$DREF" ]; then echo "$DREF is not a directory; check $0 configuration" exit 1 fi # sanity check only, isn't precise QSIZE=`du -s $DREF | awk '{print $1}'` if [ $QSIZE -ge $RDSIZE ]; then echo "$REF size $QSIZE too big for ramdisk size $RDSIZE" exit 1 fi sh $PWD/write_devs >dev_arm.txt genext2fs -i 2048 -b $RDSIZE -d $DREF -f dev_arm.txt >$FILE # Lost the capability to have non-root files, now that we use genext2fs. # To regain this feature, either add features to genext2fs, or put # some chown commands into the boot scripts. # chown -R 100:100 $MNT/home/mortal # chmod -R g-w $MNT/home/mortal # Size reporting would also be a nice feature to add to genext2fs # df $LOOP echo "gzipping $FILE" gzip -v -f -9 $FILE echo "Compressed filesystem $FILE.gz complete, ready for tftp!"