Building Linux for A10S from Scratch


In this post we will explain step by step what you have to do to build the A10S-Debian Linux image and all tools and steps so you can duplicate our image or modify and generate new images which to add support for modules which we didn’t included in our image.

Note that we use Linux-Sunxi github repository to generate the Uboot and Linux kernel. Linux-Sunxi is work in progress  and Linux-Sunxi community is very active, this means every day tens of changes are commited to the repository, unfortunately some of them are not well tested so sometimes things go broken, if you follow the steps below and you get error at some point, just report it to #linux-sunxi irc channel, thing usually get fixed very quickly in matter of hours 🙂

I’ve spoken with hno how to make SNAPSHOT of the current GitHub repository so when git checkout to be sure we use this exactly snapshot which we use to build, but I’m not so good with GitHub and didn’t understood how to use tags, any help is welcome. Anyway latest Linux-Sunxi should be always better and improved (unless something is broken unintentionally 😉 )

1. Setup of the toolchain

You should make sure you have the tools for building the Linux Kernel and install them if you don’t have them. To install new software you should be with super user rights on your Linux machine, so do this type in a terminal.

$ sudo su

you will be asked for your password and then your prompt will change to # which means you are now the super user, all future commands should be run in this mode.

First update apt-get links by typing

# apt-get update

Install the toolchain by typing the following.

# apt-get install gcc-4.6-arm-linux-gnueabi ncurses-dev uboot-mkimage build-essential git

This will install: GCC compiler used to compile the kernal, The kernel config menu
uboot make image which is required to allow the SD card to book into the linux image, Git which allows you to download from the github which holds source code for some of the system, Some other tools for building the kernel

Note that if you use debian may be you will need to add

deb squeeze main

in the file below:


after the installation you now have all tools to make your very own A10s kernel image!

2. Building Uboot

The Allwinner Linux-Sunxi community uboot is maintained by Henrik Nordstrom aka hno on Freenode irc. You can find him in #linux-sunxi or #olimex channels, if something with uboot is broken he is your man 🙂

First let’s make the directory where we will build the A10S-OLinuXino Linux:

# mkdir a10s_olinuxino 
# cd a10s_olinuxino

Then let’s download the uboot sources from GitHub repository, note there are lot of branches but you have to use sunxi branch.

# git clone -b sunxi

After the download you should have a new directory

# cd u-boot-sunxi/

With the following command you can start the uboot build:

# make A10s-OLinuXino-M CROSS_COMPILE=arm-linux-gnueabi-

At the end of the process you can check if everything is OK by

# ls u-boot.bin spl/sunxi-spl.bin

If you got these two files everything is complete, well done so far

# cd ..

You should be in the following directory


3. Building kernel sources for Olinuxino A10S

The Allwinner Linux-Sunxi community Kernel is maintained by Alejandro Mery aka mnemoc on Freenode irc. You can find him in #linux-sunxi or #olimex channel, if something is broken with the Linux Kernel you can contact him or use

Kernel sources for A10s are available on GitHub. You can download them using the following command:

# git clone

After the download go to the kernel directory

# cd linux-sunxi/

Here you need from a10s configuration file – a10s_olinuxino_defconfig. The file contains all kernel module settings.

Download a10s_olinuxino_deconfig from

then copy a10s_olinuxino_defconfig file to configs directory:

# cp a10s_olinuxino_defconfig linux-sunxi/arch/arm/configs/.

and make:

# make ARCH=arm a10s_olinuxino_defconfig

update .config file

the above step will generate Linux Kernel with all modules we selected and tested, if you wish to make your changes in the kernel configuration do:

# make ARCH=arm menuconfig

The menuconfig changes a .config text file, which you can view/edit even with a text editor like vi,nano.

With this command you can add or remove different modules for the different peripherials in the kernel. Be careful when use this as this may cause the kernel to not work properly.

You have to patch i2c speed sourses in order to use some of olimex i2c modules on UEXT with software implemented i2C.

The pach change i2c1 and i2c2 speed from 200kHz to 100kHz.

For this purpose use A10S_100kHz_I2C.patch file

Download A10S_100kHz_I2C.patch from

the file has to be copied to and started from arch/arm/plat-sunxi/include/plat/ directory

# cp A10S_100kHz_I2C.patch arch/arm/plat-sunxi/include/plat/
# cd arch/arm/plat-sunxi/include/plat/
# patch -p0 < A10S_100kHz_I2C.patch

the result should be:

