generic: platform/mikrotik: add wlan lz77 decompress
authorJohn Thomson <git@johnthomson.fastmail.com.au>
Thu, 30 May 2024 05:57:00 +0000 (15:57 +1000)
committerRobert Marko <robimarko@gmail.com>
Tue, 8 Oct 2024 08:45:58 +0000 (10:45 +0200)
commit7d33aedd10bab0d8023d608f6f900b2915c69456
treef53d5f3d2987702ef7e1e462307ed5006687d610
parent170ecbecfc73a9c8f6be9cb9ee67d6e5dbe3f402
generic: platform/mikrotik: add wlan lz77 decompress

A number of new (or with recently updated caldata)
Mikrotik devices are using LZ77 magic for wlan tag hard_config data.
New devices include the Chateau LTE12 [1], and ax devices [2]
Newly factory flashed devices may include the hap ac3 [3]

This can be seen in decoded OEM supout [4] dmesg:
"radio data lz77 decompressed from"…

Investigating an arm RouterOS flash.ko module, and supplied example
hard_config dumps, the format was guessed via decompilation and live
debugging [5]. This decoder was then built from the guessed format
specification.

debug prints can be enabled in a DYNAMIC_DEBUG kernel build via the
kernel cmdline:

        chosen {
-               bootargs = "console=ttyS0,115200";
+               bootargs = "console=ttyS0,115200 dyndbg=\"file drivers/platform/mikrotik/* +p\"";
        };

[1]: https://forum.openwrt.org/t/no-wireless-mikrotik-rbd53ig-5hacd2hnd/157763/4
[2]: https://forum.openwrt.org/t/mikrotik-routeros-v7-x-and-openwrt-sysupgrade/148072/17
[3]: https://forum.openwrt.org/t/adding-support-for-mikrotik-hap-ax2/133715/47
[4]: https://github.com/farseeker/go-mikrotik-rif
[5]: https://github.com/john-tho/routeros-wlan-lz77-decode

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Link: https://github.com/openwrt/openwrt/pull/15774
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ath79/mikrotik/config-default
target/linux/generic/files/drivers/platform/mikrotik/Kconfig
target/linux/generic/files/drivers/platform/mikrotik/Makefile
target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c
target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.c [new file with mode: 0644]
target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.h [new file with mode: 0644]
target/linux/generic/files/drivers/platform/mikrotik/routerboot.h
target/linux/ipq40xx/mikrotik/config-default
target/linux/mvebu/cortexa72/config-6.6
target/linux/ramips/mt7621/config-6.6