[Android One (First-Generation) Cross-Device Genera] chiranjit_1998:
Post is Influenced from [MENTION=6083514]Anik_khan[/MENTION] Kernel Post to make Procedure More Simple for Us All.

So Don't BE Shocked to see Things

Prerequisites:

Ubuntu 14.04 Trusty Tahr 64 Bit. (Can be on VirtualBox or Full Install Your Wish.)

RAM Minimum:2GB Recommended:4GB

Around 100GB Space for ROM’s. (Kernels can use upto 1GB.)

Unlimited (Fast) LAN Connection.

More RAM, or faster CPU, or SSD will speed up the process.

A Brain (Most Important of All :v)

At the starting of the post I have linked a script by [MENTION=5854483]akhilnarang[/MENTION] which if run will automatically install all these programs for lazy people.

If you not interested to do all procedure from below just use the script. Simply it will automatically configure the build environment.

NOTE-------- some of these packages may already be on your machine. Obviously, if you complete a step and you have one of these installed, the machine simply will not do anything. So...it will not hurt anything. Some of the packages are different from Ubuntu 12.04 and 13.04 (use these packages for Ubuntu 14.04 as many of the old ones have obsoleted - these are new replacements).

So if you set up your pc with Ubuntu we are good to go.

All code will be in code boxes like this:

$

means you have to run that command in the terminal (don't type the $).

All commands with sudo, gksudo, or gksu means it requires root permission.

It will ask for password.

Once you type, then in that terminal session it will not ask you for a few minutes again.

Any time you make changes to .bashrc or .profile file, make sure to run

$ source ~/.bashrc
$ source ~/.profile

Or exit and open new terminal else the changes will not take place

Setting Up Build Environment

Method 1:

So if you not interested in doing below all steps then simply use this script by my friend [MENTION=5854483]akhilnarang[/MENTION]

Open terminal and type:

$ sudo apt-get install git-core

then do

$ git clone https://github.com/akhilnarang/scripts.git
$ cd scripts
$ . build-environment-setup.sh

This script will install all required packages

Method 2:

1)Installing Java JDK

Open terminal (CTRL + ALT + T)

Then execute the following commands in terminal one by one:

Download & install java

$ sudo apt-get update && sudo apt-get install openjdk-7-jdk openjdk-7-jre

CHECK if java properly installed or not

$ java -version

If you get output like

Code:

java version "1.7.0_79" or anything higher(in my case)

on the first line then all is good

Now JDK is configured!

Note: Only for Ubuntu 14.04 or higher

2)Installing Required Packages

Open Terminal

Now execute this command:

Note: This will take some time, has to download about 500MB or so of packages

$ sudo apt-get update && sudo apt-get install git-core python gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-7-jdk pngcrush schedtool \
libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib liblz4-* android-tools-adb android-tools-fastboot ccache

3)Installing Android SDK

Download the SDK from here!

Accept Terms & download 64 bit.

Extract in your home directory & rename extracted folder "android-sdk".

Now, execute these commands in terminal:

$ cd ~/android-sdk/tools/
$ ./android sdk

At this point the SDK should come up and you will need to download at least all the tools and all the extras files (at least to 4.0, so select them and install them.When it finishes downloading & installing everything you have to run this command in ANOTHER TERMINAL:

$ sudo apt-get install gksudo
$ gksu gedit .bashrc

And you need to add at the end of it your SDK paths these three lines (copy and paste them):

export PATH=~/android-sdk/tools:$PATH
export PATH=~/android-sdk/platform-tools:$PATH
export PATH=~/bin:$PATH

Save and close the file, then close terminal, or

source ~/.bashrc

Find your .profile file and add this at the bottom of the file

PATH="$HOME/android-sdk/tools:$HOME/android-sdk/plartform-tools:$PATH"

SDK is configured.

4)Configuring USB Access

Now we need to set permissions so that our USB ports can detect our android devices

Type in the following commands, it will download a file with the permissions, give it permission to execute, and restart the service.

$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb

ADB & Fastboot are configured

5)Installing Repo Package

Open terminal and type:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

6)Configure Git

Open terminal and type:

$ git config --global user.email ""
$ git config --global user.name ""

Git is configured.

7)Configure ccache

Open terminal and type:

$ gksu gedit ~/.bashrc

Enter these lines

export USE_CCACHE=1
export CCACHE_DIR=~/.ccache

Save & close

Open terminal & execute:

$ source .bashrc
$ ccache -M 50G

I usually use 50 gigs. You can use more if you have more space, or build for many devices

Congrats

YOUR BUILD ENVIROMENT IS NOW SETUP .

Making Kernel