From 2e8e92930e9ea3fefb85cae40042b01aab79a35e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Oct 16 2019 09:55:32 +0000 Subject: 99-grub-mkconfig: Also disable BLS usage for Xen Dom0 hosts A previous patch disabled BLS usage for Xen Dom0 guests but it turns out that Xen Dom0 hosts also need to regenerate a GRUB config file since the menuentries used aren't the generated by 10_linux but by 20_linux_xen. Resolves: rhbz#1761799 Signed-off-by: Javier Martinez Canillas Tested-by: Steven Haigh --- diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index d29de21..339b3c7 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -4,24 +4,29 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then exit 0 fi -# A "control_d" string in /proc/xen/capabilities indicates that is a Xen Dom0 host. -[[ -e /sys/hypervisor/type ]] && read HV_TYPE < /sys/hypervisor/type -[[ -e /proc/xen/capabilities ]] && grep -q "control_d" /proc/xen/capabilities && XEN_DOM0=true - -if [[ $HV_TYPE = "xen" && $XEN_DOM0 != "true" ]]; then +# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support, +# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from +# 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU. +if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then RUN_MKCONFIG=true - if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then - sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub - fi + DISABLE_BLS=true fi ARCH=$(uname -m) +# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to +# be run to generate a GRUB config file that contains menuentry commands. if [[ $ARCH = "ppc64le" ]]; then RUN_MKCONFIG=true fi -# A traditional grub configuration file needs to be generated only for ppc64le and -# Xen DomU guests since we can't assume that bootloaders will be BLS capable there. +if [[ $DISABLE_BLS = "true" ]]; then + if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then + sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub + fi +fi + +# A traditional grub configuration file needs to be generated only in the case when +# the bootloaders are not capable of populating a menu entry from the BLS fragments. if [[ $RUN_MKCONFIG != "true" ]]; then exit 0 fi