Skip to contentSkip to conversation

rk3399: make u-boot-rockchip-with-spl.bin

PATCH Superseded Jagan Teki 3 participants 13 messages Apr 28, 2019 – May 7, 2019 3 messages not in the archive

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v2 cover rk3399: make u-boot-rockchip-with-spl.bin

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
Signature · 1 line
2.18.0.321.gffc6fa0e3

A message that is not in the archive (sent off-list or not yet received): 20190428090913.10568-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

author
#2 lore raw

PATCH v2 1/9 Makefile: clean image.map

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.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 92e04dd689..54e8fedff0 100644
@@ -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
 #
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#3 lore raw

PATCH v2 2/9 Makefile: clean bl31_*.bin

In reply to a message not in the archive

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 54e8fedff0..ba0cce9f33 100644
@@ -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
 #
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#4 lore raw

PATCH v2 3/9 travis.yml: Add pyelftools install entry

In reply to a message not in the archive

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.

---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
.travis.yml +1 -0
index eb531f1e5b..6dbbb5dd02 100644
@@ -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
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#5 lore raw

PATCH v2 4/9 rockchip: rk3399: Get bl31.elf via BL31

In reply to a message not in the archive

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.

---
 Makefile                               |  2 +-
 arch/arm/mach-rockchip/make_fit_atf.py | 11 ++++++++++-
 doc/README.rockchip                    |  4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)
Makefile +1 -1
index ba0cce9f33..2471340c71 100644
@@ -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
 #
arch/arm/mach-rockchip/make_fit_atf.py +10 -1
index d1faff1957..327875d87b 100755
@@ -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:
doc/README.rockchip +2 -2
index ca4d6473b0..98a3824e2c 100644
@@ -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
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#6 lore raw

PATCH v2 5/9 board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0

In reply to a message not in the archive

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

---
 .../{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
board/theobroma-systems/puma_rk3399/fit_spl_atf.sh renamed from board/theobroma-systems/puma_rk3399/fit_spl_atf.its +40 -6
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
@@ -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
configs/puma-rk3399_defconfig +1 -1
index e5ea2fe0b3..98b2dd6f02 100644
@@ -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
doc/README.rockchip +4 -4
index 98a3824e2c..88a4593392 100644
@@ -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
 
Signature · 1 line
2.18.0.321.gffc6fa0e3

A message that is not in the archive (sent off-list or not yet received): 20190428090913.10568-6-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

#8 lore raw

Re: [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0

Hi Philipp and Klaus,

    Does this patch OK for your boards?

Thanks,
-Kever

Quoted 150 lines · 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

---
 .../{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
board/theobroma-systems/puma_rk3399/fit_spl_atf.sh renamed from board/theobroma-systems/puma_rk3399/fit_spl_atf.its +40 -6
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
@@ -1,3 +1,31 @@
+#!/bin/sh
+#
+# Copyright (C) 2019 Jagan Teki <[email protected]>
+#
+# 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
configs/puma-rk3399_defconfig +1 -1
index e5ea2fe0b3..98b2dd6f02 100644
@@ -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
doc/README.rockchip +2 -2
index 98a3824e2c..88a4593392 100644
@@ -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.
 

doc/README.rockchip For example: · line 169

Quoted 10 lines
doc/README.rockchip +2 -2
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

author
#9 lore raw

PATCH v2 6/9 Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip

In reply to a message not in the archive

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.

---
 Kconfig             | 2 +-
 doc/README.rockchip | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
Kconfig +1 -1
index 5679a288ec..7e918e5c37 100644
@@ -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
doc/README.rockchip +0 -2
index 88a4593392..c4e5f83da7 100644
@@ -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)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#10 lore raw

PATCH v2 7/9 Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

In reply to a message not in the archive

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.

---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/Kconfig +8 -0
index dbe7f11d39..286c870135 100644
@@ -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
doc/README.rockchip +1 -2
index c4e5f83da7..ccbaaaa9a7 100644
@@ -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
 
scripts/Makefile.spl +21 -0
index 54b160d72b..49c0641aa2 100644
@@ -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      $@
Signature · 7 lines
2.18.0.321.gffc6fa0e3


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): 20190428090913.10568-8-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

#12 lore raw

Re: [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

Hi Jagan,

Quoted 7 lines · Jagan Teki

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

Quoted 6 lines

₹ 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

Quoted 73 lines
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/Kconfig +8 -0
index dbe7f11d39..286c870135 100644
@@ -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
doc/README.rockchip +1 -2
index c4e5f83da7..ccbaaaa9a7 100644
@@ -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
 
scripts/Makefile.spl +14 -0
index 54b160d72b..49c0641aa2 100644
@@ -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) \

scripts/Makefile.spl MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \ · line 395

Quoted 10 lines
scripts/Makefile.spl +7 -0
+	-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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#13 lore raw

Re: [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

Quoted 22 lines · Kever Yang

Hi Jagan,

Quoted 7 lines · Jagan Teki

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

Quoted 6 lines

₹ 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

Quoted 7 lines

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
[email protected]
https://lists.denx.de/listinfo/u-boot

author
#14 lore raw

PATCH v2 8/9 dts: Makefile: Build rockchip dtbs based on SoC types

In reply to a message not in the archive

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.

---
 arch/arm/dts/Makefile | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)
arch/arm/dts/Makefile +26 -9
index a2911fa2fd..0f9d6b7d0d 100644
@@ -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 \
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#15 lore raw

PATCH v2 9/9 rockchip: rk3399: Create single image using BINMAN

In reply to a message not in the archive

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.

---
 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(-)
Makefile +13 -0
index 2471340c71..0fe7ac3cc0 100644
@@ -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
 	@:
 
arch/arm/dts/rk3399-ficus-u-boot.dtsi +1 -0
index eab86bdb30..67b63a8352 100644
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <[email protected]>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-ddr3-1600.dtsi"
arch/arm/dts/rk3399-rock960-u-boot.dtsi +1 -0
index 5256f6d3f2..7fb5072a9b 100644
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <[email protected]>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-lpddr3-2GB-1600.dtsi"
arch/arm/dts/rk3399-u-boot.dtsi +17 -0
index 0786c1193a..abd0b091ab 100644
@@ -3,6 +3,23 @@
  * Copyright (C) 2019 Jagan Teki <[email protected]>
  */
 
+#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;
 };
arch/arm/mach-rockchip/Kconfig +1 -0
index 286c870135..7ac0ee3c2d 100644
@@ -130,6 +130,7 @@ endif
 config ROCKCHIP_RK3399
 	bool "Support Rockchip RK3399"
 	select ARM64
+	select BINMAN
 	select SUPPORT_SPL
 	select SPL
 	select SPL_ATF
doc/README.rockchip +2 -6
index ccbaaaa9a7..4ceb383bb7 100644
@@ -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
include/configs/rk3399_common.h +2 -0
index b412012582..a658f03ade 100644
@@ -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 \
Signature · 7 lines
2.18.0.321.gffc6fa0e3


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip