Olimex A20 Android Building

(UPDATE) Feb 13th. Found out why it won’t run. See at the bottom for the fix.

Using this information you can have a trouble free build of the source but sadly, the built image does not run on my board so I have documented this here in the hopes that others can get the build to complete and then we are in a position to sort out why it does not run.

At the present time (12th Feb 2014) the build still does run but I am hoping that by posting this up someone will figure out why this does not work.

To get started, you will need a Linux Ubuntu (Google recommended) system to build the source. If you are already running Ubuntu, then you are ready to get started. I’ve built this using Ubuntu 12.04 but other versions should work too, they’ve just not been tested. Google has kindly documented the installation requirements for the build environment, so use this link to make sure your system is setup correctly.

Google Setup Instructions

Once you have done this, go and grab the source from Olimex here.

Android 4.2 and Linux 3.4

Create a directory on your system to extract the source to. I created an android directory and then inside that an olimex-a20 directory. From your home directory, do the following from a terminal window.

mkrdir android
cd android
mkdir olimex-a20

Copy the source files you downloaded into this directory and then use tar to extract them.

tar zxvf android4.2.tar.gz
tar zxvf lichee-v2.0.tar.gz

You should now have both the Linux kernel source and the Android source now on your machine. You are almost ready to build them but I included 1 more step and that was to setup the cross compiler that comes with the source. Assuming you used the same directory names I showed above, you now need to add the PATH to the cross compiler to your .bashrc file. Edit the file and add the following to it. These lines assume you used the directory names above.


Now we are ready to build the kernel. This will take a little while depending on your computers speed so be patient.

cd lichee
./build.sh -psun7i_android

Once this completes, you will have the Linux kernel and now is time to build Android. If you build as per the Olimex instructions, the system will fail due to a setting for SATA. SATA is not currently supported in Android so I simply commented out the lines for this. Locate the following file and open it for editing.


And comment out or delete the SATA entry at the bottom. You can now build without errors.

<!-- storage android:mountPoint="/mnt/sata"
 android:maxFileSize="0" / -->

The extract-bsp lines copies the kernel image for when you run pack later. If after you run lunch and you don’t see the olinuxino-a20_eng option (should be option 15) then simply run the source build.envsetup.sh file again. I found that I needed to run this twice for it to appear.

cd ../android4.2
cd device/softwinner/
tar zxfv olinuxino-a20.tgz
cd ../../
source build/envsetup.sh
lunch      #select olinuxino-a20_eng
make -j4

This will take quite a while and in my case about 5 hours so grab a coffee and relax for a bit. Once this is complete, you now need to pack the image. This is where the Olimex source build instructions will fail because the configuration directory and settings are missing and may explain why the final image fails to run on my system. So, to get this to work we need to create a directory called olinuxino-a20 in this location (Linux source directory)

cd ~/android/lichee/tools/pack/chips/sun7i/configs/android
mkdir olinuxin-a20

Once you do this, download the following files and extract them into this directory.

System Configuration Files

I’ve built these files based on what I could find on a number of Google Searches and comparing the converted script.bin file in the original Olimex image. If anyone sees and error in these or have the correct files, please post a comment about it.

There is a couple of lines in the sys_config.fex file you might want to change depending on your needs. Another user on the Olimex forum and I have identified that to get the unit to boot on applying power, you need to change the following line in the [target] settings. Setting this value to 0 causes the unit to power up and go to standby mode if you have a battery connected. You then need to press the power button to get it to start. If you set this to 1, the system will boot up on applying DC power even if the battery is connected and the unit was powered down through the power switch or via software.

power_start = 1

The other change is to tell Phoenixsuit where to write the image to. This is 0 for NAND and 1 for SDCARD. I use SDCARD for testing images and once I get a working image, I change this to 0 and run pack again. No need to rebuild the source.

storage_type = 1

Now just run pack and it should generate the output image. It will be shown in RED the location of this file. Now use Phoenixsuit to load this to your board.

