From 61e6566c48836ab55e9989ee7b218f92ea601506 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Mon, 18 Jun 2018 09:17:17 +0200 Subject: [PATCH] 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 --- .../elements/bootloader/finalise.d/50-bootloader | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 99486a48..0a6b0db6 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -224,6 +224,14 @@ function install_grub2 { if [ -d /sys/firmware/efi ]; then sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG 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}