Files
openwrt/target/linux/mediatek
Andrii Kuiukoff 9a161faa40 mediatek: filogic: comfast cf-wa933: replace 128M variant with all-in-UBI
Replace the expanded fixed-partition 128M target with a dedicated
all-in-UBI target and OpenWrt U-Boot. Include bootloader configuration,
image generation and upgrade support together.

Share the fixed-partitions container and read-only 1 MiB BL2 range
in the common DTSI. Declare the remaining partitions and factory NVMEM
data in the variant DTS files. Keep NMBM on the legacy target and preserve
its stock partition map and 64 MiB UBI region.
The new layout uses a 1 MiB bl2 partition followed by a 127 MiB ubi
partition, with factory and fit NVMEM/rootdisk references and redundant
U-Boot environment volumes. Set the UBI variant boot arguments to
`root=/dev/fit0 rootwait` and identify its fit volume as the root disk.
The bootloader supplies memory and console parameters.

Add the U-Boot configuration, default environment and target, recovery
FIT and sysupgrade FIT images, BL2 and BL31/U-Boot artifacts, UBI
environment access and FIT upgrade checks. Recognise the new compatible
in board defaults. Bump the uboot-tools package release for the
new environment configuration support.

The installer creates fip, factory, ubootenv, ubootenv2, recovery and
initial fit volumes. U-Boot and sysupgrade manage the production FIT
and writable rootfs_data. DTS declarations identify volumes consumed
by Linux; they do not themselves create or populate factory data.

MAC address layout
------------------
Factory data is read from the legacy Factory MTD partition or the
factory UBI volume; the offsets within the data are unchanged.
Unit-specific address bytes are xx:xx:xx.

LAN: factory offset 0xe000, mac-base cell index 0.
WAN: factory offset 0xe000, mac-base cell index 1 (LAN MAC + 1).
2.4 GHz: factory offset 0x4, mac-base cell index 0.
5 GHz: factory offset 0x8000, mac-base cell index 0.

Flash instructions
------------------
Conversion requires an installer; the sysupgrade ITB alone cannot
convert the stock partition layout or preserve its factory data.

1. Start from the standard CF-WA933 OpenWrt target with stock MTD
   partitions. Back up BL2, u-boot-env, Factory and FIP with mtd dump,
   and copy all four files off the device before proceeding:

     mtd dump BL2 > /tmp/BL2.bin
     mtd dump u-boot-env > /tmp/u-boot-env.bin
     mtd dump Factory > /tmp/Factory.bin
     mtd dump FIP > /tmp/FIP.bin

2. Obtain the CF-WA933 installer from:
   https://github.com/andros-ua/owrt-ubi-installer/releases
   Its source and build script are available at:
   https://github.com/andros-ua/owrt-ubi-installer/tree/cf-wa933
   Connect the PC to a LAN port and use 192.168.1.254/24; the device
   is at 192.168.1.1. Copy the resulting image to /tmp and run:

     cd /tmp
     sysupgrade -n \
       openwrt-*-comfast_cf-wa933-ubi-initramfs-recovery-installer.itb

   This external installer extracts calibration/MAC data from the old
   Factory region before erasing it, creates and populates the static
   factory UBI volume, writes BL2 and fip, and creates the redundant
   environment, recovery and initial fit volumes. It copies one NAND
   eraseblock of factory data; keep the full external Factory backup.
   The blue WLAN LED blinks during installation and stays lit for five
   seconds before reboot. Run the installer only for initial conversion.

3. Once recovery boots, copy the production image to /tmp and run:

     cd /tmp
     sysupgrade -n \
       openwrt-*-comfast_cf-wa933-ubi-squashfs-sysupgrade.itb

To return to the legacy layout, boot the standard CF-WA933 initramfs
in RAM, restore the saved BL2/u-boot-env/Factory/FIP to their original
MTD partitions (using kmod-mtd-rw when needed), then sysupgrade to the
standard CF-WA933 image. The restored vendor bootloader's recovery
page can install vendor firmware. UART recovery of BL2/FIP is also
available using https://github.com/981213/mtk_uartboot.

Signed-off-by: Andrii Kuiukoff <andros.ua@gmail.com>
Signed-off-by: Guillaume RISCHARD <git@stereo.lu>
Link: https://github.com/openwrt/openwrt/pull/24590
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
2026-10-15 22:03:42 +02:00
..
2026-10-04 15:57:54 +02:00