Hi, I’m trying to build a driver that requires kernel header files…
The driver’s Makefile expects header files in the /lib/modules/$(shell uname -r)/build/
directory, however there’s no build/
directory in the /usr/lib/modules/4.19.71-rt24-v7+
Suggested sudo apt install -y linux-headers-$(uname -r)
says it’s unable to locate package linux-headers-4.19.71-rt24-v7
(I’ve done apt update
, prior to that).
Where can I find (or download) the build directory for the 4.19.71-rt24-v7+ kernel header files?
# 1. Install dependencies
sudo apt update && sudo apt install bc flex bison libssl-dev
# 2. Get the kernel sources (takes a while)
cd ~
git clone --depth 1 --branch blokas-rpi-4.19.y-rt https://github.com/BlokasLabs/rpi-linux-rt.git linux_blokas
cd linux_blokas
# 3. Prepare the kernel tree for module building.
# ! Depending on your Pi version, use appropriate argument:
# * Pi4: bcm2711_defconfig
# * Pi2/3: bcm2709_defconfig
# * Pi1: bcmrpi_defconfig
make bcm2711_defconfig
make modules_prepare
# 4. Make build/source symlinks to the kernel sources from out-of-tree module building:
sudo ln -sf /home/patch/linux_blokas /lib/modules/$(uname -r)/source
sudo ln -sf /home/patch/linux_blokas /lib/modules/$(uname -r)/build
# 5. (optional) Produce Module.symvers (takes quite long)
make modules -j4
sudo make modules_install
I got stuck at the make bcm2709_defconfig
point with an error:
patch@patchbox:~/linux_blokas $ make bcm2709_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
/bin/sh: 1: bison: not found
make[1]: *** [scripts/Makefile.lib:196: scripts/kconfig/zconf.tab.c] Error 127
make: *** [Makefile:534: bcm2709_defconfig] Error 2
Run sudo apt install flex bison
, added this dependency in above post too.
1 Like
One more dependency was needed (for make modules_prepare
): libssl-dev
1 Like