[HowTo] Building rtl8188eu kernel model for Vero4k

Since after the latest vero3-wifi-osmc update (to 1.5.0-1) I encountered severe wifi connection problems I decided to give my TP-Link TL-WN722N v2 wifi stick a chance. It needs the rtl8188eu driver which is part of the kernel tree but osmc does not build it. Since it worked quite well and is a little bit vero4k specific I would like to share the steps. Here you go:

kernel_ver=$(uname -r)

# install realtek firmware files and aarch64 toolchain for vero4k
sudo apt install firmware-realtek
sudo apt install aarch64-toolchain-osmc

# install kernel sources and headers
sudo apt install vero364-headers-${kernel_ver}
sudo apt install vero364-source-${kernel_ver}

# copy current kernel config and add rtl8188eu to config
sudo cp /boot/config-${kernel_ver} /usr/src/vero364-source-${kernel_ver}/.config
sudo echo "CONFIG_R8188EU=m" >> /usr/src/vero364-source-${kernel_ver}/.config

# required for apt
sudo cp /etc/resolv.conf ${chroot_dir}/etc/

for dir in /usr/src/vero364-headers-${kernel_ver} /usr/src/vero364-source-${kernel_ver}
	sudo mkdir -p ${chroot_dir}${dir}
	sudo mount --bind ${dir} ${chroot_dir}${dir}

sudo chroot ${chroot_dir}
apt update
apt install bc

cd /usr/src/vero364-source-${kernel_ver}
make modules SUBDIRS=drivers/staging/rtl8188eu/
make modules_install SUBDIR=drivers/staging/rtl8188eu/

# leave chroot

# copy kernel module out of chroot
sudo mkdir -p /lib/modules/${kernel_ver}/extra/
sudo cp ${chroot_dir}/usr/lib/modules/${kernel_ver}/extra/r8188eu.ko /lib/modules/${kernel_ver}/extra/

sudo depmod ${kernel_ver}

# load the rtl8188eu kernel module and unload the module from the onboard wifi
sudo modprobe r8188eu
# WARNING: this will disconnect you if you are connected wirelessly.
sudo rmmod dhd

# check logs

Now the wireless stick should work and is ready for testing via connman. In case you would like to persistently disable the onboard wifi just blacklist the corresponding kernel module like so:

# blacklist the vero4k wifi - WARNING: This will disable the onboard wifi permanently!
echo "blacklist dhd" | sudo tee /etc/modprobe.d/blacklist-dhd.conf > /dev/null

Note that this also disables bluetooth. If you would like to keep bluetooth add the interface name of the onboard wifi to /etc/connman.conf. In my case I added wlan1 to the NetworkInterfaceBlacklist:

$ grep -i blacklist /etc/connman.conf


1 Like