Add DNF protected.d fragments and pull a few fixes and enhancements
- Add DNF protected.d fragments for GRUB packages Resolves: rhbz#1874541 - Include keylayouts and at_keyboard modules in EFI builds - Add GRUB enhanced debugging features - ieee1275: Avoiding many unecessary open/close - ieee1275: device mapper and fibre channel discovery support - Fix tps-rpmtest failing due /boot/grub2/grubenv attributes mismatch Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
8c2cf1c368
commit
d84350c121
@ -64,7 +64,7 @@ Replace a bunch of machine generated ones with ones that look nicer.
|
||||
util/grub-script-check.1 | 21 +++++
|
||||
util/grub-set-default.8 | 21 +++++
|
||||
util/grub-sparc64-setup.8 | 12 +++
|
||||
59 files changed, 1319 insertions(+), 147 deletions(-)
|
||||
59 files changed, 1318 insertions(+), 147 deletions(-)
|
||||
delete mode 100644 docs/man/grub-bios-setup.h2m
|
||||
delete mode 100644 docs/man/grub-editenv.h2m
|
||||
delete mode 100644 docs/man/grub-emu.h2m
|
||||
@ -940,7 +940,7 @@ index 00000000000..72bd555d577
|
||||
+.BR "info grub"
|
||||
diff --git a/util/grub-install.8 b/util/grub-install.8
|
||||
new file mode 100644
|
||||
index 00000000000..76272a39d2e
|
||||
index 00000000000..1db89e94b3b
|
||||
--- /dev/null
|
||||
+++ b/util/grub-install.8
|
||||
@@ -0,0 +1,128 @@
|
||||
|
@ -265,7 +265,7 @@ index 00000000000..5d8fcba21aa
|
||||
+OnActiveSec=2min
|
||||
diff --git a/util/grub-set-bootflag.1 b/util/grub-set-bootflag.1
|
||||
new file mode 100644
|
||||
index 00000000000..57801da22a0
|
||||
index 00000000000..f121226b416
|
||||
--- /dev/null
|
||||
+++ b/util/grub-set-bootflag.1
|
||||
@@ -0,0 +1,20 @@
|
||||
|
120
0269-grub-install-disable-support-for-EFI-platforms.patch
Normal file
120
0269-grub-install-disable-support-for-EFI-platforms.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Hlavac <jhlavac@redhat.com>
|
||||
Date: Fri, 20 Nov 2020 23:51:47 +0100
|
||||
Subject: [PATCH] grub-install: disable support for EFI platforms
|
||||
|
||||
For each platform, GRUB is shipped as a kernel image and a set of
|
||||
modules. These files are then used by the grub-install utility to
|
||||
install GRUB on a specific device. However, in order to support UEFI
|
||||
Secure Boot, the resulting EFI binary must be signed by a recognized
|
||||
private key. For this reason, for EFI platforms, most distributions also
|
||||
ship prebuilt EFI binaries signed by a distribution-specific private
|
||||
key. In this case, however, the grub-install utility should not be used
|
||||
because it would overwrite the signed EFI binary.
|
||||
|
||||
The current fix is suboptimal because it preserves all EFI-related code.
|
||||
A better solution could be to modularize the code and provide a
|
||||
build-time option.
|
||||
|
||||
Resolves: rhbz#1737444
|
||||
|
||||
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
|
||||
---
|
||||
util/grub-install.c | 37 ++++++++++++++++---------------------
|
||||
docs/grub.texi | 7 +++++++
|
||||
util/grub-install.8 | 4 +++-
|
||||
3 files changed, 26 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index dddb7576c97..b3f5e414052 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -899,6 +899,22 @@ main (int argc, char *argv[])
|
||||
|
||||
platform = grub_install_get_target (grub_install_source_directory);
|
||||
|
||||
+ switch (platform)
|
||||
+ {
|
||||
+ case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||
+ case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
||||
+ case GRUB_INSTALL_PLATFORM_I386_EFI:
|
||||
+ case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||
+ case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
||||
+ is_efi = 1;
|
||||
+ grub_util_error (_("this utility cannot be used for EFI platforms"
|
||||
+ " because it does not support UEFI Secure Boot"));
|
||||
+ break;
|
||||
+ default:
|
||||
+ is_efi = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
{
|
||||
char *platname = grub_install_get_platform_name (platform);
|
||||
fprintf (stderr, _("Installing for %s platform.\n"), platname);
|
||||
@@ -1011,28 +1027,7 @@ main (int argc, char *argv[])
|
||||
grub_hostfs_init ();
|
||||
grub_host_init ();
|
||||
|
||||
- switch (platform)
|
||||
- {
|
||||
- case GRUB_INSTALL_PLATFORM_I386_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
|
||||
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||
- is_efi = 1;
|
||||
- break;
|
||||
- default:
|
||||
- is_efi = 0;
|
||||
- break;
|
||||
-
|
||||
- /* pacify warning. */
|
||||
- case GRUB_INSTALL_PLATFORM_MAX:
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
/* Find the EFI System Partition. */
|
||||
-
|
||||
if (is_efi)
|
||||
{
|
||||
grub_fs_t fs;
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index 495462b8e48..085b9974cc5 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -6293,6 +6293,13 @@ grub2-install @var{install_device}
|
||||
The device name @var{install_device} is an OS device name or a GRUB
|
||||
device name.
|
||||
|
||||
+In order to support UEFI Secure Boot, the resulting GRUB EFI binary must
|
||||
+be signed by a recognized private key. For this reason, for EFI
|
||||
+platforms, most distributions also ship prebuilt GRUB EFI binaries
|
||||
+signed by a distribution-specific private key. In this case, however,
|
||||
+@command{grub2-install} should not be used because it would overwrite
|
||||
+the signed EFI binary.
|
||||
+
|
||||
@command{grub2-install} accepts the following options:
|
||||
|
||||
@table @option
|
||||
diff --git a/util/grub-install.8 b/util/grub-install.8
|
||||
index 1db89e94b3b..811d441b16c 100644
|
||||
--- a/util/grub-install.8
|
||||
+++ b/util/grub-install.8
|
||||
@@ -1,4 +1,4 @@
|
||||
-.TH GRUB-INSTALL 1 "Wed Feb 26 2014"
|
||||
+.TH GRUB-INSTALL 1 "Fri Nov 20 2020"
|
||||
.SH NAME
|
||||
\fBgrub-install\fR \(em Install GRUB on a device.
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
.SH DESCRIPTION
|
||||
\fBgrub-install\fR installs GRUB onto a device. This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector.
|
||||
|
||||
+In order to support UEFI Secure Boot, the resulting GRUB EFI binary must be signed by a recognized private key. For this reason, for EFI platforms, most distributions also ship prebuilt GRUB EFI binaries signed by a distribution-specific private key. In this case, however, the \fBgrub-install\fR utility should not be used because it would overwrite the signed EFI binary.
|
||||
+
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB--modules\fR=\fIMODULES\fR\!
|
112
0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch
Normal file
112
0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch
Normal file
@ -0,0 +1,112 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Sat, 23 Nov 2019 14:57:41 +0100
|
||||
Subject: [PATCH] New --with-debug-timestamps configure flag to prepend debug
|
||||
traces with absolute and relative timestamp
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
---
|
||||
configure.ac | 18 ++++++++++++++++++
|
||||
grub-core/kern/misc.c | 20 ++++++++++++++++++++
|
||||
config.h.in | 1 +
|
||||
3 files changed, 39 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5d3316185da..d150a2e4a9c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1555,6 +1555,17 @@ else
|
||||
fi
|
||||
AC_SUBST([BOOT_TIME_STATS])
|
||||
|
||||
+AC_ARG_WITH([debug-timestamps],
|
||||
+ AS_HELP_STRING([--with-debug-timestamps],
|
||||
+ [prepend debug traces with absolute and relative timestamps]))
|
||||
+
|
||||
+if test x$with_debug_timestamps = xyes; then
|
||||
+ DEBUG_WITH_TIMESTAMPS=1
|
||||
+else
|
||||
+ DEBUG_WITH_TIMESTAMPS=0
|
||||
+fi
|
||||
+AC_SUBST([DEBUG_WITH_TIMESTAMPS])
|
||||
+
|
||||
AC_ARG_ENABLE([grub-emu-sdl],
|
||||
[AS_HELP_STRING([--enable-grub-emu-sdl],
|
||||
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
|
||||
@@ -2142,6 +2153,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
|
||||
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
||||
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
||||
AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
|
||||
+AM_CONDITIONAL([COND_DEBUG_WITH_TIMESTAMPS], [test x$DEBUG_WITH_TIMESTAMPS = x1])
|
||||
|
||||
AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
|
||||
|
||||
@@ -2237,6 +2249,12 @@ else
|
||||
echo With boot time statistics: No
|
||||
fi
|
||||
|
||||
+if [ x"$with_debug_timestamps" = xyes ]; then
|
||||
+echo Debug traces with timestamps: Yes
|
||||
+else
|
||||
+echo Debug traces with timestamps: No
|
||||
+fi
|
||||
+
|
||||
if [ x"$efiemu_excuse" = x ]; then
|
||||
echo efiemu runtime: Yes
|
||||
else
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index dc5e10b651a..bc23945a3c2 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -25,6 +25,9 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/backtrace.h>
|
||||
+#if DEBUG_WITH_TIMESTAMPS
|
||||
+#include <grub/time.h>
|
||||
+#endif
|
||||
|
||||
union printf_arg
|
||||
{
|
||||
@@ -191,9 +194,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
+#if DEBUG_WITH_TIMESTAMPS
|
||||
+ static long unsigned int last_time = 0;
|
||||
+ static int last_had_cr = 1;
|
||||
+#endif
|
||||
|
||||
if (grub_debug_enabled (condition))
|
||||
{
|
||||
+#if DEBUG_WITH_TIMESTAMPS
|
||||
+ /* Don't print timestamp if last printed message isn't terminated yet */
|
||||
+ if (last_had_cr) {
|
||||
+ long unsigned int tmabs = (long unsigned int) grub_get_time_ms();
|
||||
+ long unsigned int tmrel = tmabs - last_time;
|
||||
+ last_time = tmabs;
|
||||
+ grub_printf ("%3lu.%03lus +%2lu.%03lus ", tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000);
|
||||
+ }
|
||||
+ if (fmt[grub_strlen(fmt)-1] == '\n')
|
||||
+ last_had_cr = 1;
|
||||
+ else
|
||||
+ last_had_cr = 0;
|
||||
+#endif
|
||||
grub_printf ("%s:%d: ", file, line);
|
||||
va_start (args, fmt);
|
||||
grub_vprintf (fmt, args);
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index c7e316f0f1f..c80e3e0aba3 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -12,6 +12,7 @@
|
||||
/* Define to 1 to enable disk cache statistics. */
|
||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
||||
+#define DEBUG_WITH_TIMESTAMPS @DEBUG_WITH_TIMESTAMPS@
|
||||
|
||||
/* We don't need those. */
|
||||
#define MINILZO_CFG_SKIP_LZO_PTR 1
|
@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Sat, 23 Nov 2019 15:22:16 +0100
|
||||
Subject: [PATCH] Added debug statements to grub_disk_open() and
|
||||
grub_disk_close() on success
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
---
|
||||
grub-core/kern/disk.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c
|
||||
index ffb09c8eefb..141b40de473 100644
|
||||
--- a/grub-core/kern/disk.c
|
||||
+++ b/grub-core/kern/disk.c
|
||||
@@ -285,6 +285,8 @@ grub_disk_open (const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ grub_dprintf ("disk", "Opening `%s' succeeded.\n", name);
|
||||
+
|
||||
return disk;
|
||||
}
|
||||
|
||||
@@ -292,7 +294,7 @@ void
|
||||
grub_disk_close (grub_disk_t disk)
|
||||
{
|
||||
grub_partition_t part;
|
||||
- grub_dprintf ("disk", "Closing `%s'.\n", disk->name);
|
||||
+ grub_dprintf ("disk", "Closing `%s'...\n", disk->name);
|
||||
|
||||
if (disk->dev && disk->dev->disk_close)
|
||||
(disk->dev->disk_close) (disk);
|
||||
@@ -306,8 +308,10 @@ grub_disk_close (grub_disk_t disk)
|
||||
grub_free (disk->partition);
|
||||
disk->partition = part;
|
||||
}
|
||||
+ grub_dprintf ("disk", "Closing `%s' succeeded.\n", disk->name);
|
||||
grub_free ((void *) disk->name);
|
||||
grub_free (disk);
|
||||
+
|
||||
}
|
||||
|
||||
/* Small read (less than cache size and not pass across cache unit boundaries).
|
@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 09:29:53 +0100
|
||||
Subject: [PATCH] Introduce function grub_debug_is_enabled(void) returning 1 if
|
||||
'debug' is in the environment and not empty
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
---
|
||||
grub-core/kern/misc.c | 13 +++++++++++++
|
||||
include/grub/misc.h | 1 +
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index bc23945a3c2..d729b439072 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -162,6 +162,19 @@ int grub_err_printf (const char *fmt, ...)
|
||||
__attribute__ ((alias("grub_printf")));
|
||||
#endif
|
||||
|
||||
+/* Return 1 if 'debug' is set and not empty */
|
||||
+int
|
||||
+grub_debug_is_enabled (void)
|
||||
+{
|
||||
+ const char *debug;
|
||||
+
|
||||
+ debug = grub_env_get ("debug");
|
||||
+ if (!debug || debug[0] == '\0')
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int
|
||||
grub_debug_enabled (const char * condition)
|
||||
{
|
||||
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
||||
index 998e47e0ccf..f05e1947c4a 100644
|
||||
--- a/include/grub/misc.h
|
||||
+++ b/include/grub/misc.h
|
||||
@@ -385,6 +385,7 @@ grub_puts (const char *s)
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_puts_) (const char *s);
|
||||
+int EXPORT_FUNC(grub_debug_is_enabled) (void);
|
||||
int EXPORT_FUNC(grub_debug_enabled) (const char *condition);
|
||||
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
||||
const int line,
|
27
0273-Don-t-clear-screen-when-debugging-is-enabled.patch
Normal file
27
0273-Don-t-clear-screen-when-debugging-is-enabled.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Sat, 23 Nov 2019 16:23:54 +0100
|
||||
Subject: [PATCH] Don't clear screen when debugging is enabled
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
---
|
||||
grub-core/normal/main.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index f7ee912e715..abdccc86a59 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -210,7 +210,8 @@ void
|
||||
grub_normal_init_page (struct grub_term_output *term,
|
||||
int y __attribute__((__unused__)))
|
||||
{
|
||||
- grub_term_cls (term);
|
||||
+ if (! grub_debug_is_enabled ())
|
||||
+ grub_term_cls (term);
|
||||
|
||||
#if 0
|
||||
grub_ssize_t msg_len;
|
71
0274-grub_file_-instrumentation-new-file-debug-tag.patch
Normal file
71
0274-grub_file_-instrumentation-new-file-debug-tag.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Fri, 29 Nov 2019 11:02:00 +0100
|
||||
Subject: [PATCH] grub_file_* instrumentation (new 'file' debug tag)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
---
|
||||
grub-core/kern/file.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c
|
||||
index 58454458c47..e19aea3e514 100644
|
||||
--- a/grub-core/kern/file.c
|
||||
+++ b/grub-core/kern/file.c
|
||||
@@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
||||
const char *file_name;
|
||||
grub_file_filter_id_t filter;
|
||||
|
||||
+ grub_dprintf ("file", "Opening `%s' ...\n", name);
|
||||
+
|
||||
device_name = grub_file_get_device_name (name);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
@@ -128,6 +130,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
||||
if (!file)
|
||||
grub_file_close (last_file);
|
||||
|
||||
+ grub_dprintf ("file", "Opening `%s' succeeded.\n", name);
|
||||
+
|
||||
return file;
|
||||
|
||||
fail:
|
||||
@@ -138,6 +142,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
||||
|
||||
grub_free (file);
|
||||
|
||||
+ grub_dprintf ("file", "Opening `%s' failed.\n", name);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -169,6 +175,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
||||
|
||||
if (len == 0)
|
||||
return 0;
|
||||
+
|
||||
read_hook = file->read_hook;
|
||||
read_hook_data = file->read_hook_data;
|
||||
if (!file->read_hook)
|
||||
@@ -189,11 +196,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
||||
grub_err_t
|
||||
grub_file_close (grub_file_t file)
|
||||
{
|
||||
+ grub_dprintf ("file", "Closing `%s' ...\n", file->name);
|
||||
if (file->fs->fs_close)
|
||||
(file->fs->fs_close) (file);
|
||||
|
||||
if (file->device)
|
||||
grub_device_close (file->device);
|
||||
+
|
||||
+ if (grub_errno == GRUB_ERR_NONE)
|
||||
+ grub_dprintf ("file", "Closing `%s' succeeded.\n", file->name);
|
||||
+ else
|
||||
+ grub_dprintf ("file", "Closing `%s' failed with %d.\n", file->name, grub_errno);
|
||||
+
|
||||
grub_free (file->name);
|
||||
grub_free (file);
|
||||
return grub_errno;
|
136
0275-ieee1275-Avoiding-many-unecessary-open-close.patch
Normal file
136
0275-ieee1275-Avoiding-many-unecessary-open-close.patch
Normal file
@ -0,0 +1,136 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Diego Domingos <diegodo@br.ibm.com>
|
||||
Date: Mon, 14 Dec 2020 17:42:45 +0100
|
||||
Subject: [PATCH] ieee1275: Avoiding many unecessary open/close
|
||||
|
||||
Signed-off-by: Diego Domingos <diegodo@br.ibm.com>
|
||||
---
|
||||
grub-core/disk/ieee1275/ofdisk.c | 64 ++++++++++++++++++++++------------------
|
||||
1 file changed, 35 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
|
||||
index 03674cb477e..ea7f78ac7d8 100644
|
||||
--- a/grub-core/disk/ieee1275/ofdisk.c
|
||||
+++ b/grub-core/disk/ieee1275/ofdisk.c
|
||||
@@ -44,7 +44,7 @@ struct ofdisk_hash_ent
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
-grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size,
|
||||
+grub_ofdisk_get_block_size (grub_uint32_t *block_size,
|
||||
struct ofdisk_hash_ent *op);
|
||||
|
||||
#define OFDISK_HASH_SZ 8
|
||||
@@ -461,6 +461,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
||||
grub_ssize_t actual;
|
||||
grub_uint32_t block_size = 0;
|
||||
grub_err_t err;
|
||||
+ struct ofdisk_hash_ent *op;
|
||||
|
||||
if (grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) != 0)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
@@ -471,6 +472,35 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
||||
|
||||
grub_dprintf ("disk", "Opening `%s'.\n", devpath);
|
||||
|
||||
+ op = ofdisk_hash_find (devpath);
|
||||
+ if (!op)
|
||||
+ op = ofdisk_hash_add (devpath, NULL);
|
||||
+ if (!op)
|
||||
+ {
|
||||
+ grub_free (devpath);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
+ /* Check if the call to open is the same to the last disk already opened */
|
||||
+ if (last_devpath && !grub_strcmp(op->open_path,last_devpath))
|
||||
+ {
|
||||
+ goto finish;
|
||||
+ }
|
||||
+
|
||||
+ /* If not, we need to close the previous disk and open the new one */
|
||||
+ else {
|
||||
+ if (last_ihandle){
|
||||
+ grub_ieee1275_close (last_ihandle);
|
||||
+ }
|
||||
+ last_ihandle = 0;
|
||||
+ last_devpath = NULL;
|
||||
+
|
||||
+ grub_ieee1275_open (op->open_path, &last_ihandle);
|
||||
+ if (! last_ihandle)
|
||||
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||||
+ last_devpath = op->open_path;
|
||||
+ }
|
||||
+
|
||||
if (grub_ieee1275_finddevice (devpath, &dev))
|
||||
{
|
||||
grub_free (devpath);
|
||||
@@ -491,25 +521,18 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device");
|
||||
}
|
||||
|
||||
+
|
||||
+ finish:
|
||||
/* XXX: There is no property to read the number of blocks. There
|
||||
should be a property `#blocks', but it is not there. Perhaps it
|
||||
is possible to use seek for this. */
|
||||
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||
|
||||
{
|
||||
- struct ofdisk_hash_ent *op;
|
||||
- op = ofdisk_hash_find (devpath);
|
||||
- if (!op)
|
||||
- op = ofdisk_hash_add (devpath, NULL);
|
||||
- if (!op)
|
||||
- {
|
||||
- grub_free (devpath);
|
||||
- return grub_errno;
|
||||
- }
|
||||
disk->id = (unsigned long) op;
|
||||
disk->data = op->open_path;
|
||||
|
||||
- err = grub_ofdisk_get_block_size (devpath, &block_size, op);
|
||||
+ err = grub_ofdisk_get_block_size (&block_size, op);
|
||||
if (err)
|
||||
{
|
||||
grub_free (devpath);
|
||||
@@ -532,13 +555,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
||||
static void
|
||||
grub_ofdisk_close (grub_disk_t disk)
|
||||
{
|
||||
- if (disk->data == last_devpath)
|
||||
- {
|
||||
- if (last_ihandle)
|
||||
- grub_ieee1275_close (last_ihandle);
|
||||
- last_ihandle = 0;
|
||||
- last_devpath = NULL;
|
||||
- }
|
||||
disk->data = 0;
|
||||
}
|
||||
|
||||
@@ -685,7 +701,7 @@ grub_ofdisk_init (void)
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
-grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size,
|
||||
+grub_ofdisk_get_block_size (grub_uint32_t *block_size,
|
||||
struct ofdisk_hash_ent *op)
|
||||
{
|
||||
struct size_args_ieee1275
|
||||
@@ -698,16 +714,6 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size,
|
||||
grub_ieee1275_cell_t size2;
|
||||
} args_ieee1275;
|
||||
|
||||
- if (last_ihandle)
|
||||
- grub_ieee1275_close (last_ihandle);
|
||||
-
|
||||
- last_ihandle = 0;
|
||||
- last_devpath = NULL;
|
||||
-
|
||||
- grub_ieee1275_open (device, &last_ihandle);
|
||||
- if (! last_ihandle)
|
||||
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||||
-
|
||||
*block_size = 0;
|
||||
|
||||
if (op->block_size_fails >= 2)
|
@ -0,0 +1,90 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Diego Domingos <diegodo@br.ibm.com>
|
||||
Date: Mon, 14 Dec 2020 17:45:28 +0100
|
||||
Subject: [PATCH] ieee1275/powerpc: implements fibre channel discovery for
|
||||
ofpathname
|
||||
|
||||
grub-ofpathname doesn't work with fibre channel because there is no
|
||||
function currently implemented for it.
|
||||
This patch enables it by prividing a function that looks for the port
|
||||
name, building the entire path for OF devices.
|
||||
|
||||
Signed-off-by: Diego Domingos <diegodo@br.ibm.com>
|
||||
---
|
||||
grub-core/osdep/linux/ofpath.c | 49 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 49 insertions(+)
|
||||
|
||||
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
|
||||
index a6153d35954..0f5d54e9f2d 100644
|
||||
--- a/grub-core/osdep/linux/ofpath.c
|
||||
+++ b/grub-core/osdep/linux/ofpath.c
|
||||
@@ -350,6 +350,38 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi
|
||||
return ret;
|
||||
}
|
||||
|
||||
+
|
||||
+static void
|
||||
+of_fc_port_name(const char *path, const char *subpath, char *port_name)
|
||||
+{
|
||||
+ char *bname, *basepath, *p;
|
||||
+ int fd;
|
||||
+
|
||||
+ bname = xmalloc(sizeof(char)*150);
|
||||
+ basepath = xmalloc(strlen(path));
|
||||
+
|
||||
+ /* Generate the path to get port name information from the drive */
|
||||
+ strncpy(basepath,path,subpath-path);
|
||||
+ basepath[subpath-path-1] = '\0';
|
||||
+ p = get_basename(basepath);
|
||||
+ snprintf(bname,sizeof(char)*150,"%s/fc_transport/%s/port_name",basepath,p);
|
||||
+
|
||||
+ /* Read the information from the port name */
|
||||
+ fd = open (bname, O_RDONLY);
|
||||
+ if (fd < 0)
|
||||
+ grub_util_error (_("cannot open `%s': %s"), bname, strerror (errno));
|
||||
+
|
||||
+ if (read(fd,port_name,sizeof(char)*19) < 0)
|
||||
+ grub_util_error (_("cannot read `%s': %s"), bname, strerror (errno));
|
||||
+
|
||||
+ sscanf(port_name,"0x%s",port_name);
|
||||
+
|
||||
+ close(fd);
|
||||
+
|
||||
+ free(bname);
|
||||
+ free(basepath);
|
||||
+}
|
||||
+
|
||||
#ifdef __sparc__
|
||||
static char *
|
||||
of_path_of_nvme(const char *sys_devname __attribute__((unused)),
|
||||
@@ -577,6 +609,16 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev
|
||||
digit_string = trailing_digits (device);
|
||||
if (strncmp (of_path, "/vdevice/", sizeof ("/vdevice/") - 1) == 0)
|
||||
{
|
||||
+ if(strstr(of_path,"vfc-client"))
|
||||
+ {
|
||||
+ char * port_name = xmalloc(sizeof(char)*17);
|
||||
+ of_fc_port_name(sysfs_path, p, port_name);
|
||||
+
|
||||
+ snprintf(disk,sizeof(disk),"/%s@%s", disk_name, port_name);
|
||||
+ free(port_name);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
unsigned long id = 0x8000 | (tgt << 8) | (bus << 5) | lun;
|
||||
if (*digit_string == '\0')
|
||||
{
|
||||
@@ -590,6 +632,13 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev
|
||||
snprintf(disk, sizeof (disk),
|
||||
"/%s@%04lx000000000000:%c", disk_name, id, 'a' + (part - 1));
|
||||
}
|
||||
+ }
|
||||
+ } else if (strstr(of_path,"fibre-channel")||(strstr(of_path,"vfc-client"))){
|
||||
+ char * port_name = xmalloc(sizeof(char)*17);
|
||||
+ of_fc_port_name(sysfs_path, p, port_name);
|
||||
+
|
||||
+ snprintf(disk,sizeof(disk),"/%s@%s", disk_name, port_name);
|
||||
+ free(port_name);
|
||||
}
|
||||
else
|
||||
{
|
106
0277-ieee1275-powerpc-enables-device-mapper-discovery.patch
Normal file
106
0277-ieee1275-powerpc-enables-device-mapper-discovery.patch
Normal file
@ -0,0 +1,106 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Diego Domingos <diegodo@br.ibm.com>
|
||||
Date: Mon, 14 Dec 2020 17:47:16 +0100
|
||||
Subject: [PATCH] ieee1275/powerpc: enables device mapper discovery
|
||||
|
||||
this patch enables the device mapper discovery on ofpath.c. Currently,
|
||||
when we are dealing with a device like /dev/dm-* the ofpath returns null
|
||||
since there is no function implemented to handle this case.
|
||||
|
||||
This patch implements a function that will look into /sys/block/dm-*
|
||||
devices and search recursively inside slaves directory to find the root
|
||||
disk.
|
||||
|
||||
Signed-off-by: Diego Domingos <diegodo@br.ibm.com>
|
||||
---
|
||||
grub-core/osdep/linux/ofpath.c | 64 +++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 63 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
|
||||
index 0f5d54e9f2d..cc849d9c94c 100644
|
||||
--- a/grub-core/osdep/linux/ofpath.c
|
||||
+++ b/grub-core/osdep/linux/ofpath.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
+#include <dirent.h>
|
||||
|
||||
#ifdef __sparc__
|
||||
typedef enum
|
||||
@@ -755,13 +756,74 @@ strip_trailing_digits (const char *p)
|
||||
return new;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+get_slave_from_dm(const char * device){
|
||||
+ char *curr_device, *tmp;
|
||||
+ char *directory;
|
||||
+ char *ret = NULL;
|
||||
+
|
||||
+ directory = grub_strdup (device);
|
||||
+ tmp = get_basename(directory);
|
||||
+ curr_device = grub_strdup (tmp);
|
||||
+ *tmp = '\0';
|
||||
+
|
||||
+ /* Recursively check for slaves devices so we can find the root device */
|
||||
+ while ((curr_device[0] == 'd') && (curr_device[1] == 'm') && (curr_device[2] == '-')){
|
||||
+ DIR *dp;
|
||||
+ struct dirent *ep;
|
||||
+ char* device_path;
|
||||
+
|
||||
+ device_path = grub_xasprintf ("/sys/block/%s/slaves", curr_device);
|
||||
+ dp = opendir(device_path);
|
||||
+ free(device_path);
|
||||
+
|
||||
+ if (dp != NULL)
|
||||
+ {
|
||||
+ ep = readdir (dp);
|
||||
+ while (ep != NULL){
|
||||
+
|
||||
+ /* avoid some system directories */
|
||||
+ if (!strcmp(ep->d_name,"."))
|
||||
+ goto next_dir;
|
||||
+ if (!strcmp(ep->d_name,".."))
|
||||
+ goto next_dir;
|
||||
+
|
||||
+ free (curr_device);
|
||||
+ free (ret);
|
||||
+ curr_device = grub_strdup (ep->d_name);
|
||||
+ ret = grub_xasprintf ("%s%s", directory, curr_device);
|
||||
+ break;
|
||||
+
|
||||
+ next_dir:
|
||||
+ ep = readdir (dp);
|
||||
+ continue;
|
||||
+ }
|
||||
+ closedir (dp);
|
||||
+ }
|
||||
+ else
|
||||
+ grub_util_warn (_("cannot open directory `%s'"), device_path);
|
||||
+ }
|
||||
+
|
||||
+ free (directory);
|
||||
+ free (curr_device);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
char *
|
||||
grub_util_devname_to_ofpath (const char *sys_devname)
|
||||
{
|
||||
- char *name_buf, *device, *devnode, *devicenode, *ofpath;
|
||||
+ char *name_buf, *device, *devnode, *devicenode, *ofpath, *realname;
|
||||
|
||||
name_buf = xrealpath (sys_devname);
|
||||
|
||||
+ realname = get_slave_from_dm (name_buf);
|
||||
+ if (realname)
|
||||
+ {
|
||||
+ free (name_buf);
|
||||
+ name_buf = realname;
|
||||
+ }
|
||||
+
|
||||
device = get_basename (name_buf);
|
||||
devnode = strip_trailing_digits (name_buf);
|
||||
devicenode = strip_trailing_digits (device);
|
51
0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch
Normal file
51
0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dave@jikos.cz>
|
||||
Date: Mon, 4 Nov 2019 17:23:22 +0100
|
||||
Subject: [PATCH] btrfs: Add support for new RAID1C34 profiles
|
||||
|
||||
New 3- and 4-copy variants of RAID1 were merged into Linux kernel 5.5.
|
||||
Add the two new profiles to the list of recognized ones. As this builds
|
||||
on the same code as RAID1, only the redundancy level needs to be
|
||||
adjusted, the rest is done by the existing code.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index 0d8c666aea1..78f5de37b27 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -144,6 +144,8 @@ struct grub_btrfs_chunk_item
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID10 0x40
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID5 0x80
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100
|
||||
+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C3 0x200
|
||||
+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C4 0x400
|
||||
grub_uint8_t dummy2[0xc];
|
||||
grub_uint16_t nstripes;
|
||||
grub_uint16_t nsubstripes;
|
||||
@@ -1003,14 +1005,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
csize = (stripen + 1) * stripe_length - off;
|
||||
break;
|
||||
}
|
||||
+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C4:
|
||||
+ redundancy++;
|
||||
+ /* fall through */
|
||||
+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C3:
|
||||
+ redundancy++;
|
||||
+ /* fall through */
|
||||
case GRUB_BTRFS_CHUNK_TYPE_DUPLICATED:
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID1:
|
||||
{
|
||||
- grub_dprintf ("btrfs", "RAID1\n");
|
||||
+ grub_dprintf ("btrfs", "RAID1 (copies: %d)\n", ++redundancy);
|
||||
stripen = 0;
|
||||
stripe_offset = off;
|
||||
csize = grub_le_to_cpu64 (chunk->size) - off;
|
||||
- redundancy = 2;
|
||||
break;
|
||||
}
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID0:
|
10
grub.patches
10
grub.patches
@ -266,3 +266,13 @@ Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch
|
||||
Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch
|
||||
Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch
|
||||
Patch0268: 0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch
|
||||
Patch0269: 0269-grub-install-disable-support-for-EFI-platforms.patch
|
||||
Patch0270: 0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch
|
||||
Patch0271: 0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch
|
||||
Patch0272: 0272-Introduce-function-grub_debug_is_enabled-void-return.patch
|
||||
Patch0273: 0273-Don-t-clear-screen-when-debugging-is-enabled.patch
|
||||
Patch0274: 0274-grub_file_-instrumentation-new-file-debug-tag.patch
|
||||
Patch0275: 0275-ieee1275-Avoiding-many-unecessary-open-close.patch
|
||||
Patch0276: 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch
|
||||
Patch0277: 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch
|
||||
Patch0278: 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch
|
||||
|
11
grub2.spec
11
grub2.spec
@ -14,7 +14,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.04
|
||||
Release: 32%{?dist}
|
||||
Release: 33%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -518,6 +518,15 @@ rm -r /boot/grub2.tmp/ || :
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Dec 31 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-33
|
||||
- Add DNF protected.d fragments for GRUB packages
|
||||
Resolves: rhbz#1874541
|
||||
- Include keylayouts and at_keyboard modules in EFI builds
|
||||
- Add GRUB enhanced debugging features
|
||||
- ieee1275: Avoiding many unecessary open/close
|
||||
- ieee1275: device mapper and fibre channel discovery support
|
||||
- Fix tps-rpmtest failing due /boot/grub2/grubenv attributes mismatch
|
||||
|
||||
* Thu Nov 12 2020 Peter Hazenberg <fedoraproject@haas-en-berg.nl> - 2.04-32
|
||||
- Fixed some typos in grub-install.8 man page
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user