All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] rk3399: make u-boot-rockchip-with-spl.bin
@ 2019-04-28  9:09 ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

This is v2 for previous series[1] to create single bootable image
using binman for rk3399 platform.

This series resolved the travis-ci build issuesi[2] which were listed
in previous series.

Series introduce BL31 env for exporting bl31.elf, If the builds 
are not exporting BL31 env, the make_fit_atf.py explicitly 
create dummy bl31.elf in u-boot root directory.

patch 1, 2: clean targets for bl31_*.bin and image.map

patch 3: travis.yml for pyelftools

patch 4: add BL31 env for bl31.elf

patch 5: add BL31 env for bl31.bin, PMUM0 env for rk3399m0.bin

patch 6: BUILD_TARGET patch

patch 7: create u-boot-spl-rockchip.bin

patch 8: order dtb builds based on SoC type

patch 9: create u-boot-rockchip-with-spl.bin

Changes for v2:
- Add few clean target patches
- update bl31.elf env handling code, with logging
- support puma itb, via BL31 and PMUM0 env
- enable BUILD_TARGET for ROCKCHIP_RK3399
- add patch to build rockchip dtbs based on SoC types
- update binman patch

[1] https://patchwork.ozlabs.org/cover/1091542/
[2] https://travis-ci.org/openedev/u-boot-amarula/builds/525545316

Jagan Teki (9):
  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
  Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
  dts: Makefile: Build rockchip dtbs based on SoC types
  rockchip: rk3399: Create single image using BINMAN

 .travis.yml                                   |  1 +
 Kconfig                                       |  2 +-
 Makefile                                      | 16 ++++++-
 arch/arm/dts/Makefile                         | 35 ++++++++++----
 arch/arm/dts/rk3399-ficus-u-boot.dtsi         |  1 +
 arch/arm/dts/rk3399-rock960-u-boot.dtsi       |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi               | 17 +++++++
 arch/arm/mach-rockchip/Kconfig                |  9 ++++
 arch/arm/mach-rockchip/make_fit_atf.py        | 11 ++++-
 .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           | 23 ++++------
 include/configs/rk3399_common.h               |  2 +
 scripts/Makefile.spl                          | 21 +++++++++
 14 files changed, 153 insertions(+), 34 deletions(-)
 rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
 mode change 100644 => 100755

-- 
2.18.0.321.gffc6fa0e3

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

* [U-Boot] [PATCH v2 0/9] rk3399: make u-boot-rockchip-with-spl.bin
@ 2019-04-28  9:09 ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: u-boot

This is v2 for previous series[1] to create single bootable image
using binman for rk3399 platform.

This series resolved the travis-ci build issuesi[2] which were listed
in previous series.

Series introduce BL31 env for exporting bl31.elf, If the builds 
are not exporting BL31 env, the make_fit_atf.py explicitly 
create dummy bl31.elf in u-boot root directory.

patch 1, 2: clean targets for bl31_*.bin and image.map

patch 3: travis.yml for pyelftools

patch 4: add BL31 env for bl31.elf

patch 5: add BL31 env for bl31.bin, PMUM0 env for rk3399m0.bin

patch 6: BUILD_TARGET patch

patch 7: create u-boot-spl-rockchip.bin

patch 8: order dtb builds based on SoC type

patch 9: create u-boot-rockchip-with-spl.bin

Changes for v2:
- Add few clean target patches
- update bl31.elf env handling code, with logging
- support puma itb, via BL31 and PMUM0 env
- enable BUILD_TARGET for ROCKCHIP_RK3399
- add patch to build rockchip dtbs based on SoC types
- update binman patch

[1] https://patchwork.ozlabs.org/cover/1091542/
[2] https://travis-ci.org/openedev/u-boot-amarula/builds/525545316

Jagan Teki (9):
  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
  Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
  dts: Makefile: Build rockchip dtbs based on SoC types
  rockchip: rk3399: Create single image using BINMAN

 .travis.yml                                   |  1 +
 Kconfig                                       |  2 +-
 Makefile                                      | 16 ++++++-
 arch/arm/dts/Makefile                         | 35 ++++++++++----
 arch/arm/dts/rk3399-ficus-u-boot.dtsi         |  1 +
 arch/arm/dts/rk3399-rock960-u-boot.dtsi       |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi               | 17 +++++++
 arch/arm/mach-rockchip/Kconfig                |  9 ++++
 arch/arm/mach-rockchip/make_fit_atf.py        | 11 ++++-
 .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           | 23 ++++------
 include/configs/rk3399_common.h               |  2 +
 scripts/Makefile.spl                          | 21 +++++++++
 14 files changed, 153 insertions(+), 34 deletions(-)
 rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
 mode change 100644 => 100755

-- 
2.18.0.321.gffc6fa0e3

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

* [PATCH v2 1/9] Makefile: clean image.map
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

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>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 92e04dd689..54e8fedff0 100644
--- a/Makefile
+++ b/Makefile
@@ -1781,7 +1781,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] 26+ messages in thread

* [U-Boot] [PATCH v2 1/9] Makefile: clean image.map
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 92e04dd689..54e8fedff0 100644
--- a/Makefile
+++ b/Makefile
@@ -1781,7 +1781,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] 26+ messages in thread

* [PATCH v2 2/9] Makefile: clean bl31_*.bin
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

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>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [U-Boot] [PATCH v2 2/9] Makefile: clean bl31_*.bin
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [PATCH v2 3/9] travis.yml: Add pyelftools install entry
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

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>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index eb531f1e5b..6dbbb5dd02 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,6 +49,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] 26+ messages in thread

