|
@@ -0,0 +1,42 @@
|
|
1
|
+#!/bin/sh
|
|
2
|
+
|
|
3
|
+if [ "$#" -ne 1 ] || ! [ -d "$1" ]; then
|
|
4
|
+ echo "Usage: $0 /dev/disk" >&2
|
|
5
|
+ exit 1
|
|
6
|
+fi
|
|
7
|
+
|
|
8
|
+# Unmount mounted partitions
|
|
9
|
+for fs in `grep $1 /proc/mounts|cut -d ' ' -f 1` ; do
|
|
10
|
+ echo Unmounting $fs
|
|
11
|
+ sudo umount $fs
|
|
12
|
+done
|
|
13
|
+
|
|
14
|
+echo Overwriting old partition table
|
|
15
|
+sudo dd if=/dev/zero of=$1 bs=1024 count=1024
|
|
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
|
|
32
|
+EOF
|
|
33
|
+
|
|
34
|
+echo Writing bootstream
|
|
35
|
+sudo dd if=output/images/imx23_olinuxino_dev_linux.sb bs=512 of="$1"1 seek=4
|
|
36
|
+
|
|
37
|
+echo Writing root filesystem
|
|
38
|
+sudo dd if=output/images/rootfs.ext2 of="$1"2 bs=512
|
|
39
|
+
|
|
40
|
+echo Synchronising changes to disk
|
|
41
|
+sudo sync
|
|
42
|
+
|