简体   繁体   English

Linux内核模块开发可用于其他内核

[英]Linux Kernel Module development compile for other kernel

I'm using LinK+ in other to develop a linux kernel module. 我在其他方面使用LinK +开发Linux内核模块。 My development machine has a Linux Mint 18 installed operating system with kernel version 4.4.xx. 我的开发机器安装了Linux Mint 18操作系统,内核版本为4.4.xx。 For testing I want to deploy the kernel module to a Debian machine(in a virtualbox) which has a kernel version 3.16.xx. 为了进行测试,我想将内核模块部署到具有3.16.xx内核版本的Debian机器(在virtualbox中)。

LinK+ has an option called "Compile for other kernel" (see image below) LinK +有一个名为“为其他内核编译”的选项(请参见下图)

在此处输入图片说明

When I press that button a dialog ask me to point to Kernel Source Location. 当我按下该按钮时,将出现一个对话框,要求我指向“内核源位置”。 I've downloaded kernel version 3.16.xx from https://www.kernel.org/ and then pointed to extracted files from that archive. 我已经从https://www.kernel.org/下载了内核版本3.16.xx,然后指向从该归档文件中提取的文件。

The output of the make command is this: 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'

What did I do wrong ? 我做错了什么 ?

I've downloaded kernel version 3.16.xx from https://www.kernel.org/ and then pointed to extracted files from that archive. 我已经从https://www.kernel.org/下载了内核版本3.16.xx,然后指向从该归档文件中提取的文件。

You can't compile modules for some kernel if you have only its original source. 如果只有原始源,则不能为某些内核编译模块。 You need point IDE to configured and partially build kernel. 您需要使用IDE来配置和部分构建内核。 Actually, all files needed to build modules for some kernel version are in kbuild directory of compiled kernel, installed into /lib/modules/ version /kbuild. 实际上,为某个内核版本构建模块所需的所有文件都位于已编译内核的kbuild目录中,并安装在/ lib / modules / 版本 / kbuild中。 There are linux-kbuild- version ( https://packages.debian.org/jessie/kernel/linux-kbuild-3.16 ) package with some files https://packages.debian.org/jessie/amd64/linux-kbuild-3.16/filelist and linux-headers- version ( https://packages.debian.org/jessie/linux-headers-3.16.0-4-amd64 ) which includes Module.symvers ( https://packages.debian.org/jessie/amd64/linux-headers-3.16.0-4-amd64/filelist ): 有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 /usr/src/linux-headers-3.16.0-4-amd64/Module.symvers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM