airoha: add support for Nokia XG-040G-MF (UBI)

This commit adds support for OpenWrt U-Boot variant of Nokia XG-040G-MF
XG-PON ONU.

Notes
-----
1. A simple installation without serial console is also possible using a
   fork of @dangowrt's UBI Installer
Link: https://github.com/dangowrt/owrt-ubi-installer

Installation / recovery
-----------------------
1.  Make sure that you have 'bosa' and 'ri' partitions mtd backups before
    you start
2.  Place OpenWrt images on the tftp server (IP: 192.168.1.254):
    openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-bl31-uboot.fip
    openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-initramfs-recovery.itb
    openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-preloader.bin
3.  Attach serial console and start terminal with XMODEM support:
    picocom -b 115200 --send-cmd "sx -vvX" /dev/ttyUSB0
4.  Push reset button and power on the router
5.  Press 'x', then 'Ctrl + A' and 'Ctrl + S'
6.  Paste full path to the bl2 image:
    'openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-preloader.bin'
7.  Wait until the file is downloaded and the following prompt appears:
    Press x to load BL31 + U-Boot FIP
8.  Press 'x', then 'Ctrl + A' and 'Ctrl + S'
9.  Paste full path to the fip image:
    'openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-bl31-uboot.fip'
10. Wait until the file is downloaded, u-boot will prepare ubi partition
    automatically
11. Wait for U-Boot menu
12. Run 'Load BL31+U-Boot FIP via TFTP then write to NAND'
13. Run 'Load BL2 preloader via TFTP then write to NAND'
14. Run 'Boot system via TFTP'
15. Once in OpenWrt perform standard sysupgrade
16. Once in OpenWrt upload 'bosa' and 'ri' partitions mtd backups to the
    /tmp dir using scp protocol
17. Check ID of the UBI volumes:
    ubinfo -d 0 -N bosa | grep "Volume ID"
    ubinfo -d 0 -N ri | grep "Volume ID"
18. Write backups according to the volume ID:
    ubiupdatevol /dev/ubi0_2 /tmp/bosa.bin
    ubiupdatevol /dev/ubi0_3 /tmp/ri.bin
19. Reboot:
    reboot

UART
----
A view from the back side of the PCB:
   ------------------------
   |       GND RX TX
   |        X  X  X
Connection parameters:
115200, 8N1, 3.3V

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24654
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mikhail Zhilkin authored and Robert Marko committed 2026-08-15 10:52:45 +02:00
1 parent c7cbbebfab
commit cbe75a7bb1
6 files changed
+54 -7

No files matched your search

@@ -15,6 +15,9 @@ case "$board" in
nokia,xg-040g-mf)
ubootenv_add_mtd "u-boot-env" "0x1c000" "0x4000" "0x4000"
;;
nokia,xg-040g-mf-ubi)
ubootenv_add_ubi_default
;;
esac
config_load ubootenv
@@ -9,7 +9,8 @@ board_config_update
board=$(board_name)
case "$board" in
nokia,xg-040g-mf)
nokia,xg-040g-mf|\
nokia,xg-040g-mf-ubi)
ucidef_set_led_netdev "lan2" "lan2" "mt7530-0:0a:green:lan-2" "lan2" "link tx rx"
ucidef_set_led_netdev "lan3" "lan3" "mt7530-0:0b:green:lan-3" "lan3" "link tx rx"
ucidef_set_led_netdev "lan4" "lan4" "mt7530-0:0c:green:lan-4" "lan4" "link tx rx"
@@ -14,7 +14,8 @@ an7583_setup_interfaces()
airoha,an7583-evb)
ucidef_set_interface_lan "lan1 lan2 lan3 lan4 eth1"
;;
nokia,xg-040g-mf)
nokia,xg-040g-mf|\
nokia,xg-040g-mf-ubi)
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
;;
*)
@@ -13,6 +13,10 @@ platform_check_image() {
local board=$(board_name)
case "$board" in
nokia,xg-040g-mf-ubi)
fit_check_image "$1"
return $?
;;
*)
nand_do_platform_check "$board" "$1"
return $?
@@ -26,6 +30,9 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
nokia,xg-040g-mf-ubi)
fit_do_upgrade "$1"
;;
*)
nand_do_upgrade "$1"
;;
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
#include "an7583-nokia_xg-040g-mf-common.dtsi"
#include "an758x-nokia_xg-040g-ubi-parts.dtsi"
/ {
model = "Nokia XG-040G-MF (UBI)";
compatible = "nokia,xg-040g-mf-ubi", "airoha,an7583",
"airoha,en7583";
};
+30 -5
View File
@@ -47,22 +47,47 @@ define Device/airoha_an7583-evb-emmc
endef
TARGET_DEVICES += airoha_an7583-evb-emmc
define Device/nokia_xg-040g-mf
define Device/nokia_xg-040g-mf-common
$(call Device/FitImageLzma)
DEVICE_VENDOR := Nokia
DEVICE_MODEL := XG-040G-MF
DEVICE_DTS := an7583-nokia_xg-040g-mf
DEVICE_DTS_CONFIG := config@1
BLOCKSIZE := 128k
PAGESIZE := 2048
UBINIZE_OPTS := -E 5
DEVICE_PACKAGES := kmod-phy-airoha-en8811h \
kmod-regulator-userspace-consumer kmod-usb-ledtrig-usbport
endef
define Device/nokia_xg-040g-mf
$(call Device/nokia_xg-040g-mf-common)
DEVICE_DTS := an7583-nokia_xg-040g-mf
DEVICE_DTS_CONFIG := config@1
IMAGE_SIZE := 131968k
KERNEL_SIZE := 8192k
IMAGES += factory-kernel.bin factory-rootfs.bin
IMAGE/factory-kernel.bin := append-kernel
IMAGE/factory-rootfs.bin := append-ubi | check-size
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
DEVICE_PACKAGES := kmod-phy-airoha-en8811h kmod-regulator-userspace-consumer \
kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += nokia_xg-040g-mf
define Device/nokia_xg-040g-mf-ubi
$(call Device/nokia_xg-040g-mf-common)
DEVICE_VARIANT := (UBI)
DEVICE_DTS := an7583-nokia_xg-040g-mf-ubi
UBOOTENV_IN_UBI := 1
KERNEL_IN_UBI := 1
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
IMAGES := sysupgrade.itb
IMAGE/sysupgrade.itb := append-kernel | \
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \
append-metadata
DEVICE_PACKAGES += fitblk
ARTIFACT/bl31-uboot.fip := an7583-bl31-uboot nokia_xg-040g-mf
ARTIFACT/preloader.bin := an7583-preloader nokia_xg-040g-mf
ARTIFACTS := bl31-uboot.fip preloader.bin
endef
TARGET_DEVICES += nokia_xg-040g-mf-ubi