Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

fp-kernel-hello

Hello world Linux kernel module built in Free Pascal

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

FP Hello Linux kernel module

References

Specs

Tested on Debian 12, kernel 6.1.0-28-amd64, FPC 3.3.1.

Make sure you have Free Pascal compiler, the kernel build tools, and kernel headers installed.

pascal
sudo apt install fpc build-essential linux-headers-$(uname -r)

Usage

pascal
$ cd src

$ make
...
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-28-amd64'

$ sudo insmod fpkmhello.ko

$ sudo dmesg
...
[10388.929879] KERNEL:INFO:Hello from Free Pascal!

$ lsmod | grep fpkmhello
fpkmhello              28672  0

$ sudo rmmod fpkmhello

$ sudo dmesg
...
[10388.929879] KERNEL:INFO:Hello from Free Pascal!
[10421.320454] KERNEL:INFO:Bye-bye!

Troubleshooting

pascal
Compiling system.pas
system.pas(12,10) Error: Duplicate identifier "Char"

You may get this error depending on which version FPC (e.g. 3.2.2) you're using. Try removing the line

pascal
Char = #0..#255;

from system.pas file.