patching file i2c.h

Go to linux-sunxi folder

# cd /home/user/a10s_olinuxino/linux-sunxi

Now you can contiue a10s_configuration compiling:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage

when this finish’s you will have uImage ready and you can build the kernel modules:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules_install

DONE! At this point you have uboot and kernel modules.

The uImage file is located in /a10s_olinuxino/linux-sunxi/arch/arm/boot/

The kernel modules are located in


where 3.x.xx is kernel version

in our case the directory with modules is:


4. Format and setup the SD-card

We suggest 4GB class 10 micro sd-card but you can use any card between 2GB and 16GB.

First we have to make the correct card partitions, this is done with fdisk.

Plug SD card into your SD card reader and enter in the terminal

# ls /dev/sd

Then press two times <TAB> you will see a list of your sd devices like sda sdb sdc note that some of these devices may be your hard disk so make sure you know which one is your sd card before you proceed as you can damage your HDD if you choose the wrong sd-device. You can do this by unplugging your sd card reader and identify which “sd” devices remove from the list.

Once you know which device is your sdcard like sda use this text instead of the sdX name in the references below:

# fdisk -u=sectors /dev/sdX

then do these steps:

1. p

will list your partitions

if there are already partitions on your card do:

2. d 1

if you have more than one partitition press d while delete them all

3. n p 1

create the first partition, starting from 2048 and ending to 34815

4. beginning 2048 end 34815

create second partition

5. n p 2 enter enter

then list the created partitions:

6. p

if you did everything correctly on 4GB card you should see something like:

Disk /dev/sdX: 3980 MB, 3980394496 bytes
123 heads, 62 sectors/track, 1019 cylinders, total 7774208 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdg1 2048 34815 16384 83 Linux
/dev/sdg2 34816 7774207 3869696 83 Linux

7. w

write changes to sd card

now we have to format the file system on the card:

the first partition should be vfat as this is FS which the Allwinner bootloader understands

# mkfs.vfat /dev/sdX1

the second should be normal Linux EXT3 FS

# mkfs.ext3 /dev/sdX2

5. Debian rootfs

The Linux Kernel and Uboot are ready, now we have need from Linux distribution rootfs.

Basically the only difference between the different Linux distributions is the rootfs, so if you put Debian rootfs you will have Debian, if you put Ubuntu rootfs it will be Ubuntu etc.

How to build one is a long topic, the good thing is that there are many already pre-built so we can just download one and use.

exit the kernel directory

# cd ..

You should be in the directory below

# /home/user/a10s_olinuxino/

download debian rootfs – debian_fs_olimex.tar.gz from

mount your sd card EXT3 FS partition:

# mount /dev/sdX2 /mnt
# cd /mnt/

and unarchive the rootfs

# tar -xzvf /home/user/a10s_olinuxino/debian_fs_olimex.tar.gz
# ls

the right result should be:

bin boot dev etc home lib lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var
# cd ..

copy the last generated kernel modules in the new debian file system

cp -rf linux-sunxi/out/lib/modules/3.x.xx+/ /mnt/lib/modules/.

where x.xx is the kernel version
in our case the directory with moduls is:

# sync
# umount /mnt

at this point you have Debian on your SD card second partition.

6. Write kernel uImage you build to the SD-card

You should be in the directory below

# mount /dev/sdX1 /mnt/

copy the Kernel uImage to root directory in partition 1

# cp linux-sunxi/arch/arm/boot/uImage /mnt/.

download the a10s_script files from:

then untar it in /mnt directory

# tar -xzvf a10s_scripts.tar.gz -C /mnt

the a10s_scripts archive contains:


script.bin is a text file with very important configuration parameters like port GPIO assignments, DDR memory parameters, Video resolution etc, by changing these parameters in the script.bin you can configure your Linux without need to re-compile your kernel again and again this is smart way Allwinner provide for tweaking A10s Linux Kernel. The default A10s-olinuxino configuration is made for HDMI output. If you want to switch between HDMI and LCD_1024x600, LCD800x480 or LCD_480x272 mode then you have to replace the existing script.bin file from the first SD card partitition (note that this partitition is FAT – so you can replace the file under Windows or Linux) with the script.bin file from script_a10s_linux_LCD_1024x600, script_a10s_linux_LCD_800x480 or script_a10s_linux_LCD_480x272 directory

write the Uboot and sunxi-spl.bin

Note that you have to write u-boot.bin and sunxi-spl.bin in /dev/sdX (not sdX1 or sdX2)

