Compare commits
8 Commits
Author | SHA256 | Date | |
---|---|---|---|
|
c492a8e4e0 | ||
|
9ae800a9b5 | ||
|
957b4bf706 | ||
|
53e10b88bf | ||
|
9337eec45d | ||
|
de8c74037b | ||
|
99bb9dd07d | ||
|
39ef9c79b7 |
@ -98,7 +98,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
{
|
||||
if (!load_cfg_f)
|
||||
load_cfg_f = grub_util_fopen (load_cfg, "wb");
|
||||
@@ -1670,21 +1708,13 @@
|
||||
@@ -1670,22 +1708,14 @@
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
@ -108,6 +108,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
{
|
||||
char *subvol = NULL;
|
||||
char *mount_path = NULL;
|
||||
grub_uint64_t subvolid = 0;
|
||||
- char **rootdir_devices = NULL;
|
||||
- char *t = grub_util_path_concat (2, "/", rootdir);
|
||||
- char *rootdir_path = grub_canonicalize_file_name (t);
|
||||
@ -117,10 +118,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
-
|
||||
- if (rootdir_devices && rootdir_devices[0])
|
||||
- if (grub_strcmp (rootdir_devices[0], grub_devices[0]) == 0)
|
||||
- subvol = grub_util_get_btrfs_subvol (platdir, &mount_path);
|
||||
- subvol = grub_util_get_btrfs_subvol (platdir, &mount_path, &subvolid);
|
||||
+
|
||||
+ if (grub_strcmp (rootdir_devices[0], grub_devices[0]) == 0)
|
||||
+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path);
|
||||
+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path, &subvolid);
|
||||
|
||||
if (subvol && mount_path)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 58dcf7985b20de876a6fc44a591aa377d0a0302c Mon Sep 17 00:00:00 2001
|
||||
From db67bd0800c69f94fa3696351e7387515464d30c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Thu, 10 Feb 2022 22:16:58 +0800
|
||||
Subject: [PATCH] grub-install: bailout root device probing
|
||||
@ -15,14 +15,26 @@ filesystem in it's own right.
|
||||
|
||||
The command is also used by grub-mkconfig for the same purpose.
|
||||
|
||||
v2:
|
||||
|
||||
Test the root device first before probing to avoid encountering
|
||||
unexpected errors. If this test fails, the device is considered
|
||||
irrelevant and of no interest, as it is not useful.
|
||||
|
||||
v2.1:
|
||||
Besides verifying that the target's canonical path can be resolved,
|
||||
ensure that the target is a block device file.
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
---
|
||||
grub-core/osdep/basic/no_platform.c | 5 +++++
|
||||
grub-core/osdep/unix/platform.c | 34 +++++++++++++++++++++++++++++
|
||||
grub-core/osdep/windows/platform.c | 6 +++++
|
||||
include/grub/util/install.h | 3 +++
|
||||
util/grub-install.c | 31 ++++++++++++++++++--------
|
||||
5 files changed, 70 insertions(+), 9 deletions(-)
|
||||
grub-core/osdep/basic/no_platform.c | 5 +++
|
||||
grub-core/osdep/unix/getroot.c | 67 +++++++++++++++++++++++++++++
|
||||
grub-core/osdep/unix/platform.c | 34 +++++++++++++++
|
||||
grub-core/osdep/windows/platform.c | 6 +++
|
||||
include/grub/emu/getroot.h | 3 ++
|
||||
include/grub/util/install.h | 3 ++
|
||||
util/grub-install.c | 45 +++++++++++++++----
|
||||
7 files changed, 154 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/grub-core/osdep/basic/no_platform.c
|
||||
+++ b/grub-core/osdep/basic/no_platform.c
|
||||
@ -35,6 +47,82 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
--- a/grub-core/osdep/unix/getroot.c
|
||||
+++ b/grub-core/osdep/unix/getroot.c
|
||||
@@ -489,6 +489,73 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef __linux__
|
||||
+int
|
||||
+grub_can_guess_from_mountinfo (const char *dir_in)
|
||||
+{
|
||||
+ char **cur;
|
||||
+ char **os_dev = NULL;
|
||||
+ char *dir = grub_canonicalize_file_name (dir_in);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (!dir)
|
||||
+ return 0;
|
||||
+
|
||||
+ os_dev = grub_find_root_devices_from_mountinfo (dir, NULL);
|
||||
+
|
||||
+ if (!os_dev)
|
||||
+ os_dev = find_root_devices_from_libzfs (dir);
|
||||
+
|
||||
+ if (!os_dev)
|
||||
+ {
|
||||
+ free (dir);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ for (cur = os_dev; *cur; cur++)
|
||||
+ {
|
||||
+ if (strcmp (*cur, "/dev/root") == 0
|
||||
+ || strncmp (*cur, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0)
|
||||
+ /* Assume known and good names */
|
||||
+ continue;
|
||||
+ else
|
||||
+ {
|
||||
+ struct stat st;
|
||||
+
|
||||
+ char *tmp = grub_canonicalize_file_name (*cur);
|
||||
+ if (tmp == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ if (strncmp (tmp, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (lstat (tmp, &st) < 0)
|
||||
+ {
|
||||
+ free (tmp);
|
||||
+ break;
|
||||
+ }
|
||||
+ free (tmp);
|
||||
+ if (! S_ISBLK (st.st_mode))
|
||||
+ /* only block device allowed */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (*cur == NULL)
|
||||
+ /* no bogus device left, good */
|
||||
+ ret = 1;
|
||||
+ else
|
||||
+ grub_util_info ("`%s' is not os device", *cur);
|
||||
+
|
||||
+ for (cur = os_dev; *cur; cur++)
|
||||
+ free (*cur);
|
||||
+ free (os_dev);
|
||||
+ free (dir);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif /* __linux__ */
|
||||
+
|
||||
char **
|
||||
grub_guess_root_devices (const char *dir_in)
|
||||
{
|
||||
--- a/grub-core/osdep/unix/platform.c
|
||||
+++ b/grub-core/osdep/unix/platform.c
|
||||
@@ -250,3 +250,37 @@
|
||||
@ -87,6 +175,18 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
--- a/include/grub/emu/getroot.h
|
||||
+++ b/include/grub/emu/getroot.h
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
char *grub_find_device (const char *dir, dev_t dev);
|
||||
void grub_util_pull_device (const char *osname);
|
||||
+#ifdef __linux__
|
||||
+int grub_can_guess_from_mountinfo (const char *dir);
|
||||
+#endif
|
||||
char **grub_guess_root_devices (const char *dir);
|
||||
int grub_util_get_dev_abstraction (const char *os_dev);
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
--- a/include/grub/util/install.h
|
||||
+++ b/include/grub/util/install.h
|
||||
@@ -251,6 +251,9 @@
|
||||
@ -101,7 +201,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
int
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -887,7 +887,6 @@
|
||||
@@ -922,7 +922,6 @@
|
||||
const char *efi_file = NULL;
|
||||
char **grub_devices;
|
||||
grub_fs_t grub_fs;
|
||||
@ -109,7 +209,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
grub_device_t grub_dev = NULL;
|
||||
enum grub_install_plat platform;
|
||||
char *grubdir, *device_map;
|
||||
@@ -1067,8 +1066,10 @@
|
||||
@@ -1102,10 +1101,22 @@
|
||||
grub_host_init ();
|
||||
|
||||
{
|
||||
@ -121,8 +221,20 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
+
|
||||
char *t = grub_util_path_concat (2, "/", rootdir);
|
||||
|
||||
+#ifdef __linux__
|
||||
+ if (!grub_can_guess_from_mountinfo (t))
|
||||
+ {
|
||||
+ free(t);
|
||||
+ /* We can safely ignore the root probe here; whichever cannot be
|
||||
+ * reliably detected is irrelevant and of no interest */
|
||||
+ goto skip_root_probe;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
rootdir_path = grub_canonicalize_file_name (t);
|
||||
@@ -1089,20 +1090,32 @@
|
||||
if (!rootdir_path)
|
||||
grub_util_error (_("failed to get canonical path of `%s'"), t);
|
||||
@@ -1124,22 +1135,38 @@
|
||||
rootdir_devices[0]);
|
||||
|
||||
rootdir_grub_dev = grub_device_open (rootdir_grub_devname);
|
||||
@ -160,4 +272,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
+ grub_device_close (rootdir_grub_dev);
|
||||
}
|
||||
|
||||
+#ifdef __linux__
|
||||
+ skip_root_probe:
|
||||
+#endif
|
||||
+
|
||||
switch (platform)
|
||||
{
|
||||
case GRUB_INSTALL_PLATFORM_I386_EFI:
|
||||
|
@ -0,0 +1,60 @@
|
||||
From d35ff22516b161f6d472f7f5371a89597b072d04 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Mon, 6 May 2024 10:34:22 +0800
|
||||
Subject: [PATCH] net/drivers/ieee1275/ofnet: Remove 200 ms timeout in
|
||||
get_card_packet() to reduce input latency
|
||||
|
||||
When GRUB image is netbooted on ppc64le, the keyboard input exhibits
|
||||
significant latency, reports even say that characters are processed
|
||||
about once per second. This issue makes interactively trying to debug
|
||||
a ppc64le config very difficult.
|
||||
|
||||
It seems that the latency is largely caused by a 200 ms timeout in the
|
||||
idle event loop, during which the network card interface is consistently
|
||||
polled for incoming packets. Often, no packets arrive during this
|
||||
period, so the timeout nearly always expires, which blocks the response
|
||||
to key inputs.
|
||||
|
||||
Furthermore, this 200 ms timeout might not need to be enforced at this
|
||||
basic layer, considering that GRUB performs synchronous reads and its
|
||||
timeout management is actually handled by higher layers, not directly in
|
||||
the card instance. Additionally, the idle polling, which reacts to
|
||||
unsolicited packets like ICMP and SLAAC, would be fine at a less frequent
|
||||
polling interval, rather than needing a timeout for receiving a response.
|
||||
|
||||
For these reasons, we believe the timeout in get_card_packet() should be
|
||||
effectively removed. According to test results, the delay has disappeared,
|
||||
and it is now much easier to use interactively.
|
||||
|
||||
Signed-Off-by: Michael Chang <mchang@suse.com>
|
||||
Tested-by: Tony Jones <tonyj@suse.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/net/drivers/ieee1275/ofnet.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
|
||||
index 78f03df8e..3bf48b3f0 100644
|
||||
--- a/grub-core/net/drivers/ieee1275/ofnet.c
|
||||
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
|
||||
@@ -82,15 +82,11 @@ get_card_packet (struct grub_net_card *dev)
|
||||
grub_ssize_t actual;
|
||||
int rc;
|
||||
struct grub_ofnetcard_data *data = dev->data;
|
||||
- grub_uint64_t start_time;
|
||||
struct grub_net_buff *nb;
|
||||
|
||||
- start_time = grub_get_time_ms ();
|
||||
- do
|
||||
- rc = grub_ieee1275_read (data->handle, dev->rcvbuf, dev->rcvbufsize, &actual);
|
||||
- while ((actual <= 0 || rc < 0) && (grub_get_time_ms () - start_time < 200));
|
||||
+ rc = grub_ieee1275_read (data->handle, dev->rcvbuf, dev->rcvbufsize, &actual);
|
||||
|
||||
- if (actual <= 0)
|
||||
+ if (actual <= 0 || rc < 0)
|
||||
return NULL;
|
||||
|
||||
nb = grub_netbuff_alloc (actual + 2);
|
||||
--
|
||||
2.45.2
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 855b3e5cd4d672e961a366ff0f53e3a09a1ad0cc Mon Sep 17 00:00:00 2001
|
||||
From 96e5a28d120856057fe7fc9b281f11f8933063b7 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Fri, 30 Jun 2023 14:37:41 +0800
|
||||
Subject: [PATCH 7/9] grub-switch-to-blscfg: adapt to openSUSE
|
||||
@ -12,17 +12,26 @@ A few tweaks to make it 'just works' for openSUSE:
|
||||
- remove RHEL specific $GRUB_LINUX_MAKE_DEBUG and all related code
|
||||
- remove ostree specific hack
|
||||
- ignore increment.mod
|
||||
- fix error in dash shell script
|
||||
- fix kernel flavor parsing in openSUSE
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
---
|
||||
util/grub-switch-to-blscfg.in | 144 ++++++++++++++++++++--------------
|
||||
1 file changed, 87 insertions(+), 57 deletions(-)
|
||||
util/grub-switch-to-blscfg.in | 156 ++++++++++++++++++++--------------
|
||||
1 file changed, 94 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
|
||||
index a851424be..66ecc0cae 100644
|
||||
index a851424be..145c22add 100644
|
||||
--- a/util/grub-switch-to-blscfg.in
|
||||
+++ b/util/grub-switch-to-blscfg.in
|
||||
@@ -34,21 +34,18 @@ fi
|
||||
@@ -28,27 +28,24 @@ PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
datarootdir="@datarootdir@"
|
||||
datadir="@datadir@"
|
||||
-if [ ! -v pkgdatadir ]; then
|
||||
+if [ -z "${pkgdatadir+x}" ]; then
|
||||
pkgdatadir="${datadir}/@PACKAGE@"
|
||||
fi
|
||||
|
||||
self=`basename $0`
|
||||
|
||||
@ -162,7 +171,7 @@ index a851424be..66ecc0cae 100644
|
||||
gettext_printf "Couldn't find config file\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -190,27 +252,22 @@ fi
|
||||
@@ -190,27 +252,24 @@ fi
|
||||
mkbls() {
|
||||
local kernelver=$1 && shift
|
||||
local datetime=$1 && shift
|
||||
@ -173,15 +182,21 @@ index a851424be..66ecc0cae 100644
|
||||
- local debugid=""
|
||||
local flavor=""
|
||||
|
||||
if [ "$kernelver" == *\+* ] ; then
|
||||
local flavor=-"${kernelver##*+}"
|
||||
- if [ "$kernelver" == *\+* ] ; then
|
||||
- local flavor=-"${kernelver##*+}"
|
||||
- if [ "${flavor}" == "-debug" ]; then
|
||||
- local debugname=" with debugging"
|
||||
- local debugid="-debug"
|
||||
- fi
|
||||
fi
|
||||
- fi
|
||||
+ case "$kernelver" in
|
||||
+ *-*-*)
|
||||
+ flavor=-"${kernelver##*-}"
|
||||
+ ;;
|
||||
+ esac
|
||||
(
|
||||
source /etc/os-release
|
||||
- source /etc/os-release
|
||||
+ . /etc/os-release
|
||||
|
||||
cat <<EOF
|
||||
-title ${NAME} (${kernelver}) ${VERSION}${debugname}
|
||||
@ -189,13 +204,13 @@ index a851424be..66ecc0cae 100644
|
||||
-linux /vmlinuz-${kernelver}
|
||||
-initrd /initramfs-${kernelver}.img
|
||||
+title ${NAME} (${kernelver}) ${VERSION}
|
||||
+version ${kernelver}$
|
||||
+version ${kernelver}
|
||||
+linux ${prefix}/vmlinuz-${kernelver}
|
||||
+initrd ${prefix}/initrd-${kernelver}
|
||||
options ${kernelopts}
|
||||
grub_users \$grub_users
|
||||
grub_arg --unrestricted
|
||||
@@ -233,42 +290,15 @@ copy_bls() {
|
||||
@@ -233,42 +292,15 @@ copy_bls() {
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -239,7 +254,7 @@ index a851424be..66ecc0cae 100644
|
||||
GENERATE=0
|
||||
if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \
|
||||
| grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then
|
||||
@@ -297,9 +327,7 @@ if [ "${GENERATE}" -eq 1 ] ; then
|
||||
@@ -297,9 +329,7 @@ if [ "${GENERATE}" -eq 1 ] ; then
|
||||
fi
|
||||
|
||||
if [ -n "${mod_dir}" ]; then
|
||||
@ -250,7 +265,7 @@ index a851424be..66ecc0cae 100644
|
||||
fi
|
||||
|
||||
cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"
|
||||
@@ -311,6 +339,8 @@ if [ "${GENERATE}" -eq 1 ] ; then
|
||||
@@ -311,6 +341,8 @@ if [ "${GENERATE}" -eq 1 ] ; then
|
||||
gettext_printf "Updating %s failed\n" "${GRUB_CONFIG_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
@ -260,5 +275,5 @@ index a851424be..66ecc0cae 100644
|
||||
|
||||
# Bye.
|
||||
--
|
||||
2.44.0
|
||||
2.45.2
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 72a72facc6cbaf58fda136286af78bbbd48bd88c Mon Sep 17 00:00:00 2001
|
||||
From abd8b83cdc6398c52c7d2b71b378938cf51872fd Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Wed, 13 Mar 2024 15:26:42 +0800
|
||||
Subject: [PATCH 9/9] 10_linux: Some refinement for BLS
|
||||
@ -8,13 +8,16 @@ kernelopts assignment in the grub boot config itself to fully delegate
|
||||
the responsibility of generating kernel options to a functioning BLS
|
||||
generator.
|
||||
|
||||
Additionally, removing unused dead code, which is often blamed for
|
||||
causing errors in the dash shell script.
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
---
|
||||
util/grub.d/10_linux.in | 29 -----------------------------
|
||||
1 file changed, 29 deletions(-)
|
||||
util/grub.d/10_linux.in | 194 ----------------------------------------
|
||||
1 file changed, 194 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index edf0fca55..7cbff7466 100644
|
||||
index edf0fca55..666eae995 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -93,11 +93,7 @@ fi
|
||||
@ -29,20 +32,138 @@ index edf0fca55..7cbff7466 100644
|
||||
cat <<EOF
|
||||
|
||||
# This section was generated by a script. Do not modify the generated file - all changes
|
||||
@@ -200,11 +196,6 @@ populate_menu()
|
||||
printf "$menu"
|
||||
@@ -110,102 +106,6 @@ cat <<EOF
|
||||
EOF
|
||||
}
|
||||
|
||||
-read_config()
|
||||
-{
|
||||
- config_file=${1}
|
||||
- title=""
|
||||
- initrd=""
|
||||
- options=""
|
||||
- linux=""
|
||||
- grub_arg=""
|
||||
-
|
||||
- while read -r line
|
||||
- do
|
||||
- record=$(echo ${line} | cut -f 1 -d ' ')
|
||||
- value=$(echo ${line} | cut -s -f2- -d ' ')
|
||||
- case "${record}" in
|
||||
- "title")
|
||||
- title=${value}
|
||||
- ;;
|
||||
- "initrd")
|
||||
- initrd=${value}
|
||||
- ;;
|
||||
- "linux")
|
||||
- linux=${value}
|
||||
- ;;
|
||||
- "options")
|
||||
- options=${value}
|
||||
- ;;
|
||||
- "grub_arg")
|
||||
- grub_arg=${value}
|
||||
- ;;
|
||||
- esac
|
||||
- done < ${config_file}
|
||||
-}
|
||||
-
|
||||
-blsdir="/boot/loader/entries"
|
||||
-
|
||||
-get_sorted_bls()
|
||||
-{
|
||||
- if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ] || [ -d /ostree/repo ]; then
|
||||
- return
|
||||
- fi
|
||||
-
|
||||
- local IFS=$'\n'
|
||||
-
|
||||
- files=($(for bls in ${blsdir}/*.conf; do
|
||||
- if ! [[ -e "${bls}" ]] ; then
|
||||
- continue
|
||||
- fi
|
||||
- bls="${bls%.conf}"
|
||||
- bls="${bls##*/}"
|
||||
- echo "${bls}"
|
||||
- done | ${kernel_sort} 2>/dev/null | tac)) || :
|
||||
-
|
||||
- echo "${files[@]}"
|
||||
-}
|
||||
-
|
||||
-update_bls_cmdline()
|
||||
-{
|
||||
- local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
- local -a files=($(get_sorted_bls))
|
||||
-
|
||||
- for bls in "${files[@]}"; do
|
||||
- local options="${cmdline}"
|
||||
- if [ -z "${bls##*debug*}" ]; then
|
||||
- options="${options} ${GRUB_CMDLINE_LINUX_DEBUG}"
|
||||
- fi
|
||||
- options="$(echo "${options}" | sed -e 's/\//\\\//g')"
|
||||
- sed -i -e "s/^options.*/options ${options}/" "${blsdir}/${bls}.conf"
|
||||
- done
|
||||
-}
|
||||
-
|
||||
-populate_menu()
|
||||
-{
|
||||
- local -a files=($(get_sorted_bls))
|
||||
-
|
||||
- gettext_printf "Generating boot entries from BLS files...\n" >&2
|
||||
-
|
||||
- for bls in "${files[@]}"; do
|
||||
- read_config "${blsdir}/${bls}.conf"
|
||||
-
|
||||
- menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n"
|
||||
- menu="${menu}\t linux ${linux} ${options}\n"
|
||||
- if [ -n "${initrd}" ] ; then
|
||||
- menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||
- fi
|
||||
- menu="${menu}}\n\n"
|
||||
- done
|
||||
- # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
||||
- printf "$menu"
|
||||
-}
|
||||
-
|
||||
-# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed.
|
||||
-# FIXME: The test should be aligned to openSUSE, grubby is not our default tool
|
||||
-if [ -z "${GRUB_ENABLE_BLSCFG}" ] && ! command -v new-kernel-pkg >/dev/null && false; then
|
||||
- GRUB_ENABLE_BLSCFG="true"
|
||||
-fi
|
||||
|
||||
-
|
||||
if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
if [ x$dirname = x/ ]; then
|
||||
@@ -252,31 +243,11 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
if [ -z "${prepare_root_cache}" ]; then
|
||||
@@ -225,111 +125,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
prepare_grub_to_access_device_with_variable boot ${boot_device}
|
||||
fi
|
||||
|
||||
- arch="$(uname -m)"
|
||||
- if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then
|
||||
-
|
||||
- BLS_POPULATE_MENU="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
|
||||
- BLS_POPULATE_MENU="false"
|
||||
- fi
|
||||
- fi
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
populate_header_warn
|
||||
|
||||
- cat << EOF
|
||||
@ -69,10 +190,63 @@ index edf0fca55..7cbff7466 100644
|
||||
insmod blscfg
|
||||
blscfg
|
||||
EOF
|
||||
- fi
|
||||
-
|
||||
- if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
||||
- blsdir="/boot/loader/entries"
|
||||
- [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})"
|
||||
- if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then
|
||||
- blsdir=$(make_system_path_relative_to_its_root "${blsdir}")
|
||||
- if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
|
||||
- ${grub_editenv} - set blsdir="${blsdir}"
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
|
||||
- ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
|
||||
- fi
|
||||
-
|
||||
- if [ -n "${GRUB_DEFAULT_DTB}" ]; then
|
||||
- ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}"
|
||||
- fi
|
||||
-
|
||||
- if [ -n "${GRUB_SAVEDEFAULT}" ]; then
|
||||
- ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}"
|
||||
- fi
|
||||
- fi
|
||||
|
||||
if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
||||
blsdir="/boot/loader/entries"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-mktitle ()
|
||||
-{
|
||||
- local title_type
|
||||
- local version
|
||||
- local OS_NAME
|
||||
- local OS_VERS
|
||||
-
|
||||
- title_type=$1 && shift
|
||||
- version=$1 && shift
|
||||
-
|
||||
- OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})"
|
||||
- OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})"
|
||||
-
|
||||
- case $title_type in
|
||||
- recovery)
|
||||
- title=$(printf '%s (%s) %s (recovery mode)' \
|
||||
- "${OS_NAME}" "${version}" "${OS_VERS}")
|
||||
- ;;
|
||||
- *)
|
||||
- title=$(printf '%s (%s) %s' \
|
||||
- "${OS_NAME}" "${version}" "${OS_VERS}")
|
||||
- ;;
|
||||
- esac
|
||||
- echo -n ${title}
|
||||
-}
|
||||
-
|
||||
title_correction_code=
|
||||
|
||||
hotkey=1
|
||||
--
|
||||
2.44.0
|
||||
2.45.2
|
||||
|
||||
|
@ -7,6 +7,10 @@ v3:
|
||||
* Fix executable stack on which function trampoline is constructed to support
|
||||
closure (nested function). The closure sematic is replaced.
|
||||
|
||||
v4:
|
||||
* Fix btrfs subvolume for platform modules not mounting at runtime when the
|
||||
default subvolume is the topmost root tree (bsc#1228124)
|
||||
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -44,6 +44,7 @@
|
||||
@ -57,7 +61,7 @@ v3:
|
||||
if (err)
|
||||
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
||||
|
||||
@@ -2321,11 +2345,20 @@
|
||||
@@ -2323,11 +2347,20 @@
|
||||
grub_uint64_t tree;
|
||||
grub_uint8_t type;
|
||||
grub_size_t est_size = 0;
|
||||
@ -79,7 +83,7 @@ v3:
|
||||
if (err)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
@@ -2452,11 +2485,21 @@
|
||||
@@ -2454,11 +2487,21 @@
|
||||
struct grub_btrfs_inode inode;
|
||||
grub_uint8_t type;
|
||||
struct grub_btrfs_key key_in;
|
||||
@ -102,7 +106,7 @@ v3:
|
||||
if (err)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
@@ -2691,6 +2734,150 @@
|
||||
@@ -2693,6 +2736,150 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -253,7 +257,7 @@ v3:
|
||||
static grub_err_t
|
||||
get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree,
|
||||
grub_uint64_t objectid, grub_uint64_t offset,
|
||||
@@ -2903,6 +3090,7 @@
|
||||
@@ -2905,6 +3092,7 @@
|
||||
};
|
||||
|
||||
static grub_command_t cmd_info;
|
||||
@ -261,7 +265,7 @@ v3:
|
||||
static grub_extcmd_t cmd_list_subvols;
|
||||
|
||||
static char *
|
||||
@@ -2966,6 +3154,9 @@
|
||||
@@ -2968,6 +3156,9 @@
|
||||
cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
|
||||
"DEVICE",
|
||||
"Print BtrFS info about DEVICE.");
|
||||
@ -288,18 +292,22 @@ v3:
|
||||
struct btrfs_ioctl_search_args {
|
||||
struct btrfs_ioctl_search_key key;
|
||||
grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key))
|
||||
@@ -375,6 +383,109 @@
|
||||
@@ -375,6 +383,117 @@
|
||||
|
||||
int use_relative_path_on_btrfs = 0;
|
||||
|
||||
+static char *
|
||||
+get_btrfs_subvol (const char *path)
|
||||
+get_btrfs_subvol (const char *path, grub_uint64_t *subvolid)
|
||||
+{
|
||||
+ struct btrfs_ioctl_ino_lookup_args args;
|
||||
+ grub_uint64_t tree_id;
|
||||
+ grub_uint64_t ret_id;
|
||||
+ int fd = -1;
|
||||
+ char *ret = NULL;
|
||||
+
|
||||
+ if (subvolid)
|
||||
+ *subvolid = 0;
|
||||
+
|
||||
+ fd = open (path, O_RDONLY);
|
||||
+
|
||||
+ if (fd < 0)
|
||||
@ -312,6 +320,7 @@ v3:
|
||||
+ goto error;
|
||||
+
|
||||
+ tree_id = args.treeid;
|
||||
+ ret_id = args.treeid;
|
||||
+
|
||||
+ while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID)
|
||||
+ {
|
||||
@ -380,6 +389,9 @@ v3:
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (subvolid)
|
||||
+ *subvolid = ret_id;
|
||||
+
|
||||
+ close (fd);
|
||||
+ return ret;
|
||||
+
|
||||
@ -398,7 +410,7 @@ v3:
|
||||
char **
|
||||
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
|
||||
{
|
||||
@@ -516,12 +627,17 @@
|
||||
@@ -516,12 +635,17 @@
|
||||
else if (grub_strcmp (entries[i].fstype, "btrfs") == 0)
|
||||
{
|
||||
ret = grub_find_root_devices_from_btrfs (dir);
|
||||
@ -419,13 +431,13 @@ v3:
|
||||
}
|
||||
}
|
||||
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
|
||||
@@ -1202,6 +1318,24 @@
|
||||
@@ -1202,6 +1326,24 @@
|
||||
return grub_dev;
|
||||
}
|
||||
|
||||
+
|
||||
+char *
|
||||
+grub_util_get_btrfs_subvol (const char *path, char **mount_path)
|
||||
+grub_util_get_btrfs_subvol (const char *path, char **mount_path, grub_uint64_t *subvolid)
|
||||
+{
|
||||
+ if (mount_path)
|
||||
+ *mount_path = NULL;
|
||||
@ -438,7 +450,7 @@ v3:
|
||||
+ if (mount_path)
|
||||
+ *mount_path = grub_strdup (grub_btrfs_mount_path);
|
||||
+
|
||||
+ return get_btrfs_subvol (grub_btrfs_mount_path);
|
||||
+ return get_btrfs_subvol (grub_btrfs_mount_path, subvolid);
|
||||
+}
|
||||
+
|
||||
char *
|
||||
@ -446,7 +458,7 @@ v3:
|
||||
{
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1645,6 +1645,58 @@
|
||||
@@ -1646,6 +1646,58 @@
|
||||
prefix_drive = xasprintf ("(%s)", grub_drives[0]);
|
||||
}
|
||||
|
||||
@ -457,6 +469,7 @@ v3:
|
||||
+ {
|
||||
+ char *subvol = NULL;
|
||||
+ char *mount_path = NULL;
|
||||
+ grub_uint64_t subvolid = 0;
|
||||
+ char **rootdir_devices = NULL;
|
||||
+ char *t = grub_util_path_concat (2, "/", rootdir);
|
||||
+ char *rootdir_path = grub_canonicalize_file_name (t);
|
||||
@ -466,15 +479,15 @@ v3:
|
||||
+
|
||||
+ if (rootdir_devices && rootdir_devices[0])
|
||||
+ if (grub_strcmp (rootdir_devices[0], grub_devices[0]) == 0)
|
||||
+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path);
|
||||
+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path, &subvolid);
|
||||
+
|
||||
+ if (subvol && mount_path)
|
||||
+ {
|
||||
+ char *def_subvol;
|
||||
+ grub_uint64_t def_subvolid = 0;
|
||||
+
|
||||
+ def_subvol = grub_util_get_btrfs_subvol (rootdir_path, NULL);
|
||||
+ grub_free (grub_util_get_btrfs_subvol (rootdir_path, NULL, &def_subvolid));
|
||||
+
|
||||
+ if (def_subvol)
|
||||
+ if (def_subvolid)
|
||||
+ {
|
||||
+ char *rootdir_mount_path = NULL;
|
||||
+ if (!load_cfg_f)
|
||||
@ -484,10 +497,9 @@ v3:
|
||||
+ if (grub_strncmp (rootdir_path, mount_path, grub_strlen (rootdir_path)) == 0)
|
||||
+ rootdir_mount_path = grub_util_path_concat (2, "/", mount_path + grub_strlen (rootdir_path));
|
||||
+
|
||||
+ if (grub_strcmp (subvol, def_subvol) != 0 && rootdir_mount_path)
|
||||
+ if (subvolid != def_subvolid && rootdir_mount_path)
|
||||
+ fprintf (load_cfg_f, "btrfs-mount-subvol ($root) %s %s\n", rootdir_mount_path, subvol);
|
||||
+ free (rootdir_mount_path);
|
||||
+ free (def_subvol);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -513,7 +525,7 @@ v3:
|
||||
|
||||
+#ifdef __linux__
|
||||
+char *
|
||||
+grub_util_get_btrfs_subvol (const char *path, char **mount_path);
|
||||
+grub_util_get_btrfs_subvol (const char *path, char **mount_path, grub_uint64_t *subvolid);
|
||||
+#endif
|
||||
+
|
||||
/* Devmapper functions provided by getroot_devmapper.c. */
|
||||
|
52
grub2-s390x-set-hostonly.patch
Normal file
52
grub2-s390x-set-hostonly.patch
Normal file
@ -0,0 +1,52 @@
|
||||
diff --git a/util/s390x/zipl2grub.pl.in b/util/s390x/zipl2grub.pl.in
|
||||
index f4f997100..46b902209 100644
|
||||
--- a/util/s390x/zipl2grub.pl.in
|
||||
+++ b/util/s390x/zipl2grub.pl.in
|
||||
@@ -15,6 +15,7 @@ my $zipldir = "";
|
||||
my $running = "";
|
||||
my $refresh = 1; # needs to default to "on" until most bugs are shaken out!
|
||||
my $force = 0;
|
||||
+my $hostonly = 1;
|
||||
my $verbose = 0;
|
||||
my $debug = 0;
|
||||
my $miss = 0;
|
||||
@@ -114,8 +115,13 @@ sub BootCopy($$$$) {
|
||||
}
|
||||
sub MkInitrd($$$) {
|
||||
my( $initrd, $dir, $version) = @_;
|
||||
- my @C = ( "dracut", "--hostonly", "--force");
|
||||
+ my @C = ( "dracut", "--force");
|
||||
my $uuid;
|
||||
+ if ($hostonly) {
|
||||
+ push @C, "--hostonly";
|
||||
+ } else {
|
||||
+ push @C, "--no-hostonly";
|
||||
+ }
|
||||
push @C, "--quiet" unless ($verbose > 1);
|
||||
if ( exists( $fsdev{"/boot"}) ) {
|
||||
chomp( $uuid = qx{grub2-probe --target=fs_uuid /boot});
|
||||
@@ -368,6 +374,24 @@ foreach ("GRUB_EMU_CONMODE", "GRUB_CONMODE") {
|
||||
$C{$_} = "conmode=" . $C{$_};
|
||||
}
|
||||
|
||||
+if ( !exists( $C{SUSE_S390_DRACUT_HOSTONLY}) || $C{SUSE_S390_DRACUT_HOSTONLY} eq "auto" ) {
|
||||
+ # Auto-detection mode
|
||||
+ #
|
||||
+ # Check if the root block device of the root partition is a loop device.
|
||||
+ # If yes, it is the image building system, e.g. kiwi. Then, set 'hostonly' to 0.
|
||||
+ my ( $dev, $lsblk );
|
||||
+
|
||||
+ chomp( $dev = qx{grub2-probe -t device /});
|
||||
+ if ($dev) {
|
||||
+ chomp( $lsblk = qx{lsblk -snrp -o NAME $dev});
|
||||
+ $hostonly = 0 if ( $lsblk =~ m{\/loop} );
|
||||
+ }
|
||||
+} elsif ( $C{SUSE_S390_DRACUT_HOSTONLY} =~ m{^(no|false|0)$} ) {
|
||||
+ $hostonly = 0;
|
||||
+} else {
|
||||
+ $hostonly = 1;
|
||||
+}
|
||||
+
|
||||
if ( $debug && $verbose > 2 ) {
|
||||
foreach ( sort( keys( %C)) ) {
|
||||
printf( "%s=\"%s\"\n", $_, $C{$_});
|
@ -1,3 +1,36 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 2 08:44:40 UTC 2024 - Michael Chang <mchang@suse.com>
|
||||
|
||||
- Fix btrfs subvolume for platform modules not mounting at runtime when the
|
||||
default subvolume is the topmost root tree (bsc#1228124)
|
||||
* grub2-btrfs-06-subvol-mount.patch
|
||||
- Rediff
|
||||
* 0001-Unify-the-check-to-enable-btrfs-relative-path.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 2 02:22:21 UTC 2024 - Gary Ching-Pang Lin <glin@suse.com>
|
||||
|
||||
- Switch to '--no-hostonly' when creating the ZIPL initrd in the
|
||||
KIWI build environment to avoid some potential issues due to the
|
||||
missing modules
|
||||
* grub2-s390x-set-hostonly.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 19 09:59:15 UTC 2024 - Michael Chang <mchang@suse.com>
|
||||
|
||||
- Fix error in grub-install when root is on tmpfs (bsc#1226100)
|
||||
* 0001-grub-install-bailout-root-device-probing.patch
|
||||
- Fix incorrect Platform tag in rpm header (bsc#1217967)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 5 12:23:06 UTC 2024 - Michael Chang <mchang@suse.com>
|
||||
|
||||
- Fix error if dash shell script is used (bsc#1226453)
|
||||
* 0007-grub-switch-to-blscfg-adapt-to-openSUSE.patch
|
||||
* 0009-10_linux-Some-refinement-for-BLS.patch
|
||||
- Fix input handling in ppc64le grub2 has high latency (bsc#1223535)
|
||||
* 0001-net-drivers-ieee1275-ofnet-Remove-200-ms-timeout-in-.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 7 02:13:08 UTC 2024 - Michael Chang <mchang@suse.com>
|
||||
|
||||
|
@ -404,6 +404,8 @@ Patch213: 0006-Follow-the-device-where-blscfg-is-discovered.patch
|
||||
Patch214: 0007-grub-switch-to-blscfg-adapt-to-openSUSE.patch
|
||||
Patch215: 0008-blscfg-reading-bls-fragments-if-boot-present.patch
|
||||
Patch216: 0009-10_linux-Some-refinement-for-BLS.patch
|
||||
Patch217: 0001-net-drivers-ieee1275-ofnet-Remove-200-ms-timeout-in-.patch
|
||||
Patch218: grub2-s390x-set-hostonly.patch
|
||||
|
||||
Requires: gettext-runtime
|
||||
%if 0%{?suse_version} >= 1140
|
||||
@ -784,12 +786,6 @@ cd ..
|
||||
%if ! 0%{?only_efi:1}
|
||||
cd build
|
||||
|
||||
# 64-bit x86-64 machines use 32-bit boot loader
|
||||
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then)
|
||||
%ifarch x86_64
|
||||
%define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu}
|
||||
%endif
|
||||
|
||||
%if "%{platform}" != "emu"
|
||||
%define arch_specific --enable-device-mapper
|
||||
TLFLAGS="-static"
|
||||
|
Loading…
Reference in New Issue
Block a user