3 # (c) Copyright 2009 Graeme Gregory <dp@xora.org.uk>
4 # Licensed under terms of GPLv2
9 echo "Usage: $0 <drive>"
15 dd if=/dev/zero of=$DRIVE bs=1024 count=1024
17 SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
19 echo DISK SIZE - $SIZE bytes
21 CYLINDERS=`echo $SIZE/255/63/512 | bc`
23 echo CYLINDERS - $CYLINDERS
28 } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
30 if [ -b ${DRIVE}1 ]; then
31 mkfs.vfat -F 32 -n "boot" ${DRIVE}1
33 if [ -b ${DRIVE}p1 ]; then
34 mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
36 echo "Cant find boot partition in /dev"
40 if [ -b ${DRIVE}2 ]; then
41 mke2fs -j -L "rootfs" ${DRIVE}2
43 if [ -b ${DRIVE}p2 ]; then
44 mke2fs -j -L "rootfs" ${DRIVE}p2
46 echo "Cant find rootfs partition in /dev"