Accepting request 788095 from Base:System

OBS-URL: https://build.opensuse.org/request/show/788095
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=217
This commit is contained in:
Dominique Leuenberger 2020-03-25 22:43:37 +00:00 committed by Git OBS Bridge
parent 06a9ec90f3
commit a906f2c910
6 changed files with 714 additions and 18 deletions

View File

@ -0,0 +1,311 @@
From aa096037ae013c553acf52f9e3aa3a49c91f3c57 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 14 Feb 2020 12:44:14 +0100
Subject: [PATCH] normal: Move common datetime functions out of the normal
module
The common datetime helper functions are currently included in the normal
module, but this makes any other module that calls these functions to have
a dependency with the normal module only for this reason.
Since the normal module does a lot of stuff, it calls functions from other
modules. But since other modules may depend on it for calling the datetime
helpers, this could lead to circular dependencies between modules.
As an example, when platform == xen the grub_get_datetime() function from
the datetime module calls to the grub_unixtime2datetime() helper function
from the normal module. Which leads to the following module dependency:
datetime -> normal
and send_dhcp_packet() from the net module calls the grub_get_datetime()
function, which leads to the following module dependency:
net -> datetime -> normal
but that means that the normal module is not allowed to depend on net or
any other module that depends on it due the transitive dependency caused
by datetime. A recent patch attempted to add support to fetch the config
file over the network, which leads to the following circular dependency:
normal -> net -> datetime -> normal
So having the datetime helpers in the normal module makes it quite fragile
and easy to add circular dependencies like these, that break the build due
the genmoddep.awk script catching the issues.
Fix this by taking the datetime helper functions out of the normal module
and instead add them to the datetime module itself. Besides fixing these
issues, it makes more sense to have these helper functions there anyways.
Reported-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
Makefile.util.def | 2 +-
grub-core/Makefile.core.def | 2 +-
grub-core/{normal => lib}/datetime.c | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename grub-core/{normal => lib}/datetime.c (100%)
Index: grub-2.04/Makefile.util.def
===================================================================
--- grub-2.04.orig/Makefile.util.def
+++ grub-2.04/Makefile.util.def
@@ -139,7 +139,7 @@ library = {
common = grub-core/lib/crc.c;
common = grub-core/lib/adler32.c;
common = grub-core/lib/crc64.c;
- common = grub-core/normal/datetime.c;
+ common = grub-core/lib/datetime.c;
common = grub-core/normal/misc.c;
common = grub-core/partmap/acorn.c;
common = grub-core/partmap/amiga.c;
Index: grub-2.04/grub-core/Makefile.core.def
===================================================================
--- grub-2.04.orig/grub-core/Makefile.core.def
+++ grub-2.04/grub-core/Makefile.core.def
@@ -1657,6 +1657,7 @@ module = {
module = {
name = datetime;
+ common = lib/datetime.c;
cmos = lib/cmos_datetime.c;
efi = lib/efi/datetime.c;
uboot = lib/dummy/datetime.c;
@@ -1903,7 +1904,6 @@ module = {
common = normal/autofs.c;
common = normal/color.c;
common = normal/completion.c;
- common = normal/datetime.c;
common = normal/menu.c;
common = normal/menu_entry.c;
common = normal/menu_text.c;
Index: grub-2.04/grub-core/lib/datetime.c
===================================================================
--- /dev/null
+++ grub-2.04/grub-core/lib/datetime.c
@@ -0,0 +1,109 @@
+/* datetime.c - Module for common datetime function. */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ * 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/datetime.h>
+#include <grub/i18n.h>
+
+static const char *const grub_weekday_names[] =
+{
+ N_("Sunday"),
+ N_("Monday"),
+ N_("Tuesday"),
+ N_("Wednesday"),
+ N_("Thursday"),
+ N_("Friday"),
+ N_("Saturday"),
+};
+
+int
+grub_get_weekday (struct grub_datetime *datetime)
+{
+ unsigned a, y, m;
+
+ if (datetime->month <= 2)
+ a = 1;
+ else
+ a = 0;
+ y = datetime->year - a;
+ m = datetime->month + 12 * a - 2;
+
+ return (datetime->day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7;
+}
+
+const char *
+grub_get_weekday_name (struct grub_datetime *datetime)
+{
+ return _ (grub_weekday_names[grub_get_weekday (datetime)]);
+}
+
+#define SECPERMIN 60
+#define SECPERHOUR (60*SECPERMIN)
+#define SECPERDAY (24*SECPERHOUR)
+#define DAYSPERYEAR 365
+#define DAYSPER4YEARS (4*DAYSPERYEAR+1)
+
+
+void
+grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime)
+{
+ int i;
+ grub_uint8_t months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+ /* In the period of validity of unixtime all years divisible by 4
+ are bissextile*/
+ /* Convenience: let's have 3 consecutive non-bissextile years
+ at the beginning of the counting date. So count from 1901. */
+ int days_epoch;
+ /* Number of days since 1st Januar, 1901. */
+ unsigned days;
+ /* Seconds into current day. */
+ unsigned secs_in_day;
+ /* Transform C divisions and modulos to mathematical ones */
+ if (nix < 0)
+ days_epoch = -(((unsigned) (SECPERDAY-nix-1)) / SECPERDAY);
+ else
+ days_epoch = ((unsigned) nix) / SECPERDAY;
+ secs_in_day = nix - days_epoch * SECPERDAY;
+ days = days_epoch + 69 * DAYSPERYEAR + 17;
+
+ datetime->year = 1901 + 4 * (days / DAYSPER4YEARS);
+ days %= DAYSPER4YEARS;
+ /* On 31st December of bissextile years 365 days from the beginning
+ of the year elapsed but year isn't finished yet */
+ if (days / DAYSPERYEAR == 4)
+ {
+ datetime->year += 3;
+ days -= 3*DAYSPERYEAR;
+ }
+ else
+ {
+ datetime->year += days / DAYSPERYEAR;
+ days %= DAYSPERYEAR;
+ }
+ for (i = 0; i < 12
+ && days >= (i==1 && datetime->year % 4 == 0
+ ? 29 : months[i]); i++)
+ days -= (i==1 && datetime->year % 4 == 0
+ ? 29 : months[i]);
+ datetime->month = i + 1;
+ datetime->day = 1 + days;
+ datetime->hour = (secs_in_day / SECPERHOUR);
+ secs_in_day %= SECPERHOUR;
+ datetime->minute = secs_in_day / SECPERMIN;
+ datetime->second = secs_in_day % SECPERMIN;
+}
Index: grub-2.04/grub-core/normal/datetime.c
===================================================================
--- grub-2.04.orig/grub-core/normal/datetime.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* datetime.c - Module for common datetime function. */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * 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/datetime.h>
-#include <grub/i18n.h>
-
-static const char *const grub_weekday_names[] =
-{
- N_("Sunday"),
- N_("Monday"),
- N_("Tuesday"),
- N_("Wednesday"),
- N_("Thursday"),
- N_("Friday"),
- N_("Saturday"),
-};
-
-int
-grub_get_weekday (struct grub_datetime *datetime)
-{
- unsigned a, y, m;
-
- if (datetime->month <= 2)
- a = 1;
- else
- a = 0;
- y = datetime->year - a;
- m = datetime->month + 12 * a - 2;
-
- return (datetime->day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7;
-}
-
-const char *
-grub_get_weekday_name (struct grub_datetime *datetime)
-{
- return _ (grub_weekday_names[grub_get_weekday (datetime)]);
-}
-
-#define SECPERMIN 60
-#define SECPERHOUR (60*SECPERMIN)
-#define SECPERDAY (24*SECPERHOUR)
-#define DAYSPERYEAR 365
-#define DAYSPER4YEARS (4*DAYSPERYEAR+1)
-
-
-void
-grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime)
-{
- int i;
- grub_uint8_t months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- /* In the period of validity of unixtime all years divisible by 4
- are bissextile*/
- /* Convenience: let's have 3 consecutive non-bissextile years
- at the beginning of the counting date. So count from 1901. */
- int days_epoch;
- /* Number of days since 1st Januar, 1901. */
- unsigned days;
- /* Seconds into current day. */
- unsigned secs_in_day;
- /* Transform C divisions and modulos to mathematical ones */
- if (nix < 0)
- days_epoch = -(((unsigned) (SECPERDAY-nix-1)) / SECPERDAY);
- else
- days_epoch = ((unsigned) nix) / SECPERDAY;
- secs_in_day = nix - days_epoch * SECPERDAY;
- days = days_epoch + 69 * DAYSPERYEAR + 17;
-
- datetime->year = 1901 + 4 * (days / DAYSPER4YEARS);
- days %= DAYSPER4YEARS;
- /* On 31st December of bissextile years 365 days from the beginning
- of the year elapsed but year isn't finished yet */
- if (days / DAYSPERYEAR == 4)
- {
- datetime->year += 3;
- days -= 3*DAYSPERYEAR;
- }
- else
- {
- datetime->year += days / DAYSPERYEAR;
- days %= DAYSPERYEAR;
- }
- for (i = 0; i < 12
- && days >= (i==1 && datetime->year % 4 == 0
- ? 29 : months[i]); i++)
- days -= (i==1 && datetime->year % 4 == 0
- ? 29 : months[i]);
- datetime->month = i + 1;
- datetime->day = 1 + days;
- datetime->hour = (secs_in_day / SECPERHOUR);
- secs_in_day %= SECPERHOUR;
- datetime->minute = secs_in_day / SECPERMIN;
- datetime->second = secs_in_day % SECPERMIN;
-}

View File

@ -0,0 +1,65 @@
From 8c2c35dcc027a77aee48de89093d8770de0a8cf8 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 22 Jan 2020 12:01:52 +0100
Subject: [PATCH] kern: Add %X option to printf functions
The printf(3) function has support for the %X format specifier, to output
an unsigned hexadecimal integer in uppercase.
This can be achived in GRUB using the %x format specifier in grub_printf()
and calling grub_toupper(), but it is more convenient if there is support
for %X in grub_printf().
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/kern/misc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: grub-2.04/grub-core/kern/misc.c
===================================================================
--- grub-2.04.orig/grub-core/kern/misc.c
+++ grub-2.04/grub-core/kern/misc.c
@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uin
static inline char *
grub_lltoa (char *str, int c, unsigned long long n)
{
- unsigned base = (c == 'x') ? 16 : 10;
+ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
char *p;
if ((long long) n < 0 && c == 'd')
@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned l
do
{
unsigned d = (unsigned) (n & 0xf);
- *p++ = (d > 9) ? d + 'a' - 10 : d + '0';
+ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
}
while (n >>= 4);
else
@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, str
{
case 'p':
case 'x':
+ case 'X':
case 'u':
case 'd':
case 'c':
@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, str
switch (c)
{
case 'x':
+ case 'X':
case 'u':
args->ptr[curn].type = UNSIGNED_INT + longfmt;
break;
@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_siz
c = 'x';
/* Fall through. */
case 'x':
+ case 'X':
case 'u':
case 'd':
{

View File

@ -0,0 +1,228 @@
From cb2f15c544895e1f3d540dd39d36c4611bdf5b7b Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 22 Jan 2020 12:01:55 +0100
Subject: [PATCH] normal/main: Search for specific config files for netboot
This patch implements a search for a specific configuration when the config
file is on a remoteserver. It uses the following order:
1) DHCP client UUID option.
2) MAC address (in lower case hexadecimal with dash separators);
3) IP (in upper case hexadecimal) or IPv6;
4) The original grub.cfg file.
This procedure is similar to what is used by pxelinux and yaboot:
http://www.syslinux.org/wiki/index.php/PXELINUX#config
It is enabled by default but can be disabled by setting the environment
variable "feature_net_search_cfg" to "n" in an embedded configuration.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=873406
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/net/net.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++
grub-core/normal/main.c | 26 ++++++++--
include/grub/net.h | 2 +
3 files changed, 155 insertions(+), 4 deletions(-)
Index: grub-2.04/grub-core/net/net.c
===================================================================
--- grub-2.04.orig/grub-core/net/net.c
+++ grub-2.04/grub-core/net/net.c
@@ -1814,6 +1814,137 @@ grub_net_restore_hw (void)
return GRUB_ERR_NONE;
}
+grub_err_t
+grub_net_search_config_file (char *config)
+{
+ grub_size_t config_len;
+ char *suffix;
+
+ auto int search_through (grub_size_t num_tries, grub_size_t slice_size);
+ int search_through (grub_size_t num_tries, grub_size_t slice_size)
+ {
+ while (num_tries-- > 0)
+ {
+ grub_file_t file;
+
+ grub_dprintf ("net", "attempt to fetch config %s\n", config);
+
+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
+
+ if (file)
+ {
+ grub_file_close (file);
+ return 0;
+ }
+ else
+ {
+ if (grub_errno == GRUB_ERR_IO)
+ grub_errno = GRUB_ERR_NONE;
+ }
+
+ if (grub_strlen (suffix) < slice_size)
+ break;
+
+ config[grub_strlen (config) - slice_size] = '\0';
+ }
+
+ return 1;
+ }
+
+ config_len = grub_strlen (config);
+ config[config_len] = '-';
+ suffix = config + config_len + 1;
+
+ struct grub_net_network_level_interface *inf;
+ FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
+ {
+ /* By the Client UUID. */
+ char *ptr;
+ int client_uuid_len;
+ char *client_uuid_var;
+ const char *client_uuid;
+
+ client_uuid_len = sizeof ("net_") + grub_strlen (inf->name) +
+ sizeof ("_clientuuid") + 1;
+
+ client_uuid_var = grub_zalloc (client_uuid_len);
+ if (!client_uuid_var)
+ return grub_errno;
+
+ grub_snprintf (client_uuid_var, client_uuid_len,
+ "net_%s_clientuuid", inf->name);
+
+ client_uuid = grub_env_get (client_uuid_var);
+ grub_free (client_uuid_var);
+
+ if (client_uuid)
+ {
+ grub_strcpy (suffix, client_uuid);
+ if (search_through (1, 0) == 0)
+ return GRUB_ERR_NONE;
+ }
+
+ /* By the MAC address. */
+
+ /* Add ethernet type */
+ grub_strcpy (suffix, "01-");
+
+ grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3);
+
+ for (ptr = suffix; *ptr; ptr++)
+ if (*ptr == ':')
+ *ptr = '-';
+
+ if (search_through (1, 0) == 0)
+ return GRUB_ERR_NONE;
+
+ /* By IP address */
+
+ switch ((&inf->address)->type)
+ {
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4:
+ {
+ grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4);
+
+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \
+ ((n >> 24) & 0xff), ((n >> 16) & 0xff), \
+ ((n >> 8) & 0xff), ((n >> 0) & 0xff));
+
+ if (search_through (8, 1) == 0)
+ return GRUB_ERR_NONE;
+ break;
+ }
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
+ {
+ char buf[GRUB_NET_MAX_STR_ADDR_LEN];
+ struct grub_net_network_level_address base;
+ base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16);
+ grub_net_addr_to_str (&base, buf);
+
+ for (ptr = buf; *ptr; ptr++)
+ if (*ptr == ':')
+ *ptr = '-';
+
+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf);
+ if (search_through (1, 0) == 0)
+ return GRUB_ERR_NONE;
+ break;
+ }
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
+ return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
+ default:
+ return grub_error (GRUB_ERR_BUG,
+ "unsupported address type %d", (&inf->address)->type);
+ }
+ }
+
+ /* Remove the remaining minus sign at the end. */
+ config[config_len] = '\0';
+
+ return GRUB_ERR_NONE;
+}
+
static struct grub_preboot *fini_hnd;
static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
Index: grub-2.04/grub-core/normal/main.c
===================================================================
--- grub-2.04.orig/grub-core/normal/main.c
+++ grub-2.04/grub-core/normal/main.c
@@ -18,6 +18,7 @@
*/
#include <grub/kernel.h>
+#include <grub/net.h>
#include <grub/normal.h>
#include <grub/dl.h>
#include <grub/misc.h>
@@ -341,10 +342,27 @@ grub_cmd_normal (struct grub_command *cm
prefix = grub_env_get ("prefix");
if (prefix)
- {
- config = grub_xasprintf ("%s/grub.cfg", prefix);
- if (! config)
- goto quit;
+ {
+ grub_size_t config_len;
+ int disable_net_search = 0;
+ const char *net_search_cfg;
+
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
+
+ if (!config)
+ goto quit;
+
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+
+ net_search_cfg = grub_env_get ("feature_net_search_cfg");
+ if (net_search_cfg && net_search_cfg[0] == 'n')
+ disable_net_search = 1;
+
+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0 &&
+ !disable_net_search)
+ grub_net_search_config_file (config);
grub_enter_normal_mode (config);
grub_free (config);
Index: grub-2.04/include/grub/net.h
===================================================================
--- grub-2.04.orig/include/grub/net.h
+++ grub-2.04/include/grub/net.h
@@ -641,6 +641,8 @@ grub_net_add_dns_server (const struct gr
void
grub_net_remove_dns_server (const struct grub_net_network_level_address *s);
+grub_err_t
+grub_net_search_config_file (char *config);
extern char *grub_net_default_server;

View File

@ -0,0 +1,32 @@
From 1657e72f5bd6cdb9c35cbeb394c1d4329f8f024b Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Thu, 5 Mar 2020 16:52:18 -0500
Subject: [PATCH] datetime: Enable the datetime module for the emu platform
Fixes a build failure:
grub-core/commands/date.c:49: undefined reference to `grub_get_weekday_name'
grub-core/commands/ls.c:155: undefined reference to `grub_unixtime2datetime'
Bug: https://bugs.gentoo.org/711512
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/Makefile.core.def | 1 -
1 file changed, 1 deletion(-)
Index: grub-2.04/grub-core/Makefile.core.def
===================================================================
--- grub-2.04.orig/grub-core/Makefile.core.def
+++ grub-2.04/grub-core/Makefile.core.def
@@ -1670,7 +1670,6 @@ module = {
i386_xen_pvh = lib/xen/datetime.c;
mips_arc = lib/arc/datetime.c;
- enable = noemu;
};
module = {

View File

@ -1,9 +1,30 @@
-------------------------------------------------------------------
Fri Mar 20 10:36:54 UTC 2020 - Michael Chang <mchang@suse.com>
- Backport to support searching for specific config files for netboot
(bsc#1166409)
* 0001-normal-Move-common-datetime-functions-out-of-the-nor.patch
* 0002-kern-Add-X-option-to-printf-functions.patch
* 0003-normal-main-Search-for-specific-config-files-for-net.patch
* 0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch
-------------------------------------------------------------------
Mon Mar 16 11:42:08 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- move *.module files to separate -debug subpackage (boo#1166578)
-------------------------------------------------------------------
Thu Mar 12 08:29:55 UTC 2020 - Fabian Vogt <fvogt@suse.com>
- Adjust patch to make EFI detection a runtime decision (bsc#1164385):
- Fix EFI console detection to make it a runtime decision (bsc#1164385)
* grub2-SUSE-Add-the-t-hotkey.patch
-------------------------------------------------------------------
Tue Mar 10 11:59:23 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- Downgrade mtools to Suggests for consistency with xorriso (boo#1165839)
- remove info requirements, file triggers are used now (boo#1152105)
-------------------------------------------------------------------
Fri Feb 28 16:36:57 UTC 2020 - rw@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -291,6 +291,12 @@ Patch511: grub2-gfxmenu-support-scrolling-menu-entry-s-text.patch
Patch601: risc-v-fix-computation-of-pc-relative-relocation-offset.patch
Patch602: risc-v-add-clzdi2-symbol.patch
Patch603: grub-install-define-default-platform-for-risc-v.patch
# bsc#1166409 - Grub netbooting does not search for grub.cfg files with mac
# address or ip address in filename
Patch700: 0001-normal-Move-common-datetime-functions-out-of-the-nor.patch
Patch701: 0002-kern-Add-X-option-to-printf-functions.patch
Patch702: 0003-normal-main-Search-for-specific-config-files-for-net.patch
Patch703: 0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
@ -300,10 +306,8 @@ Recommends: os-prober
# xorriso not available using grub2-mkrescue (bnc#812681)
# downgrade to suggest as minimal system can't afford pulling in tcl/tk and half of the x11 stack (bsc#1102515)
Suggests: libburnia-tools
Recommends: mtools
Suggests: mtools
%endif
Requires(post): /sbin/install-info
Requires(preun):/sbin/install-info
%if ! 0%{?only_efi:1}
Requires: grub2-%{grubarch} = %{version}-%{release}
%endif
@ -378,6 +382,20 @@ bootloader with modular architecture. It supports rich variety of kernel format
file systems, computer architectures and hardware devices. This subpackage
provides support for %{platform} systems.
%package %{grubarch}-debug
Summary: Debug symbols for %{grubarch}
Group: System/Boot
%if %{platform} != emu
BuildArch: noarch
%endif
Requires: %{name}-%{grubarch} = %{version}
%description %{grubarch}-debug
Debug information for %{name}-%{grubarch}
Information on how to debug grub can be found online:
https://www.cnblogs.com/coryxie/archive/2013/03/12/2956807.html
%endif
%ifarch %{efi}
@ -408,6 +426,20 @@ bootloader with modular architecture. It supports rich variety of kernel format
file systems, computer architectures and hardware devices. This subpackage
provides support for EFI systems.
%package %{grubefiarch}-debug
Summary: Debug symbols for %{grubefiarch}
Group: System/Boot
%if %{platform} != emu
BuildArch: noarch
%endif
Requires: %{name}-%{grubefiarch} = %{version}
%description %{grubefiarch}-debug
Debug symbols for %{name}-%{grubefiarch}
Information on how to debug grub can be found online:
https://www.cnblogs.com/coryxie/archive/2013/03/12/2956807.html
%endif
%ifarch %{ix86} x86_64
@ -562,6 +594,10 @@ swap partition while in resuming
%patch601 -p1
%patch602 -p1
%patch603 -p1
%patch700 -p1
%patch701 -p1
%patch702 -p1
%patch703 -p1
%build
# collect evidence to debug spurious build failure on SLE15
@ -901,8 +937,6 @@ perl -ni -e '
%post
%service_add_post grub2-once.service
/sbin/install-info %{_infodir}/grub-dev.info %{_infodir}/dir || :
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
%if ! 0%{?only_efi:1}
@ -1001,14 +1035,11 @@ exit 0
%preun
%service_del_preun grub2-once.service
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/grub-dev.info %{_infodir}/dir || :
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
# We did not add core.img to grub1 menu.lst in new update-bootloader macro as what
# the old %%post ever did, then the %%preun counterpart which removed the added core.img
# entry from old %%post can be skipped entirely if having new macro in use.
%if ! 0%{?update_bootloader_posttrans:1}%{?only_efi:1}
if [ $1 = 0 ]; then
# To check by current loader settings
if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then
. %{_sysconfdir}/sysconfig/bootloader
@ -1036,8 +1067,8 @@ if [ $1 = 0 ]; then
# we have no idea what's been installed. (And a blind remove is dangerous
# to remove user's or other package's file accidently ..)
fi
%endif
fi
%endif
%postun
%service_del_postun grub2-once.service
@ -1175,14 +1206,18 @@ fi
%{_datadir}/%{name}/%{grubarch}/*.img
%{_datadir}/%{name}/%{grubarch}/*.lst
%{_datadir}/%{name}/%{grubarch}/*.mod
%{_datadir}/%{name}/%{grubarch}/*.module
%ifarch x86_64
%{_datadir}/%{name}/%{grubarch}/efiemu*.o
%endif
%{_datadir}/%{name}/%{grubarch}/gdb_grub
%{_datadir}/%{name}/%{grubarch}/gmodule.pl
%{_datadir}/%{name}/%{grubarch}/kernel.exec
%{_datadir}/%{name}/%{grubarch}/modinfo.sh
%files %{grubarch}-debug
%defattr(-,root,root,-)
%{_datadir}/%{name}/%{grubarch}/gdb_grub
%{_datadir}/%{name}/%{grubarch}/gmodule.pl
%{_datadir}/%{name}/%{grubarch}/*.module
%endif
%ifarch %{efi}
@ -1197,9 +1232,6 @@ fi
%{_datadir}/%{name}/%{grubefiarch}/*.img
%{_datadir}/%{name}/%{grubefiarch}/*.lst
%{_datadir}/%{name}/%{grubefiarch}/*.mod
%{_datadir}/%{name}/%{grubefiarch}/*.module
%{_datadir}/%{name}/%{grubefiarch}/gdb_grub
%{_datadir}/%{name}/%{grubefiarch}/gmodule.pl
%{_datadir}/%{name}/%{grubefiarch}/kernel.exec
%{_datadir}/%{name}/%{grubefiarch}/modinfo.sh
%dir %{sysefibasedir}
@ -1219,6 +1251,13 @@ fi
%{sysefidir}/grub.der
%endif
%endif
%files %{grubefiarch}-debug
%defattr(-,root,root,-)
%{_datadir}/%{name}/%{grubefiarch}/gdb_grub
%{_datadir}/%{name}/%{grubefiarch}/gmodule.pl
%{_datadir}/%{name}/%{grubefiarch}/*.module
%endif
%files snapper-plugin