Pages

Label

Jumat, 20 Januari 2017

Android AOSP Source Code Download and Build

Hello Guys !!! Hope doing well

Today I am going to discuss how to download and build Android Source code. I will also share info on how to run Emulator on generated AOSP  source image.  I am sharing step by step approach for download and build.
Step to download android source code(AOSP) in Ubuntu
1. First create one folder like "aosp-m" to copy AOSP code in your machine.

2. Open terminal(Ctrl+Alt+T) and change your Dir to latest created Dir let say "aosp-m"

3. After that Run the following command in terminal :-
git clone git://gitz01/cm/download/android/manifest
if this link not worked then try this one 
repo init -u https://android.googlesource.com/platform/manifest

4. Run Following command in terminal one by one
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

5. then run following command
repo init -u git://gitz01/cm/download/android/manifest -b master -m identifiedmanifest.xml
if this link not worked then try this one 
repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r78
here you can replace identifiedmanifest.xml to your desired AOSP source code , Let Say "android-6.0.1_r10.xml" this is code name of marshmallow.

6. and in the last run "repo sync" command. This command start downloading your desired AOSP code in your machine. This operation take more than 1 hours(depending on your INTERNET connection speed) to download source code.


That's it... Happy Coding.......

Note:- Sometime just copy paste not work properly in terminal, in that case you type these commands.

Step to compile/create System image after AOSP source code download
1. After successful download of AOSP code, First check your JDK installation
For android AOSP source code compilation, we need openjdk
For Android N we need openjdk version "1.8.0_xxxx" and for L or M we need
openjdk version "1.7.0_xxx"
2. Installing required packages (Ubuntu 14.04)
You will need a 64-bit version of Ubuntu. Ubuntu 14.04 is recommended.
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
For more detail follow the link :-
https://source.android.com/source/initializing.html
3. Then run the following command in sequence
source  build/envsetup.sh
lunch (Enter this command and then choose your target from the given option. Just pass the number like 1)
make -j4 (make command based on CPU Core and RAM size you can choose like -j8, j16 etc..)

That's it. For the fresh build it will take some couple of hours (1 or 2 or 3).

Happy Coding.......

How to run Emulator step by step guide.

Running emulator in downloaded android AOSP source code is as below :-
Step 1
If you have finished your build and generated System image correctly in current running Terminal(Ubuntu), Then it is straight forward. Just type below command in your terminal:-
emulator
Step 2
If you have generated system image earlier and you have started a fresh terminal(Ubuntu) then run the following command one by one :-

  1. source build/envsetup.sh
  2. lunch 1 here 1 is my lunch type, you can replace it with yours like(7, 8 etc) and in the last
  3. emulator
    Thanks Guys !!!  Happy Coding.....

0 komentar:

Posting Komentar

 
[tutup]