Merge branch 'f18'
This commit is contained in:
commit
214af9f845
185
add-vlan-tag-support.patch
Normal file
185
add-vlan-tag-support.patch
Normal file
@ -0,0 +1,185 @@
|
||||
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)
|
||||
char *dev, *canon;
|
||||
char *ptr;
|
||||
dev = grub_ieee1275_get_aliasdevname (bootpath);
|
||||
+ grub_ieee1275_parse_net_options (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
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/net.h>
|
||||
+#include <grub/env.h>
|
||||
|
||||
enum grub_ieee1275_parse_type
|
||||
{
|
||||
@@ -413,6 +414,35 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int
|
||||
+grub_ieee1275_parse_net_options (const char *path)
|
||||
+{
|
||||
+ char *comma;
|
||||
+ char *args;
|
||||
+ char *option = 0;
|
||||
+
|
||||
+ args = grub_ieee1275_get_devargs (path);
|
||||
+ if (!args)
|
||||
+ /* There is no option. */
|
||||
+ return -1;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ comma = grub_strchr (args, ',');
|
||||
+ if (! comma)
|
||||
+ option = grub_strdup (args);
|
||||
+ else
|
||||
+ option = grub_strndup (args, (grub_size_t)(comma - args));
|
||||
+ args = comma + 1;
|
||||
+
|
||||
+ if (! grub_strncmp(option, "vtag", 4))
|
||||
+ grub_env_set ("vlan-tag", option + grub_strlen("vtag="));
|
||||
+
|
||||
+ } while (comma);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
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
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <grub/net/arp.h>
|
||||
#include <grub/net/netbuff.h>
|
||||
#include <grub/net.h>
|
||||
+#include <grub/env.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/net/arp.h>
|
||||
|
||||
@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
{
|
||||
struct etherhdr *eth;
|
||||
grub_err_t err;
|
||||
+ grub_uint32_t vlantag = 0;
|
||||
+ grub_uint8_t etherhdr_size;
|
||||
|
||||
- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE);
|
||||
+ etherhdr_size = sizeof (*eth);
|
||||
+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE);
|
||||
|
||||
- err = grub_netbuff_push (nb, sizeof (*eth));
|
||||
+ const char *vlantag_text = grub_env_get ("vlan-tag");
|
||||
+ if (vlantag_text != 0) {
|
||||
+ etherhdr_size += 4;
|
||||
+ vlantag = grub_strtoul (vlantag_text, 0, 16);
|
||||
+ }
|
||||
+
|
||||
+ err = grub_netbuff_push (nb, etherhdr_size);
|
||||
if (err)
|
||||
return err;
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
return err;
|
||||
inf->card->opened = 1;
|
||||
}
|
||||
+
|
||||
+ /* Check if a vlan-tag is needed. */
|
||||
+ if (vlantag != 0)
|
||||
+ {
|
||||
+ /* Move eth type to the right */
|
||||
+ grub_memcpy((char *) nb->data + etherhdr_size - 2,
|
||||
+ (char *) nb->data + etherhdr_size - 6, 2);
|
||||
+
|
||||
+ /* Add the tag in the middle */
|
||||
+ grub_memcpy((char *) nb->data + etherhdr_size - 6,
|
||||
+ &vlantag, 4);
|
||||
+ }
|
||||
+
|
||||
return inf->card->driver->send (inf->card, nb);
|
||||
}
|
||||
|
||||
@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
grub_net_link_level_address_t hwaddress;
|
||||
grub_net_link_level_address_t src_hwaddress;
|
||||
grub_err_t err;
|
||||
+ grub_uint8_t etherhdr_size = sizeof (*eth);
|
||||
+
|
||||
+ grub_uint16_t vlantag_identifier = 0;
|
||||
+ grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2);
|
||||
+
|
||||
+ /* Check if a vlan-tag is present. */
|
||||
+ if (vlantag_identifier == VLANTAG_IDENTIFIER)
|
||||
+ {
|
||||
+ etherhdr_size += 4;
|
||||
+ /* Move eth type to the original position */
|
||||
+ grub_memcpy((char *) nb->data + etherhdr_size - 6,
|
||||
+ (char *) nb->data + etherhdr_size - 2, 2);
|
||||
+ }
|
||||
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
type = grub_be_to_cpu16 (eth->type);
|
||||
- err = grub_netbuff_pull (nb, sizeof (*eth));
|
||||
+ err = grub_netbuff_pull (nb, etherhdr_size);
|
||||
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_device_type) (const char *path);
|
||||
int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
|
||||
+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;
|
||||
#define GRUB_NET_TRIES 40
|
||||
#define GRUB_NET_INTERVAL 400
|
||||
|
||||
+#define VLANTAG_IDENTIFIER 0x8100
|
||||
+
|
||||
#endif /* ! GRUB_NET_HEADER */
|
||||
--
|
||||
1.7.10.4
|
||||
|
27
follow-the-symbolic-link-ieee1275.patch
Normal file
27
follow-the-symbolic-link-ieee1275.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 9436d0324b98e71c8ab55b09b4248a617cd463a8 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
Date: Wed, 7 Nov 2012 16:22:33 -0200
|
||||
Subject: [PATCH] Follow the symbolic link (ieee1275)
|
||||
|
||||
If the device used is a symlink, the file command must "follow
|
||||
the link" in order to check the real device.
|
||||
---
|
||||
util/grub-install.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub-install.in b/util/grub-install.in
|
||||
index 69a97ad..19dc3b4 100644
|
||||
--- a/util/grub-install.in
|
||||
+++ b/util/grub-install.in
|
||||
@@ -750,7 +750,7 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then
|
||||
+ if [ "$(file -s -b -L "${install_device}" | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then
|
||||
dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || {
|
||||
gettext "Failed to copy Grub to the PReP partition." 1>&2
|
||||
echo 1>&2
|
||||
--
|
||||
1.7.10.4
|
||||
|
58
grub-2.00-add-X-option-to-printf-functions.patch
Normal file
58
grub-2.00-add-X-option-to-printf-functions.patch
Normal file
@ -0,0 +1,58 @@
|
||||
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
|
||||
|
121
grub-2.00-dhcp-client-id-and-uuid-options-added.patch
Normal file
121
grub-2.00-dhcp-client-id-and-uuid-options-added.patch
Normal file
@ -0,0 +1,121 @@
|
||||
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
|
||||
|
205
grub-2.00-search-for-specific-config-file-for-netboot.patch
Normal file
205
grub-2.00-search-for-specific-config-file-for-netboot.patch
Normal file
@ -0,0 +1,205 @@
|
||||
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>
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#endif
|
||||
@@ -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
|
||||
|
54
grub2-add-bootpath-device-to-the-list.patch
Normal file
54
grub2-add-bootpath-device-to-the-list.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From d2863ca186a6d4ba2a56559bf522f46c18403645 Mon Sep 17 00:00:00 2001
|
||||
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
|
||||
Date: Fri, 14 Dec 2012 20:10:21 -0200
|
||||
Subject: [PATCH] Add bootpath device to the list
|
||||
|
||||
When scanning the devices, always check (and add) the bootpath device if it
|
||||
isn't in the device list.
|
||||
---
|
||||
grub-core/disk/ieee1275/ofdisk.c | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
|
||||
index b0aa7ec..99b156e 100644
|
||||
--- a/grub-core/disk/ieee1275/ofdisk.c
|
||||
+++ b/grub-core/disk/ieee1275/ofdisk.c
|
||||
@@ -213,6 +213,35 @@ scan (void)
|
||||
return grub_children_iterate (alias->path, dev_iterate);
|
||||
}
|
||||
|
||||
+ char *bootpath;
|
||||
+ int bootpath_size;
|
||||
+ char *type;
|
||||
+
|
||||
+ if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
|
||||
+ &bootpath_size)
|
||||
+ || bootpath_size <= 0)
|
||||
+ {
|
||||
+ /* Should never happen. */
|
||||
+ grub_printf ("/chosen/bootpath property missing!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
|
||||
+ if (! bootpath)
|
||||
+ {
|
||||
+ grub_print_error ();
|
||||
+ return;
|
||||
+ }
|
||||
+ grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
|
||||
+ (grub_size_t) bootpath_size + 1, 0);
|
||||
+ bootpath[bootpath_size] = '\0';
|
||||
+
|
||||
+ type = grub_ieee1275_get_device_type (bootpath);
|
||||
+ if (type && grub_strcmp (type, "block") == 0)
|
||||
+ dev_iterate_real (bootpath, bootpath);
|
||||
+
|
||||
+ grub_free (bootpath);
|
||||
+
|
||||
grub_devalias_iterate (dev_iterate_alias);
|
||||
grub_children_iterate ("/", dev_iterate);
|
||||
}
|
||||
--
|
||||
1.8.0
|
||||
|
21
grub2.spec
21
grub2.spec
@ -41,7 +41,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.00
|
||||
Release: 12%{?dist}
|
||||
Release: 15%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
|
||||
Group: System Environment/Base
|
||||
@ -72,6 +72,12 @@ Patch28: grub-2.00-fix-http-crash.patch
|
||||
Patch29: grub-2.00-Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch
|
||||
Patch30: grub-2.00-cas-reboot-support.patch
|
||||
Patch31: grub-2.00-for-ppc-include-all-modules-in-the-core-image.patch
|
||||
Patch32: add-vlan-tag-support.patch
|
||||
Patch33: follow-the-symbolic-link-ieee1275.patch
|
||||
Patch34: grub-2.00-add-X-option-to-printf-functions.patch
|
||||
Patch35: grub-2.00-dhcp-client-id-and-uuid-options-added.patch
|
||||
Patch36: grub-2.00-search-for-specific-config-file-for-netboot.patch
|
||||
Patch37: grub2-add-bootpath-device-to-the-list.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
@ -181,7 +187,7 @@ CD_MODULES=" all_video boot btrfs cat chain configfile echo efifwsetup \
|
||||
efinet ext2 fat font gfxmenu gfxterm gzio halt hfsplus iso9660 \
|
||||
jpeg linuxefi minicmd normal part_apple part_msdos part_gpt \
|
||||
password_pbkdf2 png reboot search search_fs_uuid \
|
||||
search_fs_file search_label sleep test video"
|
||||
search_fs_file search_label sleep test video xfs"
|
||||
./grub-mkimage -O %{grubefiarch} -o %{grubeficdname}.orig -p /EFI/BOOT \
|
||||
-d grub-core ${CD_MODULES}
|
||||
%pesign -s -i %{grubeficdname}.orig -o %{grubeficdname}
|
||||
@ -425,6 +431,17 @@ fi
|
||||
%doc grub-%{tarversion}/themes/starfield/COPYING.CC-BY-SA-3.0
|
||||
|
||||
%changelog
|
||||
* Thu Dec 20 2012 Dennis Gilmore <dennis@ausil.us> - 2.00-15
|
||||
- bump nvr
|
||||
|
||||
* Mon Dec 17 2012 Karsten Hopp <karsten@redhat.com> 2.00-14
|
||||
- add bootpath device to the device list (pfsmorigo, #886685)
|
||||
|
||||
* Tue Nov 27 2012 Peter Jones <pjones@redhat.com> - 2.00-13
|
||||
- Add vlan tag support (pfsmorigo, #871563)
|
||||
- Follow symlinks during PReP installation in grub2-install (pfsmorigo, #874234)
|
||||
- Improve search paths for config files on network boot (pfsmorigo, #873406)
|
||||
|
||||
* Tue Oct 23 2012 Peter Jones <pjones@redhat.com> - 2.00-12
|
||||
- Don't load modules when grub transitions to "normal" mode on UEFI.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user