From b9c80be1526a203356f96be9aef65b00301f08dc Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 24 May 2023 20:52:13 +0200 Subject: [PATCH] util: Enable default kernel for updates Resolves: #2184069 Signed-off-by: Marta Lewandowska Signed-off-by: Nicolas Frayer --- ...il-Enable-default-kernel-for-updates.patch | 34 +++++++++++++++++++ 20-grub.install | 6 +++- grub.patches | 1 + grub2.spec | 6 +++- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 0323-util-Enable-default-kernel-for-updates.patch diff --git a/0323-util-Enable-default-kernel-for-updates.patch b/0323-util-Enable-default-kernel-for-updates.patch new file mode 100644 index 0000000..bdfa65a --- /dev/null +++ b/0323-util-Enable-default-kernel-for-updates.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 24 May 2023 11:22:47 +0200 +Subject: [PATCH] util: Enable default kernel for updates + +Several kernel variants can be installed on a system in parallel. +In order to allow the user to choose which kernel will be set to +default after an update, re-enable grub's usage of DEFAULTKERNEL as +set in /etc/sysconfig/kernel + +Signed-off-by: Nicolas Frayer +--- + util/grub-get-kernel-settings.in | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in +index 7e87dfccc0..f71bc64360 100644 +--- a/util/grub-get-kernel-settings.in ++++ b/util/grub-get-kernel-settings.in +@@ -68,6 +68,14 @@ if test -f /etc/sysconfig/kernel ; then + . /etc/sysconfig/kernel + fi + ++GRUB_DEFAULT_KERNEL_TYPE=${DEFAULTKERNEL/-core/} ++if [ "$GRUB_DEFAULT_KERNEL_TYPE" != "kernel" ]; then ++ echo GRUB_NON_STANDARD_KERNEL=true ++ echo export GRUB_NON_STANDARD_KERNEL ++ GRUB_DEFAULT_KERNEL_TYPE=${GRUB_DEFAULT_KERNEL_TYPE/kernel-/} ++fi ++echo GRUB_DEFAULT_KERNEL_TYPE=$GRUB_DEFAULT_KERNEL_TYPE ++echo export GRUB_DEFAULT_KERNEL_TYPE + if [ "$MAKEDEBUG" = "yes" ]; then + echo GRUB_LINUX_MAKE_DEBUG=true + echo export GRUB_LINUX_MAKE_DEBUG diff --git a/20-grub.install b/20-grub.install index 9730c2c..fe7ad8a 100755 --- a/20-grub.install +++ b/20-grub.install @@ -126,7 +126,11 @@ case "$COMMAND" in sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}" fi - if [[ "$KERNEL_VERSION" == *\+debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then + if ( [[ "$KERNEL_VERSION" != *${GRUB_DEFAULT_KERNEL_TYPE}* ]] && \ + [ "x$GRUB_NON_STANDARD_KERNEL" == "xtrue" ] ) || \ + ( echo "$KERNEL_VERSION" | grep -E -q "64k|auto|rt|uki" && \ + [ "x$GRUB_NON_STANDARD_KERNEL" != "xtrue" ] ) || \ + ( [[ "$KERNEL_VERSION" == *debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ] ); then GRUB_UPDATE_DEFAULT_KERNEL=false fi diff --git a/grub.patches b/grub.patches index 510ab16..d808268 100644 --- a/grub.patches +++ b/grub.patches @@ -320,3 +320,4 @@ Patch0319: 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch Patch0320: 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch Patch0321: 0321-mm-Preallocate-some-space-when-adding-new-regions.patch Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch +Patch0323: 0323-util-Enable-default-kernel-for-updates.patch diff --git a/grub2.spec b/grub2.spec index 1235163..ece02f2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 62%{?dist} +Release: 63%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -533,6 +533,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed May 24 2023 Nicolas Frayer - 2.06-63 +- util: Enable default kernel for updates +- Resolves: #2184069 + * Tue May 23 2023 Javier Martinez Canillas - 2.06-62 - 20-grub-install: Explicitly check '+debug' suffix for debug kernels - Resolves: #2148351