widon@widon-laptop:~/Desktop/drivers/hello$ make
make -C /home/widon/Desktop/drivers/linux-2.6.30.4 M=/home/widon/Desktop/drivers/hello modules
make[1]: 正在进入目录 `/home/widon/Desktop/drivers/linux-2.6.30.4'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /home/widon/Desktop/drivers/linux-2.6.30.4/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/widon/Desktop/drivers/hello/hello.o
cc1: 错误: include/linux/autoconf.h:没有该文件或目录
In file included from include/linux/prefetch.h:14,
.............................
从 /home/widon/Desktop/drivers/hello/hello.c:2:
/home/widon/Desktop/drivers/linux-2.6.30.4/arch/x86/include/asm/module.h:68:2: 错误: #error unknown processor family
/home/widon/Desktop/drivers/hello/hello.c: 在函数‘__exittest’中:
/home/widon/Desktop/drivers/hello/hello.c:18: 警告: 返回了不兼容的指针类型
make[2]: *** [/home/widon/Desktop/drivers/hello/hello.o] 错误 1
make[1]: *** [_module_/home/widon/Desktop/drivers/hello] 错误 2
make[1]:正在离开目录 `/home/widon/Desktop/drivers/linux-2.6.30.4'
make: *** [default] 错误 2
用这个makefile为什么会有这么多错误啊
widon@widon-laptop:~/Desktop/drivers/hello$ cat Makefile
obj-m := hello.o
KERNELDIR := /home/widon/Desktop/drivers/linux-2.6.30.4
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.cmd *.o *.ko *.mod.c *.symvers *.order
widon@widon-laptop:~/Desktop/drivers/hello$ cat hello.c
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int hello_init(void)
{
printk("hello, world\n");
return 0;
}
static int hello_exit(void)
{
printk("Goodbye, cruel world\n");
return 0;
}
module_init(hello_init);
module_exit(hello_exit);
这个makefile可以
widon@widon-laptop:~/Desktop/drivers/hello$ cat Makefile_backup
obj-m := hello.o
KERNELDIR := /lib/modules/$(shell uname -r)/build
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.cmd *.o *.ko *.mod.c *.symvers *.order
linux 驱动 hello world
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
- widon1104
- 帖子: 846
- 注册时间: 2008-07-17 10:55
-
- 帖子: 6548
- 注册时间: 2008-10-31 22:12
- 系统: 践兔
- 联系: