Building Kernels for Galaxy Nexus
---from http://source.android.com/source/building-kernels.html 20130726
1.Figuring out which kernel to build
This table lists the name and locations of the kernel sources and binaries:
Device Binary location Source location Build configuration
maguro device/samsung/tuna/kernel kernel/omap tuna_defconfig
grouper | device/asus/grouper/kernel | kernel/tegra | tegra3_android_defconfig |
panda device/ti/panda/kernel kernel/omap panda_defconfig
Device projects are of the form device/<vendor>/<name>.
$ git clone https://android.googlesource.com/device/samsung/tuna
$ cd tuna
$ git log --max-count=1 kernel
The commit message for the kernel binary contains a partial git log of the kernel sources that were used to build the binary in question. The first entry in the log is the most recent, i.e. the one used to build that kernel. You will need it at a later step.
Downloading sources
Depending on which kernel you want,
$ git clone https://android.googlesource.com/kernel/omap.git
The goldfish project contains the kernel sources for the emulated platforms.
The omap project is used for PandaBoard and Galaxy Nexus, and can be used as a starting point for work on TI OMAP chipsets.
$ cd omap
$ git branch -a
$ git checkout remotes/origin/android-omap-tuna-3.0
Ensure that the prebuilt toolchain is in your path.
//$ export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH 官网的。编译android4.1.1 for galaxy nexus 没用到,编译android4.2.2 for nexus 7 则用到
export PATH=/media/本地磁盘/WORKING_DIRECTORY/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH //build android 4.1.1 for galaxy nexus
Building --------To build the tuna kernel
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
//$ git checkout <commit_from_first_step> 官网 我没用到
$ make tuna_defconfig
$ make
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 4 modules
CC crypto/ansi_cprng.mod.o
LD [M] crypto/ansi_cprng.ko
CC drivers/rpmsg/rpmsg_client_sample.mod.o
LD [M] drivers/rpmsg/rpmsg_client_sample.ko
CC drivers/rpmsg/rpmsg_server_sample.mod.o
LD [M] drivers/rpmsg/rpmsg_server_sample.ko
CC drivers/scsi/scsi_wait_scan.mod.o
LD [M] drivers/scsi/scsi_wait_scan.ko
To build the tuna kernel
The kernel binary is output as `arch/arm/boot/zImage`, and needs to be copied into the Android source tree in order to build the matching boot image.
这一步具体操作如下:
DH: cp arch/arm/boot/zImage device/samsung/tuna/kernel 然后重新编译android源码
LH:直接将zImage改名成kernel, 然后拷贝到源码层的tuna下覆盖原先的kernel文件。再重新编译android源码.