|
@@ -14,45 +14,52 @@ done
|
14
|
14
|
echo Overwriting old partition table
|
15
|
15
|
sudo dd if=/dev/zero of=$1 bs=1024 count=1024
|
16
|
16
|
|
17
|
|
-echo Recreating new partition table
|
18
|
|
-sudo fdisk $1 << EOF
|
19
|
|
-n
|
20
|
|
-p
|
21
|
|
-1
|
22
|
|
-
|
23
|
|
-+16MB
|
24
|
|
-t
|
25
|
|
-53
|
26
|
|
-n
|
27
|
|
-p
|
28
|
|
-2
|
29
|
|
-
|
30
|
|
-
|
31
|
|
-w
|
|
17
|
+if [ -e output/images/u-boot.sd ] ; then
|
|
18
|
+ echo Recreating new partition table
|
|
19
|
+ sed 's/#.*//' << EOF | tr -d " \t" | sudo fdisk $1
|
|
20
|
+ n # new partition
|
|
21
|
+ p # primary partition
|
|
22
|
+ 1 # number 1
|
|
23
|
+ # default start
|
|
24
|
+ +16M # 16MB
|
|
25
|
+ t # New Type field
|
|
26
|
+ 53 # OnTrack DM6 Aux3
|
|
27
|
+ n # new partition
|
|
28
|
+ p # primary partition
|
|
29
|
+ 2 # number 2
|
|
30
|
+ # default start
|
|
31
|
+ # default size
|
|
32
|
+ w # write changes
|
32
|
33
|
EOF
|
33
|
34
|
|
34
|
|
-if [ -e output/images/imx23_olinuxino_dev_linux.sb ] ; then
|
35
|
|
- echo Writing mxs-bootlet bootstream
|
36
|
|
- sudo dd if=output/images/imx23_olinuxino_dev_linux.sb bs=512 of="$1"1 seek=4
|
37
|
|
-elif [ -e output/images/u-boot.sd ] ; then
|
38
|
35
|
echo Writing U-Boot bootstream
|
39
|
36
|
sudo dd if=output/images/u-boot.sd of="$1"1
|
40
|
|
-elif [ -e output/images/ ] ; then
|
41
|
|
- echo Creaeting boot filesystem
|
42
|
|
- sudo mkfs.vfat -F 16 -n boot "$1"1
|
|
37
|
+elif [ -d output/images/rpi-firmware ] ; then
|
|
38
|
+ SIZE=`sudo fdisk -l $1 | grep Disk | grep bytes | awk '{print $5}'`
|
|
39
|
+ echo Disk size: $SIZE bytes
|
|
40
|
+ CYLINDERS=`echo $SIZE/255/63/512 | bc`
|
|
41
|
+ echo Cylinders: $CYLINDERS
|
|
42
|
+
|
|
43
|
+ sed 's/#.*//' << EOF | tr -d " \t" | sudo sfdisk -D -H 255 -S 63 -C $CYLINDERS $1
|
|
44
|
+ ,9,0x0C,* # From http://downloads.angstrom-distribution.org/demo/beaglebone/mkcard.txt
|
|
45
|
+ ,,,- # Found in http://elinux.org/RPi_Advanced_Setup#Advanced_SD_card_setup
|
|
46
|
+EOF
|
|
47
|
+
|
|
48
|
+ echo Creaeting boot filesystem
|
|
49
|
+ sudo mkfs.vfat -F 32 -n boot "$1"1
|
43
|
50
|
|
44
|
|
- echo Mounting boot filesystem
|
|
51
|
+ echo Mounting boot filesystem
|
45
|
52
|
sudo mkdir -p /media/boot
|
46
|
53
|
sudo mount "$1"1 /media/boot
|
47
|
54
|
|
48
|
|
- echo Copying bootloader files
|
49
|
|
- sudo cp output/images/rpi-firmware/* /media/boot/
|
50
|
|
- sudo cp output/images/*.dtb /media/boot/
|
|
55
|
+ echo Copying bootloader files
|
|
56
|
+ sudo cp output/images/rpi-firmware/* /media/boot/
|
|
57
|
+ sudo cp output/images/*.dtb /media/boot/
|
51
|
58
|
|
52
|
|
- echo Preparing and copying Kernel Image
|
53
|
|
- output/host/usr/bin/mkknlimg output/images/zImage /media/boot/zImage
|
|
59
|
+ echo Preparing and copying Kernel Image
|
|
60
|
+ sudo output/host/usr/bin/mkknlimg output/images/zImage /media/boot/zImage
|
54
|
61
|
|
55
|
|
- echo Synchronising changes to disk
|
|
62
|
+ echo Synchronising changes to disk
|
56
|
63
|
sudo sync
|
57
|
64
|
|
58
|
65
|
echo Unmounting boot filesystem
|
|
@@ -86,6 +93,6 @@ elif [ -e output/images/rootfs.ext2 ] ; then
|
86
|
93
|
echo Synchronising changes to disk
|
87
|
94
|
sudo sync
|
88
|
95
|
else
|
89
|
|
- echo Could not find a suitable root filesystem!
|
|
96
|
+ echo Could not find a suitable root filesystem!
|
90
|
97
|
fi
|
91
|
98
|
|