Kernel Module Common Commands

sudo insmod kernel_module.ko sudo rmmod kernel_module lsmod lsmod | grep kernel_module sudo dmesg sudo dmesg -W

Development Setup

Began developing the kernel module inside Multipass, using it as a lightweight Ubuntu VM sandbox. It allowed fast iteration without worrying about breaking the Pi OS environment earl on.

Resources:

Once the basic skeleton was stable (init, exit, file ops, and character device registration), moved the module to the Raspberry Pi.

Transferring Kernel Module Source from Multipass to Raspberry Pi

Kernel modules must be built against the exact kernel headers of the target device.

Do not build the .ko on Multipass and copy it over. Always compile directly on the Pi.

So instead of transferring binaries, I transferred source code and built on the Pi.

File Transfer Method: Secure Copy Protocol

Using scp

Format: scp /source/location user@target:/target/location

Prerequisites:

  1. Enable SSH on the Pi

    sudo raspi-config Navigate to: Interface Options → SSH → Password login enabled