Last active
February 10, 2020 01:04
-
-
Save satmandu/4266de009e54146ef55833e7cae8de25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "* Disabling any non-vmlinuz kernel lines" | |
echo " in /boot/firmware/config.txt ." | |
sed -i -E '/(^kernel=vmlinuz)/!s/^kernel=/#kernel=/g' /boot/firmware/config.txt | |
echo "* Adding line to use the rpi bootloader to load the kernel" | |
echo " in /boot/firmware/config.txt ." | |
if ! grep -qs '^kernel=vmlinuz' /boot/firmware/config.txt | |
then echo "kernel=vmlinuz" >> /boot/firmware/config.txt | |
fi | |
echo "* Adding line to use the rpi bootloader to load the initrd" | |
echo " in /boot/firmware/config.txt ." | |
if ! grep -qs '^initramfs initrd.img followkernel' /boot/firmware/config.txt | |
then echo "initramfs initrd.img followkernel" >> /boot/firmware/config.txt | |
fi | |
mkdir -p /etc/kernel/postinst.d | |
echo "* Creating /etc/kernel/postinst.d/zzzz_rpi_kernel ." | |
cat <<-'EOF' > /etc/kernel/postinst.d/zzzz_rpi_kernel | |
#!/bin/sh -eu | |
# | |
# This uncompresses the arm64 kernel so the rpi bootloader | |
# can load it. | |
# | |
# First exit if we aren't running an ARM64 kernel. | |
# | |
[ $(uname -m) != aarch64 ] && exit 0 | |
# | |
#KERNEL_VERSION="$1" | |
KERNEL_INSTALLED_PATH="$2" | |
gunzip -c -f ${KERNEL_INSTALLED_PATH} > ${KERNEL_INSTALLED_PATH}.nogz \ | |
&& mv -f ${KERNEL_INSTALLED_PATH}.nogz ${KERNEL_INSTALLED_PATH} | |
exit 0 | |
EOF | |
chmod +x /etc/kernel/postinst.d/zzzz_rpi_kernel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment