AOSP 源码下载
网上关于这块大部分教程都是无效的,因为墙的缘故,无法使用官方提供的下载链接,我这里使用了清华大学的镜像,是能够顺利将 AOSP 下载下来。如果你还没有安装 Ubuntu,请看《VirtualBox 安装 Ubuntu》。
下载 repo
Repo 是一款工具,可让您在 Android 环境中更轻松地使用 Git,首先需要安装 Git:
sudo apt-get install git
创建 bin,并加入 path:
mkdir ~/bin
PATH=~/bin:$PATH
下载 repo:
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
错误:
Command 'curl' not found, but can be installed with:
sudo apt install curl
需要安装 curl,执行命令sudo apt-get install curl
进行安装。
注意:命令 apt
在低版本 Ubuntu 不行,本教程统一使用命令 apt-get
。
权限设置:
chmod a+x ~/bin/repo
如何验证 repo 安装成功
输入命令repo
,提示:
/usr/bin/env: "python": 没有那个文件或目录
需要安装 python,执行命令sudo apt-get install python
安装,再次输入命令repo
,提示如下即 repo 安装成功:
error: repo is not installed. Use "repo init" to install it here.
下载源码
初始化仓库
建立工作目录 AOSP,命令:
mkdir AOSP
cd AOSP
初始化仓库:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
错误
错误1
error.GitError: manifests var:
*** 请告诉我你是谁。
运行
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
来设置您账号的缺省身份标识。
如果仅在本仓库设置身份标识,则省略 --global 参数。
没有设置身份,要使用 Gerrit 代码审核工具,您需要一个与已注册的 Google 帐号关联的电子邮件地址:
git config --global user.email "wuxiaolong.me@gmail.com"
git config --global user.name "WuXiaolong"
其他邮箱应该也是可以的。
错误2
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno 101] Network is unreachable
因为 repo 运行过程中会尝试访问官方的 git 源更新自己,如果想使用 tuna 的镜像源进行更新,将如下内容复制到你的~/.bashrc
里,然后重启终端模拟器。
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
错误3:
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
为什么会出现此种 log ?
在通过 Git 的 HTTP 协议下载最新数据之前,Repo 尝试下载预先打包的捆绑文件以引导每个 git。
原文:Repo attempts to download a prepackaged bundle file to bootstrap each git prior to downloading the most recent data via Git's HTTP protocol.
如果捆绑文件不可用(如本例所示),Repo 将忽略它并继续进行,换句话说,不要注意这一点。
原文:If a bundle file isn't available (like in this case), Repo will ignore it and proceed anyway. In other words, don't pay any attention to this.
最后,如何取消 download clone.bundle ?
只需要 在repo 添加一个参数 --no-clone-bundle,如下:
可通过 repo -h 获得参数 --no-clone-bundle 的说明
repo init --no-clone-bundle
repo sync --no-clone-bundle
指定某个 Android 版本
如果需要某个特定的 Android 版本(列表):
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.0.0_r1
提示以下,即 init 成功:
Your identity is: WuXiaolong <wuxiaolong.me@gmail.com>
If you want to change this, please re-run 'repo init' with --config-name
repo has been initialized in /media/disk/Project/AOSP
疑问
如果没有指定版本,如何知道下载好的 AOSP 是什么版本?
找到build/make/core/version_defaults.mk
文件打开,搜索PLATFORM_SDK_VERSION
,找到了 PLATFORM_SDK_VERSION := 28
,从 SDK 版本可以知道 AOSP 版本是 9.0,我下载的就是最新的。
同步代码
同步源码树(以后只需执行这条命令来同步):
repo sync
然后等待下载完毕:
正在检出文件: 100% (1709/1709), 完成.
正在检出文件: 100% (9492/9492), 完成.在检出文件: 2% (251/9492)
正在检出文件: 100% (617/617), 完成.正在检出文件: 17% (106/617)
正在检出文件: 100% (15779/15779), 完成.检出文件: 7% (1251/15779)
正在检出文件: 100% (29/29), 完成. 正在检出文件: 27% (8/29)
Syncing work tree: 100% (568/568), done.
最后整个源码大小 27.2 G。
参考
https://source.android.google.cn/setup/
公众号
我的公众号:吴小龙同学,欢迎交流~
AOSP 源码下载的更多相关文章
- 【转】提供android 5.0 AOSP源码下载
http://blog.csdn.net/innost/article/details/41148335 android-5.0.tar.gz 115网盘礼包码:5lbcl16a1k7q http:/ ...
- Android Studio 导入 AOSP 源码
有了 AOSP 源码,接下来就是如何看了,可以直接文本看,可以用 Source Insight,我当然选择 Android Studio,Android Studio 是我熟悉且十分强大的工具.问题来 ...
- AOSP 源码整编单编
<AOSP 源码下载>完成后,就可以开编了. 整编 整编,顾名思义就是编译整个 Android 源码,最终 out 目录会生成几个重要的镜像文件,其中有 system.img.userda ...
- [原创]Nexus5 源码下载、编译、真机烧录过程记录
asop使用清华镜像源https://mirror.tuna.tsinghua.edu.cn/help/AOSP/ 一开始使用每月初始化包的方式因为无法搞定版本的问题,没能通过编译,无奈,老老实实一点 ...
- Android 7.1.1系统源码下载、编译、刷机-Nexus 6实战
想成为一位合格的Android程序员或者一位Android高级工程师是十分有必要知道Android的框架层的工作原理,要知道其工作原理那么就需要阅读Android的源代码. 想要阅读Android的源 ...
- android源码下载以及编译自己的ROM
android源码下载以及编译自己的ROM 最近发现kernel.org被墙了,为什么这种网站也能被墙了? 要想下载源码的话,只能绕过去了.下面是我从网上搜索到的一些下载方法: =========== ...
- Android 11 源码下载+编译教程
下载AOSP源码 这里我使用的是外国语大学的镜像执行的下载,Mac系统的话,一定要在区分大小姐的磁盘下执行 repo init -u https://mirrors.bfsu.edu.cn/git/A ...
- 将AOSP源码导入到Android Studio进行查看
生成iml和ipr文件 source build/envsetup.sh lunch aosp_x86-eng # 或者直接输入lunch,然后选择对应的target make idegen deve ...
- C# ini文件操作【源码下载】
介绍C#如何对ini文件进行读写操作,C#可以通过调用[kernel32.dll]文件中的 WritePrivateProfileString()和GetPrivateProfileString()函 ...
随机推荐
- 牛客nowcoder NOIP普及组第三场
qtmd AK了 直接题解吧 题目链接 A-十七边形 牛牛想在一个半径为r的圆中,找到一个内接的十七边形,使他的面积最大.输入半径r,输出最大的面积. 1 <= r <= 10000 在1 ...
- numpy方法介绍
三.numpy系列 1.np.maximum:(X, Y, out=None) X 与 Y 逐位比较取其大者: 最少接收两个参数 h=[[-2,2,10],[-5,-9,20]] hh=np.maxi ...
- README.md使用
1.标题: # 一级标题 ## 二级标题 ### 三级标题 2.换行: <br> 3.代码: ``` 代码在中间 ``` 4.表格: 表头 | 表头 | 表头 ---- | ----- | ...
- poj3274 找平衡数列(哈希加一点数学思维)
题目传送门 题目大意:有n只牛,每只牛有k个属性,接下来n个数字,每个数字的二进制位上的1和0分别表示某种属性的有或者无,然后一个特殊数列就是,一个区间内所有牛的各种属性的总和相等(有e种1属性 e ...
- 75th LeetCode Weekly Contest Smallest Rotation with Highest Score
Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1 ...
- Go语言基础之3--时间和日期序列
一.时间和日期类型 1. time包 2. time.Time类型,用来表示时间 3. 获取当前时间, now := time.Now() 实例1-1 打印输出当前时间 package main i ...
- java向mysql中写入中文出现乱码
乱码的原因有很多,我遇到的原因是url配置的问题,解决方案: 将: jdbc.url=jdbc:mysql://localhost:3306/XXXX?useUnicode=true&char ...
- STL-----c++标准模板
一.排序和检索 1.sort(v.begin,v.end) 2.lower_bound(v.begin,v.end,x)
- 信息领域热词分析系统--python过滤
利用python过滤去没用的词语,过滤的词语存储在停用文件中. #创建停用词表 def stopwordlist(): stopwords=[line.strip() for line in open ...
- 配置WAMP完美攻略
软件介绍 Wamp Server 是一款功能强大的PHP 集成安装环境. 为了节约时间,本次使用 Wamp Server 来进行配置. wamp 的全部含义就是本篇文章的标题. 使用版本和操作系统 W ...