Skip to content

Instantly share code, notes, and snippets.

@xerpi
Last active May 4, 2017 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xerpi/b673641fb7add6c511ead3ef9f60c68c to your computer and use it in GitHub Desktop.
Save xerpi/b673641fb7add6c511ead3ef9f60c68c to your computer and use it in GitHub Desktop.
#!/bin/bash
BOOT_MOUNT=$RPI_BOOT_MOUNT
ROOT_MOUNT=$RPI_ROOT_MOUNT
KERNELVERSION=`make ARCH=arm kernelrelease 2> /dev/null`
KERNELFILENAME="kernel_$KERNELVERSION.img"
#DEFCONFIG=bcm2709_defconfig
DEFCONFIG=multi_v7_defconfig
DTB=bcm2837-rpi-3-b.dtb
echo "Kernel version: $KERNELVERSION"
# Copy the bcm2837 DTS from the arm64 tree
cp arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts arch/arm/boot/dts/
cp arch/arm64/boot/dts/broadcom/bcm2837.dtsi arch/arm/boot/dts/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- $DEFCONFIG
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 zImage modules $DTB
sudo -E make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH="$ROOT_MOUNT" modules_install
sudo -E cp "arch/arm/boot/zImage" "$BOOT_MOUNT/$KERNELFILENAME"
sudo -E cp "arch/arm/boot/dts/$DTB" "$BOOT_MOUNT/"
sync
echo "Kernel copied to: $BOOT_MOUNT/$KERNELFILENAME"
echo "DTB copied to: $BOOT_MOUNT/$DTB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment