Cleanup our patchset to reduce the number of patches

This change reorganizes and cleanups our patches to reduce the patch number
from 314 patches to 187. That's achieved by dropping patches that are later
reverted and squashing fixes for earlier patches that introduced features.

There are no code changes and the diff with upstream is the same before and
after the cleanup. Having fewer patches makes easier to manage the patchset
and also will ease to rebase them on top of the latest grub-2.04 release.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2019-07-16 11:23:51 +02:00
parent 18d67626ee
commit 7e98da058f
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
299 changed files with 2816 additions and 11819 deletions

View File

@ -20,11 +20,11 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/mips/arc/init.c | 2 +- grub-core/kern/mips/arc/init.c | 2 +-
grub-core/kern/mips/loongson/init.c | 2 +- grub-core/kern/mips/loongson/init.c | 2 +-
grub-core/kern/mips/qemu_mips/init.c | 2 +- grub-core/kern/mips/qemu_mips/init.c | 2 +-
grub-core/kern/misc.c | 2 +- grub-core/kern/misc.c | 11 ++++++++++-
grub-core/kern/uboot/init.c | 6 +++--- grub-core/kern/uboot/init.c | 6 +++---
grub-core/kern/xen/init.c | 2 +- grub-core/kern/xen/init.c | 2 +-
include/grub/misc.h | 2 +- include/grub/misc.h | 2 +-
14 files changed, 39 insertions(+), 21 deletions(-) 14 files changed, 48 insertions(+), 21 deletions(-)
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
index a3a11824172..b25ca4b9f17 100644 index a3a11824172..b25ca4b9f17 100644
@ -191,10 +191,10 @@ index be88b77d22d..8b6c55ffc01 100644
grub_halt (); grub_halt ();
} }
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 3b633d51f4c..952411d5dc6 100644 index 3b633d51f4c..cd63a8cea73 100644
--- a/grub-core/kern/misc.c --- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c
@@ -1095,7 +1095,7 @@ grub_abort (void) @@ -1095,9 +1095,18 @@ grub_abort (void)
grub_getkey (); grub_getkey ();
} }
@ -202,7 +202,18 @@ index 3b633d51f4c..952411d5dc6 100644
+ grub_exit (1); + grub_exit (1);
} }
+#if defined (__clang__) && !defined (GRUB_UTIL)
+/* clang emits references to abort(). */
+void __attribute__ ((noreturn))
+abort (void)
+{
+ grub_abort ();
+}
+#endif
+
void void
grub_fatal (const char *fmt, ...)
{
diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c
index 3e338645c57..be2a5be1d07 100644 index 3e338645c57..be2a5be1d07 100644
--- a/grub-core/kern/uboot/init.c --- a/grub-core/kern/uboot/init.c

View File

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 5 Feb 2014 09:42:42 -0200
Subject: [PATCH] trim arp packets with abnormal size
GRUB uses arp request to create the arp response. If the incoming packet
is foobared, GRUB needs to trim the arp response packet before sending it.
---
grub-core/net/arp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 54306e3b16d..d1c69ed2b55 100644
--- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c
@@ -150,6 +150,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
&& arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST))
{
+ if ((nb->tail - nb->data) > 50)
+ {
+ grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
+ nb->tail - nb->data);
+ nb->tail = nb->data + 50;
+ }
grub_net_link_level_address_t target;
struct grub_net_buff nb_reply;
struct arppkt *arp_reply;

View File

@ -8,7 +8,7 @@ Subject: [PATCH] Add %X option to printf functions.
1 file changed, 5 insertions(+), 2 deletions(-) 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 952411d5dc6..8344526be7f 100644 index cd63a8cea73..2656a670e09 100644
--- a/grub-core/kern/misc.c --- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c
@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) @@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)

File diff suppressed because it is too large Load Diff

View File

@ -1,248 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
Date: Tue, 22 Jan 2013 06:31:38 +0100
Subject: [PATCH] blscfg: add blscfg module to parse Boot Loader Specification
snippets
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
Works like this:
insmod blscfg
bls_import
Done! You should now have menu items for your snippets in place.
Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
---
grub-core/Makefile.core.def | 8 ++
grub-core/commands/blscfg.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 209 insertions(+)
create mode 100644 grub-core/commands/blscfg.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index f8065388213..cd0902b46b8 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -768,6 +768,14 @@ module = {
common = commands/blocklist.c;
};
+module = {
+ name = blscfg;
+ common = commands/blscfg.c;
+ enable = i386_efi;
+ enable = x86_64_efi;
+ enable = i386_pc;
+};
+
module = {
name = boot;
common = commands/boot.c;
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
new file mode 100644
index 00000000000..4274aca5a9d
--- /dev/null
+++ b/grub-core/commands/blscfg.c
@@ -0,0 +1,201 @@
+/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/
+
+/* bls.c - implementation of the boot loader spec */
+
+/*
+ * GRUB -- GRand Unified Bootloader
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/extcmd.h>
+#include <grub/i18n.h>
+#include <grub/fs.h>
+#include <grub/env.h>
+#include <grub/file.h>
+#include <grub/normal.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+#ifdef GRUB_MACHINE_EFI
+#define GRUB_LINUX_CMD "linuxefi"
+#define GRUB_INITRD_CMD "initrdefi"
+#define GRUB_BLS_CONFIG_PATH "/EFI/fedora/loader/entries/"
+#define GRUB_BOOT_DEVICE "($boot)"
+#else
+#define GRUB_LINUX_CMD "linux"
+#define GRUB_INITRD_CMD "initrd"
+#define GRUB_BLS_CONFIG_PATH "/loader/entries/"
+#define GRUB_BOOT_DEVICE "($root)"
+#endif
+
+static int parse_entry (
+ const char *filename,
+ const struct grub_dirhook_info *info __attribute__ ((unused)),
+ void *data __attribute__ ((unused)))
+{
+ grub_size_t n;
+ char *p;
+ grub_file_t f = NULL;
+ grub_off_t sz;
+ char *title = NULL, *options = NULL, *clinux = NULL, *initrd = NULL, *src = NULL;
+ const char *args[2] = { NULL, NULL };
+
+ if (filename[0] == '.')
+ return 0;
+
+ n = grub_strlen (filename);
+ if (n <= 5)
+ return 0;
+
+ if (grub_strcmp (filename + n - 5, ".conf") != 0)
+ return 0;
+
+ p = grub_xasprintf (GRUB_BLS_CONFIG_PATH "%s", filename);
+
+ f = grub_file_open (p);
+ if (!f)
+ goto finish;
+
+ sz = grub_file_size (f);
+ if (sz == GRUB_FILE_SIZE_UNKNOWN || sz > 1024*1024)
+ goto finish;
+
+ for (;;)
+ {
+ char *buf;
+
+ buf = grub_file_getline (f);
+ if (!buf)
+ break;
+
+ if (grub_strncmp (buf, "title ", 6) == 0)
+ {
+ grub_free (title);
+ title = grub_strdup (buf + 6);
+ if (!title)
+ goto finish;
+ }
+ else if (grub_strncmp (buf, "options ", 8) == 0)
+ {
+ grub_free (options);
+ options = grub_strdup (buf + 8);
+ if (!options)
+ goto finish;
+ }
+ else if (grub_strncmp (buf, "linux ", 6) == 0)
+ {
+ grub_free (clinux);
+ clinux = grub_strdup (buf + 6);
+ if (!clinux)
+ goto finish;
+ }
+ else if (grub_strncmp (buf, "initrd ", 7) == 0)
+ {
+ grub_free (initrd);
+ initrd = grub_strdup (buf + 7);
+ if (!initrd)
+ goto finish;
+ }
+
+ grub_free(buf);
+ }
+
+ if (!linux)
+ {
+ grub_printf ("Skipping file %s with no 'linux' key.", p);
+ goto finish;
+ }
+
+ args[0] = title ? title : filename;
+
+ src = grub_xasprintf ("load_video\n"
+ "set gfx_payload=keep\n"
+ "insmod gzio\n"
+ GRUB_LINUX_CMD " %s%s%s%s\n"
+ "%s%s%s%s",
+ GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "",
+ initrd ? GRUB_INITRD_CMD " " : "", initrd ? GRUB_BOOT_DEVICE : "", initrd ? initrd : "", initrd ? "\n" : "");
+
+ grub_normal_add_menu_entry (1, args, NULL, NULL, "bls", NULL, NULL, src, 0);
+
+finish:
+ grub_free (p);
+ grub_free (title);
+ grub_free (options);
+ grub_free (clinux);
+ grub_free (initrd);
+ grub_free (src);
+
+ if (f)
+ grub_file_close (f);
+
+ return 0;
+}
+
+static grub_err_t
+grub_cmd_bls_import (grub_extcmd_context_t ctxt __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char **args __attribute__ ((unused)))
+{
+ grub_fs_t fs;
+ grub_device_t dev;
+ static grub_err_t r;
+ const char *devid;
+
+ devid = grub_env_get ("root");
+ if (!devid)
+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "root");
+
+ dev = grub_device_open (devid);
+ if (!dev)
+ return grub_errno;
+
+ fs = grub_fs_probe (dev);
+ if (!fs)
+ {
+ r = grub_errno;
+ goto finish;
+ }
+
+ r = fs->dir (dev, GRUB_BLS_CONFIG_PATH, parse_entry, NULL);
+
+finish:
+ if (dev)
+ grub_device_close (dev);
+
+ return r;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT(bls)
+{
+ cmd = grub_register_extcmd ("bls_import",
+ grub_cmd_bls_import,
+ 0,
+ NULL,
+ N_("Import Boot Loader Specification snippets."),
+ NULL);
+}
+
+GRUB_MOD_FINI(bls)
+{
+ grub_unregister_extcmd (cmd);
+}

View File

@ -9,10 +9,10 @@ No one cares.
1 file changed, 5 insertions(+), 3 deletions(-) 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index b2654ef62e8..f57b7508a76 100644 index 5116aac6614..31b624a23cf 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -202,15 +202,16 @@ read_config_file (const char *config) @@ -208,15 +208,16 @@ read_config_file (const char *config)
/* Initialize the screen. */ /* Initialize the screen. */
void void
grub_normal_init_page (struct grub_term_output *term, grub_normal_init_page (struct grub_term_output *term,
@ -32,7 +32,7 @@ index b2654ef62e8..f57b7508a76 100644
msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted) if (!msg_formatted)
@@ -235,6 +236,7 @@ grub_normal_init_page (struct grub_term_output *term, @@ -241,6 +242,7 @@ grub_normal_init_page (struct grub_term_output *term,
grub_putcode ('\n', term); grub_putcode ('\n', term);
grub_putcode ('\n', term); grub_putcode ('\n', term);
grub_free (unicode_msg); grub_free (unicode_msg);

View File

@ -9,10 +9,10 @@ That is consistent with the menu help text
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index f57b7508a76..0ce59fdc3f0 100644 index 31b624a23cf..7f295e3946b 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -426,8 +426,8 @@ grub_normal_reader_init (int nested) @@ -432,8 +432,8 @@ grub_normal_reader_init (int nested)
grub_normal_init_page (term, 1); grub_normal_init_page (term, 1);
grub_term_setcursor (term, 1); grub_term_setcursor (term, 1);

View File

@ -17,10 +17,10 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
1 file changed, 3 insertions(+), 2 deletions(-) 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 0ce59fdc3f0..a3713efcd90 100644 index 7f295e3946b..231f3f86371 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
char *config; char *config;
const char *prefix, *fw_path; const char *prefix, *fw_path;
@ -29,7 +29,7 @@ index 0ce59fdc3f0..a3713efcd90 100644
if (fw_path) if (fw_path)
{ {
config = grub_xasprintf ("%s/grub.cfg", fw_path); config = grub_xasprintf ("%s/grub.cfg", fw_path);
@@ -366,7 +366,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -372,7 +372,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
} }
} }

View File

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 43 insertions(+), 37 deletions(-) 1 file changed, 43 insertions(+), 37 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index a3713efcd90..7d9c4f09b9b 100644 index 231f3f86371..cf5c0b273ce 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -341,53 +341,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -347,53 +347,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
/* Guess the config filename. It is necessary to make CONFIG static, /* Guess the config filename. It is necessary to make CONFIG static,
so that it won't get broken by longjmp. */ so that it won't get broken by longjmp. */
char *config; char *config;

View File

@ -11,15 +11,15 @@ which allows /usr/bin/grub2-editenv to be the same across platforms
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
--- ---
Makefile.util.def | 9 +++++++++ Makefile.util.def | 11 +++++++++++
util/editenv.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- util/editenv.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 53 insertions(+), 2 deletions(-) 2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index c7b775bce73..d08713b5500 100644 index c7b775bce73..3efc5718ae8 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -231,8 +231,17 @@ program = { @@ -231,8 +231,19 @@ program = {
common = util/grub-editenv.c; common = util/grub-editenv.c;
common = util/editenv.c; common = util/editenv.c;
@ -29,6 +29,8 @@ index c7b775bce73..d08713b5500 100644
+ extra_dist = grub-core/osdep/unix/compress.c; + extra_dist = grub-core/osdep/unix/compress.c;
+ extra_dist = grub-core/osdep/basic/compress.c; + extra_dist = grub-core/osdep/basic/compress.c;
+ common = util/mkimage.c; + common = util/mkimage.c;
+ common = util/grub-mkimage32.c;
+ common = util/grub-mkimage64.c;
+ common = grub-core/osdep/config.c; + common = grub-core/osdep/config.c;
+ common = util/config.c; + common = util/config.c;
+ common = util/resolve.c; + common = util/resolve.c;

View File

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
Date: Sat, 15 Feb 2014 15:10:22 -0500
Subject: [PATCH] reopen SNP protocol for exclusive use by grub
---
grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5388f952ba9..ea0e0ca360e 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -330,6 +330,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
{
struct grub_net_card *card;
grub_efi_device_path_t *dp;
+ grub_efi_simple_network_t *net;
dp = grub_efi_get_device_path (hnd);
if (! dp)
@@ -383,6 +384,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);
+ net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
+ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
+ if (net) {
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
+ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
+ continue;
+
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
+ continue;
+
+ if (net->mode->state == GRUB_EFI_NETWORK_STARTED
+ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
+ continue;
+ card->efi_net = net;
+ }
return;
}
}

View File

@ -1,51 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 4 Mar 2016 15:13:59 -0500
Subject: [PATCH] Revert "reopen SNP protocol for exclusive use by grub"
This reverts commit a3f2c756ce34c9666bddef35e3b3b85ccecdcffc , which is
obsoleted by these:
49426e9 efinet: open Simple Network Protocol exclusively
f348aee efinet: enable hardware filters when opening interface
c52ae40 efinet: skip virtual IPv4 and IPv6 devices when enumerating cards
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/drivers/efi/efinet.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index ea0e0ca360e..5388f952ba9 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -330,7 +330,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
{
struct grub_net_card *card;
grub_efi_device_path_t *dp;
- grub_efi_simple_network_t *net;
dp = grub_efi_get_device_path (hnd);
if (! dp)
@@ -384,21 +383,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);
- net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
- GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
- if (net) {
- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
- && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
- continue;
-
- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
- continue;
-
- if (net->mode->state == GRUB_EFI_NETWORK_STARTED
- && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
- continue;
- card->efi_net = net;
- }
return;
}
}

View File

@ -69,10 +69,10 @@ index 0769bf850d3..16d2ce06d5a 100644
static struct grub_preboot *fini_hnd; static struct grub_preboot *fini_hnd;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 7d9c4f09b9b..b69f9e738fa 100644 index cf5c0b273ce..ea749f26fd5 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -331,74 +331,72 @@ grub_enter_normal_mode (const char *config) @@ -337,74 +337,72 @@ grub_enter_normal_mode (const char *config)
grub_boot_time ("Exiting normal mode"); grub_boot_time ("Exiting normal mode");
} }

