Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
vanfanel
Posts: 119
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 9 times
Been thanked: 20 times

Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by vanfanel »

Hi all,

As you may have noticed, the kernel version has been updated a couple of days ago by Sorgelig to 5.13-MiSTer.

I have an rtl8188eu-based WiFi dongle I had been happily using with the MiSTer for the last months or so, but I can't get to build the rtl8188eu driver against the new 5.13-MiSTer kernel.

I have tried these two repositories:

https://github.com/ulli-kroll/rtl8188eu
https://github.com/lwfinger/rtl8188eu

...and they both fail to build against 5.13-MiSTer.
Any ideas, please?
User avatar
bootsector
Posts: 162
Joined: Sun May 24, 2020 6:58 pm
Has thanked: 4 times
Been thanked: 30 times

Re: Buildint RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by bootsector »

Maybe worth trying this one?

https://github.com/quickreflex/rtl8188eus
vanfanel
Posts: 119
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 9 times
Been thanked: 20 times

Re: Buildint RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by vanfanel »

@bootsector: Thanks for that one, I hadn't tried it.

However it fails, too:

Code: Select all

/home/manuel/src/mister/rtl8188eus/os_dep/linux/os_intfs.c:1240:22: error: initialization of ‘u16 (*)(struct net_device *, struct sk_buff *, struct net_device *)’ {aka ‘short unsigned int (*)(struct net_device *, struct sk_buff *, struct net_device *)’} from incompatible pointer type ‘u16 (*)(struct net_device *, struct sk_buff *, struct net_device *, u16 (*)(struct net_device *, struct sk_buff *, struct net_device *))’ {aka ‘short unsigned int (*)(struct net_device *, struct sk_buff *, struct net_device *, short unsigned int (*)(struct net_device *, struct sk_buff *, struct net_device *))’} [-Werror=incompatible-pointer-types]
 1240 |  .ndo_select_queue = rtw_select_queue,
      |                      ^~~~~~~~~~~~~~~~
/home/manuel/src/mister/rtl8188eus/os_dep/linux/os_intfs.c:1240:22: note: (near initialization for ‘rtw_netdev_ops.ndo_select_queue’)
xratedpooh
Posts: 2
Joined: Sat Aug 28, 2021 11:58 am
Has thanked: 1 time

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by xratedpooh »

Current 5.13.12 linux kernel has a RTL8188EU driver as staging device driver.
It's located in "/drivers/staging/rtl8188eu".
You can enable it by changing Kernel config. Then "make modules" will make r8188eu.ko.
vanfanel
Posts: 119
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 9 times
Been thanked: 20 times

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by vanfanel »

@xratedpooh

Yep, I noticed.
So I tried to build the modules like this:

Code: Select all

make ARCH=arm mrproper && make ARCH=arm MiSTer_defconfig && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- EXTRAVERSION=-MiSTer modules_prepare

Code: Select all

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf modules
Then I copied over

Code: Select all

drivers/staging/rtl8188eu/r8188eu.ko
to

Code: Select all

/lib/modules/5.13-MiSTer/
, then I do

Code: Select all

modprobe -a
and finally try to insert the module with

Code: Select all

modprobe r8188eu
, but it results in an "Exec format error".

Doing file on r8188eu.ko it reveals it's in the expected binary format:

Code: Select all

manuel@hp15db0:~/src/mister/Linux-Kernel_MiSTer$ file drivers/staging/rtl8188eu/r8188eu.ko
drivers/staging/rtl8188eu/r8188eu.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=46440349e30a8a2100fed47bd7c6f5474a868675, with debug_info, not stripped
So, any idea on what could I be doing wrong?
zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by zakk4223 »

What does modinfo say for that file?
vanfanel
Posts: 119
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 9 times
Been thanked: 20 times

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by vanfanel »

@zakk4223

This is what modinfo has to say on the subject:

Code: Select all

filename:       /lib/modules/5.13.12-MiSTer/r8188eu.ko
firmware:       rtlwifi/rtl8188eufw.bin
version:        v4.1.4_6773.20130222
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
srcversion:     0100F39960870AF79D10D2B
alias:          usb:v0BDApFFEFd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v7392pB811d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0DF6p0076d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2C4Ep0102d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2357p0111d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2357p010Cd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2001p331Bd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2001p3311d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2001p3310d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2001p330Fd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0B05p18F0d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v07B8p8179d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v056Ep4008d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0BDAp0179d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0BDAp8179d*dc*dsc*dp*ic*isc*ip*in*
depends:        lib80211
staging:        Y
intree:         Y
name:           r8188eu
vermagic:       5.13.12 SMP mod_unload ARMv7 p2v8 
parm:           rtw_ips_mode:The default IPS mode (int)
parm:           ifname:The default name to allocate for first interface (charp)
parm:           if2name:The default name to allocate for second interface (charp)
parm:           rtw_initmac:charp
parm:           rtw_channel_plan:int
parm:           rtw_channel:int
parm:           rtw_wmm_enable:int
parm:           rtw_vrtl_carrier_sense:int
parm:           rtw_vcs_type:int
parm:           rtw_ht_enable:int
parm:           rtw_cbw40_enable:int
parm:           rtw_ampdu_enable:int
parm:           rtw_rx_stbc:int
parm:           rtw_ampdu_amsdu:int
parm:           rtw_power_mgnt:int
parm:           rtw_smart_ps:int
parm:           rtw_wifi_spec:int
parm:           rtw_antdiv_cfg:int
parm:           rtw_antdiv_type:int
parm:           rtw_enusbss:int
parm:           rtw_hwpdn_mode:int
parm:           rtw_max_roaming_times:The max roaming times to try (uint)
parm:           rtw_fw_iol:FW IOL (int)
parm:           rtw_mc2u_disable:int
parm:           rtw_80211d:Enable 802.11d mechanism (int)
parm:           rtw_notch_filter:0:Disable, 1:Enable, 2:Enable only for P2P (uint)
parm:           debug:Set debug level (1-9) (default 1) (int)
parm:           monitor_enable:Enable monitor interface (default: false) (bool)
I don't see anything strange, which really puzzles me.
zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by zakk4223 »

The vermagic is wrong, it doesn't match the kernel.

Here's what it looks like on a working kernel module:
vermagic: 5.13.12-MiSTer SMP mod_unload ARMv7 p2v8

Try loading it with modprobe -f
vanfanel
Posts: 119
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 9 times
Been thanked: 20 times

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by vanfanel »

zakk4223 wrote: Sat Aug 28, 2021 7:58 pm The vermagic is wrong, it doesn't match the kernel.

Here's what it looks like on a working kernel module:
vermagic: 5.13.12-MiSTer SMP mod_unload ARMv7 p2v8

Try loading it with modprobe -f
Same error with modprobe -f.
obot
Posts: 14
Joined: Mon Jun 08, 2020 3:37 pm

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by obot »

If it ends up being a pain to build your module against the stock kernel, you may want to consider just building the whole kernel, including the modules. It doesn't take too long to do so.
xratedpooh
Posts: 2
Joined: Sat Aug 28, 2021 11:58 am
Has thanked: 1 time

Re: Building RTL8188EU kernel module for current kernel (5.13-MiSTer)

Unread post by xratedpooh »

@vanfanel
vermagic of your ko file is 5.13.12 SMP blah blah.
It should be 5.13.12-MiSTer SMP blah blah
you can add that string by modifying CONFIG_LOCALVERSION.

and also to use modprobe, do the following command first.
depmod -a
modprobe r8188eu
Post Reply