archs38: add HSDK board
[openwrt/openwrt.git] / target / linux / archs38 / image / gen_axs10x_sdcard_img.sh
1 #!/usr/bin/env bash
2
3 #
4 # Copyright (C) 2016 OpenWrt.org
5 #
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
8 #
9
10 set -x
11 [ $# -eq 5 ] || {
12 echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
13 exit 1
14 }
15
16 OUTPUT="$1"
17 BOOTFS="$2"
18 ROOTFS="$3"
19 BOOTFSSIZE="$4"
20 ROOTFSSIZE="$5"
21
22 head=4
23 sect=63
24
25 set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M`
26
27 BOOTOFFSET="$(($1 / 512))"
28 BOOTSIZE="$(($2 / 512))"
29 ROOTFSOFFSET="$(($3 / 512))"
30 ROOTFSSIZE="$(($4 / 512))"
31
32 dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
33 dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc