Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,781,289 Members 36,095 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
sparksco
Old
(Last edited by sparksco; 22nd November 2011 at 05:19 AM.)
#1  
sparksco's Avatar
Recognized Developer - OP
Thanks Meter 7,831
Posts: 8,269
Join Date: Feb 2010

 
DONATE TO ME
Default [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.

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
otherwise
- Python
Alternatively open the terminal application and type
Code:
$ sudo app-get install python
Note: Enter your login password to install
- awk and gawk
- 7zip
- RAR
Code:
$ 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:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Code:
$ java -version
The correct version is:

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

Code:
$ sudo apt-get install sun-java6-jdk sun-java6-jre
1b - Now you will need to manually remove the other java version

Code:
$ 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
Example:

Code:
#JavaDev PATH
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.24
export PATH=$PATH:$JAVA_HOME/bin
Save the file and exit, then changes will not take effect until reboot
Verify java version again
Code:
$ java -version
Step 2 - Install git
http://help.github.com/linux-set-up-git/
or
Code:
$ 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. 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:
Code:
$ 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:
Code:
$ 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:
Code:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
3d - Install the Repository
Enter the following to download make executable the "repo" binary:
Code:
$ curl https://raw.github.com/android/tools_repo/master/repo > ~/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:
Code:
$ 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

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
properly.
Code:
$ cd ~/android/system/device/htc/speedy/
./extract-files.sh
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:
Code:
$ ~/android/system/vendor/cyanogen/get-rommanager
3g - Building CyanogenMod

Check for updates
First, check for updates in the source:
Code:
$ 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.

Code:
#Android
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
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.
Code:
$ . build/envsetup.sh && brunch speedy
3j - Install

Copy your .zip file from
~/android/system/out/target/product/speedy/update.cm-XXXXX-
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.
The Following 8 Users Say Thank You to sparksco For This Useful Post: [ Click to Expand ]
 
riggsandroid
Old
#2  
riggsandroid's Avatar
Senior Member
Thanks Meter 340
Posts: 1,423
Join Date: Mar 2010
Nice write up. When I have time I'll see if it works for me.
| G2 - LS980 | ZVD Stock Rooted |
Toastcfh FTW
The Following User Says Thank You to riggsandroid For This Useful Post: [ Click to Expand ]
 
sparksco
Old
#3  
sparksco's Avatar
Recognized Developer - OP
Thanks Meter 7,831
Posts: 8,269
Join Date: Feb 2010

 
DONATE TO ME
Quote:
Originally Posted by riggsandroid View Post
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
HTC G1: Bricked
HTC G1 #2: Broke
HTC Evo Shift 4G: Active
ASUS Nexus 7: Active
LGE Nexus 4: Active


2-step unroot back to stock 2.3.4 from s-off-Evo Shift 4G
My Work-Evo Shift 4G

Lead Developer of SaberMod
Team member of AOSPAL[PSD]

If I've helped you in any way shape or form please hit the thanks button
 
danaff37
Old
#4  
danaff37's Avatar
Senior Member
Thanks Meter 766
Posts: 2,671
Join Date: Mar 2010
Location: Saint Petersburg, FL
Or just when you change your bashrc, just source the bashrc script

. ~/.bashrc



Sent from my PG06100 using XDA App
Those who think linux is free, must not value their time.
 
sparksco
Old
#5  
sparksco's Avatar
Recognized Developer - OP
Thanks Meter 7,831
Posts: 8,269
Join Date: Feb 2010

 
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

https://help.ubuntu.com/community/SwapFaq
HTC G1: Bricked
HTC G1 #2: Broke
HTC Evo Shift 4G: Active
ASUS Nexus 7: Active
LGE Nexus 4: Active


2-step unroot back to stock 2.3.4 from s-off-Evo Shift 4G
My Work-Evo Shift 4G

Lead Developer of SaberMod
Team member of AOSPAL[PSD]

If I've helped you in any way shape or form please hit the thanks button
 
drob311
Old
#6  
drob311's Avatar
Senior Member
Thanks Meter 960
Posts: 1,651
Join Date: Mar 2011
Location: Fond du Lac, WI
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
 
sparksco
Old
#7  
sparksco's Avatar
Recognized Developer - OP
Thanks Meter 7,831
Posts: 8,269
Join Date: Feb 2010

 
DONATE TO ME
Default 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
HTC G1: Bricked
HTC G1 #2: Broke
HTC Evo Shift 4G: Active
ASUS Nexus 7: Active
LGE Nexus 4: Active


2-step unroot back to stock 2.3.4 from s-off-Evo Shift 4G
My Work-Evo Shift 4G

Lead Developer of SaberMod
Team member of AOSPAL[PSD]

If I've helped you in any way shape or form please hit the thanks button
 
sparksco
Old
#8  
sparksco's Avatar
Recognized Developer - OP
Thanks Meter 7,831
Posts: 8,269
Join Date: Feb 2010

 
DONATE TO ME
guide updated for korg workaround. Changes are labeled in red
 
JaceAlvejetti
Old
(Last edited by JaceAlvejetti; 8th November 2011 at 06:01 PM.)
#9  
Senior Member
Thanks Meter 18
Posts: 155
Join Date: Aug 2007
Location: Detroit, MI
Question Repo not found?

Followed Directions to the T, Currently Hung up on
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b gingerbread --repo-url=git://github.com/android/tools_repo.git
Tells me repo command not Found

EDIT: I'm sorry hows about more info?, Ubuntu 11.10 64bit need anymore just ask
 
VICODAN
Old
#10  
VICODAN's Avatar
Senior Member
Thanks Meter 475
Posts: 1,686
Join Date: Apr 2011
Location: San Jose, CA

 
DONATE TO ME
Nice guide. Can I do this on Fedora?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes