Linux内核模块开发编译其他内核

塔里达·乔治

我在其他中使用 LinK+ 来开发 linux 内核模块。我的开发机器安装了 Linux Mint 18 操作系统,内核版本为 4.4.xx。为了进行测试,我想将内核模块部署到内核版本为 3.16.xx 的 Debian 机器(在虚拟机中)。

LinkK+ 有一个名为“为其他内核编译”的选项(见下图)

在此处输入图片说明

当我按下那个按钮时,一个对话框要求我指向内核源位置。我已经从https://www.kernel.org/下载了内核版本 3.16.xx ,然后指向从该存档中提取的文件。

make 命令的输出是这样的:

**** Build of configuration Debug for project VMDD ****

make --makefile=Makefile --directory=KERN_SRC modules 
make: Entering directory '/home/george/linkProjects/VMDD/KERN_SRC'
make -C /home/george/kernels/linux-3.16.43/ M=/home/george/linkProjects/VMDD/KERN_SRC modules
make[1]: Entering directory '/home/george/kernels/linux-3.16.43'

  WARNING: Symbol version dump ./Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/george/linkProjects/VMDD/KERN_SRC/VMDD.o
/bin/sh: 1: ./scripts/recordmcount: not found
scripts/Makefile.build:263: recipe for target '/home/george/linkProjects/VMDD/KERN_SRC/VMDD.o' failed
make[2]: *** [/home/george/linkProjects/VMDD/KERN_SRC/VMDD.o] Error 127
Makefile:1337: recipe for target '_module_/home/george/linkProjects/VMDD/KERN_SRC' failed
make[1]: Leaving directory '/home/george/kernels/linux-3.16.43'
make[1]: *** [_module_/home/george/linkProjects/VMDD/KERN_SRC] Error 2
make: *** [modules] Error 2
Makefile:8: recipe for target 'modules' failed
make: Leaving directory '/home/george/linkProjects/VMDD/KERN_SRC'

我做错了什么 ?

osgx

我已经从https://www.kernel.org/下载了内核版本 3.16.xx ,然后指向从该存档中提取的文件。

如果您只有原始源代码,则无法为某些内核编译模块。您需要点 IDE 来配置和部分构建内核。实际上,为某些内核版本构建模块所需的所有文件都在已编译内核的 kbuild 目录中,安装在 /lib/modules/ version /kbuild 中。有 linux-kbuild-版本( https://packages.debian.org/jessie/kernel/linux-kbuild-3.16 ) 包含一些文件的包https://packages.debian.org/jessie/amd64/linux-kbuild- 3.16/filelist和 linux-headers-版本( https://packages.debian.org/jessie/linux-headers-3.16.0-4-amd64 ),其中包括 Module.symvers (https://packages.debian.org/jessie/amd64/linux-headers-3.16.0-4-amd64/filelist):

/usr/src/linux-headers-3.16.0-4-amd64/Module.symvers

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章