Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
pio_masaki
Old
(Last edited by pio_masaki; 18th June 2012 at 04:03 AM.)
#1  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
Default [Guide] Compiling CM9 for A100

I've gotten a lot of PMs asking about how to compile CM9 source for CM9 ROMs. While its a somewhat daunting task at first, in this guide I aim to break it down as simple as possible, while not talking to you like an idiot. I had to gather this information myself over a few days of scouring guides and posts and threads over 5 forums, and finally pieced it together to work. My hope is this one guide will be enough for you to build for the A100, and ANY other device you choose, provided CM9 has a device tree for it. Outside of that is beyond the scope of this guide. It does not include AOKP or anything else, just AOSP CM9, which is what I use for the nightly builds here.

Section 1: I want my own stuffs, what kind of machine should I be rocking?
This first part will deal with the machine you plan to use to build with, these are my personal suggestions, however you may deviate however you want, but these instructions may no longer work for you.

Operating System
Any 64 Bit Ubuntu or Ubuntu based distro should do fine. 32 bit can also be used, I have done it successfully but requires some extra steps or variations. I use Linux Mint 11, based on Ubuntu Natty, you can use older or newer releases of course, however the instructions will no longer work and you will need to find them elsewhere. Its been said, and verified by Theonew that Ubuntu 10.04 is the best for compatibility, however this guide is aimed at Linux Mint 11/ Ubuntu Natty as that is what I run and based this guide on. This guide may or may not work on any other version of Linux.

