在我的linux头文件文件夹中,包含在/usr/src/linux-headers-5.7.0-kali1-common/include.目录中的Kali内核5.7.0头在这个文件夹中,我有包含在子文件夹中的头文件,如asm-generic、linux、uapi、acpi、crypto等等。但是在头文件中,即linux/module.h中有一个头文件引用,如
#include <asm/module.h> // top of linux/module.h但实际上,我没有asm文件夹,当我安装这些文件时,它已经包含在我的头文件中了。所以我想到的一个解决办法就是。可能的解决方案:将引用从asm/*更改为asm-泛型/*,如从asm/module.h更改为asm-泛型/module.h,在linux/module.h和其他我可能使用的文件中。我想知道asm和asm-泛型是一样的吗?意味着它们包含相同的文件和结构,或者有什么不同,我可以造成问题。
如果我更正了包含引用中的目录名,而不是它是否有意义,或者我在编译模块时会遇到问题,如果我将头子目录名称从asm更改为asm-泛型?如果我不这样做,头文件就会丢失。
发布于 2021-01-07 14:11:25
简短回答
他们不一样。
内核开发人员可能在asm头中包含asm -泛型标头,而asm标头是内核模块所需的标头。
您可以从下面的帖子中获得更多信息。
以另一种方式回答这个问题。
看来你在尝试做一个内核模块。
要构建内核模块,需要内核头或编译好的内核源代码。但是我不知道kali linux,所以我只是在这里提供了一些一般性的建议。
从哪弄到他们
- Eg: Ubuntu has it in `/usr/src/linux-headers-$(uname -r)/include`sudo apt-get install linux-headers-$(uname -r)下载- It seems kali linux 2.0 might need more operations. Found [this post](https://computingforgeeks.com/how-to-install-linux-kernel-headers-on-kali-linux-2-0-kali-sana/) might help.1. Checkout linux kernel code of your desired distro.
2. Set up kernel config with `make menuconfig` ( You might get stumbled here a while.. many packages might be required )
3. Compile kernel with `make modules_prepare` to compile essential Module.symvers for drivers. It take significant less time than compiling a full kernel.我想您已经找到了一个内核模块构建示例。如果没有,您可以参考正式的内核模块文档。如果你花一段时间读前两章的话,这会有很大帮助。
或者另一个示例
https://stackoverflow.com/questions/65591871
复制相似问题