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