[packages/grub2] EFI network boot fix from ustream
jajcus
jajcus at pld-linux.org
Sat Nov 30 15:06:47 CET 2013
commit 29982b1b7f1b769f860021a4882f72c0a79850e9
Author: Jacek Konieczny <jajcus at jajcus.net>
Date: Sat Nov 30 15:06:31 2013 +0100
EFI network boot fix from ustream
grub2-efinet_fix.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
grub2.spec | 2 ++
2 files changed, 67 insertions(+)
---
diff --git a/grub2.spec b/grub2.spec
index 1cbc136..14c219a 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -78,6 +78,7 @@ Patch20: ignore-kernel-symlinks.patch
Patch21: choose-preferred-initrd.patch
Patch22: %{name}-cfg.patch
Patch23: %{name}-freetype_include.patch
+Patch24: %{name}-efinet_fix.patch
URL: http://www.gnu.org/software/grub/
BuildRequires: autoconf >= 2.53
BuildRequires: automake >= 1:1.11.1-1
@@ -308,6 +309,7 @@ Motyw starfield dla GRUB-a.
%patch21 -p1
%patch22 -p0
%patch23 -p1
+%patch24 -p1
%build
# if gold is used then grub doesn't even boot
diff --git a/grub2-efinet_fix.patch b/grub2-efinet_fix.patch
new file mode 100644
index 0000000..06cb593
--- /dev/null
+++ b/grub2-efinet_fix.patch
@@ -0,0 +1,65 @@
+commit c5898eb4505dcd5f367048d33ec5ea9ed40dfdeb (HEAD, tmp)
+Author: Vladimir 'phcoder' Serbinenko <phcoder at 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;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/grub2.git/commitdiff/29982b1b7f1b769f860021a4882f72c0a79850e9
More information about the pld-cvs-commit
mailing list