TI-Android-JB-4.2.2-DevKit-4.1.1 DeveloperGuide

From Texas Instruments Wiki
Jump to: navigation, search

TIBanner.png

Contents

TI Android JB-4.2.2-DevKit-4.1.1 Developer Guide

Developer Guide - June, 2013

About this manual

The objective of this document is to guide developers to get access to Android JellyBean DevKit release sources for TI's AM335x platforms, setting up host environment for compilation and enabling debug environment to ease the application development, debugging and deployment.

This document contains instructions to:

  • Hardware and Software requirements
  • Setup the hardware
  • Setup the toolchain
  • Download & Build the source
  • Set up the Android debugger with the hardware platform
  • Install and execute Android applications

Hardware Requirements

This release of TI Android JB 4.2.2 DevKit 4.1.1 is evaluated on the platforms listed below. This package should be easily portable on other platforms with similar TI devices.


TI Device Platform Supported Version Other Accessories
AM335x AM335x Evaluation Module Rev 1.2 or greater USB HUB, USB Keyboard, USB Mouse, Ethernet, UART Cable, Audio Speakers, MMC/SD Card (2GB min)
AM335x BeagleBone Rev A3, A4, A5,A6 (expected to work) USB HUB, USB Keyboard, USB Mouse, Ethernet, Mini-B USB Cable, MMC/SD Card (2GB min). Also tested with beaglebone cape for DVI-D and LCD.
AM335x AM335x Starter Kit Rev 1.2b or 1.2c Micro-USB cable, Ethernet cable, Audio Speakers, micro-SD Card (2GB min), USB Keyboard, USB Mouse, USB Camera Module
AM335x BeagleBone Black Rev A5 (A5A verified, A5B and A5C expected to work) USB HUB, USB Keyboard, USB Mouse, Serial Cable - standard FTDI to TTL cable, Ethernet, Mini-B USB Cable, MMC/SD Card (2GB min), micro HDMI cable, HDMI display with 720p. Also tested with beaglebone LCD7 cape, LCD4 and LCD3 cape.


IMPORTANT

Ensure that the Wireless daughter card (COM6) is installed on the AM335x EVM before trying the wireless features. More information about this card is available at the WL127x COM daughter card web page
NOTE

This DevKit release does not support wireless (Wi-Fi and Bluetooth) on BeagleBone Black and BeagleBone

Host (PC) setup requirements

If you are an Android application developer and would like to use Android SDK Tools then refer to Android SDK Requirements for Host PC requirements.

The host development environment for Android is based on 64-bit Ubuntu, please install Ubuntu version 10.04 or later http://www.ubuntu.com/desktop/get-ubuntu/download.

IMPORTANT

This DevKit Release does not support 32-bit build host. Only 64-bit hosts are supported

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

For 64-bit Ubuntu 10.04

The following command installs the required packages for setting up the android build host:

  $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils xsltproc minicom tftpd uboot-mkimage expect

For 64-bit Ubuntu 12.04

The following command installs the required packages for setting up the android build host:

  $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
  minicom tftpd uboot-mkimage expect libgl1-mesa-dri
  $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Install Oracle JDK 6

  1. Download the latest JDK 6 installer from Oracle http://www.oracle.com/technetwork/java/javase/downloads/index.html.
    Accept the license agreement and click on the Linux x64 bin installer. The downloaded file will be named jdk-6uXX-linux-x64.bin where XX is the JDK 6 update version.
  2. Follow the following steps to install JDK 6
  $ chmod a+x jdk-6uXX-linux-x64.bin
  $ ./jdk-6uXX-linux-x64.bin
  $ sudo mkdir -p /usr/lib/jvm
  $ sudo mv jdk1.6.0_XX /usr/lib/jvm/
  $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_XX/bin/java" 1
  $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_XX/bin/javac" 1
  $ sudo update-alternatives --config java
  $ sudo update-alternatives --config javac
Set Oracle JDK as default java/javac path

NOTE:

  1. Android Jelly Bean (4.2.2) needs Oracle JDK 6.
  2. The Hard Disk should have at least 30 GigaBytes of free space to complete the building of sources.
  3. Please refer to the AOSP documentation for latest information and instructions for setting up other Ubuntu versions http://source.android.com/source/initializing.html

Getting Source & Toolchain

TI provides Android sources for all the supported devices in multiple locations, developers can download the sources from the rowboat repository or use the pre-packaged sources in the DevKit.

Using Rowboat repository(Gitorious)

A tool called Repo helps to fetch the android sources from gitorious.org/rowboat. Repo is a tool that makes it easier to work with Git in the context of Android.
For more information about Repo, see Android Version Control.
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
  $ export PATH=~/bin:$PATH

Download the Repo script and ensure it is executable:

  $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/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://gitorious.org/rowboat/manifest.git -m TI-Android-JB-4.2.2-DevKit-4.1.1.xml
  $ repo sync

TIP

You can update to latest sources later if you download the sources from rowboat gitorious repository, For this replace TI-Android-JB-4.2.2-DevKit-4.1.1.xml with rowboat-jb.xml in the "repo init" step above

Using Pre-Packaged Sources

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

Download the pre-packaged DevKit sources from TI_Android_JB_4.2.2_DevKit_4.1.1.bin.

NOTE:The following steps assume that you have copied TI_Android_JB_4.2.2_DevKit_4.1.1.bin to $HOME

Run following commands to extract the pre-packaged source:

  $ cd $HOME
  $ chmod a+x TI_Android_JB_4.2.2_DevKit_4.1.1.bin
  $ ./TI_Android_JB_4.2.2_DevKit_4.1.1.bin

NOTE: Press space to read through the license file

  • When the installer prompts, accept the license by typing 'I ACCEPT at the prompt and pressing Enter.
  • This will generate following sources
    • Android File system : $HOME/TI_Android_JB_4.2.2_DevKit_4.1.1/
    • Android Linux Kernel: $HOME/TI_Android_JB_4.2.2_DevKit_4.1.1/kernel
    • Bootloader  : $HOME/TI_Android_JB_4.2.2_DevKit_4.1.1/u-boot
    • Toolchain location will be at $HOME/TI_Android_JB_4.2.2_DevKit_4.1.1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin

Toolchain setup

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

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

Build Procedure

To create an SD card image from the fresh android source in single step, execute the following command

$ cd <android source path>
$ make TARGET_PRODUCT=<product-name> OMAPES=4.x -j<N> sdcard_build
Where <product-name> is:
  • am335xevm for AM335x EVM
  • am335xevm_sk for AM335x Starter Kit
  • beaglebone for BeagleBone
  • beagleboneblack for Beaglebone Black
NOTE: *<N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4

This command will build boot loader, kernel and filesystem with SGX for the specified product name. The SD card image directory named <product-name> will be created inside out/target/product/<product-name>. After this, you can jump to section Flashing android images to SD/MMC card directly.

To build the components one by one separately, follow the sections below.

To Build Bootloader

  • 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- am335x_evm_config
