修改编译Nexus5x android7.0.1(N)版本内核(AOSP)

关于获取Android内核源码以及编译,可以参阅Android官网相关:https://source.android.com/source/building-kernels.html
这里记录一下自己的步骤



获取内核源码相关

因为是使用的本地mirror,所以直接git clone到本地的相关文件夹

git clone aosp_mirror/kernel/msm.git

拿到源码后选择对应版本
git branch -a 查看可用版本
git checkout 切换到对应版本,这里是android-msm-bullhead-3.10-nougat

拿到对应版本源码后,定制内核版本,加入自身相关信息 ,编辑Makefile中的EXTRAVERSION即可


编译内核相关:

与Android官网略有不同,可以将要编译的对应内核的配置文件直接拷贝过来如我这里的bullhead_defconfig
cp arch/arm64/configs/bullhead_defconfig .config
然后执行编译配置
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- menuconfig
其中ARCH为架构配置,CROSS_COMPILE为交叉编译链工具前缀名,32位ARM架构对应为arm,前缀为arm-linux-androideabi-;64位ARM架构对应为arm64,前缀为aarch64-linux-android-
然后执行编译
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j8


刷入内核相关:

在/dev/plaform/下找到boot
dd if=/dev/plaform/your/boot/path of=/data/local/tmp/boot.img
adb pull /data/local/tmp/boot.img
使用abootimg命令
abootimg -u boot.img -k arch/arm64/boot/Image.gz-dtb 
然后将写好的boot.img 刷回手机

提示:
fastboot boot boot.img 不会刷入我们的boot.img 仅仅是将boot加载到内存中

fastboot flash boot boot.img 才会刷入固化boot.img 


不同kernel的git含义:

common 是通用的内核。

goldfish 内核用于模拟器的(emulated platforms)。

msm 内核用于高通的CPU芯片(Qualcomm MSM chipsets)。

omap 内核用于德州仪器的芯片(TI OMAP chipsets)。

samsung 内核用于三星的芯片(Samsung Hummingbird chipsets)。

tegra 内核用于英伟达的芯片(NVIDIA Tegra chipsets)。

exynos 用于 Nexus 10 和 Samsung  chipsets(三星的 Exynos 芯片)。

你可能感兴趣的:(AOSP)