Im a windows driver programmer who is a complete newbie in linux kernel development.I have installed linux kernel headers. I am trying my helloworld module in linux kernel.
#include <linux/init.h>
#include <linux/module.h>
/*MODULE_LICENSE("Dual BSD/GPL");*/
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
following is the code for my module. makefile for my build is
obj-m +=tryout.o
KDIR =/usr/src/linux-headers-4.13.0-37-generic
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf *.o *.ko *.mod.* *.symvers *.order
but im getting 'fatal error: linux/init.h: No such file or directory while making this module'. What could be the possible reason? and how can i resolve it?