* [U-Boot] [PATCH v2 3/9] travis.yml: Add pyelftools install entry
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index eb531f1e5b..6dbbb5dd02 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,6 +49,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] 26+ messages in thread

* [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Emmanuel Vadot, u-boot-0aAXYlwwYIKGBzrmiIFOJg, Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jagan Teki,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/

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

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

* [U-Boot] [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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.

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

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

* [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

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>
---
 .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           |  8 ++--
 3 files changed, 45 insertions(+), 11 deletions(-)
 rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
 mode change 100644 => 100755

diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
old mode 100644
new mode 100755
similarity index 50%
rename from board/theobroma-systems/puma_rk3399/fit_spl_atf.its
rename to board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
index 530f059f3d..517fad40a1
--- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
+++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
@@ -1,3 +1,31 @@
+#!/bin/sh
+#
+# 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
@@ -14,16 +42,15 @@
 	images {
 		uboot {
 			description = "U-Boot (64-bit)";
-			data = /incbin/("../../../u-boot-nodtb.bin");
+			data = /incbin/("u-boot-nodtb.bin");
 			type = "standalone";
-			os = "U-Boot";
 			arch = "arm64";
 			compression = "none";
-			load = <0x00200000>;
+			load = <0x4a000000>;
 		};
 		atf {
 			description = "ARM Trusted Firmware";
-			data = /incbin/("../../../bl31-rk3399.bin");
+			data = /incbin/("$BL31");
 			type = "firmware";
 			arch = "arm64";
 			os = "arm-trusted-firmware";
@@ -33,17 +60,20 @@
 		};
 		pmu {
 		        description = "Cortex-M0 firmware";
-			data = /incbin/("../../../rk3399m0.bin");
+			data = /incbin/("$PMUM0");
 			type = "pmu-firmware";
 			compression = "none";
 			load = <0x180000>;
                 };
 		fdt {
 			description = "RK3399-Q7 (Puma) flat device-tree";
-			data = /incbin/("../../../u-boot.dtb");
+			data = /incbin/("u-boot.dtb");
 			type = "flat_dt";
 			compression = "none";
 		};
+__HEADER_EOF
+
+cat << __CONF_HEADER_EOF
 	};
 
 	configurations {
@@ -54,5 +84,9 @@
 			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 e5ea2fe0b3..98b2dd6f02 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -15,7 +15,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEBUG_UART=y
 CONFIG_NR_DRAM_BANKS=1
-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 98a3824e2c..88a4593392 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] 26+ messages in thread

* [U-Boot] [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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>
---
 .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
 configs/puma-rk3399_defconfig                 |  2 +-
 doc/README.rockchip                           |  8 ++--
 3 files changed, 45 insertions(+), 11 deletions(-)
 rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
 mode change 100644 => 100755

diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
old mode 100644
new mode 100755
similarity index 50%
rename from board/theobroma-systems/puma_rk3399/fit_spl_atf.its
rename to board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
index 530f059f3d..517fad40a1
--- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
+++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
@@ -1,3 +1,31 @@
+#!/bin/sh
+#
+# 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
@@ -14,16 +42,15 @@
 	images {
 		uboot {
 			description = "U-Boot (64-bit)";
-			data = /incbin/("../../../u-boot-nodtb.bin");
+			data = /incbin/("u-boot-nodtb.bin");
 			type = "standalone";
-			os = "U-Boot";
 			arch = "arm64";
 			compression = "none";
-			load = <0x00200000>;
+			load = <0x4a000000>;
 		};
 		atf {
 			description = "ARM Trusted Firmware";
-			data = /incbin/("../../../bl31-rk3399.bin");
+			data = /incbin/("$BL31");
 			type = "firmware";
 			arch = "arm64";
 			os = "arm-trusted-firmware";
@@ -33,17 +60,20 @@
 		};
 		pmu {
 		        description = "Cortex-M0 firmware";
-			data = /incbin/("../../../rk3399m0.bin");
+			data = /incbin/("$PMUM0");
 			type = "pmu-firmware";
 			compression = "none";
 			load = <0x180000>;
                 };
 		fdt {
 			description = "RK3399-Q7 (Puma) flat device-tree";
-			data = /incbin/("../../../u-boot.dtb");
+			data = /incbin/("u-boot.dtb");
 			type = "flat_dt";
 			compression = "none";
 		};
+__HEADER_EOF
+
+cat << __CONF_HEADER_EOF
 	};
 
 	configurations {
@@ -54,5 +84,9 @@
 			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 e5ea2fe0b3..98b2dd6f02 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -15,7 +15,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEBUG_UART=y
 CONFIG_NR_DRAM_BANKS=1
-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 98a3824e2c..88a4593392 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] 26+ messages in thread

* [PATCH v2 6/9] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

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>
---
 Kconfig             | 2 +-
 doc/README.rockchip | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index 5679a288ec..7e918e5c37 100644
--- a/Kconfig
+++ b/Kconfig
@@ -230,7 +230,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
 	help
 	  Some SoCs need special image types (e.g. U-Boot binary
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 88a4593392..c4e5f83da7 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] 26+ messages in thread

* [U-Boot] [PATCH v2 6/9] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 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>
---
 Kconfig             | 2 +-
 doc/README.rockchip | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index 5679a288ec..7e918e5c37 100644
--- a/Kconfig
+++ b/Kconfig
@@ -230,7 +230,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
 	help
 	  Some SoCs need special image types (e.g. U-Boot binary
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 88a4593392..c4e5f83da7 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] 26+ messages in thread

* [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

Rockchip platform would require an explicit call to mkimage for
creating bootable images which indeed specific to SoC family
along with boot devices.

Example of creating bootable image for rk3399 family with SD
boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support
other families of SoC's with variety of boot stages like TPL, SPL.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index dbe7f11d39..286c870135 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
 config ROCKCHIP_BROM_HELPER
 	bool
 
+config SPL_ROCKCHIP_IMG_NAME
+	string "SPL Rockchip image name"
+	default "rk3399" if ROCKCHIP_RK3399
+	help
+	  To create SPL image for rockchip targets the image name would
+	  depends on the SoC family that would pass as an argument as
+	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
+
 config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
         bool "SPL requires early-return (for RK3188-style BROM) to BROM"
 	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
diff --git a/doc/README.rockchip b/doc/README.rockchip
index c4e5f83da7..ccbaaaa9a7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -421,11 +421,10 @@ Option 2: Package the image with SPL:
   - Prefix rk3399 header to SPL image
 
     => cd /path/to/u-boot
-    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
 
   - Write prefixed SPL at 64th sector
 
-    => sudo dd if=out of=/dev/sdc seek=64
+    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
 
   - Write U-Boot proper at 16384 sector
 
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 54b160d72b..49c0641aa2 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
 
 ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
 
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
+endif
+
 all:	$(ALL-y)
 
 quiet_cmd_cat = CAT     $@
@@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
 $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 
+# Rockchip specific SPL build
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+
+ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
+ROCKCHIP_IMG_TYPE := rkspi
+else
+ROCKCHIP_IMG_TYPE := rksd
+endif
+
+MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \
+	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
+
+$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+
+endif # CONFIG_ROCKCHIP_RK3399
+
 # Rule to link u-boot-spl
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot-spl ?= LD      $@
-- 
2.18.0.321.gffc6fa0e3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [U-Boot] [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: u-boot

Rockchip platform would require an explicit call to mkimage for
creating bootable images which indeed specific to SoC family
along with boot devices.

Example of creating bootable image for rk3399 family with SD
boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support
other families of SoC's with variety of boot stages like TPL, SPL.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index dbe7f11d39..286c870135 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
 config ROCKCHIP_BROM_HELPER
 	bool
 
+config SPL_ROCKCHIP_IMG_NAME
+	string "SPL Rockchip image name"
+	default "rk3399" if ROCKCHIP_RK3399
+	help
+	  To create SPL image for rockchip targets the image name would
+	  depends on the SoC family that would pass as an argument as
+	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
+
 config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
         bool "SPL requires early-return (for RK3188-style BROM) to BROM"
 	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
diff --git a/doc/README.rockchip b/doc/README.rockchip
index c4e5f83da7..ccbaaaa9a7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -421,11 +421,10 @@ Option 2: Package the image with SPL:
   - Prefix rk3399 header to SPL image
 
     => cd /path/to/u-boot
-    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
 
   - Write prefixed SPL at 64th sector
 
-    => sudo dd if=out of=/dev/sdc seek=64
+    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
 
   - Write U-Boot proper at 16384 sector
 
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 54b160d72b..49c0641aa2 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
 
 ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
 
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
+endif
+
 all:	$(ALL-y)
 
 quiet_cmd_cat = CAT     $@
@@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
 $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 
+# Rockchip specific SPL build
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+
+ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
+ROCKCHIP_IMG_TYPE := rkspi
+else
+ROCKCHIP_IMG_TYPE := rksd
+endif
+
+MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \
+	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
+
+$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+
+endif # CONFIG_ROCKCHIP_RK3399
+
 # Rule to link u-boot-spl
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot-spl ?= LD      $@
-- 
2.18.0.321.gffc6fa0e3

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

* [PATCH v2 8/9] dts: Makefile: Build rockchip dtbs based on SoC types
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

Sometimes u-boot specific dts nodes or properties can use
from config macros from respective rockchip family include/configs
files, example CONFIG_SPL_PAD_TO.

So, it's better to compile the dtbs based on the respective
rockchip family types rather than rockchip itself to avoid
compilation issues.

This patch organize the existing dtb's based on the rockchip
family types.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
---
 arch/arm/dts/Makefile | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index a2911fa2fd..0f9d6b7d0d 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -60,11 +60,19 @@ dtb-$(CONFIG_KIRKWOOD) += \
 dtb-$(CONFIG_ARCH_OWL) += \
 	bubblegum_96.dtb
 
-dtb-$(CONFIG_ARCH_ROCKCHIP) += \
-	rk3036-sdk.dtb \
-	rk3128-evb.dtb \
-	rk3188-radxarock.dtb \
-	rk3229-evb.dtb \
+dtb-$(CONFIG_ROCKCHIP_RK3036) += \
+	rk3036-sdk.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3128) += \
+	rk3128-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3188) += \
+	rk3188-radxarock.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK322X) += \
+	rk3229-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3288) += \
 	rk3288-evb.dtb \
 	rk3288-fennec.dtb \
 	rk3288-firefly.dtb \
@@ -77,14 +85,20 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-veyron-mickey.dtb \
 	rk3288-veyron-minnie.dtb \
 	rk3288-veyron-speedy.dtb \
-	rk3288-vyasa.dtb \
-	rk3328-evb.dtb \
-	rk3399-ficus.dtb \
+	rk3288-vyasa.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3328) += \
+	rk3328-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3368) += \
 	rk3368-lion.dtb \
 	rk3368-sheep.dtb \
 	rk3368-geekbox.dtb \
 	rk3368-px5-evb.dtb \
+
+dtb-$(CONFIG_ROCKCHIP_RK3399) += \
 	rk3399-evb.dtb \
+	rk3399-ficus.dtb \
 	rk3399-firefly.dtb \
 	rk3399-gru-bob.dtb \
 	rk3399-nanopc-t4.dtb \
@@ -96,9 +110,12 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3399-puma-ddr1866.dtb \
 	rk3399-rock-pi-4.dtb \
 	rk3399-rock960.dtb \
-	rk3399-rockpro64.dtb \
+	rk3399-rockpro64.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RV1108) += \
 	rv1108-elgin-r1.dtb \
 	rv1108-evb.dtb
+
 dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxbb-nanopi-k2.dtb \
 	meson-gxbb-odroidc2.dtb \
-- 
2.18.0.321.gffc6fa0e3

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

* [U-Boot] [PATCH v2 8/9] dts: Makefile: Build rockchip dtbs based on SoC types
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: u-boot

Sometimes u-boot specific dts nodes or properties can use
from config macros from respective rockchip family include/configs
files, example CONFIG_SPL_PAD_TO.

So, it's better to compile the dtbs based on the respective
rockchip family types rather than rockchip itself to avoid
compilation issues.

This patch organize the existing dtb's based on the rockchip
family types.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/dts/Makefile | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index a2911fa2fd..0f9d6b7d0d 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -60,11 +60,19 @@ dtb-$(CONFIG_KIRKWOOD) += \
 dtb-$(CONFIG_ARCH_OWL) += \
 	bubblegum_96.dtb
 
