您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页linux设备驱动开发详解源码,《Linux设备驱动开发详解》源码(4.1)——hello

linux设备驱动开发详解源码,《Linux设备驱动开发详解》源码(4.1)——hello

来源:化拓教育网

/home/lihacker/develop/svn/ldd10-read-only/training/kernel/drivers/hello

< hello.c >

/*

* A simple kernel module: "hello world"

*

* The initial developer of the original code is Barry Song

* <21cnbao@gmail.com>. All Rights Reserved.

*/

#include

#include

static int hello_init(void)

{

printk(KERN_INFO " Hello World enter\n");

return 0;

}

static void hello_exit(void)

{

printk(KERN_INFO " Hello World exit\n ");

}

module_init(hello_init);

module_exit(hello_exit);

MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");

MODULE_LICENSE("Dual BSD/GPL");

MODULE_DESCRIPTION("A simple Hello World Module");

MODULE_ALIAS("a simplest module");

< Makefile >

KVERS = $(shell uname -r)

# Kernel modules

obj-m += hello.o

# Specify flags for the module compilation.

#EXTRA_CFLAGS=-g -O0

build: kernel_modules

kernel_modules:

make -C /lib/modules/$(KVERS)/build M=$(CURDIR) modules

clean:

make -C /lib/modules/$(KVERS)/build M=$(CURDIR) clean

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务