LiME内核模块交叉编译失败 [英] LiME Kernel Module Cross Compilation Fails

查看:180
本文介绍了LiME内核模块交叉编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下Makefile交叉编译android-goldfish-3.10-n-dev的LiME内核模块(提交:3a3b199582a68ba0688a099147738738d6c99f3282d)Linux内核版本:

I'm trying to cross-compile the LiME Kernel Module for the android-goldfish-3.10-n-dev ( commit: 3a3b199582a68ba0688a099147738d6c99f3282d ) Linux Kernel version with the following Makefile:

obj-m := lime.o
lime-objs := tcp.o disk.o main.o

KDIR_GOLD := /path/to/goldfish

PWD := $(shell pwd)
CCPATH :=/path/to/x86_64-linux-android-4.9/bin

default:
    # cross-compile for Android emulator
    $(MAKE) ARCH=x86_64 CROSS_COMPILE=$(CCPATH)/x86_64-linux-android-  -C $(KDIR_GOLD) M="$(PWD)" modules
    $(CCPATH)/x86_64-linux-android-strip --strip-unneeded lime.ko
    mv lime.ko lime-goldfish.ko

    $(MAKE) tidy

tidy:
    rm -f *.o *.mod.c Module.symvers Module.markers modules.order \.*.o.cmd \.*.ko.cmd \.*.o.d
    rm -rf \.tmp_versions

clean:
    $(MAKE) tidy
    rm -f *.ko

但是我收到以下错误/警告,并且编译失败.

But I'm getting the following errors/warnings and the compilation fails.

make ARCH=x86_64 CROSS_COMPILE=/path/to/x86_64-linux-android-4.9/bin/x86_64-linux-android-  -C /path/to/goldfish M="/path/to/LiME/src" modules
make[1]: Entering directory '/path/to/goldfish'
  CC [M]  /path/to/LiME/src/tcp.o
  CC [M]  /path/to/LiME/src/disk.o
  CC [M]  /path/to/LiME/src/main.o
  LD [M]  /path/to/LiME/src/lime.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "param_ops_int" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "param_ops_charp" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "param_ops_long" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "ldigest_final" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "ns_to_timeval" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "kfree" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "ktime_get_real" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "iomem_resource" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "ldigest_init" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "sscanf" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "strcmp" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "kmem_cache_alloc_trace" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "kmalloc_caches" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "ldigest_update" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "vfs_write" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "filp_close" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "filp_open" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "kernel_sendmsg" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "sock_setsockopt" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "kernel_stack" [/path/to/LiME/src/lime.ko] undefined!
WARNING: "sock_create_kern" [/path/to/LiME/src/lime.ko] undefined!
  CC      /path/to/LiME/src/lime.mod.o
/path/to/LiME/src/lime.mod.c:8:1: error: variable '__this_module' has initializer but incomplete type
 __attribute__((section(".gnu.linkonce.this_module"))) = {
 ^
/path/to/LiME/src/lime.mod.c:9:2: error: unknown field 'name' specified in initializer
  .name = KBUILD_MODNAME,
  ^
/path/to/LiME/src/lime.mod.c:9:2: warning: excess elements in struct initializer
/path/to/LiME/src/lime.mod.c:9:2: warning: (near initialization for '__this_module')
/path/to/LiME/src/lime.mod.c:10:2: error: unknown field 'init' specified in initializer
  .init = init_module,
  ^
/path/to/LiME/src/lime.mod.c:10:2: warning: excess elements in struct initializer
/path/to/LiME/src/lime.mod.c:10:2: warning: (near initialization for '__this_module')
/path/to/LiME/src/lime.mod.c:14:2: error: unknown field 'arch' specified in initializer
  .arch = MODULE_ARCH_INIT,
  ^
/path/to/LiME/src/lime.mod.c:14:10: error: 'MODULE_ARCH_INIT' undeclared here (not in a function)
  .arch = MODULE_ARCH_INIT,
          ^
/path/to/LiME/src/lime.mod.c:14:2: warning: excess elements in struct initializer
  .arch = MODULE_ARCH_INIT,
  ^
/path/to/LiME/src/lime.mod.c:14:2: warning: (near initialization for '__this_module')
make[2]: *** [/path/to/goldfish/scripts/Makefile.modpost:111: /path/to/LiME/src/lime.mod.o] Error 1
make[1]: *** [Makefile:1228: modules] Error 2
make[1]: Leaving directory '/path/to/goldfish'
make: *** [Makefile:35: default] Error 2

如果我在已构建内核的System.map文件中搜索未定义"符号,则可以找到所有这些符号. 关于如何解决此问题的任何提示?谢谢

If I search for the 'undefined' symbols inside the System.map file of the built kernel I can find all of them. Any hint on how to solve this issue? Thank you

推荐答案

我已经解决了我的.config文件中针对金鱼内核的已发布设置CONFIG_MODULES=y.我还需要替换.config文件中的一行,否则KBuild系统将不会通知文件更改,并且CONFIG_MODULES=y将被覆盖并且不适用.

I've solved this issued setting CONFIG_MODULES=y in my .config file for the goldfish kernel. I also needed to replace a line in the .config file otherwise KBuild system would not notify the change in file and CONFIG_MODULES=y would be overritten and not applied.

这篇关于LiME内核模块交叉编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