hello.c文件代码如下
#include <linux/init.h>
#include <linux/moudle.h>
static int hello_init(void)
{
printk(KERN_WARING"Hello.wrold"\n);
return 0;
}
static void hello_exit(void)
{
printk(KERN_INFO:Goodbye, World\n);
}
module_init(hello_init);
module_exit(hello_exit);
Makefile代码如下:
ifneq ($(KERNELRELEASE))
obj-m:= hello.o
else
KDIR := /neihe
all:
make -C $(KDIR) M-$(PWD) modules
clean
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
然后放在linux下的/neihe目录下面。进入/neihe目录运行make提示错误:
[root@localhost neihe]# make
make -C /neihe M=/neihe modules
make[1]: Entering directory `/neihe'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/neihe'
make: *** [all] Erro
这个要怎么解决?
#include <linux/init.h>
#include <linux/moudle.h>
static int hello_init(void)
{
printk(KERN_WARING"Hello.wrold"\n);
return 0;
}
static void hello_exit(void)
{
printk(KERN_INFO:Goodbye, World\n);
}
module_init(hello_init);
module_exit(hello_exit);
Makefile代码如下:
ifneq ($(KERNELRELEASE))
obj-m:= hello.o
else
KDIR := /neihe
all:
make -C $(KDIR) M-$(PWD) modules
clean
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
然后放在linux下的/neihe目录下面。进入/neihe目录运行make提示错误:
[root@localhost neihe]# make
make -C /neihe M=/neihe modules
make[1]: Entering directory `/neihe'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/neihe'
make: *** [all] Erro
这个要怎么解决?