BCM53xx on D-Link DIR-890L - 2MB max problem

Arınç ÜNAL arinc.unal at arinc9.com
Fri Jan 13 14:11:36 PST 2023


On 12.01.2023 23:51, Linus Walleij wrote:
> On Sun, Jan 8, 2023 at 12:33 AM Linus Walleij <linus.walleij at linaro.org> wrote:
> 
>> I guess trying to figure out what lzma-loader does and implement
>> the same for ARM is the way to go, or at some point I felt like
>> implementing U-Boot for the BCM53xx and implement SEAMA
>> loading from NAND in U-Boot is maybe easier...
> 
> How hard can it be :P
> 
> U-Boot 2023.01-00442-g6b75c294818f-dirty (Jan 12 2023 - 21:46:18
> +0100)Broadcom Northstar
> 
> BCMNS Northstar SoC
> Model: Northstar model
> DRAM:  128 MiB (effective 256 MiB)
> WARNING: Caches not enabled
> Core:  13 devices, 7 uclasses, devicetree: embed
> MMC:
> Loading Environment from nowhere... OK
> In:    serial at 300
> Out:   serial at 300
> Err:   serial at 300
> Model: Northstar model
> Net:   No ethernet found.
> northstar>
> northstar>
> northstar>

Nice work! I caught something with decompressing lzma compressed images 
with U-Boot's lzmadec but had to take a quick detour to Greece before I 
could conclude my test.

Side question, did you risk writing your test builds to the flash or 
have you already got the flash in an easily reprogrammable set up?

I'm doing this on a UniElec U7621-06 (MediaTek MT7621 SoC) which has got 
256 MiB DRAM. Running Linux 6.2.0-rc3 with mainline U-Boot.

DRAM base is at 0x80000000 so I can use the 0x80000000 - 0x90000000 
range (256 MiB) for writing to memory.

I tried letting U-Boot's lzmadec decompress the kernel image. 
Decompressing fails when the kernel size reaches a certain point.

=> tftpboot 0x83000000 test-uImage.lzma; tftpboot 0x84f00000 
mt7621-unielec-u7621-06-16m.dtb; bootm 0x83000000 - 0x84f00000
[...]
## Booting kernel from Legacy Image at 83000000 ...
    Image Name:   Linux-6.2.0-rc3+
    Image Type:   MIPS Linux Kernel Image (lzma compressed)
    Data Size:    19134142 Bytes = 18.2 MiB
    Load Address: 80001000
    Entry Point:  80ed84c4
    Verifying Checksum ... OK
## Flattened Device Tree blob at 84f00000
    Booting using the fdt blob at 0x84f00000
Working FDT set to 84f00000
    Uncompressing Kernel Image
lzma compressed: uncompress error 1
Must RESET board to recover
=>

To figure out at what size lzmadec fails, I added a file with randomly 
generated data to the root filesystem so the LZMA compressor can't do 
much to shrink it.

head -c 2M < /dev/urandom > file.bin

Since the image is compressed in the end, I can't exactly add bytes and 
predict what the size of the compressed file will be. So after a lot of 
compiling and trying on the board, this is the closest I got.

LZMA compressed kernel size in bytes which U-Boot’s lzmadec can decompress:
19134096

LZMA compressed kernel size in bytes which U-Boot’s lzmadec fails to 
decompress:
19134142

However booting a kernel with self extracting works fine.

=> tftpboot 0x83000000 test-uzImage.bin; tftpboot 0x84f00000 
mt7621-unielec-u7621-06-16m.dtb; bootm 0x83000000 - 0x84f00000
[...]
## Booting kernel from Legacy Image at 83000000 ...
    Image Name:   Linux-6.2.0-rc3+
    Image Type:   MIPS Linux Kernel Image (uncompressed)
    Data Size:    19138320 Bytes = 18.3 MiB
    Load Address: 82011000
    Entry Point:  82011000
    Verifying Checksum ... OK
## Flattened Device Tree blob at 84f00000
    Booting using the fdt blob at 0x84f00000
Working FDT set to 84f00000
    Loading Kernel Image
    Loading Device Tree to 8fcf6000, end 8fcfb365 ... OK
Working FDT set to 8fcf6000
(It takes a while here to decompress...)
[    0.000000] Linux version 6.2.0-rc3+ (arinc9 at arinc9-PC) 
(mips-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU 
Binutils for Ubuntu) 2.38) #75 SMP Fri Jan 13 14:41:56 +03 2023
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is UniElec U7621-06 (16M flash)
[...]

I was wondering if there's a limit the bootloader sets for the lzma 
decompressor. I assume it's 2 MiB for CFE.

Did you try booting a kernel on this Northstar SoC with U-Boot?

Arınç



More information about the openwrt-devel mailing list