How to Create Your Own Debian / Ubuntu Image for Mele A1000 (AllWinner A10 Based STB)

Developers working on AllWinner A10 have released an Ubuntu 10.04 LTS SD card image (4GB) for the Mele A1000.

I’ll show how you can create your own Debian or Ubuntu image based on this image for any size of SD Card using Debian 6.0 (Squeeze) and the recent Ubuntu 12.04 (Precise Pangolin) as example. The current image is not perfect, for example Ethernet doesn’t work (but you can still get network connectivity with WiFi), the NAND flash can not be accessed, the system does not appear to be very stable when running X and a few more issues. But this will be fixed by the developer community over time.

Copy the u-boot and kernel binaries to your CF card

sudo dd if=mele_u-boot.bin of=/dev/sdb bs=1024 skip=8
sudo dd if=mele_kernel_3.0.8_vfat.bin of=/dev/sdb1

Once the rootfs of your choice has been generated, first mount the ext4 partition:

sudo mount /dev/sdb2 mnt

Then copy the rootfs to the SD card together with the kernel modules and OpenGL ES files. We are using Ubuntu 12.04 armel here, but if you want to use Ubuntu 12.04 armhf (hard-float) the OpenGL ES file might not work on this system, and AllWinner would have to release hard-float binaries.

For Debian:

sudo cp -a debian_armel_squeeze/* mnt cd mnt sudo tar xjvf ../a10_modules_3.0.8.tar.bz2 sudo tar xjvf ../a10_opengles.tar.bz2 cd .. sudo umount mnt

For Ubuntu:

cd mnt
sudo tar xzvf ../armel-rootfs-201204060847.tgz
sudo tar xjvf ../a10_modules_3.0.8.tar.bz2
sudo tar xjvf ../a10_opengles.tar.bz2
cd ..
sudo umount mnt

At this point the Ubuntu image is basically done and you should be able to see the desktop and login, as long as the Mele A1000 is connected to an HDMI display.

For Debian, you’ll need to complete the second stage of deboostrap and add the apt-get source list using the Mele A1000 serial console, basically following the instructions given in the section “Generating ARMEL Debian Squeeze Rootfs” of that post. Since Ethernet does not work and WiFi is then required for internet connectivity, you also need to go to http://www.debian.org/distrib/packages#search_packages, download the Debian Squeeze armel packages for libdbus-1-3, libiw30, libnl1, libpcsclite1, multiarch-support, wireless-tools_30 and wpasupplicant_0.6 and copy them to the ext4 partition or a USB thumbdrive to install it at a later stage. You can install the package with dpkg in the Mele A1000:

sudo dpkg --i *.deb

If you’d like to use the network in your device (including apt-get), you’ll need to setup Wi-Fi. With Ubuntu, you can simply do so in the graphical interface like you would do in PC or use the following instructions for Debian. With Debian, create /etc/network/interfaces file as follows (assuming you are using WPA/WPA2):

auto wlan0
iface wlan0 inet dhcp
wpa-ssid ESSID
wpa-psk password

Make sure the Wi-Fi module (8192cu) is loaded with lsmod. If not, run depmod -a and possibly restart your device.

Wi-Fi should start automatically, if not run “ifup wlan0″.

By default (due to a setting in the Android kernel provide), a normal user will not be able to access the network, to change that (for user ubuntu):

sudo groupadd -g 3003 aid_inet
sudo usermod -a -G aid_inet ubuntu

A final tip. In case you prefer to use VGA instead of HDMI, you can use this code:

int main(int argc, char const *argv[])
{

    unsigned long   args[4];
    int             ret = -1;

    int disp = open("/dev/disp", O_RDWR, 0);
    args[0]         = 0;
    args[1]         = 0;
    args[2]         = 0;
    args[3]         = 0;
    ret = ioctl(disp,0x201,(unsigned long)args); //turn VGA off

    args[1] = 0x4; //set mode to 1024x768
    ret = ioctl(disp,0x202,(unsigned long)args); //set the mode
    ret = ioctl(disp,0x200,(unsigned long)args); //turn VGA on again

    return 0;
}

The value in this code are based on drv_display_sun4i.h in the kernel code.
Build it and run it:

gcc vga_on.c -o vga_on
sudo ./vga_on

In case somebody tries those instructions and find some issues or have ideas for improvements, please let me know in the comments section as I may have missed some steps.