Test: Driver: Hello World module
PATCH 2/2 Test: Driver: Hello World module
From: Vivek <[email protected]>
- Hello World module added with Kconfig and Makefile Also check with make menuconfig.
Signed-off-by Vivek <[email protected]>
--- drivers/HelloWorld/HelloWorld-1.c | 27 +++++++++++++++++++++++++++ drivers/HelloWorld/Kconfig | 9 +++++++++ drivers/HelloWorld/Makefile | 1 + drivers/Kconfig | 2 ++ drivers/Makefile | 2 ++ 5 files changed, 41 insertions(+) create mode 100644 drivers/HelloWorld/HelloWorld-1.c create mode 100644 drivers/HelloWorld/Kconfig create mode 100644 drivers/HelloWorld/Makefile
drivers/HelloWorld/HelloWorld-1.c new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 +/* This is test file for Linux kernel module +* Here I have written a simple Hello World module +* +* author : Vivek Yadav +*/ + +#include <linux/module.h> +#include <linux/kernel.h> + +static int __init hello_init_module (void ) +{ +pr_info ("Hello World 1.\n" ); +return 0 ; +} + +static void __exit hello_cleanup_module(void) +{ +pr_info ("Goodbye World 1.\n" ); +} + +module_init (hello_init_module); +module_exit (hello_cleanup_module); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Vivek Yadav" ); +MODULE_DESCRIPTION ("Simple Hello World Kernel Module" );
drivers/HelloWorld/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +menu "Hello Module Kernel Support" + +config HELLO_WORLD + tristate "Hello Module Driver" + depends on X86 + help + Select this option to run a Hello World Module! + It is just simple driver for testing. +endmenu
drivers/HelloWorld/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_HELLO_WORLD) += HelloWorld-1.o
drivers/Kconfig +2 -0
@@ -245,4 +245,6 @@ source "drivers/cdx/Kconfig" source "drivers/dpll/Kconfig" +source "drivers/HelloWorld/Kconfig" + endmenu
drivers/Makefile +2 -0
@@ -198,3 +198,5 @@ obj-$(CONFIG_CDX_BUS) += cdx/ obj-$(CONFIG_DPLL) += dpll/ obj-$(CONFIG_S390) += s390/ + +obj-$(CONFIG_HELLO_WORLD) += HelloWorld/
Signature · 1 line
2.34.1