blob: 81f1ba9e09a8140e83b9be3c12f2f72c7ce37cb6 [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 Queru5f2afb12011-12-05 17:19:47 -080035 - The SHA-1 checksum for repo is 29ba4221d4fccdfa8d87931cd73466fdc24040b5
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070036
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -080037
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070038## Initializing a Repo client ##
39
40After installing Repo, set up your client to access the android source repository:
41
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070042 - Create an empty directory to hold your working files.
Jean-Baptiste Queru64175aa2011-11-08 17:25:08 -080043 If you're using MacOS, this has to be on a case-sensitive filesystem.
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070044 Give it any name you like:
45
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070046
47 $ mkdir WORKING_DIRECTORY
48 $ cd WORKING_DIRECTORY
49
50 - 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.
51
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070052 $ repo init -u https://android.googlesource.com/platform/manifest
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070053
54 To check out a branch other than "master", specify it with -b:
55
Jean-Baptiste Queru3e466b02011-10-06 14:34:00 -070056 $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070057
58 - 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](http://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.
59
60A 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.
61
62
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070063## Getting the files ##
64
65To pull down files to your working directory from the repositories as specified in the default manifest, run
66
67 $ repo sync
68
Jean-Baptiste Querube48f612011-10-06 14:20:51 -070069The Android source files will be located in your working directory
70under their project names. The initial sync operation will take
71an hour or more to complete. For more about `repo sync` and other
72Repo commands, see [Version Control](version-control.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070073
74
Jean-Baptiste Queru2e2de672012-01-05 09:08:46 -080075## Using authentication ##
76
77By default, access to the Android source code is anonymous. To protect the
78servers against excessive usage, each IP address is associated with a quota.
79
80When sharing an IP address with other users (e.g. when accessing the source
81repositories from beyond a NAT firewall), the quotas can trigger even for
82regular usage patterns (e.g. if many users sync new clients from the same IP
83address within a short period).
84
85In that case, it is possible to use authenticated access, which then uses
86a separate quota for each user, regardless of the IP address.
87
88The first step is to create a password from
89[the password generator](https://android.googlesource.com/new-password) and
90to save it in `~/.netrc` according to the instructions on that page.
91
92The second step is to force authenticated access, by using the following
93manifest URI: `https://android.googlesource.com/a/platform/manifest`. Notice
94how the `/a/` directory prefix triggers mandatory authentication. You can
95convert an existing client to use mandatory authentication with the following
96command:
97
98 $ repo init -u https://android.googlesource.com/a/platform/manifest
99
Jean-Baptiste Queru57a79102012-01-05 08:52:23 -0800100## Troubleshooting network issues ##
101
102When downloading from behind a proxy (which is common in some
103corporate environments), it might be necessary to explicitly
104specify the proxy that is then used by repo:
105
106 $ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
107 $ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
108
109More rarely, Linux clients experience connectivity issues, getting
110stuck in the middle of downloads (typically during "Receiving objects").
111It has been reported that tweaking the settings of the TCP/IP stack and
112using non-parallel commands can improve the situation. You need root
113access to modify the TCP setting:
114
115 $ sudo sysctl -w net.ipv4.tcp_window_scaling=0
116 $ repo sync -j1
117
118
Jean-Baptiste Queru76adec62012-01-05 10:12:06 -0800119## Using a local mirror ##
120
121When using many clients, especially in situations where bandwidth is scarce,
122it is better to create a local mirror of the entire server content, and to
123sync clients from that mirror (which requires no network access).
124
125These instructions assume that the mirror is created in `/usr/local/aosp/mirror`.
126The first step is to create and sync the mirror itself, which uses close to
12710GB of network bandwidth and a similar amount of disk space. Notice the
128`--mirror` flag, which can only be specified when creating a new client:
129
130 $ mkdir -p /usr/local/aosp/mirror
131 $ cd /usr/local/aosp/mirror
132 $ repo init -u https://android.googlesource.com/mirror/manifest --mirror
133 $ repo sync
134
135Once the mirror is synced, new clients can be created from it. Note that it's
136important to specify an absolute path:
137
138 $ mkdir -p /usr/local/aosp/master
139 $ cd /usr/local/aosp/master
140 $ repo init -u /usr/local/aosp/mirror/platform/manifest.git
141 $ repo sync
142
143Finally, to sync a client against the server, the mirror needs to be synced
144against the server, then the client against the mirror:
145
146 $ cd /usr/local/aosp/mirror
147 $ repo sync
148 $ cd /usr/local/aosp/master
149 $ repo sync
150
151It's possible to store the mirror on a LAN server and to access it over
152NFS, SSH or Git. It's also possible to store it on a removable drive and
153to pass that drive around between users or between machines.
154
155
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700156## Verifying Git Tags ##
157
158Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.
159
160 $ gpg --import
161
162Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.
163
Conley Owens68ef9842011-04-22 13:51:20 -0700164 -----BEGIN PGP PUBLIC KEY BLOCK-----
165 Version: GnuPG v1.4.2.2 (GNU/Linux)
Jean-Baptiste Queru6a64a5b2011-05-25 09:07:50 -0700166
Conley Owens68ef9842011-04-22 13:51:20 -0700167 mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
168 lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
169 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
170 u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
171 wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
172 /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
173 jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
174 MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBE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EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
192 =Wi5D
193 -----END PGP PUBLIC KEY BLOCK-----
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700194
Conley Owens68ef9842011-04-22 13:51:20 -0700195After importing the keys, you can verify any tag with
196
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700197 $ git tag -v TAG_NAME
198
Conley Owens34e98122011-12-09 16:11:30 -0800199If you haven't [set up ccache](initializing.html#ccache) yet,
200now would be a good time to do it.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700201
Conley Owens91b9bab2011-12-12 14:30:13 -0800202## Downloading kernels ##
203
204If you are only interested in kernel sources,
205you can get the kernel you are interested in through one of the following
206commands:
207
208 $ git clone https://android.googlesource.com/kernel/common.git
209 $ git clone https://android.googlesource.com/kernel/goldfish.git
210 $ git clone https://android.googlesource.com/kernel/msm.git
211 $ git clone https://android.googlesource.com/kernel/omap.git
212 $ git clone https://android.googlesource.com/kernel/samsung.git
213 $ git clone https://android.googlesource.com/kernel/tegra.git
214
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700215# Next: Build the code #
216
217You now have a complete local copy of the Android codebase. Continue on to [building](building.html)....