Packages
The Go packages kernel modules are written against.
| Package | What it’s for |
|---|---|
gokm/kernel | logging, module lifecycle, errors, handles, memory, SpinLock |
gokm/fs | filesystems (mmap and xattrs included): fs.Register |
gokm/chardev | character devices (/dev/<name>), ioctl, poll: chardev.Register |
gokm/procfs | /proc files: procfs.Create |
gokm/netdev | network interfaces (IP like TUN, or Ethernet like TAP): netdev.Register |
gokm/blk | block devices (/dev/<name>, partitions included): blk.Register |
gokm/linux | generated bindings to any kernel function, struct or constant |
Importing a framework package is all it takes: gokm build detects it and
compiles in its kernel glue. One module can use several (see
examples/devices: a char device and a /proc file sharing state).
kernelLogging, the module lifecycle, errors, handles, memory and locks.
fsFilesystems written in Go, including mmap and extended attributes.
chardev and procfsCharacter devices in /dev and files in /proc backed by Go code.
netdevNetwork interfaces whose driver is Go code: IP (like TUN) or Ethernet (like TAP).
blkBlock devices whose storage is Go code.
Module parametersPackage-level variables that become module parameters with //gokm:param.
linuxBindings to any kernel function, struct or constant, generated from the kernel's BTF.