Adding OpenWrt support for Teles VoIPBox DSL (Lantiq VR9)

I've just tried that, dropped root=, booted initramfs and started OpenWrt's sysupgrade. This is what happens:

root@OpenWrt:/tmp# sysupgrade -v openwrt-lantiq-xrx200-teles_voipbox-dsl-bri-squ
ashfs-sysupgrade.bin
Cannot save config while running from ramdisk.
Sun Apr 11 17:29:31 UTC 2021 upgrade: Commencing upgrade. Closing all shell sessions.
Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sun Apr 11 17:29:32 UTC 2021 upgrade: Sending TERM to remaining processes ... odhcpd vdsl_cpe_contro ntpd netifd dnsmasq ubusd urngd logd
Sun Apr 11 17:29:35 UTC 2021 upgrade: Sending KILL to remaining processes ...
[ 1219.784554] sh (3475): drop_caches: 3
Sun Apr 11 17:29:36 UTC 2021 upgrade: Switching to ramdisk...
Sun Apr 11 17:29:39 UTC 2021 upgrade: Performing system upgrade...
[ 1223.141979] sh (3475): drop_caches: 3
Could not open mtd device: firmware
Can't open device for writing!
cat: write error: Broken pipe
sysupgrade aborte[ 1223.176593] reboot: Res▒
ROM VER: 1.1.4
CFG 01


U-Boot 2010.06-LANTIQ-v-2.2.70 (Aug 06 2015 - 13:33:23)

CLOCK CPU 500M RAM 250M
warmboot => config_dcdc skipped
RST_REQ bf203010 a0000000
RST_REQ a0000021
RST_REQ a0000000
DRAM:  64 MiB
Flash: 32 MiB
In:    serial
Out:   serial
Err:   serial
compare ethaddr with secfl
kernel_addr 0xb055e220 found
check for update.img ...
### JFFS2 loading 'update.img' to 0x80800000
Scanning JFFS2 FS: . done.
find_inode failed for name=update.img
load: Failed to find inode
### JFFS2 LOAD ERROR<0> for update.img!
update.img not found
Net:   Internal phy(GE) firmware version: 0x8434
vr9 Switch

Type "run flash_nfs" to mount root filesystem over NFS

Hit any key to stop autoboot:  0

Why does sysupgrade try to write to the firmware mtd device? That's the partition with the Lantiq DSL drivers... does the name trigger some magic? Should I give it some other name?