$ make CROSS_COMPILE=arm-eabi- 
  • This command will generate MLO and the u-boot Image u-boot.img

NOTE: The above command will work for AM335x EVM, AM335x Starter Kit, BeagleBone and BeagleBone Black.

Alternatively you can build boot loader from top level directory itself, using the command

$ cd <android source path>
$ make TARGET_PRODUCT=<> OMAPES=4.x u-boot_build

This command will generate MLO and the u-boot Image u-boot.img in u-boot folder

To Build Android Linux Kernel

  • Change directory to kernel
$ cd <android source path>/kernel
  • Execute following commands
$ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-eabi- am335x_evm_android_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage

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

NOTE: Generated uImage can be run on AM335xevm, AM335x Starter Kit, BeagleBone and BeagleBone Black.

Alternatively you can build boot loader from top level directory itself, using the command

$ cd <android source path>
$ make TARGET_PRODUCT=<> OMAPES=4.x kernel_build

Any of the Filesystem build instructions in the below section will also generate the kernel image in kernel/arch/arm/boot folder.

To Build Android Filesystem

Ensure that you switch to the top directory of the Android sources in case you are not already there.

$ cd <android source path>

Filesystem with SGX

  • To Build the root filesystem for AM335x EVM, AM335x Starter Kit and BeagleBone
$ make TARGET_PRODUCT=<product-name> OMAPES=4.x -j<N>
Where <product-name> is:
  • am335xevm for AM335x EVM
  • am335xevm_sk for AM335x Starter Kit
  • beaglebone for BeagleBone
  • beagleboneblack for Beaglebone Black

e.g: To build the full filesystem for AM335x EVM:

$ make TARGET_PRODUCT=am335xevm OMAPES=4.x -j4

NOTE:

  • <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 filesystem, kernel, <product_name> related modules,
  • Drivers and modules for SGX and WLAN will be built and installed in android rootfs for AM335x EVM and AM335x Starter Kit
  • Android rootfs components (root and system directories) will be located in out/target/product/<product-name>.

Filesystem without SGX

  • If filesystem is already built with SGX, then the projects need to be cleaned using the following command:
$ make TARGET_PRODUCT=<product-name> clean
Where <product-name> is:
  • am335xevm for AM335x EVM
  • am335xevm_sk for AM335x Starter Kit
  • beaglebone for BeagleBone
  • beagleboneblack for Beaglebone Black
To build the root file system for AM335x without SGX accelerated graphics support

By default, the android system is built with HardwareRenderer feature. This feature assumes GPU is present and make use of GPU features on android boot. The line "USE_OPENGL_RENDERER := true" needs to be changed to "USE_OPENGL_RENDERER := false" in device/ti/<prduct-name>/BoardConfig.mk to build the android filesystem without HardwareRenderer.

Invoke the following commands for different product names.

  • AM335x EVM
$ make TARGET_PRODUCT=am335xevm droid kernel_build wl12xx_compat  -j<N> 
  • AM335x Starter Kit
$ make TARGET_PRODUCT=am335xevm_sk droid kernel_build wl12xx_compat  -j<N> 
  • BeagleBone
$ make TARGET_PRODUCT=beaglebone droid kernel_build  -j<N> 
  • BeagleBone black
$ make TARGET_PRODUCT=beagleboneblack droid kernel_build  -j<N> 

NOTE:

  • <N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4
  • droid will build basic Android filesystem
  • kernel_build will build the kernel
  • wl12xx_compat will build and install WLAN drivers into Android filesystem (for AM335x EVM and AM335x Starter Kit only)
  • The kernel image can be found at kernel/arch/arm/boot/uImage.
  • Android rootfs components (root and system folders) will be located in out/target/product/<product-name>.
NOTE

BeagleBone doesn't have WLAN support.
IMPORTANT

Applications which depends on OpenGLES 2.0 APIs (e.g. Gallery) would not work correctly without SGX libraries

TIP

Live Wallpapers depends on OPENGLES2.0 APIs and will not load if SGX is not enabled. Change to Static wallpaper after booting. Or disable Live wallpaper from device/ti/<product-name>/overlay

To build with TI WL18xx support

This DevKit release provides WL127x (COM6) support in the default build for AM335x EVM.

To evaluate TI WL18xx (COM8) wireless daughter card with the AM335x EVM, perform the following steps:

  • Ensure that you have clean setup to avoid conflicts with WL127x
$ make TARGET_PRODUCT=am335xevm OMAPES=4.x rowboat_clean

Configure kernel for WL18xx

Enable the following the kernel config file kernel/arch/arm/configs/am335x_evm_android_defconfig

CONFIG_MACH_AM335XEVM_WILINK8=y

Configure Android filesystem build for WL18xx

  • Now enter the following commands to build android filesystem with WL18xx support
$ make TARGET_PRODUCT=am335xevm OMAPES=4.x WILINK=wl18xx

This commands rebuilds the android filesystem and kernel with support for WL18xx.

Now, you can proceed with generating the filesystem tarball and populating the sdcard.

Create root filesystem tarball

NOTE

Make sure that the android filesystem build is completed without any errors before creating the tarball

The root filesystem tarball can be created in two ways.

1. Run the following command:

$ make TARGET_PRODUCT=<product name> fs_tarball</code>

2. To create the tarball manually, perform the following steps:

