Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # script to generate FIT image source for 64-bit sunxi boards with |
| 4 | # ARM Trusted Firmware and multiple device trees (given on the command line) |
| 5 | # |
| 6 | # usage: $0 <dt_name> [<dt_name> [<dt_name] ...] |
| 7 | |
| 8 | [ -z "$BL31" ] && BL31="bl31.bin" |
| 9 | |
| 10 | cat << __HEADER_EOF |
| 11 | /dts-v1/; |
| 12 | |
| 13 | / { |
| 14 | description = "Configuration to load ATF before U-Boot"; |
| 15 | #address-cells = <1>; |
| 16 | |
| 17 | images { |
| 18 | uboot@1 { |
| 19 | description = "U-Boot (64-bit)"; |
| 20 | data = /incbin/("u-boot-nodtb.bin"); |
| 21 | type = "standalone"; |
| 22 | arch = "arm64"; |
| 23 | compression = "none"; |
| 24 | load = <0x4a000000>; |
| 25 | }; |
| 26 | atf@1 { |
| 27 | description = "ARM Trusted Firmware"; |
| 28 | data = /incbin/("$BL31"); |
| 29 | type = "firmware"; |
| 30 | arch = "arm64"; |
| 31 | compression = "none"; |
| 32 | load = <0x44000>; |
| 33 | entry = <0x44000>; |
| 34 | }; |
| 35 | __HEADER_EOF |
| 36 | |
| 37 | cnt=1 |
| 38 | for dtname in $* |
| 39 | do |
| 40 | cat << __FDT_IMAGE_EOF |
| 41 | fdt@$cnt { |
| 42 | description = "$(basename $dtname .dtb)"; |
| 43 | data = /incbin/("$dtname"); |
| 44 | type = "flat_dt"; |
| 45 | compression = "none"; |
| 46 | }; |
| 47 | __FDT_IMAGE_EOF |
| 48 | cnt=$((cnt+1)) |
| 49 | done |
| 50 | |
| 51 | cat << __CONF_HEADER_EOF |
| 52 | }; |
| 53 | configurations { |
| 54 | default = "config@1"; |
| 55 | |
| 56 | __CONF_HEADER_EOF |
| 57 | |
| 58 | cnt=1 |
| 59 | for dtname in $* |
| 60 | do |
| 61 | cat << __CONF_SECTION_EOF |
| 62 | config@$cnt { |
| 63 | description = "$(basename $dtname .dtb)"; |
| 64 | firmware = "uboot@1"; |
| 65 | loadables = "atf@1"; |
| 66 | fdt = "fdt@$cnt"; |
| 67 | }; |
| 68 | __CONF_SECTION_EOF |
| 69 | cnt=$((cnt+1)) |
| 70 | done |
| 71 | |
| 72 | cat << __ITS_EOF |
| 73 | }; |
| 74 | }; |
| 75 | __ITS_EOF |