y52 Posted 4 hours ago Posted 4 hours ago (edited) Hello everybody, I tried building an in-kernel module for USB Dongle Bus 001 Device 003: ID 2357:0120 TP-Link Archer T2U PLUS [RTL8821AU] on my OrangePi Plus. Armbian supplied module from aircrack-ng/rtl8812au has become aging and raises exception errors on modprobe -r. It was deactivated : root@orangepiplus:/etc/modprobe.d# vi blacklist-88XXau.conf #blacklist 88XXau I made a fresh install of Armbian minimal image, then switched to : root@orangepiplus:~# uname -a Linux orangepiplus 6.15.4-edge-sunxi #1 SMP Fri Jun 27 10:13:43 UTC 2025 armv7l GNU/Linux root@orangepiplus:/usr/src# cat /proc/version Linux version 6.15.4-edge-sunxi (build@armbian) (arm-linux-gnueabihf-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #1 SMP Fri Jun 27 10:13:43 UTC 2025 root@orangepiplus:/usr/src# zcat /proc/config.gz | grep CC_VERSION CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" CONFIG_GCC_VERSION=130300 root@orangepiplus:/usr/src# zcat /proc/config.gz | grep STACKPROTECTOR CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y CONFIG_STACKPROTECTOR_PER_TASK=y CONFIG_HAVE_STACKPROTECTOR=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y Headers were downloaded with armbian-config : root@orangepiplus:/mnt/sda2/src/linux-6.15.4# drwxr-xr-x 25 root root 4096 Aug 21 21:40 linux-headers-6.15.4-edge-sunxi Then performed usual build process: root@orangepiplus:/usr/src# sudo git clone --depth 1 --branch linux-6.15.y https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git root@orangepiplus:/usr/src# sudo ln -s /usr/src/linux /lib/modules/$(uname -r)/build root@orangepiplus:/usr/src# ls -al /lib/modules/$(uname -r)/build lrwxrwxrwx 1 root root 14 Aug 21 22:45 /lib/modules/6.15.4-edge-sunxi/build -> /usr/src/linux cp /boot/config-$(uname -r) /usr/src/linux/.config sudo make olddefconfig sudo make menuconfig Module activated in the following tree : │ Symbol: RTW88 [=m] │ │ Type : tristate │ │ Defined at drivers/net/wireless/realtek/rtw88/Kconfig:2 │ │ Prompt: Realtek 802.11ac wireless chips support │ │ Depends on: NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_REALTEK [=y] && MAC80211 [=m] │ │ Location: │ │ -> Device Drivers │ │ -> Network device support (NETDEVICES [=y]) │ │ -> Wireless LAN (WLAN [=y]) │ │ -> Realtek devices (WLAN_VENDOR_REALTEK [=y]) │ │ (1) -> Realtek 802.11ac wireless chips support (RTW88 [=m]) root@orangepiplus:/usr/src/linux# grep -E 'CONFIG_RTW88_CORE|CONFIG_RTLWIFI|CONFIG_RTW88_8821AU' .config CONFIG_RTLWIFI=m CONFIG_RTLWIFI_USB=m # CONFIG_RTLWIFI_DEBUG is not set CONFIG_RTW88_CORE=m CONFIG_RTW88_8821AU=m cp /usr/src/linux-headers-6.15.4-edge-sunxi/Module.symvers /usr/src/linux/ Then compiled with: root@orangepiplus:/usr/src/linux# sudo make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- M=drivers/net/wireless/realtek/rtw88 make[1]: Entering directory '/usr/src/linux/drivers/net/wireless/realtek/rtw88' MODPOST Module.symvers CC [M] rtw88_core.mod.o CC [M] .module-common.o CC [M] rtw88_8822b.mod.o CC [M] rtw88_8822bs.mod.o CC [M] rtw88_8822bu.mod.o CC [M] rtw88_8822c.mod.o CC [M] rtw88_8822cs.mod.o ... LD [M] rtw88_core.ko LD [M] rtw88_8822b.ko LD [M] rtw88_8822bs.ko LD [M] rtw88_8822bu.ko LD [M] rtw88_8822c.ko LD [M] rtw88_8822cs.ko LD [M] rtw88_8822cu.ko LD [M] rtw88_8723x.ko LD [M] rtw88_8723d.ko LD [M] rtw88_8723ds.ko LD [M] rtw88_8723du.ko LD [M] rtw88_8821c.ko LD [M] rtw88_8821cs.ko LD [M] rtw88_8821cu.ko LD [M] rtw88_88xxa.ko LD [M] rtw88_8821a.ko LD [M] rtw88_8821au.ko LD [M] rtw88_sdio.ko LD [M] rtw88_usb.ko make[1]: Leaving directory '/usr/src/linux/drivers/net/wireless/realtek/rtw88' root@orangepiplus:/usr/src/linux# modinfo /usr/src/linux/drivers/net/wireless/realtek/rtw88/rtw88_8821au.ko filename: /usr/src/linux/drivers/net/wireless/realtek/rtw88/rtw88_8821au.ko license: Dual BSD/GPL description: Realtek 802.11ac wireless 8821au/8811au driver author: Bitterblue Smith <rtl8821cerfe2@gmail.com> ... alias: usb:v0BDAp0811d*dc*dsc*dp*icFFiscFFipFFin* depends: rtw88_usb,rtw88_8821a name: rtw88_8821au vermagic: 6.15.11 SMP mod_unload ARMv7 thumb2 p2v8 sudo make modules_install ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- doesn't work. Needs fixing. So I just copied modules to system location : root@orangepiplus:/usr/src/linux# sudo cp /usr/src/linux/drivers/net/wireless/realtek/rtw88/*.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtw88/ root@orangepiplus:/usr/src/linux# sudo depmod -a But loading failed as follows : root@orangepiplus:/usr/src/linux# sudo modprobe rtw88_8821au modprobe: ERROR: could not insert 'rtw88_8821au': Exec format error Aug 22 16:31:52 orangepiplus kernel: module rtw88_88xxa: .gnu.linkonce.this_module section size must match the kernel's built struct module size at run time It appears to be a structural issue, as I also tried building out-of-kernel module from lwfinger/rtw88 I also tried building on Nanopi-r5s. Each time Exec format error was observed despite the module was successfully built. Different analysis point to GCC version mismatch between kernel and build host, ABI incompatibility and subtle build failures, thus causing non-alignment with the kernel buid. Several other build flags were tried to align with the kernel, but in vain. The root cause was not found. I am running out of options now. Could community or development team point to correct approach building an in-kernel module on a running system in native environment ? PS : complementary information : when armbian headers were downloaded with armbian-config, the following build output was observed : /usr/lib/gcc/arm-linux-gnueabihf/12/cc1 -quiet -I ./scripts/include -I ./scripts/dtc/libfdt -imultilib . -imultiarch arm-linux-gnueabihf -D _LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 -D NO_YAML -MMD scripts/dtc/.dtc.o.d scripts/dtc/dtc.c -quiet -dumpdir scripts/dtc/ -dumpbase dtc.c -dumpbase-ext .c -mfloat-abi=hard -mtls-dialect=gnu -mthumb -mlibarch=armv7-a+fp -march=armv7-a+fp -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -std=gnu11 -fomit-frame-pointer -o /tmp/ccY6Z3QK.s It may give some clues on the flags used. Edited 4 hours ago by y52 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.