From 65325fba5a8d6bcafb2fc1662bd82b348b735dc2 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Fri, 15 Nov 2019 10:27:07 +0800 Subject: [PATCH] rockchip: Convert to use FIT generator for optee Use generator script so that we can use environment for TEE source. $TEE for tee.bin, and if file not exist, the script can report a warning, and meke the build success without a error. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/fit_spl_optee.its | 50 --------------- arch/arm/mach-rockchip/fit_spl_optee.sh | 78 ++++++++++++++++++++++++ configs/evb-rk3229_defconfig | 2 +- 3 files changed, 79 insertions(+), 51 deletions(-) delete mode 100644 arch/arm/mach-rockchip/fit_spl_optee.its create mode 100755 arch/arm/mach-rockchip/fit_spl_optee.sh diff --git a/arch/arm/mach-rockchip/fit_spl_optee.its b/arch/arm/mach-rockchip/fit_spl_optee.its deleted file mode 100644 index 6ed5d486f2..0000000000 --- a/arch/arm/mach-rockchip/fit_spl_optee.its +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2017 Rockchip Electronic Co.,Ltd - * - * Simple U-boot fit source file containing U-Boot, dtb and optee - */ - -/dts-v1/; - -/ { - description = "Simple image with OP-TEE support"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot"; - data = /incbin/("../../../u-boot-nodtb.bin"); - type = "standalone"; - os = "U-Boot"; - arch = "arm"; - compression = "none"; - load = <0x61000000>; - }; - optee { - description = "OP-TEE"; - data = /incbin/("../../../tee.bin"); - type = "firmware"; - arch = "arm"; - os = "tee"; - compression = "none"; - load = <0x68400000>; - entry = <0x68400000>; - }; - fdt { - description = "dtb"; - data = /incbin/("../../../u-boot.dtb"); - type = "flat_dt"; - compression = "none"; - }; - }; - - configurations { - default = "conf"; - conf { - description = "Rockchip armv7 with OP-TEE"; - firmware = "optee"; - loadables = "uboot"; - fdt = "fdt"; - }; - }; -}; diff --git a/arch/arm/mach-rockchip/fit_spl_optee.sh b/arch/arm/mach-rockchip/fit_spl_optee.sh new file mode 100755 index 0000000000..89ef04312c --- /dev/null +++ b/arch/arm/mach-rockchip/fit_spl_optee.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019 Rockchip Electronic Co.,Ltd +# +# Script to generate FIT image source for 32-bit Rockchip SoCs with +# U-Boot proper, OPTEE, and devicetree. +# +# usage: $0 + +[ -z "$TEE" ] && TEE="tee.bin" + +if [ ! -f $TEE ]; then + echo "WARNING: TEE file $TEE NOT found, U-Boot.itb is non-functional" >&2 + echo "Please export path for TEE or copy tee.bin to U-Boot folder" >&2 + TEE=/dev/null +fi + +dtname=$1 + +cat << __HEADER_EOF +/* + * Copyright (C) 2017-2019 Rockchip Electronic Co.,Ltd + * + * Simple U-boot FIT source file containing U-Boot, dtb and optee + */ + +/dts-v1/; + +/ { + description = "FIT image with OP-TEE support"; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot"; + data = /incbin/("u-boot-nodtb.bin"); + type = "standalone"; + os = "U-Boot"; + arch = "arm"; + compression = "none"; + load = <0x61000000>; + }; + optee { + description = "OP-TEE"; + data = /incbin/("$TEE"); + type = "firmware"; + arch = "arm"; + os = "tee"; + compression = "none"; + load = <0x68400000>; + entry = <0x68400000>; + }; + fdt { + description = "$(basename $dtname .dtb)"; + data = /incbin/("$dtname"); + type = "flat_dt"; + compression = "none"; + }; +__HEADER_EOF + +cat << __CONF_HEADER_EOF + }; + + configurations { + default = "conf"; + conf { + description = "$(basename $dtname .dtb)"; + firmware = "optee"; + loadables = "uboot"; + fdt = "fdt"; + }; +__CONF_HEADER_EOF + +cat << __ITS_EOF + }; +}; +__ITS_EOF diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 745fdd1c0f..11a2d01847 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -14,7 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x60000000 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_FIT_SOURCE="arch/arm/mach-rockchip/fit_spl_optee.its" +CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/fit_spl_optee.sh" CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set -- 2.39.5