写了个simple helloworld modules in linux kernel 2.6.8 but printk(KERN_ALERT "kkkkkkkkkkkkkk\n") can not print the message to current tty, but can see it at '/proc/kmsg' how to solve this problem? thanks a lot
在2.6.11下调试一驱动程序的时候,为了清除一个整形的值,连续两次在两个不同的printk中输出,在内核日志文件中看到的居然不一样,怎么会有这种事情?而且变量的访问都加了锁了。
比如对sector_t max_sector
做如下操作:
printk("j:%d
为什么我在linux-2.4.23/arch/ppc/kernel/setup.c 的early_init(int r3, int r4, int r5)函数里面加入pringk()函数一进内核就会死掉?大家能指点下吗?
printk(KERN_INFO "Goodbye world \n"); 我查了一个KERN_INFO是个define #define KERN_INFO "<6>" 那么这个函数就等于 printk(“<6>” "Goodbye world \n"); 这个语法正确吗? [ 本帖最后由 tianlijian 于 2009-4-29 10:04 编辑 ]
通过printk打你希望追踪的消息。从它的名字可以看出,这个东西有点类似与gnu c中的printf。不过用于内核的东西总该有些特色,printk添加了一些日志级别(loglevel),具体日志级别定义的宏在。 (printk的格式:printk(KERN_ALERT"The process is \"%s\"(pid %i)\n",current->comm,current->pid)) 。 这些宏定义的注释已经很详细了。 #define KERN_EMERG "" /* system is unusable */ #define KERN_ALERT "" /* action must...
我刚学习设备驱动的开发。看《Linux 设备驱动程序》一书的初级例子。
/*ModuleDemo.cpp*/
#include
我刚学习设备驱动的开发。看《Linux 设备驱动程序》一书的初级例子。
/*ModuleDemo.cpp*/
#include