kernel: bump 4.14 to 4.14.159
[openwrt/openwrt.git] / target / linux / gemini / image / dns313_gen_hdd_img.sh
1 #!/usr/bin/env bash
2
3 set -x
4 [ $# -eq 5 ] || {
5 echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
6 exit 1
7 }
8
9 OUTPUT="$1"
10 BOOTFS="$2"
11 ROOTFS="$3"
12 BOOTFSSIZE="$4"
13 ROOTFSSIZE="$5"
14
15 head=4
16 sect=63
17
18 # Create two empty partitions followed by the boot partition with
19 # the ./boot/zImage and then the rootfs partition.
20 set `ptgen -o $OUTPUT -h $head -s $sect -t 83 -n -p 0 -p 0 -p ${BOOTFSSIZE}M -p ${ROOTFSSIZE}M`
21
22 BOOTOFFSET="$(($1 / 512))"
23 BOOTSIZE="$(($2 / 512))"
24 ROOTFSOFFSET="$(($3 / 512))"
25 ROOTFSSIZE="$(($4 / 512))"
26
27 dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
28 dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc