How to build AICP on Linux?

This tutorial is for advanced Linux users,
follow it step-by-step, please!

  1. Open terminal, type and install following to wipe current java installs (optional) :

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

  2. Then type following to install correct Java 6 (say OK to prompts and stuff) :

    sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java6-installer

  3. Now type the following to install needed utilities:

    sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev 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

  4. Now tpye following to create symbolic link:

    sudo ln -s /usr/lib/i386-linux-gnu/mesa/ /usr/lib/i386-linux-gnu/

  5. Create a folder for your repo (aicp or some other path if you like) :

    mkdir ~/aicp

  6. Get the repo binary:

    mkdir ~/bin
    curl > ~/bin/repo
    chmod a+x ~/bin/repo

  7. Edit ~/.bashrc file to set some local settings:

    sudo gedit ~/.bashrc

  8. At the end of the file add following line, save the file and exit:

    export PATH=~/bin:$PATH

  9. Back to terminal. Type this to install a useful Java selector tool (optional) :

    sudo apt-get install zenity
    wget > ~/bin/update-java
    chmod a+x ~/bin/update-java

  10. Type this to use the Java selector tool to switch to java-6-oracle (optional) :

    sudo update-java
    (First select NONE to remove by pressing CANCEL, then select 'java-6-oracle' and press OK to activate it.)

  11. Type the following to navigate to the repo folder:
    cd ~/aicp
  1. Repo initialization:

    repo init -u -b n7.1

  2. sync repo:

    repo sync

  1. Build:

    . build/

  2. You can also build (and see how long it took) for specific devices like this:

    . build/
    time brunch m7

Remember to make clobber every now and then!