Demo module, initially for RPI

This commit is contained in:
Imbus 2026-02-24 12:51:41 +01:00
parent 40295d6d45
commit 81d8f15a4e
2 changed files with 97 additions and 0 deletions

23
demo_module/Makefile Normal file
View file

@ -0,0 +1,23 @@
# This is a standard makefile for building a kernel module.
# It looks a bit backwards compared to a normal makefile, but that's because
# the kernel supplies its own sub-makefile that we use to build the module.
#
# The M= option tells the kernel's makefile where to find the module's source
# files, and the -C option sets the context directory for make.
#
# The obj-m variable tells the kernel's makefile what the module's object file
# should be called. In this case, it's demo_module.o. This is how the sub-makefile
# infers the name of the module's source file.
#
# This build is highly sensitive to compiler version, and requires the system gcc
# to be the same version as the gcc that built the current kernel.
#
# For more info, see: https://www.kernel.org/doc/html/latest/kbuild/modules.html
obj-m = demo_module.o
all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean