diff --git a/0001-add-support-for-UEFI-network-protocols.patch b/0001-add-support-for-UEFI-network-protocols.patch index da98245..58aa642 100644 --- a/0001-add-support-for-UEFI-network-protocols.patch +++ b/0001-add-support-for-UEFI-network-protocols.patch @@ -1,29 +1,39 @@ -From a4baaedd5482ec182f1be83a1f4b3cdf3c286ea2 Mon Sep 17 00:00:00 2001 +From 5d6111790e1cd07d1156f47bca0733f6d715337f Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 22 Feb 2017 14:27:50 +0800 -Subject: [PATCH] Add support for UEFI network protocols +Subject: [PATCH] Support UEFI networking protocols -Add preliminary support of existing network functions based on UEFI network -protocols. +References: fate#320130, bsc#1015589 +Patch-Mainline: no + +V1: + * Add preliminary support of UEFI networking protocols + * Support UEFI HTTPS Boot + +V2: + * Workaround http data access in firmware + * Fix DNS device path parsing for efinet device + * Relaxed UEFI Protocol requirement + * Support Intel OPA (Omni-Path Architecture) PXE Boot --- grub-core/Makefile.core.def | 18 + - grub-core/kern/efi/efi.c | 70 +- - grub-core/net/drivers/efi/efinet.c | 6 + + grub-core/kern/efi/efi.c | 96 ++- + grub-core/net/drivers/efi/efinet.c | 27 + grub-core/net/efi/dhcp.c | 397 ++++++++++ grub-core/net/efi/efi_netfs.c | 57 ++ - grub-core/net/efi/http.c | 354 +++++++++ + grub-core/net/efi/http.c | 360 +++++++++ grub-core/net/efi/ip4_config.c | 398 ++++++++++ grub-core/net/efi/ip6_config.c | 422 +++++++++++ - grub-core/net/efi/net.c | 1420 ++++++++++++++++++++++++++++++++++++ - grub-core/net/efi/pxe.c | 419 +++++++++++ + grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++ + grub-core/net/efi/pxe.c | 424 +++++++++++ grub-core/net/net.c | 74 ++ - include/grub/efi/api.h | 145 +++- + include/grub/efi/api.h | 181 ++++- include/grub/efi/dhcp.h | 343 +++++++++ include/grub/efi/http.h | 215 ++++++ - include/grub/net/efi.h | 143 ++++ + include/grub/net/efi.h | 144 ++++ util/grub-mknetdir.c | 23 +- - 16 files changed, 4478 insertions(+), 26 deletions(-) + 16 files changed, 4567 insertions(+), 40 deletions(-) create mode 100644 grub-core/net/efi/dhcp.c create mode 100644 grub-core/net/efi/efi_netfs.c create mode 100644 grub-core/net/efi/http.c @@ -35,11 +45,11 @@ protocols. create mode 100644 include/grub/efi/http.h create mode 100644 include/grub/net/efi.h -Index: grub-2.02/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02.orig/grub-core/Makefile.core.def -+++ grub-2.02/grub-core/Makefile.core.def -@@ -2157,6 +2157,18 @@ module = { +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index a65c27f..e93c772 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2167,6 +2167,18 @@ module = { }; module = { @@ -58,7 +68,7 @@ Index: grub-2.02/grub-core/Makefile.core.def name = net; common = net/net.c; common = net/dns.c; -@@ -2169,6 +2181,12 @@ module = { +@@ -2179,6 +2191,12 @@ module = { common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; @@ -71,11 +81,11 @@ Index: grub-2.02/grub-core/Makefile.core.def }; module = { -Index: grub-2.02/grub-core/kern/efi/efi.c -=================================================================== ---- grub-2.02.orig/grub-core/kern/efi/efi.c -+++ grub-2.02/grub-core/kern/efi/efi.c -@@ -700,7 +700,7 @@ grub_efi_print_device_path (grub_efi_dev +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index d467785..0ceaa48 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -672,7 +672,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) { grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; @@ -84,7 +94,7 @@ Index: grub-2.02/grub-core/kern/efi/efi.c (unsigned) ipv4->local_ip_address[0], (unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[2], -@@ -713,33 +713,60 @@ grub_efi_print_device_path (grub_efi_dev +@@ -685,33 +685,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) (unsigned) ipv4->remote_port, (unsigned) ipv4->protocol, (unsigned) ipv4->static_ip_address); @@ -162,7 +172,7 @@ Index: grub-2.02/grub-core/kern/efi/efi.c } break; case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: -@@ -779,6 +806,13 @@ grub_efi_print_device_path (grub_efi_dev +@@ -751,6 +778,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) dump_vendor_path ("Messaging", (grub_efi_vendor_device_path_t *) dp); break; @@ -172,14 +182,40 @@ Index: grub-2.02/grub-core/kern/efi/efi.c + = (grub_efi_uri_device_path_t *) dp; + grub_printf ("/URI(%s)", uri->uri); + } ++ break; ++ case GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE: ++ { ++ grub_efi_dns_device_path_t *dns ++ = (grub_efi_dns_device_path_t *) dp; ++ if (dns->is_ipv6) ++ { ++ grub_printf ("/DNS(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x)", ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[0]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[0])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[1]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[1])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[2]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[2])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[3]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].addr[3]))); ++ } ++ else ++ { ++ grub_printf ("/DNS(%d.%d.%d.%d)", ++ dns->dns_server_ip[0].v4.addr[0], ++ dns->dns_server_ip[0].v4.addr[1], ++ dns->dns_server_ip[0].v4.addr[2], ++ dns->dns_server_ip[0].v4.addr[3]); ++ } ++ } + break; default: grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; -Index: grub-2.02/grub-core/net/drivers/efi/efinet.c -=================================================================== ---- grub-2.02.orig/grub-core/net/drivers/efi/efinet.c -+++ grub-2.02/grub-core/net/drivers/efi/efinet.c +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 82a28fb..f189209 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c @@ -24,6 +24,7 @@ #include #include @@ -188,7 +224,49 @@ Index: grub-2.02/grub-core/net/drivers/efi/efinet.c GRUB_MOD_LICENSE ("GPLv3+"); -@@ -816,6 +817,9 @@ grub_efi_net_config_real (grub_efi_handl +@@ -481,6 +482,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + + ldp = grub_efi_find_last_device_path (ddp); + ++ /* Skip the DNS Device */ ++ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE) ++ { ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ ++ ldp = grub_efi_find_last_device_path (ddp); ++ } ++ + 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)) +@@ -744,6 +756,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + 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 ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) + continue; + dup_dp = grub_efi_duplicate_device_path (dp); +@@ -759,6 +772,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + } + + dup_ldp = grub_efi_find_last_device_path (dup_dp); ++ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE) ++ { ++ 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); ++ } ++ ++ 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); +@@ -816,6 +838,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, GRUB_MOD_INIT(efinet) { @@ -198,7 +276,7 @@ Index: grub-2.02/grub-core/net/drivers/efi/efinet.c grub_efinet_findcards (); grub_efi_net_config = grub_efi_net_config_real; } -@@ -827,5 +831,7 @@ GRUB_MOD_FINI(efinet) +@@ -827,5 +852,7 @@ GRUB_MOD_FINI(efinet) FOR_NET_CARDS_SAFE (card, next) if (card->driver == &efidriver) grub_net_card_unregister (card); @@ -206,10 +284,11 @@ Index: grub-2.02/grub-core/net/drivers/efi/efinet.c + grub_efi_net_config = NULL; } -Index: grub-2.02/grub-core/net/efi/dhcp.c -=================================================================== +diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c +new file mode 100644 +index 0000000..dbef63d --- /dev/null -+++ grub-2.02/grub-core/net/efi/dhcp.c ++++ b/grub-core/net/efi/dhcp.c @@ -0,0 +1,397 @@ +#include +#include @@ -608,10 +687,11 @@ Index: grub-2.02/grub-core/net/efi/dhcp.c + +grub_command_func_t grub_efi_net_bootp = grub_cmd_efi_bootp; +grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; -Index: grub-2.02/grub-core/net/efi/efi_netfs.c -=================================================================== +diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c +new file mode 100644 +index 0000000..ef371d8 --- /dev/null -+++ grub-2.02/grub-core/net/efi/efi_netfs.c ++++ b/grub-core/net/efi/efi_netfs.c @@ -0,0 +1,57 @@ +#include +#include @@ -670,11 +750,12 @@ Index: grub-2.02/grub-core/net/efi/efi_netfs.c + return; + } +} -Index: grub-2.02/grub-core/net/efi/http.c -=================================================================== +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +new file mode 100644 +index 0000000..816a3cd --- /dev/null -+++ grub-2.02/grub-core/net/efi/http.c -@@ -0,0 +1,354 @@ ++++ b/grub-core/net/efi/http.c +@@ -0,0 +1,360 @@ + +#include +#include @@ -777,6 +858,17 @@ Index: grub-2.02/grub-core/net/efi/http.c + response_callback_done = 1; +} + ++struct grub_efi_http_data ++{ ++ grub_efi_http_request_data_t request_data; ++ grub_efi_http_message_t request_message; ++ grub_efi_http_token_t request_token; ++ grub_efi_http_response_data_t response_data; ++ grub_efi_http_message_t response_message; ++ grub_efi_http_token_t response_token; ++ grub_efi_http_header_t request_headers[3]; ++}; ++ +static grub_err_t +grub_efihttp_open (struct grub_efi_net_device *dev, + int prefer_ip6 __attribute__ ((unused)), @@ -785,21 +877,21 @@ Index: grub-2.02/grub-core/net/efi/http.c + int type) +{ + grub_efi_status_t status; -+ grub_efi_http_request_data_t request_data = {0}; -+ grub_efi_http_message_t request_message = {{0}, 0, 0, 0, 0}; -+ grub_efi_http_token_t request_token = {0}; -+ grub_efi_http_response_data_t response_data = {0}; -+ grub_efi_http_message_t response_message = {{0}, 0, 0, 0, 0}; -+ grub_efi_http_token_t response_token = {0}; + grub_uint32_t length, i; + grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; + grub_efi_http_t *http = dev->http; + char *url = NULL; -+ grub_efi_http_header_t request_headers[3] = { -+ {(grub_efi_char8_t *)"Host", (grub_efi_char8_t *)file->device->net->server}, -+ {(grub_efi_char8_t *)"Accept", (grub_efi_char8_t *)"*/*"}, -+ {(grub_efi_char8_t *)"User-Agent", (grub_efi_char8_t *)"UefiHttpBoot/1.0"} -+ }; ++ ++ struct grub_efi_http_data *data = grub_malloc (sizeof (*data)); ++ ++ grub_memset (data, 0, sizeof (*data)); ++ ++ data->request_headers[0].field_name = (grub_efi_char8_t *)"Host"; ++ data->request_headers[0].field_value = (grub_efi_char8_t *)file->device->net->server; ++ data->request_headers[1].field_name = (grub_efi_char8_t *)"Accept"; ++ data->request_headers[1].field_value = (grub_efi_char8_t *)"*/*"; ++ data->request_headers[2].field_name = (grub_efi_char8_t *)"User-Agent"; ++ data->request_headers[2].field_value = (grub_efi_char8_t *)"UefiHttpBoot/1.0"; + + { + grub_efi_ipv6_address_t address; @@ -829,21 +921,21 @@ Index: grub-2.02/grub-core/net/efi/http.c + ucs2_url_len = grub_utf8_to_utf16 (ucs2_url, ucs2_url_len, (grub_uint8_t *)url, url_len, NULL); /* convert string format from ascii to usc2 */ + ucs2_url[ucs2_url_len] = 0; + grub_free (url); -+ request_data.url = ucs2_url; ++ data->request_data.url = ucs2_url; + } + -+ request_data.method = GRUB_EFI_HTTPMETHODGET; ++ data->request_data.method = GRUB_EFI_HTTPMETHODGET; + -+ request_message.data.request = &request_data; -+ request_message.header_count = 3; -+ request_message.headers = request_headers; -+ request_message.body_length = 0; -+ request_message.body = NULL; ++ data->request_message.data.request = &data->request_data; ++ data->request_message.header_count = 3; ++ data->request_message.headers = data->request_headers; ++ data->request_message.body_length = 0; ++ data->request_message.body = NULL; + + /* request token */ -+ request_token.event = NULL; -+ request_token.status = GRUB_EFI_NOT_READY; -+ request_token.message = &request_message; ++ data->request_token.event = NULL; ++ data->request_token.status = GRUB_EFI_NOT_READY; ++ data->request_token.message = &data->request_message; + + request_callback_done = 0; + status = efi_call_5 (b->create_event, @@ -851,63 +943,63 @@ Index: grub-2.02/grub-core/net/efi/http.c + GRUB_EFI_TPL_CALLBACK, + grub_efi_http_request_callback, + NULL, -+ &request_token.event); ++ &data->request_token.event); + + if (status != GRUB_EFI_SUCCESS) + { -+ grub_free (request_data.url); ++ grub_free (data->request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); + } + -+ status = efi_call_2 (http->request, http, &request_token); ++ status = efi_call_2 (http->request, http, &data->request_token); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, request_token.event); -+ grub_free (request_data.url); ++ efi_call_1 (b->close_event, data->request_token.event); ++ grub_free (data->request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); + } + /* TODO: Add Timeout */ + while (!request_callback_done) + efi_call_1(http->poll, http); + -+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS; -+ response_message.data.response = &response_data; ++ data->response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS; ++ data->response_message.data.response = &data->response_data; + /* herader_count will be updated by the HTTP driver on response */ -+ response_message.header_count = 0; ++ data->response_message.header_count = 0; + /* headers will be populated by the driver on response */ -+ response_message.headers = NULL; ++ data->response_message.headers = NULL; + /* use zero BodyLength to only receive the response headers */ -+ response_message.body_length = 0; -+ response_message.body = NULL; -+ response_token.event = NULL; ++ data->response_message.body_length = 0; ++ data->response_message.body = NULL; ++ data->response_token.event = NULL; + + status = efi_call_5 (b->create_event, + GRUB_EFI_EVT_NOTIFY_SIGNAL, + GRUB_EFI_TPL_CALLBACK, + grub_efi_http_response_callback, + NULL, -+ &response_token.event); ++ &data->response_token.event); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, request_token.event); -+ grub_free (request_data.url); ++ efi_call_1 (b->close_event, data->request_token.event); ++ grub_free (data->request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); + } + -+ response_token.status = GRUB_EFI_SUCCESS; -+ response_token.message = &response_message; ++ data->response_token.status = GRUB_EFI_SUCCESS; ++ data->response_token.message = &data->response_message; + + /* wait for HTTP response */ + response_callback_done = 0; -+ status = efi_call_2 (http->response, http, &response_token); ++ status = efi_call_2 (http->response, http, &data->response_token); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, response_token.event); -+ efi_call_1 (b->close_event, request_token.event); -+ grub_free (request_data.url); ++ efi_call_1 (b->close_event, data->response_token.event); ++ efi_call_1 (b->close_event, data->request_token.event); ++ grub_free (data->request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status); + } + @@ -917,50 +1009,47 @@ Index: grub-2.02/grub-core/net/efi/http.c + + /* check the HTTP status code */ + /* parse the length of the file from the ContentLength header */ -+ for (length = 0, i = 0; i < response_message.header_count; ++i) ++ for (length = 0, i = 0; i < data->response_message.header_count; ++i) + { -+ if (!grub_strcmp((const char*)response_message.headers[i].field_name, "Content-Length")) ++ if (!grub_strcmp((const char*)data->response_message.headers[i].field_name, "Content-Length")) + { -+ length = grub_strtoul((const char*)response_message.headers[i].field_value, 0, 10); ++ length = grub_strtoul((const char*)data->response_message.headers[i].field_value, 0, 10); + break; + } + } + + file->size = (grub_off_t)length; + file->not_easily_seekable = 0; -+ file->data = 0; ++ file->data = data; + file->device->net->offset = 0; + + /* release */ + /* On response, this array is allocated and + populated by the HTTP driver. It is the responsibility of the caller + to free this memory on both request and response. */ -+ if (response_message.headers) -+ efi_call_1 (b->free_pool, response_message.headers); ++ if (data->response_message.headers) ++ efi_call_1 (b->free_pool, data->response_message.headers); + -+ efi_call_1 (b->close_event, response_token.event); -+ efi_call_1 (b->close_event, request_token.event); -+ grub_free (request_data.url); ++ efi_call_1 (b->close_event, data->response_token.event); ++ efi_call_1 (b->close_event, data->request_token.event); ++ grub_free (data->request_data.url); + + return GRUB_ERR_NONE; +} + +static grub_err_t -+grub_efihttp_close (struct grub_efi_net_device *dev, ++grub_efihttp_close (struct grub_efi_net_device *dev __attribute__ ((unused)), + int prefer_ip6 __attribute__ ((unused)), + grub_file_t file) +{ -+ grub_efi_status_t status; -+ grub_efi_http_t *http = dev->http; ++ struct grub_efi_http_data *data = file->data; + -+ return GRUB_ERR_NONE; -+ status = efi_call_2 (http->cancel, http, NULL); -+ if (status != GRUB_EFI_SUCCESS) -+ return grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status); ++ if (data) ++ grub_free (data); + ++ file->data = 0; + file->offset = 0; + file->device->net->offset = 0; -+ + return GRUB_ERR_NONE; +} + @@ -971,39 +1060,37 @@ Index: grub-2.02/grub-core/net/efi/http.c + char *buf, + grub_size_t len) +{ -+ grub_efi_http_token_t response_token; + grub_efi_status_t status; + grub_size_t sum = 0; + grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; + grub_efi_http_t *http = dev->http; ++ struct grub_efi_http_data *data = file->data; + -+ response_token.event = NULL; ++ grub_memset (data, 0, sizeof (*data)); + efi_call_5 (b->create_event, + GRUB_EFI_EVT_NOTIFY_SIGNAL, + GRUB_EFI_TPL_CALLBACK, + grub_efi_http_response_callback, + NULL, -+ &response_token.event); ++ &data->response_token.event); + + while (len) + { -+ grub_efi_http_message_t response_message; ++ data->response_message.data.response = NULL; ++ data->response_message.header_count = 0; ++ data->response_message.headers = NULL; ++ data->response_message.body_length = len; ++ data->response_message.body = buf; + -+ response_message.data.response = NULL; -+ response_message.header_count = 0; -+ response_message.headers = NULL; -+ response_message.body_length = len; -+ response_message.body = buf; -+ -+ response_token.message = &response_message; -+ response_token.status = GRUB_EFI_NOT_READY; ++ data->response_token.message = &data->response_message; ++ data->response_token.status = GRUB_EFI_NOT_READY; + + response_callback_done = 0; + -+ status = efi_call_2 (http->response, http, &response_token); ++ status = efi_call_2 (http->response, http, &data->response_token); + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, response_token.event); ++ efi_call_1 (b->close_event, data->response_token.event); + grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status); + return -1; + } @@ -1011,13 +1098,13 @@ Index: grub-2.02/grub-core/net/efi/http.c + while (!response_callback_done) + efi_call_1(http->poll, http); + -+ file->device->net->offset += response_message.body_length; -+ sum += response_message.body_length; -+ buf += response_message.body_length; -+ len -= response_message.body_length; ++ file->device->net->offset += data->response_message.body_length; ++ sum += data->response_message.body_length; ++ buf += data->response_message.body_length; ++ len -= data->response_message.body_length; + } + -+ efi_call_1 (b->close_event, response_token.event); ++ efi_call_1 (b->close_event, data->response_token.event); + + return sum; +} @@ -1029,10 +1116,11 @@ Index: grub-2.02/grub-core/net/efi/http.c + .read = grub_efihttp_read, + .close = grub_efihttp_close + }; -Index: grub-2.02/grub-core/net/efi/ip4_config.c -=================================================================== +diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c +new file mode 100644 +index 0000000..b711a5d --- /dev/null -+++ grub-2.02/grub-core/net/efi/ip4_config.c ++++ b/grub-core/net/efi/ip4_config.c @@ -0,0 +1,398 @@ + +#include @@ -1432,10 +1520,11 @@ Index: grub-2.02/grub-core/net/efi/ip4_config.c + .set_gateway = grub_efi_ip4_interface_set_gateway, + .set_dns = grub_efi_ip4_interface_set_dns + }; -Index: grub-2.02/grub-core/net/efi/ip6_config.c -=================================================================== +diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c +new file mode 100644 +index 0000000..017c4d0 --- /dev/null -+++ grub-2.02/grub-core/net/efi/ip6_config.c ++++ b/grub-core/net/efi/ip6_config.c @@ -0,0 +1,422 @@ +#include +#include @@ -1859,11 +1948,12 @@ Index: grub-2.02/grub-core/net/efi/ip6_config.c + .set_gateway = grub_efi_ip6_interface_set_gateway, + .set_dns = grub_efi_ip6_interface_set_dns + }; -Index: grub-2.02/grub-core/net/efi/net.c -=================================================================== +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +new file mode 100644 +index 0000000..0bac343 --- /dev/null -+++ grub-2.02/grub-core/net/efi/net.c -@@ -0,0 +1,1420 @@ ++++ b/grub-core/net/efi/net.c +@@ -0,0 +1,1428 @@ +#include +#include +#include @@ -2563,7 +2653,7 @@ Index: grub-2.02/grub-core/net/efi/net.c + service = grub_efi_open_protocol (dev, service_binding_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (!service) + { -+ grub_error (GRUB_ERR_IO, N_("couldn't open http service binding protocol")); ++ grub_error (GRUB_ERR_IO, N_("couldn't open efi service binding protocol")); + return NULL; + } + @@ -2707,7 +2797,7 @@ Index: grub-2.02/grub-core/net/efi/net.c + grub_efi_device_path_t *dp, *ddp, *ldp; + grub_efi_pxe_t *pxe; + struct grub_efi_net_device *d; -+ int is_ip6; ++ int is_ip6 = 0; + + dp = grub_efi_get_device_path (*handle); + if (!dp) @@ -2718,20 +2808,20 @@ Index: grub-2.02/grub-core/net/efi/net.c + + if (ldp->type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + && ldp->subtype == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE) -+ is_ip6 = 0; ++ { ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ } + else if (ldp->type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + && ldp->subtype == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) -+ is_ip6 = 1; -+ else + { -+ grub_free (ddp); -+ continue; ++ is_ip6 = 1; ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); + } + -+ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; -+ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -+ ldp->length = sizeof (*ldp); -+ + for (d = net_devices; d; d = d->next) + if (grub_efi_compare_device_paths (ddp, grub_efi_get_device_path (d->handle)) == 0) + break; @@ -2775,28 +2865,22 @@ Index: grub-2.02/grub-core/net/efi/net.c + + for (dev = net_devices; dev; dev = dev->next) + { -+ grub_efi_status_t status; + grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC; -+ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL; + -+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY, -+ sizeof (ip4_policy), &ip4_policy); ++ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS) ++ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name); + -+ if (status != GRUB_EFI_SUCCESS) -+ grub_printf ("Set IP4 STATIC POLICY FAILED, reason: %d\n", (int)status); -+ else -+ grub_printf ("Set IP4 STATIC POLICY SUCCEEDED\n"); ++ if (dev->ip6_config) ++ { ++ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL; + -+ -+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY, -+ sizeof (ip6_policy), &ip6_policy); -+ -+ if (status != GRUB_EFI_SUCCESS) -+ grub_printf ("Set IP6 STATIC POLICY FAILED, reason %d\n", (int)status); -+ else -+ grub_printf ("Set IP6 STATIC POLICY SUCCEEDED\n"); ++ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS) ++ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name); ++ } + } +} + @@ -2840,41 +2924,25 @@ Index: grub-2.02/grub-core/net/efi/net.c + ip6_config = grub_efi_open_protocol (*handle, &ip6_config_guid, + GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); + -+ if (!ip6_config) -+ continue; -+ + http_handle = grub_efi_service_binding (*handle, &http_service_binding_guid); -+ -+ if (!http_handle) -+ continue; -+ -+ http = grub_efi_open_protocol (http_handle, &http_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!http) -+ continue; ++ grub_errno = GRUB_ERR_NONE; ++ http = (http_handle) ++ ? grub_efi_open_protocol (http_handle, &http_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; + + dhcp4_handle = grub_efi_service_binding (*handle, &dhcp4_service_binding_guid); ++ grub_errno = GRUB_ERR_NONE; ++ dhcp4 = (dhcp4_handle) ++ ? grub_efi_open_protocol (dhcp4_handle, &dhcp4_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; + -+ if (!dhcp4_handle) -+ continue; -+ -+ dhcp4 = grub_efi_open_protocol (dhcp4_handle, &dhcp4_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!dhcp4) -+ continue; + + dhcp6_handle = grub_efi_service_binding (*handle, &dhcp6_service_binding_guid); ++ grub_errno = GRUB_ERR_NONE; ++ dhcp6 = (dhcp6_handle) ++ ? grub_efi_open_protocol (dhcp6_handle, &dhcp6_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; + -+ if (!dhcp6_handle) -+ continue; -+ -+ dhcp6 = grub_efi_open_protocol (dhcp6_handle, &dhcp6_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!dhcp6) -+ continue; + d = grub_malloc (sizeof (*d)); + if (!d) + { @@ -3076,7 +3144,6 @@ Index: grub-2.02/grub-core/net/efi/net.c + const char *protname, *server; + grub_net_t ret; + -+ grub_printf ("%s\n", name); + net_interface = NULL; + + if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) @@ -3117,8 +3184,6 @@ Index: grub-2.02/grub-core/net/efi/net.c + return NULL; + } + -+ grub_printf ("server is %s\n", server); -+ + /*FIXME: Use DNS translate name to address */ + net_interface = match_route (server); + @@ -3224,6 +3289,39 @@ Index: grub-2.02/grub-core/net/efi/net.c + return 0; +} + ++int ++grub_efi_net_boot_from_opa (void) ++{ ++ grub_efi_loaded_image_t *image = NULL; ++ grub_efi_device_path_t *dp; ++ ++ image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ if (!image) ++ return 0; ++ ++ dp = grub_efi_get_device_path (image->device_handle); ++ ++ while (1) ++ { ++ grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); ++ grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); ++ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ ++ if ((type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) ++ && (subtype == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)) ++ { ++ grub_efi_mac_address_device_path_t *mac_dp = (grub_efi_mac_address_device_path_t *)dp; ++ return (mac_dp->if_type == 0xC7) ? 1 : 0; ++ } ++ ++ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) ++ break; ++ dp = (grub_efi_device_path_t *) ((char *) dp + len); ++ } ++ ++ return 0; ++} ++ +static char * +grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), + const char *val __attribute__ ((unused))) @@ -3284,11 +3382,12 @@ Index: grub-2.02/grub-core/net/efi/net.c + grub_net_open = NULL; + grub_fs_unregister (&grub_efi_netfs); +} -Index: grub-2.02/grub-core/net/efi/pxe.c -=================================================================== +diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c +new file mode 100644 +index 0000000..4b6b48c --- /dev/null -+++ grub-2.02/grub-core/net/efi/pxe.c -@@ -0,0 +1,419 @@ ++++ b/grub-core/net/efi/pxe.c +@@ -0,0 +1,424 @@ + +#include +#include @@ -3362,8 +3461,10 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + grub_printf ("Couldn't start PXE\n"); + } + ++#if 0 + grub_printf ("PXE STARTED: %u\n", mode->started); + grub_printf ("PXE USING IPV6: %u\n", mode->using_ipv6); ++#endif + + if (mode->using_ipv6) + { @@ -3409,6 +3510,7 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + } + } + ++#if 0 + if (mode->using_ipv6) + { + grub_printf ("PXE STATION IP: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", @@ -3442,6 +3544,7 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + mode->subnet_mask.v4.addr[2], + mode->subnet_mask.v4.addr[3]); + } ++#endif + + /* TODO: Set The Station IP to the IP2 Config */ +} @@ -3525,6 +3628,7 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + if (parse_ip6 (file->device->net->server, ip6, &rest) && *rest == 0) + grub_memcpy (server_ip.v6.addr, ip6, sizeof (server_ip.v6.addr)); + /* TODO: ERROR Handling Here */ ++#if 0 + grub_printf ("PXE SERVER IP: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", + server_ip.v6.addr[0], + server_ip.v6.addr[1], @@ -3542,6 +3646,7 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + server_ip.v6.addr[13], + server_ip.v6.addr[14], + server_ip.v6.addr[15]); ++#endif + } + else + { @@ -3608,7 +3713,6 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + if (file->data) + { + /* TODO: RANGE Check for offset and file size */ -+ grub_printf ("Read From file->data\n"); + grub_memcpy (buf, (char*)file->data + file->device->net->offset, len); + file->device->net->offset += len; + return len; @@ -3708,10 +3812,10 @@ Index: grub-2.02/grub-core/net/efi/pxe.c + .close = pxe_close + }; + -Index: grub-2.02/grub-core/net/net.c -=================================================================== ---- grub-2.02.orig/grub-core/net/net.c -+++ grub-2.02/grub-core/net/net.c +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 5cc0d2f..02bbe95 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ #include #include @@ -3722,7 +3826,7 @@ Index: grub-2.02/grub-core/net/net.c GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1817,8 +1820,49 @@ static grub_command_t cmd_addaddr, cmd_d +@@ -1817,8 +1820,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; static grub_command_t cmd_lsroutes, cmd_lscards; static grub_command_t cmd_lsaddr, cmd_slaac; @@ -3744,7 +3848,7 @@ Index: grub-2.02/grub-core/net/net.c + if (grub_net_open) + return; + -+ if (grub_efi_net_boot_from_https () ++ if ((grub_efi_net_boot_from_https () || grub_efi_net_boot_from_opa ()) + && grub_efi_net_fs_init ()) + { + cmd_lsroutes = grub_register_command ("net_ls_routes", grub_efi_net_list_routes, @@ -3818,11 +3922,35 @@ Index: grub-2.02/grub-core/net/net.c + init_mode = INIT_MODE_NONE; +#endif } -Index: grub-2.02/include/grub/efi/api.h -=================================================================== ---- grub-2.02.orig/include/grub/efi/api.h -+++ grub-2.02/include/grub/efi/api.h -@@ -851,6 +851,8 @@ struct grub_efi_ipv6_device_path +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 99ba068..cfedd78 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -588,6 +588,23 @@ typedef grub_uint16_t grub_efi_ipv6_address_t[8]; + typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4))); + typedef grub_efi_uint64_t grub_efi_physical_address_t; + typedef grub_efi_uint64_t grub_efi_virtual_address_t; ++typedef struct { ++ grub_uint8_t addr[4]; ++} grub_efi_pxe_ipv4_address_t; ++ ++typedef struct { ++ grub_uint8_t addr[16]; ++} grub_efi_pxe_ipv6_address_t; ++ ++typedef struct { ++ grub_uint8_t addr[32]; ++} grub_efi_pxe_mac_address_t; ++ ++typedef union { ++ grub_uint32_t addr[4]; ++ grub_efi_pxe_ipv4_address_t v4; ++ grub_efi_pxe_ipv6_address_t v6; ++} grub_efi_pxe_ip_address_t; + + struct grub_efi_guid + { +@@ -851,6 +868,8 @@ struct grub_efi_ipv6_device_path grub_efi_uint16_t remote_port; grub_efi_uint16_t protocol; grub_efi_uint8_t static_ip_address; @@ -3831,7 +3959,23 @@ Index: grub-2.02/include/grub/efi/api.h } GRUB_PACKED; typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; -@@ -982,6 +984,23 @@ struct grub_efi_bios_device_path +@@ -900,6 +919,15 @@ struct grub_efi_uri_device_path + } GRUB_PACKED; + typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; + ++#define GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE 31 ++struct grub_efi_dns_device_path ++{ ++ grub_efi_device_path_t header; ++ grub_efi_uint8_t is_ipv6; ++ grub_efi_pxe_ip_address_t dns_server_ip[0]; ++} GRUB_PACKED; ++typedef struct grub_efi_dns_device_path grub_efi_dns_device_path_t; ++ + #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 + + /* Media Device Path. */ +@@ -982,6 +1010,23 @@ struct grub_efi_bios_device_path } GRUB_PACKED; typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; @@ -3855,12 +3999,18 @@ Index: grub-2.02/include/grub/efi/api.h struct grub_efi_open_protocol_information_entry { grub_efi_handle_t agent_handle; -@@ -1491,6 +1510,29 @@ typedef union { - grub_efi_pxe_ipv6_address_t v6; - } grub_efi_pxe_ip_address_t; +@@ -1473,23 +1518,28 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output + typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; + +-typedef struct { +- grub_uint8_t addr[4]; +-} grub_efi_pxe_ipv4_address_t; +typedef grub_efi_uint16_t grub_efi_pxe_base_code_udp_port_t; -+ + +-typedef struct { +- grub_uint8_t addr[16]; +-} grub_efi_pxe_ipv6_address_t; +typedef enum { + GRUB_EFI_PXE_BASE_CODE_TFTP_FIRST, + GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, @@ -3872,8 +4022,16 @@ Index: grub-2.02/include/grub/efi/api.h + GRUB_EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, + GRUB_EFI_PXE_BASE_CODE_MTFTP_LAST +} grub_efi_pxe_base_code_tftp_opcode_t; -+ -+ + +-typedef struct { +- grub_uint8_t addr[32]; +-} grub_efi_pxe_mac_address_t; + +-typedef union { +- grub_uint32_t addr[4]; +- grub_efi_pxe_ipv4_address_t v4; +- grub_efi_pxe_ipv6_address_t v6; +-} grub_efi_pxe_ip_address_t; +typedef struct { + grub_efi_ip_address_t mcast_ip; + grub_efi_pxe_base_code_udp_port_t c_port; @@ -3881,11 +4039,10 @@ Index: grub-2.02/include/grub/efi/api.h + grub_efi_uint16_t listen_timeout; + grub_efi_uint16_t transmit_timeout; +} grub_efi_pxe_base_code_mtftp_info_t; -+ + #define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 typedef struct { - grub_uint8_t filters; -@@ -1539,17 +1581,31 @@ typedef struct grub_efi_pxe_mode +@@ -1539,17 +1589,31 @@ typedef struct grub_efi_pxe_mode typedef struct grub_efi_pxe { grub_uint64_t rev; @@ -3921,7 +4078,7 @@ Index: grub-2.02/include/grub/efi/api.h void (*setpackets) (void); struct grub_efi_pxe_mode *mode; } grub_efi_pxe_t; -@@ -1791,6 +1847,44 @@ struct grub_efi_ip4_config2_protocol +@@ -1791,6 +1855,44 @@ struct grub_efi_ip4_config2_protocol }; typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; @@ -3966,7 +4123,7 @@ Index: grub-2.02/include/grub/efi/api.h enum grub_efi_ip6_config_data_type { GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, -@@ -1825,6 +1919,49 @@ struct grub_efi_ip6_config_protocol +@@ -1825,6 +1927,49 @@ struct grub_efi_ip6_config_protocol }; typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; @@ -4016,10 +4173,11 @@ Index: grub-2.02/include/grub/efi/api.h #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) -Index: grub-2.02/include/grub/efi/dhcp.h -=================================================================== +diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h +new file mode 100644 +index 0000000..fdb88eb --- /dev/null -+++ grub-2.02/include/grub/efi/dhcp.h ++++ b/include/grub/efi/dhcp.h @@ -0,0 +1,343 @@ +#ifndef GRUB_EFI_DHCP_HEADER +#define GRUB_EFI_DHCP_HEADER 1 @@ -4364,10 +4522,11 @@ Index: grub-2.02/include/grub/efi/dhcp.h +}; + +#endif /* ! GRUB_EFI_DHCP_HEADER */ -Index: grub-2.02/include/grub/efi/http.h -=================================================================== +diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h +new file mode 100644 +index 0000000..c5e9a89 --- /dev/null -+++ grub-2.02/include/grub/efi/http.h ++++ b/include/grub/efi/http.h @@ -0,0 +1,215 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -4584,11 +4743,12 @@ Index: grub-2.02/include/grub/efi/http.h +typedef struct grub_efi_http grub_efi_http_t; + +#endif /* !GRUB_EFI_HTTP_HEADER */ -Index: grub-2.02/include/grub/net/efi.h -=================================================================== +diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h +new file mode 100644 +index 0000000..de90d22 --- /dev/null -+++ grub-2.02/include/grub/net/efi.h -@@ -0,0 +1,143 @@ ++++ b/include/grub/net/efi.h +@@ -0,0 +1,144 @@ +#ifndef GRUB_NET_EFI_HEADER +#define GRUB_NET_EFI_HEADER 1 + @@ -4723,6 +4883,7 @@ Index: grub-2.02/include/grub/net/efi.h +int grub_efi_net_fs_init (void); +void grub_efi_net_fs_fini (void); +int grub_efi_net_boot_from_https (void); ++int grub_efi_net_boot_from_opa (void); + +extern grub_command_func_t grub_efi_net_list_routes; +extern grub_command_func_t grub_efi_net_list_cards; @@ -4732,10 +4893,10 @@ Index: grub-2.02/include/grub/net/efi.h +extern grub_command_func_t grub_efi_net_bootp6; + +#endif /* ! GRUB_NET_EFI_HEADER */ -Index: grub-2.02/util/grub-mknetdir.c -=================================================================== ---- grub-2.02.orig/util/grub-mknetdir.c -+++ grub-2.02/util/grub-mknetdir.c +diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c +index 82073d5..ae31271 100644 +--- a/util/grub-mknetdir.c ++++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ static char *rootdir = NULL, *subdir = NULL; @@ -4761,7 +4922,7 @@ Index: grub-2.02/util/grub-mknetdir.c {0, 0, 0, 0, 0, 0} }; -@@ -67,6 +70,9 @@ argp_parser (int key, char *arg, struct +@@ -67,6 +70,9 @@ argp_parser (int key, char *arg, struct argp_state *state) free (subdir); subdir = xstrdup (arg); return 0; @@ -4771,7 +4932,7 @@ Index: grub-2.02/util/grub-mknetdir.c /* This is an undocumented feature... */ case OPTION_DEBUG: verbosity++; -@@ -82,7 +88,6 @@ argp_parser (int key, char *arg, struct +@@ -82,7 +88,6 @@ argp_parser (int key, char *arg, struct argp_state *state) } } @@ -4788,7 +4949,7 @@ Index: grub-2.02/util/grub-mknetdir.c { const char *mkimage_target; const char *netmodule; -@@ -154,6 +159,7 @@ process_input_dir (const char *input_dir +@@ -154,6 +159,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) grub_install_push_module (targets[platform].netmodule); output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); @@ -4814,3 +4975,6 @@ Index: grub-2.02/util/grub-mknetdir.c if (!grub_install_source_directory) { +-- +2.6.2 + diff --git a/grub2.changes b/grub2.changes index 7bd7a01..d8b9b1e 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Nov 14 09:02:19 UTC 2017 - mchang@suse.com + +- 0001-add-support-for-UEFI-network-protocols.patch: + * Workaround http data access in firmware + * Fix DNS device path parsing for efinet device + * Relaxed UEFI Protocol requirement + * Support Intel OPA (Omni-Path Architecture) PXE Boot (bsc#1015589) + ------------------------------------------------------------------- Wed Nov 8 09:37:12 UTC 2017 - olaf@aepfle.de