Separately compiled source code of the kernel portion Android

I. Introduction

In the Android SDK source project, if you compile the whole project may take two or three hours even if the secondary have compiled more than twenty minutes. And I'm more of a project to make changes to Android's kernel, if every time the entire compilation, will be very time-consuming, so the following to introduce a more rapid compilation mode, you can only compile the relevant kernel source code, packing generate boot.img, and then only re-program the partition to complete the update.

Second, the compilation methods and techniques

Generates a separate file boot.img

Generally, we will be well after the entire Android build, resulting in what img file path:
/ Android root directory / out / target / protect / xxx ( product name) /
generated boot.img, system.img, recovery in this directory .img, uboot.img, kernel and other good compiler package img file.

At this point, if we made a change to the kernel, want changes to take effect, but because Android does not change the content of other partitions, do not want to compile again, this is by following these steps:

1, cd to the directory kernel execution make clean

2, cd to the Android root directory, rename the directory out , after the name of the directory can out different commands, find different versions of the compiler.

3, cd to the root directory, perform bootimage the make . 1 , a case will regenerate out directory. Inside the subdirectory before the reorganization of the same, the only difference is in the final output directory, only kernel.img, boot.img and other related documents

4. At this point, we can separate the boot.img burned into the boot partition, if ramdisk has not changed, it can be programmed only kernel.img.

Generate other partitions img file

Similarly, in the previous step, use this command, the file may be generated separately img
the make systemimage -> the system.img
the make userdataimage -> userdata.img
the make the ramdisk -> ramdisk.img

make bootimage command Detailed

Use the above command can easily compile img file you want to separate, but call the process of this command is more complex, but which contains a unique Android project compiled order to analyze the entire project source code to control very helpful, I and we intend to analyze in detail the main line of the next chapter!

ps: middle of the night and you, love apartment recently on the line 5, after work get a good chase it, so we have to sort this slightly ~


  1. Can be generated by this command boot.img, the image file contains the Linux Kernel, Ram disk, resulting boot.img can only be programmed via fastboot, which is useful only to modify the Linux kernel. ↩︎

Published 10 original articles · won praise 8 · views 5023

Guess you like

Origin blog.csdn.net/weixin_38019025/article/details/103980681