$ cd out/target/product/<product-name>
$ mkdir android_rootfs
$ cp -r root/* android_rootfs
$ cp -r system android_rootfs
$ ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2
Where <product-name> is:
  • am335xevm for AM335x EVM
  • am335xevm_sk for AM335x Starter Kit
  • beaglebone for BeagleBone
  • beagleboneblack for BeagleBone Black

rootfs.tar.bz2 is the Android filesystem, it can be put on a SD/MMC Card.

RowboPERF Integration

  • Download the sources from rowboat inside the android source path.
 $ cd <android-source-patch>
 $ git clone git://gitorious.org/rowboat/rowboperf.git
 $ cd rowboperf
 $ git reset --hard origin/rowboat-jb
  • Refer the instructions in the README file for building and installing rowboperf components.
  • Refer to RowboPERF User Guide to know more about dependency, build procedure and how to run applications.

Generate SD/MMC card IMAGE to boot Android

Configure Boot Arguments

The boot script (uEnv.txt) helps the board to boot automatically (Provided the NAND environment is empty).

  • Create a boot script file named uEnv.txt file with following content:
File: uEnv.txt
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
uenvcmd=boot


NOTE: The uEnv.txt can be edited to update bootargs and bootcmd. Especially mem field can be changed to 512M for BeagleBone Black and AM335XEVM PG2.0/PG1.0. For AM335XEVM PG2.1 board, mem=1G can be provided. Alternatively the file uEnv_<product-name>.txt present inside external/ti_android_utilities/am335x/u-boot-env/ folder can also copied as uEnv.txt.

Creating SD Card image folder

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/<product-name>/rootfs.tar.bz2 image_folder
$ cp Media_Clips image_folder
Where <product-name> is:
  • am335xevm for AM335x EVM
  • am335xevm_sk for AM335x Starter Kit
  • beaglebone for BeagleBone
  • beaglebone for BeagleBone

NOTE: Media_clips folder is available in the SD card prebuilt images

  • Copy the SDMMC card creation script
  $ cp <android-sources>/external/ti_android_utilities/am335x/mk-mmc/mkmmc-android.sh image_folder
  • mkmmc-android.sh is available at external/ti_android_utilities/am335x directory in the DevKit sources.

Flashing android images to SD/MMC card

Connect an SD or micro SD card to the host machine.

NOTE

Minimum 2GB SD card is needed

If you have built the android components separately, go to the image_folder and invoke mkmmc_android.sh script

$ cd image_folder
$ sudo ./mkmmc-android.sh /dev/sd<sd card mount-point> MLO u-boot.img uImage uEnv.txt rootfs.tar.bz2 Media_Clips

NOTE:

  • All the Images, Audio and Video can be put into Media_Clips directory and can be provided as an argument to the above script.

If you have built the android components with the single command , go to the out/target/product/<product-name>/<product-name> folder and invoke mkmmc_android.sh script

$ cd out/target/product/<product-name>/<product-name>
$ sudo ./mkmmc-android.sh /dev/sd<sd card mount-point>

1

Preparing to boot Android over NFS

Android filesystem can be mounted over network. Follow the procedure explained below:

  • Build NFS bootable tarball
  $ make TARGET_PRODUCT=<product-name> nfs_tarball
The tarball will be created at <android-devkit>/out/target/product/<product-name>/nfs-rootfs.tar.bz2
  • Create NFS mountable filesystem on host
  $ mkdir /home/workdir/Android_nfs
  $ cd /home/workdir/Android_nfs
  $ tar -xjvf ~/nfs-rootfs.tar.bz2
  • Export filesystem using NFS

Edit /etc/exports file and add following line

  /home/workdir/Android_nfs *(rw,sync,no_subtree_check,no_root_squash)
  • Run exportfs command
  $ sudo exportfs -a
  • Restart the NFS server

Run the following command to restart NFS server

  On Ubuntu 10.04 machine:
  $ sudo service nfs-kernel-server restart

Boot arguements Network Filesystem

Below are the complete bootargs for AM335xEVM and Beaglebone black using NFS:

 setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=512M root=/dev/nfs nfsroot=<server-ip>:/home/workdir/Android_nfs rw rootwait init=/init ip=dhcp'

Template:SpNote: Set mem=256M in above bootargs for Beaglebone and AM335xEVM SK

Booting the Platform

Here are the instructions to boot the prepared SD card on the two platforms:

AM335x Starter Kit

  • Connect USB cable to the micro-USB port(J3) on AM335x Starter Kit to the Host PC and have a Terminal software like TeraTerm, Minicom or Hyperterminal.
  • Connect the Ethernet (J6 or J7).
  • Connect USB Host port (J5) to USB Keyboard or USB Mouse. (Optional)
    • You can connect USB keyboard and USB Mouse to the USB HUB for use with AM335x Starter Kit.
  • Insert Micro SD card into MMC/SD slot (J4).
  • Power ON AM335x Starter Kit by connecting power cable to (J9) and pressing PWRON button (SW5) for a few seconds.

AM335x EVM

  • Connect the UART port (J12 of base board) on AM335x EVM to the Host PC and have a Terminal software like TeraTerm, Minicom or Hyperterminal.
    • Baud rate settings: 115200 8-N-1
  • Connect the Ethernet (J15 of base board) on AM335x EVM.
  • Connect Audio Speakers (J26 on daughter card) on AM335x EVM.
  • Connect Audio Line-In cable (J27 on daughter card) on AM335x EVM.
  • Connect USB Host port (USB1) (J18 on base board) on AM335x EVM to USB Keyboard or USB Mouse.
  • Select Appropriate DIP Switch settings on AM335x EVM to boot over MMC/SD
    • For MMC/SD boot the DIP switch SW3 SYSBOOT 0-7 should be set as shown below:

AM335x EVM SD boot mode setting

Switch
1
2
3
4
5
6
7
8
State
OFF
OFF
OFF
ON
OFF
ON
ON
ON
  • Insert SD card into MMC/SD slot on AM335x EVM.
  • Connect power cable to J1 on AM335x EVM.
  • Switch ON the Power Switch (SW13) on AM335x EVM.

BeagleBone

  • Connect USB cable to the mini-USB port(P3) on BeagleBone to the Host PC and have a Terminal software like TeraTerm, Minicom or Hyperterminal.
  • Connect the Ethernet (P10) on BeagleBone.
  • Connect USB Host port (P2) on BeagleBone to USB Keyboard or USB Mouse.
    • Connect USB keyboard and USB Mouse to the USB HUB for use with BeagleBone.
  • Insert Micro SD card into MMC/SD slot on the BeagleBone.
  • Power ON the BeagleBone by connecting power cable to (P5).

BeagleBone Black

  • Connect USB cable to the mini-USB port(P3) on BeagleBone Black to the Host PC
  • Connect Serial to FTDI cable to (J1) and have a Terminal software like TeraTerm, Minicom or Hyperterminal.
  • Connect the Ethernet (P10) on BeagleBone Black.
  • Connect USB Host port (P2) on BeagleBone Black to USB Keyboard or USB Mouse.
    • Connect USB keyboard and USB Mouse to the USB HUB for use with BeagleBone Black.
  • Connect HDMI port to a HDMI display using micro HDMI cable
  • Insert Micro SD card into MMC/SD slot on the BeagleBone.
  • Power ON the BeagleBone by connecting power cable to (P5).

Getting serial console on AM335x Starter Kit and BeagleBone

Serial console is provided via usb cable connection between the device and the Host. To establish a connection the serial console enter the following commands on the linux console after powering on the device:

$ sudo modprobe ftdi_sio vendor=0x0403 product=0xa6d0
$ minicom -D /dev/`dmesg | grep FTDI | grep "now attached to" | tail -n 1 | awk '{ print $NF }'` 

For detailed instructions on setting up the serial console refer BeagleBone-Android-DevKit Guide


To exercise various Android DevKit features refer to:

  1. TI-Android-JB-4.2.2-DevKit-4.1.1 UserGuide
  2. RowboPERF User Guide

Android Display through VNC

Setup Ethernet and VNC server on BeagleBone

If you use BeagleBone without any LCD-cape you can use VNC connection from the Host to the BeagleBone. Here are the steps to establish VNC connection between the BeagleBone to the Host PC

Make sure Ethernet port on board and host machine are connected to the network. Check Ethernet configuration for the board

  # netcfg
  lo UP 127.0.0.1 255.0.0.0 0x00000049
  eth0 DOWN 0.0.0.0 0.0.0.0 0x00001002

Once Ethernet is up, VNC server service can be started.

  # start androidvncserver

Connecting to target from Host

Using VNC Viewer application user can connect to the Beagleboane at the target address [say 172.24.191.37] port 5901.

Boot Logs


BootLogs AM335x EVM BeagleBone BeagleBone Black
AM335x Starter Kit
Kernel Boot Log BootLog-am335xevm.pdf BootLog-BeagleBone.pdf BootLog-BeagleBone-Black.pdf BootLog-EVM-SK.pdf
Logcat Log LogCat-am335xevm.pdf LogCat-BeagleBone.pdf LogCat-BeagleBone-Black.pdf LogCat-EVM-SK.pdf


Application Development and Debugging

Using TI's Code Composer Studio V5 (Eclipse based)

Code Composer Studio (CCS) is the integrated development environment for TI's DSPs, microcontrollers and application processors based on the Eclipse open source software framework which includes a suite of tools used to develop and debug embedded applications. Since CCS is based on Eclipse, it is possible to integrate the Android Development Tools (ADT) like Android Debug Bridge (ADB), Dalvik Debug Monitoring System (DDMS) and ndk-gdb in CCS to enable the debugging of Android Applications directly on Android Device (i.e TI EVM) along with the inherent CCS capability of Linux Aware Debug and DSP Debugging.

This wiki walks you through installation of Android Debugging Tools in CCS, connecting CCS with Android Device and illustrates a debugging session of an HelloWorld Application based on android NDK having a mix of Java and Native C Code.

Preparing CCS for Android Development

The steps below are condensed version of steps mentioned on http://developer.android.com/sdk/installing.html

Installing the ADT Plugin in CCS

NOTE: Eclipse Juno repository need to enabled for the installation above to complete. Help -> Install New Software .. -> Available Software Sites -> Enable http://download.eclipse.org/releases/juno/

Refer http://developer.android.com/sdk/eclipse-adt.html#installing

Android ADT plugin installation will guide you through installing SDK platforms/ required tools. CCSv5 will create android-sdks/ directory in specified directory(home directory by default).

Adding SDK Platforms and Other Components

  1. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory
  2. On Linux, run '<SDK>tools/android'
  3. Proxy Settings (If needed): Go to Settings and set the Proxy to work with your network
  4. To download components, use the graphical UI of the Android SDK and AVD Manager, shown in Figure below, to browse the SDK repository and select new or updated components. The Android SDK and AVD Manager will install the selected components in your SDK environment. Refer the list of Recommended Components: http://developer.android.com/sdk/installing.html#which

Android-sdk-manager.png

  1. To Install the Terminal (similar to Teraterm) in CCS, please follow the steps mentioned in the wiki: http://processors.wiki.ti.com/index.php/How_to_install_the_terminal_plugin_in_CCSv5
  2. For more information regarding CCSv5 and ADT plugin setup please refer CCSv5SetupGuide

Debugging Android with CCS

Hello World Application on Android Virtual Device (AVD)

  1. Hello World Using CCSv5
  2. Android Hello World

Hello-jni of Android NDK on Android Device

  • In CCS:
  1. Click File > New Android Project...
  2. Select the Create project from existing source radio button.
  3. Select any API level above Android 1.5.
  4. In the Location field, click Browse... and select the <ndk-root>/samples/hello-jni directory.
  5. Click Finish.
  6. Go to C/C++ Perspective. Click File->New->Convert to C/C++ Project
  • Edit jni/Android.mk and add the following line before BUILD_SHARED_LIBRARY: APP_CFLAGS := -g. This will add debugging symbols in to your native C code.
  • Compile the native code using the ndk-build command from cmd prompt:
  cd <ndk-root>/samples/hello-jni
  <ndk_root>/ndk-build
  • In CCS, create a debug configuration for a C/C++ application:
    • Create a new debug configuration for a C/C++ application. Click Run->Debug Configurations.
    • Set the process launcher to “Standard Create Process Launcher”
    • On “Main” tab, set:
      C/C++ Application: android-ndk-r5-windows\android-ndk-r5\samples\hello-jni\obj\local\armeabi\app_process
      Select Disable auto build
    • On “Debugger” tab, set:
      • Debugger: gdbserver
      • Stop on startup at: Java_com_example_hellojni_HelloJni_stringFromJNI (It is the entry function of the native C code)
      • Main Tab:
        • GDB debugger: android-ndk-r5-windows\android-ndk-r5\toolchains\arm-eabi-4.4.0\prebuilt\windows\bin\arm-eabi-gdb.exe
        • GDB command file: android-ndk-r5-windows\android-ndk-r5\samples\hello-jni\libs\armeabi\gdb.setup
        • GDB command set: Standard
        • Protocol: mi
        • Select only Verbose console mode
      • Connection Tab:
        • Type: TCP
        • Host name or IP address: localhost
        • Port number: 5039
  • Open the ndk-gdb script that came with the android NDK and comment the last line (we are not calling the usual gdb client, but we will attach an Eclipse gdb session instead)
  # $GDBCLIENT -x $GDBSETUP -e $APP_PROCESS
  • Only For Windows: Run dos2unix.exe on ndk-gdb from cygwin after editing to make sure that we do not have any unwanted dos symbols in the script
  • Starting Java Debugger:
    • Make sure you are in Java Perspective.
    • Click Run->Debug Configurations.
    • Place a breakpoint in Java code just before the native code call
    • Select Android Debug Configuration instance “HelloJni” and click “Debug”
    • It will prompt you to switch and open to CCS Debug Perspective. Select “yes”
  • Starting GDB Debugger:
    • In cygwin, make sure that the root of android-ndk is in PATH.
    • In cygwin, Go to /android-ndk-r5-windows/android-ndk-r5/samples/hello-jni and execute the following and wait until you get a prompt again:
  ndk-gdb –adb=<PATH_TO_android-sdk-windows/platform_tools/adb.exe>
sample command: $ ndk-gdb --adb=/cygdrive/c/PROGRA~1/Android/android-sdk-windows/platform-tools/adb.exe
    • CCS, go to C/C++ Perspective and click Run->“Debug”. This will launch the gdbserver in CCS Debug Perspective.
    • Now, you can seamlessly debug between Java and Native C code

Using ADB Android Debugger, Downloader

Android Debug Bridge (adb) is a versatile tool lets you manage the state of the Android-powered device. For more information about what is possible with adb, see Android Debug Bridge page at http://developer.android.com/guide/developing/tools/adb.html. The ADB tool can be used to

  • Download an application from a host machine, install & run it on the target board.
  • Start a remote shell in the target instance.
  • Debug applications running on the device using the debugging tool DDMS ( Dalvik Debug Monitor Server) which runs on top of adb connection.
  • Copy files to and from the board to host machine

Downloading "ADB" & Host setup

The adb tool is a part of Android SDK package located at http://developer.android.com/sdk/index.html. For an overview of how to install and set up the Android SDK, follow download & setup instructions from http://developer.android.com/sdk/index.html. Once you install Android SDK, the directory contents look like this.

  .
  |-- SDK Readme.txt
  |-- add-ons
  |-- google-market_licensing
  |-- platform-tools
  |   |-- NOTICE.txt
  |   |-- aapt
  |   |-- adb
  |   |-- aidl
  |   |-- dexdump
  |   |-- dx
  |   |-- lib
  |   `-- source.properties
  |-- platforms
  |-- temp
  `-- tools
      |-- NOTICE.txt
      |-- adb_has_moved.txt
      |-- android
      |-- ant
      |-- apkbuilder
      |-- ddms
      |-- dmtracedump
      |-- draw9patch
      |-- emulator
      |-- etc1tool
      |-- hierarchyviewer
      |-- hprof-conv
      |-- layoutopt
      |-- lib
      |-- mksdcard
      |-- monkeyrunner
      |-- proguard
      |-- source.properties
      |-- sqlite3
      |-- traceview
      `-- zipalign

Make sure you have installed the platform-tools component using the tools/android in linux.

The adb tool is located in paltform-tools/ directory under the Android SDK installation. Export the platform-tools and tools directory path as shown below.

  $ export PATH=<android_sdk_path>/platform-tools/:<android_sdk_path>/tools/:$PATH

Connecting Host machine to board through adb

This release of DevKit has been tested for three different methods of connecting a given board with host machine

  • adb over USB
  • adb over USB Ethernet
  • adb over Ethernet

The below sections describe each of these methods and provides necessary instructions for the same.

adb over USB

  • Make sure that the mini-usb cable is connected between the host usb port and the target’s USB OTG port
  • Turn on "USB Debugging" on your board. On the board (UI screen)-
    • Go to home screen, press MENU,
    • Select Applications, select Development, then enable USB debugging.
    • Alternatively, you can navigate to Settings->Applications->Development and then enable the "USB debugging" option.
  • Setup host machine to detect the board. On Ubuntu Linux host machines this is done by adding a rules file to configure device vendor ID of on-board OMAP device.
  • For the EVMs and Boards covered here, the vendor ID is "18d1".
    • Log in as root and create this file: /etc/udev/rules.d/51-android.rules
    For Gusty/Hardy, edit the file to read:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0451", MODE="0666"
  • Execute the following to change the user mode for the rules file.
    $ chmod a+r /etc/udev/rules.d/51-android.rules
  • Verify the adb connectivity between host and target board
    $ adb devices 

If device is connected, then output on screen should list the device, example:

       List of devices attached
       0123456789ABCDEF    device

adb over Ethernet

  • Make sure Ethernet port on board and host machine are connected to the network
  • Check Ethernet configuration for the board
  # netcfg                                                                        
  lo       UP    127.0.0.1       255.0.0.0       0x00000049                       
  eth0     UP    172.24.190.59   255.255.252.0   0x00001043                       
  • If Ethernet was not configured, configure Ethernet of the board using ifconfig/netcfg as shown below.
  # netcfg eth0 dhcp
  • Configure the ADB Daemon to use an ethernet connection using setprop as shown below.
  # setprop service.adb.tcp.port 5555
  • If network is configured successfully (above steps) then Restart service adbd on the target,
  # stop adbd
  # start adbd
  • On the host machine use following commands to establish adb connection
  $ export ADBHOST=<target's ip address>
  $ adb kill-server
  $ adb start-server
  $ adb connect <target_ip_address>:5555
  • Verify for device connectivity, by executing the following commands
    • If connected, find the device name listed as a "emulator"
  $ adb devices
    List of devices attached
    emulator-5554    device
  $ adb shell 

For more information about adb commands, see Android Debug Bridge page at http://developer.android.com/guide/developing/tools/adb.html

adb over USB on Windows Machine

Follow the below instructions to get ADB over USB work on a Windows PC

  • Download latest Android SDK

(http://developer.android.com/sdk/index.html) and uncompress it in a local folder (i.e. c:\android_sdk).

  • Download platform-tools component with the SDK Manager.exe app present in the android sdk top level directory.
  • Optionally, you may want to add the location of the SDK's platform-tools directory to your system Path. Right-click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path (under System Variables). Add the full path to the platform-tools\ directory to the path, using ";" separator.
  • Download Android USB Driver

(https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip) and uncompress it in a local folder (i.e. c:\android_sdk\usb_driver)

  • Edit (or create and then edit if it doesn't already exist) file in

"%USERPROFILE%\.android\adb_usb.ini":

  > echo 0x18D1 > "%USERPROFILE%\.android\adb_usb.ini"
  • Edit android_winusb.inf to match EVM/Beagle vendor and product ids:

Under [Google.NTx86] section add:

  ;TI EVM
  %SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_D002
  %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_D002&MI_01
  ;

NOTE: Be careful to add it under Google.NTx86 and not under Google.NTamd64 unless your machine is 64 bits. If you skip this step you won't be able to later install the driver as windows will reject it.

  • Boot the board as normal and wait until shell prompt is available (micro-B or mini-B USB cable must be disconnected).
  • Connect micro-B or mini-B USB cable between board and Windows PC.
  • If it is proceeding as planned, Windows will tell you it found a new hardware asks you to install the driver.
  • If windows does not ask, go to Computer-> Manage->Device Manager - > Universal Serial Bus controllers
    • Find the USB composite device with Hardware Id 0x18D1
    • For Beaglebone or Beaglebone black the device will be listed as BEAGLEBONE or BEAGLEBONEBLACK
    • Click on update driver -> Point to the android usb_driver location
  • Install driver that was downloaded as described in step 3 above:

Answer "No, not this time" to the question about running Windows Update to search for software.

    • Choose "Install the hardware that I manually select from a list (Advanced)" this is the 2nd option, then click "Next"
    • Select "Show All Devices", then click "Next"
    • You are going to see a grayed-out text box with "(Retrieving a list of all devices)", click the "Have Disk..." button
    • Browse" to your driver folder (c:\android_sdk\usb_driver). It will be looking of a .inf file so select "android_winusb.inf" and click "Open" then "OK". It's the only file there so you shouldn't go wrong.
    • Select "Android ADB Interface" then click the "Next" button.
    • A warning will appear, answer "Yes" but read the warning anyway.
    • Click the "Close" when the wizard is completed.
  • Disconnect and reconnect micro-B USB cable from Board(probably reboot it as well).
  • Open command prompt and restart adb server just to make sure it is in a proper state:
  > adb kill-server
  > adb start-server
  • List the attached devices with "adb devices". It should show your board/device with a random number.
  • Type "adb shell". You should see the "#" indicating it works.

Operations over ADB

The Root File System provided in this DevKit release contain only standard Android components and applications.

To install and run Android application follow steps mentioned below:

Installing (.apk files) application on Target Platform

  • From the host: You can use adb tool for package installation.
  $ adb install <package>.apk. 

NOTE: Use -s option with the adb tool, to install the package on external storage.

On successful installation adb tool will report SUCCESS on host terminal, and the application would be listed on the android main menu.

Un-installing applications (.apk) using adb

  • To un-install non-default components (that were installed later)
    • Method 1: On the host machine execute the following
  $ adb shell pm list packages
  $ adb uninstall <package name>
  • Method 2: On target:

Main menu -> Menu -> Settings -> Applications -> Manage applications -> Find the package Tap on it -> Uninstall -> OK -> OK

  • On successful removal, the application would have been removed from the android main menu. All the short-cuts to the application also removed.
  • To un-install default components, use the following commands from abd on host machine
  $ adb shell
  # rm /system/app/app.apk

On successful removal, the application would have been removed from the android main menu.

Copy any files to and from the board over ADB

  • Using the adb commands "pull" and "push" copy files to and from the board.
  • Unlike the install command, which only copies an .apk file to a specific location, the pull and push commands let you copy arbitrary directories and files to any location on the board.
  • To copy a file or directory (recursively) from the board, use
  $ adb pull <remote> <local>
  • To copy a file or directory (recursively) to the board, use
  $ adb push <local> <remote>

In the commands, <local> and <remote> refer to the paths to the file or directory on your development host (local) and on the target instance (remote).

  Here's an example: 
  $ adb push foo.txt /sdcard/foo.txt

Setup ADB for application Debugging

ADB and Eclipse, with ADT( Android Development Tools plug-in) allow users to create and debug Android applications. Follow Developing In Eclipse, with ADT at http://developer.android.com/guide/developing/eclipse-adt.html

Steps to connect Eclipse to the board.

  • Setup the adb connection with the board by following the instructions given above in connecting board ...
    Verify the connectivity by executing 
    $ adb devices
  • Open Eclipse IDE. Eclipse, with ADT plugin enable users to
    • Create an android project.
    • Build and Run the project on a connected board.
    • Debug the project using the Debug perspective.
    • Use DDMS (Dalvik Debug Monitor Server) to monitor the connected board.

For more detailed and complete information on the above follow Developing In Eclipse, with ADT at http://developer.android.com/guide/developing/eclipse-adt.html

  • Open DDMS(Dalvik Debug Monitor Server) perspective. This DDMS perspective can be opened from the eclipse menu via:
    Window -> Open Perspective -> Other -> DDMS; 
    Click on OK
  • DDMS provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information,incoming call and SMS spoofing, location data spoofing, and more.

Fastboot

The fastboot protocol is a mechanism for communicating with bootloaders over USB. It is designed to flash Android build images(x-loader, bootloader, kernel, system, userdata etc) on to the target device.

Fastboot is implemented in u-boot. TI-Android-JB-4.2.2-DevKit-4.1.1 release fastboot implementation supports NAND and eMMC/SD flashing.

Fastboot and NAND

UBIFS filesystem is used as Android rootfs for NAND. This section provides necessary steps to create UBIFS filesystem image and instructions to flash boot images (SPL, u-boot, kernel and root-filesystem (UBIFS image)). Here the assumption is that TI Android DevKit sources for AM335x EVM has been compiled successfully before trying out these instructions.

U-boot Configuration

To configure fastboot for NAND flashing, make sure that CONFIG_FASTBOOT_NAND is defined in u-boot/include/configs/am335x_evm.h file before building u-boot source.

Creating UBIFS Images

  • Extract the built rootfs.tar.bz2 file with sudo permission:
   $ sudo tar -xjvf <path-to-rootfs.tar.bz2>/rootfs.tar.bz2

Important extract with sudo permissions, otherwise you may face issues with booting of Android.

  • Install the following packages, required for building mtd-utils:
   $ sudo apt-get install uuid-dev libacl1-dev liblzo2-dev zlibc zlib1g-dev
   $ git clone git://git.infradead.org/mtd-utils.git
   $ cd mtd-utils/
   $ git checkout v1.5.0
   $ make

Important Tested with the "v1.5.0" tagged version of mtd-utils.

  • Creating ubifs image:
   $ sudo mkfs.ubifs/mkfs.ubifs -r <path-to-rootfs>/ -F -m 2048 -e 126976 -c 1580 -o ubifs.img
  • Create/Edit ubinize.cfg:
   $ vim ubinize.cfg
   [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=192MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize
  • Creating ubi.img to be flashed:
   $ sudo ubi-utils/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg

For more details on ubifs http://processors.wiki.ti.com/index.php/UBIFS_Support

Important Use either Fastboot to flash ubi.img over System partition of NAND or do it manually from u-boot prompt.


Establishing Fastboot Connectivity

Setup on Device
  • Connect serial port to host PC via null modem cable.
  • Serial port settings: 115200 8N1, No flow control.
  • Connect USB cable between USB OTG port of the board and host PC.
Setup on Linux Host
  • On command prompt, run
   $ export ANDROID_ROOT=<rowboat top level directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
   $ sudo ./fastboot devices

if a device number is echoed, fastboot is working.

Fastboot Commands

   $ export ANDROID_ROOT=<rowboat_top_level_build_directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
  • List connected devices:
   $ sudo ./fastboot devices
  
  • Populate NAND partition table
   $ sudo ./fastboot oem format
  • Update spl (MLO):
   $ sudo ./fastboot flash spl <spl_binary_path>/MLO
   
  • Updating u-boot:
   $ sudo ./fastboot flash uboot <uboot_binary_path>/u-boot.img
  
  • Updating kernel:
   $ sudo ./fastboot flash kernel <kernel_image_path>/uImage
  
  • Updating filesystem:
   $ sudo ./fastboot flash filesystem <rootfs_image_path>/ubi.img
  
  • Erasing partition:
   $ sudo ./fastboot erase <partition name> (eg. spl)
  • Display fastboot variable:
   $ sudo ./fastboot getvar <variable>

Booting with UBIFS rootfs

  • Set the bootarguments from u-boot prompt.
   # setenv nandboot 'echo Booting from nand ...; nandecc hw 2 ; nand read ${loadaddr} ${boot_nand_offset} ${boot_nand_size}; bootm ${loadaddr}'
   # setenv bootcmd 'run nandboot'
   # setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=ubi0:rootfs rootfstype=ubifs ubi.mtd=7,2048 rw rootwait init=/init ip=off'

For example the boot arguments for the AM335x EVM, will look like:

   # setenv nandboot 'echo Booting from nand ... ; nandecc hw 2 ; nand read 0x81000000 0x00280000 0x00500000 ; bootm 0x81000000;'
   # setenv bootcmd 'run nandboot'   
   # setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=ubi0:rootfs rootfstype=ubifs ubi.mtd=7,2048 rw rootwait init=/init ip=off'

Fastboot and eMMC

This section provides necessary steps to create boot eMMC boot images and provides nstructions to flash boot images Here the assumption is that TI Android DevKit sources for AM335x EVM has been compiled successfully before trying out these instructions.

U-boot Configuration

To configure fastboot for eMMC/SD flashing, make sure that CONFIG_FASTBOOT_NAND is not defined, CONFIG_STORAGE_EMMC is defined and CONFIG_MMC_FASTBOOT_DEV is set to appropriate MMC slot number on which eMMC is connected in u-boot/include/configs/am335x_evm.h file before building u-boot source.

  /* For BeagleBone Black */
  #define CONFIG_MMC_FASTBOOT_DEV 1
