[Sprint HTC EVO 4G LTE] tjarnold:
Building from Source

Guide for building Root-Box from source​

To start off, you need Ubuntu 12.04 or higher, 64-bit version installed. You cannot build Android 4.2.2 unless you are using a 64-bit OS. I am personally using Ubuntu 13.04 but I started on 12.04 so either way should be fine.

Everything is done in terminal. Please make sure to type or copy the commands exactly to avoid any issues.

Next we need to get the correct version of Java installed and set up as default. I would recommend removing any other versions. If you want to remove some other common versions that may be installed on your system run:

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

Now we need to add a self updating repository for Java.

sudo add-apt-repository ppa:webupd8team/java

Lets install Java 6

sudo apt-get update && sudo apt-get install oracle-java6-installer

In case you decided to leave other versions of java or you have another version of Java installed we need to make sure that your computer will use the correct version to compile Android.

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1

Now we tell your computer exactly which version of Java to use. After typing each line one of your choices should be JDK1.6.0_45. This is the one you want to choose.

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc

Now we need to install everything else needed to build Android.

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

And

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Here we tell your computer how to "repo".

kdir ~/bin
export PATH=~/bin:$PATH
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo

Create a folder to build in and change to that folder.

mkdir ~/rootbox_jewel
cd ~/rootbox_jewel

Initialize and sync Root-Box sources. This will take quite a while. (Like 3-6 hours with a decent connection. I sync for the first time overnight.) After the first sync, you will only get updates or changes so its much faster. You can also add -jX to the sync command (ex. repo sync -j6) where X is the number of threads being downloaded at the same time. The default is 4. I typically use 6. If you have problems or your system locks up you may want to use a smaller number.

repo init -u https://github.com/tjarnold/platform_manifest.git -b jb-mr1
repo sync

Download Term.apk. The build will fail without this since I added it into the makefiles.

cd ~/rootbox_jewel/vendor/cm
. get-prebuilts

Now you are finally ready to compile your ROM.

. build_rootbox.sh jewel

There are also some extra commands you can add on to the above command. Just type all 3 of these options after the command above. They need to be in the same order otherwise it will not work. 1) sync or nosync - will sync your repo before building, 2) any number - number of threads to build at once (the aboe command defaults to 4), 3) clean or noclean - the clean option will clear out all old build files from a previous build. This is useful if there is a major change or something gets screwed up during the build.

. build_rootbox.sh jewel sync 4 clean (run repo sync, 4 threads, delete old build files)
. build_rootbox.sh jewel nosync 2 noclean (don't sync, use 2 threads, don't remove old build files)
. build_rootbox.sh jewel sync 6 noclean (run repo sync, 6 threads, don't remove old build files)

If you have followed the directions above, the resulting .zip can be found in:

~/home/rootbox_jewel/out/target/product/jewel