AOSP源码下载

AOSP源码下载

一、Android源码传统方式下载操作

1、安装git和curl两个工具

sudo apt install git curl

2、设置你的git账号和邮箱

git config --global user.email "email address"
git config --global user.name "your name"

3、安装repo工具

mkdir ~/bin
export PATH=~/bin:$PATH  #添加path环境变量到.bashrc文件末尾
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
sudo chmod a+x ~/bin/repo

4、创建源码下载路径

mkdir android
cd android

5、初始化仓库

repo init -u https://android.googlesource.com/platform/manifest -b ${TARGER_BRANCH}   

6、下载代码

可直接使用repo sync进行同步,但是为了防止下载过程中中断,所以可以用下面的脚本来进行同步

    #!/bin/bash  
    echo "======start repo sync======"  
    repo sync  # 第一次下载android源代码
    while [ $? != 0 ]; do
        echo "======sync failed, re-sync again======"  
        sleep 2
        repo sync  #  如果出错,隔2秒后回继续调用repo sync下载android源代码
        done

二、安卓源码初始化包下载方法

[清华镜像站aosp源码下载说明](https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/)
[Aosp官方源码下载说明](https://source.android.com/setup/build/downloading)

三、repo命令使用说明

1、查看当前分支:repo branches
2、所有项目切换到指定分支,新建分支:repo start ${TARGET_BRANCH} –all

猜你喜欢

转载自blog.csdn.net/u014304560/article/details/80484305