从源代码编译内核。错误解释。

时间:2017-06-20 04:58:04

标签: c kernel

我正在从源代码编译android内核。但是在制作对象tspdrv.o时遇到了一些错误,并且无法确定它的生成位置。以下是错误:

  CC      drivers/tspdrv/tspdrv.o
In file included from include/linux/kernel.h:23:0,
             from include/linux/cache.h:4,
             from include/linux/time.h:7,
             from include/linux/stat.h:60,
             from include/linux/module.h:10,
             from drivers/tspdrv/tspdrv.c:34:
drivers/tspdrv/ImmVibeSPI.c: In function 'drv2604_write_reg_val':
include/linux/dynamic_debug.h:61:16: error: implicit declaration of function 'KBUILD_STR' [-Werror=implicit-function-declaration]
  static struct _ddebug __aligned(8)          \
         ^
include/linux/dynamic_debug.h:73:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
include/linux/printk.h:196:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI.c:681:4: note: in expansion of macro 'pr_debug'
pr_debug("drv2604 x5 write 0x%02x, 0x%02x", data[i], data[i + 1]);
^
<command-line>:0:27: error: 'tspdrv' undeclared (first use in this function)
include/linux/dynamic_debug.h:63:14: note: in expansion of macro 'KBUILD_MODNAME'
   .modname = KBUILD_MODNAME,   \
              ^
include/linux/dynamic_debug.h:73:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
include/linux/printk.h:196:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI.c:681:4: note: in expansion of macro 'pr_debug'
    pr_debug("drv2604 x5 write 0x%02x, 0x%02x", data[i], data[i + 1]);
    ^
<command-line>:0:27: note: each undeclared identifier is reported only once for each function it appears in
include/linux/dynamic_debug.h:63:14: note: in expansion of macro 'KBUILD_MODNAME'
   .modname = KBUILD_MODNAME,   \
              ^
include/linux/dynamic_debug.h:73:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
include/linux/printk.h:196:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI.c:681:4: note: in expansion of macro 'pr_debug'
    pr_debug("drv2604 x5 write 0x%02x, 0x%02x", data[i], data[i + 1]);
    ^
drivers/tspdrv/ImmVibeSPI.c: In function 'drv2604_read_reg':
<command-line>:0:27: error: 'tspdrv' undeclared (first use in this function)
include/linux/dynamic_debug.h:63:14: note: in expansion of macro 'KBUILD_MODNAME'
   .modname = KBUILD_MODNAME,   \
              ^
include/linux/dynamic_debug.h:73:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
include/linux/printk.h:196:2: note: in expansion of macro 'dynamic_pr_debug'
  dynamic_pr_debug(fmt, ##__VA_ARGS__)
  ^
drivers/tspdrv/ImmVibeSPI.c:732:2: note: in expansion of macro 'pr_debug'
  pr_debug("drv2604 read addr:0x%x reg:0x%x data:0x%x res:%d",
  ^
cc1: some warnings being treated as errors
scripts/Makefile.build:306: *** [drivers/tspdrv/tspdrv.o] Error 1

#0  drivers/tspdrv/tspdrv.o at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:306
#1  drivers/tspdrv/built-in.o at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:374
#2  __build at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:8
Command-line invocation:
    "remake -f scripts/Makefile.build obj=drivers/tspdrv"
scripts/Makefile.build:442: *** [drivers/tspdrv] Error 2

#0  drivers/tspdrv at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:442
#1  drivers/pinctrl/built-in.o at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:361
#2  drivers/built-in.o at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:374
#3  __build at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/scripts/Makefile.build:8
Command-line invocation:
    "remake -f scripts/Makefile.build obj=drivers"
Makefile:949: *** [drivers] Error 2

#0  drivers at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/Makefile:949
#1  arch/arm/kernel/vmlinux.lds at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/Makefile:940
#2  vmlinux at 
/home/ozair/nougat_mi3/kernel/xiaomi/cancro/Makefile:915
#3  all at /home/ozair/nougat_mi3/kernel/xiaomi/cancro/Makefile:563
#4  _all at /home/ozair/nougat_mi3/kernel/xiaomi/cancro/Makefile:111
Command-line invocation:
   " none

我需要了解这个错误的根源,因为它不会引导我到任何地方。例如,让我们把这部分错误

drivers/tspdrv/ImmVibeSPI.c: In function 'drv2604_write_reg_val':
include/linux/dynamic_debug.h:61:16: error: implicit declaration of 
function 'KBUILD_STR' [-Werror=implicit-function-declaration]
  static struct _ddebug __aligned(8)          \
         ^

KBUILD_STR

中没有名为include/linux/dynamic_debug.h:61:16的功能

或者我读错了?

1 个答案:

答案 0 :(得分:0)

看起来KBUILD_STR已从4.2和4.10之间的内核构建脚本中删除。

看起来驱动程序尚未更新以匹配。