From ddf5f70a27302282ab2b2011148b612fa1723587e97e582821b964ebd1bcf50c Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 25 Mar 2020 09:07:52 +0000 Subject: [PATCH] Accepting request 788092 from home:michael-chang:branches:Base:System - 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 OBS-URL: https://build.opensuse.org/request/show/788092 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=352 --- ...on-datetime-functions-out-of-the-nor.patch | 311 ++++++++++++++++++ ...ern-Add-X-option-to-printf-functions.patch | 65 ++++ ...ch-for-specific-config-files-for-net.patch | 228 +++++++++++++ ...the-datetime-module-for-the-emu-plat.patch | 32 ++ grub2.changes | 10 + grub2.spec | 12 +- 6 files changed, 657 insertions(+), 1 deletion(-) create mode 100644 0001-normal-Move-common-datetime-functions-out-of-the-nor.patch create mode 100644 0002-kern-Add-X-option-to-printf-functions.patch create mode 100644 0003-normal-main-Search-for-specific-config-files-for-net.patch create mode 100644 0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch diff --git a/0001-normal-Move-common-datetime-functions-out-of-the-nor.patch b/0001-normal-Move-common-datetime-functions-out-of-the-nor.patch new file mode 100644 index 0000000..34c5bf0 --- /dev/null +++ b/0001-normal-Move-common-datetime-functions-out-of-the-nor.patch @@ -0,0 +1,311 @@ +From aa096037ae013c553acf52f9e3aa3a49c91f3c57 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +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 +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Kiper +--- + 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 . ++ */ ++ ++#include ++#include ++ ++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 . +- */ +- +-#include +-#include +- +-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; +-} diff --git a/0002-kern-Add-X-option-to-printf-functions.patch b/0002-kern-Add-X-option-to-printf-functions.patch new file mode 100644 index 0000000..89d78ce --- /dev/null +++ b/0002-kern-Add-X-option-to-printf-functions.patch @@ -0,0 +1,65 @@ +From 8c2c35dcc027a77aee48de89093d8770de0a8cf8 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +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 +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Kiper +--- + 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': + { diff --git a/0003-normal-main-Search-for-specific-config-files-for-net.patch b/0003-normal-main-Search-for-specific-config-files-for-net.patch new file mode 100644 index 0000000..d2e9a42 --- /dev/null +++ b/0003-normal-main-Search-for-specific-config-files-for-net.patch @@ -0,0 +1,228 @@ +From cb2f15c544895e1f3d540dd39d36c4611bdf5b7b Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +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 +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Kiper +--- + 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 ++#include + #include + #include + #include +@@ -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; + diff --git a/0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch b/0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch new file mode 100644 index 0000000..fa7ac2c --- /dev/null +++ b/0004-datetime-Enable-the-datetime-module-for-the-emu-plat.patch @@ -0,0 +1,32 @@ +From 1657e72f5bd6cdb9c35cbeb394c1d4329f8f024b Mon Sep 17 00:00:00 2001 +From: Mike Gilbert +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 +Reviewed-by: Javier Martinez Canillas +Tested-by: Javier Martinez Canillas +Reviewed-by: Daniel Kiper +--- + 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 = { diff --git a/grub2.changes b/grub2.changes index 0767ad0..73861e6 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Mar 20 10:36:54 UTC 2020 - Michael Chang + +- 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 diff --git a/grub2.spec b/grub2.spec index f134c55..48d30c3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -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 @@ -588,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