U-boot Build
  • Build u-boot (both MLO and u-boot.img)
$make CROSS_COMPILE=arm-eabi- distclean
$make CROSS_COMPILE=arm-eabi- am335x_evm_config
$make CROSS_COMPILE=arm-eabi-

The above commands will generate MLO and u-boot.img files.

  • Append eMMC raw header to MLO
    • Download eMMC raw header here (right click and "save link as").
$dd if=<eMMC_raw_header> of=./MLO.final
$dd if=<MLO-Path>/MLO of=./MLO.final conv=notrunc oflag=append

Creating Boot Images

boot.img
$mkdir <YOUR_PATH>/images
$cd <YOUR_PATH>/images
$cp <ANDROID_SOURCE>/kernel/arch/arm/boot/zImage .
  • Update fstab.am335xevm ile and rebuild images
  • Add following lines to <ANDROID_SOURCE>/device/ti/<TARGET_PRODUCT>/fstab.am335xevm

/dev/block/mmcblk0p6 /system ext4 ro wait
/dev/block/mmcblk0p7 /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait
/dev/block/mmcblk0p8 /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait

NOTE

For Beaglebone black: if you insert a SD card in SD card slot and boot from internal eMMC, eMMC device will be detected as mmcblk1. If you are booting with SD card inserted, replace mmcblk0 with mmcblk1 in above lines.
  • Rebuild images
