linux 设备驱动程序 hello+param
来源:互联网 发布:淘宝货源 编辑:程序博客网 时间:2024/05/16 14:56
module_param.c 文件
#include<linux/init.h>
#include<linux/module.h>#include<linux/kernel.h>
MODULE_LICENSE("GPL");
static char *who;
static int times;
module_param(who, charp, 0644);
module_param(times, int, 0644);
static int __init hello_init(void)
{
int i;
for(i = 1; i <= times; i++)
printk("%d %s!\n", i, who);
printk("hello kernel! \n");
return 0;
}
static void __exit hello_exit(void)
{
printk("Goodbye, %s!\n", who);
}
module_init(hello_init);
module_exit(hello_exit);
Makefile文件
obj-m:=module_param.oCURRENT_PATH:=$(shell pwd)
VERSION_NUM:=$(shell uname -r)
LINUX_PATH?=/lib/modules/$(VERSION_NUM)/build/
all:
$(MAKE) -C $(LINUX_PATH) M=$(CURRENT_PATH) modules
clean:
rm -rf *.o *.ko *.mod.c *.order *.symvers .*.cmd .tmp_versions
生成module_param.ko
#make
代参数插入模块
#insmod module_param.ko who="string" times= number
查看信息
#dmesg
卸载模块
#rmmod module_param.ko
查看信息
#dmesg
- linux 设备驱动程序 hello+param
- hello.ko---linux设备驱动程序
- Linux设备驱动程序0-hello world
- 第一个linux 设备驱动程序 hello.ko
- linux驱动入门-hello设备驱动程序编写
- linux设备驱动程序的hello模块编译过程
- Linux设备驱动程序学习(0)-Hello, world!模块
- Linux设备驱动程序学习(0)-Hello, world!模块
- Linux设备驱动程序学习(0)-Hello, world!模块
- Linux设备驱动程序学习(0)-Hello, world!模块
- Linux设备驱动程序学习(一)入门必须的hello world
- Linux设备驱动程序学习(0)-Hello, world!模块
- Linux设备驱动程序学习(0)-Hello, world!模块
- linux设备驱动程序的hello模块编译过程
- Linux设备驱动程序学习(0)-Hello, world模块
- Linux设备驱动程序,个人学习,第一个模块hello world
- Linux设备驱动程序(第三版)读书笔记1,hello world
- Linux设备驱动程序(LDD)第二章:Hello World模块
- java操作excel,pdf的方法
- .net中的break、continue、return之间的区别
- socket中send函数和recv函数
- iPhone 开发过程中的一些小技术的总结
- JSFL导出FLA中的文本内容
- linux 设备驱动程序 hello+param
- 十六进制转换成字符串
- 将一个div 里的内容显示在另外的一个div里面
- 数字城市购物平台
- 无源低通滤波器设计
- 写INI配置文件
- websphere 配置数据源的时候总是提示错误
- 学习C/C++的经验谈
- Java基础20天--02--IO流