Hi!
Sorry to only bump into this thread now, I've simply not been aware of it.
@netomx:
I'm using a couple of those devices with stock bootloader in production as well as a bunch replaced U-Boot running the ubootmod
firmware. Since when OpenWrt doesn't boot any more on your device? I understand that it was working and then soft-bricked after sysupgrade to a newer image downloaded from downloads.openwrt.org?
@knacky:
The ubootmod is basically a more full-featured U-Boot and recent ARM TrustedFirmware-A which supports recovery/production dual-boot similar to the Linksys E8450/Belkin RT3200 or the BananaPi R{2,3,64} boards.
The resulting flash layout of the 64MiB SPI-NOR flash:
0x000000000000-0x000000020000 : "bl2" <- *ubnt_unifi-6-lr-v1-ubootmod-preloader.bin
0x000000020000-0x0000000c0000 : "fip" <- *ubnt_unifi-6-lr-v1-ubootmod-bl31-uboot.fip
0x0000000c0000-0x0000000d0000 : "u-boot-env" -- erase
0x0000000d0000-0x000000110000 : "factory" -- dont't touch
0x000000110000-0x000000120000 : "eeprom" -- dont't touch
0x000000120000-0x000001000000 : "recovery" <- *ubnt_unifi-6-lr-*-ubootmod-initramfs-recovery.itb
0x000001000000-0x000004000000 : "firmware" <- *ubnt_unifi-6-lr-*-ubootmod-squashfs-sysupgrade.itb
So factory
and eeprom
(which contain MAC addresses and Wi-Fi calibration data) are kept intact and everything else is replaced. Note that as the replacement U-Boot doesn't touch the LED (which is the difference between v1 and v2) bl2
and fip
are identical for v1 and v2. The recovery and sysupgrade image, however, do make use of the LEDs which are driven differently in v1 and v2, so there you need to select the appropriate image for the LEDs to work.
The easiest way to write these partitions is by booting ubnt_unifi-6-lr-*-ubootmod-initramfs-recovery.itb
via TFTP using the stock loader. Once booted, give the device a default route and install kmod-mtd-rw
using opkg:
opkg update
opkg install kmod-mtd-rw
insmod mtd-rw i_want_a_brick=1
You can now either upload the images to the device using scp -O ...
or simply download them from downloads.openwrt.org using wget on the device:
cd /tmp
wget https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-preloader.bin
wget https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-bl31-uboot.fip
...
Then write the bootloader and firmware partitions:
mtd write *ubnt_unifi-6-lr-v1-ubootmod-preloader.bin bl2
mtd write *ubnt_unifi-6-lr-v1-ubootmod-bl31-uboot.fip fip
mtd erase u-boot-env
mtd write *ubnt_unifi-6-lr-*-ubootmod-initramfs-recovery.itb recovery
mtd write *ubnt_unifi-6-lr-*-ubootmod-squashfs-sysupgrade.itb firmware
reboot -f
Now you got ARM Trusted Firmware 2.7+ and U-Boot 2022.10 running on the device.