Commit Graph

5 Commits

Author SHA1 Message Date
Chuanhong Guo a6991fc7d2 mediatek: mt7622: add a second u-boot for redmi-ax6s
The vendor u-boot knows nothing about UBI, and we used to have a
fixed-size kernel partition for vendor u-boot and UBI for rootfs.
However, that fixed partition becomes too small eventually, and
expanding it requires complicated procedure.

This commit changed the flash layout and added a second u-boot
where the kernel supposed to be.
Now the vendor u-boot chainloads our mainline u-boot, and our
u-boot reads kernel+rootfs from UBI, verifies it, and boot
into OpenWrt.

There are two possible ways to convert from the old fw:
Flash the factory image using mtd (provided by @rany2):

mount -o remount,ro /
mount -o remount,ro /overlay
cd /tmp
dd if=factory.bin bs=1M count=4 | mtd write - kernel
dd if=factory.bin bs=1M skip=4 | mtd -r write - ubi

Or, flash the 2nd u-boot via mtd and upload the firmware
to the 2nd u-boot using tftp:

1. prepare a tftp server at 192.168.1.254 to serve the
   sysupgrade image:
   openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-sysupgrade.itb
2. upload the ubi-loader.itb to OpenWrt /tmp, and flash it to
   the old kernel partition:
   mtd -r write openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-ubi-loader.itb
3. The router should reboot and flash the sysupgrade image via TFTP.

Procedure for flashing from vendor firmware shouldn't change.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2024-03-21 16:55:13 +08:00
Daniel Golle 6aec3c7b5b mediatek: mt7622: modernize Linksys E8450 / Belkin RT3200 UBI build
Move fip and factory into UBI static volumes.
Use fitblk instead of partition parser.

 !! RUN INSTALLER FIRST !!
Existing users of previous OpenWrt releases or snapshot builds will
have to **re-run the updated installer** before upgrading to firmware
after this commit.
DO NOT flash or run even just the initramfs image unless you have
run the updated installer which moves the content of the 'factory'
partition into a UBI volume.

tl;dr: DON'T USE YET!

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:30:08 +00:00
Daniel Golle 208f6c1232 mediatek: mt7622: convert BPi-R64 to all-UBI layout and fitblk
Modernize bootloader and flash memory layout of the BPi-R64 similar to
how it has also been done for the BPi-R3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:30:08 +00:00
INAGAKI Hiroshi e8646f5b3d mediatek: expand kernel size to 6MiB for WSR-2533DHP2
Expand kernel partition size on WSR-2533DHP2 for the kernel larger than
4 MiB.
To prevent upgrading from old firmware before this commit, bump the
compat version to 1.1 and add a message for forced sysupgrade using
factory-uboot.bin image.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
Daniel Golle 25e27c4af3 mediatek: set new compat version if booted on R64 and R3
If the board comes up with OpenWrt that means that the bootloader is
recent enough and knows about the new device tree overlays.

Using /etc/board.d/ is not enough in this case because it doesn't
overwrite existing configuration which may exist (and is fine to exist)
if the user updated with 'sysupgrade -F *.itb' and has kept
configuration. They would still need to manually set compat_version
even though the fact that the bootloader env has been updated can be
implied by the fact that the system has started.

Hence we can always set compat_version=1.1 for those two boards using
uci-defaults.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-06-06 01:21:56 +01:00