Driver is not loading when there 2 or more source files

35 views Asked by At

I have defined the following files

main.c file

#include "main.h"

static int __int entrypoint(void)
{
        pr_info("Helloworld");
        new_function(void);
        return 0;
}

static void __exit exitpoint(void)
{
        pr_info("Goodbye World");
}

module_init(entrypoint);
module_exit(exitpoint);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("SSV");
MODULE_DESCRIPTION("SIMPLE DRIVER");
MODULE_INFO(X86, "X86-64bit");

function.c file

#include "main.h"
void new_function(void)
{
        pr_info("hello new function \n");
}
MODULE_LICENSE("GPL");

main.h file

#include <linux/module.h>

void new_function(void);

Makefile

obj-m := main.o
main-objs :=function.o

all:
        make -C /lib/modules/$(shell uname -r)/build/ M=$(shell pwd) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build/ M=$(shell pwd) clean

When i used make it successfully generated main.ko but when i tried to load the module i am getting the following error

[ 2991.240255] main: loading out-of-tree module taints kernel. [ 2991.240263] main: module verification failed: signature and/or required key missing - tainting kernel

I was expecting module to be loaded and print statements to be printed from both the files

0

There are 0 answers