Android源码编译(8)---编译内核
来源:互联网 发布:金税盘开票数据导出 编辑:程序博客网 时间:2024/05/19 05:04
Building Kernels
IN THIS DOCUMENT
- Selecting a kernel
- Identifying kernel version
- Downloading sources
- Downloading a prebuilt gcc
- Building the kernel
This page details how to build only the kernel. The following instructions assume you have not downloaded all of AOSP; if you have already done so, you can skip the git clone
steps except the step that downloads the kernel sources.
All examples in this section use the hikey kernel.
Selecting a kernel
This table lists the name and locations of the kernel sources and binaries:
After determining the device project you want to work with, view the git log for the kernel binary. Device projects use the form device/<vendor>/<name>
.
$ git clone https://android.googlesource.com/kernel/hikey-linaro$ cd hikey-linaro$ git log --max-count=1 kernel
The commit message for the kernel binary contains a partial git log of the kernel sources used to build the binary. The first entry in the log is the most recent (the one used to build the kernel). Make a note of the commit message as you will need it in a later step.
Identifying kernel version
To determine the kernel version used in a system image, run the following command against the kernel file:
$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
For Nexus 5 (hammerhead), the command is:
$ dd if=zImage-dtb bs=1 skip=$(LC_ALL=C od -Ad -x -w2 zImage-dtb | grep 8b1f | cut -d ' ' -f1 | head -1) | zgrep -a 'Linux version'
Downloading sources
Download the source for the kernel you want to build using the appropriate git clone
command:
$ git clone https://android.googlesource.com/kernel/common.git$ git clone https://android.googlesource.com/kernel/hikey-linaro$ git clone https://android.googlesource.com/kernel/x86_64.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, Nexus 4, Nexus 5, Nexus 6, Nexus 5X, Nexus 6P, Nexus 7 (2013), 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, Nexus 7 (2012), Nexus 9, and can be used as a starting point for work on NVIDIA Tegra chipsets. - The
exynos
project has the kernel sources for Nexus 10, and can be used as a starting point for work on Samsung Exynos chipsets. - The
x86_64
project has the kernel sources for Nexus Player, and can be used as a starting point for work on Intel x86_64 chipsets. - The
hikey-linaro
project is used for HiKey reference boards, and can be used as a starting point for work on HiSilicon 620 chipsets.
Downloading a prebuilt gcc
Ensure the prebuilt toolchain is in your path:
$ export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
or
$ export PATH=$(pwd)/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin:$PATH
On a Linux host, if you don't have an Android source tree, you can download the prebuilt toolchain from:
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Building the kernel
When you know the last commit message for a kernel and have successfully downloaded the kernel source and prebuilt gcc, you are ready to build the kernel. The following build commands use the hikey kernel:
$ export ARCH=arm64$ export CROSS_COMPILE=aarch64-linux-android-$ cd hikey-linaro$ git checkout -b android-hikey-linaro-4.1 origin/android-hikey-linaro-4.1$ make hikey_defconfig$ make
To build a different kernel, simply replace hikey-linaro
with the name of the kernel you want to build.
The image outputs to the arch/arm64/boot/Image
directory; the kernel binary outputs to thearch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb
fle. Copy the Image
directory and the hi6220-hikey.dtb
file to the hikey-kernel
directory.
Alternatively, you can include the TARGET_PREBUILT_KERNEL
variable while using make bootimage
(or any other make
command line that builds a boot image). This variable is supported by all devices as it is set up viadevice/common/populate-new-device.sh
. For example:
$ export TARGET_PREBUILT_KERNEL=$your_kernel_path/arch/arm/boot/zImage-dtb
Note: Kernel names differ by device. To locate the correct filename for your kernel, refer todevice/<vendor>/<name>
in the kernel source.
- Android源码编译(8)---编译内核
- 编译android内核源码
- Android源码、内核编译
- 编译android内核源码
- Android 编译Android内核源码
- 如何编译Android内核源码
- 编译Android goldfish内核源码
- Android 编译内核kernel源码
- 编译Android系统源码和内核源码
- 编译Android系统源码和内核源码
- 编译Android系统源码和内核源码
- 编译Android系统源码和内核源码
- 编译android系统源码和内核源码
- 编译Android系统源码和内核源码
- Ubuntu上编译Android内核源码
- Ubuntu11.10下编译android内核源码
- Android内核源码下载与编译
- 编译Android源码与内核总结
- rxjava初学笔记
- 高手总结的web前端知识体系大全
- Volley 使用PATCH的记录
- 给予bootstrap的各种模板中可能遇到的下载谷歌字体的问题
- Centos6.5环境下编译安装Mapserver7.0.1
- Android源码编译(8)---编译内核
- pdf在线转换成word格式的方法
- Android绘图技巧
- Android源码编译(7)---运行
- 学习Linux ,Linux常用命令2
- 开源c++日志库 寻找-测试-选定
- POODLE SSLv3 安全漏洞 (CVE-2014-3566)
- myeclipse 快捷键(常用)
- linux下查找mysql等文件路径