Setting up compiling Envoriment


Setting Up the Enviroment

Install Ubuntu on your Virtual Machine or your computer

this document is writed for Ubuntu 14.04 lts Instalation.

    • all the comments with ** described comands executed on shell

After install the system, we need to configure the machine to use android AOSP, Kernel Sources or U-boot.

 **Installing Java**
 -$ sudo apt-add-repository ppa:webupd8team/java
 -$ sudo apt-get update
 -$ sudo apt-get install Oracle-javaX-installer

Where X is the number version of java you want to install. example : "sudo apt-get install Oracle-java7-installer"

you can install all the versions you want or you will need.

 **Setting java alternatives**
 -$ sudo update-alternatives --config java
 -$ sudo update-alternatives --config jar
 -$ sudo update-alternatives --config javac
 -$ sudo update-alternatives --config javaws
 -$ sudo update-alternatives --config javadoc
 -$ sudo update-alternatives --config javap

"Javap" is needed to compile KitKat 4.4 These six should all be selected Now JDK is configured! To check if it is done

 **checking version JDK**
 -$ java -version

the output will be similar to :

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


Installing required packages for Ubuntu 14.04 lts

 **packages to install **
 -$ sudo apt-get install build-essential
 -$ sudo apt-get install phablet-tools
 -$ sudo apt-get install git-core gnupg flex bison gperf
 -$ sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386
 -$ sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache
 -$ sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip

may be you need diferent versions of GCC or G++, folow this steps to get it and to use it.

 **installing GCC needed, check the version your compilation or compilations need**
 -$ sudo apt-get install gcc-(version, can be 4.4 or multilib)
 -$ ls /usr/bin/gcc( tab to see versions installed)
 -$ gcc -v ( to see wich version are you using)

after check wich versions are installed in you computer you can create the alternative versions to switch fast.

 **setting up alternatives**
 -$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-(version)
 -$ sudo update-alternatives --config gcc

Setting up USB acces Under GNU/Linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access. The recommended approach is to create a file at /etc/udev/rules.d/51-android.rules (as the root user).

 **Editing Rules File **
 -$ wget https://source.android.com/source/51-android.rules -P /etc/udev/rules.d/
 -$ sudo geany /etc/udev/rules.d/51-android.rules

or

 -$ wget -S -O - http://source.android.com/source/51-android.rules | sed    "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm csudoontrol --reload-rules

you need to change <username> and add your usser. Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer. This is known to work on both Ubuntu Hardy Heron (8.04.x LTS) and Lucid Lynx (10.04.x LTS). Other versions of Ubuntu or other variants of GNU/Linux might require different configurations.

Using Separated Output Directory

By default, the output of each build is stored in the out/ subdirectory of the matching source tree. On some machines with multiple storage devices, builds are faster when storing the source files and the output on separate volumes. For additional performance, the output can be stored on a filesystem optimized for speed instead of crash robustness, since all files can be re-generated in case of filesystem corruption. To set this up, export the OUT_DIR_COMMON_BASE variable to point to the location where your output directories will be stored.

 **Setting Up Out Directory **
 -$ export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>

The output directory for each separate source tree will be named after the directory holding the source tree. For instance, if you have source trees as /source/master1 and /source/master2 and OUT_DIR_COMMON_BASE is set to /output, the output directories will be /output/master1 and /output/master2.

It's important in that case to not have multiple source trees stored in directories that have the same name, as those would end up sharing an output directory, with unpredictable results. This is only supported on Jelly Bean (4.1) and newer, including the master branch.

Autenticate on Google Source Git

Go to the folowing site and use or register with a google acount. This will allow you to get the manifest and sources.

https://android.googlesource.com/new-password

and follow the steps.