mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 06:22:43 +00:00
Fix our linuxefi/linux comand reunion
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
ebe16ceeab
commit
321567331b
12 changed files with 367 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
From a0bf57e044141d5807759da2da67a71d2f7f4f42 Mon Sep 17 00:00:00 2001
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 12 Jul 2018 11:00:45 -0400
|
||||
Subject: [PATCH] Don't build the fdt command
|
||||
|
@ -14,8 +14,6 @@ grub_fdt_install in xen_boot is not defined
|
|||
grub_fdt_load in xen_boot is not defined
|
||||
grub_fdt_unload in xen_boot is not defined
|
||||
|
||||
Don't build the fdt command separately but *do* build it into the arm64 kernel.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/Makefile.core.def | 15 ++++++++++++---
|
||||
|
@ -23,6 +21,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/loader/efi/fdt.c | 22 ++++++++++++++++++++++
|
||||
include/grub/efi/efi.h | 4 ----
|
||||
4 files changed, 34 insertions(+), 50 deletions(-)
|
||||
delete mode 100644 grub-core/kern/efi/fdt.c
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 9039a6f73a3..ff6fa4bd000 100644
|
||||
|
|
29
0382-blscfg-remove-unused-typedef.patch
Normal file
29
0382-blscfg-remove-unused-typedef.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Wed, 11 Jul 2018 14:59:52 +0100
|
||||
Subject: [PATCH] blscfg: remove unused typedef
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is unused since ‘Use BLS fragment filename as menu entry id and for
|
||||
criteria to sort’.
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 23d15adfadc..243fcda57f9 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -327,8 +327,6 @@ finish:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-typedef int (*void_cmp_t)(void *, void *);
|
||||
-
|
||||
static int bls_cmp(const void *p0, const void *p1, void *state UNUSED)
|
||||
{
|
||||
struct bls_entry * e0 = *(struct bls_entry **)p0;
|
45
0383-blscfg-don-t-dynamically-allocate-default_blsdir.patch
Normal file
45
0383-blscfg-don-t-dynamically-allocate-default_blsdir.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Wed, 11 Jul 2018 15:01:45 +0100
|
||||
Subject: [PATCH] blscfg: don't dynamically allocate default_blsdir
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 243fcda57f9..1d0e6ceaf7d 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -623,7 +623,7 @@ static int find_entry (const char *filename,
|
||||
grub_file_t f = NULL;
|
||||
char *grubenv_path = NULL;
|
||||
grub_envblk_t env = NULL;
|
||||
- char *default_blsdir = NULL;
|
||||
+ const char *default_blsdir = NULL;
|
||||
grub_fs_t blsdir_fs = NULL;
|
||||
grub_device_t blsdir_dev = NULL;
|
||||
const char *blsdir = NULL;
|
||||
@@ -643,10 +643,9 @@ static int find_entry (const char *filename,
|
||||
|
||||
// set a default blsdir
|
||||
if (info->platform == PLATFORM_EMU)
|
||||
- default_blsdir = grub_xasprintf ("%s%s", GRUB_BOOT_DEVICE,
|
||||
- GRUB_BLS_CONFIG_PATH);
|
||||
+ default_blsdir = GRUB_BOOT_DEVICE GRUB_BLS_CONFIG_PATH;
|
||||
else
|
||||
- default_blsdir = grub_xasprintf ("%s", GRUB_BLS_CONFIG_PATH);
|
||||
+ default_blsdir = GRUB_BLS_CONFIG_PATH;
|
||||
|
||||
grub_env_set ("blsdir", default_blsdir);
|
||||
grub_dprintf ("blscfg", "default_blsdir: \"%s\"\n", default_blsdir);
|
||||
@@ -788,8 +787,6 @@ finish:
|
||||
if (f)
|
||||
grub_file_close (f);
|
||||
|
||||
- grub_free (default_blsdir);
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
58
0384-blscfg-sort-BLS-entries-by-version-field.patch
Normal file
58
0384-blscfg-sort-BLS-entries-by-version-field.patch
Normal file
|
@ -0,0 +1,58 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Wed, 11 Jul 2018 15:41:09 +0100
|
||||
Subject: [PATCH] blscfg: sort BLS entries by 'version' field
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This partially reverts ‘Use BLS fragment filename as menu entry id and
|
||||
for criteria to sort’. Sorting by filename only gives the correct order
|
||||
if the BLS entries are generated by a version of ostree after this patch
|
||||
https://github.com/ostreedev/ostree/commit/9f48e212a3bf9ed418fb3216e4f834d581bc520e
|
||||
to use the version (higher is newer) in the filename. Older ostrees,
|
||||
including all releases at the time of writing, use the index (lower is
|
||||
newer) in the filename, so sorting by filename produces the reverse
|
||||
order.
|
||||
|
||||
Sorting by 'version' field matches libostree's own
|
||||
compare_boot_loader_configs(), so I think it's more correct than relying
|
||||
on the filename, particularly since we've already gone to the trouble of
|
||||
parsing all the fields in the file.
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 1d0e6ceaf7d..84714f0e534 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -327,10 +327,26 @@ finish:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/* return 1: p0 is newer than p1 */
|
||||
+/* 0: p0 and p1 are the same version */
|
||||
+/* -1: p1 is newer than p0 */
|
||||
static int bls_cmp(const void *p0, const void *p1, void *state UNUSED)
|
||||
{
|
||||
struct bls_entry * e0 = *(struct bls_entry **)p0;
|
||||
struct bls_entry * e1 = *(struct bls_entry **)p1;
|
||||
+ const char *v0, *v1;
|
||||
+ int r;
|
||||
+
|
||||
+ v0 = bls_get_val(e0, "version", NULL);
|
||||
+ v1 = bls_get_val(e1, "version", NULL);
|
||||
+
|
||||
+ if (v0 && !v1)
|
||||
+ return -1;
|
||||
+ if (!v0 && v1)
|
||||
+ return 1;
|
||||
+
|
||||
+ if ((r = vercmp(v0, v1)) != 0)
|
||||
+ return r;
|
||||
|
||||
return vercmp(e0->filename, e1->filename);
|
||||
}
|
48
0385-blscfg-remove-NULL-guards-around-grub_free.patch
Normal file
48
0385-blscfg-remove-NULL-guards-around-grub_free.patch
Normal file
|
@ -0,0 +1,48 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Thu, 12 Jul 2018 10:14:43 +0100
|
||||
Subject: [PATCH] blscfg: remove NULL guards around grub_free()
|
||||
|
||||
The internal implementation of grub_free() is NULL-safe. In emu builds,
|
||||
it just delegates to the host's free(), which is specified by ANSI C to
|
||||
be NULL-safe.
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 23 ++++++-----------------
|
||||
1 file changed, 6 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 84714f0e534..f9a5b2d5afa 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -600,23 +600,12 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile)
|
||||
grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0);
|
||||
|
||||
finish:
|
||||
- if (initrd)
|
||||
- grub_free (initrd);
|
||||
-
|
||||
- if (initrds)
|
||||
- grub_free (initrds);
|
||||
-
|
||||
- if (classes)
|
||||
- grub_free (classes);
|
||||
-
|
||||
- if (args)
|
||||
- grub_free (args);
|
||||
-
|
||||
- if (argv)
|
||||
- grub_free (argv);
|
||||
-
|
||||
- if (src)
|
||||
- grub_free (src);
|
||||
+ grub_free (initrd);
|
||||
+ grub_free (initrds);
|
||||
+ grub_free (classes);
|
||||
+ grub_free (args);
|
||||
+ grub_free (argv);
|
||||
+ grub_free (src);
|
||||
}
|
||||
|
||||
struct find_entry_info {
|
47
0386-blscfg-fix-filename-in-no-linux-key-error.patch
Normal file
47
0386-blscfg-fix-filename-in-no-linux-key-error.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Thu, 12 Jul 2018 10:38:27 +0100
|
||||
Subject: [PATCH] blscfg: fix filename in "no 'linux' key" error
|
||||
|
||||
In find_entry(), 'filename' is either NULL or a directory in the ESP.
|
||||
But previously it was passed to create_entry(), which uses it in an
|
||||
error message as if it's the filename of the BLS entry in question.
|
||||
|
||||
Since bls_entry now has a 'filename' field, just use that.
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index f9a5b2d5afa..077ca5dfbe6 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -514,7 +514,7 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num)
|
||||
return list;
|
||||
}
|
||||
|
||||
-static void create_entry (struct bls_entry *entry, const char *cfgfile)
|
||||
+static void create_entry (struct bls_entry *entry)
|
||||
{
|
||||
int argc = 0;
|
||||
const char **argv = NULL;
|
||||
@@ -539,7 +539,7 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile)
|
||||
clinux = bls_get_val (entry, "linux", NULL);
|
||||
if (!clinux)
|
||||
{
|
||||
- grub_dprintf ("blscfg", "Skipping file %s with no 'linux' key.\n", cfgfile);
|
||||
+ grub_dprintf ("blscfg", "Skipping file %s with no 'linux' key.\n", entry->filename);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ static int find_entry (const char *filename,
|
||||
|
||||
grub_dprintf ("blscfg", "%s Creating %d entries from bls\n", __func__, nentries);
|
||||
for (r = nentries - 1; r >= 0; r--)
|
||||
- create_entry(entries[r], filename);
|
||||
+ create_entry(entries[r]);
|
||||
|
||||
for (r = 0; r < nentries; r++)
|
||||
bls_free_entry (entries[r]);
|
27
0387-blscfg-don-t-leak-bls_entry.filename.patch
Normal file
27
0387-blscfg-don-t-leak-bls_entry.filename.patch
Normal file
|
@ -0,0 +1,27 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Thu, 12 Jul 2018 10:59:10 +0100
|
||||
Subject: [PATCH] blscfg: don't leak bls_entry.filename
|
||||
|
||||
Zeroing the bls_entry struct before calling grub_free() on one of its
|
||||
fields is not going to work too well.
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 077ca5dfbe6..3339d62d541 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -166,8 +166,8 @@ static void bls_free_entry(struct bls_entry *entry)
|
||||
}
|
||||
|
||||
grub_free (entry->keyvals);
|
||||
- grub_memset (entry, 0, sizeof (*entry));
|
||||
grub_free (entry->filename);
|
||||
+ grub_memset (entry, 0, sizeof (*entry));
|
||||
grub_free (entry);
|
||||
}
|
||||
|
34
0388-blscfg-fix-compilation-on-EFI-and-EMU.patch
Normal file
34
0388-blscfg-fix-compilation-on-EFI-and-EMU.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Will Thompson <wjt@endlessm.com>
|
||||
Date: Thu, 12 Jul 2018 19:00:42 +0100
|
||||
Subject: [PATCH] blscfg: fix compilation on !EFI and !EMU
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Neither GRUB_MACHINE_EFI nor GRUB_MACHINE_EMU are defined when compiling
|
||||
for (eg) i386-pc. In this case, #elif GRUB_MACHINE_EMU is an error:
|
||||
|
||||
commands/blscfg.c: In function ‘grub_cmd_blscfg’:
|
||||
commands/blscfg.c:835:7: error: "GRUB_MACHINE_EMU" is not defined [-Werror=undef]
|
||||
#elif GRUB_MACHINE_EMU
|
||||
^~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Will Thompson <wjt@endlessm.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 3339d62d541..f4283708e21 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -843,7 +843,7 @@ grub_cmd_blscfg (grub_extcmd_context_t ctxt UNUSED,
|
||||
info.platform = PLATFORM_EFI;
|
||||
grub_dprintf ("blscfg", "scanning /EFI/\n");
|
||||
r = fs->dir (dev, "/EFI/", find_entry, &info);
|
||||
-#elif GRUB_MACHINE_EMU
|
||||
+#elif defined(GRUB_MACHINE_EMU)
|
||||
info.platform = PLATFORM_EMU;
|
||||
grub_dprintf ("blscfg", "scanning %s%s\n", GRUB_BOOT_DEVICE,
|
||||
GRUB_BLS_CONFIG_PATH);
|
62
0389-Fix-our-linuxefi-linux-command-reunion.patch
Normal file
62
0389-Fix-our-linuxefi-linux-command-reunion.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
From 23dbe2faf748d828fb847769c16cf97895dc31bb Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 12 Jul 2018 19:39:51 -0400
|
||||
Subject: [PATCH] Fix our linuxefi/linux command reunion.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/Makefile.core.def | 4 ++--
|
||||
grub-core/loader/i386/efi/linux.c | 13 +++++++++++--
|
||||
2 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index ff6fa4bd000..46ebe210263 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -1713,8 +1713,8 @@ module = {
|
||||
|
||||
module = {
|
||||
name = linux;
|
||||
- x86 = loader/i386/linux.c;
|
||||
- x86_efi = loader/i386/efi/linux.c;
|
||||
+ i386_pc = loader/i386/linux.c;
|
||||
+ x86_64_efi = loader/i386/efi/linux.c;
|
||||
i386_efi = loader/i386/efi/linux.c;
|
||||
xen = loader/i386/xen.c;
|
||||
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
||||
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
||||
index 66e58b71e22..498d7ba7158 100644
|
||||
--- a/grub-core/loader/i386/efi/linux.c
|
||||
+++ b/grub-core/loader/i386/efi/linux.c
|
||||
@@ -366,20 +366,29 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
|
||||
static grub_command_t cmd_linux, cmd_initrd;
|
||||
+static grub_command_t cmd_linuxefi, cmd_initrdefi;
|
||||
|
||||
-GRUB_MOD_INIT(linuxefi)
|
||||
+GRUB_MOD_INIT(linux)
|
||||
{
|
||||
cmd_linux =
|
||||
+ grub_register_command ("linux", grub_cmd_linux,
|
||||
+ 0, N_("Load Linux."));
|
||||
+ cmd_linuxefi =
|
||||
grub_register_command ("linuxefi", grub_cmd_linux,
|
||||
0, N_("Load Linux."));
|
||||
cmd_initrd =
|
||||
+ grub_register_command ("initrd", grub_cmd_initrd,
|
||||
+ 0, N_("Load initrd."));
|
||||
+ cmd_initrdefi =
|
||||
grub_register_command ("initrdefi", grub_cmd_initrd,
|
||||
0, N_("Load initrd."));
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
-GRUB_MOD_FINI(linuxefi)
|
||||
+GRUB_MOD_FINI(linux)
|
||||
{
|
||||
grub_unregister_command (cmd_linux);
|
||||
+ grub_unregister_command (cmd_linuxefi);
|
||||
grub_unregister_command (cmd_initrd);
|
||||
+ grub_unregister_command (cmd_initrdefi);
|
||||
}
|
3
Makefile
3
Makefile
|
@ -44,6 +44,9 @@ rebase:
|
|||
rpmspec:
|
||||
rpmspec -D "_sourcedir $(shell pwd)" -P grub2.spec
|
||||
|
||||
rebuild: srpm
|
||||
rpmbuild --rebuild $(SOURCES)
|
||||
|
||||
local prep mockbuild compile :
|
||||
fedpkg $@
|
||||
|
||||
|
|
|
@ -379,3 +379,11 @@ Patch0378: 0378-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch
|
|||
Patch0379: 0379-Make-the-linuxefi-module-just-be-the-x86-efi-version.patch
|
||||
Patch0380: 0380-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch
|
||||
Patch0381: 0381-Don-t-build-the-fdt-command.patch
|
||||
Patch0382: 0382-blscfg-remove-unused-typedef.patch
|
||||
Patch0383: 0383-blscfg-don-t-dynamically-allocate-default_blsdir.patch
|
||||
Patch0384: 0384-blscfg-sort-BLS-entries-by-version-field.patch
|
||||
Patch0385: 0385-blscfg-remove-NULL-guards-around-grub_free.patch
|
||||
Patch0386: 0386-blscfg-fix-filename-in-no-linux-key-error.patch
|
||||
Patch0387: 0387-blscfg-don-t-leak-bls_entry.filename.patch
|
||||
Patch0388: 0388-blscfg-fix-compilation-on-EFI-and-EMU.patch
|
||||
Patch0389: 0389-Fix-our-linuxefi-linux-command-reunion.patch
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.02
|
||||
Release: 40%{?dist}
|
||||
Release: 41%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
Group: System Environment/Base
|
||||
License: GPLv3+
|
||||
|
@ -457,6 +457,9 @@ fi
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jul 12 2018 Peter Jones <pjones@redhat.com> - 2.02-41
|
||||
- Fix our linuxefi/linux command reunion.
|
||||
|
||||
* Wed Jul 11 2018 Peter Jones <pjones@redhat.com> - 2.02-40
|
||||
- Port several fixes from the F28 tree and a WIP tree.
|
||||
|
||||
|
|
Loading…
Reference in a new issue