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: 675 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E5F283F086 for ; Thu, 20 Jun 2019 12:08:12 +0200 (CEST) Received: by mail-pl1-f198.google.com with SMTP id o6sf1294991plk.23 for ; Thu, 20 Jun 2019 03:08:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1561025291; cv=pass; d=google.com; s=arc-20160816; b=Nua0Do6fMEkJIIaK9OQjf6JoeNuKJt6hcpUZ1hBsVlTvCAazX8NIxJaIZY6GkUBmuw NLZfmsPyno60NA8z1tMQFfsC9jBLPb/3jcUtc1G+CD9KVenVjNE8C02nWuk1qsxNeHs8 7C+aVkwZpQWC0md9Ly0RPsPsFSPw56aAj2ox9sUO54lb/N6jHqMryCcFjSkqA8dXMQET o7pBi26J43aRKaGQcqrOIRacLrOn7oeltiBqsorWqvnZqOqEO7tCo/De2AuTggo9MbHv FfAN9URz/nmzoKUYP7twSDrTHH7UXtZuwXXNUPCTYPqBlAtYigpaArt1p/65tWQzlnxF uJyg== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=SMUMbyn6ACMSDBXfldicVizMeQAGI7b0FFIc3Il5gF4=; b=bE1syV5H1/K584AXfLY0huNLsUPxQEZaV7HqXhpA4JpvLOiALR3wBDqj5aodp+C74t J1vkL8quX4nPYNAYb3QylWOv+uJ8OlcKMpf3JuX1L9Fxvzdl+UrkCeDIWBlArHWZr557 j4aE6TJdF+IEakNNe/jS8ih9WuIiDmkRCgHpRvjCOEa6dV/nXYGfWhiqmRiGnKSIRv4N sSZoVOOojl9dgqJuR5OdGXCdisY8l6QUHk4nAs512XfyfCvWqwtpImkYv/DiHETUTlUP gYIPzn1J89Lu2lvouNg8DFAzoob8HPvTueJDl/YqZKKCIMoFKyh3CNVk+oUZEi5c48mA 95+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Pdt2lpRs; 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:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=SMUMbyn6ACMSDBXfldicVizMeQAGI7b0FFIc3Il5gF4=; b=Y6pSxq8lKSyjNh2/+JtprcpQTC2k9mGj6L3RcqAx4SpbslU80zL0F2Y0BXaMlFkG90 /MFaQhHT01ZAgxI3MMciXQ5+meM+LuGGCQ5t262qNiFZ9duRD6767gl3P20EDo2ubyOq 6rW2Cf8qXZA9vStBo3gMcQW0lGt5PQp+e52Xk= 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: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=SMUMbyn6ACMSDBXfldicVizMeQAGI7b0FFIc3Il5gF4=; b=YTCAlGRXMhQ73gAEk8bLtzhWtSdjcuTJBLqTDaXzUSLtL5lby0Q5OPVuzfRAOKgmXx IXh93PVe/p19s5Q3/TJ4BQVruuoh+AWW59ZDCeasTmvmxkU3WGe4+Vl5qTSYedOfz8Qv rYEDrrJUMjKqFlXtlhQLIsR7k1OLwNLi92BnjyudAlqLN2ebtnOc/fYd9tM2V10MdbK1 qnagcXr0smGZdY8phdZozSz9S6ai4L7McStN8gUEvVByPreUQl654JfY/gptDgKmPeEO WCC8gmGPJqa8ZBA67tqJi6iyTr49BmuhryNSjvESNquOUfDAgoGkalR3nCx2Rtyv2gpj lMQA== X-Gm-Message-State: APjAAAWTiDZcBnlYa9Skk22vNkQm/7ycUfa13k3iYaMb9Hb1e2N6/pRT J++oK30bTAmIe/cmhqWUpobrzF+f X-Google-Smtp-Source: APXvYqyhr+tuhiGEuXKyAlwewhPGSzYwvIqorNxiuXocGe66m26cDk0/aBG2q9wsmrdXkCwd4v/avQ== X-Received: by 2002:a62:5105:: with SMTP id f5mr130189801pfb.127.1561025291719; Thu, 20 Jun 2019 03:08:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:fe03:: with SMTP id p3ls1108095pgh.8.gmail; Thu, 20 Jun 2019 03:08:11 -0700 (PDT) X-Received: by 2002:a65:4cce:: with SMTP id n14mr12193730pgt.246.1561025291323; Thu, 20 Jun 2019 03:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561025291; cv=none; d=google.com; s=arc-20160816; b=zDfNetMSbxXOftxoMPThx+hdRUSQ/kwr6NFQwsiscL+280O0UwDj4HeMDMvJUy9HCe qfIXHLuq9MSfB4MH/MCcAgl3f13tbsRg3I4i8bCoMQYgBZCLsMTscyPL4A9WhvwY+F1M rPNH3CIMtHNzo+hBcAnb+13MMOJiRO7SZoDEBnQE95KLVrp18fXFDYOX8wG4iie3DxlC ALyYcRDESUK72G7HeU30HdbLg4NBX4b1VOBSVB4DIdjc8ydOMXhkSXQ/8MQoX4OWSuhY /tXYo9SFxlhj7f/s/+NSpFTavj8vHxdCWHiJE2qohDZO3gtJNWjRbugWb38LU4rtkbZN X2cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zttVe370+yU3kJRF5UVZnOomEKxVsOXxlVp69LiFmYw=; b=mQKJru+c73wZ0E3cXinKiaYRx1FTabWJJDsQ+tbuU2zu09R7EOA7A4IaIFafGoD1pB GLTTgxydTlScShfoW8mgwdBanAfo07zJ3gLnrmR7kC14OJ/lO41opkxxKUnFNvDJ9Hzt TvIK34FM8caLqdg6m9bs6/+aZJuC092tz2pgZlftgDfXuBv1Ed770cG3X12WWRKVohMN CG62JYeQ5kdWOyPLoSJHWSVfq7xzoFdGpnfuqEvHH+/ZbV1sHNxEGck1iKPgdX9UzeRr Ny03t8xtxHAG3IOpSYPDxC3tHF4vIT2raNvF/LDGjtzqx32FgDO0eVc8OeINvH00X/IU LRow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Pdt2lpRs; 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 j21sor6867677pfr.2.2019.06.20.03.08.11 for (Google Transport Security); Thu, 20 Jun 2019 03:08:11 -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: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 Cc: linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31 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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Pdt2lpRs; 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 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