Ubantu16.04 Compilation Flow of Android 8.0 Source Code

  • 2021-08-17 01:12:00
  • OfStack

Divided into four processes

Source download Building a compilation environment Compile source code Run

Source download

Install git and configure


// Installation git
sudo apt-get install git

// Configure git Name and mailbox 
git config --global user.name "your name"
git config --global user.email XXX@XXX.com

Create bin directory and source directory of repo

1. Create the bin directory for repo

midir ~/bin

2. Create a source directory

midir ~/source

Installing repo

Due to the anomaly of Cannot get http://gerrit.googlesource.com/git-repo/clone.bundle when adopting the common online installation method of repo, through online search, the reason is that repo can't connect to the git warehouse of the project itself when it needs to update its own project. Here, the latest project of repo is manually pulled

1. Pull repo project from git

git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo

2. Copy the repo files in git-repo to the ~/bin directory

3. Create a new. repo folder in the ~/source directory, rename git-repo to repo and copy to the. repo directory

4. Add ~/bin/repo to the environment variable and give permissions


// Give permission 
chmod a+x ~/bin/repo
// Add to environment variable 
 Will export REPO=~/bin  Add to ~/.bash_profile
/// Make the configuration file take effect 
source ~/.bash_profile

Download source code

Initialize the warehouse

cd to the ~/source directory, execute the following command

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest

Or this command


repo init -u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest

The effect of the two is 1, only the protocol is different.

If, during the execution of this command, you are prompted that you cannot connect to gerrit. googlesource. com, you just need to edit the ~/bin/repo file, find the line REPO_URL, and modify its contents to:


REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'

Then re-execute the above command.

Supplementary notes

The manifest command without parameters is used to get the latest code on master, but you can specify a specific version of android with the-b parameter. For example, if we want to get the android-4. 0.1 _r1 branch, the command is as follows:

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1
(For the current list of all branches of the AOSP project see: Branch List)

Synchronization code

The command is as follows

repo sync

Summarize


Related articles: