Skip to contentSkip to conversation

Switch WaRP7 BL33 to mbed Linux specific bootflow

PATCH New Bryan O'Donoghue 3 participants 23 messages May 8, 2019 – Jul 20, 2019

lore
Share & tools
lore
#0 lore raw

cover Switch WaRP7 BL33 to mbed Linux specific bootflow

This series switches the BL33 version of WaRP7 to an mbed Linux specific bootflow.

https://os.mbed.com/blog/entry/Introducing-Arm-Mbed-Linux-OS/

The bootflow for our port to the WaRP7 is:

BootROM -> TF-A -> OP-TEE -> u-boot -> Linux with the transition from OP-TEE to Linux also representing the transition from secure to normal world.

Here a Trusted-Firmware FIP image contains signed versions of OP-TEE and u-boot and a u-boot FIT image contains Kernel DTB, initrd, bootscript and Kernel.

OP-TEE provides a DTB overlay which the bootscript in the FIT image applies to the kernel DTB, prior to hand-off to Linux.

Some updates to warp7_bl33 and some minor updates to the shared WaRP7/WaRP7_bl33 code are included.

Bryan O'Donoghue (7):
warp7_bl33: configs: Enable FIT as the boot.scr format
warp7: include: configs: Specify image name of bootscript in FIT
warp7: include: configs: Differentiate bootscript address from
loadaddr
warp7_bl33: configs: Enable CONFIG_OF_LIBFDT
warp7_bl33: configs: Enable CONFIG_OF_LIBFDT_OVERLAY
warp7: include: configs: Specify an fdtovaddr
warp7: Specify a default CONFIG_OPTEE_LOAD_ADDR if non provided

 configs/warp7_bl33_defconfig |  5 +++++
 include/configs/warp7.h      | 20 +++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/7 warp7_bl33: configs: Enable FIT as the boot.scr format

This patch switches on FIT verification of boot.scr. After this commit your boot.scr must be in the FIT format.

---
 configs/warp7_bl33_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/warp7_bl33_defconfig +3 -0
index a79f670ea0..c0ad26ff13 100644
@@ -55,3 +55,6 @@ CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
 CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
 CONFIG_OPTEE_TZDRAM_SIZE=0x2000000
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
Signature · 1 line
2.21.0
#2 lore raw

PATCH 1/7 warp7_bl33: configs: Enable FIT as the boot.scr format

Quoted 3 lines

This patch switches on FIT verification of boot.scr. After this commit your boot.scr must be in the FIT format.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 2/7 warp7: include: configs: Specify image name of bootscript in FIT

In reply to Bryan O'Donoghue

When obtaining the bootscript from a FIT image we need to specify the name of the bootscript as defined inside of the FIT.

This patch makes a define that appends a "bootscr" parameter to the source command when compiling up in FIT mode on warp7.

An environment variable is supplied to enable others to use a different name than "bootscr" as the image name of the boot script in their FIT.

---
 include/configs/warp7.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/configs/warp7.h +8 -0
index 0ef8e35948..95955fd626 100644
@@ -38,9 +38,17 @@
 #define CONFIG_DFU_ENV_SETTINGS \
 	"dfu_alt_info=boot raw 0x2 0x1000 mmcpart 1\0" \
 
+/* When booting with FIT specify the node entry containing boot.scr */
+#if defined(CONFIG_FIT)
+#define BOOT_SCR_STRING "source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
+#else
+#define BOOT_SCR_STRING "source ${bootscriptaddr}\0"
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONFIG_DFU_ENV_SETTINGS \
 	"script=boot.scr\0" \
+	"bootscr_fitimage_name=bootscr\0" \
 	"script_signed=boot.scr.imx-signed\0" \
 	"image=zImage\0" \
 	"console=ttymxc0\0" \
Signature · 1 line
2.21.0
#4 lore raw

PATCH 2/7 warp7: include: configs: Specify image name of bootscript in FIT

Quoted 7 lines

