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.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2021-04-26 18:43:51 +02:00
parent 786a133370
commit 5d3963841d
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
2 changed files with 31 additions and 3 deletions

View File

@ -581,8 +581,33 @@ remove_var_prefix() {
update_grubcfg() update_grubcfg()
{ {
if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then # Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null # 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 fi
} }

View File

@ -1,6 +1,6 @@
Name: grubby Name: grubby
Version: 8.40 Version: 8.40
Release: 51%{?dist} Release: 52%{?dist}
Summary: Command line tool for updating bootloader configs Summary: Command line tool for updating bootloader configs
License: GPLv2+ License: GPLv2+
URL: https://github.com/rhinstaller/grubby URL: https://github.com/rhinstaller/grubby
@ -131,6 +131,9 @@ current boot environment.
%{_mandir}/man8/*.8* %{_mandir}/man8/*.8*
%changelog %changelog
* Mon Apr 26 2021 Javier Martinez Canillas <javierm@redhat.com> - 8.40-52
- grubby-bs: Fix changing kernel cmdline params not working on ppc64le
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-51 * Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-51
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild