blob: d76e86c49e6da92a8dcf553435cd9b946867f78b [file] [log] [blame] [view]
Skyler Kaufman44436912011-04-07 15:11:52 -07001<!--
Conley Owens68ef9842011-04-22 13:51:20 -07002 Copyright 2010 The Android Open Source Project
Skyler Kaufman44436912011-04-07 15:11:52 -07003
Conley Owens68ef9842011-04-22 13:51:20 -07004 Licensed under the Apache License, Version 2.0 (the "License");
Skyler Kaufman44436912011-04-07 15:11:52 -07005 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15-->
16
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070017# Downloading the Source Tree #
18
19## Installing Repo ##
20
Skyler Kaufman44436912011-04-07 15:11:52 -070021Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see [Version Control](version-control.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070022
23To install, initialize, and configure Repo, follow these steps:
24
25 - Make sure you have a bin/ directory in your home directory, and that it is included in your path:
26
27 $ mkdir ~/bin
28 $ PATH=~/bin:$PATH
29
30 - Download the Repo script and ensure it is executable:
31
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070032 $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070033 $ chmod a+x ~/bin/repo
34
Jean-Baptiste Queru2b326382012-04-24 15:00:11 -070035 - For version 1.15, the SHA-1 checksum for repo is
36 8eb56d98b36d615c3efec51868e87bebe757feb1
37
38 - For version 1.16, the SHA-1 checksum for repo is
39 f3bfa7fd2d0a44aa40579bb0242cc20df37b5e17
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070040
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -080041
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070042## Initializing a Repo client ##
43
44After installing Repo, set up your client to access the android source repository:
45
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070046 - Create an empty directory to hold your working files.
Jean-Baptiste Queru64175aa2011-11-08 17:25:08 -080047 If you're using MacOS, this has to be on a case-sensitive filesystem.
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070048 Give it any name you like:
49
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070050
51 $ mkdir WORKING_DIRECTORY
52 $ cd WORKING_DIRECTORY
53
54 - Run `repo 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.
55
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070056 $ repo init -u https://android.googlesource.com/platform/manifest
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070057
58 To check out a branch other than "master", specify it with -b:
59
Jean-Baptiste Queru3e466b02011-10-06 14:34:00 -070060 $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070061
Jean-Baptiste Queru60c81412012-04-19 15:00:44 -070062 - 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 a [registered Google account](https://www.google.com/accounts). 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.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070063
64A 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.
65
66
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070067## Getting the files ##
68
69To pull down files to your working directory from the repositories as specified in the default manifest, run
70
71 $ repo sync
72
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070073The Android source files will be located in your working directory
74under their project names. The initial sync operation will take
75an hour or more to complete. For more about `repo sync` and other
76Repo commands, see [Version Control](version-control.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070077
78
Jean-Baptiste Queru2e2de672012-01-05 09:08:46 -080079## Using authentication ##
80
81By default, access to the Android source code is anonymous. To protect the
82servers against excessive usage, each IP address is associated with a quota.
83
84When sharing an IP address with other users (e.g. when accessing the source
85repositories from beyond a NAT firewall), the quotas can trigger even for
86regular usage patterns (e.g. if many users sync new clients from the same IP
87address within a short period).
88
89In that case, it is possible to use authenticated access, which then uses
90a separate quota for each user, regardless of the IP address.
91
92The first step is to create a password from
93[the password generator](https://android.googlesource.com/new-password) and
94to save it in `~/.netrc` according to the instructions on that page.
95
96The second step is to force authenticated access, by using the following
97manifest URI: `https://android.googlesource.com/a/platform/manifest`. Notice
98how the `/a/` directory prefix triggers mandatory authentication. You can
99convert an existing client to use mandatory authentication with the following
100command:
101
102 $ repo init -u https://android.googlesource.com/a/platform/manifest
103
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -0800104## Troubleshooting network issues ##
105
106When downloading from behind a proxy (which is common in some
107corporate environments), it might be necessary to explicitly
108specify the proxy that is then used by repo:
109
110 $ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
111 $ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
112
113More rarely, Linux clients experience connectivity issues, getting
114stuck in the middle of downloads (typically during "Receiving objects").
115It has been reported that tweaking the settings of the TCP/IP stack and
116using non-parallel commands can improve the situation. You need root
117access to modify the TCP setting:
118
119 $ sudo sysctl -w net.ipv4.tcp_window_scaling=0
120 $ repo sync -j1
121
122
Jean-Baptiste Queru76adec62012-01-05 10:12:06 -0800123## Using a local mirror ##
124
125When using many clients, especially in situations where bandwidth is scarce,
126it is better to create a local mirror of the entire server content, and to
127sync clients from that mirror (which requires no network access).
128
129These instructions assume that the mirror is created in `/usr/local/aosp/mirror`.
130The first step is to create and sync the mirror itself, which uses close to
13110GB of network bandwidth and a similar amount of disk space. Notice the
132`--mirror` flag, which can only be specified when creating a new client:
133
134 $ mkdir -p /usr/local/aosp/mirror
135 $ cd /usr/local/aosp/mirror
136 $ repo init -u https://android.googlesource.com/mirror/manifest --mirror
137 $ repo sync
138
139Once the mirror is synced, new clients can be created from it. Note that it's
140important to specify an absolute path:
141
142 $ mkdir -p /usr/local/aosp/master
143 $ cd /usr/local/aosp/master
144 $ repo init -u /usr/local/aosp/mirror/platform/manifest.git
145 $ repo sync
146
147Finally, to sync a client against the server, the mirror needs to be synced
148against the server, then the client against the mirror:
149
150 $ cd /usr/local/aosp/mirror
151 $ repo sync
152 $ cd /usr/local/aosp/master
153 $ repo sync
154
155It's possible to store the mirror on a LAN server and to access it over
156NFS, SSH or Git. It's also possible to store it on a removable drive and
157to pass that drive around between users or between machines.
158
159
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700160## Verifying Git Tags ##
161
162Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.
163
164 $ gpg --import
165
166Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.
167
Conley Owens68ef9842011-04-22 13:51:20 -0700168 -----BEGIN PGP PUBLIC KEY BLOCK-----
169 Version: GnuPG v1.4.2.2 (GNU/Linux)
Jean-Baptiste Queru6a64a5b2011-05-25 09:07:50 -0700170
Conley Owens68ef9842011-04-22 13:51:20 -0700171 mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
172 lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
173 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
174 u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
175 wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
176 /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
177 jU5SA/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dDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
194 hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
195 EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
196 =Wi5D
197 -----END PGP PUBLIC KEY BLOCK-----
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700198
Conley Owens68ef9842011-04-22 13:51:20 -0700199After importing the keys, you can verify any tag with
200
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700201 $ git tag -v TAG_NAME
202
Conley Owens34e98122011-12-09 16:11:30 -0800203If you haven't [set up ccache](initializing.html#ccache) yet,
204now would be a good time to do it.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700205
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700206# Next: Build the code #
207
208You now have a complete local copy of the Android codebase. Continue on to [building](building.html)....