When obtaining the bootscript from a FIT image we need to specify the name of the bootscript as defined inside of the FIT.
This patch makes a define that appends a "bootscr" parameter to the source command when compiling up in FIT mode on warp7.
An environment variable is supplied to enable others to use a different name than "bootscr" as the image name of the boot script in their FIT.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

In reply to Bryan O'Donoghue

Reusing the loadaddr to load the boot script breaks some of the logic we want to have around the bootscript/FIT load addresses. Making a dedicated bootscript address allows us to differentiate the bootscript load address from the Linux Kernel or OPTEE load address, thus ensuring that no matter what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

---
 include/configs/warp7.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
include/configs/warp7.h +4 -3
index 95955fd626..0c63050833 100644
@@ -50,6 +50,7 @@
 	"script=boot.scr\0" \
 	"bootscr_fitimage_name=bootscr\0" \
 	"script_signed=boot.scr.imx-signed\0" \
+	"bootscriptaddr=0x83200000\0" \
 	"image=zImage\0" \
 	"console=ttymxc0\0" \
 	"ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
 	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
 	"do_bootscript_hab=" \
 		"if test ${hab_enabled} -eq 1; then " \
-			"setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+			"setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; " \
 			"setenv script ${script_signed}; " \
 			"load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \
 			"run warp7_auth_or_fail; " \
 			"run bootscript; "\
 		"fi;\0" \
 	"loadbootscript=" \
-		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+		"load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
-		"source\0" \
+		BOOT_SCR_STRING \
 	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
 	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
Signature · 1 line
2.21.0
#6 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :

Quoted 34 lines

Reusing the loadaddr to load the boot script breaks some of the logic we want to have around the bootscript/FIT load addresses. Making a dedicated bootscript address allows us to differentiate the bootscript load address from the Linux Kernel or OPTEE load address, thus ensuring that no matter what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

---
  include/configs/warp7.h | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
include/configs/warp7.h +2 -1
index 95955fd626..0c63050833 100644
@@ -50,6 +50,7 @@
  	"script=boot.scr\0" \
  	"bootscr_fitimage_name=bootscr\0" \
  	"script_signed=boot.scr.imx-signed\0" \
+	"bootscriptaddr=0x83200000\0" \
  	"image=zImage\0" \
  	"console=ttymxc0\0" \
  	"ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
  	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
  	"do_bootscript_hab=" \
  		"if test ${hab_enabled} -eq 1; then " \
-			"setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+			"setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; " \
  			"setenv script ${script_signed}; " \
  			"load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \
  			"run warp7_auth_or_fail; " \
  			"run bootscript; "\

include/configs/warp7.h line 86

Quoted 10 lines
include/configs/warp7.h +2 -2
  		"fi;\0" \
  	"loadbootscript=" \
-		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+		"load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
  	"bootscript=echo Running bootscript from mmc ...; " \
-		"source\0" \
+		BOOT_SCR_STRING \
  	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
  	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
  	"mmcboot=echo Booting from mmc ...; " \

Instead of implementing a new variable (bootscriptaddr), I think (IMHO) it's time to migrate

to distroboot for the WaRP7 (like pico imx7 for instance).

In fact, in this specific case, this allows to use the common scriptaddr[1] variable.
FYI, this is a task I am currently working on [2] (work in progress). Maybe we could integrate this migration into this series ?

[1]
http://git.denx.de/?p=u-boot.git;a=blob;f=doc/README.distro;h=ab6e6f4e74be1407001add427fcabab6253a81fc;hb=HEAD#l256
[2]
https://github.com/texierp/u-boot/commit/a141f9bfe379bad8ae6864aa25b51f35d2cfd9fd

Thanks!

BR

Pierre-Jean

#7 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Quoted 53 lines · Pierre-Jean Texier

Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :

Quoted 44 lines

Reusing the loadaddr to load the boot script breaks some of the logic we want to have around the bootscript/FIT load addresses. Making a dedicated bootscript address allows us to differentiate the bootscript load address from the Linux Kernel or OPTEE load address, thus ensuring that no matter what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

