]# dmesg | grep word_count | tail -n 2 word_count_init_success
来源:互联网 发布:开票软件000013 编辑:程序博客网 时间:2024/05/17 23:59
Makefile
obj-m := word_count.o
#include <linux/module.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/fs.h>#include <linux/miscdevice.h>#include <asm/uaccess.h>// 初始化Linux驱动static int __init word_count_init(void){// 输出日志信息printk("word_count_init_success\n");return 0;}// 卸载Linux驱动static void __exit word_count_exit(void){// 输出日志信息printk("word_count_init_exit_success\n");} // 注册初始化Linux驱动的函数module_init( word_count_init);// 注册卸载Linux驱动的函数module_exit( word_count_exit);MODULE_AUTHOR("lining");MODULE_DESCRIPTION("statistics of word count.");MODULE_ALIAS("word count module.");MODULE_LICENSE("GPL");
[root@localhost word_count]# ls /usr/src/kernels/2.6.18-53.el5xen-i686
arch include lib net usr
block init Makefile scripts
crypto ipc mm security
drivers kabi_whitelist Module.kabi sound
fs kernel Module.symvers symsets-2.6.18-53.el5xen.tar.gz
[root@localhost word_count]# ls /usr/src/kernels/2.6.18-53.el5-xen-i686
arch include lib net usr
block init Makefile scripts
crypto ipc mm security
drivers kabi_whitelist Module.kabi sound
fs kernel Module.symvers symsets-2.6.18-53.el5xen.tar.gz
[root@localhost word_count]# make -C /usr/src/kernels/2.6.18-53.el5xen-i686 M=./
make: Entering directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
Building modules, stage 2.
MODPOST
make: Leaving directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
[root@localhost word_count]# pwd
/root/drivers/ch06/word_count
[root@localhost word_count]# make -C /usr/src/kernels/2.6.18-53.el5xen-i686 M=/root/drivers/ch06/word_count
make: Entering directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
LD /root/drivers/ch06/word_count/built-in.o
CC [M] /root/drivers/ch06/word_count/word_count.o
Building modules, stage 2.
MODPOST
CC /root/drivers/ch06/word_count/word_count.mod.o
LD [M] /root/drivers/ch06/word_count/word_count.ko
make: Leaving directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
[root@localhost word_count]# ls /usr/src/kernels/2.6.18-53.el5xen-i686
arch include lib net usr
block init Makefile scripts
crypto ipc mm security
drivers kabi_whitelist Module.kabi sound
fs kernel Module.symvers symsets-2.6.18-53.el5xen.tar.gz
[root@localhost word_count]# insmod word_count.ko
[root@localhost word_count]# lsmod | grep word_count
word_count 5504 0
[root@localhost word_count]# rmmod word_count
[root@localhost word_count]# dmesg | grep word_count
word_count: no version for "struct_module" found: kernel tainted.
word_count_init_success
word_count_init_exit_success
[root@localhost word_count]# dmesg | grep word_count | tail -n 2
word_count_init_success
word_count_init_exit_success
[root@localhost word_count]#
- ]# dmesg | grep word_count | tail -n 2 word_count_init_success
- dmesg | grep word_count
- word_count
- word_count
- tail n
- # 查看串口设备:dmesg | grep ttyS*
- android N dmesg源码分析
- storm学习(2) 进阶word_count 程序
- 通过dmesg | tail 看insmod ko时输出的log
- tail VS cat VS grep(RedHat Linux)
- tail -f 多次grep过滤输出
- tail -f 多次grep过滤输出
- Linux命令之tail、head、more、grep
- dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- linux 下安装 source insight 很简单
- android系统开发-HAL层开发基础
- 关于android应用程序的入口 Activity
- SBJson
- hnust 1450 Bird tree
- ]# dmesg | grep word_count | tail -n 2 word_count_init_success
- Ubuntu11.04 autotools 安装
- A star
- 重新想象 Windows 8 Store Apps (9)
- 诺顿(Norton)免杀账号
- 第四周项目4
- 黑马程序员_数组
- oracle job不执行的分析处理
- IT之路!?