All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/6] rockchip: rk3399: Make u-boot.itb as BUILD_TARGET
@ 2019-06-20 10:07 ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

This is v4 set for supporting u-boot.itb build target
image for rk3399. here is the previous version changes[1]

Changes for v4:
- rebase on master
- support u-boot.itb build even if bl31.elf available
  in PWD like what is doing right now. this would keep 
  the backward compatible.
- update board README changes
Changes for v3:
- skip binman changes
- rebase on u-boot-rockchip/master

Note:
While creating dummy bl31.elf (neither it available in PWD nor it
as part of BL31 env), the build system is creating u-boot.its without
firmware entry which indeed expected. but the resulting u-boot.itb 
seems booting on rk3399, which I'm not sure - any input would help
on this regard.

Travis-CI:
https://travis-ci.org/openedev/u-boot-amarula/builds/548123247

[1] https://patchwork.ozlabs.org/cover/1096499/

Any inputs?
Jagan.
 
Jagan Teki (6):
  Makefile: clean image.map
  Makefile: clean bl31_*.bin
  travis.yml: Add pyelftools install entry
  rockchip: rk3399: Get bl31.elf via BL31
  board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip

 .travis.yml                                   |  1 +
 Kconfig                                       |  2 +-
 Makefile                                      |  3 +-
 arch/arm/mach-rockchip/make_fit_atf.py        | 20 +++-
 board/theobroma-systems/puma_rk3399/README    |  2 +-
 .../puma_rk3399/fit_spl_atf.its               | 58 ------------
 .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
 board/vamrs/rock960_rk3399/README             |  1 -
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           | 14 ++-
 10 files changed, 124 insertions(+), 73 deletions(-)
 delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
 create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh

-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 0/6] rockchip: rk3399: Make u-boot.itb as BUILD_TARGET
@ 2019-06-20 10:07 ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

This is v4 set for supporting u-boot.itb build target
image for rk3399. here is the previous version changes[1]

Changes for v4:
- rebase on master
- support u-boot.itb build even if bl31.elf available
  in PWD like what is doing right now. this would keep 
  the backward compatible.
- update board README changes
Changes for v3:
- skip binman changes
- rebase on u-boot-rockchip/master

Note:
While creating dummy bl31.elf (neither it available in PWD nor it
as part of BL31 env), the build system is creating u-boot.its without
firmware entry which indeed expected. but the resulting u-boot.itb 
seems booting on rk3399, which I'm not sure - any input would help
on this regard.

Travis-CI:
https://travis-ci.org/openedev/u-boot-amarula/builds/548123247

[1] https://patchwork.ozlabs.org/cover/1096499/

Any inputs?
Jagan.
 
Jagan Teki (6):
  Makefile: clean image.map
  Makefile: clean bl31_*.bin
  travis.yml: Add pyelftools install entry
  rockchip: rk3399: Get bl31.elf via BL31
  board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip

 .travis.yml                                   |  1 +
 Kconfig                                       |  2 +-
 Makefile                                      |  3 +-
 arch/arm/mach-rockchip/make_fit_atf.py        | 20 +++-
 board/theobroma-systems/puma_rk3399/README    |  2 +-
 .../puma_rk3399/fit_spl_atf.its               | 58 ------------
 .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
 board/vamrs/rock960_rk3399/README             |  1 -
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           | 14 ++-
 10 files changed, 124 insertions(+), 73 deletions(-)
 delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
 create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh

-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 1/6] Makefile: clean image.map
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

binman tools for creating single image build will create image.map
at the end, which has information about binman image node details.

current u-boot, is unable to clean this image.map so add a command
entry in clean target in Makefile.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 9fba74d3ed..804eb2c652 100644
--- a/Makefile
+++ b/Makefile
@@ -1847,7 +1847,8 @@ clean: $(clean-dirs)
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-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
+		-type f -print | xargs rm -f \
+		image.map
 
 # mrproper - Delete all generated files, including .config
 #
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 1/6] Makefile: clean image.map
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

binman tools for creating single image build will create image.map
at the end, which has information about binman image node details.

current u-boot, is unable to clean this image.map so add a command
entry in clean target in Makefile.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 9fba74d3ed..804eb2c652 100644
--- a/Makefile
+++ b/Makefile
@@ -1847,7 +1847,8 @@ clean: $(clean-dirs)
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-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
+		-type f -print | xargs rm -f \
+		image.map
 
 # mrproper - Delete all generated files, including .config
 #
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 2/6] Makefile: clean bl31_*.bin
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

Rockchip platform has its python script that would generate various
bl31_*bin for creating u-boot.itb file by taking bl31.elf as input.

These bl31_*.bin files are generated in u-boot root directory and
have no rule to clean it up. so add support for it by adding in
command entry of clean target in Makefile.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 804eb2c652..a503ab9fc1 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 \
-		image.map
+		bl31_*.bin image.map
 
 # mrproper - Delete all generated files, including .config
 #
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 2/6] Makefile: clean bl31_*.bin
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

Rockchip platform has its python script that would generate various
bl31_*bin for creating u-boot.itb file by taking bl31.elf as input.

These bl31_*.bin files are generated in u-boot root directory and
have no rule to clean it up. so add support for it by adding in
command entry of clean target in Makefile.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 804eb2c652..a503ab9fc1 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 \
-		image.map
+		bl31_*.bin image.map
 
 # mrproper - Delete all generated files, including .config
 #
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 3/6] travis.yml: Add pyelftools install entry
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