$cd <ANDROID_SOURCE>
$find out/target/product/am335xevm -name *.img -exec rm -f {} \;
$make TARGET_PRODUCT=am335xevm OMAPES=4.x
  • Prepare boot.img
$cd <YOUR_PATH>/images
$cp <ANDROID_SOURCE>/out/target/product/am335xevm/ramdisk.img .
$cp <ANDROID_SOURCE>/out/host/linux-x86/bin/mkbootimg .
$./mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x80000000 --cmdline "console=ttyO0,115200n8 androidboot.console=ttyO0 mem=512M root=/dev/ram0 rw initramfs=0x81000000,8M init=/init ip=off" -o boot.img
system.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./system.img bs=1M count=192
$mkfs.ext4 system.img
$mkdir mnt-point
$sudo mount -t ext4 -o loop system.img mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/system/* mnt-point/
$sudo umount mnt-point
userdata.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./userdata.img bs=1M count=192
$mkfs.ext4 userdata.img
$sudo mount -t ext4 -o loop userdata.img mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/data/* mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/root/data/* mnt-point/
$sudo umount mnt-point
cache.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./cache.img bs=1M count=192
$mkfs.ext4 cache.img

Establishing Fastboot Connectivity

Setup on Device
  • Connect serial port to host PC via null modem cable.
  • Serial port settings: 115200 8N1, No flow control.
  • Connect USB cable between USB OTG port of the board and host PC.
  • Boot up the board with persistent(Nand, SD/MMC, etc) or non persistent storage (Ethernet, usb, uart, etc). Please refer to http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#Boot_Modes for more details.
  • Press any key in serial port utility during boot and get U-boot command prompt.
  • Run "fastboot" on u-boot command prompt (u-boot will echo "fastboot initialized").
Setup on Linux Host
  • On command prompt, run
   $ export ANDROID_ROOT=<rowboat top level directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
   $ sudo ./fastboot devices

if a device number is echoed, fastboot is working.

Fastboot Commands

Run following commands on host machine to flash Android boot images.

/* locate fastboot in android filesystem */
$cd <ANDROID_SOURCE>/out/host/linux-x86/bin/

