ldd3中的hello world驱动程序的疑问???
驱动程序源码:
C/C++ code
Makefile文件为:
C/C++ code
可当我用insmod hello.ko将模块加载进去时并没有输出那两个printk中的内容,望大牛们帮我解答解答,请直接讲解本题,我不想听大话,多谢!!!
C/C++ code
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk(KERN_ALERT "Hello, world\n"); return 0; } static void hello_exit(void) { printk(KERN_ALERT "Goodbye, cruel world\n"); } module_init(hello_init); module_exit(hello_exit);
Makefile文件为:
C/C++ code
ifneq ($(KERNELRELEASE),) obj-m:=hello.o else KERNELDIR:=/lib/modules/$(shell uname -r)/build #内核目录 PWD:=$(shell pwd) #当前目录 default: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules clean: rm -rf *.o *mod.c *.moodbye
可当我用insmod hello.ko将模块加载进去时并没有输出那两个printk中的内容,望大牛们帮我解答解答,请直接讲解本题,我不想听大话,多谢!!!
作者: xuyuanfan77 发布时间: 2011-04-29
到
/var/log/message
里去看
/var/log/message
里去看
作者: wwyyxx26 发布时间: 2011-04-29