From 376edcff27e889ca357cc3c0360a3c9b0bf48ed7 Mon Sep 17 00:00:00 2001 From: twoneis Date: Thu, 13 Mar 2025 16:37:33 +0100 Subject: [PATCH] try some module stuff --- code/Makefile | 6 ++++++ code/module.c | 21 +++++++++++++++++++++ flake.nix | 1 + 3 files changed, 28 insertions(+) create mode 100644 code/module.c diff --git a/code/Makefile b/code/Makefile index 8b1378917..a980853d2 100644 --- a/code/Makefile +++ b/code/Makefile @@ -1 +1,7 @@ +obj-m += module.o +modules: + make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean diff --git a/code/module.c b/code/module.c new file mode 100644 index 000000000..534759f0e --- /dev/null +++ b/code/module.c @@ -0,0 +1,21 @@ +#include +#include +#include +#include +#include + +static int +mod_init(void) +{ + printk(KERN_INFO "module init"); + return 0; +} + +static void +mod_exit(void) +{ + printk(KERN_INFO "module exit"); +} + +module_init(mod_init); +module_exit() diff --git a/flake.nix b/flake.nix index 100890511..b359df9b2 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ gnumake clang-tools gcc + linuxHeaders texlab texliveFull ];