From patchwork Mon Mar 23 14:03:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1260050 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48mGN86hS8z9sNg for ; Tue, 24 Mar 2020 01:04:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D9DA81927; Mon, 23 Mar 2020 15:04:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A62A381940; Mon, 23 Mar 2020 15:04:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-out.xnet.cz (smtp-out.xnet.cz [178.217.244.18]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BC9E08192C for ; Mon, 23 Mar 2020 15:04:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=ynezz@true.cz Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 301B441B1; Mon, 23 Mar 2020 15:04:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 2e5159da; Mon, 23 Mar 2020 15:03:49 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: u-boot@lists.denx.de, Hans de Goede , Jagan Teki , Maxime Ripard Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Subject: [PATCH 3/3] sunxi: replace .its file generator with Dust template Date: Mon, 23 Mar 2020 15:03:47 +0100 Message-Id: <20200323140348.26717-4-ynezz@true.cz> In-Reply-To: <20200323140348.26717-1-ynezz@true.cz> References: <20200323140348.26717-1-ynezz@true.cz> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Replace current .its file based generator with generic Dust template based approach, including the proper .its file dependency tracking, so working images are produced by default. bl31.bin file is mandatory for functional, usable and bootable binaries, and currently missing bl31.bin is not hard error, just a warning. Signed-off-by: Petr Štetiar --- Kconfig | 5 +- Makefile | 8 ++++ board/sunxi/mksunxi_fit_atf.sh | 87 ---------------------------------- board/sunxi/u-boot-its.mk | 19 ++++++++ board/sunxi/u-boot.its.dust | 45 ++++++++++++++++++ 5 files changed, 76 insertions(+), 88 deletions(-) delete mode 100755 board/sunxi/mksunxi_fit_atf.sh create mode 100644 board/sunxi/u-boot-its.mk create mode 100644 board/sunxi/u-boot.its.dust diff --git a/Kconfig b/Kconfig index 7799a3b19629..ebdc3beddb56 100644 --- a/Kconfig +++ b/Kconfig @@ -517,10 +517,13 @@ config SPL_FIT_SOURCE U-Boot FIT image. This could specify further image to load and/or execute. +config SPL_FIT_TEMPLATE + bool "Use Dust template based .its file generation for U-Boot FIT image" + default y if SPL_LOAD_FIT && ARCH_SUNXI + config SPL_FIT_GENERATOR string ".its file generator script for U-Boot FIT image" depends on SPL_FIT - default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP default "arch/riscv/lib/mkimage_fit_opensbi.sh" if SPL_LOAD_FIT && RISCV diff --git a/Makefile b/Makefile index fa687f13a588..131e59a2fe01 100644 --- a/Makefile +++ b/Makefile @@ -1290,6 +1290,14 @@ $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE endif endif +ifeq ($(CONFIG_SPL_FIT_TEMPLATE),y) +U_BOOT_ITS := u-boot.its +include $(srctree)/include/u-boot-its.mk +sinclude $(srctree)/board/$(BOARDDIR)/u-boot-its.mk +$(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) $(U_BOOT_ITS_JSON) FORCE + $(call cmd,gen_its) +endif + ifdef CONFIG_SPL_LOAD_FIT MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh deleted file mode 100755 index 88ad71974706..000000000000 --- a/board/sunxi/mksunxi_fit_atf.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# -# script to generate FIT image source for 64-bit sunxi boards with -# ARM Trusted Firmware and multiple device trees (given on the command line) -# -# usage: $0 [ [&2 - echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2 - BL31=/dev/null -fi - -if grep -q "^CONFIG_MACH_SUN50I_H6=y" .config; then - BL31_ADDR=0x104000 -else - BL31_ADDR=0x44000 -fi - -cat << __HEADER_EOF -/dts-v1/; - -/ { - description = "Configuration to load ATF before U-Boot"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot (64-bit)"; - data = /incbin/("u-boot-nodtb.bin"); - type = "standalone"; - arch = "arm64"; - compression = "none"; - load = <0x4a000000>; - }; - atf { - description = "ARM Trusted Firmware"; - data = /incbin/("$BL31"); - type = "firmware"; - arch = "arm64"; - compression = "none"; - load = <$BL31_ADDR>; - entry = <$BL31_ADDR>; - }; -__HEADER_EOF - -cnt=1 -for dtname in $* -do - cat << __FDT_IMAGE_EOF - fdt_$cnt { - description = "$(basename $dtname .dtb)"; - data = /incbin/("$dtname"); - type = "flat_dt"; - compression = "none"; - }; -__FDT_IMAGE_EOF - cnt=$((cnt+1)) -done - -cat << __CONF_HEADER_EOF - }; - configurations { - default = "config_1"; - -__CONF_HEADER_EOF - -cnt=1 -for dtname in $* -do - cat << __CONF_SECTION_EOF - config_$cnt { - description = "$(basename $dtname .dtb)"; - firmware = "uboot"; - loadables = "atf"; - fdt = "fdt_$cnt"; - }; -__CONF_SECTION_EOF - cnt=$((cnt+1)) -done - -cat << __ITS_EOF - }; -}; -__ITS_EOF diff --git a/board/sunxi/u-boot-its.mk b/board/sunxi/u-boot-its.mk new file mode 100644 index 000000000000..c6294f18889f --- /dev/null +++ b/board/sunxi/u-boot-its.mk @@ -0,0 +1,19 @@ +BL31 := $(CURDIR)/bl31.bin +BL31_ADDR := $(if $(CONFIG_MACH_SUN50I_H6),0x104000,0x104000) + +$(BL31): + $(call check_its_dep,$@,BL31) + +U_BOOT_ITS_DEPS += $(BL31) + +quiet_cmd_gen_its_json = GENITS_JSON $@ +define cmd_gen_its_json + echo '{ \ + "bl31": "$(BL31)", \ + "load": "$(BL31_ADDR)", \ + "dtbs": [ \ + $(call gen_its_json_dtbs) \ + ] \ + }' > $@ +endef + diff --git a/board/sunxi/u-boot.its.dust b/board/sunxi/u-boot.its.dust new file mode 100644 index 000000000000..50d14e02e52f --- /dev/null +++ b/board/sunxi/u-boot.its.dust @@ -0,0 +1,45 @@ +/dts-v1/; + +/ { + description = "Configuration to load ATF before U-Boot"; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot (64-bit)"; + data = /incbin/("u-boot-nodtb.bin"); + type = "standalone"; + arch = "arm64"; + compression = "none"; + load = <0x4a000000>; + }; + atf { + description = "ARM Trusted Firmware"; + data = /incbin/("{bl31}"); + type = "firmware"; + arch = "arm64"; + compression = "none"; + load = <{load}>; + entry = <{load}>; + }; +{#dtbs} + fdt_{@idx}{.}{/idx} { + description = "{name}"; + data = /incbin/("{path}"); + type = "flat_dt"; + compression = "none"; + }; +{/dtbs} + }; + configurations { + default = "config_0"; +{#dtbs} + config_{@idx}{.}{/idx} { + description = "{name}"; + firmware = "uboot"; + loadables = "atf"; + fdt = "fdt_{@idx}{.}{/idx}"; + }; +{/dtbs} + }; +};