C/ c++ Cyanogenmod如何使用不同版本的工具链编译内核

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

本文关键字:版本 工具 内核 编译 c++ Cyanogenmod 何使用      更新时间:2023-10-16

我正在尝试编译Cyanogenmod 13的内核。我得到错误

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)

我在这里读到的。我需要用4.7编译我的内核。我如何在cyanogenmod构建期间选择工具链的版本??

我认为您需要设置gcc版本4.7并使用CC变量将其设置为编译器。例如:make target CC=/bin/gcc4.7

更多信息在这里和这里

感谢@nopasara和他的宝贵意见。

所以我做了一些进一步的研究,发现内核兼容arm-eabi tool chain而不是arm-linux-androideabi工具链。下面是我使用的命令

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

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

要使用Cyanogenmod,请将以下行添加到BoardConfig.mk

  TARGET_KERNEL_CROSS_COMPILE_PREFIX := arm-eabi-

或者使用

 export TARGET_LEGACY_GCC_VERSION=4.7 

或者编辑~/android/system/build/core/combo/TARGET_linux-arm。Mk和set version

  $(combo_2nd_arch_prefix)TARGET_LEGACY_GCC_VERSION := 4.7