Get Involved
From Android on HTC
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/usernamemkdir androidcd 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- or you could use one of the clones of the repository, listed on the side of the page at http://gitorious.org/linux-on-qualcomm-s-msm/linux-msm
- this step will take a long time depending on your Internet connection. Total size at time of writing was just under 300MB
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-msmgit 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/androidmkdir modulescd moduleswget http://files.androidonhtc.com/files/makkonen/ti.tar.gz -O - | tar xzvwget 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/androidwget 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
- First build takes a long time so be patient and hopefully nothing breaks
[edit] Building kernel For Vogue, Kaiser, and Polaris
This guide is based off the one at the XDA Developers Wiki.
[edit] Building the Kernel
- Create android-kernel directory in your home
mkdir ~/android-kernel- cd ~/android-kernel
- 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.bz2tar xjf arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2export PATH=~/android-kernel/arm-2010.09/bin:$PATH
- Obtain the kernel source from the git repository (this takes a while)
git clone git://git.linuxtogo.org/home/groups/mobile-linux/kernel.git
- Switch to the htc-vogue branch
cd kernelgit checkout -b htc-vogue origin/htc-vogue
- In the future, to update your local copy after git commits, simply cd to the kernel directory and run
git pull
- Prepare .config file by choosing the output targets
make vogue_defconfig ARCH=arm; make menuconfig
- Compile the kernel
make zImage ARCH=arm CROSS_COMPILE=arm-none-eabi-
[edit] Building the Android System Environment
- (Necessary to compile the RIL, etc.)
- Follow the instructions at http://source.android.com/download
- Install any necessary tools
- Install repo, initialize, and sync
- Enter your android directory and 'make'
- Wait
- Setup environment
- Enter the top-level directory of your Android source
- Use the following command to run the environment setup script:
. build/envsetup.sh - Set the TOP variable with
export TOP=$PWD
- Compile your modules, etc.
- Enter the directory with your component, and run
mmto build - Files will be compiled to your Android directory, in out/target/product/generic/...
- Enter the directory with your component, and run