---
  include/configs/warp7.h | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)
include/configs/warp7.h +4 -3
index 95955fd626..0c63050833 100644
@@ -50,6 +50,7 @@
       "script=boot.scr\0" \
       "bootscr_fitimage_name=bootscr\0" \
       "script_signed=boot.scr.imx-signed\0" \
+    "bootscriptaddr=0x83200000\0" \
       "image=zImage\0" \
       "console=ttymxc0\0" \
       "ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
       "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} 
 ${filesize} 0;\0" \
       "do_bootscript_hab=" \
           "if test ${hab_enabled} -eq 1; then " \
-            "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+            "setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; " \
               "setenv script ${script_signed}; " \
               "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} 
 ${script}; " \
               "run warp7_auth_or_fail; " \
               "run bootscript; "\
           "fi;\0" \
       "loadbootscript=" \
-        "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+        "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
       "bootscript=echo Running bootscript from mmc ...; " \
-        "source\0" \
+        BOOT_SCR_STRING \
       "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
Quoted 2 lines

      "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
      "mmcboot=echo Booting from mmc ...; " \

Instead of implementing a new variable (bootscriptaddr), I think (IMHO) it's time to migrate

Quoted 6 lines

to distroboot for the WaRP7 (like pico imx7 for instance >

In fact, in this specific case, this allows to use the common scriptaddr[1] variable.
FYI, this is a task I am currently working on [2] (work in progress). Maybe we could integrate this migration into this series ?

Sure.

Let me give it a test later tonight/tomorrow

---
bod

#8 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Quoted 64 lines · Bryan O'Donoghue
Quoted 61 lines · Pierre-Jean Texier

Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :

Quoted 48 lines

Reusing the loadaddr to load the boot script breaks some of the logic we want to have around the bootscript/FIT load addresses. Making a dedicated
bootscript address allows us to differentiate the bootscript load address
from the Linux Kernel or OPTEE load address, thus ensuring that no matter
what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

---
  include/configs/warp7.h | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)
include/configs/warp7.h +4 -3
index 95955fd626..0c63050833 100644
@@ -50,6 +50,7 @@
       "script=boot.scr\0" \
       "bootscr_fitimage_name=bootscr\0" \
       "script_signed=boot.scr.imx-signed\0" \
+    "bootscriptaddr=0x83200000\0" \
       "image=zImage\0" \
       "console=ttymxc0\0" \
       "ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
       "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} 
 ${filesize} 0;\0" \
       "do_bootscript_hab=" \
           "if test ${hab_enabled} -eq 1; then " \
-            "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+            "setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; 
 " \
               "setenv script ${script_signed}; " \
               "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} 
 ${script}; " \
               "run warp7_auth_or_fail; " \
               "run bootscript; "\
           "fi;\0" \
       "loadbootscript=" \
-        "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+        "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} 
 ${script};\0" \
       "bootscript=echo Running bootscript from mmc ...; " \
-        "source\0" \
+        BOOT_SCR_STRING \
Quoted 4 lines

      "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
      "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
      "mmcboot=echo Booting from mmc ...; " \

Instead of implementing a new variable (bootscriptaddr), I think (IMHO) it's time to migrate

to distroboot for the WaRP7 (like pico imx7 for instance >

Quoted 8 lines
Quoted 4 lines

In fact, in this specific case, this allows to use the common scriptaddr[1] variable.
FYI, this is a task I am currently working on [2] (work in progress). Maybe we could integrate this migration into this series ?

Sure.

Let me give it a test later tonight/tomorrow

Hi Pierre,

I've applied your patch on-top of of a 3 day old master

* 60277e4bcc - (HEAD) warp7: add distroboot support (27 hours ago)
* 4ca7700d2c - imx: Use a convenient default value for SYS_MALLOC_F_LEN (27 hours ago)
* 48372a5af6 - Remove whitelist entry for CONFIG_CRC32 (3 days ago)
* 4ad2c8953d - Remove #define CONFIG_CRC32 (3 days ago)
* 661bbc50d3 - mtd: ubi: Remove select for non existent option (3 days ago)
* 2b841dba5c - cmd: ubifs: Remove select for non-existent option (3 days ago)
* b8de00c671 - Remove whitelist entry for CONFIG_GPIO (3 days ago)
* 26680b9f3a - sysreset: select DM_GPIO instead of GPIO (3 days ago)
* 927a37df9f - Merge branch '2019-05-09-master-imports' (3 days ago)

should this apply in isolation ?

I get a dead-loop on USB CDC ethernet...

=> reset
resetting ...

U-Boot 2019.07-rc1-00457-g60277e4bcc (May 13 2019 - 23:11:24 +0100)

CPU:   Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 47C
Reset cause: POR
Model: Warp i.MX7 Board
Board: WARP7 in secure mode OPTEE DRAM 0x9d000000-0xa0000000
DRAM:  464 MiB
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
MMC:   FSL_SDHC: 1, FSL_SDHC: 0

Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial at 30860000
Out:   serial at 30860000
Err:   serial at 30860000
SEC0: RNG instantiated
Net:   usb_ether
Warning: usb_ether (eth0) using random MAC address - b6:5e:3c:03:d8:8e

Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
11090492 bytes read in 146 ms (72.4 MiB/s)
## Executing script at 80800000
No FIT subimage unit name
SCRIPT FAILED: continuing...
28970 bytes read in 7 ms (3.9 MiB/s)
starting USB...
Bus usb at 30b10000: scanning bus usb at 30b10000 for devices... 1 USB Device(s) found
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int
MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable: pxeuuid missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int
MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable:
bootfile
Retrieving file: pxelinux.cfg/0000000
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int
MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable:
bootfile

---
bod

#9 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Hi Bryan,

Le 14/05/2019 à 00:13, Bryan O'Donoghue a écrit :

Quoted 95 lines · Bryan O'Donoghue
Quoted 66 lines · Pierre-Jean Texier
Quoted 63 lines

Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :

Quoted 49 lines

Reusing the loadaddr to load the boot script breaks some of the logic we
want to have around the bootscript/FIT load addresses. Making a dedicated
bootscript address allows us to differentiate the bootscript load address
from the Linux Kernel or OPTEE load address, thus ensuring that no matter
what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

---
  include/configs/warp7.h | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)
include/configs/warp7.h +4 -3
index 95955fd626..0c63050833 100644
@@ -50,6 +50,7 @@
       "script=boot.scr\0" \
       "bootscr_fitimage_name=bootscr\0" \
       "script_signed=boot.scr.imx-signed\0" \
+    "bootscriptaddr=0x83200000\0" \
       "image=zImage\0" \
       "console=ttymxc0\0" \
       "ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
       "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} 
 ${filesize} 0;\0" \
       "do_bootscript_hab=" \
           "if test ${hab_enabled} -eq 1; then " \
-            "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+            "setexpr hab_ivt_addr ${bootscriptaddr} - 
 ${ivt_offset}; " \
               "setenv script ${script_signed}; " \
               "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} 
 ${script}; " \
               "run warp7_auth_or_fail; " \
               "run bootscript; "\
           "fi;\0" \
       "loadbootscript=" \
-        "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+        "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} 
 ${script};\0" \
       "bootscript=echo Running bootscript from mmc ...; " \
-        "source\0" \
+        BOOT_SCR_STRING \
Quoted 5 lines

      "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
      "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
      "mmcboot=echo Booting from mmc ...; " \

Instead of implementing a new variable (bootscriptaddr), I think (IMHO) it's time to migrate

