AOSP 源码下载
source link: http://wuxiaolong.me/2018/07/07/AOSP1/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
AOSP 源码下载
网上关于这块大部分教程都是无效的,因为墙的缘故,无法使用官方提供的下载链接,我这里使用了清华大学的镜像,是能够顺利将 AOSP 下载下来。如果你还没有安装 Ubuntu,请看《VirtualBox 安装 Ubuntu》。
下载 repo
Repo 是一款工具,可让您在 Android 环境中更轻松地使用 Git,首先需要安装 Git:
创建 bin,并加入 path:
下载 repo:
需要安装 curl,执行命令sudo apt-get install curl
进行安装。
注意:命令 apt
在低版本 Ubuntu 不行,本教程统一使用命令 apt-get
。
权限设置:
如何验证 repo 安装成功
输入命令repo
,提示:
需要安装 python,执行命令sudo apt-get install python
安装,再次输入命令repo
,提示如下即 repo 安装成功:
初始化仓库
建立工作目录 AOSP,命令:
初始化仓库:
没有设置身份,要使用 Gerrit 代码审核工具,您需要一个与已注册的 Google 帐号关联的电子邮件地址:
其他邮箱应该也是可以的。
因为 repo 运行过程中会尝试访问官方的 git 源更新自己,如果想使用 tuna 的镜像源进行更新,将如下内容复制到你的~/.bashrc
里,然后重启终端模拟器。
为什么会出现此种 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 的说明
指定某个 Android 版本
如果需要某个特定的 Android 版本(列表):
提示以下,即 init 成功:
如果没有指定版本,如何知道下载好的 AOSP 是什么版本?
找到build/make/core/version_defaults.mk
文件打开,搜索PLATFORM_SDK_VERSION
,找到了 PLATFORM_SDK_VERSION := 28
,从 SDK 版本可以知道 AOSP 版本是 9.0,我下载的就是最新的。
同步源码树(以后只需执行这条命令来同步):
然后等待下载完毕:
最后整个源码大小 27.2 G。
https://source.android.google.cn/setup/
我的微信公众号:吴小龙同学,欢迎关注交流,公号回复关键字「1024」有惊喜哦。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK