+++ /dev/null
-From 3e00d82827f80461f9fe6da37acd84235c08e5a5 Mon Sep 17 00:00:00 2001
-From: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
-Date: Fri, 28 Sep 2012 19:42:07 -0400
-Subject: [PATCH] Issue separate DNS queries for ipv4 and ipv6
-
-Adding multiple questions on a single DNS query is not supportted by
-most DNS servers. This patch issues two separate DNS queries
-sequentially for ipv4 and then for ipv6.
-
-There are 4 possible config options:
- DNS_OPTION_IPV4: issue only one ipv4 query
- DNS_OPTION_IPV6: issue only one ipv6 query
- DNS_OPTION_PREFER_IPV4: issue the ipv4 query first and fallback to ipv6
- DNS_OPTION_PREFER_IPV6: issue the ipv6 query first and fallback to ipv4
-However, there is no code yet to set such config option. The default is
-DNS_OPTION_PREFER_IPV4.
-
-Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=860829
----
- grub-core/net/dns.c | 99 ++++++++++++++++++++++++++++++++++++-----------------
- include/grub/net.h | 9 +++++
- 2 files changed, 76 insertions(+), 32 deletions(-)
-
-diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c
-index 3381ea7..725725c 100644
---- a/grub-core/net/dns.c
-+++ b/grub-core/net/dns.c
-@@ -34,6 +34,14 @@ struct dns_cache_element
- #define DNS_CACHE_SIZE 1021
- #define DNS_HASH_BASE 423
-
-+typedef enum grub_dns_qtype_id
-+ {
-+ GRUB_DNS_QTYPE_A = 1,
-+ GRUB_DNS_QTYPE_AAAA = 28
-+ } grub_dns_qtype_id_t;
-+
-+static grub_dns_option_t dns_type_option = DNS_OPTION_PREFER_IPV4;
-+
- static struct dns_cache_element dns_cache[DNS_CACHE_SIZE];
- static struct grub_net_network_level_address *dns_servers;
- static grub_size_t dns_nservers, dns_servers_alloc;
-@@ -410,13 +418,13 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
- return GRUB_ERR_NONE;
- }
-
--grub_err_t
--grub_net_dns_lookup (const char *name,
-+static grub_err_t
-+grub_net_dns_lookup_qtype (const char *name,
- const struct grub_net_network_level_address *servers,
- grub_size_t n_servers,
- grub_size_t *naddresses,
- struct grub_net_network_level_address **addresses,
-- int cache)
-+ int cache, grub_dns_qtype_id_t qtype)
- {
- grub_size_t send_servers = 0;
- grub_size_t i, j;
-@@ -471,8 +479,7 @@ grub_net_dns_lookup (const char *name,
- + GRUB_NET_MAX_LINK_HEADER_SIZE
- + GRUB_NET_UDP_HEADER_SIZE
- + sizeof (struct dns_header)
-- + grub_strlen (name) + 2 + 4
-- + 2 + 4);
-+ + grub_strlen (name) + 2 + 4);
- if (!nb)
- {
- grub_free (data.name);
-@@ -482,7 +489,7 @@ grub_net_dns_lookup (const char *name,
- + GRUB_NET_MAX_LINK_HEADER_SIZE
- + GRUB_NET_UDP_HEADER_SIZE);
- grub_netbuff_put (nb, sizeof (struct dns_header)
-- + grub_strlen (name) + 2 + 4 + 2 + 4);
-+ + grub_strlen (name) + 2 + 4);
- head = (struct dns_header *) nb->data;
- optr = (grub_uint8_t *) (head + 1);
- for (iptr = name; *iptr; )
-@@ -509,18 +516,7 @@ grub_net_dns_lookup (const char *name,
-
- /* Type: A. */
- *optr++ = 0;
-- *optr++ = 1;
--
-- /* Class. */
-- *optr++ = 0;
-- *optr++ = 1;
--
-- /* Compressed name. */
-- *optr++ = 0xc0;
-- *optr++ = 0x0c;
-- /* Type: AAAA. */
-- *optr++ = 0;
-- *optr++ = 28;
-+ *optr++ = qtype;
-
- /* Class. */
- *optr++ = 0;
-@@ -529,7 +525,7 @@ grub_net_dns_lookup (const char *name,
- head->id = data.id;
- head->flags = FLAGS_RD;
- head->ra_z_r_code = 0;
-- head->qdcount = grub_cpu_to_be16_compile_time (2);
-+ head->qdcount = grub_cpu_to_be16_compile_time (1);
- head->ancount = grub_cpu_to_be16_compile_time (0);
- head->nscount = grub_cpu_to_be16_compile_time (0);
- head->arcount = grub_cpu_to_be16_compile_time (0);
-@@ -587,16 +583,47 @@ grub_net_dns_lookup (const char *name,
- if (*data.naddresses)
- return GRUB_ERR_NONE;
- if (data.dns_err)
-- return grub_error (GRUB_ERR_NET_NO_DOMAIN,
-- N_("no DNS record found"));
--
-+ {
-+ grub_dprintf ("dns", "%s. QTYPE: %u QNAME: %s\n",
-+ N_("no DNS record found"), qtype, name);
-+ return GRUB_ERR_NET_NO_DOMAIN;
-+ }
- if (err)
- {
- grub_errno = err;
- return err;
- }
-- return grub_error (GRUB_ERR_TIMEOUT,
-- N_("no DNS reply received"));
-+ grub_dprintf ("dns", "%s. QTYPE: %u QNAME: %s\n",
-+ N_("no DNS reply received"), qtype, name);
-+ return GRUB_ERR_TIMEOUT;
-+}
-+
-+grub_err_t
-+grub_net_dns_lookup (const char *name,
-+ const struct grub_net_network_level_address *servers,
-+ grub_size_t n_servers,
-+ grub_size_t *naddresses,
-+ struct grub_net_network_level_address **addresses,
-+ int cache)
-+{
-+ if (dns_type_option == DNS_OPTION_IPV6 || dns_type_option == DNS_OPTION_PREFER_IPV6)
-+ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses,
-+ addresses, cache, GRUB_DNS_QTYPE_AAAA);
-+ else
-+ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses,
-+ addresses, cache, GRUB_DNS_QTYPE_A);
-+ if (!*naddresses)
-+ {
-+ if (dns_type_option == DNS_OPTION_PREFER_IPV4)
-+ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses,
-+ addresses, cache, GRUB_DNS_QTYPE_AAAA);
-+ else if (dns_type_option == DNS_OPTION_PREFER_IPV6)
-+ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses,
-+ addresses, cache, GRUB_DNS_QTYPE_A);
-+ }
-+ if (!*naddresses)
-+ return GRUB_ERR_NET_NO_DOMAIN;
-+ return GRUB_ERR_NONE;
- }
-
- static grub_err_t
-@@ -604,22 +631,28 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)),
- int argc, char **args)
- {
- grub_err_t err;
-- grub_size_t naddresses, i;
-+ struct grub_net_network_level_address cmd_server;
-+ struct grub_net_network_level_address *servers;
-+ grub_size_t nservers, i, naddresses = 0;
- struct grub_net_network_level_address *addresses = 0;
- if (argc != 2 && argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
- if (argc == 2)
- {
-- struct grub_net_network_level_address server;
-- err = grub_net_resolve_address (args[1], &server);
-+ err = grub_net_resolve_address (args[1], &cmd_server);
- if (err)
- return err;
-- err = grub_net_dns_lookup (args[0], &server, 1, &naddresses,
-- &addresses, 0);
-+ servers = &cmd_server;
-+ nservers = 1;
- }
- else
-- err = grub_net_dns_lookup (args[0], dns_servers, dns_nservers, &naddresses,
-- &addresses, 0);
-+ {
-+ servers = dns_servers;
-+ nservers = dns_nservers;
-+ }
-+
-+ grub_net_dns_lookup (args[0], servers, nservers, &naddresses,
-+ &addresses, 0);
-
- for (i = 0; i < naddresses; i++)
- {
-@@ -628,7 +661,9 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)),
- grub_printf ("%s\n", buf);
- }
- grub_free (addresses);
-- return GRUB_ERR_NONE;
-+ if (naddresses)
-+ return GRUB_ERR_NONE;
-+ return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found"));
- }
-
- static grub_err_t
-diff --git a/include/grub/net.h b/include/grub/net.h
-index 3877451..a7e5b2c 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -505,6 +505,15 @@ grub_err_t
- grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
- const grub_net_network_level_address_t *proto_addr,
- grub_net_link_level_address_t *hw_addr);
-+
-+typedef enum
-+ {
-+ DNS_OPTION_IPV4,
-+ DNS_OPTION_IPV6,
-+ DNS_OPTION_PREFER_IPV4,
-+ DNS_OPTION_PREFER_IPV6
-+ } grub_dns_option_t;
-+
- grub_err_t
- grub_net_dns_lookup (const char *name,
- const struct grub_net_network_level_address *servers,
---
-1.7.11.4
-
+++ /dev/null
-From 81e46875469ae8b2a803e6457784801a0a7a7963 Mon Sep 17 00:00:00 2001
-From: Prarit Bhargava <prarit@redhat.com>
-Date: Thu, 7 Feb 2013 11:53:41 -0500
-Subject: [PATCH] add GRUB_DISABLE_SUBMENU option
-
-This patch adds the ability to disable the grub2 submenus from
-/etc/default/grub
-
-To disable the submenus
-
-echo 'GRUB_DISABLE_SUBMENU="true"' >> /etc/default/grub
-
-
----
- util/grub-mkconfig.in | 3 ++-
- util/grub.d/10_linux.in | 24 ++++++++++++++----------
- 2 files changed, 16 insertions(+), 11 deletions(-)
-
-diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
-index 516be86..354eb43 100644
---- a/util/grub-mkconfig.in
-+++ b/util/grub-mkconfig.in
-@@ -216,7 +216,8 @@ export GRUB_DEFAULT \
- GRUB_INIT_TUNE \
- GRUB_SAVEDEFAULT \
- GRUB_ENABLE_CRYPTODISK \
-- GRUB_BADRAM
-+ GRUB_BADRAM \
-+ GRUB_DISABLE_SUBMENU
-
- if test "x${grub_cfg}" != "x"; then
- rm -f "${grub_cfg}.new"
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index e2b8ab3..9427a39 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -240,17 +240,19 @@ while [ "x$list" != "x" ] ; do
- linux_root_device_thisversion=${GRUB_DEVICE}
- fi
-
-- if [ "x$is_first_entry" = xtrue ]; then
-- linux_entry "${OS}" "${version}" simple \
-- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-+ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-+ if [ "x$is_first_entry" = xtrue ]; then
-+ linux_entry "${OS}" "${version}" simple \
-+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-
-- submenu_indentation="\t"
-+ submenu_indentation="\t"
-
-- if [ -z "$boot_device_id" ]; then
-- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
-+ if [ -z "$boot_device_id" ]; then
-+ boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
-+ fi
-+ # TRANSLATORS: %s is replaced with an OS name
-+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
- fi
-- # TRANSLATORS: %s is replaced with an OS name
-- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
- fi
-
- linux_entry "${OS}" "${version}" advanced \
-@@ -266,8 +268,10 @@ done
-
- # If at least one kernel was found, then we need to
- # add a closing '}' for the submenu command.
--if [ x"$is_first_entry" != xtrue ]; then
-- echo '}'
-+if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-+ if [ x"$is_first_entry" != xtrue ]; then
-+ echo '}'
-+ fi
- fi
-
- echo "$title_correction_code"
---- grub-2.00/util/grub.d/20_linux_xen.in~ 2013-04-15 00:03:09.162253769 +0200
-+++ grub-2.00/util/grub.d/20_linux_xen.in 2013-04-15 00:18:49.254774567 +0200
-@@ -232,7 +232,8 @@
- linux_root_device_thisversion=${GRUB_DEVICE}
- fi
-
-- if [ "x$is_first_entry" = xtrue ]; then
-+ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-+ if [ "x$is_first_entry" = xtrue ]; then
- linux_entry "${OS}" "${version}" "${xen_version}" simple \
- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
-
-@@ -243,9 +244,10 @@
- fi
- # TRANSLATORS: %s is replaced with an OS name
- echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
-- echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
-+ echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
-+ fi
-+ is_first_entry=false
- fi
-- is_first_entry=false
-
- linux_entry "${OS}" "${version}" "${xen_version}" advanced \
- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
-@@ -256,8 +258,10 @@
-
- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
- done
-- if [ x"$is_first_entry" != xtrue ]; then
-+ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-+ if [ x"$is_first_entry" != xtrue ]; then
- echo ' }'
-+ fi
- fi
- xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '`
- done
+++ /dev/null
-From 80f81f233bf74aac740d7a299d075ea46c9c7bd4 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 16:58:39 -0200
-Subject: [PATCH 1/3] Add %X option to printf functions.
-
----
- grub-core/kern/misc.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
-index 95d4624..8ac087a 100644
---- a/grub-core/kern/misc.c
-+++ b/grub-core/kern/misc.c
-@@ -596,7 +596,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
- static 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')
-@@ -611,7 +611,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
- 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
-@@ -702,6 +702,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
- {
- case 'p':
- case 'x':
-+ case 'X':
- case 'u':
- case 'd':
- case 'c':
-@@ -777,6 +778,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
- switch (c)
- {
- case 'x':
-+ case 'X':
- case 'u':
- case 'd':
- if (longlongfmt)
-@@ -918,6 +920,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
- longlongfmt |= (sizeof (void *) == sizeof (long long));
- /* Fall through. */
- case 'x':
-+ case 'X':
- case 'u':
- unsig = 1;
- /* Fall through. */
---
-1.7.10.4
-
-From 5573f16fd05c1f8f310f2ead176b52ed6d4a08ec Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 30 Oct 2012 15:19:39 -0200
-Subject: [PATCH] Add vlan-tag support
-
-This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
-multiple VLANs in a bridged network to share the same physical network link but
-maintain isolation:
-
-http://en.wikipedia.org/wiki/IEEE_802.1Q
-
-This patch should fix this bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=871563
----
- grub-core/kern/ieee1275/init.c | 1 +
- grub-core/kern/ieee1275/openfw.c | 30 +++++++++++++++++++++++++++
- grub-core/net/ethernet.c | 42 +++++++++++++++++++++++++++++++++++---
- include/grub/ieee1275/ieee1275.h | 1 +
- include/grub/net.h | 2 ++
- 5 files changed, 73 insertions(+), 3 deletions(-)
-
-diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
-index 5c45947..209cf8a 100644
---- a/grub-core/kern/ieee1275/init.c
-+++ b/grub-core/kern/ieee1275/init.c
-@@ -102,6 +102,7 @@ grub_machine_get_bootlocation (char **device, char **path)
+diff -dur grub-2.00.git20131218.orig/grub-core/kern/ieee1275/init.c grub-2.00.git20131218/grub-core/kern/ieee1275/init.c
+--- grub-2.00.git20131218.orig/grub-core/kern/ieee1275/init.c 2013-12-18 13:11:29.000000000 +0100
++++ grub-2.00.git20131218/grub-core/kern/ieee1275/init.c 2013-12-18 14:39:17.000000000 +0100
+@@ -118,6 +118,7 @@
char *dev, *canon;
char *ptr;
dev = grub_ieee1275_get_aliasdevname (bootpath);
canon = grub_ieee1275_canonicalise_devname (dev);
ptr = canon + grub_strlen (canon) - 1;
while (ptr > canon && (*ptr == ',' || *ptr == ':'))
-diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
-index c2b1bdf..9fdfafa 100644
---- a/grub-core/kern/ieee1275/openfw.c
-+++ b/grub-core/kern/ieee1275/openfw.c
+Only in grub-2.00.git20131218/grub-core/kern/ieee1275: init.c.orig
+diff -dur grub-2.00.git20131218.orig/grub-core/kern/ieee1275/openfw.c grub-2.00.git20131218/grub-core/kern/ieee1275/openfw.c
+--- grub-2.00.git20131218.orig/grub-core/kern/ieee1275/openfw.c 2013-12-18 13:11:29.000000000 +0100
++++ grub-2.00.git20131218/grub-core/kern/ieee1275/openfw.c 2013-12-18 14:39:17.000000000 +0100
@@ -23,6 +23,7 @@
#include <grub/mm.h>
#include <grub/ieee1275/ieee1275.h>
enum grub_ieee1275_parse_type
{
-@@ -413,6 +414,35 @@ fail:
+@@ -451,6 +452,35 @@
return ret;
}
char *
grub_ieee1275_get_device_type (const char *path)
{
-diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
-index b38e2c8..5e45d46 100644
---- a/grub-core/net/ethernet.c
-+++ b/grub-core/net/ethernet.c
+Only in grub-2.00.git20131218/grub-core/kern/ieee1275: openfw.c.orig
+diff -dur grub-2.00.git20131218.orig/grub-core/net/ethernet.c grub-2.00.git20131218/grub-core/net/ethernet.c
+--- grub-2.00.git20131218.orig/grub-core/net/ethernet.c 2013-12-18 13:11:29.000000000 +0100
++++ grub-2.00.git20131218/grub-core/net/ethernet.c 2013-12-18 14:39:17.000000000 +0100
@@ -23,6 +23,7 @@
#include <grub/net/arp.h>
#include <grub/net/netbuff.h>
#include <grub/time.h>
#include <grub/net/arp.h>
-@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
+@@ -56,10 +57,19 @@
{
struct etherhdr *eth;
grub_err_t err;
if (err)
return err;
eth = (struct etherhdr *) nb->data;
-@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
+@@ -76,6 +86,19 @@
return err;
inf->card->opened = 1;
}
return inf->card->driver->send (inf->card, nb);
}
-@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
+@@ -90,10 +113,23 @@
grub_net_link_level_address_t hwaddress;
grub_net_link_level_address_t src_hwaddress;
grub_err_t err;
if (err)
return err;
-diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
-index 416a544..a8cf093 100644
---- a/include/grub/ieee1275/ieee1275.h
-+++ b/include/grub/ieee1275/ieee1275.h
-@@ -210,5 +210,6 @@ char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
- char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path);
+diff -dur grub-2.00.git20131218.orig/include/grub/ieee1275/ieee1275.h grub-2.00.git20131218/include/grub/ieee1275/ieee1275.h
+--- grub-2.00.git20131218.orig/include/grub/ieee1275/ieee1275.h 2013-12-18 13:11:29.000000000 +0100
++++ grub-2.00.git20131218/include/grub/ieee1275/ieee1275.h 2013-12-18 14:40:11.000000000 +0100
+@@ -226,6 +226,7 @@
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path);
+ char *EXPORT_FUNC(grub_ieee1275_get_devname) (const char *path);
+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path);
- #endif /* ! GRUB_IEEE1275_HEADER */
-diff --git a/include/grub/net.h b/include/grub/net.h
-index a7e5b2c..f4fec17 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -532,4 +532,6 @@ extern char *grub_net_default_server;
+ void EXPORT_FUNC(grub_ieee1275_devalias_init_iterator) (struct grub_ieee1275_devalias *alias);
+ void EXPORT_FUNC(grub_ieee1275_devalias_free) (struct grub_ieee1275_devalias *alias);
+diff -dur grub-2.00.git20131218.orig/include/grub/net.h grub-2.00.git20131218/include/grub/net.h
+--- grub-2.00.git20131218.orig/include/grub/net.h 2013-12-18 13:11:29.000000000 +0100
++++ grub-2.00.git20131218/include/grub/net.h 2013-12-18 14:39:18.000000000 +0100
+@@ -533,4 +533,6 @@
#define GRUB_NET_TRIES 40
#define GRUB_NET_INTERVAL 400
+#define VLANTAG_IDENTIFIER 0x8100
+
#endif /* ! GRUB_NET_HEADER */
---
-1.7.10.4
-
+Only in grub-2.00.git20131218/include/grub: net.h.orig
---- grub-2.00/util/grub-mkconfig.in~ 2013-04-15 00:03:09.162253769 +0200
-+++ grub-2.00/util/grub-mkconfig.in 2013-04-15 01:39:22.112705322 +0200
-@@ -233,7 +233,8 @@
- GRUB_SAVEDEFAULT \
+diff -dur -x '*.orig' grub-2.00.git20131218.orig/util/grub-mkconfig.in grub-2.00.git20131218/util/grub-mkconfig.in
+--- grub-2.00.git20131218.orig/util/grub-mkconfig.in 2013-12-18 14:44:31.000000000 +0100
++++ grub-2.00.git20131218/util/grub-mkconfig.in 2013-12-18 14:45:37.000000000 +0100
+@@ -255,7 +255,8 @@
GRUB_ENABLE_CRYPTODISK \
GRUB_BADRAM \
+ GRUB_OS_PROBER_SKIP_LIST \
- GRUB_DISABLE_SUBMENU
+ GRUB_DISABLE_SUBMENU \
+ GRUB_PREFER_DRACUT
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
---- grub-2.00/util/grub.d/10_linux.in~ 2013-04-15 00:03:09.162253769 +0200
-+++ grub-2.00/util/grub.d/10_linux.in 2013-04-15 01:38:26.992181771 +0200
-@@ -191,10 +191,12 @@
+diff -dur -x '*.orig' grub-2.00.git20131218.orig/util/grub.d/10_linux.in grub-2.00.git20131218/util/grub.d/10_linux.in
+--- grub-2.00.git20131218.orig/util/grub.d/10_linux.in 2013-12-18 14:44:31.000000000 +0100
++++ grub-2.00.git20131218/util/grub.d/10_linux.in 2013-12-18 14:44:49.000000000 +0100
+@@ -198,10 +198,12 @@
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
---- grub-2.00/util/grub.d/20_linux_xen.in~ 2013-04-15 11:47:30.852286811 +0200
-+++ grub-2.00/util/grub.d/20_linux_xen.in 2013-04-15 11:49:05.606550816 +0200
-@@ -212,10 +212,12 @@
+diff -dur -x '*.orig' grub-2.00.git20131218.orig/util/grub.d/20_linux_xen.in grub-2.00.git20131218/util/grub.d/20_linux_xen.in
+--- grub-2.00.git20131218.orig/util/grub.d/20_linux_xen.in 2013-12-18 14:44:31.000000000 +0100
++++ grub-2.00.git20131218/util/grub.d/20_linux_xen.in 2013-12-18 14:44:49.000000000 +0100
+@@ -207,10 +207,12 @@
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
+++ /dev/null
-From d63a0b7fd665fae1dd34d3e86127b93dd87b8114 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 17:18:53 -0200
-Subject: [PATCH 2/3] DHCP client ID and UUID options added.
-
----
- grub-core/net/bootp.c | 56 +++++++++++++++++++++++++++++++++++++++++--------
- include/grub/net.h | 2 ++
- 2 files changed, 49 insertions(+), 9 deletions(-)
-
-diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
-index bc07d53..3b4130d 100644
---- a/grub-core/net/bootp.c
-+++ b/grub-core/net/bootp.c
-@@ -51,6 +51,14 @@ set_env_limn_ro (const char *intername, const char *suffix,
- grub_register_variable_hook (varname, 0, grub_env_write_readonly);
- }
-
-+static char
-+hexdigit (grub_uint8_t val)
-+{
-+ if (val < 10)
-+ return val + '0';
-+ return val + 'a' - 10;
-+}
-+
- static void
- parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
- {
-@@ -81,6 +89,9 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
-
- taglength = *ptr++;
-
-+ grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n",
-+ tagtype, tagtype, taglength);
-+
- switch (tagtype)
- {
- case GRUB_NET_BOOTP_NETMASK:
-@@ -121,7 +132,9 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
- grub_net_add_dns_server (&s);
- ptr += 4;
- }
-- }
-+ /* Skip adittional increment */
-+ continue;
-+ }
- break;
- case GRUB_NET_BOOTP_HOSTNAME:
- set_env_limn_ro (name, "hostname", (char *) ptr, taglength);
-@@ -139,6 +152,39 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
- set_env_limn_ro (name, "extensionspath", (char *) ptr, taglength);
- break;
-
-+ case GRUB_NET_BOOTP_CLIENT_ID:
-+ set_env_limn_ro (name, "clientid", (char *) ptr, taglength);
-+ break;
-+
-+ case GRUB_NET_BOOTP_CLIENT_UUID:
-+ {
-+ if (taglength != 17)
-+ break;
-+
-+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
-+
-+ ptr += 1;
-+ taglength -= 1;
-+
-+ char *val = grub_malloc (2 * taglength + 4 + 1);
-+ int i = 0;
-+ int j = 0;
-+ for (i = 0; i < taglength; i++)
-+ {
-+ val[2 * i + j] = hexdigit (ptr[i] >> 4);
-+ val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf);
-+
-+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
-+ {
-+ j++;
-+ val[2 * i + 1+ j] = '-';
-+ }
-+ }
-+
-+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4);
-+ }
-+ break;
-+
- /* If you need any other options please contact GRUB
- developpement team. */
- }
-@@ -299,14 +345,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
- }
- }
-
--static char
--hexdigit (grub_uint8_t val)
--{
-- if (val < 10)
-- return val + '0';
-- return val + 'a' - 10;
--}
--
- static grub_err_t
- grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
- int argc, char **args)
-diff --git a/include/grub/net.h b/include/grub/net.h
-index a7e5b2c..45348dd 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -423,6 +423,8 @@ enum
- GRUB_NET_BOOTP_DOMAIN = 0x0f,
- GRUB_NET_BOOTP_ROOT_PATH = 0x11,
- GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
-+ GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
-+ GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
- GRUB_NET_BOOTP_END = 0xff
- };
-
---
-1.7.10.4
-
+++ /dev/null
-From 4414df5e72937b0bb1c4a0bb66cd1132ec2a5720 Mon Sep 17 00:00:00 2001
-From: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
-Date: Tue, 25 Sep 2012 18:40:55 -0400
-Subject: [PATCH] Fix crash on http
-
-Don't free file->data on receiving FIN flag since it is used all over without
-checking. http_close() will be called later to free that memory.
-https://bugzilla.redhat.com/show_bug.cgi?id=860834
----
- grub-core/net/http.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/net/http.c b/grub-core/net/http.c
-index a7542d1..a5f6f31 100644
---- a/grub-core/net/http.c
-+++ b/grub-core/net/http.c
-@@ -386,7 +386,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
-
- data->sock = grub_net_tcp_open (file->device->net->server,
- HTTP_PORT, http_receive,
-- http_err, http_err,
-+ http_err, NULL,
- file);
- if (!data->sock)
- {
---
-1.7.11.4
-
---- grub-1.97.1/util/grub-mkconfig.in~ 2009-11-17 17:02:16.626243372 +0200
-+++ grub-1.97.1/util/grub-mkconfig.in 2009-11-17 17:02:08.346050859 +0200
-@@ -120,6 +120,27 @@
+--- grub-2.02~beta2/util/grub-mkconfig.in~ 2014-01-13 16:12:41.020705075 +0200
++++ grub-2.02~beta2/util/grub-mkconfig.in 2014-01-13 16:10:42.000000000 +0200
+@@ -131,6 +131,21 @@
# Device containing our userland. Typically used for root= parameter.
GRUB_DEVICE="`${grub_probe} --target=device /`"
+# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root
+case "$GRUB_DEVICE" in
+ /dev/mapper/*-*)
-+ DM_REAL_DEVICE="$(readlink -f "$GRUB_DEVICE")"
-+ DM_UUID="$(cat /sys/block/${DM_REAL_DEVICE#/dev/}/dm/uuid)"
-+ case "$DM_UUID" in
-+ LVM-*)
-+ # change "--" to / (as "/" is impossible in LV name)
-+ local dev=$(awk -vdev="${GRUB_DEVICE#/dev/mapper/}" 'BEGIN{gsub(/--/, "/", dev); print dev}')
-+ local VG=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[1]); print v[1]}')
-+ local LV=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[2]); print v[2]}')
-+ GRUB_DEVICE=/dev/$VG/$LV
-+ ;;
-+ esac
++ LVM2_LV_NAME='' LVM2_VG_NAME=''
++ eval $(lvs --noheadings --nameprefixes "$GRUB_DEVICE" 2>/dev/null)
++ if [ -n "$LVM2_VG_NAME$LVM2_LV_NAME" ]; then
++ GRUB_DEVICE=/dev/$LVM2_VG_NAME/$LVM2_LV_NAME
++ fi
+ ;;
+esac
+
-diff -dur grub-2.00.orig/util/grub-mkconfig.in grub-2.00/util/grub-mkconfig.in
---- grub-2.00.orig/util/grub-mkconfig.in 2012-10-27 15:05:15.000000000 +0200
-+++ grub-2.00/util/grub-mkconfig.in 2012-10-27 15:14:32.787243346 +0200
-@@ -221,11 +236,16 @@
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub-mkconfig.in grub-2.02~beta2/util/grub-mkconfig.in
+--- grub-2.02~beta2.orig/util/grub-mkconfig.in 2014-01-04 11:34:32.715240491 +0100
++++ grub-2.02~beta2/util/grub-mkconfig.in 2014-01-04 11:34:50.135240649 +0100
+@@ -250,11 +250,16 @@
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
oldumask=$(umask); umask 077
+ # open fd &3 for diagnostic messages
+ exec 3>&2
fi
--gettext "Generating grub.cfg ..." >&2
+-gettext "Generating grub configuration file ..." >&2
-echo >&2
-+gettext "Generating grub.cfg ..." >&3
++gettext "Generating grub configuration file ..." >&3
+echo >&3
cat << EOF
#
-@@ -259,12 +279,15 @@
+@@ -289,13 +294,16 @@
gettext_printf "Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/sysconfig/grub
and /etc/grub.d/* files or please file a bug report with
-%s file attached." "${grub_cfg}.new" >&2
+- echo >&2
+%s file attached." "${grub_cfg}.new" >&3
++ echo >&3
else
# none of the children aborted with error, install the new grub.cfg
mv -f ${grub_cfg}.new ${grub_cfg}
+
+# close diagnostic stream
+exec 3>&-
-diff -dur grub-2.00.orig/util/grub.d/00_header.in grub-2.00/util/grub.d/00_header.in
---- grub-2.00.orig/util/grub.d/00_header.in 2012-05-04 01:04:39.000000000 +0200
-+++ grub-2.00/util/grub.d/00_header.in 2012-10-27 15:16:00.665356307 +0200
-@@ -219,7 +219,7 @@
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/00_header.in grub-2.02~beta2/util/grub.d/00_header.in
+--- grub-2.02~beta2.orig/util/grub.d/00_header.in 2014-01-04 10:50:51.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/00_header.in 2014-01-04 11:34:50.135240649 +0100
+@@ -229,7 +229,7 @@
if [ "x$gfxterm" = x1 ]; then
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
&& is_path_readable_by_grub "$GRUB_THEME"; then
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
cat << EOF
-@@ -255,12 +255,12 @@
+@@ -265,12 +265,12 @@
EOF
elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
&& is_path_readable_by_grub "$GRUB_BACKGROUND"; then
esac
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
cat << EOF
-diff -dur grub-2.00.orig/util/grub.d/10_hurd.in grub-2.00/util/grub.d/10_hurd.in
---- grub-2.00.orig/util/grub.d/10_hurd.in 2012-03-04 21:10:04.000000000 +0100
-+++ grub-2.00/util/grub.d/10_hurd.in 2012-10-27 15:16:00.665356307 +0200
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/10_hurd.in grub-2.02~beta2/util/grub.d/10_hurd.in
+--- grub-2.02~beta2.orig/util/grub.d/10_hurd.in 2013-12-17 18:25:57.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/10_hurd.in 2014-01-04 11:35:59.171907965 +0100
@@ -45,8 +45,8 @@
basename=`basename $i`
dirname=`dirname $i`
exit 1
fi
-diff -dur grub-2.00.orig/util/grub.d/10_kfreebsd.in grub-2.00/util/grub.d/10_kfreebsd.in
---- grub-2.00.orig/util/grub.d/10_kfreebsd.in 2012-03-04 22:02:30.000000000 +0100
-+++ grub-2.00/util/grub.d/10_kfreebsd.in 2012-10-27 15:16:00.668689695 +0200
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/10_kfreebsd.in grub-2.02~beta2/util/grub.d/10_kfreebsd.in
+--- grub-2.02~beta2.orig/util/grub.d/10_kfreebsd.in 2013-12-17 18:25:57.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/10_kfreebsd.in 2014-01-04 11:34:50.135240649 +0100
@@ -158,7 +158,7 @@
while [ "x$list" != "x" ] ; do
module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
fi
-diff -dur grub-2.00.orig/util/grub.d/10_linux.in grub-2.00/util/grub.d/10_linux.in
---- grub-2.00.orig/util/grub.d/10_linux.in 2012-10-27 15:05:15.000000000 +0200
-+++ grub-2.00/util/grub.d/10_linux.in 2012-10-27 15:16:00.668689695 +0200
-@@ -182,7 +182,7 @@
- is_first_entry=true
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/10_linux.in grub-2.02~beta2/util/grub.d/10_linux.in
+--- grub-2.02~beta2.orig/util/grub.d/10_linux.in 2014-01-04 10:50:51.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/10_linux.in 2014-01-04 11:34:50.135240649 +0100
+@@ -176,7 +176,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`
-@@ -220,7 +220,7 @@
+@@ -213,7 +213,7 @@
fi
if test -n "${initrd}" ; then
elif test -z "${initramfs}" ; then
# "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
# no initrd or builtin initramfs, it can't work here.
-diff -dur grub-2.00.orig/util/grub.d/10_netbsd.in grub-2.00/util/grub.d/10_netbsd.in
---- grub-2.00.orig/util/grub.d/10_netbsd.in 2012-03-04 20:47:35.000000000 +0100
-+++ grub-2.00/util/grub.d/10_netbsd.in 2012-10-27 15:16:00.668689695 +0200
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/10_netbsd.in grub-2.02~beta2/util/grub.d/10_netbsd.in
+--- grub-2.02~beta2.orig/util/grub.d/10_netbsd.in 2013-12-17 18:25:57.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/10_netbsd.in 2014-01-04 11:34:50.135240649 +0100
@@ -155,7 +155,7 @@
continue
fi
- gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2
+ gettext_printf "Found NetBSD kernel: %s\n" "$k" >&3
- if [ "x$is_first_entry" = xtrue ]; then
+ if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
-diff -dur grub-2.00.orig/util/grub.d/10_windows.in grub-2.00/util/grub.d/10_windows.in
---- grub-2.00.orig/util/grub.d/10_windows.in 2012-03-04 22:11:43.000000000 +0100
-+++ grub-2.00/util/grub.d/10_windows.in 2012-10-27 15:16:00.668689695 +0200
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/10_windows.in grub-2.02~beta2/util/grub.d/10_windows.in
+--- grub-2.02~beta2.orig/util/grub.d/10_windows.in 2013-12-17 18:25:57.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/10_windows.in 2014-01-04 11:34:50.135240649 +0100
@@ -82,7 +82,7 @@
# Get boot device.
dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue
cat << EOF
menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' {
EOF
-diff -dur grub-2.00.orig/util/grub.d/20_linux_xen.in grub-2.00/util/grub.d/20_linux_xen.in
---- grub-2.00.orig/util/grub.d/20_linux_xen.in 2012-06-03 21:57:42.000000000 +0200
-+++ grub-2.00/util/grub.d/20_linux_xen.in 2012-10-27 15:16:00.672023083 +0200
-@@ -203,7 +203,7 @@
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in grub-2.02~beta2/util/grub.d/20_linux_xen.in
+--- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in 2014-01-04 10:50:51.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/20_linux_xen.in 2014-01-04 11:34:50.135240649 +0100
+@@ -204,7 +204,7 @@
fi
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
-@@ -226,7 +226,7 @@
+@@ -227,7 +227,7 @@
fi
done
if test -n "${initrd}" ; then
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
-diff -dur grub-2.00.orig/util/grub.d/30_os-prober.in grub-2.00/util/grub.d/30_os-prober.in
---- grub-2.00.orig/util/grub.d/30_os-prober.in 2012-03-04 21:52:03.000000000 +0100
-+++ grub-2.00/util/grub.d/30_os-prober.in 2012-10-27 15:16:00.675356471 +0200
-@@ -117,7 +117,7 @@
+diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub.d/30_os-prober.in grub-2.02~beta2/util/grub.d/30_os-prober.in
+--- grub-2.02~beta2.orig/util/grub.d/30_os-prober.in 2014-01-04 10:50:51.000000000 +0100
++++ grub-2.02~beta2/util/grub.d/30_os-prober.in 2014-01-04 11:34:50.135240649 +0100
+@@ -134,7 +134,7 @@
LONGNAME="${LABEL}"
fi
case ${BOOT} in
chain)
-@@ -267,7 +267,7 @@
+@@ -321,7 +321,7 @@
*)
echo -n " "
# TRANSLATORS: %s is replaced by OS name.
#
# If you change this file, run 'update-grub' afterwards to update /boot/grub/grub.cfg.
#
-# To disable auto generation of /boot/grub/grub.conf on kernel package
-# install/upgrade, UPDATE_GRUB must be set to "no".
+# To enable auto generation of /boot/grub/grub.conf on kernel package
+# install, UPDATE_GRUB must be set to "yes".
#UPDATE_GRUB=yes
# Default entry to boot. Numeric value starting with 0.
GRUB_DISABLE_RECOVERY="true"
# Disable creating "advanced" submenus, just use flat list
-GRUB_DISABLE_SUBMENU="true"
+GRUB_DISABLE_SUBMENU="y"
# Control which initial ramdisk should grub-mkconfig prefer when searching
# default is initrd-*.gz created by geninitrd, uncomment to make it prefer
+++ /dev/null
-diff -dur grub-2.00.orig/grub-core/Makefile.am grub-2.00/grub-core/Makefile.am
---- grub-2.00.orig/grub-core/Makefile.am 2012-06-26 01:56:55.000000000 +0200
-+++ grub-2.00/grub-core/Makefile.am 2012-10-27 15:19:54.321231750 +0200
-@@ -349,7 +349,7 @@
-
- # generate global module dependencies list
- moddep.lst: syminfo.lst genmoddep.awk video.lst
-- cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
-+ cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
- platform_DATA += moddep.lst
- CLEANFILES += config.log syminfo.lst moddep.lst
-
--- /dev/null
+--- docs/grub.cfg.orig 2013-11-10 19:25:04.959888566 +0000
++++ docs/grub.cfg 2013-11-10 19:25:10.260104712 +0000
+@@ -14,8 +14,8 @@
+ # For booting GNU/Linux
+ menuentry "GNU/Linux" --id gnulinux {
+ set root=(hd0,msdos1)
+- linux /vmlinuz root=/dev/sda1
+- initrd /initrd.img
++ linux /boot/vmlinuz root=/dev/sda1
++ initrd /boot/initrd
+ }
+
+ # For booting GNU/Hurd
+++ /dev/null
-commit c5898eb4505dcd5f367048d33ec5ea9ed40dfdeb (HEAD, tmp)
-Author: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
-Date: Sun Mar 17 13:33:16 2013 +0100
-
- Resend a packet if we got the wrong buffer in status.
-
- (cherry picked from commit 2f1071d57ec026a7f271b1bfe302d14e86673c0f)
-
-diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
-index 28f2db2..2b344d6 100644
---- a/grub-core/net/drivers/efi/efinet.c
-+++ b/grub-core/net/drivers/efi/efinet.c
-@@ -37,7 +37,6 @@ send_card_buffer (struct grub_net_card *dev,
- grub_efi_status_t st;
- grub_efi_simple_network_t *net = dev->efi_net;
- grub_uint64_t limit_time = grub_get_time_ms () + 4000;
-- grub_size_t len;
-
- if (dev->txbusy)
- while (1)
-@@ -52,17 +51,26 @@ send_card_buffer (struct grub_net_card *dev,
- dev->txbusy = 0;
- break;
- }
-+ if (txbuf)
-+ {
-+ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
-+ dev->txbuf, NULL, NULL, NULL);
-+ if (st != GRUB_EFI_SUCCESS)
-+ return grub_error (GRUB_ERR_IO,
-+ N_("couldn't send network packet"));
-+ }
- if (limit_time < grub_get_time_ms ())
-- return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet"));
-+ return grub_error (GRUB_ERR_TIMEOUT,
-+ N_("couldn't send network packet"));
- }
-
-- len = (pack->tail - pack->data);
-- if (len > dev->mtu)
-- len = dev->mtu;
-+ dev->last_pkt_size = (pack->tail - pack->data);
-+ if (dev->last_pkt_size > dev->mtu)
-+ dev->last_pkt_size = dev->mtu;
-
-- grub_memcpy (dev->txbuf, pack->data, len);
-+ grub_memcpy (dev->txbuf, pack->data, dev->last_pkt_size);
-
-- st = efi_call_7 (net->transmit, net, 0, len,
-+ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
- dev->txbuf, NULL, NULL, NULL);
- if (st != GRUB_EFI_SUCCESS)
- return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
-diff --git a/include/grub/net.h b/include/grub/net.h
-index 3877451..1bd7af2 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -139,6 +139,7 @@ struct grub_net_card
- {
- struct grub_efi_simple_network *efi_net;
- grub_efi_handle_t efi_handle;
-+ grub_size_t last_pkt_size;
- };
- #endif
- void *data;
+++ /dev/null
-diff -dur grub-2.00.orig/util/grub-mkfont.c grub-2.00/util/grub-mkfont.c
---- grub-2.00.orig/util/grub-mkfont.c 2012-03-10 13:17:57.000000000 +0100
-+++ grub-2.00/util/grub-mkfont.c 2013-11-30 12:42:43.623031541 +0100
-@@ -39,7 +39,7 @@
- #include FT_FREETYPE_H
- #include FT_TRUETYPE_TAGS_H
- #include FT_TRUETYPE_TABLES_H
--#include <freetype/ftsynth.h>
-+#include FT_SYNTHESIS_H
-
- #undef __FTERRORS_H__
- #define FT_ERROR_START_LIST const char *ft_errmsgs[] = {
+++ /dev/null
-diff -dur -x '*~' grub-2.00.orig/grub-core/Makefile.core.def grub-2.00/grub-core/Makefile.core.def
---- grub-2.00.orig/grub-core/Makefile.core.def 2013-12-10 13:20:26.000000000 +0100
-+++ grub-2.00/grub-core/Makefile.core.def 2013-12-10 13:23:01.000000000 +0100
-@@ -1848,3 +1848,4 @@
- enable = i386;
- };
-
-+#include Makefile.gcry.def
-diff -dur -x '*~' grub-2.00.orig/grub-core/Makefile.in grub-2.00/grub-core/Makefile.in
---- grub-2.00.orig/grub-core/Makefile.in 2012-06-26 14:12:27.000000000 +0200
-+++ grub-2.00/grub-core/Makefile.in 2013-12-10 13:22:48.000000000 +0100
-@@ -70505,7 +70505,7 @@
- .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
- $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
- if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
-- autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
-+ autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
- mv $@.new $@
-
- # gentrigtables
---- grub-2.00.orig/conf/Makefile.common 2013-12-10 13:20:26.000000000 +0100
-+++ grub-2.00/conf/Makefile.common 2013-12-10 13:44:26.000000000 +0100
-@@ -174,5 +174,5 @@
- .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
- $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
- if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
-- autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
-+ autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
- mv $@.new $@
---- grub-2.00.orig/configure.ac 2013-12-10 13:32:13.000000000 +0100
-+++ grub-2.00/configure.ac 2013-12-10 13:32:19.000000000 +0100
-@@ -1169,6 +1169,11 @@
- AC_CONFIG_FILES([util/bash-completion.d/Makefile])
- AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
- AC_CONFIG_FILES([config.h])
-+AC_CONFIG_FILES([grub-core/gdb_grub])
-+AC_CONFIG_FILES([grub-core/genmod.sh])
-+AC_CONFIG_FILES([grub-core/gensyminfo.sh])
-+AC_CONFIG_FILES([grub-core/gmodule.pl])
-+AC_CONFIG_FILES([grub-core/modinfo.sh])
-
- AC_OUTPUT
- [
-
+++ /dev/null
-diff -dur grub-2.00.orig/grub-core/gnulib/stdio.in.h grub-2.00/grub-core/gnulib/stdio.in.h
---- grub-2.00.orig/grub-core/gnulib/stdio.in.h 2010-12-01 15:45:43.000000000 +0100
-+++ grub-2.00/grub-core/gnulib/stdio.in.h 2012-10-27 15:43:17.539201562 +0200
-@@ -141,7 +141,6 @@
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
- #undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
-
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
+++ /dev/null
-From 9f8104db535a8d2f9ef42824669431bdd86b3fe8 Mon Sep 17 00:00:00 2001
-From: Matthew Garrett <mjg@redhat.com>
-Date: Tue, 10 Jul 2012 11:58:52 -0400
-Subject: [PATCH 446/482] Add support for linuxefi
-
----
- grub-core/Makefile.core.def | 8 +
- grub-core/kern/efi/mm.c | 32 ++++
- grub-core/loader/i386/efi/linux.c | 371 ++++++++++++++++++++++++++++++++++++++
- include/grub/efi/efi.h | 3 +
- include/grub/i386/linux.h | 1 +
- 5 files changed, 415 insertions(+)
- create mode 100644 grub-core/loader/i386/efi/linux.c
-
-diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
-index bb62dce..def6606 100644
---- a/grub-core/Makefile.core.def
-+++ b/grub-core/Makefile.core.def
-@@ -1534,6 +1534,14 @@ module = {
- };
-
- module = {
-+ name = linuxefi;
-+ efi = loader/i386/efi/linux.c;
-+ efi = lib/cmdline.c;
-+ enable = i386_efi;
-+ enable = x86_64_efi;
-+};
-+
-+module = {
- name = chain;
- efi = loader/efi/chainloader.c;
- i386_pc = loader/i386/pc/chainloader.c;
-diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
-index 77c9384..025d665 100644
---- a/grub-core/kern/efi/mm.c
-+++ b/grub-core/kern/efi/mm.c
-@@ -47,6 +47,38 @@ static grub_efi_uintn_t finish_desc_size;
- static grub_efi_uint32_t finish_desc_version;
- int grub_efi_is_finished = 0;
-
-+/* Allocate pages below a specified address */
-+void *
-+grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
-+ grub_efi_uintn_t pages)
-+{
-+ grub_efi_status_t status;
-+ grub_efi_boot_services_t *b;
-+ grub_efi_physical_address_t address = max;
-+
-+ if (max > 0xffffffff)
-+ return 0;
-+
-+ b = grub_efi_system_table->boot_services;
-+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
-+
-+ if (status != GRUB_EFI_SUCCESS)
-+ return 0;
-+
-+ if (address == 0)
-+ {
-+ /* Uggh, the address 0 was allocated... This is too annoying,
-+ so reallocate another one. */
-+ address = max;
-+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
-+ grub_efi_free_pages (0, pages);
-+ if (status != GRUB_EFI_SUCCESS)
-+ return 0;
-+ }
-+
-+ return (void *) ((grub_addr_t) address);
-+}
-+
- /* Allocate pages. Return the pointer to the first of allocated pages. */
- void *
- grub_efi_allocate_pages (grub_efi_physical_address_t address,
-diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
-new file mode 100644
-index 0000000..b79e632
---- /dev/null
-+++ b/grub-core/loader/i386/efi/linux.c
-@@ -0,0 +1,371 @@
-+/*
-+ * GRUB -- GRand Unified Bootloader
-+ * Copyright (C) 2012 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/loader.h>
-+#include <grub/file.h>
-+#include <grub/err.h>
-+#include <grub/types.h>
-+#include <grub/mm.h>
-+#include <grub/cpu/linux.h>
-+#include <grub/command.h>
-+#include <grub/i18n.h>
-+#include <grub/lib/cmdline.h>
-+#include <grub/efi/efi.h>
-+
-+GRUB_MOD_LICENSE ("GPLv3+");
-+
-+static grub_dl_t my_mod;
-+static int loaded;
-+static void *kernel_mem;
-+static grub_uint64_t kernel_size;
-+static grub_uint8_t *initrd_mem;
-+static grub_uint32_t handover_offset;
-+struct linux_kernel_params *params;
-+static char *linux_cmdline;
-+
-+#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
-+
-+#define SHIM_LOCK_GUID \
-+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
-+
-+struct grub_efi_shim_lock
-+{
-+ grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
-+};
-+typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
-+
-+static grub_efi_boolean_t
-+grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
-+{
-+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
-+ grub_efi_shim_lock_t *shim_lock;
-+
-+ shim_lock = grub_efi_locate_protocol(&guid, NULL);
-+
-+ if (!shim_lock)
-+ return 1;
-+
-+ if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
-+
-+static grub_err_t
-+grub_linuxefi_boot (void)
-+{
-+ handover_func hf;
-+ int offset = 0;
-+
-+#ifdef __x86_64__
-+ offset = 512;
-+#endif
-+
-+ hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
-+
-+ asm volatile ("cli");
-+
-+ hf (grub_efi_image_handle, grub_efi_system_table, params);
-+
-+ /* Not reached */
-+ return GRUB_ERR_NONE;
-+}
-+
-+static grub_err_t
-+grub_linuxefi_unload (void)
-+{
-+ grub_dl_unref (my_mod);
-+ loaded = 0;
-+ if (initrd_mem)
-+ grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size));
-+ if (linux_cmdline)
-+ grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1));
-+ if (kernel_mem)
-+ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
-+ if (params)
-+ grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
-+ return GRUB_ERR_NONE;
-+}
-+
-+static grub_err_t
-+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
-+ int argc, char *argv[])
-+{
-+ grub_file_t *files = 0;
-+ int i, nfiles = 0;
-+ grub_size_t size = 0;
-+ grub_uint8_t *ptr;
-+
-+ if (argc == 0)
-+ {
-+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-+ goto fail;
-+ }
-+
-+ if (!loaded)
-+ {
-+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
-+ goto fail;
-+ }
-+
-+ files = grub_zalloc (argc * sizeof (files[0]));
-+ if (!files)
-+ goto fail;
-+
-+ for (i = 0; i < argc; i++)
-+ {
-+ grub_file_filter_disable_compression ();
-+ files[i] = grub_file_open (argv[i]);
-+ if (! files[i])
-+ goto fail;
-+ nfiles++;
-+ size += ALIGN_UP (grub_file_size (files[i]), 4);
-+ }
-+
-+ initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
-+
-+ if (!initrd_mem)
-+ {
-+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
-+ goto fail;
-+ }
-+
-+ params->ramdisk_size = size;
-+ params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem;
-+
-+ ptr = initrd_mem;
-+
-+ for (i = 0; i < nfiles; i++)
-+ {
-+ grub_ssize_t cursize = grub_file_size (files[i]);
-+ if (grub_file_read (files[i], ptr, cursize) != cursize)
-+ {
-+ if (!grub_errno)
-+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
-+ argv[i]);
-+ goto fail;
-+ }
-+ ptr += cursize;
-+ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
-+ ptr += ALIGN_UP_OVERHEAD (cursize, 4);
-+ }
-+
-+ params->ramdisk_size = size;
-+
-+ fail:
-+ for (i = 0; i < nfiles; i++)
-+ grub_file_close (files[i]);
-+ grub_free (files);
-+
-+ if (initrd_mem && grub_errno)
-+ grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(size));
-+
-+ return grub_errno;
-+}
-+
-+static grub_err_t
-+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
-+ int argc, char *argv[])
-+{
-+ grub_file_t file = 0;
-+ struct linux_kernel_header lh;
-+ grub_ssize_t len, start, filelen;
-+ void *kernel;
-+
-+ grub_dl_ref (my_mod);
-+
-+ if (argc == 0)
-+ {
-+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-+ goto fail;
-+ }
-+
-+ file = grub_file_open (argv[0]);
-+ if (! file)
-+ goto fail;
-+
-+ filelen = grub_file_size (file);
-+
-+ kernel = grub_malloc(filelen);
-+
-+ if (!kernel)
-+ {
-+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
-+ goto fail;
-+ }
-+
-+ if (grub_file_read (file, kernel, filelen) != filelen)
-+ {
-+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
-+ goto fail;
-+ }
-+
-+ if (! grub_linuxefi_secure_validate (kernel, filelen))
-+ {
-+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
-+ grub_free (kernel);
-+ goto fail;
-+ }
-+
-+ grub_file_seek (file, 0);
-+
-+ grub_free(kernel);
-+
-+ params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384));
-+
-+ if (! params)
-+ {
-+ grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
-+ goto fail;
-+ }
-+
-+ memset (params, 0, 16384);
-+
-+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
-+ {
-+ if (!grub_errno)
-+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+ argv[0]);
-+ goto fail;
-+ }
-+
-+ if (lh.boot_flag != grub_cpu_to_le16 (0xaa55))
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number"));
-+ goto fail;
-+ }
-+
-+ if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors"));
-+ goto fail;
-+ }
-+
-+ if (lh.version < grub_cpu_to_le16 (0x020b))
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("kernel too old"));
-+ goto fail;
-+ }
-+
-+ if (!lh.handover_offset)
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover"));
-+ goto fail;
-+ }
-+
-+ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
-+ BYTES_TO_PAGES(lh.cmdline_size + 1));
-+
-+ if (!linux_cmdline)
-+ {
-+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
-+ goto fail;
-+ }
-+
-+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
-+ grub_create_loader_cmdline (argc, argv,
-+ linux_cmdline + sizeof (LINUX_IMAGE) - 1,
-+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
-+
-+ lh.cmd_line_ptr = (grub_uint32_t)(grub_uint64_t)linux_cmdline;
-+
-+ handover_offset = lh.handover_offset;
-+
-+ start = (lh.setup_sects + 1) * 512;
-+ len = grub_file_size(file) - start;
-+
-+ kernel_mem = grub_efi_allocate_pages(lh.pref_address,
-+ BYTES_TO_PAGES(lh.init_size));
-+
-+ if (!kernel_mem)
-+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
-+ BYTES_TO_PAGES(lh.init_size));
-+
-+ if (!kernel_mem)
-+ {
-+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
-+ goto fail;
-+ }
-+
-+ if (grub_file_seek (file, start) == (grub_off_t) -1)
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+ argv[0]);
-+ goto fail;
-+ }
-+
-+ if (grub_file_read (file, kernel_mem, len) != len && !grub_errno)
-+ {
-+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+ argv[0]);
-+ }
-+
-+ if (grub_errno == GRUB_ERR_NONE)
-+ {
-+ grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0);
-+ loaded = 1;
-+ lh.code32_start = (grub_uint32_t)(grub_uint64_t) kernel_mem;
-+ }
-+
-+ memcpy(params, &lh, 2 * 512);
-+
-+ params->type_of_loader = 0x21;
-+
-+ fail:
-+
-+ if (file)
-+ grub_file_close (file);
-+
-+ if (grub_errno != GRUB_ERR_NONE)
-+ {
-+ grub_dl_unref (my_mod);
-+ loaded = 0;
-+ }
-+
-+ if (linux_cmdline && !loaded)
-+ grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1));
-+
-+ if (kernel_mem && !loaded)
-+ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
-+
-+ if (params && !loaded)
-+ grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
-+
-+ return grub_errno;
-+}
-+
-+static grub_command_t cmd_linux, cmd_initrd;
-+
-+GRUB_MOD_INIT(linuxefi)
-+{
-+ cmd_linux =
-+ grub_register_command ("linuxefi", grub_cmd_linux,
-+ 0, N_("Load Linux."));
-+ cmd_initrd =
-+ grub_register_command ("initrdefi", grub_cmd_initrd,
-+ 0, N_("Load initrd."));
-+ my_mod = mod;
-+}
-+
-+GRUB_MOD_FINI(linuxefi)
-+{
-+ grub_unregister_command (cmd_linux);
-+ grub_unregister_command (cmd_initrd);
-+}
-diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
-index 489cf9e..9370fd5 100644
---- a/include/grub/efi/efi.h
-+++ b/include/grub/efi/efi.h
-@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
- void *
- EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
- grub_efi_uintn_t pages);
-+void *
-+EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max,
-+ grub_efi_uintn_t pages);
- void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
- grub_efi_uintn_t pages);
- int
-diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
-index 9d064c8..c29c5af 100644
---- a/include/grub/i386/linux.h
-+++ b/include/grub/i386/linux.h
-@@ -139,6 +139,7 @@ struct linux_kernel_header
- grub_uint64_t setup_data;
- grub_uint64_t pref_address;
- grub_uint32_t init_size;
-+ grub_uint32_t handover_offset;
- } __attribute__ ((packed));
-
- /* Boot parameters for Linux based on 2.6.12. This is used by the setup
---
-1.8.2.1
-
+++ /dev/null
-From 1ff55c8030ed529b17b02993877ac4803e7aa449 Mon Sep 17 00:00:00 2001
-From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
-Date: Mon, 2 Jul 2012 11:22:50 +0200
-Subject: [PATCH 1/3] * grub-core/net/tftp.c (ack): Fix endianness problem.
- (tftp_receive): Likewise. Reported by: Michael Davidsaver.
-
-(cherry picked from commit a706f4cc6bddd03e67a66620101209c471177b53)
----
- 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 9c70efb..d0f39ea 100644
---- a/grub-core/net/tftp.c
-+++ b/grub-core/net/tftp.c
-@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
-
- tftph_ack = (struct tftphdr *) nb_ack.data;
- tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
-- tftph_ack->u.ack.block = block;
-+ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
-
- err = grub_net_send_udp_packet (data->sock, &nb_ack);
- if (err)
-@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
- grub_priority_queue_pop (data->pq);
-
- if (file->device->net->packs.count < 50)
-- err = ack (data, tftph->u.data.block);
-+ err = ack (data, data->block + 1);
- else
- {
- file->device->net->stall = 1;
---
-1.8.2
-
-
-From 412928c729fff75cf53914cd4acac88c5e229397 Mon Sep 17 00:00:00 2001
-From: Avik Sil <aviksil@in.ibm.com>
-Date: Wed, 14 Aug 2013 20:32:42 -0300
-Subject: [PATCH 2/3] * grub-core/net/tftp.c: Send tftp ack packet before
- closing the socket.
-
-(cherry picked from commit 369508b3cb0a84c0118ee32adef923109ad187dc)
----
- grub-core/net/tftp.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
-index d0f39ea..b9d9549 100644
---- a/grub-core/net/tftp.c
-+++ b/grub-core/net/tftp.c
-@@ -243,6 +243,8 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
- data->block++;
- if (size < data->block_size)
- {
-+ if (data->ack_sent < data->block)
-+ ack (data, data->block);
- file->device->net->eof = 1;
- file->device->net->stall = 1;
- grub_net_udp_close (data->sock);
---
-1.8.2
-
-
-From e944f5bb19bb7f07ca065df75979ba3067306ae1 Mon Sep 17 00:00:00 2001
-From: Vladimir Serbinenko <phcoder@gmail.com>
-Date: Sat, 26 Oct 2013 12:48:49 +0200
-Subject: [PATCH 3/3] * grub-core/net/tftp.c: Retransmit ack when
- rereceiving old packet. Try to handle more than 0xFFFF packets.
-
-(cherry picked from commit cf8d6bbd9eb2f5c6cbb0b6e437466c77fc7b6e9b)
----
- grub-core/net/tftp.c | 26 +++++++++++++++++---------
- 1 file changed, 17 insertions(+), 9 deletions(-)
-
-diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
-index b9d9549..97217d2 100644
---- a/grub-core/net/tftp.c
-+++ b/grub-core/net/tftp.c
-@@ -102,7 +102,7 @@ typedef struct tftp_data
- grub_uint64_t file_size;
- grub_uint64_t block;
- grub_uint32_t block_size;
-- grub_uint32_t ack_sent;
-+ grub_uint64_t ack_sent;
- int have_oack;
- struct grub_error_saved save_err;
- grub_net_udp_socket_t sock;
-@@ -110,6 +110,17 @@ typedef struct tftp_data
- } *tftp_data_t;
-
- static int
-+cmp_block (grub_uint16_t a, grub_uint16_t b)
-+{
-+ grub_int16_t i = (grub_int16_t) (a - b);
-+ if (i > 0)
-+ return +1;
-+ if (i < 0)
-+ return -1;
-+ return 0;
-+}
-+
-+static int
- cmp (const void *a__, const void *b__)
- {
- struct grub_net_buff *a_ = *(struct grub_net_buff **) a__;
-@@ -117,15 +128,11 @@ cmp (const void *a__, const void *b__)
- struct tftphdr *a = (struct tftphdr *) a_->data;
- struct tftphdr *b = (struct tftphdr *) b_->data;
- /* We want the first elements to be on top. */
-- if (grub_be_to_cpu16 (a->u.data.block) < grub_be_to_cpu16 (b->u.data.block))
-- return +1;
-- if (grub_be_to_cpu16 (a->u.data.block) > grub_be_to_cpu16 (b->u.data.block))
-- return -1;
-- return 0;
-+ return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block));
- }
-
- static grub_err_t
--ack (tftp_data_t data, grub_uint16_t block)
-+ack (tftp_data_t data, grub_uint64_t block)
- {
- struct tftphdr *tftph_ack;
- grub_uint8_t nbdata[512];
-@@ -213,12 +220,13 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
- return GRUB_ERR_NONE;
- nb_top = *nb_top_p;
- tftph = (struct tftphdr *) nb_top->data;
-- if (grub_be_to_cpu16 (tftph->u.data.block) >= data->block + 1)
-+ if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0)
- break;
-+ ack (data, grub_be_to_cpu16 (tftph->u.data.block));
- grub_netbuff_free (nb_top);
- grub_priority_queue_pop (data->pq);
- }
-- if (grub_be_to_cpu16 (tftph->u.data.block) == data->block + 1)
-+ while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)
- {
- unsigned size;
-
---
-1.8.2
-
Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez
Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc
Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2
+%define beta beta2
Name: grub2
-Version: 2.00
-Release: 6
+Version: 2.02
+Release: 0.%{beta}.2
License: GPL v2
Group: Base
-Source0: http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
-# Source0-md5: a1043102fbc7bcedbf53e7ee3d17ab91
+# git://git.savannah.gnu.org/grub.git
+# git checkout %{version}~%{beta} ; make dist
+Source0: grub-%{version}~%{beta}.tar.gz
+# Source0-md5: ca6c18f6c5f1ed05b7444017a40573d9
Source1: update-grub
Source2: update-grub.8
Source3: grub.sysconfig
Source4: grub-custom.cfg
+# ./linguas.sh
+# TS=$(date +'%Y%m%d') ; tar cjvf grub-po-2.00.git$TS.tar.bz2 po/*.po po/LINGUAS
+Source5: grub-po-%{version}.git20140104.tar.bz2
+# Source5-md5: aeef3e636178093cf9d780d92da7afdb
Patch1: pld-sysconfdir.patch
Patch2: grub-garbage.patch
Patch3: grub-lvmdevice.patch
Patch4: pld-mkconfigdir.patch
Patch5: grub-mkconfig-diagnostics.patch
-Patch6: ppc.patch
-Patch7: %{name}-awk.patch
-Patch8: posix.patch
-Patch9: %{name}-gets.patch
-Patch10: %{name}-fonts_path.patch
-Patch11: %{name}-tftp_fixes.patch
-Patch12: add-vlan-tag-support.patch
-Patch13: just-say-linux.patch
-Patch14: add-GRUB-DISABLE-SUBMENU-option.patch
-Patch15: add-X-option-to-printf-functions.patch
-Patch16: dhcp-client-id-and-uuid-options-added.patch
-Patch17: fix-http-crash.patch
-Patch18: Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch
-Patch19: search-for-specific-config-file-for-netboot.patch
-Patch20: ignore-kernel-symlinks.patch
-Patch21: choose-preferred-initrd.patch
-Patch22: %{name}-cfg.patch
-Patch23: %{name}-freetype_include.patch
-Patch24: %{name}-efinet_fix.patch
-Patch25: %{name}-linuxefi.patch
-Patch26: %{name}-generated_files.patch
+Patch6: posix.patch
+Patch7: %{name}-fonts_path.patch
+Patch8: add-vlan-tag-support.patch
+Patch9: just-say-linux.patch
+Patch10: ignore-kernel-symlinks.patch
+Patch11: choose-preferred-initrd.patch
+Patch12: %{name}-cfg.patch
URL: http://www.gnu.org/software/grub/
BuildRequires: autoconf >= 2.53
-BuildRequires: autogen
BuildRequires: automake >= 1:1.11.1-1
BuildRequires: bison
BuildRequires: device-mapper-devel
BuildRequires: freetype-devel >= 2
BuildRequires: gawk
BuildRequires: gettext-devel
+BuildRequires: glibc-localedb-all
BuildRequires: glibc-static
BuildRequires: help2man
BuildRequires: libfuse-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
+BuildRequires: python
+BuildRequires: python-modules
BuildRequires: rpm >= 4.4.9-56
BuildRequires: rpmbuild(macros) >= 1.213
BuildRequires: sed >= 4.0
%endif
%endif
Requires: %{name}-platform = %{version}-%{release}
-Requires: issue
+Requires: pld-release
Requires: which
%ifarch %{ix86} %{x8664}
Suggests: %{name}-platform-pc
Motyw starfield dla GRUB-a.
%prep
-%setup -q -n grub-%{version}
+%setup -q -n grub-%{version}~%{beta} -a5
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
-%patch16 -p1
-%patch17 -p1
-%patch18 -p1
-%patch19 -p1
-%patch20 -p1
-%patch21 -p1
-%patch22 -p0
-%patch23 -p1
-%patch24 -p1
-%patch25 -p1
-%patch26 -p1
+%patch12 -p0
+
+# we don't have C.utf-8 and need an UTF-8 locale for build
+sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
%build
# if gold is used then grub doesn't even boot
ln -s /usr/bin/ld.bfd our-ld/ld
export PATH=$(pwd)/our-ld:$PATH
-cp -f /usr/share/automake/config.sub .
-%{__libtoolize}
+## not only the typicall autotools stuff
+#./autogen.sh
+
+%{__gettextize}
%{__aclocal} -I m4
-%{__autoheader}
-echo timestamp > stamp-h.in
%{__autoconf}
+%{__autoheader}
%{__automake}
for platform in %{platforms} ; do
$platform_opts \
TARGET_LDFLAGS=-static
+ %{__make} -j1 -C po update-gmo
%{__make}
cd ..
done
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
%attr(755,root,root) %{_sbindir}/grub-editenv
%attr(755,root,root) %{_sbindir}/grub-fstest
+%attr(755,root,root) %{_sbindir}/grub-file
+%attr(755,root,root) %{_sbindir}/grub-glue-efi
%attr(755,root,root) %{_sbindir}/grub-kbdcomp
%attr(755,root,root) %{_sbindir}/grub-install
+%attr(755,root,root) %{_sbindir}/grub-macbless
%attr(755,root,root) %{_sbindir}/grub-menulst2cfg
%attr(755,root,root) %{_sbindir}/grub-mkconfig
%attr(755,root,root) %{_sbindir}/grub-mklayout
%attr(755,root,root) %{_sbindir}/grub-mount
%attr(755,root,root) %{_sbindir}/grub-ofpathname
%attr(755,root,root) %{_sbindir}/grub-reboot
+%attr(755,root,root) %{_sbindir}/grub-render-label
%attr(755,root,root) %{_sbindir}/grub-script-check
%attr(755,root,root) %{_sbindir}/grub-set-default
+%attr(755,root,root) %{_sbindir}/grub-syslinux2cfg
%attr(755,root,root) %{_sbindir}/update-grub
%ifarch %{ix86} %{x8664}
%attr(755,root,root) %{_sbindir}/grub-bios-setup
%{_mandir}/man8/grub-sparc64-setup.8*
%endif
%{_mandir}/man1/grub-editenv.1*
+%{_mandir}/man1/grub-file.1*
%{_mandir}/man1/grub-fstest.1*
+%{_mandir}/man1/grub-glue-efi.1*
%{_mandir}/man1/grub-kbdcomp.1*
+%{_mandir}/man1/grub-macbless.1*
%{_mandir}/man1/grub-menulst2cfg.1*
%{_mandir}/man1/grub-mklayout.1*
+%{_mandir}/man1/grub-mknetdir.1*
%{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
%{_mandir}/man1/grub-mkrelpath.1*
%{_mandir}/man1/grub-mkrescue.1*
%{_mandir}/man1/grub-mkstandalone.1*
%{_mandir}/man1/grub-mount.1*
+%{_mandir}/man1/grub-render-label.1*
%{_mandir}/man1/grub-script-check.1*
+%{_mandir}/man1/grub-syslinux2cfg.1*
%{_mandir}/man8/grub-install.8*
%{_mandir}/man8/grub-mkconfig.8*
-%{_mandir}/man8/grub-mknetdir.8*
%{_mandir}/man8/grub-ofpathname.8*
%{_mandir}/man8/grub-reboot.8*
%{_mandir}/man8/grub-set-default.8*
%attr(755,root,root) /lib/grub.d/30_os-prober
%attr(755,root,root) /lib/grub.d/41_custom
+# these are now installed only on matching hosts
+#%attr(755,root,root) /lib/grub.d/10_hurd
+#%attr(755,root,root) /lib/grub.d/10_illumos
+#%attr(755,root,root) /lib/grub.d/10_kfreebsd
+#%attr(755,root,root) /lib/grub.d/10_netbsd
+#%attr(755,root,root) /lib/grub.d/10_xnu
+
%ifarch %{ix86} %{x8664}
%attr(755,root,root) %{_sbindir}/grub-probe
%{_mandir}/man8/grub-probe.8*
%{_libexecdir}/*-pc/kernel.img
%ifarch %{ix86} %{x8664} sparc sparc64
%{_libexecdir}/*-pc/boot.img
+%{_libexecdir}/*-pc/boot_hybrid.img
%{_libexecdir}/*-pc/cdboot.img
%{_libexecdir}/*-pc/diskboot.img
%{_libexecdir}/*-pc/lnxboot.img
-From d4bd41f972c6e22b86c773cbba2a1e14f400a8be Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 14 Mar 2011 14:27:42 -0400
-Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
-
----
- util/grub.d/10_linux.in | 4 ++--
- util/grub.d/20_linux_xen.in | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index a09c3e6..0b0df78 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@
+diff -dur -x '*.orig' grub-2.00.git20131218.orig/util/grub.d/10_linux.in grub-2.00.git20131218/util/grub.d/10_linux.in
+--- grub-2.00.git20131218.orig/util/grub.d/10_linux.in 2013-12-18 14:41:17.000000000 +0100
++++ grub-2.00.git20131218/util/grub.d/10_linux.in 2013-12-18 14:42:46.000000000 +0100
+@@ -54,9 +54,9 @@
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
+ OS="${GRUB_DISTRIBUTOR}"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
-diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
-index ee49cd9..10422b0 100644
---- a/util/grub.d/20_linux_xen.in
-+++ b/util/grub.d/20_linux_xen.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@
+diff -dur -x '*.orig' grub-2.00.git20131218.orig/util/grub.d/20_linux_xen.in grub-2.00.git20131218/util/grub.d/20_linux_xen.in
+--- grub-2.00.git20131218.orig/util/grub.d/20_linux_xen.in 2013-12-18 14:41:17.000000000 +0100
++++ grub-2.00.git20131218/util/grub.d/20_linux_xen.in 2013-12-18 14:43:11.000000000 +0100
+@@ -33,9 +33,9 @@
CLASS="--class gnu-linux --class gnu --class os --class xen"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
+ OS="${GRUB_DISTRIBUTOR}"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
---
-1.7.4
-
+++ /dev/null
-disable -m32 on ppc (gcc 3.3.6 does not like it)
-
-revert 'returns_twice' attribute for grub_setjmp.
-http://repo.or.cz/w/grub2.git/commitdiff/2c7825edcb18e9d0680a953f1475ef2caf6b0f0f
-
---- grub-1.98/configure.ac~ 2010-03-06 20:51:37.000000000 +0000
-+++ grub-1.98/configure.ac 2010-07-19 13:59:46.468351205 +0000
-@@ -114,7 +114,7 @@
- esac
-
- case "$target_cpu" in
-- i386 | powerpc) target_m32=1 ;;
-+ i386) target_m32=1 ;;
- x86_64 | sparc64) target_m64=1 ;;
- esac
-
---- grub-1.98/include/grub/powerpc/setjmp.h~ 2010-03-06 20:51:37.000000000 +0000
-+++ grub-1.98/include/grub/powerpc/setjmp.h 2010-07-19 16:37:03.616853413 +0000
-@@ -21,7 +21,7 @@
-
- typedef unsigned long grub_jmp_buf[20];
-
--int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice));
-+int grub_setjmp (grub_jmp_buf env);
- void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
-
- #endif /* ! GRUB_SETJMP_CPU_HEADER */
+++ /dev/null
-From 38d458ddd69cb7dd6e7f58f9e9f3197c6b6184f3 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 17:22:07 -0200
-Subject: [PATCH 3/3] Search for specific config file 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
-
-This should close the bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=873406
----
- grub-core/net/net.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++
- grub-core/normal/main.c | 18 ++++++--
- include/grub/net.h | 3 ++
- 3 files changed, 135 insertions(+), 4 deletions(-)
-
-diff --git a/grub-core/net/net.c b/grub-core/net/net.c
-index 01c5d32..49c32c5 100644
---- a/grub-core/net/net.c
-+++ b/grub-core/net/net.c
-@@ -1548,6 +1548,124 @@ grub_net_restore_hw (void)
- return GRUB_ERR_NONE;
- }
-
-+grub_err_t
-+grub_net_search_configfile (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_dprintf ("net", "probe %s\n", config);
-+
-+ grub_file_t file;
-+ file = grub_file_open (config);
-+
-+ if (file)
-+ {
-+ grub_file_close (file);
-+ grub_dprintf ("net", "found!\n");
-+ 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 client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) +
-+ sizeof ("_clientuuid") + 1];
-+ grub_snprintf (client_uuid_var, sizeof (client_uuid_var),
-+ "net_%s_clientuuid", inf->name);
-+
-+ const char *client_uuid;
-+ client_uuid = grub_env_get (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);
-+
-+ char *ptr;
-+ 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;
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index aa0b3e5..cc519a5 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -32,6 +32,7 @@
- #include <grub/i18n.h>
- #include <grub/charset.h>
- #include <grub/script_sh.h>
-+#include <grub/net.h>
-
- GRUB_MOD_LICENSE ("GPLv3+");
-
-@@ -379,10 +380,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
-
- prefix = grub_env_get ("prefix");
- if (prefix)
-- {
-- config = grub_xasprintf ("%s/grub.cfg", prefix);
-- if (! config)
-- goto quit;
-+ {
-+ grub_size_t config_len;
-+ 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);
-+
-+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
-+ grub_net_search_configfile (config);
-
- grub_enter_normal_mode (config);
- grub_free (config);
-diff --git a/include/grub/net.h b/include/grub/net.h
-index 45348dd..09b8d56 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -534,6 +534,9 @@ extern char *grub_net_default_server;
- #define GRUB_NET_TRIES 40
- #define GRUB_NET_INTERVAL 400
-
- #define VLANTAG_IDENTIFIER 0x8100
-
-+grub_err_t
-+grub_net_search_configfile (char *config);
-+
- #endif /* ! GRUB_NET_HEADER */
---
-1.7.10.4
-
+++ /dev/null
-grub-mkconfig does not get it right when sorting "recent kernel first":
-
-sort kernel versions correctly:
-
-Wrong:
- echo 'Loading Linux 3.0.8-1 ...'
- echo 'Loading Linux 3.0.4-2 ...'
- echo 'Loading Linux 3.0.13-1 ...'
- echo 'Loading Linux 3.0.12-2 ...'
- echo 'Loading Linux 2.6.38.8-1 ...'
-
-Correct:
- echo 'Loading Linux 3.0.13-1 ...'
- echo 'Loading Linux 3.0.12-2 ...'
- echo 'Loading Linux 3.0.8-1 ...'
- echo 'Loading Linux 3.0.4-2 ...'
- echo 'Loading Linux 2.6.38.8-1 ...'
-
---- grub-1.99/util/grub-mkconfig_lib.in~ 2012-01-12 00:47:28.626740879 +0200
-+++ grub-1.99/util/grub-mkconfig_lib.in 2012-01-12 00:53:49.554292436 +0200
-@@ -165,7 +165,7 @@
- a="$b"
- b="$c"
- fi
-- if (echo "$a" ; echo "$b") | sort -n | head -n 1 | grep -qx "$b" ; then
-+ if (echo "$a" ; echo "$b") | sort -V | head -n 1 | grep -qx "$b" ; then
- return 0
- else
- return 1