summaryrefslogtreecommitdiffstats
path: root/scripts/mkits-zyxel-fit.sh
blob: 8ace1941ebf50c1bdafabdcdcf9e5ae10de7645f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
#
# Licensed under the terms of the GNU GPL License version 2 or later.
# Author: David Bauer <mail@david-bauer.net>, based on mkits-zyxel-factory.sh.

usage() {
	echo "Usage: `basename $0` output file compat-models"
	exit 1
}

# We need at least 3 arguments
[ "$#" -lt 3 ] && usage

# Target output file
OUTPUT="$1"; shift
FILE="$1"; shift
MODELS="$1"; shift

# Create a default, fully populated DTS file
echo "\
/dts-v1/;

/ {
	description = \"Zyxel FIT (Flattened Image Tree)\";
	compat-models = [${MODELS}];
	#address-cells = <1>;

	images {
		firmware {
			data = /incbin/(\"${FILE}\");
			type = \"firmware\";
			compression = \"none\";
			hash@1 {
				algo = \"sha1\";
			};
		};
	};
};" > ${OUTPUT}