Mikrotik RouterOS v7.x and OpenWrt sysupgrade

Not a problem, I have a complete flash dumb I can rewrite to the device :slight_smile:

I can do tests on monday, will get back to you.

@johnth

I applied your commit but nothing happens.

Can it be that the target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata part needs some modifications for this to work?

root@cpe00005:~# ls /lib/firmware/ath10k/QCA4019/hw1.0/
firmware-5.bin

No cal nor board files are present after boot where they should be.

Relevant part of dmesg:

[    0.958302] MikroTik RouterBOARD hardware configuration sysfs driver v0.08
[    0.961324] MikroTik RouterBOARD software configuration sysfs driver v0.05
.....
[   18.456292] ath10k_ahb a000000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[   18.456366] ath10k_ahb a000000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   18.468302] ath10k_ahb a000000.wifi: firmware ver 10.4b-ct-4019-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 6b2b5c5b
[   18.906493] ath10k_ahb a000000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0
[   18.906578] ath10k_ahb a000000.wifi: failed to fetch board file: -12
[   18.915032] ath10k_ahb a000000.wifi: could not probe fw (-12)
[   19.918950] ath10k_ahb a800000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[   19.919046] ath10k_ahb a800000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   19.932464] ath10k_ahb a800000.wifi: firmware ver 10.4b-ct-4019-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 6b2b5c5b
[   20.360707] ath10k_ahb a800000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0
[   20.360799] ath10k_ahb a800000.wifi: failed to fetch board file: -12
[   20.369294] ath10k_ahb a800000.wifi: could not probe fw (-12)

Will need to either build with CONFIG_DYNAMIC_DEBUG, then enable dynamic debug for rb_hardconfig.c then rmmod ath10k_pci; modprobe ath10k_pci, or change the newly added pr_debug calls under hc_wlan_data_unpack_lz77 to pr_info so we can get some more details.

I can push a commit that is more verbose by default for now.

--

Edit: Think this is because I am passing the DRE\x00 magic to tag_find. Will push that

1 Like

It works! Both radios are up and running, the WLAN MACs are also correct, the wireless driver is loading without any complaints. FYI, this is also a device on Routerboot_v7, image is with your patch applied:

ipq40xx: MikroTik RouterBOOT v7 NOR specific changes to generate compatbile images, adapted to ARM traget.

Do you still need the debug logs you described? Or anything else that might help? Let me know.

Great, thank you. We only got to this stage because you provided the mtd dump for hard tags.

Not any more. They would be nice to have, to double check that things are working as expected, but not needed.
If we also debug the lz77 decompress file, I think we would run out of dmesg space, so would need to change kernel config CONFIG_LOG_BUF_SHIFT, or kernel param log_buf_len=n (bytes, must equal a power of 2).

Cheers

Can we do anything else? I tested it on multiple Chateau 12 devices they all work. If you need anything further, please let us know.

thank you @johnth

booting still work on today snapshot
patch applied without problem
ruterboot v7.11.2
HaP AC2

edit: on ubuntu 22.04 i need to install sudo apt install python3-venv for compile to work

Hi, facing the same issue. Bought the hap ac3 to find out that I have routeros v7 sth. on there and I cannot downgrade to v6. But I was able to start Openwrt initramfs image via net boot.

So I want to ask, is this still an issue, or is a fix already in the latest openwrt since the netboot seemed to work?
If not @johnth I guess this comment is from you? https://github.com/openwrt/openwrt/issues/13166#issuecomment-1655484707

If yes, what would be the easiest way? :sweat_smile:

  • build a v7 compatible sysupgrade image based on an external work-in-progress tree

I don't think I can do this.
And this

  • downgrade primary RouterBOOT to a v6 through RouterOS

didn't work, at least not via the described method here: https://openwrt.org/toh/mikrotik/common#downgrading_routeros

Edit: Alright, forcing to use backup booter is easy but I cannot find the verison of the bootloader. Only from firmware, which still is 7.sth. Do you know flashing openwrt using backup booter works or do you just assume it has a lower version?

I also have a noobish problem. I set up the OpenWRT v23.05.0-rc4 build system but I am having trouble with acquiring easy-to-use diff files from john-tho's GitHub repository to be applied to my local source tree clone. What's the easiest way of doing so?

Hi

git clone --branch v23.05.0 https://github.com/openwrt/openwrt.git
cd openwrt
wget https://patch-diff.githubusercontent.com/raw/john-tho/openwrt/pull/7.diff
patch -p1 < 7.diff 

it will fail at only one place

patching file include/image-commands.mk
patching file target/linux/ath79/image/common-mikrotik.mk
patching file target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c
patching file target/linux/ipq40xx/image/mikrotik.mk
patching file target/linux/ramips/image/mt7621.mk
Hunk #1 succeeded at 1543 (offset -2 lines).
patching file tools/Makefile
Hunk #1 FAILED at 84.
1 out of 1 hunk FAILED -- saving rejects to file tools/Makefile.rej
patching file tools/kernel2minor/patches/001-bootimage-path-option.patch
patching file tools/npkpy/Makefile

so you need to edit manually
nano tools/Makefile
and add line
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += npkpy
after line
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf

rest is almost standard
install required build tools
in addition install sudo apt install python3-venv
and you ready to compile 23.05.0

Thank you! Also thanks for the info in PM that kernel and library stripping options should be unchecked for the images to work.

1 Like

Hi all
would the approach alsowork for other mikrotik devices as well?
I am successfully running v23.05.0 custom build on hAP ac lite RB952UI-5AC2ND , originally with Routeros6.x , however I need another unit which might have already OS7...

Any news on this? I'm having headaches porting my openwrt config to my new hap ac3 with routeros 7.2.3...
I'd really like to just flash openwrt and copy paste..but I cannot build the firmware by myself.
Any date when a flashable openwrt firmware will be available for hap ac3 with routeros 7.2.3?

Is it possible to downgrade to v6 using netinstall?

If an OpenWRT-compatible ROS v6.x version supports your hardware and you are on ROS then you don't need Netinstall: just copy the ROS v6 npk to the device with Winbox (or by other means) and click "Downgrade" in the package manager, reboot and then upgrade RouterBOOT (this also works as downgrade). If you are on OWRT then you need Netinstall to return to ROS in order to manipulate RouterBOOT with ROS.

Are these patches going to be merged into master? With new Mikrotik devices shipping with v7 and many not supporting a downgrade, it seems OpenWrt will need it to continue supporting Mikrotik hardware.

1 Like