From 7d63bffff90403fdb8e33c0a30562e0d73cafeeb Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 20 Mar 2025 11:28:33 -0600 Subject: [PATCH 1/4] grubby-bls: in s390* systems, run zipl on grub cfg update event Change takes into account s390* systems as target for zipl execution. Reformat better archs/scenarios when either zipl or grub2-mkconfig must be run. Signed-off-by: Leo Sandoval --- grubby-bls | 20 +++++++++++--------- grubby.spec | 6 +++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/grubby-bls b/grubby-bls index 2785583..555fd13 100755 --- a/grubby-bls +++ b/grubby-bls @@ -599,17 +599,19 @@ remove_var_prefix() { update_grubcfg() { - # Older ppc64le OPAL firmware 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 + # Turn on RUN_MKCONFIG on different archs/scenarios + if [[ "${arch}" = 's390' ]] || [[ "${arch}" = 's390x' ]]; then + # On s390/s390x systems, run mkconfig/zipl RUN_MKCONFIG="true" - fi - - # 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 grub2-mkconfig has to run for both Xen Dom0 and DomU. - if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then + elif [[ "${arch}" = "ppc64le" ]] && [[ -d /sys/firmware/opal ]]; then + # Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run + # to generate a config with menuentry commands. + RUN_MKCONFIG="true" + elif [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; 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 grub2-mkconfig has to run for both Xen Dom0 and DomU. RUN_MKCONFIG=true fi fi diff --git a/grubby.spec b/grubby.spec index 9813791..1ffa529 100644 --- a/grubby.spec +++ b/grubby.spec @@ -3,7 +3,7 @@ Name: grubby Version: 8.40 -Release: 82%{?dist} +Release: 83%{?dist} Summary: Command line tool for updating bootloader configs License: GPL-2.0-or-later Source1: grubby-bls @@ -74,6 +74,10 @@ fi %{_mandir}/man8/grubby.8* %changelog +* Thu Mar 20 2025 Leo Sandoval - 8.40-83 +- grubby-bls: in s390* systems, run zipl on grub cfg update event + Fixes previous commit and formats better the conditions that trigger grub cfg updates + * Fri Jan 17 2025 Fedora Release Engineering - 8.40-82 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 0eb1bed0a54ae1c41514e636f4016560cd355cdf Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 16:39:20 +0000 Subject: [PATCH 2/4] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- grubby.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grubby.spec b/grubby.spec index 1ffa529..6abb3ed 100644 --- a/grubby.spec +++ b/grubby.spec @@ -3,7 +3,7 @@ Name: grubby Version: 8.40 -Release: 83%{?dist} +Release: 84%{?dist} Summary: Command line tool for updating bootloader configs License: GPL-2.0-or-later Source1: grubby-bls @@ -74,6 +74,9 @@ fi %{_mandir}/man8/grubby.8* %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 8.40-84 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Thu Mar 20 2025 Leo Sandoval - 8.40-83 - grubby-bls: in s390* systems, run zipl on grub cfg update event Fixes previous commit and formats better the conditions that trigger grub cfg updates From 6095bc576b3aa216400f1cc133ade107d4830ea7 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 30 Jul 2025 12:16:29 -0600 Subject: [PATCH 3/4] Update cfg when setting a default kernel Signed-off-by: Raju Cheerla Signed-off-by: Leo Sandoval --- grubby-bls | 2 +- grubby.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/grubby-bls b/grubby-bls index 555fd13..11b69b1 100755 --- a/grubby-bls +++ b/grubby-bls @@ -567,7 +567,7 @@ set_default_bls() { echo "default=${default}" >> "${zipl_config}" fi fi - + update_grubcfg print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}" } diff --git a/grubby.spec b/grubby.spec index 6abb3ed..a7ec5c4 100644 --- a/grubby.spec +++ b/grubby.spec @@ -3,7 +3,7 @@ Name: grubby Version: 8.40 -Release: 84%{?dist} +Release: 85%{?dist} Summary: Command line tool for updating bootloader configs License: GPL-2.0-or-later Source1: grubby-bls @@ -74,6 +74,9 @@ fi %{_mandir}/man8/grubby.8* %changelog +* Wed Jul 30 2025 Leo Sandoval - 8.40-85 +- Update cfg when setting a default kernel + * Thu Jul 24 2025 Fedora Release Engineering - 8.40-84 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 482a2825c47c4fd28a18beb279a3e826461bf878 Mon Sep 17 00:00:00 2001 From: Simon de Vlieger Date: Wed, 10 Dec 2025 07:50:55 +0100 Subject: [PATCH 4/4] spec: own `/etc/sysconfig/kernel` `grubby` reads the `/etc/sysconfig/kernel` file which isn't owned by the package, nor created by it. This leads to all image build tooling having to take special care to write this file [1] [2] so produced deliverables automatically update their kernels. This commit moves the creation of this file to the `grubby` package so things work 'out of the box' instead of needing to do out-of-package configuration by third parties. [1]: https://pagure.io/fedora-kiwi-descriptions/blob/f43/f/root/etc/sysconfig [2]: https://github.com/osbuild/images/blob/a8fafe8d9b9f7fa0d4e7316b15452acd63c6941d/data/distrodefs/fedora/imagetypes.yaml#L1027-L1028 Signed-off-by: Simon de Vlieger --- grubby.spec | 10 +++++++++- kernel.sysconfig | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 kernel.sysconfig diff --git a/grubby.spec b/grubby.spec index a7ec5c4..87b8787 100644 --- a/grubby.spec +++ b/grubby.spec @@ -3,7 +3,7 @@ Name: grubby Version: 8.40 -Release: 85%{?dist} +Release: 86%{?dist} Summary: Command line tool for updating bootloader configs License: GPL-2.0-or-later Source1: grubby-bls @@ -12,6 +12,7 @@ Source3: COPYING Source5: 95-kernel-hooks.install Source6: 10-devicetree.install Source7: grubby.8 +Source8: kernel.sysconfig BuildRequires: gcc BuildRequires: glib2-devel @@ -59,6 +60,9 @@ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE6} mkdir -p %{buildroot}%{_mandir}/man8 install -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man8/ +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +install -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/kernel + %post if [ "$1" = 2 ]; then arch=$(uname -m) @@ -72,8 +76,12 @@ fi %attr(0755,root,root) %{_prefix}/lib/kernel/install.d/10-devicetree.install %attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install %{_mandir}/man8/grubby.8* +%config(noreplace) %{_sysconfdir}/sysconfig/kernel %changelog +* Wed Dec 10 2025 Simon de Vlieger - 8.40-86 +- Own `/etc/sysconfig/kernel` which is used for `grubby` configuration + * Wed Jul 30 2025 Leo Sandoval - 8.40-85 - Update cfg when setting a default kernel diff --git a/kernel.sysconfig b/kernel.sysconfig new file mode 100644 index 0000000..8da1970 --- /dev/null +++ b/kernel.sysconfig @@ -0,0 +1,6 @@ +# UPDATEDEFAULT specifies if kernel-install should make +# new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core