下载Android11源码

下载repo脚本

mkdir ~/.bin   
PATH=~/.bin:$PATH     # 把bin文件夹加入环境变量的
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo  > ~/.bin/repo   #下载repo脚本
chmod a+x ~/.bin/repo   #添加权限

repo的运行过程中会尝试访问官方的git源更新自己,如果想使用tuna的镜像源进行更新,可以将如下内容复制到你的~/.bashrc里
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
并重启终端模拟器。

初始化仓库

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-11.0.0_r3

如果报找不到python,使用软链接来指向python3

sudo ln -s /usr/bin/python3.8 /usr/bin/python

repo经常会断开,可以使用脚本自动重连repo

echo "======start repo sync======"

PATH=~/.bin:$PATH

repo sync

while [ $? = 1 ]; do
        echo "======sync failed, re-sync again======"
        sleep 3
        repo sync
done

然后就是等好久
epo sync指令替换为repo sync --no-tags -j8,使用8个线程快一些(官方建议就用4个线程哈哈)


以上是使用清华源的方式,使用这个清华源的http协议也很有可能会中断,使用科大源官方帮助中的git源就挺稳定

AOSP(Android) 镜像使用帮助https://lug.ustc.edu.cn/wiki/mirrors/help/aosp/

如果您已经从官方同步了 AOSP 仓库,现在希望使用科大的 AOSP 仓库,请修改 .repo/manifests.git/config ,将
url = https://android.googlesource.com/platform/manifest
修改成
url = git://mirrors.ustc.edu.cn/aosp/platform/manifest

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容