Currently rockchip platform is using explicit 'make u-boot.itb' for
building u-boot.itb but if we enable CONFIG_BUILD_TARGET as 'u-boot.itb'
then the resulting u-boot.itb directly will create by make.

But, that indeed make travis build fail since it require python-pyelftools
host package.

So add pyelftools install entry as 'pip install pyelftools', this would
create pyelftools on travis host which are required to build rk3399 itb.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index 8bd49ef1a5..94b795ef21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,6 +50,7 @@ install:
  - . /tmp/venv/bin/activate
  - pip install pytest==2.8.7
  - pip install python-subunit
+ - pip install pyelftools
  - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  - mkdir ~/grub2-arm
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 3/6] travis.yml: Add pyelftools install entry
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

Currently rockchip platform is using explicit 'make u-boot.itb' for
building u-boot.itb but if we enable CONFIG_BUILD_TARGET as 'u-boot.itb'
then the resulting u-boot.itb directly will create by make.

But, that indeed make travis build fail since it require python-pyelftools
host package.

So add pyelftools install entry as 'pip install pyelftools', this would
create pyelftools on travis host which are required to build rk3399 itb.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index 8bd49ef1a5..94b795ef21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,6 +50,7 @@ install:
  - . /tmp/venv/bin/activate
  - pip install pytest==2.8.7
  - pip install python-subunit
+ - pip install pyelftools
  - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  - mkdir ~/grub2-arm
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

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 <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
---
 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
 
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: 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 <jagan@amarulasolutions.com>
---
 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
 
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 5/6] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

Right now puma rk3399 board need to copy bl31-rk3399.bin and
rk3399m0.bin into u-boot source directory to make use of building
u-boot.itb.

So, add environment variable
- BL31 for bl31.bin (instead of bl31-rk3399.bin to compatible with other
  platform BL31 env)
- PMUM0 for rk3399m0.bin

If the builds are not exporting BL31, PMUM0 env, the fit_spl_atf.sh will
notify with warning about which document to refer for more information
like this:

 WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional
 Please read Building section in doc/README.rockchip
 WARNING: PMUM0 file rk3399m0.bin NOT found, resulting binary is non-functional
 Please read Building section in doc/README.rockchip

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
---
 .../puma_rk3399/fit_spl_atf.its               | 58 ------------
 .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           |  8 +-
 4 files changed, 99 insertions(+), 63 deletions(-)
 delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
 create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh

diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
deleted file mode 100644
index 530f059f3d..0000000000
--- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
+++ /dev/null
@@ -1,58 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
-/*
- * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
- *
- * Minimal dts for a SPL FIT image payload.
- */
-
-/dts-v1/;
-
-/ {
-	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
-	#address-cells = <1>;
-
-	images {
-		uboot {
-			description = "U-Boot (64-bit)";
-			data = /incbin/("../../../u-boot-nodtb.bin");
-			type = "standalone";
-			os = "U-Boot";
-			arch = "arm64";
-			compression = "none";
-			load = <0x00200000>;
-		};
-		atf {
-			description = "ARM Trusted Firmware";
-			data = /incbin/("../../../bl31-rk3399.bin");
-			type = "firmware";
-			arch = "arm64";
-			os = "arm-trusted-firmware";
-			compression = "none";
-			load = <0x1000>;
-			entry = <0x1000>;
-		};
-		pmu {
-		        description = "Cortex-M0 firmware";
-			data = /incbin/("../../../rk3399m0.bin");
-			type = "pmu-firmware";
-			compression = "none";
-			load = <0x180000>;
-                };
-		fdt {
-			description = "RK3399-Q7 (Puma) flat device-tree";
-			data = /incbin/("../../../u-boot.dtb");
-			type = "flat_dt";
-			compression = "none";
-		};
-	};
-
-	configurations {
-		default = "conf";
-		conf {
-			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
-			firmware = "atf";
-			loadables = "uboot", "pmu";
-			fdt = "fdt";
-		};
-	};
-};
diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
new file mode 100755
index 0000000000..420e7daf4c
--- /dev/null
+++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+# Copyright (C) 2019 Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
+#
+# Based on the board/sunxi/mksunxi_fit_atf.sh
+#
+# Script to generate FIT image source for 64-bit puma boards with
+# U-Boot proper, ATF, PMU firmware and devicetree.
+#
+# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+
+[ -z "$BL31" ] && BL31="bl31.bin"
+
+if [ ! -f $BL31 ]; then
+	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
+	echo "Please read Building section in doc/README.rockchip" >&2
+	BL31=/dev/null
+fi
+
+[ -z "$PMUM0" ] && PMUM0="rk3399m0.bin"
+
+if [ ! -f $PMUM0 ]; then
+	echo "WARNING: PMUM0 file $PMUM0 NOT found, resulting binary is non-functional" >&2
+	echo "Please read Building section in doc/README.rockchip" >&2
+	PMUM0=/dev/null
+fi
+
+cat << __HEADER_EOF
+/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+/*
+ * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
+ *
+ * Minimal dts for a SPL FIT image payload.
+ */
+
+/dts-v1/;
+
+/ {
+	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
+	#address-cells = <1>;
+
+	images {
+		uboot {
+			description = "U-Boot (64-bit)";
+			data = /incbin/("u-boot-nodtb.bin");
+			type = "standalone";
+			arch = "arm64";
+			compression = "none";
+			load = <0x4a000000>;
+		};
+		atf {
+			description = "ARM Trusted Firmware";
+			data = /incbin/("$BL31");
+			type = "firmware";
+			arch = "arm64";
+			os = "arm-trusted-firmware";
+			compression = "none";
+			load = <0x1000>;
+			entry = <0x1000>;
+		};
+		pmu {
+		        description = "Cortex-M0 firmware";
+			data = /incbin/("$PMUM0");
+			type = "pmu-firmware";
+			compression = "none";
+			load = <0x180000>;
+                };
+		fdt {
+			description = "RK3399-Q7 (Puma) flat device-tree";
+			data = /incbin/("u-boot.dtb");
+			type = "flat_dt";
+			compression = "none";
+		};
+__HEADER_EOF
+
+cat << __CONF_HEADER_EOF
+	};
+
+	configurations {
+		default = "conf";
+		conf {
+			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
+			firmware = "atf";
+			loadables = "uboot", "pmu";
+			fdt = "fdt";
+		};
+__CONF_HEADER_EOF
+
+cat << __ITS_EOF
+	};
+};
+__ITS_EOF
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 03f0bfdb59..ebc78fb216 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -15,7 +15,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEBUG_UART=y
-CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/puma_rk3399/fit_spl_atf.its"
+CONFIG_SPL_FIT_GENERATOR="board/theobroma-systems/puma_rk3399/fit_spl_atf.sh"
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 5680c075fa..0ee54cd00e 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -137,8 +137,8 @@ For example:
 	=> cd arm-trusted-firmware
 	=> make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31
 
