Hi everyone,
I'm trying to compile a custom kernel module on Raspberry Pi OS, but I'm running into an issue: the `build` folder is missing in `/lib/modules/$(uname -r)/`.
Here’s a snippet from my `Makefile`:
But when I check the path, I get:
My current kernel version is:
I tried installing the kernel headers using:
…but the `build` directory is still missing, or doesn't match my current kernel version.
**How can I get the correct kernel headers or the necessary `build` directory to compile my module?**
Do I need to switch to a specific kernel version that matches the available headers?
Any help is appreciated – thanks in advance!
I'm trying to compile a custom kernel module on Raspberry Pi OS, but I'm running into an issue: the `build` folder is missing in `/lib/modules/$(uname -r)/`.
Here’s a snippet from my `Makefile`:
Code:
KDIR = /lib/modules/$(shell uname -r)/build
But when I check the path, I get:
Code:
ls /lib/modules/$(uname -r)/build# No such file or directory
My current kernel version is:
Code:
uname -r# 6.6.51+rpt-rpi-v8
I tried installing the kernel headers using:
Code:
sudo apt install raspberrypi-kernel-headers
**How can I get the correct kernel headers or the necessary `build` directory to compile my module?**
Do I need to switch to a specific kernel version that matches the available headers?
Any help is appreciated – thanks in advance!
Statistics: Posted by gs105 — Wed Apr 16, 2025 2:49 pm