diff -Nru grub2-2.02~beta2/debian/changelog grub2-2.02~beta2/debian/changelog --- grub2-2.02~beta2/debian/changelog 2014-04-10 16:34:46.000000000 +0000 +++ grub2-2.02~beta2/debian/changelog 2018-07-04 19:28:17.000000000 +0000 @@ -1,3 +1,132 @@ +grub2 (2.02~beta2-9ubuntu1.15) trusty; urgency=medium + + * util/grub-install.c: Use MokManager EFI binary name without + the .signed extension now that shim handles signing via sbsigntool + natively. (LP: #1708245) + - debian/patches/install_signed.patch + * debian/control: Breaks shim << 13 due to the renamed MokManager binary. + + -- Mathieu Trudel-Lapierre Wed, 04 Jul 2018 15:28:17 -0400 + +grub2 (2.02~beta2-9ubuntu1.14) trusty; urgency=medium + + * debian/patches/install_signed.patch: update to use the new names for the + shim binary (shim$arch) and MokManager (mm$arch). (LP: #1637290) + * debian/control: Breaks shim (<< 0.9+1474479173.6c180c6-0ubuntu1~) for the + renamed EFI binaries. + + -- Mathieu Trudel-Lapierre Fri, 14 Jul 2017 12:20:11 -0400 + +grub2 (2.02~beta2-9ubuntu1.12) trusty; urgency=medium + + * debian/patches/uefi_firmware_setup.patch: take into account that the UEFI + variable OsIndicationsSupported is a bit field, and as such should be + compared as hex values in 30_uefi-firmware.in. (LP: #1456911) + + -- Mathieu Trudel-Lapierre Fri, 29 Jul 2016 14:50:13 -0400 + +grub2 (2.02~beta2-9ubuntu1.11) trusty-proposed; urgency=medium + + * Add support for running a 64-bit Linux kernel on a 32-bit EFI. + (LP: #1591818) + + -- Shih-Yuan Lee (FourDollars) Wed, 08 Jun 2016 13:53:40 +0800 + +grub2 (2.02~beta2-9ubuntu1.8) trusty; urgency=medium + + * debian/prep-bootdev.c: add prep-bootdev for use in postinst (and to help + detecting the prep partition on ppc64el in general). + * debian/rules: build the prep-bootdev binary for grub-ieee1275. + * debian/control: add libparted-dev to Build-Depends for prep-bootdev. + * debian/grub-ieee1275-bin.install.ppc64el.in: ship prep-bootdev. + * debian/clean: clean up prep-bootdev. + * debian/postinst.in: (LP: #1549064) + - run prep-bootdev to have a device to point grub-ieee1275 to to install + the new bootloader data to when calling grub-install. + - run grub-install with --no-nvram to avoid clobbering the boot-device + variable every time grub is updated. + + -- Mathieu Trudel-Lapierre Wed, 24 Feb 2016 14:39:34 -0500 + +grub2 (2.02~beta2-9ubuntu1.7) trusty; urgency=medium + + * Cherry-picks to better handle TFTP timeouts on some arches: (LP: #1521612) + - (7b386b7) efidisk: move device path helpers in core for efinet + - (c52ae40) efinet: skip virtual IP devices when enumerating cards + - (f348aee) efinet: enable hardware filters when opening interface + * Update quick boot logic to handle abstractions for which there is no + write support. (LP: #1274320) + + -- dann frazier Wed, 16 Dec 2015 14:03:48 -0700 + +grub2 (2.02~beta2-9ubuntu1.6) trusty-security; urgency=medium + + * SECURITY UPDATE: password bypass via backspace key buffer overflow + - debian/patches/CVE-2015-8370.patch: check length before accepting a + backspace character in grub-core/lib/crypto.c, + grub-core/normal/auth.c. + - CVE-2015-8370 + + -- Marc Deslauriers Tue, 15 Dec 2015 09:11:24 -0500 + +grub2 (2.02~beta2-9ubuntu1.5) trusty; urgency=medium + + * d/p/arm64-set-correct-length-of-device-path-end-entry.patch: Fixes + booting arm64 kernels on certain UEFI implementations. (LP: #1476882) + * progress: avoid NULL dereference for net files. (LP: #1459872) + * arm64/setjmp: Add missing license macro. (LP: #1459871) + * Cherry-pick patch to add SAS disks to the device list from the ofdisk + module. (LP: #1517586) + * Cherry-pick patch to open Simple Network Protocol exclusively. + (LP: #1508893) + + -- dann frazier Wed, 25 Nov 2015 13:13:35 -0700 + +grub2 (2.02~beta2-9ubuntu1.4) trusty; urgency=medium + + * Fix overlap check in check_blocklists for load_env (backported patch from + upstream commit 1f6af2a9). (LP: #1311247) + + -- Mathieu Trudel-Lapierre Wed, 23 Sep 2015 21:29:20 -0400 + +grub2 (2.02~beta2-9ubuntu1.3) trusty; urgency=medium + + * Do not hang headless servers indefinitely on boot after edge case power + failure timing (LP: #1443735). Instead, time out after 30 seconds and boot + anyway, including on non-headless systems. + + -- Robie Basak Tue, 19 May 2015 13:31:03 +0100 + +grub2 (2.02~beta2-9ubuntu1.2) trusty-proposed; urgency=medium + + * debian/patches/install_powerpc_machtypes.patch: updated: do a better job + at detecting machine types; so as to use the right utility when updating + nvram for the boot-device. This also fixes adding a CHRP note on the + chrp_ibm machines, which broke PowerVM mode. (LP: #1334793) + * debian/patches/ppc64el-disable-vsx.patch: disable the VSX instruction, + which is enabled by default on POWER7/8 cpu models, to avoid crashes due + to instruction exceptions. The kernel will re-enable it when necessary. + (LP: #1454743) + * debian/patches/ieee1275-clear-reset.patch: clear the text attribute in + the clear command. (LP: #1454764) + + -- Mathieu Trudel-Lapierre Wed, 13 May 2015 12:30:05 -0400 + +grub2 (2.02~beta2-9ubuntu1.1) trusty-proposed; urgency=medium + + * Add dependency on efibootmgr to grub-efi-arm64-bin (LP: #1435663). + + -- dann frazier Mon, 06 Apr 2015 22:31:19 -0600 + +grub2 (2.02~beta2-9ubuntu1) trusty; urgency=medium + + * Backport patches from upstream to make the network stack more responsive + on busy networks (LP: #1314134). + * Add support for nvme device in grub-mkdevicemap (thanks, Dimitri John + Ledkov; closes: #746396, LP: #1275162). + + -- Colin Watson Thu, 08 May 2014 13:09:46 +0100 + grub2 (2.02~beta2-9) unstable; urgency=medium * Backport from upstream: diff -Nru grub2-2.02~beta2/debian/clean grub2-2.02~beta2/debian/clean --- grub2-2.02~beta2/debian/clean 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/clean 2016-02-24 19:32:39.000000000 +0000 @@ -1 +1,2 @@ debian/grub-common.install +debian/prep-bootdev diff -Nru grub2-2.02~beta2/debian/control grub2-2.02~beta2/debian/control --- grub2-2.02~beta2/debian/control 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/control 2018-07-04 19:28:17.000000000 +0000 @@ -1,7 +1,8 @@ Source: grub2 Section: admin Priority: extra -Maintainer: GRUB Maintainers +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: GRUB Maintainers Uploaders: Robert Millan , Felix Zielcke , Jordi Mallach , Colin Watson Build-Depends: debhelper (>= 7.4.2~), dpkg-dev (>= 1.15.1~), @@ -37,6 +38,7 @@ mtools [amd64], wamerican, libxen-dev [i386 amd64], + libparted-dev [any-ppc64el], Build-Conflicts: autoconf2.13, libzfs-dev, libnvpair-dev Standards-Version: 3.8.4 Homepage: http://www.gnu.org/software/grub/ @@ -92,6 +94,7 @@ Depends: grub-common (= ${binary:Version}), dpkg (>= 1.15.4) | install-info, ${shlibs:Depends}, ${misc:Depends} Replaces: grub, grub-legacy, grub-common (<< 1.99-1), grub-pc (<< 2.00-4), grub-ieee1275 (<< 2.00-4), grub-efi (<< 1.99-1), grub-coreboot (<< 2.00-4), grub-linuxbios (<< 1.99-1), grub-efi-ia32 (<< 2.00-4), grub-efi-amd64 (<< 2.00-4), grub-efi-ia64 (<< 2.00-4), grub-ieee1275 (<< 2.00-4), grub-yeeloong (<< 2.00-4) Conflicts: grub (<< 0.97-54), grub-legacy, ${legacy-doc-conflicts} +Breaks: shim (<< 13) Multi-Arch: foreign Description: GRand Unified Bootloader (common files for version 2) This package contains common files shared by the distinct flavours of GRUB. @@ -430,7 +433,7 @@ Package: grub-efi-arm64-bin Architecture: any-arm64 -Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common (= ${binary:Version}), efibootmgr [linux-any] Multi-Arch: foreign Description: GRand Unified Bootloader, version 2 (ARM64 UEFI binaries) GRUB is a portable, powerful bootloader. This version of GRUB is based on a diff -Nru grub2-2.02~beta2/debian/.git-dpm grub2-2.02~beta2/debian/.git-dpm --- grub2-2.02~beta2/debian/.git-dpm 2014-04-10 15:58:43.000000000 +0000 +++ grub2-2.02~beta2/debian/.git-dpm 2015-05-13 14:51:57.000000000 +0000 @@ -1,6 +1,6 @@ # see git-dpm(1) from git-dpm package -9ba6625cf42e26aa6541878df4ee7adb8537e61b -9ba6625cf42e26aa6541878df4ee7adb8537e61b +5439f9e3d0ad6929ff3cb2fbe3dc0fd9f2a326e1 +5439f9e3d0ad6929ff3cb2fbe3dc0fd9f2a326e1 e8f07821cce1bd0ab6d5622c2a42440f15f4fd71 e8f07821cce1bd0ab6d5622c2a42440f15f4fd71 grub2_2.02~beta2.orig.tar.xz diff -Nru grub2-2.02~beta2/debian/grub-ieee1275-bin.install.ppc64el.in grub2-2.02~beta2/debian/grub-ieee1275-bin.install.ppc64el.in --- grub2-2.02~beta2/debian/grub-ieee1275-bin.install.ppc64el.in 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/grub-ieee1275-bin.install.ppc64el.in 2016-02-24 19:32:18.000000000 +0000 @@ -1,2 +1,3 @@ usr/lib/grub/@CPU_PLATFORM@/bootinfo.txt usr/lib/grub/@CPU_PLATFORM@/grub.chrp +../../debian/prep-bootdev usr/lib/grub/@CPU_PLATFORM@ diff -Nru grub2-2.02~beta2/debian/patches/arm64-set-correct-length-of-device-path-end-entry.patch grub2-2.02~beta2/debian/patches/arm64-set-correct-length-of-device-path-end-entry.patch --- grub2-2.02~beta2/debian/patches/arm64-set-correct-length-of-device-path-end-entry.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/arm64-set-correct-length-of-device-path-end-entry.patch 2015-11-25 20:14:37.000000000 +0000 @@ -0,0 +1,33 @@ +From 07a105d450ee701b7a690a562b7efa0d827bdc65 Mon Sep 17 00:00:00 2001 +From: Leif Lindholm +Date: Tue, 7 Jan 2014 17:52:50 +0000 +Subject: 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). + +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1476882 +Origin: http://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/loader/arm64/linux.c?id=4d21c1019904598a991e847eef049c65f9c49bd9 +Last-Update: 2015-07-22 + +Patch-Name: arm64-set-correct-length-of-device-path-end-entry.patch +--- + grub-core/loader/arm64/linux.c | 2 +- + 1 file changed, 1 insertion(+), 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, diff -Nru grub2-2.02~beta2/debian/patches/arm64-setjmp-Add-missing-license-macro.patch grub2-2.02~beta2/debian/patches/arm64-setjmp-Add-missing-license-macro.patch --- grub2-2.02~beta2/debian/patches/arm64-setjmp-Add-missing-license-macro.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/arm64-setjmp-Add-missing-license-macro.patch 2015-11-25 20:14:37.000000000 +0000 @@ -0,0 +1,35 @@ +From 2252bec27ecd3d0353d1868af5a5f325450cc1d2 Mon Sep 17 00:00:00 2001 +From: dann frazier +Date: Thu, 21 May 2015 10:28:48 -0600 +Subject: 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 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1459871 +Origin: upstream, http://git.savannah.gnu.org/cgit/grub.git/commit/?id=3ac342205dc81293bb8e2d91b8c5ebe124b4ad35 + +Patch-Name: arm64-setjmp-Add-missing-license-macro.patch +--- + 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 + + /* diff -Nru grub2-2.02~beta2/debian/patches/check_blocklists_overlap_fix.patch grub2-2.02~beta2/debian/patches/check_blocklists_overlap_fix.patch --- grub2-2.02~beta2/debian/patches/check_blocklists_overlap_fix.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/check_blocklists_overlap_fix.patch 2015-09-24 01:29:11.000000000 +0000 @@ -0,0 +1,47 @@ +From 2549deb51c3636669b42370c1b2a5c7091016420 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=9F=D0=B5=D1=85=D0=BE?= + =?UTF-8?q?=D0=B2?= +Date: Sun, 22 Jun 2014 03:51:50 +0400 +Subject: * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check. + +Bug: http://savannah.gnu.org/bugs/?42134 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1311247 +Origin: upstream, http://git.savannah.gnu.org/cgit/grub.git/commit/?id=1f6af2a9f8b02a71f213b4717d8e62c8a6b14fc5 +Last-Update: 2015-01-23 + +Patch-Name: check_blocklists_overlap_fix.patch +--- + grub-core/commands/loadenv.c | 13 ++----------- + 1 file changed, 2 insertions(+), 11 deletions(-) + +diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c +index 6af8112..acd93d1 100644 +--- a/grub-core/commands/loadenv.c ++++ b/grub-core/commands/loadenv.c +@@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, + for (q = p->next; q; q = q->next) + { + grub_disk_addr_t s1, s2; +- grub_disk_addr_t e1, e2, t; ++ grub_disk_addr_t e1, e2; + + s1 = p->sector; + e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); +@@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, + s2 = q->sector; + e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); + +- if (s2 > s1) +- { +- t = s2; +- s2 = s1; +- s1 = t; +- t = e2; +- e2 = e1; +- e1 = t; +- } +- if (e1 > s2) ++ if (s1 < e2 && s2 < e1) + { + /* This might be actually valid, but it is unbelievable that + any filesystem makes such a silly allocation. */ diff -Nru grub2-2.02~beta2/debian/patches/CVE-2015-8370.patch grub2-2.02~beta2/debian/patches/CVE-2015-8370.patch --- grub2-2.02~beta2/debian/patches/CVE-2015-8370.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/CVE-2015-8370.patch 2015-12-15 14:11:20.000000000 +0000 @@ -0,0 +1,44 @@ +From 88c9657960a6c5d3673a25c266781e876c181add Mon Sep 17 00:00:00 2001 +From: Hector Marco-Gisbert +Date: Fri, 13 Nov 2015 16:21:09 +0100 +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 + +Resolves: CVE-2015-8370 + +Signed-off-by: Hector Marco-Gisbert +Signed-off-by: Ismael Ripoll-Ripoll +--- + grub-core/lib/crypto.c | 2 +- + grub-core/normal/auth.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: grub2-2.02~beta2/grub-core/lib/crypto.c +=================================================================== +--- grub2-2.02~beta2.orig/grub-core/lib/crypto.c 2015-12-15 08:45:31.307836075 -0500 ++++ grub2-2.02~beta2/grub-core/lib/crypto.c 2015-12-15 08:45:31.303836031 -0500 +@@ -456,7 +456,7 @@ + break; + } + +- if (key == '\b') ++ if (key == '\b' && cur_len) + { + cur_len--; + continue; +Index: grub2-2.02~beta2/grub-core/normal/auth.c +=================================================================== +--- grub2-2.02~beta2.orig/grub-core/normal/auth.c 2015-12-15 08:45:31.307836075 -0500 ++++ grub2-2.02~beta2/grub-core/normal/auth.c 2015-12-15 08:45:31.303836031 -0500 +@@ -172,7 +172,7 @@ + break; + } + +- if (key == '\b') ++ if (key == '\b' && cur_len) + { + cur_len--; + grub_printf ("\b"); diff -Nru grub2-2.02~beta2/debian/patches/efidisk-device-path-helpers-for-efinet.patch grub2-2.02~beta2/debian/patches/efidisk-device-path-helpers-for-efinet.patch --- grub2-2.02~beta2/debian/patches/efidisk-device-path-helpers-for-efinet.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/efidisk-device-path-helpers-for-efinet.patch 2015-12-16 21:03:25.000000000 +0000 @@ -0,0 +1,207 @@ +From c603d4c4d477f2592de30410685016e55d3b78c5 Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +Date: Thu, 7 May 2015 20:37:16 +0300 +Subject: efidisk: move device path helpers in core for efinet + +Patch-Name: efidisk-device-path-helpers-for-efinet.patch +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1521612 +Last-Update: 2015-12-03 +--- + 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 3b12c34..845c66f 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; + +@@ -811,14 +770,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 3b6cf26..12102ef 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -422,6 +422,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 a000c38..2245632 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -56,6 +56,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, diff -Nru grub2-2.02~beta2/debian/patches/efinet-enable-hardware-filters-on-interface.patch grub2-2.02~beta2/debian/patches/efinet-enable-hardware-filters-on-interface.patch --- grub2-2.02~beta2/debian/patches/efinet-enable-hardware-filters-on-interface.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/efinet-enable-hardware-filters-on-interface.patch 2015-12-16 21:03:25.000000000 +0000 @@ -0,0 +1,109 @@ +From 1a8eacd20fdfc9e9d3adf15af0a24a5c025fa071 Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +Date: Tue, 16 Jun 2015 19:52:45 +0300 +Subject: 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 + +Patch-Name: efinet-enable-hardware-filters-on-interface.patch +Bug: http://savannah.gnu.org/bugs/?45204 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1521612 +Last-Update: 2015-12-03 +--- + 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 775abde..9e0c0ad 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -156,6 +156,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); +@@ -169,6 +192,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); diff -Nru grub2-2.02~beta2/debian/patches/efinet-open-Simple-Network-Protocol-exclusively.patch grub2-2.02~beta2/debian/patches/efinet-open-Simple-Network-Protocol-exclusively.patch --- grub2-2.02~beta2/debian/patches/efinet-open-Simple-Network-Protocol-exclusively.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/efinet-open-Simple-Network-Protocol-exclusively.patch 2015-11-25 20:14:37.000000000 +0000 @@ -0,0 +1,73 @@ +From 99d5df36311e15d60a16f6cba6e3b4ca442b0472 Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +Date: Thu, 7 May 2015 20:37:17 +0300 +Subject: efinet: open Simple Network Protocol exclusively + +Patch-Name: efinet-open-Simple-Network-Protocol-exclusively.patch +Origin: upstream, http://git.savannah.gnu.org/cgit/grub.git/commit/?id=49426e9fd2e562c73a4f1206f32eff9e424a1a73 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1508893 +Last-Update: 2015-11-25 +--- + 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 2b344d6..658b3d1 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -130,9 +130,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 + }; diff -Nru grub2-2.02~beta2/debian/patches/efinet-skip-virtual-devices-on-enumeration.patch grub2-2.02~beta2/debian/patches/efinet-skip-virtual-devices-on-enumeration.patch --- grub2-2.02~beta2/debian/patches/efinet-skip-virtual-devices-on-enumeration.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/efinet-skip-virtual-devices-on-enumeration.patch 2015-12-16 21:03:25.000000000 +0000 @@ -0,0 +1,97 @@ +From a651971c4597cf8071594bf6a299af511b94ce3d Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +Date: Thu, 7 May 2015 20:37:17 +0300 +Subject: 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. + +Patch-Name: efinet-skip-virtual-devices-on-enumeration.patch +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1521612 +Last-Update: 2015-12-03 +--- + 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 658b3d1..775abde 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -208,6 +208,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); +@@ -285,7 +308,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) diff -Nru grub2-2.02~beta2/debian/patches/ieee1275-clear-reset.patch grub2-2.02~beta2/debian/patches/ieee1275-clear-reset.patch --- grub2-2.02~beta2/debian/patches/ieee1275-clear-reset.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/ieee1275-clear-reset.patch 2015-05-13 16:28:48.000000000 +0000 @@ -0,0 +1,32 @@ +From 8500c4f400ae033c79f495bbb5a10079f633193c Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Thu, 25 Sep 2014 18:41:29 -0300 +Subject: Include a text attribute reset in the clear command for ppc + +Always clear text attribute for clear command in order to avoid problems +after it boots. + +* grub-core/term/terminfo.c: Add escape for text attribute reset + +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1295255 +Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00076.html +Last-Update: 2014-09-26 + +Patch-Name: ieee1275-clear-reset.patch +--- + grub-core/term/terminfo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: b/grub-core/term/terminfo.c +=================================================================== +--- a/grub-core/term/terminfo.c ++++ b/grub-core/term/terminfo.c +@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_t + /* Clear the screen. Using serial console, screen(1) only recognizes the + * ANSI escape sequence. Using video console, Apple Open Firmware + * (version 3.1.1) only recognizes the literal ^L. So use both. */ +- data->cls = grub_strdup (" \e[2J"); ++ data->cls = grub_strdup (" \e[2J\e[m"); + data->reverse_video_on = grub_strdup ("\e[7m"); + data->reverse_video_off = grub_strdup ("\e[m"); + if (grub_strcmp ("ieee1275", str) == 0) diff -Nru grub2-2.02~beta2/debian/patches/install_powerpc_machtypes.patch grub2-2.02~beta2/debian/patches/install_powerpc_machtypes.patch --- grub2-2.02~beta2/debian/patches/install_powerpc_machtypes.patch 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/install_powerpc_machtypes.patch 2015-05-13 16:19:13.000000000 +0000 @@ -1,23 +1,28 @@ -From 02439d727af555ba60aec5ea8e0aa4d3000286c6 Mon Sep 17 00:00:00 2001 +From 6b86ab9bd13c56b7cbf957e89a5e201ddc011979 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 28 Jan 2014 14:40:02 +0000 Subject: Port yaboot logic for various powerpc machine types -Some powerpc machines require not updating the NVRAM, and some require -adding a CHRP note. This can be handled by existing grub-install -command-line options, but it's friendlier to detect this automatically. +Some powerpc machines require not updating the NVRAM. This can be handled +by existing grub-install command-line options, but it's friendlier to detect +this automatically. + +On chrp_ibm machines, use the nvram utility rather than nvsetenv. (This +is possibly suitable for other machines too, but that needs to be +verified.) Forwarded: no -Last-Update: 2014-01-28 +Last-Update: 2014-10-15 Patch-Name: install_powerpc_machtypes.patch --- grub-core/osdep/basic/platform.c | 5 +++ - grub-core/osdep/linux/platform.c | 64 ++++++++++++++++++++++++++++++++++++++ + grub-core/osdep/linux/platform.c | 72 ++++++++++++++++++++++++++++++++++++++ + grub-core/osdep/unix/platform.c | 28 +++++++++++---- grub-core/osdep/windows/platform.c | 6 ++++ include/grub/util/install.h | 3 ++ - util/grub-install.c | 17 +++++++++- - 5 files changed, 94 insertions(+), 1 deletion(-) + util/grub-install.c | 11 ++++++ + 6 files changed, 119 insertions(+), 6 deletions(-) diff --git a/grub-core/osdep/basic/platform.c b/grub-core/osdep/basic/platform.c index 4b5502a..2ab9079 100644 @@ -33,7 +38,7 @@ + return "generic"; +} diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c -index 175da72..185f971 100644 +index 175da72..033afd8 100644 --- a/grub-core/osdep/linux/platform.c +++ b/grub-core/osdep/linux/platform.c @@ -24,6 +24,7 @@ @@ -44,7 +49,7 @@ #include #include -@@ -108,3 +109,66 @@ grub_install_get_default_x86_platform (void) +@@ -108,3 +109,74 @@ grub_install_get_default_x86_platform (void) grub_util_info ("... not found"); return "i386-pc"; } @@ -88,8 +93,16 @@ + if (strncmp (buf, "machine", sizeof ("machine") - 1) == 0 && + strstr (buf, "CHRP IBM")) + { -+ machtype = "chrp_ibm"; -+ break; ++ if (strstr (buf, "qemu")) ++ { ++ machtype = "chrp_ibm_qemu"; ++ break; ++ } ++ else ++ { ++ machtype = "chrp_ibm"; ++ break; ++ } + } + + if (strncmp (buf, "platform", sizeof ("platform") - 1) == 0) @@ -111,6 +124,46 @@ + fclose (fp); + return machtype; +} +diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c +index a3fcfca..28cb37e 100644 +--- a/grub-core/osdep/unix/platform.c ++++ b/grub-core/osdep/unix/platform.c +@@ -212,13 +212,29 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device, + else + boot_device = get_ofpathname (install_device); + +- if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device", +- boot_device, NULL })) ++ if (strcmp (grub_install_get_default_powerpc_machtype (), "chrp_ibm") == 0) + { +- char *cmd = xasprintf ("setenv boot-device %s", boot_device); +- grub_util_error (_("`nvsetenv' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"), +- cmd); +- free (cmd); ++ char *arg = xasprintf ("boot-device=%s", boot_device); ++ if (grub_util_exec ((const char * []){ "nvram", ++ "--update-config", arg, NULL })) ++ { ++ char *cmd = xasprintf ("setenv boot-device %s", boot_device); ++ grub_util_error (_("`nvram' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"), ++ cmd); ++ free (cmd); ++ } ++ free (arg); ++ } ++ else ++ { ++ if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device", ++ boot_device, NULL })) ++ { ++ char *cmd = xasprintf ("setenv boot-device %s", boot_device); ++ grub_util_error (_("`nvsetenv' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"), ++ cmd); ++ free (cmd); ++ } + } + + free (boot_device); diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c index f2b9d71..cf2e39c 100644 --- a/grub-core/osdep/windows/platform.c @@ -143,18 +196,10 @@ grub_install_register_efi (grub_device_t efidir_grub_dev, const char *efifile_path, diff --git a/util/grub-install.c b/util/grub-install.c -index 1f27b65..01170d3 100644 +index 1f27b65..98da118 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -58,6 +58,7 @@ static char *target; - static int removable = 0; - static int recheck = 0; - static int update_nvram = 1; -+static int chrp_note = 0; - static char *install_device = NULL; - static char *debug_image = NULL; - static char *rootdir = NULL; -@@ -1143,7 +1144,21 @@ main (int argc, char *argv[]) +@@ -1143,7 +1143,18 @@ main (int argc, char *argv[]) if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275) { @@ -163,25 +208,13 @@ + + if (strcmp (machtype, "pmac_oldworld") == 0) + update_nvram = 0; -+ else if (strcmp (machtype, "chrp_ibm") == 0) -+ { -+ update_nvram = 0; -+ chrp_note = 1; -+ } + else if (strcmp (machtype, "cell") == 0) + update_nvram = 0; + else if (strcmp (machtype, "generic") == 0) + update_nvram = 0; ++ else if (strcmp (machtype, "chrp_ibm_qemu") == 0) ++ update_nvram = 0; + if (!macppcdir) { char *d; -@@ -1613,7 +1628,7 @@ main (int argc, char *argv[]) - /* output */ imgfile, - /* memdisk */ NULL, - have_load_cfg ? load_cfg : NULL, -- /* image target */ mkimage_target, 0); -+ /* image target */ mkimage_target, chrp_note); - /* Backward-compatibility kludges. */ - switch (platform) - { diff -Nru grub2-2.02~beta2/debian/patches/install_signed.patch grub2-2.02~beta2/debian/patches/install_signed.patch --- grub2-2.02~beta2/debian/patches/install_signed.patch 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/install_signed.patch 2018-07-04 19:28:11.000000000 +0000 @@ -13,11 +13,11 @@ Patch-Name: install_signed.patch --- - util/grub-install.c | 169 +++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 122 insertions(+), 47 deletions(-) + util/grub-install.c | 178 ++++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 131 insertions(+), 47 deletions(-) -diff --git a/util/grub-install.c b/util/grub-install.c -index 3275209..0d77a2a 100644 +Index: b/util/grub-install.c +=================================================================== --- a/util/grub-install.c +++ b/util/grub-install.c @@ -80,6 +80,7 @@ static char *label_color; @@ -39,7 +39,7 @@ }; static int fs_probe = 1; -@@ -235,6 +238,14 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -235,6 +238,14 @@ argp_parser (int key, char *arg, struct bootloader_id = xstrdup (arg); return 0; @@ -213,20 +213,25 @@ { char *uuid = NULL; /* generic method (used on coreboot and ata mod). */ -@@ -1857,7 +1890,49 @@ main (int argc, char *argv[]) +@@ -1857,7 +1890,58 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_IA64_EFI: { char *dst = grub_util_path_concat (2, efidir, efi_file); - grub_install_copy_file (imgfile, dst, 1); + if (uefi_secure_boot) + { -+ const char *shim_signed = "/usr/lib/shim/shim.efi.signed"; ++ char *shim_signed = NULL; ++ char *mok_file = NULL; + char *config_dst; + FILE *config_dst_f; + ++ shim_signed = xasprintf ("/usr/lib/shim/shim%s.efi.signed", efi_suffix); ++ mok_file = xasprintf ("mm%s.efi", efi_suffix); ++ + if (grub_util_is_regular (shim_signed)) + { -+ char *chained_base, *chained_dst, *mok_signed; ++ char *chained_base, *chained_dst; ++ char *mok_src, *mok_dst; + if (!removable) + { + free (efi_file); @@ -238,16 +243,20 @@ + chained_base = xasprintf ("grub%s.efi", efi_suffix); + chained_dst = grub_util_path_concat (2, efidir, chained_base); + grub_install_copy_file (efi_signed, chained_dst, 1); -+ /* Not critical, so not an error if it's not present (as it -+ won't be for older releases); but if we have it, make -+ sure it's installed. */ -+ mok_signed = grub_util_path_concat (2, efidir, -+ "MokManager.efi"); -+ grub_install_copy_file ("/usr/lib/shim/MokManager.efi.signed", -+ mok_signed, 0); -+ free (mok_signed); + free (chained_dst); + free (chained_base); ++ ++ /* Not critical, so not an error if they are not present (as it ++ won't be for older releases); but if we have them, make ++ sure they are installed. */ ++ mok_src = grub_util_path_concat (2, "/usr/lib/shim/", ++ mok_file); ++ mok_dst = grub_util_path_concat (2, efidir, ++ mok_file); ++ grub_install_copy_file (mok_src, ++ mok_dst, 0); ++ free (mok_src); ++ free (mok_dst); + } + else + grub_install_copy_file (efi_signed, dst, 1); diff -Nru grub2-2.02~beta2/debian/patches/mixed_size_efi.patch grub2-2.02~beta2/debian/patches/mixed_size_efi.patch --- grub2-2.02~beta2/debian/patches/mixed_size_efi.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/mixed_size_efi.patch 2016-06-30 19:26:31.000000000 +0000 @@ -0,0 +1,79 @@ +From 41f39647eec96745dd63221e295a869050faab9a Mon Sep 17 00:00:00 2001 +From: Steve McIntyre <93sam@debian.org> +Date: Tue, 27 Jan 2015 20:08:53 +0000 +Subject: Add support for running a 64-bit Linux kernel on a 32-bit EFI + +Some platforms might be capable of running a 64-bit Linux kernel but +only use a 32-bit EFI. To support such systems, it is necessary to work +out the size of the firmware rather than just the size of the kernel. +To enable that, there is now an extra EFI sysfs file to describe the +underlying firmware. Read that if possible, otherwise fall back to the +kernel type as before. + +Signed-off-by: Steve McIntyre <93sam@debian.org> + +Bug-Debian: https://bugs.debian.org/775202 +Forwarded: Not yet +Last-Update: 2015-01-10 + +Patch-Name: mixed_size_efi.patch +--- + grub-core/osdep/linux/platform.c | 38 +++++++++++++++++++++++++++++++++++++- + 1 file changed, 37 insertions(+), 1 deletion(-) + +diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c +index 033afd8..3675b23 100644 +--- a/grub-core/osdep/linux/platform.c ++++ b/grub-core/osdep/linux/platform.c +@@ -63,6 +63,42 @@ is_64_kernel (void) + return strcmp (un.machine, "x86_64") == 0; + } + ++static int ++read_platform_size (void) ++{ ++ FILE *fp; ++ char *buf = NULL; ++ size_t len = 0; ++ int ret = 0; ++ ++ /* Newer kernels can tell us directly about the size of the ++ * underlying firmware - let's see if that interface is there. */ ++ fp = grub_util_fopen ("/sys/firmware/efi/fw_platform_size", "r"); ++ if (fp != NULL) ++ { ++ if (getline (&buf, &len, fp) > 0) ++ { ++ if (strncmp (buf, "32", 2) == 0) ++ ret = 32; ++ else if (strncmp (buf, "64", 2) == 0) ++ ret = 64; ++ } ++ free (buf); ++ fclose (fp); ++ } ++ ++ if (ret == 0) ++ /* Unrecognised - fall back to matching the kernel size instead */ ++ { ++ if (is_64_kernel ()) ++ ret = 64; ++ else ++ ret = 32; ++ } ++ ++ return ret; ++} ++ + const char * + grub_install_get_default_x86_platform (void) + { +@@ -85,7 +121,7 @@ grub_install_get_default_x86_platform (void) + int found; + + grub_util_info ("...found"); +- if (is_64_kernel ()) ++ if (read_platform_size() == 64) + platform = "x86_64-efi"; + else + platform = "i386-efi"; diff -Nru grub2-2.02~beta2/debian/patches/net-ramp-up-interval.patch grub2-2.02~beta2/debian/patches/net-ramp-up-interval.patch --- grub2-2.02~beta2/debian/patches/net-ramp-up-interval.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/net-ramp-up-interval.patch 2015-05-13 14:51:57.000000000 +0000 @@ -0,0 +1,94 @@ +From c7968962ae59204cb6ffb4b46b115db592cb578e Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 21 Jan 2014 11:03:51 -0200 +Subject: increase network try interval gradually + +* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try +interval gradually. +* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise. +* grub-core/net/net.c (grub_net_fs_read_real): Likewise. +* grub-core/net/tftp.c (tftp_open): Likewise. +* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define. + +Origin: upstream, http://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=6f65e36cc4f92fe40672181eccf12eac4afb6738 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1314134 +Last-Update: 2014-04-29 + +Patch-Name: net-ramp-up-interval.patch +--- + grub-core/net/arp.c | 3 ++- + grub-core/net/icmp6.c | 3 ++- + grub-core/net/net.c | 5 +++-- + grub-core/net/tftp.c | 3 ++- + include/grub/net.h | 1 + + 5 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c +index e92c7e7..d62d0cc 100644 +--- a/grub-core/net/arp.c ++++ b/grub-core/net/arp.c +@@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, + return GRUB_ERR_NONE; + pending_req = proto_addr->ipv4; + have_pending = 0; +- grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending); ++ grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION), ++ &have_pending); + if (grub_net_link_layer_resolve_check (inf, proto_addr)) + return GRUB_ERR_NONE; + nb.data = nbd; +diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c +index 2741e6f..bbc9020 100644 +--- a/grub-core/net/icmp6.c ++++ b/grub-core/net/icmp6.c +@@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf, + { + if (grub_net_link_layer_resolve_check (inf, proto_addr)) + break; +- grub_net_poll_cards (GRUB_NET_INTERVAL, 0); ++ grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION), ++ 0); + if (grub_net_link_layer_resolve_check (inf, proto_addr)) + break; + nb->data = nbd; +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 56355f3..1521d8d 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1558,8 +1558,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len) + if (!net->eof) + { + try++; +- grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall); +- } ++ grub_net_poll_cards (GRUB_NET_INTERVAL + ++ (try * GRUB_NET_INTERVAL_ADDITION), &net->stall); ++ } + else + return total; + } +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 9c489f1..5173614 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename) + destroy_pq (data); + return err; + } +- grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack); ++ grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION), ++ &data->have_oack); + if (data->have_oack) + break; + } +diff --git a/include/grub/net.h b/include/grub/net.h +index de6259e..0e0a605 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -532,5 +532,6 @@ extern char *grub_net_default_server; + + #define GRUB_NET_TRIES 40 + #define GRUB_NET_INTERVAL 400 ++#define GRUB_NET_INTERVAL_ADDITION 20 + + #endif /* ! GRUB_NET_HEADER */ diff -Nru grub2-2.02~beta2/debian/patches/net-receive-packets-yield.patch grub2-2.02~beta2/debian/patches/net-receive-packets-yield.patch --- grub2-2.02~beta2/debian/patches/net-receive-packets-yield.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/net-receive-packets-yield.patch 2015-05-13 14:51:57.000000000 +0000 @@ -0,0 +1,34 @@ +From 85c0479ed5f45e91929efdd829a2496e263c3cd4 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 21 Jan 2014 10:49:39 -0200 +Subject: change stop condition to avoid infinite loops + +In net/net.c there is a while (1) that only exits if there is a stop +condition and more then 10 packages or if there is no package received. + +If GRUB is idle and enter in this loop, the only condition to leave is +if it doesn't have incoming packages. In a network with heavy traffic +this never happens. + +Origin: upstream, http://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=d99d2f84166b0f60673d5c0714605a153946c0fc +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1314134 +Last-Update: 2014-04-29 + +Patch-Name: net-receive-packets-yield.patch +--- + grub-core/net/net.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 0e57e93..56355f3 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition) + } + 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 -Nru grub2-2.02~beta2/debian/patches/ofdisk_add_sas_disks.patch grub2-2.02~beta2/debian/patches/ofdisk_add_sas_disks.patch --- grub2-2.02~beta2/debian/patches/ofdisk_add_sas_disks.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/ofdisk_add_sas_disks.patch 2015-11-25 20:14:37.000000000 +0000 @@ -0,0 +1,100 @@ +From 4b75a4a0f2438e1afd6ff3cb15697dbc52dfbd74 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Sun, 8 Nov 2015 21:52:22 -0200 +Subject: ofdisk: add sas disks to the device list + +Patch-Name: ofdisk_add_sas_disks.patch +Origin: upstream, http://git.savannah.gnu.org/cgit/grub.git/commit/?id=c899d9f42c543939abc92d79c9729d429740492e +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1517586 +Last-Update: 2015-11-20 +--- + grub-core/disk/ieee1275/ofdisk.c | 76 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 76 insertions(+) + +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 6870b39..6735a66 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -255,6 +255,82 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + grub_free (buf); + return; + } ++ else if (grub_strcmp (alias->type, "sas_ioa") == 0) ++ { ++ /* The method returns the number of disks and a table where ++ * each ID is 64-bit long. Example of sas paths: ++ * /pci@80000002000001f/pci1014,034A@0/sas/disk@c05db70800 ++ * /pci@80000002000001f/pci1014,034A@0/sas/disk@a05db70800 ++ * /pci@80000002000001f/pci1014,034A@0/sas/disk@805db70800 */ ++ ++ struct sas_children ++ { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_cell_t ihandle; ++ grub_ieee1275_cell_t max; ++ grub_ieee1275_cell_t table; ++ grub_ieee1275_cell_t catch_result; ++ grub_ieee1275_cell_t nentries; ++ } ++ args; ++ char *buf, *bufptr; ++ unsigned i; ++ grub_uint64_t *table; ++ grub_uint16_t table_size; ++ grub_ieee1275_ihandle_t ihandle; ++ ++ buf = grub_malloc (grub_strlen (alias->path) + ++ sizeof ("/disk@7766554433221100")); ++ if (!buf) ++ return; ++ bufptr = grub_stpcpy (buf, alias->path); ++ ++ /* Power machines documentation specify 672 as maximum SAS disks in ++ one system. Using a slightly larger value to be safe. */ ++ table_size = 768; ++ table = grub_malloc (table_size * sizeof (grub_uint64_t)); ++ ++ if (!table) ++ { ++ grub_free (buf); ++ return; ++ } ++ ++ if (grub_ieee1275_open (alias->path, &ihandle)) ++ { ++ grub_free (buf); ++ grub_free (table); ++ return; ++ } ++ ++ INIT_IEEE1275_COMMON (&args.common, "call-method", 4, 2); ++ args.method = (grub_ieee1275_cell_t) "get-sas-children"; ++ args.ihandle = ihandle; ++ args.max = table_size; ++ args.table = (grub_ieee1275_cell_t) table; ++ args.catch_result = 0; ++ args.nentries = 0; ++ ++ if (IEEE1275_CALL_ENTRY_FN (&args) == -1) ++ { ++ grub_ieee1275_close (ihandle); ++ grub_free (table); ++ grub_free (buf); ++ return; ++ } ++ ++ for (i = 0; i < args.nentries; i++) ++ { ++ grub_snprintf (bufptr, sizeof ("/disk@7766554433221100"), ++ "/disk@%" PRIxGRUB_UINT64_T, table[i]); ++ dev_iterate_real (buf, buf); ++ } ++ ++ grub_ieee1275_close (ihandle); ++ grub_free (table); ++ grub_free (buf); ++ } + + if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS) + && grub_strcmp (alias->type, "block") == 0) diff -Nru grub2-2.02~beta2/debian/patches/ppc64el-disable-vsx.patch grub2-2.02~beta2/debian/patches/ppc64el-disable-vsx.patch --- grub2-2.02~beta2/debian/patches/ppc64el-disable-vsx.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/ppc64el-disable-vsx.patch 2015-05-13 16:23:05.000000000 +0000 @@ -0,0 +1,49 @@ +From 603e3eaf4807b988cb87e3dd8a00a0518dc237aa Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Thu, 25 Sep 2014 19:33:39 -0300 +Subject: Disable VSX instruction + +VSX bit is enabled by default for Power7 and Power8 CPU models, +so we need to disable them in order to avoid instruction exceptions. +Kernel will activate it when necessary. + +* grub-core/kern/powerpc/ieee1275/startup.S: Disable VSX. + +Also-By: Adhemerval Zanella + +Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00078.html +Last-Update: 2014-09-26 + +Patch-Name: ppc64el-disable-vsx.patch +--- + grub-core/kern/powerpc/ieee1275/startup.S | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/grub-core/kern/powerpc/ieee1275/startup.S b/grub-core/kern/powerpc/ieee1275/startup.S +index 21c884b..b4d9c21 100644 +--- a/grub-core/kern/powerpc/ieee1275/startup.S ++++ b/grub-core/kern/powerpc/ieee1275/startup.S +@@ -20,6 +20,8 @@ + #include + #include + ++#define MSR_VSX 0x80 ++ + .extern __bss_start + .extern _end + +@@ -28,6 +30,14 @@ + .globl start, _start + start: + _start: ++ _start: ++ ++ /* Disable VSX instruction */ ++ mfmsr 0 ++ oris 0,0,MSR_VSX ++ mtmsrd 0 ++ isync ++ + li 2, 0 + li 13, 0 + diff -Nru grub2-2.02~beta2/debian/patches/probe_nvme.patch grub2-2.02~beta2/debian/patches/probe_nvme.patch --- grub2-2.02~beta2/debian/patches/probe_nvme.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/probe_nvme.patch 2015-05-13 14:51:57.000000000 +0000 @@ -0,0 +1,89 @@ +From 5439f9e3d0ad6929ff3cb2fbe3dc0fd9f2a326e1 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Tue, 29 Apr 2014 16:45:44 +0100 +Subject: Add support for nvme device in grub-mkdevicemap + +Author: Colin Watson +Bug-Debian: https://bugs.debian.org/746396 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1275162 +Forwarded: no +Last-Update: 2014-05-08 + +Patch-Name: probe_nvme.patch +--- + grub-core/osdep/linux/getroot.c | 14 ++++++++++++++ + util/deviceiter.c | 29 +++++++++++++++++++++++++++++ + 2 files changed, 43 insertions(+) + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 6788e39..f97f3a6 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -896,6 +896,20 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, + *pp = '\0'; + return path; + } ++ ++ /* If this is an NVMe device. */ ++ if (strncmp ("nvme", p, sizeof ("nvme") - 1) == 0) ++ { ++ /* /dev/nvme[0-9]+n[0-9]+(p[0-9]+)? */ ++ p = strchr (p, 'p'); ++ if (p) ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } ++ ++ return path; ++ } + } + + return path; +diff --git a/util/deviceiter.c b/util/deviceiter.c +index b61715d..28dcc25 100644 +--- a/util/deviceiter.c ++++ b/util/deviceiter.c +@@ -371,6 +371,12 @@ get_fio_disk_name (char *name, int unit) + { + sprintf (name, "/dev/fio%c", unit + 'a'); + } ++ ++static void ++get_nvme_disk_name (char *name, int controller, int namespace) ++{ ++ sprintf (name, "/dev/nvme%dn%d", controller, namespace); ++} + #endif + + static struct seen_device +@@ -875,6 +881,29 @@ grub_util_iterate_devices (int (*hook) (const char *, int, void *), void *hook_d + } + } + ++ /* This is for standard NVMe controllers ++ /dev/nvmenp. No idea about ++ actual limits of how many controllers a system can have and/or ++ how many namespace that would be, 10 for now. */ ++ { ++ int controller, namespace; ++ ++ for (controller = 0; controller < 10; controller++) ++ { ++ for (namespace = 0; namespace < 10; namespace++) ++ { ++ char name[16]; ++ ++ get_nvme_disk_name (name, controller, namespace); ++ if (check_device_readable_unique (name)) ++ { ++ if (hook (name, 0, hook_data)) ++ goto out; ++ } ++ } ++ } ++ } ++ + # ifdef HAVE_DEVICE_MAPPER + # define dmraid_check(cond, ...) \ + if (! (cond)) \ diff -Nru grub2-2.02~beta2/debian/patches/progress_avoid_null_deref.patch grub2-2.02~beta2/debian/patches/progress_avoid_null_deref.patch --- grub2-2.02~beta2/debian/patches/progress_avoid_null_deref.patch 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/progress_avoid_null_deref.patch 2015-11-25 20:14:37.000000000 +0000 @@ -0,0 +1,57 @@ +From df958de5315158a421d3cf938ccbb5164096526a Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +Date: Sat, 10 Oct 2015 11:44:14 +0300 +Subject: progress: avoid NULL dereference for net files + +From original patch by dann frazier : + + grub_net_fs_open() saves off a copy of the file structure it gets passed and + uses it to create a bufio structure. It then overwrites the passed in file + structure with this new bufio structure. Since file->name doesn't get set + until we return back to grub_file_open(), it means that only the bufio + structure gets a valid file->name. The "real" file's name is left + uninitialized. This leads to a crash when the progress module hook is called + on it. + +grub_net_fs_open() already saved copy of file name as ->net->name, so change +progress module to use it. + +Also, grub_file_open may leave file->name as NULL if grub_strdup fails. Check +for it. + +Also-By: dann frazier +Patch-Name: progress_avoid_null_deref.patch +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1459872 +--- + grub-core/lib/progress.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/grub-core/lib/progress.c b/grub-core/lib/progress.c +index 63a0767..95a4a62 100644 +--- a/grub-core/lib/progress.c ++++ b/grub-core/lib/progress.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -70,7 +71,15 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)), + percent = grub_divmod64 (100 * file->progress_offset, + file->size, 0); + +- partial_file_name = grub_strrchr (file->name, '/'); ++ /* grub_net_fs_open() saves off partial file structure before name is initialized. ++ It already saves passed file name in net structure so just use it in this case. ++ */ ++ if (file->device->net) ++ partial_file_name = grub_strrchr (file->device->net->name, '/'); ++ else if (file->name) /* grub_file_open() may leave it as NULL */ ++ partial_file_name = grub_strrchr (file->name, '/'); ++ else ++ partial_file_name = NULL; + if (partial_file_name) + partial_file_name++; + else diff -Nru grub2-2.02~beta2/debian/patches/quick_boot.patch grub2-2.02~beta2/debian/patches/quick_boot.patch --- grub2-2.02~beta2/debian/patches/quick_boot.patch 2014-04-10 15:58:36.000000000 +0000 +++ grub2-2.02~beta2/debian/patches/quick_boot.patch 2015-12-16 21:02:42.000000000 +0000 @@ -1,4 +1,4 @@ -From 4b19cd9780edbca2148b88ceea1f72445ff64645 Mon Sep 17 00:00:00 2001 +From 93182e8bbc7bc5f723f50b1f89cb913ff373c8b2 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jan 2014 12:13:28 +0000 Subject: Add configure option to bypass boot menu if possible @@ -17,19 +17,20 @@ of the normal runlevels), then show the boot menu regardless. Author: Richard Laager +Author: Robie Basak Forwarded: no -Last-Update: 2014-01-17 +Last-Update: 2015-09-04 Patch-Name: quick_boot.patch --- - configure.ac | 11 +++++++++ - docs/grub.texi | 9 +++++++ - grub-core/normal/menu.c | 24 +++++++++++++++++++ - util/grub-mkconfig.in | 3 ++- - util/grub.d/00_header.in | 58 +++++++++++++++++++++++++++++++++++---------- - util/grub.d/10_linux.in | 4 ++++ - util/grub.d/30_os-prober.in | 21 ++++++++++++++++ - 7 files changed, 117 insertions(+), 13 deletions(-) + configure.ac | 11 +++++++ + docs/grub.texi | 14 +++++++++ + grub-core/normal/menu.c | 24 ++++++++++++++ + util/grub-mkconfig.in | 3 +- + util/grub.d/00_header.in | 77 ++++++++++++++++++++++++++++++++++++++------- + util/grub.d/10_linux.in | 4 +++ + util/grub.d/30_os-prober.in | 21 +++++++++++++ + 7 files changed, 141 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 7c8d0af..2a7e410 100644 @@ -54,18 +55,23 @@ AC_SUBST([FONT_SOURCE]) diff --git a/docs/grub.texi b/docs/grub.texi -index 46b9e7f..28743d5 100644 +index 46b9e7f..a79256b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -1490,6 +1490,15 @@ This option may be set to a list of GRUB module names separated by spaces. +@@ -1490,6 +1490,20 @@ This option may be set to a list of GRUB module names separated by spaces. Each module will be loaded as early as possible, at the start of @file{grub.cfg}. +@item GRUB_RECORDFAIL_TIMEOUT -+If this option is set, it overrides the default recordfail setting. The -+default setting is -1, which causes GRUB to wait for user input. This option -+should be set on headless and appliance systems where access to a console is -+restricted or limited. ++If this option is set, it overrides the default recordfail setting. A ++setting of -1 causes GRUB to wait for user input indefinitely. However, a ++false positive in the recordfail mechanism may occur if power is lost during ++boot before boot success is recorded in userspace. The default setting is ++30, which causes GRUB to wait for user input for thirty seconds before ++continuing. This default allows interactive users the opportunity to switch ++to a different, working kernel, while avoiding a false positive causing the ++boot to block indefinitely on headless and appliance systems where access to ++a console is restricted or limited. + +This option is only effective when GRUB was configured with the +@option{--enable-quick-boot} option. @@ -123,7 +129,7 @@ if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 0c82f23..8dc5592 100644 +index 0c82f23..a74828e 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -21,6 +21,8 @@ prefix="@prefix@" @@ -143,30 +149,49 @@ load_env fi EOF -@@ -96,7 +99,31 @@ function savedefault { +@@ -96,7 +99,50 @@ function savedefault { save_env saved_entry fi } +EOF - ++ +if [ "$quick_boot" = 1 ]; then + cat <&2 diff -Nru grub2-2.02~beta2/debian/postinst.in grub2-2.02~beta2/debian/postinst.in --- grub2-2.02~beta2/debian/postinst.in 2014-04-10 15:58:37.000000000 +0000 +++ grub2-2.02~beta2/debian/postinst.in 2016-02-24 19:34:27.000000000 +0000 @@ -708,7 +708,10 @@ grub-ieee1275) case $(dpkg --print-architecture) in ppc64el) - grub-install --target=powerpc-ieee1275 + # Output may be empty; if so, just update the core image but + # don't install it to any PReP partition. + prep_bootdev="$(/usr/lib/grub/powerpc-ieee1275/prep-bootdev)" + grub-install --no-nvram --target=powerpc-ieee1275 $prep_bootdev ;; esac ;; diff -Nru grub2-2.02~beta2/debian/prep-bootdev.c grub2-2.02~beta2/debian/prep-bootdev.c --- grub2-2.02~beta2/debian/prep-bootdev.c 1970-01-01 00:00:00.000000000 +0000 +++ grub2-2.02~beta2/debian/prep-bootdev.c 2016-02-24 19:39:16.000000000 +0000 @@ -0,0 +1,39 @@ +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + PedDevice *dev; + + ped_exception_fetch_all(); + ped_device_probe_all(); + for (dev = ped_device_get_next(NULL); dev; + dev = ped_device_get_next(dev)) { + PedDisk *disk; + PedPartition *part; + + disk = ped_disk_new(dev); + if (!disk) + continue; + + for (part = ped_disk_next_partition(disk, NULL); part; + part = ped_disk_next_partition(disk, part)) { + if (ped_partition_is_active(part) && + ped_partition_get_flag(part, PED_PARTITION_PREP)) { + char *path; + + path = ped_partition_get_path(part); + if (path) { + printf("%s\n", path); + free(path); + return 0; + } + free(path); + } + } + } + + return 0; +} diff -Nru grub2-2.02~beta2/debian/rules grub2-2.02~beta2/debian/rules --- grub2-2.02~beta2/debian/rules 2014-04-10 15:58:37.000000000 +0000 +++ grub2-2.02~beta2/debian/rules 2016-02-24 19:31:29.000000000 +0000 @@ -177,7 +177,7 @@ dh_auto_configure -- $(confflags) --with-platform=qemu touch $@ -debian/stamps/build-grub-efi-ia32 debian/stamps/build-grub-efi-amd64 debian/stamps/build-grub-efi-ia64 debian/stamps/build-grub-efi-arm debian/stamps/build-grub-efi-arm64 debian/stamps/build-grub-ieee1275 debian/stamps/build-grub-coreboot debian/stamps/build-grub-emu debian/stamps/build-grub-uboot debian/stamps/build-grub-xen-i386 debian/stamps/build-grub-xen-amd64 debian/stamps/build-grub-yeeloong: debian/stamps/build-%: debian/stamps/configure-% +debian/stamps/build-grub-efi-ia32 debian/stamps/build-grub-efi-amd64 debian/stamps/build-grub-efi-ia64 debian/stamps/build-grub-efi-arm debian/stamps/build-grub-efi-arm64 debian/stamps/build-grub-coreboot debian/stamps/build-grub-emu debian/stamps/build-grub-uboot debian/stamps/build-grub-xen-i386 debian/stamps/build-grub-xen-amd64 debian/stamps/build-grub-yeeloong: debian/stamps/build-%: debian/stamps/configure-% dh_auto_build touch $@ @@ -188,6 +188,13 @@ endif touch $@ +debian/stamps/build-grub-ieee1275: debian/stamps/configure-grub-ieee1275 + dh_auto_build +ifeq ($(DEB_HOST_ARCH_CPU),ppc64el) + $(CC) $(HOST_CFLAGS) debian/prep-bootdev.c -o debian/prep-bootdev -lparted +endif + touch $@ + debian/stamps/build-grub-xen: debian/stamps/build-grub-xen-i386 debian/stamps/build-grub-xen-amd64 touch $@