Accepting request 306325 from Base:System
1 OBS-URL: https://build.opensuse.org/request/show/306325 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=115
This commit is contained in:
commit
8d590a4d00
207
0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch
Normal file
207
0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch
Normal file
@ -0,0 +1,207 @@
|
||||
From 7b386b703154c0901c4616badf18ddb260954bc1 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
||||
Date: Thu, 7 May 2015 20:37:16 +0300
|
||||
Subject: [PATCH 1/3] efidisk: move device path helpers in core for efinet
|
||||
|
||||
---
|
||||
grub-core/disk/efi/efidisk.c | 61 ++++++++------------------------------------
|
||||
grub-core/kern/efi/efi.c | 41 +++++++++++++++++++++++++++++
|
||||
include/grub/efi/efi.h | 4 +++
|
||||
3 files changed, 55 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
|
||||
index 60a6d3c..a8783a3 100644
|
||||
--- a/grub-core/disk/efi/efidisk.c
|
||||
+++ b/grub-core/disk/efi/efidisk.c
|
||||
@@ -43,47 +43,6 @@ static struct grub_efidisk_data *fd_devices;
|
||||
static struct grub_efidisk_data *hd_devices;
|
||||
static struct grub_efidisk_data *cd_devices;
|
||||
|
||||
-/* Duplicate a device path. */
|
||||
-static grub_efi_device_path_t *
|
||||
-duplicate_device_path (const grub_efi_device_path_t *dp)
|
||||
-{
|
||||
- grub_efi_device_path_t *p;
|
||||
- grub_size_t total_size = 0;
|
||||
-
|
||||
- for (p = (grub_efi_device_path_t *) dp;
|
||||
- ;
|
||||
- p = GRUB_EFI_NEXT_DEVICE_PATH (p))
|
||||
- {
|
||||
- total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
- if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p))
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- p = grub_malloc (total_size);
|
||||
- if (! p)
|
||||
- return 0;
|
||||
-
|
||||
- grub_memcpy (p, dp, total_size);
|
||||
- return p;
|
||||
-}
|
||||
-
|
||||
-/* Return the device path node right before the end node. */
|
||||
-static grub_efi_device_path_t *
|
||||
-find_last_device_path (const grub_efi_device_path_t *dp)
|
||||
-{
|
||||
- grub_efi_device_path_t *next, *p;
|
||||
-
|
||||
- if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
|
||||
- return 0;
|
||||
-
|
||||
- for (p = (grub_efi_device_path_t *) dp, next = GRUB_EFI_NEXT_DEVICE_PATH (p);
|
||||
- ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (next);
|
||||
- p = next, next = GRUB_EFI_NEXT_DEVICE_PATH (next))
|
||||
- ;
|
||||
-
|
||||
- return p;
|
||||
-}
|
||||
-
|
||||
static struct grub_efidisk_data *
|
||||
make_devices (void)
|
||||
{
|
||||
@@ -110,7 +69,7 @@ make_devices (void)
|
||||
if (! dp)
|
||||
continue;
|
||||
|
||||
- ldp = find_last_device_path (dp);
|
||||
+ ldp = grub_efi_find_last_device_path (dp);
|
||||
if (! ldp)
|
||||
/* This is empty. Why? */
|
||||
continue;
|
||||
@@ -150,11 +109,11 @@ find_parent_device (struct grub_efidisk_data *devices,
|
||||
grub_efi_device_path_t *dp, *ldp;
|
||||
struct grub_efidisk_data *parent;
|
||||
|
||||
- dp = duplicate_device_path (d->device_path);
|
||||
+ dp = grub_efi_duplicate_device_path (d->device_path);
|
||||
if (! dp)
|
||||
return 0;
|
||||
|
||||
- ldp = find_last_device_path (dp);
|
||||
+ ldp = grub_efi_find_last_device_path (dp);
|
||||
ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
ldp->length = sizeof (*ldp);
|
||||
@@ -180,11 +139,11 @@ is_child (struct grub_efidisk_data *child,
|
||||
grub_efi_device_path_t *dp, *ldp;
|
||||
int ret;
|
||||
|
||||
- dp = duplicate_device_path (child->device_path);
|
||||
+ dp = grub_efi_duplicate_device_path (child->device_path);
|
||||
if (! dp)
|
||||
return 0;
|
||||
|
||||
- ldp = find_last_device_path (dp);
|
||||
+ ldp = grub_efi_find_last_device_path (dp);
|
||||
ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
ldp->length = sizeof (*ldp);
|
||||
@@ -207,8 +166,8 @@ add_device (struct grub_efidisk_data **devices, struct grub_efidisk_data *d)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- ret = grub_efi_compare_device_paths (find_last_device_path ((*p)->device_path),
|
||||
- find_last_device_path (d->device_path));
|
||||
+ ret = grub_efi_compare_device_paths (grub_efi_find_last_device_path ((*p)->device_path),
|
||||
+ grub_efi_find_last_device_path (d->device_path));
|
||||
if (ret == 0)
|
||||
ret = grub_efi_compare_device_paths ((*p)->device_path,
|
||||
d->device_path);
|
||||
@@ -795,7 +754,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||
if (! dp)
|
||||
return 0;
|
||||
|
||||
- ldp = find_last_device_path (dp);
|
||||
+ ldp = grub_efi_find_last_device_path (dp);
|
||||
if (! ldp)
|
||||
return 0;
|
||||
|
||||
@@ -810,14 +769,14 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||
|
||||
/* It is necessary to duplicate the device path so that GRUB
|
||||
can overwrite it. */
|
||||
- dup_dp = duplicate_device_path (dp);
|
||||
+ dup_dp = grub_efi_duplicate_device_path (dp);
|
||||
if (! dup_dp)
|
||||
return 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
grub_efi_device_path_t *dup_ldp;
|
||||
- dup_ldp = find_last_device_path (dup_dp);
|
||||
+ dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
||||
if (!(GRUB_EFI_DEVICE_PATH_TYPE (dup_ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
|
||||
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE
|
||||
|| GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)))
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index b9eb1ab..49a1501 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -394,6 +394,47 @@ grub_efi_get_device_path (grub_efi_handle_t handle)
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
}
|
||||
|
||||
+/* Return the device path node right before the end node. */
|
||||
+grub_efi_device_path_t *
|
||||
+grub_efi_find_last_device_path (const grub_efi_device_path_t *dp)
|
||||
+{
|
||||
+ grub_efi_device_path_t *next, *p;
|
||||
+
|
||||
+ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
|
||||
+ return 0;
|
||||
+
|
||||
+ for (p = (grub_efi_device_path_t *) dp, next = GRUB_EFI_NEXT_DEVICE_PATH (p);
|
||||
+ ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (next);
|
||||
+ p = next, next = GRUB_EFI_NEXT_DEVICE_PATH (next))
|
||||
+ ;
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
+/* Duplicate a device path. */
|
||||
+grub_efi_device_path_t *
|
||||
+grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp)
|
||||
+{
|
||||
+ grub_efi_device_path_t *p;
|
||||
+ grub_size_t total_size = 0;
|
||||
+
|
||||
+ for (p = (grub_efi_device_path_t *) dp;
|
||||
+ ;
|
||||
+ p = GRUB_EFI_NEXT_DEVICE_PATH (p))
|
||||
+ {
|
||||
+ total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
+ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p))
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ p = grub_malloc (total_size);
|
||||
+ if (! p)
|
||||
+ return 0;
|
||||
+
|
||||
+ grub_memcpy (p, dp, total_size);
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
|
||||
{
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index 489cf9e..0e6fd86 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -53,6 +53,10 @@ void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
|
||||
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
|
||||
grub_efi_device_path_t *
|
||||
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
|
||||
+grub_efi_device_path_t *
|
||||
+EXPORT_FUNC(grub_efi_find_last_device_path) (const grub_efi_device_path_t *dp);
|
||||
+grub_efi_device_path_t *
|
||||
+EXPORT_FUNC(grub_efi_duplicate_device_path) (const grub_efi_device_path_t *dp);
|
||||
grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_efi_uintn_t *outbuf_size, void *outbuf,
|
||||
grub_efi_uintn_t *map_key,
|
||||
grub_efi_uintn_t *efi_desc_size,
|
||||
--
|
||||
2.1.4
|
||||
|
@ -0,0 +1,97 @@
|
||||
From c52ae40570c3bfbcca22d2195f5e6b31009d8a3f Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
||||
Date: Thu, 7 May 2015 20:37:17 +0300
|
||||
Subject: [PATCH 2/3] efinet: skip virtual IPv4 and IPv6 devices when
|
||||
enumerating cards
|
||||
|
||||
EDK2 PXE driver creates two child devices - IPv4 and IPv6 - with
|
||||
bound SNP instance. This means we get three cards for every physical
|
||||
adapter when enumerating. Not only is this confusing, this may result
|
||||
in grub ignoring packets that come in via the "wrong" card.
|
||||
|
||||
Example of device hierarchy is
|
||||
|
||||
Ctrl[91] PciRoot(0x0)/Pci(0x3,0x0)
|
||||
Ctrl[95] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)
|
||||
Ctrl[B4] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)
|
||||
Ctrl[BC] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv6(0000:0000:0000:0000:0000:0000:0000:0000)
|
||||
|
||||
Skip PXE created virtual devices when enumerating cards. Make sure to
|
||||
find real card when applying initial autoconfiguration during PXE boot,
|
||||
this information is associated with one of child devices.
|
||||
---
|
||||
grub-core/net/drivers/efi/efinet.c | 51 +++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 50 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index f171f20..2b53e9e 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -174,6 +174,29 @@ grub_efinet_findcards (void)
|
||||
{
|
||||
grub_efi_simple_network_t *net;
|
||||
struct grub_net_card *card;
|
||||
+ grub_efi_device_path_t *dp, *parent = NULL, *child = NULL;
|
||||
+
|
||||
+ /* EDK2 UEFI PXE driver creates IPv4 and IPv6 messaging devices as
|
||||
+ children of main MAC messaging device. We only need one device with
|
||||
+ bound SNP per physical card, otherwise they compete with each other
|
||||
+ when polling for incoming packets.
|
||||
+ */
|
||||
+ dp = grub_efi_get_device_path (*handle);
|
||||
+ if (!dp)
|
||||
+ continue;
|
||||
+ for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp); dp = GRUB_EFI_NEXT_DEVICE_PATH (dp))
|
||||
+ {
|
||||
+ parent = child;
|
||||
+ child = dp;
|
||||
+ }
|
||||
+ if (child
|
||||
+ && GRUB_EFI_DEVICE_PATH_TYPE (child) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
+ && (GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
+ || GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)
|
||||
+ && parent
|
||||
+ && GRUB_EFI_DEVICE_PATH_TYPE (parent) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
+ && GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)
|
||||
+ continue;
|
||||
|
||||
net = grub_efi_open_protocol (*handle, &net_io_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
@@ -251,7 +274,33 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
if (! cdp)
|
||||
continue;
|
||||
if (grub_efi_compare_device_paths (dp, cdp) != 0)
|
||||
- continue;
|
||||
+ {
|
||||
+ grub_efi_device_path_t *ldp, *dup_dp, *dup_ldp;
|
||||
+ int match;
|
||||
+
|
||||
+ /* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6
|
||||
+ as children of Ethernet card and binds PXE and Load File protocols
|
||||
+ to it. Loaded Image Device Path protocol will point to these pseudo
|
||||
+ devices. We skip them when enumerating cards, so here we need to
|
||||
+ find matching MAC device.
|
||||
+ */
|
||||
+ ldp = grub_efi_find_last_device_path (dp);
|
||||
+ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
+ || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
+ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
||||
+ continue;
|
||||
+ dup_dp = grub_efi_duplicate_device_path (dp);
|
||||
+ if (!dup_dp)
|
||||
+ continue;
|
||||
+ dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
||||
+ dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
+ dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
+ dup_ldp->length = sizeof (*dup_ldp);
|
||||
+ match = grub_efi_compare_device_paths (dup_dp, cdp) == 0;
|
||||
+ grub_free (dup_dp);
|
||||
+ if (!match)
|
||||
+ continue;
|
||||
+ }
|
||||
pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (! pxe)
|
||||
--
|
||||
2.1.4
|
||||
|
89
0003-efinet-open-Simple-Network-Protocol-exclusively.patch
Normal file
89
0003-efinet-open-Simple-Network-Protocol-exclusively.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From 49426e9fd2e562c73a4f1206f32eff9e424a1a73 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
||||
Date: Thu, 7 May 2015 20:37:17 +0300
|
||||
Subject: [PATCH 3/3] efinet: open Simple Network Protocol exclusively
|
||||
|
||||
EDK2 network stack is based on Managed Network Protocol which is layered
|
||||
on top of Simple Management Protocol and does background polling. This
|
||||
polling races with grub for received (and probably trasmitted) packets
|
||||
which causes either serious slowdown or complete failure to load files.
|
||||
|
||||
Open SNP device exclusively. This destroys all child MNP instances and
|
||||
stops background polling.
|
||||
|
||||
Exclusive open cannot be done when enumerating cards, as it would destroy
|
||||
PXE information we need to autoconfigure interface; and it cannot be done
|
||||
during autoconfiguration as we need to do it for non-PXE boot as well. So
|
||||
move SNP open to card ->open method and add matching ->close to clean up.
|
||||
|
||||
Based on patch from Mark Salter <msalter@redhat.com>
|
||||
|
||||
Also-By: Mark Salter <msalter@redhat.com>
|
||||
Closes: 41731
|
||||
---
|
||||
grub-core/net/drivers/efi/efinet.c | 46 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 46 insertions(+)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 2b53e9e..5533515 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -142,9 +142,55 @@ get_card_packet (struct grub_net_card *dev)
|
||||
return nb;
|
||||
}
|
||||
|
||||
+static grub_err_t
|
||||
+open_card (struct grub_net_card *dev)
|
||||
+{
|
||||
+ grub_efi_simple_network_t *net;
|
||||
+
|
||||
+ /* Try to reopen SNP exlusively to close any active MNP protocol instance
|
||||
+ that may compete for packet polling
|
||||
+ */
|
||||
+ net = grub_efi_open_protocol (dev->efi_handle, &net_io_guid,
|
||||
+ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
|
||||
+ if (net)
|
||||
+ {
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
|
||||
+ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
|
||||
+ return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net start failed",
|
||||
+ dev->name);
|
||||
+
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
|
||||
+ return grub_error (GRUB_ERR_NET_NO_CARD, "%s: card stopped",
|
||||
+ dev->name);
|
||||
+
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STARTED
|
||||
+ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
|
||||
+ return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net initialize failed",
|
||||
+ dev->name);
|
||||
+
|
||||
+ efi_call_4 (grub_efi_system_table->boot_services->close_protocol,
|
||||
+ dev->efi_net, &net_io_guid,
|
||||
+ grub_efi_image_handle, dev->efi_handle);
|
||||
+ dev->efi_net = net;
|
||||
+ }
|
||||
+
|
||||
+ /* If it failed we just try to run as best as we can */
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+close_card (struct grub_net_card *dev)
|
||||
+{
|
||||
+ efi_call_4 (grub_efi_system_table->boot_services->close_protocol,
|
||||
+ dev->efi_net, &net_io_guid,
|
||||
+ grub_efi_image_handle, dev->efi_handle);
|
||||
+}
|
||||
+
|
||||
static struct grub_net_card_driver efidriver =
|
||||
{
|
||||
.name = "efinet",
|
||||
+ .open = open_card,
|
||||
+ .close = close_card,
|
||||
.send = send_card_buffer,
|
||||
.recv = get_card_packet
|
||||
};
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 42d3848d0162ea8f824d63d57afb43b8b0a96860 Mon Sep 17 00:00:00 2001
|
||||
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
|
||||
Date: Sat, 15 Feb 2014 15:10:22 -0500
|
||||
Subject: [PATCH 110/112] reopen SNP protocol for exclusive use by grub
|
||||
|
||||
References: bnc#871555
|
||||
Patch-Mainline: no
|
||||
---
|
||||
grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 2b344d6..a6e4c79 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -223,6 +223,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
{
|
||||
struct grub_net_card *card;
|
||||
grub_efi_device_path_t *dp;
|
||||
+ grub_efi_simple_network_t *net;
|
||||
|
||||
dp = grub_efi_get_device_path (hnd);
|
||||
if (! dp)
|
||||
@@ -250,6 +251,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
&pxe_mode->dhcp_ack,
|
||||
sizeof (pxe_mode->dhcp_ack),
|
||||
1, device, path);
|
||||
+ net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
|
||||
+ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
|
||||
+ if (net) {
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
|
||||
+ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
|
||||
+ continue;
|
||||
+
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
|
||||
+ continue;
|
||||
+
|
||||
+ if (net->mode->state == GRUB_EFI_NETWORK_STARTED
|
||||
+ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
|
||||
+ continue;
|
||||
+ card->efi_net = net;
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
}
|
||||
--
|
||||
1.8.5.3
|
||||
|
122
grub2-xen.cfg
Normal file
122
grub2-xen.cfg
Normal file
@ -0,0 +1,122 @@
|
||||
insmod part_msdos
|
||||
insmod part_gpt
|
||||
insmod search
|
||||
insmod configfile
|
||||
insmod legacy_configfile
|
||||
|
||||
set debian_cddev=""
|
||||
set debian_cdarch=""
|
||||
if [ "${grub_cpu}" = "x86_64" ]; then
|
||||
debian_cdarch="amd"
|
||||
fi
|
||||
if [ "${grub_cpu}" = "i386" ]; then
|
||||
debian_cdarch="i386"
|
||||
fi
|
||||
if [ -n "${debian_cdarch}" ]; then
|
||||
set debian_kern="/install.${debian_cdarch}/xen/vmlinuz"
|
||||
set debian_initrd="/install.${debian_cdarch}/xen/initrd.gz"
|
||||
search -s debian_domUcfg -f "/install.${debian_cdarch}/xen/debian.cfg"
|
||||
search -s debian_cdkern -f "${debian_kern}"
|
||||
search -s debian_cdinitrd -f "${debian_initrd}"
|
||||
if [ -n "${debian_domUcfg}" -a -n "${debian_cdinitrd}" -a -n "${debian_cdkern}" -a "${debian_domUcfg}" = "${debian_cdinitrd}" -a "${debian_domUcfg}" = "${debian_cdkern}" ]; then
|
||||
debian_cddev="${debian_domUcfg}"
|
||||
fi
|
||||
fi
|
||||
|
||||
set fedora_cddev=""
|
||||
if [ "${grub_cpu}" = "x86_64" ]; then
|
||||
set fedora_kern="/images/pxeboot/vmlinuz"
|
||||
set fedora_initrd="/images/pxeboot/initrd.img"
|
||||
search -s fedora_cdkern -f "${fedora_kern}"
|
||||
search -s fedora_cdinitrd -f "${fedora_initrd}"
|
||||
if [ -n "${fedora_cdkern}" -a -n "${fedora_cdinitrd}" -a "${fedora_cdkern}" = "${fedora_cdinitrd}" ]; then
|
||||
set fedora_cddev="${fedora_cdkern}"
|
||||
fi
|
||||
fi
|
||||
|
||||
set suse_cddev=""
|
||||
search -s suse_cddev_content -f "/content"
|
||||
search -s suse_cddev_product -f "/media.1/products"
|
||||
if [ -n "${suse_cddev_content}" -a -n "${suse_cddev_product}" -a "${suse_cddev_content}" = "${suse_cddev_product}" ]; then
|
||||
set suse_cddev="${suse_cddev_content}"
|
||||
fi
|
||||
|
||||
hdcfg_lst="/boot/grub2/grub.cfg \
|
||||
/@/boot/grub2/grub.cfg \
|
||||
/boot/grub/menu.lst \
|
||||
/grub2/grub.cfg \
|
||||
/grub/menu.lst"
|
||||
|
||||
set hdcfg=""
|
||||
for c in ${hdcfg_lst}; do
|
||||
if search -s hddev -f "${c}"; then
|
||||
set hdcfg="${c}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
set timeout=0
|
||||
if [ -n "${debian_cddev}" ]; then
|
||||
set timeout=8
|
||||
menuentry "${debian_cddev} Debian Install" {
|
||||
set root="${debian_cddev}"
|
||||
linux "${debian_kern}" ignore_loglevel
|
||||
initrd "${debian_initrd}"
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -n "${fedora_cddev}" ]; then
|
||||
set timeout=8
|
||||
menuentry "${fedora_cddev} Fedora Install" {
|
||||
set root="${fedora_cddev}"
|
||||
linux "${fedora_kern}" ignore_loglevel
|
||||
initrd "${fedora_initrd}"
|
||||
}
|
||||
menuentry "${fedora_cddev} Fedora Rescue" {
|
||||
set root="${fedora_cddev}"
|
||||
linux "${fedora_kern}" ignore_loglevel rescue
|
||||
initrd "${fedora_initrd}"
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -n "${suse_cddev}" ]; then
|
||||
if [ "${grub_cpu}" = "i386" ]; then
|
||||
set suse_cdarch="i586"
|
||||
else
|
||||
set suse_cdarch="${grub_cpu}"
|
||||
fi
|
||||
set timeout=8
|
||||
set root="${suse_cddev}"
|
||||
set suse_cdcfg="/boot/${suse_cdarch}/grub2-xen/grub.cfg"
|
||||
set suse_cdkern="/boot/${suse_cdarch}/vmlinuz-xen"
|
||||
set suse_cdinitrd="/boot/${suse_cdarch}/initrd-xen"
|
||||
if [ -f "${suse_cdcfg}" ]; then
|
||||
menuentry "${suse_cddev} SUSE Install menu" {
|
||||
set root="${suse_cddev}"
|
||||
configfile "${suse_cdcfg}"
|
||||
}
|
||||
elif [ -f "${suse_cdkern}" -a -f "$suse_cdinitrd" ]; then
|
||||
menuentry "${suse_cddev} SUSE Install" {
|
||||
linux "${suse_cdkern}" linemode=1 xencons=hvc0
|
||||
initrd "${suse_cdinitrd}"
|
||||
}
|
||||
menuentry "${suse_cddev} SUSE Rescue" {
|
||||
linux "${suse_cdkern}" linemode=1 xencons=hvc0 rescue=1
|
||||
initrd "${suse_cdinitrd}"
|
||||
}
|
||||
menuentry "${suse_cddev} SUSE Upgrade" {
|
||||
linux "${suse_cdkern}" linemode=1 xencons=hvc0 upgrade=1
|
||||
initrd "${suse_cdinitrd}"
|
||||
}
|
||||
else
|
||||
echo "the device ${suse_cddev} is not xen pv bootable"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${hddev}" ] ; then
|
||||
set default="Boot From Hard Disk"
|
||||
menuentry "${hddev} Boot From Hard Disk" {
|
||||
set root="${hddev}"
|
||||
configfile "${hdcfg}"
|
||||
}
|
||||
fi
|
@ -1,3 +1,21 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon May 11 08:50:14 UTC 2015 - mchang@suse.com
|
||||
|
||||
- Support booting opensuse installer as PV DomU (boo#926795)
|
||||
* added grub2-xen.cfg for tracking default pvgrub2 xen configs rather than
|
||||
generating it from spec file
|
||||
* grub2-xen.cfg: from Olaf Hering <ohering@suse.com>
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun May 10 19:38:00 UTC 2015 - arvidjaar@gmail.com
|
||||
|
||||
- replace grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
|
||||
with upstream version:
|
||||
* 0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch
|
||||
* 0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch
|
||||
* 0003-efinet-open-Simple-Network-Protocol-exclusively.patch
|
||||
Fixes EFI network boot in some QEMU configurations.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 29 13:20:20 UTC 2015 - dmueller@suse.com
|
||||
|
||||
|
31
grub2.spec
31
grub2.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package grub2
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -146,6 +146,7 @@ Source11: SLES-UEFI-CA-Certificate.crt
|
||||
Source12: grub2-snapper-plugin.sh
|
||||
Source14: 80_suse_btrfs_snapshot
|
||||
Source15: grub2-once.service
|
||||
Source16: grub2-xen.cfg
|
||||
Source1000: PATCH_POLICY
|
||||
Patch1: rename-grub-info-file-to-grub2.patch
|
||||
Patch2: grub2-linux.patch
|
||||
@ -175,7 +176,9 @@ Patch40: grub2-s390x-03-output-7-bit-ascii.patch
|
||||
Patch41: grub2-s390x-04-grub2-install.patch
|
||||
Patch42: grub2-s390x-05-grub2-mkconfig.patch
|
||||
Patch43: grub2-use-rpmsort-for-version-sorting.patch
|
||||
Patch50: grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
|
||||
Patch44: 0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch
|
||||
Patch45: 0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch
|
||||
Patch46: 0003-efinet-open-Simple-Network-Protocol-exclusively.patch
|
||||
Patch51: grub2-xen-legacy-config-device-name.patch
|
||||
Patch52: grub2-getroot-support-NVMe-device-names.patch
|
||||
Patch53: grub2-getroot-treat-mdadm-ddf-as-simple-device.patch
|
||||
@ -416,7 +419,9 @@ mv po/grub.pot po/%{name}.pot
|
||||
%patch41 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch50 -p1
|
||||
%patch44 -p1
|
||||
%patch45 -p1
|
||||
%patch46 -p1
|
||||
%patch51 -p1
|
||||
%patch52 -p1
|
||||
%patch53 -p1
|
||||
@ -521,25 +526,7 @@ cd build-xen
|
||||
--program-transform-name=s,grub,%{name},
|
||||
make %{?_smp_mflags}
|
||||
|
||||
cat > ./grub.cfg <<EOF
|
||||
insmod part_msdos
|
||||
insmod part_gpt
|
||||
insmod search
|
||||
insmod configfile
|
||||
insmod legacy_configfile
|
||||
if search -s root -f /boot/grub2/grub.cfg ; then
|
||||
configfile /boot/grub2/grub.cfg
|
||||
elif search -s root -f /@/boot/grub2/grub.cfg ; then
|
||||
configfile /@/boot/grub2/grub.cfg
|
||||
elif search -s root -f /boot/grub/menu.lst ; then
|
||||
legacy_configfile /boot/grub/menu.lst
|
||||
elif search -s root -f /grub2/grub.cfg ; then
|
||||
configfile /grub2/grub.cfg
|
||||
elif search -s root -f /grub/menu.lst ; then
|
||||
legacy_configfile /grub/menu.lst
|
||||
fi
|
||||
EOF
|
||||
./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub.xen -O %{grubxenarch} -d grub-core/ "/boot/grub/grub.cfg=./grub.cfg"
|
||||
./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub.xen -O %{grubxenarch} -d grub-core/ "/boot/grub/grub.cfg=%{SOURCE16}"
|
||||
|
||||
cd ..
|
||||
%endif
|
||||
|
Loading…
Reference in New Issue
Block a user