Install EFI bootloader on kickstart from a BIOS machine

General support questions
Post Reply
djuarezg
Posts: 1
Joined: 2020/02/13 10:51:11

Install EFI bootloader on kickstart from a BIOS machine

Post by djuarezg » 2020/02/13 10:56:47

I am trying to build a CentOS7 disk image with Koji (https://docs.pagure.org/koji/image_build/). To do so you specify a kickstart file to be used. Since QEMU is spawning a BIOS VM, my kickstart is doing only BIOS related stuff.

My issue here is that I want this image to run on UEFI-only machines as well. How could I accomplish that with just one kickstart file? Bear in mind building always happens in a BIOS machine, so my idea is whether it is possible to "install both bootloaders" for both BIOS and UEFI so this image can run on every machine no matter what it uses.

This is the Kickstart file I am using:

Code: Select all

(...)
ignoredisk --only-use=vda
# System bootloader configuration
bootloader --append="console=ttyS0,115200 console=tty0 inst.gpt" --location=mbr --timeout=5 --boot-drive=vda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --disklabel gpt

part biosboot --fstype=biosboot --size=1 --ondisk=vda
partition /boot/efi --fstype=efi --label EFI  --size=200
partition /         --fstype=xfs --ondisk=vda --label ROOT --size=2800 --mkfsoptions="-n ftype=1"

(...)

/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-mkconfig --o /etc/grub2-efi.cfg
# We are installing bootloader with the bootloader command, but this only adds bios compatible, so we force both: https://unix.stackexchange.com/questions/273329/can-i-install-grub2-on-a-flash-drive-to-boot-both-bios-and-uefi
# Should not be necessary to add --directory=/usr/lib/grub/x86_64-efi/ /dev/vda
/usr/sbin/grub2-install --target x86_64-efi
/usr/sbin/grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
My idea is to have something as upstream CentOS 8 does for Azure (https://github.com/CentOS/sig-cloud-ins ... re.ks#L3-4). In this case it is the other way around, they run it on a UEFI machine and install it for BIOS manually.

I want to avoid running this on a UEFI machine at all costs.

Post Reply

Return to “CentOS 7 - General Support”