feat(lab02): skeleton for ex 2,3,4

This commit is contained in:
Klagarge committed 2026-03-30 17:03:13 +02:00
1 parent f5a7c11e62
commit 08191068ba
4 files changed
+15 -187

No files matched your search

+8 -3
View File
@@ -4,12 +4,15 @@ export PATH := /buildroot/output/host/usr/sbin$\
:/buildroot/output/host/bin/$\
:$(PATH)
MODULE := mymodule
SOURCE := skeleton
# Part executed when called from kernel build system:
ifneq ($(KERNELRELEASE),)
obj-m += mymodule.o ## name of the generated module
obj-m += $(MODULE).o ## name of the generated module
mymodule-objs := skeleton.o ## list of objects needed for that module
CFLAGS_skeleton.o := -DDEBUG
$(MODULE)-objs := $(SOURCE).o ## list of objects needed for that module
CFLAGS_$(SOURCE).o := -DDEBUG
# Part executed when called from standard make in module source directory:
else
@@ -25,6 +28,8 @@ clean:
install:
$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(MODPATH) modules_install
install -d $(MODPATH)/etc/modprobe.d
install -m 0644 $(SOURCE).conf $(MODPATH)/etc/modprobe.d/$(SOURCE).conf
endif
+6 -6
View File
@@ -7,13 +7,13 @@
static char* text = "dummy text";
module_param(text, charp, 0664);
static int elements = 1;
module_param(elements, int, 0);
static int number = 1;
module_param(number, int, 0);
static int __init skeleton_init(void)
{
pr_info ("Linux module 01 skeleton loaded\n");
pr_debug (" text: %s\n elements: %d\n", text, elements);
pr_info ("Linux module skeleton ex02 loaded\n");
pr_debug (" text: %s\n number: %d\n", text, number);
return 0;
}
@@ -25,7 +25,7 @@ static void __exit skeleton_exit(void)
module_init (skeleton_init);
module_exit (skeleton_exit);
MODULE_AUTHOR ("Daniel Gachet <daniel.gachet@hefr.ch>");
MODULE_AUTHOR ("Fastium <fastium.pro@proton.me>");
MODULE_AUTHOR ("Klagarge <remi@heredero.ch>");
MODULE_DESCRIPTION ("Module skeleton");
MODULE_LICENSE ("GPL");
+1
View File
@@ -0,0 +1 @@
options mymodule number=42 text="The answer to the Ultimate Question of Life, The Universe, and Everything"