# dd if=u-boot-sunxi/spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
# dd if=u-boot-sunxi/u-boot.bin of=/dev/sdX bs=1024 seek=32
# sync
# umount /mnt

Now you have an SD card ready to boot debian on A10s-OLinuXino.

Connect USB-SERIAL-CABLE-F to UEXT Tx.Rx and GND, or connect a HDMI screen. Put the SD-card in A10s-OLinuXino and apply +5V power, you should see Uboot and then Kernel messages on the console

default username/password is : root / olimex

7. Simple test of a10s-olinuxino LED1

You can write and read around 25 GPIO on a10s using the file system

root@A10s:~# ls /sys/class/gpio/export

gpio15_pc3/ gpio20_pe2/ gpio26_pe8/ gpio4_pb11/ gpiochip1/gpio10_pb6/ gpio16_pc7/ gpio21_pe3/ gpio27_pe9/ gpio5_pg9/ unexportgpio11_pb7/ gpio17_pc16/ gpio22_pe4/ gpio28_pe10/ gpio6_pg10/gpio12_pb8/ gpio18_pc17/ gpio23_pe5/ gpio29_pe11/ gpio7_pb15/gpio13_pb3/ gpio19_pe1/ gpio24_pe6/ gpio2_pb13/ gpio8_pb16/gpio14_pb4/ gpio1_pb14/ gpio25_pe7/ gpio3_pb12/ gpio9_pb5/

root@A10s:~# ls /sys/class/gpio/

this check available GPIO

the LED1 is connected to PE3(gpio21_pe3).

root@A10s:~# echo out > /sys/class/gpio/gpio21_pe3/direction

make PE3 output

root@A10s:~# echo 1 > /sys/class/gpio/gpio21_pe3/value

write logical 1 in PE3 – turn on LED1

root@A10s:~# echo 0 > /sys/class/gpio/gpio21_pe3/value

write logical 0 in PE3 – turn off LED1


EDIT: After some discussion with Henrik on irc channel he made git TAGs on uboot and kernel which snapshot the GitHub repositories to match what I wrote above, this means even there are new changes to the GitHub repositories, if you follow the steps above and something is broken you can do after the # git clone …

for u-boot

# git checkout v2013.07-rc1-sunxi

for kernel

# git checkout sunxi-v3.0.76-r0

these commands will point GitHub to same snapshot we used in the posting to build uboot and kernel

