CM-T335: Android: Building images

From Compulab Mediawiki
Jump to: navigation, search

Android Image

The Android Demo filesystem image for the CompuLab CM-T335 System-on-Module / Computer-on-Module is based on Android Jelly Bean 4.1.2 distribution for TI's Sitara(TM) AM335x ARM Cortex(TM) A8 Processors.

Host Setup

Rowboat Jelly Bean sources can be built only on 64-bit hosts. The current build is tested on Ubuntu 12.04 (64-bit). This article assumes that the Getting Started instructions have been followed precisely and the same directory structure and all the tools were installed. The section Installing the JDK of the Getting Started instructions should be skipped. Also this article will use the $ANDROID_BASE variable to denote the base directory of the Rowboat Android sources.

Java JDK Setup

Default Ubuntu installation comes with OpenJDK which does not work for building the Rowboat Android JB sources. To over come this problem, the Sun Java JDK must be used. Current build was tested with Java SE Development Kit 6u38. This or later version (from now we assume it's XX) can be downloaded from here. Please use the Linux x64 bin installer. Install the JDK into any location. Also this article will use the $JDK_HOME variable to denote the JDK install directory.

cd $JDK_HOME
cp /path/to/jdk/jdk-6uXX-linux-x64.bin $JDK_HOME
chmod a+x jdk-6uXX-linux-x64.bin
./jdk-6uXX-linux-x64.bin

Installing Repo

Repo is a tool that helps to fetch the Rowboat Android sources. Please refer to Android Developing for more information about Repo. This article will use the $REPO_HOME variable to denote the repo install directory.

  • Download the Repo and add execution permitions:
cd $REPO_HOME
curl https://storage.googleapis.com/git-repo-downloads/repo > ${REPO_HOME}/repo
chmod a+x ${REPO_HOME}/repo
  • Add $REPO_HOME to the path:
PATH=${REPO_HOME}:$PATH

Getting Rowboat Android Sources

The Rowboat Android source repository is hosted on the Rowboat Gitorious website.

  • Create an empty directory for the Rowboat Android sources:
mkdir -p /path/to/rowboat/android
export ANDROID_BASE=/path/to/rowboat/android
cd $ANDROID_BASE
  • Get the sources:
repo init -u git://gitorious.org/rowboat/manifest.git -m TI-Android-JB-4.1.2-DevKit-4.0.1.xml
repo sync


Admolition note.png If the Rowboat Android source repository hosted on the Rowboat Gitorious website is inaccessible download TI customized sources for Android JB 4.1.2 from the TI website.

Extract Android JB 4.1.2 sources by executing the downloaded binary in a terminal:

./TI-Android-JB-4.1.2_AM335x_4.0.1.bin
...

As a result a directory named TI-Android-JB-4.1.2_AM335x_4.0.1 is created. Copy its content into $ANDROID_BASE directory:

cp -a TI-Android-JB-4.1.2_AM335x_4.0.1/* $ANDROID_BASE/

Applying Patches

The Rowboat Android source tree is a collection of individual git repositories rather than a single git tree. The CM-T335 Android Demo package provides a collection of patches for CM-T335 support. The patch collection is organized into sub-collections; each sub-collection relates to an individual git repository. All sub-collections form a tree structure that preserves the Rowboat Android Source tree structure. All patches are generated vs. source tree version determined by the Rowboat Android manifest named TI-Android-JB-4.1.2-DevKit-4.0.1.xml.

  • Patching the build/ directory:
cd $ANDROID_BASE/build
git checkout -b cm-t335-dev
git am /path/to/cm-t335-android/development/build/*
  • Patching the device/ directory:
cd $ANDROID_BASE/device/
mkdir -p compulab/cm_t335
cd compulab/cm_t335
git init
git checkout -b cm-t335-dev
git am /path/to/cm-t335-android/development/device/compulab/cm_t335/*
  • Patching the hardware/ti/omap3 directory:
cd $ANDROID_BASE/hardware/ti/omap3
git checkout -b cm-t335-dev
git am /path/to/cm-t335-android/development/hardware/ti/omap3/*
  • Patching the hardware/ti/wlan directory:
cd $ANDROID_BASE/hardware/ti/wlan
git checkout -b cm-t335-dev
git am /path/to/cm-t335-android/development/hardware/ti/wlan/*
  • Patching the kernel directory:
cd $ANDROID_BASE/kernel
git checkout -b cm-t335-dev
git am /path/to/cm-t335-android/development/kernel/*
Admolition note.png TI customized sources for Android JB 4.1.2 downloaded from the TI website have no git repositories and thus cannot be patched by the means of git utility.

Use patch utility instead.

Building Android images

  • Setup Build Environment
export ANDROID_BASE=/path/to/rowboat/adnroid
cd $ANDROID_BASE
export PATH=$JDK_HOME/bin:$PATH
export PATH=$ANDROID_BASE/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export TARGET_PRODUCT=cm_t335
  • Replace the Makefile in the Android home directory with the patched version:
rm -rf ${ANDROID_BASE)/Makefile
cp ${ANDROID_BASE)/build/core/root.mk ${ANDROID_BASE)/Makefile
  • To build the full Android Demo image (including Android filesystem, SGX, and Linux kernel):
    make OMAPES=4.x -j<N>
where N should be twice the number of processors/cores on your host machine.
  • To build a single Android Demo image component:
    • The Android filesystem:
      make droid -j<N>
    • The SGX:
      make sgx OMAPES=4.x -j<N>
    • The Linux kernel:
      make kernel_build -j<N>
  • To create Android filesystem tarball:
    make fs_tarball

See also