blob: 7fabab551fc3de9771a5b2eafb811a01db32c2d3 [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 Queru2ab46c42012-06-06 15:21:35 -070035 - For version 1.17, the SHA-1 checksum for repo is
36 ddd79b6d5a7807e911b524cb223bc3544b661c28
Jean-Baptiste Querub79e4162012-06-04 14:03:57 -070037
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -080038
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070039## Initializing a Repo client ##
40
41After installing Repo, set up your client to access the android source repository:
42
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070043 - Create an empty directory to hold your working files.
Jean-Baptiste Queru64175aa2011-11-08 17:25:08 -080044 If you're using MacOS, this has to be on a case-sensitive filesystem.
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070045 Give it any name you like:
46
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070047
48 $ mkdir WORKING_DIRECTORY
49 $ cd WORKING_DIRECTORY
50
51 - 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.
52
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070053 $ repo init -u https://android.googlesource.com/platform/manifest
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070054
55 To check out a branch other than "master", specify it with -b:
56
Jean-Baptiste Queru3e466b02011-10-06 14:34:00 -070057 $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070058
Jean-Baptiste Queru60c81412012-04-19 15:00:44 -070059 - 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 -070060
61A 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.
62
63
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070064## Getting the files ##
65
66To pull down files to your working directory from the repositories as specified in the default manifest, run
67
68 $ repo sync
69
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070070The Android source files will be located in your working directory
71under their project names. The initial sync operation will take
72an hour or more to complete. For more about `repo sync` and other
73Repo commands, see [Version Control](version-control.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070074
75
Jean-Baptiste Queru2e2de672012-01-05 09:08:46 -080076## Using authentication ##
77
78By default, access to the Android source code is anonymous. To protect the
79servers against excessive usage, each IP address is associated with a quota.
80
81When sharing an IP address with other users (e.g. when accessing the source
82repositories from beyond a NAT firewall), the quotas can trigger even for
83regular usage patterns (e.g. if many users sync new clients from the same IP
84address within a short period).
85
86In that case, it is possible to use authenticated access, which then uses
87a separate quota for each user, regardless of the IP address.
88
89The first step is to create a password from
90[the password generator](https://android.googlesource.com/new-password) and
91to save it in `~/.netrc` according to the instructions on that page.
92
93The second step is to force authenticated access, by using the following
94manifest URI: `https://android.googlesource.com/a/platform/manifest`. Notice
95how the `/a/` directory prefix triggers mandatory authentication. You can
96convert an existing client to use mandatory authentication with the following
97command:
98
99 $ repo init -u https://android.googlesource.com/a/platform/manifest
100
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -0800101## Troubleshooting network issues ##
102
103When downloading from behind a proxy (which is common in some
104corporate environments), it might be necessary to explicitly
105specify the proxy that is then used by repo:
106
107 $ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
108 $ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
109
110More rarely, Linux clients experience connectivity issues, getting
111stuck in the middle of downloads (typically during "Receiving objects").
112It has been reported that tweaking the settings of the TCP/IP stack and
113using non-parallel commands can improve the situation. You need root
114access to modify the TCP setting:
115
116 $ sudo sysctl -w net.ipv4.tcp_window_scaling=0
117 $ repo sync -j1
118
119
Jean-Baptiste Queru76adec62012-01-05 10:12:06 -0800120## Using a local mirror ##
121
122When using many clients, especially in situations where bandwidth is scarce,
123it is better to create a local mirror of the entire server content, and to
124sync clients from that mirror (which requires no network access).
125
126These instructions assume that the mirror is created in `/usr/local/aosp/mirror`.
127The first step is to create and sync the mirror itself, which uses close to
12810GB of network bandwidth and a similar amount of disk space. Notice the
129`--mirror` flag, which can only be specified when creating a new client:
130
131 $ mkdir -p /usr/local/aosp/mirror
132 $ cd /usr/local/aosp/mirror
133 $ repo init -u https://android.googlesource.com/mirror/manifest --mirror
134 $ repo sync
135
136Once the mirror is synced, new clients can be created from it. Note that it's
137important to specify an absolute path:
138
139 $ mkdir -p /usr/local/aosp/master
140 $ cd /usr/local/aosp/master
141 $ repo init -u /usr/local/aosp/mirror/platform/manifest.git
142 $ repo sync
143
144Finally, to sync a client against the server, the mirror needs to be synced
145against the server, then the client against the mirror:
146
147 $ cd /usr/local/aosp/mirror
148 $ repo sync
149 $ cd /usr/local/aosp/master
150 $ repo sync
151
152It's possible to store the mirror on a LAN server and to access it over
153NFS, SSH or Git. It's also possible to store it on a removable drive and
154to pass that drive around between users or between machines.
155
156
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700157## Verifying Git Tags ##
158
159Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.
160
161 $ gpg --import
162
163Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.
164
Conley Owens68ef9842011-04-22 13:51:20 -0700165 -----BEGIN PGP PUBLIC KEY BLOCK-----
166 Version: GnuPG v1.4.2.2 (GNU/Linux)
Jean-Baptiste Queru6a64a5b2011-05-25 09:07:50 -0700167
Conley Owens68ef9842011-04-22 13:51:20 -0700168 mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
169 lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
170 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
171 u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
172 wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
173 /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
174 jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR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hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
192 EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
193 =Wi5D
194 -----END PGP PUBLIC KEY BLOCK-----
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700195
Conley Owens68ef9842011-04-22 13:51:20 -0700196After importing the keys, you can verify any tag with
197
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700198 $ git tag -v TAG_NAME
199
Conley Owens34e98122011-12-09 16:11:30 -0800200If you haven't [set up ccache](initializing.html#ccache) yet,
201now would be a good time to do it.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700202
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700203# Next: Build the code #
204
205You now have a complete local copy of the Android codebase. Continue on to [building](building.html)....