xref: /rk3399_rockchip-uboot/board/sunxi/mksunxi_fit_atf.sh (revision 4c78028737c3185f49f5691183aeac3478b5f699)
12ef99d41SAndre Przywara#!/bin/sh
22ef99d41SAndre Przywara#
32ef99d41SAndre Przywara# script to generate FIT image source for 64-bit sunxi boards with
42ef99d41SAndre Przywara# ARM Trusted Firmware and multiple device trees (given on the command line)
52ef99d41SAndre Przywara#
62ef99d41SAndre Przywara# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
72ef99d41SAndre Przywara
82ef99d41SAndre Przywara[ -z "$BL31" ] && BL31="bl31.bin"
92ef99d41SAndre Przywara
10*4c780287STom Riniif [ ! -f $BL31 ]; then
11*4c780287STom Rini	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
12*4c780287STom Rini	echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
13*4c780287STom Rini	BL31=/dev/null
14*4c780287STom Rinifi
15*4c780287STom Rini
162ef99d41SAndre Przywaracat << __HEADER_EOF
172ef99d41SAndre Przywara/dts-v1/;
182ef99d41SAndre Przywara
192ef99d41SAndre Przywara/ {
202ef99d41SAndre Przywara	description = "Configuration to load ATF before U-Boot";
212ef99d41SAndre Przywara	#address-cells = <1>;
222ef99d41SAndre Przywara
232ef99d41SAndre Przywara	images {
242ef99d41SAndre Przywara		uboot@1 {
252ef99d41SAndre Przywara			description = "U-Boot (64-bit)";
262ef99d41SAndre Przywara			data = /incbin/("u-boot-nodtb.bin");
272ef99d41SAndre Przywara			type = "standalone";
282ef99d41SAndre Przywara			arch = "arm64";
292ef99d41SAndre Przywara			compression = "none";
302ef99d41SAndre Przywara			load = <0x4a000000>;
312ef99d41SAndre Przywara		};
322ef99d41SAndre Przywara		atf@1 {
332ef99d41SAndre Przywara			description = "ARM Trusted Firmware";
342ef99d41SAndre Przywara			data = /incbin/("$BL31");
352ef99d41SAndre Przywara			type = "firmware";
362ef99d41SAndre Przywara			arch = "arm64";
372ef99d41SAndre Przywara			compression = "none";
382ef99d41SAndre Przywara			load = <0x44000>;
392ef99d41SAndre Przywara			entry = <0x44000>;
402ef99d41SAndre Przywara		};
412ef99d41SAndre Przywara__HEADER_EOF
422ef99d41SAndre Przywara
432ef99d41SAndre Przywaracnt=1
442ef99d41SAndre Przywarafor dtname in $*
452ef99d41SAndre Przywarado
462ef99d41SAndre Przywara	cat << __FDT_IMAGE_EOF
472ef99d41SAndre Przywara		fdt@$cnt {
482ef99d41SAndre Przywara			description = "$(basename $dtname .dtb)";
492ef99d41SAndre Przywara			data = /incbin/("$dtname");
502ef99d41SAndre Przywara			type = "flat_dt";
512ef99d41SAndre Przywara			compression = "none";
522ef99d41SAndre Przywara		};
532ef99d41SAndre Przywara__FDT_IMAGE_EOF
542ef99d41SAndre Przywara	cnt=$((cnt+1))
552ef99d41SAndre Przywaradone
562ef99d41SAndre Przywara
572ef99d41SAndre Przywaracat << __CONF_HEADER_EOF
582ef99d41SAndre Przywara	};
592ef99d41SAndre Przywara	configurations {
602ef99d41SAndre Przywara		default = "config@1";
612ef99d41SAndre Przywara
622ef99d41SAndre Przywara__CONF_HEADER_EOF
632ef99d41SAndre Przywara
642ef99d41SAndre Przywaracnt=1
652ef99d41SAndre Przywarafor dtname in $*
662ef99d41SAndre Przywarado
672ef99d41SAndre Przywara	cat << __CONF_SECTION_EOF
682ef99d41SAndre Przywara		config@$cnt {
692ef99d41SAndre Przywara			description = "$(basename $dtname .dtb)";
702ef99d41SAndre Przywara			firmware = "uboot@1";
712ef99d41SAndre Przywara			loadables = "atf@1";
722ef99d41SAndre Przywara			fdt = "fdt@$cnt";
732ef99d41SAndre Przywara		};
742ef99d41SAndre Przywara__CONF_SECTION_EOF
752ef99d41SAndre Przywara	cnt=$((cnt+1))
762ef99d41SAndre Przywaradone
772ef99d41SAndre Przywara
782ef99d41SAndre Przywaracat << __ITS_EOF
792ef99d41SAndre Przywara	};
802ef99d41SAndre Przywara};
812ef99d41SAndre Przywara__ITS_EOF
82