作者: yelei302
2013-03-21 15:51:09
hello.c
#incldue
#include
static int hello_init(void)
{
printk(KERN_WARNING"Hello,world!\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_INFO"Goodbye,world\n");
}
module_init(hello_init);
module_exit(hello_exit);
makefile
ifneq ($(KERNELRELERASE),)
obj-m :=hello.o
else
KDIR := /lib/modules/2.6.18-164.el5/build
all:
make -C $(KDIR) M=$(PWD) modules
clean:
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
编译结果:
[root@localhost kernel]# make
make -C /lib/modules/2.6.18-164.el5/build M=/mnt/hgfs/Linux/kernel modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-164.el5-i686'
Building modules, stage 2.
MODPOST
make[1]: Leaving directory `/usr/src/kernels/2.6.18-164.el5-i686'
目录下并没有生成hello.o hello.ko
为什么??