Get Involved

From Android on HTC

Jump to:navigation, search

Want to help out with porting Android to HTC devices? Here are some great resources to get you started!

Contents

[edit] Communication

Visit the IRC channel #htc-linux on Freenode or visit the Kaiser or Polaris development threads on XDA-Developers or visit the Vogue android page hosted by dzo. Submit bugs in a bug report.

[edit] Prerequisites

You'll need a linux build environment. Ubuntu is assumed in this guide. Running it from a virtual machine is an easy way to do it without disturbing your main running system. Virtualbox is a powerful free virtual machine environment. When creating a VM with Virtualbox, err on the side of making the Virtual Hard Drive larger than necessary. It can be set not to take up space until it is needed; however, if it is set too small, it is problematic to expand it past the initial limit. 8-10GB is a good minimum if you're just compiling the kernel; 20GB if you also plan to build Android system files.

If you are running a Debian/Ubuntu based distribution, you can simply run the following command in a Terminal to download and install all the necessary prerequisites: sudo apt-get install git-core git jfsutils xfsprogs quota isdnutils-base nfs-common oprofile Not all of these are necessary, but they shouldn't hurt.

If you are running another distribution, you'll need to find out the equivalent packages and download/install them. Git is the most important.

[edit] Building kernel for Diamond, Raphael, Blackstone, Topaz, and Rhodium

First step is to create a directory where you are going to hold all the source code and build tools. This will help keep things organized on your system and help you understand what exactly is involved and required. My suggestion is to create a directory within your home user directory called “android”. For purposes of this tutorial, I will be using the generic name of “username” to refer to whatever your linux username is (replace as necessary). Perform the following to create the directory and move inside it:

cd /home/username
mkdir android
cd android

[edit] Obtain the ARM Toolchain

An easy place to store the toolchain would be within the “android” folder you have created. Download and extract the ARM toolchain by performing the following:

wget http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -O - | tar xjv
  • This might take a long time depending on your Internet connection. Total size is around 77MB

Next step is to now add the ARM toolchain to your path. Use the following to add the bin directory to the path:

export PATH=$PATH:/home/username/android/arm-2008q3/bin

[edit] Obtain the Kernel

Now its time to clone the source branch from the repository at gitorious.org. This is the combined package for Diamond, Raphael, Blackstone, Rhodium and Topaz phones (also has preliminary support for some other devices). Use the following command to grab the main branch of linux-msm and place it in the directory "/home/username/android/linux-msm":

git clone git://gitorious.org/linux-on-qualcomm-s-msm/linux-msm.git

Next it is good to first check that the right branch is selected and checked out. Use the following commands to check this:

cd linux-msm
git status
  • It should say "# On branch htc-msm-2.6.27 / nothing to commit (working directory clean)"

If this does not show, you will need to perform the following:

git checkout -b htc-msm-2.6.27 origin/htc-msm-2.6.27
  • if you get an error that says "fatal: git checkout: branch htc-msm-2.6.27 already exists", just ignore - it means you've already got the correct branch

[edit] Obtain the Modules

Again, for organization, we’ll place these modules in their own directory within the "android" directory we have created. Use the following commands to get both the compcache and tiwlan modules:

cd /home/username/android
mkdir modules
cd modules
wget http://files.androidonhtc.com/files/makkonen/ti.tar.gz -O - | tar xzv
wget http://compcache.googlecode.com/files/compcache-0.5.4.tar.gz -O - | tar xzv

[edit] Compile the Kernel and Modules

First, download the build.sh script to the android directory:

cd /home/username/android
wget http://files.androidonhtc.com/files/makkonen/build.sh

Next, you’ll need to edit the file and include all the correct directories. The following would be the settings based on this tutorial:

KERNEL_PATH=/home/username/android/linux-msm
TOOLCHAIN_PATH=/home/username/android/arm-2008q3/bin/arm-none-linux-gnueabi-
MODULES_PATH=/home/username/android/modules
OUTPUT_PATH=/home/username/android/compiled-builds
Set DEVTYPE to reflect your phone model (for nice naming of output directory)

You now need to save and exit the build.sh file Finally set the build.sh file to be executable with the following command:

chmod u+x build.sh

Execute the script with the following command:

./build.sh


[edit] Building kernel For Vogue, Kaiser, and Polaris

This guide is based off the one at the XDA Developers Wiki.

[edit] Building the Kernel

  1. Create android-kernel directory in your home
    mkdir ~/android-kernel
    cd ~/android-kernel
  2. Obtain the ARM toolchain
    wget http://www.codesourcery.com/sgpp/lite/arm/portal/package7813/public/arm-none-eabi/arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 -O arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
    tar xjf arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
    export PATH=~/android-kernel/arm-2010.09/bin:$PATH
  3. Obtain the kernel source from the git repository (this takes a while)
    git clone git://git.linuxtogo.org/home/groups/mobile-linux/kernel.git
  4. Switch to the htc-vogue branch
    cd kernel
    git checkout -b htc-vogue origin/htc-vogue
    1. In the future, to update your local copy after git commits, simply cd to the kernel directory and run git pull
  5. Prepare .config file by choosing the output targets
    make vogue_defconfig ARCH=arm; make menuconfig
  6. Compile the kernel
    make zImage ARCH=arm CROSS_COMPILE=arm-none-eabi-

[edit] Building the Android System Environment

  1. Follow the instructions at http://source.android.com/download
    1. Install any necessary tools
    2. Install repo, initialize, and sync
    3. Enter your android directory and 'make'
    4. Wait
  1. Setup environment
    1. Enter the top-level directory of your Android source
    2. Use the following command to run the environment setup script: . build/envsetup.sh
    3. Set the TOP variable with export TOP=$PWD
  1. Compile your modules, etc.
    1. Enter the directory with your component, and run mm to build
    2. Files will be compiled to your Android directory, in out/target/product/generic/...
Navigation
Toolbox