Remove All Ads from XDA

[GUIDE]Compile CM7 AOSP (Kanged edition) For Speedy on Linux

10,048 posts
Thanks Meter: 8,874
Post Reply Email Thread
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.

Hardware Requirements:

- 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
NOTE: 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
- Python
Alternatively open the terminal application and type
$ sudo app-get install python
Note: Enter your login password to install
- awk and gawk
- 7zip
$ sudo apt-get install rar
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

NOTE: On Ubuntu 11.10, and variants, you need to enable the
parter repository to install sun-java6-jdk:
$ sudo add-apt-repository "deb maverick partner"
$ java -version
The correct version is:

java -version
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)
You must have a 1.6.x to compile on the gingerbread branch of cyanogenmod. 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

$ sudo nautilus
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

#JavaDev PATH
export JAVA_HOME=/usr/lib/jvm/java-6-sun-
export PATH=$PATH:$JAVA_HOME/bin
Save the file and exit, then changes will not take effect until reboot
Verify java version again
$ java -version
Step 2 - Install git
$ sudo apt-get install git
Step 3 - Prepare the Build Environment

NOTE: You only need to do these steps the first time you build.
If you previously prepared your build environment, skip to Copy
proprietary files.

3a - Install the ADB
Install the Android SDK.

3b - Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit 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
For 64-bit only systems:
$ 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 > ~/bin/repo
$ chmod a+x ~/bin/repo
NOTE: 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:// -b gingerbread --repo-url=git://
$ repo sync
3e - Copy proprietary files

NOTE: 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

NOTE: 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:
$ ~/android/system/vendor/cyanogen/get-rommanager
3g - Building CyanogenMod

Check for updates
First, check for updates in the source:
$ cd ~/android/system/
$ repo sync
$ cp build/core/ -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.

export ARCH=arm
export PATH=$PATH:~/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
3i - Configure Build & Compile
Now, the environment must be configured to build and the ROM
compiled, from code, for the Speedy.
$ . build/ && brunch speedy
3j - Install

Copy your .zip file from
~/android/system/out/target/product/speedy/ 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.
The Following 8 Users Say Thank You to sparksco For This Useful Post: [ View ] Gift sparksco Ad-Free
18th May 2011, 03:29 PM |#2  
riggsandroid's Avatar
Senior Member
Thanks Meter: 423
Nice write up. When I have time I'll see if it works for me.
The Following User Says Thank You to riggsandroid For This Useful Post: [ View ] Gift riggsandroid Ad-Free
18th May 2011, 11:23 PM |#3  
sparksco's Avatar
OP Inactive Recognized Developer
Thanks Meter: 8,874
Donate to Me
Originally Posted by riggsandroid

Nice write up. When I have time I'll see if it works for me.

Yeah this was a quick write up. The main thing is you have to reboot every time you edit your .bashrc, or copy and paste it into terminal

Also I'll be doing a how to compile kernel, hopefully soon
18th May 2011, 11:58 PM |#4  
danaff37's Avatar
Senior Member
Flag Saint Petersburg, FL
Thanks Meter: 899
Or just when you change your bashrc, just source the bashrc script

. ~/.bashrc

Sent from my PG06100 using XDA App
19th May 2011, 05:33 AM |#5  
sparksco's Avatar
OP Inactive Recognized Developer
Thanks Meter: 8,874
Donate to Me
Has anyone tried a swap file yet? I just set mine up and it seems to speed compiling up quite a bit. I went off of this guide but I made mine 1.6GB in size
19th May 2011, 05:41 AM |#6  
drob311's Avatar
Senior Member
Flag Fond du Lac, WI
Thanks Meter: 984
You are a savior... I have been trying to get this running on my natty tower, but have had little success... This write up will be very handy... Thank you for the excellent write up and the time for doing it...

Sent from my PG06100 using Tapatalk
21st May 2011, 05:53 AM |#7  
sparksco's Avatar
OP Inactive Recognized Developer
Thanks Meter: 8,874
Donate to Me
New java update?
I noticed that my java was not all the way up to date. I went into recovery and selected fix broken packages and then it updated my java to this version:

~$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)

On a side note it also updated my python and some other things. Make sure you have internet that is not wifi
14th October 2011, 06:38 AM |#8  
sparksco's Avatar
OP Inactive Recognized Developer
Thanks Meter: 8,874
Donate to Me
guide updated for korg workaround. Changes are labeled in red
8th November 2011, 06:55 PM |#9  
Senior Member
Flag Detroit, MI
Thanks Meter: 33
Question Repo not found?
Followed Directions to the T, Currently Hung up on
$ repo init -u git:// -b gingerbread --repo-url=git://
Tells me repo command not Found

EDIT: I'm sorry hows about more info?, Ubuntu 11.10 64bit need anymore just ask
8th November 2011, 07:14 PM |#10  
VICODAN's Avatar
Senior Member
Flag San Jose, CA
Thanks Meter: 476
Donate to Me
Nice guide. Can I do this on Fedora?
9th November 2011, 12:51 AM |#11  
jesusice's Avatar
Senior Member
Thanks Meter: 1,040
Originally Posted by riggsandroid

Nice write up. When I have time I'll see if it works for me.

...6 months later.

Ya find any of that time yet, Riggs?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes