2
votes

I am trying to run a hello world kernel module but its showing module.h is no present. but i have module.h in /usr/src/linux.2.xx.xx/includes/.Please help me how to set this path?

2

2 Answers

1
votes

Try the following in your shell in the directory with the source of your module:

export KDIR=/usr/src/linux.2.xx.xx
make -C $KDIR M=`pwd`

That header should be used via #include <linux/module.h>

0
votes

try to touch a new makefile which coding like below

ifneq ($(KERNELRELEASE),)
obj-m := hello.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
  1. this makefile should name "Makefile"
  2. put it in the same directory with the hello.c file