to distroboot for the WaRP7 (like pico imx7 for instance >

Quoted 8 lines
Quoted 4 lines

In fact, in this specific case, this allows to use the common scriptaddr[1] variable.
FYI, this is a task I am currently working on [2] (work in progress). Maybe we could integrate this migration into this series ?

Sure.

Let me give it a test later tonight/tomorrow

Hi Pierre,

I've applied your patch on-top of of a 3 day old master

* 60277e4bcc - (HEAD) warp7: add distroboot support (27 hours ago)
* 4ca7700d2c - imx: Use a convenient default value for SYS_MALLOC_F_LEN (27 hours ago)
* 48372a5af6 - Remove whitelist entry for CONFIG_CRC32 (3 days ago)
* 4ad2c8953d - Remove #define CONFIG_CRC32 (3 days ago)
* 661bbc50d3 - mtd: ubi: Remove select for non existent option (3 days ago)
* 2b841dba5c - cmd: ubifs: Remove select for non-existent option (3 days ago)
* b8de00c671 - Remove whitelist entry for CONFIG_GPIO (3 days ago)
* 26680b9f3a - sysreset: select DM_GPIO instead of GPIO (3 days ago) *   927a37df9f - Merge branch '2019-05-09-master-imports' (3 days ago)

Quoted 1 line

should this apply in isolation ?

Not necessarily, on my side everything working well on-top of master, for example:

Hit any key to stop autoboot:  0
=> run bootcmd_mmc0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
247 bytes read in 1 ms (241.2 KiB/s)
## Executing script at 80800000
8923088 bytes read in 131 ms (65 MiB/s)
26889 bytes read in 5 ms (5.1 MiB/s)
Kernel image @ 0x80800000 [ 0x000000 - 0x8827d0 ] ## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000 Using Device Tree in place at 83000000, end 83009908

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0

Quoted 27 lines

I get a dead-loop on USB CDC ethernet...

=> reset
resetting ...

U-Boot 2019.07-rc1-00457-g60277e4bcc (May 13 2019 - 23:11:24 +0100)

CPU:   Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz) CPU:   Extended Commercial temperature grade (-20C to 105C) at 47C Reset cause: POR
Model: Warp i.MX7 Board
Board: WARP7 in secure mode OPTEE DRAM 0x9d000000-0xa0000000 DRAM:  464 MiB
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
MMC:   FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial at 30860000
Out:   serial at 30860000
Err:   serial at 30860000
SEC0: RNG instantiated
Net:   usb_ether
Warning: usb_ether (eth0) using random MAC address - b6:5e:3c:03:d8:8e

Quoted 9 lines

Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
11090492 bytes read in 146 ms (72.4 MiB/s)
## Executing script at 80800000
No FIT subimage unit name
SCRIPT FAILED: continuing...

It seems your problem is here. In fact, if this action fail, U-Boot try to run network booting (PXE, defined in warp7.h).

For your tests, the command 'bootcmd_mmc0' is sufficient.

FYI, my setup is not exactly the the same as
you have (with the CONFIG_FIT_SIGNATURE option enabled for sure). I'm going to do some tests with this configuration.

Pierre-Jean

Quoted 28 lines

28970 bytes read in 7 ms (3.9 MiB/s)
starting USB...
Bus usb at 30b10000: scanning bus usb at 30b10000 for devices... 1 USB Device(s) found
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable:
pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable:
bootfile
Retrieving file: pxelinux.cfg/0000000
using ci_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int MAC de:ad:be:af:00:01
HOST MAC de:ad:be:af:00:00
high speed config #1: 2 mA, Ethernet Gadget, using CDC Ethernet The remote end did not respond in time.missing environment variable:
bootfile

---
bod

#10 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Quoted 11 lines · Pierre-Jean Texier
Quoted 2 lines

should this apply in isolation ?

Not necessarily, on my side everything working well on-top of master, for example:

Hit any key to stop autoboot:  0
=> run bootcmd_mmc0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr

So do you need a boot.scr for this patch to work, how will that affect current users who rely on the u-boot env only ?

#11 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Le 15/05/2019 à 10:23, Bryan O'Donoghue a écrit :

Quoted 15 lines · Pierre-Jean Texier
Quoted 11 lines
Quoted 2 lines

should this apply in isolation ?

Not necessarily, on my side everything working well on-top of master, for example:

Hit any key to stop autoboot:  0
=> run bootcmd_mmc0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr

Quoted 2 lines

So do you need a boot.scr for this patch to work, how will that affect current users who rely on the u-boot env only ?

In fact, by using the Generic Distro Concept, we can also use the extlinux file, as explained in[1].
Example on WaRP7 :

=> run bootcmd_mmc0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
132 bytes read in 1 ms (128.9 KiB/s)
1:    linux
Retrieving file: /zImage
8118520 bytes read in 116 ms (66.7 MiB/s)
append: root=PARTUUID= rootwait rw console=ttymxc0,115200 Retrieving file: /imx7s-warp.dtb
26889 bytes read in 4 ms (6.4 MiB/s)
Kernel image @ 0x80800000 [ 0x000000 - 0x7be0f8 ] ## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000 Using Device Tree in place at 83000000, end 83009908

Regarding your question, it seems that is now the standard on many platforms [2].
In fact, instead of keeping a custom environment, it is better to use a more
generic approach by switching to disto config (with boot.scr, extlinux, and so on).

For sure, we can customized the CONFIG_BOOTCOMMAND variable in patch.

[1] http://git.denx.de/?p=u-boot.git;a=blob;f=doc/README.distro
[2]
https://github.com/u-boot/u-boot/search?q=BOOT_TARGET_DEVICES%28func%29&unscoped_q=BOOT_TARGET_DEVICES%28func%29

Thanks

Pierre-jean

#12 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Quoted 8 lines · Pierre-Jean Texier

Regarding your question, it seems that is now the standard on many platforms [2].
In fact, instead of keeping a custom environment, it is better to use a more
generic approach by switching to disto config (with boot.scr, extlinux, and so on).

For sure, we can customized the CONFIG_BOOTCOMMAND variable in patch.

Right.

This smells like a bigger change to me then, since we have to account for how we transition current users from their u-boot environment to distroboot.

It sounds to me like a series of patches around this one topic.

So, I think it is worthwhile exploring that set of changes but, I do think we should do it separately to this set :)

---
bod

#13 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

Hi Bryan,

Le 20/05/2019 à 10:33, Bryan O'Donoghue a écrit :

Quoted 14 lines · Pierre-Jean Texier
Quoted 8 lines

Regarding your question, it seems that is now the standard on many platforms [2].
In fact, instead of keeping a custom environment, it is better to use a more
generic approach by switching to disto config (with boot.scr, extlinux, and so on).

For sure, we can customized the CONFIG_BOOTCOMMAND variable in patch.

Right.

Quoted 8 lines

This smells like a bigger change to me then, since we have to account for how we transition current users from their u-boot environment to distroboot.

It sounds to me like a series of patches around this one topic.

So, I think it is worthwhile exploring that set of changes but, I do think we should do it separately to this set :)

Indeed, it seems you're right.
I'll send this later, means once your patches are integrated ;). I am convinced that it's better to work on your series first.

Just a quick remark, can you share more informations about the setup ? so I can test your series on my side ;)

Pierre-Jean

Quoted 3 lines

---
bod

#14 lore raw

PATCH 3/7 warp7: include: configs: Differentiate bootscript address from loadaddr

In reply to Bryan O'Donoghue
Quoted 7 lines

Reusing the loadaddr to load the boot script breaks some of the logic we want to have around the bootscript/FIT load addresses. Making a dedicated bootscript address allows us to differentiate the bootscript load address from the Linux Kernel or OPTEE load address, thus ensuring that no matter what the load sequence the bootscript and Kernel/OPTEE binary load addresses do not conflict.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#15 lore raw

PATCH 4/7 warp7_bl33: configs: Enable CONFIG_OF_LIBFDT

In reply to Bryan O'Donoghue

In order to switch on DTB overlay support in WaRP7 BL33 we first need to switch on LIBFDT support. Do that now.

---
 configs/warp7_bl33_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/warp7_bl33_defconfig +1 -0
index c0ad26ff13..5b6a85356f 100644
@@ -58,3 +58,4 @@ CONFIG_OPTEE_TZDRAM_SIZE=0x2000000
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_OF_LIBFDT=y
Signature · 1 line
2.21.0
#16 lore raw