-dtb-$(CONFIG_ARCH_ROCKCHIP) += \
-	rk3036-sdk.dtb \
-	rk3128-evb.dtb \
-	rk3188-radxarock.dtb \
-	rk3229-evb.dtb \
+dtb-$(CONFIG_ROCKCHIP_RK3036) += \
+	rk3036-sdk.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3128) += \
+	rk3128-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3188) += \
+	rk3188-radxarock.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK322X) += \
+	rk3229-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3288) += \
 	rk3288-evb.dtb \
 	rk3288-fennec.dtb \
 	rk3288-firefly.dtb \
@@ -77,14 +85,20 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-veyron-mickey.dtb \
 	rk3288-veyron-minnie.dtb \
 	rk3288-veyron-speedy.dtb \
-	rk3288-vyasa.dtb \
-	rk3328-evb.dtb \
-	rk3399-ficus.dtb \
+	rk3288-vyasa.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3328) += \
+	rk3328-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3368) += \
 	rk3368-lion.dtb \
 	rk3368-sheep.dtb \
 	rk3368-geekbox.dtb \
 	rk3368-px5-evb.dtb \
+
+dtb-$(CONFIG_ROCKCHIP_RK3399) += \
 	rk3399-evb.dtb \
+	rk3399-ficus.dtb \
 	rk3399-firefly.dtb \
 	rk3399-gru-bob.dtb \
 	rk3399-nanopc-t4.dtb \
@@ -96,9 +110,12 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3399-puma-ddr1866.dtb \
 	rk3399-rock-pi-4.dtb \
 	rk3399-rock960.dtb \
-	rk3399-rockpro64.dtb \
+	rk3399-rockpro64.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RV1108) += \
 	rv1108-elgin-r1.dtb \
 	rv1108-evb.dtb
+
 dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxbb-nanopi-k2.dtb \
 	meson-gxbb-odroidc2.dtb \
-- 
2.18.0.321.gffc6fa0e3

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