View File

@ -9,19 +9,23 @@ starting with the most recent. Added an option for rpm-based systems to
use the rpm-sort library to sort kernels instead. use the rpm-sort library to sort kernels instead.
Resolves rhbz#1124074 Resolves rhbz#1124074
Signed-off-by: Robert Marshall <rmarshall@redhat.com>
[pjones: fix --enable-rpm-sort configure option]
Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
configure.ac | 29 +++++ configure.ac | 29 +++++
Makefile.util.def | 16 +++ Makefile.util.def | 16 +++
util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++
.gitignore | 2 + .gitignore | 2 +
util/grub-mkconfig_lib.in | 8 +- util/grub-mkconfig_lib.in | 11 +-
util/grub-rpm-sort.8 | 12 ++ util/grub-rpm-sort.8 | 12 ++
6 files changed, 347 insertions(+), 1 deletion(-) 6 files changed, 350 insertions(+), 1 deletion(-)
create mode 100644 util/grub-rpm-sort.c create mode 100644 util/grub-rpm-sort.c
create mode 100644 util/grub-rpm-sort.8 create mode 100644 util/grub-rpm-sort.8
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index d5db2803ec4..056df1cbaf9 100644 index d5db2803ec4..00f1db29b1a 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
@ -47,7 +51,7 @@ index d5db2803ec4..056df1cbaf9 100644
+AC_ARG_ENABLE([rpm-sort], +AC_ARG_ENABLE([rpm-sort],
+ [AS_HELP_STRING([--enable-rpm-sort], + [AS_HELP_STRING([--enable-rpm-sort],
+ [enable native rpm sorting of kernels in grub (default=guessed)])]) + [enable native rpm sorting of kernels in grub (default=guessed)])])
+if test x"$enable_rpm-sort" = xno ; then +if test x"$enable_rpm_sort" = xno ; then
+ rpm_sort_excuse="explicitly disabled" + rpm_sort_excuse="explicitly disabled"
+fi +fi
+ +
@ -75,10 +79,10 @@ index d5db2803ec4..056df1cbaf9 100644
if test x$host_kernel = xkfreebsd; then if test x$host_kernel = xkfreebsd; then
AC_CHECK_LIB([geom], [geom_gettree], [], AC_CHECK_LIB([geom], [geom_gettree], [],
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index d08713b5500..406d96861b6 100644 index 3efc5718ae8..bb21c87c8ed 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -685,6 +685,22 @@ program = { @@ -687,6 +687,22 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
}; };
@ -402,23 +406,33 @@ index 43f04d47277..fa2e5b609b1 100644
/grub*-script-check.1 /grub*-script-check.1
/grub*-set-default /grub*-set-default
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 1a4a57898f9..7fe3598435c 100644 index 1a4a57898f9..113a41f9409 100644
--- a/util/grub-mkconfig_lib.in --- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in
@@ -214,6 +214,12 @@ version_sort () @@ -33,6 +33,9 @@ fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi
+if test "x$grub_rpm_sort" = x; then
+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@"
+fi
if which gettext >/dev/null 2>/dev/null; then
:
@@ -214,6 +217,12 @@ version_sort ()
esac esac
} }
+if [ "x$RPMLIB" = x ]; then +if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then
+ kernel_sort=version_sort + kernel_sort="$grub_rpm_sort"
+else +else
+ kernel_sort="${sbindir}/grub-rpm-sort" + kernel_sort=version_sort
+fi +fi
+ +
version_test_numeric () version_test_numeric ()
{ {
version_test_numeric_a="$1" version_test_numeric_a="$1"
@@ -230,7 +236,7 @@ version_test_numeric () @@ -230,7 +239,7 @@ version_test_numeric ()
version_test_numeric_a="$version_test_numeric_b" version_test_numeric_a="$version_test_numeric_b"
version_test_numeric_b="$version_test_numeric_c" version_test_numeric_b="$version_test_numeric_c"
fi fi

View File

@ -8,36 +8,42 @@ without having to alter the grub.cfg. The hashed password now
lives in a root-only-readable configuration file. lives in a root-only-readable configuration file.
Resolves: rhbz#985962 Resolves: rhbz#985962
Signed-off-by: Robert Marshall <rmarshall@redhat.com>
[pjones: fix the efidir in grub-setpassword and rename tool]
Signed-off-by: Peter Jones <pjones@redhat.com>
[luto: fix grub-setpassword -o's output path]
Andy Lutomirski <luto@kernel.org>
--- ---
configure.ac | 1 + configure.ac | 1 +
Makefile.util.def | 13 +++++ Makefile.util.def | 13 +++++
.gitignore | 2 + .gitignore | 2 +
util/grub-mkconfig.in | 2 + util/grub-mkconfig.in | 2 +
util/grub-setpassword.8 | 28 +++++++++++ util/grub-set-password.8 | 28 ++++++++++
util/grub-setpassword.in | 123 +++++++++++++++++++++++++++++++++++++++++++++++ util/grub-set-password.in | 128 ++++++++++++++++++++++++++++++++++++++++++++++
util/grub.d/01_users.in | 11 +++++ util/grub.d/01_users.in | 11 ++++
7 files changed, 180 insertions(+) 7 files changed, 185 insertions(+)
create mode 100644 util/grub-setpassword.8 create mode 100644 util/grub-set-password.8
create mode 100644 util/grub-setpassword.in create mode 100644 util/grub-set-password.in
create mode 100644 util/grub.d/01_users.in create mode 100644 util/grub.d/01_users.in
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 056df1cbaf9..679f634ce4c 100644 index 00f1db29b1a..1cb6a9615db 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot]) grub_TRANSFORM([grub-reboot])
+grub_TRANSFORM([grub-setpassword]) +grub_TRANSFORM([grub-set-password])
grub_TRANSFORM([grub-rpm-sort]) grub_TRANSFORM([grub-rpm-sort])
grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-set-default])
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index 406d96861b6..fd91045bd6d 100644 index bb21c87c8ed..7729e65c607 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -440,6 +440,12 @@ script = { @@ -442,6 +442,12 @@ script = {
installdir = grubconf; installdir = grubconf;
}; };
@ -50,13 +56,13 @@ index 406d96861b6..fd91045bd6d 100644
script = { script = {
name = '10_windows'; name = '10_windows';
common = util/grub.d/10_windows.in; common = util/grub.d/10_windows.in;
@@ -722,6 +728,13 @@ script = { @@ -724,6 +730,13 @@ script = {
installdir = sbin; installdir = sbin;
}; };
+script = { +script = {
+ name = grub-setpassword; + name = grub-set-password;
+ common = util/grub-setpassword.in; + common = util/grub-set-password.in;
+ mansection = 8; + mansection = 8;
+ installdir = sbin; + installdir = sbin;
+}; +};
@ -65,15 +71,15 @@ index 406d96861b6..fd91045bd6d 100644
name = grub-mkconfig_lib; name = grub-mkconfig_lib;
common = util/grub-mkconfig_lib.in; common = util/grub-mkconfig_lib.in;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index fa2e5b609b1..5066689bc0a 100644 index fa2e5b609b1..141684867d1 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -111,6 +111,8 @@ grub-*.tar.* @@ -111,6 +111,8 @@ grub-*.tar.*
/grub*-script-check.1 /grub*-script-check.1
/grub*-set-default /grub*-set-default
/grub*-set-default.8 /grub*-set-default.8
+/grub*-setsetpassword +/grub*-set-password
+/grub*-setsetpassword.8 +/grub*-set-password.8
/grub*-shell /grub*-shell
/grub*-shell-tester /grub*-shell-tester
/grub*-sparc64-setup /grub*-sparc64-setup
@ -90,21 +96,21 @@ index f68d4925ee6..bdb9982aefb 100644
*) *)
if grub_file_is_not_garbage "$i" && test -x "$i" ; then if grub_file_is_not_garbage "$i" && test -x "$i" ; then
echo echo
diff --git a/util/grub-setpassword.8 b/util/grub-setpassword.8 diff --git a/util/grub-set-password.8 b/util/grub-set-password.8
new file mode 100644 new file mode 100644
index 00000000000..49200a848b7 index 00000000000..9646546e43d
--- /dev/null --- /dev/null
+++ b/util/grub-setpassword.8 +++ b/util/grub-set-password.8
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
+.TH GRUB-SETPASSWORD 3 "Thu Jun 25 2015" +.TH GRUB-SET-PASSWORD 3 "Thu Jun 25 2015"
+.SH NAME +.SH NAME
+\fBgrub-setpassword\fR \(em Generate the user.cfg file containing the hashed grub bootloader password. +\fBgrub-set-password\fR \(em Generate the user.cfg file containing the hashed grub bootloader password.
+ +
+.SH SYNOPSIS +.SH SYNOPSIS
+\fBgrub-setpassword\fR [OPTION] +\fBgrub-set-password\fR [OPTION]
+ +
+.SH DESCRIPTION +.SH DESCRIPTION
+\fBgrub-setpassword\fR outputs the user.cfg file which contains the hashed GRUB bootloader password. This utility only supports configurations where there is a single root user. +\fBgrub-set-password\fR outputs the user.cfg file which contains the hashed GRUB bootloader password. This utility only supports configurations where there is a single root user.
+ +
+The file has the format: +The file has the format:
+GRUB2_PASSWORD=<\fIhashed password\fR>. +GRUB2_PASSWORD=<\fIhashed password\fR>.
@ -117,23 +123,24 @@ index 00000000000..49200a848b7
+-v, --version +-v, --version
+Display the current version. +Display the current version.
+.TP +.TP
+-o, --output[=\fIDIRECTORY PATH\fR] +-o, --output=<\fIDIRECTORY\fR>
+Choose the file path to which user.cfg will be written. +Choose the file path to which user.cfg will be written.
+ +
+.SH SEE ALSO +.SH SEE ALSO
+.BR "info grub" +.BR "info grub"
+ +
+.BR "info grub2-mkpasswd-pbkdf2" +.BR "info grub2-mkpasswd-pbkdf2"
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in diff --git a/util/grub-set-password.in b/util/grub-set-password.in
new file mode 100644 new file mode 100644
index 00000000000..dd76f00fc0e index 00000000000..5ebf50576d6
--- /dev/null --- /dev/null
+++ b/util/grub-setpassword.in +++ b/util/grub-set-password.in
@@ -0,0 +1,123 @@ @@ -0,0 +1,128 @@
+#!/bin/sh -e +#!/bin/sh -e
+ +
+EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')
+if [ -d /sys/firmware/efi/efivars/ ]; then +if [ -d /sys/firmware/efi/efivars/ ]; then
+ grubdir=`echo "/@bootdirname@/efi/EFI/redhat/" | sed 's,//*,/,g'` + grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
+else +else
+ grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` + grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
+fi +fi
@ -148,15 +155,14 @@ index 00000000000..dd76f00fc0e
+# Print the usage. +# Print the usage.
+usage () { +usage () {
+ cat <<EOF + cat <<EOF
+Usage: $0 [OPTION] [SOURCE] +Usage: $0 [OPTION]
+Run GRUB script in a Qemu instance. +$0 prompts the user to set a password on the grub bootloader. The password
+is written to a file named user.cfg which lives in the GRUB directory
+located by default at ${grubdir}.
+ +
+ -h, --help print this message and exit + -h, --help print this message and exit
+ -v, --version print the version information and exit + -v, --version print the version information and exit
+ -o, --output_path choose a custom output path for user.cfg + -o, --output_path <DIRECTORY> put user.cfg in a user-selected directory
+
+$0 prompts the user to set a password on the grub bootloader. The password
+is written to a file named user.cfg.
+ +
+Report bugs at https://bugzilla.redhat.com. +Report bugs at https://bugzilla.redhat.com.
+EOF +EOF
@ -237,7 +243,7 @@ index 00000000000..dd76f00fc0e
+ P1="$1" && shift + P1="$1" && shift
+ +
+ ( echo ${P0} ; echo ${P1} ) | \ + ( echo ${P0} ; echo ${P1} ) | \
+ ${grub_mkpasswd} | \ + LC_ALL=C ${grub_mkpasswd} | \
+ grep -v '[eE]nter password:' | \ + grep -v '[eE]nter password:' | \
+ sed -e "s/PBKDF2 hash of your password is //" + sed -e "s/PBKDF2 hash of your password is //"
+} +}
@ -250,9 +256,14 @@ index 00000000000..dd76f00fc0e
+ +
+# on the ESP, these will fail to set the permissions, but it's okay because +# on the ESP, these will fail to set the permissions, but it's okay because
+# the directory is protected. +# the directory is protected.
+install -m 0600 /dev/null "${grubdir}/user.cfg" 2>/dev/null || : +install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
+chmod 0600 "${grubdir}/user.cfg" 2>/dev/null || : +chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
+echo "GRUB2_PASSWORD=${MYPASS}" > "${grubdir}/user.cfg" +echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg"
+
+if ! grep -q "^### BEGIN /etc/grub.d/01_users ###$" "${OUTPUT_PATH}/grub.cfg"; then
+ echo "WARNING: The current configuration lacks password support!"
+ echo "Update your configuration with @grub_mkconfig@ to support this feature."
+fi
diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in
new file mode 100644 new file mode 100644
index 00000000000..db2f44bfb78 index 00000000000..db2f44bfb78

View File

@ -20,10 +20,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/net/url.h create mode 100644 include/grub/net/url.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index cd0902b46b8..991891a6e09 100644 index 8bd220a41ba..d0c8a8b1908 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -2185,6 +2185,7 @@ module = { @@ -2188,6 +2188,7 @@ module = {
common = net/ethernet.c; common = net/ethernet.c;
common = net/arp.c; common = net/arp.c;
common = net/netbuff.c; common = net/netbuff.c;
@ -32,7 +32,7 @@ index cd0902b46b8..991891a6e09 100644
module = { module = {
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 8344526be7f..f1fab700048 100644 index 2656a670e09..1c560ea570a 100644
--- a/grub-core/kern/misc.c --- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c
@@ -296,6 +296,19 @@ grub_strrchr (const char *s, int c) @@ -296,6 +296,19 @@ grub_strrchr (const char *s, int c)

View File

@ -1,57 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 3 Aug 2015 11:46:42 -0400
Subject: [PATCH] Try to make sure configure.ac and grub-rpm-sort play nice.
Apparently the test for whether to use grub-rpm-sort and also the
renaming of it to grub2-rpm-sort on the runtime side weren't right.
Related: rhbz#1124074
Signed-off-by: Peter Jones <pjones@redhat.com>
---
configure.ac | 2 +-
util/grub-mkconfig_lib.in | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 679f634ce4c..71d1056969e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1796,7 +1796,7 @@ AC_SUBST([LIBDEVMAPPER])
AC_ARG_ENABLE([rpm-sort],
[AS_HELP_STRING([--enable-rpm-sort],
[enable native rpm sorting of kernels in grub (default=guessed)])])
-if test x"$enable_rpm-sort" = xno ; then
+if test x"$enable_rpm_sort" = xno ; then
rpm_sort_excuse="explicitly disabled"
fi
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 7fe3598435c..113a41f9409 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -33,6 +33,9 @@ fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi
+if test "x$grub_rpm_sort" = x; then
+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@"
+fi
if which gettext >/dev/null 2>/dev/null; then
:
@@ -214,10 +217,10 @@ version_sort ()
esac
}
-if [ "x$RPMLIB" = x ]; then
+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then
+ kernel_sort="$grub_rpm_sort"
+else
kernel_sort=version_sort
-else
- kernel_sort="${sbindir}/grub-rpm-sort"
fi
version_test_numeric ()

View File

@ -12,19 +12,19 @@ debug stanzas.
Resolves: rhbz#1226325 Resolves: rhbz#1226325
--- ---
configure.ac | 2 + configure.ac | 2 +
Makefile.util.def | 7 +++ Makefile.util.def | 7 ++
.gitignore | 2 + .gitignore | 2 +
util/bash-completion.d/grub-completion.bash.in | 22 ++++++++ util/bash-completion.d/grub-completion.bash.in | 22 +++++++
util/grub-get-kernel-settings.3 | 20 +++++++ util/grub-get-kernel-settings.3 | 20 ++++++
util/grub-get-kernel-settings.in | 78 ++++++++++++++++++++++++++ util/grub-get-kernel-settings.in | 88 ++++++++++++++++++++++++++
util/grub-mkconfig.in | 3 + util/grub-mkconfig.in | 3 +
util/grub.d/10_linux.in | 23 ++++++-- util/grub.d/10_linux.in | 23 +++++--
8 files changed, 152 insertions(+), 5 deletions(-) 8 files changed, 162 insertions(+), 5 deletions(-)
create mode 100644 util/grub-get-kernel-settings.3 create mode 100644 util/grub-get-kernel-settings.3
create mode 100644 util/grub-get-kernel-settings.in create mode 100644 util/grub-get-kernel-settings.in
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 71d1056969e..aa06ed59c8d 100644 index 1cb6a9615db..2a6fde5be81 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install]) @@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install])
@ -44,10 +44,10 @@ index 71d1056969e..aa06ed59c8d 100644
grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-install.1])
grub_TRANSFORM([grub-kbdcomp.3]) grub_TRANSFORM([grub-kbdcomp.3])
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index fd91045bd6d..2d032643de7 100644 index 7729e65c607..c39b3ce6aa9 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -714,6 +714,13 @@ script = { @@ -716,6 +716,13 @@ script = {
installdir = sbin; installdir = sbin;
}; };
@ -62,7 +62,7 @@ index fd91045bd6d..2d032643de7 100644
name = grub-set-default; name = grub-set-default;
common = util/grub-set-default.in; common = util/grub-set-default.in;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 5066689bc0a..54795fa60be 100644 index 141684867d1..096eeff7de8 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -68,6 +68,8 @@ grub-*.tar.* @@ -68,6 +68,8 @@ grub-*.tar.*
@ -135,10 +135,10 @@ index 00000000000..ba33330e28d
+.BR "info grub" +.BR "info grub"
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
new file mode 100644 new file mode 100644
index 00000000000..12046219878 index 00000000000..7e87dfccc0e
--- /dev/null --- /dev/null
+++ b/util/grub-get-kernel-settings.in +++ b/util/grub-get-kernel-settings.in
@@ -0,0 +1,78 @@ @@ -0,0 +1,88 @@
+#!/bin/sh +#!/bin/sh
+set -e +set -e
+ +
@ -217,6 +217,16 @@ index 00000000000..12046219878
+ echo GRUB_LINUX_DEBUG_TITLE_POSTFIX=\" with debugging\" + echo GRUB_LINUX_DEBUG_TITLE_POSTFIX=\" with debugging\"
+ echo export GRUB_LINUX_DEBUG_TITLE_POSTFIX + echo export GRUB_LINUX_DEBUG_TITLE_POSTFIX
+fi +fi
+if [ "$DEFAULTDEBUG" = "yes" ]; then
+ echo GRUB_DEFAULT_TO_DEBUG=true
+else
+ echo GRUB_DEFAULT_TO_DEBUG=false
+fi
+echo export GRUB_DEFAULT_TO_DEBUG
+if [ "$UPDATEDEFAULT" = "yes" ]; then
+ echo GRUB_UPDATE_DEFAULT_KERNEL=true
+ echo export GRUB_UPDATE_DEFAULT_KERNEL
+fi
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index bdb9982aefb..8218f3d477f 100644 index bdb9982aefb..8218f3d477f 100644
--- a/util/grub-mkconfig.in --- a/util/grub-mkconfig.in

View File

@ -6,13 +6,15 @@ Subject: [PATCH] Normalize slashes in tftp paths.
Some tftp servers do not handle multiple consecutive slashes correctly; Some tftp servers do not handle multiple consecutive slashes correctly;
this patch avoids sending tftp requests with non-normalized paths. this patch avoids sending tftp requests with non-normalized paths.
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
[msalter: fix malformed tftp packets]
Signed-off-by: Mark Salter <msalter@redhat.com>
--- ---
grub-core/net/tftp.c | 24 +++++++++++++++++++++++- grub-core/net/tftp.c | 28 +++++++++++++++++++++++++---
1 file changed, 23 insertions(+), 1 deletion(-) 1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 1157524fc50..5ca0a96a6f6 100644 index 1157524fc50..dcd82494309 100644
--- a/grub-core/net/tftp.c --- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c
@@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data) @@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data)
@ -41,15 +43,19 @@ index 1157524fc50..5ca0a96a6f6 100644
static grub_err_t static grub_err_t
tftp_open (struct grub_file *file, const char *filename) tftp_open (struct grub_file *file, const char *filename)
{ {
@@ -337,7 +356,10 @@ tftp_open (struct grub_file *file, const char *filename) @@ -337,9 +356,12 @@ tftp_open (struct grub_file *file, const char *filename)
rrqlen = 0; rrqlen = 0;
tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ); tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ);
- grub_strcpy (rrq, filename); - grub_strcpy (rrq, filename);
- rrqlen += grub_strlen (filename) + 1;
- rrq += grub_strlen (filename) + 1;
+ +
+ /* Copy and normalize the filename to work-around issues on some tftp + /* Copy and normalize the filename to work-around issues on some tftp
+ servers when file names are being matched for remapping. */ + servers when file names are being matched for remapping. */
+ grub_normalize_filename (rrq, filename); + grub_normalize_filename (rrq, filename);
rrqlen += grub_strlen (filename) + 1; + rrqlen += grub_strlen (rrq) + 1;
rrq += grub_strlen (filename) + 1; + rrq += grub_strlen (rrq) + 1;
grub_strcpy (rrq, "octet");
rrqlen += grub_strlen ("octet") + 1;

View File

@ -1,59 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: RHEL Ninjas <example@example.com>
Date: Fri, 25 Sep 2015 16:24:23 +0900
Subject: [PATCH] efinet: add filter for the first exclusive reopen of SNP
---
grub-core/net/drivers/efi/efinet.c | 39 ++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5388f952ba9..d15a799f29a 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -383,6 +383,45 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);
+ net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
+ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
+ if (net) {
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
+ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
+ continue;
+
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
+ continue;
+
+ if (net->mode->state == GRUB_EFI_NETWORK_STARTED
+ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
+ continue;
+
+ /* Enable hardware receive filters if driver declares support for it.
+ We need unicast and broadcast and additionaly all nodes and
+ solicited multicast for IPv6. Solicited multicast is per-IPv6
+ address and we currently do not have API to do it so simply
+ try to enable receive of all multicast packets or evertyhing in
+ the worst case (i386 PXE driver always enables promiscuous too).
+
+ This does trust firmware to do what it claims to do.
+ */
+ if (net->mode->receive_filter_mask)
+ {
+ grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST |
+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
+
+ filters &= net->mode->receive_filter_mask;
+ if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST))
+ filters |= (net->mode->receive_filter_mask &
+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS);
+
+ efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL);
+ }
+
+ card->efi_net = net;
+ }
return;
}
}

View File

@ -13,7 +13,7 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
create mode 100644 grub-core/lib/arm64/backtrace.c create mode 100644 grub-core/lib/arm64/backtrace.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 991891a6e09..27563743ba9 100644 index d0c8a8b1908..8bb5eb0f47f 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -175,6 +175,9 @@ kernel = { @@ -175,6 +175,9 @@ kernel = {
@ -27,7 +27,7 @@ index 991891a6e09..27563743ba9 100644
i386_xen = kern/i386/dl.c; i386_xen = kern/i386/dl.c;
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index f1fab700048..5ce89a40c68 100644 index 1c560ea570a..04371ac49f2 100644
--- a/grub-core/kern/misc.c --- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@

View File

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Mon, 22 Feb 2016 15:30:05 -0500
Subject: [PATCH] Warn if grub password will not be read (#1290803)
It is possible for a system to have never run grub-mkconfig and add the
section that reads the user.cfg file which contains a user set GRUB
password. Users in that scenario will now be warned that grub-mkconfig
must be run prior to their newly set password taking effect.
Resolves: rhbz#1290803
---
util/grub-setpassword.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
index dd76f00fc0e..fb9d3a3b6f9 100644
--- a/util/grub-setpassword.in
+++ b/util/grub-setpassword.in
@@ -121,3 +121,8 @@ fi
install -m 0600 /dev/null "${grubdir}/user.cfg" 2>/dev/null || :
chmod 0600 "${grubdir}/user.cfg" 2>/dev/null || :
echo "GRUB2_PASSWORD=${MYPASS}" > "${grubdir}/user.cfg"
+
+if ! grep -q "^### BEGIN /etc/grub.d/01_users ###$" "${grubdir}/grub.cfg"; then
+ echo "WARNING: The current configuration lacks password support!"
+ echo "Update your configuration with @grub_mkconfig@ to support this feature."
+fi

View File

@ -1,55 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Tue, 26 Jan 2016 10:28:35 -0500
Subject: [PATCH] Clean up grub-setpassword documentation (#1290799)
The output for --help had some errors. Corrected those and polished the
text to be a little easier to follow. Carried verbage over to man page
to maintain internal consistency.
Resolves: rhbz#1290799
---
util/grub-setpassword.8 | 2 +-
util/grub-setpassword.in | 15 +++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/util/grub-setpassword.8 b/util/grub-setpassword.8
index 49200a848b7..dc91dd6697b 100644
--- a/util/grub-setpassword.8
+++ b/util/grub-setpassword.8
@@ -19,7 +19,7 @@ Display program usage and exit.
-v, --version
Display the current version.
.TP
--o, --output[=\fIDIRECTORY PATH\fR]
+-o, --output=<\fIDIRECTORY\fR>
Choose the file path to which user.cfg will be written.
.SH SEE ALSO
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
index fb9d3a3b6f9..c8c0fa4199d 100644
--- a/util/grub-setpassword.in
+++ b/util/grub-setpassword.in
@@ -16,15 +16,14 @@ grub_mkpasswd="${bindir}/@grub_mkpasswd_pbkdf2@"
# Print the usage.
usage () {
cat <<EOF
-Usage: $0 [OPTION] [SOURCE]
-Run GRUB script in a Qemu instance.
-
- -h, --help print this message and exit
- -v, --version print the version information and exit
- -o, --output_path choose a custom output path for user.cfg
-
+Usage: $0 [OPTION]
$0 prompts the user to set a password on the grub bootloader. The password
-is written to a file named user.cfg.
+is written to a file named user.cfg which lives in the GRUB directory
+located by default at ${grubdir}.
+
+ -h, --help print this message and exit
+ -v, --version print the version information and exit
+ -o, --output_path <DIRECTORY> put user.cfg in a user-selected directory
Report bugs at https://bugzilla.redhat.com.
EOF

View File

@ -13,7 +13,7 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed.
create mode 100644 util/grub-syslinux2cfg.1 create mode 100644 util/grub-syslinux2cfg.1
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index aa06ed59c8d..f69f8986791 100644 index 2a6fde5be81..9318c281108 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -80,6 +80,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) @@ -80,6 +80,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3])

View File

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Fri, 29 Jan 2016 16:56:11 -0500
Subject: [PATCH] Fix locale issue in grub-setpassword (#1294243)
A shell substitution was expecting non-translated output to grab the
hashed password and put it in the user.cfg file. Modified code to force
the generic C locale when this particular piece of code is run.
Resolves: rhbz#1294243
---
util/grub-setpassword.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
index c8c0fa4199d..d7924af5192 100644
--- a/util/grub-setpassword.in
+++ b/util/grub-setpassword.in
@@ -104,7 +104,7 @@ getpass() {
P1="$1" && shift
( echo ${P0} ; echo ${P1} ) | \
- ${grub_mkpasswd} | \
+ LC_ALL=C ${grub_mkpasswd} | \
grep -v '[eE]nter password:' | \
sed -e "s/PBKDF2 hash of your password is //"
}

View File

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robert Elliott <elliott@hpe.com>
Date: Fri, 22 Jan 2016 13:32:30 +0100
Subject: [PATCH] efiemu: Handle persistent RAM and unknown possible future
additions.
(cherry picked from commit ae3b83a4d4df75a01198a2fed7542391e7c449e0)
Resolves: rhbz#1288608
---
grub-core/efiemu/mm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c
index 52a032f7b2e..92e7df7e501 100644
--- a/grub-core/efiemu/mm.c
+++ b/grub-core/efiemu/mm.c
@@ -410,8 +410,8 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
return grub_efiemu_add_to_mmap (addr, size,
GRUB_EFI_ACPI_MEMORY_NVS);
- case GRUB_MEMORY_PERSISTENT:
- case GRUB_MEMORY_PERSISTENT_LEGACY:
+ case GRUB_MEMORY_PRAM:
+ case GRUB_MEMORY_PMEM:
return grub_efiemu_add_to_mmap (addr, size,
GRUB_EFI_PERSISTENT_MEMORY);
default:

View File

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 22 Jan 2016 14:10:30 +0100
Subject: [PATCH] efiemu: Fix compilation failure
(cherry picked from commit b6a03dfd327489d53ee07c6d7d593b99c7b7cb62)
Resolves: rhbz#1288608
---
grub-core/efiemu/mm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c
index 92e7df7e501..52a032f7b2e 100644
--- a/grub-core/efiemu/mm.c
+++ b/grub-core/efiemu/mm.c
@@ -410,8 +410,8 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
return grub_efiemu_add_to_mmap (addr, size,
GRUB_EFI_ACPI_MEMORY_NVS);
- case GRUB_MEMORY_PRAM:
- case GRUB_MEMORY_PMEM:
+ case GRUB_MEMORY_PERSISTENT:
+ case GRUB_MEMORY_PERSISTENT_LEGACY:
return grub_efiemu_add_to_mmap (addr, size,
GRUB_EFI_PERSISTENT_MEMORY);
default:

View File

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 7 Apr 2016 10:58:06 -0400
Subject: [PATCH] Revert "reopen SNP protocol for exclusive use by grub"
I *think* this should have been replaced by upstream's
49426e9fd2e562c73a4f1206f32eff9e424a1a73, so I'm reverting for now.
May resolve rhbz#1273974.
This reverts commit 147daeab22db793978f952b6f0d832919a1b0081.
---
grub-core/net/drivers/efi/efinet.c | 39 --------------------------------------
1 file changed, 39 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index d15a799f29a..5388f952ba9 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -383,45 +383,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);
- net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
- GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
- if (net) {
- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
- && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
- continue;
-
- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
- continue;
-
- if (net->mode->state == GRUB_EFI_NETWORK_STARTED
- && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
- continue;
-
- /* Enable hardware receive filters if driver declares support for it.
- We need unicast and broadcast and additionaly all nodes and
- solicited multicast for IPv6. Solicited multicast is per-IPv6
- address and we currently do not have API to do it so simply
- try to enable receive of all multicast packets or evertyhing in
- the worst case (i386 PXE driver always enables promiscuous too).
-
- This does trust firmware to do what it claims to do.
- */
- if (net->mode->receive_filter_mask)
- {
- grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST |
- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
-
- filters &= net->mode->receive_filter_mask;
- if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST))
- filters |= (net->mode->receive_filter_mask &
- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS);
-
- efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL);
- }
-
- card->efi_net = net;
- }
return;
}
}

View File

@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Salter <msalter@redhat.com>
Date: Tue, 7 Mar 2017 18:26:17 -0500
Subject: [PATCH] Fix malformed tftp packets
0088-Normalize-slashes-in-tftp-paths.patch collapses multiple contiguous
slashes in a filename into one slash in the tftp packet filename field.
However, the packet buffer pointer is advanced using the original name.
This leaves unitialized data between the name field and the type field
leading to tftp errors. Use the length of the normalized name to avoid
this.
Signed-off-by: Mark Salter <msalter@redhat.com>
---
grub-core/net/tftp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 5ca0a96a6f6..dcd82494309 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -360,8 +360,8 @@ tftp_open (struct grub_file *file, const char *filename)
/* Copy and normalize the filename to work-around issues on some tftp
servers when file names are being matched for remapping. */
grub_normalize_filename (rrq, filename);
- rrqlen += grub_strlen (filename) + 1;
- rrq += grub_strlen (filename) + 1;
+ rrqlen += grub_strlen (rrq) + 1;
+ rrq += grub_strlen (rrq) + 1;
grub_strcpy (rrq, "octet");
rrqlen += grub_strlen ("octet") + 1;

View File

@ -3,13 +3,16 @@ From: Michael Chang <mchang@suse.com>
Date: Thu, 21 Aug 2014 03:39:11 +0000 Date: Thu, 21 Aug 2014 03:39:11 +0000
Subject: [PATCH] grub2-btrfs-05-grub2-mkconfig Subject: [PATCH] grub2-btrfs-05-grub2-mkconfig
Signed-off-by: Michael Chang <mchang@suse.com>
[dusty: No more "Bootable Snapshot" submenu in grub.cfg.]
Signed-off-by: Dusty Mabe <dusty@dustymabe.com>
--- ---
util/grub-mkconfig.in | 3 ++- util/grub-mkconfig.in | 3 ++-
util/grub-mkconfig_lib.in | 4 ++++ util/grub-mkconfig_lib.in | 4 ++++
util/grub.d/00_header.in | 24 +++++++++++++++++++++++- util/grub.d/00_header.in | 12 +++++++++++-
util/grub.d/10_linux.in | 4 ++++ util/grub.d/10_linux.in | 4 ++++
util/grub.d/20_linux_xen.in | 4 ++++ util/grub.d/20_linux_xen.in | 4 ++++
5 files changed, 37 insertions(+), 2 deletions(-) 5 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 8218f3d477f..4248b9341ab 100644 index 8218f3d477f..4248b9341ab 100644
@ -42,7 +45,7 @@ index 113a41f9409..b3aae534ddc 100644
is_path_readable_by_grub () is_path_readable_by_grub ()
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 858b526c925..e2a53300126 100644 index 858b526c925..8a16fea347e 100644
--- a/util/grub.d/00_header.in --- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
@ -71,22 +74,6 @@ index 858b526c925..e2a53300126 100644
load_env load_env
fi fi
EOF EOF
@@ -356,3 +366,15 @@ fi
if [ "x${GRUB_BADRAM}" != "x" ] ; then
echo "badram ${GRUB_BADRAM}"
fi
+
+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then
+ # Note: No $snapshot_num on *read-only* rollback! (bsc#901487)
+ cat <<EOF
+if [ -n "\$extra_cmdline" ]; then
+ submenu "Bootable snapshot #\$snapshot_num" {
+ menuentry "If OK, run 'snapper rollback' and reboot." { true; }
+ }
+fi
+EOF
+fi
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 4e49ccdf742..d9a05937e46 100644 index 4e49ccdf742..d9a05937e46 100644
--- a/util/grub.d/10_linux.in --- a/util/grub.d/10_linux.in

View File

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 4 Mar 2016 16:29:13 -0500
Subject: [PATCH] Make grub-editenv build again.
36212460d3565b18439a3a8130b28e6c97702c6a split how some of the mkimage
utility functions are defined, and they wind up being linked into
grub-editenv. Most utilities got fixed, but this one was missed.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
Makefile.util.def | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile.util.def b/Makefile.util.def
index 2d032643de7..879e8eb98a4 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -237,6 +237,8 @@ program = {
extra_dist = grub-core/osdep/unix/compress.c;
extra_dist = grub-core/osdep/basic/compress.c;
common = util/mkimage.c;
+ common = util/grub-mkimage32.c;
+ common = util/grub-mkimage64.c;
common = grub-core/osdep/config.c;
common = util/config.c;
common = util/resolve.c;

View File

@ -1,53 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 26 Feb 2014 21:49:12 -0500
Subject: [PATCH] Make "exit" take a return code.
This adds "exit" with a return code. With this patch, any "exit"
command /may/ include a return code, and on platforms that support
returning with an exit status, we will do so. By default we return the
same exit status we did before this patch.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/emu/main.c | 6 ++++++
grub-core/kern/misc.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
index 55ea5a11ccd..7e47ec81263 100644
--- a/grub-core/kern/emu/main.c
+++ b/grub-core/kern/emu/main.c
@@ -72,6 +72,12 @@ grub_exit (int retval __attribute__((unused)))
grub_reboot ();
}
+void
+grub_exit (int retval __attribute__((unused)))
+{
+ grub_reboot ();
+}
+
void
grub_machine_init (void)
{
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 5ce89a40c68..04371ac49f2 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1120,6 +1120,15 @@ grub_abort (void)
grub_exit (1);
}
+#if defined (__clang__) && !defined (GRUB_UTIL)
+/* clang emits references to abort(). */
+void __attribute__ ((noreturn))
+abort (void)
+{
+ grub_abort ();
+}
+#endif
+
void
grub_fatal (const char *fmt, ...)
{

View File

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dusty Mabe <dusty@dustymabe.com>
Date: Sat, 18 Jul 2015 15:38:08 +0000
Subject: [PATCH] No more "Bootable Snapshot" submenu in grub.cfg.
This breaks grubby (run on kernel upgrades) because grubby just
does a search for "menuentry".
---
util/grub.d/00_header.in | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index e2a53300126..8a16fea347e 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -366,15 +366,3 @@ fi
if [ "x${GRUB_BADRAM}" != "x" ] ; then
echo "badram ${GRUB_BADRAM}"
fi
-
-if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
- [ "x${GRUB_FS}" = "xbtrfs" ] ; then
- # Note: No $snapshot_num on *read-only* rollback! (bsc#901487)
- cat <<EOF
-if [ -n "\$extra_cmdline" ]; then
- submenu "Bootable snapshot #\$snapshot_num" {
- menuentry "If OK, run 'snapper rollback' and reboot." { true; }
- }
-fi
-EOF
-fi

View File

@ -1,29 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com> From: Peter Jones <pjones@redhat.com>
Date: Wed, 3 Oct 2018 20:48:32 +0200 Date: Fri, 9 Dec 2016 15:40:29 -0500
Subject: [PATCH] add 10_linux_bls grub.d snippet to generate menu entries from Subject: [PATCH] Add BLS support to grub-mkconfig
BLS files
This grub.d snippet can be used on platforms where the bootloader doesn't GRUB now has BootLoaderSpec support, the user can choose to use this by
setting GRUB_ENABLE_BLSCFG to true in /etc/default/grub. On this setup,
the boot menu entries are not added to the grub.cfg, instead BLS config
files are parsed by blscfg command and the entries created dynamically.
A 10_linux_bls grub.d snippet to generate menu entries from BLS files
is also added that can be used on platforms where the bootloader doesn't
have BLS support and only can parse a normal grub configuration file. have BLS support and only can parse a normal grub configuration file.
Portions of this script were taken from the ostree-grub-generator script Portions of the 10_linux_bls were taken from the ostree-grub-generator
included in the OSTree project. script that's included in the OSTree project.
Resolves: rhbz#1636013 Fixes to support multi-devices and generate a BLS section even if no
kernels are found in the boot directory were proposed by Yclept Nemo
and Tom Gundersen respectively.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
--- ---
Makefile.util.def | 7 + Makefile.util.def | 7 +
util/grub.d/10_linux_bls.in | 440 ++++++++++++++++++++++++++++++++++++++++++++ util/grub-mkconfig.8 | 4 +
2 files changed, 447 insertions(+) util/grub-mkconfig.in | 9 +-
util/grub-mkconfig_lib.in | 20 +-
util/grub.d/10_linux.in | 67 ++++++-
util/grub.d/10_linux_bls.in | 478 ++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 580 insertions(+), 5 deletions(-)
create mode 100644 util/grub.d/10_linux_bls.in create mode 100644 util/grub.d/10_linux_bls.in
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index c8cb91308d9..eca3dfa753f 100644 index c39b3ce6aa9..c16c2ca545a 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -508,6 +508,13 @@ script = { @@ -490,6 +490,13 @@ script = {
condition = COND_HOST_LINUX; condition = COND_HOST_LINUX;
}; };
@ -37,12 +49,218 @@ index c8cb91308d9..eca3dfa753f 100644
script = { script = {
name = '10_xnu'; name = '10_xnu';
common = util/grub.d/10_xnu.in; common = util/grub.d/10_xnu.in;
diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
index a2d1f577b9b..434fa4deda4 100644
--- a/util/grub-mkconfig.8
+++ b/util/grub-mkconfig.8
@@ -13,5 +13,9 @@
\fB--output\fR=\fIFILE\fR
Write generated output to \fIFILE\fR.
+.TP
+\fB--no-grubenv-update\fR
+Do not update variables in the grubenv file.
+
.SH SEE ALSO
.BR "info grub"
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 4248b9341ab..5e643e16973 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
+export GRUB_GRUBENV_UPDATE="yes"
+
. "${pkgdatadir}/grub-mkconfig_lib"
# Usage: usage
@@ -59,6 +61,7 @@ usage () {
gettext "Generate a grub config file"; echo
echo
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
+ print_option_help "--no-grubenv-update" "$(gettext "do not update variables in the grubenv file")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
echo
@@ -94,6 +97,9 @@ do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
+ --no-grubenv-update)
+ GRUB_GRUBENV_UPDATE="no"
+ ;;
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
@@ -259,7 +265,8 @@ export GRUB_DEFAULT \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
GRUB_DEFAULT_DTB \
- SUSE_BTRFS_SNAPSHOT_BOOTING
+ SUSE_BTRFS_SNAPSHOT_BOOTING \
+ GRUB_ENABLE_BLSCFG
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index b3aae534ddc..bc11df2bd84 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -30,6 +30,9 @@ fi
if test "x$grub_file" = x; then
grub_file="${bindir}/@grub_file@"
fi
+if test "x$grub_editenv" = x; then
+ grub_editenv="${bindir}/@grub_editenv@"
+fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi
@@ -125,8 +128,19 @@ EOF
fi
}
+prepare_grub_to_access_device_with_variable ()
+{
+ device_variable="$1"
+ shift
+ prepare_grub_to_access_device "$@"
+ unset "device_variable"
+}
+
prepare_grub_to_access_device ()
{
+ if [ -z "$device_variable" ]; then
+ device_variable="root"
+ fi
old_ifs="$IFS"
IFS='
'
@@ -161,14 +175,14 @@ prepare_grub_to_access_device ()
# otherwise set root as per value in device.map.
fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`"
if [ "x$fs_hint" != x ]; then
- echo "set root='$fs_hint'"
+ echo "set ${device_variable}='$fs_hint'"
fi
if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
echo "if [ x\$feature_platform_search_hint = xy ]; then"
- echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
+ echo " search --no-floppy --fs-uuid --set=${device_variable} ${hints} ${fs_uuid}"
echo "else"
- echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+ echo " search --no-floppy --fs-uuid --set=${device_variable} ${fs_uuid}"
echo "fi"
fi
IFS="$old_ifs"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index d9a05937e46..3919b8aff4e 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -82,6 +82,67 @@ case x"$GRUB_FS" in
;;
esac
+populate_header_warn()
+{
+cat <<EOF
+
+# This section was generated by a script. Do not modify the generated file - all changes
+# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
+#
+# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
+# populates the boot menu. Please refer to the Boot Loader Specification documentation
+# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
+
+EOF
+}
+
+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
+ if [ x$dirname = x/ ]; then
+ if [ -z "${prepare_root_cache}" ]; then
+ prepare_grub_to_access_device ${GRUB_DEVICE}
+ fi
+ else
+ if [ -z "${prepare_boot_cache}" ]; then
+ prepare_grub_to_access_device ${GRUB_DEVICE_BOOT}
+ fi
+ fi
+
+ if [ -d /sys/firmware/efi ]; then
+ bootefi_device="`${grub_probe} --target=device /boot/efi/`"
+ prepare_grub_to_access_device_with_variable boot ${bootefi_device}
+ else
+ boot_device="`${grub_probe} --target=device /boot/`"
+ prepare_grub_to_access_device_with_variable boot ${boot_device}
+ fi
+
+ populate_header_warn
+
+ cat << EOF
+set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
+
+insmod blscfg
+blscfg
+EOF
+
+ 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
+
+ ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
+ if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
+ ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
+ fi
+ fi
+
+ exit 0
+fi
+
mktitle ()
{
local title_type
@@ -121,6 +182,7 @@ linux_entry ()
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
+
if [ x$type != xsimple ] ; then
title=$(mktitle "$type" "$version")
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
@@ -224,6 +286,7 @@ is_top_level=true
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
gettext_printf "Found linux image: %s\n" "$linux" >&2
+
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -262,7 +325,9 @@ while [ "x$list" != "x" ] ; do
for i in ${initrd}; do
initrd_display="${initrd_display} ${dirname}/${i}"
done
- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
+ if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then
+ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
+ fi
fi
fdt=
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
new file mode 100644 new file mode 100644
index 00000000000..3cc7803c6a1 index 00000000000..1b7536435f1
--- /dev/null --- /dev/null
+++ b/util/grub.d/10_linux_bls.in +++ b/util/grub.d/10_linux_bls.in
@@ -0,0 +1,440 @@ @@ -0,0 +1,478 @@
+#! /bin/sh +#! /bin/sh
+set -e +set -e
+ +
@ -172,6 +390,9 @@ index 00000000000..3cc7803c6a1
+ initrd="" + initrd=""
+ options="" + options=""
+ linux="" + linux=""
+ grub_users=""
+ grub_arg=""
+ grub_class=""
+ +
+ while read -r line + while read -r line
+ do + do
@ -190,17 +411,39 @@ index 00000000000..3cc7803c6a1
+ "options") + "options")
+ options=${value} + options=${value}
+ ;; + ;;
+ "grub_users")
+ grub_users=${value}
+ ;;
+ "grub_arg")
+ grub_arg=${value}
+ ;;
+ "grub_class")
+ grub_class=${value}
+ ;;
+ esac + esac
+ done < ${config_file} + done < ${config_file}
+} +}
+ +
+populate_menu() +populate_menu()
+{ +{
+ entries_path="/boot/loader/entries" + blsdir="/boot/loader/entries"
+ local -a files
+ local IFS=$'\n'
+ gettext_printf "Generating boot entries from BLS files...\n" >&2 + gettext_printf "Generating boot entries from BLS files...\n" >&2
+ for config in $(ls -v -r $entries_path/*.conf); do +
+ read_config ${config} + files=($(for bls in ${blsdir}/*.conf ; do
+ menu="${menu}menuentry '${title}' {\n" + if ! [[ -e "${bls}" ]] ; then
+ continue
+ fi
+ bls="${bls%.conf}"
+ bls="${bls##*/}"
+ echo "${bls}"
+ done | ${kernel_sort} | tac)) || :
+
+ for bls in "${files[@]}" ; do
+ read_config "${blsdir}/${bls}.conf"
+
+ menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n"
+ menu="${menu}\t linux ${linux} ${options}\n" + menu="${menu}\t linux ${linux} ${options}\n"
+ if [ -n "${initrd}" ] ; then + if [ -n "${initrd}" ] ; then
+ menu="${menu}\t initrd ${boot_prefix}${initrd}\n" + menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
@ -236,17 +479,30 @@ index 00000000000..3cc7803c6a1
+ +
+ if [ -d /sys/firmware/efi ]; then + if [ -d /sys/firmware/efi ]; then
+ bootefi_device="`${grub_probe} --target=device /boot/efi/`" + bootefi_device="`${grub_probe} --target=device /boot/efi/`"
+ prepare_grub_to_access_device ${bootefi_device} boot + prepare_grub_to_access_device_with_variable boot ${bootefi_device}
+ else + else
+ boot_device="`${grub_probe} --target=device /boot/`" + boot_device="`${grub_probe} --target=device /boot/`"
+ prepare_grub_to_access_device ${boot_device} boot + prepare_grub_to_access_device_with_variable boot ${boot_device}
+ fi + fi
+ +
+ populate_header_warn + populate_header_warn
+ populate_menu + populate_menu
+ +
+ ${grub_editenv} - set saved_entry=0 + 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
+
+ ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" + ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
+ if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
+ ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
+ fi
+ fi
+ +
+ exit 0 + exit 0
+ fi + fi

