Hi everyone,
I’m running a Xiaomi Mi Router 3G (R3G) with recent OpenWrt releases and I’m seeing a persistent issue after every sysupgrade.
Problem
After a successful sysupgrade, the router boots with a kernel that does not match the upgraded rootfs. The system comes up, but kernel modules are unavailable because the running kernel and rootfs are from different versions.
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "Bootloader"
mtd1: 00040000 00020000 "Config"
mtd2: 00040000 00020000 "Bdata"
mtd3: 00040000 00020000 "factory"
mtd4: 00040000 00020000 "crash"
mtd5: 00040000 00020000 "crash_syslog"
mtd6: 00040000 00020000 "reserved0"
mtd7: 00400000 00020000 "kernel_stock"
mtd8: 00400000 00020000 "kernel"
mtd9: 07580000 00020000 "ubi"
How I fix it
Immediately after sysupgrade, if I copy kernel to kernel_stock, everything works correctly:
dd if=/dev/mtd8 of=/tmp/kernel.mtd8
mtd write /tmp/kernel.mtd8 /dev/mtd7
I would like to have it fixed permanently.
Is there a known Xiaomi dual-boot flag or bootloader variable that selects between these partitions?
Any guidance on identifying the active boot slot or fixing this permanently would be appreciated.