在插入一个模块时,模块验证失败。

4
在Ubuntu 14.04,Kernel 3.13.0上,当我插入以下简单模块时,从内核日志中收到错误消息:"module verification failed: signature and/or required key missing - tainting kernel"。
我是否犯了任何错误或错过了什么?这是一个名为ts2.c的文件中的模块源代码。
#include <linux/module.h>   /* Needed by all modules */
#include <linux/kernel.h>   /* Needed for KERN_INFO */
#include <linux/init.h>


MODULE_LICENSE("GPL");
MODULE_ALIAS("hello2");

static int __init hello1_init(void)
{
    printk(KERN_INFO "Hello world 2.\n");
    return 0;
}

static void __exit hello1_exit(void)
{
    printk(KERN_INFO "Goodbye world 2.\n");
}

module_init(hello1_init);
module_exit(hello1_exit);

这是Makefile文件:

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := ts2.o
else    
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

modules:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) modules
clean:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) clean

endif

depend .depend dep:
    $(CC) $(EXTRA_CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
1个回答

2

您的 make 文件出现了问题...

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := ts2.o

应该是以下这样的:

而不应该是这样:

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := hello1.o

现在你的问题应该已经解决了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接