1 #! /bin/sh 2 3 DRIVE=$1 4 5 dd if=/dev/zero of=$DRIVE bs=1024 count=1024 6 7 SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` 8 9 echo DISK SIZE - $SIZE bytes 10 11 CYLINDERS=`echo $SIZE/255/63/512 | bc` 12 13 echo CYLINDERS - $CYLINDERS 14 15 { 16 echo ,9,0x0C,* 17 echo ,,,- 18 } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE 19 20 mkfs.vfat -F 32 -n "boot" ${DRIVE}1 21 mke2fs -j -L "rootfs" ${DRIVE}2 22 23