insmod error in kernel module programming
我刚刚开始使用模块化编程。
以上是我的两个文件:
你好.c
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include <linux/init.h> #include <linux/module.h> static int hello_init(void) static void hello_exit(void) module_init(hello_init); |
制作文件
1
2 3 4 5 6 7 8 9 |
obj–m += hello.o
KDIR = /usr/src/linux–headers–3.13.0–46–generic all: clean: |
这是我的终端输出在 insmod 命令中显示错误,请帮助。
1
2 3 4 5 6 7 8 |
anubhav@anubhav–Inspiron–3421:~/Desktop/os$ make
make –C /usr/src/linux–headers–3.13.0–46–generic SUBDIRS=/home/anubhav/Desktop/os modules make[1]: Entering directory `/usr/src/linux–headers–3.13.0–46–generic‘ Building modules, stage 2. MODPOST 1 modules make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-46-generic’ anubhav@anubhav–Inspiron–3421:~/Desktop/os$ insmod hello.ko insmod: ERROR: could not insert module hello.ko: Operation not permitted |
如果您启用了安全启动,较新的内核将不允许插入任意内核模块。因此,您可以在 BIOS 中禁用安全启动,或者您需要对要安装的内核模块进行签名。
安全签署内核模块的步骤:
您需要成为 root 才能执行第 2 步
正如isowen所说,只有root可以加载或卸载模块。
执行
n
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/269279.html