CPU
Any dual core (or even single if you don't mind waiting) will do. 4 core is of course better, and the faster/newer/most epic available will yield builds in as little as 30 minutes. A core 2 duo will build is roughly an hour. A Pentium D about 2. This, over all others, dictate how long it takes to compile the build. Overclocking can be used, however it should be completely stable or you will get build errors and bad ROMs.

RAM
2 GB is passable, 4 GB is suggested, 16 GB ideal. While the amount is more important, get the fastest RAM and tune the lowest STABLE latencies for best performance.

Storage
AOSP can take up to 50+GB of hard drive space. By default it will use the home partition. A single device build will only need 20GB or less of free space, however the more free space the better as the rest of Linux uses it too. Suggest 250GB + hard drive. 80GB minimum for a single device.

Section 2: Ok my machine won't melt, what software do I need?
Assuming your machine is fully operational with some flavor of Ubuntu Natty, we can move on to setting up the software side!

Open a terminal, then in the browser highlight and copy the line, then go back to the terminal and click CTRL+SHIFT+V to paste into terminal. Hit enter when done.

32bit and 64 bit systems:
sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool

64 Bit only
sudo apt-get install g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib

Other random software you need
sudo apt-get install libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils

Generate link for libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

Install Java JDK 1.6
Get Java JDK 6 from here.
Copy the file you downloaded to your Home directory, then go back into terminal.
Remove all other Java, it'll cause problems later.

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

Now we copy the Java JDK you moved into your Home directory
Copy each line and run, then move to the next.

sudo mkdir -p /opt/java/64/
sudo cp jdk-6u32-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u32-linux-x64.bin
./jdk-6u32-linux-x64.bin
exit

If you get errors, double check the file you downloaded is the same as the command, if not, change the command to match, or the download to match the command.

Next, assuming you have a Gnome desktop installed, we'll edit .bashrc

gedit ~/.bashrc

Should open a text editor. In this text editor add

# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_32
export PATH=$PATH:$JAVA_HOME/bin

If it already has text inside, add this to the top. Press save, and close the text editor.

Next, you need to download the Android SDK. Yes, you NEED this. Get it here.

Extract it to your home folder, so it's like this: ~/android/sdk

Open the .bashrc again and add the Android SDK stuff:

gedit ~/.bashrc

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

Adapt it to match wherever you decided to place the folders. Add this below the Java from above. Be sure to save.

Now we add device paths:

sudo gedit /etc/udev/rules.d/99-android.rules

Opens the editor again, now add:

#Acer
SUBSYSTEM==usb, SYSFS{idVendor}==0502, MODE=0666
#ASUS
SUBSYSTEM==usb, SYSFS{idVendor}==0b05, MODE=0666
#Dell
SUBSYSTEM==usb, SYSFS{idVendor}==413c, MODE=0666
#Foxconn
SUBSYSTEM==usb, SYSFS{idVendor}==0489, MODE=0666
#Garmin-Asus
SUBSYSTEM==usb, SYSFS{idVendor}==091E, MODE=0666
#Google
SUBSYSTEM==usb, SYSFS{idVendor}==18d1, MODE=0666
#HTC
SUBSYSTEM==usb, SYSFS{idVendor}==0bb4, MODE=0666
#Huawei
SUBSYSTEM==usb, SYSFS{idVendor}==12d1, MODE=0666
#K-Touch
SUBSYSTEM==usb, SYSFS{idVendor}==24e3, MODE=0666
#KT Tech
SUBSYSTEM==usb, SYSFS{idVendor}==2116, MODE=0666
#Kyocera
SUBSYSTEM==usb, SYSFS{idVendor}==0482, MODE=0666
#Lenevo
SUBSYSTEM==usb, SYSFS{idVendor}==17EF, MODE=0666
#LG
SUBSYSTEM==usb, SYSFS{idVendor}==1004, MODE=0666
#Motorola
SUBSYSTEM==usb, SYSFS{idVendor}==22b8, MODE=0666
#NEC
SUBSYSTEM==usb, SYSFS{idVendor}==0409, MODE=0666
#Nook
SUBSYSTEM==usb, SYSFS{idVendor}==2080, MODE=0666
#Nvidia
SUBSYSTEM==usb, SYSFS{idVendor}==0955, MODE=0666
#OTGV
SUBSYSTEM==usb, SYSFS{idVendor}==2257, MODE=0666
#Pantech
SUBSYSTEM==usb, SYSFS{idVendor}==10A9, MODE=0666
#Philips
SUBSYSTEM==usb, SYSFS{idVendor}==0471, MODE=0666
#PMC-Sierra
SUBSYSTEM==usb, SYSFS{idVendor}==04da, MODE=0666
#Qualcomm
SUBSYSTEM==usb, SYSFS{idVendor}==05c6, MODE=0666
#SK Telesys
SUBSYSTEM==usb, SYSFS{idVendor}==1f53, MODE=0666
#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666
#Sharp
SUBSYSTEM==usb, SYSFS{idVendor}==04dd, MODE=0666
#Sony Ericsson
SUBSYSTEM==usb, SYSFS{idVendor}==0fce, MODE=0666
#Toshiba
SUBSYSTEM==usb, SYSFS{idVendor}==0930, MODE=0666
#ZTE
SUBSYSTEM==usb, SYSFS{idVendor}==19D2, MODE=0666


SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"

Save and close.

Back in terminal enter
sudo chmod +x /etc/udev/rules.d/99-android.rules

Now we need to open the Android SDK to install some extras, in terminal enter

android

If the lines above were correct, it should launch your SDK. If not, in terminal, enter

cd ~/android

and try again.

Once the SDK Manager open, give it a second to search the repos, then check the boxes for Android SDK Tools and Android SDK platform-tools, then let them install. It takes a few minutes.

Now, just to make sure, we edit .bashrc again to double check the paths are correct. I messed up here before, so I added this part in just in case.

gedit ~/.bashrc

Should have:

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

#Java PATH
export JAVA_HOME=/opt/java/64/jdk1.6.0_32
export PATH=$PATH:$JAVA_HOME/bin

Android and Java can be before or after each other, doesn't matter, just have them at the top.

Post 2 will pick up with getting your workplace prepped, including repos. See you in a second.
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following 6 Users Say Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
pio_masaki
Old
(Last edited by pio_masaki; 17th June 2012 at 09:45 PM.)
#2  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
Section 3: My machine didn't melt, but my terminal did!

And now we begin EVEN MOAR FUN TERMINAL STUFFS! and lots of waiting. In this section we will begin prepping your workplace for syncing to the repo, which takes a couple hours, or more, to complete the first time. Afterwords it only takes a few minutes.

First we make some directories, and set permissions:

Once again, in terminal.

mkdir -p ~/bin
mkdir -p ~/android/system
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo

At this point you will need to at minimum close terminal and open a new one, or even completely reboot your system and resume. /android/system can be named anything you want, like /android/aosp or /android/cm9, etc.

Now we use gedit for .bashrc once again.

gedit ~/.bashrc

export PATH=$PATH:~/bin

Save and exit.

Next we'll attempt to sync to the CM repo, this is the long one.

cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync -j16

Again remember this is 1 line per command, enter each line.

Once you issue repo sync it will begin the horribly long process of syncing to the repo, and takes a couple hours, or more, to complete. At this point, go out for dinner or something. Watch the game. It WILL take a long time.

Welcome back, been awhile! Next we sync device specific items, in terminal again:

. build/envsetup.sh && brunch {{{device}}} where {{{device}}} is your device, so in this case:

. build/envsetup.sh && brunch a100

You shouldn't have to do this anymore, a one time deal unless you need to setup all over again.

Next we get the proprietary files from the device:

cd ~/android/system/device/acer/a100/
./extract-files.sh

Substitute acer and a100 for whatever make and model you want to pull from.

While still in /android/system we need to get the prebuilts:

~/android/system/vendor/cm/get-prebuilts

Thats it for the ONE time prep work. This next section will be on a per build basis.

cd ~/android/system/
repo sync

Then to build your ROM:

. build/envsetup.sh && brunch a100

You can also add a -JX argument, where X is cpu cores, or threads, you wish to use. So . build/envsetup.sh && brunch a100 -j16 would hog alot of cpu time, but be faster.

WOW that took forever! But..you got it, next section has some more info!
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following 4 Users Say Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
pio_masaki
Old
(Last edited by pio_masaki; 17th June 2012 at 09:58 PM.)
#3  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
Section 4: Ok...that was awhole lot of work followed by vast amounts of boredom...wait...where the EFF is my ROM?!

After your first build, you'll probably be looking for your squeaky clean new ROM built by yourself, GRATS!

This is where I end this guide, and leave you to flail around random directories on your own searching in vain for your ROM.

Ok, no I won't, not that mean. Your new ROM will be prepackaged in a flashable zip file in..get ready..

~/android/system/out/target/product/a100/

It'll be amongst alot of files,but it will be there when the build has completed. At this point, name it whatever, and put it on your external SD card, and flash it!

Section 5: Ok..what if I want to build another one?

You'll first want to clear out the previous build, we do this with clobber. In terminal...

cd ~/android/system
make clobber

Then follow the section above for building with

cd ~/android/system/
repo sync

Then to build your ROM:

. build/envsetup.sh && brunch a100

It'll likely take less time then before, but still pretty close. The new build will be in the same place as before!

That ends my guide for building CM9 by source for the A100. Keep in mind this can be adapted to just about any SUPPORTED device tree, just change make and models where appropriate.

This is the first draft, and will likely undergo some changes to clean up and make a little clearer what should be done. Feel free to ask questions or make suggestions, as always, and I will attempt to answer and fix any issues. Keep in mind, though, I am still new to this, and things like changing, modifying, or hacking the code isn't something I know how to do.

Thanks:
The CM team
blahbl4hblah: Alot of my info was from his guide here. It got me MOST of the way there, some other info came from other places, however I can't remember where. It wasn't from XDA, and alot of the missing pieces came from the CM wiki.
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following 4 Users Say Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
Theonew
Old
(Last edited by Theonew; 17th June 2012 at 09:55 PM.)
#4  
Theonew's Avatar
Recognized Contributor
Thanks Meter 1023
Posts: 3,458
Join Date: Dec 2010
Location: Wherever I am

 
DONATE TO ME
Glad to see your living up to it already . *He's done it again* - Another excellent guide and this time, no typos . Thanks for this and don't you think I forgot about it .

Edit (Sorry but I just needed to do this ) - You have a typo in your second to last paragraph (of post #2).
The Following User Says Thank You to Theonew For This Useful Post: [ Click to Expand ]
 
pio_masaki
Old
#5  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
lol my keyboard hasn't even stopped smoking yet and you already start in on my typos! When my fingers stop smoldering I'll go back over and correct anything I can find, which I'm sure there's plenty, as usual I typed it all up and put it up as I did it, not much proofing outside of it had somewhat complete structured language in it. Hopefully english.
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following User Says Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
Theonew
Old
(Last edited by Theonew; 17th June 2012 at 10:10 PM.)
#6  
Theonew's Avatar
Recognized Contributor
Thanks Meter 1023
Posts: 3,458
Join Date: Dec 2010
Location: Wherever I am

 
DONATE TO ME
Quote:
Originally Posted by pio_masaki View Post
lol my keyboard hasn't even stopped smoking yet and you already start in on my typos! When my fingers stop smoldering I'll go back over and correct anything I can find, which I'm sure there's plenty, as usual I typed it all up and put it up as I did it, not much proofing outside of it had somewhat complete structured language in it. Hopefully english.
Its nothing major, just a commonly misunderstood concept. One thing you may want to note, is that using Ubuntu 10.04 is recommended and later versions are experimental (some commands are different, and they may not support Git branches other than master).
 
pio_masaki
Old
#7  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
Quote:
Originally Posted by Theonew View Post
Its nothing major, just a commonly misunderstood concept. One thing you may want to note, is that using Ubuntu 10.04 is recommended and later versions are experimental (some commands are different, and they may not support Git branches other than master).
While I agree 10.04 is the "best" to use, compatibility wise, these instructions are specifically aimed at Ubuntu Natty 11.04, and all commands listed are what I used to setup for my builds, using Linux Mint 11, which is Ubuntu Natty. The guide wasn't really intended as a coverall for building on any distro, but more a guide documenting what I did to get builds going, and its based on Linux Mint 11 (natty), which is of course mentioned, as well as deviating from that build changing what needs to be done, and the guide will no longer work.

I'll of course add a note about using Ubuntu 10.04, however the guide mostly likely won't work on that release, but then again, it might, haven't tried. I know 11.10+ needs changes to work properly, as I figured out on my server running LM 12, but works fine on 11.04. At least, for this guide it does.
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following User Says Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
da-pharoah
Old
#8  
da-pharoah's Avatar
Recognized Contributor
Thanks Meter 1479
Posts: 2,571
Join Date: Mar 2009
Location: Seacoast near Joppa

 
DONATE TO ME
Quote:
Originally Posted by pio_masaki View Post
While I agree 10.04 is the "best" to use, compatibility wise, these instructions are specifically aimed at Ubuntu Natty 11.04, and all commands listed are what I used to setup for my builds, using Linux Mint 11, which is Ubuntu Natty. The guide wasn't really intended as a coverall for building on any distro, but more a guide documenting what I did to get builds going, and its based on Linux Mint 11 (natty), which is of course mentioned, as well as deviating from that build changing what needs to be done, and the guide will no longer work.

I'll of course add a note about using Ubuntu 10.04, however the guide mostly likely won't work on that release, but then again, it might, haven't tried. I know 11.10+ needs changes to work properly, as I figured out on my server running LM 12, but works fine on 11.04. At least, for this guide it does.
Sweet guide bro!




 

Team Hellfire

SGS3: CM10
G2X: CM7 || CM9
Kindle Fire: CM7 || CM9
x0xhellx0x's ROM Guides: SGS3 || G2X || Kindle Fire
Nullifier: G2x || Kindle Fire
 
pio_masaki
Old
#9  
pio_masaki's Avatar
Recognized Contributor - OP
Thanks Meter 1866
Posts: 2,454
Join Date: May 2012
Location: Surprise, Az

 
DONATE TO ME
Quote:
Originally Posted by da-pharoah View Post
Sweet guide bro!
Thanks, and grats on the new title!
My A100 Stuff:
Guide: All things Iconia A100
Jellytime Sosei
CM10 Unofficial Builds
My Droid DNA Stuff:
PAC-Man for the Droid DNA
Thank you to those that donated, it's greatly appreciated!
The Following User Says Thank You to pio_masaki For This Useful Post: [ Click to Expand ]
 
da-pharoah
Old
#10  
da-pharoah's Avatar
Recognized Contributor
Thanks Meter 1479
Posts: 2,571
Join Date: Mar 2009
Location: Seacoast near Joppa

 
DONATE TO ME
Quote:
Originally Posted by pio_masaki View Post
Thanks, and grats on the new title!
Thanks man :thumbup:

Sent from my LG-P999 using xda premium




 

Team Hellfire

SGS3: CM10
G2X: CM7 || CM9
Kindle Fire: CM7 || CM9
x0xhellx0x's ROM Guides: SGS3 || G2X || Kindle Fire
Nullifier: G2x || Kindle Fire

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

report this ad
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...