Compile Android4.4.2 source code based on Ubuntu 14.04 LTS
Environment preparation:
Basic Environment: Ubuntu-14.04-desktop-64bit LTS (bare metal or Windows virtual machine can be installed, 12.04 can also, but 10.04 is not currently supported)
Other requirements: free disk space of more than GB, code part close to 10 Gb, others for git and compilation intermediate and target file preparation
========================================================== =
Part 1: Environment Initialization
========================================================== =
1. Install Oracle JDK
Note: if you cannot use OpenJDK to compile Android4.4, you must use Oracle JDK1.6 and 1.7.
For more information about how to install Oracle JDK, see my other article [install Oracle JDK in Ubuntu Linux].
2. install necessary tools and software
Note: This is different from the official package. The official package will report an error.
$ Sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev: i386 x11proto-core-dev: i386 libx11-dev: i386 libreadline6-dev: i386 libgl1-mesa-dev g ++-multilib mingw32 tofrodos python-markdown libxml2-utils unzip tproc zlib1g-dev: i386 dpkg-dev
$ Sudo ln-s/usr/lib/i386-linux-gnu/mesa/libGL. so.1/usr/lib/i386-linux-gnu/libGL. so
3. Configure USB Access Permissions
Add the following content to the/etc/udev/rules. d/51-android.rules file.
# Adb protocol on passion (Nexus One)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e12", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on passion (Nexus One)
SUBSYSTEM = "usb", ATTR {idVendor} = "0bb4", ATTR {idProduct} = "0fff", MODE = "0600", OWNER = "<username>"
# Adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e22", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e20", MODE = "0600", OWNER = "<username>"
# Adb protocol on stingray/wingray (Xoom)
SUBSYSTEM = "usb", ATTR {idVendor} = "22b8", ATTR {idProduct} = "70a9", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "708c", MODE = "0600", OWNER = "<username>"
# Adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM = "usb", ATTR {idVendor} = "04e8", ATTR {idProduct} = "6860", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e30", MODE = "0600", OWNER = "<username>"
# Adb protocol on panda (pandabard)
SUBSYSTEM = "usb", ATTR {idVendor} = "0451", ATTR {idProduct} = "d101", MODE = "0600", OWNER = "<username>"
# Adb protocol on panda (pandabard ES)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "d002", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on panda (PandaBoard)
SUBSYSTEM = "usb", ATTR {idVendor} = "0451", ATTR {idProduct} = "d022", MODE = "0600", OWNER = "<username>"
# Usbboot protocol on panda (PandaBoard)
SUBSYSTEM = "usb", ATTR {idVendor} = "0451", ATTR {idProduct} = "d00f", MODE = "0600", OWNER = "<username>"
# Usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM = "usb", ATTR {idVendor} = "0451", ATTR {idProduct} = "d010", MODE = "0600", OWNER = "<username>"
# Adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e42", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4e40", MODE = "0600", OWNER = "<username>"
# Adb protocol on manta (Nexus 10)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4ee2", MODE = "0600", OWNER = "<username>"
# Fastboot protocol on manta (Nexus 10)
SUBSYSTEM = "usb", ATTR {idVendor} = "18d1", ATTR {idProduct} = "4ee0", MODE = "0600", OWNER = "<username>"
Run the following command to replace the username in the above file with your username.
4. Configure ccache
Install ccache and add export USE_CCACHE = 1 ~ /. Bashrc.
$ Sudo apt-get install ccache
$ Source ~ /. Bashrc
========================================================== =
Part 2: source code download
========================================================== =
1. Install repo
(1) create a directory
$ Mkdir ~ /Bin
$ PATH = ~ /Bin: $ PATH
(2) download the repo Tool
Note: For firewall reasons, the official links cannot be used and must be replaced with the following:
Official curl http://commondatastorage.googleapis.com/git-repo-downloads/repo> ~ /Bin/repo
Available:
Curl http://git-repo.googlecode.com/files/repo-1.12> ~ /Bin/repo
(3) add executable permissions
$ Chmod a + x ~ /Bin/repo
2. initialize the Repo Client
(1) create a directory
$ Mkdir aosp
$ Cd aosp
(2) initialize repo
Note: A network error may occur later. Add the following content to/etc/hosts and follow these steps.
74.125.71.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173 cache.pack.google.com
You know why a network error occurs!
$ Repo init-u https://android.googlesource.com/platform/manifest-B android-4.4.2_r2
NOTE: If it is executed in a virtual machine, you must use the email verification method. For details, see [2].
Set the git user name and email address to replace your real email address and name:
Git config-global user. email "you@example.com"
Git config -- global user. name "Your Name"
Modify aosp/. resp/manifest. xml and change fetch = "..":
Fetch = "https://android.googlesource.com /"
3. Download source code
$ Repo sync
Note: The system may prompt you to upgrade the repo. It is best not to upgrade it unless you have full information to solve a series of problems after the upgrade.
Well, wait a few minutes, days and nights! I spent 5 hours
-------------------------------------- Split line --------------------------------------
Android 4.4.4 release and download
The simplest Ubuntu Touch & Android dual-System Installation Method
Enable dual-boot for Ubuntu and Android 4.4.2 on Nexus
Configure the Android SDK development environment in Ubuntu 14.04
Build the Android development environment under 64-bit Ubuntu 11.10 (JDK + Eclipse + ADT + Android SDK details)
How to configure the compiling environment of Android 14.04 kitkat on Ubuntu 4.4 x64
Install Android SDK on Ubuntu 12.10x64
-------------------------------------- Split line --------------------------------------
For more details, please continue to read the highlights on the next page: