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/includ开发者_如何学Pythones/.Please help me how to set this path?
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>
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
- this makefile should name "Makefile"
- put it in the same directory with the hello.c file
精彩评论