From patchwork Thu Jun 20 10:07:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1119355 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="Pdt2lpRs"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45TyHj3r15z9s3C for ; Thu, 20 Jun 2019 20:10:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 35829C21DF9; Thu, 20 Jun 2019 10:09:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id AD867C21E29; Thu, 20 Jun 2019 10:08:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E1837C21DFD; Thu, 20 Jun 2019 10:08:16 +0000 (UTC) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by lists.denx.de (Postfix) with ESMTPS id 6043EC21DA6 for ; Thu, 20 Jun 2019 10:08:12 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id c85so1404607pfc.1 for ; Thu, 20 Jun 2019 03:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zttVe370+yU3kJRF5UVZnOomEKxVsOXxlVp69LiFmYw=; b=Pdt2lpRs9dO73yg+IMccdvzd0qS8QSTPxjWTBTaLKIFHTeOfe1AHhKjRAkDzOVT0ty 99H1Fyk3TKkVfnnf9Vl+IxHHmewTc+xj/yCNiFNWCyrtNWf6JECB4TD4Sr0LLzl5dnCh xyA74yL4cYw/JUsQg6vjZ4gfx7xthfr18ibr4= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zttVe370+yU3kJRF5UVZnOomEKxVsOXxlVp69LiFmYw=; b=uMZTYJ7nLoJoBoukyIlz0OBuiiMQONS+Z+TKpjJp/9TgfwwkgErBLOEFYWWLjow8ml zhk4rZCE9qSL2FBa8aX7hhfa8qinwbM/FVf6I5MrGcMPN+1eLe2MuZcYYifA04PxRlC0 mkB402iHtZfnbj5D4KEASCuHY25qRT0LrbjfWEsF39HUXw808JKUE22h+bayIwQ0viQl 7eIUVUJ3ASx2a6o4jk+TkqBGJPVEwv1BTCGBZoGeku2OJHUzdl/yv4xTUQUA40ffIHvh WYaZMIhBW8rhhSzZcSNAtp9BzuEvqMkJYIqbSsAEyWGndRMTOH1u+xFpMXBd2sy4+7X/ zPFQ== X-Gm-Message-State: APjAAAVNkeFKiNKz0ceHEJMLBNY9o1KRTd71O9BU+WBRJ+RI5Nlomk0s XvfIwzkI71Y/pyKV4faMDEARrw== X-Google-Smtp-Source: APXvYqwIr8ZSNeN+vd61vU4KuKiDPu4PjPjixkEA5o/MU1zN1j/FlWLEcQhkAyybCnP4gExXslE7Ig== X-Received: by 2002:a62:b40a:: with SMTP id h10mr131422396pfn.216.1561025290988; Thu, 20 Jun 2019 03:08:10 -0700 (PDT) Received: from localhost.localdomain ([183.82.229.140]) by smtp.gmail.com with ESMTPSA id x129sm21731387pfb.29.2019.06.20.03.08.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 03:08:10 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , u-boot@lists.denx.de Date: Thu, 20 Jun 2019 15:37:38 +0530 Message-Id: <20190620100740.6560-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190620100740.6560-1-jagan@amarulasolutions.com> References: <20190620100740.6560-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Cc: linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com Subject: [U-Boot] [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" 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 Reviewed-by: Kever Yang --- Makefile | 2 +- arch/arm/mach-rockchip/make_fit_atf.py | 20 ++++++++++++++++++-- doc/README.rockchip | 4 ++-- 3 files changed, 21 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..e7d3846a13 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,19 @@ def generate_atf_binary(bl31_file_name): def main(): uboot_elf = "./u-boot" - bl31_elf = "./bl31.elf" + bl31_elf = os.path.isfile("./bl31.elf") fit_its = sys.stdout + if bl31_elf: + bl31_elf = "./bl31.elf" + elif "BL31" in os.environ: + bl31_elf=os.getenv("BL31"); + 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