31 Comments (+add yours?)

  1. David
    Jun 19, 2013 @ 12:25:27

    Very good tutorial!!


  2. David Goadby
    Jun 19, 2013 @ 12:41:11

    You don’t actually say but the implication is that the system was built on a Ubuntu host. As I am about to replicate this process could you tell me which version it was? I figure that if everything is the same then the result should work. If it doesn’t then it is easier to ask further questions.

    I’m really a SUSE man at heart but I will run whatever it takes to get this working for me.

    As I use Virtualbox.I will be happy to make working copies of the development system available.


    • OLIMEX Ltd
      Jun 19, 2013 @ 14:24:21

      our host is running Debian

      root@debian:~# uname -a
      Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2+deb7u2 i686 GNU/Linux

      we used to be on Ubuntu but moved to Debian as for Linux kernel build latter seems more convenient


      • David Goadby
        Jun 19, 2013 @ 17:52:33

        Thanks for that. Actually I prefer Debian too. It was the comment about “if you use debian may be you will need to add…” that threw me.

        Thanks again.


  3. awallin55
    Jun 19, 2013 @ 18:23:23

    what are the differences if one wants to build an image with Ubuntu 12.04LTS?


  4. David Goadby
    Jun 20, 2013 @ 19:41:28

    Trying the instructions on a Debian 7.1 system. The line “# apt-get install gcc-4.6-arm-linux-gnueabi ncurses-dev uboot-mkimage build-essential git” fails with a “gcc-4.6..” not found.

    I tried adding the the sid repository to source.list and that then revealed some more dependencies and some missing keys. I then installed the embedian-archive-keyring which helped.It all started to look a mess so I stopped for a while.

    Either there has been a major update to the tool-chain since you ran these instructions or there is a typo. I’m just creating a fresh clone of the Debian 7.1 system to start again.


  5. David Goadby
    Jun 21, 2013 @ 15:34:55

    The problem I am having is the package gcc-4.6-arm-linux-gnueabi is not in the repository.

    The apt-cache shows gcc-4.4-arm-linux-gnueabi but if I try to install it fails with a dependency on cpp-4.4-arm which has a further dependency of libgmp3c2 which is not found.

    When I run apt-update there is an odd error message which is a GPG error for squeeze Release saying the “public key is not available”.

    This error may be the real cause of the other problems but I have no idea what it means or how to correct it.

    Any ideas?

    David Goadby


    • David Goadby
      Jun 21, 2013 @ 15:51:27

      Update: I solved the apt-update GPG issue. It is necessary to install the keyring with the following commands:

      apt-get install emdebian-archive-keyring
      apt-get update

      If the keyring was already installed then I guess it was not required a second time so the entry was omitted.

      The tool-chain issue remains though.


  6. Jefferson
    Jun 21, 2013 @ 18:32:38


    My name is Jefferson, I am new in android,
    Could you help me in this situation:

    I have the android source code, used it on a plate (Cubieboard) A10, recetemente got a new model board (Olimex A10s rev C).
    In the android source code I made several changes after I generated the image and used in Cubieboard now need to use that same image in new board (Olimex).

    When I flash nand with this image, I can not.

    How to solve this?
    I read about, and script.bin sys_confi.fex

    If so how can I solve?
    thanks ..


  7. Liran bh
    Jun 24, 2013 @ 13:29:59

    where can i find instructions how to build the android image?
    thanks ahead


  8. Altiveus
    Jun 27, 2013 @ 18:02:24

    the download stops.
    Debian GNU/Linux 7.0 A10S tty1
    I can not enter anything with any keyboard.


  9. giovanni.v
    Jun 29, 2013 @ 20:11:04

    Please put this document in the Olimex wiki… its a better place to find it and to keep it updated.


  10. clementg
    Jul 04, 2013 @ 13:19:37

    Can you provide a prebuilt kernel image (uImage and modules) ? I spent two days trying to do it but it doesn’t boot. I’m using gcc 4.7, that may be the cause of my problem.

    Anyway, I need Linux 3.0.76 to pass new kernel parameters. Thanks in advance!


  11. Trackback: minipc a10s linux sd | Lost Ferry
  12. Sjef
    Aug 21, 2013 @ 10:30:30

    I’ve succesfully built everything and written to the SD-card but the problem is that the board won’t boot. I even tried just preparing the SD-card and then copying the contents of the Debian SD-card sold by you to my own SD-card. Still not booting.
    In serial console, only thing I get is:

    U-Boot SPL 2013.07-08154-g48845ec (Aug 20 2013 – 12:17:50)

    Board: A10s-OLinuXino-M

    DRAM: 512 MiB

    CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2


    And that’s all. Nothing happens after that. What could possibly be the problem?


    • OLIMEX Ltd
      Aug 21, 2013 @ 12:05:17

      your power supply may be weak and not ensuring enough power for the board to boot properly


      • Sjef
        Aug 21, 2013 @ 13:56:07

        Thanks for reply, but it’s olimex PSU and boot ok with olimex SD card. So this is not it. But I already found the cause. The snapshot build of u-boot works fine. It’s just that the latest one doesn’t work. I already talked about it in the irc..

      • OLIMEX Ltd
        Aug 21, 2013 @ 14:24:26

        so actually you didn’t follow the instructions 🙂

  13. Michael Balcos
    Sep 18, 2013 @ 07:41:59

    For those having issues with setting up an environment for compiling the kernel (eg: the libgmp3c2 dependency for gcc 4.4), I’ve made a separate procedure. It can be found here:


  14. Michael Balcos
    Oct 21, 2013 @ 05:39:57

    I’ve made Slackware ARM 14.0 to work on the OLinuXino A10S:



  15. PhilipStevensonJr
    Oct 23, 2013 @ 20:45:14

    Is it possible to use an armel based Debian an not an armhf?


  16. FallingLeaf
    Nov 21, 2013 @ 05:17:11

    I have done all steps above and I can run the A10S board as a stand alone computer with HDMI display. Everything seem to be good so far. Then I want to change display from HDMI to LCD by running the ./, then select LCD display and 800×480 resolution. But after I reset the board, the LCD is on, but didn’t display anything,
    I currently use LCD 7”. system run on linux debian distribution. Does the kernel above support for LCD 7”?


  17. Trackback: [Announcement] Updated Tizen Common Image for A20-OLinuXino-MICRO and Other Sunxi Devices - Tizen Experts

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 )

Connecting to %s

%d bloggers like this: