[ GUIDE ] How to Configure Ubuntu 13.04 Raring Ringtail for Compiling Android ROMs

sylentprofet

Senior Member
Jun 10, 2010
283
1,857
0
Sacramento
--- copied with permission from nathanpfry.com ---​

Initializing a fresh Android Build Environment in Ubuntu 13.04 sucks, right? The instructions at the aosp page are outdated at best, wrong at worst. Near as I can tell, they try to have you install 2 JDKs, the first one not even being the correct link for Raring Ringtail, and the second being OpenJDK. Which might work. But iiiiiiii dunno about all that, I'd rather have Oracle's official stamp when it comes to building for Android.

Currently most of the guides are up to 12.04 LTS, which is fine and dandy, but being on the cutting edge is nice too. Plus, I don't think I've seen anyone aggregate the directions in this order, for the correct official JDK and everything just right for building happiness.

This guide applies to Ubuntu 13.04 Raring Ringtail 64 bit. Do not use 32 Bit. Also, PAY CLOSE ATTENTION when to use "sudo" and when to not. It can make things funky if you do something as root that you shouldn't.

Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.

First, let's set up the correct JDK.

Many of you probably have some kind of wrong Java installed. Sad cupcake.

Let's get rid of that. Copy and paste this into a Terminal window:

Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Banish the OpenJDK! If you must keep it, it's possible. But I'm not going to tell you how to do it here. I don't want any chance of confusion or mistake.

Back to the Terminal. Copypasta the following:

Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.04. No more unrecognized Java version errors! Yay! And it's self updating, so you don't have to redownload binaries everytime they release a new version.

Next, we actually need to install the package. More copypasta:

Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the onscreen instructions. You have to Accept the Licensing Agreement or whatever. Hopefully no human centipede clauses. Once that is completed successfully, you will have to restart any open browsers with Java content for it to display correctly.

To make sure the correct version of Java is activated, run the following at the Terminal prompt:

Code:
java -version
You should see something like the following:

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)

Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:

Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python gcc g++ cpp gcc-4.8 g++-4.8 ccache
And we wait. Don't worry, this isn't the crazy downloading part just yet.

When that is done, do this:

Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
That's probably it on the package side of things. Probably.

You guessed it, time for more Terminal. This really is the easiest way, seriously. And it's totally worth it when you're basking in the glory of a bunch of people on XDA.

The binary for repo will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:

Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Use your favorite text editor to open ~/.bashrc

I like nano:

Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:

Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:

Code:
source ~/.bashrc
In the terminal, navigate to where you would like to store the Android source code. The directions below will make it in your home folder, but if you have limited space, you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external is basically unusable. Here we go:

Code:
mkdir ~/android
cd ~/android
Now you're going to initialize the repo. Here's where you decide the flavor of Android you want to build for, ie AOKP, CyanogenMod, AOSP etc. The following, for the purposes of this tutorial, will initialize for AOKP:

Code:
repo init -u git://github.com/AOKP/platform_manifest.git -b jb
Almost there. Last step, but it's a doozy. You're going to get the source. Prepare yourself, mere mortal. 10+ GB of downloading await you. Don't worry, it's automated. Go to sleep. Eat something. Perhaps you have heard of this new thing the kids are doing called "going outside"? Yeah, I didn't think so. Me neither. Hey everyone, it's a terminal:

Code:
repo sync
Check back periodically every hour or so. It really all depends on how fast your internet connection is.

That should be everything. Now you're ready to build Android the right way. Luck!

Feel free to buy me a coconut water (donate) if you like my work. It would be greatly appreciated!

Please hit the "Thanks" button if this post helped you out.

For guides on how to compile ROMs from source and other Android/Ubuntu topics, check out my blog!
 
Last edited:

sylentprofet

Senior Member
Jun 10, 2010
283
1,857
0
Sacramento
Isn't this just like your 12.10 guide? And this would work on the nexus 7?

Sent from my VS920 4G using Tapatalk 2
There are subtle differences but more or less.

People would be looking for the info eventually so I put it out there.

This setup should let you compile for just about any Android device that's supported or has a github et al repo.
 

jjhiza

Senior Member
Dec 19, 2010
3,163
2,697
0
Dirty Jersey
I meant is it possible to build ROMs on the nexus 7 running Ubuntu 13.04 or 12.10

Sent from my VS920 4G using Tapatalk 4 Beta
Yes. Google uses Ubuntu 12.04LTS to build AOSP for all of its devices, so the N7 should show up in the lunch menu. 12.10 and 13.04 will operate the same way. :)
 

azoller1

Senior Member
Aug 4, 2011
1,798
1,694
143
Lenexa
No, using my nexus 7 with Ubuntu desktop running on my nexus 7 and then building a ROM with Ubuntu running on my nexus 7 thats what I meant

Sent from my Nexus 7 using Tapatalk HD
 

jjhiza

Senior Member
Dec 19, 2010
3,163
2,697
0
Dirty Jersey
No, using my nexus 7 with Ubuntu desktop running on my nexus 7 and then building a ROM with Ubuntu running on my nexus 7 thats what I meant

Sent from my Nexus 7 using Tapatalk HD
Oooooh, I see what you mean. In that case, I highly doubt it. I'm not 100% sure what kind of specs the N7 has, but just in terms of RAM, building on it would probably crash the tablet. Not to mention the fact that you may not have enough storage space to even download the repo... It's between 15-30GB,depending on which branch you sync.

You never know though... I'm attempting to compile kernels on a dead laptop. I used an 8GB flash drive to install 12.04 on, and after syncing the source, I still have about 300MB of space left. The computer runs slow as dirt, but it works. :)
 
  • Like
Reactions: questgraves

THEindian

Senior Member
Nov 20, 2011
1,850
553
0
No, using my nexus 7 with Ubuntu desktop running on my nexus 7 and then building a ROM with Ubuntu running on my nexus 7 thats what I meant

Sent from my Nexus 7 using Tapatalk HD
Don't even try, its not even about whether or not you can download it or even compile it, compile times would be HORRENDOUS. A pentium 4 could beat a tegra 3 in processing power, while arm is AMAZING for power effeciency, you can't really beat the x86 architecture, plus you would lose a lot of toolchain optimizations.It would take you well over 1 day, probably closer to 2 days to compile a single rom, not factoring in any errors you run into.
 

Rushing

Senior Member
Jan 13, 2012
2,295
2,892
0
Los Angeles
Don't even try, its not even about whether or not you can download it or even compile it, compile times would be HORRENDOUS. A pentium 4 could beat a tegra 3 in processing power, while arm is AMAZING for power effeciency, you can't really beat the x86 architecture, plus you would lose a lot of toolchain optimizations.It would take you well over 1 day, probably closer to 2 days to compile a single rom, not factoring in any errors you run into.

after following this guide will I be somewhat set up to build touchwiz kernels?

I am reading that older versions are better for kernel compiling.. thanks
 

THEindian

Senior Member
Nov 20, 2011
1,850
553
0
after following this guide will I be somewhat set up to build touchwiz kernels?

I am reading that older versions are better for kernel compiling.. thanks
No, go ahead and follow this guide, usually, older versions are recommended because all the necissary drivers are guaranteed but you'll be fine in this case.
 

cj360

Senior Member
Oct 24, 2011
1,331
709
0
Is that a user maintained repo for java or oracle maintained? Since everyone just seems to push for new new things not old stable things.

Sent from my Xperia Play using Tapatalk 2
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone