Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 63 lines (49 sloc) 1.557 kb
89d390a8 » fhunleth
2012-02-04 Add script to build a disk image.
1 #!/bin/sh
2
3 set -e
4 export LC_ALL=C
5
6 if [ $# -ne 0 ]; then
7 echo "Usage: $0"
8 exit 1
9 fi
10
11 make beaglebone_erlang_defconfig
12 make
13
14 #OUTPUTFILE=bbone-erlang-`git describe`.img.gz
15 OUTPUTFILE=bbone-erlang-0.0.img
16
17 MBRFILE=/tmp/mbr.bin
18 VFATFILE=/tmp/vfat.bin
19
20 HEADS=255
21 SECTORS=63
22
23 VFAT_PART_CYLINDERS=1
24 ROOTFS_PART_CYLINDERS=16
25 USER_PART_CYLINDERS=124
26
27 dd if=/dev/zero of=$MBRFILE count=1
28 sfdisk -f -H $HEADS -S $SECTORS $MBRFILE << EOF
29 0,$VFAT_PART_CYLINDERS,c,*
30 ,$ROOTFS_PART_CYLINDERS
31 ,$USER_PART_CYLINDERS
32 EOF
33
34 # Keep mcopy from complaining
35 export MTOOLS_SKIP_CHECK=1
36
37 # Create a file for making the VFAT boot partition.
38 # It loses 1 block due to the MBR taking up the first block
39 dd if=/dev/zero of=$VFATFILE count=$(( $VFAT_PART_CYLINDERS * $HEADS * $SECTORS - 1 ))
40 mkfs.vfat $VFATFILE -n boot
41 mcopy -i $VFATFILE output/images/MLO ::
42 mcopy -i $VFATFILE output/images/uImage ::
43 mcopy -i $VFATFILE output/images/u-boot.img ::
44
45 # Mark that this is the first boot, so that the init scripts
46 # can format the user partition
47 touch /tmp/1stboot
48 mcopy -i $VFATFILE /tmp/1stboot ::
49
50 cat $MBRFILE $VFATFILE output/images/rootfs.ext2 > $OUTPUTFILE
51 zip ${OUTPUTFILE}.zip $OUTPUTFILE
52
53 # Clean up
54 rm $VFATFILE $MBRFILE /tmp/1stboot
55
56 echo "==================================================================="
57 echo "Created $OUTPUTFILE and $OUTPUTFILE.zip."
58 echo
59 echo "Write to a MicroSD card by running:"
60 echo
e27cdce1 » fhunleth
2012-02-04 Add first time boot code to format the user partition if invalid.
61 echo "find /dev -name \"sdX?\" -exec umount \"{}\" \";\""
89d390a8 » fhunleth
2012-02-04 Add script to build a disk image.
62 echo "sudo dd if=$OUTPUTFILE of=/dev/sdX bs=128k"
63 echo "where sdX is where the MicroSD card was mounted."
64
Something went wrong with that request. Please try again.