TI-AM37x-Android-4.0-Guide

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

This document explains how to download, build and run Android 4.0 Ice Cream Sandwich on TI's AM37x (ARM Cortex A8) based EVM and BeagleboardXM with SGX (3D graphics acceleration) support

Out of the Box Demo

This section gives the instructions to quickly prepare an SD Card image and get an experience of Android Ice Cream Sandwich on AM37x EVM and Beagleboard XM.

Download the pre-built Image

AM37x EVM Pre-built Image

  • Using Curl
 $ cd ~
 $ curl http://rowboat.googlecode.com/files/AM37X_ICS.tar.gz > AM37X_ICS.tar.gz
 $ tar -zxvf AM37X_ICS.tar.gz
  • Direct Download
 Download link: http://rowboat.googlecode.com/files/AM37X_ICS.tar.gz

Beagleboard-xm Pre-built Image

  • Using Curl
 $ cd ~
 $ curl http://rowboat.googlecode.com/files/beagleboard_xm_sgx.tar.gz > beagleboard_xm_sgx.tar.gz
 $ tar -zxvf beagleboard_xm_sgx.tar.gz
  • Direct Download
 Download Link: http://rowboat.googlecode.com/files/beagleboard_xm_sgx.tar.gz

Prepare the MMC/SD card Image

  • Get an SD Card of minimum size 4 GBytes (Class4 minimum) and a USB Card reader
  • Insert the USB SD Card reader (with SD Card) in your host Linux PC
  • Populate the MMC/SD card
 $ tar -xzvf <Board name>.tar.gz
 $ cd <Board name>
 $ sudo ./mkmmc-android /dev/sd<device>

Setup the board/platform

  • For MMC/SD boot - On AM37x EVM the DIP switch SW4 should be set as shown below
Switch
1
2
3
4
5
6
7
8
State
OFF
ON
ON
ON
OFF
OFF
OFF
OFF
  • Connect the UART port of the platform to the Host PC and have a Terminal software like TeraTerm, Minicom or Hyperterminal.
  • Connect the Ethernet
  • Connect Audio Speakers
  • Insert the SD Card into the Board
  • For Beagleboard-xm you need to connect DVI Monitor through HDMI connector.
  • Use self powered USB HUB and connect it to USB Host port of the platform, mainly for Beagleboard-xm. For AM37x, the on board keypad can be used
  • Connect USB keyboard and USB Mouse to the USB HUB for use with Beagleboard-XM
  • Switch on the platform
  • Wait for 35sec to get Android up on the UI screen Getting Source Code
 NOTE: For the first time boot the System might take few minutes to boot. 
 NOTE: If your NAND flash is not empty the system might not boot with MMC, 
       in that case do the following with Serial Console / Terminal prompt in u-boot 
 
 #> mmc init
 #> fatload mmc 0 0x82000000 boot.scr
 #> source 0x82000000

Download Source Code

Installing Repo

  • 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 https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Get the source code

After installing repo, set up your host machine to access the Android source repositories

  • Create an empty directory to hold your working files
$ mkdir ~/rowboat-android
$ cd ~/rowboat-android
  • Get source code
$ repo init -u git://gitorious.org/rowboat/manifest.git -m rowboat-ics.xml
$ repo sync

Download Tools

Download SD card utility scripts, SignGP and boot script tools & untar them into your home directory.

 $ cd ~
 $ curl http://rowboat.googlecode.com/files/RowboatTools.tar.gz > RowboatTools.tar.gz
 $ tar -zxvf RowboatTools.tar.gz

Compilation Procedure

Toolchain Setup

Setup the tool-chain path to point to arm-eabi- tools in prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin

$ export PATH=<android source path>/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

Build x-loader

  • Change directory to x-loader
$ cd <android source path>/x-loader
  • Execute the following commands
$ make CROSS_COMPILE=arm-eabi- distclean
$ make CROSS_COMPILE=arm-eabi- <config>
$ make CROSS_COMPILE=arm-eabi-
  
 Where config is omap3evm_config for AM37x EVM and omap3beagle_config for Beagleboard-xm

This command will build the x-loader Image "x-load.bin"

To create the MLO file used for booting from a MMC/SD card, sign the x-loader image using the signGP tool.

 $ ./signGP ./x-load.bin
  
 Note: You will need to copy the signGP tool from the RowboatTools/signGP directory to the directory that contains the x-load.bin file

