Accepting request 250087 from home:michael-chang:branches:Base:System

- fix grub.xen not able to handle legacy menu.lst hdX names (bnc#863821)
  * add grub2-xen-legacy-config-device-name.patch from arvidjaar
- fix the performance of grub2 uefi pxe is bad (bnc#871555)
  * add grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch

OBS-URL: https://build.opensuse.org/request/show/250087
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=117
This commit is contained in:
Stephan Kulow 2014-09-19 15:58:54 +00:00 committed by Git OBS Bridge
parent 1f44d7d117
commit 66d380590b
4 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,48 @@
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

View File

@ -0,0 +1,112 @@
From: Andrey Borzenkov <arvidjaar@gmail.com>
Subject: [PATCH] accept also hdX as alias to native Xen disk name
References: bnc#863821
Patch-Mainline: no
To assign correct disk numbers, sort disks by increasing order of handle
value. This allows reusing legacy pv-grub menu.lst which is using hdX names.
Suggested-By: Michael Chang <mchang@suse.com>
---
grub-core/disk/xen/xendisk.c | 45 +++++++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 9 deletions(-)
diff --git a/grub-core/disk/xen/xendisk.c b/grub-core/disk/xen/xendisk.c
index 2b11c2a..b18a923 100644
--- a/grub-core/disk/xen/xendisk.c
+++ b/grub-core/disk/xen/xendisk.c
@@ -40,6 +40,7 @@ struct virtdisk
grub_xen_evtchn_t evtchn;
void *dma_page;
grub_xen_grant_t dma_grant;
+ struct virtdisk *compat_next;
};
#define xen_wmb() mb()
@@ -47,6 +48,7 @@ struct virtdisk
static struct virtdisk *virtdisks;
static grub_size_t vdiskcnt;
+struct virtdisk *compat_head;
static int
grub_virtdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
@@ -66,20 +68,32 @@ grub_virtdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
static grub_err_t
grub_virtdisk_open (const char *name, grub_disk_t disk)
{
- grub_size_t i;
+ int i;
grub_uint32_t secsize;
char fdir[200];
char *buf;
+ int num = -1;
+ struct virtdisk *vd;
- for (i = 0; i < vdiskcnt; i++)
- if (grub_strcmp (name, virtdisks[i].fullname) == 0)
+ /* For compatibility with pv-grub legacy menu.lst accept hdX as disk name */
+ if (name[0] == 'h' && name[1] == 'd' && name[2])
+ {
+ num = grub_strtoul (name + 2, 0, 10);
+ if (grub_errno)
+ {
+ grub_errno = 0;
+ num = -1;
+ }
+ }
+ for (i = 0, vd = compat_head; vd; vd = vd->compat_next, i++)
+ if (i == num || grub_strcmp (name, vd->fullname) == 0)
break;
- if (i == vdiskcnt)
+ if (!vd)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a virtdisk");
- disk->data = &virtdisks[i];
- disk->id = i;
+ disk->data = vd;
+ disk->id = vd - virtdisks;
- grub_snprintf (fdir, sizeof (fdir), "%s/sectors", virtdisks[i].backend_dir);
+ grub_snprintf (fdir, sizeof (fdir), "%s/sectors", vd->backend_dir);
buf = grub_xenstore_get_file (fdir, NULL);
if (!buf)
return grub_errno;
@@ -87,8 +101,7 @@ grub_virtdisk_open (const char *name, grub_disk_t disk)
if (grub_errno)
return grub_errno;
- grub_snprintf (fdir, sizeof (fdir), "%s/sector-size",
- virtdisks[i].backend_dir);
+ grub_snprintf (fdir, sizeof (fdir), "%s/sector-size", vd->backend_dir);
buf = grub_xenstore_get_file (fdir, NULL);
if (!buf)
return grub_errno;
@@ -264,6 +277,7 @@ fill (const char *dir, void *data)
grub_err_t err;
void *buf;
struct evtchn_alloc_unbound alloc_unbound;
+ struct virtdisk **prev = &compat_head, *vd = compat_head;
/* Shouldn't happen unles some hotplug happened. */
if (vdiskcnt >= *ctr)
@@ -374,6 +388,19 @@ fill (const char *dir, void *data)
virtdisks[vdiskcnt].frontend_dir = grub_strdup (fdir);
+ /* For compatibility with pv-grub maintain linked list sorted by handle
+ value in increasing order. This allows mapping of (hdX) disk names
+ from legacy menu.lst */
+ while (vd)
+ {
+ if (vd->handle > virtdisks[vdiskcnt].handle)
+ break;
+ prev = &vd->compat_next;
+ vd = vd->compat_next;
+ }
+ virtdisks[vdiskcnt].compat_next = vd;
+ *prev = &virtdisks[vdiskcnt];
+
vdiskcnt++;
return 0;

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Sep 18 09:55:57 UTC 2014 - mchang@suse.com
- fix grub.xen not able to handle legacy menu.lst hdX names (bnc#863821)
* add grub2-xen-legacy-config-device-name.patch from arvidjaar
- fix the performance of grub2 uefi pxe is bad (bnc#871555)
* add grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
-------------------------------------------------------------------
Tue Sep 16 07:08:18 UTC 2014 - schwab@suse.de

View File

@ -153,6 +153,8 @@ Patch42: grub2-btrfs-fix-incorrect-address-reference.patch
Patch43: grub2-mkconfig-aarch64.patch
# Fix build with glibc 2.20+
Patch44: grub2-glibc-2.20.patch
Patch45: grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
Patch46: grub2-xen-legacy-config-device-name.patch
# Btrfs snapshot booting related patches
Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
Patch102: grub2-btrfs-02-export-subvolume-envvars.patch
@ -356,6 +358,8 @@ mv po/grub.pot po/%{name}.pot
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1