chore: migrate src to solutions
This commit is contained in:
167 files changed
+17
-17
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# Part executed when called from kernel build system:
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
obj-m += mymodule.o ## name of the generated module
|
||||
|
||||
mymodule-objs := skeleton.o ## list of objects needed for that module
|
||||
|
||||
# Part executed when called from standard make in module source directory:
|
||||
else
|
||||
include ../../buildroot_path
|
||||
include ../../kernel_settings
|
||||
include ../../set_host_path
|
||||
PWD := $(shell pwd)
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) ARCH=$(CPU) CROSS_COMPILE=$(TOOLS) modules
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) clean
|
||||
|
||||
install:
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(MODPATH) modules_install
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/* skeleton.c */
|
||||
#include <linux/module.h> /* needed by all modules */
|
||||
#include <linux/init.h> /* needed for macros */
|
||||
#include <linux/kernel.h> /* needed for debugging */
|
||||
|
||||
#include <linux/moduleparam.h> /* needed for module parameters */
|
||||
|
||||
#include <linux/slab.h> /* needed for dynamic memory allocation */
|
||||
#include <linux/list.h> /* needed for linked list processing */
|
||||
#include <linux/string.h> /* needed for string handling */
|
||||
|
||||
#include <linux/ioport.h> /* needed for memory region handling */
|
||||
#include <linux/io.h> /* needed for mmio handling */
|
||||
|
||||
#include <linux/kthread.h> /* needed for kernel thread management */
|
||||
#include <linux/delay.h> /* needed for delay fonctions */
|
||||
|
||||
|
||||
static struct task_struct* my_thread;
|
||||
|
||||
|
||||
static int skeleton_thread (void* data)
|
||||
{
|
||||
pr_info ("skeleton thread is now active...\n");
|
||||
while(!kthread_should_stop()) {
|
||||
ssleep (5);
|
||||
pr_info ("skeleton thread is kick every 5 seconds...\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init skeleton_init(void)
|
||||
{
|
||||
pr_info ("Linux module 06 skeleton loaded\n");
|
||||
|
||||
my_thread = kthread_run (skeleton_thread, 0, "s/thread");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit skeleton_exit(void)
|
||||
{
|
||||
kthread_stop (my_thread);
|
||||
|
||||
pr_info ("Linux module skeleton unloaded\n");
|
||||
}
|
||||
|
||||
module_init (skeleton_init);
|
||||
module_exit (skeleton_exit);
|
||||
|
||||
MODULE_AUTHOR ("Daniel Gachet <daniel.gachet@hefr.ch>");
|
||||
MODULE_DESCRIPTION ("Module skeleton");
|
||||
MODULE_LICENSE ("GPL");
|
||||
|
||||
Reference in new issue
Block a user