<
Android源码镜像
>
上一篇

Linux 文件夹 权限 chmod命令
下一篇

Aosp 下载 编译 刷机

repo简介

repo是基于git的python脚本,官方使用python2.7,已经更新到python3.x了

目录简介

命令

null

AOSP下载

替换Google镜像为清华大学镜像

参考Google教程
https://android.googlesource.com/全部使用https://aosp.tuna.tsinghua.edu.cn/代替即可。


使用清华大学镜像站每月更新的初始化包

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

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

使用方法如下:

wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar
cd AOSP   # 解压得到的 AOSP 工程目录
# 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
repo sync # 正常同步一遍即可得到完整目录
# 或 repo sync -l 仅checkout代码

此后,每次只需运行repo sync即可保持同步。 我们强烈建议您保持每天同步,并尽量选择凌晨等低峰时间

传统方法获取

创建本地镜像

#Google
repo init -u https://android.googlesource.com/mirror/manifest --mirror
#中国科学技术大学
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest --mirror
#清华大学
repo init -u https://aosp.tuna.tsinghua.edu.cn/mirror/manifest --mirror

同步当前repo 即将镜像与服务器同步

repo sync

同步完成后,运行git daemon --verbose --export-all --base-path=WORKING_DIR WORKING_DIR(WORKING_DIR为代码树所在目录) 。

此后,其他用户使用git://your_ip/作为镜像即可。

替换已有的 AOSP 源代码的 remote

替换为清华大学镜像源

如果你之前已经通过某种途径获得了 AOSP 的源码(或者你只是 init 这一步完成后), 你希望以后通过 TUNA 同步 AOSP 部分的代码

  1. .repo/manifest.xml -> aosp这个remotefetch -> 从 https://android.googlesource.com 改为 https://aosp.tuna.tsinghua.edu.cn/

  2. 同时,修改 .repo/manifests.git/config -> url = https://android.googlesource.com/platform/manifest -> url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest

改为其它源同理

从本地镜像获取到工作目录

从本地镜像创建新客户端 repo init -u git://ip.to.mirror/platform/manifest.git

同步当前repo 即将客户端与镜像同步 repo sync

init时没-b指定分支的话 状态是no branches
后续必须执行repo start建分支才能开发,对每个仓库创建工作分支,checkout

repo start 分支

验证 Git 标记

将以下公钥加载到您的 GnuPG 密钥数据库中。该密钥用于对代表各版本的带注释标记进行签名。

gpg --import

复制并粘贴以下密钥,然后输入 EOF (Ctrl-D) 以结束输入并处理密钥。

(已复制到文件中)

导入密钥后,您可以通过以下命令验证任何标记:

git tag -v TAG_NAME

获取专有二进制文件

Top
Foot