Linux 驱动开发
来源:互联网 发布:淘宝aⅴ首页 编辑:程序博客网 时间:2024/05/15 08:08
1。写一个简单的驱动程序,命名为Hello.c
********************************************
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
static int __init hello_init(void)
{
printk(KERN_INFO "Hello world/n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_INFO "Goodbye world/n");
}
module_init(hello_init);
module_exit(hello_exit);
********************************************
2。然后书写Makefile文件
obj-m := hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd)
clean
*********************************************
3。在命令行输入 make命令
********************************************
4。接下来,将生成的模块加载到内核。sudo insmod hello.ko
********************************************
5。可以通过dmesg查看 内核里面的输出
********************************************
6。sudo rmmod hello.ko
********************************************
大功告成,打起精神,迎接接下来的挑战把!
- linux 驱动开发
- Linux驱动开发
- linux驱动开发
- LINUX驱动开发
- Linux驱动开发要点
- Linux液晶屏驱动开发
- Linux设备驱动开发
- Linux液晶屏驱动开发
- Linux驱动开发资源
- Linux 驱动开发方法论
- Linux 驱动开发
- linux驱动开发学习
- ARM-Linux驱动开发
- linux驱动开发学习
- linux驱动开发
- Linux液晶屏驱动开发
- linux驱动开发方法论
- linux驱动开发流程
- 转:SSO解决方案大全 Single Sign-On for everyone(统一用户认证)
- Android高手进阶教程(一)-------Android常用名令集锦(图文并茂)!
- C++中的extern C
- JSP中大于号小于号的转义字符
- AppEngine中允许使用session
- Linux 驱动开发
- JAVA基础--JAVA中的反射机制详解
- how websites are perceived by their visitors and the basic ways in which websites can be constructed.
- GestureDetector
- mysql my.cnf 配置建议
- VC下揭开“特洛伊木马”的隐藏面纱
- how websites are perceived by their visitors and the basic ways in which websites can be constructed.
- 多重继承虚基类大小
- how websites are perceived by their visitors and the basic ways in which websites can be constructed.