/* search for fastboot devices */
$./fastboot devices

/* create GPT table on eMMC/SD card */
$./fastboot oem format

/* flash all partitions: ./fastboot flash <name> <binary> */

/* flash SPL */
$./fastboot flash spl <YOUR_PATH>/images/MLO.final

/* flash bootloader */
$./fastboot flash bootloader <YOUR_PATH>/images/u-boot.img

/* flash boot image */
$./fastboot flash boot <YOUR_PATH>/images/boot.img

/* flash file system - system image */
$./fastboot flash system <YOUR_PATH>/images/system.img

/* flash user data */
$./fastboot flash userdata <YOUR_PATH>/images/userdata.img

/* flash cache partition */
$./fastboot flash cache <YOUR_PATH>/images/cache.img

/* reboot target */
$./fastboot reboot

Remove Wireless support

This DevKit release supports wireless (WL127x COM6) module on AM335xEVM and AM335xEVM SK boards. To remove wireless support from AM335xEVM sources, make sure that following entries are removed.

  • Disable building of TI version of wpa_supplicant 0.8.x and Bluetooth in your BoardConfig.mk
Repository: <Android source>/device/ti/am335xevm

diff --git a/BoardConfig.mk b/BoardConfig.mk
index 03f2de1..16a2901 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -29,8 +29,7 @@ ARCH_ARM_HAVE_TLS_REGISTER := true
 
 TARGET_NO_KERNEL := true
 
