Porting Linux 6.12 to a 5G router that mainline doesn't know exists
After finding a backdoor on my Telstra 5G Modem 2, I replaced everything above the bootloader: first the reseller's kernel, then the whole MediaTek T750 platform onto Linux 6.12 with OpenWrt 25.12. Here's what it took, trial by trial.
Contents
- The hardware and the rules
- Step one: get rid of the reseller’s kernel
- Mainline has nothing; the SDK has everything
- Getting it to boot at all
- Ethernet: forty trials for one clock
- 5G: the modem on a kernel it was never built for
- Wi-Fi: the easy part, mostly
- Everything else a router needs
- OpenWrt 25.12 on top
- Hardening and tuning
- Where it stands
In Part 1 I found that the second-hand Telstra 5G Modem 2 I’d bought came pre-joined to the seller’s Tailscale network, with a passwordless root telnet shell, a reseller-modified kernel and a pile of software I didn’t ask for. Removing the Tailscale login closed one door. It didn’t make the rest of the system trustworthy.
So I replaced it. The router now runs OpenWrt 25.12.6 on a Linux 6.12.118 kernel I built myself, with Ethernet, 5G (IPv4 and IPv6), both Wi-Fi 6 radios, thermal protection, LEDs and buttons all working. The kernel runs untainted, with zero warnings at boot. Mainline Linux has no support at all for this SoC, so getting there meant porting MediaTek’s platform layer for the T750 from a 4.19 vendor tree onto 6.12.
This is the long version. The code, scripts and a prebuilt GPL-only kernel are at dpusta/telstra-5g-modem-2.
The hardware and the rules
| Board | Arcadyan AW1000 Ultra (“Telstra 5G Modem 2”), device tree telstra,meteor2 |
| SoC | MediaTek T750 / MT6890, 4× Cortex-A55, about 1.6 GB usable RAM |
| Storage | 16 GB eMMC, GPT, full A/B slots |
| Modem | Fibocom FG360-EAU, talking to Linux over MediaTek’s CCCI/MIPC (not QMI, not MBIM) |
| Wi-Fi | 2× MT7915 on PCIe |
| Ethernet | 2 MACs: one through SGMII to an MT7531 switch (4 LAN ports), one to an RTL8221B 2.5G PHY (WAN) |
| Stock software | vendor OpenWrt 19.07.7, Linux 4.19.190 |
A few facts shaped everything that followed:
- Some parts stay closed whatever I do. These are the preloader, the LK bootloader, the SPM/SSPM/MCUPM power firmware, the modem firmware and the Wi-Fi firmware blobs. I never write any of them.
- The signing keys are public. Every signed image on the board is signed with MediaTek’s default SDK test keys, and the boot ROM doesn’t enforce secure boot (
sbc_en = 0). I can produce a boot image the bootloader accepts without defeating anything. - A/B slots are the only safety net. The preloader keeps a per-slot priority, try counter and success flag in the
miscpartition. If I give slot A a single try and the kernel there never marks itself successful, the next restart goes back to slot B. That is the whole recovery story, because there is no proven USB recovery for this model. Public reports show reading these boards over USB, never a successful write. Every flash had to assume that a mistake could be permanent. - Some partitions must never be written.
proinfoholds the activation code,nvdata/nvramhold the IMEI and RF calibration, andmiscmay only be changed through the slot script. The stockfirstboot_fullzeroes the calibration, so it never runs either.
Before anything else I copied all 52 partitions off the router and checked each against the device by SHA-256.
Step one: get rid of the reseller’s kernel
The stock kernel is a rebuild with two additions (details in Part 1): a hidden check that restarts the board forever if /bin/modem_status is missing, and an RSA activation lock tied to the chip serial number. To run a clean system on it you have to ship the reseller’s modem_status file and live with the lock.
The way out was Fibocom’s own kernel. Fibocom’s SP-Flash packages for the FG360 circulate on forums, and the NA variant’s kernel (4.19.190, built 2025-06-14 with the same OpenWrt GCC 7.5 toolchain) matched the modversions CRCs of all 52 vendor drivers this board needs, 1,819 symbol checks with no mismatch. Its configuration differed from the reseller kernel only by the reseller’s additions.
kernel/make-boot.py combines that kernel with the router’s own boot header and device tree, then signs cert2 the way the SDK’s sign.py does (RSASSA-PSS, SHA-256, salt 32, the SDK test image key). It rebuilds the original boot images byte for byte, which is how I know it’s right. I tested it on slot A with slot B as the fallback, then wrote it to slot B with the proven slot A as the fallback. Both slots then ran Fibocom’s kernel, and no reseller code was left.
On top of that went OpenWrt 25.12.6 userspace on the 4.19 kernel (“image 8”). It uses official signed OpenWrt packages plus the handful of vendor programs the modem needs, kept read-only in /opt/telstra. That was a working, clean router. It was also running a kernel from May 2021 on a branch that stopped getting security fixes in December 2024, with no nftables, no namespaces and no seccomp. So, 6.12.
Mainline has nothing; the SDK has everything
I checked mainline 6.12.118 directly: there are zero hits for mt6890, mt6880 or t750 in drivers/, arch/arm64 or the DT bindings. The MediaTek clock and pinctrl drivers stop at other SoC families, mtk_eth_soc knows MT2701/MT762x/MT798x, and there is no CCCI modem interface anywhere in mainline.
A copy of Fibocom’s FG360 SDK also circulates, and its ext_kernel-4.19 is a complete Linux 4.19 tree with exactly the pieces mainline lacks:
clk-mt6890.c;pinctrl-mt6880.cplus this board’s pinmux table;- the GMAC/SGMII Ethernet driver;
- the eCCCI modem interface (240+ files, with an
mt6890/platform layer); - the PMIC, PCIe host and PHY drivers;
- the thermal drivers.
So the port was not a reverse-engineering job. It was a backport, large but fully open. The SDK itself is not redistributable, so the repository only contains the files I derived from it.
Strategy: graft, overlay or carry
For each component I picked one of three approaches:
- Graft onto mainline, where mainline has a newer driver for the same IP generation.
mtk_eth_socgot anmt6890_dataentry,mtk-sdgot a match line with MT8183 host data (checked against the vendor’s register header), andpinctrl-mt6880slotted into the same “paris” framework mainline uses. - Overlay the SDK file wholesale, where mainline’s driver of the same name is for a different IP generation. The PCIe host and PHY are examples: mainline
pcie-mediatek-gen3targets MT8192, while the SDK version has the MT6890 pre-init, VCOREFS SMC calls and power quirks. - Carry the vendor tree intact, where there’s no mainline equivalent at all. That meant all of eCCCI/CCMNI/DPMAIF, 46 files, with their own Kconfig.
Everything is applied by one idempotent Python script (kernel-port/scripts/apply.py) to a pristine 6.12.118 tarball on every build. There’s no long-lived fork to rebase.
One compat header instead of a thousand edits
The vendor modem stack was written against 4.19. Instead of editing every call site, it’s built with -include linux/mtk_ccci_compat.h, a 110-line header that maps the removed APIs:
/* 4.19 called this; ioremap() is the same on arm64 (removed in 5.6) */
#define ioremap_nocache(addr, size) ioremap((addr), (size))
/* PDE_DATA() renamed (5.17) */
#define PDE_DATA(inode) pde_data(inode)
/* netif_napi_add() lost its weight argument (6.7); keep the 4-arg form */
#define netif_napi_add(dev, napi, poll, weight) \
netif_napi_add_weight((dev), (napi), (poll), (weight))
The rest of the 4.19 to 6.12 API drift was handled with mechanical edits:
proc_opsreplacedfile_operationsfor/procfiles;class_create()takes one argument;kobj_type.default_groups;- syscore
.suspendreturnsintwhile.resumereturnsvoid; ndo_tx_timeout()gained a queue argument;compat_timevalis gone;- platform
remove()returnsvoid.
Helpfully, -Wincompatible-pointer-types is now a hard error in 6.12, which surfaced every signature I’d missed.
Shims can be wrong in quiet ways. The first version of the RTC shim cast struct tm to struct rtc_time. On arm64 struct tm is four bytes larger (long tm_year), so the conversion wrote past the caller’s stack variable. The stack protector killed the kernel in ccci_event_log() the first time the modem daemon closed a port. The fix converts field by field through a real struct tm. A second shim had turned __inval_dcache_area() into a mere barrier. Since the modem writes its receive ring by DMA into cached memory, the CPU read stale ring entries, and after a while the modem asserted in its data-path driver. It’s now dcache_inval_poc().
By 2 December the full kernel built cleanly: clocks, pinctrl, UART, eMMC, Ethernet, the complete eCCCI modem stack and PCIe, all built in. That’s when the hardware got a say.
Getting it to boot at all
Each hardware trial followed the same procedure:
- Write
boot_aonly. - Give slot A exactly one try.
- Restart.
- If slot A doesn’t mark itself successful, the preloader falls back to slot B.
- Check from slot B that
boot_bis byte-identical to before.
Trials 1 to 4: nothing. The router left slot B, and about 105 seconds later it was back on slot B. The bootloader’s crash record said wdt_status 0x5, a hardware watchdog reset. I had no serial console. In trial 3 I moved the watchdog countdown to the kernel’s very first instructions: if the kernel had run at all, the board would have come back at least 10 seconds sooner. It didn’t, so the kernel most likely never executed its first instruction.
The fix was in the bootloader, not the kernel. Before jumping to the kernel, LK patches the device tree through a set of set_fdt hooks that look up specific stock nodes: /emicen@10219000, /emimpu@10226000, /emiisu, /mrdump_ext_rst, /dramc, /mddriver and others. If any is missing, LK fails silently and never jumps. Stub nodes without the stock phandles are enough. After that, /soc needed compatible = "simple-bus", and 6.12 booted.
Logging without a serial port. LK copies the ramoops console zone into its expdb crash partition, but only after a hardware watchdog reset. So the bring-up kernel copied printk into that zone (meteor2_ramlog=), booted with panic=0 so that a panic hangs instead of rebooting by software, and ended its init by letting /dev/watchdog expire on purpose. Back on slot B, the 6.12 log was waiting in expdb. One trap: after any other kind of reset, LK restores an old snapshot into pstore, so a stale log can look like a fresh one.
Ethernet: forty trials for one clock
NETSYS was unpowered. In trial 11 every driver bound, but every register in the network subsystem (0x15000000 to 0x1511ffff) read zero. The vendor DT does have a NETSYS power domain, but it’s commented out (“modify by CLK SW”), and the 4.19 kernel never powers it because the bootloader already has. The “eth” domain that does exist in the vendor table is a different, unused Synopsys GMAC, and trying to power it timed out and took down the whole power-domain probe. The real one is NETSYS_PWR_CON at SPM offset 0x34c, status bit 19, found in the vendor clock driver’s pwr_names[19] and ATF’s mt_spm_reg.h. I added it as a new domain with its bus protection bits. Then mainline oopsed because it reads mediatek,infracfg per domain node rather than from the controller node, which was another quick fix. The result was the MT7531 probed, the DSA tree came up and lan0 to lan4 appeared. Still no frame got through.
The switch’s own counters located the fault. I exposed the MT7531’s registers and per-port MIB counters through debugfs. Port 2 received my Mac’s frames cleanly, and port 6 delivered them to the CPU cleanly. But what port 6 received from the SoC’s GMAC2 was only fragments, about five bytes each, one per transmit attempt. GMAC2 started every frame and aborted it, and it truncated what it received.
I spent trials 16 to 67 comparing every readable register against the running stock system with devmem. I ruled out:
- the SGMII mode and line rate;
- the Vcore voltage;
- the PLLs;
- the GMAC configuration;
- the special-tag handling;
- the QDMA queue IDs;
- the NETSYS SRAM power-down bits, which were wrong but weren’t the cause.
Eventually every frame-engine, GMAC, ETHSYS and SGMII register matched stock, and it still didn’t work.
The clocks were running at 26 MHz. The topckgen frequency meter showed the NETSYS clock muxes fed from the 26 MHz crystal instead of 356 to 800 MHz. The mux registers were identical to stock, and the muxes ignored software reselection. On the stock system the SPM firmware owns those muxes, and it only takes them over once the kernel starts Vcore DVFS. The vendor mtk-dvfsrc driver makes an ATF SMC call (0xC2000506, VCOREFS_CONTROL) with the INIT command, programs about 80 DVFSRC registers, then sends START at late_initcall_sync. Nothing in mainline does that on this SoC.
- Trial 68 added INIT, the register programme and START. The muxes moved to 156/273/364 MHz: receive was clean, transmit still aborted.
- Trial 69 added a Vcore level request. The muxes moved to 242/546/437 MHz, and transmit and receive both worked: DHCP lease, pings, about 100 page loads.
- Trial 71 moved this into a proper driver (
mtk-dvfsrc-mt6890.c, with advfsrc@10012000DT node) at the level stock actually runs (750 mV). The NETSYS clocks matched stock exactly, and a 32 MiB HTTP transfer ran at ~870 Mbit/s, which is gigabit line rate.
Two more Ethernet bugs:
- A transmit stall in QDMA. Every session eventually hit a NETDEV watchdog on LAN queue 5, and live measurement showed the hardware DMA pointer always one descriptor ahead of the CPU’s. Mainline’s TX reclaim loop checks the owner bit on the next descriptor; this QDMA v2 (like the vendor driver) needs it checked on the current one. After the fix, throughput was 110 to 112 MB/s with no watchdog.
- The WAN PHY wasn’t where the device tree said. The stock DT names the 2.5G PHY
aqr112cat MDIO address 8. This board actually has an RTL8221B at address 7, with its reset on GPIO64. LK leaves that GPIO low and the stock kernel drives it high. The reset has to sit on the MDIO bus node, because the bus scan reads PHY IDs before any per-PHY reset would run.
5G: the modem on a kernel it was never built for
The vendor eCCCI stack is the reason most people would call this port impossible. It came up in stages:
- The bootloader starts the modem, and Linux has to find it. LK loads and boots the modem firmware and leaves an info buffer in reserved memory. The driver couldn’t map it: it used
pfn_valid(), which on 6.12 is true for all RAM, so it took the wrong path to a stubvmap_reserved_mem. Switching topfn_is_map_memory()plus a realvmapfixed it. - The modem power domain. The modem daemon power-cycles the modem when it starts, so the MD1 domain needed the vendor’s exact sequence: external buck isolation, reset before power-on, and bus protection on three registers.
- The modem boots and then crashes. With that in place, the modem reached READY in about 3.5 s, the radio turned on and the SIM read as ready. Then, 2 to 4 seconds after radio-on, the modem firmware asserted in
digrf_mipi.c, its link to the RF transceiver.
I ruled out the RF configuration set, pin modes, GPIOs, DVFS levels, PLLs and clock buffers. The cause was the MT6330 PMIC. Ten of the stock system’s sixty RF and modem power-control registers differed: the bits that hand control of the RF and modem supplies to the modem’s own SRCLKEN signals were zero. LK doesn’t set them; the stock kernel’s PMIC init does. Fixing it needed two pieces:
- SPMI access on 6.12. Mainline
spmi-mtk-pmifworks with the MT8195 compatible, because the PMIF register table is identical to the vendor’s MT6880 one. - A small driver,
m2-mt6330-lp.c, that sets the stock values. I read them from the running stock router one register at a time.
The result: no assert, the modem registered on the network in 11 seconds, a data call opened ccmni1, and ping 1.1.1.1 went out over 5G from Linux 6.12.
IPv6 needed one more change. The vendor’s ccmni network devices identify themselves with Android’s ARPHRD_PUREIP (520), which mainline’s address configuration doesn’t know: it set up no link-local address and processed no router advertisements. Declaring them ARPHRD_RAWIP (519) fixed it. The carrier’s router advertisement on the point-to-point link gives a /64 but no default router, so the protocol script adds the IPv6 default route itself.
Wi-Fi: the easy part, mostly
The MT7915 is supported in mainline by mt76, using the same kind of firmware blobs as the vendor driver. Getting there still took a few fixes:
- PCIe: the PEXTP power domains (three MAC domains with SRAM bits, four PHY domains), and
device_type = "pci"on the host nodes. Without that the memory window is parsed as an error and the cards’ BARs stay unassigned. The PCIe PHYs also waited forever for an efuse calibration cell, until the efuse node was bound to a driver. - Calibration: each radio’s EEPROM (RF calibration) lives in the
nvcfgpartition, not on the chip. A kernel patch loadsmeteor2-eeprom-<pci-domain>.binper card, from read-only RAM copies. Both EEPROMs leave the band-select field unset, so mainline thought both radios were dual-band and OpenWrt put both on 5 GHz. The loader now sets 5 GHz forpcie0and 2.4 GHz forpcie1. - Regulatory: the kernel only accepts a signed
regulatory.db. OpenWrt’s package builds an unsigned one, so the country stayed00and 5 GHz was “no initiate radiation” (“Frequency 5180 not allowed for AP mode”). Shipping the official signed database fixed it. There was also a timing issue: cfg80211 tried to load the database at 1.96 s, before the switch to the real root filesystem, and never retried, so the image now runsiw reg reloadearly in boot.
Measured on the 5 GHz radio: HE80 gives 4×4 with about 1,134 Mbit/s TX and 1,020 Mbit/s RX and zero TX failures. HE160 drops the MT7915 to 2×2 (chains 2 and 3 off) with 40× more TX failures, so the image uses 80 MHz.
Everything else a router needs
- Thermal protection. I ported the vendor LVTS driver: 12 zones, critical at 115 °C, hardware reset armed at 117 °C. Its calibration lives in efuses that read as zeros from Linux, but LK passes their contents in
/chosen/atag,devinfo, so I ported the vendormtk-devinfonvmem driver as well. The board NTCs and the 5G power-amplifier coolers go over CCCI. At 82 °C on the PA sensor the modem’s TX duty cycle is limited step by step, and at 90 °C mobile data turns off. I tested it by forcing the cooling state by hand: the modem accepted it, and ping went from 30 to 104 ms while throttled. - Randomness. The kernel’s random number generator was only ready about 28 seconds into boot. An early blocking request from
dropbearkeyorubusdfroze the board. The stock firmware gets entropy from an ATF SMC call (MTK_SIP_KERNEL_GET_RND); porting that hwrng driver broughtcrng init donedown to 0.6 s. - LEDs and buttons. Ten
gpio-ledsand threegpio-keys, wired as in the stock DT, with signal-strength LEDs driven from AT commands. - MAC addresses. The router’s own MACs come from
nvcfg.mtk_ethrefuses to change the address while the interface is up, so the interface is taken down, changed and brought back up.
OpenWrt 25.12 on top
With the kernel working under a bring-up initramfs, getting real OpenWrt to start from slot A surfaced a final set of problems:
init=/etc/preinitis required. OpenWrt kernels start/etc/preinitthrough a downstream patch; mainline starts/sbin/init.- Read-only semantics changed between kernels. For safety, the system marks every partition it doesn’t need read-only. On 4.19, a read-only whole disk left its partitions independent. On 6.12, a read-only whole disk makes every partition read-only, so OpenWrt’s overlay went read-only seconds after mounting. Now the disk holding the system stays writable as a device and every other partition is locked individually.
- Restarting the DSA conduit killed LAN transmit. Whenever
eth1was stopped and started (which netifd does), QDMA queue 5 never completed again. On MT6890 the conduit, once up, now only stops and starts its queues; the link and SerDes stay up. - A stale object file. The 3-second watchdog from my bring-up debug markers ended up in a production kernel.
rsync -ahad restored pristine files with their old timestamps, somakereused objects compiled from patched code. Now it’srsync -rlD --checksum. - OpenWrt 25.12’s generated wireless config enables both radios as an open network named “OpenWrt”. That’s fine on a dev board, not on a 5G router. The image now ships with Wi-Fi off until you configure it.
Debugging these without a serial console relied on a per-second boot log that the boot guard writes into the last MiB of rootfs_a (with fsync on every write), plus the ramoops trick from earlier.
Hardening and tuning
The final kernel (owrt14) and image (612-19) add:
- Hardening:
FORTIFY_SOURCE,INIT_ON_ALLOC_DEFAULT_ON,ZERO_CALL_USED_REGS,MODULE_SIG_FORCE(the threemt76modules are signed at build time), no/dev/mem,/dev/port, debugfs or kexec,dmesg_restrict=1,vm.mmap_rnd_bits=24, and procd’s ujail and seccomp, which the 4.19 kernel couldn’t do at all. - Firewall and offload:
firewall4on nftables with software flow offload. - Bufferbloat:
CAKE(diffserv4 dual-srchost nat ack-filter) on the 5G interface,fq_codelas the default qdisc, BBR and 4 MiB socket buffers. - CPU balancing: the 5G data-path IRQs pinned to CPU 1, and receive packet steering spread across CPUs 2 and 3.
- Built in: WireGuard with NEON ChaCha20/Poly1305, and 802.1Q VLANs.
- Clean logs: getting to
tainted=0withFORTIFY_SOURCEon meant converting the vendor’s legacy[0]trailing arrays to C99 flexible arrays. The modem poller’s idle sleep moved tomsleep_interruptibleso the load average reads correctly (~0.1 at idle). Noisy vendor log lines were demoted to debug.
What I dropped on purpose: CPU frequency scaling and CPU idle (the SoC stays at 36 to 42 °C, and the vendor SPM/MCUPM paths add hang risk for a watt or two), and mtk_ppe hardware offload (it doesn’t accelerate the 5G interface).
Where it stands
From the first 6.12 hardware trial (2 December, 23:26) to Ethernet, 5G, Wi-Fi and thermal protection took about 118 trial boots over roughly a day and a half. Getting clean OpenWrt on top, hardened and committed to slot A, took about one more day. Slot B still holds the 4.19-based image as an untouched fallback.
What’s still not mine: the bootloaders, power-management firmware, modem firmware and Wi-Fi firmware, which are closed with no source anywhere. I also still run six vendor modem daemons and ten libraries from the router’s own firmware, read-only and isolated. Their 2021 source is in the SDK, and rebuilding them is the next step.
Open items:
- the 2.5G line rate is untested (I have no 2.5G peer);
- the RESET button hasn’t been pressed yet;
- a DPMAIF “null skb” event on the 5G receive path, seen once and not since.
The repository has:
- the build pipeline (Docker, from a pristine 6.12.118 tarball);
- the slot-trial flashing scripts;
- the full trial-by-trial log (
KERNEL_PORT.md); - a release with the prebuilt kernel, DTB and Wi-Fi modules, 100% GPL-2.0, with no vendor binaries.
The rootfs images copy vendor modem programs from your own router’s firmware, so they’re built locally and never redistributed.
If you try it, read FINDINGS.md first. Without a proven USB recovery, the A/B slot trial is the only safety net you have, and it only protects you if you never touch the partitions it can’t restore.