Android setup for USB Wi-Fi adapter

Purpose: make the Cubieboard2 running Android use the USB Wi-Fi adapter. By default, the Android images I found available did not have the required driver or better said, it was not being used.


Really good tutorial:

One Android images source:

Linux tools:


1. I used Android 4.2_v1.08 image.
2. Inpack the .img file with imgrepacker

./imgrepacker .img

imgrepacker (version 2.05 linux)
LiveSuit’s & PhoenixSuit’s firmware image unpacker/packer

(c) RedScorpio, Moscow, 2012-2014

==========================[ START ]==========================

— Firmware unpacking —

PhoenixSuit image format detected

– image.cfg creating –
image.cfg created

– Files extracting –
“/sys_config.fex” extracted (format: unknown)
“/sys_partition.fex” extracted (format: unknown)
“/split_xxxx.fex” extracted (format: unknown)
“/boot0_nand.fex” extracted (format: Allwinner BOOT0 file)
“/boot0_sdcard.fex” extracted (format: Allwinner BOOT0 file)
“/u-boot.fex” extracted (format: unknown)
“/fes1.fex” extracted (format: Allwinner BOOT0 file)
“/usbtool.fex” extracted (format: Windows PE file)
“/aultls32.fex” extracted (format: Compiled lua file)
“/aultools.fex” extracted (format: Compiled lua file)
“/cardtool.fex” extracted (format: Windows PE file)
“/cardscript.fex” extracted (format: unknown)
“/sunxi_mbr.fex” extracted (format: unknown)
“/dlinfo.fex” extracted (format: unknown)
“/bootloader.fex” extracted (format: FAT16 image)
“bootloader.fex.iso” created
“/Vbootloader.fex” extracted (format: unknown/empty?)
“/env.fex” extracted (format: unknown)
“/Venv.fex” extracted (format: unknown/empty?)
“/boot.fex” extracted (format: Android boot image)
“/Vboot.fex” extracted (format: unknown/empty?)
“/system.fex” extracted (format: sparse image)
“/Vsystem.fex” extracted (format: unknown/empty?)
“/recovery.fex” extracted (format: Android boot image)
“/Vrecovery.fex” extracted (format: unknown/empty?)
“/diskfs.fex” extracted (format: unknown)

==========================[ STOP ]==========================

3. Copy these files is a separate folder:

4. Rename boot.fex and recovery.fex to boot.img and recovery.img.

5. Use the script from the linux tools archive:

./ boot.img

Now in the folder containing the split_bootimg script there are two new files. Unzip the ramdisk archive to a new folder.

mkdir ramdisk
cd ramdisk
gunzip -c ../boot.img-ramdisk.gz | cpio -i

6. Edit the file init.sun7i.rc by adding this line:
insmod /system/vendor/modules/rtl8192cu.ko


To get info about modules:

To see the modules already loaded in the kernel:

To access the system itself thee steps are needed:

1. Convert from .fex to .img:
./simg2img system.fex system.img

2. Make a new directory for the system and mount it
mkdir system
sudo mount -o loop system.img system

3. Restore the image to fex
sudo ./ -s system new-system.fex ext4 ../tmp 500M
The 500M part tells how much memory should be allocated for the image, if 500M does not work check the size of the orginal .img and use something similar, otherwise just increase until it executes successfully.

I was surprised to find a lot of drivers already included in the system.

system/vendor/modules$ ls
8188eu.ko gc0307.ko mali.ko scsi_wait_scan.ko
8189es.ko gc0308.ko mcs7830.ko sp0838.ko
8192cu.ko gc0309.ko mma7660.ko stk831x.ko
8723as.ko gc0329.ko mma8452.ko sun7i-ir.ko
8723au.ko gc2015.ko mma865x.ko sun7i-keypad.ko
afa750.ko gc2035.ko Module.symvers sun7i_tvd.ko
al3010.ko gpio-sunxi.ko mt9d112.ko sunxi_csi0.ko
asix.ko gspca_main.ko mt9m112.ko sunxi_csi1.ko
bcm20710a1.hcd gt2005.ko mt9m113.ko sunxi-ps2.ko
bcm4330.ko hdcp.ko mxc622x.ko sunxi-ts.ko
bma250.ko hi253.ko nand.ko sw_device.ko
camera.ko hi704.ko nvram_ap6210.txt ump.ko
cdc_ether.ko hid-logitech-dj.ko ov2643.ko usbnet.ko
dmard10.ko i2c_device_debug.ko ov2655.ko usb-storage.ko
example.ko kxtik.ko ov5640.ko uvcvideo.ko
fw_bcm40181a2_apsta.bin leds-sunxi.ko qf9700.ko videobuf-core.ko
fw_bcm40181a2.bin lis3de_acc.ko rtl8150.ko videobuf-dma-contig.ko
fw_bcm40181a2_p2p.bin lis3dh_acc.ko s5k4ec.ko


Ok… nothing worked!!!

After trying a lot to get the wi-fi adapter to work on Android I didn’t manage to do it, BUT AGAIN, the experience gave me an idea about browsing so I ended up here:

where I found the long lost Android image containing the driver. It worked flawlessly. (TODO: open it up and see how it was made)


Download link:

Further Android setup

First problem:
The only layer that truly works and supports perfectly hardware acceleration on the board was MXPlayer. However, due to licencing problems no more AC3 audio decoding software was included so it needs to be added manually.
Solution found here:
Download the all-in-one zip pack of codecs then using MXPlayer’s settings (custom codec) point it to the location of the archive.


Second problem: the NAND memory is too small for video caching so I need to make Android 4.2.2 write to external USB hard-drive.
Solution found here:

1. connect through adb to the board
2. mount the system
mount -o remount,rw /system
3. Make a copy of the file and edit it by adding in the body of android.permission.WRITE_EXTERNAL_STORAGE

cd /system/etc/permissions/
busybox cp platform.xml platform-old.xml
busybox vi platform.xml


Now the video streaming app can use an external device as cache storage place.


One thought on “Android setup for USB Wi-Fi adapter

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s