PATCH 4/7 warp7_bl33: configs: Enable CONFIG_OF_LIBFDT

Quoted 3 lines

In order to switch on DTB overlay support in WaRP7 BL33 we first need to switch on LIBFDT support. Do that now.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#17 lore raw

PATCH 5/7 warp7_bl33: configs: Enable CONFIG_OF_LIBFDT_OVERLAY

In reply to Bryan O'Donoghue

This commit enables CONFIG_OF_LIBFDT_OVERLAY a requirement to perform a merge of an OPTEE provided DTB overlay into our main kernel DTB image.

---
 configs/warp7_bl33_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/warp7_bl33_defconfig +1 -0
index 5b6a85356f..d4716378a7 100644
@@ -59,3 +59,4 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_LIBFDT=y
+CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.21.0
#18 lore raw

PATCH 5/7 warp7_bl33: configs: Enable CONFIG_OF_LIBFDT_OVERLAY

Quoted 3 lines

This commit enables CONFIG_OF_LIBFDT_OVERLAY a requirement to perform a merge of an OPTEE provided DTB overlay into our main kernel DTB image.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#19 lore raw

PATCH 6/7 warp7: include: configs: Specify an fdtovaddr

In reply to Bryan O'Donoghue

In the Mbed Linux OS bootflow OP-TEE runs before u-boot and provides a DTB overlay at 0x83100000.

This overlay should subsequently be merged into the main DTB before handing over to the kernel.

This patch defines fdtovaddr at 0x83100000.

---
 include/configs/warp7.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/warp7.h +1 -0
index 0c63050833..bab23cfdca 100644
@@ -58,6 +58,7 @@
 	"initrd_high=0xffffffff\0" \
 	"fdt_file=imx7s-warp.dtb\0" \
 	"fdt_addr=" __stringify(CONFIG_SYS_FDT_ADDR)"\0" \
+	"fdtovaddr=0x83100000\0" \
 	"optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
Signature · 1 line
2.21.0
#20 lore raw

PATCH 6/7 warp7: include: configs: Specify an fdtovaddr

Quoted 6 lines

In the Mbed Linux OS bootflow OP-TEE runs before u-boot and provides a DTB overlay at 0x83100000.
This overlay should subsequently be merged into the main DTB before handing over to the kernel.
This patch defines fdtovaddr at 0x83100000.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#21 lore raw

PATCH 7/7 warp7: Specify a default CONFIG_OPTEE_LOAD_ADDR if non provided

In reply to Bryan O'Donoghue

If no CONFIG_OPTEE_LOAD_ADDR is provided i.e. you are not loading OPTEE into memory in u-boot, then just set the non-existent CONFIG option to zero, elsewise stringify(CONFIG_OPTEE_LOAD_ADDR) will return "CONFIG_OPTEE_LOAD_ADDR" - which looks weird in the u-boot environment.

---
 include/configs/warp7.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/warp7.h +4 -0
index bab23cfdca..8c31d72205 100644
@@ -45,6 +45,10 @@
 #define BOOT_SCR_STRING "source ${bootscriptaddr}\0"
 #endif
 
+#ifndef CONFIG_OPTEE_LOAD_ADDR
+#define CONFIG_OPTEE_LOAD_ADDR 0
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONFIG_DFU_ENV_SETTINGS \
 	"script=boot.scr\0" \
Signature · 1 line
2.21.0
#22 lore raw

PATCH 7/7 warp7: Specify a default CONFIG_OPTEE_LOAD_ADDR if non provided

Quoted 5 lines

If no CONFIG_OPTEE_LOAD_ADDR is provided i.e. you are not loading OPTEE into memory in u-boot, then just set the non-existent CONFIG option to zero, elsewise stringify(CONFIG_OPTEE_LOAD_ADDR) will return "CONFIG_OPTEE_LOAD_ADDR" - which looks weird in the u-boot environment.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================