Hopefully this will get you building the source code and at this present time, I am unable to get it past the following error. If you have the serial debug you will most likely see a number of untracked PID exits in the output if the system has the same failure as myself. If you type LOGCAT into the debug you will get more detailed debugging information but start a capture before you do this as the output generates a lot of information. Below is a partial dumb of the information I am seeing.

I/SurfaceFlinger( 1944): GraphicBufferAlloc::createGraphicBuffer 
W/SurfaceFlinger( 1944): hw_get display module Failed!
D/SurfaceFlinger( 1944): display dispatcher enabled
W/SurfaceFlinger( 1944): wifidisplay dispatcher disable
I/SurfaceFlinger( 1944): GraphicBufferAlloc::createGraphicBuffer 
I/SurfaceFlinger( 1944): EGL informations:
I/SurfaceFlinger( 1944): vendor : Android
I/SurfaceFlinger( 1944): version : 1.4 Android META-EGL
I/SurfaceFlinger( 1944): extensions: EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer 
I/SurfaceFlinger( 1944): Client API: OpenGL_ES
I/SurfaceFlinger( 1944): EGLSurface: 8-8-8-8, config=0x60000014
I/SurfaceFlinger( 1944): OpenGL ES informations:
I/SurfaceFlinger( 1944): vendor : ARM
I/SurfaceFlinger( 1944): renderer : Mali-400 MP
I/SurfaceFlinger( 1944): version : OpenGL ES-CM 1.1
I/SurfaceFlinger( 1944): extensions: GL_EXT_debug_marker GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_matrix_get GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_point_size_array GL_OES_point_sprite GL_OES_texture_npot GL_OES_query_matrix GL_OES_matrix_palette GL_OES_extended_matrix_palette GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_draw_texture GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_OES_framebuffer_object GL_OES_stencil8 GL_OES_depth24 GL_ARM_rgba8 GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_OES_texture_cube_map GL_EXT_discard_framebuffer GL_EXT_robustness GL_OES_depth_texture_cube_map 
I/SurfaceFlinger( 1944): GL_MAX_TEXTURE_SIZE = 4096
I/SurfaceFlinger( 1944): GL_MAX_VIEWPORT_DIMS = 4096 x 4096
D/SurfaceFlinger( 1944): Screen acquired, type=0 flinger=0x411eb370
D/SurfaceComposerClient( 1468): ComposerService reconnected
F/libc ( 1468): Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1), thread 1954 (BootAnimation)
I/AwesomePlayer( 1147): setDataSource_l(URL suppressed)
I/ServiceManager( 1147): Waiting for service window...
F/libc ( 1944): Fatal signal 11 (SIGSEGV) at 0x00000084 (code=1), thread 1945 (SurfaceFlinger)
I/DEBUG ( 1142): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1142): Build fingerprint: 'softwinners/olinuxino_a20/olinuxino-a20:4.2.2/JDQ39/20140211:eng/test-keys'
I/DEBUG ( 1142): Revision: '0'
I/DEBUG ( 1142): pid: 1468, tid: 1954, name: BootAnimation >>> /system/bin/bootanimation <<<
I/DEBUG ( 1142): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000010

If you have success, please post a comment.

(UPDATE Feb 13th 2014) 
I have found out why it won’t run. The display.sun7i.so file is missing and not included. It seems to be a conditional flag issue and I have gotten around this by removing the check.

Locate this file


and edit the 2 lines below to add the # to them (comment out the lines)

#ifneq ($(filter wing%,$(TARGET_DEVICE)),)
include $(call all-makefiles-under,$(LOCAL_PATH))

Save the file and now run make-j4 and pack to create the image for NAND or SD as above. It should now work albiet in Chinese and on my unit, the LCD keeps going on and off.

Somehow this is not the actual build configuration that Olimex claims it to be for the images on their website but at least we now have a partially working system to start creating customs builds with. I’ll update the blog entry and I find out more.

