Difference between revisions of "ECE497 Listings for Embedded Linux Primer Chapter 8"

From eLinux.org
Jump to: navigation, search
(Added Listing 8-1)
 
(Added Listing 8-2)
Line 32: Line 32:
 
MODULE_DESCRIPTION("Hello World Example");
 
MODULE_DESCRIPTION("Hello World Example");
 
MODULE_LICENSE("GPL");
 
MODULE_LICENSE("GPL");
 +
</pre>
 +
|-
 +
| 8-2
 +
| 8-5
 +
| Kconfig Patch for Examples
 +
| <pre>
 +
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
 +
index 6f31c94..0805290 100644
 +
--- a/drivers/char/Kconfig
 +
+++ b/drivers/char/Kconfig
 +
@@ -4,6 +4,13 @@
 +
 +
menu "Character devices"
 +
 +
+config EXAMPLES
 +
+      tristate "Enable Examples"
 +
+      default M
 +
+      ---help---
 +
+        Enable compilation option for Embedded Linux Primer
 +
+        driver examples
 +
+
 +
config VT
 +
        bool "Virtual terminal" if EMBEDDED
 +
        depends on !S390
 +
</pre>
 +
|-
 +
| 8-2
 +
| 8-5
 +
| Kconfig Patch for Examples
 +
| <pre>
 +
 
</pre>
 
</pre>
  
 
|}
 
|}

Revision as of 07:45, 26 March 2010


Number Page Caption Listing
8-1 8-3 Minimal Device Driver
/* Example Minimal Character Device Driver */
#include <linux/module.h>

static int __init hello_init(void)
{
    printk(KERN_INFO "Hello Example Init\n");

    return 0;
}

static void __exit hello_exit(void)
{
    printk("Hello Example Exit\n");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_AUTHOR("Chris Hallinan");
MODULE_DESCRIPTION("Hello World Example");
MODULE_LICENSE("GPL");
8-2 8-5 Kconfig Patch for Examples
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig 
index 6f31c94..0805290 100644 
--- a/drivers/char/Kconfig 
+++ b/drivers/char/Kconfig 
@@ -4,6 +4,13 @@ 
 
 menu "Character devices" 
 
+config EXAMPLES 
+       tristate "Enable Examples" 
+       default M 
+       ---help--- 
+         Enable compilation option for Embedded Linux Primer 
+         driver examples 
+ 
 config VT 
        bool "Virtual terminal" if EMBEDDED 
        depends on !S390 
8-2 8-5 Kconfig Patch for Examples