Building Linux sunxi with WIFI Realtek support
The first step to configure the wifi module is to load a driver support this chipset. There is a legacy driver called 8188cu.ko and other newer called rtl8192cu.ko. This driver support both chiptsets rtl8192cu and rtl8188cu, but it is necessary a firmware to work.
Before doing these steps, first test if there is already WIFI Realtek support in Linux board:
modprobe rtl8192cu (linux board)
If the message is: modprobe: FATAL: Module rtl8192cu not found, do next steps. If no, go to section Configuring the interface.
Warning: this step is to be done on PC! You can enable the driver in kernel config:
Device Drivers --> [*] Network device support -->[*] Wireless LAN --> <M>
Realtek RTL8192CU/RTL8188CU USB Wireless Network
Now compile the kernel with Realtek support enabled. You could read: Compiling linux for sunxi.
You can also download the source code RTL8192CU and build it manually. For the Wifi works it is necessary to have the firmware rtl8192cufw.bin. In the Debian repo there is the package firmware-realtek that contains the firmware. Download here debian-repo and tranfer to uSD or media used and install it:
dpkg -i firmware-realtek
In my case (Debian 6), even installing the package firmware-realtek, rtl8192cufw.bin was not present. Verify the /lib/firmware/rtlwifi and look for it. If this is your case, download here rtl8192cufw.bin and tranfer to uSD or media used. Then copy the firmware to /lib/firmware/rtlwifi of target. This debian-rootfs already have all the necessary packages. Choose your preferred Linux distribution!
In Linux with WIFI Realtek support enabled and the firmware in right place just type:
modprobe rtl8192cu (linux board)You should see something like:
rtl8192cu: MAC address: 48:02:2a:ea:8c:3e rtl8192cu: Board Type 0 rtl8192cu: rx_max_size 15360, rx_urb_num 8, in_ep 1 ieee80211 phy0: Selected rate control algorithm 'rtl_rc' usbcore: registered new interface driver rtl8192cu
Configuring the interface (linux board)
All commands and actions performed in that section is to be done on board. That is, in linux that is running on the board!
In order to configure the wlanN(N can be any interger) interface download from your PC and transfer to uSD the packages wireless-tools and wpasupplicant and install them, if your system does not have them! These packages are to Debian wheezy armhf. Download the appropriate packages for your system!
Thereafter check if your wifi interface is active:
If you see only the lo interface, we find out the number of interface wlanN(N can be any integer). Type:
lo no wireless extensions. tunl0 no wireless extensions. wlan0 IEEE 802.11bgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry long limit:7 RTS thr=2347 B Fragment thr:off Encryption key:off Power Management:on
Ok, my N is 0. Edit the file /etc/network/interfaces and change as your network(dhcp or static):
auto wlan0 iface wlan0 inet dhcp wpa-driver wext wpa-ssid YOUR_WIFI_SSID (change as your network) wpa-key-mgmt WPA-PSK wpa-psk YOUR_WIFI_PASSWORD (change as your network)Now we can type:
ifup wlan0 (replace with the number you found)
From that point everything already works in the current kernel!
Verifying the Wifi functionality (linux board)
Type ifconfig and a similar result should appear:
lo Link encap:Loopback Local inet end.: 127.0.0.1 Masc:255.0.0.0 endereço inet6: ::1/128 Escopo:Máquina UP LOOPBACKRUNNING MTU:16436 Métrica:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 colisões:0 txqueuelen:0 RX bytes:1000 (1000.0 B) TX bytes:1000 (1000.0 B) wlan0 Link encap:Ethernet Endereço de HW 00:0d:f0:a2:63:74 inet end.: 192.168.1.3 Bcast:192.168.1.255 Masc:255.255.255.0 endereço inet6: fe80::20d:f0ff:fea2:6374/64 Escopo:Link UP BROADCASTRUNNING MULTICAST MTU:1500 Métrica:1 RX packets:604836 errors:0 dropped:0 overruns:0 frame:0 TX packets:343723 errors:0 dropped:0 overruns:0 carrier:0 colisões:0 txqueuelen:1000 RX bytes:898817015 (857.1 MiB) TX bytes:31367981 (29.9 MiB)Make sure you are connected on the wireless network:
lo no wireless extensions. wlan0 IEEE 802.11bgn ESSID:"GVT-9EE1" Mode:Managed Frequency:2.447 GHz Access Point: 84:C9:B2:C9:9E:E2 Bit Rate=72.2 Mb/s Tx-Power=20 dBm Retry long limit:7 RTS thr=2347 B Fragment thr:off Encryption key:off Power Management:off Link Quality=51/70 Signal level=-59 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:1 Missed beacon:0
One way to improve the connectivity is downloading the network-manager. Test your internet connection and type:
apt-get install 'any package'
If these two commands to work, the configuration is ok!