Linux-Kernel für Raspberry Pi 2/3 unter Debian (64-bit) kompilieren

sudo apt-get install git-core build-essential
mkdir ~/pi
mkdir ~/pi/modules
mkdir ~/pi/image
mkdir -p ~/pi/devicetree/overlays
cd ~pi/
git clone --depth=1 https://github.com/raspberrypi/linux.git
git clone https://github.com/raspberrypi/tools
cd ~/pi/linux
PATH=$PATH:$HOME/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
sed -i 's/CONFIG_LOCALVERSION=".*"/CONFIG_LOCALVERSION="-custom"/' .config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
cd ~/pi/linux
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=~/pi/modules/ modules_install
cd ~/pi/modules/lib/modules
tar cfz modules.tgz lib/modules/
tar cfz firmware.tgz lib/firmware/

scp modules.tgz pi@raspberrypi:
scp firmware.tgz pi@raspberrypi:
cd ~/pi/linux
./scripts/mkknlimg arch/arm/boot/zImage ~/pi/image/kernel-custom.img

scp ../image/kernel-custom.img pi@raspberrypi:
cd ~/pi/linux
cp arch/arm/boot/dts/*.dtb ~/pi/devicetree/
cp arch/arm/boot/dts/overlays/*.dtb* ~/pi/devicetree/overlays/
cp arch/arm/boot/dts/overlays/README ~/pi/devicetree/overlays/
cd ../devicetree
tar cfz ../devicetree.tgz *

scp ../devicetree.tgz pi@raspberrypi:
ssh pi@raspberrypi
sudo mv kernel-custom.img
cd /
sudo tar xfz ~/modules.tgz
rm ~/modules.tgz
# open /boot/config.txt in your favorite editor as root
# add a line with the following content: kernel=kernel-custom.img
sudo reboot

Firmware und die Device-Tree-Dateien müssen nur installiert werden, wenn eine andere Kernel-Version als die auf dem Raspberry Pi vorhandene installiert werden soll.

  • Zuletzt geändert: 2016-06-02 18:49