[Solved] Uboot - Not enough buffer for decompression LZMA ERROR 1

Thank you, anyway! :slight_smile:

P.s. I bought this router to have another device to test the ath79 target! :smiley:

Awesome,thanks for joining ath79 porting efforts

It may also be that the LZMA compression parameters at image creation cause the expand job to fail. I stumbled upon that 5 years ago with WNDR3700.

Basically the ar71xx compression parameters at image creation needed to be changed for WNDR3700 to use a slightly smaller "dictionary" size. The default was 23bit, causing it be max. 8 MB size, which semi-regularly broke decompression in Nov 2012. Restricting dictionary to 20 bits helped, and that has been the default for WNDR3700/3800 since then.

Read from here: https://dev.archive.openwrt.org/ticket/12454.html#comment:12

It is quite possible that there is something similar with your device. That LZMA error 1 is typically just a generic error flag.

It didn't work! :frowning: Same error
Before:

binwalk -I openwrt-ar71xx-generic-archer-c7-v2-initramfs-kernel.bin --dumb | grep LZMA
512           0x200           LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 5669300 bytes

After (The size is different because I rebuilt it from scratch):

binwalk -I openwrt-ar71xx-generic-archer-c7-v2-initramfs-kernel.bin --dumb | grep LZMA
512           0x200           LZMA compressed data, properties: 0x6D, dictionary size: 1048576 bytes, uncompressed size: 7012972 bytes

If can help, I tried binwalk on the OEM dump firrmware without the uboot partition:

 binwalk -I archer_d7.bin --dumb | grep LZMA
131584        0x20200         LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: 3078192 bytes
1441888       0x160060        LZMA compressed data, properties: 0x6D, dictionary size: 131072 bytes, uncompressed size: 131072 bytes
1488455       0x16B647        LZMA compressed data, properties: 0x6D, dictionary size: 131072 bytes, uncompressed size: 131072 bytes
etc....

The dictionary is above 8M. However I noticed that the property id is different (0x6D vs 0x5D)

Can you try using 0x81000000 as adress?
I got an AR7242 board using that

Sadly no luck.

AP135> tftpboot 0x81000000 openwrt-ar71xx-generic-archer-c7-v2-initramfs-kernel.
bin
dup 1 speed 1000
Using eth0 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.1
Filename 'openwrt-ar71xx-generic-archer-c7-v2-initramfs-kernel.bin'.
Load address: 0x81000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########################
done
Bytes transferred = 4115789 (3ecd4d hex)
AP135> bootm 0x81000000
## Booting image at 81000000 ...
        Uncompressing Kernel Image ... Not enough buffer for decompression
LZMA ERROR 1 - must RESET board to recover

However I think that the problem isn't related to the position in ram... in fact if I try to tftpboot the OEM image works in every position:

AP135> tftpboot 0x81000000 archer_d7_flash_after_uboot.bin
Using eth0 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.1
Filename 'archer_d7_flash_after_uboot.bin'.
Load address: 0x81000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##
done
Bytes transferred = 16646144 (fe0000 hex)
AP135> bootm 0x81000000
## Booting image at 81000000 ...
        Uncompressing Kernel Image ... OK

Starting kernel ...

Booting QCA955x
Linux version 2.6.31--LSDK-9.5.2.18 (root@localhost.localdomain) (gcc version 4.
3.3 (GCC) ) #2 Thu Jan 21 16:05:34 CST 2016
flash_size passed from bootloader = 16
arg 1: console=ttyS0,115200
arg 2: root=31:02
arg 3: rootfstype=squashfs
arg 4: init=/sbin/init
arg 5: mtdparts=ath-nor0:128k(u-boot),1280k(kernel),14656k(rootfs),64k(radioDECT
),64k(config),64k(romfs),64k(rom),64k(radio)
arg 6: mem=128M
CPU revision is: 00019750 (MIPS 74Kc)
cpu apb ddr apb ath_sys_frequency: cpu 720 ddr 600 ahb 200
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
User-defined physical RAM map:
 memory: 08000000 @ 00000000 (usable)
Zone PFN ranges:
  Normal   0x00000000 -> 0x00008000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00008000
etc..

Do you know if is possible to boot another u-boot from u-boot in ram? (u-boot-inception ahah :D) I could try to compile a custom uboot and then start my initarmfs.... :roll_eyes:

Hm,well it should be possible

what is the code for the image building ? 1043 v4 needed tplink-safeloader, the rest did not
or you could try gzip the initrd instead of lzma

