编译Android 3.10内核源时出错



最近,我试图为我的小米Mi4c交叉complecle android内核。为此,我已经下载并配置了这样的工具链:

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b  marshmallow-release toolchain64
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE=`pwd`/toolchain64/bin/aarch64-linux-android-

然后我从这里克隆内核来源:https://github.com/andropax/andropax/android_kernel_kernel_xiaomi_msm8992

并执行此操作:

make clean && make mrproper
make ARCH=arm64 resurrection_libra_defconfig
make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -j3

然后我有一个错误:

In file included from include/linux/kernel.h:14:0,
                 from include/linux/sched.h:15,
                 from /home/owner/android_kernel_xiaomi_msm8992/arch/arm64/include/asm/compat.h:25,
                 from /home/owner/android_kernel_xiaomi_msm8992/arch/arm64/include/asm/stat.h:23,
                 from include/linux/stat.h:5,
                 from include/linux/module.h:10,
                 from drivers/tspdrv/tspdrv.c:26:
drivers/tspdrv/ImmVibeSPI_ISA1000.c: In function 'ImmVibeSPI_ForceOut_SetSamples':
include/linux/dynamic_debug.h:64:16: error: implicit declaration of function 'KBUILD_STR' [-Werror=implicit-function-declaration]
  static struct _ddebug  __aligned(8)   
                ^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  
  ^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
  pr_debug("%s: level = %dn", __func__, level);
  ^
<command-line>:0:27: error: 'tspdrv' undeclared (first use in this function)
include/linux/dynamic_debug.h:66:14: note: in expansion of macro 'KBUILD_MODNAME'
   .modname = KBUILD_MODNAME,   
              ^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  
  ^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
  pr_debug("%s: level = %dn", __func__, level);
  ^
<command-line>:0:27: note: each undeclared identifier is reported only once for each function it appears in
include/linux/dynamic_debug.h:66:14: note: in expansion of macro 'KBUILD_MODNAME'
   .modname = KBUILD_MODNAME,   
              ^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  
  ^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
  pr_debug("%s: level = %dn", __func__, level);
  ^
drivers/tspdrv/tspdrv.c: At top level:
drivers/tspdrv/tspdrv.c:94:37: fatal error: tspdrvOutputDataHandler.c: No such file or directory
 #include <tspdrvOutputDataHandler.c>
                                     ^
cc1: some warnings being treated as errors
compilation terminated.

那么,问题是,我在做什么错?也许我需要另一个工具链进行交叉填充?可以建议一个吗?我认为内核代码没有错误。那怎么了?

所以,几天后,我找到了答案。感谢4pda的Kay2777。

在主要makefile中查找kbuild_cflags,并添加以下以抑制警告作为错误:

KBUILD_CFLAGS += -w
// if all errors are to be suppressed
KBUILD_CFLAGS += -Wno-error=unused-but-set-variable
// if that specific error is to be suppressed.

最新更新