rocky-linux-generic-images/includes/bootloader-stuff.ksi

61 lines
2.0 KiB
Plaintext

%post
# U-Boot binaries for 32-bit and 64-bit Raspberry Pi models
# (these are loaded by /boot/efi/config.txt)
cp -v -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin
cp -v -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin
# Remove the 'dracut-config-generic' package if found installed
dnf list installed | grep 'dracut-config-generic' > /dev/null && \
rpm -e dracut-config-generic
# TODO: Add a comment to show what this is doing
#if [ -x /lib/kernel/install.d/10-devicetree.install ]; then
# /lib/kernel/install.d/10-devicetree.install remove
#fi
# remove '/boot/dtb' because the kernel should use '/boot/dtb'
if [ -d /boot/dtb ]; then
rm -r -v -f /boot/dtb
fi
# Kernel selection at boot
cat << EOF > /etc/sysconfig/kernel
# This file was generated by the Kickstart repository used to create this disk image
# PLEASE DO NOT MODIFY THIS UNLESS EITHER
# 1. You know what you are doing
# 2. You are told to modify this file by a Rocky Linux support member
# The 'UPDATEDEFAULT' option makes a newly installed kernel as the default in the boot entry selection
UPDATEDEFAULT=yes
# The 'DEFAULTKERNEL' options specifies what package type will be used as the default
DEFAULTKERNEL=kernel-core
EOF
chmod --verbose 644 /etc/sysconfig/kernel
# GRUB setup
if [ -d /boot/efi/EFI/rocky ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ]; then
mv -v -f /boot/grub2/grub.cfg /boot/efi/EFI/rocky/grub.cfg
ln -s ../efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg
[ -d /boot/efi/EFI/BOOT ] || mkdir --verbose --parent /boot/efi/EFI/BOOT
cp -v -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI
fi
# Write GRUB defaults
cat << EOF > /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_BLSCFG="false"
EOF
chmod --verbose 644 /etc/default/grub
%end