ubuntu 22.04 编译 aosp 13 源码

执行 sudo apt install curl

test@test-Lenovo:~$ mkdir ~/bin

test@test-Lenovo:~ PATH=\~/bin:PATH

test@test-Lenovo:~$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

test@test-Lenovo:~$ chmod a+x ~/bin/repo

test@test-Lenovo:~$ mkdir aosp

test@test-Lenovo:~$ cd aosp/

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

/usr/bin/env: 'python': No such file or directory

5.python3 had installed,so should link:

test@test-Lenovo:~$ cd /usr/bin/

test@test-Lenovo:/usr/bin$ ls -l | grep python

lrwxrwxrwx 1 root root 23 7月 22 03:07 pdb3.8 -> ../lib/python3.8/pdb.py

lrwxrwxrwx 1 root root 31 7月 22 03:07 py3versions -> ../share/python3/py3versions.py

lrwxrwxrwx 1 root root 9 7月 22 03:07 python3 -> python3.8

-rwxr-xr-x 1 root root 5490352 6月 2 18:49 python3.8

-rwxr-xr-x 1 root root 384 3月 28 2020 python3-futurize

-rwxr-xr-x 1 root root 388 3月 28 2020 python3-pasteurize

test@test-Lenovo:/usr/bin$ sudo ln -s python3 python

test@test-Lenovo:/usr/bin$ ls -l | grep python

lrwxrwxrwx 1 root root 23 7月 22 03:07 pdb3.8 -> ../lib/python3.8/pdb.py

lrwxrwxrwx 1 root root 31 7月 22 03:07 py3versions -> ../share/python3/py3versions.py

lrwxrwxrwx 1 root root 7 11月 15 22:53 python -> python3

lrwxrwxrwx 1 root root 9 7月 22 03:07 python3 -> python3.8

-rwxr-xr-x 1 root root 5490352 6月 2 18:49 python3.8

-rwxr-xr-x 1 root root 384 3月 28 2020 python3-futurize

-rwxr-xr-x 1 root root 388 3月 28 2020 python3-pasteurize

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

repo: error: "git" is not available

repo: error: [Errno 2] No such file or directory: 'git'

Please make sure git is installed and in your path.

test@test-Lenovo:~/aosp$ sudo apt-get install git

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

Downloading Repo source from https://gerrit.googlesource.com/git-repo

repo的运行过程中会尝试访问官方的git源(errit.googlesource.com)更新自己,如果想使用tuna的镜像源进行更新,可以将如下内容复制到你的~/.bashrc里

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

test@test-Lenovo:~/aosp$ vi ~/.bashrc

test@test-Lenovo:~/aosp$ sudo apt-get install vim

test@test-Lenovo:~/aosp$ source ~/.bashrc

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

Downloading Repo source from https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

fatal: cannot make /home/test/aosp/.repo/repo directory: File exists

fatal: cloning the git-repo repository failed, will remove '.repo/repo'

test@test-Lenovo:~/aosp$ rm .repo/ -rf

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

Downloading Repo source from https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

fatal: unable to access 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/': server certificate verification failed. CAfile: none CRLfile: none

test@test-Lenovo:~/aosp$ git config --global http.sslverify false

test@test-Lenovo:~/aosp$ git config --global user.email "test@example.com"

test@test-Lenovo:~/aosp$ git config --global user.name "test"

test@test-Lenovo:~/aosp$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

repo has been initialized in /home/test/aosp

test@test-Lenovo:~/aosp$ repo sync

9.install java jdk:

执行 sudo apt-get install openjdk-8-jdk

10.install all libs:

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev

sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386

sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386

sudo apt-get install dpkg-dev libsdl1.2-dev

sudo apt-get install git-core gnupg flex bison gperf build-essential

sudo apt-get install zip curl zlib1g-dev gcc-multilib

sudo apt-get install libc6-dev-i386

sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev

sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4

sudo apt-get install lib32z-dev ccache

sudo apt-get install libssl-dev libncurses5

自己总结:分支切换====================================================================

切换分支到某个源码版本

进入到/aosp/.repo/manifests$

使用命令 git branch -a | grep "android-13"

既可以列出所有13的分支

remotes/origin/android-13.0.0_r1

remotes/origin/android-13.0.0_r10

remotes/origin/android-13.0.0_r11

remotes/origin/android-13.0.0_r12

remotes/origin/android-13.0.0_r13

...

2、切换分支

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-13.0.0_r6

编译源码

. build/envsetup.sh

lunch sdk_phone_x86_64 #must this

make

emulator

源码下载的其他方式===========================================================

12.other function download the source:

wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包

tar xf aosp-latest.tar # 解压

cd AOSP # 解压得到的 AOSP 工程目录

这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录

repo sync # 正常同步一遍即可得到完整目录

或 repo sync -l 仅checkout代码

repo sync may has this error:

error: Entry 'command.py' not uptodate. Cannot merge.

fatal:xxxxxxxx''v2.17.3.0

cd .repo/repo

git pull

相关推荐
绵绵细雨中的乡音1 小时前
网络基础知识
linux·网络
Peter·Pan爱编程2 小时前
Docker在Linux中安装与使用教程
linux·docker·eureka
kunge20133 小时前
Ubuntu22.04 安装virtualbox7.1
linux·virtualbox
清溪5493 小时前
DVWA中级
linux
Sadsvit3 小时前
源码编译安装LAMP架构并部署WordPress(CentOS 7)
linux·运维·服务器·架构·centos
xiaok3 小时前
为什么 lsof 显示多个 nginx 都在 “使用 443”?
linux
苦学编程的谢4 小时前
Linux
linux·运维·服务器
G_H_S_3_4 小时前
【网络运维】Linux 文本处理利器:sed 命令
linux·运维·网络·操作文本
Linux运维技术栈4 小时前
多系统 Node.js 环境自动化部署脚本:从 Ubuntu 到 CentOS,再到版本自由定制
linux·ubuntu·centos·node.js·自动化
拾心215 小时前
【运维进阶】Linux 正则表达式
linux·运维·正则表达式