Android6.0源码编译笔记(二)-利用国内镜像源同步AOSP源码

目前墙太高,vpn可能无效,所以使用清华/中科大镜像源同步源码。

清华AOSP镜像源https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

中科大AOSP镜像源https://lug.ustc.edu.cn/wiki/mirrors/help/aosp

这里以我自己同步清华镜像源为例。
(一)下载安装repo

mkdir ~/bin         //创建bin目录
PATH=~/bin:$PATH      //把repo路径添加到PATH中

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo                    //授予执行权限

(二)同步源码

下载每月更新的初始包https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar,下载完成后记得根据 checksum.txt 的内容校验一下。

由于所有代码都是从隐藏的.repo目录中 checkout 出来的,所以只保留了.repo目录,下载后解压 再repo sync一遍即可得到完整的目录。

wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
 //下载初始化包。可直接打开网址用迅雷下载,断点续传
tar xf aosp-latest.tar                            
   //解压得到的 AOSP 工程目录这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
cd  AOSP           //进入源码目录,依据自己的源码工作目录而定
 repo sync        //正常同步一遍即可得到完整目录,也需要很长时间//或 repo sync -l 仅checkout代码

此后,每次只需运行repo sync即可保持同步
同步完成之后,在目录下 ctrl+H可以看到隐藏的.repo文件夹

同步好的源码目录如下


(三)替换已有的CM /aosp源代码从 TUNA 同步部分代码

我在百度云上下载了别人打包下载好的完整CM12源码,包括.repo目录,解压之后可以利用清华源码镜像同步部分aosp主干源码。

在 init初始化 这一步完成后, 后通过 TUNA 同步 AOSP 部分

cd ~/android/cm
sudo gedit .repo/manifest.xml
//用gedit编辑器打开.repo/manifest.xml,也可以直接找到目录打开

把其中的 aosp 这个 remote 的 fetch 从https://android.googlesource.com改为https://aosp.tuna.tsinghua.edu.cn/或git://aosp.tuna.tsinghua.edu.cn/aosp

以下两步CM中不需要,AOSP需要**

sudo gedit ~/android/cm/.repo/manifests.git/config

将url=https://android.googlesource.com/platform/manifest更改为
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest或 url = git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值