Goldfish on Android Emulator

Introduction

This document explains how to download, build and run Goldfish on TI's ARM Cortex A8 based AM37x Beagleboard-XM.

Getting Source Code

  • Host Setup

Java JDK setup

Ubuntu now comes only with OpenJDK which does not work for building the goldfish Android. Please follow the following steps to setup the Sun JDK:

Download the Sun Java JDK from the following link: http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html

You need to download the Linux x64 bin installer. (Not the rpm installer)

Install the JDK into your home using the following commands:

$ cp android-sdk_r20.0.3-linux.tgz to home dir.  
$ tar -zxvf android-sdk_r20.0.3-linux.tgz  
$ cd android-sdk_r20.0.3-linux  
$ chmod a+x jdk-6u33-linux-x64.bin  
$ ./jdk-6u33-linux-x64.bin

If prompted, accept the licence agreement by entering "yes" at the prompt. JDK will be installed to ~/android-sdk_r20.0.3-linux

Add the JDK to your PATH as follows:

$export PATH="$HOME/android-sdk_r20.0.3-linux/bin:$PATH"

Installing Repo

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

Initializing repo Client, After installing repo, set up your client to access the android source repository

Get the Files

$ git clone https://android.googlesource.com/kernel/goldfish  
$ cd goldfish/  
$ git branch -a  
$ git checkout -t origin/android-goldfish-2.6.29 -b goldfish

Compilation Procedure

Toolchain Setup

Download cross-tool chain arm-2012.03-56-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 from code sorcery web site.. $ tar -jxvf 2012.03-56-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

$ export PATH=arm-2012.03/bin:$PATH

Build Kernel

Change directory to kernel

$ cd goldfish  
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- distclean  
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- goldfish_armv7_defconfig  
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage  

This will generate zImage (kernel image) in kernel/arch/arm/boot folder Build Android filesystem

Managing Virtual Devices

An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.

The easiest way to create an AVD is to use the graphical AVD Manager, which you launch from Eclipse by clicking Window > AVD Manager. You can also start the AVD Manager from the command line by calling the android tool with the avd options, from the /tools/ directory.

Android Emulator

We will run the Android Emulator, which comes within the Android SDK

http://developer.android.com/guide/developing/tools/emulator.html

Download Android SDK

http://developer.android.com/sdk/index.html

Install Android SDK

http://developer.android.com/sdk/installing.html

We untar the sdk and add tools directory into the PATH variable:

$ tar xvzf android-sdk_r20.0.3-linux.tgz  
$ export PATH=$PATH:~/android-sdk-linux_86/tools

We are not going to create an android virtual device, but instead we will use an environment variable to indicate where our images are:

$ emulator -help # Shows some help.  
$ export ANDROID_PRODUCT_OUT=/path/to/goldfish/arch/arm/boot/zImage # Env variable showing where our images are.

Run the emulator program:

$ emulator -verbose

if we want more debug information:

$ emulator -show-kernel -verbose

CONNECTING TO THE EMULATOR USING ADB (ANDROID DEBUG BRIDGE) TOOL

adb tool comes within Android SDK.

In a console we execute:

$ adb devices  

It will show available devices in your system: List of devices attached

emulator-5554 device

We can now connect to the device:

$ adb shell

Loading modules in android using ADB bridge

  1. Compile the module hello.c to be inserted using proper cross-tool chain to get .ko file.
  2. Now push hello.ko on to the data dir of emulatorusing cmd push hello.ko /data
  3. run " adb shell" from your terminal to have goldfish terminal.
  4. ismode /data/hello.ko
  5. Acknowledge if module is loaded or not using dmesg
  6. If module insertion is successfull go rmmode again check the dmesg prints...

Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
15 tips to enhance security of your Linux machine
What is the difference between "su" and "su -" in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux
What is virtual memory, paging and swap space?

What is the difference between DNS A record and CNAME record?