美文网首页Android技术知识首页投稿(暂停使用,暂停投稿)Android开发
Android6.0源码编译笔记(二)-利用国内镜像源同步AOS

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

作者: 扒块腹肌 | 来源:发表于2016-06-30 08:15 被阅读8050次

目前墙太高,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

                                                         //下载repo,尚未FQ的同学建议在Windows下打开此网址下载好,然后复制进ubuntu虚拟机的~/bin目录,我提供已经下载好的repo,下载密码:smtg


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

相关文章

网友评论

    本文标题:Android6.0源码编译笔记(二)-利用国内镜像源同步AOS

    本文链接:https://www.haomeiwen.com/subject/dwixjttx.html