diff mbox series

[U-Boot,3/7] warp7: include: configs: Differentiate bootscript address from loadaddr

Message ID 20190508181448.20452-4-bryan.odonoghue@linaro.org
State Accepted
Commit 1d4cdc717e2cbd6d2c9746805c2f6dedcfd93008
Delegated to: Stefano Babic
Headers show
Series Switch WaRP7 BL33 to mbed Linux specific bootflow | expand

Commit Message

Bryan O'Donoghue May 8, 2019, 6:14 p.m. UTC
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.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Pierre-Jean Texier May 8, 2019, 7:33 p.m. UTC | #1
Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :
> 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.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>   include/configs/warp7.h | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/configs/warp7.h b/include/configs/warp7.h
> index 95955fd626..0c63050833 100644
> --- a/include/configs/warp7.h
> +++ b/include/configs/warp7.h
> @@ -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 ...; " \

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
Bryan O'Donoghue May 9, 2019, 3:32 p.m. UTC | #2
On 08/05/2019 20:33, Pierre-Jean Texier wrote:
> Hi Bryan,
> 
> Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :
>> 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.
>>
>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> ---
>>   include/configs/warp7.h | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/configs/warp7.h b/include/configs/warp7.h
>> index 95955fd626..0c63050833 100644
>> --- a/include/configs/warp7.h
>> +++ b/include/configs/warp7.h
>> @@ -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 ...; " \
> 
> 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 ?

Sure.

Let me give it a test later tonight/tomorrow

---
bod
Bryan O'Donoghue May 13, 2019, 10:13 p.m. UTC | #3
On 09/05/2019 16:32, Bryan O'Donoghue wrote:
> 
> 
> On 08/05/2019 20:33, Pierre-Jean Texier wrote:
>> Hi Bryan,
>>
>> Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :
>>> 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.
>>>
>>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>> ---
>>>   include/configs/warp7.h | 7 ++++---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/configs/warp7.h b/include/configs/warp7.h
>>> index 95955fd626..0c63050833 100644
>>> --- a/include/configs/warp7.h
>>> +++ b/include/configs/warp7.h
>>> @@ -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 ...; " \
>>
>> 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 ?
> 
> 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@30860000
Out:   serial@30860000
Err:   serial@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@30b10000: scanning bus usb@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
Pierre-Jean Texier May 14, 2019, 8:27 p.m. UTC | #4
Hi Bryan,

Le 14/05/2019 à 00:13, Bryan O'Donoghue a écrit :
>
>
> On 09/05/2019 16:32, Bryan O'Donoghue wrote:
>>
>>
>> On 08/05/2019 20:33, Pierre-Jean Texier wrote:
>>> Hi Bryan,
>>>
>>> Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :
>>>> 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.
>>>>
>>>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>>> ---
>>>>   include/configs/warp7.h | 7 ++++---
>>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/include/configs/warp7.h b/include/configs/warp7.h
>>>> index 95955fd626..0c63050833 100644
>>>> --- a/include/configs/warp7.h
>>>> +++ b/include/configs/warp7.h
>>>> @@ -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 ...; " \
>>>
>>> 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 ?
>>
>> 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 ?
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

>
> 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@30860000
> Out:   serial@30860000
> Err:   serial@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...

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
> 28970 bytes read in 7 ms (3.9 MiB/s)
> starting USB...
> Bus usb@30b10000: scanning bus usb@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
Bryan O'Donoghue May 15, 2019, 8:23 a.m. UTC | #5
On 14/05/2019 21:27, Pierre-Jean Texier wrote:
>>
>> 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 ?
Pierre-Jean Texier May 15, 2019, 7:13 p.m. UTC | #6
Le 15/05/2019 à 10:23, Bryan O'Donoghue a écrit :
>
>
> On 14/05/2019 21:27, Pierre-Jean Texier wrote:
>>>
>>> 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 ?

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
Bryan O'Donoghue May 20, 2019, 8:33 a.m. UTC | #7
On 15/05/2019 20:13, Pierre-Jean Texier wrote:
> 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
Pierre-Jean Texier May 23, 2019, 7:56 p.m. UTC | #8
Hi Bryan,

Le 20/05/2019 à 10:33, Bryan O'Donoghue a écrit :
>
>
> On 15/05/2019 20:13, Pierre-Jean Texier wrote:
>> 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 :)

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

>
> ---
> bod
Stefano Babic July 20, 2019, 8:45 a.m. UTC | #9
> 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.
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

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

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 95955fd626..0c63050833 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -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 ...; " \