* [PATCH v2 9/9] rockchip: rk3399: Create single image using BINMAN
  2019-04-28  9:09 ` [U-Boot] " Jagan Teki
@ 2019-04-28  9:09     ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, u-boot-0aAXYlwwYIKGBzrmiIFOJg

RK3399 platform has two stage boot loaders like SPL and
U-Boot proper. For each stage we need to burn the image
on to flash with respective offsets.

This patch create a single image using binman, so that
user can get rid of burning different stage boot images.

without this patch:
------------------
₹ sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
₹ sudo dd if=u-boot.itb of=/dev/sdc seek=16384

with this patch:
---------------
₹ sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64

This would easily extend if other rockchip family SoC's would
make use of single image creation.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 Makefile                                | 13 +++++++++++++
 arch/arm/dts/rk3399-ficus-u-boot.dtsi   |  1 +
 arch/arm/dts/rk3399-rock960-u-boot.dtsi |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi         | 17 +++++++++++++++++
 arch/arm/mach-rockchip/Kconfig          |  1 +
 doc/README.rockchip                     |  8 ++------
 include/configs/rk3399_common.h         |  2 ++
 7 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 2471340c71..0fe7ac3cc0 100644
--- a/Makefile
+++ b/Makefile
@@ -851,6 +851,11 @@ ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
 ALL-y += u-boot-sunxi-with-spl.bin
 endif
 
+# Build a combined spl + u-boot image for rockchip
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP) += u-boot-rockchip-with-spl.bin
+endif
+
 # enable combined SPL/u-boot/dtb rules for tegra
 ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy)
 ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1366,6 +1371,11 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
 endif
 endif
 
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+u-boot-rockchip-with-spl.bin: spl/u-boot-spl-rockchip.bin u-boot.itb FORCE
+	@$(call if_changed,binman)
+endif # CONFIG_ROCKCHIP_RK3399
+
 ifneq ($(CONFIG_TEGRA),)
 ifneq ($(CONFIG_BINMAN),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1664,6 +1674,9 @@ spl/u-boot-spl: tools prepare \
 spl/sunxi-spl.bin: spl/u-boot-spl
 	@:
 
+spl/u-boot-spl-rockchip.bin: spl/u-boot-spl
+	@:
+
 spl/sunxi-spl-with-ecc.bin: spl/sunxi-spl.bin
 	@:
 
diff --git a/arch/arm/dts/rk3399-ficus-u-boot.dtsi b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
index eab86bdb30..67b63a8352 100644
--- a/arch/arm/dts/rk3399-ficus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-ddr3-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-rock960-u-boot.dtsi b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
index 5256f6d3f2..7fb5072a9b 100644
--- a/arch/arm/dts/rk3399-rock960-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-lpddr3-2GB-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 0786c1193a..abd0b091ab 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -3,6 +3,23 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include <config.h>
+
+/ {
+	binman {
+		filename = "u-boot-rockchip-with-spl.bin";
+		pad-byte = <0xff>;
+
+		blob {
+			filename = "spl/u-boot-spl-rockchip.bin";
+		};
+
+		u-boot-img {
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+};
+
 &sdmmc {
 	u-boot,dm-pre-reloc;
 };
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 286c870135..7ac0ee3c2d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -130,6 +130,7 @@ endif
 config ROCKCHIP_RK3399
 	bool "Support Rockchip RK3399"
 	select ARM64
+	select BINMAN
 	select SUPPORT_SPL
 	select SPL
 	select SPL_ATF
diff --git a/doc/README.rockchip b/doc/README.rockchip
index ccbaaaa9a7..4ceb383bb7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -422,13 +422,9 @@ Option 2: Package the image with SPL:
 
     => cd /path/to/u-boot
 
-  - Write prefixed SPL at 64th sector
+  - Write single spl + u-boot at 64th sector
 
-    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
-
-  - Write U-Boot proper at 16384 sector
-
-    => sudo dd if=u-boot.itb of=/dev/sdc seek=16384
+    => sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64
     => sync
 
 Put this SD (or micro-SD) card into your board and reset it. You should see
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index b412012582..a658f03ade 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -38,6 +38,8 @@
 #define CONFIG_SYS_SDRAM_BASE		0
 #define SDRAM_MAX_SIZE			0xf8000000
 
+#define CONFIG_SPL_PAD_TO		8355840
+
 #ifndef CONFIG_SPL_BUILD
 
 #define ENV_MEM_LAYOUT_SETTINGS \
-- 
2.18.0.321.gffc6fa0e3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [U-Boot] [PATCH v2 9/9] rockchip: rk3399: Create single image using BINMAN
@ 2019-04-28  9:09     ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-04-28  9:09 UTC (permalink / raw)
  To: u-boot

RK3399 platform has two stage boot loaders like SPL and
U-Boot proper. For each stage we need to burn the image
on to flash with respective offsets.

This patch create a single image using binman, so that
user can get rid of burning different stage boot images.

without this patch:
------------------
₹ sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
₹ sudo dd if=u-boot.itb of=/dev/sdc seek=16384

with this patch:
---------------
₹ sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64

This would easily extend if other rockchip family SoC's would
make use of single image creation.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 Makefile                                | 13 +++++++++++++
 arch/arm/dts/rk3399-ficus-u-boot.dtsi   |  1 +
 arch/arm/dts/rk3399-rock960-u-boot.dtsi |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi         | 17 +++++++++++++++++
 arch/arm/mach-rockchip/Kconfig          |  1 +
 doc/README.rockchip                     |  8 ++------
 include/configs/rk3399_common.h         |  2 ++
 7 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 2471340c71..0fe7ac3cc0 100644
--- a/Makefile
+++ b/Makefile
@@ -851,6 +851,11 @@ ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
 ALL-y += u-boot-sunxi-with-spl.bin
 endif
 
+# Build a combined spl + u-boot image for rockchip
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP) += u-boot-rockchip-with-spl.bin
+endif
+
 # enable combined SPL/u-boot/dtb rules for tegra
 ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy)
 ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1366,6 +1371,11 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
 endif
 endif
 
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+u-boot-rockchip-with-spl.bin: spl/u-boot-spl-rockchip.bin u-boot.itb FORCE
+	@$(call if_changed,binman)
+endif # CONFIG_ROCKCHIP_RK3399
+
 ifneq ($(CONFIG_TEGRA),)
 ifneq ($(CONFIG_BINMAN),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1664,6 +1674,9 @@ spl/u-boot-spl: tools prepare \
 spl/sunxi-spl.bin: spl/u-boot-spl
 	@:
 
+spl/u-boot-spl-rockchip.bin: spl/u-boot-spl
+	@:
+
 spl/sunxi-spl-with-ecc.bin: spl/sunxi-spl.bin
 	@:
 
diff --git a/arch/arm/dts/rk3399-ficus-u-boot.dtsi b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
index eab86bdb30..67b63a8352 100644
--- a/arch/arm/dts/rk3399-ficus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-ddr3-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-rock960-u-boot.dtsi b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
index 5256f6d3f2..7fb5072a9b 100644
--- a/arch/arm/dts/rk3399-rock960-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-lpddr3-2GB-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 0786c1193a..abd0b091ab 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -3,6 +3,23 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include <config.h>
+
+/ {
+	binman {
+		filename = "u-boot-rockchip-with-spl.bin";
+		pad-byte = <0xff>;
+
+		blob {
+			filename = "spl/u-boot-spl-rockchip.bin";
+		};
+
+		u-boot-img {
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+};
+
 &sdmmc {
 	u-boot,dm-pre-reloc;
 };
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 286c870135..7ac0ee3c2d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -130,6 +130,7 @@ endif
 config ROCKCHIP_RK3399
 	bool "Support Rockchip RK3399"
 	select ARM64
+	select BINMAN
 	select SUPPORT_SPL
 	select SPL
 	select SPL_ATF
diff --git a/doc/README.rockchip b/doc/README.rockchip
index ccbaaaa9a7..4ceb383bb7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -422,13 +422,9 @@ Option 2: Package the image with SPL:
 
     => cd /path/to/u-boot
 
-  - Write prefixed SPL at 64th sector
+  - Write single spl + u-boot at 64th sector
 
-    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
-
-  - Write U-Boot proper at 16384 sector
-
-    => sudo dd if=u-boot.itb of=/dev/sdc seek=16384
+    => sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64
     => sync
 
 Put this SD (or micro-SD) card into your board and reset it. You should see
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index b412012582..a658f03ade 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -38,6 +38,8 @@
 #define CONFIG_SYS_SDRAM_BASE		0
 #define SDRAM_MAX_SIZE			0xf8000000
 
+#define CONFIG_SPL_PAD_TO		8355840
+
 #ifndef CONFIG_SPL_BUILD
 
 #define ENV_MEM_LAYOUT_SETTINGS \
-- 
2.18.0.321.gffc6fa0e3

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

* Re: [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0
  2019-04-28  9:09     ` [U-Boot] " Jagan Teki
