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> |
| 34 | <p>You will want to look at the git log for the kernel in the device project that |
| 35 | you are interested in. |
| 36 | Device projects are of the form device/<vendor>/<name>.</p> |
| 37 | <pre><code>$ git clone https://android.googlesource.com/device/ti/panda |
| 38 | $ cd panda |
| 39 | $ git log kernel |
| 40 | </code></pre> |
| 41 | <p>The log should contain notes of the commit SHA1 for the appropriate |
| 42 | kernel project. Keep this value at hand so that you can use it in |
| 43 | a later step.</p> |
| 44 | <h2 id="downloading-sources">Downloading sources</h2> |
| 45 | <p>Depending on which kernel you want,</p> |
| 46 | <pre><code>$ git clone https://android.googlesource.com/kernel/common.git |
| 47 | $ git clone https://android.googlesource.com/kernel/exynos.git |
| 48 | $ git clone https://android.googlesource.com/kernel/goldfish.git |
| 49 | $ git clone https://android.googlesource.com/kernel/msm.git |
| 50 | $ git clone https://android.googlesource.com/kernel/omap.git |
| 51 | $ git clone https://android.googlesource.com/kernel/samsung.git |
| 52 | $ git clone https://android.googlesource.com/kernel/tegra.git |
| 53 | </code></pre> |
| 54 | <ul> |
| 55 | <li>The <code>goldfish</code> project contains the kernel sources for the emulated |
| 56 | platforms.</li> |
| 57 | <li>The <code>msm</code> project has the sources for ADP1, ADP2, Nexus One, Nexus 4, |
| 58 | and can be used as a starting point for work on Qualcomm MSM chipsets.</li> |
| 59 | <li>The <code>omap</code> project is used for PandaBoard and Galaxy Nexus, |
| 60 | and can be used as a starting point for work on TI OMAP chipsets.</li> |
| 61 | <li>The <code>samsung</code> project is used for Nexus S, |
| 62 | and can be used as a starting point for work on Samsung Hummingbird chipsets.</li> |
| 63 | <li>The <code>tegra</code> project is for Xoom and Nexus 7, |
| 64 | and can be used as a starting point for work on NVIDIA Tegra chipsets.</li> |
| 65 | <li>The <code>exynos</code> project has the kernel sources for Nexus 10, |
| 66 | and can be used as a starting point for work on Samsung Exynos chipsets.</li> |
| 67 | </ul> |
| 68 | <h2 id="downloading-a-prebuilt-gcc">Downloading a prebuilt gcc</h2> |
| 69 | <p>Ensure that the prebuilt toolchain is in your path.</p> |
| 70 | <pre><code>$ git clone https://android.googlesource.com/platform/prebuilt |
| 71 | $ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH |
| 72 | </code></pre> |
| 73 | <h2 id="building">Building</h2> |
| 74 | <p>As an example, we would build the panda kernel using the following commands:</p> |
| 75 | <pre><code>$ export ARCH=arm |
| 76 | $ export SUBARCH=arm |
| 77 | $ export CROSS_COMPILE=arm-eabi- |
| 78 | $ cd omap |
| 79 | $ git checkout <commit_from_first_step> |
| 80 | $ make panda_defconfig |
| 81 | $ make |
| 82 | </code></pre> |
| 83 | <p>To build the tuna kernel, you may run the previous commands replacing all |
| 84 | instances of "panda" with "tuna".</p> |
| 85 | <ul> |
| 86 | <li>The kernel for mantaray is <code>device/samsung/manta/kernel</code></li> |
| 87 | <li>The kernel for mako is <code>device/lge/mako-kernel/kernel</code></li> |
| 88 | <li>The kernel for grouper and tilapia is <code>device/asus/grouper/kernel</code></li> |
| 89 | <li>The kernel for maguro and toro is <code>device/samsung/tuna/kernel</code></li> |
| 90 | <li>The kernel for crespo and crespo4g is <code>device/samsung/crespo/kernel</code></li> |
| 91 | <li>The kernel for stingray and wingray is <code>device/moto/wingray/kernel</code></li> |
| 92 | </ul> |
| 93 | <p>The image is output as <code>arch/arm/boot/zImage</code>. You may copy it as |
| 94 | <code>device/<vendor>/<name>/kernel</code> or <code>device/ti/panda/kernel</code> in the case of this |
| 95 | example.</p> |