Download and compile the latest Android 4.0.3 source code

Source: Internet
Author: User
Tags gnupg

After the release of the latest android4.0 source code, I believe many people are eager to try it like me. In fact, the download and compilation of 4.0 code are similar to those of previous versions, but there are some minor differences, write it down for reference by beginners who do not know the truth

First of all, in the development environment, Google recommends that you use ubuntu10.0.4 and preferably 64-bit. Since it is for work and study, follow the official requirements as much as possible.

Python 2.5 -- 2.7 ubuntu10.0.4 has been installed by default, so you do not need to install it. You need to install it in other environments.

JDK 6 compiling 4.0 requires JDK 6 and JDK 5 for SDK Compilation

Git 1.7 or newer

If your Ubuntu is 32-bit, perform the following steps before downloading the source code:

After downloading the source code, modify the following four files: external/clearsilver/cgi/Android. mk.
External/clearsilver/Java-JNI/Android. mk
External/clearsilver/util/Android. mk
External/clearsilver/CS/Android. mk

Set local_cflags + =-M64
Local_ldflags + =-M64

Change to local_cflags + =-M32
Local_ldflags + =-M32

In build/CORE/Main. mk

Find ifneq (64, $ (findstring 64, $ (build_arch )))

Change it to ifneq (i686, $ (findstring i686, $ (build_arch )))

If you install Ubuntu with the latest 11.04 header, a header file loss error may occur at the end of the compilation due to the kernel version bug. For example:, please fix it as follows:

Repo download platform/external/qemu 22776/1 if you are 10.0.4, do not do anything redundant. If you fix it, the compiled version may fail to enter the system due to the black screen. Remember!

The compiling environment is different, and the problems you encounter may be strange. If your compilation has a problem, please develop the habit of Google and Baidu.

1: JDK is relatively simple to install.

2: Install the dependency Library:

64-bit:

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \  libxml2-utils xsltproc
32-bit
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \  zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \  libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \  libxml2-utils xsltproc

On Ubuntu 10.10:

    $ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

On Ubuntu 11.10:

    $ sudo apt-get install libx11-dev:i386
3: Download Repo
$ mkdir ~/bin $ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo $ chmod a+x ~/bin/repo

4: Create the source code directory:

$ mkdir ANDROID_SOURCE
$ cd ANDROID_SOURCE
5: Get the android source code version on git
$ repo init -u https://android.googlesource.com/platform/manifest
Download the latest version.
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.3_r1
In this case, you need to enter the user name and email
 
 
After entering the information, run the synchronization command.
6: Download source code
$ repo sync
Add parameter:-JX indicates how many threads are enabled to download the source code.
Source code + repo around 13 Gb (because repo will automatically execute the check out command)
If an error occurs in the middle or the network is unstable, You Can reinitialize the repo and use the same email to synchronize the local git Library and the GIT library on the server.
 
 
Compile source code

After downloading the source code, go to the source code home directory.
1: run:
$ source build/envsetup.sh
The Souce command executes the envsetup file under the build directory of the source code package.
 
We can see that this file defines a lot of functions for compilation.
function help()
function get_abs_build_var()
function get_build_var()
function check_product()
function check_variant()
function setpaths()
function printconfig()
function set_stuff_for_environment()
function set_sequence_number()
function settitle()
function choosetype()
function chooseproduct()
function choosevariant()
function tapas()
function choosecombo()
function print_lunch_menu()
function lunch()
function gettop
function m()
function findmakefile()
function mm()
function mmm()
function croot()
function pid()
function gdbclient()
function jgrep()
function cgrep()
function resgrep()
function getprebuilt
function tracedmdump()
function runhat()
function getbugreports()
function startviewserver()
function stopviewserver()
function isviewserverstarted()
function smoketest()
function runtest()
function runtest_py()
function godir ()

2: select a target
$ lunch full-eng
 
We compile and run it in the simulator, so select "full ".
 
We select the maximum permission, that is, the version after root, so select Eng
3: Compile source code
$ make -j4
About 3 hours
After compilation, the out folder is generated in the source code directory.
 
Okay, you can check whether the following compiled source code is running properly.
$ emulator
If the command cannot be found, initialize the environment.
$ source build/envsetup.sh
$ lunch full-eng
 
 
OK. The Android source code is successfully completed and the kernel will be compiled tomorrow.



 
 
 
 
 




 
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.