当前位置: 技术问答>linux和unix
《linux device driver》中的小例子编译一次需要多长时间?
来源: 互联网 发布时间:2016-02-10
本文导语: 怎么我编译第二章的“helloworld”模块都要几十分钟? 例子都是书上的 hello.c ------ #include #include MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk(KERN_ALERT "Hello, worldn"); return 0; } static voi...
怎么我编译第二章的“helloworld”模块都要几十分钟?
例子都是书上的
hello.c
------
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, worldn");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel worldn");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile:
------
# 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
例子都是书上的
hello.c
------
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, worldn");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel worldn");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile:
------
# 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
|
Makefile 没有问题
uname -r确认是你的2.6.10
uname -r确认是你的2.6.10
|
你怎么放过去的?我用sourceinsight好好的。
|
复制过去吧...
|
vi不熟悉,不过vi对中文一般复制不了
emacs确实牛,开销也是值得的
emacs确实牛,开销也是值得的