• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.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
28to download and build the appropriate kernel.</p>
29<p>The following instructions assume that you have not downloaded all
30of AOSP.  If you have downloaded all of AOSP, you may skip the git
31clone 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>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>flo</td>
44    <td>device/asus/flo-kernel/kernel</td>
45    <td>kernel/msm</td>
46    <td>flo_defconfig</td>
47  </tr>
48  <tr>
49    <td>deb</td>
50    <td>device/asus/flo-kernel/kernel</td>
51    <td>kernel/msm</td>
52    <td>flo_defconfig</td>
53  </tr>
54  <tr>
55    <td>manta</td>
56    <td>device/samsung/manta/kernel</td>
57    <td>kernel/exynos</td>
58    <td>manta_defconfig</td>
59  </tr>
60  <tr>
61    <td>mako</td>
62    <td>device/lge/mako-kernel/kernel</td>
63    <td>kernel/msm</td>
64    <td>mako_defconfig</td>
65  </tr>
66  <tr>
67    <td>grouper</td>
68    <td>device/asus/grouper/kernel</td>
69    <td>kernel/tegra</td>
70    <td>tegra3_android_defconfig</td>
71  </tr>
72  <tr>
73    <td>tilapia</td>
74    <td>device/asus/grouper/kernel</td>
75    <td>kernel/tegra</td>
76    <td>tegra3_android_defconfig</td>
77  </tr>
78  <tr>
79    <td>maguro</td>
80    <td>device/samsung/tuna/kernel</td>
81    <td>kernel/omap</td>
82    <td>tuna_defconfig</td>
83  </tr>
84  <tr>
85    <td>toro</td>
86    <td>device/samsung/tuna/kernel</td>
87    <td>kernel/omap</td>
88    <td>tuna_defconfig</td>
89  </tr>
90  <tr>
91    <td>panda</td>
92    <td>device/ti/panda/kernel</td>
93    <td>kernel/omap</td>
94    <td>panda_defconfig</td>
95  </tr>
96  <tr>
97    <td>stingray</td>
98    <td>device/moto/wingray/kernel</td>
99    <td>kernel/tegra</td>
100    <td>stingray_defconfig</td>
101  </tr>
102  <tr>
103    <td>wingray</td>
104    <td>device/moto/wingray/kernel </td>
105    <td>kernel/tegra</td>
106    <td>stingray_defconfig</td>
107  </tr>
108  <tr>
109    <td>crespo</td>
110    <td>device/samsung/crespo/kernel</td>
111    <td>kernel/samsung</td>
112    <td>herring_defconfig</td>
113  </tr>
114  <tr>
115    <td>crespo4g</td>
116    <td>device/samsung/crespo/kernel</td>
117    <td>kernel/samsung</td>
118    <td>herring_defconfig</td>
119  </tr>
120</table>
121
122<p>You will want to look at the git log for the kernel binary in the device
123project that you are interested in.</p>
124
125
126
127Device projects are of the form device/&lt;vendor&gt;/&lt;name&gt;.</p>
128<pre><code>$ git clone https://android.googlesource.com/device/ti/panda
129$ cd panda
130$ git log --max-count=1 kernel
131</code></pre>
132
133<p>The commit message for the kernel binary contains a partial git log
134of the kernel sources that were used to build the binary in question.
135The first entry in the log is the most recent, i.e. the one used to
136build that kernel. You will need it at a later step.</p>
137
138<h2 id="downloading-sources">Downloading sources</h2>
139<p>Depending on which kernel you want,</p>
140<pre><code>$ git clone https://android.googlesource.com/kernel/common.git
141$ git clone https://android.googlesource.com/kernel/exynos.git
142$ git clone https://android.googlesource.com/kernel/goldfish.git
143$ git clone https://android.googlesource.com/kernel/msm.git
144$ git clone https://android.googlesource.com/kernel/omap.git
145$ git clone https://android.googlesource.com/kernel/samsung.git
146$ git clone https://android.googlesource.com/kernel/tegra.git
147</code></pre>
148<ul>
149<li>The <code>goldfish</code> project contains the kernel sources for the emulated
150platforms.</li>
151<li>The <code>msm</code> project has the sources for ADP1, ADP2, Nexus One, Nexus 4,
152and can be used as a starting point for work on Qualcomm MSM chipsets.</li>
153<li>The <code>omap</code> project is used for PandaBoard and Galaxy Nexus,
154and can be used as a starting point for work on TI OMAP chipsets.</li>
155<li>The <code>samsung</code> project is used for Nexus S,
156and can be used as a starting point for work on Samsung Hummingbird chipsets.</li>
157<li>The <code>tegra</code> project is for Xoom and Nexus 7,
158and can be used as a starting point for work on NVIDIA Tegra chipsets.</li>
159<li>The <code>exynos</code> project has the kernel sources for Nexus 10,
160and can be used as a starting point for work on Samsung Exynos chipsets.</li>
161</ul>
162<h2 id="downloading-a-prebuilt-gcc">Downloading a prebuilt gcc</h2>
163<p>Ensure that the prebuilt toolchain is in your path.</p>
164<pre>$ export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH</pre>
165
166or
167<pre>$ export PATH=$(pwd)/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin:$PATH</pre>
168
169<p>On a linux host, if you don't have an Android source tree, you can download
170the prebuilt toolchain from:
171<pre>$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6</pre>
172
173<h2 id="building">Building</h2>
174<p>As an example, we would build the panda kernel using the following commands:</p>
175<pre><code>$ export ARCH=arm
176$ export SUBARCH=arm
177$ export CROSS_COMPILE=arm-eabi-
178$ cd omap
179$ git checkout &lt;commit_from_first_step&gt;
180$ make panda_defconfig
181$ make
182</code></pre>
183<p>To build the tuna kernel, you may run the previous commands replacing all
184instances of "panda" with "tuna".</p>
185<p>
186The kernel binary is output as `arch/arm/boot/zImage`, and needs to be copied
187into the Android source tree in order to build the matching boot image.
188</p>
189