-BOARD_HAVE_BLUETOOTH := true
-BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/ti/am335xevm/bluetooth
+BOARD_HAVE_BLUETOOTH := false
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_RECOVERY := true
 
@@ -51,25 +50,3 @@ BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_FLASH_BLOCK_SIZE := 4096
 
 #TARGET_PROVIDES_INIT_RC := true
-
-# Connectivity - Wi-Fi
-USES_TI_MAC80211 := true
-ifdef USES_TI_MAC80211
-BOARD_WPA_SUPPLICANT_DRIVER      := NL80211
-BOARD_HOSTAPD_DRIVER             := NL80211
-BOARD_WLAN_DEVICE                := wl12xx_mac80211
-BOARD_SOFTAP_DEVICE              := wl12xx_mac80211
-WPA_SUPPLICANT_VERSION           := VER_0_8_X_TI
-
-ifeq ($(WILINK), wl18xx)
-WIFI_DRIVER_MODULE_PATH          := "/system/lib/modules/wlcore_sdio.ko"
-WIFI_DRIVER_MODULE_NAME          := "wlcore_sdio"
-else
-WIFI_DRIVER_MODULE_PATH          := "/system/lib/modules/wl12xx_sdio.ko"
-WIFI_DRIVER_MODULE_NAME          := "wl12xx_sdio"
-endif
-
-WIFI_FIRMWARE_LOADER             := ""
-COMMON_GLOBAL_CFLAGS += -DUSES_TI_MAC80211
-endif
-
  • Remove WLAN and Bluetooth related modules and services from init.am335xevm.rc file
Repository: <Android source>/device/ti/am335xevm

diff --git a/init.am335xevm.rc b/init.am335xevm.rc
index 66a00aa..8bbd614 100644
--- a/init.am335xevm.rc
+++ b/init.am335xevm.rc
@@ -44,16 +44,6 @@ on boot
 # Default Read Ahead value for sdcards
     write /sys/block/mmcblk0/queue/read_ahead_kb 2048
 