-	(copy bl31.bin into U-Boot root dir)
-	=> cp build/rk3399/release/bl31/bl31.bin /path/to/u-boot/bl31-rk3399.bin
+	(export bl31.bin)
+	=> export BL31=/path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.bin
 
      For rest of rk3399 boards.
 
@@ -162,8 +162,8 @@ For example:
      (export cross compiler path for Cortex-M0 PMU)
      => make CROSS_COMPILE=arm-cortex_m0-eabi-
 
-     (copy rk3399m0.bin into U-Boot root dir)
-     => cp rk3399m0.bin /path/to/u-boot
+     (export rk3399m0.bin)
+     => export PMUM0=/path/to/rk3399-cortex-m0/rk3399m0.bin
 
    - Compile U-Boot
 
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 5/6] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

Right now puma rk3399 board need to copy bl31-rk3399.bin and
rk3399m0.bin into u-boot source directory to make use of building
u-boot.itb.

So, add environment variable
- BL31 for bl31.bin (instead of bl31-rk3399.bin to compatible with other
  platform BL31 env)
- PMUM0 for rk3399m0.bin

If the builds are not exporting BL31, PMUM0 env, the fit_spl_atf.sh will
notify with warning about which document to refer for more information
like this:

 WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional
 Please read Building section in doc/README.rockchip
 WARNING: PMUM0 file rk3399m0.bin NOT found, resulting binary is non-functional
 Please read Building section in doc/README.rockchip

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 .../puma_rk3399/fit_spl_atf.its               | 58 ------------
 .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           |  8 +-
 4 files changed, 99 insertions(+), 63 deletions(-)
 delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
 create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh

diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
deleted file mode 100644
index 530f059f3d..0000000000
--- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
+++ /dev/null
@@ -1,58 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
-/*
- * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
- *
- * Minimal dts for a SPL FIT image payload.
- */
-
-/dts-v1/;
-
-/ {
-	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
-	#address-cells = <1>;
-
-	images {
-		uboot {
-			description = "U-Boot (64-bit)";
-			data = /incbin/("../../../u-boot-nodtb.bin");
-			type = "standalone";
-			os = "U-Boot";
-			arch = "arm64";
-			compression = "none";
-			load = <0x00200000>;
-		};
-		atf {
-			description = "ARM Trusted Firmware";
-			data = /incbin/("../../../bl31-rk3399.bin");
-			type = "firmware";
-			arch = "arm64";
-			os = "arm-trusted-firmware";
-			compression = "none";
-			load = <0x1000>;
-			entry = <0x1000>;
-		};
-		pmu {
-		        description = "Cortex-M0 firmware";
-			data = /incbin/("../../../rk3399m0.bin");
-			type = "pmu-firmware";
-			compression = "none";
-			load = <0x180000>;
-                };
-		fdt {
-			description = "RK3399-Q7 (Puma) flat device-tree";
-			data = /incbin/("../../../u-boot.dtb");
-			type = "flat_dt";
-			compression = "none";
-		};
-	};
-
-	configurations {
-		default = "conf";
-		conf {
-			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
-			firmware = "atf";
-			loadables = "uboot", "pmu";
-			fdt = "fdt";
-		};
-	};
-};
diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
new file mode 100755
index 0000000000..420e7daf4c
--- /dev/null
+++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+# Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
+#
+# Based on the board/sunxi/mksunxi_fit_atf.sh
+#
+# Script to generate FIT image source for 64-bit puma boards with
+# U-Boot proper, ATF, PMU firmware and devicetree.
+#
+# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+
+[ -z "$BL31" ] && BL31="bl31.bin"
+
+if [ ! -f $BL31 ]; then
+	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
+	echo "Please read Building section in doc/README.rockchip" >&2
+	BL31=/dev/null
+fi
+
+[ -z "$PMUM0" ] && PMUM0="rk3399m0.bin"
+
+if [ ! -f $PMUM0 ]; then
+	echo "WARNING: PMUM0 file $PMUM0 NOT found, resulting binary is non-functional" >&2
+	echo "Please read Building section in doc/README.rockchip" >&2
+	PMUM0=/dev/null
+fi
+
+cat << __HEADER_EOF
+/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+/*
+ * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
+ *
+ * Minimal dts for a SPL FIT image payload.
+ */
+
+/dts-v1/;
+
+/ {
+	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
+	#address-cells = <1>;
+
+	images {
+		uboot {
+			description = "U-Boot (64-bit)";
+			data = /incbin/("u-boot-nodtb.bin");
+			type = "standalone";
+			arch = "arm64";
+			compression = "none";
+			load = <0x4a000000>;
+		};
+		atf {
+			description = "ARM Trusted Firmware";
+			data = /incbin/("$BL31");
+			type = "firmware";
+			arch = "arm64";
+			os = "arm-trusted-firmware";
+			compression = "none";
+			load = <0x1000>;
+			entry = <0x1000>;
+		};
+		pmu {
+		        description = "Cortex-M0 firmware";
+			data = /incbin/("$PMUM0");
+			type = "pmu-firmware";
+			compression = "none";
+			load = <0x180000>;
+                };
+		fdt {
+			description = "RK3399-Q7 (Puma) flat device-tree";
+			data = /incbin/("u-boot.dtb");
+			type = "flat_dt";
+			compression = "none";
+		};
+__HEADER_EOF
+
+cat << __CONF_HEADER_EOF
+	};
+
+	configurations {
+		default = "conf";
+		conf {
+			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
+			firmware = "atf";
+			loadables = "uboot", "pmu";
+			fdt = "fdt";
+		};
+__CONF_HEADER_EOF
+
+cat << __ITS_EOF
+	};
+};
+__ITS_EOF
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 03f0bfdb59..ebc78fb216 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -15,7 +15,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEBUG_UART=y
-CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/puma_rk3399/fit_spl_atf.its"
+CONFIG_SPL_FIT_GENERATOR="board/theobroma-systems/puma_rk3399/fit_spl_atf.sh"
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 5680c075fa..0ee54cd00e 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -137,8 +137,8 @@ For example:
 	=> cd arm-trusted-firmware
 	=> make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31
 
-	(copy bl31.bin into U-Boot root dir)
-	=> cp build/rk3399/release/bl31/bl31.bin /path/to/u-boot/bl31-rk3399.bin
+	(export bl31.bin)
+	=> export BL31=/path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.bin
 
      For rest of rk3399 boards.
 
@@ -162,8 +162,8 @@ For example:
      (export cross compiler path for Cortex-M0 PMU)
      => make CROSS_COMPILE=arm-cortex_m0-eabi-
 
-     (copy rk3399m0.bin into U-Boot root dir)
-     => cp rk3399m0.bin /path/to/u-boot
+     (export rk3399m0.bin)
+     => export PMUM0=/path/to/rk3399-cortex-m0/rk3399m0.bin
 
    - Compile U-Boot
 
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 6/6] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip
  2019-06-20 10:07 ` [U-Boot] " Jagan Teki
@ 2019-06-20 10:07     ` Jagan Teki
  -1 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki

Add u-boot.itb BUILD_TARGET for Rockchip platform when SPL_LOAD_FIT
is being used.

This can get rid of building itb explicitly with 'make u-boot.itb'
so, from now all required images will build just by make.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 Kconfig                                    | 2 +-
 board/theobroma-systems/puma_rk3399/README | 2 +-
 board/vamrs/rock960_rk3399/README          | 1 -
 doc/README.rockchip                        | 2 --
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/Kconfig b/Kconfig
index 6b44256538..df8f2946c5 100644
--- a/Kconfig
+++ b/Kconfig
@@ -250,7 +250,7 @@ config BUILD_TARGET
 	default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5
 	default "u-boot-spl.kwb" if ARCH_MVEBU && SPL
 	default "u-boot-elf.srec" if RCAR_GEN3
-	default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
+	default "u-boot.itb" if SPL_LOAD_FIT && (ROCKCHIP_RK3399 || ARCH_SUNXI)
 	default "u-boot.kwb" if KIRKWOOD
 	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
 	help
diff --git a/board/theobroma-systems/puma_rk3399/README b/board/theobroma-systems/puma_rk3399/README
index f67dfb451f..9b31b0b379 100644
--- a/board/theobroma-systems/puma_rk3399/README
+++ b/board/theobroma-systems/puma_rk3399/README
@@ -60,7 +60,7 @@ Creating a SPL image for SD-Card/eMMC
 Creating a SPL image for SPI-NOR
   > tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin spl_nor.img
 Create the FIT image containing U-Boot proper, ATF, M0 Firmware, devicetree
-  > make CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb
+  > make CROSS_COMPILE=aarch64-linux-gnu-
 
 Flash the image
 ===============
diff --git a/board/vamrs/rock960_rk3399/README b/board/vamrs/rock960_rk3399/README
index d14399090e..c5c675c4ea 100644
--- a/board/vamrs/rock960_rk3399/README
+++ b/board/vamrs/rock960_rk3399/README
@@ -61,7 +61,6 @@ Compile the U-Boot
   > export CROSS_COMPILE=aarch64-linux-gnu-
   > make rock960-rk3399_defconfig
   > make
