安装交叉编译环境见:ubuntu下交叉编译arm64/armbian内核模块。
下载5.3内核及wireguard最新源码,并打补丁到内核。
#git clone -b 5.3 --depth 1 https://github.com/150balbes/Amlogic_s905-kernel.git
git clone -b 5.3 --depth 1 https://github.com/w22gb8/Amlogic_s905-kernel.git
cd Amlogic_s905-kernel/
#git clone https://git.zx2c4.com/wireguard-linux-compat
git clone -b v1.0.20211208 --depth=1 https://github.com/WireGuard/wireguard-linux-compat.git
bash ./wireguard-linux-compat/kernel-tree-scripts/jury-rig.sh .
编译wireguard模块,版本后缀-aml-g12和内核后缀保持一致。
cp ../config-5.3.0-aml-g12 .config
make LOCALVERSION="-aml-g12" modules_prepare
make M=net/wireguard CONFIG_WIREGUARD=m modules
modinfo net/wireguard/wireguard.ko
替换升级wireguard内核模块:
systemctl stop wg-quick@wg0.service
cp wireguard.ko /lib/modules/5.3.0-aml-g12/kernel/net/wireguard/
modprobe -r wireguard
systemctl start wg-quick@wg0.service