All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
To: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Philipp Tomsich
	<philipp.tomsich-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org>,
	Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	Akash Gajjar <akash-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org>,
	Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
	Manivannan Sadhasivam
	<manivannan.sadhasivam-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Emmanuel Vadot <manu-xXdDKFdH5B3kFDPD4ZthVA@public.gmane.org>,
	u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org,
	Paul Kocialkowski
	<paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Jagan Teki
	<jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org
Subject: [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31
Date: Sun, 28 Apr 2019 14:39:08 +0530	[thread overview]
Message-ID: <20190428090913.10568-5-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190428090913.10568-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>

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.

Cc: Emmanuel Vadot <manu-xXdDKFdH5B3kFDPD4ZthVA@public.gmane.org> <manu-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
---
 Makefile                               |  2 +-
 arch/arm/mach-rockchip/make_fit_atf.py | 11 ++++++++++-
 doc/README.rockchip                    |  4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ba0cce9f33..2471340c71 100644
--- a/Makefile
+++ b/Makefile
@@ -1782,7 +1782,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 d1faff1957..327875d87b 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -10,6 +10,7 @@ usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
 import os
 import sys
 import getopt
+import logging
 
 # pip install pyelftools
 from elftools.elf.elffile import ELFFile
@@ -194,8 +195,16 @@ def get_bl31_segments_info(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");
+    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 ca4d6473b0..98a3824e2c 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
 
-- 
2.18.0.321.gffc6fa0e3

WARNING: multiple messages have this Message-ID (diff)
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31
Date: Sun, 28 Apr 2019 14:39:08 +0530	[thread overview]
Message-ID: <20190428090913.10568-5-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190428090913.10568-1-jagan@amarulasolutions.com>

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.

Cc: Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 Makefile                               |  2 +-
 arch/arm/mach-rockchip/make_fit_atf.py | 11 ++++++++++-
 doc/README.rockchip                    |  4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ba0cce9f33..2471340c71 100644
--- a/Makefile
+++ b/Makefile
@@ -1782,7 +1782,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 d1faff1957..327875d87b 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -10,6 +10,7 @@ usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
 import os
 import sys
 import getopt
+import logging
 
 # pip install pyelftools
 from elftools.elf.elffile import ELFFile
@@ -194,8 +195,16 @@ def get_bl31_segments_info(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");
+    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 ca4d6473b0..98a3824e2c 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
 
-- 
2.18.0.321.gffc6fa0e3

  parent reply	other threads:[~2019-04-28  9:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28  9:09 [PATCH v2 0/9] rk3399: make u-boot-rockchip-with-spl.bin Jagan Teki
2019-04-28  9:09 ` [U-Boot] " Jagan Teki
     [not found] ` <20190428090913.10568-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2019-04-28  9:09   ` [PATCH v2 1/9] Makefile: clean image.map Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` [PATCH v2 2/9] Makefile: clean bl31_*.bin Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` [PATCH v2 3/9] travis.yml: Add pyelftools install entry Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` Jagan Teki [this message]
2019-04-28  9:09     ` [U-Boot] [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31 Jagan Teki
2019-04-28  9:09   ` [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0 Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
     [not found]     ` <20190428090913.10568-6-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2019-05-07  5:01       ` Kever Yang
2019-05-07  5:01         ` [U-Boot] " Kever Yang
2019-04-28  9:09   ` [PATCH v2 6/9] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399 Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
     [not found]     ` <20190428090913.10568-8-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2019-05-07  6:34       ` Kever Yang
2019-05-07  6:34         ` [U-Boot] " Kever Yang
2019-05-07  6:44         ` Jagan Teki
2019-05-07  6:44           ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` [PATCH v2 8/9] dts: Makefile: Build rockchip dtbs based on SoC types Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki
2019-04-28  9:09   ` [PATCH v2 9/9] rockchip: rk3399: Create single image using BINMAN Jagan Teki
2019-04-28  9:09     ` [U-Boot] " Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190428090913.10568-5-jagan@amarulasolutions.com \
    --to=jagan-dyjbcgdgk7pe9whmmfpqlfatqe2ktcn/@public.gmane.org \
    --cc=akash-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org \
    --cc=kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=manivannan.sadhasivam-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=manu-xXdDKFdH5B3kFDPD4ZthVA@public.gmane.org \
    --cc=paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
    --cc=philipp.tomsich-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org \
    --cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
    --cc=u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.