$ git show --format=fuller --patch-with-stat --summary afb597adedf3bb5e35beb490fdbd02ace1b096a8
commit afb597adedf3bb5e35beb490fdbd02ace1b096a8
Author: Bernhard Rosenkraenzer <bero@lindev.ch>
AuthorDate: Tue Feb 4 01:06:41 2020 +0100
Commit: Bernhard Rosenkraenzer <bero@lindev.ch>
CommitDate: Tue Feb 4 01:06:41 2020 +0100
Show clang kernels after gcc kernel
---
grub2-clang-kernels-last.patch | 138 +++++++++++++++++++++++++++++++++++++++++
grub2.spec | 4 +-
2 files changed, 141 insertions(+), 1 deletion(-)
create mode 100644 grub2-clang-kernels-last.patch
diff --git a/grub2-clang-kernels-last.patch b/grub2-clang-kernels-last.patch
new file mode 100644
index 0000000..dd59f17
--- /dev/null
+++ b/grub2-clang-kernels-last.patch
@@ -0,0 +1,138 @@
+From 201eb5dc38e345aae3f27d4d4f5db97779f82070 Mon Sep 17 00:00:00 2001
+From: Gabriel Craciunescu <nix.or.die@gmail.com>
+Date: Tue, 14 Jan 2020 15:16:27 +0100
+Subject: [PATCH] use two lists to sort kernels
+
+ We do that bc is the chepest solution, the other solution is to patch sort
+ etc which is not really a good idea.
+
+ So we go first with non clang kernel in the name and write the menus,
+ then with -clang kernels after that. That way we force -clang to be always
+ after any normal kernels in the menus.
+---
+ 10_linux | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 105 insertions(+)
+
+diff --git grub/util/grub.d/10_linux.in grub/util/grub.d/10_linux.in
+index f0f7268..3e599af 100755
+--- grub/util/grub.d/10_linux.in
++++ grub_util/grub.d/10_linux.in
+@@ -224,6 +224,10 @@ title_correction_code=
+ submenu_indentation=""
+
+ is_top_level=true
++
++listc=`echo $list | tr ' ' '\n' | grep clang`
++list=`echo $list | tr ' ' '\n' | grep -v clang`
++
+ while [ "x$list" != "x" ] ; do
+ linux=`version_find_latest $list`
+ gettext_printf "Found linux image: %s\n" "$linux" >&2
+@@ -325,6 +329,107 @@ while [ "x$list" != "x" ] ; do
+ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
+ done
+
++while [ "x$listc" != "x" ] ; do
++ linux=`version_find_latest $listc`
++ gettext_printf "Found linux image: %s\n" "$linux" >&2
++ basename=`basename $linux`
++ dirname=`dirname $linux`
++ rel_dirname=`make_system_path_relative_to_its_root $dirname`
++ version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
++ alt_version=`echo $version | sed -e "s,\.old$,,g"`
++ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
++ #[[ -s /etc/machine-id ]] && machine_id=`cat /etc/machine-id`
++ initrd_early=
++ for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
++ ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
++ if test -e "${dirname}/${i}" ; then
++ initrd_early="${initrd_early} ${i}"
++ fi
++ done
++
++ initrd_real=
++ for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
++ "initrd-${version}" "initramfs-${version}.img" \
++ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
++ "initrd-${alt_version}" "initramfs-${alt_version}.img" \
++ "initramfs-genkernel-${version}" \
++ "initramfs-genkernel-${alt_version}" \
++ "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
++ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
++ if test -e "${dirname}/${i}" ; then
++ initrd_real="${i}"
++ break
++ fi
++ done
++
++ initrd=
++ if test -n "${initrd_early}" || test -n "${initrd_real}"; then
++ initrd="${initrd_early} ${initrd_real}"
++
++ initrd_display=
++ for i in ${initrd}; do
++ initrd_display="${initrd_display} ${dirname}/${i}"
++ done
++ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
++ fi
++
++ config=
++ for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
++ if test -e "${i}" ; then
++ config="${i}"
++ break
++ fi
++ done
++
++ initramfs=
++ if test -n "${config}" ; then
++ initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`
++ fi
++
++ if test -z "${initramfs}" && test -z "${initrd_real}" ; then
++ # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
++ # no initrd or builtin initramfs, it can't work here.
++ if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
++ || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then
++
++ linux_root_device_thisversion=${GRUB_DEVICE}
++ else
++ linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID}
++ fi
++ fi
++
++ if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
++ linux_entry "${OS}" "${version}" simple \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++
++ submenu_indentation="$grub_tab"
++
++ if [ -z "$boot_device_id" ]; then
++ boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
++ fi
++
++ ## (crazy) this is bc the way translations are working
++ # match Live theme , requested from @bero
++ atext_c=">"
++ atext_="$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)"
++ atext="${atext_} ${atext_c}"
++ # TRANSLATORS: %s is replaced with an OS name
++ echo "submenu '$atext' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
++ is_top_level=false
++ fi
++
++ linux_entry "${OS}" "${version}" advanced \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++ linux_entry "${OS}" "${version}" console \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} plymouth.enable=0 systemd.unit=multi-user.target"
++ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
++ linux_entry "${OS}" "${version}" recovery \
++ "single ${GRUB_CMDLINE_LINUX_RECOVERY}"
++ fi
++
++ listc=`echo $listc | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
++done
++
+ # If at least one kernel was found, then we need to
+ # add a closing '}' for the submenu command.
+ if [ x"$is_top_level" != xtrue ]; then
diff --git a/grub2.spec b/grub2.spec
index 6861413..44c119e 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -25,7 +25,7 @@ Name: grub2
## and compare to grub2-2.02-unity-mkrescue-use-grub2-dir.patch
## do _NOT_ update without doing that .. we just go lucky until now.
Version: 2.04
-Release: 2
+Release: 3
Group: System/Kernel and hardware
License: GPLv3+
Url: http://www.gnu.org/software/grub/
@@ -77,6 +77,8 @@ Patch15: grub-2.02-20180620-disable-docs.patch
# while running grub-mkimage
Patch16: grub-2.02-define-abort.patch
Patch17: grub-2.04-grub-extras-lua-fix.patch
+# Show clang kernels after gcc kernels
+Patch18: grub2-clang-kernels-last.patch
# (crazy) these are 2 BAD patches , FIXME after Lx4
# Patch7 prepares remove for that ( partially )