From patchwork Thu Jun 20 10:59:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 678 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B1A223F063 for ; Thu, 20 Jun 2019 12:59:38 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id s195sf1538218pgs.13 for ; Thu, 20 Jun 2019 03:59:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1561028377; cv=pass; d=google.com; s=arc-20160816; b=OtMqtv+y3jtiwukJ1wJJvIKcgoS/n+8UfRokAvOnFp96yUfzU2Rx1gdwyrG5yxrJ9H 0T6C+GrDJen9wQyOyWSxMC3C6LYdwW2XmicOe3ZUVHe57EuRdcE16+9zrdd2KmEbaWOU O3DmL08Q6gGx78j4IJu7+s+74oiw7t5N8upsNyJROMJPoZM+Zm05ATfQ6ZiV5yQq/aXI dHvmKOXpoby85J7mAicymbt+1mbbuEZoq8qC3VO1Sxci1xaeNpGJ9q6M5O56xWaPPef9 M8Xo6mfgh/XtGpDMTb86INBRdV1I1zqwaiiyOkQgEb6+O0pmPpLSfZvlYlMaWTSMfdaE sUCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=HmbD0orUSGxU5wN7uJ+dmF1J5owkkPzn+hrE1ScJBms=; b=IdkMc3H39mMO1OnLbjbU3BalpeqLakl90BIaZ6GsEPQAaMSUp4zkmWAAe/yKmRvP4j f3c6ZFmYsIbSd5HKYR1bO2BOQa1YIl8CBwqO0eUKyXnDRKyrKnVIg5oCGsrfpaT5fHW+ sPeFUixgZgQcz/pyyzCBNMoTveZ355pUrJrVkMzddNmL7OtTs1xwNl7GmojzFX7a5Jqp PPBA+zdUSn2rwDUgMYsnmzZ3tEuVuIAEsR3VOoE6jb81LGh76Slj3QArIfr0cbS4wwWI Ep+LA0u0/ZWU5s8apJH/gPjOwe8uF8YC1ZwnzUtEtwU0XhyI53LKjyPyVqV7ABqboZSR uWbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="MYt/ZFt/"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=HmbD0orUSGxU5wN7uJ+dmF1J5owkkPzn+hrE1ScJBms=; b=M7dazPrpd4jUlrnsMjiaL2fyGNxIE1tFOmv/2194neKo8AfY8AlOxXJ+2B7x9YEhHj AO99h5lKKSWL8ECueU63u8VkqMKu7jpu5N8dxWeiLvKvGdCjgcPaSTZ11OmplUZXx4Qj OwrWpdTDQdpIghDbzWud+aptV7MzcQCdXTM5Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=HmbD0orUSGxU5wN7uJ+dmF1J5owkkPzn+hrE1ScJBms=; b=pXil49+8vSG9EERy+YE1gFyk1pbn3vp4Gf1YrJVTXbyp/mbhHGzVAUs0e+xSa7Z+ZH X6+q1U8bDzDLfkTvpWI1ZO5746p34QeIweQY7wkWJq0nyIKcRf+GkpQiDvb+qLoXvyIx Tq/+ar2IDwTCJH/PqVBNZdk8XZOp91Gtt/c9NCUlzTmHxRKOisf15Oq12yakgRDFwyT2 pqumd9dHvKaUn6OampYY5cg59UPDeFH/k3PUHDcsZQQCvVosbKJq1DCHiK3Oxv9CeOOu weWqI5akpKwfnVp4k38bDzjiQ03FwNuCqFd3nJvoP9CRZHu3vEd61a3ExW2WaYNFSKgC 50zA== X-Gm-Message-State: APjAAAXq450im0XIf6UE63ZRknaYAIIJGwUjMFq0kL5+7UK0mIJpxg78 AWx3aOJb3jCp2T7KqIWi2vVEyfia X-Google-Smtp-Source: APXvYqyOsBu83cMg34ybB1Fg1IcygcTBkio08VAUDmvQb2lIX1jQ5SJ9ZCTv2f5yNuohuCi1QE02Xg== X-Received: by 2002:aa7:8157:: with SMTP id d23mr130203063pfn.92.1561028376751; Thu, 20 Jun 2019 03:59:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:1e8:: with SMTP id b95ls1299325plb.10.gmail; Thu, 20 Jun 2019 03:59:36 -0700 (PDT) X-Received: by 2002:a17:90a:28e4:: with SMTP id f91mr2387018pjd.99.1561028376420; Thu, 20 Jun 2019 03:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561028376; cv=none; d=google.com; s=arc-20160816; b=tQeY2/o4Fp1mYDfIXx2es7KmY8R3HqHyCLUk/FZeXtnfT4zpzSJe7psGcGOpWc6XhK ql2AgF+jO3OSNRhnVNDgM+9FR1hpyhv9G5Mj93TIS0z9b3rxw7ZI+6aOPcgxHDj7FoJD NXXQFUMlUU2wjos5QIHjslTv18rJwt6f/mehlnTRncsDv6WQSkccJ8M0kNdxULQfJ7nr PpmDTPzIPqJ57nA2HdY4uW0nF50qmqkUFNu0qj0Kzg2dTjlWPxsbwXXKFKy3Otat14JP CguE11s1Yd9M32E1SovazTki0B2cUxQUSpFWA6zniB2k0Pr+7b/s0HQ5lAggiAy7lAKv 7ryQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=VTYVwBjgCKNY/FlJSycuMhAtBvrPKNheYq1n4TGKvPs=; b=ENIFwkxoVjOBm9fVE3dKa7+g+B81hA6vC5bpQplwaXJg+5kV5zoWvW7laY/3Jgf+Hk LLO6rkTqJsBVi+rwdix4LnkWeRCNOlIYWMUxMdjzA5BOT13YGhTVaKzHoLC+gBzVxZjk /tOr13jZolX9xusaCe9epK2Oels+Sx4GK2Q1BaJy9I36jmzqfl2WrAHqn7XkvsTF9jRG 63YMswYzuCF7EtqD+E3AKCJlSbjQdsn1UYIQ/T/MTJfqloXc1JqvDhR18ljMm9vO6gd0 M5IXo0h+SYFN1r/WS9H46CvorBuZwnM2dUMgCIFPYJWVigzn9iZVnNXvK10mL2IxNLGS DBbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="MYt/ZFt/"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id g5sor18495774pgc.72.2019.06.20.03.59.35 for (Google Transport Security); Thu, 20 Jun 2019 03:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:8d4c:: with SMTP id z73mr6426521pgd.95.1561028375258; Thu, 20 Jun 2019 03:59:35 -0700 (PDT) Received: from localhost.localdomain ([183.82.229.140]) by smtp.gmail.com with ESMTPSA id r15sm31306524pfc.162.2019.06.20.03.59.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 03:59:34 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , u-boot@lists.denx.de Cc: linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v4.1 4/6] rockchip: rk3399: Get bl31.elf via BL31 Date: Thu, 20 Jun 2019 16:29:22 +0530 Message-Id: <20190620105922.484-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="MYt/ZFt/"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Right now rockchip platform need to copy bl31.elf into u-boot source directory to make use of building u-boot.itb. So, add environment variable BL31 like Allwinner SoC so-that the bl31.elf would available via BL31. If the builds are not exporting BL31 env, the make_fit_atf.py explicitly create dummy bl31.elf in u-boot root directory to satisfy travis builds and it will show the warning on console as WARNING: BL31 file bl31.elf NOT found, resulting binary is non-functional WARNING: Please read Building section in doc/README.rockchip Note, that the dummy bl31 files were created during not exporting BL31 case would be removed via clean target in Makefile. Signed-off-by: Jagan Teki --- Changes for v4.1: - Check BL31 env first instead of bl31.elf PWD. Makefile | 2 +- arch/arm/mach-rockchip/make_fit_atf.py | 19 +++++++++++++++++-- doc/README.rockchip | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a503ab9fc1..3ede10ff68 100644 --- a/Makefile +++ b/Makefile @@ -1848,7 +1848,7 @@ clean: $(clean-dirs) -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \ -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \ -type f -print | xargs rm -f \ - bl31_*.bin image.map + bl31.c bl31.elf bl31_*.bin image.map # mrproper - Delete all generated files, including .config # diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index 212bd0a854..45ec105887 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -12,6 +12,7 @@ import os import sys import getopt +import logging # pip install pyelftools from elftools.elf.elffile import ELFFile @@ -89,13 +90,17 @@ def append_conf_section(file, cnt, dtname, segments): file.write('\t\tconfig_%d {\n' % cnt) file.write('\t\t\tdescription = "%s";\n' % dtname) file.write('\t\t\tfirmware = "atf_1";\n') - file.write('\t\t\tloadables = "uboot",') + file.write('\t\t\tloadables = "uboot"') + if segments != 0: + file.write(',') for i in range(1, segments): file.write('"atf_%d"' % (i)) if i != (segments - 1): file.write(',') else: file.write(';\n') + if segments == 0: + file.write(';\n') file.write('\t\t\tfdt = "fdt_1";\n') file.write('\t\t};\n') file.write('\n') @@ -171,8 +176,18 @@ def generate_atf_binary(bl31_file_name): def main(): uboot_elf = "./u-boot" - bl31_elf = "./bl31.elf" fit_its = sys.stdout + if "BL31" in os.environ: + bl31_elf=os.getenv("BL31"); + elif os.path.isfile("./bl31.elf"): + bl31_elf = "./bl31.elf" + else: + os.system("echo 'int main(){}' > bl31.c") + os.system("${CROSS_COMPILE}gcc -c bl31.c -o bl31.elf") + bl31_elf = "./bl31.elf" + logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) + logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional') + logging.warning(' Please read Building section in doc/README.rockchip') opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h") for opt, val in opts: diff --git a/doc/README.rockchip b/doc/README.rockchip index 264f7e4994..5680c075fa 100644 --- a/doc/README.rockchip +++ b/doc/README.rockchip @@ -149,8 +149,8 @@ For example: => make realclean => make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 - (copy bl31.elf into U-Boot root dir) - => cp build/rk3399/release/bl31/bl31.elf /path/to/u-boot + (export bl31.elf) + => export BL31=/path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf - Compile PMU M0 firmware