======sample_kmp_source====== DRAFT: This page is under construction ===== Purpose ===== This is the source code for the "Hello World" sample module referenced by [[:driver-backport:sample_kmp_spec_file|Sample KMP spec file]]. ===== Kbuild ===== obj-m  := samplemod.o samplemod-y += main.o ===== main.c ===== /* * main.c - A demo kernel module. * * Copyright (C) 2003, 2004, 2005, 2006 * Andreas Gruenbacher , SUSE Labs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * A copy of the GNU General Public License can be obtained from * http://www.gnu.org/. */ #include #include MODULE_AUTHOR("Andreas Gruenbacher "); MODULE_DESCRIPTION("Hello world module"); MODULE_LICENSE("GPL"); MODULE_VERSION(VERSION); int param; module_param(param, int, 0); MODULE_PARM_DESC(param, "Example parameter"); void exported_function(void) { printk(KERN_INFO "Exported function called.\n"); } EXPORT_SYMBOL_GPL(exported_function); int __init init_hello(void) { printk(KERN_INFO "Hello world.\n"); return 0; } void __exit exit_hello(void) { printk(KERN_INFO "Goodbye world.\n"); } module_init(init_hello); module_exit(exit_hello);