关于获取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 芯片)。

更多相关文章

  1. Ubuntu 16.04 LTS 编译 Android(安卓)7.1
  2. Android输出logs到文件
  3. GreenDao使用心得
  4. 生成so
  5. Gradle Android最新自动化编译脚本教程
  6. Ubuntu10.04系统 32位机上安装编译Android2.3源码
  7. Android(安卓)4.4 Kitkat 使能 USB adb 功能
  8. 编译Android源码制作ROM,烧录
  9. Android(安卓)Build系统bash filename too long问题

随机推荐

  1. android 通过百度地图定位获取坐标在导航
  2. android:layout_gravity和android:gravit
  3. Android视图框架
  4. 【Android自学笔记】android实现TextView
  5. Android的地图服务
  6. Android获取在线视频的缩略图方式对比
  7. Android浏览器显示大分辨率图片的问题 分
  8. Android 入门第八讲02-WebView的高级用法
  9. android,No Launcher activity found!
  10. Android(安卓)JNI入门第三篇――jni头文