Building and installing scripts based on the Docker image created by Xose Pérez, incorporating the excellent scripts created by RonR from the Raspberry Pi Forums message https://forums.raspberrypi.com/viewtopic.php?t=360054
This environment can be used to cross-compile the Raspberry Pi OS kernel from a Linux, Windows, or Mac workstation using Docker.
This image has been successfully run to build and install a custom Linux kernel + modules on an RPi5 device.
- Make sure Docker is installed.
- Build and run the docker image we will use for compilation:
./builder
You will be dropped into a shell inside the container's /build
directory with only the make
script.. From here you can work on compiling the kernel.
After you
exit
out of that shell, the Docker container will stop, but will not be removed. If you want to jump back into it, you can rundocker start cross-compile
anddocker attach cross-compile
.
Also, the output of the built process will be available under
.build
folder.
- Within the Docker shell, run the 'build-kernel' script:
./build-kernel
A series of questions will be asked, answer them as you need to.
- The output .zip file from the build of the RPi kernel will be in /root/.zip, copy this file and the 'install-kernel' file to your RPi board (hint: sshfs can be used), then as root run the install file:
./install-kernel <kernel-version-postfix>.zip
Full instructions on using this Docker image can be found at: