grubby-bs: Fix changing kernel cmdline params not working on ppc64le

Currently the grubby script re-generates a GRUB config file that contains
menuentry commands for every /boot/loader/entries/*.conf file snippet.

But this is only needed for ppc64le machines that have a Petitboot version
that doesn't support parsing BLS snippets. Instead of generating a config
on any ppc64le machine, restrict this for the case where is really needed.

The /etc/grub.d/10_linux script already takes this into account and does
not add menuentry commands unless is needed. But the grubby script didn't
check this, causing changing kernel cmdline params to not work on ppc64le.

Resolves: rhbz#1896222

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2021-04-27 13:12:16 +02:00
parent f192979782
commit 85b061f5e6
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
2 changed files with 32 additions and 3 deletions

View File

@ -581,8 +581,33 @@ remove_var_prefix() {
update_grubcfg()
{
if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support
# so grub2-mkconfig has to be run to generate a config with menuentry commands.
if [ "${arch}" = "ppc64le" ] && [ -d /sys/firmware/opal ]; then
RUN_MKCONFIG="true"
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
if test -e ${petitboot_path}; then
read -r -d '' petitboot_version < ${petitboot_path}
petitboot_version="$(echo ${petitboot_version//v})"
if test -n ${petitboot_version}; then
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
re='^[0-9]+$'
if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] &&
([[ ${major_version} -gt 1 ]] ||
[[ ${major_version} -eq 1 &&
${minor_version} -ge 8 ]]); then
RUN_MKCONFIG="false"
fi
fi
fi
fi
if [[ $RUN_MKCONFIG = "true" ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
fi
}

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 52%{?dist}
Release: 53%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -131,6 +131,10 @@ current boot environment.
%{_mandir}/man8/*.8*
%changelog
* Tue Apr 27 2021 Javier Martinez Canillas <javierm@redhat.com> - 8.40-53
- grubby-bs: Fix changing kernel cmdline params not working on ppc64le
Resolves: rhbz#1896222
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 8.40-52
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937