Android source code compilation process

Source: Internet
Author: User

http://my.oschina.net/zhoulc/blog/170698

Http://jingyan.baidu.com/article/c85b7a641200e0003bac95a3.html

Attention:
1, do not use 64-bit Ubuntu
2, be sure to allocate 4g or more swap space

System Customization Basic process: Get the source code--Modify the source (including modification and cropping)--Compile the modified source--Get target system files----porting system--Test succeeded--complete
One, the source code download
Google search download Android source code, the first result is the Official document (http://source.android.com/source/downloading.html) teach you how to download the source code, the approximate steps are as follows:
1, create a folder in the current user's home directory to save a write executable file, and add the folder to the environment variables;
mkdir ~/bin
Path=~/bin: $PATH

2, install curl, install git, download repo;
sudo apt-get Install Curl
sudo apt-get install git
If you want to use a proxy:
Curl-x 127.0.0.1:8087 Http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Do not use proxies:
Curl Http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
And, of course, let repo have executable permissions:
chmod a+x ~/bin/repo

3, create a folder to store Android source code
mkdir working_directory
CD working_directory

4. Initialize the warehouse information and set the version to be downloaded
Repo Init-u https://android.googlesource.com/platform/manifest
Repo Init-u https://android.googlesource.com/platform/manifest-b ANDROID-4.0.1_R1
Ps:repo How to set up the proxy:
Export http_proxy=127.0.0.1:8087
Export https_proxy=127.0.0.1:8087

5, sync Android source code
Repo Sync
PS: In the synchronization process if the interruption do not worry, the use of Repo Sync can continue to sync, sync content is hidden during synchronization, to the source synchronization directory by Ctrl+h can view hidden content; I downloaded android-4.0.1_r1 about 11g, used for almost 10 hours; Telecom 20m+ agent about 3 hours download complete
Second, the configuration of the compilation environment
The compilation process is notable for using 32-bit systems and ensuring sufficient memory space!!!
Android compilation requires a lot of dependencies, and here's a list of dependencies I've compiled and some issues
1, install basic dependency support
sudo apt-get install build-essential make Libc6-dev
sudo apt-get install bison patch Texinfo Libncurses-dev
sudo apt-get install Flex Bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip
sudo apt-get install GnuPG ncurses-dev zlib1g-dev valgrind

Installation of 2,JDK
Because Oracle bought Sun, and then Google told the Android JDK platform can only reach 1.6 is jdk6, so with JDK7 is not, if the Android version is lower may also need to use JDK5, here Company use JDK6;
(1), Google search jdk-6u45-linux-i586.bin download JDK6 installation package (Oracle official not found)
(2), copy the installation package to the ~/bin directory
(3), give the installation package Execute permission
chmod a+x ~/bin/jdk-6u45-linux-i586.bin

(4), execute the installation package
~/bin/jdk-6u45-linux-i586.bin

(5), when execution is completed, it will be generated in the bin directory jdk-1.60_45 this directory to configure the bin directory in this directory to the environment variable
Path=~/bin/jdk-1.60_45/bin: $PATH
Execute Java command to check if installation is successful

Installation of 3,GCC and g++
Because Ubuntu comes with g++ and GCC version is too high, so can not compile the source code, here need to install 4.4.6 version
(1) Remove your own gcc and g++
sudo apt-get remove gcc
sudo apt-get remove g++

(2), install the 4.4 version of GCC and g++
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4

(3) To establish a connection for the 4.4 version of GCC and g++
Cd/usr/bin
sudo rm gcc
sudo rm g++
sudo rm cc
sudo ln gcc-4.4 gcc
sudo ln gcc-4.4 cc
sudo ln g++-4.4 g++

Third, source code compilation
CD ~/bin/working_directory
(-j4 is the number of specified threads, if the computer performance is good can be written-j8 or something)
Make-j4

Android source code compilation process

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.