From Variscite Wiki

1 VAR-SOM-AM33 Android ICS 4.0.3 DevKit-3.0.1 DevelopersGuide

2 Overview

The objective of this document is to guide Android developers to get access to Android ICS DevKit release sources for VAR-SOM-AM33, setting up host environment for compilation and deployment.

This document contains instructions to:

  • Hardware and software requirement.
  • Setup the hardware.
  • Setup the toolchain.
  • Download & build the source.
  • Install the binaries on the VAR-SOM-AM33.

2.1 Hardware Requirements

VAR-SOM-AM33 evaluation kit.

2.2 Host (PC) setup requirements

The host development environment for Android is based on Ubuntu, please install Ubuntu version 10.04 or later

We recommend you to have a Linux "Ubuntu 10.04 or above" Host machine, See Ubuntu Linux installation notes

The host installation would need few more Android specific dependencies, these can be installed dynamically over network using below commands.

2.3 For Ubuntu on 32-bit machines

$ sudo add-apt-repository "deb lucid partner"
$ sudo add-apt-repository "deb-src lucid partner"
$ sudo apt-get update
$ sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev minicom tftpd uboot-mkimage expect
$ sudo update-java-alternatives -s java-6-sun

  1. Android ICS (4.0.3) needs Java 6.
  2. The hard disk should have at least 25 GigaBytes of free space to complete the building of sources.
  3. Please refer to the AOSP for latest information

3 Getting Source & Toolchain

TI provides Android sources for all it's supported devices in multiple locations, developers can download the sources from the rowboat repository or use the pre-packaged sources in the DevKit.
To support VAR-SOM-AM33, Variscite provide patches to be applied on top of TI source code.

3.1 Using Rowboat Gitorious

A tool called Repo helps to fetch the android sources from Repo is a tool that makes it easier to work with Git in the context of Android.
To install, initialize, and configure Repo, follow these steps:

Make sure you have a bin/ directory in your home directory, and that it is included in your path:

$ mkdir ~/bin
$ PATH=~/bin:$PATH

Download the Repo script and ensure it is executable:

$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo

The following commands help developers to clone sources from rowboat repository

$ mkdir $HOME/rowboat-android
$ cd $HOME/rowboat-android
$ repo init -u git:// -m TI-Android-ICS-4.0.3-DevKit-3.0.1.xml
$ repo sync

3.2 Using Pre-Packaged Sources

The above method is time consuming. Developers can use the pre-packaged Android sources in DevKit package.

Download the pre-packaged DevKit sources from TI-Android-ICS-4.0.3_AM335x_3.0.1.bin.

Run following commands to extract the pre-packaged source:

$ mkdir $HOME/rowboat-android
$ cd $HOME/rowboat-android
$ chmod a+x TI-Android-ICS-4.0.3_AM335x_3.0.1.bin
$ ./TI-Android-ICS-4.0.3_AM335x_3.0.1.bin
  • Accept the Licence when the installer prompts
  • This will generate following sources
    • Android File system : $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/
    • Android Linux Kernel: $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/kernel
    • Bootloader  : $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/u-boot
    • Toolchain location will be at $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin

3.3 Toolchain setup

  • Setup the toolchain path to point to arm-eabi- tools in prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
  $ export PATH=$HOME/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

We recommend to keep the add the toolchain path as shown above to avoid conflicts with any other installed toolchain

3.3.1 Apply VAR-SOM-AM33 U-Boot patch to U-Boot source code

Patch can be obtained from Variscite's FTP, under:


$ cd <android source path>/u-boot
$ git checkout 429a3860feea2711d3f1561ac1a431b849f45729
$ git apply VAR_SOM_AM33_U_BOOT_Support.patch

3.3.2 Apply VAR-SOM-AM33 kernel patch to kernel source code

Patches can be obtained from Variscite's FTP, under:

$ cd <android source path>/kernel
$ cd kernel
$ git checkout c0d71b6f64950d5ca529c17d91a590dfd51e8208
$ git apply VAR_SOM_AM33_Kernel_Support.patch

3.3.3 Use VAR-SOM-AM33 Android File-System

The below modifications are required to orignal TI's built AFS.

$ cp <Variscite's AFS>/gpio-keys.kl $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/device/ti/am335xevm/gpio-keys.kl
$ cp <Variscite's AFS>/init.rc $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/device/ti/am335xevm/init.rc

NOTE: Variscite's pre-build Android file-system can be obtain from Variscite's FTP.

4 Build Procedure

4.1 Toolchain setup

  • Setup the toolchain path to point to arm-eabi- tools in prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
$ export PATH=$HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

4.2 Build Bootloader

  • Change directory to u-boot
$ cd $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/u-boot
  • Execute following commands:
$ make CROSS_COMPILE=arm-eabi- distclean
$ make CROSS_COMPILE=arm-eabi- var_am335x_config
$ make CROSS_COMPILE=arm-eabi- 
  • This command will generate the MLO and the u-boot Image "u-boot.img"

