1. Installing OPENJDK-7-JDK
Android 5.1 uses a JDK that is no longer an Oracle JDK, but an open source OpenJDK, after Ubuntu is installed, install the JDK using the following command:
$sudo Apt-get Install OPENJDK-7-JDK
When installed, set environment variables:
At the end of the/etc/profile file, add:
java_home=/usr/lib/jvm/java-7-openjdk-amd64/
Path= $PATH: $HOME/bin: $JAVA _home/bin
Export Java_home
Export PATH
2. Installing software that relies on compilation
Install the dependent software using the following command:
sudo apt-get install git gnupg Flex Bison gperf build-essential Zip curl Libc6-dev libncurses5-dev:i386 X11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dri:i386 libgl1-mesa-dev g++-multilib mingw32 Tofrodos Python-markdown libxml2-utils Xsltproc 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 the Cache
Configure the cache with the following command:
sudo apt-get install CCache
SOURCE ~/.BASHRC
4. Download Repo
1) Create repo directory
mkdir ~/bin
Path=~/bin: $PATH
2) Download repo (official repo can not download, the other repo mostly older, this time relatively new, I looked for a long cry)
git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/
Copy the repo files from the Git-repo to the bin directory after cloning
CP Git-repo/repo ~/bin/
To modify the repo file, set Repo_url as follows:
Repo_url = ' Git://aosp.tuna.tsinghua.edu.cn/android/git-repo '
5. Initialize Repo
1) Create a directory
mkdir ~/AOSP
2) Initialize Repo
CD ~/AOSP
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b ANDROID-5.1.1_R4
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b Android-6.0.1_r22
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b android-n-preview-1
PS: When initializing, the prompt requires email authentication, using the following command:
git config--global user.email "[Email protected]"
git config--global user.name "Your name"
6. Replace the existing AOSP source code remote
<remote name= "Aosp"
Fetch= "Git://aosp.tuna.tsinghua.edu.cn/android/"
review= "https://android-review.googlesource.com/"/>
7. Download the source code
Repo Sync
8. Source code Compilation
PS: Compilation process comparison, my computer dual-core, using single-threaded compilation, time bit about 12 hours, if using multi-threading, time should be exponentially reduced
1) Set the cache
CD AOSP
Prebuilts/misc/linux-x86/ccache/ccache-m 50G
2) initializing the compilation environment
. build/envsetup.sh
3) Select compile target Package
Ps:lunch the way there are many, you can use the lunch command to view, I use the most commonly used
Lunch Aosp_arm-eng
4) Compiling
Make
Ps:1.make later can be more parameters: such as your machine when dual-core, per-core dual-threaded words, using make-j4, so faster, but the compilation of memory used more
After 2.make fails or stops, you can continue compiling with make-k
Fourth chapter source code download and compile