[GUIDE]Compile CM7 AOSP (Kanged edition) For Speedy on Linux
Ok so I was searching and searching for a guide on how to compile CM7 source, and finally found a way to do it on the latest Ubuntu 11.10 oneiric
Updated info for non-debian based systems thanks to Vicodan:
If you want to use this on fedora or non-debian based systems you will need to replace every command that says apt-get to yum. Thanks to Vicodan for pointing this out as I do not use fedora myself.
- A minimum dual core pc, the more ram the better
- A working wifi connection
- Linux Operating System. Either 32-bit or 64-bit will work
64-bit will run faster
Optional Recommended Software:
Many of these can be found in the software center using the search box
If you find multiple versions it's ok to install them all, unless it says
Alternatively open the terminal application and type
Note: Enter your login password to install
- awk and gawk
Step 1 java:
Setting up java is one of the most important step to getting your pc prepared for a build environment. First check the java version that is installed on your pc
On Ubuntu 11.10, and variants, you need to enable the
parter repository to install sun-java6-jdk:
$ sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
The correct version is:
You must have a 1.6.x to compile on the gingerbread branch of cyanogenmod.
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
If you have the correct version skip down to Step 2.
1a - First install the correct version:
$ sudo apt-get install sun-java6-jdk sun-java6-jre
1b - Now you will need to manually remove the other java version
This will open up a root file explorer. Once it opens click on the "file
system" tab on the left and navigate to the /usr/lib/jvm
Once there you should see two types of java. If you see java open jdk
you need to delete it, along with it's associated bin folder. Close the
root file explorer window
1c - Edit .bashrc
Next navigate to your home folder and open up the .bashrc file. This is
a hidden file so you will have to press Ctrl + H to see it. Add the
following lines to the top section, and change accordingly to your path
Save the file and exit, then changes will not take effect until reboot
Verify java version again Step 2
- Install git
or Step 3
- Prepare the Build Environment
You only need to do these steps the first time you build.
If you previously prepared your build environment, skip to Copy
3a - Install the ADB
Install the Android SDK. http://wiki.cyanogenmod.com/index.ph...he_Android_SDK
3b - Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit systems:
For 64-bit only systems:
$ sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
$ sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib
3c - Create the Directories
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
3d - Install the Repository
Enter the following to download make executable the "repo" binary:
$ curl https://raw.github.com/android/tools_repo/master/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
You may need to reboot for these changes to take effect.
Now enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u git://github.com/CyanogenMod/android.git -b gingerbread --repo-url=git://github.com/android/tools_repo.git
$ repo sync
3e - Copy proprietary files
This only needs done the first time you build. If you have
already done these steps, you may skip to Download RomManager.
You will need to have a speedy with a working copy of CyanogenMod
install and ADB working on the computer. This script will copy the
proprietary files from the device.
Connect the device to the computer and ensure that ADB is working
$ cd ~/android/system/device/htc/speedy/
3f - Download RomManager
This only needs to be done when an update to
RomManager is released. If you are-up-to date, you may skip to Building
CyanogenMod. Download RomManager which is needed by the build:
3g - Building CyanogenMod
Check for updates
First, check for updates in the source:
$ cd ~/android/system/
$ repo sync
$ cp build/core/root.mk -f Makefile
3h - Set up your Compiler
This is optional but helpful for kernel compiling
There are a lot of things that need to be added to the .bashrc to let your
pc know about which type of compiler you want to use. The best way is
to use the one provided in the CM7 work tree.
3i - Configure Build & Compile
Now, the environment must be configured to build and the ROM
compiled, from code, for the Speedy.
$ . build/envsetup.sh && brunch speedy
3j - Install
Copy your .zip file from
signed.zip to the root of the SD card.
Optional: Download Google Apps for CyanogenMod 7 and place it on the
root of the SD card.
Flash both of these .zip files from recovery.