I was in the need to add USB-WiFi support for the Kria KV260. As my experience with Linux is based on Ubuntu, and as Xilinx recently announced the Ubuntu 20.04 LTS release for the KV260, I wanted to give it a try.
Desktop SetupMy desktop setup is a Windows 10 machine on an i5 with 32 GB of RAM, running a VM with Ubuntu 20.04 (8GB RAM) as guest OS.
Setting the Ubuntu imageIf you have never connected the KV260 before and ran the out-of-the-shelf example, please do this first.
A more complete and detailed guide can be found here. A fast track is below.
Download the image from here. (direct link). Although there are other images, the target is the Ubuntu developers and the base image worked fine for me. I have a preference to create my bootable images using Rufus, which is similar to any other method to flash the SD card.
I am logging via the Terminal.
Insert the SD card. Plug the Micro-USB into the KV260 and your PC. Open your preferred terminal (Tera Term for Windows in my case) to connect to the KV260. Power the board.
After booting, you can log in with the default credentials:
- username: ubuntu
- password: ubuntu
To change the current password just do a simple sudo command
ubuntu@kria:~$ sudo ls
[sudo] password for ubuntu:
sudo: Account or password is expired, reset your password and try again
Changing password for ubuntu.
Current password:
New password:
Retype new password:
You need to be connected to the internet to download the drivers from Github. Check your ethernet connection with a ping command:
ubuntu@kria:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=7.55 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=7.73 ms
...
Setup Xilinx environmentDo the usual.
sudo apt update
sudo apt upgrade
sudo reboot
Run the following commands to setup the KV260 for Xilinx development.
sudo snap install xlnx-config --classic
xlnx-config.sysinit
sudo reboot
Connecting the USB-WiFi adapterBefore getting any adapter, check that it can run on Linux (or get the chipset and do a google search).
I bought an OOWolf USB-WiFi adapter with the chipset Realtek 8812BU. After some googling and reading, I ended with the GitHub repo morrownr/88x2bu-20210702 which contained the drivers that worked in my case.
You can validate the adapter chipset by running the command lsusb after plug-in the adapter to any of the USB3 ports in the KV260.
ubuntu@kria:~$ sudo lsusb
Bus 002 Device 002: ID 0424:5744 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 0424:2740 Microchip Technology, Inc. (formerly SMSC)
Bus 001 Device 006: ID 0bda:b812 Realtek Semiconductor Corp.
Bus 001 Device 005: ID 0424:2744 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ubuntu@kria:~$
- Bus 001 Device 006: ID 0bda:b812 Realtek Semiconductor Corp.
If you want to test if the driver is going to work for you, make it first and skip the installation and follow Testing the driver section.
make ARCH=arm64
insmod 88x2bu.ko
Installing the driverInstalling and building the driver is an easy step. Note that you need to set ARCH=arm64, otherwise the build will fail. The build does take some minutes. Do the reboot at the end of the build.
sudo apt install -y dkms git build-essential
mkdir repos; cd repos
git clone https://github.com/morrownr/88x2bu-20210702
cd 88x2bu-20210702
sudo ARCH=arm64 ./install-driver.sh
Console output:
Running install-driver.sh version 20211212
Starting installation...
Copying source files to: /usr/src/rtl88x2bu-5.13.1
Copying 88x2bu.conf to: /etc/modprobe.d
Creating symlink /var/lib/dkms/rtl88x2bu/5.13.1/source ->
/usr/src/rtl88x2bu-5.13.1
DKMS: add completed.
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
'make' -j4 KVER=5.4.0-1017-xilinx-zynqmp KSRC=/lib/modules/5.4.0-1017-xilinx-zynqmp/build.................................................................................
cleaning build area...
DKMS: build completed.
88x2bu.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/5.4.0-1017-xilinx-zynqmp/updates/dkms/
depmod....
DKMS: install completed.
The driver was installed successfully.
Do you want to edit the driver options file now? [y/N] n
Do you want to reboot now? (recommended) [y/N] y
[ 374.093383] reboot: Restarting system
Testing the driverAfter reboot, the WiFi adapter is down. The iwconfig command will show you the available WiFi devices, and you will need the device name for the next steps. In my case, wlx1cbfceeb7e7b.
ubuntu@kria:~$ iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
sit0 no wireless extensions.
wlx1cbfceeb7e7b IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=-100 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Now we need to power up the device with ifconfig from net-tools
sudo apt install net-tools
sudo ifconfig wlx1cbfceeb7e7b up
sudo iwlist wlx1cbfceeb7e7b scan | grep ESSID
And voila, if everything was installed correctly, the iwlist command will show you the current APs around you.
ubuntu@kria:~$ sudo iwlist wlx1cbfceeb7e7b scan | grep ESSID
ESSID:"BELL113"
ESSID:"ramduq"
ESSID:"BELL709"
ESSID:"BELL113"
ESSID:"ramduq"
ESSID:""
ESSID:"BELL709"
ESSID:"HP-Print-BB-Officejet Pro X476dw"
Setting up the WiFi connection (WPA)As a final step, let's connect to the internet. My wireless network uses WAP.
# just in case (it was already installed)
sudo apt install wpasupplicant
Note: Unplug the ethernet cable
You need to create your credentials file first with:
wpa_passphrase your-ESSID your-passphrase | sudo tee /etc/wpa_supplicant.conf
And then connect to your network (-i DeviceName)
sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wlx1cbfceeb7e7b
Here I am suspending wpa_supplicant with Ctrl+z and running it in the background (bg) so I can see the messages. Adding & at the end of the command should have the same effect.
Console output:
ubuntu@kria:~$ sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wlx1cbfceeb7e7b
Successfully initialized wpa_supplicant
wlx1cbfceeb7e7b: Trying to associate with e4:c3:2a:29:2e:fa (SSID='ramduq' freq=5745 MHz)
wlx1cbfceeb7e7b: CTRL-EVENT-STARTED-CHANNEL-SWITCH freq=5745 ht_enabled=1 ch_offset=1 ch_width=80 MHz cf1=5775 cf2=0
wlx1cbfceeb7e7b: Associated with e4:c3:2a:29:2e:fa
wlx1cbfceeb7e7b: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlx1cbfceeb7e7b: WPA: Key negotiation completed with e4:c3:2a:29:2e:fa [PTK=CCMP GTK=CCMP]
wlx1cbfceeb7e7b: CTRL-EVENT-CONNECTED - Connection to e4:c3:2a:29:2e:fa completed [id=0 id_str=]
wlx1cbfceeb7e7b: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=US
^Z
[1]+ Stopped sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wlx1cbfceeb7e7b
ubuntu@kria:~$ bg
After all your testing are done, you can run wpa_supplicant with the option -B to running it quietly in the background.
sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wlx1cbfceeb7e7b -B
Altought we are connected to the AP, we still need to get an IP with
sudo dhclient wlx1cbfceeb7e7b
To check the connection:
ubuntu@kria:~$ iwconfig wlx1cbfceeb7e7b
wlx1cbfceeb7e7b IEEE 802.11 ESSID:"ramduq"
Mode:Managed Frequency:5.745 GHz Access Point: E4:C3:2A:29:2E:FA
Bit Rate=867 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=64/70 Signal level=-46 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
ubuntu@kria:~$
And we can test the connection with a ping
ping 8.8.8.8
ubuntu@kria:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=8.19 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=7.45 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=8.51 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 7.453/8.052/8.511/0.443 ms
ubuntu@kria:~$
And that's all for the moment. Thanks, comments or suggestions are appreciated. If you find a better way, please share.
Linkshttps://askubuntu.com/questions/1079377/how-do-i-install-drivers-for-realtek-rtl8812bu
https://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line
Comments
Please log in or sign up to comment.