@ 2019-05-07  5:01         ` Kever Yang
  -1 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-05-07  5:01 UTC (permalink / raw)
  To: Jagan Teki, Simon Glass, Philipp Tomsich, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Klaus Goger,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	u-boot-0aAXYlwwYIKGBzrmiIFOJg

Hi Philipp and Klaus,

    Does this patch OK for your boards?

Thanks,
-Kever
On 04/28/2019 05:09 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>
> ---
>  .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
>  configs/puma-rk3399_defconfig                 |  2 +-
>  doc/README.rockchip                           |  8 ++--
>  3 files changed, 45 insertions(+), 11 deletions(-)
>  rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
>  mode change 100644 => 100755
>
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> old mode 100644
> new mode 100755
> similarity index 50%
> rename from board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> rename to board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> index 530f059f3d..517fad40a1
> --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> @@ -1,3 +1,31 @@
> +#!/bin/sh
> +#
> +# 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
> @@ -14,16 +42,15 @@
>  	images {
>  		uboot {
>  			description = "U-Boot (64-bit)";
> -			data = /incbin/("../../../u-boot-nodtb.bin");
> +			data = /incbin/("u-boot-nodtb.bin");
>  			type = "standalone";
> -			os = "U-Boot";
>  			arch = "arm64";
>  			compression = "none";
> -			load = <0x00200000>;
> +			load = <0x4a000000>;
>  		};
>  		atf {
>  			description = "ARM Trusted Firmware";
> -			data = /incbin/("../../../bl31-rk3399.bin");
> +			data = /incbin/("$BL31");
>  			type = "firmware";
>  			arch = "arm64";
>  			os = "arm-trusted-firmware";
> @@ -33,17 +60,20 @@
>  		};
>  		pmu {
>  		        description = "Cortex-M0 firmware";
> -			data = /incbin/("../../../rk3399m0.bin");
> +			data = /incbin/("$PMUM0");
>  			type = "pmu-firmware";
>  			compression = "none";
>  			load = <0x180000>;
>                  };
>  		fdt {
>  			description = "RK3399-Q7 (Puma) flat device-tree";
> -			data = /incbin/("../../../u-boot.dtb");
> +			data = /incbin/("u-boot.dtb");
>  			type = "flat_dt";
>  			compression = "none";
>  		};
> +__HEADER_EOF
> +
> +cat << __CONF_HEADER_EOF
>  	};
>  
>  	configurations {
> @@ -54,5 +84,9 @@
>  			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 e5ea2fe0b3..98b2dd6f02 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -15,7 +15,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  CONFIG_DEBUG_UART=y
>  CONFIG_NR_DRAM_BANKS=1
> -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 98a3824e2c..88a4593392 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
>  




_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

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

Hi Philipp and Klaus,

    Does this patch OK for your boards?

Thanks,
-Kever
On 04/28/2019 05:09 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>
> ---
>  .../{fit_spl_atf.its => fit_spl_atf.sh}       | 46 ++++++++++++++++---
>  configs/puma-rk3399_defconfig                 |  2 +-
>  doc/README.rockchip                           |  8 ++--
>  3 files changed, 45 insertions(+), 11 deletions(-)
>  rename board/theobroma-systems/puma_rk3399/{fit_spl_atf.its => fit_spl_atf.sh} (50%)
>  mode change 100644 => 100755
>
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> old mode 100644
> new mode 100755
> similarity index 50%
> rename from board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> rename to board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> index 530f059f3d..517fad40a1
> --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.its
> +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> @@ -1,3 +1,31 @@
> +#!/bin/sh
> +#
> +# 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
> @@ -14,16 +42,15 @@
>  	images {
>  		uboot {
>  			description = "U-Boot (64-bit)";
> -			data = /incbin/("../../../u-boot-nodtb.bin");
> +			data = /incbin/("u-boot-nodtb.bin");
>  			type = "standalone";
> -			os = "U-Boot";
>  			arch = "arm64";
>  			compression = "none";
> -			load = <0x00200000>;
> +			load = <0x4a000000>;
>  		};
>  		atf {
>  			description = "ARM Trusted Firmware";
> -			data = /incbin/("../../../bl31-rk3399.bin");
> +			data = /incbin/("$BL31");
>  			type = "firmware";
>  			arch = "arm64";
>  			os = "arm-trusted-firmware";
> @@ -33,17 +60,20 @@
>  		};
>  		pmu {
>  		        description = "Cortex-M0 firmware";
> -			data = /incbin/("../../../rk3399m0.bin");
> +			data = /incbin/("$PMUM0");
>  			type = "pmu-firmware";
>  			compression = "none";
>  			load = <0x180000>;
>                  };
>  		fdt {
>  			description = "RK3399-Q7 (Puma) flat device-tree";
> -			data = /incbin/("../../../u-boot.dtb");
> +			data = /incbin/("u-boot.dtb");
>  			type = "flat_dt";
>  			compression = "none";
>  		};
> +__HEADER_EOF
> +
> +cat << __CONF_HEADER_EOF
>  	};
>  
>  	configurations {
> @@ -54,5 +84,9 @@
>  			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 e5ea2fe0b3..98b2dd6f02 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -15,7 +15,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  CONFIG_DEBUG_UART=y
>  CONFIG_NR_DRAM_BANKS=1
> -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 98a3824e2c..88a4593392 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] 26+ messages in thread

* Re: [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
  2019-04-28  9:09     ` [U-Boot] " Jagan Teki