4.3 Build Android Linux Kernel

  • Change directory to kernel
$ cd $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1kernel
  • Execute following commands
$ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-eabi- var_am335x_android_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage

This will generate uImage(kernel image) in kernel/arch/arm/boot folder

NOTE: Genrated uImage run on both am335xevm and beaglebone.

4.4 Build Android Filesystem

  • To Build the root filesystem for
$ make TARGET_PRODUCT=am335xevm OMAPES=4.x -j<N>

  • <N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4
  • The above command will build Android file-system, kernel and related modules,
  • SGX drivers and WLAN drivers will be built and installed in android rootfs.
  • Android rootfs components (root and system directories) will be located in out/target/product/am335xevm.
  • SGX drivers and libraries will get installed in Android rootfs components.

5 Boot

The Android can either be booted from NAND or MMC/SD device. Following sections describe various boot options possible.

5.1 Boot From SD Card

5.1.1 Create bootable SD card

This section describes the steps to create a bootable SD card to boot Android on the VAR-SOM-AM33.

  • Get a 4GB SD memory card.
  • Connect the 4G SD memory card using memory card reader to the Linux machine.
  • Note the name allocated for this device. Type "dmesg". The SD card name should show up near the end, usually something like "SDC" (/dev/sdc) or "SDD" (/dev/sdd).
  • Create root file-system tarball, run the following command:
make TARGET_PRODUCT=<product name> fs_tarball
  • Create a boot script file named uEnv.txt file with following content:
bootargs=console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait init=/init ip=off
bootcmd=mmc rescan ; fatload mmc 0 81000000 uImage ; bootm 81000000
  • Copy compiled images to image folder and create a bootable SD card as follows.
$ mkdir image_folder
$ cp uEnv.txt image_folder
$ cp kernel/arch/arm/boot/uImage image_folder
$ cp u-boot/u-boot.img image_folder
$ cp u-boot/MLO image_folder
$ cp out/target/product/am335xevm/rootfs.tar.bz2 image_folder
$ cp Media_Clips image_folder

NOTE: Get the Media_clips folder from the Variscite's SD card creation folder.
  • Copy the SD/MMC card creation script:
$ cp <android-devkit>/ image_folder

NOTE: Get the script from the Variscite's SD card creation folder.
  • Generate Android bootable SD card using SD/MMC card creation script.
$ cd image_folder
$ sudo ./ /dev/sdX MLO u-boot.img uImage uEnv.txt rootfs.tar.bz2 Media_Clips

5.1.2 Boot Android from SD card

  • Insert the SD card you just created into the MMC/SD slot on the custom board.
  • Power on the.

By default the will boot from NAND, to boot from SD/MMC make sure the NAND chip is erased or press and hold the boot select switch while power on.

5.2 Boot From NAND

By default the boot from NAND. The boot images(MLO, U-Boot, Kernel) and UBIFS Android file-system should be flashed to the NAND device.

5.2.1 Create Android UBI image

$ cd $HOME/rowboat-android/TI-Android-ICS-4.0.3_AM335x_3.0.1/out/target/product/am335xevm
$ mkdir android_rootfs
$ cp -r root/* android_rootfs
$ cp -r system android_rootfs
$ ckmod -R 777 android_rootfs
  • Use MTD tools to create UBI Android file-system image as desbribed here.

5.2.2 Flash Images to NAND

  • Get FAT32 formated SD card.
  • Copy the boot images(MLO, u-boot.img, uImage) and UBIFS Android file-system image to the SD card.
  • Insert the SD card you just created into the MMC/SD slot on the custom board.
  • Install the images. From U-Boot console:
U-Boot # nand erase.chip
U-Boot # reset
<< REBOOT ... >>
U-Boot # mmc rescan
U-Boot # nandecc hw 2
 << Install MLO >>
U-Boot # fatload mmc 0:1 0x81000000 MLO
U-Boot # nand write 0x81000000 0x00000000 0x00020000
<< Install u-boot.img >>
U-Boot # fatload mmc 0 0x81000000 u-boot.img
U-Boot # nand write 0x81000000 0x00080000 0x001E0000
<< Install uImage >>
U-Boot # fatload mmc 0 0x81000000 uImage
U-Boot # nand write.i 0x81000000 0x00280000 0x00500000
<< Install ubi.img >>
U-Boot # fatload mmc 0 0x81000000 ubi.img
U-Boot # nand write.i 0x81000000 0x00780000 0x07460000

5.2.3 Boot Android from SD card

  • Insert the SD card you just created into the MMC/SD slot on the custom board.
  • Power on the VAR-SOM-AM33.

6 Android ADB Setup

Android Debug Bridge (adb) is a versatile tool that let you manage the state of the Android-powered device.

For more information about how to setup ADB adb, see TI ADB Setup page at

When using adb over USB on Windows Machine, edit android_winusb.inf to match VAR-SOM-AM33 vendor and product ids, under Google.NTx86 section add:
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_D002
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_D002&amp&MI_01