#!/bin/dash # https://www.raspberrypi.com/documentation/computers/linux_kernel.html #KERNEL_VERSION=5.15.113 #KERNEL_VERSION=4.4.187 #KERNEL_VERSION=4.9.120 #KERNEL_VERSION=4.14.63 KERNEL_VERSION=pi4 #KERNEL_MAJOR_VERSION=v5.x #KERNEL_MAJOR_VERSION=v4.x #git clone --depth=1 https://github.com/raspberrypi/linux KERNEL_PAGE=https://github.com/raspberrypi/linux DEVICE_NAME=pi4 OUT_DIRECTORY=out-pi4 #prepare _PWD=`pwd` mkdir -p $OUT_DIRECTORY/lib/modules echo "Download kernel" if [ ! -d linux-raspberypi ]; then git clone --depth=1 https://github.com/raspberrypi/linux linux-pi4 fi #echo "Unpack kernel" #tar -xvf linux-$KERNEL_VERSION.tar.xz -o linux-$KERNEL_VERSION-arm64 echo "Copy config to kernel" cp configs/$DEVICE_NAME/generic-pi4 ./linux-pi4/.config echo "Compile kernel" cd ./linux-pi4 KERNEL=kernel8 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs -j4 #make -j4 #make INSTALL_MOD_PATH=$_PWD/$OUT_DIRECTORY/ modules_install #output results #echo "Copy results to out" #cd $_PWD #cp ./linux-$KERNEL_VERSION/arch/x86_64/boot/bzImage $_PWD/$OUT_DIRECTORY/vmlinuz-xos #cp ./linux-$KERNEL_VERSION/vmlinux $_PWD/$OUT_DIRECTORY/vmlinux-xos