Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling kernel (6.1.26) fails #37

Closed
GiyoMoon opened this issue Apr 27, 2023 · 63 comments
Closed

Compiling kernel (6.1.26) fails #37

GiyoMoon opened this issue Apr 27, 2023 · 63 comments

Comments

@GiyoMoon
Copy link

Hey, I'm trying to include this driver in my kernel configuration and I'm failing to get it to compile properly. I appreciate any help! <3

Environment

Kernel version I am trying to build: 6.1.26
Target arch: arm64
Host OS: Debian GNU/Linux 11 (bullseye)

Kernel setup

  1. Cloned the 6.1.26 kernel:
    git clone --depth 1 --branch linux-6.1.y https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  2. Cloned this repository into the wireless realtek folder:
    git clone --depth 1 https://github.com/lwfinger/rtl8723ds drivers/net/wireless/realtek/rtl8723ds
  3. Modified drivers/net/wireless/realtek/rtl8723ds/Kconfig and deleted the hypens around --help--
  4. Edited the drivers/net/wireless/realtek/Kconfig file and inserted source "drivers/net/wireless/realtek/rtl8723ds/Kconfig"
  5. Edited the drivers/net/wireless/realtek/Makefile file and inserted obj-$(CONFIG_RTL8723DS) += rtl8723ds/

Kernel config

I used the default config with make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig and added CONFIG_RTL8723DS=y to include this driver.

Compiling

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image

This resulted in the following error:

aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-gnu-ld: ID map text too big or misaligned
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/core/rtw_p2p.o: in function `cancel_ro_ch_handler':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/core/rtw_p2p.c:3355: undefined reference to `cfg80211_remain_on_channel_expired'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/recv_linux.o: in function `rtw_handle_tkip_mic_err':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/recv_linux.c:569: undefined reference to `cfg80211_michael_mic_failure'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_connect_bss':
/root/project/linux_6.1/./include/net/cfg80211.h:7551: undefined reference to `cfg80211_connect_done'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_frequency_to_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5972: undefined reference to `ieee80211_freq_khz_to_channel'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_mgmt_tx_status':
/root/project/linux_6.1/./include/net/cfg80211.h:7976: undefined reference to `cfg80211_mgmt_tx_status_ext'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_frequency_to_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5972: undefined reference to `ieee80211_freq_khz_to_channel'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_rtw_remain_on_channel':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:5258: undefined reference to `cfg80211_ready_on_channel'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_get_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5995: undefined reference to `ieee80211_get_channel_khz'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_inform_bss_frame':
/root/project/linux_6.1/./include/net/cfg80211.h:6664: undefined reference to `cfg80211_inform_bss_frame_data'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_inform_bss':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:547: undefined reference to `cfg80211_put_bss'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_get_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5995: undefined reference to `ieee80211_get_channel_khz'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_check_bss':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:577: undefined reference to `cfg80211_get_bss'
aarch64-linux-gnu-ld: /root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:588: undefined reference to `cfg80211_put_bss'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_get_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5995: undefined reference to `ieee80211_get_channel_khz'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_ibss_indicate_connect':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:657: undefined reference to `cfg80211_ibss_joined'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `ieee80211_get_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5995: undefined reference to `ieee80211_get_channel_khz'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_indicate_connect':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:755: undefined reference to `cfg80211_roamed'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_indicate_disconnect':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:859: undefined reference to `cfg80211_disconnected'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_indicate_scan_done':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:1918: undefined reference to `cfg80211_scan_done'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_unlink_bss':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:1970: undefined reference to `cfg80211_get_bss'
aarch64-linux-gnu-ld: /root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:1982: undefined reference to `cfg80211_unlink_bss'
aarch64-linux-gnu-ld: /root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:1985: undefined reference to `cfg80211_put_bss'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_rtw_scan':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:2506: undefined reference to `cfg80211_scan_done'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_cfg80211_indicate_sta_assoc':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:3524: undefined reference to `cfg80211_new_sta'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_del_sta':
/root/project/linux_6.1/./include/net/cfg80211.h:7792: undefined reference to `cfg80211_del_sta_sinfo'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `cfg80211_rx_mgmt':
/root/project/linux_6.1/./include/net/cfg80211.h:7917: undefined reference to `cfg80211_rx_mgmt_ext'
aarch64-linux-gnu-ld: /root/project/linux_6.1/./include/net/cfg80211.h:7917: undefined reference to `cfg80211_rx_mgmt_ext'
aarch64-linux-gnu-ld: /root/project/linux_6.1/./include/net/cfg80211.h:7917: undefined reference to `cfg80211_rx_mgmt_ext'
aarch64-linux-gnu-ld: /root/project/linux_6.1/./include/net/cfg80211.h:7917: undefined reference to `cfg80211_rx_mgmt_ext'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `wiphy_new':
/root/project/linux_6.1/./include/net/cfg80211.h:5550: undefined reference to `wiphy_new_nm'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_wiphy_free':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:6938: undefined reference to `wiphy_free'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_wiphy_register':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:6952: undefined reference to `wiphy_register'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_wiphy_unregister':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:6967: undefined reference to `wiphy_unregister'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o: in function `rtw_wdev_unregister':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:7070: undefined reference to `cfg80211_disconnected'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `cfg80211_vendor_cmd_alloc_reply_skb':
/root/project/linux_6.1/./include/net/cfg80211.h:7179: undefined reference to `__cfg80211_alloc_reply_skb'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `rtw_cfgvendor_send_cmd_reply':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.c:214: undefined reference to `cfg80211_vendor_cmd_reply'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `cfg80211_vendor_event_alloc':
/root/project/linux_6.1/./include/net/cfg80211.h:7231: undefined reference to `__cfg80211_alloc_event_skb'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `cfg80211_vendor_event':
/root/project/linux_6.1/./include/net/cfg80211.h:7281: undefined reference to `__cfg80211_send_event_skb'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `cfg80211_vendor_cmd_alloc_reply_skb':
/root/project/linux_6.1/./include/net/cfg80211.h:7179: undefined reference to `__cfg80211_alloc_reply_skb'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `rtw_cfgvendor_send_cmd_reply':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.c:214: undefined reference to `cfg80211_vendor_cmd_reply'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `cfg80211_vendor_cmd_alloc_reply_skb':
/root/project/linux_6.1/./include/net/cfg80211.h:7179: undefined reference to `__cfg80211_alloc_reply_skb'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.o: in function `rtw_cfgvendor_get_feature_set_matrix':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/rtw_cfgvendor.c:359: undefined reference to `cfg80211_vendor_cmd_reply'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/wifi_regd.o: in function `ieee80211_get_channel':
/root/project/linux_6.1/./include/net/cfg80211.h:5995: undefined reference to `ieee80211_get_channel_khz'
aarch64-linux-gnu-ld: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/wifi_regd.o: in function `_rtw_regd_init_wiphy':
/root/project/linux_6.1/drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/wifi_regd.c:503: undefined reference to `wiphy_apply_custom_regulatory'
make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
make: *** [Makefile:1255: vmlinux] Error 2
@lwfinger
Copy link
Owner

Hey, I would recommend that you switch to the rtw88 repo (https://github.com/lwfinger/rtw88.git). It, as well as kernel 6.4 due out in about 2 months, support all of the 802.11ac chips - PCI, USB, and SDIO.

@GiyoMoon
Copy link
Author

@lwfinger That's awesome news! Thanks for the information, I will try if I can get Wifi working on my SoC with the rtw88 repository tomorrow. The build has been successful so far.

@GiyoMoon
Copy link
Author

GiyoMoon commented Apr 30, 2023

@lwfinger Hey again, I got it working with this repository by compiling it as a module and not make it built-in :)

About the rtw88 repository, is the RTL8723DS chip supported by it? I read in the readme that it's not :/

...only the RTW8723DS member of the Realtek Wifi 5 (802.11ac) chips is not supported with rtw88.

Thanks for your help!

@lwfinger
Copy link
Owner

You are right. I just asked the author of the other SDIO drivers why the 8723ds was not included. If someone is needed to test, would you be able to help?

Many wifi drivers, including all of the rtw88 and rtw89 families, must be built as modules. The usual problem is some namespace contamination with the same symbol being defined in multiple drivers.

@GiyoMoon
Copy link
Author

GiyoMoon commented Apr 30, 2023

Oh I see, thanks for the information.

Yes I could help with testing. I'm currently tinkering with a MangoPi MQ-Quad (https://mangopi.org/mqquad) which has the 8723ds chip on it. But I only started getting into kernel/driver stuff, so I might need some help setting things up etc.

@lwfinger
Copy link
Owner

Testing could be no more difficult than doing a 'git pull' from rtw88, building and trying, and then reporting the results including anything from the logs. If you can build modules, that will work.

@GiyoMoon
Copy link
Author

Alright I can do that :) Happy to help!

@lwfinger
Copy link
Owner

lwfinger commented May 4, 2023

I just pushed the 8723ds code. Do a 'git pull', 'make', and 'sudo make install'. Let me know how it works.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

I'm getting the following error when running make:

CC [M]  /root/rtw88/rtw8723ds.o
In file included from /root/rtw88/rtw8723ds.c:5:
/root/rtw88/rtw8723ds.c:14:15: error: ‘SDIO_VENDOR_ID_REALTEK’ undeclared here (not in a function); did you mean ‘SDIO_VENDOR_ID_MEDIATEK’?
   14 |   SDIO_DEVICE(SDIO_VENDOR_ID_REALTEK,
      |               ^~~~~~~~~~~~~~~~~~~~~~
/usr/src/linux-headers-5.10.0-16-common/include/linux/mmc/sdio_func.h:95:13: note: in definition of macro ‘SDIO_DEVICE’
   95 |  .vendor = (vend), .device = (dev)
      |             ^~~~
/root/rtw88/rtw8723ds.c:15:8: error: ‘SDIO_DEVICE_ID_REALTEK_RTW8723DS’ undeclared here (not in a function); did you mean ‘SDIO_DEVICE_ID_MEDIATEK_MT7663’?
   15 |        SDIO_DEVICE_ID_REALTEK_RTW8723DS),
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/linux-headers-5.10.0-16-common/include/linux/mmc/sdio_func.h:95:31: note: in definition of macro ‘SDIO_DEVICE’
   95 |  .vendor = (vend), .device = (dev)
      |                               ^~~
make[3]: *** [/usr/src/linux-headers-5.10.0-16-common/scripts/Makefile.build:291: /root/rtw88/rtw8723ds.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.10.0-16-common/Makefile:1846: /root/rtw88] Error 2
make[1]: *** [/usr/src/linux-headers-5.10.0-16-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-16-arm64'
make: *** [Makefile:117: all] Error 2

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

Changing line #6 in rtw8723ds.c from #include <linux/mmc/sdio_ids.h> to #include "sdio_ids.h" seemed to fix it!

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

Output for sudo make install:

make -C /lib/modules/5.16.17-sun50iw9/build M=/root/rtw88 modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-16-arm64'
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-16-arm64'
Install rtw88 SUCCESS

@lwfinger
Copy link
Owner

lwfinger commented May 4, 2023

Sorry that I missed that error. The latest kernels have the updated sdio_ids.h, but this repo needs to carry them as a separate file.

Does it work?

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

Do I have to do some extra steps to get the driver to work?

I checked for the RTL8723DE driver which needs to be blacklisted, but my system doesn't have it. I disabled the originial rtl8723ds driver and now, ifconfig only shows the loopback device :/

@lwfinger
Copy link
Owner

lwfinger commented May 4, 2023

You do not need to blacklist anything. No kernel contains the SDIO driver.

What does 'lsmod | grep rtw' show?

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

Nothing, seems like the driver didn't start

@GiyoMoon
Copy link
Author

GiyoMoon commented May 4, 2023

Ohh I see my mistake. I had issues installing the linux headers for my kernel and picked another version with the KVER variable but this didn't seem to work:

[    7.121977] rtw_core: version magic '5.10.0-16-arm64 SMP mod_unload modversions aarch64' should be '5.16.17-sun50iw9 SMP mod_unload aarch64'

When running just make I get the following output:

make -C /lib/modules/5.16.17-sun50iw9/build M=/root/rtw88 modules
make[1]: *** /lib/modules/5.16.17-sun50iw9/build: No such file or directory.  Stop.
make: *** [Makefile:117: all] Error 2

@lwfinger
Copy link
Owner

lwfinger commented May 4, 2023

That error means that the kernel headers are not installed.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 5, 2023

Is there a way to compile + install it when compiling the kernel? I did this with the rtl8723ds driver here and it's far more convenient than installing all build tools on my weak SoC.
I'm currently trying to find a way to install the kernel headers for my kernel version.

@lwfinger
Copy link
Owner

lwfinger commented May 5, 2023

I did a quick look, but that should work.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 5, 2023

Alright I managed to install the linux headers and build it on my SoC, but it doesn't seem to start:

mangopi:/lib/modules/6.3.0-g58390c8ce1bd-dirty# find -name rtw88
./build/drivers/net/wireless/realtek/rtw88
./kernel/drivers/net/wireless/realtek/rtw88
mangopi:/lib/modules/6.3.0-g58390c8ce1bd-dirty# dmesg | grep rtw
mangopi:/lib/modules/6.3.0-g58390c8ce1bd-dirty# lsmod
Module                  Size  Used by    Not tainted
cfg80211              389120  0 
rfkill                 28672  1 cfg80211
ipv6                  446464 18 [permanent]
mangopi:/lib/modules/6.3.0-g58390c8ce1bd-dirty# 

@lwfinger
Copy link
Owner

lwfinger commented May 5, 2023

The SDIO device table in this driver contained device 0x024c, 0xD723, but the other driver also had 0x024c, 0xD724. I added the new one to the table and pushed a fix. Do another 'git pull' and rebuild.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 6, 2023

Hey! I rebuild it, and the output of the commands I executed above are still the same, but I tried to run modprobe rtw_8723ds:

mangopi:/# modprobe rtw_8723ds
[  344.714608] rtw_core: version magic '6.3.0 SMP preempt mod_unload aarch64' should be '6.3.0-g58390c8ce1bd-dirty SMP preempt mod_unload aarch64'
[  344.734916] rtw_core: version magic '6.3.0 SMP preempt mod_unload aarch64' should be '6.3.0-g58390c8ce1bd-dirty SMP preempt mod_unload aarch64'
modprobe: can't load module rtw_core (kernel/drivers/net/wireless/realtek/rtw88/rtw_core.ko): invalid module format

Maybe it's because I'm running the mainline kernel, I'll try stable and report back.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 6, 2023

Okay that was my mistake when creating the kernel headers, I fixed it. Now, after running modprobe rtw_8723ds, I get:

mangopi:~# dmesg | grep rtw
[    3.678016] rtw_core: loading out-of-tree module taints kernel.
mangopi:~# lsmod | grep rtw
rtw_8723ds             16384  0 
rtw_sdio               24576  1 rtw_8723ds
rtw_8723d              53248  1 rtw_8723ds
rtw_core              204800  2 rtw_sdio,rtw_8723d
mac80211              548864  2 rtw_sdio,rtw_core
cfg80211              385024  2 rtw_core,mac80211
mangopi:~# rc-service networking restart
 * Stopping NTP Server ...
 [ ok ]
 * Stopping networking ...
 *   lo ...
 [ ok ]
 * Starting networking ...
 *   lo ...
 [ ok ]
 *   wlan0 ...
ip: ioctl 0x8913 failed: No such device
ip: can't find device 'wlan0'
ip: can't find device 'wlan0'
ifup: failed to change interface wlan0 state to 'up'
 [ !! ]

@lwfinger
Copy link
Owner

lwfinger commented May 6, 2023

Do a 'sudo dmesh | grep renamed'. That will tell you the name of the device, which may not be wlan0.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 8, 2023

Hey, sorry for the late answer, I was busy during the weekend. I assume you mean dmesg. The output is empty:

mangopi:~# dmesg | grep renamed
mangopi:~# 

At least when using the driver from this repository here (lwfinger/rtl8723ds), the interface name was wlan0.

@lwfinger
Copy link
Owner

lwfinger commented May 8, 2023

Please do a reboot followed by the command 'lsmod|grep rtw'. Post the output.

Next, run the dommand 'sudo dmesg -t > dmesg.txt' and attach dmesg.txt to this issue.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 8, 2023

I did add rtw_8723ds to /etc/modules for it to start when booting.

mangopi:~# lsmod | grep rtw
rtw_8723ds             12288  0 
rtw_8723d              49152  1 rtw_8723ds
rtw_sdio               20480  1 rtw_8723ds
rtw_core              204800  2 rtw_8723d,rtw_sdio
mac80211              552960  2 rtw_sdio,rtw_core
cfg80211              389120  2 rtw_core,mac80211

dmesg.txt

@lwfinger
Copy link
Owner

lwfinger commented May 8, 2023

Your dmesg shows that the device is being recognized, but no indication that a driver is being attached. Knowing that, I rechecked the SDIO device table, and found that I had done that wrong. I just pushed a fix that I think is correct. Please pull and rebuild. Do the dmesg.txt thing again after you rebuild and reboot.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 8, 2023

dmesg.txt

@lwfinger
Copy link
Owner

lwfinger commented May 8, 2023

We definitely gained a bit that time, but we are missing the firmware, which does not make any sense. That firmware is installed with a 'sudo make install'.

Run the commands 'ls /lib/firmware' and /lib/firmware/rtw88' and post the output.

@lwfinger
Copy link
Owner

lwfinger commented May 8, 2023

I reported this problem upstream to the guys that wrote rtw8723ds.c in the following E-mail:

Martin and Jernej,

It took a bit of working through some problems, but the user now has the rtw8723ds loading and starting. The first problem other than the mechanics of building and installing the driver on his SoC was that there is a second SDIO vendor ID/device ID for his device, namely 0x024c:0xd724. As I am carrying a local copy of sdio_ids.h, that was relatively easy to fix.

At the moment, when the device starts, the log shows the following:
[ 3.640866] rtw_8723ds mmc1:0001:1: Firmware version 48.0.0, H2C version 0
[ 3.645302] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.654556] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.659268] rtw_8723ds mmc1:0001:1: sdio read16 failed (0x10040): -22
[ 3.665710] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.672499] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.677208] rtw_8723ds mmc1:0001:1: sdio write16 failed (0x10040): -22
[ 3.683739] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.690528] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.695236] rtw_8723ds mmc1:0001:1: sdio write16 failed (0x10100): -22
[ 3.873173] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.879978] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.884690] rtw_8723ds mmc1:0001:1: sdio read16 failed (0x10002): -22
[ 3.891141] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.897931] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.902640] rtw_8723ds mmc1:0001:1: sdio write16 failed (0x10002): -22
[ 3.909172] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.915962] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.920672] rtw_8723ds mmc1:0001:1: sdio read16 failed (0x10008): -22
[ 3.927116] sunxi-mmc 4021000.mmc: unaligned scatterlist: os b00 length 2
[ 3.933906] sunxi-mmc 4021000.mmc: map DMA failed
[ 3.938616] rtw_8723ds mmc1:0001:1: sdio write16 failed (0x10008): -22
[ ok ]

This problem is beyond my knowledge of SDIO.

Thanks for any help you can give.

I will let you know when they provide a fix or some test code.

Larry

@GiyoMoon
Copy link
Author

GiyoMoon commented May 8, 2023

Great thanks!
Thank you for your support with the installation, I learned a lot :)

@lwfinger
Copy link
Owner

lwfinger commented May 9, 2023

Learning a lot is one of the goals. :)

I heard back from the guy that wrote sdio.c. He said "This looks like an issue with the Allwinner SDIO controller. We can
try to work around this with the attached patch. Please note that I've only compile-tested that patch.
In theory it can hurt 16-bit register access (read/write) performance a bit (since we now require two MMC commands instead of one). Whether this can be measured in the real world is unknown to me. Let's see if it fixes the observed issue first."

I added his patch to the code. Do another git pull and test. Thanks.

@GiyoMoon
Copy link
Author

GiyoMoon commented May 9, 2023

Hey, I pulled the changes and compiled it again. Now, wlan0 manages to become ready, but after a bit, an error shows up. In the first boot I actually managed to do a ping and an nslookup before the error showed and it worked!
dmesg.txt

@GiyoMoon
Copy link
Author

GiyoMoon commented May 9, 2023

It seems pretty random when this error shows up, I managed to do some more network related stuff after a reboot and in this try, it crashed 180 seconds after boot.

@lwfinger
Copy link
Owner

lwfinger commented May 9, 2023

Yes, we are close. I sent the BUG splat to the author of sdio.c. I will let you know when we are ready for another test.

@lwfinger
Copy link
Owner

I have not heard back from the author as of this morning. I added a little code that should detect the problem and go on. Let me know what dmesg says now about this problem.

@GiyoMoon
Copy link
Author

There you go:
dmesg.txt

@lwfinger
Copy link
Owner

lwfinger commented May 10, 2023

Thanks - try again Long-distance debugging is so much fun.

BTW, As I recall, you ssh into the SoC. Any chance I can ssh into that host?

@GiyoMoon
Copy link
Author

Hey, no I'm connecting over a serial console. The SoC only has a wifi interface and when I'm testing it, it's not really possible to use SSH ;) Also I'm having some issues opening a console over SSH at the moment, but scp for example work. I still need to fix this.

I will try the new code later today and will report back.

@GiyoMoon
Copy link
Author

Still looks like the same bug :/
dmesg.txt

@lwfinger
Copy link
Owner

I am really lost on this problem. The strance thing is that the traceback shows skb_find_text just before skb_panic. The strange part is that skb_find_text if only called from within net/sched/em_text.c, and some of the netfilter code. The latter is part of the firewall code. The former is used for QoS scheduling. What does the command 'lsmod | grep sch' show? If that is blank, could you turn off the firewall to see if that makes any difference? Let me know what you find.

The person that wrote rtw8723ds.c has just taken delivery of an SoC like yours, and hopes to get it running this weekend.

@lwfinger
Copy link
Owner

One of the developers wrote to tell me of a section in the vendor driver where a packet is dropped when there is a CRC error.

I added this to this driver. Pllease pull and test again. Thanks.

@GiyoMoon
Copy link
Author

Hey! lsmod | grep sch is blank but I also don't have a firewall running. I'm running a very bare Alpine root filesystem with almost nothing installed.

I pulled the changes and tested it again. Now it shows rtw_8723ds mmc1:0001:1: Invalid RX packet size! in the kernel log.
dmesg.txt

@GiyoMoon
Copy link
Author

GiyoMoon commented May 15, 2023

It fails scanning for networks. I tried running iwctl station wlan0 scan, then these warnings start to show up and iwctl station wlan0 get-networks is empty.

@lwfinger
Copy link
Owner

We at least learned why the skb overrun happened. We are now testing whether aggregation is the problem. Do a git pull and remake. Thanks for testing.

@GiyoMoon
Copy link
Author

No problem, I'm happy to help! It still shows the same warnings.
dmesg.txt

@lwfinger
Copy link
Owner

I just pushed new code that will report the parameters from the "Invalid RX packet size!" messages so that we can see what is wrong. Again, thanks for testing.

@GiyoMoon
Copy link
Author

I think you made a mistake when displaying the rx_len value and wrote &d instead of %d. I fixed this and built it:
dmesg.txt

@lwfinger
Copy link
Owner

Thanks for fixing my mistakes. The sdio.c gurus have suggested another change, which I have pushed along with the fix you found. Please try.

@lwfinger
Copy link
Owner

There is another fix this morning that made one system work. Do a pull and try again.

@GiyoMoon
Copy link
Author

Hey, I just compiled it again:
dmesg.txt

@lwfinger
Copy link
Owner

That is disappointing. Just to verify, you do have commit d708f01496a3 ("rtw88: Correctly handle RX operations").

I just removed some debug stuff and pushed again. Pull and try. Thanks.

@GiyoMoon
Copy link
Author

Yes I just verified it, I'm on d708f01496a36c382773be2a08dc33ce17398d55 :/

@lwfinger
Copy link
Owner

Now you should be on 7da3cc1238f543eacd4c1a7d44f7b770f4d2a448.

@GiyoMoon
Copy link
Author

Now the kernel log gets spammed with warnings:
screenlog.txt

@lwfinger
Copy link
Owner

I asked for a copy of sdio.c that works and pushed it. I must have screwed this one up somewhere. At least he did not report any warnings in his logs. Rinse and repeat!

@GiyoMoon
Copy link
Author

It works!!! 🎉 I was able to do apk update, install packages and I did a speedtest:

mangopi:~# speedtest
Retrieving speedtest.net configuration...
Testing from [REDACTED] ([REDACTED])...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by [REDACTED] ([REDACTED]) [223.54 km]: 15.24 ms
Testing download speed................................................................................
Download: 40.34 Mbit/s
Testing upload speed......................................................................................................
Upload: 41.44 Mbit/s
mangopi:~# lsmod | grep rtw
rtw_8723ds             12288  0 
rtw_8723d              49152  1 rtw_8723ds
rtw_sdio               20480  1 rtw_8723ds
rtw_core              204800  2 rtw_8723d,rtw_sdio
mac80211              552960  2 rtw_sdio,rtw_core
cfg80211              389120  2 rtw_core,mac80211

Here is the kernel log, if you still need it:
dmesg.txt

Thank you very much!!

@lwfinger
Copy link
Owner

That is what we like - a clean dmesg. I am going to close this issue. If something else comes up, open a new one under rtw88.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants