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

61 lines
2.0 KiB
Plaintext
Raw Normal View History

2023-07-28 07:24:36 +00:00
%post
# U-Boot binaries for 32-bit and 64-bit Raspberry Pi models
# (these are loaded by /boot/efi/config.txt)
2023-07-28 08:25:52 +00:00
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
2023-07-28 07:24:36 +00:00
# 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
2023-07-29 07:59:10 +00:00
#if [ -x /lib/kernel/install.d/10-devicetree.install ]; then
# /lib/kernel/install.d/10-devicetree.install remove
#fi
2023-07-28 07:24:36 +00:00
# remove '/boot/dtb' because the kernel should use '/boot/dtb'
if [ -d /boot/dtb ]; then
2023-07-28 08:25:52 +00:00
rm -r -v -f /boot/dtb
2023-07-28 07:24:36 +00:00
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
2023-07-28 08:25:52 +00:00
chmod --verbose 644 /etc/sysconfig/kernel
2023-07-28 07:24:36 +00:00
# GRUB setup
if [ -d /boot/efi/EFI/rocky ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ]; then
2023-07-28 08:25:52 +00:00
mv -v -f /boot/grub2/grub.cfg /boot/efi/EFI/rocky/grub.cfg
2023-07-28 07:24:36 +00:00
ln -s ../efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg
2023-07-28 08:25:52 +00:00
[ -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
2023-07-28 07:24:36 +00:00
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"
2023-07-29 13:41:57 +00:00
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
2023-07-28 07:24:36 +00:00
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_BLSCFG="false"
EOF
2023-07-28 08:25:52 +00:00
chmod --verbose 644 /etc/default/grub
2023-07-28 07:24:36 +00:00
%end