From 49eb9d2678c1f40c63cf21d8bbb4eebadb2dab3fd21ee2fd26d34dc9cd60bcbc Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 1 Mar 2016 12:06:29 +0000 Subject: [PATCH 1/3] Accepting request 362771 from home:arvidjaar:grub2-next - new upstream version 2.02~beta3 * highlights of user visible changes not yet present in openSUSE package - arm-uboot now generates position independent self relocating image, so single binary should run on all supported systems - loader for Xen on aarch64. grub-mkconfig support was not in time for beta3 yet. - improved ZFS support (extensible_dataset, large_blocks, embedded_data, hole_birth features) - support for IPv6 Router Advertisements - support for persistent memory (we do not overwrite it and pass correct information to OS) - try to display more specific icons for os-prober generated menu entries - grub-install detects EFI bit size and selects correct platform (x86_64-efi or i386-efi) independent of OS bit size; needs kernel 4.0 or higher. - LVM RAID1 support - xnu loader fixes which should make OS X menu entry generated by os-prober work again - ... and lot of fixes over entire tree OBS-URL: https://build.opensuse.org/request/show/362771 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=205 --- ...dd-bootargs-parser-for-open-firmware.patch | 372 ------ ...ue-when-reading-username-and-passwor.patch | 54 - ...vice-path-helpers-in-core-for-efinet.patch | 207 ---- ...net-Check-for-immediate-completition.patch | 51 - ...rdware-filters-when-opening-interfac.patch | 107 -- ...fi-efi.c-Ensure-that-the-result-star.patch | 75 -- ...i386-tsc.c-calibrate_tsc-Ensure-that.patch | 28 - ...aVu-also-in-usr-share-fonts-truetype.patch | 26 - ...ine-count-calculation-for-long-lines.patch | 38 - ...o-not-close-stdin-in-grub_passwd_get.patch | 42 - ...ix-password-Fix-file-descriptor-leak.patch | 34 - 0002-Add-Virtual-LAN-support.patch | 133 +- ...ual-IPv4-and-IPv6-devices-when-enume.patch | 97 -- ...c-Fix-unused-function-warning-on-xen.patch | 31 - 0002-linux-getroot-fix-descriptor-leak.patch | 24 - ...kip-BIOS-scan-if-EBDA-length-is-zero.patch | 80 -- ...-Simple-Network-Protocol-exclusively.patch | 89 -- ...-util-grub-mount-fix-descriptor-leak.patch | 22 - 0004-linux-ofpath-fix-descriptor-leak.patch | 23 - ...ive-delay-sources-whenever-appropria.patch | 1104 ----------------- 0005-grub-fstest-fix-descriptor-leak.patch | 28 - 0005-i386-fix-TSC-calibration-using-PIT.patch | 27 - aarch64-reloc.patch | 27 - biendian.patch | 201 --- grub-2.02~beta2.tar.xz | 3 - grub-2.02~beta3.tar.xz | 3 + ...INE_LINUX_RECOVERY-for-recovery-mode.patch | 6 +- ...rd_ctx-so-we-don-t-free-a-random-poi.patch | 134 -- ...4-Reduce-timer-event-frequency-by-10.patch | 40 - ...et_status-on-buggy-firmware-properly.patch | 66 - grub2-arm64-set-correct-length.patch | 31 - ...m64-setjmp-Add-missing-license-macro.patch | 34 - grub2-btrfs-04-grub2-install.patch | 16 +- grub2-btrfs-05-grub2-mkconfig.patch | 6 +- ...ot-key-comparison-failures-due-to-en.patch | 28 - ...trfs-fix-incorrect-address-reference.patch | 13 - grub2-efi-HP-workaround.patch | 20 +- grub2-efi-xen-chainload.patch | 4 +- grub2-fix-menu-in-xen-host-server.patch | 21 +- ...t-fix-get-btrfs-fs-prefix-big-endian.patch | 25 - grub2-getroot-support-NVMe-device-names.patch | 36 - grub2-glibc-2.20.patch | 34 - grub2-mkconfig-aarch64.patch | 8 +- grub2-netboot-hang.patch | 13 - grub2-ppc64-cas-reboot-support.patch | 28 +- grub2-ppc64-qemu.patch | 33 - ...2-s390x-02-kexec-module-added-to-emu.patch | 66 +- grub2-s390x-04-grub2-install.patch | 63 +- grub2-s390x-05-grub2-mkconfig.patch | 39 +- grub2-secureboot-add-linuxefi.patch | 6 +- grub2-secureboot-chainloader.patch | 10 +- grub2-xen-legacy-config-device-name.patch | 112 -- grub2-xfs-Add-helper-for-inode-size.patch | 76 -- ...e-numbers-to-cpu-endianity-immediate.patch | 82 -- ...ination-loop-for-directory-iteration.patch | 32 - grub2-xfs-V5-filesystem-format-support.patch | 478 ------- grub2.changes | 86 ++ grub2.spec | 106 +- libgcc-prereq.patch | 256 ---- libgcc.patch | 440 ------- ppc64_opt.patch | 26 - ppc64le.patch | 95 -- rename-grub-info-file-to-grub2.patch | 93 +- use-grub2-as-a-package-name.patch | 16 +- 64 files changed, 303 insertions(+), 5301 deletions(-) delete mode 100644 0001-Add-bootargs-parser-for-open-firmware.patch delete mode 100644 0001-Fix-security-issue-when-reading-username-and-passwor.patch delete mode 100644 0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch delete mode 100644 0001-efinet-Check-for-immediate-completition.patch delete mode 100644 0001-efinet-enable-hardware-filters-when-opening-interfac.patch delete mode 100644 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch delete mode 100644 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch delete mode 100644 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch delete mode 100644 0001-menu-fix-line-count-calculation-for-long-lines.patch delete mode 100644 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch delete mode 100644 0001-unix-password-Fix-file-descriptor-leak.patch delete mode 100644 0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch delete mode 100644 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch delete mode 100644 0002-linux-getroot-fix-descriptor-leak.patch delete mode 100644 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch delete mode 100644 0003-efinet-open-Simple-Network-Protocol-exclusively.patch delete mode 100644 0003-util-grub-mount-fix-descriptor-leak.patch delete mode 100644 0004-linux-ofpath-fix-descriptor-leak.patch delete mode 100644 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch delete mode 100644 0005-grub-fstest-fix-descriptor-leak.patch delete mode 100644 0005-i386-fix-TSC-calibration-using-PIT.patch delete mode 100644 aarch64-reloc.patch delete mode 100644 biendian.patch delete mode 100644 grub-2.02~beta2.tar.xz create mode 100644 grub-2.02~beta3.tar.xz delete mode 100644 grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch delete mode 100644 grub2-arm64-Reduce-timer-event-frequency-by-10.patch delete mode 100644 grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch delete mode 100644 grub2-arm64-set-correct-length.patch delete mode 100644 grub2-arm64-setjmp-Add-missing-license-macro.patch delete mode 100644 grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch delete mode 100644 grub2-btrfs-fix-incorrect-address-reference.patch delete mode 100644 grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch delete mode 100644 grub2-getroot-support-NVMe-device-names.patch delete mode 100644 grub2-glibc-2.20.patch delete mode 100644 grub2-netboot-hang.patch delete mode 100644 grub2-ppc64-qemu.patch delete mode 100644 grub2-xen-legacy-config-device-name.patch delete mode 100644 grub2-xfs-Add-helper-for-inode-size.patch delete mode 100644 grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch delete mode 100644 grub2-xfs-Fix-termination-loop-for-directory-iteration.patch delete mode 100644 grub2-xfs-V5-filesystem-format-support.patch delete mode 100644 libgcc-prereq.patch delete mode 100644 libgcc.patch delete mode 100644 ppc64_opt.patch delete mode 100644 ppc64le.patch diff --git a/0001-Add-bootargs-parser-for-open-firmware.patch b/0001-Add-bootargs-parser-for-open-firmware.patch deleted file mode 100644 index 2089849..0000000 --- a/0001-Add-bootargs-parser-for-open-firmware.patch +++ /dev/null @@ -1,372 +0,0 @@ -From 0787fba15352ef47958e0c9fcc912b8bbcf8ab4e Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Mon, 30 Jun 2014 10:31:59 -0300 -Subject: [PATCH 1/2] Add bootargs parser for open firmware. - -It enables net boot even when there is no bootp/dhcp server. ---- - ChangeLog | 16 +++++ - grub-core/kern/ieee1275/init.c | 7 +-- - grub-core/net/bootp.c | 63 +++++-------------- - grub-core/net/drivers/ieee1275/ofnet.c | 107 ++++++++++++++++++++++++++++++++- - grub-core/net/net.c | 38 ++++++++++++ - include/grub/ieee1275/ieee1275.h | 3 +- - include/grub/net.h | 4 ++ - 7 files changed, 185 insertions(+), 53 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 41bcebf..a659369 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,19 @@ -+2014-01-24 Paulo Flabiano Smorigo -+ -+ Add bootargs parser for open firmware. -+ -+ It enables net boot even when there is no bootp/dhcp server. -+ -+ * grub-core/net/drivers/ieee1275/ofnet.c: Add grub_ieee1275_parse_bootargs -+ and call it at grub_ieee1275_net_config_real. -+ -+2013-12-23 Paulo Flabiano Smorigo -+ -+ Add grub_env_set_net_property function. -+ -+ * grub-core/net/bootp.c: Remove set_env_limn_ro. -+ * grub-core/net/net.c: Add grub_env_set_net_property. -+ - 2013-12-24 Vladimir Serbinenko - - * configure.ac: Set version to 2.02~beta2. -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 89b2822..d5bd74d 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -80,9 +80,8 @@ grub_translate_ieee1275_path (char *filepath) - } - } - --void (*grub_ieee1275_net_config) (const char *dev, -- char **device, -- char **path); -+void (*grub_ieee1275_net_config) (const char *dev, char **device, char **path, -+ char *bootpath); - void - grub_machine_get_bootlocation (char **device, char **path) - { -@@ -126,7 +125,7 @@ grub_machine_get_bootlocation (char **device, char **path) - *ptr = 0; - - if (grub_ieee1275_net_config) -- grub_ieee1275_net_config (canon, device, path); -+ grub_ieee1275_net_config (canon, device, path, bootpath); - grub_free (dev); - grub_free (canon); - } -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index c14e9de..6310ed4 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -25,41 +25,6 @@ - #include - #include - --static char * --grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), -- const char *val __attribute__ ((unused))) --{ -- return NULL; --} -- --static void --set_env_limn_ro (const char *intername, const char *suffix, -- const char *value, grub_size_t len) --{ -- char *varname, *varvalue; -- char *ptr; -- varname = grub_xasprintf ("net_%s_%s", intername, suffix); -- if (!varname) -- return; -- for (ptr = varname; *ptr; ptr++) -- if (*ptr == ':') -- *ptr = '_'; -- varvalue = grub_malloc (len + 1); -- if (!varvalue) -- { -- grub_free (varname); -- return; -- } -- -- grub_memcpy (varvalue, value, len); -- varvalue[len] = 0; -- grub_env_set (varname, varvalue); -- grub_register_variable_hook (varname, 0, grub_env_write_readonly); -- grub_env_export (varname); -- grub_free (varname); -- grub_free (varvalue); --} -- - static void - parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - { -@@ -136,20 +101,24 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - } - continue; - case GRUB_NET_BOOTP_HOSTNAME: -- set_env_limn_ro (name, "hostname", (const char *) ptr, taglength); -- break; -+ grub_env_set_net_property (name, "hostname", (const char *) ptr, -+ taglength); -+ break; - - case GRUB_NET_BOOTP_DOMAIN: -- set_env_limn_ro (name, "domain", (const char *) ptr, taglength); -- break; -+ grub_env_set_net_property (name, "domain", (const char *) ptr, -+ taglength); -+ break; - - case GRUB_NET_BOOTP_ROOT_PATH: -- set_env_limn_ro (name, "rootpath", (const char *) ptr, taglength); -- break; -+ grub_env_set_net_property (name, "rootpath", (const char *) ptr, -+ taglength); -+ break; - - case GRUB_NET_BOOTP_EXTENSIONS_PATH: -- set_env_limn_ro (name, "extensionspath", (const char *) ptr, taglength); -- break; -+ grub_env_set_net_property (name, "extensionspath", (const char *) ptr, -+ taglength); -+ break; - - /* If you need any other options please contact GRUB - development team. */ -@@ -211,8 +180,8 @@ grub_net_configure_by_dhcp_ack (const char *name, - } - - if (size > OFFSET_OF (boot_file, bp)) -- set_env_limn_ro (name, "boot_file", (char *) bp->boot_file, -- sizeof (bp->boot_file)); -+ grub_env_set_net_property (name, "boot_file", bp->boot_file, -+ sizeof (bp->boot_file)); - if (is_def) - grub_net_default_server = 0; - if (is_def && !grub_net_default_server && bp->server_ip) -@@ -243,8 +212,8 @@ grub_net_configure_by_dhcp_ack (const char *name, - if (size > OFFSET_OF (server_name, bp) - && bp->server_name[0]) - { -- set_env_limn_ro (name, "dhcp_server_name", (char *) bp->server_name, -- sizeof (bp->server_name)); -+ grub_env_set_net_property (name, "dhcp_server_name", bp->server_name, -+ sizeof (bp->server_name)); - if (is_def && !grub_net_default_server) - { - grub_net_default_server = grub_strdup (bp->server_name); -diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index ceb5931..a079065 100644 ---- a/grub-core/net/drivers/ieee1275/ofnet.c -+++ b/grub-core/net/drivers/ieee1275/ofnet.c -@@ -127,8 +127,111 @@ bootp_response_properties[] = - { .name = "bootpreply-packet", .offset = 0x2a}, - }; - -+enum -+{ -+ BOOTARGS_SERVER_ADDR, -+ BOOTARGS_FILENAME, -+ BOOTARGS_CLIENT_ADDR, -+ BOOTARGS_GATEWAY_ADDR, -+ BOOTARGS_BOOTP_RETRIES, -+ BOOTARGS_TFTP_RETRIES, -+ BOOTARGS_SUBNET_MASK, -+ BOOTARGS_BLOCKSIZE -+}; -+ -+static int -+grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath, -+ char **device, struct grub_net_card **card) -+{ -+ char *args; -+ char *comma_char = 0; -+ char *equal_char = 0; -+ grub_size_t field_counter = 0; -+ -+ grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; -+ grub_net_link_level_address_t hw_addr; -+ grub_net_interface_flags_t flags = 0; -+ struct grub_net_network_level_interface *inter; -+ -+ hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; -+ -+ args = bootpath + grub_strlen (devpath) + 1; -+ do -+ { -+ comma_char = grub_strchr (args, ','); -+ if (comma_char != 0) -+ *comma_char = 0; -+ -+ /* Check if it's an option (like speed=auto) and not a default parameter */ -+ equal_char = grub_strchr (args, '='); -+ if (equal_char != 0) -+ { -+ *equal_char = 0; -+ grub_env_set_net_property ((*card)->name, args, equal_char + 1, -+ grub_strlen(equal_char + 1)); -+ *equal_char = '='; -+ } -+ else -+ { -+ switch (field_counter++) -+ { -+ case BOOTARGS_SERVER_ADDR: -+ *device = grub_xasprintf ("tftp,%s", args); -+ if (!*device) -+ return grub_errno; -+ break; -+ -+ case BOOTARGS_CLIENT_ADDR: -+ grub_net_resolve_address (args, &client_addr); -+ break; -+ -+ case BOOTARGS_GATEWAY_ADDR: -+ grub_net_resolve_address (args, &gateway_addr); -+ break; -+ -+ case BOOTARGS_SUBNET_MASK: -+ grub_net_resolve_address (args, &subnet_mask); -+ break; -+ } -+ } -+ args = comma_char + 1; -+ if (comma_char != 0) -+ *comma_char = ','; -+ } while (comma_char != 0); -+ -+ if ((client_addr.ipv4 != 0) && (subnet_mask.ipv4 != 0)) -+ { -+ grub_ieee1275_phandle_t devhandle; -+ grub_ieee1275_finddevice (devpath, &devhandle); -+ grub_ieee1275_get_property (devhandle, "mac-address", -+ hw_addr.mac, sizeof(hw_addr.mac), 0); -+ inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr, -+ flags); -+ grub_net_add_ipv4_local (inter, -+ __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); -+ } -+ -+ if (gateway_addr.ipv4 != 0) -+ { -+ grub_net_network_level_netaddress_t target; -+ char *rname; -+ -+ target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -+ target.ipv4.base = 0; -+ target.ipv4.masksize = 0; -+ rname = grub_xasprintf ("%s:default", ((*card)->name)); -+ if (rname) -+ grub_net_add_route_gw (rname, target, gateway_addr); -+ else -+ return grub_errno; -+ } -+ -+ return 0; -+} -+ - static void --grub_ieee1275_net_config_real (const char *devpath, char **device, char **path) -+grub_ieee1275_net_config_real (const char *devpath, char **device, char **path, -+ char *bootpath) - { - struct grub_net_card *card; - -@@ -158,6 +261,8 @@ grub_ieee1275_net_config_real (const char *devpath, char **device, char **path) - } - grub_free (canon); - -+ grub_ieee1275_parse_bootargs (devpath, bootpath, device, &card); -+ - for (i = 0; i < ARRAY_SIZE (bootp_response_properties); i++) - if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, - bootp_response_properties[i].name, -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0e57e93..8f9d183 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1480,6 +1480,44 @@ receive_packets (struct grub_net_card *card, int *stop_condition) - grub_print_error (); - } - -+static char * -+grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) -+{ -+ return NULL; -+} -+ -+grub_err_t -+grub_env_set_net_property (const char *intername, const char *suffix, -+ const char *value, grub_size_t len) -+{ -+ char *varname, *varvalue; -+ char *ptr; -+ -+ varname = grub_xasprintf ("net_%s_%s", intername, suffix); -+ if (!varname) -+ return grub_errno; -+ for (ptr = varname; *ptr; ptr++) -+ if (*ptr == ':') -+ *ptr = '_'; -+ varvalue = grub_malloc (len + 1); -+ if (!varvalue) -+ { -+ grub_free (varname); -+ return grub_errno; -+ } -+ -+ grub_memcpy (varvalue, value, len); -+ varvalue[len] = 0; -+ grub_err_t ret = grub_env_set (varname, varvalue); -+ grub_register_variable_hook (varname, 0, grub_env_write_readonly); -+ grub_env_export (varname); -+ grub_free (varname); -+ grub_free (varvalue); -+ -+ return ret; -+} -+ - void - grub_net_poll_cards (unsigned time, int *stop_condition) - { -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 7fefd16..f8b3d79 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -73,7 +73,8 @@ struct grub_ieee1275_devalias - - extern void (*EXPORT_VAR(grub_ieee1275_net_config)) (const char *dev, - char **device, -- char **path); -+ char **path, -+ char *bootargs); - - /* Maps a device alias to a pathname. */ - extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); -diff --git a/include/grub/net.h b/include/grub/net.h -index de6259e..843f74f 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -480,6 +480,10 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, - void - grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str); - -+grub_err_t -+grub_env_set_net_property (const char *intername, const char *suffix, -+ const char *value, grub_size_t len); -+ - void - grub_net_poll_cards (unsigned time, int *stop_condition); - --- -1.9.3 diff --git a/0001-Fix-security-issue-when-reading-username-and-passwor.patch b/0001-Fix-security-issue-when-reading-username-and-passwor.patch deleted file mode 100644 index 9a93256..0000000 --- a/0001-Fix-security-issue-when-reading-username-and-passwor.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 451d80e52d851432e109771bb8febafca7a5f1f2 Mon Sep 17 00:00:00 2001 -From: Hector Marco-Gisbert -Date: Wed, 16 Dec 2015 07:57:18 +0300 -Subject: [PATCH] Fix security issue when reading username and password - -This patch fixes two integer underflows at: - * grub-core/lib/crypto.c - * grub-core/normal/auth.c - -CVE-2015-8370 - -Signed-off-by: Hector Marco-Gisbert -Signed-off-by: Ismael Ripoll-Ripoll -Also-By: Andrey Borzenkov ---- - grub-core/lib/crypto.c | 3 ++- - grub-core/normal/auth.c | 7 +++++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index 010e550..683a8aa 100644 ---- a/grub-core/lib/crypto.c -+++ b/grub-core/lib/crypto.c -@@ -470,7 +470,8 @@ grub_password_get (char buf[], unsigned buf_size) - - if (key == '\b') - { -- cur_len--; -+ if (cur_len) -+ cur_len--; - continue; - } - -diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c -index c6bd96e..8615c48 100644 ---- a/grub-core/normal/auth.c -+++ b/grub-core/normal/auth.c -@@ -174,8 +174,11 @@ grub_username_get (char buf[], unsigned buf_size) - - if (key == '\b') - { -- cur_len--; -- grub_printf ("\b"); -+ if (cur_len) -+ { -+ cur_len--; -+ grub_printf ("\b"); -+ } - continue; - } - --- -1.9.1 - diff --git a/0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch b/0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch deleted file mode 100644 index be8733d..0000000 --- a/0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 7b386b703154c0901c4616badf18ddb260954bc1 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -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 - diff --git a/0001-efinet-Check-for-immediate-completition.patch b/0001-efinet-Check-for-immediate-completition.patch deleted file mode 100644 index 988f2a2..0000000 --- a/0001-efinet-Check-for-immediate-completition.patch +++ /dev/null @@ -1,51 +0,0 @@ -From cf2b4a36c408084852c44dea045331f039b895d2 Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Fri, 27 Mar 2015 14:27:56 +0100 -Subject: [PATCH] efinet: Check for immediate completition. - -This both speeds GRUB up and workarounds unexpected EFI behaviour. ---- - grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 2b344d6..f171f20 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -37,11 +37,12 @@ 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; -+ void *txbuf; - - if (dev->txbusy) - while (1) - { -- void *txbuf = NULL; -+ txbuf = NULL; - st = efi_call_3 (net->get_status, net, 0, &txbuf); - if (st != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_IO, -@@ -74,7 +75,18 @@ send_card_buffer (struct grub_net_card *dev, - dev->txbuf, NULL, NULL, NULL); - if (st != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_IO, N_("couldn't send network packet")); -- dev->txbusy = 1; -+ -+ /* -+ The card may have sent out the packet immediately - set txbusy -+ to 0 in this case. -+ Cases were observed where checking txbuf at the next call -+ of send_card_buffer() is too late: 0 is returned in txbuf and -+ we run in the GRUB_ERR_TIMEOUT case above. -+ Perhaps a timeout in the FW has discarded the recycle buffer. -+ */ -+ st = efi_call_3 (net->get_status, net, 0, &txbuf); -+ dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf == dev->txbuf); -+ - return GRUB_ERR_NONE; - } - --- -2.5.1 - diff --git a/0001-efinet-enable-hardware-filters-when-opening-interfac.patch b/0001-efinet-enable-hardware-filters-when-opening-interfac.patch deleted file mode 100644 index ba0377a..0000000 --- a/0001-efinet-enable-hardware-filters-when-opening-interfac.patch +++ /dev/null @@ -1,107 +0,0 @@ -From f348aee7b33dd85e7da62b497a96a7319a0bf9dd Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 16 Jun 2015 19:52:45 +0300 -Subject: [PATCH] efinet: enable hardware filters when opening interface - -Exclusive open on SNP will close all existing protocol instances which -may disable all receive filters on interface. Reinstall them after we -opened protocol exclusively. - -Also follow UEFI specification recommendation and stop interfaces when -closing them: - -Unexpected system errors, reboots and hangs can occur if an OS is loaded -and the network devices are not Shutdown() and Stopped(). - -Also by: Mark Salter -Closes: 45204 ---- - grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++++ - include/grub/efi/api.h | 20 +++++++++++++++++--- - 2 files changed, 42 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5533515..70b26af 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -168,6 +168,29 @@ open_card (struct grub_net_card *dev) - return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net initialize failed", - dev->name); - -+ /* Enable hardware receive filters if driver declares support for it. -+ We need unicast and broadcast and additionaly all nodes and -+ solicited multicast for IPv6. Solicited multicast is per-IPv6 -+ address and we currently do not have API to do it so simply -+ try to enable receive of all multicast packets or evertyhing in -+ the worst case (i386 PXE driver always enables promiscuous too). -+ -+ This does trust firmware to do what it claims to do. -+ */ -+ if (net->mode->receive_filter_mask) -+ { -+ grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST | -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; -+ -+ filters &= net->mode->receive_filter_mask; -+ if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST)) -+ filters |= (net->mode->receive_filter_mask & -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS); -+ -+ efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL); -+ } -+ - efi_call_4 (grub_efi_system_table->boot_services->close_protocol, - dev->efi_net, &net_io_guid, - grub_efi_image_handle, dev->efi_handle); -@@ -181,6 +204,8 @@ open_card (struct grub_net_card *dev) - static void - close_card (struct grub_net_card *dev) - { -+ efi_call_1 (dev->efi_net->shutdown, dev->efi_net); -+ efi_call_1 (dev->efi_net->stop, dev->efi_net); - efi_call_4 (grub_efi_system_table->boot_services->close_protocol, - dev->efi_net, &net_io_guid, - grub_efi_image_handle, dev->efi_handle); -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index e5dd543..1a5e38c 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -1501,17 +1501,31 @@ enum - GRUB_EFI_NETWORK_INITIALIZED, - }; - -+enum -+ { -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST = 0x01, -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST = 0x02, -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST = 0x04, -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS = 0x08, -+ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST = 0x10, -+ }; -+ - struct grub_efi_simple_network - { - grub_uint64_t revision; - grub_efi_status_t (*start) (struct grub_efi_simple_network *this); -- void (*stop) (void); -+ grub_efi_status_t (*stop) (struct grub_efi_simple_network *this); - grub_efi_status_t (*initialize) (struct grub_efi_simple_network *this, - grub_efi_uintn_t extra_rx, - grub_efi_uintn_t extra_tx); - void (*reset) (void); -- void (*shutdown) (void); -- void (*receive_filters) (void); -+ grub_efi_status_t (*shutdown) (struct grub_efi_simple_network *this); -+ grub_efi_status_t (*receive_filters) (struct grub_efi_simple_network *this, -+ grub_uint32_t enable, -+ grub_uint32_t disable, -+ grub_efi_boolean_t reset_mcast_filter, -+ grub_efi_uintn_t mcast_filter_count, -+ grub_efi_mac_address_t *mcast_filter); - void (*station_address) (void); - void (*statistics) (void); - void (*mcastiptomac) (void); --- -2.5.1 - diff --git a/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch b/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch deleted file mode 100644 index c2909d3..0000000 --- a/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 7e7293d745ef7c0a13d8cbf12f474843edfdd0ab Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 16:41:47 +0100 -Subject: [PATCH] * grub-core/kern/efi/efi.c: Ensure that the result - starts with / and has no //. - ---- - ChangeLog | 5 +++++ - grub-core/kern/efi/efi.c | 25 +++++++++++++++++-------- - 2 files changed, 22 insertions(+), 8 deletions(-) - -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index b253141..b9eb1ab 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -309,7 +309,7 @@ grub_efi_modules_addr (void) - char * - grub_efi_get_filename (grub_efi_device_path_t *dp0) - { -- char *name = 0, *p; -+ char *name = 0, *p, *pi; - grub_size_t filesize = 0; - grub_efi_device_path_t *dp; - -@@ -328,7 +328,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - grub_efi_uint16_t len; - len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) - / sizeof (grub_efi_char16_t)); -- filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 1; -+ filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2; - } - - dp = GRUB_EFI_NEXT_DEVICE_PATH (dp); -@@ -356,12 +356,12 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - grub_efi_file_path_device_path_t *fp; - grub_efi_uint16_t len; - -- if (p != name) -- *p++ = '/'; -+ *p++ = '/'; - - len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) - / sizeof (grub_efi_char16_t)); - fp = (grub_efi_file_path_device_path_t *) dp; -+ - p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len); - } - -@@ -370,10 +370,19 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - - *p = '\0'; - -- /* EFI breaks paths with backslashes. */ -- for (p = name; *p; p++) -- if (*p == '\\') -- *p = '/'; -+ for (pi = name, p = name; *pi;) -+ { -+ /* EFI breaks paths with backslashes. */ -+ if (*pi == '\\' || *pi == '/') -+ { -+ *p++ = '/'; -+ while (*pi == '\\' || *pi == '/') -+ pi++; -+ continue; -+ } -+ *p++ = *pi++; -+ } -+ *p = '\0'; - - return name; - } --- -2.1.4 - diff --git a/0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch b/0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch deleted file mode 100644 index 64a2cd0..0000000 --- a/0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2e62352bc28bd5d3efafc1b5cbe211ff9e9987fd Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 21:07:08 +0100 -Subject: [PATCH] * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure - that no division by 0 occurs. - ---- - ChangeLog | 5 +++++ - grub-core/kern/i386/tsc.c | 6 +++++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c -+++ grub-2.02~beta2/grub-core/kern/i386/tsc.c -@@ -122,7 +122,11 @@ calibrate_tsc (void) - grub_pit_wait (0xffff); - end_tsc = grub_get_tsc (); - -- grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0); -+ grub_tsc_rate = 0; -+ if (end_tsc > tsc_boot_time) -+ grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0); -+ if (grub_tsc_rate == 0) -+ grub_tsc_rate = 5368;/* 800 MHz */ - } - #endif - diff --git a/0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch b/0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch deleted file mode 100644 index 22aad4d..0000000 --- a/0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2b1fbf23b49586e414d3212544395e18b1c0b9cb Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sun, 12 Jan 2014 16:16:26 +0400 -Subject: [PATCH] look for DejaVu also in /usr/share/fonts/truetype - -It is installed in this path on openSUSE. ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 7c5d080..e80c074 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1375,7 +1375,7 @@ fi - - if test x"$starfield_excuse" = x; then - for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do -- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do -+ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do - if test -f "$dir/DejaVuSans.$ext"; then - DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" - break 2 --- -1.8.4 - diff --git a/0001-menu-fix-line-count-calculation-for-long-lines.patch b/0001-menu-fix-line-count-calculation-for-long-lines.patch deleted file mode 100644 index f50a0bf..0000000 --- a/0001-menu-fix-line-count-calculation-for-long-lines.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 7c1f98869a1aedc2210c4d9e5ad9828eeb2dda72 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 28 Dec 2015 19:48:44 +0300 -Subject: [PATCH] menu: fix line count calculation for long lines - -It gave one extra screen line if length was exactly equal to screen -width. - -Reported by Michael Chang. -Also-By: Michael Chang ---- - grub-core/normal/menu_entry.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index 62c7e16..2b73225 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -126,9 +126,13 @@ ensure_space (struct line *linep, int extra) - static int - get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen) - { -- return (grub_getstringwidth (linep->buf, linep->buf + linep->len, -- term_screen->term) -- / (unsigned) term_screen->geo.entry_width) + 1; -+ grub_size_t width = grub_getstringwidth (linep->buf, linep->buf + linep->len, -+ term_screen->term); -+ -+ /* Empty line still consumes space on screen */ -+ return width ? (width + (unsigned) term_screen->geo.entry_width - 1) / -+ (unsigned) term_screen->geo.entry_width -+ : 1; - } - - static void --- -1.9.1 - diff --git a/0001-unix-do-not-close-stdin-in-grub_passwd_get.patch b/0001-unix-do-not-close-stdin-in-grub_passwd_get.patch deleted file mode 100644 index 34a45cf..0000000 --- a/0001-unix-do-not-close-stdin-in-grub_passwd_get.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 6a46cbcc5c1c746562fd7181bf0f2337db065201 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 18 Nov 2015 22:23:58 +0300 -Subject: [PATCH] unix: do not close stdin in grub_passwd_get - -This makes it impossible to read from stdin without controlling tty: - -10:/mnt # echo -e passwd\\npasswd | setsid ./grub-mkpasswd-pbkdf2 -Enter password: -Reenter password: ./grub-mkpasswd-pbkdf2: error: failure to read password. -10:/mnt ---- - grub-core/osdep/unix/password.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/osdep/unix/password.c b/grub-core/osdep/unix/password.c -index 4b9507b..9996b24 100644 ---- a/grub-core/osdep/unix/password.c -+++ b/grub-core/osdep/unix/password.c -@@ -54,7 +54,8 @@ grub_password_get (char buf[], unsigned buf_size) - grub_memset (buf, 0, buf_size); - if (!fgets (buf, buf_size, stdin)) - { -- fclose (in); -+ if (in != stdin) -+ fclose (in); - return 0; - } - ptr = buf + strlen (buf) - 1; -@@ -67,7 +68,8 @@ grub_password_get (char buf[], unsigned buf_size) - grub_xputs ("\n"); - grub_refresh (); - -- fclose (in); -+ if (in != stdin) -+ fclose (in); - - return 1; - } --- -1.9.1 - diff --git a/0001-unix-password-Fix-file-descriptor-leak.patch b/0001-unix-password-Fix-file-descriptor-leak.patch deleted file mode 100644 index 73811f9..0000000 --- a/0001-unix-password-Fix-file-descriptor-leak.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 810254093959708aa6a260c59ad3cf3a1d250755 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:53:03 +0100 -Subject: [PATCH] unix/password: Fix file descriptor leak. - -Found by: Coverity scan. ---- - grub-core/osdep/unix/password.c | 7 ++++++- - 1 files changed, 6 insertions(+), 1 deletions(-) - -Index: grub-2.02~beta2/grub-core/osdep/unix/password.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/unix/password.c 2013-12-25 00:29:26.000000000 +0800 -+++ grub-2.02~beta2/grub-core/osdep/unix/password.c 2015-09-22 17:10:01.109530851 +0800 -@@ -53,7 +53,10 @@ - tty_changed = 0; - grub_memset (buf, 0, buf_size); - if (!fgets (buf, buf_size, stdin)) -- return 0; -+ { -+ fclose (in); -+ return 0; -+ } - ptr = buf + strlen (buf) - 1; - while (buf <= ptr && (*ptr == '\n' || *ptr == '\r')) - *ptr-- = 0; -@@ -64,5 +67,7 @@ - grub_xputs ("\n"); - grub_refresh (); - -+ fclose (in); -+ - return 1; - } diff --git a/0002-Add-Virtual-LAN-support.patch b/0002-Add-Virtual-LAN-support.patch index 7e73143..541f2ee 100644 --- a/0002-Add-Virtual-LAN-support.patch +++ b/0002-Add-Virtual-LAN-support.patch @@ -19,36 +19,11 @@ http://en.wikipedia.org/wiki/IEEE_802.1Q include/grub/net/ip.h | 3 ++- 8 files changed, 124 insertions(+), 20 deletions(-) -diff --git a/ChangeLog b/ChangeLog -index a659369..188c882 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,20 @@ -+2014-02-04 Paulo Flabiano Smorigo -+ -+ Add Virtual LAN 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 -+ -+ * grub-core/net/ethernet.c: Add check, get, and set vlan tag id. -+ * grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs. -+ * grub-core/net/arp.c: Add check. -+ * grub-core/net/ip.c: Likewise. -+ * include/grub/net/arp.h: Add vlantag attribute. -+ * include/grub/net/ip.h: Likewise. -+ - 2014-01-24 Paulo Flabiano Smorigo - - Add bootargs parser for open firmware. -diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index e92c7e7..3a3ee29 100644 ---- a/grub-core/net/arp.c -+++ b/grub-core/net/arp.c -@@ -121,8 +121,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, +Index: grub-2.02~beta3/grub-core/net/arp.c +=================================================================== +--- grub-2.02~beta3.orig/grub-core/net/arp.c 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/grub-core/net/arp.c 2016-02-28 19:23:27.056877621 +0300 +@@ -111,8 +111,8 @@ } grub_err_t @@ -57,9 +32,9 @@ index e92c7e7..3a3ee29 100644 +grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, + grub_uint16_t vlantag_vid) { - struct arphdr *arp_header = (struct arphdr *) nb->data; - grub_uint8_t *sender_hardware_address; -@@ -157,6 +157,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, + struct arppkt *arp_packet = (struct arppkt *) nb->data; + grub_net_network_level_address_t sender_addr, target_addr; +@@ -138,6 +138,12 @@ FOR_NET_NETWORK_LEVEL_INTERFACES (inf) { @@ -71,12 +46,12 @@ index e92c7e7..3a3ee29 100644 + /* Am I the protocol address target? */ if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 - && grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST) -diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index a079065..2a4f27c 100644 ---- a/grub-core/net/drivers/ieee1275/ofnet.c -+++ b/grub-core/net/drivers/ieee1275/ofnet.c -@@ -147,11 +147,11 @@ grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath, + && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) +Index: grub-2.02~beta3/grub-core/net/drivers/ieee1275/ofnet.c +=================================================================== +--- grub-2.02~beta3.orig/grub-core/net/drivers/ieee1275/ofnet.c 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/grub-core/net/drivers/ieee1275/ofnet.c 2016-02-28 19:24:47.004878566 +0300 +@@ -147,11 +147,11 @@ char *comma_char = 0; char *equal_char = 0; grub_size_t field_counter = 0; @@ -84,12 +59,12 @@ index a079065..2a4f27c 100644 grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; grub_net_link_level_address_t hw_addr; grub_net_interface_flags_t flags = 0; - struct grub_net_network_level_interface *inter; + struct grub_net_network_level_interface *inter = NULL; + grub_uint32_t vlantag = 0; hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; -@@ -169,6 +169,18 @@ grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath, +@@ -169,6 +169,18 @@ *equal_char = 0; grub_env_set_net_property ((*card)->name, args, equal_char + 1, grub_strlen(equal_char + 1)); @@ -108,7 +83,7 @@ index a079065..2a4f27c 100644 *equal_char = '='; } else -@@ -207,6 +219,12 @@ grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath, +@@ -207,6 +219,12 @@ hw_addr.mac, sizeof(hw_addr.mac), 0); inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr, flags); @@ -121,10 +96,10 @@ index a079065..2a4f27c 100644 grub_net_add_ipv4_local (inter, __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); } -diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index c397b1b..3a526b3 100644 ---- a/grub-core/net/ethernet.c -+++ b/grub-core/net/ethernet.c +Index: grub-2.02~beta3/grub-core/net/ethernet.c +=================================================================== +--- grub-2.02~beta3.orig/grub-core/net/ethernet.c 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/grub-core/net/ethernet.c 2016-02-28 19:23:27.056877621 +0300 @@ -18,6 +18,7 @@ #include @@ -133,7 +108,7 @@ index c397b1b..3a526b3 100644 #include #include #include -@@ -56,10 +57,16 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, +@@ -56,10 +57,16 @@ { struct etherhdr *eth; grub_err_t err; @@ -152,7 +127,7 @@ index c397b1b..3a526b3 100644 if (err) return err; eth = (struct etherhdr *) nb->data; -@@ -76,6 +83,21 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, +@@ -76,6 +83,21 @@ return err; inf->card->opened = 1; } @@ -174,7 +149,7 @@ index c397b1b..3a526b3 100644 return inf->card->driver->send (inf->card, nb); } -@@ -90,10 +112,26 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, +@@ -90,10 +112,26 @@ grub_net_link_level_address_t hwaddress; grub_net_link_level_address_t src_hwaddress; grub_err_t err; @@ -202,7 +177,7 @@ index c397b1b..3a526b3 100644 if (err) return err; -@@ -121,13 +159,14 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, +@@ -121,13 +159,14 @@ { /* ARP packet. */ case GRUB_NET_ETHERTYPE_ARP: @@ -219,11 +194,11 @@ index c397b1b..3a526b3 100644 } grub_netbuff_free (nb); return GRUB_ERR_NONE; -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index c6971f9..8041905 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -225,12 +225,13 @@ handle_dgram (struct grub_net_buff *nb, +Index: grub-2.02~beta3/grub-core/net/ip.c +=================================================================== +--- grub-2.02~beta3.orig/grub-core/net/ip.c 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/grub-core/net/ip.c 2016-02-28 19:23:27.056877621 +0300 +@@ -228,12 +228,13 @@ grub_net_ip_protocol_t proto, const grub_net_network_level_address_t *source, const grub_net_network_level_address_t *dest, @@ -238,7 +213,7 @@ index c6971f9..8041905 100644 /* DHCP needs special treatment since we don't know IP yet. */ { struct udphdr *udph; -@@ -290,6 +291,13 @@ handle_dgram (struct grub_net_buff *nb, +@@ -293,6 +294,13 @@ && grub_net_addr_cmp (&inf->address, dest) == 0 && grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0) break; @@ -252,7 +227,7 @@ index c6971f9..8041905 100644 /* Solicited node multicast. */ if (inf->card == card && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6 -@@ -378,7 +386,8 @@ static grub_err_t +@@ -381,7 +389,8 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, struct grub_net_card *card, const grub_net_link_level_address_t *hwaddress, @@ -262,7 +237,7 @@ index c6971f9..8041905 100644 { struct iphdr *iph = (struct iphdr *) nb->data; grub_err_t err; -@@ -453,7 +462,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, +@@ -456,7 +465,7 @@ dest.ipv4 = iph->dest; return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, @@ -271,7 +246,7 @@ index c6971f9..8041905 100644 } for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev) -@@ -589,7 +598,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, +@@ -592,7 +601,7 @@ dest.ipv4 = dst; return handle_dgram (ret, card, src_hwaddress, @@ -280,7 +255,7 @@ index c6971f9..8041905 100644 ttl); } } -@@ -644,7 +653,8 @@ static grub_err_t +@@ -650,7 +659,8 @@ grub_net_recv_ip6_packets (struct grub_net_buff *nb, struct grub_net_card *card, const grub_net_link_level_address_t *hwaddress, @@ -290,7 +265,7 @@ index c6971f9..8041905 100644 { struct ip6hdr *iph = (struct ip6hdr *) nb->data; grub_err_t err; -@@ -695,21 +705,24 @@ grub_net_recv_ip6_packets (struct grub_net_buff *nb, +@@ -701,21 +711,24 @@ grub_memcpy (dest.ipv6, &iph->dest, sizeof (dest.ipv6)); return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, @@ -319,11 +294,11 @@ index c6971f9..8041905 100644 grub_dprintf ("net", "Bad IP version: %d\n", (iph->verhdrlen >> 4)); grub_netbuff_free (nb); return GRUB_ERR_NONE; -diff --git a/include/grub/net.h b/include/grub/net.h -index 843f74f..db5f6b3 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -268,6 +268,12 @@ typedef struct grub_net +Index: grub-2.02~beta3/include/grub/net.h +=================================================================== +--- grub-2.02~beta3.orig/include/grub/net.h 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/include/grub/net.h 2016-02-28 19:23:27.056877621 +0300 +@@ -280,6 +280,12 @@ extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name); @@ -336,7 +311,7 @@ index 843f74f..db5f6b3 100644 struct grub_net_network_level_interface { struct grub_net_network_level_interface *next; -@@ -279,6 +285,7 @@ struct grub_net_network_level_interface +@@ -291,6 +297,7 @@ grub_net_interface_flags_t flags; struct grub_net_bootp_packet *dhcp_ack; grub_size_t dhcp_acklen; @@ -344,17 +319,17 @@ index 843f74f..db5f6b3 100644 void *data; }; -@@ -537,4 +544,6 @@ extern char *grub_net_default_server; - #define GRUB_NET_TRIES 40 +@@ -561,4 +568,6 @@ #define GRUB_NET_INTERVAL 400 + #define GRUB_NET_INTERVAL_ADDITION 20 +#define VLANTAG_IDENTIFIER 0x8100 + #endif /* ! GRUB_NET_HEADER */ -diff --git a/include/grub/net/arp.h b/include/grub/net/arp.h -index bb17036..56336b3 100644 ---- a/include/grub/net/arp.h -+++ b/include/grub/net/arp.h +Index: grub-2.02~beta3/include/grub/net/arp.h +=================================================================== +--- grub-2.02~beta3.orig/include/grub/net/arp.h 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/include/grub/net/arp.h 2016-02-28 19:23:27.056877621 +0300 @@ -22,10 +22,11 @@ #include @@ -369,11 +344,11 @@ index bb17036..56336b3 100644 + const grub_net_network_level_address_t *proto_addr); #endif -diff --git a/include/grub/net/ip.h b/include/grub/net/ip.h -index 7a8e614..e79dec9 100644 ---- a/include/grub/net/ip.h -+++ b/include/grub/net/ip.h -@@ -48,7 +48,8 @@ grub_err_t +Index: grub-2.02~beta3/include/grub/net/ip.h +=================================================================== +--- grub-2.02~beta3.orig/include/grub/net/ip.h 2016-02-28 19:23:27.060877621 +0300 ++++ grub-2.02~beta3/include/grub/net/ip.h 2016-02-28 19:23:27.056877621 +0300 +@@ -48,7 +48,8 @@ grub_net_recv_ip_packets (struct grub_net_buff *nb, struct grub_net_card *card, const grub_net_link_level_address_t *hwaddress, @@ -383,5 +358,3 @@ index 7a8e614..e79dec9 100644 grub_err_t grub_net_send_ip_packet (struct grub_net_network_level_interface *inf, --- -1.9.3 diff --git a/0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch b/0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch deleted file mode 100644 index 467f8fd..0000000 --- a/0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch +++ /dev/null @@ -1,97 +0,0 @@ -From c52ae40570c3bfbcca22d2195f5e6b31009d8a3f Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -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 - diff --git a/0002-i386-tsc-Fix-unused-function-warning-on-xen.patch b/0002-i386-tsc-Fix-unused-function-warning-on-xen.patch deleted file mode 100644 index f46b3bc..0000000 --- a/0002-i386-tsc-Fix-unused-function-warning-on-xen.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 50ebc8f5f35a322b3736c03e16de7108932126b0 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 13:12:44 +0100 -Subject: [PATCH] i386/tsc: Fix unused function warning on xen. - ---- - grub-core/kern/i386/tsc.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c -+++ grub-2.02~beta2/grub-core/kern/i386/tsc.c -@@ -57,6 +57,8 @@ grub_get_tsc (void) - return (((grub_uint64_t) hi) << 32) | lo; - } - -+#ifndef GRUB_MACHINE_XEN -+ - static __inline int - grub_cpu_is_tsc_supported (void) - { -@@ -69,8 +71,6 @@ grub_cpu_is_tsc_supported (void) - return (d & (1 << 4)) != 0; - } - --#ifndef GRUB_MACHINE_XEN -- - static void - grub_pit_wait (grub_uint16_t tics) - { diff --git a/0002-linux-getroot-fix-descriptor-leak.patch b/0002-linux-getroot-fix-descriptor-leak.patch deleted file mode 100644 index 582a1c2..0000000 --- a/0002-linux-getroot-fix-descriptor-leak.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 6704abade6674a91d8c652a7e4596ca3421411b6 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 21:38:40 +0300 -Subject: [PATCH] linux/getroot: fix descriptor leak. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/getroot.c | 4 +++- - 1 files changed, 3 insertions(+), 1 deletions(-) - -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c 2015-09-22 17:10:33.177530851 +0800 -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c 2015-09-22 17:13:27.269530851 +0800 -@@ -368,7 +368,8 @@ - ret[1+namelen] = '\0'; - } - if (!ret) -- return xstrdup ("/"); -+ ret = xstrdup ("/"); -+ close (fd); - return ret; - } - diff --git a/0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch b/0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch deleted file mode 100644 index 797345d..0000000 --- a/0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 07258815e96aab2c72593d0129d17051cbf68d27 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 8 May 2015 06:15:16 +0300 -Subject: [PATCH] acpi: do not skip BIOS scan if EBDA length is zero - -EBDA layout is not standardized so we cannot assume first two bytes -are length. Neither is it required by ACPI standard. HP 8710W is known -to contain zeroes here. - -Closes: 45002 ---- - grub-core/commands/acpi.c | 4 ++++ - grub-core/commands/i386/pc/acpi.c | 10 ++++++---- - 2 files changed, 10 insertions(+), 4 deletions(-) - -Index: grub-2.02~beta2/grub-core/commands/acpi.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/commands/acpi.c -+++ grub-2.02~beta2/grub-core/commands/acpi.c -@@ -179,8 +179,10 @@ grub_acpi_create_ebda (void) - struct grub_acpi_rsdp_v20 *v2; - - ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4); -+ grub_dprintf ("acpi", "EBDA @%p\n", ebda); - if (ebda) - ebda_kb_len = *(grub_uint16_t *) ebda; -+ grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len); - if (ebda_kb_len > 16) - ebda_kb_len = 0; - ctx.ebda_len = (ebda_kb_len + 1) << 10; -@@ -494,6 +496,8 @@ grub_cmd_acpi (struct grub_extcmd_contex - if (! rsdp) - rsdp = grub_machine_acpi_get_rsdpv1 (); - -+ grub_dprintf ("acpi", "RSDP @%p\n", rsdp); -+ - if (rsdp) - { - grub_uint32_t *entry_ptr; -Index: grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/commands/i386/pc/acpi.c -+++ grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c -@@ -29,14 +29,15 @@ grub_machine_acpi_get_rsdpv1 (void) - grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); - ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); - ebda_len = * (grub_uint16_t *) ebda; -- if (! ebda_len) -- return 0; -+ if (! ebda_len) /* FIXME do we really need this check? */ -+ goto scan_bios; - for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) - if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 - && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 - && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0) - return (struct grub_acpi_rsdp_v10 *) ptr; - -+scan_bios: - grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); - for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; - ptr += 16) -@@ -56,8 +57,8 @@ grub_machine_acpi_get_rsdpv2 (void) - grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); - ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); - ebda_len = * (grub_uint16_t *) ebda; -- if (! ebda_len) -- return 0; -+ if (! ebda_len) /* FIXME do we really need this check? */ -+ goto scan_bios; - for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) - if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 - && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -@@ -67,6 +68,7 @@ grub_machine_acpi_get_rsdpv2 (void) - == 0) - return (struct grub_acpi_rsdp_v20 *) ptr; - -+scan_bios: - grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); - for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; - ptr += 16) diff --git a/0003-efinet-open-Simple-Network-Protocol-exclusively.patch b/0003-efinet-open-Simple-Network-Protocol-exclusively.patch deleted file mode 100644 index 0d9523a..0000000 --- a/0003-efinet-open-Simple-Network-Protocol-exclusively.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 49426e9fd2e562c73a4f1206f32eff9e424a1a73 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -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 - -Also-By: Mark Salter -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 - diff --git a/0003-util-grub-mount-fix-descriptor-leak.patch b/0003-util-grub-mount-fix-descriptor-leak.patch deleted file mode 100644 index 26b8339..0000000 --- a/0003-util-grub-mount-fix-descriptor-leak.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 1a87156e01e3cb873f3479c31c34c97fb690eb71 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:24:28 +0300 -Subject: [PATCH] util/grub-mount: fix descriptor leak. - -Found by: Coverity scan. ---- - util/grub-mount.c | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - -Index: grub-2.02~beta2/util/grub-mount.c -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mount.c 2013-12-25 00:29:28.000000000 +0800 -+++ grub-2.02~beta2/util/grub-mount.c 2015-09-22 17:15:44.525530851 +0800 -@@ -511,6 +511,7 @@ - return 0; - } - grub_zfs_add_key (buf, real_size, 0); -+ fclose (f); - } - return 0; - diff --git a/0004-linux-ofpath-fix-descriptor-leak.patch b/0004-linux-ofpath-fix-descriptor-leak.patch deleted file mode 100644 index d8395a2..0000000 --- a/0004-linux-ofpath-fix-descriptor-leak.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 637fc62699e7ae3f0057e1c56d330eb193fd40b6 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 20:29:00 +0300 -Subject: [PATCH] linux/ofpath: fix descriptor leak - -Found by: Coverity scan ---- - grub-core/osdep/linux/ofpath.c | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -Index: grub-2.02~beta2/grub-core/osdep/linux/ofpath.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/ofpath.c 2013-12-25 00:29:26.000000000 +0800 -+++ grub-2.02~beta2/grub-core/osdep/linux/ofpath.c 2015-09-22 17:16:06.869530851 +0800 -@@ -122,6 +122,8 @@ - fd = open(path, O_RDONLY); - if (fd < 0 || fstat (fd, &st) < 0) - { -+ if (fd >= 0) -+ close (fd); - snprintf(path, path_size, "%s/devspec", sysfs_path); - fd = open(path, O_RDONLY); - } diff --git a/0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch b/0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch deleted file mode 100644 index fa1d7f9..0000000 --- a/0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch +++ /dev/null @@ -1,1104 +0,0 @@ -From d43a5ee65143f384357fbfdcace4258e3537c214 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 13 Nov 2015 16:14:53 +0100 -Subject: [PATCH] tsc: Use alternative delay sources whenever appropriate. - -PIT isn't available on some of new hardware including Hyper-V. So -use pmtimer for calibration. Moreover pmtimer calibration is faster, so -use it on coreboor where booting time is important. - -Based on patch by Michael Chang. ---- - grub-core/Makefile.am | 7 ++ - grub-core/Makefile.core.def | 19 ++++- - grub-core/commands/acpi.c | 12 --- - grub-core/commands/efi/acpi.c | 59 -------------- - grub-core/commands/i386/pc/acpi.c | 83 -------------------- - grub-core/kern/acpi.c | 34 ++++++++ - grub-core/kern/efi/acpi.c | 59 ++++++++++++++ - grub-core/kern/i386/efi/tsc.c | 40 ++++++++++ - grub-core/kern/i386/pc/acpi.c | 83 ++++++++++++++++++++ - grub-core/kern/i386/tsc.c | 123 +++++++---------------------- - grub-core/kern/i386/tsc_pit.c | 84 ++++++++++++++++++++ - grub-core/kern/i386/tsc_pmtimer.c | 160 ++++++++++++++++++++++++++++++++++++++ - grub-core/kern/i386/xen/tsc.c | 40 ++++++++++ - include/grub/acpi.h | 17 ++-- - include/grub/i386/tsc.h | 26 +++++++ - 15 files changed, 588 insertions(+), 258 deletions(-) - delete mode 100644 grub-core/commands/efi/acpi.c - delete mode 100644 grub-core/commands/i386/pc/acpi.c - create mode 100644 grub-core/kern/acpi.c - create mode 100644 grub-core/kern/efi/acpi.c - create mode 100644 grub-core/kern/i386/efi/tsc.c - create mode 100644 grub-core/kern/i386/pc/acpi.c - create mode 100644 grub-core/kern/i386/tsc_pit.c - create mode 100644 grub-core/kern/i386/tsc_pmtimer.c - create mode 100644 grub-core/kern/i386/xen/tsc.c - -Index: grub-2.02~beta2/grub-core/Makefile.am -=================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.am -+++ grub-2.02~beta2/grub-core/Makefile.am -@@ -97,6 +97,7 @@ if COND_i386_efi - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h - endif - -@@ -108,10 +109,12 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_i386_multiboot - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_i386_qemu -@@ -150,11 +153,13 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_ia64_efi - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_mips -@@ -229,11 +234,13 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_arm64_efi - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h - endif - - if COND_emu -Index: grub-2.02~beta2/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -173,8 +173,20 @@ kernel = { - efi = kern/efi/init.c; - efi = kern/efi/mm.c; - efi = term/efi/console.c; -+ efi = kern/acpi.c; -+ efi = kern/efi/acpi.c; -+ i386_coreboot = kern/i386/pc/acpi.c; -+ i386_multiboot = kern/i386/pc/acpi.c; -+ i386_coreboot = kern/acpi.c; -+ i386_multiboot = kern/acpi.c; - - x86 = kern/i386/tsc.c; -+ x86 = kern/i386/tsc_pit.c; -+ i386_efi = kern/i386/efi/tsc.c; -+ x86_64_efi = kern/i386/efi/tsc.c; -+ i386_efi = kern/i386/tsc_pmtimer.c; -+ i386_coreboot = kern/i386/tsc_pmtimer.c; -+ x86_64_efi = kern/i386/tsc_pmtimer.c; - - i386_efi = kern/i386/efi/init.c; - i386_efi = bus/pci.c; -@@ -186,6 +198,7 @@ kernel = { - x86_64_efi = bus/pci.c; - - xen = kern/i386/tsc.c; -+ xen = kern/i386/xen/tsc.c; - x86_64_xen = kern/x86_64/xen/hypercall.S; - i386_xen = kern/i386/xen/hypercall.S; - xen = kern/xen/init.c; -@@ -684,10 +697,8 @@ module = { - name = acpi; - - common = commands/acpi.c; -- efi = commands/efi/acpi.c; -- i386_pc = commands/i386/pc/acpi.c; -- i386_coreboot = commands/i386/pc/acpi.c; -- i386_multiboot = commands/i386/pc/acpi.c; -+ i386_pc = kern/acpi.c; -+ i386_pc = kern/i386/pc/acpi.c; - - enable = efi; - enable = i386_pc; -Index: grub-2.02~beta2/grub-core/commands/acpi.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/commands/acpi.c -+++ grub-2.02~beta2/grub-core/commands/acpi.c -@@ -61,18 +61,6 @@ static const struct grub_arg_option opti - {0, 0, 0, 0, 0, 0} - }; - --/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */ --grub_uint8_t --grub_byte_checksum (void *base, grub_size_t size) --{ -- grub_uint8_t *ptr; -- grub_uint8_t ret = 0; -- for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size; -- ptr++) -- ret += *ptr; -- return ret; --} -- - /* rev1 is 1 if ACPIv1 is to be generated, 0 otherwise. - rev2 contains the revision of ACPIv2+ to generate or 0 if none. */ - static int rev1, rev2; -Index: grub-2.02~beta2/grub-core/commands/efi/acpi.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/commands/efi/acpi.c -+++ /dev/null -@@ -1,59 +0,0 @@ --/* acpi.c - get acpi tables. */ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2009 Free Software Foundation, Inc. -- * -- * GRUB is free software: you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation, either version 3 of the License, or -- * (at your option) any later version. -- * -- * GRUB is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with GRUB. If not, see . -- */ -- --#include --#include --#include --#include -- --struct grub_acpi_rsdp_v10 * --grub_machine_acpi_get_rsdpv1 (void) --{ -- unsigned i; -- static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; -- -- for (i = 0; i < grub_efi_system_table->num_table_entries; i++) -- { -- grub_efi_packed_guid_t *guid = -- &grub_efi_system_table->configuration_table[i].vendor_guid; -- -- if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_packed_guid_t))) -- return (struct grub_acpi_rsdp_v10 *) -- grub_efi_system_table->configuration_table[i].vendor_table; -- } -- return 0; --} -- --struct grub_acpi_rsdp_v20 * --grub_machine_acpi_get_rsdpv2 (void) --{ -- unsigned i; -- static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; -- -- for (i = 0; i < grub_efi_system_table->num_table_entries; i++) -- { -- grub_efi_packed_guid_t *guid = -- &grub_efi_system_table->configuration_table[i].vendor_guid; -- -- if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_packed_guid_t))) -- return (struct grub_acpi_rsdp_v20 *) -- grub_efi_system_table->configuration_table[i].vendor_table; -- } -- return 0; --} -Index: grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/commands/i386/pc/acpi.c -+++ /dev/null -@@ -1,83 +0,0 @@ --/* acpi.c - get acpi tables. */ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2009 Free Software Foundation, Inc. -- * -- * GRUB is free software: you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation, either version 3 of the License, or -- * (at your option) any later version. -- * -- * GRUB is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with GRUB. If not, see . -- */ -- --#include --#include -- --struct grub_acpi_rsdp_v10 * --grub_machine_acpi_get_rsdpv1 (void) --{ -- int ebda_len; -- grub_uint8_t *ebda, *ptr; -- -- grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); -- ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); -- ebda_len = * (grub_uint16_t *) ebda; -- if (! ebda_len) /* FIXME do we really need this check? */ -- goto scan_bios; -- for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) -- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0) -- return (struct grub_acpi_rsdp_v10 *) ptr; -- --scan_bios: -- grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); -- for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; -- ptr += 16) -- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0) -- return (struct grub_acpi_rsdp_v10 *) ptr; -- return 0; --} -- --struct grub_acpi_rsdp_v20 * --grub_machine_acpi_get_rsdpv2 (void) --{ -- int ebda_len; -- grub_uint8_t *ebda, *ptr; -- -- grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); -- ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); -- ebda_len = * (grub_uint16_t *) ebda; -- if (! ebda_len) /* FIXME do we really need this check? */ -- goto scan_bios; -- for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) -- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0 -- && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024 -- && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length) -- == 0) -- return (struct grub_acpi_rsdp_v20 *) ptr; -- --scan_bios: -- grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); -- for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; -- ptr += 16) -- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0 -- && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024 -- && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length) -- == 0) -- return (struct grub_acpi_rsdp_v20 *) ptr; -- return 0; --} -Index: grub-2.02~beta2/grub-core/kern/acpi.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/acpi.c -@@ -0,0 +1,34 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2012 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+ -+/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */ -+grub_uint8_t -+grub_byte_checksum (void *base, grub_size_t size) -+{ -+ grub_uint8_t *ptr; -+ grub_uint8_t ret = 0; -+ for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size; -+ ptr++) -+ ret += *ptr; -+ return ret; -+} -Index: grub-2.02~beta2/grub-core/kern/efi/acpi.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/efi/acpi.c -@@ -0,0 +1,59 @@ -+/* acpi.c - get acpi tables. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+ -+struct grub_acpi_rsdp_v10 * -+grub_machine_acpi_get_rsdpv1 (void) -+{ -+ unsigned i; -+ static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; -+ -+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++) -+ { -+ grub_efi_packed_guid_t *guid = -+ &grub_efi_system_table->configuration_table[i].vendor_guid; -+ -+ if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_packed_guid_t))) -+ return (struct grub_acpi_rsdp_v10 *) -+ grub_efi_system_table->configuration_table[i].vendor_table; -+ } -+ return 0; -+} -+ -+struct grub_acpi_rsdp_v20 * -+grub_machine_acpi_get_rsdpv2 (void) -+{ -+ unsigned i; -+ static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; -+ -+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++) -+ { -+ grub_efi_packed_guid_t *guid = -+ &grub_efi_system_table->configuration_table[i].vendor_guid; -+ -+ if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_packed_guid_t))) -+ return (struct grub_acpi_rsdp_v20 *) -+ grub_efi_system_table->configuration_table[i].vendor_table; -+ } -+ return 0; -+} -Index: grub-2.02~beta2/grub-core/kern/i386/efi/tsc.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/i386/efi/tsc.c -@@ -0,0 +1,40 @@ -+/* kern/i386/tsc.c - x86 TSC time source implementation -+ * Requires Pentium or better x86 CPU that supports the RDTSC instruction. -+ * This module uses the PIT to calibrate the TSC to -+ * real time. -+ * -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2008 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+int -+grub_tsc_calibrate_from_efi (void) -+{ -+ grub_uint64_t start_tsc, end_tsc; -+ /* Use EFI Time Service to calibrate TSC */ -+ start_tsc = grub_get_tsc (); -+ efi_call_1 (grub_efi_system_table->boot_services->stall, 1000); -+ end_tsc = grub_get_tsc (); -+ grub_tsc_rate = grub_divmod64 ((1ULL << 32), end_tsc - start_tsc, 0); -+ return 1; -+} -Index: grub-2.02~beta2/grub-core/kern/i386/pc/acpi.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/i386/pc/acpi.c -@@ -0,0 +1,83 @@ -+/* acpi.c - get acpi tables. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+ -+struct grub_acpi_rsdp_v10 * -+grub_machine_acpi_get_rsdpv1 (void) -+{ -+ int ebda_len; -+ grub_uint8_t *ebda, *ptr; -+ -+ grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); -+ ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); -+ ebda_len = * (grub_uint16_t *) ebda; -+ if (! ebda_len) /* FIXME do we really need this check? */ -+ goto scan_bios; -+ for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) -+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0) -+ return (struct grub_acpi_rsdp_v10 *) ptr; -+ -+scan_bios: -+ grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); -+ for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; -+ ptr += 16) -+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0) -+ return (struct grub_acpi_rsdp_v10 *) ptr; -+ return 0; -+} -+ -+struct grub_acpi_rsdp_v20 * -+grub_machine_acpi_get_rsdpv2 (void) -+{ -+ int ebda_len; -+ grub_uint8_t *ebda, *ptr; -+ -+ grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n"); -+ ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4); -+ ebda_len = * (grub_uint16_t *) ebda; -+ if (! ebda_len) /* FIXME do we really need this check? */ -+ goto scan_bios; -+ for (ptr = ebda; ptr < ebda + 0x400; ptr += 16) -+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0 -+ && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024 -+ && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length) -+ == 0) -+ return (struct grub_acpi_rsdp_v20 *) ptr; -+ -+scan_bios: -+ grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n"); -+ for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000; -+ ptr += 16) -+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 -+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0 -+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0 -+ && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024 -+ && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length) -+ == 0) -+ return (struct grub_acpi_rsdp_v20 *) ptr; -+ return 0; -+} -Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c -+++ grub-2.02~beta2/grub-core/kern/i386/tsc.c -@@ -1,7 +1,6 @@ - /* kern/i386/tsc.c - x86 TSC time source implementation - * Requires Pentium or better x86 CPU that supports the RDTSC instruction. -- * This module uses the RTC (via grub_get_rtc()) to calibrate the TSC to -- * real time. -+ * This module calibrates the TSC to real time. - * - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008 Free Software Foundation, Inc. -@@ -25,12 +24,6 @@ - #include - #include - #include --#ifdef GRUB_MACHINE_XEN --#include --#else --#include --#endif --#include - - /* This defines the value TSC had at the epoch (that is, when we calibrated it). */ - static grub_uint64_t tsc_boot_time; -@@ -40,28 +33,20 @@ static grub_uint64_t tsc_boot_time; - in 32-bit. */ - grub_uint32_t grub_tsc_rate; - --/* Read the TSC value, which increments with each CPU clock cycle. */ --static __inline grub_uint64_t --grub_get_tsc (void) -+static grub_uint64_t -+grub_tsc_get_time_ms (void) - { -- grub_uint32_t lo, hi; -- grub_uint32_t a,b,c,d; -- -- /* The CPUID instruction is a 'serializing' instruction, and -- avoids out-of-order execution of the RDTSC instruction. */ -- grub_cpuid (0,a,b,c,d); -- /* Read TSC value. We cannot use "=A", since this would use -- %rax on x86_64. */ -- __asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi)); -+ grub_uint64_t a = grub_get_tsc () - tsc_boot_time; -+ grub_uint64_t ah = a >> 32; -+ grub_uint64_t al = a & 0xffffffff; - -- return (((grub_uint64_t) hi) << 32) | lo; -+ return ((al * grub_tsc_rate) >> 32) + ah * grub_tsc_rate; - } - --#ifndef GRUB_MACHINE_XEN -- - static __inline int - grub_cpu_is_tsc_supported (void) - { -+#ifndef GRUB_MACHINE_XEN - grub_uint32_t a,b,c,d; - if (! grub_cpu_is_cpuid_supported ()) - return 0; -@@ -69,93 +54,41 @@ grub_cpu_is_tsc_supported (void) - grub_cpuid(1,a,b,c,d); - - return (d & (1 << 4)) != 0; --} -- --static void --grub_pit_wait (grub_uint16_t tics) --{ -- /* Disable timer2 gate and speaker. */ -- grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) -- & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), -- GRUB_PIT_SPEAKER_PORT); -- -- /* Set tics. */ -- grub_outb (GRUB_PIT_CTRL_SELECT_2 | GRUB_PIT_CTRL_READLOAD_WORD, -- GRUB_PIT_CTRL); -- grub_outb (tics & 0xff, GRUB_PIT_COUNTER_2); -- grub_outb (tics >> 8, GRUB_PIT_COUNTER_2); -- -- /* Enable timer2 gate, keep speaker disabled. */ -- grub_outb ((grub_inb (GRUB_PIT_SPEAKER_PORT) & ~ GRUB_PIT_SPK_DATA) -- | GRUB_PIT_SPK_TMR2, -- GRUB_PIT_SPEAKER_PORT); -- -- /* Wait. */ -- while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00); -- -- /* Disable timer2 gate and speaker. */ -- grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) -- & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), -- GRUB_PIT_SPEAKER_PORT); --} -+#else -+ return 1; - #endif -- --static grub_uint64_t --grub_tsc_get_time_ms (void) --{ -- grub_uint64_t a = grub_get_tsc () - tsc_boot_time; -- grub_uint64_t ah = a >> 32; -- grub_uint64_t al = a & 0xffffffff; -- -- return ((al * grub_tsc_rate) >> 32) + ah * grub_tsc_rate; - } - --#ifndef GRUB_MACHINE_XEN --/* Calibrate the TSC based on the RTC. */ --static void --calibrate_tsc (void) -+static int -+calibrate_tsc_hardcode (void) - { -- /* First calibrate the TSC rate (relative, not absolute time). */ -- grub_uint64_t end_tsc; -- -- tsc_boot_time = grub_get_tsc (); -- grub_pit_wait (0xffff); -- end_tsc = grub_get_tsc (); -- -- grub_tsc_rate = 0; -- if (end_tsc > tsc_boot_time) -- grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0); -- if (grub_tsc_rate == 0) -- grub_tsc_rate = 5368;/* 800 MHz */ -+ grub_tsc_rate = 5368;/* 800 MHz */ -+ return 1; - } --#endif - - void - grub_tsc_init (void) - { --#ifdef GRUB_MACHINE_XEN -- grub_uint64_t t; -- tsc_boot_time = grub_get_tsc (); -- t = grub_xen_shared_info->vcpu_info[0].time.tsc_to_system_mul; -- if (grub_xen_shared_info->vcpu_info[0].time.tsc_shift > 0) -- t <<= grub_xen_shared_info->vcpu_info[0].time.tsc_shift; -- else -- t >>= -grub_xen_shared_info->vcpu_info[0].time.tsc_shift; -- grub_tsc_rate = grub_divmod64 (t, 1000000, 0); -- grub_install_get_time_ms (grub_tsc_get_time_ms); --#else -- if (grub_cpu_is_tsc_supported ()) -- { -- calibrate_tsc (); -- grub_install_get_time_ms (grub_tsc_get_time_ms); -- } -- else -+ if (!grub_cpu_is_tsc_supported ()) - { - #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_IEEE1275) - grub_install_get_time_ms (grub_rtc_get_time_ms); - #else - grub_fatal ("no TSC found"); - #endif -+ return; - } -+ -+ tsc_boot_time = grub_get_tsc (); -+ -+#ifdef GRUB_MACHINE_XEN -+ (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode()); -+#elif defined (GRUB_MACHINE_EFI) -+ (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode()); -+#elif defined (GRUB_MACHINE_COREBOOT) -+ (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode()); -+#else -+ (void) (grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode()); - #endif -+ grub_install_get_time_ms (grub_tsc_get_time_ms); - } -Index: grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c -@@ -0,0 +1,84 @@ -+/* kern/i386/tsc.c - x86 TSC time source implementation -+ * Requires Pentium or better x86 CPU that supports the RDTSC instruction. -+ * This module uses the PIT to calibrate the TSC to -+ * real time. -+ * -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2008 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+grub_pit_wait (void) -+{ -+ int ret = 0; -+ -+ /* Disable timer2 gate and speaker. */ -+ grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) -+ & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), -+ GRUB_PIT_SPEAKER_PORT); -+ -+ /* Set tics. */ -+ grub_outb (GRUB_PIT_CTRL_SELECT_2 | GRUB_PIT_CTRL_READLOAD_WORD, -+ GRUB_PIT_CTRL); -+ /* 0xffff ticks: 55ms. */ -+ grub_outb (0xff, GRUB_PIT_COUNTER_2); -+ grub_outb (0xff, GRUB_PIT_COUNTER_2); -+ -+ /* Enable timer2 gate, keep speaker disabled. */ -+ grub_outb ((grub_inb (GRUB_PIT_SPEAKER_PORT) & ~ GRUB_PIT_SPK_DATA) -+ | GRUB_PIT_SPK_TMR2, -+ GRUB_PIT_SPEAKER_PORT); -+ -+ if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) { -+ ret = 1; -+ /* Wait. */ -+ while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00); -+ } -+ -+ /* Disable timer2 gate and speaker. */ -+ grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) -+ & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), -+ GRUB_PIT_SPEAKER_PORT); -+ -+ return ret; -+} -+ -+/* Calibrate the TSC based on the RTC. */ -+int -+grub_tsc_calibrate_from_pit (void) -+{ -+ /* First calibrate the TSC rate (relative, not absolute time). */ -+ grub_uint64_t start_tsc, end_tsc; -+ -+ start_tsc = grub_get_tsc (); -+ if (!grub_pit_wait ()) -+ return 0; -+ end_tsc = grub_get_tsc (); -+ -+ grub_tsc_rate = 0; -+ if (end_tsc > start_tsc) -+ grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - start_tsc, 0); -+ if (grub_tsc_rate == 0) -+ return 0; -+ return 1; -+} -Index: grub-2.02~beta2/grub-core/kern/i386/tsc_pmtimer.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/i386/tsc_pmtimer.c -@@ -0,0 +1,160 @@ -+/* kern/i386/tsc.c - x86 TSC time source implementation -+ * Requires Pentium or better x86 CPU that supports the RDTSC instruction. -+ * This module uses the PIT to calibrate the TSC to -+ * real time. -+ * -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2008 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static void * -+grub_acpi_rsdt_find_table (struct grub_acpi_table_header *rsdt, const char *sig) -+{ -+ grub_size_t s; -+ grub_uint32_t *ptr; -+ -+ if (!rsdt) -+ return 0; -+ -+ if (grub_memcmp (rsdt->signature, "RSDT", 4) != 0) -+ return 0; -+ -+ ptr = (grub_uint32_t *) (rsdt + 1); -+ s = (rsdt->length - sizeof (*rsdt)) / sizeof (grub_uint32_t); -+ for (; s; s--, ptr++) -+ { -+ struct grub_acpi_table_header *tbl; -+ tbl = (struct grub_acpi_table_header *) (grub_addr_t) *ptr; -+ if (grub_memcmp (tbl->signature, sig, 4) == 0) -+ return tbl; -+ } -+ return 0; -+} -+ -+static void * -+grub_acpi_xsdt_find_table (struct grub_acpi_table_header *xsdt, const char *sig) -+{ -+ grub_size_t s; -+ grub_uint64_t *ptr; -+ -+ if (!xsdt) -+ return 0; -+ -+ if (grub_memcmp (xsdt->signature, "XSDT", 4) != 0) -+ return 0; -+ -+ ptr = (grub_uint64_t *) (xsdt + 1); -+ s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint32_t); -+ for (; s; s--, ptr++) -+ { -+ struct grub_acpi_table_header *tbl; -+#if GRUB_CPU_SIZEOF_VOID_P != 8 -+ if (*ptr >> 32) -+ continue; -+#endif -+ tbl = (struct grub_acpi_table_header *) (grub_addr_t) *ptr; -+ if (grub_memcmp (tbl->signature, sig, 4) == 0) -+ return tbl; -+ } -+ return 0; -+} -+ -+struct grub_acpi_fadt * -+grub_acpi_find_fadt (void) -+{ -+ struct grub_acpi_fadt *fadt = 0; -+ struct grub_acpi_rsdp_v10 *rsdpv1; -+ struct grub_acpi_rsdp_v20 *rsdpv2; -+ rsdpv1 = grub_machine_acpi_get_rsdpv1 (); -+ if (rsdpv1) -+ fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *) -+ (grub_addr_t) rsdpv1->rsdt_addr, -+ GRUB_ACPI_FADT_SIGNATURE); -+ if (fadt) -+ return fadt; -+ rsdpv2 = grub_machine_acpi_get_rsdpv2 (); -+ if (rsdpv2) -+ fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *) -+ (grub_addr_t) rsdpv2->rsdpv1.rsdt_addr, -+ GRUB_ACPI_FADT_SIGNATURE); -+ if (fadt) -+ return fadt; -+ if (rsdpv2 -+#if GRUB_CPU_SIZEOF_VOID_P != 8 -+ && !(rsdpv2->xsdt_addr >> 32) -+#endif -+ ) -+ fadt = grub_acpi_xsdt_find_table ((struct grub_acpi_table_header *) -+ (grub_addr_t) rsdpv2->xsdt_addr, -+ GRUB_ACPI_FADT_SIGNATURE); -+ if (fadt) -+ return fadt; -+ return 0; -+} -+ -+int -+grub_tsc_calibrate_from_pmtimer (void) -+{ -+ grub_uint32_t start; -+ grub_uint32_t last; -+ grub_uint32_t cur, end; -+ struct grub_acpi_fadt *fadt; -+ grub_port_t p; -+ grub_uint64_t start_tsc; -+ grub_uint64_t end_tsc; -+ int num_iter = 0; -+ -+ fadt = grub_acpi_find_fadt (); -+ if (!fadt) -+ return 0; -+ p = fadt->pmtimer; -+ if (!p) -+ return 0; -+ -+ start = grub_inl (p) & 0xffffff; -+ last = start; -+ /* It's 3.579545 MHz clock. Wait 1 ms. */ -+ end = start + 3580; -+ start_tsc = grub_get_tsc (); -+ while (1) -+ { -+ cur = grub_inl (p) & 0xffffff; -+ if (cur < last) -+ cur |= 0x1000000; -+ num_iter++; -+ if (cur >= end) -+ { -+ end_tsc = grub_get_tsc (); -+ grub_tsc_rate = grub_divmod64 ((1ULL << 32), end_tsc - start_tsc, 0); -+ return 1; -+ } -+ /* Check for broken PM timer. -+ 50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz) -+ if after this time we still don't have 1 ms on pmtimer, then -+ pmtimer is broken. -+ */ -+ if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) { -+ return 0; -+ } -+ } -+} -Index: grub-2.02~beta2/grub-core/kern/i386/xen/tsc.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/i386/xen/tsc.c -@@ -0,0 +1,40 @@ -+/* kern/i386/tsc.c - x86 TSC time source implementation -+ * Requires Pentium or better x86 CPU that supports the RDTSC instruction. -+ * This module uses the PIT to calibrate the TSC to -+ * real time. -+ * -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2008 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+int -+grub_tsc_calibrate_from_xen (void) -+{ -+ grub_uint64_t t; -+ t = grub_xen_shared_info->vcpu_info[0].time.tsc_to_system_mul; -+ if (grub_xen_shared_info->vcpu_info[0].time.tsc_shift > 0) -+ t <<= grub_xen_shared_info->vcpu_info[0].time.tsc_shift; -+ else -+ t >>= -grub_xen_shared_info->vcpu_info[0].time.tsc_shift; -+ grub_tsc_rate = grub_divmod64 (t, 1000000, 0); -+ return 1; -+} -Index: grub-2.02~beta2/include/grub/acpi.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/acpi.h -+++ grub-2.02~beta2/include/grub/acpi.h -@@ -67,10 +67,14 @@ struct grub_acpi_fadt - grub_uint32_t dsdt_addr; - grub_uint8_t somefields1[20]; - grub_uint32_t pm1a; -- grub_uint8_t somefields2[64]; -+ grub_uint8_t somefields2[8]; -+ grub_uint32_t pmtimer; -+ grub_uint8_t somefields3[32]; -+ grub_uint32_t flags; -+ grub_uint8_t somefields4[16]; - grub_uint64_t facs_xaddr; - grub_uint64_t dsdt_xaddr; -- grub_uint8_t somefields3[96]; -+ grub_uint8_t somefields5[96]; - } GRUB_PACKED; - - #define GRUB_ACPI_MADT_SIGNATURE "APIC" -@@ -176,9 +180,9 @@ enum - #ifndef GRUB_DSDT_TEST - struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void); - struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void); --struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void); --struct grub_acpi_rsdp_v20 *grub_machine_acpi_get_rsdpv2 (void); --grub_uint8_t grub_byte_checksum (void *base, grub_size_t size); -+struct grub_acpi_rsdp_v10 *EXPORT_FUNC(grub_machine_acpi_get_rsdpv1) (void); -+struct grub_acpi_rsdp_v20 *EXPORT_FUNC(grub_machine_acpi_get_rsdpv2) (void); -+grub_uint8_t EXPORT_FUNC(grub_byte_checksum) (void *base, grub_size_t size); - - grub_err_t grub_acpi_create_ebda (void); - -@@ -217,4 +221,7 @@ enum - GRUB_ACPI_EXTOPCODE_BANK_FIELD_OP = 0x87, - }; - -+struct grub_acpi_fadt * -+grub_acpi_find_fadt (void); -+ - #endif /* ! GRUB_ACPI_HEADER */ -Index: grub-2.02~beta2/include/grub/i386/tsc.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/i386/tsc.h -+++ grub-2.02~beta2/include/grub/i386/tsc.h -@@ -20,9 +20,35 @@ - #define KERNEL_CPU_TSC_HEADER 1 - - #include -+#include - - void grub_tsc_init (void); - /* In ms per 2^32 ticks. */ - extern grub_uint32_t EXPORT_VAR(grub_tsc_rate); -+int -+grub_tsc_calibrate_from_xen (void); -+int -+grub_tsc_calibrate_from_efi (void); -+int -+grub_tsc_calibrate_from_pmtimer (void); -+int -+grub_tsc_calibrate_from_pit (void); -+ -+/* Read the TSC value, which increments with each CPU clock cycle. */ -+static __inline grub_uint64_t -+grub_get_tsc (void) -+{ -+ grub_uint32_t lo, hi; -+ grub_uint32_t a,b,c,d; -+ -+ /* The CPUID instruction is a 'serializing' instruction, and -+ avoids out-of-order execution of the RDTSC instruction. */ -+ grub_cpuid (0,a,b,c,d); -+ /* Read TSC value. We cannot use "=A", since this would use -+ %rax on x86_64. */ -+ __asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi)); -+ -+ return (((grub_uint64_t) hi) << 32) | lo; -+} - - #endif /* ! KERNEL_CPU_TSC_HEADER */ diff --git a/0005-grub-fstest-fix-descriptor-leak.patch b/0005-grub-fstest-fix-descriptor-leak.patch deleted file mode 100644 index f89568f..0000000 --- a/0005-grub-fstest-fix-descriptor-leak.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 151c19a42a8ea76395fdb579221198156da9c026 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 22:45:58 +0300 -Subject: [PATCH] grub-fstest: fix descriptor leak - -Found by: Coverity scan. ---- - util/grub-fstest.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -Index: grub-2.02~beta2/util/grub-fstest.c -=================================================================== ---- grub-2.02~beta2.orig/util/grub-fstest.c 2013-12-25 00:40:31.000000000 +0800 -+++ grub-2.02~beta2/util/grub-fstest.c 2015-09-22 17:16:23.177530851 +0800 -@@ -570,12 +570,12 @@ - return 0; - } - real_size = fread (buf, 1, 1024, f); -+ fclose (f); - if (real_size < 0) - { - printf (_("%s: error:"), program_name); - printf (_("cannot read `%s': %s"), arg, strerror (errno)); - printf ("\n"); -- fclose (f); - return 0; - } - grub_zfs_add_key (buf, real_size, 0); diff --git a/0005-i386-fix-TSC-calibration-using-PIT.patch b/0005-i386-fix-TSC-calibration-using-PIT.patch deleted file mode 100644 index 53a68a4..0000000 --- a/0005-i386-fix-TSC-calibration-using-PIT.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a03c1034f6062e69075056c8f31b90e159ce5244 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Tue, 1 Dec 2015 18:49:38 +0300 -Subject: [PATCH] i386: fix TSC calibration using PIT - -Condition was accidentally reversed, so PIT calibration always failed -when PIT was present and always succeeded when PIT was missing, but in -the latter case resulted in absurdly fast clock. - -Reported and tested by Vitaly Kuznetsov ---- - grub-core/kern/i386/tsc_pit.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/i386/tsc_pit.c -+++ grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c -@@ -49,7 +49,7 @@ grub_pit_wait (void) - | GRUB_PIT_SPK_TMR2, - GRUB_PIT_SPEAKER_PORT); - -- if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) { -+ if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00) { - ret = 1; - /* Wait. */ - while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00); diff --git a/aarch64-reloc.patch b/aarch64-reloc.patch deleted file mode 100644 index c625b52..0000000 --- a/aarch64-reloc.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 668add258ff7ffcfdc2c501fe5eb32e53c69b6f4 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Mon, 30 Dec 2013 12:56:19 +0000 -Subject: [PATCH] strip .eh_frame section from arm64-efi kernel - -Fixes grub-mkimage error "relocation 0x105 is not implemented yet." ---- - ChangeLog | 4 ++++ - grub-core/Makefile.core.def | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c916246..42443bc 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -66,7 +66,7 @@ kernel = { - arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; - - arm64_efi_ldflags = '-Wl,-r,-d'; -- arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; -+ arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame'; - - i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; --- -2.1.0 - diff --git a/biendian.patch b/biendian.patch deleted file mode 100644 index 3e4ae60..0000000 --- a/biendian.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 9facac630985467ee1ad40beaed07d50ee18062c Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Fri, 15 Aug 2014 14:39:53 -0300 -Subject: [PATCH 143/143] Suport for bi-endianess in elf file - -* grub-core/kern/elf.c: check and switch endianess with grub_{be,le}_to - cpu functions. -* grub-core/kern/elfXX.c: Likewise. - -Also-by: Tomohiro B Berry ---- - grub-core/kern/elf.c | 60 +++++++++++++++++++++++++++++++++++++++-- - grub-core/kern/elfXX.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 131 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/elf.c b/grub-core/kern/elf.c -index 5f99c43..de90811 100644 ---- a/grub-core/kern/elf.c -+++ b/grub-core/kern/elf.c -@@ -28,6 +28,11 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - -+void grub_elf32_check_endianess (grub_elf_t elf); -+void grub_elf64_check_endianess (grub_elf_t elf); -+grub_err_t grub_elf32_check_version (grub_elf_t elf); -+grub_err_t grub_elf64_check_version (grub_elf_t elf); -+ - /* Check if EHDR is a valid ELF header. */ - static grub_err_t - grub_elf_check_header (grub_elf_t elf) -@@ -38,10 +43,22 @@ grub_elf_check_header (grub_elf_t elf) - || e->e_ident[EI_MAG1] != ELFMAG1 - || e->e_ident[EI_MAG2] != ELFMAG2 - || e->e_ident[EI_MAG3] != ELFMAG3 -- || e->e_ident[EI_VERSION] != EV_CURRENT -- || e->e_version != EV_CURRENT) -+ || e->e_ident[EI_VERSION] != EV_CURRENT) - return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic")); - -+ if (grub_elf_is_elf32 (elf)) -+ { -+ grub_elf32_check_endianess (elf); -+ grub_elf32_check_version (elf); -+ } -+ else if (grub_elf_is_elf64 (elf)) -+ { -+ grub_elf64_check_endianess (elf); -+ grub_elf64_check_version (elf); -+ } -+ else -+ return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic")); -+ - return GRUB_ERR_NONE; - } - -@@ -127,7 +144,20 @@ grub_elf_open (const char *name) - #define grub_elf_is_elfXX grub_elf_is_elf32 - #define grub_elfXX_load_phdrs grub_elf32_load_phdrs - #define ElfXX_Phdr Elf32_Phdr -+#define ElfXX_Ehdr Elf32_Ehdr - #define grub_uintXX_t grub_uint32_t -+#define grub_be_to_halfXX grub_be_to_cpu16 -+#define grub_be_to_wordXX grub_be_to_cpu32 -+#define grub_be_to_addrXX grub_be_to_cpu32 -+#define grub_be_to_offXX grub_be_to_cpu32 -+#define grub_be_to_XwordXX grub_be_to_wordXX -+#define grub_le_to_halfXX grub_le_to_cpu16 -+#define grub_le_to_wordXX grub_le_to_cpu32 -+#define grub_le_to_addrXX grub_le_to_cpu32 -+#define grub_le_to_offXX grub_le_to_cpu32 -+#define grub_le_to_XwordXX grub_le_to_wordXX -+#define grub_elfXX_check_endianess grub_elf32_check_endianess -+#define grub_elfXX_check_version grub_elf32_check_version - - #include "elfXX.c" - -@@ -140,7 +170,20 @@ grub_elf_open (const char *name) - #undef grub_elf_is_elfXX - #undef grub_elfXX_load_phdrs - #undef ElfXX_Phdr -+#undef ElfXX_Ehdr - #undef grub_uintXX_t -+#undef grub_be_to_halfXX -+#undef grub_be_to_wordXX -+#undef grub_be_to_addrXX -+#undef grub_be_to_offXX -+#undef grub_be_to_XwordXX -+#undef grub_le_to_halfXX -+#undef grub_le_to_wordXX -+#undef grub_le_to_addrXX -+#undef grub_le_to_offXX -+#undef grub_le_to_XwordXX -+#undef grub_elfXX_check_endianess -+#undef grub_elfXX_check_version - - - /* 64-bit */ -@@ -153,6 +196,19 @@ grub_elf_open (const char *name) - #define grub_elf_is_elfXX grub_elf_is_elf64 - #define grub_elfXX_load_phdrs grub_elf64_load_phdrs - #define ElfXX_Phdr Elf64_Phdr -+#define ElfXX_Ehdr Elf64_Ehdr - #define grub_uintXX_t grub_uint64_t -+#define grub_be_to_halfXX grub_be_to_cpu16 -+#define grub_be_to_wordXX grub_be_to_cpu32 -+#define grub_be_to_addrXX grub_be_to_cpu64 -+#define grub_be_to_offXX grub_be_to_cpu64 -+#define grub_be_to_XwordXX grub_be_to_cpu64 -+#define grub_le_to_halfXX grub_le_to_cpu16 -+#define grub_le_to_wordXX grub_le_to_cpu32 -+#define grub_le_to_addrXX grub_le_to_cpu64 -+#define grub_le_to_offXX grub_le_to_cpu64 -+#define grub_le_to_XwordXX grub_le_to_cpu64 -+#define grub_elfXX_check_endianess grub_elf64_check_endianess -+#define grub_elfXX_check_version grub_elf64_check_version - - #include "elfXX.c" -diff --git a/grub-core/kern/elfXX.c b/grub-core/kern/elfXX.c -index 1d09971..ecf9df6 100644 ---- a/grub-core/kern/elfXX.c -+++ b/grub-core/kern/elfXX.c -@@ -154,3 +154,76 @@ grub_elfXX_load (grub_elf_t elf, const char *filename, - - return grub_errno; - } -+ -+void -+grub_elfXX_check_endianess (grub_elf_t elf) -+{ -+ ElfXX_Ehdr *e = &(elf->ehdr.ehdrXX); -+ ElfXX_Phdr *phdr; -+ -+ if (e->e_ident[EI_DATA] == ELFDATA2MSB) -+ { -+ e->e_type = grub_be_to_halfXX (e->e_type); -+ e->e_machine = grub_be_to_halfXX (e->e_machine); -+ e->e_version = grub_be_to_wordXX (e->e_version); -+ e->e_entry = grub_be_to_addrXX (e->e_entry); -+ e->e_phoff = grub_be_to_offXX (e->e_phoff); -+ e->e_shoff = grub_be_to_offXX (e->e_shoff); -+ e->e_flags = grub_be_to_wordXX (e->e_flags); -+ e->e_ehsize = grub_be_to_halfXX (e->e_ehsize); -+ e->e_phentsize = grub_be_to_halfXX (e->e_phentsize); -+ e->e_phnum = grub_be_to_halfXX (e->e_phnum); -+ e->e_shentsize = grub_be_to_halfXX (e->e_shentsize); -+ e->e_shnum = grub_be_to_halfXX (e->e_shnum); -+ e->e_shstrndx = grub_be_to_halfXX (e->e_shstrndx); -+ -+ FOR_ELFXX_PHDRS (elf,phdr) -+ { -+ phdr->p_type = grub_be_to_wordXX (phdr->p_type); -+ phdr->p_flags = grub_be_to_wordXX (phdr->p_flags); -+ phdr->p_offset = grub_be_to_offXX (phdr->p_offset); -+ phdr->p_vaddr = grub_be_to_addrXX (phdr->p_vaddr); -+ phdr->p_paddr = grub_be_to_addrXX (phdr->p_paddr); -+ phdr->p_filesz = grub_be_to_XwordXX (phdr->p_filesz); -+ phdr->p_memsz = grub_be_to_XwordXX (phdr->p_memsz); -+ phdr->p_align = grub_be_to_XwordXX (phdr->p_align); -+ } -+ } -+ else if (e->e_ident[EI_DATA] == ELFDATA2LSB) -+ { -+ e->e_type = grub_le_to_halfXX (e->e_type); -+ e->e_machine = grub_le_to_halfXX (e->e_machine); -+ e->e_version = grub_le_to_wordXX (e->e_version); -+ e->e_entry = grub_le_to_addrXX (e->e_entry); -+ e->e_phoff = grub_le_to_offXX (e->e_phoff); -+ e->e_shoff = grub_le_to_offXX (e->e_shoff); -+ e->e_flags = grub_le_to_wordXX (e->e_flags); -+ e->e_ehsize = grub_le_to_halfXX (e->e_ehsize); -+ e->e_phentsize = grub_le_to_halfXX (e->e_phentsize); -+ e->e_phnum = grub_le_to_halfXX (e->e_phnum); -+ e->e_shentsize = grub_le_to_halfXX (e->e_shentsize); -+ e->e_shnum = grub_le_to_halfXX (e->e_shnum); -+ e->e_shstrndx = grub_le_to_halfXX (e->e_shstrndx); -+ -+ FOR_ELFXX_PHDRS (elf,phdr) -+ { -+ phdr->p_type = grub_le_to_wordXX (phdr->p_type); -+ phdr->p_flags = grub_le_to_wordXX (phdr->p_flags); -+ phdr->p_offset = grub_le_to_offXX (phdr->p_offset); -+ phdr->p_vaddr = grub_le_to_addrXX (phdr->p_vaddr); -+ phdr->p_paddr = grub_le_to_addrXX (phdr->p_paddr); -+ phdr->p_filesz = grub_le_to_XwordXX (phdr->p_filesz); -+ phdr->p_memsz = grub_le_to_XwordXX (phdr->p_memsz); -+ phdr->p_align = grub_le_to_XwordXX (phdr->p_align); -+ } -+ } -+} -+ -+grub_err_t -+grub_elfXX_check_version (grub_elf_t elf) -+{ -+ if (elf->ehdr.ehdrXX.e_version != EV_CURRENT) -+ return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic")); -+ -+ return GRUB_ERR_NONE; -+} --- -1.9.3 diff --git a/grub-2.02~beta2.tar.xz b/grub-2.02~beta2.tar.xz deleted file mode 100644 index 793b10a..0000000 --- a/grub-2.02~beta2.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f6c702b2a8ea58f27a2b02928bb77973cb5a827af08f63db38c471c0a01b418d -size 5798740 diff --git a/grub-2.02~beta3.tar.xz b/grub-2.02~beta3.tar.xz new file mode 100644 index 0000000..2c233ea --- /dev/null +++ b/grub-2.02~beta3.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30ec3d555e52a702c3eef449872ef874eff28b320f40b55ffc47f70db8e5ada1 +size 6030784 diff --git a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch b/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch index 859e688..309138d 100644 --- a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch +++ b/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch @@ -21,7 +21,7 @@ Index: grub-2.02~beta2/util/grub-mkconfig.in =================================================================== --- grub-2.02~beta2.orig/util/grub-mkconfig.in +++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -224,7 +224,8 @@ export GRUB_DEFAULT \ +@@ -227,7 +227,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ @@ -35,7 +35,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in =================================================================== --- grub-2.02~beta2.orig/util/grub.d/10_linux.in +++ grub-2.02~beta2/util/grub.d/10_linux.in -@@ -238,7 +238,7 @@ while [ "x$list" != "x" ] ; do +@@ -240,7 +240,7 @@ while [ "x$list" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ @@ -43,4 +43,4 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_RECOVERY}" fi - list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` + list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` diff --git a/grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch b/grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch deleted file mode 100644 index 03923aa..0000000 --- a/grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch +++ /dev/null @@ -1,134 +0,0 @@ -From c1be7e90be547f6e3f2d7a5c0519f2efa31f495b Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 17 Sep 2014 16:30:11 -0400 -Subject: [PATCH] Initialized initrd_ctx so we don't free a random pointer from - the stack. - -Currently, if "linux" fails, the "goto fail;" in grub_cmd_initrd sends us -into grub_initrd_close() without grub_initrd_init() being called, and thus -it never clears initrd_ctx->components. grub_initrd_close() then frees that -address, which is stale data from the stack. If the stack happens to have a -stale *address* there that matches a recent allocation, then you'll get a -double free later. - -So initialize the memory up front. - -Signed-off-by: Peter Jones ---- - grub-core/loader/arm/linux.c | 2 +- - grub-core/loader/arm64/linux.c | 2 +- - grub-core/loader/i386/linux.c | 2 +- - grub-core/loader/i386/pc/linux.c | 2 +- - grub-core/loader/ia64/efi/linux.c | 2 +- - grub-core/loader/mips/linux.c | 2 +- - grub-core/loader/powerpc/ieee1275/linux.c | 2 +- - grub-core/loader/sparc64/ieee1275/linux.c | 2 +- - 8 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c -index e6770d9..62cbe75 100644 ---- a/grub-core/loader/arm/linux.c -+++ b/grub-core/loader/arm/linux.c -@@ -396,7 +396,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_file_t file; - grub_size_t size = 0; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index f1d10a1..0dc144e 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -328,7 +328,7 @@ static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - int initrd_size, initrd_pages; - void *initrd_mem = NULL; - -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 31fb91e..2ae1763 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -1050,7 +1050,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_addr_t addr_min, addr_max; - grub_addr_t addr; - grub_err_t err; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - { -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 672c013..b481e46 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -388,7 +388,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_uint8_t *initrd_chunk; - grub_addr_t initrd_addr; - grub_err_t err; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - { -diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c -index 87ac49f..eb78e6e 100644 ---- a/grub-core/loader/ia64/efi/linux.c -+++ b/grub-core/loader/ia64/efi/linux.c -@@ -568,7 +568,7 @@ static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - { -diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c -index ef64a5b..4a3e8c5 100644 ---- a/grub-core/loader/mips/linux.c -+++ b/grub-core/loader/mips/linux.c -@@ -415,7 +415,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - void *initrd_src; - grub_addr_t initrd_dest; - grub_err_t err; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c -index 4a14f66..787d7dc 100644 ---- a/grub-core/loader/powerpc/ieee1275/linux.c -+++ b/grub-core/loader/powerpc/ieee1275/linux.c -@@ -333,7 +333,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_size_t size = 0; - grub_addr_t first_addr; - grub_addr_t addr; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - { -diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c -index de6ee2f..c5e8dfa 100644 ---- a/grub-core/loader/sparc64/ieee1275/linux.c -+++ b/grub-core/loader/sparc64/ieee1275/linux.c -@@ -373,7 +373,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_addr_t paddr; - grub_addr_t addr; - int ret; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, }; - - if (argc == 0) - { --- -1.8.4.5 - diff --git a/grub2-arm64-Reduce-timer-event-frequency-by-10.patch b/grub2-arm64-Reduce-timer-event-frequency-by-10.patch deleted file mode 100644 index 051a4ae..0000000 --- a/grub2-arm64-Reduce-timer-event-frequency-by-10.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 3aed1012cb8f559a0241569d6ec6b1be23844b05 Mon Sep 17 00:00:00 2001 -From: Mark Salter -Date: Thu, 20 Feb 2014 12:54:52 -0500 -Subject: [PATCH 139/152] Reduce timer event frequency by 10 - -Timer event to keep grub msec counter was running at 1000HZ. This was too -fast for UEFI timer driver and resulted in a 10x slowdown in grub time -versus wallclock. Reduce the timer event frequency and increase tick -increment accordingly to keep better time. - -Signed-off-by: Mark Salter ---- - grub-core/kern/arm/efi/init.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c -index a6ae034..0c17d83 100644 ---- a/grub-core/kern/arm/efi/init.c -+++ b/grub-core/kern/arm/efi/init.c -@@ -38,7 +38,7 @@ static void - increment_timer (grub_efi_event_t event __attribute__ ((unused)), - void *context __attribute__ ((unused))) - { -- tmr++; -+ tmr += 10; - } - - void -@@ -52,7 +52,7 @@ grub_machine_init (void) - - efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL, - GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt); -- efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 10000); -+ efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000); - - grub_install_get_time_ms (grub_efi_get_time_ms); - } --- -1.9.3 - diff --git a/grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch b/grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch deleted file mode 100644 index be8ad0b..0000000 --- a/grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 4fe8e6d4a1279b1840171d8e797d911cd8443333 Mon Sep 17 00:00:00 2001 -From: Josef Bacik -Date: Thu, 6 Aug 2015 10:49:46 -0700 -Subject: [PATCH] efinet: handle get_status() on buggy firmware properly - -The EFI spec indicates that get_status() should return the address of the buffer -we passed into transmit to indicate the the buffer was transmitted. However we -have boxes where the firmware returns some arbitrary address instead, which -makes grub think that we've not sent anything. So since we have the SNP stuff -opened in exclusive mode just assume any non-NULL txbuf means that our transmit -occurred properly. This makes grub able to do its networking stuff properly on -our broken firmware. Thanks, - -cc: Peter Jones -Signed-off-by: Josef Bacik ---- - grub-core/net/drivers/efi/efinet.c | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 70b26af..5388f95 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -47,19 +47,19 @@ send_card_buffer (struct grub_net_card *dev, - if (st != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_IO, - N_("couldn't send network packet")); -- if (txbuf == dev->txbuf) -+ /* -+ Some buggy firmware could return an arbitrary address instead of the -+ txbuf address we trasmitted, so just check that txbuf is non NULL -+ for success. This is ok because we open the SNP protocol in -+ exclusive mode so we know we're the only ones transmitting on this -+ box and since we only transmit one packet at a time we know our -+ transmit was successfull. -+ */ -+ if (txbuf) - { - 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")); -@@ -84,8 +84,9 @@ send_card_buffer (struct grub_net_card *dev, - we run in the GRUB_ERR_TIMEOUT case above. - Perhaps a timeout in the FW has discarded the recycle buffer. - */ -+ txbuf = NULL; - st = efi_call_3 (net->get_status, net, 0, &txbuf); -- dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf == dev->txbuf); -+ dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf); - - return GRUB_ERR_NONE; - } --- -2.5.1 - diff --git a/grub2-arm64-set-correct-length.patch b/grub2-arm64-set-correct-length.patch deleted file mode 100644 index c347407..0000000 --- a/grub2-arm64-set-correct-length.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4d21c1019904598a991e847eef049c65f9c49bd9 Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Tue, 7 Jan 2014 17:52:50 +0000 -Subject: [PATCH] arm64: set correct length of device path end entry - -The length of the Device Path End entry in the grub_linux_boot() -function was incorrectly set to 0. This triggers an assert failure -in debug builds of Tianocore. - -Set it to sizeof (grub_efi_device_path_t). ---- - ChangeLog | 4 ++++ - grub-core/loader/arm64/linux.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 9d15aad..75ad871 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -268,7 +268,7 @@ grub_linux_boot (void) - - mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE; - mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -- mempath[1].header.length = 0; -+ mempath[1].header.length = sizeof (grub_efi_device_path_t); - - b = grub_efi_system_table->boot_services; - status = b->load_image (0, grub_efi_image_handle, --- -2.3.2 - diff --git a/grub2-arm64-setjmp-Add-missing-license-macro.patch b/grub2-arm64-setjmp-Add-missing-license-macro.patch deleted file mode 100644 index a121f32..0000000 --- a/grub2-arm64-setjmp-Add-missing-license-macro.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3ac342205dc81293bb8e2d91b8c5ebe124b4ad35 Mon Sep 17 00:00:00 2001 -From: dann frazier -Date: Thu, 21 May 2015 10:28:48 -0600 -Subject: [PATCH 1/2] arm64/setjmp: Add missing license macro - -Including the setjmp module in an arm64-efi image will cause it to -immediately exit with an "incompatible license" error. - -The source file includes a GPLv3+ boilerplate, so fix this by declaring a -GPLv3+ license using the GRUB_MOD_LICENSE macro. - -Signed-off-by: dann frazier ---- - grub-core/lib/arm64/setjmp.S | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/lib/arm64/setjmp.S b/grub-core/lib/arm64/setjmp.S -index adaafe4..eabfd99 100644 ---- a/grub-core/lib/arm64/setjmp.S -+++ b/grub-core/lib/arm64/setjmp.S -@@ -17,8 +17,10 @@ - */ - - #include -+#include - - .file "setjmp.S" -+GRUB_MOD_LICENSE "GPLv3+" - .text - - /* --- -2.4.1 - diff --git a/grub2-btrfs-04-grub2-install.patch b/grub2-btrfs-04-grub2-install.patch index 0006c02..35ddf8f 100644 --- a/grub2-btrfs-04-grub2-install.patch +++ b/grub2-btrfs-04-grub2-install.patch @@ -26,8 +26,8 @@ Index: grub-2.02~beta2/grub-core/osdep/unix/config.c *ptr++ = *iptr; } -- strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\", " -- "\"$GRUB_ENABLE_CRYPTODISK\", \"$GRUB_DISTRIBUTOR\""); +- strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" " +- "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\""); + strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\nSUSE_BTRFS_SNAPSHOT_BOOTING=%s\\n\" " + "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\" \"$SUSE_BTRFS_SNAPSHOT_BOOTING\""); @@ -70,7 +70,7 @@ Index: grub-2.02~beta2/util/grub-install.c =================================================================== --- grub-2.02~beta2.orig/util/grub-install.c +++ grub-2.02~beta2/util/grub-install.c -@@ -816,6 +816,8 @@ fill_core_services (const char *core_ser +@@ -828,6 +828,8 @@ fill_core_services (const char *core_ser free (sysv_plist); } @@ -79,7 +79,7 @@ Index: grub-2.02~beta2/util/grub-install.c int main (int argc, char *argv[]) { -@@ -849,6 +851,9 @@ main (int argc, char *argv[]) +@@ -861,6 +863,9 @@ main (int argc, char *argv[]) grub_util_load_config (&config); @@ -89,7 +89,7 @@ Index: grub-2.02~beta2/util/grub-install.c if (!bootloader_id && config.grub_distributor) { char *ptr; -@@ -1334,6 +1339,16 @@ main (int argc, char *argv[]) +@@ -1346,6 +1351,16 @@ main (int argc, char *argv[]) fprintf (load_cfg_f, "set debug='%s'\n", debug_image); } @@ -110,15 +110,15 @@ Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c =================================================================== --- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c +++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -364,6 +364,7 @@ get_btrfs_fs_prefix (const char *mount_p - return ret; +@@ -370,6 +370,7 @@ get_btrfs_fs_prefix (const char *mount_p + return NULL; } +int use_relative_path_on_btrfs = 0; char ** grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) -@@ -502,6 +503,12 @@ grub_find_root_devices_from_mountinfo (c +@@ -508,6 +509,12 @@ grub_find_root_devices_from_mountinfo (c { ret = grub_find_root_devices_from_btrfs (dir); fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); diff --git a/grub2-btrfs-05-grub2-mkconfig.patch b/grub2-btrfs-05-grub2-mkconfig.patch index 2a7a417..224e464 100644 --- a/grub2-btrfs-05-grub2-mkconfig.patch +++ b/grub2-btrfs-05-grub2-mkconfig.patch @@ -28,7 +28,7 @@ Index: grub-2.02~beta2/util/grub.d/00_header.in +++ grub-2.02~beta2/util/grub.d/00_header.in @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" - . "@datadir@/@PACKAGE@/grub-mkconfig_lib" + . "$pkgdatadir/grub-mkconfig_lib" +if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && + [ "x${GRUB_FS}" = "xbtrfs" ] ; then @@ -72,7 +72,7 @@ Index: grub-2.02~beta2/util/grub-mkconfig.in =================================================================== --- grub-2.02~beta2.orig/util/grub-mkconfig.in +++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -255,7 +255,8 @@ export GRUB_DEFAULT \ +@@ -262,7 +262,8 @@ export GRUB_DEFAULT \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ GRUB_CMDLINE_LINUX_RECOVERY \ @@ -101,7 +101,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in fi;; xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` -@@ -237,7 +241,12 @@ while [ "x$list" != "x" ] ; do +@@ -236,7 +240,12 @@ while [ "x$list" != "x" ] ; do if [ $PLATFORM != "emu" ]; then hotkey=0 else diff --git a/grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch b/grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch deleted file mode 100644 index c2352ed..0000000 --- a/grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4afd0107efa6a2d9cbe6fc71c529264dc2b9fb8a Mon Sep 17 00:00:00 2001 -From: Thomas Falcon -Date: Mon, 31 Mar 2014 15:32:30 +0100 -Subject: [PATCH] btrfs: fix get_root key comparison failures due to endianness - -* grub-core/fs/btrfs.c (get_root): Convert -GRUB_BTRFS_ROOT_VOL_OBJECTID to little-endian. ---- - ChangeLog | 7 +++++++ - grub-core/fs/btrfs.c | 2 +- - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 89666b6..f7b6c15 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -1201,7 +1201,7 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, - struct grub_btrfs_key key_out, key_in; - struct grub_btrfs_root_item ri; - -- key_in.object_id = GRUB_BTRFS_ROOT_VOL_OBJECTID; -+ key_in.object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_ROOT_VOL_OBJECTID); - key_in.offset = 0; - key_in.type = GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM; - err = lower_bound (data, &key_in, &key_out, --- -1.8.4.5 - diff --git a/grub2-btrfs-fix-incorrect-address-reference.patch b/grub2-btrfs-fix-incorrect-address-reference.patch deleted file mode 100644 index 716d87c..0000000 --- a/grub2-btrfs-fix-incorrect-address-reference.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: grub-2.02~beta2/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/fs/btrfs.c -+++ grub-2.02~beta2/grub-core/fs/btrfs.c -@@ -1051,7 +1051,7 @@ grub_btrfs_extent_read (struct grub_btrf - - data->extend = data->extstart + grub_le_to_cpu64 (data->extent->size); - if (data->extent->type == GRUB_BTRFS_EXTENT_REGULAR -- && (char *) &data->extent + elemsize -+ && (char *) data->extent + elemsize - >= (char *) &data->extent->filled + sizeof (data->extent->filled)) - data->extend = - data->extstart + grub_le_to_cpu64 (data->extent->filled); diff --git a/grub2-efi-HP-workaround.patch b/grub2-efi-HP-workaround.patch index aa73a6a..5b53090 100644 --- a/grub2-efi-HP-workaround.patch +++ b/grub2-efi-HP-workaround.patch @@ -78,16 +78,16 @@ Index: grub-2.02~beta2/grub-core/kern/efi/init.c void grub_machine_get_bootlocation (char **device, char **path) -@@ -67,6 +129,12 @@ grub_machine_get_bootlocation (char **de - p = grub_strrchr (*path, '/'); - if (p) - *p = '\0'; +@@ -69,6 +131,12 @@ grub_machine_get_bootlocation (char **de + p = grub_strrchr (*path, '/'); + if (p) + *p = '\0'; + -+ if ((p = workaround_efi_firmware_path (*device, *path))) -+ { -+ grub_free (*path); -+ *path = p; -+ } ++ if ((p = workaround_efi_firmware_path (*device, *path))) ++ { ++ grub_free (*path); ++ *path = p; ++ } + } } - void diff --git a/grub2-efi-xen-chainload.patch b/grub2-efi-xen-chainload.patch index 03d0e49..298b40e 100644 --- a/grub2-efi-xen-chainload.patch +++ b/grub2-efi-xen-chainload.patch @@ -34,7 +34,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in +ME=$(basename $0) + - . "@datadir@/@PACKAGE@/grub-mkconfig_lib" + . "$pkgdatadir/grub-mkconfig_lib" export TEXTDOMAIN=@PACKAGE@ @@ -36,9 +38,11 @@ CLASS="--class gnu-linux --class gnu --c @@ -152,7 +152,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in if [ x"$is_top_level" != xtrue ]; then echo ' }' fi -- xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '` +- xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '` done # If at least one kernel was found, then we need to diff --git a/grub2-fix-menu-in-xen-host-server.patch b/grub2-fix-menu-in-xen-host-server.patch index 82c6543..895abdf 100644 --- a/grub2-fix-menu-in-xen-host-server.patch +++ b/grub2-fix-menu-in-xen-host-server.patch @@ -33,8 +33,8 @@ Index: grub-2.02~beta2/util/grub-mkconfig_lib.in +++ grub-2.02~beta2/util/grub-mkconfig_lib.in @@ -248,6 +248,11 @@ version_test_gt () *.old:*.old) ;; - *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; - *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; + *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; + *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; +# bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected +# The dbg version should be placed after release version + dbg-*:dbg-*) ;; @@ -60,11 +60,14 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in CLASS="--class gnu-linux --class gnu --class os --class xen" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then -@@ -165,9 +171,17 @@ file_is_not_sym () { +@@ -166,10 +172,18 @@ file_is_not_sym () { esac } --xen_list=`for i in /boot/xen*; do +-xen_list= +-for i in /boot/xen*; do +- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi +-done +# bnc#877040 - Duplicate entries for boot menu created +# only create /boot/xen.gz symlink boot entry +if test -L /boot/xen.gz; then @@ -72,10 +75,10 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in +else + # bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected + # wildcard expasion with correct suffix (.gz) for not generating many duplicated menu entries -+ xen_list=`for i in /boot/xen*.gz; do - if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi -- done` -+ done` ++ xen_list= ++ for i in /boot/xen*.gz; do ++ if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi ++ done +fi prepare_boot_cache= boot_device_id= @@ -84,7 +87,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in =================================================================== --- grub-2.02~beta2.orig/util/grub.d/10_linux.in +++ grub-2.02~beta2/util/grub.d/10_linux.in -@@ -207,6 +207,40 @@ while [ "x$list" != "x" ] ; do +@@ -209,6 +209,40 @@ while [ "x$list" != "x" ] ; do fi done diff --git a/grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch b/grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch deleted file mode 100644 index 2858d09..0000000 --- a/grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch +++ /dev/null @@ -1,25 +0,0 @@ -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -324,9 +324,9 @@ get_btrfs_fs_prefix (const char *mount_p - - tree_id = sargs.buf[2]; - br = (struct grub_btrfs_root_backref *) (sargs.buf + 4); -- inode_id = br->inode_id; -+ inode_id = grub_le_to_cpu64 (br->inode_id); - name = br->name; -- namelen = br->n; -+ namelen = grub_le_to_cpu16 (br->n); - } - else - { -@@ -353,7 +353,7 @@ get_btrfs_fs_prefix (const char *mount_p - - ir = (struct grub_btrfs_inode_ref *) (sargs.buf + 4); - name = ir->name; -- namelen = ir->n; -+ namelen = grub_le_to_cpu16 (ir->n); - } - old = ret; - ret = xmalloc (namelen + (old ? strlen (old) : 0) + 2); diff --git a/grub2-getroot-support-NVMe-device-names.patch b/grub2-getroot-support-NVMe-device-names.patch deleted file mode 100644 index 5d94d9b..0000000 --- a/grub2-getroot-support-NVMe-device-names.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 9706066791b994a55fb2d3d532a86aa1fde2a457 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 3 Apr 2014 21:31:12 +0200 -Subject: [PATCH] * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe device names. -References: bnc#873132 - ---- - -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -883,6 +883,23 @@ grub_util_part_to_disk (const char *os_d - *pp = '\0'; - return path; - } -+ -+ /* If this is a NVMe device */ -+ if ((strncmp ("nvme", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') -+ { -+ char *pp = p + 4; -+ while (*pp >= '0' && *pp <= '9') -+ pp++; -+ if (*pp == 'n') -+ pp++; -+ while (*pp >= '0' && *pp <= '9') -+ pp++; -+ if (*pp == 'p') -+ *is_part = 1; -+ /* /dev/nvme[0-9]+n[0-9]+p[0-9]* */ -+ *pp = '\0'; -+ return path; -+ } - } - - return path; diff --git a/grub2-glibc-2.20.patch b/grub2-glibc-2.20.patch deleted file mode 100644 index cd81e3a..0000000 --- a/grub2-glibc-2.20.patch +++ /dev/null @@ -1,34 +0,0 @@ -* grub-core/kern/emu/hostfs.c: squahes below warning - warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" - -Signed-off-by: Khem Raj - -Upstream-Status: Submitted ---- - grub-core/kern/emu/hostfs.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c -index 7e725f6..823116d 100644 ---- a/grub-core/kern/emu/hostfs.c -+++ b/grub-core/kern/emu/hostfs.c -@@ -19,7 +19,11 @@ - - #include - -+/* Legacy feature macro.*/ - #define _BSD_SOURCE -+/* New feature macro that provides everything _BSD_SOURCE and -+ * _SVID_SOURCE provided and possibly more. */ -+#define _DEFAULT_SOURCE - #include - #include - #include --- -2.1.0 - - -_______________________________________________ -Grub-devel mailing list -Grub-devel@gnu.org -https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/grub2-mkconfig-aarch64.patch b/grub2-mkconfig-aarch64.patch index ad304aa..c105797 100644 --- a/grub2-mkconfig-aarch64.patch +++ b/grub2-mkconfig-aarch64.patch @@ -6,9 +6,9 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in +++ grub-2.02~beta2/util/grub.d/10_linux.in @@ -190,6 +190,7 @@ EOF machine=`uname -m` - case "$machine" in - i?86 | x86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; -+ aarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; - s390 | s390x) klist="/boot/image-* /boot/kernel-*" ;; + case "x$machine" in + xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; ++ xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; + xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ /boot/kernel-*" ;; diff --git a/grub2-netboot-hang.patch b/grub2-netboot-hang.patch deleted file mode 100644 index cf8d096..0000000 --- a/grub2-netboot-hang.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: grub-2.02~beta2/grub-core/net/net.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/net/net.c -+++ grub-2.02~beta2/grub-core/net/net.c -@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *c - } - card->opened = 1; - } -- while (1) -+ while (received < 100) - { - /* Maybe should be better have a fixed number of packets for each card - and just mark them as used and not used. */ diff --git a/grub2-ppc64-cas-reboot-support.patch b/grub2-ppc64-cas-reboot-support.patch index c053653..422dd2a 100644 --- a/grub2-ppc64-cas-reboot-support.patch +++ b/grub2-ppc64-cas-reboot-support.patch @@ -26,9 +26,9 @@ parameters Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/ieee1275/openfw.c -+++ grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c -@@ -561,3 +561,65 @@ grub_ieee1275_canonicalise_devname (cons +--- grub-2.02~beta2.orig/grub-core/kern/ieee1275/openfw.c 2016-01-29 23:08:47.560532720 +0300 ++++ grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c 2016-01-29 23:08:47.556532720 +0300 +@@ -590,3 +590,65 @@ return NULL; } @@ -96,19 +96,19 @@ Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c +} Index: grub-2.02~beta2/grub-core/normal/main.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/normal/main.c -+++ grub-2.02~beta2/grub-core/normal/main.c -@@ -32,6 +32,9 @@ - #include +--- grub-2.02~beta2.orig/grub-core/normal/main.c 2016-01-29 23:08:47.560532720 +0300 ++++ grub-2.02~beta2/grub-core/normal/main.c 2016-01-29 23:09:59.812533575 +0300 +@@ -33,6 +33,9 @@ #include #include + #include +#ifdef GRUB_MACHINE_IEEE1275 +#include +#endif GRUB_MOD_LICENSE ("GPLv3+"); -@@ -267,6 +270,21 @@ grub_normal_execute (const char *config, +@@ -275,6 +278,21 @@ { menu = read_config_file (config); @@ -132,8 +132,8 @@ Index: grub-2.02~beta2/grub-core/normal/main.c } Index: grub-2.02~beta2/grub-core/script/execute.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/script/execute.c -+++ grub-2.02~beta2/grub-core/script/execute.c +--- grub-2.02~beta2.orig/grub-core/script/execute.c 2016-01-29 23:08:47.560532720 +0300 ++++ grub-2.02~beta2/grub-core/script/execute.c 2016-01-29 23:08:47.560532720 +0300 @@ -27,6 +27,9 @@ #include #include @@ -144,7 +144,7 @@ Index: grub-2.02~beta2/grub-core/script/execute.c /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -861,6 +864,10 @@ grub_script_execute_sourcecode (const ch +@@ -877,6 +880,10 @@ grub_err_t ret = 0; struct grub_script *parsed_script; @@ -157,9 +157,9 @@ Index: grub-2.02~beta2/grub-core/script/execute.c char *line; Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h -+++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h -@@ -234,6 +234,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_n +--- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h 2016-01-29 23:08:47.560532720 +0300 ++++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h 2016-01-29 23:08:47.560532720 +0300 +@@ -242,6 +242,8 @@ void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias); void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, struct grub_ieee1275_devalias *alias); diff --git a/grub2-ppc64-qemu.patch b/grub2-ppc64-qemu.patch deleted file mode 100644 index 1522447..0000000 --- a/grub2-ppc64-qemu.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 90f6eed0b4ffdfe361c2966e62fcb8ed11b528bc Mon Sep 17 00:00:00 2001 -From: Nikunj A Dadhania -Date: Thu, 20 Mar 2014 16:39:29 +0530 -Subject: [PATCH] ieee1275: check for IBM pseries emulated machine - -As there is no check for IBM pSeries qemu machine, is_qemu is not -set. So feature like GRUB_IEEE1275_FLAG_HAS_CURSORONOFF is not -enabled. This results in cursor not being displayed during the -grub-menu. - -Signed-off-by: Nikunj A Dadhania ---- - grub-core/kern/ieee1275/cmain.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index d92ae14..3e12e6b 100644 ---- a/grub-core/kern/ieee1275/cmain.c -+++ b/grub-core/kern/ieee1275/cmain.c -@@ -84,8 +84,10 @@ grub_ieee1275_find_options (void) - - rc = grub_ieee1275_get_property (root, "model", - tmp, sizeof (tmp), 0); -- if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC")) -+ if (rc >= 0 && (!grub_strcmp (tmp, "Emulated PC") -+ || !grub_strcmp (tmp, "IBM pSeries (emulated by qemu)"))) { - is_qemu = 1; -+ } - - if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0) - grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS); --- -1.8.3.1 diff --git a/grub2-s390x-02-kexec-module-added-to-emu.patch b/grub2-s390x-02-kexec-module-added-to-emu.patch index fd97f6e..0e60963 100644 --- a/grub2-s390x-02-kexec-module-added-to-emu.patch +++ b/grub2-s390x-02-kexec-module-added-to-emu.patch @@ -11,12 +11,12 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def =================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1674,9 +1674,9 @@ module = { +--- grub-2.02~beta2.orig/grub-core/Makefile.core.def 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/grub-core/Makefile.core.def 2016-01-29 22:59:52.240526390 +0300 +@@ -1667,9 +1667,9 @@ + ia64_efi = loader/ia64/efi/linux.c; arm = loader/arm/linux.c; arm64 = loader/arm64/linux.c; - fdt = lib/fdt.c; + emu = loader/emu/linux.c; common = loader/linux.c; common = lib/cmdline.c; @@ -26,8 +26,8 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def module = { Index: grub-2.02~beta2/grub-core/loader/emu/linux.c =================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/loader/emu/linux.c +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ grub-2.02~beta2/grub-core/loader/emu/linux.c 2016-01-29 22:59:52.240526390 +0300 @@ -0,0 +1,173 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -204,8 +204,8 @@ Index: grub-2.02~beta2/grub-core/loader/emu/linux.c +} Index: grub-2.02~beta2/include/grub/emu/hostfile.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/hostfile.h -+++ grub-2.02~beta2/include/grub/emu/hostfile.h +--- grub-2.02~beta2.orig/include/grub/emu/hostfile.h 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/include/grub/emu/hostfile.h 2016-01-29 22:59:52.240526390 +0300 @@ -22,6 +22,7 @@ #include #include @@ -214,7 +214,7 @@ Index: grub-2.02~beta2/include/grub/emu/hostfile.h #include int -@@ -29,7 +30,7 @@ grub_util_is_directory (const char *path +@@ -29,7 +30,7 @@ int grub_util_is_special_file (const char *path); int @@ -225,8 +225,8 @@ Index: grub-2.02~beta2/include/grub/emu/hostfile.h grub_util_path_concat (size_t n, ...); Index: grub-2.02~beta2/include/grub/emu/exec.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/exec.h -+++ grub-2.02~beta2/include/grub/emu/exec.h +--- grub-2.02~beta2.orig/include/grub/emu/exec.h 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/include/grub/emu/exec.h 2016-01-29 22:59:52.240526390 +0300 @@ -23,6 +23,8 @@ #include @@ -236,7 +236,7 @@ Index: grub-2.02~beta2/include/grub/emu/exec.h pid_t grub_util_exec_pipe (const char *const *argv, int *fd); pid_t -@@ -32,7 +34,7 @@ int +@@ -32,7 +34,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, const char *stdout_file, const char *stderr_file); int @@ -247,9 +247,9 @@ Index: grub-2.02~beta2/include/grub/emu/exec.h const char *stdout_file); Index: grub-2.02~beta2/grub-core/Makefile.am =================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.am -+++ grub-2.02~beta2/grub-core/Makefile.am -@@ -243,6 +243,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc +--- grub-2.02~beta2.orig/grub-core/Makefile.am 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/grub-core/Makefile.am 2016-01-29 22:59:52.240526390 +0300 +@@ -258,6 +258,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h @@ -259,9 +259,9 @@ Index: grub-2.02~beta2/grub-core/Makefile.am endif Index: grub-2.02~beta2/grub-core/kern/emu/main.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/main.c -+++ grub-2.02~beta2/grub-core/kern/emu/main.c -@@ -95,6 +95,7 @@ static struct argp_option options[] = { +--- grub-2.02~beta2.orig/grub-core/kern/emu/main.c 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/grub-core/kern/emu/main.c 2016-01-29 22:59:52.240526390 +0300 +@@ -106,6 +106,7 @@ N_("use GRUB files in the directory DIR [default=%s]"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, {"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0}, @@ -269,7 +269,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/main.c { 0, 0, 0, 0, 0, 0 } }; -@@ -148,6 +149,9 @@ argp_parser (int key, char *arg, struct +@@ -163,6 +164,9 @@ case 'v': verbosity++; break; @@ -281,9 +281,9 @@ Index: grub-2.02~beta2/grub-core/kern/emu/main.c { Index: grub-2.02~beta2/grub-core/kern/emu/misc.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/misc.c -+++ grub-2.02~beta2/grub-core/kern/emu/misc.c -@@ -38,6 +38,7 @@ +--- grub-2.02~beta2.orig/grub-core/kern/emu/misc.c 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/grub-core/kern/emu/misc.c 2016-01-29 22:59:52.240526390 +0300 +@@ -37,6 +37,7 @@ #include int verbosity; @@ -291,7 +291,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c void grub_util_warn (const char *fmt, ...) -@@ -81,7 +82,7 @@ grub_util_error (const char *fmt, ...) +@@ -80,7 +81,7 @@ vfprintf (stderr, fmt, ap); va_end (ap); fprintf (stderr, ".\n"); @@ -300,7 +300,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c } void * -@@ -138,6 +139,9 @@ xasprintf (const char *fmt, ...) +@@ -138,6 +139,9 @@ void grub_exit (void) { @@ -309,10 +309,10 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c +#endif exit (1); } + #endif +@@ -199,3 +203,15 @@ -@@ -150,3 +154,15 @@ grub_get_time_ms (void) - - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); + fclose (fp); } + +void @@ -328,15 +328,15 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c +} Index: grub-2.02~beta2/include/grub/emu/misc.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/misc.h -+++ grub-2.02~beta2/include/grub/emu/misc.h -@@ -59,6 +59,9 @@ void EXPORT_FUNC(grub_util_warn) (const - void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); - void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn)); +--- grub-2.02~beta2.orig/include/grub/emu/misc.h 2016-01-29 22:59:52.244526390 +0300 ++++ grub-2.02~beta2/include/grub/emu/misc.h 2016-01-29 22:59:52.240526390 +0300 +@@ -60,6 +60,9 @@ + void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); + void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2), noreturn)); +void EXPORT_FUNC(grub_util_set_kexecute) (void); +int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; + grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); - extern char * canonicalize_file_name (const char *path); + #ifdef HAVE_DEVICE_MAPPER diff --git a/grub2-s390x-04-grub2-install.patch b/grub2-s390x-04-grub2-install.patch index 3145d78..5fc632e 100644 --- a/grub2-s390x-04-grub2-install.patch +++ b/grub2-s390x-04-grub2-install.patch @@ -81,7 +81,7 @@ Index: grub-2.02~beta2/Makefile.util.def @@ -385,6 +387,7 @@ program = { ldadd = libgrubkern.a; ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)'; + ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + emu_condition = COND_NOT_s390x; }; @@ -94,16 +94,7 @@ Index: grub-2.02~beta2/Makefile.util.def }; data = { -@@ -620,7 +624,7 @@ program = { - common = grub-core/disk/host.c; - - common = util/resolve.c; -- enable = noemu; -+ emu_condition = COND_s390x; - common = grub-core/kern/emu/argp_common.c; - common = grub-core/osdep/init.c; - -@@ -688,6 +692,38 @@ script = { +@@ -687,6 +691,38 @@ script = { }; script = { @@ -142,7 +133,7 @@ Index: grub-2.02~beta2/Makefile.util.def name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; installdir = noinst; -@@ -1281,6 +1317,7 @@ program = { +@@ -1282,6 +1318,7 @@ program = { ldadd = libgrubkern.a; ldadd = grub-core/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; @@ -154,12 +145,12 @@ Index: grub-2.02~beta2/configure.ac =================================================================== --- grub-2.02~beta2.orig/configure.ac +++ grub-2.02~beta2/configure.ac -@@ -177,9 +177,9 @@ if test x$platform != xemu ; then +@@ -181,9 +181,9 @@ if test x$platform != xemu ; then esac fi -if test x"$target_cpu-$platform" = xsparc64-emu ; then -- target_m64=1 ; +- target_m64=1 -fi +case x"$target_cpu-$platform" in + xsparc64-emu | xs390x-emu) target_m64=1 ;; @@ -167,7 +158,7 @@ Index: grub-2.02~beta2/configure.ac case "$target_os" in windows* | mingw32*) target_os=cygwin ;; -@@ -1665,6 +1665,9 @@ AM_CONDITIONAL([COND_arm_uboot], [test x +@@ -1845,6 +1845,9 @@ AM_CONDITIONAL([COND_arm_uboot], [test x AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) @@ -181,7 +172,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def =================================================================== --- grub-2.02~beta2.orig/grub-core/Makefile.core.def +++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1064,6 +1064,7 @@ module = { +@@ -1050,6 +1050,7 @@ module = { module = { name = videotest; common = commands/videotest.c; @@ -189,7 +180,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -@@ -1477,6 +1478,7 @@ module = { +@@ -1462,6 +1463,7 @@ module = { common = gfxmenu/gui_progress_bar.c; common = gfxmenu/gui_util.c; common = gfxmenu/gui_string_util.c; @@ -197,7 +188,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -@@ -1856,11 +1858,13 @@ module = { +@@ -1841,11 +1843,13 @@ module = { name = gfxterm; common = term/gfxterm.c; enable = videomodules; @@ -211,7 +202,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -@@ -1975,6 +1979,7 @@ module = { +@@ -1960,6 +1964,7 @@ module = { enable = x86_64_efi; enable = emu; enable = xen; @@ -219,7 +210,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -@@ -1990,6 +1995,7 @@ module = { +@@ -2006,6 +2011,7 @@ module = { module = { name = gfxterm_menu; common = tests/gfxterm_menu.c; @@ -227,7 +218,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -@@ -2142,6 +2148,7 @@ module = { +@@ -2158,6 +2164,7 @@ module = { enable = x86_64_efi; enable = emu; enable = xen; @@ -295,7 +286,7 @@ Index: grub-2.02~beta2/include/grub/util/install.h GRUB_INSTALL_PLATFORM_MAX }; -@@ -217,6 +218,9 @@ void +@@ -219,6 +220,9 @@ void grub_install_sgi_setup (const char *install_device, const char *imgfile, const char *destname); @@ -309,7 +300,7 @@ Index: grub-2.02~beta2/util/grub-install-common.c =================================================================== --- grub-2.02~beta2.orig/util/grub-install-common.c +++ grub-2.02~beta2/util/grub-install-common.c -@@ -665,6 +665,7 @@ static struct +@@ -666,6 +666,7 @@ static struct [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, @@ -329,7 +320,7 @@ Index: grub-2.02~beta2/util/grub-install.c static int force = 0; static int have_abstractions = 0; static int have_cryptodisk = 0; -@@ -107,6 +108,7 @@ enum +@@ -106,6 +107,7 @@ enum OPTION_NO_BOOTSECTOR, OPTION_NO_RS_CODES, OPTION_MACPPC_DIRECTORY, @@ -337,7 +328,7 @@ Index: grub-2.02~beta2/util/grub-install.c OPTION_LABEL_FONT, OPTION_LABEL_COLOR, OPTION_LABEL_BGCOLOR, -@@ -182,6 +184,11 @@ argp_parser (int key, char *arg, struct +@@ -181,6 +183,11 @@ argp_parser (int key, char *arg, struct efidir = xstrdup (arg); return 0; @@ -349,7 +340,7 @@ Index: grub-2.02~beta2/util/grub-install.c case OPTION_DISK_MODULE: free (disk_module); disk_module = xstrdup (arg); -@@ -299,6 +306,8 @@ static struct argp_option options[] = { +@@ -298,6 +305,8 @@ static struct argp_option options[] = { N_("use DIR as the EFI System Partition root."), 2}, {"macppc-directory", OPTION_MACPPC_DIRECTORY, N_("DIR"), 0, N_("use DIR for PPC MAC install."), 2}, @@ -358,7 +349,7 @@ Index: grub-2.02~beta2/util/grub-install.c {"label-font", OPTION_LABEL_FONT, N_("FILE"), 0, N_("use FILE as font for label"), 2}, {"label-color", OPTION_LABEL_COLOR, N_("COLOR"), 0, N_("use COLOR for label"), 2}, {"label-bgcolor", OPTION_LABEL_BGCOLOR, N_("COLOR"), 0, N_("use COLOR for label background"), 2}, -@@ -325,6 +334,8 @@ get_default_platform (void) +@@ -324,6 +333,8 @@ get_default_platform (void) return "arm64-efi"; #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__) return grub_install_get_default_x86_platform (); @@ -367,7 +358,7 @@ Index: grub-2.02~beta2/util/grub-install.c #else return NULL; #endif -@@ -484,6 +495,8 @@ have_bootdev (enum grub_install_plat pl) +@@ -495,6 +506,8 @@ have_bootdev (enum grub_install_plat pl) case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: @@ -376,7 +367,7 @@ Index: grub-2.02~beta2/util/grub-install.c return 0; /* pacify warning. */ -@@ -895,6 +908,7 @@ main (int argc, char *argv[]) +@@ -907,6 +920,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_ARM_UBOOT: case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: @@ -384,7 +375,7 @@ Index: grub-2.02~beta2/util/grub-install.c break; case GRUB_INSTALL_PLATFORM_I386_QEMU: -@@ -940,6 +954,7 @@ main (int argc, char *argv[]) +@@ -952,6 +966,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: @@ -392,7 +383,7 @@ Index: grub-2.02~beta2/util/grub-install.c free (install_device); install_device = NULL; break; -@@ -1201,6 +1216,20 @@ main (int argc, char *argv[]) +@@ -1213,6 +1228,20 @@ main (int argc, char *argv[]) } } @@ -413,7 +404,7 @@ Index: grub-2.02~beta2/util/grub-install.c grub_install_copy_files (grub_install_source_directory, grubdir, platform); -@@ -1445,6 +1474,7 @@ main (int argc, char *argv[]) +@@ -1457,6 +1486,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_ARM_UBOOT: case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: @@ -421,7 +412,7 @@ Index: grub-2.02~beta2/util/grub-install.c grub_util_warn ("%s", _("no hints available for your platform. Expect reduced performance")); break; /* pacify warning. */ -@@ -1557,6 +1587,10 @@ main (int argc, char *argv[]) +@@ -1569,6 +1599,10 @@ main (int argc, char *argv[]) strcpy (mkimage_target, "sparc64-ieee1275-raw"); core_name = "core.img"; break; @@ -432,7 +423,7 @@ Index: grub-2.02~beta2/util/grub-install.c /* pacify warning. */ case GRUB_INSTALL_PLATFORM_MAX: break; -@@ -1572,6 +1606,7 @@ main (int argc, char *argv[]) +@@ -1584,6 +1618,7 @@ main (int argc, char *argv[]) core_name); char *prefix = xasprintf ("%s%s", prefix_drive ? : "", relative_grubdir); @@ -440,7 +431,7 @@ Index: grub-2.02~beta2/util/grub-install.c grub_install_make_image_wrap (/* source dir */ grub_install_source_directory, /*prefix */ prefix, /* output */ imgfile, -@@ -1610,6 +1645,10 @@ main (int argc, char *argv[]) +@@ -1622,6 +1657,10 @@ main (int argc, char *argv[]) /* image target */ mkimage_target, 0); } break; @@ -451,7 +442,7 @@ Index: grub-2.02~beta2/util/grub-install.c case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: -@@ -1871,6 +1910,10 @@ main (int argc, char *argv[]) +@@ -1883,6 +1922,10 @@ main (int argc, char *argv[]) } break; diff --git a/grub2-s390x-05-grub2-mkconfig.patch b/grub2-s390x-05-grub2-mkconfig.patch index 0bf6b81..9ec5f90 100644 --- a/grub2-s390x-05-grub2-mkconfig.patch +++ b/grub2-s390x-05-grub2-mkconfig.patch @@ -81,34 +81,33 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in message="$(gettext_printf "Loading Linux %s ..." ${version})" if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then sed "s/^/$submenu_indentation/" << EOF -@@ -165,16 +188,17 @@ EOF - } +@@ -166,17 +189,15 @@ EOF machine=`uname -m` --case "x$machine" in + case "x$machine" in - xi?86 | xx86_64) -- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi -- done` ;; +- list= +- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; - *) -- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi -- done` ;; -+case "$machine" in -+ i?86 | x86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; -+ s390 | s390x) klist="/boot/image-* /boot/kernel-*" ;; +- list= +- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; ++ xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; ++ xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; + *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ + /boot/kernel-*" ;; esac -+list=`for i in $klist; do -+ if grub_file_is_not_garbage "$i" ; then -+ echo -n "$i " ; -+ fi -+ done` ++list= ++for i in $klist ; do ++ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi ++done case "$machine" in i?86) GENKERNEL_ARCH="x86" ;; -@@ -184,6 +208,15 @@ case "$machine" in +@@ -186,6 +207,15 @@ case "$machine" in *) GENKERNEL_ARCH="$machine" ;; esac @@ -124,7 +123,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in prepare_boot_cache= prepare_root_cache= boot_device_id= -@@ -200,6 +233,11 @@ while [ "x$list" != "x" ] ; do +@@ -202,6 +232,11 @@ while [ "x$list" != "x" ] ; do basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -136,7 +135,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -@@ -284,7 +322,8 @@ while [ "x$list" != "x" ] ; do +@@ -286,7 +321,8 @@ while [ "x$list" != "x" ] ; do boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi # TRANSLATORS: %s is replaced with an OS name diff --git a/grub2-secureboot-add-linuxefi.patch b/grub2-secureboot-add-linuxefi.patch index 0b8ffda..d1a6eca 100644 --- a/grub2-secureboot-add-linuxefi.patch +++ b/grub2-secureboot-add-linuxefi.patch @@ -19,7 +19,7 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def =================================================================== --- grub-2.02~beta2.orig/grub-core/Makefile.core.def +++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1706,6 +1706,14 @@ module = { +@@ -1691,6 +1691,14 @@ module = { }; module = { @@ -320,7 +320,7 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + goto fail; + } + -+ memset (params, 0, 16384); ++ grub_memset (params, 0, 16384); + + if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) + { @@ -408,7 +408,7 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + lh.code32_start = (grub_uint32_t)(grub_addr_t) kernel_mem; + } + -+ memcpy(params, &lh, 2 * 512); ++ grub_memcpy(params, &lh, 2 * 512); + + params->type_of_loader = 0x21; + diff --git a/grub2-secureboot-chainloader.patch b/grub2-secureboot-chainloader.patch index ab3d694..a6feafa 100644 --- a/grub2-secureboot-chainloader.patch +++ b/grub2-secureboot-chainloader.patch @@ -642,9 +642,9 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c &image_handle); if (status != GRUB_EFI_SUCCESS) { -@@ -352,33 +853,10 @@ grub_cmd_chainloader (grub_command_t cmd - - grub_file_close (file); +@@ -350,33 +851,10 @@ grub_cmd_chainloader (grub_command_t cmd + } + loaded_image->device_handle = dev_handle; - if (argc > 1) + if (cmdline) @@ -677,8 +677,8 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c + loaded_image->load_options_size = cmdline_len; } - grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); -@@ -397,6 +875,9 @@ grub_cmd_chainloader (grub_command_t cmd + grub_file_close (file); +@@ -398,6 +876,9 @@ grub_cmd_chainloader (grub_command_t cmd if (address) efi_call_2 (b->free_pages, address, pages); diff --git a/grub2-xen-legacy-config-device-name.patch b/grub2-xen-legacy-config-device-name.patch deleted file mode 100644 index 2b8e2a1..0000000 --- a/grub2-xen-legacy-config-device-name.patch +++ /dev/null @@ -1,112 +0,0 @@ -From: Andrey Borzenkov -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 - ---- - 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; - diff --git a/grub2-xfs-Add-helper-for-inode-size.patch b/grub2-xfs-Add-helper-for-inode-size.patch deleted file mode 100644 index 7f214ea..0000000 --- a/grub2-xfs-Add-helper-for-inode-size.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 34231b28cbb6b2e10d7668c5b6d2432e8563bd1d Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Thu, 5 Jun 2014 20:56:21 +0200 -Subject: [PATCH 1/4] xfs: Add helper for inode size - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 16ffd3f1ebd9..a2fc942707c1 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -255,6 +255,11 @@ grub_xfs_inode_offset (struct grub_xfs_data *data, - data->sblock.log2_inode); - } - -+static inline int -+grub_xfs_inode_size(struct grub_xfs_data *data) -+{ -+ return 1 << data->sblock.log2_inode; -+} - - static grub_err_t - grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, -@@ -264,8 +269,8 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, - int offset = grub_xfs_inode_offset (data, ino); - - /* Read the inode. */ -- if (grub_disk_read (data->disk, block, offset, -- 1 << data->sblock.log2_inode, inode)) -+ if (grub_disk_read (data->disk, block, offset, grub_xfs_inode_size(data), -+ inode)) - return grub_errno; - - if (grub_strncmp ((char *) inode->magic, "IN", 2)) -@@ -297,7 +302,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - if (node->inode.fork_offset) - recoffset = (node->inode.fork_offset - 1) / 2; - else -- recoffset = ((1 << node->data->sblock.log2_inode) -+ recoffset = (grub_xfs_inode_size(node->data) - - ((char *) &node->inode.data.btree.keys - - (char *) &node->inode)) - / (2 * sizeof (grub_uint64_t)); -@@ -458,7 +463,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, - - fdiro = grub_malloc (sizeof (struct grub_fshelp_node) - - sizeof (struct grub_xfs_inode) -- + (1 << ctx->diro->data->sblock.log2_inode) + 1); -+ + grub_xfs_inode_size(ctx->diro->data) + 1); - if (!fdiro) - { - grub_print_error (); -@@ -684,7 +689,7 @@ grub_xfs_mount (grub_disk_t disk) - data = grub_realloc (data, - sizeof (struct grub_xfs_data) - - sizeof (struct grub_xfs_inode) -- + (1 << data->sblock.log2_inode) + 1); -+ + grub_xfs_inode_size(data) + 1); - - if (! data) - goto fail; -@@ -802,7 +807,7 @@ grub_xfs_open (struct grub_file *file, const char *name) - grub_memcpy (&data->diropen, fdiro, - sizeof (struct grub_fshelp_node) - - sizeof (struct grub_xfs_inode) -- + (1 << data->sblock.log2_inode)); -+ + grub_xfs_inode_size(data)); - grub_free (fdiro); - } - --- -1.8.1.4 - diff --git a/grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch b/grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch deleted file mode 100644 index dd3eb83..0000000 --- a/grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 57ae4073cc28fa74014a62aca397a40ce1f73763 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Thu, 12 Jun 2014 11:01:11 +0200 -Subject: [PATCH 3/4] xfs: Convert inode numbers to cpu endianity immediately - after reading - -Currently XFS driver converted inode numbers to native endianity only -when using them to compute inode position. Although this works, it is -somewhat confusing. So convert inode numbers when reading them from disk -structures as every other field. - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index ef3bc787e968..7e247a32df5c 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -180,14 +180,14 @@ static inline grub_uint64_t - GRUB_XFS_INO_INOINAG (struct grub_xfs_data *data, - grub_uint64_t ino) - { -- return (grub_be_to_cpu64 (ino) & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1)); -+ return (ino & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1)); - } - - static inline grub_uint64_t - GRUB_XFS_INO_AG (struct grub_xfs_data *data, - grub_uint64_t ino) - { -- return (grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data)); -+ return (ino >> GRUB_XFS_INO_AGBITS (data)); - } - - static inline grub_disk_addr_t -@@ -511,13 +511,12 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - if (smallino) - { - parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent.i4); -- parent = grub_cpu_to_be64 (parent); - /* The header is a bit smaller than usual. */ - de = (struct grub_xfs_dir_entry *) ((char *) de - 4); - } - else - { -- parent = diro->inode.data.dir.dirhead.parent.i8; -+ parent = grub_be_to_cpu64(diro->inode.data.dir.dirhead.parent.i8); - } - - /* Synthesize the direntries for `.' and `..'. */ -@@ -550,7 +549,6 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - | (((grub_uint64_t) inopos[5]) << 16) - | (((grub_uint64_t) inopos[6]) << 8) - | (((grub_uint64_t) inopos[7]) << 0); -- ino = grub_cpu_to_be64 (ino); - - c = de->name[de->len]; - de->name[de->len] = '\0'; -@@ -632,7 +630,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - is not used by GRUB. So it can be overwritten. */ - filename[direntry->len] = '\0'; - -- if (iterate_dir_call_hook (direntry->inode, filename, &ctx)) -+ if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), -+ filename, &ctx)) - { - grub_free (dirblock); - return 1; -@@ -694,7 +693,7 @@ grub_xfs_mount (grub_disk_t disk) - goto fail; - - data->diropen.data = data; -- data->diropen.ino = data->sblock.rootino; -+ data->diropen.ino = grub_be_to_cpu64(data->sblock.rootino); - data->diropen.inode_read = 1; - data->bsize = grub_be_to_cpu32 (data->sblock.bsize); - data->agsize = grub_be_to_cpu32 (data->sblock.agsize); --- -1.8.1.4 - diff --git a/grub2-xfs-Fix-termination-loop-for-directory-iteration.patch b/grub2-xfs-Fix-termination-loop-for-directory-iteration.patch deleted file mode 100644 index 23fcf89..0000000 --- a/grub2-xfs-Fix-termination-loop-for-directory-iteration.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a7d584c005bde09bb86475a79d714215b3480821 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Wed, 11 Jun 2014 18:36:59 +0200 -Subject: [PATCH 2/4] xfs: Fix termination loop for directory iteration - -Directory iteration used wrong position (sizeof wrong structure) for -termination of iteration inside a directory block. Luckily the position -ended up being wrong by just 1 byte and directory entries are larger so -things worked out fine in practice. But fix the problem anyway. - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index a2fc942707c1..ef3bc787e968 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -608,8 +608,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - - grub_be_to_cpu32 (tail->leaf_stale)); - - /* Iterate over all entries within this block. */ -- while (pos < (dirblk_size -- - (int) sizeof (struct grub_xfs_dir2_entry))) -+ while (pos < tail_start) - { - struct grub_xfs_dir2_entry *direntry; - grub_uint8_t *freetag; --- -1.8.1.4 - diff --git a/grub2-xfs-V5-filesystem-format-support.patch b/grub2-xfs-V5-filesystem-format-support.patch deleted file mode 100644 index 1240720..0000000 --- a/grub2-xfs-V5-filesystem-format-support.patch +++ /dev/null @@ -1,478 +0,0 @@ -From 2f725e644d8ccf001a4dccddc8abb2c9479352a7 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Wed, 11 Jun 2014 18:36:01 +0200 -Subject: [PATCH] xfs: V5 filesystem format support - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 245 +++++++++++++++++++++++++++++++++++++---------------- - 1 file changed, 173 insertions(+), 72 deletions(-) - -Index: grub-2.02~beta2/grub-core/fs/xfs.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/fs/xfs.c -+++ grub-2.02~beta2/grub-core/fs/xfs.c -@@ -34,6 +34,15 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_INODE_FORMAT_EXT 2 - #define XFS_INODE_FORMAT_BTREE 3 - -+/* Superblock version field flags */ -+#define XFS_SB_VERSION_NUMBITS 0x000f -+#define XFS_SB_VERSION_MOREBITSBIT 0x8000 -+ -+/* features2 field flags */ -+#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */ -+ -+/* incompat feature flags */ -+#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ - - struct grub_xfs_sblock - { -@@ -45,7 +54,9 @@ struct grub_xfs_sblock - grub_uint64_t rootino; - grub_uint8_t unused3[20]; - grub_uint32_t agsize; -- grub_uint8_t unused4[20]; -+ grub_uint8_t unused4[12]; -+ grub_uint16_t version; -+ grub_uint8_t unused5[6]; - grub_uint8_t label[12]; - grub_uint8_t log2_bsize; - grub_uint8_t log2_sect; -@@ -54,12 +65,19 @@ struct grub_xfs_sblock - grub_uint8_t log2_agblk; - grub_uint8_t unused6[67]; - grub_uint8_t log2_dirblk; -+ grub_uint8_t unused7[7]; -+ grub_uint32_t features2; -+ grub_uint8_t unused8[4]; -+ grub_uint32_t sb_features_compat; -+ grub_uint32_t sb_features_ro_compat; -+ grub_uint32_t sb_features_incompat; -+ grub_uint32_t sb_features_log_incompat; - } GRUB_PACKED; - - struct grub_xfs_dir_header - { - grub_uint8_t count; -- grub_uint8_t smallino; -+ grub_uint8_t largeino; - union - { - grub_uint32_t i4; -@@ -67,14 +85,16 @@ struct grub_xfs_dir_header - } GRUB_PACKED parent; - } GRUB_PACKED; - -+/* Structure for directory entry inlined in the inode */ - struct grub_xfs_dir_entry - { - grub_uint8_t len; - grub_uint16_t offset; - char name[1]; -- /* Inode number follows, 32 bits. */ -+ /* Inode number follows, 32 / 64 bits. */ - } GRUB_PACKED; - -+/* Structure for directory entry in a block */ - struct grub_xfs_dir2_entry - { - grub_uint64_t inode; -@@ -90,7 +110,8 @@ struct grub_xfs_btree_node - grub_uint16_t numrecs; - grub_uint64_t left; - grub_uint64_t right; -- grub_uint64_t keys[1]; -+ /* In V5 here follow crc, uuid, etc. */ -+ /* Then follow keys and block pointers */ - } GRUB_PACKED; - - struct grub_xfs_btree_root -@@ -123,17 +144,6 @@ struct grub_xfs_inode - grub_uint16_t unused3; - grub_uint8_t fork_offset; - grub_uint8_t unused4[17]; -- union -- { -- char raw[156]; -- struct dir -- { -- struct grub_xfs_dir_header dirhead; -- struct grub_xfs_dir_entry direntry[1]; -- } dir; -- grub_xfs_extent extents[XFS_INODE_EXTENTS]; -- struct grub_xfs_btree_root btree; -- } GRUB_PACKED data; - } GRUB_PACKED; - - struct grub_xfs_dirblock_tail -@@ -157,6 +167,8 @@ struct grub_xfs_data - int pos; - int bsize; - grub_uint32_t agsize; -+ unsigned int hasftype:1; -+ unsigned int hascrc:1; - struct grub_fshelp_node diropen; - }; - -@@ -164,6 +176,24 @@ static grub_dl_t my_mod; - - - -+static int grub_xfs_sb_hascrc(struct grub_xfs_data *data) -+{ -+ return (grub_be_to_cpu16(data->sblock.version) & XFS_SB_VERSION_NUMBITS) == 5; -+} -+ -+static int grub_xfs_sb_hasftype(struct grub_xfs_data *data) -+{ -+ grub_uint32_t version = grub_be_to_cpu16(data->sblock.version); -+ -+ if ((version & XFS_SB_VERSION_NUMBITS) == 5 && -+ grub_be_to_cpu32(data->sblock.sb_features_incompat) & XFS_SB_FEAT_INCOMPAT_FTYPE) -+ return 1; -+ if (version & XFS_SB_VERSION_MOREBITSBIT && -+ grub_be_to_cpu32(data->sblock.features2) & XFS_SB_VERSION2_FTYPE) -+ return 1; -+ return 0; -+} -+ - /* Filetype information as used in inodes. */ - #define FILETYPE_INO_MASK 0170000 - #define FILETYPE_INO_REG 0100000 -@@ -219,18 +249,6 @@ GRUB_XFS_EXTENT_SIZE (grub_xfs_extent *e - return (grub_be_to_cpu32 (exts[ex][3]) & ((1 << 21) - 1)); - } - --static inline int --GRUB_XFS_ROUND_TO_DIRENT (int pos) --{ -- return ((((pos) + 8 - 1) / 8) * 8); --} -- --static inline int --GRUB_XFS_NEXT_DIRENT (int pos, int len) --{ -- return (pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2); --} -- - - static inline grub_uint64_t - grub_xfs_inode_block (struct grub_xfs_data *data, -@@ -261,6 +279,92 @@ grub_xfs_inode_size(struct grub_xfs_data - return 1 << data->sblock.log2_inode; - } - -+static void * -+grub_xfs_inode_data(struct grub_xfs_inode *inode) -+{ -+ if (inode->version <= 2) -+ return ((char *)inode) + 100; -+ return ((char *)inode) + 176; -+} -+ -+static struct grub_xfs_dir_entry * -+grub_xfs_inline_de(struct grub_xfs_dir_header *head) -+{ -+ /* -+ * With small inode numbers the header is 4 bytes smaller because of -+ * smaller parent pointer -+ */ -+ return (void *)(((char *)head) + sizeof(struct grub_xfs_dir_header) - -+ (head->largeino ? 0 : sizeof(grub_uint32_t))); -+} -+ -+static grub_uint8_t * -+grub_xfs_inline_de_inopos(struct grub_xfs_data *data, -+ struct grub_xfs_dir_entry *de) -+{ -+ return ((grub_uint8_t *)(de + 1)) + de->len - 1 + -+ (data->hasftype ? 1 : 0); -+} -+ -+static struct grub_xfs_dir_entry * -+grub_xfs_inline_next_de(struct grub_xfs_data *data, -+ struct grub_xfs_dir_header *head, -+ struct grub_xfs_dir_entry *de) -+{ -+ char *p = (char *)de + sizeof(struct grub_xfs_dir_entry) - 1 + de->len; -+ -+ p += head->largeino ? sizeof(grub_uint64_t) : sizeof(grub_uint32_t); -+ if (data->hasftype) -+ p++; -+ -+ return (struct grub_xfs_dir_entry *)p; -+} -+ -+static struct grub_xfs_dirblock_tail * -+grub_xfs_dir_tail(struct grub_xfs_data *data, void *dirblock) -+{ -+ int dirblksize = 1 << (data->sblock.log2_bsize + data->sblock.log2_dirblk); -+ -+ return (struct grub_xfs_dirblock_tail *) -+ ((char *)dirblock + dirblksize - sizeof (struct grub_xfs_dirblock_tail)); -+} -+ -+static struct grub_xfs_dir2_entry * -+grub_xfs_first_de(struct grub_xfs_data *data, void *dirblock) -+{ -+ if (data->hascrc) -+ return (struct grub_xfs_dir2_entry *)((char *)dirblock + 64); -+ return (struct grub_xfs_dir2_entry *)((char *)dirblock + 16); -+} -+ -+static inline int -+grub_xfs_round_dirent_size (int len) -+{ -+ return (len + 7) & ~7; -+} -+ -+static struct grub_xfs_dir2_entry * -+grub_xfs_next_de(struct grub_xfs_data *data, struct grub_xfs_dir2_entry *de) -+{ -+ int size = sizeof (struct grub_xfs_dir2_entry) + de->len + 2 /* Tag */; -+ -+ if (data->hasftype) -+ size++; /* File type */ -+ return (struct grub_xfs_dir2_entry *) -+ (((char *)de) + grub_xfs_round_dirent_size (size)); -+} -+ -+static grub_uint64_t * -+grub_xfs_btree_keys(struct grub_xfs_data *data, -+ struct grub_xfs_btree_node *leaf) -+{ -+ char *p = (char *)(leaf + 1); -+ -+ if (data->hascrc) -+ p += 48; /* crc, uuid, ... */ -+ return (grub_uint64_t *)(void*)p; -+} -+ - static grub_err_t - grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, - struct grub_xfs_inode *inode) -@@ -268,6 +372,9 @@ grub_xfs_read_inode (struct grub_xfs_dat - grub_uint64_t block = grub_xfs_inode_block (data, ino); - int offset = grub_xfs_inode_offset (data, ino); - -+ grub_dprintf("xfs", "Reading inode (%llu) - %llu, %d\n", -+ (unsigned long long) ino, -+ (unsigned long long) block, offset); - /* Read the inode. */ - if (grub_disk_read (data->disk, block, offset, grub_xfs_inode_size(data), - inode)) -@@ -290,6 +397,7 @@ grub_xfs_read_block (grub_fshelp_node_t - - if (node->inode.format == XFS_INODE_FORMAT_BTREE) - { -+ struct grub_xfs_btree_root *root; - const grub_uint64_t *keys; - int recoffset; - -@@ -297,15 +405,15 @@ grub_xfs_read_block (grub_fshelp_node_t - if (leaf == 0) - return 0; - -- nrec = grub_be_to_cpu16 (node->inode.data.btree.numrecs); -- keys = &node->inode.data.btree.keys[0]; -+ root = grub_xfs_inode_data(&node->inode); -+ nrec = grub_be_to_cpu16 (root->numrecs); -+ keys = &root->keys[0]; - if (node->inode.fork_offset) - recoffset = (node->inode.fork_offset - 1) / 2; - else - recoffset = (grub_xfs_inode_size(node->data) -- - ((char *) &node->inode.data.btree.keys -- - (char *) &node->inode)) -- / (2 * sizeof (grub_uint64_t)); -+ - ((char *) keys - (char *) &node->inode)) -+ / (2 * sizeof (grub_uint64_t)); - do - { - int i; -@@ -327,7 +435,10 @@ grub_xfs_read_block (grub_fshelp_node_t - 0, node->data->bsize, leaf)) - return 0; - -- if (grub_strncmp ((char *) leaf->magic, "BMAP", 4)) -+ if ((!node->data->hascrc && -+ grub_strncmp ((char *) leaf->magic, "BMAP", 4)) || -+ (node->data->hascrc && -+ grub_strncmp ((char *) leaf->magic, "BMA3", 4))) - { - grub_free (leaf); - grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node"); -@@ -335,8 +446,8 @@ grub_xfs_read_block (grub_fshelp_node_t - } - - nrec = grub_be_to_cpu16 (leaf->numrecs); -- keys = &leaf->keys[0]; -- recoffset = ((node->data->bsize - ((char *) &leaf->keys -+ keys = grub_xfs_btree_keys(node->data, leaf); -+ recoffset = ((node->data->bsize - ((char *) keys - - (char *) leaf)) - / (2 * sizeof (grub_uint64_t))); - } -@@ -346,7 +457,7 @@ grub_xfs_read_block (grub_fshelp_node_t - else if (node->inode.format == XFS_INODE_FORMAT_EXT) - { - nrec = grub_be_to_cpu32 (node->inode.nextents); -- exts = &node->inode.data.extents[0]; -+ exts = grub_xfs_inode_data(&node->inode); - } - else - { -@@ -404,7 +515,7 @@ grub_xfs_read_symlink (grub_fshelp_node_ - switch (node->inode.format) - { - case XFS_INODE_FORMAT_INO: -- return grub_strndup (node->inode.data.raw, size); -+ return grub_strndup (grub_xfs_inode_data(&node->inode), size); - - case XFS_INODE_FORMAT_EXT: - { -@@ -501,23 +612,18 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - { - case XFS_INODE_FORMAT_INO: - { -- struct grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0]; -- int smallino = !diro->inode.data.dir.dirhead.smallino; -+ struct grub_xfs_dir_header *head = grub_xfs_inode_data(&diro->inode); -+ struct grub_xfs_dir_entry *de = grub_xfs_inline_de(head); -+ int smallino = !head->largeino; - int i; - grub_uint64_t parent; - - /* If small inode numbers are used to pack the direntry, the - parent inode number is small too. */ - if (smallino) -- { -- parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent.i4); -- /* The header is a bit smaller than usual. */ -- de = (struct grub_xfs_dir_entry *) ((char *) de - 4); -- } -+ parent = grub_be_to_cpu32 (head->parent.i4); - else -- { -- parent = grub_be_to_cpu64(diro->inode.data.dir.dirhead.parent.i8); -- } -+ parent = grub_be_to_cpu64 (head->parent.i8); - - /* Synthesize the direntries for `.' and `..'. */ - if (iterate_dir_call_hook (diro->ino, ".", &ctx)) -@@ -526,12 +632,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - if (iterate_dir_call_hook (parent, "..", &ctx)) - return 1; - -- for (i = 0; i < diro->inode.data.dir.dirhead.count; i++) -+ for (i = 0; i < head->count; i++) - { - grub_uint64_t ino; -- grub_uint8_t *inopos = (((grub_uint8_t *) de) -- + sizeof (struct grub_xfs_dir_entry) -- + de->len - 1); -+ grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de); - grub_uint8_t c; - - /* inopos might be unaligned. */ -@@ -556,10 +660,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - return 1; - de->name[de->len] = c; - -- de = ((struct grub_xfs_dir_entry *) -- (((char *) de)+ sizeof (struct grub_xfs_dir_entry) + de->len -- + ((smallino ? sizeof (grub_uint32_t) -- : sizeof (grub_uint64_t))) - 1)); -+ de = grub_xfs_inline_next_de(dir->data, head, de); - } - break; - } -@@ -586,15 +687,11 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - >> dirblk_log2); - blk++) - { -- /* The header is skipped, the first direntry is stored -- from byte 16. */ -- int pos = 16; -+ struct grub_xfs_dir2_entry *direntry = -+ grub_xfs_first_de(dir->data, dirblock); - int entries; -- int tail_start = (dirblk_size -- - sizeof (struct grub_xfs_dirblock_tail)); -- -- struct grub_xfs_dirblock_tail *tail; -- tail = (struct grub_xfs_dirblock_tail *) &dirblock[tail_start]; -+ struct grub_xfs_dirblock_tail *tail = -+ grub_xfs_dir_tail(dir->data, dirblock); - - numread = grub_xfs_read_file (dir, 0, 0, - blk << dirblk_log2, -@@ -606,13 +703,11 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - - grub_be_to_cpu32 (tail->leaf_stale)); - - /* Iterate over all entries within this block. */ -- while (pos < tail_start) -+ while ((char *)direntry < (char *)tail) - { -- struct grub_xfs_dir2_entry *direntry; - grub_uint8_t *freetag; - char *filename; - -- direntry = (struct grub_xfs_dir2_entry *) &dirblock[pos]; - freetag = (grub_uint8_t *) direntry; - - if (grub_get_unaligned16 (freetag) == 0XFFFF) -@@ -620,14 +715,16 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - grub_uint8_t *skip = (freetag + sizeof (grub_uint16_t)); - - /* This entry is not used, go to the next one. */ -- pos += grub_be_to_cpu16 (grub_get_unaligned16 (skip)); -+ direntry = (struct grub_xfs_dir2_entry *) -+ (((char *)direntry) + -+ grub_be_to_cpu16 (grub_get_unaligned16 (skip))); - - continue; - } - -- filename = &dirblock[pos + sizeof (*direntry)]; -- /* The byte after the filename is for the tag, which -- is not used by GRUB. So it can be overwritten. */ -+ filename = (char *)(direntry + 1); -+ /* The byte after the filename is for the filetype, padding, or -+ tag, which is not used by GRUB. So it can be overwritten. */ - filename[direntry->len] = '\0'; - - if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), -@@ -644,8 +741,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t - break; - - /* Select the next directory entry. */ -- pos = GRUB_XFS_NEXT_DIRENT (pos, direntry->len); -- pos = GRUB_XFS_ROUND_TO_DIRENT (pos); -+ direntry = grub_xfs_next_de(dir->data, direntry); - } - } - grub_free (dirblock); -@@ -670,6 +766,7 @@ grub_xfs_mount (grub_disk_t disk) - if (!data) - return 0; - -+ grub_dprintf("xfs", "Reading sb\n"); - /* Read the superblock. */ - if (grub_disk_read (disk, 0, 0, - sizeof (struct grub_xfs_sblock), &data->sblock)) -@@ -697,9 +794,13 @@ grub_xfs_mount (grub_disk_t disk) - data->diropen.inode_read = 1; - data->bsize = grub_be_to_cpu32 (data->sblock.bsize); - data->agsize = grub_be_to_cpu32 (data->sblock.agsize); -+ data->hasftype = grub_xfs_sb_hasftype(data); -+ data->hascrc = grub_xfs_sb_hascrc(data); - - data->disk = disk; - data->pos = 0; -+ grub_dprintf("xfs", "Reading root ino %llu\n", -+ (unsigned long long) grub_cpu_to_be64(data->sblock.rootino)); - - grub_xfs_read_inode (data, data->diropen.ino, &data->diropen.inode); - diff --git a/grub2.changes b/grub2.changes index 66de87a..7a67bd4 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,89 @@ +------------------------------------------------------------------- +Mon Feb 29 03:40:22 UTC 2016 - arvidjaar@gmail.com + +- new upstream version 2.02~beta3 + * highlights of user visible changes not yet present in openSUSE package + - arm-uboot now generates position independent self relocating image, so + single binary should run on all supported systems + - loader for Xen on aarch64. grub-mkconfig support was not in time for + beta3 yet. + - improved ZFS support (extensible_dataset, large_blocks, embedded_data, + hole_birth features) + - support for IPv6 Router Advertisements + - support for persistent memory (we do not overwrite it and pass correct + information to OS) + - try to display more specific icons for os-prober generated menu entries + - grub-install detects EFI bit size and selects correct platform (x86_64-efi + or i386-efi) independent of OS bit size; needs kernel 4.0 or higher. + - LVM RAID1 support + - xnu loader fixes which should make OS X menu entry generated by os-prober + work again + - ... and lot of fixes over entire tree + * rediff + - rename-grub-info-file-to-grub2.patch + - use-grub2-as-a-package-name.patch + - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch + - grub2-fix-menu-in-xen-host-server.patch + - grub2-efi-HP-workaround.patch + - grub2-secureboot-chainloader.patch + - grub2-s390x-02-kexec-module-added-to-emu.patch + - grub2-s390x-04-grub2-install.patch + - grub2-s390x-05-grub2-mkconfig.patch + - grub2-efi-xen-chainload.patch + - grub2-mkconfig-aarch64.patch + - grub2-btrfs-04-grub2-install.patch + - grub2-ppc64-cas-reboot-support.patch + - 0002-Add-Virtual-LAN-support.patch + * fix grub2-secureboot-add-linuxefi.patch - use grub_memset and + grub_memcpy instead of memset and memcpy (caused errors due to + compiler warning) + * drop upstream patches + - 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch + - 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch + - 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 + - 0001-efinet-Check-for-immediate-completition.patch + - 0001-efinet-enable-hardware-filters-when-opening-interfac.patch + - grub2-xen-legacy-config-device-name.patch + - grub2-getroot-support-NVMe-device-names.patch + - grub2-netboot-hang.patch + - grub2-btrfs-fix-incorrect-address-reference.patch + - aarch64-reloc.patch + - grub2-glibc-2.20.patch (related code dropped upstream) + - grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch + - grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch + - grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch + - grub2-ppc64-qemu.patch + - grub2-xfs-Add-helper-for-inode-size.patch + - grub2-xfs-Fix-termination-loop-for-directory-iteration.patch + - grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch + - grub2-xfs-V5-filesystem-format-support.patch + - 0001-Add-bootargs-parser-for-open-firmware.patch + - grub2-arm64-set-correct-length.patch + - grub2-arm64-setjmp-Add-missing-license-macro.patch + - grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch + - 0001-unix-password-Fix-file-descriptor-leak.patch + - 0002-linux-getroot-fix-descriptor-leak.patch + - 0003-util-grub-mount-fix-descriptor-leak.patch + - 0004-linux-ofpath-fix-descriptor-leak.patch + - 0005-grub-fstest-fix-descriptor-leak.patch + - ppc64le.patch + - libgcc-prereq.patch + - libgcc.patch + - 0001-Fix-security-issue-when-reading-username-and-passwor.patch + - 0001-menu-fix-line-count-calculation-for-long-lines.patch + - grub2-arm64-Reduce-timer-event-frequency-by-10.patch + - 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch + - 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch + - 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch + - 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch + - 0005-i386-fix-TSC-calibration-using-PIT.patch + - biendian.patch + - ppc64_opt.patch + * drop workarounds for gdb_grub and grub.chrp, they are now installed under fixed name + * do not patch docs/Makefile.in, it is regenerated anyway + ------------------------------------------------------------------- Fri Jan 29 03:54:15 UTC 2016 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index 4c7ebc7..ece8758 100644 --- a/grub2.spec +++ b/grub2.spec @@ -124,7 +124,7 @@ BuildRequires: systemd-rpm-macros %define only_x86_64 %{nil} %endif -Version: 2.02~beta2 +Version: 2.02~beta3 Release: 0 Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0+ @@ -153,7 +153,6 @@ Source1000: PATCH_POLICY Patch1: rename-grub-info-file-to-grub2.patch Patch2: grub2-linux.patch Patch3: use-grub2-as-a-package-name.patch -Patch4: 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch Patch6: grub2-iterate-and-hook-for-extended-partition.patch Patch8: grub2-ppc-terminfo.patch Patch9: grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch @@ -170,7 +169,6 @@ Patch24: grub2-secureboot-provide-linuxefi-config.patch Patch29: grub2-secureboot-chainloader.patch Patch34: grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch Patch35: grub2-linguas.sh-no-rsync.patch -Patch36: 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch Patch37: grub2-use-Unifont-for-starfield-theme-terminal.patch Patch38: grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch Patch39: grub2-s390x-02-kexec-module-added-to-emu.patch @@ -178,33 +176,16 @@ 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 -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 -Patch47: 0001-efinet-Check-for-immediate-completition.patch -Patch48: 0001-efinet-enable-hardware-filters-when-opening-interfac.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 Patch56: grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch -Patch57: grub2-netboot-hang.patch Patch58: grub2-xen-linux16.patch Patch59: grub2-efi-disable-video-cirrus-and-bochus.patch Patch60: grub2-editenv-add-warning-message.patch Patch61: grub2-vbe-blacklist-preferred-1440x900x32.patch -Patch62: grub2-btrfs-fix-incorrect-address-reference.patch -Patch63: aarch64-reloc.patch Patch64: grub2-btrfs-workaround-grub2-once.patch Patch65: grub2-mkconfig-aarch64.patch -# Fix build with glibc 2.20+ -Patch66: grub2-glibc-2.20.patch -Patch67: grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch -Patch68: grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch -Patch69: grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch Patch70: grub2-default-distributor.patch Patch71: grub2-menu-unrestricted.patch -Patch72: 0001-Fix-security-issue-when-reading-username-and-passwor.patch -Patch73: 0001-menu-fix-line-count-calculation-for-long-lines.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 @@ -217,40 +198,11 @@ Patch120: grub2-efi-xen-chainload.patch Patch121: grub2-efi-chainloader-root.patch Patch122: grub2-efi-xen-cmdline.patch # PPC64 LE support -Patch201: ppc64le.patch -Patch202: libgcc-prereq.patch -Patch203: libgcc.patch -Patch204: grub2-ppc64-qemu.patch Patch205: grub2-ppc64le-disable-video.patch Patch207: grub2-ppc64le-memory-map.patch -Patch229: grub2-xfs-Add-helper-for-inode-size.patch -Patch230: grub2-xfs-Fix-termination-loop-for-directory-iteration.patch -Patch231: grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch -Patch232: grub2-xfs-V5-filesystem-format-support.patch Patch233: grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch -Patch234: 0001-Add-bootargs-parser-for-open-firmware.patch Patch235: 0002-Add-Virtual-LAN-support.patch Patch236: grub2-efi_gop-avoid-low-resolution.patch -Patch238: grub2-arm64-Reduce-timer-event-frequency-by-10.patch -Patch239: grub2-arm64-set-correct-length.patch -Patch240: grub2-arm64-setjmp-Add-missing-license-macro.patch -Patch241: grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch -# Upstream patches for fixing file descriptor leakage (bsc#943784) -Patch260: 0001-unix-password-Fix-file-descriptor-leak.patch -Patch261: 0002-linux-getroot-fix-descriptor-leak.patch -Patch262: 0003-util-grub-mount-fix-descriptor-leak.patch -Patch263: 0004-linux-ofpath-fix-descriptor-leak.patch -Patch264: 0005-grub-fstest-fix-descriptor-leak.patch -# Upstream patch to fix patch 0001-unix-password-Fix-file-descriptor-leak.patch -Patch265: 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch -# Backport upstream patches for HyperV gen2 TSC timer calbration without RTC (bsc#904647) -Patch270: 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch -Patch271: 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch -Patch272: 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch -Patch273: 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch -Patch274: 0005-i386-fix-TSC-calibration-using-PIT.patch -Patch275: biendian.patch -Patch276: ppc64_opt.patch Patch277: grub2-ppc64-cas-reboot-support.patch Requires: gettext-runtime @@ -419,7 +371,6 @@ mv docs/grub.texi docs/grub2.texi mv po/grub.pot po/%{name}.pot %patch2 -p1 %patch3 -p1 -%patch4 -p1 %patch6 -p1 %patch8 -p1 %patch9 -p1 @@ -436,7 +387,6 @@ mv po/grub.pot po/%{name}.pot %patch29 -p1 %patch34 -p1 %patch35 -p1 -%patch36 -p1 %patch37 -p1 %patch38 -p1 %patch39 -p1 @@ -444,32 +394,16 @@ mv po/grub.pot po/%{name}.pot %patch41 -p1 %patch42 -p1 %patch43 -p1 -%patch44 -p1 -%patch45 -p1 -%patch46 -p1 -%patch47 -p1 -%patch48 -p1 -%patch51 -p1 -%patch52 -p1 %patch53 -p1 %patch56 -p1 -%patch57 -p1 %patch58 -p1 %patch59 -p1 %patch60 -p1 %patch61 -p1 -%patch62 -p1 -%patch63 -p1 %patch64 -p1 %patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 %patch70 -p1 %patch71 -p1 -%patch72 -p1 -%patch73 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 @@ -479,37 +413,11 @@ mv po/grub.pot po/%{name}.pot %patch120 -p1 %patch121 -p1 %patch122 -p1 -%patch201 -p1 -%patch202 -p1 -%patch203 -p1 -%patch204 -p1 %patch205 -p1 %patch207 -p1 -%patch229 -p1 -%patch230 -p1 -%patch231 -p1 -%patch232 -p1 %patch233 -p1 -%patch234 -p1 %patch235 -p1 %patch236 -p1 -%patch238 -p1 -%patch239 -p1 -%patch240 -p1 -%patch241 -p1 -%patch260 -p1 -%patch261 -p1 -%patch262 -p1 -%patch263 -p1 -%patch264 -p1 -%patch265 -p1 -%patch270 -p1 -%patch271 -p1 -%patch272 -p1 -%patch273 -p1 -%patch274 -p1 -%patch275 -p1 -%patch276 -p1 %patch277 -p1 # Generate po/LINGUAS for message catalogs ... @@ -727,12 +635,6 @@ install -m 644 -D %{SOURCE15} $RPM_BUILD_ROOT%{_unitdir}/grub2-once.service install -m 755 -D %{SOURCE17} $RPM_BUILD_ROOT%{_libdir}/systemd/system-sleep/grub2.sleep %endif -%ifarch ppc ppc64 ppc64le -# Rename grub2.chrp back to grub.chrp so it is found by tools -mv $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubarch}/%{name}.chrp \ - $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubarch}/grub.chrp -%endif - R=$RPM_BUILD_ROOT %ifarch %{ix86} x86_64 %else @@ -996,9 +898,9 @@ fi %{_sbindir}/%{name}-ofpathname %{_sbindir}/%{name}-sparc64-setup %{_mandir}/man1/%{name}-glue-efi.1.* -%{_mandir}/man1/%{name}-macbless.1.* %{_mandir}/man1/%{name}-mount.1.* %{_mandir}/man8/%{name}-bios-setup.8.* +%{_mandir}/man8/%{name}-macbless.8.* %{_mandir}/man8/%{name}-ofpathname.8.* %{_mandir}/man8/%{name}-sparc64-setup.8.* %endif @@ -1031,7 +933,7 @@ fi %ifarch x86_64 %{_libdir}/%{name}/%{grubarch}/efiemu*.o %endif -%{_libdir}/%{name}/%{grubarch}/gdb_grub2 +%{_libdir}/%{name}/%{grubarch}/gdb_grub %{_libdir}/%{name}/%{grubarch}/gmodule.pl %{_libdir}/%{name}/%{grubarch}/kernel.exec %{_libdir}/%{name}/%{grubarch}/modinfo.sh @@ -1052,7 +954,7 @@ fi %{_libdir}/%{name}/%{grubefiarch}/*.lst %{_libdir}/%{name}/%{grubefiarch}/*.mod %{_libdir}/%{name}/%{grubefiarch}/*.module -%{_libdir}/%{name}/%{grubefiarch}/gdb_grub2 +%{_libdir}/%{name}/%{grubefiarch}/gdb_grub %{_libdir}/%{name}/%{grubefiarch}/gmodule.pl %{_libdir}/%{name}/%{grubefiarch}/kernel.exec %{_libdir}/%{name}/%{grubefiarch}/modinfo.sh diff --git a/libgcc-prereq.patch b/libgcc-prereq.patch deleted file mode 100644 index 6575f72..0000000 --- a/libgcc-prereq.patch +++ /dev/null @@ -1,256 +0,0 @@ -From f371dd5da81701f7bc3d28c67cb4c2c289728691 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 21:22:57 +0400 -Subject: [PATCH] fix include loop on MinGW due to libintl.h pulling stdio.h - -In file included from ./include/grub/dl.h:23:0, - from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3: -./include/grub/list.h:34:18: warning: conflicting types for 'grub_list_push' [en -abled by default] - void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item); - ^ -./include/grub/symbol.h:68:25: note: in definition of macro 'EXPORT_FUNC' - # define EXPORT_FUNC(x) x - ^ -In file included from ./include/grub/fs.h:30:0, - from ./include/grub/file.h:25, - from ./grub-core/lib/posix_wrap/stdio.h:23, - from c:\mingw\include\libintl.h:314, - from ./include/grub/i18n.h:33, - from ./include/grub/misc.h:27, - from ./include/grub/list.h:25, - from ./include/grub/dl.h:28, - from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3: -./include/grub/partition.h:106:3: note: previous implicit declaration of 'grub_l -ist_push' was here - grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list), - ^ -list.h needs just ATTRIBUTE_ERROR from misc.h; split compiler features -into separate file grub/compiler.h and include it instead. ---- - ChangeLog | 14 +++++++++++ - grub-core/commands/fileXX.c | 1 + - grub-core/efiemu/prepare.c | 1 + - grub-core/loader/i386/xen_file.c | 1 + - grub-core/loader/i386/xen_fileXX.c | 1 + - grub-core/video/capture.c | 1 + - include/grub/command.h | 1 + - include/grub/compiler.h | 51 ++++++++++++++++++++++++++++++++++++++ - include/grub/dl.h | 1 + - include/grub/list.h | 4 +-- - include/grub/misc.h | 29 +--------------------- - include/grub/procfs.h | 1 + - 12 files changed, 76 insertions(+), 30 deletions(-) - create mode 100644 include/grub/compiler.h - -diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c -index c9857ff..58e1094 100644 ---- a/grub-core/commands/fileXX.c -+++ b/grub-core/commands/fileXX.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - - #pragma GCC diagnostic ignored "-Wcast-align" - -diff --git a/grub-core/efiemu/prepare.c b/grub-core/efiemu/prepare.c -index fb1b25d..84c3368 100644 ---- a/grub-core/efiemu/prepare.c -+++ b/grub-core/efiemu/prepare.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - -diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c -index ebbf6aa..ff23235 100644 ---- a/grub-core/loader/i386/xen_file.c -+++ b/grub-core/loader/i386/xen_file.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - - grub_elf_t - grub_xen_file (grub_file_t file) -diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c -index 6df0015..73a5f90 100644 ---- a/grub-core/loader/i386/xen_fileXX.c -+++ b/grub-core/loader/i386/xen_fileXX.c -@@ -17,6 +17,7 @@ - */ - - #include -+#include - - static grub_err_t - parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi, -diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c -index 67c8edd..4f83c74 100644 ---- a/grub-core/video/capture.c -+++ b/grub-core/video/capture.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - - static struct - { -diff --git a/include/grub/command.h b/include/grub/command.h -index 8705a63..eee4e84 100644 ---- a/include/grub/command.h -+++ b/include/grub/command.h -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - typedef enum grub_command_flags - { -diff --git a/include/grub/compiler.h b/include/grub/compiler.h -new file mode 100644 -index 0000000..c9e1d7a ---- /dev/null -+++ b/include/grub/compiler.h -@@ -0,0 +1,51 @@ -+/* compiler.h - macros for various compiler features */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010,2014 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_COMPILER_HEADER -+#define GRUB_COMPILER_HEADER 1 -+ -+/* GCC version checking borrowed from glibc. */ -+#if defined(__GNUC__) && defined(__GNUC_MINOR__) -+# define GNUC_PREREQ(maj,min) \ -+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -+#else -+# define GNUC_PREREQ(maj,min) 0 -+#endif -+ -+/* Does this compiler support compile-time error attributes? */ -+#if GNUC_PREREQ(4,3) -+# define ATTRIBUTE_ERROR(msg) \ -+ __attribute__ ((__error__ (msg))) -+#else -+# define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) -+#endif -+ -+#if GNUC_PREREQ(4,4) -+# define GNU_PRINTF gnu_printf -+#else -+# define GNU_PRINTF printf -+#endif -+ -+#if GNUC_PREREQ(3,4) -+# define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) -+#else -+# define WARN_UNUSED_RESULT -+#endif -+ -+#endif /* ! GRUB_COMPILER_HEADER */ -diff --git a/include/grub/dl.h b/include/grub/dl.h -index d29a899..9562fa6 100644 ---- a/include/grub/dl.h -+++ b/include/grub/dl.h -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #endif - - /* -diff --git a/include/grub/list.h b/include/grub/list.h -index edd20ad..d170ff6 100644 ---- a/include/grub/list.h -+++ b/include/grub/list.h -@@ -21,8 +21,8 @@ - #define GRUB_LIST_HEADER 1 - - #include --#include --#include -+#include -+#include - - struct grub_list - { -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 2cf74b5..c6cd456 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -25,34 +25,7 @@ - #include - #include - #include -- --/* GCC version checking borrowed from glibc. */ --#if defined(__GNUC__) && defined(__GNUC_MINOR__) --# define GNUC_PREREQ(maj,min) \ -- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) --#else --# define GNUC_PREREQ(maj,min) 0 --#endif -- --/* Does this compiler support compile-time error attributes? */ --#if GNUC_PREREQ(4,3) --# define ATTRIBUTE_ERROR(msg) \ -- __attribute__ ((__error__ (msg))) --#else --# define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) --#endif -- --#if GNUC_PREREQ(4,4) --# define GNU_PRINTF gnu_printf --#else --# define GNU_PRINTF printf --#endif -- --#if GNUC_PREREQ(3,4) --# define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) --#else --# define WARN_UNUSED_RESULT --#endif -+#include - - #define ALIGN_UP(addr, align) \ - ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) -diff --git a/include/grub/procfs.h b/include/grub/procfs.h -index d393da7..8cc331d 100644 ---- a/include/grub/procfs.h -+++ b/include/grub/procfs.h -@@ -20,6 +20,7 @@ - #define GRUB_PROCFS_HEADER 1 - - #include -+#include - - struct grub_procfs_entry - { --- -2.1.4 - diff --git a/libgcc.patch b/libgcc.patch deleted file mode 100644 index 154bd13..0000000 --- a/libgcc.patch +++ /dev/null @@ -1,440 +0,0 @@ -From: Paulo Flabiano Smorigo -Date: Wed, 13 Aug 2014 19:00:19 +0000 -Subject: [PATCH 142/143] Files reorganization and include some libgcc fuctions - -As we avoid libgcc dependency for powerpc64el, we moved some functions -to other files and add the necessary ones. - -* Makefile.core.def: Include compiler-rt.S. -* misc.c: Add the necessary libgcc functions. -* compiler-rt.S: New file. -* libgcc.h: Move some content from here ... -* compiler.h: ... to here. - -Also-By: Brent Baude -Also-By: Vladimir 'phcoder' Serbinenko ---- - grub-core/Makefile.core.def | 1 + - grub-core/kern/misc.c | 107 ++++++++++++++++++++++++++++ - grub-core/kern/powerpc/compiler-rt.S | 130 +++++++++++++++++++++++++++++++++++ - include/grub/compiler.h | 61 ++++++++++++++++ - include/grub/libgcc.h | 67 ------------------ - 5 files changed, 299 insertions(+), 67 deletions(-) - create mode 100644 grub-core/kern/powerpc/compiler-rt.S - -Index: grub-2.02~beta2/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -252,6 +252,7 @@ kernel = { - - powerpc_ieee1275 = kern/powerpc/cache.S; - powerpc_ieee1275 = kern/powerpc/dl.c; -+ powerpc_ieee1275 = kern/powerpc/compiler-rt.S; - - sparc64_ieee1275 = kern/sparc64/cache.S; - sparc64_ieee1275 = kern/sparc64/dl.c; -Index: grub-2.02~beta2/grub-core/kern/misc.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/misc.c -+++ grub-2.02~beta2/grub-core/kern/misc.c -@@ -1339,3 +1339,110 @@ grub_real_boot_time (const char *file, - grub_error_pop (); - } - #endif -+ -+#if defined (NO_LIBGCC) -+ -+/* Based on libgcc2.c from gcc suite. */ -+int -+__ucmpdi2 (grub_uint64_t a, grub_uint64_t b) -+{ -+ union component64 ac, bc; -+ ac.full = a; -+ bc.full = b; -+ -+ if (ac.high < bc.high) -+ return 0; -+ else if (ac.high > bc.high) -+ return 2; -+ -+ if (ac.low < bc.low) -+ return 0; -+ else if (ac.low > bc.low) -+ return 2; -+ return 1; -+} -+ -+ -+/* Based on libgcc2.c from gcc suite. */ -+grub_uint64_t -+__lshrdi3 (grub_uint64_t u, int b) -+{ -+ if (b == 0) -+ return u; -+ -+ const union component64 uu = {.full = u}; -+ const int bm = 32 - b; -+ union component64 w; -+ -+ if (bm <= 0) -+ { -+ w.high = 0; -+ w.low = (grub_uint32_t) uu.high >> -bm; -+ } -+ else -+ { -+ const grub_uint32_t carries = (grub_uint32_t) uu.high << bm; -+ -+ w.high = (grub_uint32_t) uu.high >> b; -+ w.low = ((grub_uint32_t) uu.low >> b) | carries; -+ } -+ -+ return w.full; -+} -+ -+/* Based on libgcc2.c from gcc suite. */ -+grub_uint64_t -+__ashrdi3 (grub_uint64_t u, int b) -+{ -+ if (b == 0) -+ return u; -+ -+ const union component64 uu = {.full = u}; -+ const int bm = 32 - b; -+ union component64 w; -+ -+ if (bm <= 0) -+ { -+ /* w.high = 1..1 or 0..0 */ -+ w.high = uu.high >> (32 - 1); -+ w.low = uu.high >> -bm; -+ } -+ else -+ { -+ const grub_uint32_t carries = (grub_uint32_t) uu.high << bm; -+ -+ w.high = uu.high >> b; -+ w.low = ((grub_uint32_t) uu.low >> b) | carries; -+ } -+ -+ return w.full; -+} -+ -+/* Based on libgcc2.c from gcc suite. */ -+grub_uint64_t -+__ashldi3 (grub_uint64_t u, int b) -+{ -+ if (b == 0) -+ return u; -+ -+ const union component64 uu = {.full = u}; -+ const int bm = 32 - b; -+ union component64 w; -+ -+ if (bm <= 0) -+ { -+ w.low = 0; -+ w.high = (grub_uint32_t) uu.low << -bm; -+ } -+ else -+ { -+ const grub_uint32_t carries = (grub_uint32_t) uu.low >> bm; -+ -+ w.low = (grub_uint32_t) uu.low << b; -+ w.high = ((grub_uint32_t) uu.high << b) | carries; -+ } -+ -+ return w.full; -+} -+ -+#endif -Index: grub-2.02~beta2/grub-core/kern/powerpc/compiler-rt.S -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/powerpc/compiler-rt.S -@@ -0,0 +1,130 @@ -+/* -+ * Special support for eabi and SVR4 -+ * -+ * Copyright (C) 1995-2014 Free Software Foundation, Inc. -+ * Written By Michael Meissner -+ * 64-bit support written by David Edelsohn -+ * -+ * This file is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 3, or (at your option) any -+ * later version. -+ * -+ * This file is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * Under Section 7 of GPL version 3, you are granted additional -+ * permissions described in the GCC Runtime Library Exception, version -+ * 3.1, as published by the Free Software Foundation. -+ * -+ * You should have received a copy of the GNU General Public License and -+ * a copy of the GCC Runtime Library Exception along with this program; -+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -+ * . -+ */ -+ -+/* Do any initializations needed for the eabi environment */ -+ -+#include -+#include -+ -+ .section ".text" -+ -+#define CFI_RESTORE(reg) .cfi_restore reg -+#define CFI_OFFSET(reg, off) .cfi_offset reg, off -+#define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg -+#define CFI_STARTPROC .cfi_startproc -+#define CFI_ENDPROC .cfi_endproc -+ -+/* Routines for restoring integer registers, called by the compiler. */ -+/* Called with r11 pointing to the stack header word of the caller of the */ -+/* function, just beyond the end of the integer restore area. */ -+ -+CFI_STARTPROC -+CFI_DEF_CFA_REGISTER (11) -+CFI_OFFSET (65, 4) -+CFI_OFFSET (14, -72) -+CFI_OFFSET (15, -68) -+CFI_OFFSET (16, -64) -+CFI_OFFSET (17, -60) -+CFI_OFFSET (18, -56) -+CFI_OFFSET (19, -52) -+CFI_OFFSET (20, -48) -+CFI_OFFSET (21, -44) -+CFI_OFFSET (22, -40) -+CFI_OFFSET (23, -36) -+CFI_OFFSET (24, -32) -+CFI_OFFSET (25, -28) -+CFI_OFFSET (26, -24) -+CFI_OFFSET (27, -20) -+CFI_OFFSET (28, -16) -+CFI_OFFSET (29, -12) -+CFI_OFFSET (30, -8) -+CFI_OFFSET (31, -4) -+FUNCTION(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */ -+CFI_RESTORE (14) -+FUNCTION(_restgpr_15_x) lwz 15,-68(11) -+CFI_RESTORE (15) -+FUNCTION(_restgpr_16_x) lwz 16,-64(11) -+CFI_RESTORE (16) -+FUNCTION(_restgpr_17_x) lwz 17,-60(11) -+CFI_RESTORE (17) -+FUNCTION(_restgpr_18_x) lwz 18,-56(11) -+CFI_RESTORE (18) -+FUNCTION(_restgpr_19_x) lwz 19,-52(11) -+CFI_RESTORE (19) -+FUNCTION(_restgpr_20_x) lwz 20,-48(11) -+CFI_RESTORE (20) -+FUNCTION(_restgpr_21_x) lwz 21,-44(11) -+CFI_RESTORE (21) -+FUNCTION(_restgpr_22_x) lwz 22,-40(11) -+CFI_RESTORE (22) -+FUNCTION(_restgpr_23_x) lwz 23,-36(11) -+CFI_RESTORE (23) -+FUNCTION(_restgpr_24_x) lwz 24,-32(11) -+CFI_RESTORE (24) -+FUNCTION(_restgpr_25_x) lwz 25,-28(11) -+CFI_RESTORE (25) -+FUNCTION(_restgpr_26_x) lwz 26,-24(11) -+CFI_RESTORE (26) -+FUNCTION(_restgpr_27_x) lwz 27,-20(11) -+CFI_RESTORE (27) -+FUNCTION(_restgpr_28_x) lwz 28,-16(11) -+CFI_RESTORE (28) -+FUNCTION(_restgpr_29_x) lwz 29,-12(11) -+CFI_RESTORE (29) -+FUNCTION(_restgpr_30_x) lwz 30,-8(11) -+CFI_RESTORE (30) -+FUNCTION(_restgpr_31_x) lwz 0,4(11) -+ lwz 31,-4(11) -+CFI_RESTORE (31) -+ mtlr 0 -+CFI_RESTORE (65) -+ mr 1,11 -+CFI_DEF_CFA_REGISTER (1) -+ blr -+CFI_ENDPROC -+ -+CFI_STARTPROC -+FUNCTION(_savegpr_14) stw 14,-72(11) /* save gp registers */ -+FUNCTION(_savegpr_15) stw 15,-68(11) -+FUNCTION(_savegpr_16) stw 16,-64(11) -+FUNCTION(_savegpr_17) stw 17,-60(11) -+FUNCTION(_savegpr_18) stw 18,-56(11) -+FUNCTION(_savegpr_19) stw 19,-52(11) -+FUNCTION(_savegpr_20) stw 20,-48(11) -+FUNCTION(_savegpr_21) stw 21,-44(11) -+FUNCTION(_savegpr_22) stw 22,-40(11) -+FUNCTION(_savegpr_23) stw 23,-36(11) -+FUNCTION(_savegpr_24) stw 24,-32(11) -+FUNCTION(_savegpr_25) stw 25,-28(11) -+FUNCTION(_savegpr_26) stw 26,-24(11) -+FUNCTION(_savegpr_27) stw 27,-20(11) -+FUNCTION(_savegpr_28) stw 28,-16(11) -+FUNCTION(_savegpr_29) stw 29,-12(11) -+FUNCTION(_savegpr_30) stw 30,-8(11) -+FUNCTION(_savegpr_31) stw 31,-4(11) -+ blr -+CFI_ENDPROC -Index: grub-2.02~beta2/include/grub/compiler.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/compiler.h -+++ grub-2.02~beta2/include/grub/compiler.h -@@ -48,4 +48,65 @@ - # define WARN_UNUSED_RESULT - #endif - -+#include "types.h" -+ -+union component64 -+{ -+ grub_uint64_t full; -+ struct -+ { -+#ifdef GRUB_CPU_WORDS_BIGENDIAN -+ grub_uint32_t high; -+ grub_uint32_t low; -+#else -+ grub_uint32_t low; -+ grub_uint32_t high; -+#endif -+ }; -+}; -+ -+#if defined (__powerpc__) -+grub_uint64_t EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b); -+grub_uint64_t EXPORT_FUNC (__ashrdi3) (grub_uint64_t u, int b); -+grub_uint64_t EXPORT_FUNC (__ashldi3) (grub_uint64_t u, int b); -+int EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b); -+void EXPORT_FUNC (_restgpr_14_x) (void); -+void EXPORT_FUNC (_restgpr_15_x) (void); -+void EXPORT_FUNC (_restgpr_16_x) (void); -+void EXPORT_FUNC (_restgpr_17_x) (void); -+void EXPORT_FUNC (_restgpr_18_x) (void); -+void EXPORT_FUNC (_restgpr_19_x) (void); -+void EXPORT_FUNC (_restgpr_20_x) (void); -+void EXPORT_FUNC (_restgpr_21_x) (void); -+void EXPORT_FUNC (_restgpr_22_x) (void); -+void EXPORT_FUNC (_restgpr_23_x) (void); -+void EXPORT_FUNC (_restgpr_24_x) (void); -+void EXPORT_FUNC (_restgpr_25_x) (void); -+void EXPORT_FUNC (_restgpr_26_x) (void); -+void EXPORT_FUNC (_restgpr_27_x) (void); -+void EXPORT_FUNC (_restgpr_28_x) (void); -+void EXPORT_FUNC (_restgpr_29_x) (void); -+void EXPORT_FUNC (_restgpr_30_x) (void); -+void EXPORT_FUNC (_restgpr_31_x) (void); -+void EXPORT_FUNC (_savegpr_14) (void); -+void EXPORT_FUNC (_savegpr_15) (void); -+void EXPORT_FUNC (_savegpr_16) (void); -+void EXPORT_FUNC (_savegpr_17) (void); -+void EXPORT_FUNC (_savegpr_18) (void); -+void EXPORT_FUNC (_savegpr_19) (void); -+void EXPORT_FUNC (_savegpr_20) (void); -+void EXPORT_FUNC (_savegpr_21) (void); -+void EXPORT_FUNC (_savegpr_22) (void); -+void EXPORT_FUNC (_savegpr_23) (void); -+void EXPORT_FUNC (_savegpr_24) (void); -+void EXPORT_FUNC (_savegpr_25) (void); -+void EXPORT_FUNC (_savegpr_26) (void); -+void EXPORT_FUNC (_savegpr_27) (void); -+void EXPORT_FUNC (_savegpr_28) (void); -+void EXPORT_FUNC (_savegpr_29) (void); -+void EXPORT_FUNC (_savegpr_30) (void); -+void EXPORT_FUNC (_savegpr_31) (void); -+ -+#endif -+ - #endif /* ! GRUB_COMPILER_HEADER */ -Index: grub-2.02~beta2/include/grub/libgcc.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/libgcc.h -+++ grub-2.02~beta2/include/grub/libgcc.h -@@ -16,79 +16,6 @@ - * along with GRUB. If not, see . - */ - --/* We need to include config-util.h.in for HAVE_*. */ --#ifndef __STDC_VERSION__ --#define __STDC_VERSION__ 0 --#endif --#include -- --/* On x86 these functions aren't really needed. Save some space. */ --#if !defined (__i386__) && !defined (__x86_64__) --# ifdef HAVE___ASHLDI3 --void EXPORT_FUNC (__ashldi3) (void); --# endif --# ifdef HAVE___ASHRDI3 --void EXPORT_FUNC (__ashrdi3) (void); --# endif --# ifdef HAVE___LSHRDI3 --void EXPORT_FUNC (__lshrdi3) (void); --# endif --# ifdef HAVE___UCMPDI2 --void EXPORT_FUNC (__ucmpdi2) (void); --# endif --# ifdef HAVE___BSWAPSI2 --void EXPORT_FUNC (__bswapsi2) (void); --# endif --# ifdef HAVE___BSWAPDI2 --void EXPORT_FUNC (__bswapdi2) (void); --# endif --# ifdef HAVE___CTZDI2 --void EXPORT_FUNC (__ctzdi2) (void); --# endif --# ifdef HAVE___CTZSI2 --void EXPORT_FUNC (__ctzsi2) (void); --# endif --#endif -- --#ifdef HAVE__RESTGPR_14_X --void EXPORT_FUNC (_restgpr_14_x) (void); --void EXPORT_FUNC (_restgpr_15_x) (void); --void EXPORT_FUNC (_restgpr_16_x) (void); --void EXPORT_FUNC (_restgpr_17_x) (void); --void EXPORT_FUNC (_restgpr_18_x) (void); --void EXPORT_FUNC (_restgpr_19_x) (void); --void EXPORT_FUNC (_restgpr_20_x) (void); --void EXPORT_FUNC (_restgpr_21_x) (void); --void EXPORT_FUNC (_restgpr_22_x) (void); --void EXPORT_FUNC (_restgpr_23_x) (void); --void EXPORT_FUNC (_restgpr_24_x) (void); --void EXPORT_FUNC (_restgpr_25_x) (void); --void EXPORT_FUNC (_restgpr_26_x) (void); --void EXPORT_FUNC (_restgpr_27_x) (void); --void EXPORT_FUNC (_restgpr_28_x) (void); --void EXPORT_FUNC (_restgpr_29_x) (void); --void EXPORT_FUNC (_restgpr_30_x) (void); --void EXPORT_FUNC (_restgpr_31_x) (void); --void EXPORT_FUNC (_savegpr_14) (void); --void EXPORT_FUNC (_savegpr_15) (void); --void EXPORT_FUNC (_savegpr_16) (void); --void EXPORT_FUNC (_savegpr_17) (void); --void EXPORT_FUNC (_savegpr_18) (void); --void EXPORT_FUNC (_savegpr_19) (void); --void EXPORT_FUNC (_savegpr_20) (void); --void EXPORT_FUNC (_savegpr_21) (void); --void EXPORT_FUNC (_savegpr_22) (void); --void EXPORT_FUNC (_savegpr_23) (void); --void EXPORT_FUNC (_savegpr_24) (void); --void EXPORT_FUNC (_savegpr_25) (void); --void EXPORT_FUNC (_savegpr_26) (void); --void EXPORT_FUNC (_savegpr_27) (void); --void EXPORT_FUNC (_savegpr_28) (void); --void EXPORT_FUNC (_savegpr_29) (void); --void EXPORT_FUNC (_savegpr_30) (void); --void EXPORT_FUNC (_savegpr_31) (void); --#endif -- - #if defined (__arm__) - void EXPORT_FUNC (__aeabi_lasr) (void); - void EXPORT_FUNC (__aeabi_llsl) (void); diff --git a/ppc64_opt.patch b/ppc64_opt.patch deleted file mode 100644 index fd2f34b..0000000 --- a/ppc64_opt.patch +++ /dev/null @@ -1,26 +0,0 @@ -From afd0f21b2027310fda52b00ac1b964041d39a363 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Mon, 15 Jun 2015 09:10:19 -0300 -Subject: [PATCH] Add flag for powerpc ieee1275 to avoid unneeded optimizations - ---- - conf/Makefile.common | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 96e58c9..fcb8d2e 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -17,6 +17,9 @@ endif - if COND_arm64 - CFLAGS_PLATFORM += -mcmodel=large - endif -+if COND_powerpc_ieee1275 -+ CFLAGS_PLATFORM += -mcpu=powerpc -+endif - - #FIXME: discover and check XEN headers - CPPFLAGS_XEN = -I/usr/include --- -2.1.4 - diff --git a/ppc64le.patch b/ppc64le.patch deleted file mode 100644 index b1d916d..0000000 --- a/ppc64le.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 8014cad21bb2cc986f10f0a927036851f490a8ec Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Wed, 13 Aug 2014 18:59:58 +0000 -Subject: [PATCH 141/143] Add powerpc little-endian (ppc64le) flags - -libgcc dependency was removed *just* for this target because -the distros that use ppc64el doesn't have 32-bit support on it. - -* configure.ac: Add targets for powerpc64el and skip libgcc. -* Makefile.am: Likewise. ---- - configure.ac | 17 +++++++++++++++-- - grub-core/Makefile.am | 2 ++ - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 2632e2d..53fd7c7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -142,6 +142,7 @@ if test "x$with_platform" = x; then - x86_64-*) platform=pc ;; - powerpc-*) platform=ieee1275 ;; - powerpc64-*) platform=ieee1275 ;; -+ powerpc64le-*) platform=ieee1275 ;; - sparc64-*) platform=ieee1275 ;; - mipsel-*) platform=loongson ;; - mips-*) platform=arc ;; -@@ -160,6 +161,7 @@ case "$target_cpu"-"$platform" in - x86_64-xen) ;; - x86_64-*) target_cpu=i386 ;; - powerpc64-ieee1275) target_cpu=powerpc ;; -+ powerpc64le-ieee1275) target_cpu=powerpc ;; - esac - - # Check if the platform is supported, make final adjustments. -@@ -604,6 +606,13 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then - TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" - fi - -+if test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno; then -+ LD_FORCE_LE=1 -+ TARGET_CFLAGS="$TARGET_CFLAGS -mbig-endian -DNO_LIBGCC=1" -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mbig-endian" -+ TARGET_LDFLAGS="$TARGET_LDFLAGS -static -mbig-endian" -+fi -+ - if test "x$target_m32" = x1; then - # Force 32-bit mode. - TARGET_CFLAGS="$TARGET_CFLAGS -m32" -@@ -1047,7 +1056,8 @@ else - CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error" - fi - CPPFLAGS="$TARGET_CPPFLAGS" --if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then -+if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes \ -+ || ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then - TARGET_LIBGCC= - else - TARGET_LIBGCC=-lgcc -@@ -1631,7 +1641,9 @@ if test x"$enable_werror" != xno ; then - HOST_CFLAGS="$HOST_CFLAGS -Werror" - fi - --if test "x$grub_cv_cc_target_clang" = xno; then -+# if not clang or power LE, use static libgcc -+if test "x$grub_cv_cc_target_clang" = xno \ -+ || ! ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then - TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc" - else - TARGET_LDFLAGS_STATIC_LIBGCC= -@@ -1694,6 +1706,7 @@ AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = - AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) - AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu]) - AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) -+AM_CONDITIONAL([COND_powerpc_le], [test x$target_cpu = xpowerpc -a x$ac_cv_c_bigendian = xno]) - AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) - AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel]) - AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips]) -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 5c087c8..cb7fd9f 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -84,8 +84,10 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h - if !COND_clang -+if !COND_powerpc_le - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h - endif -+endif - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h - - if COND_i386_pc --- -1.9.3 diff --git a/rename-grub-info-file-to-grub2.patch b/rename-grub-info-file-to-grub2.patch index 77706af..634e8e4 100644 --- a/rename-grub-info-file-to-grub2.patch +++ b/rename-grub-info-file-to-grub2.patch @@ -12,10 +12,10 @@ files - Makefile.core.am and Makefile.util.am - it may be necessary to manually rename it. --- -Index: grub-2.02~beta1/docs/Makefile.am +Index: grub-2.02~beta3/docs/Makefile.am =================================================================== ---- grub-2.02~beta1.orig/docs/Makefile.am -+++ grub-2.02~beta1/docs/Makefile.am +--- grub-2.02~beta3.orig/docs/Makefile.am 2016-02-28 19:19:14.788874638 +0300 ++++ grub-2.02~beta3/docs/Makefile.am 2016-02-28 19:19:14.780874638 +0300 @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = subdir-objects @@ -25,91 +25,10 @@ Index: grub-2.02~beta1/docs/Makefile.am grub_TEXINFOS = fdl.texi EXTRA_DIST = font_char_metrics.png font_char_metrics.txt -Index: grub-2.02~beta1/docs/Makefile.in +Index: grub-2.02~beta3/docs/grub.texi =================================================================== ---- grub-2.02~beta1.orig/docs/Makefile.in -+++ grub-2.02~beta1/docs/Makefile.in -@@ -79,7 +79,7 @@ host_triplet = @host@ - target_triplet = @target@ - subdir = docs - DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ -- $(grub_TEXINFOS) $(top_srcdir)/build-aux/mdate-sh \ -+ $(top_srcdir)/build-aux/mdate-sh \ - $(srcdir)/version.texi $(srcdir)/stamp-vti \ - $(srcdir)/version-dev.texi $(srcdir)/stamp-1 \ - $(top_srcdir)/build-aux/texinfo.tex mdate-sh texinfo.tex -@@ -184,14 +184,14 @@ AM_V_texidevnull = $(am__v_texidevnull_@ - am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) - am__v_texidevnull_0 = > /dev/null - am__v_texidevnull_1 = --INFO_DEPS = $(srcdir)/grub.info $(srcdir)/grub-dev.info -+INFO_DEPS = $(srcdir)/grub2.info $(srcdir)/grub-dev.info - TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex - am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux --DVIS = grub.dvi grub-dev.dvi --PDFS = grub.pdf grub-dev.pdf --PSS = grub.ps grub-dev.ps --HTMLS = grub.html grub-dev.html --TEXINFOS = grub.texi grub-dev.texi -+DVIS = grub2.dvi grub-dev.dvi -+PDFS = grub2.pdf grub-dev.pdf -+PSS = grub2.ps grub-dev.ps -+HTMLS = grub2.html grub-dev.html -+TEXINFOS = grub2.texi grub-dev.texi - TEXI2DVI = texi2dvi - TEXI2PDF = $(TEXI2DVI) --pdf --batch - MAKEINFOHTML = $(MAKEINFO) --html -@@ -1068,7 +1068,7 @@ top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = subdir-objects - - # AM_MAKEINFOFLAGS = --no-split --no-validate --info_TEXINFOS = grub.texi grub-dev.texi -+info_TEXINFOS = grub2.texi grub-dev.texi - grub_TEXINFOS = fdl.texi - EXTRA_DIST = font_char_metrics.png font_char_metrics.txt - all: all-am -@@ -1149,14 +1149,14 @@ $(am__aclocal_m4_deps): - else \ - rm -rf $(@:.html=.htp); exit 1; \ - fi --$(srcdir)/grub.info: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) --grub.dvi: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) --grub.pdf: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) --grub.html: grub.texi $(srcdir)/version.texi $(grub_TEXINFOS) -+$(srcdir)/grub2.info: grub2.texi $(srcdir)/version.texi -+grub2.dvi: grub2.texi $(srcdir)/version.texi -+grub2.pdf: grub2.texi $(srcdir)/version.texi -+grub2.html: grub2.texi $(srcdir)/version.texi - $(srcdir)/version.texi: $(srcdir)/stamp-vti --$(srcdir)/stamp-vti: grub.texi $(top_srcdir)/configure -- @(dir=.; test -f ./grub.texi || dir=$(srcdir); \ -- set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/grub.texi`; \ -+$(srcdir)/stamp-vti: grub2.texi $(top_srcdir)/configure -+ @(dir=.; test -f ./grub2.texi || dir=$(srcdir); \ -+ set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/grub2.texi`; \ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(VERSION)"; \ -@@ -1276,12 +1276,12 @@ dist-info: $(INFO_DEPS) - done - - mostlyclean-aminfo: -- -rm -rf grub.t2d grub.t2p grub-dev.t2d grub-dev.t2p -+ -rm -rf grub2.t2d grub2.t2p grub-dev.t2d grub-dev.t2p - - clean-aminfo: -- -test -z "grub.dvi grub.pdf grub.ps grub.html grub-dev.dvi grub-dev.pdf \ -+ -test -z "grub2.dvi grub2.pdf grub2.ps grub2.html grub-dev.dvi grub-dev.pdf \ - grub-dev.ps grub-dev.html" \ -- || rm -rf grub.dvi grub.pdf grub.ps grub.html grub-dev.dvi grub-dev.pdf \ -+ || rm -rf grub2.dvi grub2.pdf grub2.ps grub2.html grub-dev.dvi grub-dev.pdf \ - grub-dev.ps grub-dev.html - - maintainer-clean-aminfo: -Index: grub-2.02~beta1/docs/grub.texi -=================================================================== ---- grub-2.02~beta1.orig/docs/grub.texi -+++ grub-2.02~beta1/docs/grub.texi +--- grub-2.02~beta3.orig/docs/grub.texi 2016-02-28 19:19:14.788874638 +0300 ++++ grub-2.02~beta3/docs/grub.texi 2016-02-28 19:19:14.784874638 +0300 @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- diff --git a/use-grub2-as-a-package-name.patch b/use-grub2-as-a-package-name.patch index 010e297..9a7fdc1 100644 --- a/use-grub2-as-a-package-name.patch +++ b/use-grub2-as-a-package-name.patch @@ -12,16 +12,16 @@ Signed-off-by: Jiri Slaby configure.ac | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) -Index: grub-2.02~beta2/configure.ac +Index: grub-2.02~beta3/configure.ac =================================================================== ---- grub-2.02~beta2.orig/configure.ac -+++ grub-2.02~beta2/configure.ac -@@ -32,7 +32,7 @@ dnl type, so there is no conflict. Varia - dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target - dnl type. +--- grub-2.02~beta3.orig/configure.ac 2016-02-28 19:22:28.028876923 +0300 ++++ grub-2.02~beta3/configure.ac 2016-02-28 19:22:57.596877272 +0300 +@@ -31,7 +31,7 @@ + dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are + dnl used for the target type. See INSTALL for full list of variables. --AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org]) -+AC_INIT([GRUB2],[2.02~beta2],[bug-grub@gnu.org]) +-AC_INIT([GRUB],[2.02~beta3],[bug-grub@gnu.org]) ++AC_INIT([GRUB2],[2.02~beta3],[bug-grub@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) From 88e55c1dc59ff436c879fd240e214c282744b3cd0fd047f2b10a485c251abedf Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 2 Mar 2016 02:59:16 +0000 Subject: [PATCH 2/3] Accepting request 363782 from home:arvidjaar:grub2-next Fix Factory review and add feature to changelog OBS-URL: https://build.opensuse.org/request/show/363782 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=206 --- grub2.changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub2.changes b/grub2.changes index 7a67bd4..7b58ae8 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,5 +1,5 @@ ------------------------------------------------------------------- -Mon Feb 29 03:40:22 UTC 2016 - arvidjaar@gmail.com +Tue Mar 1 18:53:17 UTC 2016 - arvidjaar@gmail.com - new upstream version 2.02~beta3 * highlights of user visible changes not yet present in openSUSE package @@ -18,6 +18,7 @@ Mon Feb 29 03:40:22 UTC 2016 - arvidjaar@gmail.com - LVM RAID1 support - xnu loader fixes which should make OS X menu entry generated by os-prober work again + - key modifiers (Ctrl-X etc) should work on EFI too - ... and lot of fixes over entire tree * rediff - rename-grub-info-file-to-grub2.patch @@ -74,6 +75,7 @@ Mon Feb 29 03:40:22 UTC 2016 - arvidjaar@gmail.com - 0001-Fix-security-issue-when-reading-username-and-passwor.patch - 0001-menu-fix-line-count-calculation-for-long-lines.patch - grub2-arm64-Reduce-timer-event-frequency-by-10.patch + - 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch - 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch - 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch - 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch From 2e14e5acb80b10a265ea6efa623972124325b0e2ac6ede8df6770c68ef610db2 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Fri, 4 Mar 2016 02:44:35 +0000 Subject: [PATCH 3/3] Accepting request 365018 from home:algraf:arm-efi This is another attempt at getting U-Boot EFI based boot support work with grub2. The major change to the last sr is that this time around I dropped the patch to force uuid setting, since with newer u-boot code we don't need that anymore :). Thanks a lot for the review! Alex - Make mkconfig search for zImage on arm * grub2-mkconfig-arm.patch - Add support to directly pass an EFI FDT table to a kernel on 32bit arm * 0001-arm64-Move-firmware-fdt-search-into-global-function.patch * 0002-arm-efi-Use-fdt-from-firmware-when-available.patch OBS-URL: https://build.opensuse.org/request/show/365018 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=207 --- ...ware-fdt-search-into-global-function.patch | 106 ++++++++++++++++++ ...Use-fdt-from-firmware-when-available.patch | 33 ++++++ grub2-mkconfig-arm.patch | 12 ++ grub2.changes | 13 +++ grub2.spec | 7 ++ 5 files changed, 171 insertions(+) create mode 100644 0001-arm64-Move-firmware-fdt-search-into-global-function.patch create mode 100644 0002-arm-efi-Use-fdt-from-firmware-when-available.patch create mode 100644 grub2-mkconfig-arm.patch diff --git a/0001-arm64-Move-firmware-fdt-search-into-global-function.patch b/0001-arm64-Move-firmware-fdt-search-into-global-function.patch new file mode 100644 index 0000000..21e0f0f --- /dev/null +++ b/0001-arm64-Move-firmware-fdt-search-into-global-function.patch @@ -0,0 +1,106 @@ +From 3750bd8d7cf8a7a7bbbda3354bea64f86cb34910 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Mon, 4 Jan 2016 22:00:04 +0100 +Subject: [PATCH 1/2] arm64: Move firmware fdt search into global function + +Searching for a device tree that EFI passes to us via configuration tables +is nothing architecture specific. Move it into generic code. + +Signed-off-by: Alexander Graf +--- + grub-core/kern/efi/init.c | 22 ++++++++++++++++++++++ + grub-core/loader/arm64/fdt.c | 24 +----------------------- + include/grub/efi/efi.h | 2 ++ + 3 files changed, 25 insertions(+), 23 deletions(-) + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index e9c85de..fb90ecd 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -72,6 +72,28 @@ grub_machine_get_bootlocation (char **device, char **path) + } + } + ++void * ++grub_efi_get_firmware_fdt (void) ++{ ++ grub_efi_configuration_table_t *tables; ++ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; ++ void *firmware_fdt = NULL; ++ unsigned int i; ++ ++ /* Look for FDT in UEFI config tables. */ ++ tables = grub_efi_system_table->configuration_table; ++ ++ for (i = 0; i < grub_efi_system_table->num_table_entries; i++) ++ if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0) ++ { ++ firmware_fdt = tables[i].vendor_table; ++ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt); ++ break; ++ } ++ ++ return firmware_fdt; ++} ++ + void + grub_efi_fini (void) + { +diff --git a/grub-core/loader/arm64/fdt.c b/grub-core/loader/arm64/fdt.c +index 5202c14..db49cf6 100644 +--- a/grub-core/loader/arm64/fdt.c ++++ b/grub-core/loader/arm64/fdt.c +@@ -28,28 +28,6 @@ + static void *loaded_fdt; + static void *fdt; + +-static void * +-get_firmware_fdt (void) +-{ +- grub_efi_configuration_table_t *tables; +- grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; +- void *firmware_fdt = NULL; +- unsigned int i; +- +- /* Look for FDT in UEFI config tables. */ +- tables = grub_efi_system_table->configuration_table; +- +- for (i = 0; i < grub_efi_system_table->num_table_entries; i++) +- if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0) +- { +- firmware_fdt = tables[i].vendor_table; +- grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt); +- break; +- } +- +- return firmware_fdt; +-} +- + void * + grub_fdt_load (grub_size_t additional_size) + { +@@ -65,7 +43,7 @@ grub_fdt_load (grub_size_t additional_size) + if (loaded_fdt) + raw_fdt = loaded_fdt; + else +- raw_fdt = get_firmware_fdt(); ++ raw_fdt = grub_efi_get_firmware_fdt(); + + size = + raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ; +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 0e6fd86..2acf85e 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -81,6 +81,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + char **device, + char **path); + ++void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); ++ + grub_addr_t grub_efi_modules_addr (void); + + void grub_efi_mm_init (void); +-- +2.7.1 + diff --git a/0002-arm-efi-Use-fdt-from-firmware-when-available.patch b/0002-arm-efi-Use-fdt-from-firmware-when-available.patch new file mode 100644 index 0000000..87c9d0f --- /dev/null +++ b/0002-arm-efi-Use-fdt-from-firmware-when-available.patch @@ -0,0 +1,33 @@ +From 2a36cece32e4b967d164f974b5b5740cfa0375e1 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Mon, 4 Jan 2016 22:05:55 +0100 +Subject: [PATCH 2/2] arm efi: Use fdt from firmware when available + +If EFI is nice enough to pass us an FDT using configuration tables on 32bit +ARM, we should really try and make use of it. + +Signed-off-by: Alexander Graf +--- + include/grub/arm/linux.h | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h +index 059dbba..a66caad 100644 +--- a/include/grub/arm/linux.h ++++ b/include/grub/arm/linux.h +@@ -40,11 +40,7 @@ + # define LINUX_PHYS_OFFSET (0x00008000) + # define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) + # define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) +-static inline grub_addr_t +-grub_arm_firmware_get_boot_data (void) +-{ +- return 0; +-} ++# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt + static inline grub_uint32_t + grub_arm_firmware_get_machine_type (void) + { +-- +2.7.1 + diff --git a/grub2-mkconfig-arm.patch b/grub2-mkconfig-arm.patch new file mode 100644 index 0000000..00423b1 --- /dev/null +++ b/grub2-mkconfig-arm.patch @@ -0,0 +1,12 @@ +Index: grub-2.02~beta3/util/grub.d/10_linux.in +=================================================================== +--- grub-2.02~beta3.orig/util/grub.d/10_linux.in ++++ grub-2.02~beta3/util/grub.d/10_linux.in +@@ -193,6 +193,7 @@ machine=`uname -m` + case "x$machine" in + xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; + xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; ++ xarm*) klist="/boot/zImage-* /zImage-* /boot/kernel-*" ;; + xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; + *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ + /boot/kernel-*" ;; diff --git a/grub2.changes b/grub2.changes index 7b58ae8..b612aa6 100644 --- a/grub2.changes +++ b/grub2.changes @@ -86,6 +86,19 @@ Tue Mar 1 18:53:17 UTC 2016 - arvidjaar@gmail.com * drop workarounds for gdb_grub and grub.chrp, they are now installed under fixed name * do not patch docs/Makefile.in, it is regenerated anyway +------------------------------------------------------------------- +Tue Mar 1 11:06:34 UTC 2016 - agraf@suse.com + +- Make mkconfig search for zImage on arm + * grub2-mkconfig-arm.patch + +------------------------------------------------------------------- +Sun Feb 28 23:10:06 UTC 2016 - agraf@suse.com + +- Add support to directly pass an EFI FDT table to a kernel on 32bit arm + * 0001-arm64-Move-firmware-fdt-search-into-global-function.patch + * 0002-arm-efi-Use-fdt-from-firmware-when-available.patch + ------------------------------------------------------------------- Fri Jan 29 03:54:15 UTC 2016 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index ece8758..e8bcb15 100644 --- a/grub2.spec +++ b/grub2.spec @@ -186,6 +186,7 @@ Patch64: grub2-btrfs-workaround-grub2-once.patch Patch65: grub2-mkconfig-aarch64.patch Patch70: grub2-default-distributor.patch Patch71: grub2-menu-unrestricted.patch +Patch72: grub2-mkconfig-arm.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 @@ -197,6 +198,9 @@ Patch106: grub2-btrfs-06-subvol-mount.patch Patch120: grub2-efi-xen-chainload.patch Patch121: grub2-efi-chainloader-root.patch Patch122: grub2-efi-xen-cmdline.patch +# 32bit ARM EFI FDT table pass-through support +Patch130: 0001-arm64-Move-firmware-fdt-search-into-global-function.patch +Patch131: 0002-arm-efi-Use-fdt-from-firmware-when-available.patch # PPC64 LE support Patch205: grub2-ppc64le-disable-video.patch Patch207: grub2-ppc64le-memory-map.patch @@ -404,6 +408,7 @@ mv po/grub.pot po/%{name}.pot %patch65 -p1 %patch70 -p1 %patch71 -p1 +%patch72 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 @@ -413,6 +418,8 @@ mv po/grub.pot po/%{name}.pot %patch120 -p1 %patch121 -p1 %patch122 -p1 +%patch130 -p1 +%patch131 -p1 %patch205 -p1 %patch207 -p1 %patch233 -p1