Mikrotik RouterOS v7.x and OpenWrt sysupgrade

None of the above sounds difficult, I just need the initramfs for the netboot thanks.

Sent a PM.

I have one MikroTik RBD53iG-5HacD2HnD with factory RouterOS v7 laying around :slight_smile:
So I can dump you this one, if you can give me instruction/scripts ...

That router is not interesting, as it is already supported.

I know it's already supported, but it should be running RouterOS v6 when flashing.
But this one has v7 from the factory, so I'm unable to downgrade it to v6 to be able to netboot and flash it :frowning:

1 Like

The two issues are different in nature. The pure ROS7 boot and sysupgrade is already fixed by @johnth , its just not pulled in to openwrt master yet. Once thats done, we can extend device support so v7 compatible images can be build. For this we dont need more device dumps.

What we need is dumps from devices that has the new LZ77 encoded wifi bdf/cal-data. Your device is not like that.

1 Like


Here is the hard_config dump of another Chateau_12: link

I see that there are no changes for ath79 target here - do you think that copying image recipe from either ipq40xx or ramips should work? I'll be happy to test that.

Thank you. My dirty python decoder worked as expected on that file, it was different to the first, and matched the emulated uncompressed file, so the block format I found stands for now.

For NOR targets, yes, it is worth testing, will need to make it match the mikrotik nor recipe in common-mikrotik. I have not looked at ath79 NAND (not planning to).
I initially avoided it for the big endian. I remember seeing some data endian converted by RouterBOOT on MIPSBE, but I don't remember what… Hopefully they do the same for the NPK.
I can test this later as well, but feel free to try.


Ok, I'll try that soon (hopefully).

As for NAND, it seems, that RouterBOOT v7 can actually boot current image format as is. So there is nothing much left to do with that regard, maybe save for inventing a better method, than generating dummy yaffs section for kernel, which was the reason for disabling NAND devices in the first place.

Hi @johnth

This is great news.

There are two questions in my mind:

  1. Can you please create a pull request for the "routerboot-v7" branch of yours, so it can get to Openwrt and we can start adding device support based on that? I am testing it on two devices already and it works, so we can add "tested by" tags right away.

  2. On the LZ77 part: I assume the platform driver cannot really use a python script, so I wonder whats next? There are two devices which are ready for Openwrt, only this part is missing for them to be fully functional.

I got a chance to test this, and my ath79 wapg with RouterBOOT 6.45.8 boot the bootimage NPK file-container kernel fine. I don't know how far back RouterBOOT started to be able to load bootimage NPK file-container kernel, but the backup booter 3.41 worked here as well.

RouterBOOT backup booter 3.41

RouterBOARD wAP G-5HacT2HnD

CPU frequency: 720 MHz
 Memory speed: 300 MHz
  Memory size:  64 MiB
 Storage size:  16 MiB

Press any key within 2 seconds to enter setup..

loading kernel... OK
setting up elf image... OK
jumping to kernel code
[    0.000000] Linux version 5.15.98 (john@john) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 12.2.0 r21569+48-9b6dd57a33) 12.2.0, GNU ld (GNU Binutils) 2.40.0) #0 Sat Mar 18 06:54:53 2023
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] MIPS: machine is MikroTik RouterBOARD wAP G-5HacT2HnD
[    0.000000] SoC: Qualcomm Atheros QCA9556 ver 1 rev 0
[    0.000000] Initrd not found or empty - disabling initrd
root@OpenWrt:~# hexdump -C -n 64 /dev/mtd$(find_mtd_index kernel)
00000000  00 00 00 01 00 00 00 01  ff ff 62 6f 6f 74 69 6d  |..........bootim|
00000010  61 67 65 00 00 00 00 00  00 00 00 00 00 00 00 00  |age.............|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

urgh, no way around this if we want to directly boot kernel from RouterBOOT. ipq40xx NAND (UBI) are the only Mikrotik devices I have seen which do not use YAFFS.

Both of these are proof-of-concept rather than a clean tool.

Maybe you could convince a maintainer that you need this whole python framework to build the NPK, but ideally someone creates a new tool to do it. If you wanted to use this as-is, you would need to get python3-venv added to the buildbots for it, but first tests should be added for the additional functionality I tacked onto the framework, and that sent upstream for code review.

Someone extends rb_hardconfig hc_wlan_data_unpack with the logic to decompress the Mikrotik LZ77 block format.

Anyone is welcome to try either or both of these things…

1 Like

Hi @johnth

To be honest, I thought that at least the general routerboot-v7 parts can be just pulled in. I did that on my branch with the Chateau 12 and Hap ac3 and it just worked without any issues or hacking. I did not realized that is also proof of concept, like the LZ77 part.

On the LZ77 part, I do hope that you or someone more capable than me might pick this up and make the platform driver extension. There are some devices already which only needs this to be fully functional on Openwrt, like the Chateau 12LTE or the Chateau 5G.

whats the root password, it boots up on but it's asking for a root password