If you have the "go" command in your main bl, it should be possible... But you need probably a build without low level initialization...

I think there is no jtag on board?
I would use pepe2k's u-boot_mod and modify this one for your board... There are other board with the same soc, so this shouldn be that hard...
If you backup your spi flash and have a programmer you could also try to replace the factory u-boot with that.

Edit: I have to correct me, he mentions that he supports qca955x soc, but there is no board with this soc mentioned in the readme.

What code should I check?
I think your are talking about this: (I commentend "lzma | tplink-v1-header" to try other compression methods)

define Device/tplink
  TPLINK_HWREV := 0x1
  TPLINK_HEADER_VERSION := 1
  LOADER_TYPE := gz
  KERNEL := kernel-bin | patch-cmdline | lzma
  KERNEL_INITRAMFS := kernel-bin | patch-cmdline #| lzma | tplink-v1-header
  IMAGES := sysupgrade.bin factory.bin
  IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
  IMAGE/factory.bin := append-rootfs | mktplinkfw factory
endef

However if I try to boot an image without compression it says:

Uncompressing Kernel Image ... OK

Starting kernel ...

but it stops here... so probably I should give some other instruction to u-boot to start the kernel correctly. Unfortunately I can't find anything online...

hmm replace patch-cmdline by append-dtb (you have to do it anyway) and instead of lzma try gzip

KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | tplink-v1-header

I don't know if # is ok right there, maybe remove the | lzma

I have the "go" command but I don't know how to remove the low level initialization.... I can compile u-boot from tp-link sources, but I am not so skilled to edit the u-boot sources blindly...

About the JTAG, there are the pins... but probably is connected to the broadcom cpu and I don't have an spi programmer... I should buy it...
ARCHER%20D7

I am still using the old ar71xx target... when it will boot correctly I'll use the ath79 target... However I'll try your string....

[OT] Just for clarification... I have two QCA9550 board: this one and the Sitecom WLR-8100... For what concern the ath79 testing I am using the Sitecom... When I'll have some spare time I'll also test your latest commit :wink: [/OT]

ah sorry, I thought you're using the ath79 (you should)

You could also try it firstly with a "normal" build, but most devices will hang with a second low level init...
What will you do if your tp-link bl will boot that you can boot your image?
DonΒ΄t know what throws this lzma error.

I had good experiences with this cheap CH341A spi programmer and flashrom as software.
And probabl something like this...
With this clamp i could read and write a wr1043v4 without desoldering, but cheaper/low power devices as wr841v8 does not work without desoldering.

My hunch is still, like I wrote above, about the compression parameters used in creating the LZMA image. In addition to the dictionary size, you might try removing the three other non-standard parameters "-lc1 -lp2 -pb2" in order to see if the compressed image could work.

Success!!! :slight_smile: Eventually the problem was: wrong header version!

The position for the kernel size is different in the v3 header... So previously the modem read 80 06 00 00 as kernel size... Approximately 2GB! :joy:

Apparently this is the only ar71xx device to require the Tp-Link header v3... while other ar71xx needs the safeloader or the the v1....

Do you think I should create the patch for ar71xx or ath79 or both?

However thank you all for the help! :slight_smile:

@juppin Fun fact: I bought the spi programmer few hours ago on Amazon with 1-day delivery!! :sweat_smile: It will be useful the next time! :wink:

Attention is slowly shifting from ar71xx to ath79, so if you think you can support the complete device (to the extent possible, e.g. I don't expect xDSL modem functionality to ever get supported) in reasonable time, I'd concentrate on ath79 (and kernel 4.14) only, but ar71xx hasn't been formally closed for device additions yet.

Ok, I'll try to do both in this week-end.. :wink: Next weeks I'll be practically offline due to exams...

For what concern the xDSL part, this modem (but also vr2600 and few other) could be "supported" in theory, because of the two cpus... for example I can restart the QCA9550 while the broadcom is still alive and working...

We should "just" find the way the two cpus send commands to the other. Unfortunately I don't have an adsl line anymore... so I can't test it... but I'll inform you about my findings :slight_smile:

in my case the error message was slightly different:
Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

tftpboot was requesting default image name to load at address 0x80100000 so i tried load my built image to that address and got the message above.

however if on boot select 1. load image to SDRAM it prompts for ip addresses and image file and loads it to 0x80a00000 and from that address extraction goes fine and boot continues.

1 Like