-# wi-fi
-    mkdir /data/misc/wifi/sockets 0770 wifi wifi
-    mkdir /data/misc/dhcp 0770 dhcp dhcp
-    insmod /system/lib/modules/compat.ko
-    insmod /system/lib/modules/cfg80211.ko
-    insmod /system/lib/modules/mac80211.ko
-    insmod /system/lib/modules/wlcore.ko
-    insmod /system/lib/modules/wl12xx.ko
-    insmod /system/lib/modules/wl18xx.ko
-
 on fs
     mount_all /fstab.am335xevm
 
@@ -95,39 +85,6 @@ service iprenew_eth0 /system/bin/dhcpcd -n
     disabled
     oneshot
 
-#shared transport user space mgr service for Bluetooth, FM and GPS
-service uim /system/bin/uim-sysfs
-    class core
-    user root
-    group bluetooth net_bt_admin
-
-service p2p_supplicant /system/bin/wpa_supplicant \
-	-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \
-	-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
-	-puse_p2p_group_interface=1
-	class main
-	socket wpa_wlan0 dgram 660 wifi wifi
-	disabled
-	oneshot
-
-service wpa_supplicant /system/bin/wpa_supplicant \
-        -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-	-e/data/misc/wifi/entropy.bin
-        class main
-        socket wpa_wlan0 dgram 660 wifi wifi
-        disabled
-        oneshot
-
-service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
-        class main
-        disabled
-        oneshot
-
-service iprenew_wlan0 /system/bin/dhcpcd -n
-        class main
-	disabled
-	oneshot
-
 service dhcpcd_p2p /system/bin/dhcpcd -aABKL
     disabled
     oneshot
@@ -136,11 +93,6 @@ service iprenew_p2p /system/bin/dhcpcd -n
     disabled
     oneshot
 
-service hostapd_bin /system/bin/hostapd -d /data/misc/wifi/hostapd.conf
-    socket wpa_wlan0 dgram 660 wifi wifi
-    disabled
-    oneshot
-
 # virtual sdcard daemon running as media_rw (1023)
 service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
     class late_start

  • Disable Wi-Fi for use by Android network manager.
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index edd5633..78ba8d1 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -111,7 +111,6 @@
          Wifi interfaces.  If the device doesn't want to support tethering over Wifi this
          should be empty.  An example would be "softap.*" -->
     <string-array translatable="false" name="config_tether_wifi_regexs">
-        <item>"wlan0"</item>
     </string-array>
 
     <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
@@ -119,7 +118,6 @@
     <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
    <integer-array translatable="false" name="config_tether_upstream_types">
 	<item>0</item>
-        <item>1</item>
         <item>9</item>
     </integer-array>
 
@@ -135,8 +133,6 @@
     <string-array translatable="false" name="networkAttributes">
         <item>"ethernet,9,9,2,-1,true"</item>
         <item>"mobile,0,0,0,-1,true"</item>
-	<item>"wifi,1,1,1,-1,true"</item>
-        <item>"wifi_p2p,13,1,0,-1,true"</item>
     </string-array>
 
     <!-- This string array should be overridden by the device to present a list of radio
@@ -145,7 +141,6 @@
     <!-- An Array of "[ConnectivityManager connectionType],
                       [# simultaneous connection types]"  -->
     <string-array translatable="false" name="radioAttributes">
-        <item>"1,1"</item>
         <item>"0,1"</item>
         <item>"9,1"</item>
     </string-array>

  • Remove wifi and Bluetooth permission files
diff --git a/device.mk b/device.mk
index f470d42..081b99f 100644
--- a/device.mk
+++ b/device.mk
@@ -26,16 +26,6 @@ PRODUCT_COPY_FILES := \
        device/ti/am335xevm/mixer_paths.xml:system/etc/mixer_paths.xml \
        device/ti/am335xevm/audio_policy.conf:system/etc/audio_policy.conf
 
-# Bluetooth support
-PRODUCT_COPY_FILES += \
-       frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \
-       system/bluetooth/data/main.nonsmartphone.conf:system/etc/bluetooth/main.conf
-
-# WLAN support
-PRODUCT_COPY_FILES +=\
-       frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
-       frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml
-
 # Hardware Features
 PRODUCT_COPY_FILES += \
        frameworks/native/data/etc/android.hardware.touchscreen.xml:system/etc/permissions/android.hardware.touchscreen.xml \

  • Disable WL127x module related kernel configuration.
diff --git a/arch/arm/configs/am335x_evm_android_defconfig b/arch/arm/configs/am335x_evm_android_defconfig
index f3d2b37..0a4e270 100644
--- a/arch/arm/configs/am335x_evm_android_defconfig
+++ b/arch/arm/configs/am335x_evm_android_defconfig
@@ -857,7 +857,6 @@ CONFIG_BT_HCIUART_LL=y
 # CONFIG_BT_HCIBFUSB is not set
 # CONFIG_BT_HCIVHCI is not set
 # CONFIG_BT_MRVL is not set
-CONFIG_BT_WILINK=y
 # CONFIG_AF_RXRPC is not set
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
@@ -900,7 +899,6 @@ CONFIG_RFKILL_INPUT=y
 CONFIG_NFC_DEVICES=y
 # CONFIG_PN544_NFC is not set
 # CONFIG_NFC_PN533 is not set
-CONFIG_ST_NFC=y
 
 #
 # Device Drivers
@@ -1112,8 +1110,7 @@ CONFIG_EEPROM_AT24=y
 #
 # Texas Instruments shared transport line discipline
 #
-CONFIG_TI_ST=y
-CONFIG_ST_HCI=y
+# CONFIG_TI_ST is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
 CONFIG_SENSORS_LIS3_I2C=y

  • After doing all above mentioned modification, perform clean build. Follow procedure mention in Build Procedure section for building source code

Others

How to set media volume?

Main Menu->Settings->Sound->Volume

How to show fps in logcat messages?

To print the FPS in logcat dump, type this command on the console before starting playback:
#setprop debug.video.showfps 1

To disable the prints, type:
#setprop debug.video.showfps 0

How to set longer screen timeout ?

Main Menu->Settings->Display->Screen timeout->30 minutes

Acronyms

  • SDK – Software Development Kit
  • NDK – Native Development Kit (For more information, refer http://developer.android.com/sdk/ndk/overview.html)
  • ADT – Android Development Tools
  • ADB – Android Debug Bridge
  • DDMS – Dalvik Debug Monitoring System
  • AVD – Android Virtual Device

Quick References

Content Link Ref#
User Guide http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_UserGuide
Release Notes http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_ReleaseNotes
Porting Guides http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_PortingGuide
Downloads http://focus.ti.com/docs/toolsw/folders/print/androidsdk-sitara.html

Support

For further information or to report any problems, contact http://e2e.ti.com/android or http://support.ti.com.
For community support join http://groups.google.com/group/rowboat
For IRC #rowboat on irc.freenode.net