Home | History | Annotate | Download | only in source
      1 <html devsite><head>
      2     <title></title>
      3     <meta name="project_path" value="/_project.yaml"/>
      4     <meta name="book_path" value="/_book.yaml"/>
      5   </head>
      6   <body>
      7   <!--
      8       Copyright 2017 The Android Open Source Project
      9 
     10       Licensed under the Apache License, Version 2.0 (the "License");
     11       you may not use this file except in compliance with the License.
     12       You may obtain a copy of the License at
     13 
     14           http://www.apache.org/licenses/LICENSE-2.0
     15 
     16       Unless required by applicable law or agreed to in writing, software
     17       distributed under the License is distributed on an "AS IS" BASIS,
     18       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     19       See the License for the specific language governing permissions and
     20       limitations under the License.
     21   -->
     22 
     23 <p> Android  Linux  Mac OS Windows </p>
     24 <p><a href="life-of-a-patch.html"></a></p>
     25 <h2 id="choosing-a-branch"></h2>
     26 <p><a href="build-numbers.html"></a> <code>master</code></p>
     27 <p></p>
     28 <h2 id="setting-up-a-linux-build-environment"> Linux </h2>
     29 <p> <code>master</code></p>
     30 <p> Ubuntu LTS (14.04)  Android  Ubuntu </p>
     31 <p> Gingerbread (2.3.x)  <code>master</code>  64  32 </p>
     32 <p class="note"><strong></strong><a href="requirements.html"></a> Ubuntu  Mac OS </p>
     33 
     34 <h3 id="installing-the-jdk"> JDK</h3>
     35 <p><a href="https://android.googlesource.com/">Android  (AOSP)</a>  Android  <code>master</code>  Java 8 Ubuntu  <a href="http://openjdk.java.net/install/">OpenJDK</a></p>
     36 <p> <a href="requirements.html#jdk">JDK </a></p>
     37 
     38 <h4 id="for-ubuntu-15-04"> Ubuntu &gt;= 15.04</h4>
     39 <p></p>
     40 <pre>
     41 $ sudo apt-get update
     42 $ sudo apt-get install openjdk-8-jdk
     43 </pre>
     44 
     45 <h4 id="for-ubuntu-14-04"> Ubuntu LTS 14.04</h4>
     46 <p> Ubuntu 14.04  OpenJDK 8 <strong>Ubuntu 15.04 OpenJDK 8</strong>  Ubuntu 14.04 <em> 15.1016.04  Ubuntu 14.04 </em></p>
     47 <ol>
     48 <li>
     49 <p> <a href="http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/">archive.ubuntu.com</a>  64  <code>.deb</code> </p>
     50 <ul>
     51 <li><a href="http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb">openjdk-8-jre-headless_8u45-b14-1_amd64.deb</a>
     52 SHA256<code>0f5aba8db39088283b51e00054813063173a4d8809f70033976f83e214ab56c0</code></li>
     53 <li><a href="http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb">openjdk-8-jre_8u45-b14-1_amd64.deb</a>
     54 SHA256<code>9ef76c4562d39432b69baf6c18f199707c5c56a5b4566847df908b7d74e15849</code></li>
     55 <li><a href="http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb">openjdk-8-jdk_8u45-b14-1_amd64.deb</a>
     56 SHA256<code>6e47215cf6205aa829e6a0a64985075bd29d1f428a4006a80c9db371c2fc3c4c</code></li>
     57 </ul>
     58 </li>
     59 <li>
     60 <p> SHA256 </p>
     61 <p> <code>sha256sum</code> </p>
     62 <pre>
     63 $ sha256sum {downloaded.deb file}
     64 </pre>
     65 </li>
     66 <li>
     67 <p></p>
     68 <pre>
     69 $ sudo apt-get update
     70 </pre>
     71 <p> .deb  <code>dpkg</code></p>
     72 <pre>
     73 $ sudo dpkg -i {downloaded.deb file}
     74 </pre>
     75 <p></p>
     76 <pre>
     77 $ sudo apt-get -f install
     78 </pre>
     79 </li>
     80 </ol>
     81 
     82 <h4 id="default-java-version"> Java  - </h4>
     83 
     84 <p> Ubuntu  Java </p>
     85 <pre>
     86 $ sudo update-alternatives --config java
     87 $ sudo update-alternatives --config javac
     88 </pre>
     89 
     90 <p> Java <a href="building.html#wrong-java-version"> Java </a></p>
     91 
     92 <h3 id="installing-required-packages-ubuntu-1404"> (Ubuntu 14.04)</h3>
     93 
     94 <p> 64  Ubuntu Ubuntu 14.04</p>
     95 
     96 <pre>
     97 $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
     98   zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
     99   lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
    100   libgl1-mesa-dev libxml2-utils xsltproc unzip
    101 </pre>
    102 
    103 <p class="note"><strong></strong> SELinux  <code>python-networkx</code> </p>
    104 
    105 <p class="note"><strong></strong> LDAP  ART  <code>libnss-sss:i386</code> </p>
    106 
    107 <h3 id="installing-required-packages-ubuntu-1204"> (Ubuntu 12.04)</h3>
    108 
    109 <p> Ubuntu 12.04  Androidmaster  Ubuntu 12.04</p>
    110 
    111 <pre>
    112 $ sudo apt-get install git gnupg flex bison gperf build-essential \
    113   zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
    114   libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
    115   libgl1-mesa-dev g++-multilib mingw32 tofrodos \
    116   python-markdown libxml2-utils xsltproc zlib1g-dev:i386
    117 $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
    118 </pre>
    119 
    120 <h3 id="installing-required-packages-ubuntu-1004-1110"> (Ubuntu 10.04 - 11.10)</h3>
    121 <p> Ubuntu 10.04-11.10  AOSP</p>
    122 
    123 <pre>
    124 $ sudo apt-get install git gnupg flex bison gperf build-essential \
    125   zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
    126   x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
    127   libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
    128   libxml2-utils xsltproc
    129 </pre>
    130 
    131 <p> Ubuntu 10.10 </p>
    132 
    133 <pre>
    134 $ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
    135 </pre>
    136 
    137 <p> Ubuntu 11.10 </p>
    138 
    139 <pre>
    140 $ sudo apt-get install libx11-dev:i386
    141 </pre>
    142 
    143 <h3 id="configuring-usb-access"> USB </h3>
    144 
    145 <p> GNU/Linux  Ubuntu  USB </p>
    146 <p> root  <code>/etc/udev/rules.d/51-android.rules</code> </p>
    147 
    148 <p> <a href="51-android.txt">51-android.txt</a> </p>
    149 
    150 <pre>
    151 $ wget -S -O - http://source.android.com/source/51-android.txt | sed "s/&lt;username&gt;/$USER/" | sudo tee &gt;/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
    152 </pre>
    153 
    154 <p></p>
    155 
    156 <h3 id="using-a-separate-output-directory"></h3>
    157 
    158 <p> <code>out/</code> </p>
    159 
    160 <p></p>
    161 
    162 <p> <code>OUT_DIR_COMMON_BASE</code> </p>
    163 
    164 <pre>
    165 $ export OUT_DIR_COMMON_BASE=&lt;path-to-your-out-directory&gt;
    166 </pre>
    167 
    168 <p></p>
    169 
    170 <p> <code>/source/master1</code>  <code>/source/master2</code> <code>OUT_DIR_COMMON_BASE</code>  <code>/output</code> <code>/output/master1</code>  <code>/output/master2</code></p>
    171 
    172 <p></p>
    173 
    174 <p> Jelly Bean (4.1)  <code>master</code> </p>
    175 
    176 <h2 id="setting-up-a-mac-os-x-build-environment"> Mac OS </h2>
    177 
    178 <p>Mac OS Git  Git  <code>git status</code> AOSP </p>
    179 
    180 <p> Mac OS  <code>master</code>  SDK</p>
    181 
    182 <h3 id="creating-a-case-sensitive-disk-image"></h3>
    183 
    184 <p> Mac OS  25GB Case sensitive, Journaled</p>
    185 
    186 <p> shell </p>
    187 <pre>
    188 # hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg
    189 </pre>
    190 
    191 <p> <code>.dmg</code> <code>.dmg.sparseimage</code> Android </p>
    192 
    193 <p></p>
    194 
    195 <pre>
    196 # hdiutil resize -size &lt;new-size-you-want&gt;g ~/android.dmg.sparseimage
    197 </pre>
    198 
    199 <p> <code>android.dmg</code>  <code>~/.bash_profile</code> </p>
    200 
    201 <ul>
    202 <li> <code>mountAndroid</code> <p></p>
    203 
    204 <pre>
    205 # mount the android file image
    206 function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
    207 </pre>
    208 
    209 <p class="note"><strong></strong> <code>.dmg.sparseimage</code>  <code>~/android.dmg</code>  <code>~/android.dmg.sparseimage</code></p>
    210 </li>
    211 
    212 <li>
    213 <p> <code>umountAndroid</code> </p>
    214 <pre>
    215 # unmount the android file image
    216 function umountAndroid() { hdiutil detach /Volumes/android; }
    217 </pre>
    218 </li>
    219 </ul>
    220 
    221 <p> <code>android</code> </p>
    222 
    223 <h3 id="installing-the-mac-jdk"> JDK</h3>
    224 
    225 <p> Android  Java <a href="requirements.html"></a></p>
    226 
    227 <h4 id="installing-required-packages"></h4>
    228 
    229 <ol>
    230 <li>
    231 <p> Xcode </p><pre>
    232 $ xcode-select --install
    233 </pre>
    234 
    235 <p> Mac OS10.8  <a href="http://developer.apple.com/">Apple </a> Xcode Apple  Apple ID </p>
    236 </li>
    237 
    238 <li>
    239 <p> <a href="http://www.macports.org/install.php">macports.org</a>  MacPorts</p>
    240 
    241 <p class="note"><strong></strong> <code>/opt/local/bin</code>  <code>/usr/bin</code> <strong></strong> <code>~/.bash_profile</code> </p>
    242 
    243 <pre>
    244 <code>export PATH=/opt/local/bin:$PATH</code>
    245 </pre>
    246 
    247 <p class="note"><strong></strong> <code>.bash_profile</code> </p>
    248 </li>
    249 
    250 <li>
    251 <p> MacPorts  MakeGit  GPG </p>
    252 
    253 <pre>
    254 $ POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg
    255 </pre>
    256 
    257 <p> Mac OS X v10.4 bison</p>
    258 <pre>
    259 $ POSIXLY_CORRECT=1 sudo port install bison
    260 </pre>
    261 </li>
    262 </ol>
    263 
    264 <h4 id="reverting-from-make-382"> make 3.82 </h4>
    265 
    266 <p> Android 4.0.x (Ice Cream Sandwich) gmake 3.82  Android  MacPorts  3.81 </p>
    267 
    268 <ol>
    269 <li>
    270 <p> <code>/opt/local/etc/macports/sources.conf</code> rsync </p>
    271 <pre>
    272 file:///Users/Shared/dports
    273 </pre>
    274 
    275 <p></p>
    276 <pre>
    277 $ mkdir /Users/Shared/dports
    278 </pre>
    279 </li>
    280 
    281 <li>
    282 <p> <code>dports</code> </p>
    283 <pre>
    284 $ svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/
    285 </pre>
    286 </li>
    287 
    288 <li>
    289 <p></p>
    290 
    291 <pre>
    292 $ portindex /Users/Shared/dports
    293 </pre>
    294 </li>
    295 
    296 <li>
    297 <p> gmake</p>
    298 <pre>
    299 $ sudo port install gmake @3.81
    300 </pre>
    301 </li>
    302 </ol>
    303 
    304 <h4 id="setting-a-file-descriptor-limit"></h4>
    305 
    306 <p> Mac OS </p>
    307 
    308 <p> <code>~/.bash_profile</code> </p>
    309 <pre>
    310 # set the number of open files to be 1024
    311 ulimit -S -n 1024
    312 </pre>
    313 
    314 <h2 id="optimizing-a-build-environment"></h2>
    315 
    316 <h3 id="setting-up-ccache"> ccache</h3>
    317 
    318 <p> ccache ccache  C  C++ ccache  <code>make clean</code> ccache</p>
    319 
    320 <p class="note"><strong></strong>ccache </p>
    321 
    322 <p> ccache</p>
    323 
    324 <pre>
    325 $ export USE_CCACHE=1
    326 $ export CCACHE_DIR=/&lt;path_of_your_choice&gt;/.ccache
    327 $ prebuilts/misc/linux-x86/ccache/ccache -M 50G
    328 </pre>
    329 
    330 <p> 50G  100G</p>
    331 
    332 <p> <code>.bashrc</code></p>
    333 
    334 <pre>
    335 export USE_CCACHE=1
    336 </pre>
    337 
    338 <p> <code>~/.ccache</code>  NFS  <code>.bashrc</code> </p>
    339 
    340 <p> Mac OS  <code>linux-x86</code>  <code>darwin-x86</code></p>
    341 
    342 <pre>
    343 prebuilts/misc/darwin-x86/ccache/ccache -M 50G
    344 </pre>
    345 
    346 <p> Ice Cream Sandwich (4.0.x) ccache </p>
    347 
    348 <pre>
    349 prebuilt/linux-x86/ccache/ccache -M 50G
    350 </pre>
    351 
    352 <p> CCACHE_DIR </p>
    353 
    354 <p> Linux  ccache </p>
    355 
    356 <pre>
    357 $ watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
    358 </pre>
    359 
    360 <h2 id="next-download-the-source"></h2>
    361 
    362 <p><a href="downloading.html"></a></p>
    363 
    364 </body></html>