Hi,
I wanted to create a Linux kernel module that takes my name, and two integers as arguments, and then prints the name and the sum of those numbers on standard output. Unfortunately the file is not compiling. I get the message: make[2]: *** No rules to make object '/home/rafal/Core/core.o', required by '/home/rafal/Core/core.mod'. Stop. Below I paste the Makefile and module code. Someone suggest what is wrong.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static char *my_name= "Janusz";
module_param(my_name, charp, 0644);
MODULE_PARM_DESC(my_name, "String");
static int first_value = 1;
module_param(first_value, int, 0644);
MODULE_PARM_DESC(first_value, "Integer");
static int second_value = 2;
module_param(second_value, int, 0644);
MODULE_PARM_DESC(second_value, "Integer");
static int __init my init(void)
{
int sum;
sum= first_value+second_value;
printk(KERN_INFO "[parameters] Init module!\n");
printk(KERN_INFO "[parameters] my_name = %s\n", my_name);
printk(KERN_INFO "[parameters] sum = %d\n", sum);
return 0;
}
void __exit my_exit(void)
module_init(my_init);
module_exit(my_exit);
obj-m := core.o
KERNELDIR = /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
What I have tried:
I have no more idea whats is wrong