linux2.6驱动编写问题
no such file or directory
///代码文件
#i nclude <linux/init.h>
#i nclude <linux/module.h>
MODULE_LICENSE("MYGPL"); //(1)
static int hello_init(void) //(2)
{
printk(KERN_ALERT "Hello, world\n"); //(3)
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init); //(4)
module_exit(hello_exit); //(5)
makefile文件
# Makefile for hello module
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq($(KERNELRELEASE),)
obj-m := hello.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
当我运行make 的时候却提示:
make -C /lib/modules/2.6.18-8.e15xen/build M=/home/module_tzb modules
make: ***/lib/modules/2.6.18-8.e15xen/build: no such file or directory.Stop.
make:***[default]Error 2
请教各位高手希望能给小弟指点迷津,这个问题困扰了我很久
因为小弟是菜鸟还望各为大哥多多指教,回帖谢谢
我的系统是Red Hat Enterprise linux 5
内核是2.6.18版本的哈