View File

@ -18,10 +18,10 @@ to the kexec command line tool, to allow booting the selected menu entry.
create mode 100644 grub-core/loader/emu/linux.c create mode 100644 grub-core/loader/emu/linux.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index e52d776887a..067b97a4221 100644 index 8bb5eb0f47f..e70558a800a 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -1710,7 +1710,6 @@ module = { @@ -1712,7 +1712,6 @@ module = {
common = loader/linux.c; common = loader/linux.c;
common = lib/cmdline.c; common = lib/cmdline.c;

View File

@ -4,20 +4,24 @@ Date: Thu, 15 Mar 2018 14:12:40 -0400
Subject: [PATCH] Add grub2-switch-to-blscfg Subject: [PATCH] Add grub2-switch-to-blscfg
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
[jhlavac: Use ${etcdefaultgrub} instead of /etc/default/grub]
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
--- ---
Makefile.util.def | 7 ++ Makefile.util.def | 7 +
.gitignore | 2 + .gitignore | 2 +
util/grub-switch-to-blscfg.8 | 25 ++++ util/grub-set-password.in | 2 +-
util/grub-switch-to-blscfg.in | 262 ++++++++++++++++++++++++++++++++++++++++++ util/grub-switch-to-blscfg.8 | 33 +++++
4 files changed, 296 insertions(+) util/grub-switch-to-blscfg.in | 314 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 357 insertions(+), 1 deletion(-)
create mode 100644 util/grub-switch-to-blscfg.8 create mode 100644 util/grub-switch-to-blscfg.8
create mode 100644 util/grub-switch-to-blscfg.in create mode 100644 util/grub-switch-to-blscfg.in
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index 879e8eb98a4..f4fbd250630 100644 index c16c2ca545a..aa59418ff2c 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -1348,6 +1348,13 @@ program = { @@ -1355,6 +1355,13 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
}; };
@ -32,7 +36,7 @@ index 879e8eb98a4..f4fbd250630 100644
name = grub-glue-efi; name = grub-glue-efi;
mansection = 1; mansection = 1;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 54795fa60be..42475592123 100644 index 096eeff7de8..7aaae594d51 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -121,6 +121,8 @@ grub-*.tar.* @@ -121,6 +121,8 @@ grub-*.tar.*
@ -44,12 +48,24 @@ index 54795fa60be..42475592123 100644
/grub_fstest.pp /grub_fstest.pp
/grub_fstest_init.c /grub_fstest_init.c
/grub_fstest_init.lst /grub_fstest_init.lst
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index 5ebf50576d6..c0b5ebbfdc5 100644
--- a/util/grub-set-password.in
+++ b/util/grub-set-password.in
@@ -1,6 +1,6 @@
#!/bin/sh -e
-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')
+EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g')
if [ -d /sys/firmware/efi/efivars/ ]; then
grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
else
diff --git a/util/grub-switch-to-blscfg.8 b/util/grub-switch-to-blscfg.8 diff --git a/util/grub-switch-to-blscfg.8 b/util/grub-switch-to-blscfg.8
new file mode 100644 new file mode 100644
index 00000000000..134dfc62a7b index 00000000000..9a886282976
--- /dev/null --- /dev/null
+++ b/util/grub-switch-to-blscfg.8 +++ b/util/grub-switch-to-blscfg.8
@@ -0,0 +1,25 @@ @@ -0,0 +1,33 @@
+.TH GRUB-SWITCH-TO-BLSCFG 1 "Wed Feb 26 2014" +.TH GRUB-SWITCH-TO-BLSCFG 1 "Wed Feb 26 2014"
+.SH NAME +.SH NAME
+\fBgrub-switch-to-blscfg\fR \(em Switch to using BLS config files. +\fBgrub-switch-to-blscfg\fR \(em Switch to using BLS config files.
@ -73,14 +89,22 @@ index 00000000000..134dfc62a7b
+--grub-defaults=\fIFILE\fR +--grub-defaults=\fIFILE\fR
+The defaults file for grub-mkconfig. The default value is \fI/etc/default/grub\fR. +The defaults file for grub-mkconfig. The default value is \fI/etc/default/grub\fR.
+ +
+.TP
+--bls-directory=\fIDIR\fR
+Create BootLoaderSpec fragments in \fIDIR\fR. The default value is \fI/boot/loader/entries\fR.
+
+.TP
+--backup-suffix=\fSUFFIX\fR
+The suffix to use for saved backup files. The default value is \fI.bak\fR.
+
+.SH SEE ALSO +.SH SEE ALSO
+.BR "info grub" +.BR "info grub"
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
new file mode 100644 new file mode 100644
index 00000000000..3ae5e4ea8d0 index 00000000000..49b3985fadb
--- /dev/null --- /dev/null
+++ b/util/grub-switch-to-blscfg.in +++ b/util/grub-switch-to-blscfg.in
@@ -0,0 +1,262 @@ @@ -0,0 +1,314 @@
+#! /bin/sh +#! /bin/sh
+# +#
+# Set a default boot entry for GRUB. +# Set a default boot entry for GRUB.
@ -104,6 +128,7 @@ index 00000000000..3ae5e4ea8d0
+# Initialize some variables. +# Initialize some variables.
+prefix=@prefix@ +prefix=@prefix@
+exec_prefix=@exec_prefix@ +exec_prefix=@exec_prefix@
+sbindir=@sbindir@
+bindir=@bindir@ +bindir=@bindir@
+sysconfdir="@sysconfdir@" +sysconfdir="@sysconfdir@"
+PACKAGE_NAME=@PACKAGE_NAME@ +PACKAGE_NAME=@PACKAGE_NAME@
@ -116,22 +141,27 @@ index 00000000000..3ae5e4ea8d0
+ +
+self=`basename $0` +self=`basename $0`
+ +
+grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
+grub_editenv=${bindir}/@grub_editenv@ +grub_editenv=${bindir}/@grub_editenv@
+etcdefaultgrub=/etc/default/grub +etcdefaultgrub=/etc/default/grub
+ +
+EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/') +eval "$("${grub_get_kernel_settings}")" || true
+
+EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g')
+if [ -d /sys/firmware/efi/efivars/ ]; then +if [ -d /sys/firmware/efi/efivars/ ]; then
+ startlink=/etc/grub2-efi.cfg + startlink=/etc/grub2-efi.cfg
+ grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'` + grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
+ blsdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/loader/entries" | sed 's,//*,/,g'`
+else +else
+ startlink=/etc/grub2.cfg + startlink=/etc/grub2.cfg
+ grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` + grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
+ blsdir=`echo "/@bootdirname@" | sed 's,//*,/,g'`
+fi +fi
+ +
+blsdir=`echo "/@bootdirname@/loader/entries" | sed 's,//*,/,g'`
+
+backupsuffix=.bak +backupsuffix=.bak
+ +
+arch="$(uname -m)"
+
+export TEXTDOMAIN=@PACKAGE@ +export TEXTDOMAIN=@PACKAGE@
+export TEXTDOMAINDIR="@localedir@" +export TEXTDOMAINDIR="@localedir@"
+ +
@ -230,18 +260,18 @@ index 00000000000..3ae5e4ea8d0
+ +
+find_grub_cfg() { +find_grub_cfg() {
+ local candidate="" + local candidate=""
+ while [[ -e "${candidate}" || $# -gt 0 ]] + while [ -e "${candidate}" -o $# -gt 0 ]
+ do + do
+ if [[ ! -e "${candidate}" ]] ; then + if [ ! -e "${candidate}" ] ; then
+ candidate="$1" + candidate="$1"
+ shift + shift
+ fi + fi
+ +
+ if [[ -L "${candidate}" ]]; then + if [ -L "${candidate}" ]; then
+ candidate="$(realpath "${candidate}")" + candidate="$(realpath "${candidate}")"
+ fi + fi
+ +
+ if [[ -f "${candidate}" ]]; then + if [ -f "${candidate}" ]; then
+ export GRUB_CONFIG_FILE="${candidate}" + export GRUB_CONFIG_FILE="${candidate}"
+ return 0 + return 0
+ fi + fi
@ -254,11 +284,11 @@ index 00000000000..3ae5e4ea8d0
+ exit 1 + exit 1
+fi +fi
+ +
+if [[ ! -d "${blsdir}" ]]; then +if [ ! -d "${blsdir}" ]; then
+ install -m 700 -d "${blsdir}" + install -m 700 -d "${blsdir}"
+fi +fi
+ +
+if [[ -f /etc/machine-id ]]; then +if [ -f /etc/machine-id ]; then
+ MACHINE_ID=$(cat /etc/machine-id) + MACHINE_ID=$(cat /etc/machine-id)
+else +else
+ MACHINE_ID=$(dmesg | sha256sum) + MACHINE_ID=$(dmesg | sha256sum)
@ -267,14 +297,17 @@ index 00000000000..3ae5e4ea8d0
+mkbls() { +mkbls() {
+ local kernelver=$1 && shift + local kernelver=$1 && shift
+ local datetime=$1 && shift + local datetime=$1 && shift
+ local bootprefix=$1 && shift
+ +
+ local debugname="" + local debugname=""
+ local debugid=""
+ local flavor="" + local flavor=""
+ +
+ if [[ "$kernelver" == *\+* ]] ; then + if [ "$kernelver" == *\+* ] ; then
+ local flavor=-"${kernelver##*+}" + local flavor=-"${kernelver##*+}"
+ if [[ "${flavor}" == "-debug" ]]; then + if [ "${flavor}" == "-debug" ]; then
+ local debugname=" with debugging" + local debugname=" with debugging"
+ local debugid="-debug"
+ fi + fi
+ fi + fi
+ ( + (
@ -282,8 +315,9 @@ index 00000000000..3ae5e4ea8d0
+ +
+ cat <<EOF + cat <<EOF
+title ${NAME} (${kernelver}) ${VERSION}${debugname} +title ${NAME} (${kernelver}) ${VERSION}${debugname}
+linux /vmlinuz-${kernelver} +version ${kernelver}${debugid}
+initrd /initramfs-${kernelver}.img +linux ${bootprefix}/vmlinuz-${kernelver}
+initrd ${bootprefix}/initramfs-${kernelver}.img
+options \$kernelopts +options \$kernelopts
+id ${ID}-${datetime}-${kernelver} +id ${ID}-${datetime}-${kernelver}
+grub_users \$grub_users +grub_users \$grub_users
@ -293,24 +327,52 @@ index 00000000000..3ae5e4ea8d0
+ ) | cat + ) | cat
+} +}
+ +
+copy_bls() {
+ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do + for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
+ if [[ ! -d "/lib/modules/${kernelver}" ]] ; then
+ continue
+ fi
+ if [[ ! -f "/boot/vmlinuz-${kernelver}" ]]; then
+ continue
+ fi
+ bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf" + bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf"
+ linux="/vmlinuz-${kernelver}"
+ linux_path="/boot${linux}"
+ kernel_dir="/lib/modules/${kernelver}" + kernel_dir="/lib/modules/${kernelver}"
+ if [[ -f "${kernel_dir}/bls.conf" ]]; then +
+ if [ ! -d "${kernel_dir}" ] ; then
+ continue
+ fi
+ if [ ! -f "${linux_path}" ]; then
+ continue
+ fi
+
+ linux_relpath="$("${grub_mkrelpath}" "${linux_path}")"
+ bootprefix="${linux_relpath%%"${linux}"}"
+
+ if [ -f "${kernel_dir}/bls.conf" ] ; then
+ cp -af "${kernel_dir}/bls.conf" "${bls_target}" + cp -af "${kernel_dir}/bls.conf" "${bls_target}"
+ if [ -n "${bootprefix}" ]; then
+ sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
+ sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
+ fi
+ else + else
+ mkbls "${kernelver}" \ + mkbls "${kernelver}" \
+ "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \ + "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \
+ "${bootprefix}" \
+ >"${bls_target}" + >"${bls_target}"
+ fi + fi
+
+ if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
+ bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")"
+ cp -aT "${bls_target}" "${bls_debug}"
+ title="$(grep '^title[ \t]' "${bls_debug}" | sed -e 's/^title[ \t]*//')"
+ blsid="$(grep '^id[ \t]' "${bls_debug}" | sed -e "s/\.${ARCH}/-debug.${arch}/")"
+ sed -i -e "s/^title.*/title ${title}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${bls_debug}"
+ sed -i -e "s/^id.*/${blsid}/" "${bls_debug}"
+ sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${bls_debug}"
+ fi
+ done + done
+ +
+ if [ -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]; then
+ mkbls "0-rescue-${MACHINE_ID}" "0" "${bootprefix}" >"${blsdir}/${MACHINE_ID}-0-rescue.conf"
+ fi
+}
+
+GENERATE=0 +GENERATE=0
+if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \ +if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \
+ | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then + | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then
@ -329,13 +391,27 @@ index 00000000000..3ae5e4ea8d0
+ GENERATE=1 + GENERATE=1
+fi +fi
+ +
+if [[ "${GENERATE}" -eq 1 ]] ; then +if [ "${GENERATE}" -eq 1 ] ; then
+ copy_bls
+
+ if [ $arch = "x86_64" ] && [ ! -d /sys/firmware/efi ]; then
+ mod_dir="i386-pc"
+ elif [ $arch = "ppc64" -o $arch = "ppc64le" ] && [ ! -d /sys/firmware/opal ]; then
+ mod_dir="powerpc-ieee1275"
+ fi
+
+ if [ -n "${mod_dir}" ]; then
+ for mod in blscfg increment; do
+ cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1
+ done
+ fi
+
+ cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}" + cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"
+ if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then + if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then
+ cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" + cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}"
+ sed -i"${backupsuffix}" \ + sed -i"${backupsuffix}" \
+ -e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \ + -e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \
+ /etc/default/grub + "${etcdefaultgrub}"
+ gettext_printf "Updating %s failed\n" "${GRUB_CONFIG_FILE}" + gettext_printf "Updating %s failed\n" "${GRUB_CONFIG_FILE}"
+ exit 1 + exit 1
+ fi + fi

View File

@ -47,7 +47,7 @@ index 636f97e1ba1..e758ab3416d 100644
grub_printf ("%s:%d: ", file, line); grub_printf ("%s:%d: ", file, line);
va_start (args, fmt); va_start (args, fmt);
diff --git a/include/grub/misc.h b/include/grub/misc.h diff --git a/include/grub/misc.h b/include/grub/misc.h
index cbfae75a1b4..f7473c154f0 100644 index fcaf1201e39..0f5abc4638e 100644
--- a/include/grub/misc.h --- a/include/grub/misc.h
+++ b/include/grub/misc.h +++ b/include/grub/misc.h
@@ -367,6 +367,7 @@ grub_puts (const char *s) @@ -367,6 +367,7 @@ grub_puts (const char *s)

View File

@ -38,7 +38,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
delete mode 100644 grub-core/lib/i386/backtrace.c delete mode 100644 grub-core/lib/i386/backtrace.c
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index f4fbd250630..cbd661d6348 100644 index aa59418ff2c..4e722ab766b 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -49,6 +49,12 @@ library = { @@ -49,6 +49,12 @@ library = {
@ -55,13 +55,13 @@ index f4fbd250630..cbd661d6348 100644
library = { library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 067b97a4221..cb24f92a431 100644 index e70558a800a..63b33490b11 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -130,6 +130,12 @@ kernel = { @@ -129,6 +129,12 @@ kernel = {
common = kern/rescue_parser.c;
common = kern/rescue_reader.c; common = kern/rescue_reader.c;
common = kern/term.c; common = kern/term.c;
common = kern/qsort.c;
+ common = kern/backtrace.c; + common = kern/backtrace.c;
+ +
+ x86 = kern/i386/backtrace.c; + x86 = kern/i386/backtrace.c;
@ -71,7 +71,7 @@ index 067b97a4221..cb24f92a431 100644
noemu = kern/compiler-rt.c; noemu = kern/compiler-rt.c;
noemu = kern/mm.c; noemu = kern/mm.c;
@@ -176,9 +182,6 @@ kernel = { @@ -175,9 +181,6 @@ kernel = {
softdiv = lib/division.c; softdiv = lib/division.c;
@ -81,7 +81,7 @@ index 067b97a4221..cb24f92a431 100644
i386 = kern/i386/dl.c; i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c; i386_xen = kern/i386/dl.c;
@@ -2277,13 +2280,11 @@ module = { @@ -2279,13 +2282,11 @@ module = {
module = { module = {
name = backtrace; name = backtrace;

View File

@ -8,10 +8,10 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index b69f9e738fa..04ae9ed02f6 100644 index ea749f26fd5..4117317c4c4 100644
--- a/grub-core/normal/main.c --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -419,6 +419,9 @@ grub_normal_reader_init (int nested) @@ -425,6 +425,9 @@ grub_normal_reader_init (int nested)
const char *msg_esc = _("ESC at any time exits."); const char *msg_esc = _("ESC at any time exits.");
char *msg_formatted; char *msg_formatted;

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