2017-11-03 970
bhsong@bhsong-laptop:~/develop/svn/ldd6410/linux-2.6.31/drivers/char$ mkdir driver_examples
cd driver_examples/ cp ../../../../training/kernel/drivers/hello/hello.c ./ cp ../../../../training/kernel/drivers/globalmem/globalmem.c ./ cp ../../../../training/kernel/drivers/globalmem/globalfifo.c ./
source "drivers/char/driver_examples/Kconfig"
## driver examples configuration# menuconfig DRIVER_EXAMPLE tristate "driver examples in 'Explain Linux Device Drivers in detail'" ---help--- say Yes to build-in hello world, globalmem, globalfifo, say M to get those kernel modulesif DRIVER_EXAMPLE config HELLO_WORLD tristate "Hello World" ---help--- To compile this driver as a module, choose M here; the module will be called hello.mem config GLOBALMEM tristate "globalmem" ---help--- To compile this driver as a module, choose M here; the module will be called globalmem. config GLOBALFIFO tristate "globalfifo" ---help--- To compile this driver as a module, choose M here; the module will be called globalfifo. endif # DRIVER_EXAMPLE
driver examples in 'Explain Linux Device Drivers in detail' ─────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted letters are hotkeys. Pressing <Y> │ │ includes, <N> excludes, <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: │ │ [*] built-in [ ] excluded <M> module < > module capable │ │ │ │ ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ --- driver examples in 'Explain Linux Device Drivers in detail' │ │ │ │ < > Hello World (NEW) │ │ │ │ < > globalmem (NEW) │ │ │ │ < > globalfifo (NEW) │ │ │ │ │ │ │ │ │ │ │ │
obj-$(CONFIG_DRIVER_EXAMPLE) += driver_examples/
obj-$(CONFIG_HELLO_WORLD) += hello.o obj-$(CONFIG_GLOBALMEM) += globalmem.o obj-$(CONFIG_GLOBALFIFO) += globalfifo.o
Index: drivers/char/Kconfig===================================================================--- drivers/char/Kconfig (revision 87)+++ drivers/char/Kconfig (working copy)Index: drivers/char/driver_examples/Makefile===================================================================--- drivers/char/driver_examples/Makefile (revision 0)+++ drivers/char/driver_examples/Makefile (revision 0)@@ -0,0 +1,3 @@+obj-$(CONFIG_HELLO_WORLD) += hello.o+obj-$(CONFIG_GLOBALMEM) += globalmem.o+obj-$(CONFIG_GLOBALFIFO) += globalfifo.o@@ -1110,5 +1110,7 @@ source "drivers/s390/char/Kconfig" +source "drivers/char/driver_examples/Kconfig"+ endmenu Index: drivers/char/Makefile===================================================================--- drivers/char/Makefile (revision 87)+++ drivers/char/Makefile (working copy)@@ -111,6 +111,8 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o js-rtc-y = rtc.o +obj-$(CONFIG_DRIVER_EXAMPLE) += driver_examples/+ # Files generated that shall be removed upon make clean clean-files := consolemap_deftbl.c defkeymap.c Index: drivers/char/driver_examples/Kconfig===================================================================--- drivers/char/driver_examples/Kconfig (revision 0)+++ drivers/char/driver_examples/Kconfig (revision 0)@@ -0,0 +1,31 @@+#+# driver examples configuration+#++menuconfig DRIVER_EXAMPLE+ tristate "driver examples in 'Explain Linux Device Drivers in detail'"+ ---help---+ say Yes to build-in hello world, globalmem, globalfifo, say M to get+ those kernel modules++if DRIVER_EXAMPLE++config HELLO_WORLD+ tristate "Hello World"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called hello.++config GLOBALMEM+ tristate "globalmem"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called globalmem.++config GLOBALFIFO+ tristate "globalfifo"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called globalfifo.++endif # DRIVER_EXAMPLE+Index: drivers/char/Kconfig===================================================================--- drivers/char/Kconfig (revision 87)+++ drivers/char/Kconfig (working copy)@@ -1110,5 +1110,7 @@ source "drivers/s390/char/Kconfig" +source "drivers/char/driver_examples/Kconfig"+ endmenu Index: drivers/char/Makefile===================================================================--- drivers/char/Makefile (revision 87)+++ drivers/char/Makefile (working copy)@@ -111,6 +111,8 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o js-rtc-y = rtc.o +obj-$(CONFIG_DRIVER_EXAMPLE) += driver_examples/+ # Files generated that shall be removed upon make clean clean-files := consolemap_deftbl.c defkeymap.c Index: drivers/char/driver_examples/Kconfig===================================================================--- drivers/char/driver_examples/Kconfig (revision 0)+++ drivers/char/driver_examples/Kconfig (revision 0)@@ -0,0 +1,31 @@+#+# driver examples configuration+#++menuconfig DRIVER_EXAMPLE+ tristate "driver examples in 'Explain Linux Device Drivers in detail'"+ ---help---+ say Yes to build-in hello world, globalmem, globalfifo, say M to get+ those kernel modules++if DRIVER_EXAMPLE++config HELLO_WORLD+ tristate "Hello World"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called hello.++config GLOBALMEM+ tristate "globalmem"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called globalmem.++config GLOBALFIFO+ tristate "globalfifo"+ ---help---+ To compile this driver as a module, choose M here; the module will be+ called globalfifo.++endif # DRIVER_EXAMPLEIndex: drivers/char/driver_examples/Makefile===================================================================--- drivers/char/driver_examples/Makefile (revision 0)+++ drivers/char/driver_examples/Makefile (revision 0)@@ -0,0 +1,3 @@+obj-$(CONFIG_HELLO_WORLD) += hello.o+obj-$(CONFIG_GLOBALMEM) += globalmem.o
+obj-$(CONFIG_GLOBALFIFO) += globalfifo.o
本文转自 21cnbao 51CTO博客,原文链接:http://blog.51cto.com/21cnbao/266975,如需转载请自行联系原作者
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。