MediaTek Filogic 830 是MTK用于家庭Wifi6路由的SOC。 其cpu为Arm Cortex-A53 64位。其中MT7981是双核,MT7986是4核。
目前Openwrt已经支持MT7981了,市面上有很多这个方案的路由器,我手上的是小米的WR30U。
本文将最新的long term内核6.6导入到MT7981。
下载最新的6.6.32内核,从清华镜像站下载,速度快的惊人:
https://mirrors.tuna.tsinghua.edu.cn/kernel/v6.x/linux-6.6.32.tar.xz
使用crosstool-ng 1.26.0编译一个arm64 toolchain。也可以从网上下载一个aarch64的toolchain。
没有使用defconfig,是因为我们想从空白开始开启所有的配置。所以从tiny config开始。
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make tinyconfig
使用openwrt提供的device tree:
target/linux/mediatek/
dts/mt7981b-xiaomi-mi-router-common.dtsi
dts/mt7981b-xiaomi-mi-router-wr30u.dtsi
dts/mt7981b-xiaomi-mi-router-wr30u-stock.dts
files-6.6/arch/arm64/boot/dts/mediatek/mt7981.dtsi
编译方法,见参考[3]
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make Image.lzma
主机安装mkimage程序(属于uboot-tools)
$ mkimage -f fit.its wr30u.itb
fit.its内容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | /dts-v1/; / { description = "ARM64 Xrouter FIT (Flattened Image Tree)"; #address-cells = <1>; images { kernel-1 { description = "ARM64 Linux Kernel"; data = /incbin/("Image.lzma"); type = "kernel"; arch = "arm64"; os = "linux"; compression = "none"; load = <0x48000000>; entry = <0x48000000>; hash-1 { algo = "crc32"; }; hash-2 { algo = "sha1"; }; }; fdt-1 { description = "ARM64 device tree blob"; data = /incbin/("wr30u.dtb"); type = "flat_dt"; arch = "arm64"; compression = "none"; hash-1 { algo = "crc32"; }; hash-2 { algo = "sha1"; }; }; }; configurations { default = "config-1"; config-1 { description = "Xrouter wr30u"; kernel = "kernel-1"; fdt = "fdt-1"; }; }; }; |
进入mt7981设备
$ tftpboot wr30u.itb
$ bootm
很遗憾,崩溃了,
RB07> bootm
## Loading kernel from FIT Image at 46000000 ...
Using 'config-1' configuration
Trying 'kernel-1' kernel subimage
Description: ARM64 Linux Kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x460000e0
Data Size: 563335 Bytes = 550.1 KiB
Architecture: AArch64
OS: Linux
Load Address: 0x48000000
Entry Point: 0x48000000
Hash algo: crc32
Hash value: 5ebc019b
Hash algo: sha1
Hash value: 851e60e3fa8a487dff96a0db7b32a2a6944a3e1d
Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 46000000 ...
Using 'config-1' configuration
Trying 'fdt-1' fdt subimage
Description: ARM64 device tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x46089a90
Data Size: 18154 Bytes = 17.7 KiB
Architecture: AArch64
Hash algo: crc32
Hash value: 9e5d355c
Hash algo: sha1
Hash value: 75cf6b16d5f4106ffde6420a968409472c6e3a02
Verifying Hash Integrity ... crc32+ sha1+ OK
Booting using the fdt blob at 0x46089a90
Loading Kernel Image
Loading Device Tree to 000000004f7f3000, end 000000004f7fa6e9 ... OK
Starting kernel ...
"Synchronous Abort" handler, esr 0x02000000
elr: 0000000039ec4000 lr : 0000000041e02868 (reloc)
elr: 0000000048000000 lr : 000000004ff3e868
x0 : 000000004f7f3000 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000048000000 x5 : 0000000000000001
x6 : 0000000000000008 x7 : 0000000000000000
x8 : 0000000048000000 x9 : 0000000000000002
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 000000004f7f7fff
x14: 000000004f7ff0f8 x15: 000000004ff3d798
x16: 0000000048000000 x17: 000019115217de91
x18: 000000004f7ffdb0 x19: 000000004ffe40c8
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000000 x23: 000000004f7ff410
x24: 0000000000000000 x25: 000000004f7ff410
x26: 000000004ffcd290 x27: 0000000000000000
x28: 00000000460000e0 x29: 000000004f7ff1f0
Code: 49840010 600a4908 14501415 002b0122 (0000005d)
Resetting CPU ...
resetting ...
未完待续 。。。 part 2 https://linuxdev.cc/article/a0gv7l.html
[1] MT7981B Wi-Fi 6 Generation Router Platform: Datasheet
https://mirror2.openwrt.org/docs/MT7981B_Wi-Fi6_Platform_Datasheet_Open_V1.0.pdf
[2] kernel tinyconfig
https://linuxdev.cc/article/a0gq98.html
[3] how kernel build device tree