%post # Setting correct yum variable to use raspberrypi kernel repo #echo "generic" > /etc/dnf/vars/kvariant # # Creating rocky user and add to wheel group /sbin/useradd -c "Rocky Linux default user" -G wheel -m -U rocky echo "rockylinux" | passwd --stdin rocky # Generic efi filename for VMs mkdir -p /boot/efi/EFI/BOOT if [ -d /boot/efi/EFI/rocky/ ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ];then for j in grub.cfg grubenv;do mv -f /boot/grub2/${j} /boot/efi/EFI/rocky/ ln -s ../efi/EFI/rocky/${j} /boot/grub2/${j} done cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI fi cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin rpm -e dracut-config-generic #setup dtb link by running "creating 10-devicetree.install" if [ -x /lib/kernel/install.d/10-devicetree.install ];then /lib/kernel/install.d/10-devicetree.install remove fi ### Write /etc/sysconfig/kernel cat << EOF > /etc/sysconfig/kernel # Written by image installer # UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default UPDATEDEFAULT=yes # DEFAULTKERNEL specifies the default kernel package type DEFAULTKERNEL=kernel-core EOF chmod 644 /etc/sysconfig/kernel ### Write grub defaults, turn off OS probing as it is always wrong for image creation 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" GRUB_CMDLINE_LINUX="" GRUB_DISABLE_RECOVERY="true" GRUB_DISABLE_OS_PROBER="true" GRUB_ENABLE_BLSCFG="false" EOF chmod 644 /etc/default/grub # fixing the rpmdb rpm --rebuilddb # remove /boot/dtb for some rpi to boot rm -f /boot/dtb %end