Search code examples
c++ckernelcyanogenmodlinux-toolchain

C/C++ Cyanogenmod How to compile kernel using different version of toolchain?


I am trying to compile kernel for Cyanogenmod 13. I am getting error

ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
 To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
 (NOTE: This is not recommended)

I read it here. That i need to compile my kernel using 4.7. How can i choose the version of toolchain during cyanogenmod build ??


Solution

  • Thanks to @nopasara and his valuable comment.

    So i did little research further and discovered that the kernel is compatiable with arm-eabi tool chain not arm-linux-androideabi toolchain. So here is the command i used

    export PATH=$PATH:~/android/system/prebuilts/gcc/linux-x86/arm/arm-linux-eabi-4.7/bin/ && export ARCH=arm && export SUBARCH=arm && export CROSS_COMPILE=arm-linux-eabi- && make msm8226_defconfig O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ
    

    and

     make   O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ zImage -j4
    

    To do with this Cyanogenmod add following line to your BoardConfig.mk

      TARGET_KERNEL_CROSS_COMPILE_PREFIX := arm-eabi-
    

    and either use

     export TARGET_LEGACY_GCC_VERSION=4.7 
    

    Or edit ~/android/system/build/core/combo/TARGET_linux-arm.mk and set version in

      $(combo_2nd_arch_prefix)TARGET_LEGACY_GCC_VERSION := 4.7