4619defd73d6ef57f71c1d9213e9b1447f9324aa
[openwrt/staging/wigyori.git] / target / linux / realview / image / gen_realview_sdcard_img.sh
1 #!/usr/bin/env bash
2
3 set -x
4 [ $# -eq 3 ] || {
5 echo "SYNTAX: $0 <file> <rootfs image> <rootfs size>"
6 exit 1
7 }
8
9 OUTPUT="$1"
10 ROOTFS="$2"
11 ROOTFSSIZE="$3"
12
13 head=4
14 sect=63
15
16 set `ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t 83 -p ${ROOTFSSIZE}M`
17
18 ROOTFSOFFSET="$(($1 / 512))"
19 ROOTFSSIZE="$(($2 / 512))"
20
21 dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
22
23