如何编译并修改aosp系统
使用 vnc进行链接
# 下载repo
这是一个python脚本,用来下载android镜像,首先在home目录下设置一下文件bin
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
1
2
3
4
2
3
4
# 国内下载
repo脚本会读取 REPO_URL 环境变量
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
1
2
3
2
3
# 下载位置
mkdir ~/AOSP
cd AOSP
1
2
2
# 配置git
git config --global user.name [Your Name]
git config --global user.email [you@example.com]
1
2
2
# 指定分支下载
# 国外
repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r1
# 国内
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-10.0.0_r1
1
2
3
4
5
2
3
4
5
# 同步镜像
repo sync -j8 # 8个线程
1
# centos
yum install gcc gcc-c++
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel make libffi-devel
# 修改
rm -rf /usr/bin/python
ln -s /usr/bin/python3 /usr/bin/python
# 任意目录
mkdir bin
PATH=./bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ./bin/repo
chmod a+x ./bin/repo
# 科大源
export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo'
git config --global user.name [Your Name]
git config --global user.email [you@example.com]
# 同步指定android
../bin/repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-10.0.0_r40
../bin/repo sync -j4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 启动镜像
# 安装依赖
sudo yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 java-1.8.0-openjdk-headless.x86_64
sudo yum install -y libstdc++.i686 libstdc++-devel.i686 perl cpio expat-devel gettext-devel autoconf glibc.i686 glibc-devel.i686 zlib-devel.i686 libX11-devel.i686 ncurses-devel.i686 ncurses-libs.i686 gperf flex bison patch unzip
1
2
3
4
5
2
3
4
5
# 重要
# 由于CentOS系统的yum指令依靠python2来执行,此时也需要将相应的命令调整成python2
vim /usr/bin/yum
把 #! /usr/bin/python 修改为 #! /usr/bin/python2
vim /usr/libexec/urlgrabber-ext-down
把 #! /usr/bin/python 修改为 #! /usr/bin/python2
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 编译文档
# 相关源
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
https://lug.ustc.edu.cn/wiki/mirrors/help/aosp/
# ubuntu
https://blog.csdn.net/yubo_725/article/details/117470199
# centos
https://cloud.tencent.com/developer/article/1121762
https://blog.csdn.net/yelo_go/article/details/123652770
https://www.jianshu.com/p/e0e992b51f31
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 按需定制
如何根据需要修改aosp源码
1
上次更新: 2023-06-27 21:41:54