Android am389x build procedure

From Texas Instruments Wiki
Jump to: navigation, search

TIBanner.png
Content is no longer maintained and is being kept for reference only!



Build procedure document for Android on AM389x

Content is no longer maintained and is being kept for reference only!



Android on AM389xEVM Guide - Nov 10, 2010

Requirements

This section describes the list of Software and Hardware requirements to set-up Android on AM389x.

  • Hardware Requirements:

This build set-up is verified is evaluated on the below given list of platforms. This package should be easily portable on other platforms on similar TI devices.

TI Device Platform Supported Version Other Accessories
AM389x AM389x EVM Rev B TV/Monitor with HD component capability, USB Keyboard, USB Mouse, Ethernet, UART Cable, Audio Speakers, MMC/SD Card (2GB min), am389xevm processor fan


  • Software Requirements:

If you are a Android application developer or would like to use Android SDK Tools then refer to http://developer.android.com/sdk/requirements.html for Host PC requirements.

To evaluate this release we recommend you to have a Linux "Ubuntu 8.04 or above" Host machine, See Ubuntu Linux installation notes

Build requirements at HOST machine

  • Refer to arowboat.org for software requirements at host side
  • Installing the repo tool:
  $ curl http://android.git.kernel.org/repo > ~/bin/repo
  $ chmod a+x ~/bin/repo

Hardware Setup

  • AM389xEVM with a processor fan and a 12V/5.0A Power Supply.
  • BOOT/CFG(SW3 switch), configured for MMC booting as shown below:


Switch
1 2 3 4 5 6 7 8 9 10
State
ON ON ON OFF ON OFF OFF OFF OFF OFF


  • A network cable and working ethernet connection for NFS mount and/or for tftpboot.
  • A USB mouse and keyboard for input.
  • TV with HD component output capability connected to AM389xEVM board through component out and Audio output(3.5mm jack) device connected to HP out(P2).

Software versions used in this release

Configuring the HOST build environment

  • Exporting top level Android root directory where Rowboat-Froyo sources are cloned.
  $ export ANDROID_ROOT=~/rowboat-android
  • Adding Android and code-sourcery toolchain in the default PATH.
  Note: code-sourcery arm-2010q1 toolchain is used to build u-boot.bin and MLO.
  $ export PATH=$ANDROID_ROOT/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:<code_sourcery_toolchain_installed_path>/arm-2010q1/bin:$PATH
  • Exporting SysLink and IPC directories.
  $ export SYSLINK_ROOT=$ANDROID_ROOT/hardware/ti/am389x/syslink/syslink_02_00_00_56_alpha2/
  $ export IPCDIR=$ANDROID_ROOT/hardware/ti/am389x/syslink/ipc_1_22_00_10_eng/packages
  • Exporting the Rootfs directory which can be used as a NFS share as well.
  $ export NFS_ROOT=$ANDROID_ROOT/out/target/product/am389xevm/android_rootfs
  • Exporting the u-boot source directory.
  $ export UBOOT=~/u-boot-04.00.00.07

Downloading the AM389xEVM Android Froyo(Rowboat) sources

  $ mkdir $ANDROID_ROOT
  $ cd $ANDROID_ROOT
  $ ~/bin/repo init -u git://gitorious.org/rowboat/manifest.git -m rowboat-froyo-am389x.xml
  $ ~/bin/repo sync

Building AM389xEVM Android Froyo(Rowboat) rootfs

  $ cd $ANDROID_ROOT
  $ make TARGET_PRODUCT=am389xevm