@ 2019-05-07  6:34         ` Kever Yang
  -1 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-05-07  6:34 UTC (permalink / raw)
  To: Jagan Teki, Simon Glass, Philipp Tomsich, Akash Gajjar, Tom Rini,
	Manivannan Sadhasivam
  Cc: Paul Kocialkowski,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	u-boot-0aAXYlwwYIKGBzrmiIFOJg

Hi Jagan,

On 04/28/2019 05:09 PM, Jagan Teki wrote:
> Rockchip platform would require an explicit call to mkimage for
> creating bootable images which indeed specific to SoC family
> along with boot devices.
>
> Example of creating bootable image for rk3399 family with SD
> boot device as
>
> ₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin
>
> This patch would do the same think via Makefile.spl for rk3399.
>
> This would be an initial version and it can easily expand further to support
> other families of SoC's with variety of boot stages like TPL, SPL.

    rk3399 may have TPL like other SoCs, for there will be image types:

SPL+u-boot.bin

SPL+u-boot.itb

TPL+SPL+u-boot.itb

Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?

Is it possible to make it more generic?


Thanks,

- Kever

>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  arch/arm/mach-rockchip/Kconfig |  8 ++++++++
>  doc/README.rockchip            |  3 +--
>  scripts/Makefile.spl           | 21 +++++++++++++++++++++
>  3 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index dbe7f11d39..286c870135 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
>  config ROCKCHIP_BROM_HELPER
>  	bool
>  
> +config SPL_ROCKCHIP_IMG_NAME
> +	string "SPL Rockchip image name"
> +	default "rk3399" if ROCKCHIP_RK3399
> +	help
> +	  To create SPL image for rockchip targets the image name would
> +	  depends on the SoC family that would pass as an argument as
> +	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
> +
>  config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
>          bool "SPL requires early-return (for RK3188-style BROM) to BROM"
>  	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
> diff --git a/doc/README.rockchip b/doc/README.rockchip
> index c4e5f83da7..ccbaaaa9a7 100644
> --- a/doc/README.rockchip
> +++ b/doc/README.rockchip
> @@ -421,11 +421,10 @@ Option 2: Package the image with SPL:
>    - Prefix rk3399 header to SPL image
>  
>      => cd /path/to/u-boot
> -    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
>  
>    - Write prefixed SPL at 64th sector
>  
> -    => sudo dd if=out of=/dev/sdc seek=64
> +    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
>  
>    - Write U-Boot proper at 16384 sector
>  
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 54b160d72b..49c0641aa2 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
>  
>  ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
>  
> +ifdef CONFIG_ROCKCHIP_RK3399
> +ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
> +endif
> +
>  all:	$(ALL-y)
>  
>  quiet_cmd_cat = CAT     $@
> @@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
>  $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
>  	$(call if_changed,mkimage)
>  
> +# Rockchip specific SPL build
> +ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
> +
> +ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
> +ROCKCHIP_IMG_TYPE := rkspi
> +else
> +ROCKCHIP_IMG_TYPE := rksd
> +endif
> +
> +MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \
> +	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
> +
> +$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
> +	$(call if_changed,mkimage)
> +
> +endif # CONFIG_ROCKCHIP_RK3399
> +
>  # Rule to link u-boot-spl
>  # May be overridden by arch/$(ARCH)/config.mk
>  quiet_cmd_u-boot-spl ?= LD      $@




_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [U-Boot] [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
@ 2019-05-07  6:34         ` Kever Yang
  0 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-05-07  6:34 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 04/28/2019 05:09 PM, Jagan Teki wrote:
