Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 1 | page.title=Building Kernels |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2010 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2>In this document</h2> |
| 22 | <ol id="auto-toc"> |
| 23 | </ol> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
| 27 | <p>If you are only interested in the kernel, you may use this guide |
| 28 | to download and build the appropriate kernel.</p> |
| 29 | <p>The following instructions assume that you have not downloaded all |
| 30 | of AOSP. If you have downloaded all of AOSP, you may skip the git |
| 31 | clone steps other than the step to download the actual kernel sources.</p> |
| 32 | <p>We will use the Pandaboard kernel in all the following examples.</p> |
| 33 | <h2 id="figuring-out-which-kernel-to-build">Figuring out which kernel to build</h2> |
Robert Ly | 40e3b6d | 2013-04-17 18:12:10 -0700 | [diff] [blame] | 34 | <p>This table lists the name and locations of the kernel sources and binaries: |
| 35 | <table> |
| 36 | <tr> |
| 37 | <th>Device</th> |
| 38 | <th>Binary location</th> |
| 39 | <th>Source location</th> |
| 40 | <th>Build configuration</th> |
| 41 | </tr> |
| 42 | <tr> |
| 43 | <td>manta</td> |
| 44 | <td>device/samsung/manta/kernel</td> |
| 45 | <td>kernel/exynos</td> |
| 46 | <td>manta_defconfig</td> |
| 47 | </tr> |
| 48 | <tr> |
| 49 | <td>mako</td> |
| 50 | <td>device/lge/mako-kernel/kernel</td> |
| 51 | <td>kernel/msm</td> |
| 52 | <td>mako_defconfig</td> |
| 53 | </tr> |
| 54 | <tr> |
| 55 | <td>grouper</td> |
| 56 | <td>device/asus/grouper/kernel</td> |
| 57 | <td>kernel/tegra</td> |
| 58 | <td>tegra3_android_defconfig</td> |
| 59 | </tr> |
| 60 | <tr> |
| 61 | <td>tilapia</td> |
| 62 | <td>device/asus/grouper/kernel</td> |
| 63 | <td>kernel/tegra</td> |
| 64 | <td>tegra3_android_defconfig</td> |
| 65 | </tr> |
| 66 | <tr> |
| 67 | <td>maguro</td> |
| 68 | <td>device/samsung/tuna/kernel</td> |
| 69 | <td>kernel/omap</td> |
| 70 | <td>tuna_defconfig</td> |
| 71 | </tr> |
| 72 | <tr> |
| 73 | <td>toro</td> |
| 74 | <td>device/samsung/tuna/kernel</td> |
| 75 | <td>kernel/omap</td> |
| 76 | <td>tuna_defconfig</td> |
| 77 | </tr> |
| 78 | <tr> |
| 79 | <td>panda</td> |
| 80 | <td>device/ti/panda/kernel</td> |
| 81 | <td>kernel/omap</td> |
| 82 | <td>panda_defconfig</td> |
| 83 | </tr> |
| 84 | <tr> |
| 85 | <td>stingray</td> |
| 86 | <td>device/moto/wingray/kernel</td> |
| 87 | <td>kernel/tegra</td> |
| 88 | <td>stingray_defconfig</td> |
| 89 | </tr> |
| 90 | <tr> |
| 91 | <td>wingray</td> |
| 92 | <td>device/moto/wingray/kernel </td> |
| 93 | <td>kernel/tegra</td> |
| 94 | <td>stingray_defconfig</td> |
| 95 | </tr> |
| 96 | <tr> |
| 97 | <td>crespo</td> |
| 98 | <td>device/samsung/crespo/kernel</td> |
| 99 | <td>kernel/samsung</td> |
| 100 | <td>herring_defconfig</td> |
| 101 | </tr> |
| 102 | <tr> |
| 103 | <td>crespo4g</td> |
| 104 | <td>device/samsung/crespo/kernel</td> |
| 105 | <td>kernel/samsung</td> |
| 106 | <td>herring_defconfig</td> |
| 107 | </tr> |
| 108 | </table> |
| 109 | |
| 110 | <p>You will want to look at the git log for the kernel binary in the device |
| 111 | project that you are interested in.</p> |
| 112 | |
| 113 | |
| 114 | |
Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 115 | Device projects are of the form device/<vendor>/<name>.</p> |
| 116 | <pre><code>$ git clone https://android.googlesource.com/device/ti/panda |
| 117 | $ cd panda |
Robert Ly | 40e3b6d | 2013-04-17 18:12:10 -0700 | [diff] [blame] | 118 | $ git log --max-count=1 kernel |
Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 119 | </code></pre> |
Robert Ly | 40e3b6d | 2013-04-17 18:12:10 -0700 | [diff] [blame] | 120 | |
| 121 | <p>The commit message for the kernel binary contains a partial git log |
| 122 | of the kernel sources that were used to build the binary in question. |
| 123 | The first entry in the log is the most recent, i.e. the one used to |
| 124 | build that kernel. You will need it at a later step.</p> |
| 125 | |
Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 126 | <h2 id="downloading-sources">Downloading sources</h2> |
| 127 | <p>Depending on which kernel you want,</p> |
| 128 | <pre><code>$ git clone https://android.googlesource.com/kernel/common.git |
| 129 | $ git clone https://android.googlesource.com/kernel/exynos.git |
| 130 | $ git clone https://android.googlesource.com/kernel/goldfish.git |
| 131 | $ git clone https://android.googlesource.com/kernel/msm.git |
| 132 | $ git clone https://android.googlesource.com/kernel/omap.git |
| 133 | $ git clone https://android.googlesource.com/kernel/samsung.git |
| 134 | $ git clone https://android.googlesource.com/kernel/tegra.git |
| 135 | </code></pre> |
| 136 | <ul> |
| 137 | <li>The <code>goldfish</code> project contains the kernel sources for the emulated |
| 138 | platforms.</li> |
| 139 | <li>The <code>msm</code> project has the sources for ADP1, ADP2, Nexus One, Nexus 4, |
| 140 | and can be used as a starting point for work on Qualcomm MSM chipsets.</li> |
| 141 | <li>The <code>omap</code> project is used for PandaBoard and Galaxy Nexus, |
| 142 | and can be used as a starting point for work on TI OMAP chipsets.</li> |
| 143 | <li>The <code>samsung</code> project is used for Nexus S, |
| 144 | and can be used as a starting point for work on Samsung Hummingbird chipsets.</li> |
| 145 | <li>The <code>tegra</code> project is for Xoom and Nexus 7, |
| 146 | and can be used as a starting point for work on NVIDIA Tegra chipsets.</li> |
| 147 | <li>The <code>exynos</code> project has the kernel sources for Nexus 10, |
| 148 | and can be used as a starting point for work on Samsung Exynos chipsets.</li> |
| 149 | </ul> |
| 150 | <h2 id="downloading-a-prebuilt-gcc">Downloading a prebuilt gcc</h2> |
| 151 | <p>Ensure that the prebuilt toolchain is in your path.</p> |
Robert Ly | 40e3b6d | 2013-04-17 18:12:10 -0700 | [diff] [blame] | 152 | <pre>$ export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH</pre> |
| 153 | |
| 154 | or |
| 155 | <pre>$ export PATH=$(pwd)/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin:$PATH</pre> |
| 156 | |
| 157 | <p>On a linux host, if you don't have an Android source tree, you can download |
| 158 | the prebuilt toolchain from: |
| 159 | <pre>$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6</pre> |
| 160 | |
Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 161 | <h2 id="building">Building</h2> |
| 162 | <p>As an example, we would build the panda kernel using the following commands:</p> |
| 163 | <pre><code>$ export ARCH=arm |
| 164 | $ export SUBARCH=arm |
| 165 | $ export CROSS_COMPILE=arm-eabi- |
| 166 | $ cd omap |
| 167 | $ git checkout <commit_from_first_step> |
| 168 | $ make panda_defconfig |
| 169 | $ make |
| 170 | </code></pre> |
| 171 | <p>To build the tuna kernel, you may run the previous commands replacing all |
| 172 | instances of "panda" with "tuna".</p> |
Robert Ly | 40e3b6d | 2013-04-17 18:12:10 -0700 | [diff] [blame] | 173 | <p> |
| 174 | The kernel binary is output as `arch/arm/boot/zImage`, and needs to be copied |
| 175 | into the Android source tree in order to build the matching boot image. |
| 176 | </p> |