Installing the rootfs to the NFS share

  $ mkdir $NFS_ROOT
  $ cp -rf $ANDROID_ROOT/out/target/product/am389xevm/root/* $NFS_ROOT
  $ cp -rf $ANDROID_ROOT/out/target/product/am389xevm/system $NFS_ROOT
  $ cp -rf $ANDROID_ROOT/device/ti/am389xevm/syslink $NFS_ROOT/system/bin

Building MLO and u-boot with MMC/SD support

  • Building MLO:
  $ cd $UBOOT
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_min_sd
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti
  $ cp u-boot.min.sd MLO
  • Building u-boot:
  $ cd $UBOOT
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_config
  $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti

Building AM389xEVM kernel

  $ cd $ANDROID_ROOT/kernel
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- clean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- ti8168_evm_android_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage

Building and installing the SysLink

  • Building the SysLink module:
  $ cd $ANDROID_ROOT/hardware/ti/am389x
  $ tar xjf syslink_vpss.tar.bz2
  $ cd $SYSLINK_ROOT/ti/syslink/utils/hlos/knl/Linux
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX clean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX
  • Building the SysLink user library:
  $ cd $SYSLINK_ROOT/ti/syslink/utils/hlos/usr/Linux
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX clean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX
  • Building the ProcMgr binary:
  $ cd $SYSLINK_ROOT/ti/syslink/samples/hlos/procMgr/usr/Linux
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX clean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- SYSLINK_PLATFORM=TI81XX
  • Installing the SysLink module, ProcMgr and M3 firware to the Rootfs:
  $ cp $SYSLINK_ROOT/ti/syslink/utils/hlos/knl/Linux/syslink.ko $SYSLINK_ROOT/ti/syslink/lib/samples/procmgrapp.exe \
       $ANDROID_ROOT/hardware/ti/am389x/ti816x_hdvpss/ti816x_hdvpss.xem3 $NFS_ROOT/system/bin/syslink/

Building and installing VPSS/TI816xFB

  • Building VPSS/TI816xFB and other kernel modules:
  $ cd $ANDROID_ROOT/kernel
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- KBUILD_EXTRA_SYMBOLS=$SYSLINK_ROOT/ti/syslink/utils/hlos/knl/Linux/Module.symvers modules
  • Installing vpss/ti816xfb modules to the Rootfs:
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- INSTALL_MOD_PATH=$NFS_ROOT/system/ \
    KBUILD_EXTRA_SYMBOLS=$SYSLINK_ROOT/ti/syslink/utils/hlos/knl/Linux/Module.symvers modules_install
  • Default output channel for fb0 is HDMI. To change it to HDCOMP set 'hdcomp_out=1' in $NFSROOT/system/bin/syslink/rc.syslink

Install the Android Graphics SGX SDK on Host Machine

Untar AM389x_Android_SGX_SDK.tar.gz to some suitable location.

After extracting following directory structure should be seen.

  root@android-pc:~/AM389x_Android_SGX_SDK# ls
  ANDROID_RN_3_01_00_03.pdf       GFX_Linux_SDK           
  gfx_rel_es5.x_android           Makefile.KM.Android
  ANDROID_RN_3_01_00_03.txt       gfx_rel_es2.x_android   initrc.patch
  Rules.make                      GFX_Linux_KM            gfx_rel_es3.x_android  
  Makefile                        uninstall::

Edit Rules.make to configure the SGX source build

1) #set home area HOME (relative location for all SDK operations) HOME=INVALIDVAL

2) #Current Directory where Graphics SDK is installed GRAPHICS_INSTALL_DIR=$(HOME)/AM389x_Android_SGX_SDK

3) #Path of Android Root FS ANDROID_ROOT=$(HOME)/INVALIDVAL

4) #set toolchain root path for arm-eabi CSTOOL_DIR=INVALIDVAL

5) #set the kernel installation path KERNEL_INSTALL_DIR=$(HOME)/INVALIDVAL

Example:

  HOME=/home/user
  GRAPHICS_INSTALL_DIR=$(HOME)/AM389x_Android_SGX_SDK
  ANDROID_ROOT=$(HOME)/rowboat-android/out/target/product/am389xevm/android_rootfs
  CSTOOL_DIR=$(HOME)/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/
  KERNEL_INSTALL_DIR=$(HOME)/rowboat-android/kernel

Build the Kernel Module sources

Execute the make command in the sources directory

  root@android-pc:~/AM389x_Android_SGX_SDK# make

Will display:

copying the sgx kernel modules to appropriate folder...

Install the SGX drivers in Target filesystem

Install the SGX drivers in the root filesystem built

  root@android-pc:~/AM389x_Android_SGX_SDK# make install OMAPES=5.x


Packaging the rootfs

  $ cd $ANDROID_ROOT/out/target/product/am389xevm
  $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

Preparing the MMC card

Use the mk-mmc utility provided in TI_Android_DevKit 02_00_00 release to populate the SD Card. This utility helps users create a MMC/SD Card with required Images to boot Android on any given TI platform.

  • Execute the following command:
   Example:
    
   $ ./mkmmc-android /dev/sdc $UBOOT/MLO $UBOOT/u-boot.bin $ANDROID_ROOT/kernel/arch/arm/boot/uImage boot.scr $NFS_ROOT/../rootfs.tar.bz2

   This populates the SD/MMC card with all the images.
  NOTE:
    
    To create the boot.scr boot script use the mkbootscr tool found in the same package. You can set the bootargs as mentioned in the next section.

YAFFS2 rootfs image on NAND

Do not try this at the moment, Use MMC/NFS boot instead

  • Copy the rootfs.tar.bz2 file-system created above to the rootfs partition of MMC/SD card.
   host$ sudo cp $NFS_ROOT/../rootfs.tar.bz2 <mount_point>/rootfs
  • Now boot the device from MMC by setting the MMC/SD bootargs from the next section.
  • Run the following commands from target board
  • Determine the MTD device for the file system partition of you Flash device
   target# cat /proc/mtd

You should see output similar to:

   target# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00260000 00020000 "U-Boot"
   mtd1: 00020000 00020000 "U-Boot Env"
   mtd2: 00440000 00020000 "Kernel"
   mtd3: 0c820000 00020000 "File System"
   mtd4: 03120000 00020000 "Reserved"

The file system partition of the flash device is /dev/mtd/mtd3

  • Erase the file system partition
   target# flash_eraseall /dev/mtd/mtd3

You should see output similar to:

   target# flash_eraseall /dev/mtd/mtd3
   Erasing 16 Kibyte @ 3b9c000 -- 99 % complete.
  • Mount the Flash file system partition using the block device node on a temporary directory /tempd.
   target# mkdir /tempd

NOTE: For small block NAND devices (i.e. DM6446) you must mount the file system as a YAFFS file system. For large block NAND devices (i.e. DM355/AM389X) the file system should be mounted as YAFFS2. Using the wrong version of YAFFS will result in error messages similar to:

   target# mount -t yaffs2 /dev/block/mtdblock3 /tempd
   yaffs: dev is 32505859 name is "mtdblock3"
   yaffs: Attempting MTD mount on 31.3, "mtdblock3"
   yaffs: MTD device does not support have the right page sizes
   mount: wrong fs type, bad option, bad superblock on /dev/mtdblock3,
          or too many mounted file systems
  • Untar the contents of the tarball file system image to the Flash device
   target# cd /tempd
   target# date MMDDhhmmCCYY (this is month,day,hour,minute,century,year format.  i.e. for May 22 10:15 2008 this would be "date 052210152008")
   target# busybox tar xjf /rootfs.tar.gz

NOTE: The date command is used to avoid warnings about time differences

  • Unmount the Flash file system partition
   target# cd /
   target# umount /tempd
  • Now the target is ready to mount the rootfs from NAND.

Setting the Bootargs

  • For NFS boot:
  $ setenv bootargs 'mem=166M@0x80000000 mem=768M@0x90000000 console=ttyS2,115200n8 androidboot.console=ttyS2 noinitrd init=/init rw vram=50M ip=dhcp root=/dev/nfs nfsroot=<nfs_root_ip_address>:<nfs_root_path>,nolock'
  • For MMC boot:
  $ setenv bootargs 'mem=166M@0x80000000 mem=768M@0x90000000 console=ttyS2,115200n8 androidboot.console=ttyS2 noinitrd init=/init rw vram=50M ip=dhcp root=/dev/mmcblk0p2 rootfstype=ext3'
  • For NAND boot:
  $ setenv bootargs 'mem=166M@0x80000000 mem=768M@0x90000000 console=ttyS2,115200n8 noinitrd rw root=/dev/mtdblock3 rootfstype=yaffs2 rootwait ip=dhcp init=/init androidboot.console=ttyS2'

Known Issues

  • Video overlays are not supported in this release.
  • Audio recording is working but playback from Audio Recorder application is not working. Recordings can be played from Music application.
  • USB Mouse/Keyboard have hot-plug issues. *Sometimes* they don't work on hot-plug.
  • USB OTG is not supported.
  • Composite, SVideo and RGB display output is not supported in this release.