2022ubuntu perfectly builds ASOP source code compilation environment (domestic image) 1 -- Download Image

Keywords: Linux Operation & Maintenance Ubuntu

Several core addresses

https://mirrors.tuna.tsinghua.edu.cn/help/git-repo/ Tsinghua Git Repo image help
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/ Tsinghua Android image help

Address of some relevant information

My environment is brand new ubuntu18

Download overall steps

1. Install repo
2. Install the global repo configuration file repo
3. Set update image 3.1
4. Create a new working directory and initialize the warehouse with repo init
5. Synchronize pull down the source file repo sync

6. The installation and compilation environment includes a series of things such as JDK

1. Install repo

sudo apt install repo

Just come all the way down

2. Global repo file

According to Tsinghua documents

If you don't have curl, remember to install it

sudo apt-get install curl
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo

It is modified here to download Tsinghua image faster

3. Set the update image address

sudo gedit ~/.bashrc

New code

# repo 
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

Configuration effective

source ~/.bashrc

4. Create a new working directory and start initializing the warehouse

Our goal is Android 8.0_ R2 so direct

mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-8.0.0_r2

Other branches open https://source.android.com/setup/start/build-numbers#source -Code tags and builds this website queries for version codes

Of course, it will fail unexpectedly because it can't connect to gerrit.googlesource.com. Let's set the image address and see Step 3

Initialization succeeded

python3 ~/bin/repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-8.0.0_r2


Your identity is: huruwo <1458476478@qq.com>
If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white 
  bold     dim      ul       reverse 
Enable color display in this user account (y/N)? y

repo has been initialized in /home/huruwo/ASOP_8.0_r2

Start synchronization

repo sync can add some command parameters

python3 ~/bin/repo sync

Then there is a long wait, but I have 200M broadband, which is estimated to be just a few hours

complete

Checking out files: 100% (96784/96784), done.
Checking out files: 100% (4867/4867), done.
Checking out files: 100% (3209/3209), done.
Checking out files: 100% (61/61), done.
Checking out files: 100% (1709/1709), done.
Checking out files: 100% (9492/9492), done.
Checking out files: 100% (921/921), done.
Checking out files: 100% (1309/1309), done.
Checking out files: 100% (617/617), done.
Checking out: 100% (568/568), done in 19m53.907s
repo sync has finished successfully.

Emergence and solution of various problems

1.file=sys.stderr

This is also the most common mistake

I searched for a long time to find the perfect solution

First of all, this problem is caused by the version of python

Our higher version of ubuntu defaults to Python 3. X

But the python command is still 2.7

such as

python
Python 2.7.17 (default, Feb 27 2021, 15:10:58) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-8.0.0_r2
  File "/home/huruwo/ASOP_8.0_r2/.repo/repo/main.py", line 79
    file=sys.stderr)
        ^
SyntaxError: invalid syntax

We can open it

gdeit /home/huruwo/ASOP_8.0_r2/.repo/repo/main.py

#!/usr/bin/env python3

if sys.version_info.major < 3:
  print('repo: error: Python 2 is no longer supported; '
        'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_SOFT),
        file=sys.stderr)
  sys.exit(1)

As you can see, here is the checked version

Declared that python2 is no longer supported

The solution is to point the default python to 3.x instead of 2.7

Many places teach us how to modify the default python pointer

Having Python open is the same as the python 3 command

But I don't recommend this. It's better to start rep's init directly with Python 3

Replace command

python3 ~/bin/repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-8.0.0_r2

Note that this points to the file ~ / bin/repo instead of the default path

2.Please tell me who you are.

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'huruwo@ubuntu.(none)')

Small problem. You didn't enter the relevant configuration information. Just follow these two git commands

Like mine

git config --global user.email "1458476478@qq.com"
git config --global user.name "huruwo"

3. Certificate problem / etc / SSL / certs / Ca certificates.crt crlfile: None

/etc/ssl/certs/ca-certificates.crt CRLfile: none

Configure ignore certificate

Command line input

export GIT_SSL_NO_VERIFY=1

Posted by robvan75 on Mon, 08 Nov 2021 20:51:00 -0800