emu: support newer kexec syscall

Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
Robbie Harwood 2023-02-06 22:43:11 +00:00
parent a5299c3192
commit ed1787d5fc
263 changed files with 489 additions and 474 deletions

View File

@ -55,7 +55,7 @@ index 88f55e35c4..bda9fd1211 100644
library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 5354f9613d..4b7c45a7b0 100644
index 058c88ac3a..52ec0fafcd 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -142,6 +142,12 @@ kernel = {
@ -81,7 +81,7 @@ index 5354f9613d..4b7c45a7b0 100644
i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c;
@@ -2398,15 +2401,12 @@ module = {
@@ -2399,15 +2402,12 @@ module = {
module = {
name = backtrace;
@ -897,7 +897,7 @@ index 03b916f053..701bf63abc 100644
ba codestart
mov %o4, %o0
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 80e7a83edf..f512573c0d 100644
index ee88e44e97..bfd29a3bf0 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h

View File

@ -57,10 +57,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/net/efi.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 4b7c45a7b0..c40170f2dd 100644
index 52ec0fafcd..12797336c9 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2299,6 +2299,12 @@ module = {
@@ -2300,6 +2300,12 @@ module = {
common = hook/datehook.c;
};
@ -73,7 +73,7 @@ index 4b7c45a7b0..c40170f2dd 100644
module = {
name = net;
common = net/net.c;
@@ -2312,6 +2318,12 @@ module = {
@@ -2313,6 +2319,12 @@ module = {
common = net/ethernet.c;
common = net/arp.c;
common = net/netbuff.c;

View File

@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index c40170f2dd..84a3d89de9 100644
index 12797336c9..4e7d90da76 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -177,7 +177,6 @@ kernel = {
@ -53,7 +53,7 @@ index c40170f2dd..84a3d89de9 100644
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1836,7 +1836,6 @@ module = {
@@ -1837,7 +1837,6 @@ module = {
module = {
name = fdt;
efi = loader/efi/fdt.c;
@ -110,7 +110,7 @@ index e609c7e411..3514aa4a5b 100644
+
#endif /* ! GRUB_FDT_HEADER */
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f512573c0d..dd49939aaa 100644
index bfd29a3bf0..c2e8a82bce 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h

View File

@ -43,7 +43,7 @@ index 54462e0892..7b4e1854d3 100644
have_with_bootdir=n
AC_ARG_WITH([bootdir],
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 84a3d89de9..498ca11762 100644
index 4e7d90da76..4f203533f5 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -579,6 +579,11 @@ image = {

View File

@ -18,10 +18,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
10 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index eeea092752..f08a1bb841 100644
index 0ff13bcaf8..d278c2921f 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path)
@@ -185,7 +185,7 @@ grub_util_get_image_size (const char *path)
sz = ftello (f);
if (sz < 0)
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));

View File

@ -40,7 +40,7 @@ index d066652e9b..e10fe766d1 100644
name = '01_menu_auto_hide';
common = util/grub.d/01_menu_auto_hide.in;
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 498ca11762..1e15345107 100644
index 4f203533f5..ea4d59f51b 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -398,6 +398,11 @@ kernel = {

View File

@ -21,7 +21,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 grub-core/commands/efi/env.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 1e15345107..81fc274148 100644
index ea4d59f51b..dc9fea6f44 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -820,6 +820,12 @@ module = {

View File

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 9 Apr 2019 12:30:38 +0200
Subject: [PATCH] Fix systemctl kexec exit status check
There's always an error printed even when the systemctl kexec command does
succeed. That's because systemctl executes it asynchronously, but the emu
loader seems to expect it to be synchronous and that should never return.
Also, it's wrong to test if kexecute == 1 since we already know that's the
case or otherwise the function wouldn't had called grub_fatal() earlier.
Finally, systemctl kexec failing shouldn't be a fatal error since the emu
loader fallbacks to executing the kexec command in case of a failure.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/loader/emu/linux.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
index fda9e00d24..5b85b225ee 100644
--- a/grub-core/loader/emu/linux.c
+++ b/grub-core/loader/emu/linux.c
@@ -71,8 +71,10 @@ grub_linux_boot (void)
(kexecute==1) ? "do-or-die" : "just-in-case");
rc = grub_util_exec (systemctl);
- if (kexecute == 1)
- grub_fatal (N_("Error trying to perform 'systemctl kexec'"));
+ if (rc == GRUB_ERR_NONE)
+ return rc;
+
+ grub_error (rc, N_("Error trying to perform 'systemctl kexec'"));
/* need to check read-only root before resetting hard!? */
grub_printf("Performing 'kexec -e'");

View File

@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 9 Apr 2019 12:42:37 +0200
Subject: [PATCH] Print grub-emu linux loader messages as debug
They just polute the output and should better be debug messages instead.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/loader/emu/linux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
index 5b85b225ee..22ab6af172 100644
--- a/grub-core/loader/emu/linux.c
+++ b/grub-core/loader/emu/linux.c
@@ -50,7 +50,7 @@ grub_linux_boot (void)
initrd_param = grub_xasprintf("%s", "");
}
- grub_printf("%serforming 'kexec -l %s %s %s'\n",
+ grub_dprintf ("linux", "%serforming 'kexec -l %s %s %s'\n",
(kexecute) ? "P" : "Not p",
kernel_path, initrd_param, boot_cmdline);
@@ -67,7 +67,7 @@ grub_linux_boot (void)
if (kexecute < 1)
grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart."));
- grub_printf("Performing 'systemctl kexec' (%s) ",
+ grub_dprintf ("linux", "Performing 'systemctl kexec' (%s) ",
(kexecute==1) ? "do-or-die" : "just-in-case");
rc = grub_util_exec (systemctl);

Some files were not shown because too many files have changed in this diff Show More