3 # (c) Copyright 2009 Graeme Gregory <dp@xora.org.uk>
4 # Licensed under terms of GPLv2
6 # Parts of the procudure base on the work of Denys Dmytriyenko
7 # http://wiki.omap.com/index.php/MMC_Boot_Format
12 echo "Usage: $0 <drive>"
18 dd if=/dev/zero of=$DRIVE bs=1024 count=1024
20 SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
22 echo DISK SIZE - $SIZE bytes
24 CYLINDERS=`echo $SIZE/255/63/512 | bc`
26 echo CYLINDERS - $CYLINDERS
31 } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
33 if [ -b ${DRIVE}1 ]; then
34 mkfs.vfat -F 32 -n "boot" ${DRIVE}1
36 if [ -b ${DRIVE}p1 ]; then
37 mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
39 echo "Cant find boot partition in /dev"
43 if [ -b ${DRIVE}2 ]; then
44 mke2fs -j -L "rootfs" ${DRIVE}2
46 if [ -b ${DRIVE}p2 ]; then
47 mke2fs -j -L "rootfs" ${DRIVE}p2
49 echo "Cant find rootfs partition in /dev"