[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.