[REGRESSION] imx: spl_imx_romapi: boot loops

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Oct 24 13:17:49 CEST 2023


On 24/10/2023 12.03, Marcel Ziswiler wrote:
> Hi Rasmus
> 
> Thanks for your help.
> 
> On Tue, 2023-10-24 at 11:18 +0200, Rasmus Villemoes wrote:
> 
> 
> [snip]
> 
>> Hm. Can you show the result of 'fdtdump u-boot.itb | head'
> 
> ⬢[zim at toolbox u-boot.git]$ fdtdump u-boot.itb | head
> 
> **** fdtdump is a low-level debugging tool, not meant for general use.
> **** If you want to decompile a dtb, you probably want
> ****     dtc -I dtb -O dts <filename>
> 
> /dts-v1/;
> // magic:		0xd00dfeed
> // totalsize:		0x414 (1044)
> // off_dt_struct:	0x38
> // off_dt_strings:	0x370
> // off_mem_rsvmap:	0x28
> // version:		17
> // last_comp_version:	2
> // boot_cpuid_phys:	0x0
> // size_dt_strings:	0xa1
> 
>>  as well as
>> just the actual file sizes of u-boot.itb and flash.bin.
> 
> ⬢[zim at toolbox u-boot.git]$ ls -l u-boot.itb u-boot.bin
> -rw-r--r--. 1 zim zim 882984 Oct 24 11:42 u-boot.bin
> -rw-r--r--. 1 zim zim 934504 Oct 24 11:42 u-boot.itb
> 
>> Also, in spl_romapi_read_stream(), can you add a print out what
>> ss->pagesize is, and also an unconditional printf() after the
>> rom_api_download_image() - we apparently don't hit the "Failure download
>> %d", but I'd still like to see if we even return from that
>> rom_api_download_image() call.
> 
> U-Boot SPL 2024.01-rc1-dirty (Oct 24 2023 - 11:56:41 +0200)
> Training FAILED
> DDR configured as single rank
> SEC0:  RNG instantiated
> Normal Boot
> WDT:   Started watchdog at 30280000 with servicing every 1000ms (60s timeout)
> Trying to boot from BOOTROM
> Boot Stage: Primary boot
> Find img info 0x4802b000, size 1044
> Need continue download 1024
> spl_romapi_read_stream ss->pagesize 0x200
> spl_romapi_read_stream ss->pagesize 0x200
> downloading another 0xc9000 bytes
> rom_api_download_image()=240
> spl_romapi_read_stream ss->pagesize 0x200
> downloading another 0x1ae00 bytes
> rom_api_download_image()=240
> spl_romapi_read_stream�


So this is interesting. I tried disabling CONFIG_IMX_HAB (because that
case doesn't create an .itb with external data) and boot on a board
which is not locked down, and I get

Trying to boot from BOOTROM
Boot Stage: USB boot
Find img info 0x000000004802df00, size 1504
already have 256 bytes
Need continue download 2048
spl_romapi_read_stream(): ss->pagesize = 0x1
spl_romapi_read_stream(): ss->pagesize = 0x1
downloading another 0x9d768 bytes
spl_romapi_read_stream(): rom_api_download_image -> 240
spl_romapi_read_stream(): ss->pagesize = 0x1
downloading another 0x1ff18 bytes
spl_romapi_read_stream(): rom_api_download_image -> 240
spl_romapi_read_stream(): ss->pagesize = 0x1
spl_romapi_read_stream(): ss->pagesize = 0x1
downloading another 0x1622 bytes
spl_romapi_read_stream(): rom_api_download_image -> 240
NOTICE:  BL31: v2.6(release):lf-5.15.71-2.2.0-0-g3c1583ba0-dirty
NOTICE:  BL31: Built : 11:00:38, Nov 21 2022

and this works just fine. But in my case ss->pagesize is 1, whereas you
have 512.

Just exactly how are you booting? It says "Boot Stage: Primary boot"
whereas I'm doing serial download with uuu (i.e. "Boot Stage: USB boot").

It seems weird that you even end up in the is_boot_from_stream_device()
if you're booting from eMMC (which would explain the 512 byte page size).

Also, the prints above reveal that the download of the 0x1ae00 succeeds,
but then we enter the function once more, and for some reason your
printf() gets cut short; in my boot, that's for fetching another 0x1622
bytes. My guess is that the board hangs because it tries to download
more data than the stream can supply, due to the rounding-up to
ss->pagesize. Can you try with this

diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi
b/arch/arm/dts/imx8mp-u-boot.dtsi
index e54df1766fa..4b5e9ff466f 100644
--- a/arch/arm/dts/imx8mp-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-u-boot.dtsi
@@ -100,6 +100,7 @@

        itb {
                filename = "u-boot.itb";
+               align-size = <512>;

                fit {
                        description = "Configuration to load ATF before
U-Boot";

so that u-boot.itb is extended so it's a multiple of 512 bytes?

Rasmus



More information about the U-Boot mailing list