Setup wlan with CentOS 7 on a Banana Pi using a TP-Link USB adapter

There is a Banana Pi 1st generation, that was sitting in my drawer for too long. So I decided to bring it back to life with CentOS to which I’m a newbie. My first target is to use a TL-WN725N Nano-USB Wlan Device to connect to my local network. This guarantees fun and learning, so here we go šŸ™‚

First I downloaded the CentOS BananaPi Image. I used the link provided in their announce last december and grabbed

CentOS-Userland-7-armv7hl-Minimal-1511-BananaPi.img.xz

Then used `dd` to load it on a SD card, put it in the banana and boot that nifty little box.

The first login had to be done with credentials user:’root’ and password:’centos’.
Then install the ‘usbutils’ package to get the ‘lsusb’ command.


%sudo lsusb
....
Bus 001 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

The RTL8188EU driver can be found on github. That’s great, now all I had to do was to follow the readme.
So I installed git `sudo yum install git`, cloned the repo and compiled the driver.

git -c http.sslVerify=false clone https://github.com/lwfinger/rtl8188eu.git

The ‘sslVerify’ option was needed as CentOS complained about it.

cd rtl8188eu
make

Doing so brought up some errors that told me my fresh CentOS needs some more packages. All together I installed those packages to make it ‘work’.

yum install make wget gcc automake autoconf kernel-headers
yum install kernel-devel

I struggled a lot with the ‘kernel-devel’ package as it wasn’t found by yum. Searching the web left me with no answer so I downloaded the rpm myself.

curl -O http://mirror.centos.org/altarch/7/kernel/armhfp/kernel-4.2.3/Packages/kernel-devel-4.2.3-200.el7.armv7hl.rpm
sudo rpm -Uvh kernel-devel-4.2.3-200.el7.armv7hl.rpm

After that I could compile the driver without errors and install it.

make
sudo make install

Now edit the file `/etc/wpa_supplicant/wpa_supplicant.conf` and add:

network={
ssid="your_wlan_name"
psk="your_supersecret_password"
priority=1
}

The next command will connect to your wireless account.
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
ioctl[SIOCSIWAP]: Operation not permitted

I first got fooled by the “Operation not permitted” message. But it worked anyway!
To re-connect after booting edit ‘/etc/sysconfig/wpa_supplicant’ and add
INTERFACES="-iwlan0"
Also create the file /etc/systemd/system/mdhclient.service with and insert this content:

[Unit]
Description=dhclient service
Before=network.target
After=syslog.target
Requires=wpa_supplicant.service

[Service]
Type=forking
PIDFile=/var/run/dhclient.pid
ExecStart=/sbin/dhclient wlan0

[Install]
WantedBy=multi-user.target

That’s it, I plugged out the eth0 cable, rebooted the banana and was able to connect through wlan.
Now all that is connected to my banana pi is the power chord.
That’s what I needed! Now I can put it back drawer and think about a possible next blog post. (Maybe: Configure OSX TimeMachine over Network)

THANK YOU

This blog post helped me very much, a huge “Thank You” goes out to Stanislav.

Leave a Reply