The Android Open Source Project | 5c11852 | 2008-10-21 07:00:00 -0700 | [diff] [blame^] | 1 | |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
| 5 | <title>Android - Getting Source Code</title> |
| 6 | <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=internal-codesite" type="text/javascript"></script> |
| 7 | <script src="http://code.google.com/js/jquery.js" type="text/javascript"></script> |
| 8 | <script type="text/javascript">var _tocPath_ = 'http://code.google.com/android/_toc.ezt';</script> |
| 9 | <script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script> |
| 10 | <link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet"> |
| 11 | </link> |
| 12 | |
| 13 | <!--[if IE]><link rel="stylesheet" type="text/css" href="/css/iehacks.css" /><![endif]--> |
| 14 | <script src="http://code.google.com/android/assets/search_autocomplete.js"></script> |
| 15 | <link rel="stylesheet" type="text/css" href="http://code.google.com/css/semantic_headers.css" /> |
| 16 | <link rel="stylesheet" type="text/css" href="http://code.google.com/android/assets/style.css" /> |
| 17 | <script> |
| 18 | jQuery(document).ready(function() { |
| 19 | jQuery("pre").addClass("prettyprint"); |
| 20 | }); |
| 21 | </script> |
| 22 | <style type="text/css"> |
| 23 | <!-- |
| 24 | h1,h2,h3 { |
| 25 | color: #000000; |
| 26 | } |
| 27 | --> |
| 28 | </style> |
| 29 | </head> |
| 30 | <body class="gc-documentation"> |
| 31 | <div id="gc-container"> |
| 32 | <a name="top"></a> |
| 33 | <div id="skipto"> </div> |
| 34 | <div id="langpref"> |
| 35 | <!--<a class="dropdown" href="/">English</a> <span>|</span> <a href="/more/">Site Directory</a> --> |
| 36 | </div> |
| 37 | <div id="gc-header"> |
| 38 | <div id="logo"><a href="http://code.google.com/android/index.html"><img src="http://code.google.com/android/images/logo_android.gif" alt="Android"/></a></div> |
| 39 | <div id="search" style="inline"> |
| 40 | <div id="searchForm" class="searchForm" style="height: 44px;"> |
| 41 | <!--previously form was here--> |
| 42 | </div> |
| 43 | <!-- end searchForm --> |
| 44 | <noscript> |
| 45 | <style type="text/css"> |
| 46 | .searchForm { |
| 47 | display : none !important; |
| 48 | } |
| 49 | .searchForm2 { |
| 50 | display : inline !important; |
| 51 | } |
| 52 | </style> |
| 53 | </noscript> |
| 54 | <div id="searchForm2" class="searchForm2" style="display:none"> |
| 55 | <form id="searchbox_001456098540849067467:6whlsytkdqg" action="http://www.google.com/cse"> |
| 56 | <input type="hidden" name="cx" value="001456098540849067467:6whlsytkdqg" /> |
| 57 | <input type="hidden" name="cof" value="FORID:0" /> |
| 58 | <input type="text" name="q" maxlength="2048" size="41" autocomplete="off" title="Google Code Search"/> |
| 59 | <input type="submit" name="sa" value="Search" title="Search"/> |
| 60 | <br/> |
| 61 | <div class="greytext">e.g. "ajax apis" or "open source"</div> |
| 62 | </form> |
| 63 | </div> |
| 64 | <!-- end searchForm2 --> |
| 65 | </div> |
| 66 | <!-- end search --> |
| 67 | </div> |
| 68 | <!-- end gc-header --> |
| 69 | <div id="searchControl" class="search-control"></div> |
| 70 | <!--[if IE]><iframe id="backiFrame" name="backiFrame" src='/dummy.html' style="display:none"></iframe><![endif]--> |
| 71 | <div id="codesiteContent"> |
| 72 | <a name="gc-topnav-anchor"></a> |
| 73 | <div id="gc-topnav"> |
| 74 | <h1>Android Platform Development Kit</h1> |
| 75 | <ul class="gc-topnav-tabs"> |
| 76 | <li id="sdk_link"> <a href="http://code.google.com/android/index.html" title="Android Software Development Kit">SDK</a> </li> |
| 77 | <li id="docs_link"> <a href="index.html" title="Official Android documentation">Docs</a> </li> |
| 78 | <li id="faq_link"> <a href="http://code.google.com/android/kb/index.html" title="Answers to frequently asked questions about Android">FAQ</a> </li> |
| 79 | <li> <a href="http://android-developers.blogspot.com/" title="Official Android blog">Blog</a> </li> |
| 80 | <li> <a href="http://code.google.com/android/groups.html" title="Android developer forum">Group</a> </li> |
| 81 | <li> <a href="http://code.google.com/android/terms.html" title="Android terms of service">Terms</a> </li> |
| 82 | <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20getting_source_code.html%20v0.3%20-%209%20June%202008)%0D%0A%0D%0ASUMMARY:%0D%0A%0D%0A%0D%0A%0D%0ASTEPS%20TO%20REPRODUCE:%0D%0A%0D%0A%0D%0A%0D%0AADDITIONAL%20NOTES:">Report a Problem</a> </li> |
| 83 | </ul> |
| 84 | </div> |
| 85 | <!-- end gc-topnav --> |
| 86 | <div class="g-section g-tpl-180"> |
| 87 | <a name="gc-toc"></a> |
| 88 | <div class="g-unit g-first" id="gc-toc"> |
| 89 | <ul> |
| 90 | <li> |
| 91 | <h1><a href="index.html">Documentation</a></h1> |
| 92 | <ul> |
| 93 | <li> <strong>Introduction</strong> |
| 94 | <ul> |
| 95 | <li><a href="system_requirements.html">Device Requirements</a></li> |
| 96 | </ul> |
| 97 | </li> |
| 98 | <li> <strong>Dev Environment Setup</strong> |
| 99 | <ul> |
| 100 | <li><a href="source_setup_guide.html">Host System Setup</a></li> |
| 101 | <li><a href="getting_source_code.html">Getting Source Code</a></li> |
| 102 | <li> <a href="intro_source_code.html">Source Code Overview</a></li> |
| 103 | <li><a href="build_system.html">Build System</a></li> |
| 104 | </ul> |
| 105 | </li> |
| 106 | <li> <strong>Basic Bring up</strong> |
| 107 | <ul> |
| 108 | <li><a href="build_new_device.html">Building New Device</a></li> |
| 109 | <li><a href="bring_up.html">Bring up</a></li> |
| 110 | <li><a href="keymaps_keyboard_input.html">Keymaps and Keyboard</a></li> |
| 111 | <li><a href="display_drivers.html">Display Drivers</a></li> |
| 112 | </ul> |
| 113 | </li> |
| 114 | <li> <strong>Multimedia</strong> |
| 115 | <ul> |
| 116 | <li><a href="audio_sub_system.html">Audio Subsystem</a></li> |
| 117 | </ul> |
| 118 | </li> |
| 119 | <li> <strong>Power Management</strong> |
| 120 | <ul> |
| 121 | <li><a href="power_management.html">Power Management</a></li> |
| 122 | </ul> |
| 123 | </li> |
| 124 | <li> <strong>Telephony</strong> |
| 125 | <ul> |
| 126 | <li><a href="telephony.html">Radio Interface Layer</a></li> |
| 127 | </ul> |
| 128 | </li> |
| 129 | <li> <strong>Testing</strong> |
| 130 | <ul> |
| 131 | <li><a href="instrumentation_framework.html">Instrumentation Framework</a></li> |
| 132 | <li><a href="instrumentation_testing.html">Instrumentation Testing</a></li> |
| 133 | </ul> |
| 134 | </li> |
| 135 | </ul> |
| 136 | </li> |
| 137 | </ul> |
| 138 | </div> |
| 139 | <a name="gc-pagecontent"></a> |
| 140 | <div class="g-unit" id="gc-pagecontent"> |
| 141 | <div id="jd-content"> |
| 142 | <div class="jd-descr"> |
| 143 | |
| 144 | |
| 145 | <a name="androidGettingSourceCodeTitle"></a><h1>Getting Source Code</h1> |
| 146 | |
| 147 | |
| 148 | |
| 149 | <a name="toc"/> |
| 150 | <div style="padding:10px"> |
| 151 | <a href="#androidSourceSetupBuildGitSetup">Introduction</a><br/> |
| 152 | <a href="#androidSourceSetupBuildGitSetupInstall">Installing and Configuring Git</a><br/> |
| 153 | <a href="#androidSourceSetupBuildGitSetupServer">Establishing Server Access</a><br/><div style="padding-left:40px"> |
| 154 | |
| 155 | <a href="#androidSourceSetupBuildGitSetupServerRSAKeys">Generating RSA Keys</a><br/> |
| 156 | <a href="#androidSourceSetupBuildGitSetupServerVerifyConnection">Verifying a Connection to the Git Server</a><br/></div> |
| 157 | <a href="#androidSourceSetupGetCode">Downloading Code</a><br/> |
| 158 | <a href="#androidSourceSetupExtractingPatch">Extracting an Android Patch</a><br/></div></font></div> |
| 159 | |
| 160 | <a name="androidSourceSetupBuildGitSetup"></a><h2>Introduction</h2> |
| 161 | |
| 162 | <p>Android relies on Git, a version control system, to install the Android platform. You will need to install Git 1.5.2 or greater in order to access the source tree. Please visit <a href="http://git.or.cz/">http://git.or.cz/</a> for more information regarding Git.</p> |
| 163 | <p>Git permits you to control access to working directories, and we recommend that you use it to limit Android repository access to only a few people within your organization (please refer to your Google NDA for potential contractual restraints on sharing Android source access). </p> |
| 164 | <p>You may clone Google's repository to a local copy for sharing internally (see Git documentation for details).</p> |
| 165 | |
| 166 | |
| 167 | <a name="androidSourceSetupBuildGitSetupInstall"></a><h2>Installing and Configuring Git</h2> |
| 168 | |
| 169 | <p>To install the Git package, execute:</p> |
| 170 | <pre class="prettyprint"> |
| 171 | % sudo apt-get install git-core |
| 172 | </pre> |
| 173 | |
| 174 | |
| 175 | <a name="androidSourceSetupBuildGitSetupServer"></a><h2>Establishing Server Access</h2> |
| 176 | |
| 177 | <p>Once Git is cleanly installed, you need to establish a connection with Google's Git server, a connection that requires an RSA key in order to authenticate requests.</p> |
| 178 | |
| 179 | |
| 180 | <a name="androidSourceSetupBuildGitSetupServerRSAKeys"></a><h3>Generating RSA Keys</h3> |
| 181 | |
| 182 | <p>Each developer must have a unique RSA key in order to access Android source code. To generate an RSA key: </p> |
| 183 | <p> |
| 184 | <ol> |
| 185 | <li>Type:<br/> |
| 186 | <pre class="prettyprint">% ssh-keygen -t rsa -C email@domain.com</pre><br/> |
| 187 | You must use a valid email address to create your key.</li> |
| 188 | <li>When prompted, indicate the file to which you wish to write your key (<code>id_rsa</code> in this example).</li> |
| 189 | <li>When prompted, associate a passphrase with your key.</li> |
| 190 | <li>Upon success, you should have two files saved to the designated directory: </li> |
| 191 | <ul> |
| 192 | <li><code>id_rsa</code>: This file contains the private half of your RSA key. You shouldn't share this file with anyone. </li> |
| 193 | <li><code>id_rsa.pub</code>: This is the public half or your RSA key and you should send it to your Google technical account manager.</li> |
| 194 | </ul> |
| 195 | </ol> |
| 196 | </p> |
| 197 | <p>Send your Google Account Manager your public key file in order to establish Git server access. </p> |
| 198 | |
| 199 | |
| 200 | <a name="androidSourceSetupBuildGitSetupServerVerifyConnection"></a><h3>Verifying a Connection to the Git Server</h3> |
| 201 | |
| 202 | <p>Once you have generated an RSA key and shared the public file with Google, you can test your connection with the Git server with the following command:</p> |
| 203 | <pre class="prettyprint"> |
| 204 | % ssh android-git.ext.google.com |
| 205 | </pre> |
| 206 | |
| 207 | <p>You should receive one of the following results:</p> |
| 208 | |
| 209 | <table border=1 cellpadding=2 cellspacing=0> |
| 210 | <tbody><tr> |
| 211 | <th scope="col">Result</th> |
| 212 | <th scope="col">Cause</th> |
| 213 | <th scope="col">Action</th> |
| 214 | </tr> |
| 215 | <tr> |
| 216 | <td> |
| 217 | <code>fatal: What do you think I am? A shell?<BR> |
| 218 | Connection to android-git closed.</code> |
| 219 | </pre> </td> |
| 220 | <td>Success</td> |
| 221 | <td>None. You successfully connected to the Git server. (You should not have shell access and it's expected to receive this error.)</td> |
| 222 | </tr> |
| 223 | <tr> |
| 224 | <td>ssh hangs and eventually times out. </td> |
| 225 | <td>Your setup is failing to locate and establish a basic connection. </td> |
| 226 | <td>Google needs to debug network settings. </td> |
| 227 | </tr> |
| 228 | <tr> |
| 229 | <td>Error: Permission denied <public key> </td> |
| 230 | <td>Either you are not using the matching username or the RSA private key does not match the public key. </td> |
| 231 | <td>Try executing:<BR> |
| 232 | <code> |
| 233 | % ssh $USER@android- |
| 234 | git.ext.google.com |
| 235 | </code></td> |
| 236 | </tr> |
| 237 | </table> |
| 238 | |
| 239 | |
| 240 | <a name="androidSourceSetupGetCode"></a><h2>Downloading Code</h2> |
| 241 | |
| 242 | <p>Android source code is maintained in two repositories: <code>device</code> and <code>kernel</code>. The <code>device</code> repository includes the Android framework (things like the Activity Manager, Window Manager, Telephony Manager, View System, etc.). The <code>kernel</code> repository includes the core code necessary to run the operating system (things like the Display Driver, Camera Driver, Keypad Driver, Power Management, etc.). (Please see <a href="http://code.google.com/android/what-is-android.html">What is Android?</a> for details.)</p> |
| 243 | |
| 244 | <p>Save device and kernel code at the same directory level, for example:</p> |
| 245 | <p> |
| 246 | <ul><li><code>/home/joe/android/device</code></li> |
| 247 | <li><code>/home/joe/android/kernel</code></li> |
| 248 | </ul></p> |
| 249 | <p><b>Device Code</b></p> |
| 250 | <p>To download device code, you need your username and a unique <code><path></code> string supplied by Google to execute the following:</p> |
| 251 | <pre class="prettyprint"> |
| 252 | % git-clone $USER@android-git.ext.google.com:<path>/device.git |
| 253 | </pre> |
| 254 | |
| 255 | <p><b>Kernel Code</b></p> |
| 256 | <p>To download kernel code, you need your username and a unique <code><path></code> string supplied by Google to execute the following:</p> |
| 257 | <pre class="prettyprint"> |
| 258 | % git-clone $USER@android-git.ext.google.com:<path>/kernel.git |
| 259 | </pre> |
| 260 | |
| 261 | |
| 262 | |
| 263 | <a name="androidSourceSetupExtractingPatch"></a><h2>Extracting an Android Patch</h2> |
| 264 | |
| 265 | <p>You likely already have Linux running on your platform and only need to integrate Android-specific changes. The following directions describe how to extract an Android patch.</p> |
| 266 | <ol> |
| 267 | <li>Download a generic version of the Linux kernel that matches the Linux version downloaded with the Android Kernel code.</li> |
| 268 | <li>Run <code>diff</code> on the two kernel packages to get Android-specific changes.</li> |
| 269 | <li>Apply the patch to your target kernel and build.</li> |
| 270 | </ol> |
| 271 | |
| 272 | |
| 273 | <p><span class="lh2"><a name="androidFooter"></a></span> |
| 274 | |
| 275 | </div> |
| 276 | </div> |
| 277 | <!-- end gc-pagecontent --> |
| 278 | </div> |
| 279 | <!-- end gooey wrapper --> |
| 280 | </div> |
| 281 | <!-- end codesearchresults --> |
| 282 | <div id="gc-footer" dir="ltr"> |
| 283 | <div class="text"> ©2008 Google<!-- - <a href="/">Code Home</a> - <a href="http://www.google.com/accounts/TOS">Site Terms of Service</a> - <a href="http://www.google.com/privacy.html">Privacy Policy</a> - <a href="/more">Site Directory</a> --></div> |
| 284 | </div> |
| 285 | <!-- end gc-footer --> |
| 286 | </div> |
| 287 | <!-- end gc-containter --> |
| 288 | <script src="http://www.google-analytics.com/ga.js" type="text/javascript"> |
| 289 | </script> |
| 290 | <script type="text/javascript"> |
| 291 | try { |
| 292 | var pageTracker = _gat._getTracker("UA-18071-1"); |
| 293 | pageTracker._setAllowAnchor(true); |
| 294 | pageTracker._initData(); |
| 295 | pageTracker._trackPageview(); |
| 296 | } catch(e) {} |
| 297 | </script> |
| 298 | <div id="jd-build-id"> v0.3 - 9 June 2008</div> |
| 299 | </div></div></div></body> |
| 300 | </html> |
| 301 | |