Android 内核编译过程记录

Android 内核编译过程记录

  1. 下载内核源码和交叉编译链,交叉编译链我用的 https://aosp.tuna.tsinghua.edu.cn/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9

    UPDATE :Google 目前在全力推广 Clang,老内核请不要使用 master 分支,新内核建议迁移至Clang。

  2. 设置交叉编译链前缀

    export CROSS_COMPILE=$(pwd)/bin/<toolchain_prefix>-
    
  1. 指定交叉编译目标架构

    export ARCH=<arch> && export SUBARCH=<arch>
    
  1. 开始编译,新建输出文件夹,如果不是首次编译需要通过第二三条命令进行清理。指定 defconfig 文件,进行编译。

    mkdir -p out
    make O=out clean
    make O=out mrproper
    make O=out <defconfig_name>
    make O=out -j$(nproc --all)
    
  1. 在4.x的机器上编译3.x的内核需要把 kernel/timeconst.pl 第373行改为 if (!(@val)) {
posted @ 2019-05-12 09:48  ZanyRain  阅读(227)  评论(0)    收藏  举报