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 | |
Tom Rini | 6475fc9 | 2017-05-22 15:40:11 -0400 | [diff] [blame] | 10 | if [ ! -f $BL31 ]; then |
| 11 | echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2 |
| 12 | echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2 |
| 13 | BL31=/dev/null |
| 14 | fi |
| 15 | |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 16 | cat << __HEADER_EOF |
| 17 | /dts-v1/; |
| 18 | |
| 19 | / { |
| 20 | description = "Configuration to load ATF before U-Boot"; |
| 21 | #address-cells = <1>; |
| 22 | |
| 23 | images { |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 24 | uboot { |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 25 | description = "U-Boot (64-bit)"; |
| 26 | data = /incbin/("u-boot-nodtb.bin"); |
| 27 | type = "standalone"; |
| 28 | arch = "arm64"; |
| 29 | compression = "none"; |
| 30 | load = <0x4a000000>; |
| 31 | }; |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 32 | atf { |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 33 | description = "ARM Trusted Firmware"; |
| 34 | data = /incbin/("$BL31"); |
| 35 | type = "firmware"; |
| 36 | arch = "arm64"; |
| 37 | compression = "none"; |
| 38 | load = <0x44000>; |
| 39 | entry = <0x44000>; |
| 40 | }; |
| 41 | __HEADER_EOF |
| 42 | |
| 43 | cnt=1 |
| 44 | for dtname in $* |
| 45 | do |
| 46 | cat << __FDT_IMAGE_EOF |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 47 | fdt_$cnt { |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 48 | description = "$(basename $dtname .dtb)"; |
| 49 | data = /incbin/("$dtname"); |
| 50 | type = "flat_dt"; |
| 51 | compression = "none"; |
| 52 | }; |
| 53 | __FDT_IMAGE_EOF |
| 54 | cnt=$((cnt+1)) |
| 55 | done |
| 56 | |
| 57 | cat << __CONF_HEADER_EOF |
| 58 | }; |
| 59 | configurations { |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 60 | default = "config_1"; |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 61 | |
| 62 | __CONF_HEADER_EOF |
| 63 | |
| 64 | cnt=1 |
| 65 | for dtname in $* |
| 66 | do |
| 67 | cat << __CONF_SECTION_EOF |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 68 | config_$cnt { |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 69 | description = "$(basename $dtname .dtb)"; |
Andre Przywara | 2f23b1d | 2017-12-04 02:05:11 +0000 | [diff] [blame] | 70 | firmware = "uboot"; |
| 71 | loadables = "atf"; |
| 72 | fdt = "fdt_$cnt"; |
Andre Przywara | 4c16089 | 2017-04-26 01:32:46 +0100 | [diff] [blame] | 73 | }; |
| 74 | __CONF_SECTION_EOF |
| 75 | cnt=$((cnt+1)) |
| 76 | done |
| 77 | |
| 78 | cat << __ITS_EOF |
| 79 | }; |
| 80 | }; |
| 81 | __ITS_EOF |