The signGP tool will create a .ift file, rename the x-load.bin.ift to MLO

$ mv x-load.bin.ift MLO

Build Boot Loader (u-boot)

  • Change directory to u-boot
$ cd <android source path>/u-boot
  • Execute following commands
 $ make CROSS_COMPILE=arm-eabi- distclean
 $ make CROSS_COMPILE=arm-eabi- <config>
 $ make CROSS_COMPILE=arm-eabi- 
  
 Where config is omap3_evm_config for AM37x EVM and omap3_beagle_config for Beagleboard-xm

This command will generate the u-boot Image "u-boot.bin"

Build Android, Kernel and SGX

 $ make TARGET_PRODUCT=<target_product> OMAPES=5.x
  
 Where target_product is omap3evm for AM37x EVM and beagleboard for Beagleboard-xm

This command will build kernel, android sources and sgx. If you want to build these components separately, follow below section.

Build Android, Kernel and SGX Separately

Build Kernel

  • Change directory to kernel
 $ cd <android source path>/kernel
  • Build kernel
 $ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
 $ make ARCH=arm CROSS_COMPILE=arm-eabi- <config>
 $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
 
 Where config is omap3_evm_android_defconfig AM37x EVM and omap3_beagle_android_defconfig Beagleboard-xm

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

Build Android filesystem

Use following commands to build the root file system.

 $ cd <Android source path>
 $ make TARGET_PRODUCT=<target_product> droid
  
 Where target_product is omap3evm for AM37x EVM and beagleboard for Beagleboard-xm

Build and Install SGX(2D/3D accleration) drivers and libraries

Use following commands to build the root file system.

 $ cd <Android source path>/hardware/ti/sgx
 $ make TARGET_PRODUCT=beagleboard OMAPES=5.x ANDROID_ROOT_DIR=<android source path>
 $ make TARGET_PRODUCT=beagleboard OMAPES=5.x ANDROID_ROOT_DIR=<android source path> install

Create Root Filesystem Tarball

Prepare the root filesystem as follows:

 $ cd <android source>/out/target/product/omap3evm
 $ mkdir android_rootfs
 $ cp -r root/* android_rootfs
 $ cp -r system android_rootfs
 $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

Creating an SD Card Image

This section walks you through the steps necessary to create a bootable SD card with for Android, using the binaries you built in the previous step. Configure Boot Arguments

The default boot arguments for beagleboard-xm are located at "~/RowboatTools/mk-bootscr/boot.scr" boot script. Refer to Boot Arguments section for required boot arguments. If you want to make changes to the boot arguments, you need to re-generate the boot script (boot.scr) as follows

  • Change directory to mk-bootscr folder.
$ cd ~/RowboatTools/mk-bootscr

Edit mkbootscr file as per your boot arguments.

  • Generate boot.scr boot script
$ ./mkbootscr
  • Flash SD Card

Copy compiled Images to image folder and create a bootable SD card as follows.

$ mkdir ~/image_folder
$ cp <android sorce path>/kernel/arch/arm/boot/uImage ~/image_folder
$ cp <android souorce path>/u-boot/u-boot.bin ~/image_folder
$ cp <android source path>/x-loader/MLO ~/image_folder
$ cp ~/RowboatTools/mk-bootscr/boot.scr ~/image_folder
$ cp <android source path>/out/target/product/omap3evm/rootfs.tar.bz2 ~/image_folder
$ cp ~/RowboatTools/mk-mmc/mkmmc-android.sh ~/image_folder
$cd ~/image_folder
$ sudo./mkmmc-android <your SD card device e.g.:/dev/sdc> MLO u-boot.bin uImage boot.scr rootfs.tar.bz2

Boot Arguments

  • AM37x EVM boot arguments
  setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootdelay=1 init=/init \
  ip=off omap_vout.vid1_static_vrfb_alloc=y vram=8M omapfb.vram=0:8M'
  • Beagleboard-xm boot arguments
  setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootdelay=1 init=/init \
  ip=off omap_vout.vid1_static_vrfb_alloc=y vram=8M omapfb.vram=0:8M omapdss.def_disp=dvi omapfb.mode=dvi:1024x768-16'

Booting Up the Board

Insert your SD card into your board, Setup the board as mentioned in Setup the board/platform section and turn on the board.

Android ICS should boot.Note that the first boot usually takes a little while because it runs some "first-time" initialization scripts. You can connect mouse to board and browse ICS UI.