Linux kernel recompilation instructions are wrong/incomplete #3575
Labels
backlog
We'll be getting to it eventually
documentation
update
Things change with time, this is a change
I recently tried to recompile the Raspberry Pi Linux kernel to enable the PREEMPT_RT patch, but by following the instructions on the documentation page for this very thing I was lead to wrong steps and some things are missing.
I tried both to compile the kernel on my Raspberry Pi (version 4 B+, 64-bit), and to cross-compile it on my x86 laptop with Ubuntu 22.04 and then installing it on the SD card.
After finishing the compilation/cross-compilation, the documentation states that "If you now reboot, your Raspberry Pi should be running your freshly-compiled kernel.", but this is not the case. In both cases (compile and cross-compile) the kernel would not be correctly installed/linked, and the Raspberry Pi would just start up with its normal kernel.
I checked with
ls /boot/vmlinuz*
to see all available kernels, but the just installed kernel was not there, for compilation nor cross-compilation.I found out that one could use the
flash-kernel
command to force the RPi to use the correct kernel. However, the flash-kernel command cannot find the freshly installed kernel because it doesn't have avmlinuz
.The steps that worked for me to correctly compile and flash the kernel are the following:
LOCALVERSION=”-raspi”
. We need this for theflash-kernel
command. This command can force flash our newly installed kernel, but only if it's the "correct flavor". To make a kernel the "correct flavor" for RPis, it needs to have the "-raspi" suffix.flash-kernel -force <kernel_name>
command with the kernel's name.My suggestions for the RPi docs:
flash-kernel
utility to force the Linux kernel installation. In that case the kernel needs to be compiled with theLOCALVERSION=”-raspi”
flag, soflash-kernel
recognizes the kernel as having the correct flavor.Some nice additions specific to the PREEMPT_RT patch would be to mention that one needs to disable KVM so that the Full RT option for the Linux kernel becomes available. I know this is not Raspberry Pi-specific but I think that using the PREEMPT_RT patch on a RPi will become more common in the future.
The text was updated successfully, but these errors were encountered: