b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Licensed under the terms of the GNU GPL License version 2 or later. |
| 4 | # Author: David Bauer <mail@david-bauer.net>, based on mkits-zyxel-factory.sh. |
| 5 | |
| 6 | usage() { |
| 7 | echo "Usage: `basename $0` output file compat-models" |
| 8 | exit 1 |
| 9 | } |
| 10 | |
| 11 | # We need at least 3 arguments |
| 12 | [ "$#" -lt 3 ] && usage |
| 13 | |
| 14 | # Target output file |
| 15 | OUTPUT="$1"; shift |
| 16 | FILE="$1"; shift |
| 17 | MODELS="$1"; shift |
| 18 | |
| 19 | # Create a default, fully populated DTS file |
| 20 | echo "\ |
| 21 | /dts-v1/; |
| 22 | |
| 23 | / { |
| 24 | timestamp = <0x684090B4>; |
| 25 | description = \"Zyxel FIT (Flattened Image Tree)\"; |
| 26 | compat-models = [${MODELS}]; |
| 27 | fw_version = \"9.99(###.1)\"; |
| 28 | #address-cells = <1>; |
| 29 | |
| 30 | images { |
| 31 | ubi { |
| 32 | data = /incbin/(\"${FILE}\"); |
| 33 | type = \"firmware\"; |
| 34 | compression = \"none\"; |
| 35 | hash { |
| 36 | algo = \"sha256\"; |
| 37 | }; |
| 38 | }; |
| 39 | }; |
| 40 | };" > ${OUTPUT} |