Building Kernels
编译内核
If you are only interested in the kernel, you may use this guide to download and build the appropriate kernel.
如果你只对内核感兴趣,你可以用这个指南下载和编译适合的内核
The following instructions assume that you have not downloaded all of AOSP.
以下说明假定你没有下载所有的andriod开放源代码项目,
If you have downloaded all of AOSP, you may skip the git clone steps other than the step to download the actual kernel sources.
如果你已经下载了所有的android开放源代码项目,你可以跳过git clone步骤,而不用去下载现在的内核源代码。
We will use the Pandaboard kernel in all the following examples.
下面的说明都以熊猫开发版(Pandaboard)内核为例
Figuring out which kernel to build
搞清楚构建哪个内核
你将想查看你感兴趣的设备项目的内核 git 日志。设备项目的形式 device/<供应商>/<名字>。
You will want to look at the git log for the kernel in the device project that you are interested in. Device projects are of the form device/<vendor>/<name>.$ git clone https://android.googlesource.com/device/ti/panda
$ cd panda
$ git log kernel
The log should contain notes of the commit SHA1 for the appropriate kernel project. Keep this value at hand so that you can use it in a later step.
日志应该包含保证适当内核项目的 SHA1 记录。保持这值在手上,使你能用它在一个后来的步骤。
Downloading sources
将下载的资源
Depending on which kernel you want,
依赖哪个内核
$ git clone https://android.googlesource.com/kernel/common.git
$ git clone https://android.googlesource.com/kernel/exynos.git
$ git clone https://android.googlesource.com/kernel/goldfish.git
$ git clone https://android.googlesource.com/kernel/msm.git
$ git clone https://android.googlesource.com/kernel/omap.git
$ git clone https://android.googlesource.com/kernel/samsung.git
$ git clone https://android.googlesource.com/kernel/tegra.git
- The
goldfish
project contains the kernel sources for the emulated platforms. - The
msm
project has the sources for ADP1, ADP2, Nexus One, and can be used as a starting point for work on Qualcomm MSM chipsets. - The
omap
project is used for PandaBoard and Galaxy Nexus, and can be used as a starting point for work on TI OMAP chipsets. - The
samsung
project is used for Nexus S and can be used as a starting point for work on Samsung Hummingbird chipsets. - The
tegra
project is for Xoom and Nexus 7, and can be used as a starting point for work on NVIDIA Tegra chipsets. - The
exynos
project can be used as a starting point for work on Samsung Exynos chipsets.
goldfish
项目包含模拟平台内核源。
msm
项目有 ADP1,ADP2 ,Nexus One的源,和能被用作一个开始点工作在美国高通公司 Qualcomm MSM 芯片。omap
项目是被用于 PandaBoard 和 Galaxy Nexus,和能被用作一个开始点工作在 TI OMAP 芯片。samsung
工程是被用于 Nexus S 和能被用作一个开始点工作在 Samsung 峰鸟芯片。tegra
工程是为 Xoom,和能备用作一个开始点工作在 NVIDIA Tegra 芯片。exynos
工程能被用作一个开始点工作在 Samsung Exynos 芯片。
Downloading a prebuilt gcc
下载预编译gcc
Ensure that the prebuilt toolchain is in your path.
保证预编译 toolchain 是在你的环境变量。
$ git clone https://android.googlesource.com/platform/prebuilt
$ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Building
编译
As an example, we would build the panda kernel using the following commands:
作为一个例子,我们将构建 panda kernel 内核用下面的命令
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
$ git checkout <commit_from_first_step>
$ make panda_defconfig
$ make
To build the tuna kernel, you may run the previous commands replacing all instances of "panda" with "tuna".
构建 tuna 内核,你可能运行以前的命令替换所有 "panda" 随着 "tuna"的实例。
- maguro 和 toro 的内核是
device/samsung/tuna/kernel
- crespo 和 crespo4g 的内核是
device/samsung/crespo/kernel
- stingray 和 wingray 的内核是
device/moto/wingray/kernel
镜像输出The image is output as arch/arm/boot/zImage。你可能复制它作为
device/<供应商>/<名字>/kernel
或 device/ti/panda/kernel
在这个例子的情况。
- The kernel for maguro and toro is
device/samsung/tuna/kernel
- The kernel for crespo and crespo4g is
device/samsung/crespo/kernel
- The kernel for stingray and wingray is
device/moto/wingray/kernel
The image is output as arch/arm/boot/zImage
. You may copy it as device/<vendor>/<name>/kernel
or device/ti/panda/kernel
in the case of this example.