&localbus {
        nor@0 {
                compatible = "lantiq,nor";
                bank-width = <2>;
                reg = <0 0x0 0x2000000>;
                #address-cells = <1>;
                #size-cells = <1>;

                /* https://forum.openwrt.org/t/adding-openwrt-support-for-teles-voipbox-dsl-lantiq-vr9/93010/8?u=breti */
                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "uboot";
                                reg = <0x0 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@20000 {
                                label = "gphy_firmware";
                                reg = <0x20000 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@40000 {
                                label = "firmware";
                                reg = <0x40000 0x100000>; /* 1 MB */
                                read-only;
                        };

                        partition@140000 {
                                label = "kernel";
                                reg = <0x140000 0x680000>; /* 6.8 MB */
                        };

                        partition@7c0000 {
                                label = "sysconfig";
                                reg = <0x7c0000 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@7e0000 {
                                label = "ubootconfig";
                                reg = <0x7e0000 0x20000>; /* 128 kB */
                                read-only;
                        };
                        partition@800000 {
                                label = "ubi";
                                reg = <0x800000 0x1800000>; /* 25 MB */
                        };
                };
        };
};

Yes, it's possible that it triggers something in the sysupgrade. Rename it to something else.

Tried that, still the same...

root@OpenWrt:/tmp# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00020000 "uboot"
mtd1: 00020000 00020000 "gphy_firmware"
mtd2: 00100000 00020000 "dsl_firmware"
mtd3: 00680000 00020000 "kernel"
mtd4: 00020000 00020000 "sysconfig"
mtd5: 00020000 00020000 "ubootconfig"
mtd6: 01800000 00020000 "ubi"
root@OpenWrt:/tmp# sysupgrade -v openwrt-lantiq-xrx200-teles_voipbox-dsl-bri-squ
ashfs-sysupgrade.bin
Cannot save config while running from ramdisk.
Sun Apr 18 10:03:48 UTC 2021 upgrade: Commencing upgrade. Closing all shell sessions.
Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sun Apr 18 10:03:49 UTC 2021 upgrade: Sending TERM to remaining processes ... odhcpd vdsl_cpe_contro ntpd netifd dnsmasq ubusd urngd logd
Sun Apr 18 10:03:52 UTC 2021 upgrade: Sending KILL to remaining processes ...
[  119.119627] sh (3138): drop_caches: 3
Sun Apr 18 10:03:53 UTC 2021 upgrade: Switching to ramdisk...
Sun Apr 18 10:03:57 UTC 2021 upgrade: Performing system upgrade...
[  122.503761] sh (3138): drop_caches: 3
Could not open mtd device: firmware
Can't open device for writing!
cat: write error: Broken pipe
sysupgrade aborte[  122.538777] reboot: Res▒
ROM VER: 1.1.4
CFG 01


U-Boot 2010.06-LANTIQ-v-2.2.70 (Aug 06 2015 - 13:33:23)

Post your changes in target/linux/lantiq/image/vr9.mk. Or link to your repository, if pushed somewhere public.

Oh, sorry, should've done that before. Here's my repo (branch teles):

Move the device to vr9.mk. teles.mk implies that it's a new subtarget, while in fact your device is vr9. Also, change $(Device/lantiqFullImage) to $(Device/NAND).

OK, will try that.

OK, flashing FullImage with the teles updater doesn't work, so I can remove it, but NAND? Are you sure? There's no NAND memory in this device AFAIK.

Have tried both changes, still the same

root@OpenWrt:/tmp# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00020000 "uboot"
mtd1: 00020000 00020000 "gphy_firmware"
mtd2: 00100000 00020000 "dsl_firmware"
mtd3: 00680000 00020000 "kernel"
mtd4: 00020000 00020000 "sysconfig"
mtd5: 00020000 00020000 "ubootconfig"
mtd6: 01800000 00020000 "ubi"
root@OpenWrt:/tmp# sysupgrade -v openwrt-lantiq-xrx200-teles_voipbox-dsl-bri-squ
ashfs-sysupgrade.bin
Cannot save config while running from ramdisk.
Sun Apr 18 11:02:00 UTC 2021 upgrade: Commencing upgrade. Closing all shell sessions.
Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sun Apr 18 11:02:01 UTC 2021 upgrade: Sending TERM to remaining processes ... odhcpd vdsl_cpe_contro ntpd netifd dnsmasq ubusd urngd logd
Sun Apr 18 11:02:04 UTC 2021 upgrade: Sending KILL to remaining processes ...
[  129.469241] sh (3133): drop_caches: 3
Sun Apr 18 11:02:06 UTC 2021 upgrade: Switching to ramdisk...
Sun Apr 18 11:02:09 UTC 2021 upgrade: Performing system upgrade...
[  132.834469] sh (3133): drop_caches: 3
Could not open mtd device: firmware
Can't open device for writing!
cat: write error: Broken pipe
sysupgrade aborte[  132.867723] reboot: Res▒
ROM VER: 1.1.4
CFG 01

Sorry, I blindly assumed it's a NAND device without checking. Yes, remove $(Device/*) and try without anything (default target). Although, I'm worried that it won't work since the entire flash process for lantiq appears to assume the existence of "firmware" partition that holds both kernel and rootfs.

But I must admit that I can't speak from experience here, because so far I didn't have to dig too deep in the update scripts, and all boards I worked on in Lantiq target had functional sysupgrade without any troubles.

Ok, thanks. I'm going to the code and trying to figure out how/where to set the partition names for upgrade. There are some other devices in vr9.mk with no firmware partition, so it must be possible...

Idea: What about joining the gphy_firmware, the dsl_firmware and the kernel partition to one big ~8MB firmware partition? I don't think I need the firmware partitions anymore for OpenWrt because it uses its own firmware files. Don't know what the sysconfig partition is good for.

&localbus {
        nor@0 {
                compatible = "lantiq,nor";
                bank-width = <2>;
                reg = <0 0x0 0x2000000>;
                #address-cells = <1>;
                #size-cells = <1>;

                /* https://forum.openwrt.org/t/adding-openwrt-support-for-teles-voipbox-dsl-lantiq-vr9/93010/8?u=breti */
                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "uboot";
                                reg = <0x0 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@20000 {
                                label = "gphy_firmware";
                                reg = <0x20000 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@40000 {
                                label = "dsl_firmware";
                                reg = <0x40000 0x100000>; /* 1 MB */
                                read-only;
                        };

                        partition@140000 {
                                label = "kernel";
                                reg = <0x140000 0x680000>; /* 6.8 MB */
                        };

                        partition@7c0000 {
                                label = "sysconfig";
                                reg = <0x7c0000 0x20000>; /* 128 kB */
                                read-only;
                        };

                        partition@7e0000 {
                                label = "ubootconfig";
                                reg = <0x7e0000 0x20000>; /* 128 kB */
                                read-only;
                        };
                        partition@800000 {
                                label = "ubi";
                                reg = <0x800000 0x1800000>; /* 25 MB */
                        };
                };
        };
};

That's what I'm thinking too, but you'll need to trace the update process, starting from vr9.mk, then Makefile and all the way down through update.sh and platform.sh scripts to figure out what's happening.

In ideal world you could merge everything from gphy_firmware to ubi, but it's not possible since this device has a not so common split where u-boot config is between kernel and rootfs. Firmware and configuration partitions are usually at the beginning or end of the flash.

I don't think gphy_firmware and dsl_firmware are actually the problem here, and 6.8 MB is really a lot for the kernel already. You best bet is to make a new target for the sysupgrade image (like $(Device/teles)) where you could even make it work with stock firmware, making the initial flashing much easier. But you'll have to investigate the sysupgrade process.

OK - I'll try... Thank you for all your time and support! :slight_smile:

OK I've bricked the box -- the gphy_firmware partition was needed for u-boot to initialize the ethernet ports... :joy:

Now I have to look for UART recovery mode.

Hopefully you have a backup. If your U-Boot has loadx/loady/loadz commands, you can use them to transfer the backup from your PC.

I've some more boxes, so... no worries, one device more or less....

U-boot hangs before entering u-boot cli, so I can't do anything. Even with UART recovery I'd have to upload another u-boot version with ethernet disabled and xmodem support to upload a new image. No way.

ROM VER: 1.r;#!▒D▒

U-Boot 2010.06-LANTIQ-v-2.2.70 (Aug 06 2015 - 13:33:23)

CLOCK CPU 500M RAM 250M
coldboot => do config_dcdc ....
RST_REQ bf203010 a0000020
RST_REQ a0000021
RST_REQ a0000000
DRAM:  64 MiB
Flash: 32 MiB
In:    serial
Out:   serial
Err:   serial
compare ethaddr with secfl
kernel_addr 0xb055e2d0 found
check for update.img ...
### JFFS2 loading 'update.img' to 0x80800000
Scanning JFFS2 FS: . done.
find_inode failed for name=update.img
load: Failed to find inode
### JFFS2 LOAD ERROR<0> for update.img!
update.img not found
Net:

... that's it. No more output.