18 comments on “Olimex A20 Android Building

  1. Hello, I tried it and compilation works 🙂 but I have a problem with external SD card. I am not able to use it.

    1) I am not able to mount it. The soluiton was in modification the vold.fstab because the second mmc controler is here: /devices/platform/sunxi-mmc.3/mmc_host

    Now I am able to mount it in shell.

    2) The other problem is in propagation the /mnt/extsd to android environment. I am not able to see the content in Android and I don’t know why :-(.

    Do you know how to resolve it?

    Thank you, Zbynek Kocur

    • Hi there, I have been running from SD for the time being but I will try to install on NAND and check out the SD card issue. I did notice in the config.xml that the SD card was set for power off installation. I’ll have a look over the next few days.

      • Hello, thank you very much for your answer.

        The SD slot is powered, I am able to see the device in /dev/block/mmcblkX. manual mount works but Android don’t see it.

      • Hi, try setting this entry to true and place it in the config.xml file located in the directory below. The default setting is false.



      • Hello, here is my config.xml:


        <!– Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or




        there is no SD card section. Could you send me the right section?

      • I found the other problem. I am not able to write to /mnt/sdcard. In vold.fstab is that configuration and manual mount in shell works.

        dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandk

      • I try it several times but I am not able to use internal memory aka /mnt/sdcard. The nandk is not mounted. It seems like system problem with user access to data storages.

  2. I get this:

    make[2]: Entering directory `/home/user/A20/Android/lichee/linux-3.4′
    CC [M] /home/user/A20/Android/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.o
    arm-linux-gnueabi-gcc: error: directory: No such file or directory
    arm-linux-gnueabi-gcc: error: directory”: No such file or directory
    make[3]: *** [/home/user/A20/Android/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.o] Error 1
    make[2]: *** [_module_/home/user/A20/Android/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump] Error 2
    make[2]: Leaving directory `/home/user/A20/Android/lichee/linux-3.4′
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/user/A20/Android/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump’

  3. thank you for your blog..
    by following above steps I have successfully compiled the kernel source, i have my imge file “sun7i_android_olinuxino-a20.img” located at the folder /home/android/android1/olimex-a20/lichee/tools/pack/

    Now my problem is

    I am unable to load the “sun7i_android_olinuxino-a20.img” file to the NAND/SD card.

    when i connected my alwinner a20 board to windows pc, phoenix suite detects the board. when i press the upgrade button to upgrade “sun7i_android_olinuxino-a20.img ” immedietely device gets disconneted.

    I am not encountering this problem when i am going to upgrade other “xxxxx.img” file.

    please suggest any solution…

    thank you

  4. To update hold in the REC button and press and release RESET. Keep holding REC until the board is detected. It will go off line and then on in the recovery mode.

    The image must have been build for NAND if you are trying to write to NAND. Make sure there is NO SD card in when you do this.

    The setting for the build is in the FEX file and applied when you run the pack command.

    storage_type: 0 = nand, 1 = SDCard

  5. Hello Dave,

    first of all thank you very much for this blog, it definetely helped me to compile an Android image on my own.
    I thought that this site might be a good place to also show how to build an english version instead of the chinese version:
    find the file: android4.2/device/softwinner/wing-common/ProductCommon.mk

    now find the line starting with:

    and move (or remove) the lines
    persist.sys.timezone=Asia/Shanghai \
    persist.sys.language=zh \
    persist.sys.country=CN \

    behind the PRODUCT_PROPERTY_OVERRIDES definition and comment them:

    ro.kernel.android.checkjni=0 \
    wifi.interface=wlan0 \
    wifi.supplicant_scan_interval=15 \
    debug.egl.hw=1 \
    ro.display.switch=1 \
    ro.opengles.version=131072 \
    rild.libargs=-d/dev/ttyUSB2 \
    rild.libpath=/system/lib/libsoftwinner-ril.so \
    keyguard.no_require_sim=true \
    persist.sys.strictmode.visual=0 \
    persist.sys.strictmode.disable=1 \

    #persist.sys.timezone=Asia/Shanghai \
    #persist.sys.language=zh \
    #persist.sys.country=CN \

    Now I did a clean and afterwards rebuilt the image and tada it was now in english which is the default.

    Probably you already new this, but for me it took some time to find so maybe others are glad that this information can be found here.

    Kind regards


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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