Flashing 23.05 onto UAP-LR

Hi @mk24
I'm hoping you might have some more advice for me.

I'm trying for flash the latest OpenWRT firmware via serial on a UAP-LR with the AR7241 chip, but I'm running into the following problem (I also tried it with, 0x81000000, the memory location you suggested):

ar7240> tftp 0x80000000 initramfs-kernel.bin
Using eth0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.20
Filename 'initramfs-kernel.bin'.
Load address: 0x80000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########################################################
done
Bytes transferred = 5624259 (55d1c3 hex)
ar7240> bootm 0x80000000
## Booting image at 80000000 ...
   Image Name:   MIPS OpenWrt Linux-5.15.150
   Created:      2024-03-22  22:09:42 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    5624195 Bytes =  5.4 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x80000040 ...OK
   Uncompressing Kernel Image ... ERROR: LzmaDecode.c, 543

Decoding error = 1
LZMA ERROR 1 - must RESET board to recover

Resetting...

U-Boot unifi-v1.6.17.296-g1af7670c (Apr 22 2019 - 11:05:55)

DRAM:  64 MB
Base:0x80000000, Top:0x84000000, Res logbuf:0xa3ff3800, log_magic:0xf0f0f0f0 kseg: 0xa0000000
Flash:  8 MB
PCIe WLAN Module found (tries: 1). 
Net:   eth0, eth1
Board: Copyright Ubiquiti Networks Inc. 2014
Hit any key to stop autoboot:  0 
Board: Ubiquiti Networks AR7241 board (e512-20.0101.002e)
 0. Name = u-boot, offset = 0, start_addr=9f000000, size=262144,start_sector=0, end_sector=3 
 1. Name = u-boot-env, offset = 40000, start_addr=9f040000, size=65536,start_sector=4, end_sector=4 
 2. Name = kernel, offset = 50000, start_addr=9f050000, size=7733248,start_sector=5, end_sector=122 
 3. Name = cfg, offset = 7b0000, start_addr=9f7b0000, size=262144,start_sector=123, end_sector=126 
 4. Name = EEPROM, offset = 7f0000, start_addr=9f7f0000, size=65536,start_sector=127, end_sector=127 
UBNT application initialized 
## Booting image at 9f050000 ...
Bad Magic Number
ar7240> 

I tried flashing the Kernel file from here: https://firmware-selector.openwrt.org/?version=23.05.3&target=ath79%2Fgeneric&id=ubnt_unifi-ap-lr

The OEM firmware version is was 4.xx, I couldn't downgrade it. I also I tried flashing the SysUpgrade firmware file but ran into a " cannot use older jffs2 file system with newer kernel" error when booting when I followed the guide here: https://openwrt.org/toh/ubiquiti/unifi_ap

This is now quite a bit different situation than the thread title, since the UAP-LR is a fully supported model. There are release 23.05.3 initramfs and sysupgrade builds available for direct download and I suggest using those.

The "LZMA Error" after decompression has started is because with an improper load address, the uncompressed kernel being formed in RAM overwrites memory space that is holding yet to be uncompressed data. That will happen almost immediately with a load address of 0x80000000, and it may happen at 81000000 as the newer builds get larger. To avoid this, try increasing the load address even further to 0x82000000, which will allow 32 MB of space for the uncompressed kernel.

Thanks, @mk24

I've not had any luck with the official guide for flashing OpenWRT on the UAP-LR.(Couldn't find any info in UAP-LR forums related to my problem either, Luckily I ended up finding your post).

I'll give it another try tonight with the 0x82000000 load address, hopefully that will work. Thanks for the suggestion. I'll let you know if it works or not.

Thanks again, @mk24

The load address of 0x80000000 worked! It booted from RAM and I was finally able to boot and flash OpenWRT!