diff options
Diffstat (limited to 'source/a/grub')
18 files changed, 508 insertions, 252 deletions
diff --git a/source/a/grub/0001-00_header-add-GRUB_COLOR_-variables.patch b/source/a/grub/0001-00_header-add-GRUB_COLOR_-variables.patch new file mode 100644 index 000000000..867e8feeb --- /dev/null +++ b/source/a/grub/0001-00_header-add-GRUB_COLOR_-variables.patch @@ -0,0 +1,41 @@ +From 21e5bcf22ab1a9f08c63e2a0212219d7482f77c1 Mon Sep 17 00:00:00 2001 +From: Christian Hesse <mail@eworm.de> +Date: Wed, 10 Mar 2021 18:42:25 +0100 +Subject: [PATCH] 00_header: add GRUB_COLOR_* variables +--- + util/grub-mkconfig.in | 2 ++ + util/grub.d/00_header.in | 8 ++++++++ + 2 files changed, 10 insertions(+) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index f8cbb8d7a..1189d95f9 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -246,6 +246,8 @@ export GRUB_DEFAULT \ + GRUB_BACKGROUND \ + GRUB_THEME \ + GRUB_GFXPAYLOAD_LINUX \ ++ GRUB_COLOR_NORMAL \ ++ GRUB_COLOR_HIGHLIGHT \ + GRUB_INIT_TUNE \ + GRUB_SAVEDEFAULT \ + GRUB_ENABLE_CRYPTODISK \ +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 93a90233e..c5955df00 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -125,6 +125,14 @@ cat <<EOF + + EOF + ++if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then ++ cat << EOF ++set menu_color_normal=$GRUB_COLOR_NORMAL ++set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT ++ ++EOF ++fi ++ + serial=0; + gfxterm=0; + for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do diff --git a/source/a/grub/0001-skip-new-and-orig-files-in-etc-grub.d.patch b/source/a/grub/0001-skip-new-and-orig-files-in-etc-grub.d.patch new file mode 100644 index 000000000..601a05b9a --- /dev/null +++ b/source/a/grub/0001-skip-new-and-orig-files-in-etc-grub.d.patch @@ -0,0 +1,10 @@ +--- ./util/grub-mkconfig_lib.in.orig 2023-12-05 08:46:53.000000000 -0600 ++++ ./util/grub-mkconfig_lib.in 2024-01-02 13:44:41.164913702 -0600 +@@ -191,6 +191,7 @@ + case "$1" in + *.dpkg-*) return 1 ;; # debian dpkg + *.rpmsave|*.rpmnew) return 1 ;; ++ *.new|*.orig) return 1 ;; # slackware incoming or backed up config file + README*|*/README*) return 1 ;; # documentation + *.sig) return 1 ;; # signatures + esac diff --git a/source/a/grub/0001-skip-new-files-in-etc-grub.d.patch b/source/a/grub/0001-skip-new-files-in-etc-grub.d.patch deleted file mode 100644 index e1b4b8dcc..000000000 --- a/source/a/grub/0001-skip-new-files-in-etc-grub.d.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./util/grub-mkconfig.in.orig 2021-03-10 07:42:22.000000000 -0600 -+++ ./util/grub-mkconfig.in 2021-09-10 13:33:17.602163090 -0500 -@@ -278,6 +278,8 @@ - *~) ;; - # emacsen autosave files. FIXME: support other editors - */\#*\#) ;; -+ # Slackware incoming config files should be skipped as well: -+ *.new) ;; - *) - if grub_file_is_not_garbage "$i" && test -x "$i" ; then - echo diff --git a/source/a/grub/0003-support-dropins-for-default-configuration.patch b/source/a/grub/0003-support-dropins-for-default-configuration.patch new file mode 100644 index 000000000..4840487a1 --- /dev/null +++ b/source/a/grub/0003-support-dropins-for-default-configuration.patch @@ -0,0 +1,28 @@ +From ac560966d09295663fa9516d8d137e0c0fd04c06 Mon Sep 17 00:00:00 2001 +From: Christian Hesse <mail@eworm.de> +Date: Mon, 12 Jun 2023 07:42:01 +0200 +Subject: [PATCH 1/1] support dropins for default configuration + +--- + util/grub-mkconfig.in | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 1a945085c..4338dceef 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -160,6 +160,11 @@ fi + if test -f ${sysconfdir}/default/grub ; then + . ${sysconfdir}/default/grub + fi ++for dropin in ${sysconfdir}/default/grub.d/*.cfg ; do ++ if test -f "${dropin}" ; then ++ . "${dropin}" ++ fi ++done + + if [ "x${GRUB_DISABLE_UUID}" = "xtrue" ]; then + if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then +-- +2.41.0 + diff --git a/source/a/grub/0004-initrd_fallback_name.patch b/source/a/grub/0004-initrd_fallback_name.patch new file mode 100644 index 000000000..4c8efcdcb --- /dev/null +++ b/source/a/grub/0004-initrd_fallback_name.patch @@ -0,0 +1,24 @@ +--- ./util/grub.d/10_linux.in.orig 2024-07-30 15:28:52.790956089 -0500 ++++ ./util/grub.d/10_linux.in 2024-07-30 15:33:20.145303738 -0500 +@@ -235,7 +235,8 @@ + "initramfs-genkernel-${version}" \ + "initramfs-genkernel-${alt_version}" \ + "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ +- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do ++ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \ ++ "$GRUB_INITRD_FALLBACK_NAME" ; do + if test -e "${dirname}/${i}" ; then + initrd_real="${i}" + break +--- ./util/grub-mkconfig.in.orig 2024-07-30 15:28:52.787956085 -0500 ++++ ./util/grub-mkconfig.in 2024-07-30 15:35:55.115501711 -0500 +@@ -262,7 +262,8 @@ + GRUB_ENABLE_CRYPTODISK \ + GRUB_BADRAM \ + GRUB_OS_PROBER_SKIP_LIST \ +- GRUB_DISABLE_SUBMENU ++ GRUB_DISABLE_SUBMENU \ ++ GRUB_INITRD_FALLBACK_NAME + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" diff --git a/source/a/grub/0005-GRUB_DISPLAY_KERNEL_FILETYPES.patch b/source/a/grub/0005-GRUB_DISPLAY_KERNEL_FILETYPES.patch new file mode 100644 index 000000000..1b9b8105f --- /dev/null +++ b/source/a/grub/0005-GRUB_DISPLAY_KERNEL_FILETYPES.patch @@ -0,0 +1,32 @@ +--- ./util/grub.d/10_linux.in.orig 2024-07-30 15:48:29.942595025 -0500 ++++ ./util/grub.d/10_linux.in 2024-07-30 15:55:59.637592488 -0500 +@@ -209,6 +209,17 @@ + + is_top_level=true + for linux in ${reverse_sorted_list}; do ++ ++ # Skip symbolic links to kernels if requested: ++ if [ -L "$linux" -a "$GRUB_DISPLAY_KERNEL_FILETYPES" = "files" ]; then ++ continue ++ fi ++ ++ # Skip kernels that are files rather than symbolic links if requested: ++ if [ ! -L "$linux" -a "$GRUB_DISPLAY_KERNEL_FILETYPES" = "symlinks" ]; then ++ continue ++ fi ++ + gettext_printf "Found linux image: %s\n" "$linux" >&2 + basename=`basename $linux` + dirname=`dirname $linux` +--- ./util/grub-mkconfig.in.orig 2024-07-30 15:48:29.985595129 -0500 ++++ ./util/grub-mkconfig.in 2024-07-30 15:51:12.083974196 -0500 +@@ -263,7 +263,8 @@ + GRUB_BADRAM \ + GRUB_OS_PROBER_SKIP_LIST \ + GRUB_DISABLE_SUBMENU \ +- GRUB_INITRD_FALLBACK_NAME ++ GRUB_INITRD_FALLBACK_NAME \ ++ GRUB_DISPLAY_KERNEL_FILETYPES + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" diff --git a/source/a/grub/0006-warn-grub.d-overwrites-docs.patch b/source/a/grub/0006-warn-grub.d-overwrites-docs.patch new file mode 100644 index 000000000..302e8263d --- /dev/null +++ b/source/a/grub/0006-warn-grub.d-overwrites-docs.patch @@ -0,0 +1,11 @@ +--- ./util/grub.d/README.orig 2018-11-24 11:13:02.000000000 -0600 ++++ ./util/grub.d/README 2024-09-10 16:45:11.619178928 -0500 +@@ -9,3 +9,8 @@ + administrator. For example, you can add an entry to boot another OS as + 01_otheros, 11_otheros, etc, depending on the position you want it to occupy in + the menu; and then adjust the default setting via /etc/default/grub. ++ ++When the grub package is upgraded/reinstalled, all the files in this directory ++that are normally shipped with the package (with the exception of 40_custom) ++will be replaced! Make copies or new files with a unique filename if you don't ++want them to be overwritten. diff --git a/source/a/grub/09_slackware_linux b/source/a/grub/09_slackware_linux new file mode 100644 index 000000000..b3a2499a0 --- /dev/null +++ b/source/a/grub/09_slackware_linux @@ -0,0 +1,196 @@ +#! /bin/sh +set -e +# grub-mkconfig helper script. +# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see <http://www.gnu.org/licenses/>. +# +# Save this file in /etc/grub.d/09_slackware_linux + +prefix="/usr" +exec_prefix="${prefix}" +datarootdir="${prefix}/share" + +. "${datarootdir}/grub/grub-mkconfig_lib" + +export TEXTDOMAIN=grub +export TEXTDOMAINDIR="${datarootdir}/locale" + +CLASS="--class gnu-linux --class gnu --class os" + +if [ "${GRUB_DISTRIBUTOR}" = "" ] ; then + OS=Linux +else + OS="${GRUB_DISTRIBUTOR} Linux" + CLASS="--class $(echo "${GRUB_DISTRIBUTOR}" | tr '[:upper:]' '[:lower:]') ${CLASS}" +fi + +# loop-AES arranges things so that /dev/loop/X can be our root device, but +# the initrds that Linux uses don't like that. +case ${GRUB_DEVICE} in + /dev/loop/*|/dev/loop[0-9]) + GRUB_DEVICE=$(losetup "${GRUB_DEVICE}" | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/") + ;; +esac + +if [ "${GRUB_DEVICE_UUID}" = "" ] || [ "${GRUB_DISABLE_LINUX_UUID}" = "true" ] \ + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} +else + LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} +fi + +linux_entry () +{ + os="$1" + tag="$2" + version="$3" + recovery="$4" + args="$5" + if ${recovery} ; then + title="$(gettext "%s, with Linux %s [%s] (recovery mode)")" + else + title="$(gettext "%s, with Linux %s [%s]")" + fi + printf "menuentry \"${title}\" ${CLASS} {\n" "${os}" "${version}" "${tag}" + save_default_entry | sed -e "s/^/\t/" + + # Use ELILO's generic "efifb" when it's known to be available. + # FIXME: We need an interface to select vesafb in case efifb can't be used. + if [ "$GRUB_GFXPAYLOAD_LINUX" = "" ]; then + if grep -qx "CONFIG_FB_EFI=y" /boot/config-"${version}" 2> /dev/null \ + && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-"${version}" 2> /dev/null; then + cat << EOF + set gfxpayload=keep +EOF + fi + else + cat << EOF + set gfxpayload=$GRUB_GFXPAYLOAD_LINUX +EOF + fi + + if [ -z "${prepare_boot_cache}" ]; then + prepare_boot_cache="$(prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | sed -e "s/^/\t/")" + fi + printf '%s\n' "${prepare_boot_cache}" + cat << EOF + echo $(printf "$(gettext "Loading Linux %s ...")" "${version}") + linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} +EOF + if test -n "${initrd}" ; then + cat << EOF + echo $(gettext "Loading initial ramdisk ...") + initrd ${initrd} +EOF + fi + cat << EOF +} +EOF +} + +process_list() { + mylist="$1" + tag="$2" + initrd_allowed="$3" + + # Version-sort the kernels + sorted_kernels=$(echo "$mylist" | tr ' ' '\n' | version_sort -r) + + # Use portable command substitution + kernels=$(echo "$sorted_kernels" | tr ' ' '\n') + + for kernel in $kernels; do + + # Skip symbolic links to kernels if requested: + if [ -L "$kernel" -a "$GRUB_DISABLE_KERNEL_SYMLINKS" = "true" ]; then + continue + fi + + printf "Found linux image: %s\n" "$kernel" >&2 + basename=$(basename "$kernel") + dirname=$(dirname "$kernel") + 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}" + initrd= + actual_initrd= + + if [ "${initrd_allowed}" = "true" ]; then + for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ + ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do + if [ -e "${dirname}/${i}" ]; then + if [ -z "$initrd" ]; then + initrd="$rel_dirname/$i" + else + initrd="$initrd $rel_dirname/$i" + fi + fi + done + for i in "initrd-${tag}-${version}.gz" "initrd-${tag}.gz" \ + "initrd-${version}.gz" "initrd.gz" \ + "initrd.img-${version}" "initrd-${version}.img" \ + "initrd-${version}" "initrd.img-${alt_version}" \ + "initrd-${alt_version}.img" "initrd-${alt_version}"; do + if [ -e "${dirname}/${i}" ]; then + actual_initrd="true" + if [ -z "$initrd" ]; then + initrd="$rel_dirname/$i" + else + initrd="$initrd $rel_dirname/$i" + fi + break + fi + done + + if [ -n "${initrd}" ]; then + printf "Found initrd image: %s\n" "${initrd}" >&2 + fi + if [ -z "$actual_initrd" ]; then + # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. + linux_root_device_thisversion=${GRUB_DEVICE} + fi + else + # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. + linux_root_device_thisversion=${GRUB_DEVICE} + fi + + linux_entry "${OS}" "${tag}" "${version}" false \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + + if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then + linux_entry "${OS}" "${tag}" "${version}" true \ + "single ${GRUB_CMDLINE_LINUX}" + fi + done +} + +prepare_boot_cache= + +list=$(for i in /boot/vmlinu[xz]-generic-* /boot/vmlinu[xz]-generic /vmlinu[xz]-generic-* ; do + if grub_file_is_not_garbage "$i" ; then printf "%s " "$i"; fi + done) + +process_list "${list}" "generic" "true" + +list=$(for i in /boot/vmlinu[xz]-custom-* /boot/vmlinu[xz]-custom /vmlinu[xz]-custom-* ; do + if grub_file_is_not_garbage "$i" ; then printf "%s " "$i"; fi + done) +process_list "${list}" "custom" "true" + +list=$(for i in /boot/vmlinu[xz]-huge-* /boot/vmlinu[xz]-huge /vmlinu[xz]-huge-* ; do + if grub_file_is_not_garbage "$i" ; then printf "%s " "$i"; fi + done) +process_list "${list}" "huge" "false" diff --git a/source/a/grub/10_linux.osname.patch b/source/a/grub/10_linux.osname.patch new file mode 100644 index 000000000..f76adee78 --- /dev/null +++ b/source/a/grub/10_linux.osname.patch @@ -0,0 +1,12 @@ +--- ./util/grub.d/10_linux.in.orig 2022-12-07 07:47:11.000000000 -0600 ++++ ./util/grub.d/10_linux.in 2024-07-24 14:14:09.362582694 -0500 +@@ -30,6 +30,9 @@ + + if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then + OS=GNU/Linux ++elif echo ${GRUB_DISTRIBUTOR} | grep -q Slackware ; then # opting out, thanks ++ OS="${GRUB_DISTRIBUTOR}" ++ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" + else + OS="${GRUB_DISTRIBUTOR} GNU/Linux" + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" diff --git a/source/a/grub/7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763.patch b/source/a/grub/7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763.patch deleted file mode 100644 index 27b2277c4..000000000 --- a/source/a/grub/7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas <javierm@redhat.com> -Date: Fri, 11 Jun 2021 21:36:16 +0200 -Subject: fs/ext2: Ignore checksum seed incompat feature - -This incompat feature is used to denote that the filesystem stored its -metadata checksum seed in the superblock. This is used to allow tune2fs -changing the UUID on a mounted metdata_csum filesystem without having -to rewrite all the disk metadata. However, the GRUB doesn't use the -metadata checksum at all. So, it can just ignore this feature if it -is enabled. This is consistent with the GRUB filesystem code in general -which just does a best effort to access the filesystem's data. - -The checksum seed incompat feature has to be removed from the ignore -list if the support for metadata checksum verification is added to the -GRUB ext2 driver later. - -Suggested-by: Eric Sandeen <esandeen@redhat.com> -Suggested-by: Lukas Czerner <lczerner@redhat.com> -Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> -Reviewed-by: Lukas Czerner <lczerner@redhat.com> -Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> ---- - grub-core/fs/ext2.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index e7dd78e..4953a15 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 - #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 - #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 -+#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 - #define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 - - /* The set of back-incompatible features this driver DOES support. Add (OR) -@@ -123,10 +124,15 @@ GRUB_MOD_LICENSE ("GPLv3+"); - * mmp: Not really back-incompatible - was added as such to - * avoid multiple read-write mounts. Safe to ignore for this - * RO driver. -+ * checksum seed: Not really back-incompatible - was added to allow tools -+ * such as tune2fs to change the UUID on a mounted metadata -+ * checksummed filesystem. Safe to ignore for now since the -+ * driver doesn't support checksum verification. However, it -+ * has to be removed from this list if the support is added later. - */ - #define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ -- | EXT4_FEATURE_INCOMPAT_MMP) -- -+ | EXT4_FEATURE_INCOMPAT_MMP \ -+ | EXT4_FEATURE_INCOMPAT_CSUM_SEED) - - #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U - --- -cgit v1.1 - diff --git a/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch b/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch deleted file mode 100644 index 5abc747af..000000000 --- a/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch +++ /dev/null @@ -1,121 +0,0 @@ -From a4b495520e4dc41a896a8b916a64eda9970c50ea Mon Sep 17 00:00:00 2001 -From: Erwan Velu <erwanaliasr1@gmail.com> -Date: Wed, 25 Aug 2021 15:31:52 +0200 -Subject: fs/xfs: Fix unreadable filesystem with v4 superblock - -The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) -introduced the bigtime support by adding some features in v3 inodes. -This change extended grub_xfs_inode struct by 76 bytes but also changed -the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this -commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes -XFS_V2_INODE_SIZE becomes 16 bytes too small. - -As a result, the data structures aren't properly aligned and the GRUB -generates "attempt to read or write outside of partition" errors when -trying to read the XFS filesystem: - - GNU GRUB version 2.11 - .... - grub> set debug=efi,gpt,xfs - grub> insmod part_gpt - grub> ls (hd0,gpt1)/ - partmap/gpt.c:93: Read a valid GPT header - partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840 - error: attempt to read or write outside of partition. - -This commit change the XFS_V2_INODE_SIZE computation by subtracting 76 -bytes instead of 92 bytes from the actual size of grub_xfs_inode struct. -This 76 bytes value comes from added members: - 20 grub_uint8_t unused5 - 1 grub_uint64_t flags2 - 48 grub_uint8_t unused6 - -This patch explicitly splits the v2 and v3 parts of the structure. -The unused4 is still ending of the v2 structures and the v3 starts -at unused5. Thanks to this we will avoid future corruptions of v2 -or v3 inodes. - -The XFS_V2_INODE_SIZE is returning to its expected size and the -filesystem is back to a readable state: - - GNU GRUB version 2.11 - .... - grub> set debug=efi,gpt,xfs - grub> insmod part_gpt - grub> ls (hd0,gpt1)/ - partmap/gpt.c:93: Read a valid GPT header - partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (131) - 64, 768 - efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0 - grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024 - grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816 - grub> - -Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) - -Signed-off-by: Erwan Velu <e.velu@criteo.com> -Tested-by: Carlos Maiolino <cmaiolino@redhat.com> -Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> ---- - grub-core/fs/xfs.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 0f524c3a8..e3816d1ec 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -192,6 +192,11 @@ struct grub_xfs_time_legacy - grub_uint32_t nanosec; - } GRUB_PACKED; - -+/* -+ * The struct grub_xfs_inode layout was taken from the -+ * struct xfs_dinode_core which is described here: -+ * https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf -+ */ - struct grub_xfs_inode - { - grub_uint8_t magic[2]; -@@ -208,14 +213,15 @@ struct grub_xfs_inode - grub_uint32_t nextents; - grub_uint16_t unused3; - grub_uint8_t fork_offset; -- grub_uint8_t unused4[37]; -+ grub_uint8_t unused4[17]; /* Last member of inode v2. */ -+ grub_uint8_t unused5[20]; /* First member of inode v3. */ - grub_uint64_t flags2; -- grub_uint8_t unused5[48]; -+ grub_uint8_t unused6[48]; /* Last member of inode v3. */ - } GRUB_PACKED; - - #define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode) --/* Size of struct grub_xfs_inode until fork_offset (included). */ --#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92) -+/* Size of struct grub_xfs_inode v2, up to unused4 member included. */ -+#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) - - struct grub_xfs_dirblock_tail - { --- -cgit v1.2.1 - - diff --git a/source/a/grub/b835601c7639ed1890f2d3db91900a8506011a8e.patch b/source/a/grub/b835601c7639ed1890f2d3db91900a8506011a8e.patch new file mode 100644 index 000000000..6670f7677 --- /dev/null +++ b/source/a/grub/b835601c7639ed1890f2d3db91900a8506011a8e.patch @@ -0,0 +1,34 @@ +From b835601c7639ed1890f2d3db91900a8506011a8e Mon Sep 17 00:00:00 2001 +From: Oskari Pirhonen <xxc3ncoredxx@gmail.com> +Date: Thu, 21 Dec 2023 01:17:35 -0600 +Subject: build: Include grub-core/extra_deps.lst in dist + +Fixes build failure due to the extra_deps.lst file not existing in the +tarball. Found while trying to package GRUB 2.12 for Gentoo. + + make[3]: *** No rule to make target '/var/tmp/portage/sys-boot/grub-2.12/work/grub-2.12/grub-core/extra_deps.lst', needed by 'syminfo.lst'. Stop. + +Fixes: 89fbe0cac (grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core) +Fixes: 154dcb1ae (build: Allow explicit module dependencies) + +Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com> +Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> +--- + conf/Makefile.extra-dist | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index 5e7126f..d9e2b8c 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -21,6 +21,7 @@ EXTRA_DIST += conf/i386-cygwin-img-ld.sc + EXTRA_DIST += grub-core/Makefile.core.def + EXTRA_DIST += grub-core/Makefile.gcry.def + ++EXTRA_DIST += grub-core/extra_deps.lst + EXTRA_DIST += grub-core/genmoddep.awk + EXTRA_DIST += grub-core/genmod.sh.in + EXTRA_DIST += grub-core/gensyminfo.sh.in +-- +cgit v1.1 + diff --git a/source/a/grub/doinst.sh b/source/a/grub/doinst.sh index 54c06904f..1078190e4 100644 --- a/source/a/grub/doinst.sh +++ b/source/a/grub/doinst.sh @@ -11,8 +11,26 @@ config() { # Otherwise, we leave the .new copy for the admin to consider... } +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + # Also preserve timestamp: + touch -r $NEW ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + # Process config files in etc/grub.d/: for file in etc/grub.d/*.new ; do - config $file + preserve_perms $file + # Move it into place. These are not intended to be edited locally - make new custom scripts! + # We'll skip moving 40_custom.new, though. + if [ -r $file -a ! "$file" = "etc/grub.d/40_custom.new" ]; then + mv $file $(dirname $file)/$(basename $file .new) + fi done config etc/default/grub.new diff --git a/source/a/grub/etc.default.grub b/source/a/grub/etc.default.grub index b2d4080a0..a44846a3d 100644 --- a/source/a/grub/etc.default.grub +++ b/source/a/grub/etc.default.grub @@ -9,20 +9,39 @@ GRUB_DISTRIBUTOR=$( sed 's/Slackware /Slackware-/' /etc/slackware-version ) GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" -# Uncomment to disable graphical terminal (grub-pc only) +# Uncomment to disable graphical terminal (grub-pc only): #GRUB_TERMINAL=console -# The resolution used on graphical terminal -# note that you can use only modes which your graphic card supports via VBE -# you can see them in real GRUB with the command `vbeinfo' +# The resolution used on graphical terminal. +# Note that you can use only modes which your graphic card supports via VBE. +# You can see them in real GRUB with the command `vbeinfo'. #GRUB_GFXMODE=640x480 #GRUB_GFXMODE=1024x768x32 # Font used on the graphical terminal: #GRUB_FONT=/usr/share/grub/dejavusansmono.pf2 -# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux +# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux: #GRUB_DISABLE_LINUX_UUID=true -# Uncomment to disable generation of recovery mode menu entries -#GRUB_DISABLE_RECOVERY="true" +# Uncomment to disable generation of recovery mode menu entries: +GRUB_DISABLE_RECOVERY="true" + +# Search for other operating systems with os-prober. +# If you don't want this, you can do any of these things to disable it: +# - change to "true" +# - comment it out, since disabled is the default +# - remove the executable bit from /etc/grub.d/30_os-prober +GRUB_DISABLE_OS_PROBER="false" + +# Disable the submenus: +GRUB_DISABLE_SUBMENU="true" + +# What kernel filetypes to display in the menu. This may be set to "files" +# (only display kernels that are files), "symlinks" (only display kernels +# that are symbolic links), or "both". +GRUB_DISPLAY_KERNEL_FILETYPES=both + +# This option allows defining an initrd name that will match any kernel as a +# fallback if no other matching initrd is found. You may use any name you like. +#GRUB_INITRD_FALLBACK_NAME=initrd.gz diff --git a/source/a/grub/grub.SlackBuild b/source/a/grub/grub.SlackBuild index b2bbb7223..accc3115e 100755 --- a/source/a/grub/grub.SlackBuild +++ b/source/a/grub/grub.SlackBuild @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2013, 2016, 2017, 2018, 2019, 2023 Patrick J. Volkerding, Sebeka, Minnesota, USA +# Copyright 2013, 2016, 2017, 2018, 2019, 2023, 2024 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -28,12 +28,15 @@ PKGNAM=grub VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} # Better to use _ than ~ in the package filenames version: PKGVER=$(echo $VERSION | tr '~' '_') -BUILD=${BUILD:-5} +BUILD=${BUILD:-16} + +# If you use stack-protector, then grub will not work with legacy BIOS: +STACKPROTECT=${STACKPROTECT:---enable-stack-protector=no} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$(uname -m)" in - i?86) ARCH=i586 ;; + i?86) ARCH=i686 ;; arm*) readelf /usr/bin/file -A | grep -E -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; # Unless $ARCH is already set, use uname -m for all other archs: *) ARCH=$(uname -m) ;; @@ -51,32 +54,15 @@ fi NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} -if [ "$ARCH" = "i386" ]; then - SLKCFLAGS="-march=i386 -mcpu=i686" - LIBDIRSUFFIX="" -elif [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-march=i486 -mtune=i686" - EFI32_FLAGS=" --with-platform=efi --target=i386 --program-prefix= " - LIBDIRSUFFIX="" -elif [ "$ARCH" = "i586" ]; then - SLKCFLAGS="-march=i586 -mtune=i686" - EFI32_FLAGS=" --with-platform=efi --target=i386 --program-prefix= " - LIBDIRSUFFIX="" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-march=i686" +if [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-mtune=generic" EFI32_FLAGS=" --with-platform=efi --target=i386 --program-prefix= " LIBDIRSUFFIX="" -elif [ "$ARCH" = "s390" ]; then - SLKCFLAGS="" - LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="" + SLKCFLAGS="-mtune=generic" EFI32_FLAGS=" --with-platform=efi --target=i386 --program-prefix= " EFI_FLAGS=" --with-platform=efi --target=x86_64 --program-prefix= " LIBDIRSUFFIX="64" -elif [ "$ARCH" = "armv7hl" ]; then - SLKCFLAGS="-march=armv7-a -mfpu=vfpv3-d16" - LIBDIRSUFFIX="" else SLKCFLAGS="" LIBDIRSUFFIX="" @@ -103,24 +89,43 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \+ -# Use /boot/initrd.gz as a valid initrd name: -zcat $CWD/initrd_naming.patch | patch -p1 --verbose || exit 1 - # Support DejaVuSansMono font (dejavusansmono.pf2) by default: -zcat $CWD/grub.dejavusansmono.gfxterm.font.diff.gz | patch -p1 --verbose || exit 1 +cat $CWD/grub.dejavusansmono.gfxterm.font.diff | patch -p1 --verbose || exit 1 # Fix alignment error with gcc8: -zcat $CWD/0198-align-struct-efi_variable-better.patch.gz | patch -p1 --verbose || exit 1 +cat $CWD/0198-align-struct-efi_variable-better.patch | patch -p1 --verbose || exit 1 + +# Skip processing any files in /etc/grub.d/ that end in .new or .orig: +cat $CWD/0001-skip-new-and-orig-files-in-etc-grub.d.patch | patch -p1 --verbose || exit 1 + +# From Arch, add a couple more GRUB_COLOR options: +cat $CWD/0001-00_header-add-GRUB_COLOR_-variables.patch | patch -p1 --verbose || exit 1 + +# Also from Arch, support drop-in config bits in /etc/default/grub.d/: +cat $CWD/0003-support-dropins-for-default-configuration.patch | patch -p1 --verbose || exit 1 + +# Fix 2.12 release with upstream commit (won't compile otherwise): +cat $CWD/b835601c7639ed1890f2d3db91900a8506011a8e.patch | patch -p1 --verbose || exit 1 -# Fix unreadable XFS filesystem with v4 superblock: -zcat $CWD/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch.gz | patch -p1 --verbose || exit 1 +# For Slackware, opt-out of having our operating system renamed: +cat $CWD/10_linux.osname.patch | patch -p1 --verbose || exit 1 -# Skip processing any files in /etc/grub.d/ that end in .new: -zcat $CWD/0001-skip-new-files-in-etc-grub.d.patch.gz | patch -p1 --verbose || exit 1 +# Allow defining an initrd fallback name with the +# GRUB_INITRD_FALLBACK_NAME variable in /etc/default/grub. +# Commented out by default. +cat $CWD/0004-initrd_fallback_name.patch | patch -p1 --verbose || exit 1 -# Since upstream apparently can't be bothered, let's fix using ext* filesystems -# created with what are now the default options: -zcat $CWD/7fd5feff97c4b1f446f8fcf6d37aca0c64e7c763.patch.gz | patch -p1 --verbose || exit 1 +# Support displaying only kernels that are files, only kernels that are +# symlinks, or both. This is set with the GRUB_DISPLAY_KERNEL_FILETYPES +# variable in /etc/default/grub: +cat $CWD/0005-GRUB_DISPLAY_KERNEL_FILETYPES.patch | patch -p1 --verbose || exit 1 + +# Add a warning to the README in /etc/grub.d/ so that users know that the +# standard files in here will be overwritten with every upgrade: +cat $CWD/0006-warn-grub.d-overwrites-docs.patch | patch -p1 --verbose || exit 1 + +# Still won't compile. Someday they'll remember how to cut a new release. +touch grub-core/extra_deps.lst # Regenerate build system to fix dependency on outdated automake: autoreconf -vif @@ -137,6 +142,8 @@ build_grub() { --infodir=/usr/info \ --mandir=/usr/man \ --disable-werror \ + --with-dejavufont=/usr/share/fonts/TTF/DejaVuSans.ttf \ + $STACKPROTECT \ $EFI_DO || exit 1 # Build and install: @@ -158,11 +165,27 @@ fi # Always end with regular build: build_grub || exit 1 +## NOT USED (but we'll leave the file here for now) +## Add custom 09_slackware_linux config. Thanks to Richard Cranium for the +## initial version, and Daedra for making it POSIX compliant: +#cp -a $CWD/09_slackware_linux $PKG/etc/grub.d/09_slackware_linux +#chown root:root $PKG/etc/grub.d/09_slackware_linux +#chmod 755 $PKG/etc/grub.d/09_slackware_linux + # Preserve files in /etc/grub.d/: for file in $PKG/etc/grub.d/*_* ; do mv ${file} ${file}.new done +# Add an update-grub script ala Ubuntu: +cp -a $CWD/update-grub $PKG/usr/sbin/update-grub +chown root:root $PKG/usr/sbin/update-grub +chmod 755 $PKG/usr/sbin/update-grub + +# Since every other grub command is of the form "grub-{command}", add a symlink +# so that "grub-update" also works: +ln -sf update-grub $PKG/usr/sbin/grub-update + # Strip binaries: ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null @@ -176,8 +199,10 @@ mv $PKG/etc/bash_completion.d/grub \ rmdir --parents $PKG/etc/bash_completion.d 2>/dev/null # Install default options file: -mkdir -p $PKG/etc/default +mkdir -p $PKG/etc/default/grub.d cat $CWD/etc.default.grub > $PKG/etc/default/grub.new +# Add a hint: +echo "Files in this directory must end in .cfg to be processed." > $PKG/etc/default/grub.d/README # Create a directory for grub.cfg: mkdir -p $PKG/boot/grub @@ -231,7 +256,7 @@ if [ -r ChangeLog ]; then fi mkdir -p $PKG/install -zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/doinst.sh > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG diff --git a/source/a/grub/initrd_naming.patch b/source/a/grub/initrd_naming.patch deleted file mode 100644 index 6b62778b0..000000000 --- a/source/a/grub/initrd_naming.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -Naur grub-2.00.orig/util/grub.d/10_linux.in grub-2.00/util/grub.d/10_linux.in ---- grub-2.00.orig/util/grub.d/10_linux.in 2012-04-18 23:24:38.000000000 +0200 -+++ grub-2.00/util/grub.d/10_linux.in 2012-06-30 07:53:03.765625589 +0200 -@@ -198,7 +198,8 @@ - "initramfs-genkernel-${version}" \ - "initramfs-genkernel-${alt_version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ -- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do -+ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \ -+ "initrd.gz"; do - if test -e "${dirname}/${i}" ; then - initrd="$i" - break diff --git a/source/a/grub/slack-desc b/source/a/grub/slack-desc index 1f7a31e09..b07c8a3b2 100644 --- a/source/a/grub/slack-desc +++ b/source/a/grub/slack-desc @@ -8,10 +8,10 @@ |-----handy-ruler------------------------------------------------------| grub: grub (the GRand Unified Bootloader) grub: -grub: GNU GRUB is a multiboot boot loader. -grub: -grub: Website: http://www.gnu.org/software/grub/ +grub: GNU GRUB, the GRand Unified Bootloader, is a flexible and powerful +grub: boot loader program for a wide range of architectures. grub: +grub: Homepage: https://www.gnu.org/software/grub/ grub: grub: grub: diff --git a/source/a/grub/update-grub b/source/a/grub/update-grub new file mode 100644 index 000000000..fef55d9b8 --- /dev/null +++ b/source/a/grub/update-grub @@ -0,0 +1,10 @@ +#!/bin/sh +# This is a simple script to update grub from the configuration file. +# Please note that after upgrading to a new grub version, you should +# first use "grub-install" to reinstall the bootloader, similar to this: +# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --recheck +# or this: +# grub-install --target=i386-pc --recheck /dev/sdX + +set -e +exec grub-mkconfig -o /boot/grub/grub.cfg "$@" |