环境:
Android13源码下载和构建之后会占用接近300G空间,构建多个版本会占用更多,
16GB及以上内存,32GB及以上swap空间,否则编译初期容易OOM,导致终端闪退
ArchLinux: 6.2.13-arch1-1 (64-bit)
JAVA:openjdk version "9"
PYTHON: Python 3.11.5
----------
i5双核
16G内存
32GB的Swap空间
1T硬盘
注意:若需要编译源码刷机,需要先确定要刷的手机支持的aosp版本,参考
aosp下载、编译、刷机和单编framework(android 12)
android-10.0.0_r47之下载、编译、运行
已不建议直接下载压缩包,建议直接使用repo更新,原因是多数系统python已被升级成了python3,python2被完全移除。而清华镜像压缩包里面的repo还是python2时候创建的,会引起各种初始化异常
1. 下载初始化包,约60G:https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
2. 解压预下载包,解压出aosp目录,只有隐藏文件夹.repo
tar xf aosp-latest.tar
- 创建目录,初始化仓库
查看android版本号
mkdir aosp
cd aosp
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r47
- 指定版本,同步代码
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r47
repo sync
若失败则重新执行,sync支持断点
repo sync --fail-fast
也可以用脚本执行同步
touch repo.sh
vim repo.sh
chmod a+x repo.sh
./repo.sh
脚本:
#!/bin/bash
repo sync -j4
while [ $? -ne 0 ]
do
echo "======sync failed ,re-sync again======"
sleep 3
repo sync -j4
done
- 查看分支,获取同步版本名

最低0.47元/天 解锁文章
833

被折叠的 条评论
为什么被折叠?



