登录
首页 » linux driver » linux设备驱动程序简单示例

linux设备驱动程序简单示例

于 2023-02-16 发布 文件大小:63.63 kB
0 81
下载积分: 2 下载次数: 1

代码说明:

以一个hello word程序为例,展示最简单的linux设备驱动程序。hello.c#include #include MODULE_LICENSE("Dual BSD/GPL");static int hello_init(void){    printk(KERN_ERR "hello world! ");    return 0;}static void hello_exit(void){    printk(KERN_ERR "goodbye cruel world ");}module_init(hello_init);module_exit(hello_exit);hello.h:无makefile:ifneq ($(KERNELRELEASE),)obj-m := hello.oelseKERNELDIR ?= /root/rpmbuild/BUILD/kernel-3.10.0-693.21.1.el7/linux-3.10.0-693.21.1.el7.x86_64PWD := $(shell pwd)default:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesendif

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • linux设备驱动程序简单示例
    以一个hello word程序为例,展示最简单的linux设备驱动程序。hello.c#include #include MODULE_LICENSE("Dual BSD/GPL");static int hello_init(void){    printk(KERN_ERR "hello world! ");    return 0;}static void hello_exit(void){    printk(KERN_ERR "goodbye cruel world ");}module_init(hello_init);module_exit(hello_exit);hello.h:无makefile:ifneq ($(KERNELRELEASE),)obj-m := hello.oelseKERNELDIR ?= /root/rpmbuild/BUILD/kernel-3.10.0-693.21.1.el7/linux-3.10.0-693.21.1.el7.x86_64PWD := $(shell pwd)default:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesendif
    2023-02-16 03:10:03下载
    积分:1
  • 696518资源总数
  • 105661会员总数
  • 6今日下载