Fix bootloader for efi on rhel systems

When building the image on a non-efi environment, it generates
linux16/initrd16 entries. But to boot from UEFI they need to have
linuxefi/initrdefi entries.
Use sed to replace those entries, in case we have an EFI image.

Change-Id: I47c96450e10f34b91bcc32888532bd7ab87cf316
This commit is contained in:
Yolanda Robla 2018-06-18 09:17:17 +02:00
parent e210f79500
commit 61e6566c48

View File

@ -224,6 +224,14 @@ function install_grub2 {
if [ -d /sys/firmware/efi ]; then if [ -d /sys/firmware/efi ]; then
sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG
fi fi
# when using efi, and having linux16/initrd16, it needs to be replaced
# by linuxefi/initrdefi. When building images on a non-efi system,
# the 16 suffix is added to linux/initrd entries, but we need it to be
# linuxefi/initrdefi for the image to boot under efi
if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG
fi
} }
DIB_EXTLINUX=${DIB_EXTLINUX:-0} DIB_EXTLINUX=${DIB_EXTLINUX:-0}