From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C377AC47082 for ; Mon, 31 May 2021 10:15:24 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20F1F610E7 for ; Mon, 31 May 2021 10:15:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20F1F610E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC14082E88; Mon, 31 May 2021 12:15:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="bJ99TPMC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B75B782E76; Mon, 31 May 2021 12:14:56 +0200 (CEST) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2C2D482B1C for ; Mon, 31 May 2021 12:14:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62d.google.com with SMTP id l3so15939938ejc.4 for ; Mon, 31 May 2021 03:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h2KbVdTXSGIW3C1b2d9IOuFtzf49W+dux/kqTW0JW/M=; b=bJ99TPMCt0H+sQ7B28lbkdpN9gnsMcjxKvbeBVXtNdZmqiCtrPQkBMEEG0WdiTP0MR u47I1XSheq223ctNA/5wELU0NWx00rkns6yxb0yAZOL1ZMMFQIabj0w/SQd6zOktUD3x ABmt7at4QrKFJgtI3v5oO5g0tOm2atKgo4Ur+I3sA6YFwR1BaVeGhNj4uwW1t1MQImx4 QEVg7H8OTc4ZcibclRinQPI4kAqH7uBbHdMFqeYH440R59T0fCeTvPdrD+j0BnAP/LEx 390RL5Az/hIT2wBfkblQpKrbmAn7Z8lLp1lEbejRaGSMSZN9/MGaR4QSkRKHo4egackQ 5W/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=h2KbVdTXSGIW3C1b2d9IOuFtzf49W+dux/kqTW0JW/M=; b=FPbsR/vtmr7Ssymqc2WhjeRtLdvwqBIgcScr3DCTQJfnuY/5GUaMwTdgRNdVdLBQad Ni/IhdNtgKX7VDjhMUPa/mBnCGvyPkRjpeqI3BadsEDvxTCvQ5WkB/Um+hbME1xYGgVX 1PNnQZNCQNed27leyWwb8zy9OTMxMYrbZ9FcIEsZz4Ve0teV34JO77fJ6ArAJZcuBLEt E9t51ldHRXH1SiGlH+MoJWK7KCE7SE0gcfRsLSzjApUCQUpyLwLTi0oSpj6gZLbnEm4z AiWMLr9ANDUxQN8MiAK8N++b+smM7QrZa16x+FkrIQZUSlQc1xxiD39IZeFAYECumwSL n8LQ== X-Gm-Message-State: AOAM532ne+dRl8+b5L1q358I4vAmUacJDp0rgWYd9en4LQCN/edotCno shCRENv4Nu1g2TEA1K8xY2xeEgDjEtafKG1/ X-Google-Smtp-Source: ABdhPJzwTqmbGPxC0xOVXde2LUfAVghTsLeFTc/FPdNmN/9wl0fsXngJEz9y+Q64gH42gDTJHdqr+g== X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr13257059ejc.159.1622456091675; Mon, 31 May 2021 03:14:51 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::e05]) by smtp.gmail.com with ESMTPSA id hz10sm5771482ejc.40.2021.05.31.03.14.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 May 2021 03:14:51 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, Ricardo Salveti Subject: [PATCH 2/3] zynqmp: Generate u-boot.its also with TEE dynamically Date: Mon, 31 May 2021 12:14:46 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean The first change is to trying to find out TF-A load address based on reading elf file. Expectation is that bl31.bin is in the same folder as bl31.elf. It brings new flexibility to place TF-A to any address (DDR included). And also enable TEE generation also with TEE configuration. Expecation is the same as above that tee.bin and tee.elf are in the same folder. User has to just define link to BL31/BL32 binary files and the rest should be handled by the script. Signed-off-by: Michal Simek --- I am using bash that's why not sure if ${BL31%.*} will work on other shells but let's see. --- arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 41 ++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh index 92e31849f88d..700871dbe109 100755 --- a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh +++ b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh @@ -8,9 +8,19 @@ BL33="u-boot-nodtb.bin" [ -z "$BL31" ] && BL31="bl31.bin" -# Can be also done as ${CROSS_COMPILE}readelf -l bl31.elf | awk '/Entry point/ { print $3 }' +BL31_ELF="${BL31%.*}.elf" +[ -f ${BL31_ELF} ] && ATF_LOAD_ADDR=`${CROSS_COMPILE}readelf -l "${BL31_ELF}" | \ +awk '/Entry point/ { print $3 }'` + [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0xfffea000" +[ -z "$BL32" ] && BL32="tee.bin" +BL32_ELF="${BL32%.*}.elf" +[ -f ${BL32_ELF} ] && TEE_LOAD_ADDR=`${CROSS_COMPILE}readelf -l "${BL32_ELF}" | \ +awk '/Entry point/ { print $3 }'` + +[ -z "$TEE_LOAD_ADDR" ] && TEE_LOAD_ADDR="0x60000000" + if [ -z "$BL33_LOAD_ADDR" ];then BL33_LOAD_ADDR=`awk '/CONFIG_SYS_TEXT_BASE/ { print $3 }' include/generated/autoconf.h` fi @@ -75,6 +85,24 @@ cat << __ATF __ATF fi +if [ -f $BL32 ]; then +cat << __TEE + tee { + description = "TEE firmware"; + data = /incbin/("$BL32"); + type = "firmware"; + os = "tee"; + arch = "arm64"; + compression = "none"; + load = <$TEE_LOAD_ADDR>; + entry = <$TEE_LOAD_ADDR>; + hash { + algo = "md5"; + }; + }; +__TEE +fi + DEFAULT=1 cnt=1 for dtname in $DT @@ -117,6 +145,16 @@ cat << __CONF_SECTION1_EOF }; __CONF_SECTION1_EOF else +if [ -f $BL32 ]; then +cat << __CONF_SECTION1_EOF + config_$cnt { + description = "$(basename $dtname .dtb)"; + firmware = "atf"; + loadables = "uboot", "tee"; + fdt = "fdt_$cnt"; + }; +__CONF_SECTION1_EOF +else cat << __CONF_SECTION1_EOF config_$cnt { description = "$(basename $dtname .dtb)"; @@ -126,6 +164,7 @@ cat << __CONF_SECTION1_EOF }; __CONF_SECTION1_EOF fi +fi cnt=$((cnt+1)) done -- 2.31.1