Realtek RTL8188SU on SheevaPlug

I've recently bought a SheevaPlug low power computer and a Realtek RTL8188SU Wireless N USB adapter.

The SheevaPlug is unlike regular PCs based on the i386, it is actually an ARM platform. With Ubuntu no longer supporting ARM platforms, I've decided to try to use Debian. After installing Debian, I soon realised that the Realtek isn't supported.

Using lsusb, my Wireless USB adapter is identified as:

Bus 001 Device 003: ID 0bda:8171 Realtek Semiconductor Corp. RTL8188SU 802.11n WLAN Adapter

According to the Debian Wiki, the RTL8188 uses the r8192s_usb driver, however it is currently only supported on i386 and amd64. Having no luck compiling the source code that came with the usb adapter, I ventured on to IRC for the first time, and with the help of JimdiGriz at #debian-arm, I was able to get it to work fully now, it requires compiling a custom kernel. Below is the steps that I've followed in order to get it all to work.

On a Debian Squeeze machine (I've had it installed on a VirtualBox virtual machine), if you have lenny, make sure you do a dist-upgrade to squeeze first. Then add emdebian.org to the repository by running:

deb http://www.emdebian.org/debian/ lenny main' > /etc/apt/sources.list.d/emdebian.list

Then update the repository

apt-get update 

install the following packages:

apt-get install build-essential gcc-4.3-arm-linux-gnueabi libc6-dev-armel-cross libc6-armel-cross kernel-package fakeroot

Now, download the source code for the linux kernel from Debian Repository without installing it. Then extract the package to a temporary folder, in this case, /usr/src/moo

dpkg -x linux-source-2.6.32_2.6.32-20_all.deb /usr/src/moo

Now, extract the source code:

cd /usr/src; tar jxf /usr/src/moo/usr/src/linux-source-2.6.32.tar.bz2

Now, we need to download the kernel configuration file and save it as .config in the /usr/src/linux-source-2.6.32 folder. A copy of the configuration file can be found at Sheeva.with-linux.com

Create an alias by running

alias amake="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make"

Now, we need to add support for the wireless usb adapter using the menuconfig by running:

amake menuconfig

Select Device Drivers, Staging Drivers, RealTek RTL8192SU Wireless LAN NIC driver, (check the Debian wiki to see which RealTek driver you need based on your lsusb output) and press [M] to modulise it, now Exit the menuconfig program and save the configuration.

Now, you are ready to compile the kernel driver.

make-kpkg --initrd --arch armel --subarch kirkwood --cross-compile /usr/bin/arm-linux-gnueabi- --revision=0 --append-to-version=-custom --rootcmd fakeroot kernel_image

After a long time, it will finish compiling. You will find a deb package created in /usr/src/, the name of it should be  linux-image-2.6.32-custom_0_armel.deb. Copy the deb package to the SheevaPlug. The easiest way is to have openssh-server installed on the SheevaPlug, and then you can scp the file over.

On the SheevaPlug, install the deb package by running

dpkg -i linux-image-2.6.32-custom_0_armel.deb

Now, you need to create a uImage file. In order to create this, you will need to install the following packages on the SheevaPlug:

apt-get install mtd-utils uboot-mkimage 

Create a backup of /boot/uImage, then create the new uImage by running

mkimage -A arm -O linux -T kernel -C none -n uImage -a 0x00008000 -e 0x00008000 -d /boot/vmlinuz /boot/uImage

If your kernel is on the internal flash, you should run the following as well to copy it to the flash:

flash_eraseall /dev/mtd1
nandwrite -p /dev/mtd1 /boot/uImage

Now, reboot and you should see your wireless usb adapter kick into action. In order to use it, you will need to configure it. The following is adopted from the Debian Wifi Wiki.

If you are using WPA security, install wpasupplicants

apt-get install wireless-tools wpasupplicant firmware-realtek

Change the permission of /etc/network/interfaces to 0600

chmod 0600 /etc/network/interfaces  

In your favourite text editor, add the following to your /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp
wpa-ssid mynetworkname
wpa-psk mysecretpassphrase

Now, restart networking (or just reboot the SheevaPlug) and you should be able to use the wireless usb adapter on the SheevaPlug.

Many thanks to JimdiGriz at #debian-arm for his patience in guiding me through the cross compilation process, and the authors of the following pages for the help they provided as well.

For those who couldn't get it working, I've included the deb package.

AttachmentSize
linux-image.zip7.32 MB

Comments

Still booting old kernel

Hi, thank you for posting this!
I've managed to compile the custom kernel but am rebooting to the old kernel/uImage. I think it's something to do with the uImage address, would you please shine a light?

here's my printenv

Marvell>> printenv
baudrate=115200
loads_echo=0
ipaddr=10.4.50.165
serverip=10.4.50.5
rootpath=/mnt/ARM_FS/
netmask=255.255.255.0
console=a0000
e=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x1ff00000@0x100000(root)
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
ethmtu=1500
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
yuk_ethaddr=00:00:00:EE:51:81
nandEcc=1bit
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
mtdpartitions=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)
ethaddr=00:50:43:01:50:5f
real_bootcmd=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd
filesize=32D62A
bootargs_root=root=/dev/mmcblk0p1
ineLinux=yes
bootargs_console=console=ttyS0,115200
bootargs=console=ttyS0,115200
bootcmd_mmc=mmcinit; ext2load mmc 0:1 0x01100000 /uInitrd; ext2load mmc 0:1 0x00800000 /uImage
bootcmd=setenv bootargs $(bootargs_console); run bootcmd_mmc; bootm 0x00800000 0x01100000
nExt=no
arcNumber=2097
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=puStream=no
mainlineLinux=yes
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
enaAutoRecovery=yes
pcieTune=no

Environment size: 2140/131068 bytes

It doesnt work anymore

Hey could you Update you Tutorial please. The way it ist descibed doesnt work anymore thanks brokk

What doesn't work?

Hey Anonymous,

What doesn't work any more? You need to be more specific if you want help...