-  > make u-boot.itb
 
 Compile the rkdeveloptool
 =========================
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 0ee54cd00e..fac87ade2c 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -103,7 +103,6 @@ For example:
      => cd /path/to/u-boot
      => make nanopi-neo4-rk3399_defconfig
      => make
-     => make u-boot.itb
 
    - Get the rkbin
 
@@ -170,7 +169,6 @@ For example:
      => cd /path/to/u-boot
      => make orangepi-rk3399_defconfig
      => make
-     => make u-boot.itb
 
      (Get spl/u-boot-spl-dtb.bin, u-boot.itb images and some boards would get
       spl/u-boot-spl.bin since it doesn't enable CONFIG_SPL_OF_CONTROL
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 6/6] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip
@ 2019-06-20 10:07     ` Jagan Teki
  0 siblings, 0 replies; 18+ messages in thread
From: Jagan Teki @ 2019-06-20 10:07 UTC (permalink / raw)
  To: u-boot

Add u-boot.itb BUILD_TARGET for Rockchip platform when SPL_LOAD_FIT
is being used.

This can get rid of building itb explicitly with 'make u-boot.itb'
so, from now all required images will build just by make.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 Kconfig                                    | 2 +-
 board/theobroma-systems/puma_rk3399/README | 2 +-
 board/vamrs/rock960_rk3399/README          | 1 -
 doc/README.rockchip                        | 2 --
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/Kconfig b/Kconfig
index 6b44256538..df8f2946c5 100644
--- a/Kconfig
+++ b/Kconfig
@@ -250,7 +250,7 @@ config BUILD_TARGET
 	default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5
 	default "u-boot-spl.kwb" if ARCH_MVEBU && SPL
 	default "u-boot-elf.srec" if RCAR_GEN3
-	default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
+	default "u-boot.itb" if SPL_LOAD_FIT && (ROCKCHIP_RK3399 || ARCH_SUNXI)
 	default "u-boot.kwb" if KIRKWOOD
 	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
 	help
diff --git a/board/theobroma-systems/puma_rk3399/README b/board/theobroma-systems/puma_rk3399/README
index f67dfb451f..9b31b0b379 100644
--- a/board/theobroma-systems/puma_rk3399/README
+++ b/board/theobroma-systems/puma_rk3399/README
@@ -60,7 +60,7 @@ Creating a SPL image for SD-Card/eMMC
 Creating a SPL image for SPI-NOR
   > tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin spl_nor.img
 Create the FIT image containing U-Boot proper, ATF, M0 Firmware, devicetree
-  > make CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb
+  > make CROSS_COMPILE=aarch64-linux-gnu-
 
 Flash the image
 ===============
diff --git a/board/vamrs/rock960_rk3399/README b/board/vamrs/rock960_rk3399/README
index d14399090e..c5c675c4ea 100644
--- a/board/vamrs/rock960_rk3399/README
+++ b/board/vamrs/rock960_rk3399/README
@@ -61,7 +61,6 @@ Compile the U-Boot
   > export CROSS_COMPILE=aarch64-linux-gnu-
   > make rock960-rk3399_defconfig
   > make
-  > make u-boot.itb
 
 Compile the rkdeveloptool
 =========================
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 0ee54cd00e..fac87ade2c 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -103,7 +103,6 @@ For example:
      => cd /path/to/u-boot
      => make nanopi-neo4-rk3399_defconfig
      => make
-     => make u-boot.itb
 
    - Get the rkbin
 
@@ -170,7 +169,6 @@ For example:
      => cd /path/to/u-boot
      => make orangepi-rk3399_defconfig
      => make
-     => make u-boot.itb
 
      (Get spl/u-boot-spl-dtb.bin, u-boot.itb images and some boards would get
       spl/u-boot-spl.bin since it doesn't enable CONFIG_SPL_OF_CONTROL
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31
  2019-06-20 10:07     ` [U-Boot] " Jagan Teki
@ 2019-06-21  9:38       ` Kever Yang
  -1 siblings, 0 replies; 18+ messages in thread
From: Kever Yang @ 2019-06-21  9:38 UTC (permalink / raw)
  To: Jagan Teki, Simon Glass, Philipp Tomsich, u-boot
  Cc: linux-rockchip, linux-amarula

Hi Jagan:


On 06/20/2019 06:07 PM, Jagan Teki wrote:
> 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 <jagan@amarulasolutions.com>
> ---
>  Makefile                               |  2 +-
>  arch/arm/mach-rockchip/make_fit_atf.py | 20 ++++++++++++++++++--
>  doc/README.rockchip                    |  4 ++--

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
>  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
>  



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31
@ 2019-06-21  9:38       ` Kever Yang
  0 siblings, 0 replies; 18+ messages in thread
From: Kever Yang @ 2019-06-21  9:38 UTC (permalink / raw)
  To: u-boot

Hi Jagan:


On 06/20/2019 06:07 PM, Jagan Teki wrote:
> 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 <jagan@amarulasolutions.com>
> ---
>  Makefile                               |  2 +-
>  arch/arm/mach-rockchip/make_fit_atf.py | 20 ++++++++++++++++++--
>  doc/README.rockchip                    |  4 ++--

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
>  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
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 5/6] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  2019-06-20 10:07     ` [U-Boot] " Jagan Teki
@ 2019-06-21  9:39       ` Kever Yang
  -1 siblings, 0 replies; 18+ messages in thread
From: Kever Yang @ 2019-06-21  9:39 UTC (permalink / raw)
  To: Jagan Teki, Simon Glass, Philipp Tomsich, u-boot
  Cc: linux-rockchip, linux-amarula



On 06/20/2019 06:07 PM, Jagan Teki wrote:
> Right now puma rk3399 board need to copy bl31-rk3399.bin and
> rk3399m0.bin into u-boot source directory to make use of building
> u-boot.itb.
>
> So, add environment variable
> - BL31 for bl31.bin (instead of bl31-rk3399.bin to compatible with other
>   platform BL31 env)
> - PMUM0 for rk3399m0.bin
>
> If the builds are not exporting BL31, PMUM0 env, the fit_spl_atf.sh will
> notify with warning about which document to refer for more information
> like this:
>
>  WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional
>  Please read Building section in doc/README.rockchip
>  WARNING: PMUM0 file rk3399m0.bin NOT found, resulting binary is non-functional
>  Please read Building section in doc/README.rockchip
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>  .../puma_rk3399/fit_spl_atf.its               | 58 ------------
>  .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
>  configs/puma-rk3399_defconfig                 |  2 +-
>  doc/README.rockchip                           |  8 +-
>  4 files changed, 99 insertions(+), 63 deletions(-)
>  delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
>  create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
>
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> deleted file mode 100644
> index 530f059f3d..0000000000
> --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
> -/*
> - * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
> - *
> - * Minimal dts for a SPL FIT image payload.
> - */
> -
> -/dts-v1/;
> -
> -/ {
> -	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
> -	#address-cells = <1>;
> -
> -	images {
> -		uboot {
> -			description = "U-Boot (64-bit)";
> -			data = /incbin/("../../../u-boot-nodtb.bin");
> -			type = "standalone";
> -			os = "U-Boot";
> -			arch = "arm64";
> -			compression = "none";
> -			load = <0x00200000>;
> -		};
> -		atf {
> -			description = "ARM Trusted Firmware";
> -			data = /incbin/("../../../bl31-rk3399.bin");
> -			type = "firmware";
> -			arch = "arm64";
> -			os = "arm-trusted-firmware";
> -			compression = "none";
> -			load = <0x1000>;
> -			entry = <0x1000>;
> -		};
> -		pmu {
> -		        description = "Cortex-M0 firmware";
> -			data = /incbin/("../../../rk3399m0.bin");
> -			type = "pmu-firmware";
> -			compression = "none";
> -			load = <0x180000>;
> -                };
> -		fdt {
> -			description = "RK3399-Q7 (Puma) flat device-tree";
> -			data = /incbin/("../../../u-boot.dtb");
> -			type = "flat_dt";
> -			compression = "none";
> -		};
> -	};
> -
> -	configurations {
> -		default = "conf";
> -		conf {
> -			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
> -			firmware = "atf";
> -			loadables = "uboot", "pmu";
> -			fdt = "fdt";
> -		};
> -	};
> -};
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> new file mode 100755
> index 0000000000..420e7daf4c
> --- /dev/null
> +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> @@ -0,0 +1,94 @@
> +#!/bin/sh
> +#
> +# SPDX-License-Identifier:      GPL-2.0+
> +#
> +# Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
> +#
> +# Based on the board/sunxi/mksunxi_fit_atf.sh
> +#
> +# Script to generate FIT image source for 64-bit puma boards with
> +# U-Boot proper, ATF, PMU firmware and devicetree.
> +#
> +# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
> +
> +[ -z "$BL31" ] && BL31="bl31.bin"
> +
> +if [ ! -f $BL31 ]; then
> +	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
> +	echo "Please read Building section in doc/README.rockchip" >&2
> +	BL31=/dev/null
> +fi
> +
> +[ -z "$PMUM0" ] && PMUM0="rk3399m0.bin"
> +
> +if [ ! -f $PMUM0 ]; then
> +	echo "WARNING: PMUM0 file $PMUM0 NOT found, resulting binary is non-functional" >&2
> +	echo "Please read Building section in doc/README.rockchip" >&2
> +	PMUM0=/dev/null
> +fi
> +
> +cat << __HEADER_EOF
> +/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
> +/*
> + * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
> + *
> + * Minimal dts for a SPL FIT image payload.
> + */
> +
> +/dts-v1/;
> +
> +/ {
> +	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
> +	#address-cells = <1>;
> +
> +	images {
> +		uboot {
> +			description = "U-Boot (64-bit)";
> +			data = /incbin/("u-boot-nodtb.bin");
> +			type = "standalone";
> +			arch = "arm64";
> +			compression = "none";
> +			load = <0x4a000000>;
> +		};
> +		atf {
> +			description = "ARM Trusted Firmware";
> +			data = /incbin/("$BL31");
> +			type = "firmware";
> +			arch = "arm64";
> +			os = "arm-trusted-firmware";
> +			compression = "none";
> +			load = <0x1000>;
> +			entry = <0x1000>;
> +		};
> +		pmu {
> +		        description = "Cortex-M0 firmware";
> +			data = /incbin/("$PMUM0");
> +			type = "pmu-firmware";
> +			compression = "none";
> +			load = <0x180000>;
> +                };
> +		fdt {
> +			description = "RK3399-Q7 (Puma) flat device-tree";
> +			data = /incbin/("u-boot.dtb");
> +			type = "flat_dt";
> +			compression = "none";
> +		};
> +__HEADER_EOF
> +
> +cat << __CONF_HEADER_EOF
> +	};
> +
> +	configurations {
> +		default = "conf";
> +		conf {
> +			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
> +			firmware = "atf";
> +			loadables = "uboot", "pmu";
> +			fdt = "fdt";
> +		};
> +__CONF_HEADER_EOF
> +
> +cat << __ITS_EOF
> +	};
> +};
> +__ITS_EOF
> diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
> index 03f0bfdb59..ebc78fb216 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -15,7 +15,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
>  CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  CONFIG_DEBUG_UART=y
> -CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/puma_rk3399/fit_spl_atf.its"
> +CONFIG_SPL_FIT_GENERATOR="board/theobroma-systems/puma_rk3399/fit_spl_atf.sh"
>  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
>  CONFIG_MISC_INIT_R=y
>  # CONFIG_DISPLAY_CPUINFO is not set
> diff --git a/doc/README.rockchip b/doc/README.rockchip
> index 5680c075fa..0ee54cd00e 100644
> --- a/doc/README.rockchip
> +++ b/doc/README.rockchip
> @@ -137,8 +137,8 @@ For example:
>  	=> cd arm-trusted-firmware
>  	=> make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31
>  
> -	(copy bl31.bin into U-Boot root dir)
> -	=> cp build/rk3399/release/bl31/bl31.bin /path/to/u-boot/bl31-rk3399.bin
> +	(export bl31.bin)
> +	=> export BL31=/path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.bin
>  
>       For rest of rk3399 boards.
>  
> @@ -162,8 +162,8 @@ For example:
>       (export cross compiler path for Cortex-M0 PMU)
>       => make CROSS_COMPILE=arm-cortex_m0-eabi-
>  
> -     (copy rk3399m0.bin into U-Boot root dir)
> -     => cp rk3399m0.bin /path/to/u-boot
> +     (export rk3399m0.bin)
> +     => export PMUM0=/path/to/rk3399-cortex-m0/rk3399m0.bin
>  
>     - Compile U-Boot
>  



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH v4 5/6] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
@ 2019-06-21  9:39       ` Kever Yang
  0 siblings, 0 replies; 18+ messages in thread
From: Kever Yang @ 2019-06-21  9:39 UTC (permalink / raw)
  To: u-boot



On 06/20/2019 06:07 PM, Jagan Teki wrote:
> Right now puma rk3399 board need to copy bl31-rk3399.bin and
> rk3399m0.bin into u-boot source directory to make use of building
> u-boot.itb.
>
> So, add environment variable
> - BL31 for bl31.bin (instead of bl31-rk3399.bin to compatible with other
>   platform BL31 env)
> - PMUM0 for rk3399m0.bin
>
> If the builds are not exporting BL31, PMUM0 env, the fit_spl_atf.sh will
> notify with warning about which document to refer for more information
> like this:
>
>  WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional
>  Please read Building section in doc/README.rockchip
>  WARNING: PMUM0 file rk3399m0.bin NOT found, resulting binary is non-functional
>  Please read Building section in doc/README.rockchip
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>  .../puma_rk3399/fit_spl_atf.its               | 58 ------------
>  .../puma_rk3399/fit_spl_atf.sh                | 94 +++++++++++++++++++
>  configs/puma-rk3399_defconfig                 |  2 +-
>  doc/README.rockchip                           |  8 +-
>  4 files changed, 99 insertions(+), 63 deletions(-)
>  delete mode 100644 board/theobroma-systems/puma_rk3399/fit_spl_atf.its
>  create mode 100755 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
>
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> deleted file mode 100644
> index 530f059f3d..0000000000
> --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
> -/*
> - * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
> - *
> - * Minimal dts for a SPL FIT image payload.
> - */
> -
> -/dts-v1/;
> -
> -/ {
> -	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
> -	#address-cells = <1>;
> -
> -	images {
> -		uboot {
> -			description = "U-Boot (64-bit)";
> -			data = /incbin/("../../../u-boot-nodtb.bin");
> -			type = "standalone";
> -			os = "U-Boot";
> -			arch = "arm64";
> -			compression = "none";
> -			load = <0x00200000>;
> -		};
> -		atf {
> -			description = "ARM Trusted Firmware";
> -			data = /incbin/("../../../bl31-rk3399.bin");
> -			type = "firmware";
> -			arch = "arm64";
> -			os = "arm-trusted-firmware";
> -			compression = "none";
> -			load = <0x1000>;
> -			entry = <0x1000>;
> -		};
> -		pmu {
> -		        description = "Cortex-M0 firmware";
> -			data = /incbin/("../../../rk3399m0.bin");
> -			type = "pmu-firmware";
> -			compression = "none";
> -			load = <0x180000>;
> -                };
> -		fdt {
> -			description = "RK3399-Q7 (Puma) flat device-tree";
> -			data = /incbin/("../../../u-boot.dtb");
> -			type = "flat_dt";
> -			compression = "none";
> -		};
> -	};
> -
> -	configurations {
> -		default = "conf";
> -		conf {
> -			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
> -			firmware = "atf";
> -			loadables = "uboot", "pmu";
> -			fdt = "fdt";
> -		};
> -	};
> -};
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> new file mode 100755
> index 0000000000..420e7daf4c
> --- /dev/null
> +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> @@ -0,0 +1,94 @@
> +#!/bin/sh
> +#
> +# SPDX-License-Identifier:      GPL-2.0+
> +#
> +# Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
> +#
> +# Based on the board/sunxi/mksunxi_fit_atf.sh
> +#
> +# Script to generate FIT image source for 64-bit puma boards with
> +# U-Boot proper, ATF, PMU firmware and devicetree.
> +#
> +# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
> +
> +[ -z "$BL31" ] && BL31="bl31.bin"
> +
> +if [ ! -f $BL31 ]; then
> +	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
> +	echo "Please read Building section in doc/README.rockchip" >&2
> +	BL31=/dev/null
> +fi
> +
> +[ -z "$PMUM0" ] && PMUM0="rk3399m0.bin"
> +
> +if [ ! -f $PMUM0 ]; then
> +	echo "WARNING: PMUM0 file $PMUM0 NOT found, resulting binary is non-functional" >&2
> +	echo "Please read Building section in doc/README.rockchip" >&2
> +	PMUM0=/dev/null
> +fi
> +
> +cat << __HEADER_EOF
> +/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
> +/*
> + * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
> + *
> + * Minimal dts for a SPL FIT image payload.
> + */
> +
> +/dts-v1/;
> +
> +/ {
> +	description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
> +	#address-cells = <1>;
> +
> +	images {
> +		uboot {
> +			description = "U-Boot (64-bit)";
> +			data = /incbin/("u-boot-nodtb.bin");
> +			type = "standalone";
> +			arch = "arm64";
> +			compression = "none";
> +			load = <0x4a000000>;
> +		};
> +		atf {
> +			description = "ARM Trusted Firmware";
> +			data = /incbin/("$BL31");
> +			type = "firmware";
> +			arch = "arm64";
> +			os = "arm-trusted-firmware";
> +			compression = "none";
> +			load = <0x1000>;
> +			entry = <0x1000>;
> +		};
> +		pmu {
> +		        description = "Cortex-M0 firmware";
> +			data = /incbin/("$PMUM0");
> +			type = "pmu-firmware";
> +			compression = "none";
> +			load = <0x180000>;
> +                };
> +		fdt {
> +			description = "RK3399-Q7 (Puma) flat device-tree";
> +			data = /incbin/("u-boot.dtb");
> +			type = "flat_dt";
> +			compression = "none";
> +		};
> +__HEADER_EOF
> +
> +cat << __CONF_HEADER_EOF
> +	};
> +
> +	configurations {
> +		default = "conf";
> +		conf {
> +			description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
> +			firmware = "atf";
> +			loadables = "uboot", "pmu";
> +			fdt = "fdt";
> +		};
> +__CONF_HEADER_EOF
> +
> +cat << __ITS_EOF
> +	};
> +};
> +__ITS_EOF
> diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
> index 03f0bfdb59..ebc78fb216 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -15,7 +15,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
>  CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  CONFIG_DEBUG_UART=y
> -CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/puma_rk3399/fit_spl_atf.its"
> +CONFIG_SPL_FIT_GENERATOR="board/theobroma-systems/puma_rk3399/fit_spl_atf.sh"
>  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
>  CONFIG_MISC_INIT_R=y
>  # CONFIG_DISPLAY_CPUINFO is not set
> diff --git a/doc/README.rockchip b/doc/README.rockchip
> index 5680c075fa..0ee54cd00e 100644
> --- a/doc/README.rockchip
> +++ b/doc/README.rockchip
> @@ -137,8 +137,8 @@ For example:
>  	=> cd arm-trusted-firmware
>  	=> make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31
>  
> -	(copy bl31.bin into U-Boot root dir)
> -	=> cp build/rk3399/release/bl31/bl31.bin /path/to/u-boot/bl31-rk3399.bin
> +	(export bl31.bin)
> +	=> export BL31=/path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.bin
>  
>       For rest of rk3399 boards.
>  
> @@ -162,8 +162,8 @@ For example:
>       (export cross compiler path for Cortex-M0 PMU)
>       => make CROSS_COMPILE=arm-cortex_m0-eabi-
>  
> -     (copy rk3399m0.bin into U-Boot root dir)
> -     => cp rk3399m0.bin /path/to/u-boot
> +     (export rk3399m0.bin)
> +     => export PMUM0=/path/to/rk3399-cortex-m0/rk3399m0.bin
>  
>     - Compile U-Boot
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-06-21  9:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 10:07 [PATCH v4 0/6] rockchip: rk3399: Make u-boot.itb as BUILD_TARGET Jagan Teki
2019-06-20 10:07 ` [U-Boot] " Jagan Teki
     [not found] ` <20190620100740.6560-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2019-06-20 10:07   ` [PATCH v4 1/6] Makefile: clean image.map Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki
2019-06-20 10:07   ` [PATCH v4 2/6] Makefile: clean bl31_*.bin Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki
2019-06-20 10:07   ` [PATCH v4 3/6] travis.yml: Add pyelftools install entry Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki
2019-06-20 10:07   ` [PATCH v4 4/6] rockchip: rk3399: Get bl31.elf via BL31 Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki
2019-06-21  9:38     ` Kever Yang
2019-06-21  9:38       ` [U-Boot] " Kever Yang
2019-06-20 10:07   ` [PATCH v4 5/6] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0 Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki
2019-06-21  9:39     ` Kever Yang
2019-06-21  9:39       ` [U-Boot] " Kever Yang
2019-06-20 10:07   ` [PATCH v4 6/6] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip Jagan Teki
2019-06-20 10:07     ` [U-Boot] " Jagan Teki

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.