Tools for building, running, debugging the Android Kernel (linux-goldfish-2.6.29) on Mac OS X.
C Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Android Kernel Tools

Tools for building, running, debugging the Android Kernel (linux-goldfish-2.6.29) on Mac OS X.


Create a case sensitive drive:

hdutil create -size 1.5g -fs "Case-sensitive HFS+" -volname ECE353 android.dmg

Clone your repository to the drive.

open android.dmg
cd /Volumes/ECE353/

# Using svn
svn co svn+ssh://<grp_#>/svn/trunk android

# Using git-svn
git svn clone -s ssh:// android

Install Xcode from the App Store and install Command Line Tools.

Install Homebrew (

ruby -e "$(curl -fsSL"

Install the android ndk and sdk.

brew install android-sdk
brew install android-ndk


Clone the script to your favourite directory:

git clone

Enable the script as an executable:

chmod +x ./setup

Install the tools:

./setup install

Other possible use cases:

./setup uninstall           # uninstall the tools
./setup install --dryrun    # show what files will be installed
./setup uninstall --dryrun  # show what files will be uninstalled


agcc -- gcc for android userspace executables.

# sample usage:
agcc -o program_name source.c
adb push program_name /data/local/
adb shell /data/local/program_name

agdb -- gdb for android kernel/userspace.

# run for kernel:
agdb --kernel
agdb -k

# run for userspace:
agdb --user program_name
agdb -u program_name

buildandroid -- builds the android kernel


runandroid, runkernel, runuser -- runs the android emulator and debugs (for both user and kernel space)

runandroid -0                   # runs the telnet session continuously
runandroid -0 -v                # runs the telnet session continously with output
runandroid -1                   # builds the android kernel then runs it with a telnet connection
                                # this command also starts an adb shell

runandroid --user program.c     # compiles the userspace program and runs it under agdb
runuser program.c               # same as previous command
runuser --gdb program.c         # runs the user program under agdb

runandroid --kernel             # runs the kernel under agdb
runkernel                       # same as previous command

# sensorsim:
sensorsim 1 2 3   # set the azimuth, pitch and roll for the currently running device

Typical Workflow

  1. Open one terminal window and run runandroid -0. This will start attempting to connect to telnet.
  2. Open second terminal window and run runandroid -1. This will build the android kernel and start an adb shell.
  3. Either runuser program.c or runkernel depending on whether kernel is being tested or userspace program is being tested.


Q: There no available targets for building. A: After performing brew install android-sdk, please install the targets. Specifically version 14 of the sdk.

Q: There are problems immediately after installing. A: Run through the setup steps in lab 2.

Q: You have not configured your kernel... A: You need to run make ARCH=arm goldfish_armv7_defconfig, and configure the kernel as done in lab 2 (see lab 2 guidelines).

Q: Do you have support for XXX tool? A: Probably, update your tools first by doing git pull. If said tools don't exist, make an issue.

Q: A problem about ASENSOR_TYPE_ORIENTATION not found. A: You need to add ASENSOR_TYPE_ORIENTATION = 3 to the sensor.h file. See lab 3 guidelines for details.

Other Resources

See PeterSlawski/ece353-resources for additional help.