> Rockchip platform would require an explicit call to mkimage for
> creating bootable images which indeed specific to SoC family
> along with boot devices.
>
> Example of creating bootable image for rk3399 family with SD
> boot device as
>
> ₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin
>
> This patch would do the same think via Makefile.spl for rk3399.
>
> This would be an initial version and it can easily expand further to support
> other families of SoC's with variety of boot stages like TPL, SPL.

    rk3399 may have TPL like other SoCs, for there will be image types:

SPL+u-boot.bin

SPL+u-boot.itb

TPL+SPL+u-boot.itb

Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?

Is it possible to make it more generic?


Thanks,

- Kever

>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  arch/arm/mach-rockchip/Kconfig |  8 ++++++++
>  doc/README.rockchip            |  3 +--
>  scripts/Makefile.spl           | 21 +++++++++++++++++++++
>  3 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index dbe7f11d39..286c870135 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
>  config ROCKCHIP_BROM_HELPER
>  	bool
>  
> +config SPL_ROCKCHIP_IMG_NAME
> +	string "SPL Rockchip image name"
> +	default "rk3399" if ROCKCHIP_RK3399
> +	help
> +	  To create SPL image for rockchip targets the image name would
> +	  depends on the SoC family that would pass as an argument as
> +	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
> +
>  config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
>          bool "SPL requires early-return (for RK3188-style BROM) to BROM"
>  	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
> diff --git a/doc/README.rockchip b/doc/README.rockchip
> index c4e5f83da7..ccbaaaa9a7 100644
> --- a/doc/README.rockchip
> +++ b/doc/README.rockchip
> @@ -421,11 +421,10 @@ Option 2: Package the image with SPL:
>    - Prefix rk3399 header to SPL image
>  
>      => cd /path/to/u-boot
> -    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
>  
>    - Write prefixed SPL at 64th sector
>  
> -    => sudo dd if=out of=/dev/sdc seek=64
> +    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
>  
>    - Write U-Boot proper at 16384 sector
>  
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 54b160d72b..49c0641aa2 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
>  
>  ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
>  
> +ifdef CONFIG_ROCKCHIP_RK3399
> +ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
> +endif
> +
>  all:	$(ALL-y)
>  
>  quiet_cmd_cat = CAT     $@
> @@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
>  $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
>  	$(call if_changed,mkimage)
>  
> +# Rockchip specific SPL build
> +ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
> +
> +ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
> +ROCKCHIP_IMG_TYPE := rkspi
> +else
> +ROCKCHIP_IMG_TYPE := rksd
> +endif
> +
> +MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \
> +	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
> +
> +$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
> +	$(call if_changed,mkimage)
> +
> +endif # CONFIG_ROCKCHIP_RK3399
> +
>  # Rule to link u-boot-spl
>  # May be overridden by arch/$(ARCH)/config.mk
>  quiet_cmd_u-boot-spl ?= LD      $@

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

* Re: [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
  2019-05-07  6:34         ` [U-Boot] " Kever Yang
@ 2019-05-07  6:44           ` Jagan Teki
  -1 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-05-07  6:44 UTC (permalink / raw)
  To: Kever Yang
  Cc: Tom Rini, U-Boot-Denx, linux-rockchip, Akash Gajjar,
	Manivannan Sadhasivam, linux-amarula

On Tue, May 7, 2019 at 12:04 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Hi Jagan,
>
> On 04/28/2019 05:09 PM, Jagan Teki wrote:
> > Rockchip platform would require an explicit call to mkimage for
> > creating bootable images which indeed specific to SoC family
> > along with boot devices.
> >
> > Example of creating bootable image for rk3399 family with SD
> > boot device as
> >
> > ₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin
> >
> > This patch would do the same think via Makefile.spl for rk3399.
> >
> > This would be an initial version and it can easily expand further to support
> > other families of SoC's with variety of boot stages like TPL, SPL.
>
>     rk3399 may have TPL like other SoCs, for there will be image types:
>
> SPL+u-boot.bin
>
> SPL+u-boot.itb
>
> TPL+SPL+u-boot.itb
>
> Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?
>
> Is it possible to make it more generic?

Yes, I have watched your TPL changes. and we can extend this to
support TPL to make combination of all images.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399
@ 2019-05-07  6:44           ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2019-05-07  6:44 UTC (permalink / raw)
  To: u-boot

On Tue, May 7, 2019 at 12:04 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Hi Jagan,
>
> On 04/28/2019 05:09 PM, Jagan Teki wrote:
> > Rockchip platform would require an explicit call to mkimage for
> > creating bootable images which indeed specific to SoC family
> > along with boot devices.
> >
> > Example of creating bootable image for rk3399 family with SD
> > boot device as
> >
> > ₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin
> >
> > This patch would do the same think via Makefile.spl for rk3399.
> >
> > This would be an initial version and it can easily expand further to support
> > other families of SoC's with variety of boot stages like TPL, SPL.
>
>     rk3399 may have TPL like other SoCs, for there will be image types:
>
> SPL+u-boot.bin
>
> SPL+u-boot.itb
>
> TPL+SPL+u-boot.itb
>
> Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?
>
> Is it possible to make it more generic?

Yes, I have watched your TPL changes. and we can extend this to
support TPL to make combination of all images.

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

end of thread, other threads:[~2019-05-07  6:44 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31 Jagan Teki
2019-04-28  9:09     ` [U-Boot] " 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

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.