Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, seeVersion Control.
To install, initialize, and configure Repo, follow these steps:
-
Make sure you have a bin/ directory in your home directory, and that it is included in your path:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
-
Download the Repo script and ensure it is executable:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
-
The SHA-1 checksum for repo is 29ba4221d4fccdfa8d87931cd73466fdc24040b5
Initializing a Repo client
After installing Repo, set up your client to access the android source repository:
-
Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
-
Runrepo init
to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in
the Android source will be placed within your working directory.
$ repo init -u https://android.googlesource.com/platform/manifest
To check out a branch other than "master", specify it with -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
-
When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with aregistered Google account.
Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.
A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a.repo
directory where files such as
the manifest will be kept.
Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
$ repo sync
The Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more aboutrepo sync
and other
Repo commands, seeVersion Control.
Using authentication
By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota.
When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).
In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.
The first step is to create a password fromthe password generatorand to save it in~/.netrc
according
to the instructions on that page.
The second step is to force authenticated access, by using the following manifest URI:https://android.googlesource.com/a/platform/manifest
. Notice how the/a/
directory
prefix triggers mandatory authentication. You can convert an existing client to use mandatory authentication with the following command:
$ repo init -u https://android.googlesource.com/a/platform/manifest
Troubleshooting network issues
When downloading from behind a proxy (which is common in some corporate environments), it might be necessary to explicitly specify the proxy that is then used by repo:
$ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
$ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
More rarely, Linux clients experience connectivity issues, getting stuck in the middle of downloads (typically during "Receiving objects"). It has been reported that tweaking the settings of the TCP/IP stack and using non-parallel commands can improve the situation.
You need root access to modify the TCP setting:
$ sudo sysctl -w net.ipv4.tcp_window_scaling=0
$ repo sync -j1
Using a local mirror
When using many clients, especially in situations where bandwidth is scarce, it is better to create a local mirror of the entire server content, and to sync clients from that mirror (which requires no network access).
These instructions assume that the mirror is created in/usr/local/aosp/mirror
. The first step is to create and sync the mirror itself, which uses close to 10GB of network bandwidth and a similar
amount of disk space. Notice the--mirror
flag, which can only be specified when creating a new client:
$ mkdir -p /usr/local/aosp/mirror
$ cd /usr/local/aosp/mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync
Once the mirror is synced, new clients can be created from it. Note that it's important to specify an absolute path:
$ mkdir -p /usr/local/aosp/master
$ cd /usr/local/aosp/master
$ repo init -u /usr/local/aosp/mirror/platform/manifest.git
$ repo sync
Finally, to sync a client against the server, the mirror needs to be synced against the server, then the client against the mirror:
$ cd /usr/local/aosp/mirror
$ repo sync
$ cd /usr/local/aosp/master
$ repo sync
It's possible to store the mirror on a LAN server and to access it over NFS, SSH or Git. It's also possible to store it on a removable drive and to pass that drive around between users or between machines.
Verifying Git Tags
Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.
$ gpg --import
Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux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ScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----
After importing the keys, you can verify any tag with
$ git tag -v TAG_NAME
If you haven'tset up ccacheyet, now would be a good time to do it.
Downloading kernels
If you are only interested in kernel sources, you can get the kernel you are interested in through one of the following commands:
$ git clone https://android.googlesource.com/kernel/common.git
$ git clone https://android.googlesource.com/kernel/goldfish.git
$ git clone https://android.googlesource.com/kernel/msm.git
$ git clone https://android.googlesource.com/kernel/omap.git
$ git clone https://android.googlesource.com/kernel/samsung.git
$ git clone https://android.googlesource.com/kernel/tegra.git
Next: Build the code
You now have a complete local copy of the Android codebase. Continue on tobuilding....
分享到:
相关推荐
最近2013-11-29(Nov 29, 2013)更新的Android ZXing 2.3.0 release源码及编译后的core-2.3.0.jar和android-integration-2.3.0.jar打包亲测可用,如大家有兴趣自己编译的话请参考下面的教程。 下面我写的教程修改自...
下载Android Studio Intellij,SDK和Nox模拟器软件 您将学到什么 Java编程语言 Android Studio 查看和添加数据 使用Fire Web创建应用程序 制作在线视频应用程序 制作Mp3应用程序 SQLite数据库 JSON Web服务 使用邮递...
Ubuntu16.04编译Android源码7.0和4.4及踩坑 一.虚拟机环境配置 1.1Ubuntu怎样修改软件源地址 1.2共享文件夹 1.3虚拟机配置 二.操作指南 2.1将源文件拷贝到linux环境下后解压并编译 2.2相关工具安装 3.3推荐...
EhLib 8.0 Build 8.0.023 Pro Edition FullSource for D7-XE8 亲测可用,含全部源码及 Demo The Library contains components and classes for Borland Delphi versions 7, 9, Developer Studio 2006, Delphi 2007...
Android Gradle插件 原始源代码,请参见
2、 复制并解压源码到DevExpressNETComponents的安装目录,通常是: C:\Program Files (x86)\DevExpress 18.2\Components\Sources 3、 安装Visual Studio 2010 独立Shell,编译Windows Form和WPF的Design项目要引用...
xx@xx:~/code/android_27$ source build/envsetup.sh 自动输出 including device/generic/mini-emulator-arm64/vendorsetup.sh including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh including d
从零手写vue3源码 从零开始手写实现vue3的部分源码 package.json配置项 private私有属性 包的存放空间 名称模块名@ vue / xxx表示vue包下的xxx模块,在约会模块时可以import'@ vue / xxx' main给commonjs使用,除时...
.Net Webservice Studio (Build on .net 4.5) source code
Welcome to the dynamic world of Android smartphone and tablet app development with the Android Software Development Kit (SDK), the JavaTM programming language and the rapidly evolving Android Studio ...
100% Full Source Code .NET Installation: ------------------ Under Delphi .NET, go to Component->Installed .NET Components and browse and select the Steema.TeeChart.VCL.Design.dll assembly (design-...
This directory contains source code and build script for CyUSB3 WDF kernel mode USB generic driver. This driver source code is readily compliable for operating system such as Windows 10, 8.1, 8, 7, ...
webpack-source-code ├── webpack-master // webpack 源码 ├── myProgram │ ├── src │ │ ├── utils │ │ ├── └── math.js │ │ └── index.js │ ├── build.js │ ├── package-lock....
单击右侧的“下载邮政编码”按钮以下载示例代码。 在访问目录页面。 看到错误? 报告,或简单地分叉并向我们发送拉取请求 笔记 对于如何运行代码的默认建议,假设您将构建目录放置在Learning-OpenCV-3_examples...
Samba Documents Provider Overview This is an Android app that extends the built in File Manager to support ...Download and unarchive Samba 4.5.1 source code. Change directory to the root of Samba
CodeBuild 和 AWS CodePipeline 构建、测试和发布代码库的连续管道。 aws-delivlib由.aws-delivlib使用,旨在支持通过 . 管道结构 delivlib 管道由以下顺序阶段组成。 每个阶段将同时执行所有任务: +-----------+ +...
java tools 源码 android-d8 andaroid build-tools d8 source code 作用 将class字节码文件转为dex,dx的升级版 编译环境 IDEA 反馈 QQEmail:
2 compact, you can download the source code and build their own micro-channel platform. 3 easy to use keywords, auto-reply, graphic, event, custom menus and other basic functions. According to the ...
* +__ [SourceCode] +_ CoolReport.vbp ---------------- 本组件的工程文件 * +__ [SourceCode] +_ frmCool.frm --------------- 本组件的表单需求文件 * +__ [SourceCode] +_ CircleGrap.cls ---------------- 本...
编辑app / app / build.gradle(applicationId,versionCode,versionName)。 在app / app / src / main / res / drawable(hdpi,mdpi,xhdpi)中更改应用程序图标。 填写online / plans.json并将其上传到某个...