diff --git a/0432-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0001-Migrate-PPC-from-Yaboot-to-Grub2.patch similarity index 96% rename from 0432-Migrate-PPC-from-Yaboot-to-Grub2.patch rename to 0001-Migrate-PPC-from-Yaboot-to-Grub2.patch index 58fd2b5..d1694bc 100644 --- a/0432-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0001-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -1,7 +1,7 @@ -From 08a6cb996791748ae3f628ca81ea126b98befc0d Mon Sep 17 00:00:00 2001 +From 430eb790de723e12dab382bebb1bf7c4636f518c Mon Sep 17 00:00:00 2001 From: Mark Hamzy Date: Wed, 28 Mar 2012 14:46:41 -0500 -Subject: [PATCH 432/506] Migrate PPC from Yaboot to Grub2 +Subject: [PATCH 01/74] Migrate PPC from Yaboot to Grub2 Add configuration support for serial terminal consoles. This will set the maximum screen size so that text is not overwritten. diff --git a/0001-fix-EFI-detection-on-Windows.patch b/0001-fix-EFI-detection-on-Windows.patch deleted file mode 100644 index ec7c893..0000000 --- a/0001-fix-EFI-detection-on-Windows.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a6e7719bbe05993613a8de69dba14fa092144925 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Wed, 25 Dec 2013 22:36:28 +0400 -Subject: [PATCH 001/506] fix EFI detection on Windows - -We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns -zero) *and* extended error information is ERROR_INVALID_FUNCTION. - -Cf. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx ---- - ChangeLog | 5 +++++ - grub-core/osdep/windows/platform.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 41bcebf..21ec1c7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2013-12-25 Andrey Borzenkov -+ -+ * grub-core/osdep/windows/platform.c (get_platform): Fix EFI -+ detection. -+ - 2013-12-24 Vladimir Serbinenko - - * configure.ac: Set version to 2.02~beta2. -diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c -index f2b9d71..d217efe 100644 ---- a/grub-core/osdep/windows/platform.c -+++ b/grub-core/osdep/windows/platform.c -@@ -100,7 +100,7 @@ get_platform (void) - - if (!func_GetFirmwareEnvironmentVariableW (L"BootOrder", GRUB_EFI_GLOBAL_VARIABLE_GUID_WINDOWS_STR, - buffer, sizeof (buffer)) -- && GetLastError () != ERROR_INVALID_FUNCTION) -+ && GetLastError () == ERROR_INVALID_FUNCTION) - { - platform = PLAT_BIOS; - return; --- -2.4.3 - diff --git a/0433-Add-fw_path-variable-revised.patch b/0002-Add-fw_path-variable-revised.patch similarity index 94% rename from 0433-Add-fw_path-variable-revised.patch rename to 0002-Add-fw_path-variable-revised.patch index 51a0463..2585d1b 100644 --- a/0433-Add-fw_path-variable-revised.patch +++ b/0002-Add-fw_path-variable-revised.patch @@ -1,7 +1,7 @@ -From dd00df22ba2bc9b9e388c65f98d208330020fc24 Mon Sep 17 00:00:00 2001 +From 77809768ce9f984cd2359cb605456314721aca95 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 19 Sep 2012 21:22:55 -0300 -Subject: [PATCH 433/506] Add fw_path variable (revised) +Subject: [PATCH 02/74] Add fw_path variable (revised) This patch makes grub look for its config file on efi where the app was found. It was originally written by Matthew Garrett, and adapted to fix the diff --git a/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch b/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch deleted file mode 100644 index 0fc5621..0000000 --- a/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 5bda44d7f98c36f87144869ec58b518f80a69b56 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 25 Dec 2013 23:31:42 +0100 -Subject: [PATCH 002/506] * grub-core/kern/arm/cache_armv6.S: Remove - .arch directive. - - As these functions are used on pre-ARMv6 CPUs as well we don't want - to make assembler assume that architecture is higher than default one. ---- - ChangeLog | 7 +++++++ - grub-core/kern/arm/cache_armv6.S | 1 - - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 21ec1c7..153bc43 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2013-12-25 Vladimir Serbinenko -+ -+ * grub-core/kern/arm/cache_armv6.S: Remove .arch directive. -+ -+ As these functions are used on pre-ARMv6 CPUs as well we don't want -+ to make assembler assume that architecture is higher than default one. -+ - 2013-12-25 Andrey Borzenkov - - * grub-core/osdep/windows/platform.c (get_platform): Fix EFI -diff --git a/grub-core/kern/arm/cache_armv6.S b/grub-core/kern/arm/cache_armv6.S -index 39da1df..dfaded0 100644 ---- a/grub-core/kern/arm/cache_armv6.S -+++ b/grub-core/kern/arm/cache_armv6.S -@@ -22,7 +22,6 @@ - .text - .syntax unified - .arm -- .arch armv6 - - # define DMB mcr p15, 0, r0, c7, c10, 5 - # define DSB mcr p15, 0, r0, c7, c10, 4 --- -2.4.3 - diff --git a/0434-Add-support-for-linuxefi.patch b/0003-Add-support-for-linuxefi.patch similarity index 99% rename from 0434-Add-support-for-linuxefi.patch rename to 0003-Add-support-for-linuxefi.patch index a093e2d..1ab1400 100644 --- a/0434-Add-support-for-linuxefi.patch +++ b/0003-Add-support-for-linuxefi.patch @@ -1,7 +1,7 @@ -From 5b84fbd00374f561f82277b7d22fd8a4877667e6 Mon Sep 17 00:00:00 2001 +From b1ce9da47f7d73a793f8e41ad4575d09e4ef9e9b Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 10 Jul 2012 11:58:52 -0400 -Subject: [PATCH 434/506] Add support for linuxefi +Subject: [PATCH 03/74] Add support for linuxefi --- grub-core/Makefile.core.def | 8 + diff --git a/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch b/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch deleted file mode 100644 index 6787b70..0000000 --- a/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 51f941a0d871fe9af20d57574272e62d52b3375c Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 27 Dec 2013 03:03:32 +0000 -Subject: [PATCH 003/506] * INSTALL (Cross-compiling the GRUB): Fix some - spelling mistakes. * docs/grub.texi (Getting the source code): Likewise. - ---- - ChangeLog | 5 +++++ - INSTALL | 10 +++++----- - docs/grub-dev.texi | 8 ++++---- - 3 files changed, 14 insertions(+), 9 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 21ec1c7..e61d48b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2013-12-27 Colin Watson -+ -+ * INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes. -+ * docs/grub.texi (Getting the source code): Likewise. -+ - 2013-12-25 Andrey Borzenkov - - * grub-core/osdep/windows/platform.c (get_platform): Fix EFI -diff --git a/INSTALL b/INSTALL -index afc957c..db12530 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -140,7 +140,7 @@ If build and host are different make check isn't available. - If build and host are different man pages are not generated. - - As an example imagine you have a build system running on FreeBSD on sparc --which prepares packages for developpers running amd64 GNU/Linux laptop and -+which prepares packages for developers running amd64 GNU/Linux laptop and - they need to make images for ARM board running U-boot. In this case: - - build=sparc64-freebsd -@@ -149,7 +149,7 @@ target=arm-uboot - - For this example the configure line might look like (more details below) - (some options are optional and included here for completeness but some rarely --used options are omited): -+used options are omitted): - - ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu - CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config -@@ -196,9 +196,9 @@ corresponding platform are not needed for the platform in question. - 11. TARGET_RANLIB= for ranlib for target. - - - Additionally for emu, for host and target. -- 1. SDL is looked for in stadard linker directories (-lSDL) (optional) -- 2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional) -- 3. libusb is looked for in stadard linker directories (-lusb) (optional) -+ 1. SDL is looked for in standard linker directories (-lSDL) (optional) -+ 2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional) -+ 3. libusb is looked for in standard linker directories (-lusb) (optional) - - - Platform-agnostic tools and data. - 1. make is the tool you execute after ./configure. -diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index c796850..7c6244c 100644 ---- a/docs/grub-dev.texi -+++ b/docs/grub-dev.texi -@@ -108,16 +108,16 @@ The branches available are: - - @table @samp - @item master -- Main developpement branch. -+ Main development branch. - @item grub-legacy - GRUB 0.97 codebase. Kept for reference and legal reasons - @item multiboot - Multiboot specfication - @item multiboot2 - Multiboot2 specfication --@item developper branches -- Prefixed with developper name. Every developper of a team manages his own branches. -- Developper branches do not need changelog entries. -+@item developer branches -+ Prefixed with developer name. Every developer of a team manages his own branches. -+ Developer branches do not need changelog entries. - @end table - - Once you have used @kbd{git clone} to fetch an initial copy of a branch, you --- -2.4.3 - diff --git a/0004-NEWS-First-draft-of-2.02-entry.patch b/0004-NEWS-First-draft-of-2.02-entry.patch deleted file mode 100644 index e57511d..0000000 --- a/0004-NEWS-First-draft-of-2.02-entry.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 30a338460ad97c190502a1067979dac2fc548f16 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 27 Dec 2013 03:05:38 +0000 -Subject: [PATCH 004/506] * NEWS: First draft of 2.02 entry. - ---- - ChangeLog | 4 +++ - NEWS | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 123 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index e61d48b..53f0481 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2013-12-27 Colin Watson - -+ * NEWS: First draft of 2.02 entry. -+ -+2013-12-27 Colin Watson -+ - * INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes. - * docs/grub.texi (Getting the source code): Likewise. - -diff --git a/NEWS b/NEWS -index 4bb5f98..577d9fd 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,122 @@ -+New in 2.02: -+ -+* New/improved filesystem and disk support: -+ * Big-endian UFS1. -+ * Experimental 64-bit ext2 support. -+ * Various fixes for non-512-byte sector devices. -+ * New `proc' filesystem framework, used by LUKS disks. -+ * Fix DM-RAID partition handling. -+ * New `nativedisk' command to switch from firmware to native disk drivers. -+ * Compressed HFS+. -+ * DragonFly BSD labels. -+ * CBFS (coreboot). -+ * Handle partitioned LVM properly. -+ * Use LVM UUIDs whenever possible. -+ * GPT PReP. -+ * New `progress' module that shows progress information while reading -+ files. -+ -+* New/improved terminal and video support: -+ * Monochrome text (matching `hercules' in GRUB Legacy). -+ * Morse code output using system speaker. -+ * `spkmodem' output (simple data protocol using system speaker). -+ * Handle Japanese special keys. -+ * coreboot framebuffer. -+ * Serial on ARC. -+ * Native vt100 handling for grub-emu, replacing the use of the curses -+ library. -+ * New gfxmenu options for terminal window positioning, theme background -+ image handling, and scrollbar padding, plus `item_pixmap_style' and -+ `highlight_overlay'. -+ * Support several more image types (paletted and greyscale). -+ -+* Boot protocol improvements: -+ * Support Apple FAT binaries on non-Apple platforms. -+ * Improve FreeDOS direct loading support compatibility. -+ * Enable `linux16' on all x86 platforms, not just BIOS. -+ * New TrueCrypt ISO loader. -+ -+* New/improved network support: -+ * New variables `net_default_*' containing properties of the default -+ interface. -+ * Autoload `http' and `tftp' modules if necessary. -+ * Improve TFTP robustness. -+ * Parse `nd' disk names in GRUB Legacy configuration files. -+ * Issue separate DNS queries for IPv4 and IPv6. -+ -+* New/improved platform support: -+ * New `efifwsetup' and `lsefi' commands on EFI platforms. -+ * New `cmosclean', `cmosdump', and `cmosset' commands on platforms with -+ CMOS support. -+ * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on -+ coreboot. -+ * Improve opcode parsing in ACPI halt implementation. -+ * Use the TSC as a possible time source on i386-ieee1275. -+ * Merge PowerPC grub-mkrescue implementation with the common one. -+ * Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such -+ as pSeries, and mips-arc. -+ * Make grub-mkrescue better support Apple Intel Macs on CD. -+ * Enable GRUB Legacy configuration file parsing on EFI. -+ * Support halt for Loongson 2E. -+ * ARM U-Boot and EFI ports. -+ * Reorganise platform-dependent code in utilities to avoid #ifdef mess. -+ * AROS and Haiku support for userspace utilities. -+ * Xen PV port. -+ * Fix EFI stack alignment. -+ * ARM64 EFI port. -+ * On Linux, read partition start offsets from sysfs if possible. -+ * New grub-macbless utility, and better integration with Mac firmware in -+ grub-install. -+ * Support Yeeloong 3A. -+ * Add `cpuid --pae' option to detect Physical Address Extension on x86. -+ -+* Security: -+ * Add optional facility to enforce that all files read by the core image -+ from disk have a valid detached digital signature. -+ -+* Performance: -+ * Avoid costly division operations in many places. -+ * New boot time analysis framework (`./configure --enable-boot-time'). -+ * Initialise USB ports in parallel. -+ * New `testspeed' command to test file read speed. -+ -+* Scripting: -+ * New `eval' and `tr' commands. -+ * grub-script-check fails on scripts containing no commands. -+ -+* Installation and other utility improvements: -+ * Add option to compress files on installation or image creation. -+ * Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'. -+ * Support probing EFI System Partition (requires os-prober >= 1.58). -+ * Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and -+ `GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently. -+ * grub-mount handles symbolic links to directories. -+ * Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key -+ for grub-mkconfig. -+ * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone -+ rewritten in C. They should now work in supported non-Unix-like -+ environments. -+ * Reorganise timeout handling using new `timeout_style' environment -+ variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig. -+ Menu hotkeys pressed during a hidden timeout now boot the corresponding -+ menu entry immediately. -+ * New `file' command and grub-file utility to check file types. -+ * New syslinux configuration file parser. -+ -+* Build system: -+ * Remove all uses of nested functions; GRUB no longer requires an -+ executable stack. -+ * Fix documentation build with Texinfo >= 5.1. -+ * More robust and documented cross-compiling support. -+ * Partial clang support for some platforms. -+ * Eliminate the use of AutoGen. This allowed some performance -+ improvements to the build system. -+ * Fix build with FreeType >= 2.5.1. -+ * Make gentpl.py compatible with Python 3. It now requires at least -+ Python 2.6. -+ -+* Revision control moved to git. -+ - New in 2.00: - - * Appearance: --- -2.4.3 - diff --git a/0435-Use-linuxefi-and-initrdefi-where-appropriate.patch b/0004-Use-linuxefi-and-initrdefi-where-appropriate.patch similarity index 91% rename from 0435-Use-linuxefi-and-initrdefi-where-appropriate.patch rename to 0004-Use-linuxefi-and-initrdefi-where-appropriate.patch index 0304fbd..5b7ec37 100644 --- a/0435-Use-linuxefi-and-initrdefi-where-appropriate.patch +++ b/0004-Use-linuxefi-and-initrdefi-where-appropriate.patch @@ -1,7 +1,7 @@ -From 93b844d65dde67bf4dd668149bdcccab92514671 Mon Sep 17 00:00:00 2001 +From 98857c979c99a85c6bb9ff758c1d17b522d150ae Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 16 Jul 2012 18:57:11 -0400 -Subject: [PATCH 435/506] Use "linuxefi" and "initrdefi" where appropriate. +Subject: [PATCH 04/74] Use "linuxefi" and "initrdefi" where appropriate. --- util/grub.d/10_linux.in | 18 ++++++++++++++++-- diff --git a/0436-Don-t-allow-insmod-when-secure-boot-is-enabled.patch b/0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch similarity index 96% rename from 0436-Don-t-allow-insmod-when-secure-boot-is-enabled.patch rename to 0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch index 94500c2..70a5756 100644 --- a/0436-Don-t-allow-insmod-when-secure-boot-is-enabled.patch +++ b/0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch @@ -1,7 +1,7 @@ -From 6ca0c8870102ed6465fd2c66fd8f6d3fae76a99e Mon Sep 17 00:00:00 2001 +From c76d0d67323efe33ec2e3f44f08047545550d721 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 23 Oct 2012 10:40:49 -0400 -Subject: [PATCH 436/506] Don't allow insmod when secure boot is enabled. +Subject: [PATCH 05/74] Don't allow insmod when secure boot is enabled. Hi, diff --git a/0005-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch b/0005-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch deleted file mode 100644 index 2492e8e..0000000 --- a/0005-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8442d3e956fa3775419b0b3ce65f4289875e7ecf Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Sat, 28 Dec 2013 02:20:27 +0000 -Subject: [PATCH 005/506] * NEWS: The cmosclean command in fact dates back to - 1.99. Remove mention of it from 2.02. - ---- - ChangeLog | 5 +++++ - NEWS | 3 +-- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index da3c2df..c33856e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2013-12-28 Colin Watson -+ -+ * NEWS: The cmosclean command in fact dates back to 1.99. Remove -+ mention of it from 2.02. -+ - 2013-12-27 Vladimir Serbinenko - - * grub-core/kern/arm/cache_armv6.S: Remove .arch directive. -diff --git a/NEWS b/NEWS -index 577d9fd..b74c05f 100644 ---- a/NEWS -+++ b/NEWS -@@ -46,8 +46,7 @@ New in 2.02: - - * New/improved platform support: - * New `efifwsetup' and `lsefi' commands on EFI platforms. -- * New `cmosclean', `cmosdump', and `cmosset' commands on platforms with -- CMOS support. -+ * New `cmosdump' and `cmosset' commands on platforms with CMOS support. - * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on - coreboot. - * Improve opcode parsing in ACPI halt implementation. --- -2.4.3 - diff --git a/0437-Pass-x-hex-hex-straight-through-unmolested.patch b/0006-Pass-x-hex-hex-straight-through-unmolested.patch similarity index 97% rename from 0437-Pass-x-hex-hex-straight-through-unmolested.patch rename to 0006-Pass-x-hex-hex-straight-through-unmolested.patch index 9d23d5c..8752c47 100644 --- a/0437-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0006-Pass-x-hex-hex-straight-through-unmolested.patch @@ -1,7 +1,7 @@ -From e2df8fe29842472f8d49dfbfd39fca1b9c809eee Mon Sep 17 00:00:00 2001 +From 468d8909c5c86fec5e676df7ca1223a370bab703 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 1 Oct 2012 13:24:37 -0400 -Subject: [PATCH 437/506] Pass "\x[[:hex:]][[:hex:]]" straight through +Subject: [PATCH 06/74] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. --- diff --git a/0006-remove-unused-error.h-from-kern-emu-misc.c.patch b/0006-remove-unused-error.h-from-kern-emu-misc.c.patch deleted file mode 100644 index 5133c25..0000000 --- a/0006-remove-unused-error.h-from-kern-emu-misc.c.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 989af025829b20a19f4d3ee01e86f4ee9de7cf1e Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 28 Dec 2013 09:01:20 +0400 -Subject: [PATCH 006/506] remove unused error.h from kern/emu/misc.c - -Fixes compilation on mingw32, where include is apparently missing. ---- - ChangeLog | 5 +++++ - grub-core/kern/emu/misc.c | 1 - - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index c33856e..0401f61 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2013-12-28 Andrey Borzenkov -+ -+ * grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation -+ on mingw. -+ - 2013-12-28 Colin Watson - - * NEWS: The cmosclean command in fact dates back to 1.99. Remove -diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 43471b4..bb606da 100644 ---- a/grub-core/kern/emu/misc.c -+++ b/grub-core/kern/emu/misc.c -@@ -20,7 +20,6 @@ - #include - - #include --#include - #include - #include - #include --- -2.4.3 - diff --git a/0007-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch b/0007-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch deleted file mode 100644 index b81d989..0000000 --- a/0007-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 093dec7370650ecfa9b770210e21b8d6b03f1df3 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 28 Dec 2013 17:25:14 +0100 -Subject: [PATCH 007/506] Don't abort() on unavailable coreboot tables - if not running on coreboot. - ---- - ChangeLog | 4 ++++ - grub-core/kern/i386/coreboot/cbtable.c | 2 +- - grub-core/kern/i386/coreboot/init.c | 5 +++++ - 3 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 0401f61..ed6d77c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2013-12-28 Vladimir Serbinenko -+ -+ Don't abort() on unavailable coreboot tables if not running on coreboot. -+ - 2013-12-28 Andrey Borzenkov - - * grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation -diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c -index e3bb7b2..1669bc0 100644 ---- a/grub-core/kern/i386/coreboot/cbtable.c -+++ b/grub-core/kern/i386/coreboot/cbtable.c -@@ -55,7 +55,7 @@ grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, - if (check_signature (table_header)) - goto signature_found; - -- grub_fatal ("Could not find coreboot table\n"); -+ return 0; - - signature_found: - -diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c -index 6b150b4..3314f02 100644 ---- a/grub-core/kern/i386/coreboot/init.c -+++ b/grub-core/kern/i386/coreboot/init.c -@@ -51,6 +51,7 @@ grub_exit (void) - - grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; - static grub_uint64_t modend; -+static int have_memory = 0; - - /* Helper for grub_machine_init. */ - static int -@@ -82,6 +83,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, - - grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin)); - -+ have_memory = 1; -+ - return 0; - } - -@@ -97,6 +100,8 @@ grub_machine_init (void) - grub_vga_text_init (); - - grub_machine_mmap_iterate (heap_init, NULL); -+ if (!have_memory) -+ grub_fatal ("No memory found"); - - grub_video_coreboot_fb_late_init (); - --- -2.4.3 - diff --git a/0438-Fix-crash-on-http.patch b/0007-Fix-crash-on-http.patch similarity index 88% rename from 0438-Fix-crash-on-http.patch rename to 0007-Fix-crash-on-http.patch index b6bedab..b46d8a7 100644 --- a/0438-Fix-crash-on-http.patch +++ b/0007-Fix-crash-on-http.patch @@ -1,7 +1,7 @@ -From cf9eb6291b60f27c247c2586b1ee57498de72607 Mon Sep 17 00:00:00 2001 +From 59371cdd4588470ced7b8fbf71ecda648c52b989 Mon Sep 17 00:00:00 2001 From: Gustavo Luiz Duarte Date: Tue, 25 Sep 2012 18:40:55 -0400 -Subject: [PATCH 438/506] Fix crash on http +Subject: [PATCH 07/74] Fix crash on http Don't free file->data on receiving FIN flag since it is used all over without checking. http_close() will be called later to free that memory. diff --git a/0439-IBM-client-architecture-CAS-reboot-support.patch b/0008-IBM-client-architecture-CAS-reboot-support.patch similarity index 97% rename from 0439-IBM-client-architecture-CAS-reboot-support.patch rename to 0008-IBM-client-architecture-CAS-reboot-support.patch index a251c7e..4a69eb7 100644 --- a/0439-IBM-client-architecture-CAS-reboot-support.patch +++ b/0008-IBM-client-architecture-CAS-reboot-support.patch @@ -1,7 +1,7 @@ -From 3d35130015653257ae8e65bb85d63180195a34e7 Mon Sep 17 00:00:00 2001 +From 13ca7774359074df68cd1042889e44d99f85a695 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Thu, 20 Sep 2012 18:07:39 -0300 -Subject: [PATCH 439/506] IBM client architecture (CAS) reboot support +Subject: [PATCH 08/74] IBM client architecture (CAS) reboot support This is an implementation of IBM client architecture (CAS) reboot for GRUB. diff --git a/0008-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch b/0008-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch deleted file mode 100644 index 535dac3..0000000 --- a/0008-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 0e309454f6f184c3704d7b78687e314f14a07b3c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 30 Dec 2013 06:49:15 +0100 -Subject: [PATCH 008/506] * NEWS: Add few missing entries. Correct - existing ones. - ---- - ChangeLog | 4 ++++ - NEWS | 27 ++++++++++++++++++++++----- - 2 files changed, 26 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index ed6d77c..db84300 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2013-12-30 Vladimir Serbinenko -+ -+ * NEWS: Add few missing entries. Correct existing ones. -+ - 2013-12-28 Vladimir Serbinenko - - Don't abort() on unavailable coreboot tables if not running on coreboot. -diff --git a/NEWS b/NEWS -index b74c05f..49a2459 100644 ---- a/NEWS -+++ b/NEWS -@@ -35,6 +35,8 @@ New in 2.02: - * Improve FreeDOS direct loading support compatibility. - * Enable `linux16' on all x86 platforms, not just BIOS. - * New TrueCrypt ISO loader. -+ * multiboot2 boot-services EFI specification. -+ * multiboot2 full-file specfication. - - * New/improved network support: - * New variables `net_default_*' containing properties of the default -@@ -44,11 +46,17 @@ New in 2.02: - * Parse `nd' disk names in GRUB Legacy configuration files. - * Issue separate DNS queries for IPv4 and IPv6. - -+* Coreboot improvements: -+ * CBFS support both in on-disk images (loopback) and flash. -+ * Ability to launch another payload from flash or disk -+ * Coreboot framebuffer -+ * CBMEMC support (both logging and inspecting logs) -+ * Inspecting coreboot timestamps. -+ * Inspecting coreboot tables. -+ - * New/improved platform support: - * New `efifwsetup' and `lsefi' commands on EFI platforms. - * New `cmosdump' and `cmosset' commands on platforms with CMOS support. -- * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on -- coreboot. - * Improve opcode parsing in ACPI halt implementation. - * Use the TSC as a possible time source on i386-ieee1275. - * Merge PowerPC grub-mkrescue implementation with the common one. -@@ -68,6 +76,7 @@ New in 2.02: - grub-install. - * Support Yeeloong 3A. - * Add `cpuid --pae' option to detect Physical Address Extension on x86. -+ * Support for USB debug dongles. - - * Security: - * Add optional facility to enforce that all files read by the core image -@@ -78,6 +87,7 @@ New in 2.02: - * New boot time analysis framework (`./configure --enable-boot-time'). - * Initialise USB ports in parallel. - * New `testspeed' command to test file read speed. -+ * Speed-up gfxterm by storing intermediate results in more compact format. - - * Scripting: - * New `eval' and `tr' commands. -@@ -95,6 +105,7 @@ New in 2.02: - * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone - rewritten in C. They should now work in supported non-Unix-like - environments. -+ * Native mingw support, including ability to install on EFI under windows. - * Reorganise timeout handling using new `timeout_style' environment - variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig. - Menu hotkeys pressed during a hidden timeout now boot the corresponding -@@ -107,12 +118,19 @@ New in 2.02: - executable stack. - * Fix documentation build with Texinfo >= 5.1. - * More robust and documented cross-compiling support. -- * Partial clang support for some platforms. -+ * Partial clang support for some platforms (experimental). -+ * Partial mingw64 x86_64-efi compile support (highly experimental). -+ * Partial mingw32 i386-* (other than already present i386-pc) -+ compile support (highly experimental). - * Eliminate the use of AutoGen. This allowed some performance - improvements to the build system. -+ * Remove variable length arrays. -+ * OpenBSD compile and tools support (NetBSD and FreeBSD were already supported). - * Fix build with FreeType >= 2.5.1. - * Make gentpl.py compatible with Python 3. It now requires at least - Python 2.6. -+ * modinfo.sh contains build information now. -+ * Added many new tests to improve robustness. - - * Revision control moved to git. - -@@ -142,7 +160,6 @@ New in 2.00: - * IEEE1275 serial. - * EFI serial. - * Network stack for BIOS, IEEE1275, EMU and EFI, including TFTP, HTTP and DNS. -- * VBE on coreboot support. - - * New filesystem, filters and disks formats: - * DVH partition map. -@@ -166,7 +183,7 @@ New in 2.00: - * multidevice, mirrored and raidz(2,3) ZFS support. - * RAID LVM (internal RAIDing) support. - * ZFS crypto support. -- * ZLE and GZIP on ZFS support. -+ * ZLE, LZ4 and GZIP on ZFS support. - * Support ZFS up to 33. - * HFS string is now treated like mac-roman and not UTF-8 - * HFS mtime support. --- -2.4.3 - diff --git a/0440-Add-vlan-tag-support.patch b/0009-Add-vlan-tag-support.patch similarity index 98% rename from 0440-Add-vlan-tag-support.patch rename to 0009-Add-vlan-tag-support.patch index cb65b8e..8f65cfe 100644 --- a/0440-Add-vlan-tag-support.patch +++ b/0009-Add-vlan-tag-support.patch @@ -1,7 +1,7 @@ -From eb41d0f572081eeadf04cdf22a9ef508a9dc3216 Mon Sep 17 00:00:00 2001 +From b258cc2ba1f2284026b6ebcadbb972f0f0fa4de0 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 30 Oct 2012 15:19:39 -0200 -Subject: [PATCH 440/506] Add vlan-tag support +Subject: [PATCH 09/74] Add vlan-tag 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 diff --git a/0009-strip-.eh_frame-section-from-arm64-efi-kernel.patch b/0009-strip-.eh_frame-section-from-arm64-efi-kernel.patch deleted file mode 100644 index 44f9f04..0000000 --- a/0009-strip-.eh_frame-section-from-arm64-efi-kernel.patch +++ /dev/null @@ -1,39 +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 009/506] 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/ChangeLog b/ChangeLog -index db84300..8c1ecec 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2013-12-30 Andrey Borzenkov -+ -+ * grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi. -+ - 2013-12-30 Vladimir Serbinenko - - * NEWS: Add few missing entries. Correct existing ones. -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.4.3 - diff --git a/0441-Add-X-option-to-printf-functions.patch b/0010-Add-X-option-to-printf-functions.patch similarity index 92% rename from 0441-Add-X-option-to-printf-functions.patch rename to 0010-Add-X-option-to-printf-functions.patch index d134695..068e4eb 100644 --- a/0441-Add-X-option-to-printf-functions.patch +++ b/0010-Add-X-option-to-printf-functions.patch @@ -1,7 +1,7 @@ -From 29512e7fcc5500d37dff524da4a7af0c60971d65 Mon Sep 17 00:00:00 2001 +From 28297386b1d3801d3a79d31e957b0fbed9eb5baa Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 16:58:39 -0200 -Subject: [PATCH 441/506] Add %X option to printf functions. +Subject: [PATCH 10/74] Add %X option to printf functions. --- grub-core/kern/misc.c | 7 +++++-- diff --git a/0010-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch b/0010-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch deleted file mode 100644 index c29f64b..0000000 --- a/0010-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c9e839e2caaf278491f99e7d181cf20dcf5f0b75 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 7 Jan 2014 10:38:54 +0400 -Subject: [PATCH 010/506] use {grub,boot}aa64.efi for boot images on AArch64 - -According to UEFI 2.4 specification, default boot file name on AArch64 -is BOOTAA64.EFI (3.4.1.1 Removable Media Boot Behavior). Also set default -GRUB image name to grubaa64.efi to match it. ---- - util/grub-install.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub-install.c b/util/grub-install.c -index 8cfe0ea..4608b80 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -1091,7 +1091,7 @@ main (int argc, char *argv[]) - efi_file = "BOOTARM.EFI"; - break; - case GRUB_INSTALL_PLATFORM_ARM64_EFI: -- efi_file = "BOOTAARCH64.EFI"; -+ efi_file = "BOOTAA64.EFI"; - break; - default: - grub_util_error ("%s", _("You've found a bug")); -@@ -1118,7 +1118,7 @@ main (int argc, char *argv[]) - efi_file = "grubarm.efi"; - break; - case GRUB_INSTALL_PLATFORM_ARM64_EFI: -- efi_file = "grubarm64.efi"; -+ efi_file = "grubaa64.efi"; - break; - default: - efi_file = "grub.efi"; --- -2.4.3 - diff --git a/0442-DHCP-client-ID-and-UUID-options-added.patch b/0011-DHCP-client-ID-and-UUID-options-added.patch similarity index 96% rename from 0442-DHCP-client-ID-and-UUID-options-added.patch rename to 0011-DHCP-client-ID-and-UUID-options-added.patch index 350bbd8..a87ce46 100644 --- a/0442-DHCP-client-ID-and-UUID-options-added.patch +++ b/0011-DHCP-client-ID-and-UUID-options-added.patch @@ -1,7 +1,7 @@ -From 0cdf813f43fff3c7dbb416e7afd3ea01fc2cb1cf Mon Sep 17 00:00:00 2001 +From 8122de140b4941e6f733aa3b2789eb54284ec5b4 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:18:53 -0200 -Subject: [PATCH 442/506] DHCP client ID and UUID options added. +Subject: [PATCH 11/74] DHCP client ID and UUID options added. --- grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----- diff --git a/0011-fix-32-bit-compilation-on-MinGW-w64.patch b/0011-fix-32-bit-compilation-on-MinGW-w64.patch deleted file mode 100644 index e3b001f..0000000 --- a/0011-fix-32-bit-compilation-on-MinGW-w64.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 94cee4a4c201bb506377b2c26e072eee8cb19d6f Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 7 Jan 2014 18:43:02 +0400 -Subject: [PATCH 011/506] fix 32 bit compilation on MinGW-w64 - -Use _FILE_OFFSET_BITS macro to distinguish between native MinGW and -32 bit under MinGW-64. The latter does not require fseeko/ftello -redefinition which it already does in case of _FILE_OFFSET_BITS=64. ---- - ChangeLog | 5 +++++ - include/grub/osdep/hostfile_windows.h | 3 +++ - 2 files changed, 8 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 8c1ecec..e87f0a7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-07 Andrey Borzenkov -+ -+ * include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello -+ on MinGW-64 when compiling for 32 bits. -+ - 2013-12-30 Andrey Borzenkov - - * grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi. -diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h -index 36615b2..79efcfa 100644 ---- a/include/grub/osdep/hostfile_windows.h -+++ b/include/grub/osdep/hostfile_windows.h -@@ -69,8 +69,11 @@ enum grub_util_fd_open_flags_t - - #if defined (__MINGW32__) && !defined (__MINGW64__) - -+/* 32 bit on MinGW-64 already redefines them if _FILE_OFFSET_BITS=64 */ -+#if !defined(_FILE_OFFSET_BITS) - #define fseeko fseeko64 - #define ftello ftello64 -+#endif - - #endif - --- -2.4.3 - diff --git a/0012-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch b/0012-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch deleted file mode 100644 index c2aa759..0000000 --- a/0012-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e7cfa8d5e1c6d54d40731065e535889b2e8bc9a2 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 7 Jan 2014 20:34:25 +0400 -Subject: [PATCH 012/506] Change grub-mkrescue to use bootaa64.efi too - -Also add ChangeLog entry for previous change. ---- - ChangeLog | 7 +++++++ - util/grub-mkrescue.c | 2 +- - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index e87f0a7..0b9fa05 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,12 @@ - 2014-01-07 Andrey Borzenkov - -+ * util/grub-install.c: Use bootaa64.efi instead of bootaarch64.efi on -+ arm64 to comply with EFI specification. Also use grubaa64.efi for -+ consistency. -+ * util/grub-mkrescue.c: Change to use bootaa64.efi too. -+ -+2014-01-07 Andrey Borzenkov -+ - * include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello - on MinGW-64 when compiling for 32 bits. - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 317879d..0d03e55 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -663,7 +663,7 @@ main (int argc, char *argv[]) - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname); - free (imgname); - -- imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaarch64.efi"); -+ imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaa64.efi"); - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM64_EFI, "arm64-efi", - imgname); - free (imgname); --- -2.4.3 - diff --git a/0443-Search-for-specific-config-file-for-netboot.patch b/0012-Search-for-specific-config-file-for-netboot.patch similarity index 97% rename from 0443-Search-for-specific-config-file-for-netboot.patch rename to 0012-Search-for-specific-config-file-for-netboot.patch index 9ba864a..c48ded4 100644 --- a/0443-Search-for-specific-config-file-for-netboot.patch +++ b/0012-Search-for-specific-config-file-for-netboot.patch @@ -1,7 +1,7 @@ -From 6d9169d45e90c95fd17d9b42ab7ea91d18edee6b Mon Sep 17 00:00:00 2001 +From 0c18485577c42381f170a9dc1ddd89836cea91b3 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:22:07 -0200 -Subject: [PATCH 443/506] Search for specific config file for netboot +Subject: [PATCH 12/74] Search for specific config file for netboot This patch implements a search for a specific configuration when the config file is on a remoteserver. It uses the following order: diff --git a/0013-arm64-set-correct-length-of-device-path-end-entry.patch b/0013-arm64-set-correct-length-of-device-path-end-entry.patch deleted file mode 100644 index b778fca..0000000 --- a/0013-arm64-set-correct-length-of-device-path-end-entry.patch +++ /dev/null @@ -1,43 +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 013/506] 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/ChangeLog b/ChangeLog -index 0b9fa05..4ec5517 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-07 Leif Lindholm -+ -+ * grub-core/loader/arm64/linux.c: correctly set device path end length. -+ - 2014-01-07 Andrey Borzenkov - - * util/grub-install.c: Use bootaa64.efi instead of bootaarch64.efi on -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.4.3 - diff --git a/0444-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similarity index 97% rename from 0444-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch rename to 0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index b2aa55d..84e4f11 100644 --- a/0444-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -1,7 +1,7 @@ -From 86baf514c1f19d223bfbfb2ad7007e64f22a0648 Mon Sep 17 00:00:00 2001 +From 4b0168249752a531ddedbdc3884bc675cd24033d Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Tue, 22 Jan 2013 06:31:38 +0100 -Subject: [PATCH 444/506] blscfg: add blscfg module to parse Boot Loader +Subject: [PATCH 13/74] blscfg: add blscfg module to parse Boot Loader Specification snippets http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec diff --git a/0014-Makefile.util.def-grub-macbless-Change-mansection-to.patch b/0014-Makefile.util.def-grub-macbless-Change-mansection-to.patch deleted file mode 100644 index 092216a..0000000 --- a/0014-Makefile.util.def-grub-macbless-Change-mansection-to.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ccd21a65ed5ebce27b1e78b56208169fbf30351e Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Wed, 8 Jan 2014 11:05:20 +0000 -Subject: [PATCH 014/506] * Makefile.util.def (grub-macbless): Change - mansection to 8. - ---- - ChangeLog | 4 ++++ - Makefile.util.def | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 4ec5517..b445f12 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-08 Colin Watson -+ -+ * Makefile.util.def (grub-macbless): Change mansection to 8. -+ - 2014-01-07 Leif Lindholm - - * grub-core/loader/arm64/linux.c: correctly set device path end length. -diff --git a/Makefile.util.def b/Makefile.util.def -index 985e76c..3c99be2 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -405,7 +405,7 @@ program = { - program = { - name = grub-macbless; - installdir = sbin; -- mansection = 1; -+ mansection = 8; - common = util/grub-macbless.c; - common = grub-core/osdep/init.c; - common = grub-core/kern/emu/argp_common.c; --- -2.4.3 - diff --git a/0445-Move-bash-completion-script-922997.patch b/0014-Move-bash-completion-script-922997.patch similarity index 86% rename from 0445-Move-bash-completion-script-922997.patch rename to 0014-Move-bash-completion-script-922997.patch index 08fb306..c474196 100644 --- a/0445-Move-bash-completion-script-922997.patch +++ b/0014-Move-bash-completion-script-922997.patch @@ -1,7 +1,7 @@ -From e0c1af15ca7361a543adfe9b9d61d1cd43d7be43 Mon Sep 17 00:00:00 2001 +From 74dc404ac3a93552cf3299e25ebce9e881840fec Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Apr 2013 14:35:34 -0400 -Subject: [PATCH 445/506] Move bash completion script (#922997) +Subject: [PATCH 14/74] Move bash completion script (#922997) Apparently these go in a new place now. --- diff --git a/0015-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch b/0015-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch deleted file mode 100644 index 7f2b863..0000000 --- a/0015-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0776112c5311196889a15058a3b1be4c81ba5e05 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sun, 12 Jan 2014 15:29:21 +0400 -Subject: [PATCH 015/506] add part_apple to EFI rescue image to fix missing - prefix - -On Mac rescue image is booted from HFS+ partition, so bootpath looks like -/ACPI(a0341d0,0)/PCI(1,1f)/ATAPI(0,0,0)/HD(3,5d1,ca3,0000000000000000,20,0)/EndEntire - -grub fails to find device for this path because it cannot scan partition -table. The simplest fix is to add part_apple by default. ---- - util/grub-mkrescue.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 0d03e55..34e0b7a 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -653,11 +653,15 @@ main (int argc, char *argv[]) - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname); - free (imgname); - -+ grub_install_push_module ("part_apple"); - img64 = grub_util_path_concat (2, efidir_efi_boot, "bootx64.efi"); - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64-efi", img64); -+ grub_install_pop_module (); - -+ grub_install_push_module ("part_apple"); - img32 = grub_util_path_concat (2, efidir_efi_boot, "bootia32.efi"); - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_I386_EFI, "i386-efi", img32); -+ grub_install_pop_module (); - - imgname = grub_util_path_concat (2, efidir_efi_boot, "bootarm.efi"); - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname); -@@ -707,7 +711,9 @@ main (int argc, char *argv[]) - free (efidir); - } - -+ grub_install_push_module ("part_apple"); - make_image_fwdisk (GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275, "powerpc-ieee1275", "powerpc-ieee1275/core.elf"); -+ grub_install_pop_module (); - - if (source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275]) - { --- -2.4.3 - diff --git a/0446-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0015-for-ppc-reset-console-display-attr-when-clear-screen.patch similarity index 87% rename from 0446-for-ppc-reset-console-display-attr-when-clear-screen.patch rename to 0015-for-ppc-reset-console-display-attr-when-clear-screen.patch index c270a5d..1bae743 100644 --- a/0446-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0015-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -1,7 +1,7 @@ -From 2add40f1185770a5cae18187659c334090a70ef5 Mon Sep 17 00:00:00 2001 +From 8c359782b598dfe24a6685fb2d181f76c9cc012f Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 24 Apr 2013 10:51:48 -0300 -Subject: [PATCH 446/506] for ppc, reset console display attr when clear screen +Subject: [PATCH 15/74] for ppc, reset console display attr when clear screen This should fix this bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=908519 diff --git a/0447-Don-t-write-messages-to-the-screen.patch b/0016-Don-t-write-messages-to-the-screen.patch similarity index 97% rename from 0447-Don-t-write-messages-to-the-screen.patch rename to 0016-Don-t-write-messages-to-the-screen.patch index 318de7a..a77b7be 100644 --- a/0447-Don-t-write-messages-to-the-screen.patch +++ b/0016-Don-t-write-messages-to-the-screen.patch @@ -1,7 +1,7 @@ -From e9cf038f6f4c0c94679ca290da2c12ece83b16c2 Mon Sep 17 00:00:00 2001 +From fdb6df04bdd06c990498a283ddcaf0522adf8db0 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:30:20 -0400 -Subject: [PATCH 447/506] Don't write messages to the screen +Subject: [PATCH 16/74] Don't write messages to the screen Writing messages to the screen before the menus or boot splash happens so quickly it looks like something is wrong and isn't diff --git a/0016-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch b/0016-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch deleted file mode 100644 index 48eeed8..0000000 --- a/0016-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 09a836e59c1103ed9aa238dcd526da670c9b0d90 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 17 Jan 2014 02:30:52 +0000 -Subject: [PATCH 016/506] freebsd/hostdisk.c is only ever compiled on FreeBSD - -* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove -redundant preprocessor conditional. ---- - ChangeLog | 5 +++++ - grub-core/osdep/freebsd/hostdisk.c | 2 -- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index b445f12..6613b4e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-17 Colin Watson -+ -+ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove -+ redundant preprocessor conditional. -+ - 2014-01-08 Colin Watson - - * Makefile.util.def (grub-macbless): Change mansection to 8. -diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c -index bd5fddb..eb202dc 100644 ---- a/grub-core/osdep/freebsd/hostdisk.c -+++ b/grub-core/osdep/freebsd/hostdisk.c -@@ -108,7 +108,6 @@ grub_util_fd_open (const char *os_dev, int flags) - - ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); - --#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - if (! (sysctl_oldflags & 0x10) - && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_oldflags, sysctl_size)) - { -@@ -116,7 +115,6 @@ grub_util_fd_open (const char *os_dev, int flags) - close (ret); - return GRUB_UTIL_FD_INVALID; - } --#endif - - return ret; - } --- -2.4.3 - diff --git a/0448-Don-t-print-GNU-GRUB-header.patch b/0017-Don-t-print-GNU-GRUB-header.patch similarity index 86% rename from 0448-Don-t-print-GNU-GRUB-header.patch rename to 0017-Don-t-print-GNU-GRUB-header.patch index 493ca3e..93219a3 100644 --- a/0448-Don-t-print-GNU-GRUB-header.patch +++ b/0017-Don-t-print-GNU-GRUB-header.patch @@ -1,7 +1,7 @@ -From 58753a84c70d230beb407972706c71f1e3389e9b Mon Sep 17 00:00:00 2001 +From 0d083e108f6f49c9dddc518a311f7d6718981789 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:53:48 -0400 -Subject: [PATCH 448/506] Don't print GNU GRUB header +Subject: [PATCH 17/74] Don't print GNU GRUB header No one cares. --- diff --git a/0017-Prefer-more-portable-test-1-constructs.patch b/0017-Prefer-more-portable-test-1-constructs.patch deleted file mode 100644 index 24a1e59..0000000 --- a/0017-Prefer-more-portable-test-1-constructs.patch +++ /dev/null @@ -1,109 +0,0 @@ -From ff66b8e7d8397c40bdd57ada31665b605c20c565 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 17 Jan 2014 15:24:50 +0000 -Subject: [PATCH 017/506] Prefer more portable test(1) constructs - -* util/grub.d/00_header.in (make_timeout): Use && rather than test --a. -* util/grub.d/10_windows.in: Likewise. -* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather -than test -o. -* util/grub.d/30_os-prober.in: Use && rather than test -a, and || -rather than test -o. ---- - ChangeLog | 12 +++++++++++- - util/grub.d/00_header.in | 2 +- - util/grub.d/10_netbsd.in | 2 +- - util/grub.d/10_windows.in | 4 ++-- - util/grub.d/30_os-prober.in | 4 ++-- - 5 files changed, 17 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6613b4e..c8e95a6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,4 +1,14 @@ --2014-01-17 Colin Watson -+2014-01-17 Colin Watson -+ -+ * util/grub.d/00_header.in (make_timeout): Use && rather than test -+ -a. -+ * util/grub.d/10_windows.in: Likewise. -+ * util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather -+ than test -o. -+ * util/grub.d/30_os-prober.in: Use && rather than test -a, and || -+ rather than test -o. -+ -+2014-01-17 Colin Watson - - * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove - redundant preprocessor conditional. -diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 0c82f23..ce2ec81 100644 ---- a/util/grub.d/00_header.in -+++ b/util/grub.d/00_header.in -@@ -285,7 +285,7 @@ make_timeout () - if [ "x${3}" != "x" ] ; then - timeout="${2}" - style="${3}" -- elif [ "x${1}" != "x" -a "x${1}" != "x0" ] ; then -+ elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then - # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme. - timeout="${1}" - if [ "x${2}" != "x0" ] ; then -diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in -index 29a0e41..9988a42 100644 ---- a/util/grub.d/10_netbsd.in -+++ b/util/grub.d/10_netbsd.in -@@ -69,7 +69,7 @@ netbsd_load_fs_module () - kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }') - kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod" - -- if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then -+ if test -z "$karch" || test -z "$kversion" || test ! -f "${kmodule}"; then - return - fi - -diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in -index 9025914..48bd955 100644 ---- a/util/grub.d/10_windows.in -+++ b/util/grub.d/10_windows.in -@@ -66,11 +66,11 @@ for drv in $drives ; do - osid= - - # Check for Vista bootmgr. -- if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then -+ if [ -f "$dir"/bootmgr ] && [ -f "$dir"/boot/bcd ] ; then - OS="$(gettext "Windows Vista/7 (loader)")" - osid=bootmgr - # Check for NTLDR. -- elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then -+ elif [ -f "$dir"/ntldr ] && [ -f "$dir"/ntdetect.com ] && [ -f "$dir"/boot.ini ] ; then - OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext "Windows NT/2000/XP (loader)")" - osid=ntldr - needmap=t -diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 0470e66..7cf8487 100644 ---- a/util/grub.d/30_os-prober.in -+++ b/util/grub.d/30_os-prober.in -@@ -30,7 +30,7 @@ if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then - exit 0 - fi - --if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then -+if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then - # missing os-prober and/or linux-boot-prober - exit 0 - fi -@@ -119,7 +119,7 @@ for OS in ${OSPROBED} ; do - EXPUUID="${EXPUUID}@${DEVICE#*@}" - fi - -- if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then -+ if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then - echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 - continue - fi --- -2.4.3 - diff --git a/0449-Don-t-add-to-highlighted-row.patch b/0018-Don-t-add-to-highlighted-row.patch similarity index 85% rename from 0449-Don-t-add-to-highlighted-row.patch rename to 0018-Don-t-add-to-highlighted-row.patch index 974d378..cc664fd 100644 --- a/0449-Don-t-add-to-highlighted-row.patch +++ b/0018-Don-t-add-to-highlighted-row.patch @@ -1,7 +1,7 @@ -From 36d33527138e344d957a2e589f26455078aabe7a Mon Sep 17 00:00:00 2001 +From 5c30a4744e7840cb9ae135d470b45416c41bb91e Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 17:49:45 -0400 -Subject: [PATCH 449/506] Don't add '*' to highlighted row +Subject: [PATCH 18/74] Don't add '*' to highlighted row It is already highlighted. --- diff --git a/0018-NEWS-Add-few-missing-entries.patch b/0018-NEWS-Add-few-missing-entries.patch deleted file mode 100644 index ee4520a..0000000 --- a/0018-NEWS-Add-few-missing-entries.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 5acc8020b46605703a59915d4166520788dfdf00 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 16:31:10 +0100 -Subject: [PATCH 018/506] * NEWS: Add few missing entries. - ---- - ChangeLog | 4 ++++ - NEWS | 18 +++++++++++++++--- - 2 files changed, 19 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c8e95a6..6a19f85 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-18 Vladimir Serbinenko -+ -+ * NEWS: Add few missing entries. -+ - 2014-01-17 Colin Watson - - * util/grub.d/00_header.in (make_timeout): Use && rather than test -diff --git a/NEWS b/NEWS -index 49a2459..a61df94 100644 ---- a/NEWS -+++ b/NEWS -@@ -15,6 +15,8 @@ New in 2.02: - * GPT PReP. - * New `progress' module that shows progress information while reading - files. -+ * ZFS features support. -+ * ZFS LZ4 support. - - * New/improved terminal and video support: - * Monochrome text (matching `hercules' in GRUB Legacy). -@@ -36,6 +38,7 @@ New in 2.02: - * Enable `linux16' on all x86 platforms, not just BIOS. - * New TrueCrypt ISO loader. - * multiboot2 boot-services EFI specification. -+ * multiboot2 EFI memory map specification. - * multiboot2 full-file specfication. - - * New/improved network support: -@@ -51,12 +54,15 @@ New in 2.02: - * Ability to launch another payload from flash or disk - * Coreboot framebuffer - * CBMEMC support (both logging and inspecting logs) -- * Inspecting coreboot timestamps. -- * Inspecting coreboot tables. -+ * Command for inspecting coreboot timestamps (`coreboot_boottime'). -+ * Command for inspecting coreboot tables (`lscoreboot'). -+ * New target default_payload.elf. -+ * Increased maximal core size. - - * New/improved platform support: - * New `efifwsetup' and `lsefi' commands on EFI platforms. - * New `cmosdump' and `cmosset' commands on platforms with CMOS support. -+ * New command `pcidump' for PCI platforms. - * Improve opcode parsing in ACPI halt implementation. - * Use the TSC as a possible time source on i386-ieee1275. - * Merge PowerPC grub-mkrescue implementation with the common one. -@@ -77,6 +83,8 @@ New in 2.02: - * Support Yeeloong 3A. - * Add `cpuid --pae' option to detect Physical Address Extension on x86. - * Support for USB debug dongles. -+ * Support for *-emu on all platforms (previously only i386/x86_64 worked). -+ * Support *-emu on Windows. - - * Security: - * Add optional facility to enforce that all files read by the core image -@@ -88,6 +96,8 @@ New in 2.02: - * Initialise USB ports in parallel. - * New `testspeed' command to test file read speed. - * Speed-up gfxterm by storing intermediate results in more compact format. -+ * Lazy LVM/mdraid scan. -+ * Disk hints. - - * Scripting: - * New `eval' and `tr' commands. -@@ -105,7 +115,8 @@ New in 2.02: - * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone - rewritten in C. They should now work in supported non-Unix-like - environments. -- * Native mingw support, including ability to install on EFI under windows. -+ * Native mingw support. -+ * Ability to install on EFI under windows. - * Reorganise timeout handling using new `timeout_style' environment - variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig. - Menu hotkeys pressed during a hidden timeout now boot the corresponding -@@ -122,6 +133,7 @@ New in 2.02: - * Partial mingw64 x86_64-efi compile support (highly experimental). - * Partial mingw32 i386-* (other than already present i386-pc) - compile support (highly experimental). -+ * Support for grub-mkpasswd on Windows. - * Eliminate the use of AutoGen. This allowed some performance - improvements to the build system. - * Remove variable length arrays. --- -2.4.3 - diff --git a/0450-Message-string-cleanups.patch b/0019-Message-string-cleanups.patch similarity index 96% rename from 0450-Message-string-cleanups.patch rename to 0019-Message-string-cleanups.patch index e317336..e320905 100644 --- a/0450-Message-string-cleanups.patch +++ b/0019-Message-string-cleanups.patch @@ -1,7 +1,7 @@ -From 2115d88318a56ccc03fc298533b06c18e919517c Mon Sep 17 00:00:00 2001 +From 0784f9845eee9a4408334b160fe9447481ea1b55 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 11:09:04 -0400 -Subject: [PATCH 450/506] Message string cleanups +Subject: [PATCH 19/74] Message string cleanups Make use of terminology consistent. Remove jargon. --- diff --git a/0019-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch b/0019-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch deleted file mode 100644 index db30e43..0000000 --- a/0019-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch +++ /dev/null @@ -1,90 +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 019/506] * 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/ChangeLog b/ChangeLog -index 6a19f85..b04a4ef 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-18 Vladimir Serbinenko - -+ * grub-core/kern/efi/efi.c: Ensure that the result starts with / -+ and has no //. -+ -+2014-01-18 Vladimir Serbinenko -+ - * NEWS: Add few missing entries. - - 2014-01-17 Colin Watson -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.4.3 - diff --git a/0451-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0020-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch similarity index 86% rename from 0451-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch rename to 0020-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch index c44d4ef..c291514 100644 --- a/0451-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +++ b/0020-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch @@ -1,7 +1,7 @@ -From 694bfc483adcd4ef23aad0fd88d6331c1f2b8492 Mon Sep 17 00:00:00 2001 +From 55197d5839d8456cd72b081e2a552e14d50611e9 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:23 -0400 -Subject: [PATCH 451/506] Fix border spacing now that we aren't displaying it +Subject: [PATCH 20/74] Fix border spacing now that we aren't displaying it --- grub-core/normal/menu_text.c | 6 +++--- diff --git a/0020-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch b/0020-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch deleted file mode 100644 index 1fdd8e1..0000000 --- a/0020-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch +++ /dev/null @@ -1,47 +0,0 @@ -From ae80f312700c72fcb0222a7865ea69f37517a313 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 16:43:29 +0100 -Subject: [PATCH 020/506] * util/grub-mount.c: Extend GCC warning - workaround to grub-mount. - ---- - ChangeLog | 4 ++++ - util/grub-mount.c | 7 ++++++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index b04a4ef..8534158 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-01-18 Vladimir Serbinenko - -+ * util/grub-mount.c: Extend GCC warning workaround to grub-mount. -+ -+2014-01-18 Vladimir Serbinenko -+ - * grub-core/kern/efi/efi.c: Ensure that the result starts with / - and has no //. - -diff --git a/util/grub-mount.c b/util/grub-mount.c -index 118881e..19de2e6 100644 ---- a/util/grub-mount.c -+++ b/util/grub-mount.c -@@ -41,8 +41,13 @@ - #include - #include - -+#pragma GCC diagnostic ignored "-Wmissing-prototypes" -+#pragma GCC diagnostic ignored "-Wmissing-declarations" -+#include -+#pragma GCC diagnostic error "-Wmissing-prototypes" -+#pragma GCC diagnostic error "-Wmissing-declarations" -+ - #include "progname.h" --#include "argp.h" - - static const char *root = NULL; - grub_device_t dev = NULL; --- -2.4.3 - diff --git a/0452-Use-the-correct-indentation-for-the-term-help-text.patch b/0021-Use-the-correct-indentation-for-the-term-help-text.patch similarity index 86% rename from 0452-Use-the-correct-indentation-for-the-term-help-text.patch rename to 0021-Use-the-correct-indentation-for-the-term-help-text.patch index 0f6b8a7..0250baf 100644 --- a/0452-Use-the-correct-indentation-for-the-term-help-text.patch +++ b/0021-Use-the-correct-indentation-for-the-term-help-text.patch @@ -1,7 +1,7 @@ -From 066292ef95375f1848c5e403d7ca7d73277bdbcb Mon Sep 17 00:00:00 2001 +From 38947a46ac4a1c8799a9d743381067324218038f Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:49 -0400 -Subject: [PATCH 452/506] Use the correct indentation for the term help text +Subject: [PATCH 21/74] Use the correct indentation for the term help text That is consistent with the menu help text --- diff --git a/0021-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch b/0021-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch deleted file mode 100644 index 09912fd..0000000 --- a/0021-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch +++ /dev/null @@ -1,153 +0,0 @@ -From dcecae1a49996bbaefb4133a878215594eb5094a Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 19:50:54 +0400 -Subject: [PATCH 021/506] reintroduce BUILD_LDFLAGS for the cross-compile case - -This allows providing separate LDFLAGS for build and host environments, which -are not necessary the same for cross-compile case. In particular, it allows -building host programs statically to not depend on presence of libraries at -run-time (e.g. MinGW DLLs on Windows) while continue to use default dynamic -linking at build time. - -Also fix obsolete comments in confgure.ac - we do use different environment -for build and host now. ---- - ChangeLog | 7 +++++++ - INSTALL | 3 ++- - Makefile.am | 8 ++++---- - configure.ac | 13 ++++++++----- - grub-core/Makefile.am | 6 +++--- - 5 files changed, 24 insertions(+), 13 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 8534158..9c3ef2e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2014-01-07 Andrey Borzenkov -+ -+ * configure.ac: Add support for BUILD_LDFLAGS. -+ * Makefile.am: Use BUILD_LDFLAGS for build time programs here ... -+ * grub-core/Makefile.am: ... and here. -+ * INSTALL: Mention BUILD_LDFLAGS. -+ - 2014-01-18 Vladimir Serbinenko - - * util/grub-mount.c: Extend GCC warning workaround to grub-mount. -diff --git a/INSTALL b/INSTALL -index db12530..b67cd7f 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -168,7 +168,8 @@ corresponding platform are not needed for the platform in question. - generate sin and cos tables. - 2. BUILD_CFLAGS= for C options for build. - 3. BUILD_CPPFLAGS= for C preprocessor options for build. -- 4. BUILD_FREETYPE= for freetype-config for build (optional). -+ 4. BUILD_LDFLAGS= for linker options for build. -+ 5. BUILD_FREETYPE= for freetype-config for build (optional). - - - For host - 1. --host= to autoconf name of host. -diff --git a/Makefile.am b/Makefile.am -index 320e86f..1bbec0e 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -67,20 +67,20 @@ endif - starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 - - build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) - CLEANFILES += build-grub-mkfont - - garbage-gen: util/garbage-gen.c -- $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^ -+ $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ - CLEANFILES += garbage-gen - EXTRA_DIST += util/garbage-gen.c - - build-grub-gen-asciih: util/grub-gen-asciih.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror - CLEANFILES += build-grub-gen-asciih - - build-grub-gen-widthspec: util/grub-gen-widthspec.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror - CLEANFILES += build-grub-gen-widthspec - - if COND_STARFIELD -diff --git a/configure.ac b/configure.ac -index 7c5d080..2e4cf3c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -26,11 +26,10 @@ dnl This is necessary because the target type in autoconf does not - dnl describe such a system very well. - dnl - dnl The current strategy is to use variables with no prefix (such as --dnl CC, CFLAGS, etc.) for the host type as well as the build type, --dnl because GRUB does not need to use those variables for the build --dnl type, so there is no conflict. Variables with the prefix "TARGET_" --dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target --dnl type. -+dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_" -+dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables -+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]) - -@@ -477,6 +476,7 @@ AC_SUBST(HOST_CC) - AC_SUBST(BUILD_CC) - AC_SUBST(BUILD_CFLAGS) - AC_SUBST(BUILD_CPPFLAGS) -+AC_SUBST(BUILD_LDFLAGS) - AC_SUBST(TARGET_CC) - AC_SUBST(TARGET_NM) - AC_SUBST(TARGET_RANLIB) -@@ -1290,10 +1290,12 @@ SAVED_CC="$CC" - SAVED_CPP="$CPP" - SAVED_CFLAGS="$CFLAGS" - SAVED_CPPFLAGS="$CPPFLAGS" -+SAVED_LDFLAGS="$LDFLAGS" - CC="$BUILD_CC" - CPP="$BUILD_CPP" - CFLAGS="$BUILD_CFLAGS" - CPPFLAGS="$BUILD_CPPFLAGS" -+LDFLAGS="$BUILD_LDFAGS" - - unset ac_cv_c_bigendian - unset ac_cv_header_ft2build_h -@@ -1356,6 +1358,7 @@ CC="$SAVED_CC" - CPP="$SAVED_CPP" - CFLAGS="$SAVED_CFLAGS" - CPPFLAGS="$SAVED_CPPFLAGS" -+LDFLAGS="$SAVED_LDFLAGS" - - - DJVU_FONT_SOURCE= -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 1b3142d..13b7979 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -27,14 +27,14 @@ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) - CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) - - build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ - - build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ - - # gentrigtables - gentrigtables: gentrigtables.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM) -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) - CLEANFILES += gentrigtables - - # trigtables.c --- -2.4.3 - diff --git a/0453-Indent-menu-entries.patch b/0022-Indent-menu-entries.patch similarity index 86% rename from 0453-Indent-menu-entries.patch rename to 0022-Indent-menu-entries.patch index e37a5f3..c0ab0e2 100644 --- a/0453-Indent-menu-entries.patch +++ b/0022-Indent-menu-entries.patch @@ -1,7 +1,7 @@ -From d9479d21d4b97295000fe2268b1e6cadf301f008 Mon Sep 17 00:00:00 2001 +From 2bbb261ba6fbb2024321d685429a9822f33f22d3 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:30:55 -0400 -Subject: [PATCH 453/506] Indent menu entries +Subject: [PATCH 22/74] Indent menu entries --- grub-core/normal/menu_text.c | 3 ++- diff --git a/0022-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch b/0022-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch deleted file mode 100644 index 40243f2..0000000 --- a/0022-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 3abb9563712f73bc48a33d428a3ab4c756191904 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 16:57:35 +0100 -Subject: [PATCH 022/506] * grub-core/term/terminfo.c: Recognize keys - F1-F12. - ---- - ChangeLog | 4 +++ - grub-core/term/terminfo.c | 86 +++++++++++++++++++++++++++-------------------- - 2 files changed, 54 insertions(+), 36 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 9c3ef2e..bdfbf44 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-18 Vladimir Serbinenko -+ -+ * grub-core/term/terminfo.c: Recognize keys F1-F12. -+ - 2014-01-07 Andrey Borzenkov - - * configure.ac: Add support for BUILD_LDFLAGS. -diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 3d48b19..f0d3e3d 100644 ---- a/grub-core/term/terminfo.c -+++ b/grub-core/term/terminfo.c -@@ -460,28 +460,31 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - {'@', GRUB_TERM_KEY_INSERT}, - }; - -- static struct -- { -- char key; -- unsigned ascii; -- } -- four_code_table[] = -+ static unsigned four_code_table[] = - { -- {'1', GRUB_TERM_KEY_HOME}, -- {'3', GRUB_TERM_KEY_DC}, -- {'5', GRUB_TERM_KEY_PPAGE}, -- {'6', GRUB_TERM_KEY_NPAGE}, -- {'7', GRUB_TERM_KEY_HOME}, -- {'8', GRUB_TERM_KEY_END} -+ [1] = GRUB_TERM_KEY_HOME, -+ [3] = GRUB_TERM_KEY_DC, -+ [5] = GRUB_TERM_KEY_PPAGE, -+ [6] = GRUB_TERM_KEY_NPAGE, -+ [7] = GRUB_TERM_KEY_HOME, -+ [8] = GRUB_TERM_KEY_END, -+ [17] = GRUB_TERM_KEY_F6, -+ [18] = GRUB_TERM_KEY_F7, -+ [19] = GRUB_TERM_KEY_F8, -+ [20] = GRUB_TERM_KEY_F9, -+ [21] = GRUB_TERM_KEY_F10, -+ [23] = GRUB_TERM_KEY_F11, -+ [24] = GRUB_TERM_KEY_F12, - }; - char fx_key[] = - { 'P', 'Q', 'w', 'x', 't', 'u', -- 'q', 'r', 'p', 'M', 'A', 'B' }; -+ 'q', 'r', 'p', 'M', 'A', 'B', 'H', 'F' }; - unsigned fx_code[] = - { GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, - GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6, - GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9, -- GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12 }; -+ GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, -+ GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_END }; - unsigned i; - - if (c == '\e') -@@ -492,19 +495,13 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - { - CONTINUE_READ; - -- switch (c) -- { -- case 'H': -- keys[0] = GRUB_TERM_KEY_HOME; -- *len = 1; -- return; -- case 'F': -- keys[0] = GRUB_TERM_KEY_END; -- *len = 1; -- return; -- default: -- return; -- } -+ for (i = 0; i < ARRAY_SIZE (fx_key); i++) -+ if (fx_key[i] == c) -+ { -+ keys[0] = fx_code[i]; -+ *len = 1; -+ return; -+ } - } - - if (c != '[') -@@ -523,6 +520,15 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - - switch (c) - { -+ case '[': -+ CONTINUE_READ; -+ if (c >= 'A' && c <= 'E') -+ { -+ keys[0] = GRUB_TERM_KEY_F1 + c - 'A'; -+ *len = 1; -+ return; -+ } -+ return; - case 'O': - CONTINUE_READ; - for (i = 0; i < ARRAY_SIZE (fx_key); i++) -@@ -555,18 +561,26 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - return; - } - -- default: -- for (i = 0; i < ARRAY_SIZE (four_code_table); i++) -- if (four_code_table[i].key == c) -+ case '1' ... '9': -+ { -+ unsigned val = c - '0'; -+ CONTINUE_READ; -+ if (c >= '0' && c <= '9') - { -+ val = val * 10 + (c - '0'); - CONTINUE_READ; -- if (c != '~') -- return; -- keys[0] = four_code_table[i].ascii; -- *len = 1; -- return; - } -- return; -+ if (c != '~') -+ return; -+ if (val >= ARRAY_SIZE (four_code_table) -+ || four_code_table[val] == 0) -+ return; -+ keys[0] = four_code_table[val]; -+ *len = 1; -+ return; -+ } -+ default: -+ return; - } - } - #undef CONTINUE_READ --- -2.4.3 - diff --git a/0023-Fix-ChangeLog-date.patch b/0023-Fix-ChangeLog-date.patch deleted file mode 100644 index 97114cb..0000000 --- a/0023-Fix-ChangeLog-date.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 9b9c4686f07644eb9c4f4786ff121bb9e19e31cd Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 20:01:16 +0400 -Subject: [PATCH 023/506] Fix ChangeLog date - ---- - ChangeLog | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index bdfbf44..fcbf220 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -2,7 +2,7 @@ - - * grub-core/term/terminfo.c: Recognize keys F1-F12. - --2014-01-07 Andrey Borzenkov -+2014-01-18 Andrey Borzenkov - - * configure.ac: Add support for BUILD_LDFLAGS. - * Makefile.am: Use BUILD_LDFLAGS for build time programs here ... --- -2.4.3 - diff --git a/0454-Fix-margins.patch b/0023-Fix-margins.patch similarity index 92% rename from 0454-Fix-margins.patch rename to 0023-Fix-margins.patch index 906383d..528bd35 100644 --- a/0454-Fix-margins.patch +++ b/0023-Fix-margins.patch @@ -1,7 +1,7 @@ -From 7b246fc51139c94f68152d490e255d930b022a55 Mon Sep 17 00:00:00 2001 +From 5d7922cf7cc6799bd82f7192f6bb39329888d07a Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:59:36 -0400 -Subject: [PATCH 454/506] Fix margins +Subject: [PATCH 23/74] Fix margins --- grub-core/normal/menu_text.c | 8 +++----- diff --git a/0455-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/0024-Add-support-for-UEFI-operating-systems-returned-by-o.patch similarity index 89% rename from 0455-Add-support-for-UEFI-operating-systems-returned-by-o.patch rename to 0024-Add-support-for-UEFI-operating-systems-returned-by-o.patch index 2942427..48205f0 100644 --- a/0455-Add-support-for-UEFI-operating-systems-returned-by-o.patch +++ b/0024-Add-support-for-UEFI-operating-systems-returned-by-o.patch @@ -1,7 +1,7 @@ -From 79f17b3b74ee1270959fb40de4ba55bb63534c1b Mon Sep 17 00:00:00 2001 +From 6e6e62cc673d7ac1cdf63437c9fb14f7a5765465 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 12 Jun 2013 11:51:49 -0400 -Subject: [PATCH 455/506] Add support for UEFI operating systems returned by +Subject: [PATCH 24/74] Add support for UEFI operating systems returned by os-prober os-prober returns UEFI operating systems in the form: diff --git a/0024-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch b/0024-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch deleted file mode 100644 index a9a5c3a..0000000 --- a/0024-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5ef569df5b359048ee55c5000e2679855cb87e06 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 20:04:11 +0400 -Subject: [PATCH 024/506] Use _W64 to detect MinGW W64-32 instead of - _FILE_OFFSET_BITS - -In 94cee4a4c201bb506377b2c26e072eee8cb19d6f I overlooked that config.h -unconditionally sets _FILE_OFFSET_BITS, so it cannot be used to detect -MinGW W64 environment. It looks like Emacs folks already found -solution; instead of _FILE_OFFSET_BITS use _W64 as suggested in -http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00723.html ---- - ChangeLog | 5 +++++ - include/grub/osdep/hostfile_windows.h | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index fcbf220..5aac7c1 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-18 Andrey Borzenkov -+ -+ * include/grub/osdep/hostfile_windows.h: Use _W64 instead of -+ FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64. -+ - 2014-01-18 Vladimir Serbinenko - - * grub-core/term/terminfo.c: Recognize keys F1-F12. -diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h -index 79efcfa..bf6451b 100644 ---- a/include/grub/osdep/hostfile_windows.h -+++ b/include/grub/osdep/hostfile_windows.h -@@ -69,8 +69,8 @@ enum grub_util_fd_open_flags_t - - #if defined (__MINGW32__) && !defined (__MINGW64__) - --/* 32 bit on MinGW-64 already redefines them if _FILE_OFFSET_BITS=64 */ --#if !defined(_FILE_OFFSET_BITS) -+/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */ -+#ifndef _W64 - #define fseeko fseeko64 - #define ftello ftello64 - #endif --- -2.4.3 - diff --git a/0456-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0025-Disable-GRUB-video-support-for-IBM-power-machines.patch similarity index 93% rename from 0456-Disable-GRUB-video-support-for-IBM-power-machines.patch rename to 0025-Disable-GRUB-video-support-for-IBM-power-machines.patch index 97e8857..5b46685 100644 --- a/0456-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0025-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -1,7 +1,7 @@ -From 49053d07add1a526a633f525933d5d17471a5989 Mon Sep 17 00:00:00 2001 +From d27d2a5ba388b2d18881a7ed429d3639801251ec Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 11 Jun 2013 15:14:05 -0300 -Subject: [PATCH 456/506] Disable GRUB video support for IBM power machines +Subject: [PATCH 25/74] Disable GRUB video support for IBM power machines Should fix the problem in bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=973205 diff --git a/0025-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch b/0025-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch deleted file mode 100644 index f26ba2a..0000000 --- a/0025-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 1ecf96fcc4bd882381bf21a461a12baf3c5ecf77 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 20:41:24 +0400 -Subject: [PATCH 025/506] add BUILD_EXEEXT support to fix make clean on Windows - -Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where -appropriate. ---- - ChangeLog | 7 +++++++ - Makefile.am | 16 ++++++++-------- - Makefile.util.def | 2 +- - configure.ac | 21 ++++++++++++++++----- - grub-core/Makefile.am | 14 ++++++++------ - 5 files changed, 40 insertions(+), 20 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 5aac7c1..dad2da2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,12 @@ - 2014-01-18 Andrey Borzenkov - -+ * configure.ac: Add support for BUILD_EXEEXT and use it ... -+ * Makefile.am: ... here. -+ * Makefile.util.def: ... and here. -+ * grub-core/Makefile.am: ... and here. -+ -+2014-01-18 Andrey Borzenkov -+ - * include/grub/osdep/hostfile_windows.h: Use _W64 instead of - FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64. - -diff --git a/Makefile.am b/Makefile.am -index 1bbec0e..aa526f5 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -66,22 +66,22 @@ endif - - starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 - --build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c -+build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) --CLEANFILES += build-grub-mkfont -+CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT) - --garbage-gen: util/garbage-gen.c -+garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c - $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ --CLEANFILES += garbage-gen -+CLEANFILES += garbage-gen$(BUILD_EXEEXT) - EXTRA_DIST += util/garbage-gen.c - --build-grub-gen-asciih: util/grub-gen-asciih.c -+build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror --CLEANFILES += build-grub-gen-asciih -+CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT) - --build-grub-gen-widthspec: util/grub-gen-widthspec.c -+build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror --CLEANFILES += build-grub-gen-widthspec -+CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT) - - if COND_STARFIELD - starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files) -diff --git a/Makefile.util.def b/Makefile.util.def -index 3c99be2..83df212 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -708,7 +708,7 @@ script = { - name = grub-fs-tester; - common = tests/util/grub-fs-tester.in; - installdir = noinst; -- dependencies = garbage-gen; -+ dependencies = 'garbage-gen$(BUILD_EXEEXT)'; - }; - - script = { -diff --git a/configure.ac b/configure.ac -index 2e4cf3c..cf3de3b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux]) - # We don't want -g -O2 by default in CFLAGS - : ${CFLAGS=""} - --# Checks for host and target systems. -+# Checks for build, host and target systems. -+AC_CANONICAL_BUILD - AC_CANONICAL_HOST - save_program_prefix="${program_prefix}" - AC_CANONICAL_TARGET -@@ -422,6 +423,16 @@ case "$build_os" in - haiku*) BUILD_LIBM= ;; - *) BUILD_LIBM=-lm ;; - esac -+ -+dnl FIXME proper test seems to require too deep dive into Autoconf internals. -+dnl For now just list known platforms that we support. -+ -+case "$build_os" in -+ cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;; -+ *) BUILD_EXEEXT= ;; -+esac -+AC_SUBST(BUILD_EXEEXT) -+ - # For gnulib. - gl_INIT - -@@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then - *windows* | *cygwin* | *mingw*) - if test x${target_cpu} = xi386 ; then - grub_cv_target_cc_link_format=-mi386pe; -- TARGET_OBJ2ELF='./build-grub-pe2elf'; -+ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'; - fi - if test x${target_cpu} = xx86_64 ; then - grub_cv_target_cc_link_format=-mi386pep; -- TARGET_OBJ2ELF='./build-grub-pep2elf'; -+ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'; - fi - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" - ;; -@@ -803,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then - fi - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" - if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then -- TARGET_OBJ2ELF='./build-grub-pe2elf'; -+ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'; - fi - if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then -- TARGET_OBJ2ELF='./build-grub-pep2elf'; -+ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'; - fi - fi - -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 13b7979..826b3dd 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin - CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) - CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) - --build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c -+build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ -+CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT) - --build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c -+build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ -+CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT) - - # gentrigtables --gentrigtables: gentrigtables.c -+gentrigtables$(BUILD_EXEEXT): gentrigtables.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) --CLEANFILES += gentrigtables -+CLEANFILES += gentrigtables$(BUILD_EXEEXT) - - # trigtables.c --trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac -- ./gentrigtables > $@ -+trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac -+ ./gentrigtables$(BUILD_EXEEXT) > $@ - CLEANFILES += trigtables.c - - # XXX Use Automake's LEX & YACC support --- -2.4.3 - diff --git a/0457-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0026-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch similarity index 83% rename from 0457-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch rename to 0026-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch index 9939e80..f333e21 100644 --- a/0457-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +++ b/0026-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch @@ -1,7 +1,7 @@ -From 1ec3f0284d7dee52ee1afc6ac72ec39bdf3fba88 Mon Sep 17 00:00:00 2001 +From 63642951c9e35985a3e35ab218d8d0831d60d239 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 21 Jun 2013 14:44:08 -0400 -Subject: [PATCH 457/506] Use -2 instead of -1 for our right-hand margin, so +Subject: [PATCH 26/74] Use -2 instead of -1 for our right-hand margin, so linewrapping works (#976643). Signed-off-by: Peter Jones diff --git a/0026-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch b/0026-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch deleted file mode 100644 index b0e5e39..0000000 --- a/0026-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch +++ /dev/null @@ -1,281 +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 026/506] 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/ChangeLog b/ChangeLog -index dad2da2..dad469b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,19 @@ - 2014-01-18 Andrey Borzenkov - -+ * include/grub/misc.h: Move macros for compiler features to ... -+ * include/grub/compiler.h: ... new file. -+ * include/grub/list.h: Include instead of . -+ * grub-core/commands/fileXX.c: Include . -+ * grub-core/efiemu/prepare.c: Include . -+ * grub-core/loader/i386/xen_file.c: Include . -+ * grub-core/loader/i386/xen_fileXX.c: Include . -+ * grub-core/video/capture.c: Include . -+ * include/grub/command.h: Include . -+ * include/grub/dl.h: Include . -+ * include/grub/procfs.h: Include . -+ -+2014-01-18 Andrey Borzenkov -+ - * configure.ac: Add support for BUILD_EXEEXT and use it ... - * Makefile.am: ... here. - * Makefile.util.def: ... and here. -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.4.3 - diff --git a/0458-Use-linux16-when-appropriate-880840.patch b/0027-Use-linux16-when-appropriate-880840.patch similarity index 90% rename from 0458-Use-linux16-when-appropriate-880840.patch rename to 0027-Use-linux16-when-appropriate-880840.patch index 553dfa1..296f539 100644 --- a/0458-Use-linux16-when-appropriate-880840.patch +++ b/0027-Use-linux16-when-appropriate-880840.patch @@ -1,7 +1,7 @@ -From 6c42254d5f033b24b859a8a6a82720e99a62887a Mon Sep 17 00:00:00 2001 +From 8a516f33193744bbe67198fe03cadf1a67129630 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:05:07 -0400 -Subject: [PATCH 458/506] Use linux16 when appropriate (#880840) +Subject: [PATCH 27/74] Use linux16 when appropriate (#880840) The kernel group really would prefer that we use the 16 bit entry point on x86 bios machines. diff --git a/0027-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch b/0027-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch deleted file mode 100644 index 38f4a98..0000000 --- a/0027-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 6c519b5c6c95a0d486c548157b2af3d4fb4e0bbe Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 19:26:40 +0100 -Subject: [PATCH 027/506] * grub-core/commands/macbless.c: Rename FILE - and DIR to avoid conflicts. - - Reported by: Andrey Borzenkov. ---- - ChangeLog | 7 +++++++ - grub-core/commands/macbless.c | 6 +++--- - 2 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index dad469b..9d1a3f0 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2014-01-18 Vladimir Serbinenko -+ -+ * grub-core/commands/macbless.c: Rename FILE and DIR to avoid -+ conflicts. -+ -+ Reported by: Andrey Borzenkov. -+ - 2014-01-18 Andrey Borzenkov - - * include/grub/misc.h: Move macros for compiler features to ... -diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c -index c521083..4724edd 100644 ---- a/grub-core/commands/macbless.c -+++ b/grub-core/commands/macbless.c -@@ -37,7 +37,7 @@ struct find_node_context - grub_uint64_t inode_found; - char *dirname; - enum -- { NONE, FILE, DIR } found; -+ { FOUND_NONE, FOUND_FILE, FOUND_DIR } found; - }; - - static int -@@ -53,7 +53,7 @@ find_inode (const char *filename, - && grub_strcasecmp (ctx->dirname, filename) == 0))) - { - ctx->inode_found = info->inode; -- ctx->found = info->dir ? DIR : FILE; -+ ctx->found = info->dir ? FOUND_DIR : FOUND_FILE; - } - return 0; - } -@@ -175,7 +175,7 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel) - grub_free (path); - - return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found, -- (ctx.found == DIR), intel); -+ (ctx.found == FOUND_DIR), intel); - } - - static grub_err_t --- -2.4.3 - diff --git a/0459-Enable-pager-by-default.-985860.patch b/0028-Enable-pager-by-default.-985860.patch similarity index 83% rename from 0459-Enable-pager-by-default.-985860.patch rename to 0028-Enable-pager-by-default.-985860.patch index 9e6d46a..fd6bdd1 100644 --- a/0459-Enable-pager-by-default.-985860.patch +++ b/0028-Enable-pager-by-default.-985860.patch @@ -1,7 +1,7 @@ -From 20bc510e42d5eb2a041242cf59ebcc31509c995a Mon Sep 17 00:00:00 2001 +From 7a0a7f7efdbf856e53788782f0c8ce3e50f16acb Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:09:27 -0400 -Subject: [PATCH 459/506] Enable pager by default. (#985860) +Subject: [PATCH 28/74] Enable pager by default. (#985860) Signed-off-by: Peter Jones --- diff --git a/0028-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch b/0028-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch deleted file mode 100644 index 6a5075e..0000000 --- a/0028-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6ba983559dcffa0fa69c7fc861b5a16b4877a92c Mon Sep 17 00:00:00 2001 -From: Mike Gilbert -Date: Sat, 18 Jan 2014 19:41:15 +0100 -Subject: [PATCH 028/506] * Makefile.util.def: Link grub-ofpathname with - zfs libs. - ---- - ChangeLog | 4 ++++ - Makefile.util.def | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 9d1a3f0..edceb66 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-01 Mike Gilbert -+ -+ * Makefile.util.def: Link grub-ofpathname with zfs libs. -+ - 2014-01-18 Vladimir Serbinenko - - * grub-core/commands/macbless.c: Rename FILE and DIR to avoid -diff --git a/Makefile.util.def b/Makefile.util.def -index 83df212..a286a89 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -384,7 +384,7 @@ program = { - ldadd = libgrubgcry.a; - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; -- ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)'; -+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - }; - - program = { --- -2.4.3 - diff --git a/0460-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0029-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch similarity index 86% rename from 0460-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch rename to 0029-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch index 45d65bc..b0693b5 100644 --- a/0460-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +++ b/0029-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch @@ -1,7 +1,7 @@ -From bc27879780659acd3d2d7ec192339fde52404b73 Mon Sep 17 00:00:00 2001 +From 150668f7d02e0cc7e9f07c8c8ffc69763c796bea Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:13:27 -0400 -Subject: [PATCH 460/506] F10 doesn't work on serial, so don't tell the user to +Subject: [PATCH 29/74] F10 doesn't work on serial, so don't tell the user to hit it (#987443) Signed-off-by: Peter Jones diff --git a/0029-Makefile.am-default_payload.elf-Add-modules.patch b/0029-Makefile.am-default_payload.elf-Add-modules.patch deleted file mode 100644 index b69e584..0000000 --- a/0029-Makefile.am-default_payload.elf-Add-modules.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0b47c57ad62e314fac9c77cc17bdea032f945fca Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 19:43:19 +0100 -Subject: [PATCH 029/506] * Makefile.am (default_payload.elf): Add - modules multiboot cbmemc linux16 gzio echo help. - ---- - ChangeLog | 7 ++++++- - Makefile.am | 2 +- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index edceb66..cff9386 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,4 +1,9 @@ --2014-01-01 Mike Gilbert -+2014-01-18 Vladimir Serbinenko -+ -+ * Makefile.am (default_payload.elf): Add modules -+ multiboot cbmemc linux16 gzio echo help. -+ -+2014-01-18 Mike Gilbert - - * Makefile.util.def: Link grub-ofpathname with zfs libs. - -diff --git a/Makefile.am b/Makefile.am -index aa526f5..97c062d 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -399,7 +399,7 @@ bootcheck: $(BOOTCHECKS) - - if COND_i386_coreboot - default_payload.elf: grub-mkstandalone grub-mkimage -- pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg -+ pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg - endif - - windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows --- -2.4.3 - diff --git a/0461-Don-t-say-GNU-Linux-in-generated-menus.patch b/0030-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 91% rename from 0461-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0030-Don-t-say-GNU-Linux-in-generated-menus.patch index 59f0067..6d20b0c 100644 --- a/0461-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0030-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -1,7 +1,7 @@ -From f6d0829f2743a4eefa3419672d24ef2258bb281b Mon Sep 17 00:00:00 2001 +From a3400ba9c9969ec9c2447528a746dcc761aaf03f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 14 Mar 2011 14:27:42 -0400 -Subject: [PATCH 461/506] Don't say "GNU/Linux" in generated menus. +Subject: [PATCH 30/74] Don't say "GNU/Linux" in generated menus. --- util/grub.d/10_linux.in | 4 ++-- diff --git a/0030-fix-removal-of-cpu-machine-links-on-mingw-msys.patch b/0030-fix-removal-of-cpu-machine-links-on-mingw-msys.patch deleted file mode 100644 index 6067044..0000000 --- a/0030-fix-removal-of-cpu-machine-links-on-mingw-msys.patch +++ /dev/null @@ -1,55 +0,0 @@ -From e0a850947f541e5078304699106f9f66a79e4151 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 22:48:04 +0400 -Subject: [PATCH 030/506] fix removal of {cpu,machine} links on mingw/msys - -At least on Windows 2003 using "ln -s dir1 dir2" in msys shell succeeds, -but results in what looks like hard link. Subsequent "rm -f dir2" (e.g. -during second config.status invocation) fails. Check that we also can -remove link to directory. - -Make it more clear in message that we are checking "ln -s". ---- - ChangeLog | 5 +++++ - acinclude.m4 | 6 +++--- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index cff9386..c3bfa9f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-18 Andrey Borzenkov -+ -+ * acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove -+ symbolic link to directory. It fails in Msys shell on Windows 2003. -+ - 2014-01-18 Vladimir Serbinenko - - * Makefile.am (default_payload.elf): Add modules -diff --git a/acinclude.m4 b/acinclude.m4 -index 32d5477..b2bb88d 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -418,15 +418,15 @@ else - [fi] - ]) - --dnl Check if ln can handle directories properly (mingw). -+dnl Check if ln -s can handle directories properly (mingw). - AC_DEFUN([grub_CHECK_LINK_DIR],[ --AC_MSG_CHECKING([whether ln can handle directories properly]) -+AC_MSG_CHECKING([whether ln -s can handle directories properly]) - [mkdir testdir 2>/dev/null - case $srcdir in - [\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;; - *) reldir=../$srcdir/include/grub/util ;; - esac --if ln -s $reldir testdir/util 2>/dev/null ; then] -+if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null ; then] - AC_MSG_RESULT([yes]) - [link_dir=yes - else --- -2.4.3 - diff --git a/0462-Don-t-draw-a-border-around-the-menu.patch b/0031-Don-t-draw-a-border-around-the-menu.patch similarity index 95% rename from 0462-Don-t-draw-a-border-around-the-menu.patch rename to 0031-Don-t-draw-a-border-around-the-menu.patch index c29cdd1..0cbb274 100644 --- a/0462-Don-t-draw-a-border-around-the-menu.patch +++ b/0031-Don-t-draw-a-border-around-the-menu.patch @@ -1,7 +1,7 @@ -From b28ff92a87ac8d67c78b6ebf4d74ff781610d312 Mon Sep 17 00:00:00 2001 +From f8a84b6c117a525e48711ae177501cb9b29f8c23 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 16:47:33 -0400 -Subject: [PATCH 462/506] Don't draw a border around the menu +Subject: [PATCH 31/74] Don't draw a border around the menu It looks cleaner without it. --- diff --git a/0031-grub-core-normal-main.c-read_config_file-Buffer-conf.patch b/0031-grub-core-normal-main.c-read_config_file-Buffer-conf.patch deleted file mode 100644 index a9c3f40..0000000 --- a/0031-grub-core-normal-main.c-read_config_file-Buffer-conf.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 41155a57223e346b990a3d1b6708fa85351ab256 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 19:54:09 +0100 -Subject: [PATCH 031/506] * grub-core/normal/main.c (read_config_file): - Buffer config file. Reduces boot time. - ---- - ChangeLog | 5 +++++ - grub-core/normal/main.c | 14 +++++++++++--- - 2 files changed, 16 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c3bfa9f..c84f7e7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-18 Vladimir Serbinenko -+ -+ * grub-core/normal/main.c (read_config_file): Buffer config file. -+ Reduces boot time. -+ - 2014-01-18 Andrey Borzenkov - - * acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c36663f..3a926fc 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)), - static grub_menu_t - read_config_file (const char *config) - { -- grub_file_t file; -+ grub_file_t rawfile, file; - char *old_file = 0, *old_dir = 0; - char *config_dir, *ptr = 0; - const char *ctmp; -@@ -122,10 +123,17 @@ read_config_file (const char *config) - } - - /* Try to open the config file. */ -- file = grub_file_open (config); -- if (! file) -+ rawfile = grub_file_open (config); -+ if (! rawfile) - return 0; - -+ file = grub_bufio_open (rawfile, 0); -+ if (! file) -+ { -+ grub_file_close (file); -+ return 0; -+ } -+ - ctmp = grub_env_get ("config_file"); - if (ctmp) - old_file = grub_strdup (ctmp); --- -2.4.3 - diff --git a/0463-Use-the-standard-margin-for-the-timeout-string.patch b/0032-Use-the-standard-margin-for-the-timeout-string.patch similarity index 90% rename from 0463-Use-the-standard-margin-for-the-timeout-string.patch rename to 0032-Use-the-standard-margin-for-the-timeout-string.patch index 6618c84..2c4ad73 100644 --- a/0463-Use-the-standard-margin-for-the-timeout-string.patch +++ b/0032-Use-the-standard-margin-for-the-timeout-string.patch @@ -1,7 +1,7 @@ -From 90dbbcfa9eeec55ba68b77b9bc16c369445ad809 Mon Sep 17 00:00:00 2001 +From a46bec0098c8eb772c630d0aaa32d0eb86e00fa7 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 10:52:32 -0400 -Subject: [PATCH 463/506] Use the standard margin for the timeout string +Subject: [PATCH 32/74] Use the standard margin for the timeout string So that it aligns with the other messages --- diff --git a/0032-util-grub-install.c-Fix-a-typo.patch b/0032-util-grub-install.c-Fix-a-typo.patch deleted file mode 100644 index 96c7d45..0000000 --- a/0032-util-grub-install.c-Fix-a-typo.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b204b718cc00432f18be861b8bf4342e50feef90 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 18 Jan 2014 20:02:51 +0100 -Subject: [PATCH 032/506] * util/grub-install.c: Fix a typo. - ---- - ChangeLog | 4 ++++ - util/grub-install.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index c84f7e7..9360345 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-01-18 Vladimir Serbinenko - -+ * util/grub-install.c: Fix a typo. -+ -+2014-01-18 Vladimir Serbinenko -+ - * grub-core/normal/main.c (read_config_file): Buffer config file. - Reduces boot time. - -diff --git a/util/grub-install.c b/util/grub-install.c -index 4608b80..5903f34 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -1259,7 +1259,7 @@ main (int argc, char *argv[]) - - if (!config.is_cryptodisk_enabled && have_cryptodisk) - grub_util_error (_("attempt to install to encrypted disk without cryptodisk enabled. " -- "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=1", -+ "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=y", - grub_util_get_config_filename ()); - - if (disk_module && grub_strcmp (disk_module, "ata") == 0) --- -2.4.3 - diff --git a/0464-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch b/0033-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch similarity index 85% rename from 0464-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch rename to 0033-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch index fc3bbfa..0341363 100644 --- a/0464-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch +++ b/0033-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch @@ -1,7 +1,7 @@ -From 9dc877744ea47b51b58e7a129e36c6d106302b94 Mon Sep 17 00:00:00 2001 +From 72f5fd673e63802ff829570395d9c7d950b30f52 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 10 Jan 2014 09:36:24 -0500 -Subject: [PATCH 464/506] Fix grub_script_execute_sourcecode() usage on ppc. +Subject: [PATCH 33/74] Fix grub_script_execute_sourcecode() usage on ppc. 593e430c made it not take the extra argc/argv that this code still passes it. diff --git a/0033-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch b/0033-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch deleted file mode 100644 index 9320a50..0000000 --- a/0033-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 015045471ed815fc45ba9fba52cb34582d129a96 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 18 Jan 2014 23:15:40 +0400 -Subject: [PATCH 033/506] use MODULE_FILES for genemuinit* instead of MOD_FILES - -MinGW native nm does not support ELF binaries. ---- - ChangeLog | 8 ++++++++ - grub-core/Makefile.am | 8 ++++---- - grub-core/genemuinit.sh | 4 ++-- - grub-core/genemuinitheader.sh | 4 ++-- - 4 files changed, 16 insertions(+), 8 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 9360345..4688ff4 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,11 @@ -+2014-01-18 Andrey Borzenkov -+ -+ * grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES -+ instead of MOD_FILES. -+ * grub-core/genemuinit.sh: Simplify stripping of suffix so it works -+ both with and without .exe. -+ * grub-core/genemuinitheader.sh: Same. -+ - 2014-01-18 Vladimir Serbinenko - - * util/grub-install.c: Fix a typo. -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 826b3dd..5c087c8 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h - kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h - grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h - --grub_emu_init.h: genemuinitheader.sh $(MOD_FILES) -- rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@ -+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES) -+ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@ - CLEANFILES += grub_emu_init.h - --grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) -- rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@ -+grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES) -+ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@ - CLEANFILES += grub_emu_init.c - endif - -diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh -index 45c15ec..8c6bb1c 100644 ---- a/grub-core/genemuinit.sh -+++ b/grub-core/genemuinit.sh -@@ -47,7 +47,7 @@ EOF - read mods - for line in $mods; do - if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then -- echo "grub_${line}_init ();" | sed 's,\.mod,,g;' -+ echo "grub_${line%%.*}_init ();" - fi - done - -@@ -63,7 +63,7 @@ EOF - - for line in $mods; do - if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then -- echo "grub_${line}_fini ();" | sed 's,\.mod,,g;' -+ echo "grub_${line%%.*}_fini ();" - fi - done - -diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh -index 6b83f59..a99a15d 100644 ---- a/grub-core/genemuinitheader.sh -+++ b/grub-core/genemuinitheader.sh -@@ -44,9 +44,9 @@ EOF - read mods - for line in $mods; do - if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then -- echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;' -+ echo "void grub_${line%%.*}_init (void);" - fi - if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then -- echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;' -+ echo "void grub_${line%%.*}_fini (void);" - fi - done --- -2.4.3 - diff --git a/0465-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0034-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 79% rename from 0465-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch index b1367f9..0c76f14 100644 --- a/0465-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0034-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -1,17 +1,17 @@ -From 1b067956364d2860bc6adae9e6c782116030a356 Mon Sep 17 00:00:00 2001 +From cbe42c54d476e6dfb133028c3b9c2d56821bf449 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 13 Jan 2014 21:50:59 -0500 -Subject: [PATCH 465/506] Add .eh_frame to list of relocations stripped +Subject: [PATCH 34/74] Add .eh_frame to list of relocations stripped --- conf/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 96e58c9..8aab824 100644 +index fcb8d2e..afabfe8 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding +@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) diff --git a/0034-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch b/0034-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch deleted file mode 100644 index a7c7e0f..0000000 --- a/0034-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 049f63824c654ca10dc9073decc139ccd2f9a06b Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 17 Jan 2014 02:28:46 +0000 -Subject: [PATCH 034/506] Ignore EPERM when modifying kern.geom.debugflags - -Many tests fail when run as a non-root user on FreeBSD. The failures -all amount to an inability to open files using grub_util_fd_open, -because we cannot set the kern.geom.debugflags sysctl. This sysctl is -indeed important to allow us to do such things as installing GRUB to the -MBR, but if we need to do that and can't then we will get an error -later. Enforcing it here is unnecessary and prevents otherwise -perfectly reasonable operations. ---- - ChangeLog | 7 +++++++ - grub-core/osdep/freebsd/hostdisk.c | 12 ++++++++++-- - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 4688ff4..10abfe2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2014-01-19 Colin Watson -+ -+ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore -+ EPERM when modifying kern.geom.debugflags. It is only a problem for -+ such things as installing GRUB to the MBR, in which case there'll be -+ an error later anyway, not for opening files during tests. -+ - 2014-01-18 Andrey Borzenkov - - * grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES -diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c -index eb202dc..6145d07 100644 ---- a/grub-core/osdep/freebsd/hostdisk.c -+++ b/grub-core/osdep/freebsd/hostdisk.c -@@ -102,8 +102,16 @@ grub_util_fd_open (const char *os_dev, int flags) - if (! (sysctl_oldflags & 0x10) - && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, sysctl_size)) - { -- grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags"); -- return GRUB_UTIL_FD_INVALID; -+ if (errno == EPERM) -+ /* Running as an unprivileged user; don't worry about restoring -+ flags, although if we try to write to anything interesting such -+ as the MBR then we may fail later. */ -+ sysctl_oldflags = 0x10; -+ else -+ { -+ grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags"); -+ return GRUB_UTIL_FD_INVALID; -+ } - } - - ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); --- -2.4.3 - diff --git a/0466-Make-10_linux-work-with-our-changes-for-linux16-and-.patch b/0035-Make-10_linux-work-with-our-changes-for-linux16-and-.patch similarity index 93% rename from 0466-Make-10_linux-work-with-our-changes-for-linux16-and-.patch rename to 0035-Make-10_linux-work-with-our-changes-for-linux16-and-.patch index 8f2d343..bfbd932 100644 --- a/0466-Make-10_linux-work-with-our-changes-for-linux16-and-.patch +++ b/0035-Make-10_linux-work-with-our-changes-for-linux16-and-.patch @@ -1,7 +1,7 @@ -From 7dbfa43dfad616a38a98ff301dcd93a6feef77f8 Mon Sep 17 00:00:00 2001 +From 059cfdc310a6c0456358553619b47c6bf6f2e062 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 13:12:23 -0500 -Subject: [PATCH 466/506] Make 10_linux work with our changes for linux16 and +Subject: [PATCH 35/74] Make 10_linux work with our changes for linux16 and linuxefi on aarch64 Signed-off-by: Peter Jones diff --git a/0035-change-stop-condition-to-avoid-infinite-loops.patch b/0035-change-stop-condition-to-avoid-infinite-loops.patch deleted file mode 100644 index 48ed86c..0000000 --- a/0035-change-stop-condition-to-avoid-infinite-loops.patch +++ /dev/null @@ -1,52 +0,0 @@ -From d99d2f84166b0f60673d5c0714605a153946c0fc Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 21 Jan 2014 10:49:39 -0200 -Subject: [PATCH 035/506] 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. ---- - ChangeLog | 12 ++++++++++++ - grub-core/net/net.c | 2 +- - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 10abfe2..f69d8c7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,15 @@ -+2014-01-21 Paulo Flabiano Smorigo -+ -+ * grub-core/net/net.c (receive_packets): 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. -+ - 2014-01-19 Colin Watson - - * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore -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. */ --- -2.4.3 - diff --git a/0467-Don-t-print-during-fdt-loading-method.patch b/0036-Don-t-print-during-fdt-loading-method.patch similarity index 82% rename from 0467-Don-t-print-during-fdt-loading-method.patch rename to 0036-Don-t-print-during-fdt-loading-method.patch index b2a23ae..899ee3e 100644 --- a/0467-Don-t-print-during-fdt-loading-method.patch +++ b/0036-Don-t-print-during-fdt-loading-method.patch @@ -1,7 +1,7 @@ -From 8a0557e9e05f6e6de54536d3ff4da789dbc3854e Mon Sep 17 00:00:00 2001 +From 8eb74c470b7839cf8516aa986aff4a251b9a41a4 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 16:15:46 -0500 -Subject: [PATCH 467/506] Don't print during fdt loading method. +Subject: [PATCH 36/74] Don't print during fdt loading method. Signed-off-by: Peter Jones --- diff --git a/0036-increase-network-try-interval-gradually.patch b/0036-increase-network-try-interval-gradually.patch deleted file mode 100644 index 26aa423..0000000 --- a/0036-increase-network-try-interval-gradually.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 6f65e36cc4f92fe40672181eccf12eac4afb6738 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 21 Jan 2014 11:03:51 -0200 -Subject: [PATCH 036/506] 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. ---- - ChangeLog | 9 +++++++++ - 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 + - 6 files changed, 19 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index f69d8c7..f5618a6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,14 @@ - 2014-01-21 Paulo Flabiano Smorigo - -+ * 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. -+ -+2014-01-21 Paulo Flabiano Smorigo -+ - * grub-core/net/net.c (receive_packets): Change stop condition to avoid - infinite loops. - -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 */ --- -2.4.3 - diff --git a/0468-Honor-a-symlink-when-generating-configuration-by-gru.patch b/0037-Honor-a-symlink-when-generating-configuration-by-gru.patch similarity index 84% rename from 0468-Honor-a-symlink-when-generating-configuration-by-gru.patch rename to 0037-Honor-a-symlink-when-generating-configuration-by-gru.patch index 1c6b072..61d4409 100644 --- a/0468-Honor-a-symlink-when-generating-configuration-by-gru.patch +++ b/0037-Honor-a-symlink-when-generating-configuration-by-gru.patch @@ -1,7 +1,7 @@ -From f8368056ed2433473c563104b14d89e547db9b9a Mon Sep 17 00:00:00 2001 +From f81575bfb4a5e65950a7abc2ee5212525f86ad22 Mon Sep 17 00:00:00 2001 From: Marcel Kolaja Date: Tue, 21 Jan 2014 10:57:08 -0500 -Subject: [PATCH 468/506] Honor a symlink when generating configuration by +Subject: [PATCH 37/74] Honor a symlink when generating configuration by grub2-mkconfig Honor a symlink when generating configuration by grub2-mkconfig, so that diff --git a/0037-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch b/0037-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch deleted file mode 100644 index 868d4d4..0000000 --- a/0037-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 36387ece6be1b912c778d4a5f068801f99385fa2 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 21 Jan 2014 19:29:33 +0400 -Subject: [PATCH 037/506] look for DejaVu also in /usr/share/fonts/truetype - -It is installed in this path on openSUSE. ---- - ChangeLog | 4 ++++ - configure.ac | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index f5618a6..9f5d81d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-21 Andrey Borzenkov -+ -+ * configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype. -+ - 2014-01-21 Paulo Flabiano Smorigo - - * grub-core/net/arp.c (grub_net_arp_send_request): Increase network try -diff --git a/configure.ac b/configure.ac -index cf3de3b..120263e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1389,7 +1389,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 --- -2.4.3 - diff --git a/0469-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/0038-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch similarity index 85% rename from 0469-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch rename to 0038-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch index 677670a..60fd949 100644 --- a/0469-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +++ b/0038-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch @@ -1,7 +1,7 @@ -From 77911e9f883dd246f2adf104d00db7201fe0c8dc Mon Sep 17 00:00:00 2001 +From 2f7da057da45a039313a5a905f58f45f7837da6e Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 30 Jun 2014 14:16:46 -0400 -Subject: [PATCH 469/506] Don't munge raw spaces when we're doing our cmdline +Subject: [PATCH 38/74] Don't munge raw spaces when we're doing our cmdline escaping (#923374) Signed-off-by: Peter Jones diff --git a/0038-Show-detected-path-to-DejaVuSans-in-configure-summar.patch b/0038-Show-detected-path-to-DejaVuSans-in-configure-summar.patch deleted file mode 100644 index feef272..0000000 --- a/0038-Show-detected-path-to-DejaVuSans-in-configure-summar.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 443b3222621b6df1e5e01bd6fb2c496568065f92 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 21 Jan 2014 19:41:11 +0400 -Subject: [PATCH 038/506] Show detected path to DejaVuSans in configure summary - ---- - ChangeLog | 1 + - configure.ac | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 9f5d81d..3ba57ae 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,6 +1,7 @@ - 2014-01-21 Andrey Borzenkov - - * configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype. -+ Show detected font path in summary. - - 2014-01-21 Paulo Flabiano Smorigo - -diff --git a/configure.ac b/configure.ac -index 120263e..8888c2f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1816,6 +1816,7 @@ echo grub-mount: No "($grub_mount_excuse)" - fi - if [ x"$starfield_excuse" = x ]; then - echo starfield theme: Yes -+echo With DejaVuSans font from $DJVU_FONT_SOURCE - else - echo starfield theme: No "($starfield_excuse)" - fi --- -2.4.3 - diff --git a/0470-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0039-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 85% rename from 0470-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0039-Don-t-require-a-password-to-boot-entries-generated-b.patch index 724e13d..b1d1699 100644 --- a/0470-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0039-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -1,7 +1,7 @@ -From 5a5d16211c91e4d650fab56c5035b7eb346a9e0f Mon Sep 17 00:00:00 2001 +From 7a8693b352d9194d96bc02e9297284a5fabf6de5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 11 Feb 2014 11:14:50 -0500 -Subject: [PATCH 470/506] Don't require a password to boot entries generated by +Subject: [PATCH 39/74] Don't require a password to boot entries generated by grub-mkconfig. When we set a password, we just want that to mean you can't /edit/ an entry. diff --git a/0039-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch b/0039-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch deleted file mode 100644 index d7470a5..0000000 --- a/0039-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch +++ /dev/null @@ -1,62 +0,0 @@ -From eec4237a3265b024cc97d3cd287bdea7cd187f48 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Tue, 21 Jan 2014 20:54:09 +0400 -Subject: [PATCH 039/506] add GRUB_WINDOWS_EXTRA_DIST to allow shipping runtime - files - -Not all toolkits provide static libraries. This patch enables creation of self -contained distribution that does not require pre-existing runtime libraries. -Intended usage is - -export GRUB_WINDOWS_EXTRA_DIST="/path/to/liblzma.dll /path/to/libintl.dll" -make -make windowszip - -As those libraries and locations are dependent on toolchain in use, trying -to autodetect them is likely impossible. So just provide a simple way to -package everything in one step. - -Also remove $(windowsdir) after ZIP was created same as other "make dist" -targets. ---- - ChangeLog | 5 +++++ - Makefile.am | 4 ++++ - 2 files changed, 9 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 3ba57ae..1ede370 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-21 Andrey Borzenkov - -+ * Makefile.am: Allow adding extra files to generated Windows ZIP -+ archive by setting GRUB_WINDOWS_EXTRA_DIST. -+ -+2014-01-21 Andrey Borzenkov -+ - * configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype. - Show detected font path in summary. - -diff --git a/Makefile.am b/Makefile.am -index 97c062d..f02ae0a 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -420,10 +420,14 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA) - for x in $(starfield_DATA); do \ - cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \ - done -+ for x in $(GRUB_WINDOWS_EXTRA_DIST); do \ -+ cp -fp $$x $(windowsdir); \ -+ done - - windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip - windowszip: windowsdir - test -f $(windowszip) && rm $(windowszip) || true - zip -r $(windowszip) $(windowsdir) -+ rm -rf $(windowsdir) - - EXTRA_DIST += linguas.sh --- -2.4.3 - diff --git a/0471-Don-t-emit-Booting-.-message.patch b/0040-Don-t-emit-Booting-.-message.patch similarity index 91% rename from 0471-Don-t-emit-Booting-.-message.patch rename to 0040-Don-t-emit-Booting-.-message.patch index 2ab27e4..7cfd1b2 100644 --- a/0471-Don-t-emit-Booting-.-message.patch +++ b/0040-Don-t-emit-Booting-.-message.patch @@ -1,7 +1,7 @@ -From 30f5402fabe385931871a3277db5ce62f137af72 Mon Sep 17 00:00:00 2001 +From 66cfcf6a84e2b87db6eafeba1b950792c6830817 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 09:37:49 -0500 -Subject: [PATCH 471/506] Don't emit "Booting ..." message. +Subject: [PATCH 40/74] Don't emit "Booting ..." message. UI team still hates this stuff, so we're disabling it for RHEL 7. diff --git a/0040-util-grub-install.c-write_to_disk-Add-an-info-messag.patch b/0040-util-grub-install.c-write_to_disk-Add-an-info-messag.patch deleted file mode 100644 index e285852..0000000 --- a/0040-util-grub-install.c-write_to_disk-Add-an-info-messag.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d08059309f83388312b7f3e533f4b70d803f7bda Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 23 Jan 2014 12:05:36 +0000 -Subject: [PATCH 040/506] * util/grub-install.c (write_to_disk): Add an info - message. - ---- - ChangeLog | 4 ++++ - util/grub-install.c | 1 + - 2 files changed, 5 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 1ede370..eee8e78 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-23 Colin Watson -+ -+ * util/grub-install.c (write_to_disk): Add an info message. -+ - 2014-01-21 Andrey Borzenkov - - * Makefile.am: Allow adding extra files to generated Windows ZIP -diff --git a/util/grub-install.c b/util/grub-install.c -index 5903f34..787dc90 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -675,6 +675,7 @@ write_to_disk (grub_device_t dev, const char *fn) - - core_img = grub_util_read_image (fn); - -+ grub_util_info ("writing `%s' to `%s'", fn, dev->disk->name); - err = grub_disk_write (dev->disk, 0, 0, - core_size, core_img); - free (core_img); --- -2.4.3 - diff --git a/0472-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch b/0041-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch similarity index 98% rename from 0472-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch rename to 0041-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch index 086538c..3f2dfb3 100644 --- a/0472-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch +++ b/0041-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch @@ -1,8 +1,8 @@ -From e5accb37d101774583d94d0c8051e464c45e29c6 Mon Sep 17 00:00:00 2001 +From 2eeb9c48e4dfd7cd22a214a9cb5dd37094278240 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 3 Feb 2014 15:21:46 -0500 -Subject: [PATCH 472/506] Make CTRL and ALT keys work as expected on EFI - systems (version 5). +Subject: [PATCH 41/74] Make CTRL and ALT keys work as expected on EFI systems + (version 5). This is version 4. @@ -210,7 +210,7 @@ index a37eb84..677eab5 100644 void diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index e5dd543..1423403 100644 +index 1a5e38c..029ee92 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -111,7 +111,7 @@ diff --git a/0041-util-grub-install.c-List-available-targets.patch b/0041-util-grub-install.c-List-available-targets.patch deleted file mode 100644 index 574213a..0000000 --- a/0041-util-grub-install.c-List-available-targets.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 95cd131ea0085ce16a4f2bfabc22d83548fc85cf Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 24 Jan 2014 18:09:25 +0100 -Subject: [PATCH 041/506] * util/grub-install.c: List available targets. - ---- - ChangeLog | 4 ++++ - include/grub/util/install.h | 2 ++ - util/grub-install-common.c | 30 ++++++++++++++++++++++++++++++ - util/grub-install.c | 10 ++++++++-- - 4 files changed, 44 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index eee8e78..20e8baa 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-24 Vladimir Serbinenko -+ -+ * util/grub-install.c: List available targets. -+ - 2014-01-23 Colin Watson - - * util/grub-install.c (write_to_disk): Add an info message. -diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index bc987aa..aedcd29 100644 ---- a/include/grub/util/install.h -+++ b/include/grub/util/install.h -@@ -138,6 +138,8 @@ grub_install_get_platform_cpu (enum grub_install_plat platid); - const char * - grub_install_get_platform_platform (enum grub_install_plat platid); - -+char * -+grub_install_get_platforms_string (void); - - typedef enum { - GRUB_COMPRESSION_AUTO, -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 6ea0a8e..c8bedcb 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -668,6 +668,36 @@ static struct - }; - - char * -+grub_install_get_platforms_string (void) -+{ -+ char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (platforms)); -+ int platform_strins_len = 0; -+ char *platforms_string; -+ char *ptr; -+ unsigned i; -+ for (i = 0; i < ARRAY_SIZE (platforms); i++) -+ { -+ arr[i] = xasprintf ("%s-%s", platforms[i].cpu, -+ platforms[i].platform); -+ platform_strins_len += strlen (arr[i]) + 2; -+ } -+ ptr = platforms_string = xmalloc (platform_strins_len); -+ qsort (arr, ARRAY_SIZE (platforms), sizeof (char *), grub_qsort_strcmp); -+ for (i = 0; i < ARRAY_SIZE (platforms); i++) -+ { -+ strcpy (ptr, arr[i]); -+ ptr += strlen (arr[i]); -+ *ptr++ = ','; -+ *ptr++ = ' '; -+ free (arr[i]); -+ } -+ ptr[-2] = 0; -+ free (arr); -+ -+ return platforms_string; -+} -+ -+char * - grub_install_get_platform_name (enum grub_install_plat platid) - { - return xasprintf ("%s-%s", platforms[platid].cpu, -diff --git a/util/grub-install.c b/util/grub-install.c -index 787dc90..2e6226a 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -256,7 +256,7 @@ static struct argp_option options[] = { - OPTION_HIDDEN, 0, 2}, - {"target", OPTION_TARGET, N_("TARGET"), - /* TRANSLATORS: "TARGET" as in "target platform". */ -- 0, N_("install GRUB for TARGET platform [default=%s]"), 2}, -+ 0, N_("install GRUB for TARGET platform [default=%s]; available targets: %s"), 2}, - {"grub-setup", OPTION_SETUP, "FILE", OPTION_HIDDEN, 0, 2}, - {"grub-mkrelpath", OPTION_MKRELPATH, "FILE", OPTION_HIDDEN, 0, 2}, - {"grub-mkdevicemap", OPTION_MKDEVICEMAP, "FILE", OPTION_HIDDEN, 0, 2}, -@@ -340,7 +340,13 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) - case OPTION_BOOT_DIRECTORY: - return xasprintf (text, GRUB_DIR_NAME, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME); - case OPTION_TARGET: -- return xasprintf (text, get_default_platform ()); -+ { -+ char *plats = grub_install_get_platforms_string (); -+ char *ret; -+ ret = xasprintf (text, get_default_platform (), plats); -+ free (plats); -+ return ret; -+ } - case ARGP_KEY_HELP_POST_DOC: - return xasprintf (text, program_name, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME); - default: --- -2.4.3 - diff --git a/0042-Fix-several-translatable-strings.patch b/0042-Fix-several-translatable-strings.patch deleted file mode 100644 index 1226bba..0000000 --- a/0042-Fix-several-translatable-strings.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 61c8482b2097dfc08d76c36a1087bc3d243f4db1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 24 Jan 2014 18:20:27 +0100 -Subject: [PATCH 042/506] Fix several translatable strings. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - Suggested by: D. Prévot. ---- - ChangeLog | 6 ++++++ - grub-core/commands/syslinuxcfg.c | 2 +- - grub-core/loader/arm64/linux.c | 2 +- - util/grub-syslinux2cfg.c | 4 ++-- - 4 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 20e8baa..e149d8e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,11 @@ - 2014-01-24 Vladimir Serbinenko - -+ Fix several translatable strings. -+ -+ Suggested by: D. Prévot. -+ -+2014-01-24 Vladimir Serbinenko -+ - * util/grub-install.c: List available targets. - - 2014-01-23 Colin Watson -diff --git a/grub-core/commands/syslinuxcfg.c b/grub-core/commands/syslinuxcfg.c -index a4bfc40..00ae113 100644 ---- a/grub-core/commands/syslinuxcfg.c -+++ b/grub-core/commands/syslinuxcfg.c -@@ -50,7 +50,7 @@ static const struct grub_arg_option options[] = - N_("root directory of the syslinux disk [default=/]."), - N_("DIR"), ARG_TYPE_STRING}, - {"cwd", 'c', 0, -- N_("current directory of the syslinux [default is parent directory of input file]."), -+ N_("current directory of syslinux [default is parent directory of input file]."), - N_("DIR"), ARG_TYPE_STRING}, - {"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0}, - {"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0}, -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 75ad871..65129c2 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -120,7 +120,7 @@ check_kernel (struct grub_arm64_linux_kernel_header *lh) - - if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC) - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -- N_("plain Image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); -+ N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); - - grub_dprintf ("linux", "UEFI stub kernel:\n"); - grub_dprintf ("linux", "text_offset = 0x%012llx\n", -diff --git a/util/grub-syslinux2cfg.c b/util/grub-syslinux2cfg.c -index 5e944c2..f4fda6d 100644 ---- a/util/grub-syslinux2cfg.c -+++ b/util/grub-syslinux2cfg.c -@@ -66,10 +66,10 @@ static struct argp_option options[] = { - N_("root directory of the syslinux disk [default=/]."), 0}, - {"target-cwd", 'T', N_("DIR"), 0, - N_( -- "current directory of the syslinux as it will be seen on runtime [default is parent directory of input file]." -+ "current directory of syslinux as it will be seen on runtime [default is parent directory of input file]." - ), 0}, - {"cwd", 'c', N_("DIR"), 0, -- N_("current directory of the syslinux [default is parent directory of input file]."), 0}, -+ N_("current directory of syslinux [default is parent directory of input file]."), 0}, - - {"output", 'o', N_("FILE"), 0, N_("write output to FILE [default=stdout]."), 0}, - {"isolinux", 'i', 0, 0, N_("assume input is an isolinux configuration file."), 0}, --- -2.4.3 - diff --git a/0473-May-as-well-try-it.patch b/0042-May-as-well-try-it.patch similarity index 99% rename from 0473-May-as-well-try-it.patch rename to 0042-May-as-well-try-it.patch index a96abae..3cba6a4 100644 --- a/0473-May-as-well-try-it.patch +++ b/0042-May-as-well-try-it.patch @@ -1,7 +1,7 @@ -From 8b463a745e6c58e679f1a9869b55f441f038654b Mon Sep 17 00:00:00 2001 +From 41bab5e877a3f71232a6be47b5bc210e46f15442 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 4 Mar 2014 11:00:23 -0500 -Subject: [PATCH 473/506] May as well try it. +Subject: [PATCH 42/74] May as well try it. --- conf/Makefile.extra-dist | 1 - @@ -133,7 +133,7 @@ index ea6b9df..9e9a20c 100644 EXTRA_DIST += docs/grub.cfg EXTRA_DIST += docs/osdetect.cfg diff --git a/configure.ac b/configure.ac -index fd8a62e..6275310 100644 +index e54b9df..357c94e 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default]) diff --git a/0043-do-not-set-default-prefix-in-grub-mkimage.patch b/0043-do-not-set-default-prefix-in-grub-mkimage.patch deleted file mode 100644 index 54082ec..0000000 --- a/0043-do-not-set-default-prefix-in-grub-mkimage.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 1440b7ebae47e1cb710e920bec9d88c4d75ff432 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 25 Jan 2014 19:54:51 +0400 -Subject: [PATCH 043/506] do not set default prefix in grub-mkimage - -Default prefix is likely wrong on Unix and completely wrong on Windows. -Let caller set it explicitly to avoid any ambiguity. ---- - ChangeLog | 4 ++++ - util/grub-mkimage.c | 16 +++++++++++----- - 2 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index e149d8e..b405b7e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-25 Andrey Borzenkov -+ -+ * util/grub-mkimage.c: Make prefix argument mandatory. -+ - 2014-01-24 Vladimir Serbinenko - - Fix several translatable strings. -diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index a2bd4c1..1e0bcf1 100644 ---- a/util/grub-mkimage.c -+++ b/util/grub-mkimage.c -@@ -64,7 +64,7 @@ static struct argp_option options[] = { - {"directory", 'd', N_("DIR"), 0, - /* TRANSLATORS: platform here isn't identifier. It can be translated. */ - N_("use images and modules under DIR [default=%s/]"), 0}, -- {"prefix", 'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0}, -+ {"prefix", 'p', N_("DIR"), 0, N_("set prefix directory"), 0}, - {"memdisk", 'm', N_("FILE"), 0, - /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated. - "embed" is a verb (command description). "*/ -@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) - { - case 'd': - return xasprintf (text, grub_util_get_pkglibdir ()); -- case 'p': -- return xasprintf (text, DEFAULT_DIRECTORY); - case 'O': - { - char *formats = grub_install_get_image_targets_string (), *ret; -@@ -268,6 +266,15 @@ main (int argc, char *argv[]) - exit(1); - } - -+ if (!arguments.prefix) -+ { -+ char *program = xstrdup(program_name); -+ printf ("%s\n", _("Prefix not specified (use the -p option).")); -+ argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program); -+ free (program); -+ exit(1); -+ } -+ - if (arguments.output) - { - fp = grub_util_fopen (arguments.output, "wb"); -@@ -287,8 +294,7 @@ main (int argc, char *argv[]) - strcpy (ptr, dn); - } - -- grub_install_generate_image (arguments.dir, -- arguments.prefix ? : DEFAULT_DIRECTORY, fp, -+ grub_install_generate_image (arguments.dir, arguments.prefix, fp, - arguments.output, arguments.modules, - arguments.memdisk, arguments.pubkeys, - arguments.npubkeys, arguments.config, --- -2.4.3 - diff --git a/0474-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0043-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 91% rename from 0474-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0043-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 8f09fea..0fe14d0 100644 --- a/0474-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0043-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -1,7 +1,7 @@ -From c346d135db33d9be45a187f991a80c2a940c066d Mon Sep 17 00:00:00 2001 +From 8af32e8379ab56a1a2feb422aa4cc0cb8c640684 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 19 Feb 2014 15:58:43 -0500 -Subject: [PATCH 474/506] use fw_path prefix when fallback searching for grub +Subject: [PATCH 43/74] use fw_path prefix when fallback searching for grub config When PXE booting via UEFI firmware, grub was searching for grub.cfg diff --git a/0475-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0044-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 95% rename from 0475-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0044-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index aed7c02..d395eeb 100644 --- a/0475-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0044-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -1,8 +1,7 @@ -From c0c97aabd80d0bad57f325e8c0c1eed923752422 Mon Sep 17 00:00:00 2001 +From a57d117e93a7286b2370f8531a24be61e56bcd1e Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 6 Mar 2014 11:51:33 -0500 -Subject: [PATCH 475/506] Try mac/guid/etc before grub.cfg on tftp config - files. +Subject: [PATCH 44/74] Try mac/guid/etc before grub.cfg on tftp config files. Signed-off-by: Peter Jones --- diff --git a/0044-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch b/0044-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch deleted file mode 100644 index 1949eee..0000000 --- a/0044-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 5ae584c0b0c64b445c0820037d74058595133af3 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Sat, 25 Jan 2014 21:49:41 +0400 -Subject: [PATCH 044/506] fix Mingw W64-32 cross compile failure due to printf - redefinition in libintl.h - -In file included from util/misc.c:36:0: -./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=] - char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT; - ^ -./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=] - -The reason is libintl.h which redefines printf as libintl_printf. The problem -is not present in native MinGW build which avoids redefinition. Use -(format (__printf__) instead which is valid replacement in GCC. - -v2: add grub-core/lib/libgcrypt/src/g10lib.h -v3: modify g10lib.h during import ---- - ChangeLog | 9 +++++++++ - include/grub/crypto.h | 2 +- - include/grub/emu/misc.h | 8 ++++---- - include/grub/err.h | 2 +- - util/import_gcry.py | 6 ++++++ - 5 files changed, 21 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index b405b7e..c93f11f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,12 @@ -+ -+2014-01-25 Andrey Borzenkov -+ -+ * include/grub/crypto.h: Replace __attribute__ ((format (printf)) with -+ __attribute__ ((format (__printf__)) to fix compilation under MinGW-w64. -+ * include/grub/emu/misc.h: ... and here. -+ * include/grub/err.h: ... and here. -+ * util/import_gcry.py: ... and here (in files g10lib.h). -+ - 2014-01-25 Andrey Borzenkov - - * util/grub-mkimage.c: Make prefix argument mandatory. -diff --git a/include/grub/crypto.h b/include/grub/crypto.h -index ec1b980..a24e89d 100644 ---- a/include/grub/crypto.h -+++ b/include/grub/crypto.h -@@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char *file, int line, - const char *func) __attribute__ ((noreturn)); - - void _gcry_burn_stack (int bytes); --void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); -+void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (__printf__, 1, 2))); - - - #ifdef GRUB_UTIL -diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index dde48c1..a588ba2 100644 ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h -@@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev); - void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT; - void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT; - char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT; --char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT; -+char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))) WARN_UNUSED_RESULT; - --void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); --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_warn) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); -+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_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); - -diff --git a/include/grub/err.h b/include/grub/err.h -index 9896fcc..1590c68 100644 ---- a/include/grub/err.h -+++ b/include/grub/err.h -@@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void); - void EXPORT_FUNC(grub_print_error) (void); - extern int EXPORT_VAR(grub_err_printed_errors); - int grub_err_printf (const char *fmt, ...) -- __attribute__ ((format (printf, 1, 2))); -+ __attribute__ ((format (__printf__, 1, 2))); - - #endif /* ! GRUB_ERR_HEADER */ -diff --git a/util/import_gcry.py b/util/import_gcry.py -index 63ebb90..2b3322d 100644 ---- a/util/import_gcry.py -+++ b/util/import_gcry.py -@@ -534,6 +534,12 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))): - fw.close () - continue - -+ if src == "g10lib.h": -+ fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)")) -+ f.close () -+ fw.close () -+ continue -+ - fw.write (f.read ()) - f.close () - fw.close () --- -2.4.3 - diff --git a/0045-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch b/0045-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch deleted file mode 100644 index dc63b40..0000000 --- a/0045-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 9afe2053c9b37820888bd5e77acd35c0eacf6699 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 26 Jan 2014 02:36:05 +0100 -Subject: [PATCH 045/506] * grub-core/term/serial.c - (grub_serial_register): Fix invalid free. Ensure that pointers are - inited to NULL and that pointers are not accessed after free. - ---- - ChangeLog | 5 +++++ - grub-core/term/serial.c | 8 ++++---- - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c93f11f..67b4d5c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-26 Vladimir Serbinenko -+ -+ * grub-core/term/serial.c (grub_serial_register): Fix invalid free. -+ Ensure that pointers are inited to NULL and that pointers are not -+ accessed after free. - - 2014-01-25 Andrey Borzenkov - -diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c -index b581a76..c9b5574 100644 ---- a/grub-core/term/serial.c -+++ b/grub-core/term/serial.c -@@ -338,23 +338,23 @@ grub_serial_register (struct grub_serial_port *port) - grub_free (indata); - return grub_errno; - } -- -- out = grub_malloc (sizeof (*out)); -+ -+ out = grub_zalloc (sizeof (*out)); - if (!out) - { -- grub_free (in); - grub_free (indata); - grub_free ((char *) in->name); -+ grub_free (in); - return grub_errno; - } - - outdata = grub_malloc (sizeof (*outdata)); - if (!outdata) - { -- grub_free (in); - grub_free (indata); - grub_free ((char *) in->name); - grub_free (out); -+ grub_free (in); - return grub_errno; - } - --- -2.4.3 - diff --git a/0476-trim-arp-packets-with-abnormal-size.patch b/0045-trim-arp-packets-with-abnormal-size.patch similarity index 88% rename from 0476-trim-arp-packets-with-abnormal-size.patch rename to 0045-trim-arp-packets-with-abnormal-size.patch index f437900..7695a35 100644 --- a/0476-trim-arp-packets-with-abnormal-size.patch +++ b/0045-trim-arp-packets-with-abnormal-size.patch @@ -1,7 +1,7 @@ -From ee4302aa644523afd447e21201412ab6da00d4d6 Mon Sep 17 00:00:00 2001 +From 13599cf511f2be11fec127dde981e2b6958b37bb Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 5 Feb 2014 09:42:42 -0200 -Subject: [PATCH 476/506] trim arp packets with abnormal size +Subject: [PATCH 45/74] trim arp packets with abnormal size GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it. diff --git a/0477-Fix-convert-function-to-support-NVMe-devices.patch b/0046-Fix-convert-function-to-support-NVMe-devices.patch similarity index 91% rename from 0477-Fix-convert-function-to-support-NVMe-devices.patch rename to 0046-Fix-convert-function-to-support-NVMe-devices.patch index cf25218..b80a05f 100644 --- a/0477-Fix-convert-function-to-support-NVMe-devices.patch +++ b/0046-Fix-convert-function-to-support-NVMe-devices.patch @@ -1,7 +1,7 @@ -From 0696467ff34b3862035a5beae0dad4a6ea9f3525 Mon Sep 17 00:00:00 2001 +From 1d7732b94984ddc61de2332723176af3b208993d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 11:34:00 -0500 -Subject: [PATCH 477/506] Fix convert function to support NVMe devices +Subject: [PATCH 46/74] Fix convert function to support NVMe devices This is adapted from the patch at https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against diff --git a/0046-grub-install-support-for-partitioned-partx-loop-devi.patch b/0046-grub-install-support-for-partitioned-partx-loop-devi.patch deleted file mode 100644 index 66927cb..0000000 --- a/0046-grub-install-support-for-partitioned-partx-loop-devi.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 35f2d96c0d68772c831952b2ee4eba6519d6ea1b Mon Sep 17 00:00:00 2001 -From: Mike Gilbert -Date: Sun, 26 Jan 2014 02:56:04 +0100 -Subject: [PATCH 046/506] grub-install: support for partitioned partx - loop devices. - - * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect - /dev/loopX as being the parent of /dev/loopXpY. ---- - ChangeLog | 7 +++++++ - grub-core/osdep/linux/getroot.c | 13 +++++++++++++ - 2 files changed, 20 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 67b4d5c..bbec1e7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2014-01-26 Mike Gilbert -+ -+ grub-install: support for partitioned partx loop devices. -+ -+ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect -+ /dev/loopX as being the parent of /dev/loopXpY. -+ - 2014-01-26 Vladimir Serbinenko - - * grub-core/term/serial.c (grub_serial_register): Fix invalid free. -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 772de0a..19581d3 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -883,6 +883,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, - *pp = '\0'; - return path; - } -+ -+ /* If this is a loop device */ -+ if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') -+ { -+ char *pp = p + 4; -+ while (*pp >= '0' && *pp <= '9') -+ pp++; -+ if (*pp == 'p') -+ *is_part = 1; -+ /* /dev/loop[0-9]+p[0-9]* */ -+ *pp = '\0'; -+ return path; -+ } - } - - return path; --- -2.4.3 - diff --git a/0478-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/0047-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch similarity index 89% rename from 0478-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch rename to 0047-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch index 9e75a71..ead7094 100644 --- a/0478-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +++ b/0047-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch @@ -1,7 +1,7 @@ -From 67e66f4a26a0862f0f2d931b08edc234f13cd227 Mon Sep 17 00:00:00 2001 +From c5f3f71aea4fbbdc1d0cc0457f98344255a499cb Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Wed, 12 Mar 2014 10:58:16 -0400 -Subject: [PATCH 478/506] Fix bad test on GRUB_DISABLE_SUBMENU. +Subject: [PATCH 47/74] Fix bad test on GRUB_DISABLE_SUBMENU. The file /etc/grub.d/10_linux does diff --git a/0047-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch b/0047-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch deleted file mode 100644 index d50f2f0..0000000 --- a/0047-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 7f64fb590cd80517e1381693a16d7cf2486fa808 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 26 Jan 2014 03:31:10 +0100 -Subject: [PATCH 047/506] * grub-core/term/at_keyboard.c: Tolerate - missing keyboard. - ---- - ChangeLog | 4 ++++ - grub-core/term/at_keyboard.c | 3 +++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index bbec1e7..d37d4a6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-26 Vladimir Serbinenko -+ -+ * grub-core/term/at_keyboard.c: Tolerate missing keyboard. -+ - 2014-01-26 Mike Gilbert - - grub-install: support for partitioned partx loop devices. -diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index f5071ce..b4257e8 100644 ---- a/grub-core/term/at_keyboard.c -+++ b/grub-core/term/at_keyboard.c -@@ -396,6 +396,9 @@ fetch_key (int *is_break) - if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) - return -1; - at_key = grub_inb (KEYBOARD_REG_DATA); -+ /* May happen if no keyboard is connected. Just ignore this. */ -+ if (at_key == 0xff) -+ return -1; - if (at_key == 0xe0) - { - e0_received = 1; --- -2.4.3 - diff --git a/0048-.gitignore-add-missing-files-and-.exe-variants.patch b/0048-.gitignore-add-missing-files-and-.exe-variants.patch deleted file mode 100644 index 146b9d4..0000000 --- a/0048-.gitignore-add-missing-files-and-.exe-variants.patch +++ /dev/null @@ -1,73 +0,0 @@ -From ba584da163bc4dc2a36988ae327733ba10251143 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Wed, 29 Jan 2014 13:26:00 -0200 -Subject: [PATCH 048/506] .gitignore: add missing files and .exe variants. - ---- - .gitignore | 7 +++++++ - ChangeLog | 6 +++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/.gitignore b/.gitignore -index 2b0156a..18ab8e8 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -58,6 +58,8 @@ grub-emu.exe - grub-emu-lite.exe - grub_emu_init.c - grub_emu_init.h -+/grub-file -+/grub-file.exe - grub-fstest - grub-fstest.exe - grub_fstest_init.c -@@ -66,6 +68,8 @@ grub_func_test - grub-install - grub-install.exe - grub-kbdcomp -+/grub-macbless -+/grub-macbless.exe - grub-macho2img - /grub-menulst2cfg - /grub-menulst2cfg.exe -@@ -120,6 +124,8 @@ grub-shell - grub-shell-tester - grub-sparc64-setup - grub-sparc64-setup.exe -+/grub-syslinux2cfg -+/grub-syslinux2cfg.exe - gzcompress_test - hddboot_test - help_test -@@ -194,6 +200,7 @@ grub-core/modinfo.sh - grub-core/*.module - grub-core/*.module.exe - grub-core/*.pp -+grub-core/kernel.img.bin - util/bash-completion.d/grub - grub-core/gnulib/alloca.h - grub-core/gnulib/arg-nonnull.h -diff --git a/ChangeLog b/ChangeLog -index bbec1e7..b996df8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-01-29 Paulo Flabiano Smorigo -+ -+ * .gitignore: add missing files and .exe variants. -+ - 2014-01-26 Mike Gilbert - - grub-install: support for partitioned partx loop devices. -@@ -1109,7 +1113,7 @@ - - 2013-12-14 Vladimir Serbinenko - -- * .gitignore: Add .exe variants. Add missing files. Remove few outdated -+ * .gitignore: add .exe variants. add missing files. remove few outdated - entries. - - 2013-12-14 Vladimir Serbinenko --- -2.4.3 - diff --git a/0479-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch b/0048-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch similarity index 84% rename from 0479-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch rename to 0048-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch index ec72544..2eaf251 100644 --- a/0479-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch +++ b/0048-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch @@ -1,7 +1,7 @@ -From f56fb3d530641525a477888e94bbaa21265a15d0 Mon Sep 17 00:00:00 2001 +From 753e72ea12dfeb7a1374b9840325795cf65897a5 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 10 Feb 2014 16:13:10 -0500 -Subject: [PATCH 479/506] Switch to use APM Mustang device tree, for hardware +Subject: [PATCH 48/74] Switch to use APM Mustang device tree, for hardware testing. Signed-off-by: David A. Marlin diff --git a/0480-Use-the-default-device-tree-from-the-grub-default-fi.patch b/0049-Use-the-default-device-tree-from-the-grub-default-fi.patch similarity index 89% rename from 0480-Use-the-default-device-tree-from-the-grub-default-fi.patch rename to 0049-Use-the-default-device-tree-from-the-grub-default-fi.patch index b41269a..d7e326d 100644 --- a/0480-Use-the-default-device-tree-from-the-grub-default-fi.patch +++ b/0049-Use-the-default-device-tree-from-the-grub-default-fi.patch @@ -1,8 +1,7 @@ -From aae3606b6b924083e215db5207f99ef78eec0ae5 Mon Sep 17 00:00:00 2001 +From 7d0777d57fec835e8a1b8e8ca940598101cdb861 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 12 Feb 2014 14:54:04 -0500 -Subject: [PATCH 480/506] Use the default device tree from the grub default - file +Subject: [PATCH 49/74] Use the default device tree from the grub default file instead of hardcoding a value. diff --git a/0049-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch b/0049-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch deleted file mode 100644 index c255ef7..0000000 --- a/0049-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch +++ /dev/null @@ -1,75 +0,0 @@ -From ba424f37a95cf3f9c9995e051383424e328d13f6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:41:48 +0100 -Subject: [PATCH 049/506] * util/grub-mkfont.c: Downgrade warnings about - unhandled features to debug. - ---- - ChangeLog | 5 +++++ - util/grub-mkfont.c | 14 ++++++++------ - 2 files changed, 13 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 5692a5b..ce0ea89 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-29 Vladimir Serbinenko - -+ * util/grub-mkfont.c: Downgrade warnings about unhandled features -+ to debug. -+ -+2014-01-29 Vladimir Serbinenko -+ - * grub-core/term/at_keyboard.c: Tolerate missing keyboard. - - 2014-01-29 Paulo Flabiano Smorigo -diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 3cb02ad..3de07ee 100644 ---- a/util/grub-mkfont.c -+++ b/util/grub-mkfont.c -@@ -516,8 +516,8 @@ process_cursive (struct gsub_feature *feature, - } - if (grub_be_to_cpu16 (lookup->flag) & ~GSUB_RTL_CHAR) - { -- printf (_("Unsupported substitution flag: 0x%x\n"), -- grub_be_to_cpu16 (lookup->flag)); -+ grub_util_info ("unsupported substitution flag: 0x%x", -+ grub_be_to_cpu16 (lookup->flag)); - } - switch (feattag) - { -@@ -577,7 +577,8 @@ process_cursive (struct gsub_feature *feature, - There are 2 coverage specifications: list and range. - This warning is thrown when another coverage specification - is detected. */ -- printf (_("Unsupported coverage specification: %d\n"), covertype); -+ fprintf (stderr, -+ _("Unsupported coverage specification: %d\n"), covertype); - } - } - } -@@ -616,7 +617,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut) - grub_uint32_t feattag - = grub_be_to_cpu32 (features->features[i].feature_tag); - if (feature->params) -- printf (_("WARNING: unsupported font feature parameters: %x\n"), -+ fprintf (stderr, -+ _("WARNING: unsupported font feature parameters: %x\n"), - grub_be_to_cpu16 (feature->params)); - switch (feattag) - { -@@ -647,8 +649,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut) - if (!grub_isgraph (str[j])) - str[j] = '?'; - /* TRANSLATORS: It's gsub feature, not gsub font. */ -- printf (_("Unknown gsub font feature 0x%x (%s)\n"), -- feattag, str); -+ grub_util_info ("Unknown gsub font feature 0x%x (%s)", -+ feattag, str); - } - } - } --- -2.4.3 - diff --git a/0050-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch b/0050-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch deleted file mode 100644 index c6d72cf..0000000 --- a/0050-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4686e163f278ae7cfaab3bebbde215f5688c7e3f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:43:25 +0100 -Subject: [PATCH 050/506] * grub-core/disk/ahci.c: Do not enable I/O - decoding and keep enabling busmaster for the end. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ahci.c | 10 ++++++---- - 2 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index ce0ea89..8c37450 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-29 Vladimir Serbinenko - -+ * grub-core/disk/ahci.c: Do not enable I/O decoding and keep -+ enabling busmaster for the end. -+ -+2014-01-29 Vladimir Serbinenko -+ - * util/grub-mkfont.c: Downgrade warnings about unhandled features - to debug. - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 0b13fb8..18c1327 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -194,10 +194,8 @@ grub_ahci_pciinit (grub_pci_device_t dev, - return 0; - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -- grub_pci_write_word (addr, grub_pci_read_word (addr) | -- GRUB_PCI_COMMAND_IO_ENABLED -- | GRUB_PCI_COMMAND_MEM_ENABLED -- | GRUB_PCI_COMMAND_BUS_MASTER); -+ grub_pci_write_word (addr, grub_pci_read_word (addr) -+ | GRUB_PCI_COMMAND_MEM_ENABLED); - - hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK, - sizeof (hba)); -@@ -621,6 +619,10 @@ grub_ahci_pciinit (grub_pci_device_t dev, - if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14) - adevs[i]->atapi = 1; - -+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -+ grub_pci_write_word (addr, grub_pci_read_word (addr) -+ | GRUB_PCI_COMMAND_BUS_MASTER); -+ - for (i = 0; i < nports; i++) - if (adevs[i]) - { --- -2.4.3 - diff --git a/0481-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0050-reopen-SNP-protocol-for-exclusive-use-by-grub.patch similarity index 80% rename from 0481-reopen-SNP-protocol-for-exclusive-use-by-grub.patch rename to 0050-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index 158dd1c..3a6f55b 100644 --- a/0481-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0050-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,17 +1,17 @@ -From aa6d3d99ecc56e05a61dec3a5fd5e3f6300e6a02 Mon Sep 17 00:00:00 2001 +From 65d576323537049aff86ec5166d5780613c73ffe Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Sat, 15 Feb 2014 15:10:22 -0500 -Subject: [PATCH 481/506] reopen SNP protocol for exclusive use by grub +Subject: [PATCH 50/74] reopen SNP protocol for exclusive use by grub --- grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5533515..6a1dd1f 100644 +index 70b26af..7b8c4a5 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -304,6 +304,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -329,6 +329,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, { struct grub_net_card *card; grub_efi_device_path_t *dp; @@ -19,7 +19,7 @@ index 5533515..6a1dd1f 100644 dp = grub_efi_get_device_path (hnd); if (! dp) -@@ -357,6 +358,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -382,6 +383,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, &pxe_mode->dhcp_ack, sizeof (pxe_mode->dhcp_ack), 1, device, path); diff --git a/0482-Reduce-timer-event-frequency-by-10.patch b/0051-Reduce-timer-event-frequency-by-10.patch similarity index 90% rename from 0482-Reduce-timer-event-frequency-by-10.patch rename to 0051-Reduce-timer-event-frequency-by-10.patch index 53b729a..2d0d4ec 100644 --- a/0482-Reduce-timer-event-frequency-by-10.patch +++ b/0051-Reduce-timer-event-frequency-by-10.patch @@ -1,7 +1,7 @@ -From c89ce9e7afd7b6b2aba2dd83a2c1faf4cf651262 Mon Sep 17 00:00:00 2001 +From 37395693e758b0674a6d504c9672b290eaa172bd Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Thu, 20 Feb 2014 12:54:52 -0500 -Subject: [PATCH 482/506] Reduce timer event frequency by 10 +Subject: [PATCH 51/74] 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 diff --git a/0051-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch b/0051-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch deleted file mode 100644 index cfc23d8..0000000 --- a/0051-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 3142b2feacc45ae42f4d3e6891d233727da4c3e1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:45:18 +0100 -Subject: [PATCH 051/506] * grub-core/disk/ahci.c: Allocate and clean - space for all possible 32 slots to avoid pointing to uninited area. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ahci.c | 8 +++++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 8c37450..b2b54b9 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-29 Vladimir Serbinenko - -+ * grub-core/disk/ahci.c: Allocate and clean space for all possible 32 -+ slots to avoid pointing to uninited area. -+ -+2014-01-29 Vladimir Serbinenko -+ - * grub-core/disk/ahci.c: Do not enable I/O decoding and keep - enabling busmaster for the end. - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 18c1327..d63fd09 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -358,7 +358,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - grub_dprintf ("ahci", "err: %x\n", - adevs[i]->hba->ports[adevs[i]->port].sata_error); - -- adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head)); -+ adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32); - if (!adevs[i]->command_list_chunk) - { - adevs[i] = 0; -@@ -376,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev, - - adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk); - adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk); -+ -+ grub_memset ((void *) adevs[i]->command_list, 0, -+ sizeof (struct grub_ahci_cmd_table)); -+ grub_memset ((void *) adevs[i]->command_table, 0, -+ sizeof (struct grub_ahci_cmd_head) * 32); -+ - adevs[i]->command_list->command_table_base - = grub_dma_get_phys (adevs[i]->command_table_chunk); - --- -2.4.3 - diff --git a/0483-always-return-error-to-UEFI.patch b/0052-always-return-error-to-UEFI.patch similarity index 84% rename from 0483-always-return-error-to-UEFI.patch rename to 0052-always-return-error-to-UEFI.patch index 35fbdcb..5b07488 100644 --- a/0483-always-return-error-to-UEFI.patch +++ b/0052-always-return-error-to-UEFI.patch @@ -1,7 +1,7 @@ -From 3d6c115a0511353f9f0a4fc99549d13012b37e6f Mon Sep 17 00:00:00 2001 +From cbadbfbf9694d91b7c5d15f1d7ac7b9773168bab Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 26 Feb 2014 21:49:12 -0500 -Subject: [PATCH 483/506] always return error to UEFI +Subject: [PATCH 52/74] always return error to UEFI --- grub-core/kern/efi/efi.c | 2 +- diff --git a/0052-grub-core-disk-ahci.c-Add-safety-cleanups.patch b/0052-grub-core-disk-ahci.c-Add-safety-cleanups.patch deleted file mode 100644 index 2215113..0000000 --- a/0052-grub-core-disk-ahci.c-Add-safety-cleanups.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 07ea8daa8606160a18778af9a806d61b884d8d73 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:46:17 +0100 -Subject: [PATCH 052/506] * grub-core/disk/ahci.c: Add safety cleanups. - ---- - ChangeLog | 4 ++++ - grub-core/disk/ahci.c | 10 ++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index b2b54b9..148607f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-01-29 Vladimir Serbinenko - -+ * grub-core/disk/ahci.c: Add safety cleanups. -+ -+2014-01-29 Vladimir Serbinenko -+ - * grub-core/disk/ahci.c: Allocate and clean space for all possible 32 - slots to avoid pointing to uninited area. - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index d63fd09..643e691 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -454,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis); - adevs[i]->hba->ports[adevs[i]->port].command_list_base - = grub_dma_get_phys (adevs[i]->command_list_chunk); -+ adevs[i]->hba->ports[adevs[i]->port].command_issue = 0; - adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE; - } - -@@ -600,6 +601,9 @@ grub_ahci_pciinit (grub_pci_device_t dev, - failed_adevs[i] = adevs[i]; - adevs[i] = 0; - } -+ -+ grub_dprintf ("ahci", "cleaning up failed devs\n"); -+ - for (i = 0; i < nports; i++) - if (failed_adevs[i] && (fr_running & (1 << i))) - failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; -@@ -855,6 +859,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force) - { - struct grub_disk_ata_pass_through_parms parms2; - dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; -+ dev->hba->ports[dev->port].command_issue = 0; -+ dev->command_list[0].config = 0; -+ dev->command_table[0].prdt[0].unused = 0; -+ dev->command_table[0].prdt[0].size = 0; -+ dev->command_table[0].prdt[0].data_base = 0; -+ - endtime = grub_get_time_ms () + 1000; - while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) - if (grub_get_time_ms () > endtime) --- -2.4.3 - diff --git a/0486-Suport-for-bi-endianess-in-elf-file.patch b/0053-Suport-for-bi-endianess-in-elf-file.patch similarity index 98% rename from 0486-Suport-for-bi-endianess-in-elf-file.patch rename to 0053-Suport-for-bi-endianess-in-elf-file.patch index 85b975e..5681cae 100644 --- a/0486-Suport-for-bi-endianess-in-elf-file.patch +++ b/0053-Suport-for-bi-endianess-in-elf-file.patch @@ -1,7 +1,7 @@ -From 86e23df10073c5b704ddd32cad65e033baeb1379 Mon Sep 17 00:00:00 2001 +From 1eb395fea007c7b86a72cc264130fb5b2bbd6912 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Fri, 15 Aug 2014 14:39:53 -0300 -Subject: [PATCH 486/506] Suport for bi-endianess in elf file +Subject: [PATCH 53/74] Suport for bi-endianess in elf file * grub-core/kern/elf.c: check and switch endianess with grub_{be,le}_to cpu functions. diff --git a/0053-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch b/0053-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch deleted file mode 100644 index a26d8fb..0000000 --- a/0053-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch +++ /dev/null @@ -1,54 +0,0 @@ -From d6b94c5eb2a968ebb64f7937d244a267d56f10ab Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:49:51 +0100 -Subject: [PATCH 053/506] * grub-core/disk/ahci.c: Properly handle - transactions with no transferred data. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ahci.c | 7 +++++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 148607f..1cd2b39 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-29 Vladimir Serbinenko - -+ * grub-core/disk/ahci.c: Properly handle transactions with no -+ transferred data. -+ -+2014-01-29 Vladimir Serbinenko -+ - * grub-core/disk/ahci.c: Add safety cleanups. - - 2014-01-29 Vladimir Serbinenko -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 643e691..fdd40c6 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -932,7 +932,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH) - return grub_error (GRUB_ERR_BUG, "too big data buffer"); - -- bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1)); -+ if (parms->size) -+ bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1)); -+ else -+ bufc = grub_memalign_dma32 (1024, 512); - - grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n", - dev->hba->ports[dev->port].task_file_data, -@@ -942,7 +945,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - = (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT) - // | GRUB_AHCI_CONFIG_CLEAR_R_OK - | (0 << GRUB_AHCI_CONFIG_PMP_SHIFT) -- | (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT) -+ | ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT) - | (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0) - | (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ) - | (parms->taskfile.cmd == 8 ? (1 << 8) : 0); --- -2.4.3 - diff --git a/0487-Add-grub_util_readlink.patch b/0054-Add-grub_util_readlink.patch similarity index 99% rename from 0487-Add-grub_util_readlink.patch rename to 0054-Add-grub_util_readlink.patch index da1a8bb..50ebd84 100644 --- a/0487-Add-grub_util_readlink.patch +++ b/0054-Add-grub_util_readlink.patch @@ -1,7 +1,7 @@ -From 8d58af8b99565170b4b4a873f2df96327204a1f2 Mon Sep 17 00:00:00 2001 +From 022a44e0ed6b34a8c5f8c89c25bd9047ff681edd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:01:03 -0400 -Subject: [PATCH 487/506] Add grub_util_readlink() +Subject: [PATCH 54/74] Add grub_util_readlink() Add grub_util_readlink(). This requires pulling in stat and readlink from gnulib, which pulls in stat and related headers, but after that the diff --git a/0054-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch b/0054-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch deleted file mode 100644 index da91e6f..0000000 --- a/0054-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 9abbaae7cdc5ffba6065c089c9ebb076864d9bbd Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 29 Jan 2014 23:50:49 +0100 -Subject: [PATCH 054/506] * grub-core/disk/ahci.c: Increase timeout. - Some SSDs take up to 7 seconds to recover if last poweroff was bad. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ahci.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 1cd2b39..cfa9c83 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-01-29 Vladimir Serbinenko - -+ * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to -+ 7 seconds to recover if last poweroff was bad. -+ -+2014-01-29 Vladimir Serbinenko -+ - * grub-core/disk/ahci.c: Properly handle transactions with no - transferred data. - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index fdd40c6..5e4a639 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -1022,7 +1022,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - grub_dprintf ("ahci", "AHCI tfd = %x\n", - dev->hba->ports[dev->port].task_file_data); - -- endtime = grub_get_time_ms () + (spinup ? 10000 : 5000); -+ endtime = grub_get_time_ms () + (spinup ? 20000 : 20000); - while ((dev->hba->ports[dev->port].command_issue & 1)) - if (grub_get_time_ms () > endtime) - { --- -2.4.3 - diff --git a/0488-Make-editenv-chase-symlinks-including-those-across-d.patch b/0055-Make-editenv-chase-symlinks-including-those-across-d.patch similarity index 95% rename from 0488-Make-editenv-chase-symlinks-including-those-across-d.patch rename to 0055-Make-editenv-chase-symlinks-including-those-across-d.patch index fabe9ca..3d9e87c 100644 --- a/0488-Make-editenv-chase-symlinks-including-those-across-d.patch +++ b/0055-Make-editenv-chase-symlinks-including-those-across-d.patch @@ -1,7 +1,7 @@ -From 22e0e3e6652136c14550d97302c9569d5e5f2d45 Mon Sep 17 00:00:00 2001 +From 7375f089a16470cb0c1c583732a7dc8fd7bf6065 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:38:00 -0400 -Subject: [PATCH 488/506] Make editenv chase symlinks including those across +Subject: [PATCH 55/74] Make editenv chase symlinks including those across devices. This lets us make /boot/grub2/grubenv a symlink to diff --git a/0055-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch b/0055-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch deleted file mode 100644 index 0bb4ac6..0000000 --- a/0055-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 511ece7cebe261bcdd4a1d3f50ed9c05a234bcc6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 3 Feb 2014 14:34:27 +0100 -Subject: [PATCH 055/506] * util/grub-mkfont.c: Build fix for argp.h - with older gcc. - ---- - ChangeLog | 4 ++++ - util/grub-mkfont.c | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index cfa9c83..7891088 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-02-03 Vladimir Serbinenko -+ -+ * util/grub-mkfont.c: Build fix for argp.h with older gcc. -+ - 2014-01-29 Vladimir Serbinenko - - * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to -diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 3de07ee..e6485b4 100644 ---- a/util/grub-mkfont.c -+++ b/util/grub-mkfont.c -@@ -33,7 +33,11 @@ - - #ifndef GRUB_BUILD - #define _GNU_SOURCE 1 -+#pragma GCC diagnostic ignored "-Wmissing-prototypes" -+#pragma GCC diagnostic ignored "-Wmissing-declarations" - #include -+#pragma GCC diagnostic error "-Wmissing-prototypes" -+#pragma GCC diagnostic error "-Wmissing-declarations" - #endif - #include - --- -2.4.3 - diff --git a/0489-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0056-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 88% rename from 0489-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0056-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index d7a14f7..4efe7fe 100644 --- a/0489-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0056-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -1,8 +1,7 @@ -From 1d1848f16c2bfd40fa5c89bae314b738f43abd95 Mon Sep 17 00:00:00 2001 +From 2cf03adf505fc90176e9caee44c3f2adadbe6218 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 14:23:23 -0400 -Subject: [PATCH 489/506] Generate OS and CLASS in 10_linux from - /etc/os-release +Subject: [PATCH 56/74] Generate OS and CLASS in 10_linux from /etc/os-release This makes us use pretty names in the titles we generate in grub2-mkconfig when GRUB_DISTRIBUTOR isn't set. diff --git a/0056-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch b/0056-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch deleted file mode 100644 index eb38952..0000000 --- a/0056-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 006c78f378629e83db718ce6e3f83d2f2c68ce7e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 3 Feb 2014 14:35:51 +0100 -Subject: [PATCH 056/506] * util/grub-mkrescue.c: Build fix for argp.h - with older gcc. - ---- - ChangeLog | 4 ++++ - util/grub-mkrescue.c | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 7891088..eb72cc3 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-02-03 Vladimir Serbinenko - -+ * util/grub-mkrescue.c: Build fix for argp.h with older gcc. -+ -+2014-02-03 Vladimir Serbinenko -+ - * util/grub-mkfont.c: Build fix for argp.h with older gcc. - - 2014-01-29 Vladimir Serbinenko -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 34e0b7a..e719839 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -25,7 +25,11 @@ - #include - #include - #include -+#pragma GCC diagnostic ignored "-Wmissing-prototypes" -+#pragma GCC diagnostic ignored "-Wmissing-declarations" - #include -+#pragma GCC diagnostic error "-Wmissing-prototypes" -+#pragma GCC diagnostic error "-Wmissing-declarations" - - #include - #include --- -2.4.3 - diff --git a/0490-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch b/0057-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch similarity index 86% rename from 0490-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch rename to 0057-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch index 0fa82b2..074bcdf 100644 --- a/0490-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch +++ b/0057-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch @@ -1,7 +1,7 @@ -From 64ce819ee219a6aa868cbf9e78f85c2d775657da Mon Sep 17 00:00:00 2001 +From 0ad8b88186862b9f7c66b918c1682885ecd4cf65 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 15:25:22 -0400 -Subject: [PATCH 490/506] Fix GRUB_DISABLE_SUBMENU one more time. +Subject: [PATCH 57/74] Fix GRUB_DISABLE_SUBMENU one more time. Resolves: rhbz#1063414 diff --git a/0057-add-grub_env_set_net_property-function.patch b/0057-add-grub_env_set_net_property-function.patch deleted file mode 100644 index d4229cc..0000000 --- a/0057-add-grub_env_set_net_property-function.patch +++ /dev/null @@ -1,199 +0,0 @@ -From e4dbf247b656eb9577020af653ff37159fc340f2 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 4 Feb 2014 18:41:38 -0200 -Subject: [PATCH 057/506] 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. -* include/grub/net.h: Likewise. ---- - ChangeLog | 8 +++++++ - grub-core/net/bootp.c | 63 +++++++++++++-------------------------------------- - grub-core/net/net.c | 38 +++++++++++++++++++++++++++++++ - include/grub/net.h | 4 ++++ - 4 files changed, 66 insertions(+), 47 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index eb72cc3..5af5748 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,11 @@ -+2014-02-04 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. -+ * include/grub/net.h: Likewise. -+ - 2014-02-03 Vladimir Serbinenko - - * util/grub-mkrescue.c: Build fix for argp.h with older gcc. -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/net.c b/grub-core/net/net.c -index 1521d8d..f2e723b 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/net.h b/include/grub/net.h -index 0e0a605..538baa3 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); - --- -2.4.3 - diff --git a/0491-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0058-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 88% rename from 0491-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0058-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index 97035ab..9c0ddd4 100644 --- a/0491-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0058-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -1,7 +1,7 @@ -From 079eebad956087e7e1cb3a4dacd9689704f6d210 Mon Sep 17 00:00:00 2001 +From 0786b1e018ce247e9e9d1a38996c81cc0e77bdc5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 15:52:08 -0400 -Subject: [PATCH 491/506] Minimize the sort ordering for .debug and -rescue- +Subject: [PATCH 58/74] Minimize the sort ordering for .debug and -rescue- kernels. Resolves: rhbz#1065360 diff --git a/0058-add-bootpath-parser-for-open-firmware.patch b/0058-add-bootpath-parser-for-open-firmware.patch deleted file mode 100644 index 67d67c4..0000000 --- a/0058-add-bootpath-parser-for-open-firmware.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 9585647a25b65f98db6bd22c569b34795512f046 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 4 Feb 2014 19:00:55 -0200 -Subject: [PATCH 058/506] add bootpath 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_bootpath and -call it at grub_ieee1275_net_config_real. -* grub-core/kern/ieee1275/init.c: Add bootpath to grub_ieee1275_net_config. -* include/grub/ieee1275/ieee1275.h: Likewise. ---- - ChangeLog | 13 ++++ - grub-core/kern/ieee1275/init.c | 7 +-- - grub-core/net/drivers/ieee1275/ofnet.c | 107 ++++++++++++++++++++++++++++++++- - include/grub/ieee1275/ieee1275.h | 5 +- - 4 files changed, 125 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 5af5748..07caf46 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,18 @@ - 2014-02-04 Paulo Flabiano Smorigo - -+ Add bootpath 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_bootpath -+ and call it at grub_ieee1275_net_config_real. -+ * grub-core/kern/ieee1275/init.c: Add bootpath to -+ grub_ieee1275_net_config. -+ * include/grub/ieee1275/ieee1275.h: Likewise. -+ -+ -+2014-02-04 Paulo Flabiano Smorigo -+ - Add grub_env_set_net_property function. - - * grub-core/net/bootp.c: Remove set_env_limn_ro. -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/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 4483c91..eea8e71 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_bootpath (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_bootpath (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/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index dc54bea..8e42513 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -70,8 +70,9 @@ struct grub_ieee1275_devalias - }; - - extern void (*EXPORT_VAR(grub_ieee1275_net_config)) (const char *dev, -- char **device, -- char **path); -+ char **device, -+ char **path, -+ char *bootargs); - - /* Maps a device alias to a pathname. */ - extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); --- -2.4.3 - diff --git a/0492-Add-GRUB_DISABLE_UUID.patch b/0059-Add-GRUB_DISABLE_UUID.patch similarity index 97% rename from 0492-Add-GRUB_DISABLE_UUID.patch rename to 0059-Add-GRUB_DISABLE_UUID.patch index 368d657..3e24b53 100644 --- a/0492-Add-GRUB_DISABLE_UUID.patch +++ b/0059-Add-GRUB_DISABLE_UUID.patch @@ -1,7 +1,7 @@ -From 39913783f3e1c3ce09e6cdb4851f538b316e74c9 Mon Sep 17 00:00:00 2001 +From 521c146fd6ee046e0670b55a51754cf11b9302b3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 16:49:25 -0400 -Subject: [PATCH 492/506] Add GRUB_DISABLE_UUID. +Subject: [PATCH 59/74] Add GRUB_DISABLE_UUID. This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name diff --git a/0059-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch b/0059-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch deleted file mode 100644 index c484877..0000000 --- a/0059-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch +++ /dev/null @@ -1,40 +0,0 @@ -From d0949e374731e3f36c279774cd08fadd6553dcee Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 20 Feb 2014 10:11:43 +0100 -Subject: [PATCH 059/506] * grub-core/disk/ahci.c: Ignore NPORTS field - and rely on PI exclusively. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ahci.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 07caf46..aec689d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-02-20 Vladimir Serbinenko -+ -+ * grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI -+ exclusively. -+ - 2014-02-04 Paulo Flabiano Smorigo - - Add bootpath parser for open firmware. -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 5e4a639..89365cd 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -322,7 +322,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - - grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); - -- nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; -+ nports = (GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; - - grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports, - hba->ports_implemented); --- -2.4.3 - diff --git a/0493-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0060-Allow-fallback-to-include-entries-by-title-not-just-.patch similarity index 95% rename from 0493-Allow-fallback-to-include-entries-by-title-not-just-.patch rename to 0060-Allow-fallback-to-include-entries-by-title-not-just-.patch index d525e5e..2a42907 100644 --- a/0493-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0060-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -1,8 +1,8 @@ -From 9852edf71552cf8072ebaedddcd3eae865fe2fe6 Mon Sep 17 00:00:00 2001 +From bc03dfab52d7ba7c91b74d656d82fd4eed6bae75 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 5 Sep 2014 10:07:04 -0400 -Subject: [PATCH 493/506] Allow "fallback" to include entries by title, not - just number. +Subject: [PATCH 60/74] Allow "fallback" to include entries by title, not just + number. Resolves: rhbz#1026084 diff --git a/0060-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch b/0060-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch deleted file mode 100644 index 6d80872..0000000 --- a/0060-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch +++ /dev/null @@ -1,82 +0,0 @@ -From f94b2b4eeb5ec804671d5a0efa4ce779c179b68f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 28 Feb 2014 09:47:57 +0100 -Subject: [PATCH 060/506] * grub-core/kern/i386/coreboot/mmap.c: Filter - out 0xa0000-0x100000 region. - ---- - ChangeLog | 5 +++++ - grub-core/kern/i386/coreboot/mmap.c | 38 +++++++++++++++++++++++++++++++------ - 2 files changed, 37 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index aec689d..c2983f2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-02-28 Vladimir Serbinenko -+ -+ * grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000 -+ region. -+ - 2014-02-20 Vladimir Serbinenko - - * grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI -diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c -index 1197975..4d29f6b 100644 ---- a/grub-core/kern/i386/coreboot/mmap.c -+++ b/grub-core/kern/i386/coreboot/mmap.c -@@ -44,18 +44,44 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) - mem_region = - (mem_region_t) ((long) table_item + - sizeof (struct grub_linuxbios_table_item)); -- while ((long) mem_region < (long) table_item + (long) table_item->size) -+ for (; (long) mem_region < (long) table_item + (long) table_item->size; -+ mem_region++) - { -- if (ctx->hook (mem_region->addr, mem_region->size, -+ grub_uint64_t start = mem_region->addr; -+ grub_uint64_t end = mem_region->addr + mem_region->size; -+ /* Mark region 0xa0000 - 0x100000 as reserved. */ -+ if (start < 0x100000 && end >= 0xa0000 -+ && mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE) -+ { -+ if (start < 0xa0000 -+ && ctx->hook (start, 0xa0000 - start, -+ /* Multiboot mmaps match with the coreboot mmap -+ definition. Therefore, we can just pass type -+ through. */ -+ mem_region->type, -+ ctx->hook_data)) -+ return 1; -+ if (start < 0xa0000) -+ start = 0xa0000; -+ if (start >= end) -+ continue; -+ -+ if (ctx->hook (start, (end > 0x100000 ? 0x100000 : end) - start, -+ GRUB_MEMORY_RESERVED, -+ ctx->hook_data)) -+ return 1; -+ start = 0x100000; -+ -+ if (end <= start) -+ continue; -+ } -+ if (ctx->hook (start, end - start, - /* Multiboot mmaps match with the coreboot mmap - definition. Therefore, we can just pass type - through. */ -- (((mem_region->type <= GRUB_MACHINE_MEMORY_BADRAM) && (mem_region->type >= GRUB_MACHINE_MEMORY_AVAILABLE)) -- || mem_region->type == GRUB_MEMORY_COREBOOT_TABLES) ? mem_region->type : GRUB_MEMORY_RESERVED, -+ mem_region->type, - ctx->hook_data)) - return 1; -- -- mem_region++; - } - - return 0; --- -2.4.3 - diff --git a/0494-Load-arm-with-SB-enabled.patch b/0061-Load-arm-with-SB-enabled.patch similarity index 99% rename from 0494-Load-arm-with-SB-enabled.patch rename to 0061-Load-arm-with-SB-enabled.patch index c17a855..4a2750b 100644 --- a/0494-Load-arm-with-SB-enabled.patch +++ b/0061-Load-arm-with-SB-enabled.patch @@ -1,7 +1,7 @@ -From 52f32f8cba353fd61b05af6996f969632445125d Mon Sep 17 00:00:00 2001 +From 56438f7e90e47de9c964272e6329ac5ef8ee9f0d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 18 Sep 2014 11:26:14 -0400 -Subject: [PATCH 494/506] Load arm with SB enabled. +Subject: [PATCH 61/74] Load arm with SB enabled. Make sure we actually try to validate secure boot on this platform (even though we're not shipping it enabled by default.) diff --git a/0061-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch b/0061-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch deleted file mode 100644 index f0c15c6..0000000 --- a/0061-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 4a70fed815c12090c772ed911363520d0f02cf36 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 28 Feb 2014 09:48:57 +0100 -Subject: [PATCH 061/506] * grub-core/loader/i386/multiboot_mbi.c - (grub_multiboot_make_mbi): Limit location to 640K. - ---- - ChangeLog | 5 +++++ - grub-core/loader/i386/multiboot_mbi.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index c2983f2..feea178 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-02-28 Vladimir Serbinenko - -+ * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit -+ location to 640K. -+ -+2014-02-28 Vladimir Serbinenko -+ - * grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000 - region. - -diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c -index 7431aa4..f10c087 100644 ---- a/grub-core/loader/i386/multiboot_mbi.c -+++ b/grub-core/loader/i386/multiboot_mbi.c -@@ -446,7 +446,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target) - bufsize = grub_multiboot_get_mbi_size (); - - err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -- 0x10000, 0x100000 - bufsize, -+ 0x10000, 0xa0000 - bufsize, - bufsize, 4, - GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) --- -2.4.3 - diff --git a/0495-Try-prefix-if-fw_path-doesn-t-work.patch b/0062-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 97% rename from 0495-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0062-Try-prefix-if-fw_path-doesn-t-work.patch index e1bbb9b..2d0a643 100644 --- a/0495-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0062-Try-prefix-if-fw_path-doesn-t-work.patch @@ -1,7 +1,7 @@ -From d2fd442571640c4adb15d9aa726a5da9503b5b8a Mon Sep 17 00:00:00 2001 +From d0ed2021aea192f40486b67c6fb7a0ca1da1ac20 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 3 Oct 2014 11:08:03 -0400 -Subject: [PATCH 495/506] Try $prefix if $fw_path doesn't work. +Subject: [PATCH 62/74] Try $prefix if $fw_path doesn't work. Related: rhbz#1148652 diff --git a/0062-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch b/0062-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch deleted file mode 100644 index e41c1a8..0000000 --- a/0062-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch +++ /dev/null @@ -1,47 +0,0 @@ -From dfc5ccfa97e15c8c83c98594570e4e07b3630877 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 28 Feb 2014 09:50:47 +0100 -Subject: [PATCH 062/506] * grub-core/mmap/i386/uppermem.c (lower_hook) - [COREBOOT]: Ignore low tables for low memory calculations. - ---- - ChangeLog | 5 +++++ - grub-core/mmap/i386/uppermem.c | 6 +++++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index feea178..5edbf67 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-02-28 Vladimir Serbinenko - -+ * grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low -+ tables for low memory calculations. -+ -+2014-02-28 Vladimir Serbinenko -+ - * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit - location to 640K. - -diff --git a/grub-core/mmap/i386/uppermem.c b/grub-core/mmap/i386/uppermem.c -index bd8b429..a6be989 100644 ---- a/grub-core/mmap/i386/uppermem.c -+++ b/grub-core/mmap/i386/uppermem.c -@@ -31,8 +31,12 @@ lower_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, - - if (type != GRUB_MEMORY_AVAILABLE) - return 0; -+#ifdef GRUB_MACHINE_COREBOOT -+ if (addr <= 0x1000) -+#else - if (addr == 0) -- *lower = size; -+#endif -+ *lower = size + addr; - return 0; - } - --- -2.4.3 - diff --git a/0496-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch b/0063-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch similarity index 92% rename from 0496-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch rename to 0063-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch index ee426ac..fa931e0 100644 --- a/0496-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch +++ b/0063-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch @@ -1,8 +1,8 @@ -From 470b4ecee71a70b35f7908b6a9cef9b55453d449 Mon Sep 17 00:00:00 2001 +From 8bc3f3da2d6a5b372d120c2d07efbcc5ad17eddc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 27 Oct 2014 09:22:55 -0400 -Subject: [PATCH 496/506] Try to emit linux16/initrd16 and linuxefi/initrdefi - in 30-os_prober. +Subject: [PATCH 63/74] Try to emit linux16/initrd16 and linuxefi/initrdefi in + 30-os_prober. Resolves: rhbz#1108296 diff --git a/0063-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch b/0063-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch deleted file mode 100644 index 6dee9a6..0000000 --- a/0063-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch +++ /dev/null @@ -1,88 +0,0 @@ -From bec35dad2a86b2412e9ce11d09f47f1d01ccc616 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 28 Feb 2014 10:07:11 +0100 -Subject: [PATCH 063/506] * grub-core/kern/i386/pc/mmap.c: Fallback to - EISA memory map if E820 failed to return any regions. - ---- - ChangeLog | 5 +++++ - grub-core/kern/i386/pc/mmap.c | 40 +++++++++++++++++++++------------------- - 2 files changed, 26 insertions(+), 19 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 5edbf67..2e98f39 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-02-28 Vladimir Serbinenko - -+ * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map -+ if E820 failed to return any regions. -+ -+2014-02-28 Vladimir Serbinenko -+ - * grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low - tables for low memory calculations. - -diff --git a/grub-core/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c -index 8009e83..f1375f3 100644 ---- a/grub-core/kern/i386/pc/mmap.c -+++ b/grub-core/kern/i386/pc/mmap.c -@@ -141,33 +141,35 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry, - grub_err_t - grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) - { -- grub_uint32_t cont; -+ grub_uint32_t cont = 0; - struct grub_machine_mmap_entry *entry - = (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; -+ int e820_works = 0; - -- grub_memset (entry, 0, sizeof (entry)); -+ while (1) -+ { -+ grub_memset (entry, 0, sizeof (entry)); - -- /* Check if grub_get_mmap_entry works. */ -- cont = grub_get_mmap_entry (entry, 0); -+ cont = grub_get_mmap_entry (entry, cont); - -- if (entry->size) -- do -- { -- if (hook (entry->addr, entry->len, -- /* GRUB mmaps have been defined to match with the E820 definition. -- Therefore, we can just pass type through. */ -- entry->type, hook_data)) -- break; -+ if (!entry->size) -+ break; - -- if (! cont) -- break; -+ if (entry->len) -+ e820_works = 1; -+ if (entry->len -+ && hook (entry->addr, entry->len, -+ /* GRUB mmaps have been defined to match with -+ the E820 definition. -+ Therefore, we can just pass type through. */ -+ entry->type, hook_data)) -+ break; - -- grub_memset (entry, 0, sizeof (entry)); -+ if (! cont) -+ break; -+ } - -- cont = grub_get_mmap_entry (entry, cont); -- } -- while (entry->size); -- else -+ if (!e820_works) - { - grub_uint32_t eisa_mmap = grub_get_eisa_mmap (); - --- -2.4.3 - diff --git a/0497-Update-to-minilzo-2.08.patch b/0064-Update-to-minilzo-2.08.patch similarity index 99% rename from 0497-Update-to-minilzo-2.08.patch rename to 0064-Update-to-minilzo-2.08.patch index ad94927..e77b4a7 100644 --- a/0497-Update-to-minilzo-2.08.patch +++ b/0064-Update-to-minilzo-2.08.patch @@ -1,7 +1,7 @@ -From 2d2bd88d2efd68e086dfa75ddc28c0f5f346996a Mon Sep 17 00:00:00 2001 +From 402afd14075d41885ffeb48112343ec319b4af13 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Dec 2014 15:36:09 -0500 -Subject: [PATCH 497/506] Update to minilzo-2.08 +Subject: [PATCH 64/74] Update to minilzo-2.08 This fixes CVE-2014-4607 - lzo: lzo1x_decompress_safe() integer overflow diff --git a/0064-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch b/0064-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch deleted file mode 100644 index b5e86a2..0000000 --- a/0064-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 86402b4e0fec7d0e5637f70a3103a4d9c3f62839 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 28 Feb 2014 10:50:05 +0100 -Subject: [PATCH 064/506] * include/grub/i386/openbsd_bootarg.h: Add - addr and frequency fields. * grub-core/loader/i386/bsd.c - (grub_cmd_openbsd): Fill addr field. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - Suggested by: Markus Müller. ---- - ChangeLog | 7 +++++++ - grub-core/loader/i386/bsd.c | 2 ++ - include/grub/i386/openbsd_bootarg.h | 2 ++ - 3 files changed, 11 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 2e98f39..770269c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,12 @@ - 2014-02-28 Vladimir Serbinenko - -+ * include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields. -+ * grub-core/loader/i386/bsd.c (grub_cmd_openbsd): Fill addr field. -+ -+ Suggested by: Markus Müller. -+ -+2014-02-28 Vladimir Serbinenko -+ - * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map - if E820 failed to return any regions. - -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index ea0edfa..19985f0 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -1646,6 +1646,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) - - serial.device = (GRUB_OPENBSD_COM_MAJOR << 8) | port; - serial.speed = speed; -+ serial.addr = grub_ns8250_hw_get_port (port); - - grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial)); - bootflags |= OPENBSD_RB_SERCONS; -@@ -1656,6 +1657,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) - - grub_memset (&serial, 0, sizeof (serial)); - serial.device = (GRUB_OPENBSD_VGA_MAJOR << 8); -+ serial.addr = 0xffffffff; - grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial)); - bootflags &= ~OPENBSD_RB_SERCONS; - } -diff --git a/include/grub/i386/openbsd_bootarg.h b/include/grub/i386/openbsd_bootarg.h -index 01ca486..9ebe6b4 100644 ---- a/include/grub/i386/openbsd_bootarg.h -+++ b/include/grub/i386/openbsd_bootarg.h -@@ -75,6 +75,8 @@ struct grub_openbsd_bootarg_console - { - grub_uint32_t device; - grub_uint32_t speed; -+ grub_uint32_t addr; -+ grub_uint32_t frequency; - }; - - struct grub_openbsd_bootarg_pcibios --- -2.4.3 - diff --git a/0498-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0065-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 92% rename from 0498-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0065-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 3d0ac16..47ad7b7 100644 --- a/0498-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0065-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -1,8 +1,8 @@ -From ec6fb2f84c14090f517cbe57b6a8eeabbb76d684 Mon Sep 17 00:00:00 2001 +From 3dd1e0b3978fe49960000d407672dac6fb8042d8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 28 Apr 2015 11:15:03 -0400 -Subject: [PATCH 498/506] Make grub2-mkconfig construct titles that look like - the ones we want elsewhere. +Subject: [PATCH 65/74] Make grub2-mkconfig construct titles that look like the + ones we want elsewhere. Resolves: rhbz#1215839 diff --git a/0065-ieee1275-check-for-IBM-pseries-emulated-machine.patch b/0065-ieee1275-check-for-IBM-pseries-emulated-machine.patch deleted file mode 100644 index 17ae58b..0000000 --- a/0065-ieee1275-check-for-IBM-pseries-emulated-machine.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e4a1fe391906bfcd1a778c5ec4e242c4b07d429d Mon Sep 17 00:00:00 2001 -From: Nikunj A Dadhania -Date: Thu, 20 Mar 2014 16:57:12 +0530 -Subject: [PATCH 065/506] ieee1275: check for IBM pseries emulated machine - -is_qemu is not being set lead to disabling of feature like -GRUB_IEEE1275_FLAG_HAS_CURSORONOFF. This resulted in cursor not being -displayed during the grub-menu edit. - -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); --- -2.4.3 - diff --git a/0499-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch b/0066-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch similarity index 90% rename from 0499-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch rename to 0066-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch index cf5ad00..033958c 100644 --- a/0499-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch +++ b/0066-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch @@ -1,7 +1,7 @@ -From 6114642c13b10fdb39145377ff74310f2f27158d Mon Sep 17 00:00:00 2001 +From fadcf2216e668dcfe6b4d0278101eef03400aa1f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 28 Apr 2015 11:17:02 -0400 -Subject: [PATCH 499/506] Make rescue and debug entries sort right /again/ in +Subject: [PATCH 66/74] Make rescue and debug entries sort right /again/ in grub2-mkconfig. Related: rhbz#12145839 diff --git a/0066-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch b/0066-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch deleted file mode 100644 index 16493ad..0000000 --- a/0066-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 68f17b2b300e4eaf9852c23d0b652d6e210ac180 Mon Sep 17 00:00:00 2001 -From: Fu Wei -Date: Wed, 26 Mar 2014 08:13:07 +0100 -Subject: [PATCH 066/506] * grub-core/loader/arm64/linux.c: Remove - redundant "0x". - ---- - ChangeLog | 4 ++++ - grub-core/loader/arm64/linux.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 770269c..44ce649 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-03-26 Fu Wei -+ -+ * grub-core/loader/arm64/linux.c: Remove redundant "0x". -+ - 2014-02-28 Vladimir Serbinenko - - * include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields. -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 65129c2..f1d10a1 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -68,7 +68,7 @@ get_firmware_fdt (void) - 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 @ 0x%p\n", firmware_fdt); -+ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt); - break; - } - --- -2.4.3 - diff --git a/0500-Make-.gitignore-suck-way-less.patch b/0067-Make-.gitignore-suck-way-less.patch similarity index 98% rename from 0500-Make-.gitignore-suck-way-less.patch rename to 0067-Make-.gitignore-suck-way-less.patch index b951052..c8b9fe4 100644 --- a/0500-Make-.gitignore-suck-way-less.patch +++ b/0067-Make-.gitignore-suck-way-less.patch @@ -1,7 +1,7 @@ -From 048b160002e097cf739739c2f9e88c7e684bc2bd Mon Sep 17 00:00:00 2001 +From 5ca1f600b419264e712b0a7e841837a4ce39418c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 7 Jul 2015 10:13:14 -0400 -Subject: [PATCH 500/506] Make .gitignore suck way less +Subject: [PATCH 67/74] Make .gitignore suck way less We lost a man page because of incompatibilities between bzr's ignore system and .gitignore, so solve that slightly better. diff --git a/0067-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch b/0067-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch deleted file mode 100644 index c820a0a..0000000 --- a/0067-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 46b74dd3cbb3a97a7abeb7f0464de548006e0e3d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 26 Mar 2014 08:48:30 +0100 -Subject: [PATCH 067/506] * grub-core/lib/relocator.c: Fix the case when - end of leftover is used. - ---- - ChangeLog | 4 ++++ - grub-core/lib/relocator.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 44ce649..b3f077a 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-03-26 Vladimir Serbinenko -+ -+ * grub-core/lib/relocator.c: Fix the case when end of leftover is used. -+ - 2014-03-26 Fu Wei - - * grub-core/loader/arm64/linux.c: Remove redundant "0x". -diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c -index 9f9770b..cb11ea5 100644 ---- a/grub-core/lib/relocator.c -+++ b/grub-core/lib/relocator.c -@@ -865,6 +865,8 @@ malloc_in_range (struct grub_relocator *rel, - % GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT; - struct grub_relocator_fw_leftover *lo - = events[last_lo].leftover; -+ if (offend == 0 && alloc_end != alloc_start) -+ offend = GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT; - lo->freebytes[offstart / 8] - &= ((1 << (8 - (start % 8))) - 1); - grub_memset (lo->freebytes + (offstart + 7) / 8, 0, --- -2.4.3 - diff --git a/0068-Fix-grub-probe-0-option.patch b/0068-Fix-grub-probe-0-option.patch deleted file mode 100644 index aa9839f..0000000 --- a/0068-Fix-grub-probe-0-option.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 9b35fe819f642f9277534d97f73024eb6734057d Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Mon, 31 Mar 2014 13:51:17 +0100 -Subject: [PATCH 068/506] Fix grub-probe -0 option - -* util/grub-probe,c (options): Make -0 work again (broken by -conversion to argp). -(main): Simplify logic. ---- - ChangeLog | 6 ++++++ - util/grub-probe.c | 7 ++----- - 2 files changed, 8 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index b3f077a..46a6561 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,9 @@ -+2014-03-31 Colin Watson -+ -+ * util/grub-probe,c (options): Make -0 work again (broken by -+ conversion to argp). -+ (main): Simplify logic. -+ - 2014-03-26 Vladimir Serbinenko - - * grub-core/lib/relocator.c: Fix the case when end of leftover is used. -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 1f3b59f..80509be 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -711,6 +711,7 @@ static struct argp_option options[] = { - N_("use FILE as the device map [default=%s]"), 0}, - {"target", 't', N_("TARGET"), 0, 0, 0}, - {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, -+ {0, '0', 0, 0, N_("separate items in output using ASCII NUL characters"), 0}, - { 0, 0, 0, 0, 0, 0 } - }; - -@@ -884,11 +885,7 @@ main (int argc, char *argv[]) - else - probe (arguments.devices[0], NULL, delim); - -- if (!arguments.zero_delim && (print == PRINT_BIOS_HINT -- || print == PRINT_IEEE1275_HINT -- || print == PRINT_BAREMETAL_HINT -- || print == PRINT_EFI_HINT -- || print == PRINT_ARC_HINT)) -+ if (delim == ' ') - putchar ('\n'); - - /* Free resources. */ --- -2.4.3 - diff --git a/0501-Update-info-with-grub.cfg-netboot-selection-order-11.patch b/0068-Update-info-with-grub.cfg-netboot-selection-order-11.patch similarity index 93% rename from 0501-Update-info-with-grub.cfg-netboot-selection-order-11.patch rename to 0068-Update-info-with-grub.cfg-netboot-selection-order-11.patch index b9b1883..e7d7345 100644 --- a/0501-Update-info-with-grub.cfg-netboot-selection-order-11.patch +++ b/0068-Update-info-with-grub.cfg-netboot-selection-order-11.patch @@ -1,7 +1,7 @@ -From 9800d08533c09f76c226ebbbcfc1c35718c390f4 Mon Sep 17 00:00:00 2001 +From 722feabf3772d18d008ed9d53091c91fbafa85a9 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 16:34:51 -0400 -Subject: [PATCH 501/506] Update info with grub.cfg netboot selection order +Subject: [PATCH 68/74] Update info with grub.cfg netboot selection order (#1148650) Added documentation to the grub info page that specifies the order diff --git a/0069-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch b/0069-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch deleted file mode 100644 index 9a8cfc6..0000000 --- a/0069-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch +++ /dev/null @@ -1,366 +0,0 @@ -From 24024dac7f51d3c0df8e1bec63c02d52828de534 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Mon, 31 Mar 2014 14:48:33 +0100 -Subject: [PATCH 069/506] Fix partmap, cryptodisk, and abstraction handling in - grub-mkconfig. - -Commit 588744d0dc655177d5883bdcb8f72ff5160109ed caused grub-mkconfig -no longer to be forgiving of trailing spaces on grub-probe output -lines, which among other things means that util/grub.d/10_linux.in -no longer detects LVM. To fix this, make grub-probe's output -delimiting more consistent. As a bonus, this improves the coverage -of the -0 option. - -Fixes Debian bug #735935. - -* grub-core/disk/cryptodisk.c -(grub_util_cryptodisk_get_abstraction): Add a user-data argument. -* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap): -Likewise. -* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction): -Update prototype. -* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise. -* util/grub-install.c (push_partmap_module, push_cryptodisk_module, -probe_mods): Adjust for extra user-data arguments. -* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid, -probe_abstraction): Use configured delimiter. Update callers. ---- - ChangeLog | 25 ++++++++++++++++++++++++ - grub-core/disk/cryptodisk.c | 19 ++++++++++--------- - grub-core/disk/diskfilter.c | 5 +++-- - include/grub/cryptodisk.h | 3 ++- - include/grub/diskfilter.h | 3 ++- - util/grub-install.c | 14 ++++++++++---- - util/grub-probe.c | 46 ++++++++++++++++++++++----------------------- - 7 files changed, 74 insertions(+), 41 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 46a6561..d613bf6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,30 @@ - 2014-03-31 Colin Watson - -+ Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig. -+ -+ Commit 588744d0dc655177d5883bdcb8f72ff5160109ed caused grub-mkconfig -+ no longer to be forgiving of trailing spaces on grub-probe output -+ lines, which among other things means that util/grub.d/10_linux.in -+ no longer detects LVM. To fix this, make grub-probe's output -+ delimiting more consistent. As a bonus, this improves the coverage -+ of the -0 option. -+ -+ Fixes Debian bug #735935. -+ -+ * grub-core/disk/cryptodisk.c -+ (grub_util_cryptodisk_get_abstraction): Add a user-data argument. -+ * grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap): -+ Likewise. -+ * include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction): -+ Update prototype. -+ * include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise. -+ * util/grub-install.c (push_partmap_module, push_cryptodisk_module, -+ probe_mods): Adjust for extra user-data arguments. -+ * util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid, -+ probe_abstraction): Use configured delimiter. Update callers. -+ -+2014-03-31 Colin Watson -+ - * util/grub-probe,c (options): Make -0 work again (broken by - conversion to argp). - (main): Simplify logic. -diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c -index 75c6e1f..f0e3a90 100644 ---- a/grub-core/disk/cryptodisk.c -+++ b/grub-core/disk/cryptodisk.c -@@ -762,25 +762,26 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name, - - void - grub_util_cryptodisk_get_abstraction (grub_disk_t disk, -- void (*cb) (const char *val)) -+ void (*cb) (const char *val, void *data), -+ void *data) - { - grub_cryptodisk_t dev = (grub_cryptodisk_t) disk->data; - -- cb ("cryptodisk"); -- cb (dev->modname); -+ cb ("cryptodisk", data); -+ cb (dev->modname, data); - - if (dev->cipher) -- cb (dev->cipher->cipher->modname); -+ cb (dev->cipher->cipher->modname, data); - if (dev->secondary_cipher) -- cb (dev->secondary_cipher->cipher->modname); -+ cb (dev->secondary_cipher->cipher->modname, data); - if (dev->essiv_cipher) -- cb (dev->essiv_cipher->cipher->modname); -+ cb (dev->essiv_cipher->cipher->modname, data); - if (dev->hash) -- cb (dev->hash->modname); -+ cb (dev->hash->modname, data); - if (dev->essiv_hash) -- cb (dev->essiv_hash->modname); -+ cb (dev->essiv_hash->modname, data); - if (dev->iv_hash) -- cb (dev->iv_hash->modname); -+ cb (dev->iv_hash->modname, data); - } - - const char * -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 28b70c6..e8a3bcb 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -354,7 +354,8 @@ grub_diskfilter_memberlist (grub_disk_t disk) - - void - grub_diskfilter_get_partmap (grub_disk_t disk, -- void (*cb) (const char *pm)) -+ void (*cb) (const char *pm, void *data), -+ void *data) - { - struct grub_diskfilter_lv *lv = disk->data; - struct grub_diskfilter_pv *pv; -@@ -376,7 +377,7 @@ grub_diskfilter_get_partmap (grub_disk_t disk, - continue; - } - for (s = 0; pv->partmaps[s]; s++) -- cb (pv->partmaps[s]); -+ cb (pv->partmaps[s], data); - } - } - -diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h -index 66f3e1e..f2ad2a7 100644 ---- a/include/grub/cryptodisk.h -+++ b/include/grub/cryptodisk.h -@@ -145,7 +145,8 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name, - grub_disk_t source, const char *cheat); - void - grub_util_cryptodisk_get_abstraction (grub_disk_t disk, -- void (*cb) (const char *val)); -+ void (*cb) (const char *val, void *data), -+ void *data); - - char * - grub_util_get_geli_uuid (const char *dev); -diff --git a/include/grub/diskfilter.h b/include/grub/diskfilter.h -index 042fe04..1aedcd3 100644 ---- a/include/grub/diskfilter.h -+++ b/include/grub/diskfilter.h -@@ -202,7 +202,8 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk, - struct grub_diskfilter_vg **vg); - void - grub_diskfilter_get_partmap (grub_disk_t disk, -- void (*cb) (const char *val)); -+ void (*cb) (const char *val, void *data), -+ void *data); - #endif - - #endif /* ! GRUB_RAID_H */ -diff --git a/util/grub-install.c b/util/grub-install.c -index 2e6226a..e9c6a46 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -387,7 +387,7 @@ probe_raid_level (grub_disk_t disk) - } - - static void --push_partmap_module (const char *map) -+push_partmap_module (const char *map, void *data __attribute__ ((unused))) - { - char buf[50]; - -@@ -402,6 +402,12 @@ push_partmap_module (const char *map) - } - - static void -+push_cryptodisk_module (const char *mod, void *data __attribute__ ((unused))) -+{ -+ grub_install_push_module (mod); -+} -+ -+static void - probe_mods (grub_disk_t disk) - { - grub_partition_t part; -@@ -412,11 +418,11 @@ probe_mods (grub_disk_t disk) - grub_util_info ("no partition map found for %s", disk->name); - - for (part = disk->partition; part; part = part->parent) -- push_partmap_module (part->partmap->name); -+ push_partmap_module (part->partmap->name, NULL); - - if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) - { -- grub_diskfilter_get_partmap (disk, push_partmap_module); -+ grub_diskfilter_get_partmap (disk, push_partmap_module, NULL); - have_abstractions = 1; - } - -@@ -432,7 +438,7 @@ probe_mods (grub_disk_t disk) - if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) - { - grub_util_cryptodisk_get_abstraction (disk, -- grub_install_push_module); -+ push_cryptodisk_module, NULL); - have_abstractions = 1; - have_cryptodisk = 1; - } -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 80509be..ecb7b6b 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -130,13 +130,14 @@ get_targets_string (void) - } - - static void --do_print (const char *x) -+do_print (const char *x, void *data) - { -- grub_printf ("%s ", x); -+ char delim = *(const char *) data; -+ grub_printf ("%s%c", x, delim); - } - - static void --probe_partmap (grub_disk_t disk) -+probe_partmap (grub_disk_t disk, char delim) - { - grub_partition_t part; - grub_disk_memberlist_t list = NULL, tmp; -@@ -147,10 +148,10 @@ probe_partmap (grub_disk_t disk) - } - - for (part = disk->partition; part; part = part->parent) -- printf ("%s ", part->partmap->name); -+ printf ("%s%c", part->partmap->name, delim); - - if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) -- grub_diskfilter_get_partmap (disk, do_print); -+ grub_diskfilter_get_partmap (disk, do_print, &delim); - - /* In case of LVM/RAID, check the member devices as well. */ - if (disk->dev->memberlist) -@@ -159,7 +160,7 @@ probe_partmap (grub_disk_t disk) - } - while (list) - { -- probe_partmap (list->disk); -+ probe_partmap (list->disk, delim); - tmp = list->next; - free (list); - list = tmp; -@@ -167,7 +168,7 @@ probe_partmap (grub_disk_t disk) - } - - static void --probe_cryptodisk_uuid (grub_disk_t disk) -+probe_cryptodisk_uuid (grub_disk_t disk, char delim) - { - grub_disk_memberlist_t list = NULL, tmp; - -@@ -178,7 +179,7 @@ probe_cryptodisk_uuid (grub_disk_t disk) - } - while (list) - { -- probe_cryptodisk_uuid (list->disk); -+ probe_cryptodisk_uuid (list->disk, delim); - tmp = list->next; - free (list); - list = tmp; -@@ -186,7 +187,7 @@ probe_cryptodisk_uuid (grub_disk_t disk) - if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) - { - const char *uu = grub_util_cryptodisk_get_uuid (disk); -- grub_printf ("%s ", uu); -+ grub_printf ("%s%c", uu, delim); - } - } - -@@ -210,7 +211,7 @@ probe_raid_level (grub_disk_t disk) - } - - static void --probe_abstraction (grub_disk_t disk) -+probe_abstraction (grub_disk_t disk, char delim) - { - grub_disk_memberlist_t list = NULL, tmp; - int raid_level; -@@ -219,7 +220,7 @@ probe_abstraction (grub_disk_t disk) - list = disk->dev->memberlist (disk); - while (list) - { -- probe_abstraction (list->disk); -+ probe_abstraction (list->disk, delim); - - tmp = list->next; - free (list); -@@ -229,26 +230,26 @@ probe_abstraction (grub_disk_t disk) - if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID - && (grub_memcmp (disk->name, "lvm/", sizeof ("lvm/") - 1) == 0 || - grub_memcmp (disk->name, "lvmid/", sizeof ("lvmid/") - 1) == 0)) -- printf ("lvm "); -+ printf ("lvm%c", delim); - - if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID - && grub_memcmp (disk->name, "ldm/", sizeof ("ldm/") - 1) == 0) -- printf ("ldm "); -+ printf ("ldm%c", delim); - - if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) -- grub_util_cryptodisk_get_abstraction (disk, do_print); -+ grub_util_cryptodisk_get_abstraction (disk, do_print, &delim); - - raid_level = probe_raid_level (disk); - if (raid_level >= 0) - { -- printf ("diskfilter "); -+ printf ("diskfilter%c", delim); - if (disk->dev->raidname) -- printf ("%s ", disk->dev->raidname (disk)); -+ printf ("%s%c", disk->dev->raidname (disk), delim); - } - if (raid_level == 5) -- printf ("raid5rec "); -+ printf ("raid5rec%c", delim); - if (raid_level == 6) -- printf ("raid6rec "); -+ printf ("raid6rec%c", delim); - } - - static void -@@ -630,16 +631,14 @@ probe (const char *path, char **device_names, char delim) - - if (print == PRINT_ABSTRACTION) - { -- probe_abstraction (dev->disk); -- putchar (delim); -+ probe_abstraction (dev->disk, delim); - grub_device_close (dev); - continue; - } - - if (print == PRINT_CRYPTODISK_UUID) - { -- probe_cryptodisk_uuid (dev->disk); -- putchar (delim); -+ probe_cryptodisk_uuid (dev->disk, delim); - grub_device_close (dev); - continue; - } -@@ -647,8 +646,7 @@ probe (const char *path, char **device_names, char delim) - if (print == PRINT_PARTMAP) - { - /* Check if dev->disk itself is contained in a partmap. */ -- probe_partmap (dev->disk); -- putchar (delim); -+ probe_partmap (dev->disk, delim); - grub_device_close (dev); - continue; - } --- -2.4.3 - diff --git a/0502-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0069-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch similarity index 98% rename from 0502-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0069-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index 22f4173..8495de0 100644 --- a/0502-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0069-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -1,7 +1,7 @@ -From 092d28444fac3b4629a84daed5003fcbbb24c9c7 Mon Sep 17 00:00:00 2001 +From 52da7ccd886fc26ca8989c4632bd5330d833ddc5 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH 502/506] Use Distribution Package Sort for grub2-mkconfig +Subject: [PATCH 69/74] Use Distribution Package Sort for grub2-mkconfig (#1124074) Users reported that newly installed kernels on their systems installed @@ -61,7 +61,7 @@ index 591c5e5..f28d73d 100644 name = grub-mkconfig; common = util/grub-mkconfig.in; diff --git a/configure.ac b/configure.ac -index 9306223..e86a40d 100644 +index 357c94e..64791d1 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -80,7 +80,7 @@ index 9306223..e86a40d 100644 grub_TRANSFORM([grub-reboot.3]) grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) -@@ -1610,6 +1612,33 @@ fi +@@ -1630,6 +1632,33 @@ fi AC_SUBST([LIBDEVMAPPER]) diff --git a/0503-Add-friendly-grub2-password-config-tool-985962.patch b/0070-Add-friendly-grub2-password-config-tool-985962.patch similarity index 97% rename from 0503-Add-friendly-grub2-password-config-tool-985962.patch rename to 0070-Add-friendly-grub2-password-config-tool-985962.patch index dbedfa3..b5c4e28 100644 --- a/0503-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0070-Add-friendly-grub2-password-config-tool-985962.patch @@ -1,7 +1,7 @@ -From 130e377aa87178f1a5555f6ac039fc0530b7cdb3 Mon Sep 17 00:00:00 2001 +From d6e5091112cf708784ba0ee57245b20d0aceb5f1 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Thu, 25 Jun 2015 11:13:11 -0400 -Subject: [PATCH 503/506] Add friendly grub2 password config tool (#985962) +Subject: [PATCH 70/74] Add friendly grub2 password config tool (#985962) Provided a tool for users to reset the grub2 root user password without having to alter the grub.cfg. The hashed password now @@ -65,7 +65,7 @@ index f28d73d..bc13d4a 100644 common = util/grub-mkconfig_lib.in; installdir = noinst; diff --git a/configure.ac b/configure.ac -index e86a40d..991cb15 100644 +index 64791d1..add5473 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) diff --git a/0070-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch b/0070-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch deleted file mode 100644 index 4580676..0000000 --- a/0070-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch +++ /dev/null @@ -1,44 +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 070/506] 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/ChangeLog b/ChangeLog -index d613bf6..6eca73e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2014-03-31 Thomas Falcon -+ -+ 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. -+ - 2014-03-31 Colin Watson - - Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig. -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, --- -2.4.3 - diff --git a/0504-Make-exit-take-a-return-code.patch b/0071-Make-exit-take-a-return-code.patch similarity index 85% rename from 0504-Make-exit-take-a-return-code.patch rename to 0071-Make-exit-take-a-return-code.patch index 8cb2c67..59a0a3d 100644 --- a/0504-Make-exit-take-a-return-code.patch +++ b/0071-Make-exit-take-a-return-code.patch @@ -1,7 +1,7 @@ -From ebb9cc96a230bbd58e0064356cdb3d403a473581 Mon Sep 17 00:00:00 2001 +From ec51384985765e1b0c56decdec58e00eb47f7bf1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 7 Jul 2015 12:00:26 -0400 -Subject: [PATCH 504/506] Make "exit" take a return code. +Subject: [PATCH 71/74] Make "exit" take a return code. This adds "exit" with a return code. With this patch, any "exit" command /may/ include a return code, and on platforms that support @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones --- grub-core/commands/minicmd.c | 20 ++++++++++++++++---- grub-core/kern/efi/efi.c | 9 +++++++-- - grub-core/kern/emu/misc.c | 4 ++-- + grub-core/kern/emu/misc.c | 5 +++-- grub-core/kern/i386/coreboot/init.c | 2 +- grub-core/kern/i386/qemu/init.c | 2 +- grub-core/kern/ieee1275/init.c | 2 +- @@ -22,7 +22,8 @@ Signed-off-by: Peter Jones grub-core/kern/misc.c | 2 +- grub-core/kern/uboot/init.c | 6 +++--- grub-core/kern/xen/init.c | 2 +- - 12 files changed, 36 insertions(+), 19 deletions(-) + include/grub/misc.h | 2 +- + 13 files changed, 38 insertions(+), 20 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c index a3a1182..b25ca4b 100644 @@ -81,14 +82,15 @@ index c80d85b..95c75d4 100644 } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index bb606da..837d162 100644 +index bb606da..258a564 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -135,9 +135,9 @@ xasprintf (const char *fmt, ...) +@@ -135,9 +135,10 @@ xasprintf (const char *fmt, ...) #endif void -grub_exit (void) ++__attribute__ ((noreturn)) +grub_exit (int rc) { - exit (1); @@ -175,7 +177,7 @@ index be88b77..8b6c55f 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 66f11f8..be6aa63 100644 +index 6b3397f..27d4b81 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1090,7 +1090,7 @@ grub_abort (void) @@ -225,6 +227,19 @@ index 0559c03..fce526d 100644 { struct sched_shutdown arg; +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 2a9f87c..0620814 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -334,7 +334,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, + char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) + __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT; + char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT; +-void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn)); ++void EXPORT_FUNC(grub_exit) (int rc) __attribute__ ((noreturn)); + grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, + grub_uint64_t d, + grub_uint64_t *r); -- 2.4.3 diff --git a/0071-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch b/0071-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch deleted file mode 100644 index 6cddc1c..0000000 --- a/0071-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch +++ /dev/null @@ -1,55 +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 071/506] * grub-core/osdep/linux/getroot.c - (grub_util_part_to_disk): Support NVMe device names. - ---- - ChangeLog | 5 +++++ - grub-core/osdep/linux/getroot.c | 17 +++++++++++++++++ - 2 files changed, 22 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 6eca73e..20a3661 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-04-03 Vladimir Serbinenko -+ -+ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe -+ device names. -+ - 2014-03-31 Thomas Falcon - - btrfs: fix get_root key comparison failures due to endianness -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 19581d3..7007193 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -896,6 +896,23 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, - *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; --- -2.4.3 - diff --git a/0505-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch b/0072-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch similarity index 94% rename from 0505-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch rename to 0072-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch index ee87dc9..d75ee2a 100644 --- a/0505-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch +++ b/0072-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch @@ -1,7 +1,7 @@ -From aec0ae4db26fafe3ec5ea29e60313df6c88162d1 Mon Sep 17 00:00:00 2001 +From ba6c77f7bd141f4f34c93c33ef5ecd51b971c283 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 7 Jul 2015 12:04:28 -0400 -Subject: [PATCH 505/506] Add some __unused__ where gcc 5.x is more picky about +Subject: [PATCH 72/74] Add some __unused__ where gcc 5.x is more picky about it. With some build flags, gcc 5.x throws more warnings about __unused__ not diff --git a/0072-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch b/0072-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch deleted file mode 100644 index 9d133e8..0000000 --- a/0072-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 8063ce197f3196da077c667ba7a6a82173608fbb Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 4 Apr 2014 07:58:42 +0200 -Subject: [PATCH 072/506] Replace few instances of memcmp/memcpy in the code - that should be grub_memcmp/grub_memcpy. - ---- - ChangeLog | 5 +++++ - grub-core/commands/acpihalt.c | 4 ++-- - grub-core/commands/legacycfg.c | 4 ++-- - grub-core/lib/relocator.c | 2 +- - grub-core/loader/i386/bsd.c | 4 ++-- - 5 files changed, 12 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 20a3661..f633fae 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-04-04 Vladimir Serbinenko -+ -+ Replace few instances of memcmp/memcpy in the code that should be -+ grub_memcmp/grub_memcpy. -+ - 2014-04-03 Vladimir Serbinenko - - * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe -diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c -index 09421a6..83bdfe1 100644 ---- a/grub-core/commands/acpihalt.c -+++ b/grub-core/commands/acpihalt.c -@@ -214,8 +214,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, - } - case GRUB_ACPI_OPCODE_NAME: - ptr++; -- if ((!scope || memcmp (scope, "\\", scope_len) == 0) && -- (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)) -+ if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) && -+ (grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0)) - { - int ll; - grub_uint8_t *ptr2 = ptr; -diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index e42a9d8..2c09fb7 100644 ---- a/grub-core/commands/legacycfg.c -+++ b/grub-core/commands/legacycfg.c -@@ -580,7 +580,7 @@ check_password_md5_real (const char *entered, - GRUB_MD_MD5->write (ctx, entered, enteredlen); - digest = GRUB_MD_MD5->read (ctx); - GRUB_MD_MD5->final (ctx); -- memcpy (alt_result, digest, MD5_HASHLEN); -+ grub_memcpy (alt_result, digest, MD5_HASHLEN); - - GRUB_MD_MD5->init (ctx); - GRUB_MD_MD5->write (ctx, entered, enteredlen); -@@ -596,7 +596,7 @@ check_password_md5_real (const char *entered, - - for (i = 0; i < 1000; i++) - { -- memcpy (alt_result, digest, 16); -+ grub_memcpy (alt_result, digest, 16); - - GRUB_MD_MD5->init (ctx); - if ((i & 1) != 0) -diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c -index cb11ea5..f759c7f 100644 ---- a/grub-core/lib/relocator.c -+++ b/grub-core/lib/relocator.c -@@ -652,7 +652,7 @@ malloc_in_range (struct grub_relocator *rel, - for (i = 0; i < (BITS_IN_BYTE * sizeof (grub_addr_t) / DIGITSORT_BITS); - i++) - { -- memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0])); -+ grub_memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0])); - for (j = 0; j < N; j++) - counter[((events[j].pos >> (DIGITSORT_BITS * i)) - & DIGITSORT_MASK) + 1]++; -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 19985f0..41ef910 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -1082,7 +1082,7 @@ grub_netbsd_add_boot_disk_and_wedge (void) - - grub_crypto_hash (GRUB_MD_MD5, hash, - buf.raw, GRUB_DISK_SECTOR_SIZE); -- memcpy (biw.matchhash, hash, 16); -+ grub_memcpy (biw.matchhash, hash, 16); - - grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw)); - } -@@ -1100,7 +1100,7 @@ grub_netbsd_add_boot_disk_and_wedge (void) - bid.labelsector = partmapsector; - bid.label.type = buf.label.type; - bid.label.checksum = buf.label.checksum; -- memcpy (bid.label.packname, buf.label.packname, 16); -+ grub_memcpy (bid.label.packname, buf.label.packname, 16); - } - else - { --- -2.4.3 - diff --git a/0506-Fix-race-in-EFI-validation.patch b/0073-Fix-race-in-EFI-validation.patch similarity index 95% rename from 0506-Fix-race-in-EFI-validation.patch rename to 0073-Fix-race-in-EFI-validation.patch index 442821c..8d74712 100644 --- a/0506-Fix-race-in-EFI-validation.patch +++ b/0073-Fix-race-in-EFI-validation.patch @@ -1,7 +1,7 @@ -From aaa2b70bc66f50d0cd9243b6b0f90a141958ced2 Mon Sep 17 00:00:00 2001 +From dbd2b5884c493f3fb78a8259b7375dd2c0349a2f Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 14 Jul 2015 16:58:51 -0700 -Subject: [PATCH 506/506] Fix race in EFI validation +Subject: [PATCH 73/74] Fix race in EFI validation --- grub-core/loader/i386/efi/linux.c | 44 ++++++++++----------------------------- diff --git a/0073-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch b/0073-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch deleted file mode 100644 index 8349ec3..0000000 --- a/0073-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 6f6d4aa02cbc522fadbc8dc42a43dedfca40da0d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 4 Apr 2014 08:02:38 +0200 -Subject: [PATCH 073/506] * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. - They're no longer pulled from libgcc. - ---- - ChangeLog | 5 +++++ - include/grub/libgcc.h | 7 ------- - 2 files changed, 5 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index f633fae..094fbca 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-04-04 Vladimir Serbinenko - -+ * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer -+ pulled from libgcc. -+ -+2014-04-04 Vladimir Serbinenko -+ - Replace few instances of memcmp/memcpy in the code that should be - grub_memcmp/grub_memcpy. - -diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h -index fdc6611..97233d7 100644 ---- a/include/grub/libgcc.h -+++ b/include/grub/libgcc.h -@@ -42,13 +42,6 @@ void EXPORT_FUNC (__bswapsi2) (void); - # 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); --- -2.4.3 - diff --git a/0074-Add-missing-endif.patch b/0074-Add-missing-endif.patch deleted file mode 100644 index a2e1416..0000000 --- a/0074-Add-missing-endif.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2009da62f2fa19634c4485edaccf9c88ab98b276 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 4 Apr 2014 08:11:15 +0200 -Subject: [PATCH 074/506] Add missing #endif - ---- - include/grub/libgcc.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h -index 97233d7..8e93b67 100644 ---- a/include/grub/libgcc.h -+++ b/include/grub/libgcc.h -@@ -42,6 +42,7 @@ void EXPORT_FUNC (__bswapsi2) (void); - # ifdef HAVE___BSWAPDI2 - void EXPORT_FUNC (__bswapdi2) (void); - # endif -+#endif - - #ifdef HAVE__RESTGPR_14_X - void EXPORT_FUNC (_restgpr_14_x) (void); --- -2.4.3 - diff --git a/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch b/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch new file mode 100644 index 0000000..5de66f8 --- /dev/null +++ b/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch @@ -0,0 +1,22 @@ +From 9d24c88e23ac11043c9ea3a61eceb41b9430589c Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 22 Jul 2015 11:21:01 -0400 +Subject: [PATCH 74/74] Mark po/exclude.pot as binary so git won't try to diff + nonprintables. + +Signed-off-by: Peter Jones +--- + .gitattributes | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 .gitattributes + +diff --git a/.gitattributes b/.gitattributes +new file mode 100644 +index 0000000..33ffaa4 +--- /dev/null ++++ b/.gitattributes +@@ -0,0 +1 @@ ++po/exclude.pot binary +-- +2.4.3 + diff --git a/0075-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch b/0075-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch deleted file mode 100644 index a4cb9de..0000000 --- a/0075-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a72fc329ebd81c03d7a2e6ad422e573e5a4d3213 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 6 Apr 2014 00:44:44 +0200 -Subject: [PATCH 075/506] * grub-core/lib/syslinux_parse.c: Fix timeout - quoting. - ---- - ChangeLog | 4 ++++ - grub-core/lib/syslinux_parse.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 094fbca..11de908 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-04-06 Vladimir Serbinenko -+ -+ * grub-core/lib/syslinux_parse.c: Fix timeout quoting. -+ - 2014-04-04 Vladimir Serbinenko - - * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 21fa175..6bc504b 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -1432,7 +1432,7 @@ config_file (struct output_buffer *outbuf, - for (curentry = menu.entries; curentry->next; curentry = curentry->next); - lentry = curentry; - -- print_string ("set timeout='"); -+ print_string ("set timeout="); - err = print_num (outbuf, (menu.timeout + 9) / 10); - if (err) - return err; --- -2.4.3 - diff --git a/0076-Improve-LVM-logical_volumes-string-matching.patch b/0076-Improve-LVM-logical_volumes-string-matching.patch deleted file mode 100644 index 1f5d7f1..0000000 --- a/0076-Improve-LVM-logical_volumes-string-matching.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c4badfe8363cc41dbedfabaa238b6c8a884e03c8 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 10 Apr 2014 14:42:41 +0100 -Subject: [PATCH 076/506] Improve LVM "logical_volumes" string matching - -* grub-core/disk/lvm.c (grub_lvm_detect): Search for -"logical_volumes" block a little more accurately. ---- - ChangeLog | 5 +++++ - grub-core/disk/lvm.c | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 11de908..c98e0df 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-04-10 Colin Watson -+ -+ * grub-core/disk/lvm.c (grub_lvm_detect): Search for -+ "logical_volumes" block a little more accurately. -+ - 2014-04-06 Vladimir Serbinenko - - * grub-core/lib/syslinux_parse.c: Fix timeout quoting. -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 483c17e..862a966 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -333,10 +333,10 @@ grub_lvm_detect (grub_disk_t disk, - } - } - -- p = grub_strstr (p, "logical_volumes"); -+ p = grub_strstr (p, "logical_volumes {"); - if (p) - { -- p += sizeof ("logical_volumes = ") - 1; -+ p += sizeof ("logical_volumes {") - 1; - - /* And add all the lvs to the volume group. */ - while (1) --- -2.4.3 - diff --git a/0077-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch b/0077-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch deleted file mode 100644 index da91cd1..0000000 --- a/0077-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 3a310e842fb7a9818c2e7cf0f4118f13660871d2 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 10 Apr 2014 16:54:33 +0100 -Subject: [PATCH 077/506] Tolerate devices with no filesystem UUID returned by - os-prober - -* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem -UUID. Other parts of grub-mkconfig tolerate these, they were -previously allowed here up to commit -55e706c918922def17f5012c23cfe88c4c645208, and they can arise in -practice when the system has active LVM snapshots. -Fixes Ubuntu bug #1287436. ---- - ChangeLog | 9 +++++++++ - util/grub.d/30_os-prober.in | 23 +++++++++++++---------- - 2 files changed, 22 insertions(+), 10 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c98e0df..30d0cac 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,14 @@ - 2014-04-10 Colin Watson - -+ * util/grub.d/30_os-prober.in: Tolerate devices with no filesystem -+ UUID. Other parts of grub-mkconfig tolerate these, they were -+ previously allowed here up to commit -+ 55e706c918922def17f5012c23cfe88c4c645208, and they can arise in -+ practice when the system has active LVM snapshots. -+ Fixes Ubuntu bug #1287436. -+ -+2014-04-10 Colin Watson -+ - * grub-core/disk/lvm.c (grub_lvm_detect): Search for - "logical_volumes" block a little more accurately. - -diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 7cf8487..6f38c82 100644 ---- a/util/grub.d/30_os-prober.in -+++ b/util/grub.d/30_os-prober.in -@@ -112,16 +112,17 @@ for OS in ${OSPROBED} ; do - LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" - LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" - BOOT="`echo ${OS} | cut -d ':' -f 4`" -- UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`" -- EXPUUID="$UUID" -+ if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then -+ EXPUUID="$UUID" - -- if [ x"${DEVICE#*@}" != x ] ; then -+ if [ x"${DEVICE#*@}" != x ] ; then - EXPUUID="${EXPUUID}@${DEVICE#*@}" -- fi -+ fi - -- if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then -- echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 -- continue -+ if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then -+ echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 -+ continue -+ fi - fi - - BTRFS="`echo ${OS} | cut -d ':' -f 5`" -@@ -277,9 +278,11 @@ EOF - echo "$title_correction_code" - ;; - macosx) -- OSXUUID="${UUID}" -- osx_entry xnu_kernel 32 -- osx_entry xnu_kernel64 64 -+ if [ "${UUID}" ]; then -+ OSXUUID="${UUID}" -+ osx_entry xnu_kernel 32 -+ osx_entry xnu_kernel64 64 -+ fi - ;; - hurd) - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" --- -2.4.3 - diff --git a/0078-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch b/0078-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch deleted file mode 100644 index e8b0efe..0000000 --- a/0078-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5a6db38d62235094a903882b71ef2749b4c19cbb Mon Sep 17 00:00:00 2001 -From: Piotr Krysiuk -Date: Sun, 20 Apr 2014 15:58:45 +0200 -Subject: [PATCH 078/506] Allow loading old kernels by placing GDT in - conventional memory. - ---- - ChangeLog | 5 +++++ - grub-core/lib/i386/relocator.c | 11 +++++++---- - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 30d0cac..1be8e5e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-04-20 Piotr Krysiuk -+ -+ * grub-core/lib/i386/relocator.c: Allow loading old kernels by placing -+ GDT in conventional memory. -+ - 2014-04-10 Colin Watson - - * util/grub.d/30_os-prober.in: Tolerate devices with no filesystem -diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c -index d2a1b27..ffaf25f 100644 ---- a/grub-core/lib/i386/relocator.c -+++ b/grub-core/lib/i386/relocator.c -@@ -81,10 +81,13 @@ grub_relocator32_boot (struct grub_relocator *rel, - void *relst; - grub_relocator_chunk_t ch; - -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, -- (0xffffffff - RELOCATOR_SIZEOF (32)) -- + 1, RELOCATOR_SIZEOF (32), 16, -- GRUB_RELOCATOR_PREFERENCE_NONE, -+ /* Specific memory range due to Global Descriptor Table for use by payload -+ that we will store in returned chunk. The address range and preference -+ are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */ -+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000, -+ 0x9a000 - RELOCATOR_SIZEOF (32), -+ RELOCATOR_SIZEOF (32), 16, -+ GRUB_RELOCATOR_PREFERENCE_LOW, - avoid_efi_bootservices); - if (err) - return err; --- -2.4.3 - diff --git a/0079-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch b/0079-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch deleted file mode 100644 index a9f26e9..0000000 --- a/0079-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 4b8b9135f1676924a8458da528d264bbc7bbb301 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 20 Apr 2014 16:12:41 +0200 -Subject: [PATCH 079/506] * grub-core/kern/misc.c (__bzero): Don't - compile in GRUB_UTIL. - - Reported by: Yves Blusseau . ---- - ChangeLog | 6 ++++++ - grub-core/kern/misc.c | 3 +++ - 2 files changed, 9 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 1be8e5e..ba5e205 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,9 @@ -+2014-04-20 Vladimir Serbinenko -+ -+ * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL. -+ -+ Reported by: Yves Blusseau . -+ - 2014-04-20 Piotr Krysiuk - - * grub-core/lib/i386/relocator.c: Allow loading old kernels by placing -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 54db2e1..c5c815d 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -542,6 +542,9 @@ memset (void *s, int c, grub_size_t n) - return grub_memset (s, c, n); - } - -+#endif -+ -+#if !defined(GRUB_UTIL) && defined(__APPLE__) - void GRUB_BUILTIN_ATTR - __bzero (void *s, grub_size_t n) - { --- -2.4.3 - diff --git a/0080-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch b/0080-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch deleted file mode 100644 index af147be..0000000 --- a/0080-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 480c89858e58a2360d62fdafbeda3e7080133e9e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 12 May 2014 10:01:48 +0200 -Subject: [PATCH 080/506] * grub-core/commands/verify.c - (grub_pubkey_open): Fix memdisk check. - ---- - ChangeLog | 5 +++++ - grub-core/commands/verify.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index ba5e205..c32d4c6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-06-21 Vladimir Serbinenko -+ -+ * grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk -+ check. -+ - 2014-04-20 Vladimir Serbinenko - - * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL. -diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c -index a9dfd88..6349ccf 100644 ---- a/grub-core/commands/verify.c -+++ b/grub-core/commands/verify.c -@@ -835,7 +835,7 @@ grub_pubkey_open (grub_file_t io, const char *filename) - - if (!sec) - return io; -- if (io->device->disk && io->device->disk->id == GRUB_DISK_DEVICE_MEMDISK_ID) -+ if (io->device->disk && io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID) - return io; - fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig")); - if (!fsuf) --- -2.4.3 - diff --git a/0081-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch b/0081-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch deleted file mode 100644 index 9af4537..0000000 --- a/0081-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 2c2c5c720d79c54af39a5a4423f2d6a48d21bfda Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 15 May 2014 14:36:48 +0200 -Subject: [PATCH 081/506] * grub-core/commands/verify.c - (grub_pubkey_open): Trust procfs. - ---- - ChangeLog | 4 ++++ - grub-core/commands/verify.c | 4 +++- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index c32d4c6..6d2f8c6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-06-21 Vladimir Serbinenko - -+ * grub-core/commands/verify.c (grub_pubkey_open): Trust procfs. -+ -+2014-06-21 Vladimir Serbinenko -+ - * grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk - check. - -diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c -index 6349ccf..525bdd1 100644 ---- a/grub-core/commands/verify.c -+++ b/grub-core/commands/verify.c -@@ -835,7 +835,9 @@ grub_pubkey_open (grub_file_t io, const char *filename) - - if (!sec) - return io; -- if (io->device->disk && io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID) -+ if (io->device->disk && -+ (io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID -+ || io->device->disk->dev->id == GRUB_DISK_DEVICE_PROCFS_ID)) - return io; - fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig")); - if (!fsuf) --- -2.4.3 - diff --git a/0082-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch b/0082-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch deleted file mode 100644 index 1e773b3..0000000 --- a/0082-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 87de66d9d83446ecddb29cfbdf7369102c8e209e Mon Sep 17 00:00:00 2001 -From: Trevor Woerner -Date: Sat, 21 Jun 2014 20:26:47 +0200 -Subject: [PATCH 082/506] * util/grub-gen-asciih.c (add_glyph): Fix - uninitialised variable. - ---- - ChangeLog | 4 ++++ - util/grub-gen-asciih.c | 15 +++++++++------ - 2 files changed, 13 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6d2f8c6..8929dbb 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-06-21 Trevor Woerner -+ -+ * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. -+ - 2014-06-21 Vladimir Serbinenko - - * grub-core/commands/verify.c (grub_pubkey_open): Trust procfs. -diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c -index e01447a..e35dcb7 100644 ---- a/util/grub-gen-asciih.c -+++ b/util/grub-gen-asciih.c -@@ -81,14 +81,14 @@ add_glyph (FT_UInt glyph_idx, FT_Face face, - err = FT_Load_Glyph (face, glyph_idx, flag); - if (err) - { -- printf ("Freetype Error %d loading glyph 0x%x for U+0x%x", -+ fprintf (stderr, "Freetype Error %d loading glyph 0x%x for U+0x%x", - err, glyph_idx, char_code); - - if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs)) -- printf (": %s\n", ft_errmsgs[err]); -+ fprintf (stderr, ": %s\n", ft_errmsgs[err]); - else -- printf ("\n"); -- return; -+ fprintf (stderr, "\n"); -+ exit (1); - } - - glyph = face->glyph; -@@ -128,7 +128,6 @@ add_glyph (FT_UInt glyph_idx, FT_Face face, - static void - write_font_ascii_bitmap (FILE *file, FT_Face face) - { -- struct grub_glyph_info glyph; - int char_code; - - fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n"); -@@ -138,10 +137,14 @@ write_font_ascii_bitmap (FILE *file, FT_Face face) - for (char_code = 0; char_code <= 0x7f; char_code++) - { - FT_UInt glyph_idx; -- -+ struct grub_glyph_info glyph; -+ - glyph_idx = FT_Get_Char_Index (face, char_code); - if (!glyph_idx) - return; -+ -+ memset (&glyph, 0, sizeof(glyph)); -+ - add_glyph (glyph_idx, face, char_code, &glyph); - - if (glyph.width == 8 && glyph.height == 16 --- -2.4.3 - diff --git a/0083-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch b/0083-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch deleted file mode 100644 index e491486..0000000 --- a/0083-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 3f3ec8ef44f484ef581d030b0d8500c8906b673f Mon Sep 17 00:00:00 2001 -From: Stephane Rochoy -Date: Sun, 22 Jun 2014 01:34:57 +0200 -Subject: [PATCH 083/506] * grub-core/commands/efi/lsefisystab.c - (grub_cmd_lsefisystab): Show EFI system table physical address. - ---- - ChangeLog | 5 +++++ - grub-core/commands/efi/lsefisystab.c | 1 + - 2 files changed, 6 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 8929dbb..1dba603 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-06-21 Stephane Rochoy -+ -+ * grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show -+ EFI system table physical address. -+ - 2014-06-21 Trevor Woerner - - * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. -diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c -index eda8c5f..8717db9 100644 ---- a/grub-core/commands/efi/lsefisystab.c -+++ b/grub-core/commands/efi/lsefisystab.c -@@ -52,6 +52,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)), - grub_efi_configuration_table_t *t; - unsigned int i; - -+ grub_printf ("Address: %p\n", st); - grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n", - st->hdr.signature, st->hdr.revision); - { --- -2.4.3 - diff --git a/0084-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch b/0084-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch deleted file mode 100644 index adef2b9..0000000 --- a/0084-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 15bd333e10b236fd24d17b2b23065f14d70ce478 Mon Sep 17 00:00:00 2001 -From: Stephane Rochoy -Date: Sun, 22 Jun 2014 01:35:52 +0200 -Subject: [PATCH 084/506] * grub-core/loader/i386/bsd.c - (grub_netbsd_boot): Pass pointer to EFI system table. - ---- - ChangeLog | 5 +++++ - grub-core/loader/i386/bsd.c | 8 ++++++++ - include/grub/i386/netbsd_bootinfo.h | 7 +++++++ - 3 files changed, 20 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 1dba603..ee46a4d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-06-21 Stephane Rochoy - -+ * grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to -+ EFI system table. -+ -+2014-06-21 Stephane Rochoy -+ - * grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show - EFI system table physical address. - -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 41ef910..8f691e0 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -1145,6 +1145,14 @@ grub_netbsd_boot (void) - if (err) - return err; - -+#ifdef GRUB_MACHINE_EFI -+ err = grub_bsd_add_meta (NETBSD_BTINFO_EFI, -+ &grub_efi_system_table, -+ sizeof (grub_efi_system_table)); -+ if (err) -+ return err; -+#endif -+ - { - struct bsd_tag *tag; - tag_buf_len = 0; -diff --git a/include/grub/i386/netbsd_bootinfo.h b/include/grub/i386/netbsd_bootinfo.h -index e48c19b..9b4f460 100644 ---- a/include/grub/i386/netbsd_bootinfo.h -+++ b/include/grub/i386/netbsd_bootinfo.h -@@ -58,6 +58,8 @@ - #define NETBSD_BTINFO_BOOTWEDGE 10 - #define NETBSD_BTINFO_MODULES 11 - #define NETBSD_BTINFO_FRAMEBUF 12 -+#define NETBSD_BTINFO_USERCONFCOMMANDS 13 -+#define NETBSD_BTINFO_EFI 14 - - struct grub_netbsd_bootinfo - { -@@ -146,4 +148,9 @@ struct grub_netbsd_btinfo_framebuf - - #define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16 - -+struct grub_netbsd_btinfo_efi -+{ -+ void *pa_systbl; /* Physical address of the EFI System Table */ -+}; -+ - #endif --- -2.4.3 - diff --git a/0085-util-grub-install.c-Fix-handling-of-disk-module.patch b/0085-util-grub-install.c-Fix-handling-of-disk-module.patch deleted file mode 100644 index 7ede9e3..0000000 --- a/0085-util-grub-install.c-Fix-handling-of-disk-module.patch +++ /dev/null @@ -1,47 +0,0 @@ -From fa33530870839e303354ff2660baeff5356ea736 Mon Sep 17 00:00:00 2001 -From: Glenn Washburn -Date: Sun, 22 Jun 2014 01:45:11 +0200 -Subject: [PATCH 085/506] * util/grub-install.c: Fix handling of - --disk-module. - ---- - ChangeLog | 4 ++++ - util/grub-install.c | 3 +-- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index ee46a4d..03eedb3 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-06-21 Glenn Washburn -+ -+ * util/grub-install.c: Fix handling of --disk-module. -+ - 2014-06-21 Stephane Rochoy - - * grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to -diff --git a/util/grub-install.c b/util/grub-install.c -index e9c6a46..7d61c32 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -94,7 +94,6 @@ enum - OPTION_RECHECK, - OPTION_FORCE, - OPTION_FORCE_FILE_ID, -- OPTION_MODULE, - OPTION_NO_NVRAM, - OPTION_REMOVABLE, - OPTION_BOOTLOADER_ID, -@@ -273,7 +272,7 @@ static struct argp_option options[] = { - N_("install even if problems are detected"), 2}, - {"force-file-id", OPTION_FORCE_FILE_ID, 0, 0, - N_("use identifier file even if UUID is available"), 2}, -- {"disk-module", OPTION_MODULE, N_("MODULE"), 0, -+ {"disk-module", OPTION_DISK_MODULE, N_("MODULE"), 0, - N_("disk module to use (biosdisk or native). " - "This option is only available on BIOS target."), 2}, - {"no-nvram", OPTION_NO_NVRAM, 0, 0, --- -2.4.3 - diff --git a/0086-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch b/0086-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch deleted file mode 100644 index 4333db9..0000000 --- a/0086-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 1f6af2a9f8b02a71f213b4717d8e62c8a6b14fc5 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: [PATCH 086/506] * grub-core/commands/loadenv.c - (check_blocklists): Fix overlap check. - ---- - ChangeLog | 4 ++++ - grub-core/commands/loadenv.c | 13 ++----------- - 2 files changed, 6 insertions(+), 11 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 03eedb3..be322d4 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-06-21 Роман Пехов -+ -+ * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check. -+ - 2014-06-21 Glenn Washburn - - * util/grub-install.c: Fix handling of --disk-module. -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. */ --- -2.4.3 - diff --git a/0087-docs-grub-dev.texi-Finding-your-way-around-The-build.patch b/0087-docs-grub-dev.texi-Finding-your-way-around-The-build.patch deleted file mode 100644 index 663ad93..0000000 --- a/0087-docs-grub-dev.texi-Finding-your-way-around-The-build.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 4250f552a6c78f5547d45c77b46ea11c5e8e394d Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 26 Jun 2014 14:20:17 +0100 -Subject: [PATCH 087/506] * docs/grub-dev.texi (Finding your way around): The - build system no longer uses AutoGen directly. - ---- - ChangeLog | 5 +++++ - docs/grub-dev.texi | 6 +++--- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index be322d4..5109c5a 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-06-26 Colin Watson -+ -+ * docs/grub-dev.texi (Finding your way around): The build system no -+ longer uses AutoGen directly. -+ - 2014-06-21 Роман Пехов - - * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check. -diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 7c6244c..a9f4de6 100644 ---- a/docs/grub-dev.texi -+++ b/docs/grub-dev.texi -@@ -228,12 +228,12 @@ The opening @samp{/*} and closing @samp{*/} should be placed together on a line - Here is a brief map of the GRUB code base. - - GRUB uses Autoconf and Automake, with most of the Automake input generated --by AutoGen. The top-level build rules are in @file{configure.ac}, -+by a Python script. The top-level build rules are in @file{configure.ac}, - @file{grub-core/Makefile.core.def}, and @file{Makefile.util.def}. Each - block in a @file{*.def} file represents a build target, and specifies the - source files used to build it on various platforms. The @file{*.def} files --are processed into AutoGen input by @file{gentpl.py} (which you only need to --look at if you are extending the build system). If you are adding a new -+are processed into Automake input by @file{gentpl.py} (which you only need -+to look at if you are extending the build system). If you are adding a new - module which follows an existing pattern, such as a new command or a new - filesystem implementation, it is usually easiest to grep - @file{grub-core/Makefile.core.def} and @file{Makefile.util.def} for an --- -2.4.3 - diff --git a/0088-Fix-an-infinite-loop-in-grub-mkconfig.patch b/0088-Fix-an-infinite-loop-in-grub-mkconfig.patch deleted file mode 100644 index 035945d..0000000 --- a/0088-Fix-an-infinite-loop-in-grub-mkconfig.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0901e7855f922e770cbfeb58262cb8fded518190 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Tue, 8 Jul 2014 23:54:30 +0100 -Subject: [PATCH 088/506] Fix an infinite loop in grub-mkconfig - -* util/grub.d/10_hurd.in: Make kernel list progression not fail on -kernels whose paths contain regex metacharacters. -* util/grub.d/10_kfreebsd.in: Likewise. -* util/grub.d/10_linux.in: Likewise. -* util/grub.d/20_linux_xen.in: Likewise. - -Reported by: Heimo Stranner. ---- - ChangeLog | 10 ++++++++++ - util/grub.d/10_hurd.in | 2 +- - util/grub.d/10_kfreebsd.in | 2 +- - util/grub.d/10_linux.in | 2 +- - util/grub.d/20_linux_xen.in | 4 ++-- - 5 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 5109c5a..ccd8ac1 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,13 @@ -+2014-07-08 Colin Watson -+ -+ * util/grub.d/10_hurd.in: Make kernel list progression not fail on -+ kernels whose paths contain regex metacharacters. -+ * util/grub.d/10_kfreebsd.in: Likewise. -+ * util/grub.d/10_linux.in: Likewise. -+ * util/grub.d/20_linux_xen.in: Likewise. -+ -+ Reported by: Heimo Stranner. -+ - 2014-06-26 Colin Watson - - * docs/grub-dev.texi (Finding your way around): The build system no -diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in -index 82dfe19..29b4554 100644 ---- a/util/grub.d/10_hurd.in -+++ b/util/grub.d/10_hurd.in -@@ -168,7 +168,7 @@ while [ "x$kernels" != "x" ] ; do - hurd_entry "$kernel" advanced - hurd_entry "$kernel" recovery - -- kernels=`echo $kernels | tr ' ' '\n' | grep -vx $kernel | tr '\n' ' '` -+ kernels=`echo $kernels | tr ' ' '\n' | fgrep -vx "$kernel" | tr '\n' ' '` - done - - # If at least one kernel was found, then we need to -diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in -index a524762..ba7175b 100644 ---- a/util/grub.d/10_kfreebsd.in -+++ b/util/grub.d/10_kfreebsd.in -@@ -228,7 +228,7 @@ while [ "x$list" != "x" ] ; do - kfreebsd_entry "${OS}" "${version}" recovery "-s" - fi - -- list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '` -+ list=`echo $list | tr ' ' '\n' | fgrep -vx "$kfreebsd" | tr '\n' ' '` - done - - # If at least one kernel was found, then we need to -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 00d1931..d2e2a8f 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -241,7 +241,7 @@ while [ "x$list" != "x" ] ; do - "single ${GRUB_CMDLINE_LINUX}" - fi - -- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` -+ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` - done - - # If at least one kernel was found, then we need to -diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index a608435..2e77758 100644 ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in -@@ -255,12 +255,12 @@ while [ "x${xen_list}" != "x" ] ; do - "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" - fi - -- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` -+ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` - done - 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 --- -2.4.3 - diff --git a/0089-grub-core-fs-cbfs.c-Don-t-probe-disks-of-unknow-size.patch b/0089-grub-core-fs-cbfs.c-Don-t-probe-disks-of-unknow-size.patch deleted file mode 100644 index 397bd91..0000000 --- a/0089-grub-core-fs-cbfs.c-Don-t-probe-disks-of-unknow-size.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 33f6ce671f984465e0f8f9c96927c087b6d0c1a1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 10 Aug 2014 09:50:36 +0200 -Subject: [PATCH 089/506] * grub-core/fs/cbfs.c: Don't probe disks of - unknow size. - - Fixes hang on virtualbox. ---- - ChangeLog | 4 ++++ - grub-core/fs/cbfs.c | 3 +++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index ccd8ac1..47ff355 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-08-10 Vladimir Serbinenko -+ -+ * grub-core/fs/cbfs.c: Don't probe disks of unknow size. -+ - 2014-07-08 Colin Watson - - * util/grub.d/10_hurd.in: Make kernel list progression not fail on -diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c -index 7ad1483..35750a0 100644 ---- a/grub-core/fs/cbfs.c -+++ b/grub-core/fs/cbfs.c -@@ -149,6 +149,9 @@ grub_cbfs_mount (grub_disk_t disk) - grub_off_t header_off; - struct cbfs_header head; - -+ if (grub_disk_get_size (disk) == GRUB_DISK_SIZE_UNKNOWN) -+ goto fail; -+ - if (grub_disk_read (disk, grub_disk_get_size (disk) - 1, - GRUB_DISK_SECTOR_SIZE - sizeof (ptr), - sizeof (ptr), &ptr)) --- -2.4.3 - diff --git a/0090-Fix-Changelog.patch b/0090-Fix-Changelog.patch deleted file mode 100644 index a92f8d4..0000000 --- a/0090-Fix-Changelog.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 79c80b06b80c680e584038537098b9e433415465 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 10 Aug 2014 10:04:04 +0200 -Subject: [PATCH 090/506] Fix Changelog - ---- - ChangeLog | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 47ff355..cab1427 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -2,6 +2,8 @@ - - * grub-core/fs/cbfs.c: Don't probe disks of unknow size. - -+ Fixes hang on virtualbox. -+ - 2014-07-08 Colin Watson - - * util/grub.d/10_hurd.in: Make kernel list progression not fail on --- -2.4.3 - diff --git a/0091-grub-core-disk-i386-pc-biosdisk.c-grub_biosdisk_rw-A.patch b/0091-grub-core-disk-i386-pc-biosdisk.c-grub_biosdisk_rw-A.patch deleted file mode 100644 index 08b419c..0000000 --- a/0091-grub-core-disk-i386-pc-biosdisk.c-grub_biosdisk_rw-A.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0af3ae2d8b31e31c991eb7dd1d4b79e698907c8d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 10 Aug 2014 11:27:13 +0200 -Subject: [PATCH 091/506] * grub-core/disk/i386/pc/biosdisk.c - (grub_biosdisk_rw): Add safety to avoid triggerring VirtualBox bug. - ---- - ChangeLog | 5 +++++ - grub-core/disk/i386/pc/biosdisk.c | 8 ++++++++ - 2 files changed, 13 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index cab1427..9e159a8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-08-10 Vladimir Serbinenko - -+ * grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Add -+ safety to avoid triggerring VirtualBox bug. -+ -+2014-08-10 Vladimir Serbinenko -+ - * grub-core/fs/cbfs.c: Don't probe disks of unknow size. - - Fixes hang on virtualbox. -diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c -index 1689539..6b21525 100644 ---- a/grub-core/disk/i386/pc/biosdisk.c -+++ b/grub-core/disk/i386/pc/biosdisk.c -@@ -455,6 +455,14 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, - { - struct grub_biosdisk_data *data = disk->data; - -+ /* VirtualBox fails with sectors above 2T on CDs. -+ Since even BD-ROMS are never that big anyway, return error. */ -+ if ((data->flags & GRUB_BIOSDISK_FLAG_CDROM) -+ && (sector >> 32)) -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, -+ N_("attempt to read or write outside of disk `%s'"), -+ disk->name); -+ - if (data->flags & GRUB_BIOSDISK_FLAG_LBA) - { - struct grub_biosdisk_dap *dap; --- -2.4.3 - diff --git a/0092-grub-core-kern-disk_common.c-Clump-disk-size-to-1EiB.patch b/0092-grub-core-kern-disk_common.c-Clump-disk-size-to-1EiB.patch deleted file mode 100644 index a0d369f..0000000 --- a/0092-grub-core-kern-disk_common.c-Clump-disk-size-to-1EiB.patch +++ /dev/null @@ -1,68 +0,0 @@ -From d1224d209be3fcfa5cea7b3e637cfc429f7d2345 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 10 Aug 2014 11:27:36 +0200 -Subject: [PATCH 092/506] * grub-core/kern/disk_common.c: Clump disk - size to 1EiB. - ---- - ChangeLog | 4 ++++ - grub-core/kern/disk_common.c | 22 ++++++++++++++++------ - 2 files changed, 20 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 9e159a8..6c389b0 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-08-10 Vladimir Serbinenko - -+ * grub-core/kern/disk_common.c: Clump disk size to 1EiB. -+ -+2014-08-10 Vladimir Serbinenko -+ - * grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Add - safety to avoid triggerring VirtualBox bug. - -diff --git a/grub-core/kern/disk_common.c b/grub-core/kern/disk_common.c -index fb19778..2ca12b5 100644 ---- a/grub-core/kern/disk_common.c -+++ b/grub-core/kern/disk_common.c -@@ -7,6 +7,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, - grub_off_t *offset, grub_size_t size) - { - grub_partition_t part; -+ grub_disk_addr_t total_sectors; -+ - *sector += *offset >> GRUB_DISK_SECTOR_BITS; - *offset &= GRUB_DISK_SECTOR_SIZE - 1; - -@@ -27,12 +29,20 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, - *sector += start; - } - -- if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN -- && ((disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) <= *sector -- || ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) -- >> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors -- << (disk->log_sector_size -- - GRUB_DISK_SECTOR_BITS)) - *sector)) -+ /* Transform total_sectors to number of 512B blocks. */ -+ total_sectors = disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); -+ -+ /* Some drivers have problems with disks above reasonable. -+ Treat unknown as 1EiB disk. While on it, clamp the size to 1EiB. -+ Just one condition is enough since GRUB_DISK_UNKNOWN_SIZE << ls is always -+ above 9EiB. -+ */ -+ if (total_sectors > (1ULL << 51)) -+ total_sectors = (1ULL << 51); -+ -+ if ((total_sectors <= *sector -+ || ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) -+ >> GRUB_DISK_SECTOR_BITS) > total_sectors - *sector)) - return grub_error (GRUB_ERR_OUT_OF_RANGE, - N_("attempt to read or write outside of disk `%s'"), disk->name); - --- -2.4.3 - diff --git a/0093-grub-core-term-at_keyboard.c-Retry-probing-keyboard-.patch b/0093-grub-core-term-at_keyboard.c-Retry-probing-keyboard-.patch deleted file mode 100644 index 67fdd84..0000000 --- a/0093-grub-core-term-at_keyboard.c-Retry-probing-keyboard-.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 3c058332499f6c0185c167a7faf37afa808136b7 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 13 Aug 2014 23:04:01 +0200 -Subject: [PATCH 093/506] * grub-core/term/at_keyboard.c: Retry probing - keyboard if scancode setup failed. - ---- - ChangeLog | 5 +++++ - grub-core/term/at_keyboard.c | 11 +++++------ - 2 files changed, 10 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6c389b0..22030fd 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-08-13 Vladimir Serbinenko -+ -+ * grub-core/term/at_keyboard.c: Retry probing keyboard if -+ scancode setup failed. -+ - 2014-08-10 Vladimir Serbinenko - - * grub-core/kern/disk_common.c: Clump disk size to 1EiB. -diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index b4257e8..c234e92 100644 ---- a/grub-core/term/at_keyboard.c -+++ b/grub-core/term/at_keyboard.c -@@ -226,7 +226,7 @@ static const struct - {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, - }; - --static int alive = 0, ping_sent; -+static int ping_sent; - - static void - keyboard_controller_wait_until_ready (void) -@@ -373,7 +373,7 @@ set_scancodes (void) - grub_dprintf ("atkeyb", "returned set %d\n", current_set); - if (current_set == 1) - return; -- grub_printf ("No supported scancode set found\n"); -+ grub_dprintf ("atkeyb", "no supported scancode set found\n"); - #endif - } - -@@ -543,7 +543,7 @@ grub_keyboard_getkey (void) - int - grub_at_keyboard_is_alive (void) - { -- if (alive) -+ if (current_set != 0) - return 1; - if (ping_sent - && KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)) -@@ -611,7 +611,6 @@ static void - grub_keyboard_controller_init (void) - { - at_keyboard_status = 0; -- alive = 1; - /* Drain input buffer. */ - while (1) - { -@@ -639,7 +638,7 @@ grub_keyboard_controller_init (void) - static grub_err_t - grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) - { -- if (!alive) -+ if (current_set == 0) - return GRUB_ERR_NONE; - if (grub_keyboard_orig_set) - write_mode (grub_keyboard_orig_set); -@@ -656,7 +655,7 @@ grub_at_fini_hw (int noreturn __attribute__ ((unused))) - static grub_err_t - grub_at_restore_hw (void) - { -- if (!alive) -+ if (current_set == 0) - return GRUB_ERR_NONE; - - /* Drain input buffer. */ --- -2.4.3 - diff --git a/0094-Fix-typo-gettext_print-instead-of-gettext_printf.patch b/0094-Fix-typo-gettext_print-instead-of-gettext_printf.patch deleted file mode 100644 index 4f06645..0000000 --- a/0094-Fix-typo-gettext_print-instead-of-gettext_printf.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c291f47b2c003ef6daeafaedd458db838bad6fb8 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Thu, 14 Aug 2014 21:02:31 +0400 -Subject: [PATCH 094/506] Fix typo (gettext_print instead of gettext_printf) - ---- - ChangeLog | 5 +++++ - util/grub-mkconfig.in | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 22030fd..a8f379b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-08-14 Andrey Borzenkov -+ -+ * util/grub-mkconfig.in: Fix typo (gettext_print instead of -+ gettext_printf). -+ - 2014-08-13 Vladimir Serbinenko - - * grub-core/term/at_keyboard.c: Retry probing keyboard if -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index ca040dd..d1fae49 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -124,7 +124,7 @@ set $grub_probe dummy - if test -f "$1"; then - : - else -- gettext_print "%s: Not found.\n" "$1" 1>&2 -+ gettext_printf "%s: Not found.\n" "$1" 1>&2 - exit 1 - fi - --- -2.4.3 - diff --git a/0095-grub-core-kern-mips-arc-init.c-grub_machine_get_boot.patch b/0095-grub-core-kern-mips-arc-init.c-grub_machine_get_boot.patch deleted file mode 100644 index 0c2595a..0000000 --- a/0095-grub-core-kern-mips-arc-init.c-grub_machine_get_boot.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 1de3a48098053aaebd35232bd73e3ce3f3fdf51c Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Mon, 25 Aug 2014 15:19:48 -0700 -Subject: [PATCH 095/506] * grub-core/kern/mips/arc/init.c - (grub_machine_get_bootlocation): Initialise pend to pacify GCC. - ---- - ChangeLog | 5 +++++ - grub-core/kern/mips/arc/init.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index a8f379b..6a99e2a 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-08-25 Colin Watson -+ -+ * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation): -+ Initialise pend to pacify GCC. -+ - 2014-08-14 Andrey Borzenkov - - * util/grub-mkconfig.in: Fix typo (gettext_print instead of -diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index b4f50e4..3834a14 100644 ---- a/grub-core/kern/mips/arc/init.c -+++ b/grub-core/kern/mips/arc/init.c -@@ -360,7 +360,7 @@ grub_machine_get_bootlocation (char **device, char **path) - char *loaddev = boot_location; - char *pptr, *partptr; - char *dname; -- grub_disk_addr_t poff = -1, pend; -+ grub_disk_addr_t poff = -1, pend = -1; - struct get_device_name_ctx ctx; - grub_disk_t parent = 0; - unsigned i; --- -2.4.3 - diff --git a/0096-configure.ac-Remove-several-unnecessary-semicolons.patch b/0096-configure.ac-Remove-several-unnecessary-semicolons.patch deleted file mode 100644 index 3e532fa..0000000 --- a/0096-configure.ac-Remove-several-unnecessary-semicolons.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 4d94b2db58e5d6e3d6e451ab294cd9def33f7aef Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Sun, 7 Sep 2014 20:47:43 +0100 -Subject: [PATCH 096/506] * configure.ac: Remove several unnecessary - semicolons. - ---- - ChangeLog | 4 ++++ - configure.ac | 36 ++++++++++++++++++------------------ - 2 files changed, 22 insertions(+), 18 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6a99e2a..4e422b8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-09-07 Colin Watson -+ -+ * configure.ac: Remove several unnecessary semicolons. -+ - 2014-08-25 Colin Watson - - * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation): -diff --git a/configure.ac b/configure.ac -index 8888c2f..a3610e1 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -90,18 +90,18 @@ case "$target_cpu" in - amd64) target_cpu=x86_64 ;; - sparc) target_cpu=sparc64 ;; - mipsel|mips64el) -- target_cpu=mipsel; -- machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; -+ target_cpu=mipsel -+ machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1" - ;; - mips|mips64) -- target_cpu=mips; -- machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; -+ target_cpu=mips -+ machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1" - ;; - arm*) -- target_cpu=arm; -+ target_cpu=arm - ;; - aarch64*) -- target_cpu=arm64; -+ target_cpu=arm64 - ;; - esac - -@@ -178,7 +178,7 @@ if test x$platform != xemu ; then - fi - - if test x"$target_cpu-$platform" = xsparc64-emu ; then -- target_m64=1 ; -+ target_m64=1 - fi - - case "$target_os" in -@@ -742,7 +742,7 @@ if test x"$efiemu_excuse" = x ; then - ]], [[]])], [flag=1], [flag=0]) - if test x"$flag" = x1; then - grub_cv_target_cc_efiemu64_link_format="$format" -- break; -+ break - fi - done]) - if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then -@@ -775,12 +775,12 @@ if test x"$platform" = xemu ; then - ;; - *windows* | *cygwin* | *mingw*) - if test x${target_cpu} = xi386 ; then -- grub_cv_target_cc_link_format=-mi386pe; -- TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'; -+ grub_cv_target_cc_link_format=-mi386pe -+ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' - fi - if test x${target_cpu} = xx86_64 ; then -- grub_cv_target_cc_link_format=-mi386pep; -- TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'; -+ grub_cv_target_cc_link_format=-mi386pep -+ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' - fi - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" - ;; -@@ -806,7 +806,7 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then - ]], [[]])], [flag=1], [flag=0]) - if test x"$flag" = x1; then - grub_cv_target_cc_link_format="$format" -- break; -+ break - fi - done]) - if test x"$grub_cv_target_cc_link_format" = xunknown; then -@@ -814,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then - fi - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" - if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then -- TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'; -+ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' - fi - if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then -- TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'; -+ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' - fi - fi - -@@ -995,7 +995,7 @@ if test "$target_cpu" = arm; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) - if test x"$flag" = x1; then - grub_cv_target_cc_strict_align="$arg" -- break; -+ break - fi - done]) - -@@ -1416,7 +1416,7 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do - md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')" - # PCF and BDF from version 6.3 isn't hanled properly by libfreetype. - if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then -- continue; -+ continue - fi - FONT_SOURCE="$dir/unifont.$ext" - break 2 -@@ -1501,7 +1501,7 @@ if test x"$device_mapper_excuse" = x ; then - fi - - if test x"$device_mapper_excuse" = x ; then -- LIBDEVMAPPER="-ldevmapper"; -+ LIBDEVMAPPER="-ldevmapper" - AC_DEFINE([HAVE_DEVICE_MAPPER], [1], - [Define to 1 if you have the devmapper library.]) - fi --- -2.4.3 - diff --git a/0097-Support-grub-emu-on-x32-ILP32-but-with-x86-64-instru.patch b/0097-Support-grub-emu-on-x32-ILP32-but-with-x86-64-instru.patch deleted file mode 100644 index 1ed0bca..0000000 --- a/0097-Support-grub-emu-on-x32-ILP32-but-with-x86-64-instru.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 2a5a532c0047d4eff90175936b220b638cce1013 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Sun, 7 Sep 2014 23:04:35 +0100 -Subject: [PATCH 097/506] Support grub-emu on x32 (ILP32 but with x86-64 - instruction set) - -* configure.ac: Remove -m64 from checks for -mcmodel=large and --mno-red-zone. These are always either unnecessary (x86_64-emu) or -already in TARGET_CFLAGS at this point, and they produce incorrect -results when building for x32. -* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast -pointers to Elf64_Xword via grub_addr_t, in order to work on x32. -* include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P, -GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32. ---- - ChangeLog | 13 +++++++++++++ - configure.ac | 4 ++-- - grub-core/kern/x86_64/dl.c | 4 ++-- - include/grub/x86_64/types.h | 6 +++++- - 4 files changed, 22 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 4e422b8..572ee50 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,18 @@ - 2014-09-07 Colin Watson - -+ Support grub-emu on x32 (ILP32 but with x86-64 instruction set) -+ -+ * configure.ac: Remove -m64 from checks for -mcmodel=large and -+ -mno-red-zone. These are always either unnecessary (x86_64-emu) or -+ already in TARGET_CFLAGS at this point, and they produce incorrect -+ results when building for x32. -+ * grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast -+ pointers to Elf64_Xword via grub_addr_t, in order to work on x32. -+ * include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P, -+ GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32. -+ -+2014-09-07 Colin Watson -+ - * configure.ac: Remove several unnecessary semicolons. - - 2014-08-25 Colin Watson -diff --git a/configure.ac b/configure.ac -index a3610e1..8662bac 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -862,7 +862,7 @@ LDFLAGS="$TARGET_LDFLAGS" - if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then - # Use large model to support 4G memory - AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ -- CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large" -+ CFLAGS="$TARGET_CFLAGS -mcmodel=large" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_mcmodel=yes], - [grub_cv_cc_mcmodel=no]) -@@ -877,7 +877,7 @@ fi - if test "$target_cpu"-"$platform" = x86_64-efi; then - # EFI writes to stack below %rsp, we must not use the red zone - AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ -- CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone" -+ CFLAGS="$TARGET_CFLAGS -mno-red-zone" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_no_red_zone=yes], - [grub_cv_cc_no_red_zone=no]) -diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c -index 6cb88bf..4406906 100644 ---- a/grub-core/kern/x86_64/dl.c -+++ b/grub-core/kern/x86_64/dl.c -@@ -73,7 +73,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - { - grub_int64_t value; - value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - -- (Elf64_Xword) seg->addr - rel->r_offset; -+ (Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset; - if (value != (grub_int32_t) value) - return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range"); - *addr32 = value; -@@ -83,7 +83,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - case R_X86_64_PC64: - { - *addr64 += rel->r_addend + sym->st_value - -- (Elf64_Xword) seg->addr - rel->r_offset; -+ (Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset; - } - break; - -diff --git a/include/grub/x86_64/types.h b/include/grub/x86_64/types.h -index fec9109..0bbdc6d 100644 ---- a/include/grub/x86_64/types.h -+++ b/include/grub/x86_64/types.h -@@ -20,10 +20,14 @@ - #define GRUB_TYPES_CPU_HEADER 1 - - /* The size of void *. */ -+#ifdef __ILP32__ -+#define GRUB_TARGET_SIZEOF_VOID_P 4 -+#else - #define GRUB_TARGET_SIZEOF_VOID_P 8 -+#endif - - /* The size of long. */ --#ifdef __MINGW32__ -+#if defined(__MINGW32__) || defined(__ILP32__) - #define GRUB_TARGET_SIZEOF_LONG 4 - #else - #define GRUB_TARGET_SIZEOF_LONG 8 --- -2.4.3 - diff --git a/0098-Fix-incorrect-address-reference-in-btrfs.patch b/0098-Fix-incorrect-address-reference-in-btrfs.patch deleted file mode 100644 index 6378305..0000000 --- a/0098-Fix-incorrect-address-reference-in-btrfs.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 54bd9a061083b916d3563101d147a01e002486aa Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 14 Aug 2014 18:17:45 +0800 -Subject: [PATCH 098/506] Fix incorrect address reference in btrfs - -We encountered a weird random kernel initrd unpacking error on btrfs -and finally found it was caused by incorrect address reference in range -check for type GRUB_BTRFS_EXTENT_REGULAR and the entire result is -unpredictable. - -This is a quick fix to make the address reference to the -grub_btrfs_extent_data structure correctly, not the pointer variable -to it. - -Any suggestions to this patch is welcome. ---- - ChangeLog | 6 ++++++ - grub-core/fs/btrfs.c | 2 +- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 572ee50..0676065 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,9 @@ -+2014-09-08 Michael Chang -+ -+ * grub-core/fs/btrfs.c (grub_btrfs_extent_read): Fix extent size -+ check; comparing &data->extent against addresses in the region it -+ points to is unpredictable. -+ - 2014-09-07 Colin Watson - - Support grub-emu on x32 (ILP32 but with x86-64 instruction set) -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index f7b6c15..95a8fa6 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -1051,7 +1051,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data, - - 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); --- -2.4.3 - diff --git a/0099-Fix-build-with-glibc-2.20.patch b/0099-Fix-build-with-glibc-2.20.patch deleted file mode 100644 index 1529ec0..0000000 --- a/0099-Fix-build-with-glibc-2.20.patch +++ /dev/null @@ -1,47 +0,0 @@ -From a276b840464629fdaecbe7e813f83a717a34993a Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 3 Sep 2014 01:15:08 -0700 -Subject: [PATCH 099/506] Fix build with glibc 2.20 - -* 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 ---- - ChangeLog | 4 ++++ - grub-core/kern/emu/hostfs.c | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 0676065..ea011b7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-09-15 Khem Raj -+ * grub-core/kern/emu/hostfs.c: use _DEFAULT_SOURCE in addition to -+ _BSD_SOURCE to avoid warnings under glibc 2.20+. -+ - 2014-09-08 Michael Chang - - * grub-core/fs/btrfs.c (grub_btrfs_extent_read): Fix extent size -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.4.3 - diff --git a/0100-Tidy-up-ChangeLog-formatting.patch b/0100-Tidy-up-ChangeLog-formatting.patch deleted file mode 100644 index 2b75a71..0000000 --- a/0100-Tidy-up-ChangeLog-formatting.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 60049a0e7204c267fc867ce8de31421613af0b69 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Fri, 19 Sep 2014 14:50:51 +0100 -Subject: [PATCH 100/506] Tidy up ChangeLog formatting. - ---- - ChangeLog | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index ea011b7..2bbf501 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,4 +1,5 @@ --2014-09-15 Khem Raj -+2014-09-15 Khem Raj -+ - * grub-core/kern/emu/hostfs.c: use _DEFAULT_SOURCE in addition to - _BSD_SOURCE to avoid warnings under glibc 2.20+. - --- -2.4.3 - diff --git a/0101-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch b/0101-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch deleted file mode 100644 index ed39b5f..0000000 --- a/0101-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 631a82003851ca68bfaf87e12be5c94e14cd2a91 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 17 Sep 2014 16:30:11 -0400 -Subject: [PATCH 101/506] 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 ---- - ChangeLog | 12 ++++++++++++ - 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 +- - 9 files changed, 20 insertions(+), 8 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 2bbf501..1c79b77 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,15 @@ -+2014-21-15 Peter Jones -+ -+ * grub-core/loader/arm/linux.c: Initialized initrd_ctx so -+ we don't free a random pointer from the stack. -+ * grub-core/loader/arm64/linux.c: Likewise. -+ * grub-core/loader/i386/linux.c: Likewise. -+ * grub-core/loader/i386/pc/linux.c: Likewise. -+ * grub-core/loader/ia64/efi/linux.c: Likewise. -+ * grub-core/loader/mips/linux.c: Likewise. -+ * grub-core/loader/powerpc/ieee1275/linux.c: Likewise. -+ * grub-core/loader/sparc64/ieee1275/linux.c: Likewise. -+ - 2014-09-15 Khem Raj - - * grub-core/kern/emu/hostfs.c: use _DEFAULT_SOURCE in addition to -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) - { --- -2.4.3 - diff --git a/0102-grub-core-osdep-unix-config.c-Remove-extraneous-comm.patch b/0102-grub-core-osdep-unix-config.c-Remove-extraneous-comm.patch deleted file mode 100644 index f13a628..0000000 --- a/0102-grub-core-osdep-unix-config.c-Remove-extraneous-comm.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0aece00c54aa6a6ac316c619a1ad31ec3190aca2 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Sun, 21 Sep 2014 17:49:13 +0200 -Subject: [PATCH 102/506] * grub-core/osdep/unix/config.c: Remove - extraneous comma. - ---- - ChangeLog | 6 +++++- - grub-core/commands/keylayouts.c | 4 +++- - grub-core/gmodule.pl.in | 2 +- - grub-core/normal/main.c | 10 +++++++--- - grub-core/normal/menu.c | 2 +- - grub-core/normal/menu_entry.c | 2 +- - grub-core/osdep/unix/config.c | 4 ++-- - grub-core/tests/cmdline_cat_test.c | 2 +- - include/grub/normal.h | 2 +- - 9 files changed, 22 insertions(+), 12 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 1c79b77..bac248c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,4 +1,8 @@ --2014-21-15 Peter Jones -+2014-09-21 Michael Chang -+ -+ * grub-core/osdep/unix/config.c: Remove extraneous comma. -+ -+2014-09-21 Peter Jones - - * grub-core/loader/arm/linux.c: Initialized initrd_ctx so - we don't free a random pointer from the stack. -diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c -index da04389..f4b7730 100644 ---- a/grub-core/commands/keylayouts.c -+++ b/grub-core/commands/keylayouts.c -@@ -173,8 +173,10 @@ grub_term_map_key (grub_keyboard_key_t code, int status) - - key = map_key_core (code, status, &alt_gr_consumed); - -- if (key == 0 || key == GRUB_TERM_SHIFT) -+ if (key == 0 || key == GRUB_TERM_SHIFT) { - grub_printf ("Unknown key 0x%x detected\n", code); -+ return GRUB_TERM_NO_KEY; -+ } - - if (status & GRUB_TERM_STATUS_CAPS) - { -diff --git a/grub-core/gmodule.pl.in b/grub-core/gmodule.pl.in -index 6739a6f..78aa1e6 100644 ---- a/grub-core/gmodule.pl.in -+++ b/grub-core/gmodule.pl.in -@@ -23,7 +23,7 @@ while (<>) { - } - - print " -s $2 $sections{$1}" -- if ($sections{$1} ne '0x0'); -+ if ($sections{$1} ne '0x0' and $sections{$1} ne ''); - }; - close (READELF); - print "\n"; -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 3a926fc..c41f175 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -302,7 +302,7 @@ grub_enter_normal_mode (const char *config) - nested_level++; - grub_normal_execute (config, 0, 0); - grub_boot_time ("Entering shell"); -- grub_cmdline_run (0); -+ grub_cmdline_run (0, 1); - nested_level--; - if (grub_normal_exit_level) - grub_normal_exit_level--; -@@ -424,11 +424,15 @@ grub_normal_read_line (char **line, int cont, - } - - void --grub_cmdline_run (int nested) -+grub_cmdline_run (int nested, int force_auth) - { - grub_err_t err = GRUB_ERR_NONE; - -- err = grub_auth_check_authentication (NULL); -+ do -+ { -+ err = grub_auth_check_authentication (NULL); -+ } -+ while (err && force_auth); - - if (err) - { -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index b47991a..719e2fb 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -773,7 +773,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - - case 'c': - menu_fini (); -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - goto refresh; - - case 'e': -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index b485df8..62c7e16 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -1396,7 +1396,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - - case GRUB_TERM_CTRL | 'c': - case GRUB_TERM_KEY_F2: -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - goto refresh; - - case GRUB_TERM_CTRL | 'x': -diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index f4b0bb4..65effa9 100644 ---- a/grub-core/osdep/unix/config.c -+++ b/grub-core/osdep/unix/config.c -@@ -105,8 +105,8 @@ grub_util_load_config (struct grub_util_config *cfg) - *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\""); - - argv[2] = script; - argv[3] = '\0'; -diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c -index c3de5c4..f1e2143 100644 ---- a/grub-core/tests/cmdline_cat_test.c -+++ b/grub-core/tests/cmdline_cat_test.c -@@ -109,7 +109,7 @@ cmdline_cat_test (void) - grub_video_checksum ("cmdline_cat"); - - if (!grub_test_use_gfxterm ()) -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - - grub_test_use_gfxterm_end (); - -diff --git a/include/grub/normal.h b/include/grub/normal.h -index c4ab193..218cbab 100644 ---- a/include/grub/normal.h -+++ b/include/grub/normal.h -@@ -66,7 +66,7 @@ void grub_menu_init_page (int nested, int edit, - struct grub_term_output *term); - void grub_normal_init_page (struct grub_term_output *term, int y); - char *grub_file_getline (grub_file_t file); --void grub_cmdline_run (int nested); -+void grub_cmdline_run (int nested, int force_auth); - - /* Defined in `cmdline.c'. */ - char *grub_cmdline_get (const char *prompt); --- -2.4.3 - diff --git a/0103-Fix-wrong-commit.patch b/0103-Fix-wrong-commit.patch deleted file mode 100644 index 49c36c6..0000000 --- a/0103-Fix-wrong-commit.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 5e42618e001ab28346ee1a3f4591977afda7f2f5 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 21 Sep 2014 18:18:03 +0200 -Subject: [PATCH 103/506] Fix wrong commit - ---- - grub-core/commands/keylayouts.c | 4 +--- - grub-core/gmodule.pl.in | 2 +- - grub-core/normal/main.c | 10 +++------- - grub-core/normal/menu.c | 2 +- - grub-core/normal/menu_entry.c | 2 +- - grub-core/tests/cmdline_cat_test.c | 2 +- - include/grub/normal.h | 2 +- - 7 files changed, 9 insertions(+), 15 deletions(-) - -diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c -index f4b7730..da04389 100644 ---- a/grub-core/commands/keylayouts.c -+++ b/grub-core/commands/keylayouts.c -@@ -173,10 +173,8 @@ grub_term_map_key (grub_keyboard_key_t code, int status) - - key = map_key_core (code, status, &alt_gr_consumed); - -- if (key == 0 || key == GRUB_TERM_SHIFT) { -+ if (key == 0 || key == GRUB_TERM_SHIFT) - grub_printf ("Unknown key 0x%x detected\n", code); -- return GRUB_TERM_NO_KEY; -- } - - if (status & GRUB_TERM_STATUS_CAPS) - { -diff --git a/grub-core/gmodule.pl.in b/grub-core/gmodule.pl.in -index 78aa1e6..6739a6f 100644 ---- a/grub-core/gmodule.pl.in -+++ b/grub-core/gmodule.pl.in -@@ -23,7 +23,7 @@ while (<>) { - } - - print " -s $2 $sections{$1}" -- if ($sections{$1} ne '0x0' and $sections{$1} ne ''); -+ if ($sections{$1} ne '0x0'); - }; - close (READELF); - print "\n"; -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c41f175..3a926fc 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -302,7 +302,7 @@ grub_enter_normal_mode (const char *config) - nested_level++; - grub_normal_execute (config, 0, 0); - grub_boot_time ("Entering shell"); -- grub_cmdline_run (0, 1); -+ grub_cmdline_run (0); - nested_level--; - if (grub_normal_exit_level) - grub_normal_exit_level--; -@@ -424,15 +424,11 @@ grub_normal_read_line (char **line, int cont, - } - - void --grub_cmdline_run (int nested, int force_auth) -+grub_cmdline_run (int nested) - { - grub_err_t err = GRUB_ERR_NONE; - -- do -- { -- err = grub_auth_check_authentication (NULL); -- } -- while (err && force_auth); -+ err = grub_auth_check_authentication (NULL); - - if (err) - { -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 719e2fb..b47991a 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -773,7 +773,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - - case 'c': - menu_fini (); -- grub_cmdline_run (1, 0); -+ grub_cmdline_run (1); - goto refresh; - - case 'e': -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index 62c7e16..b485df8 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -1396,7 +1396,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - - case GRUB_TERM_CTRL | 'c': - case GRUB_TERM_KEY_F2: -- grub_cmdline_run (1, 0); -+ grub_cmdline_run (1); - goto refresh; - - case GRUB_TERM_CTRL | 'x': -diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c -index f1e2143..c3de5c4 100644 ---- a/grub-core/tests/cmdline_cat_test.c -+++ b/grub-core/tests/cmdline_cat_test.c -@@ -109,7 +109,7 @@ cmdline_cat_test (void) - grub_video_checksum ("cmdline_cat"); - - if (!grub_test_use_gfxterm ()) -- grub_cmdline_run (1, 0); -+ grub_cmdline_run (1); - - grub_test_use_gfxterm_end (); - -diff --git a/include/grub/normal.h b/include/grub/normal.h -index 218cbab..c4ab193 100644 ---- a/include/grub/normal.h -+++ b/include/grub/normal.h -@@ -66,7 +66,7 @@ void grub_menu_init_page (int nested, int edit, - struct grub_term_output *term); - void grub_normal_init_page (struct grub_term_output *term, int y); - char *grub_file_getline (grub_file_t file); --void grub_cmdline_run (int nested, int force_auth); -+void grub_cmdline_run (int nested); - - /* Defined in `cmdline.c'. */ - char *grub_cmdline_get (const char *prompt); --- -2.4.3 - diff --git a/0104-grub-core-gmodule.pl.in-Accept-newer-binutils-which-.patch b/0104-grub-core-gmodule.pl.in-Accept-newer-binutils-which-.patch deleted file mode 100644 index dacedbd..0000000 --- a/0104-grub-core-gmodule.pl.in-Accept-newer-binutils-which-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 2988a849fcf9f7b3c9fca94a4b1cd5913ca4c912 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 21 Sep 2014 18:23:23 +0200 -Subject: [PATCH 104/506] * grub-core/gmodule.pl.in: Accept newer - binutils which output empty column rather than 0x0. - ---- - ChangeLog | 5 +++++ - grub-core/gmodule.pl.in | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index bac248c..163265b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-09-21 Vladimir Serbinenko -+ -+ * grub-core/gmodule.pl.in: Accept newer binutils which output -+ empty column rather than 0x0. -+ - 2014-09-21 Michael Chang - - * grub-core/osdep/unix/config.c: Remove extraneous comma. -diff --git a/grub-core/gmodule.pl.in b/grub-core/gmodule.pl.in -index 6739a6f..78aa1e6 100644 ---- a/grub-core/gmodule.pl.in -+++ b/grub-core/gmodule.pl.in -@@ -23,7 +23,7 @@ while (<>) { - } - - print " -s $2 $sections{$1}" -- if ($sections{$1} ne '0x0'); -+ if ($sections{$1} ne '0x0' and $sections{$1} ne ''); - }; - close (READELF); - print "\n"; --- -2.4.3 - diff --git a/0105-grub-core-commands-keylayouts.c-Ignore-unknown-keys.patch b/0105-grub-core-commands-keylayouts.c-Ignore-unknown-keys.patch deleted file mode 100644 index ff31225..0000000 --- a/0105-grub-core-commands-keylayouts.c-Ignore-unknown-keys.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 7c378c3964a19ae6da0648ca18cf37308b072629 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 21 Sep 2014 18:49:49 +0200 -Subject: [PATCH 105/506] * grub-core/commands/keylayouts.c: Ignore - unknown keys. - ---- - ChangeLog | 4 ++++ - grub-core/commands/keylayouts.c | 4 +++- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 163265b..6d4e295 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-09-21 Vladimir Serbinenko - -+ * grub-core/commands/keylayouts.c: Ignore unknown keys. -+ -+2014-09-21 Vladimir Serbinenko -+ - * grub-core/gmodule.pl.in: Accept newer binutils which output - empty column rather than 0x0. - -diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c -index da04389..f4b7730 100644 ---- a/grub-core/commands/keylayouts.c -+++ b/grub-core/commands/keylayouts.c -@@ -173,8 +173,10 @@ grub_term_map_key (grub_keyboard_key_t code, int status) - - key = map_key_core (code, status, &alt_gr_consumed); - -- if (key == 0 || key == GRUB_TERM_SHIFT) -+ if (key == 0 || key == GRUB_TERM_SHIFT) { - grub_printf ("Unknown key 0x%x detected\n", code); -+ return GRUB_TERM_NO_KEY; -+ } - - if (status & GRUB_TERM_STATUS_CAPS) - { --- -2.4.3 - diff --git a/0106-grub-core-normal-main.c-Don-t-drop-to-rescue-console.patch b/0106-grub-core-normal-main.c-Don-t-drop-to-rescue-console.patch deleted file mode 100644 index d5ef595..0000000 --- a/0106-grub-core-normal-main.c-Don-t-drop-to-rescue-console.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 41c6f91fce842b6c9565b8a61bf6289ba0f5cd6a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 21 Sep 2014 18:51:09 +0200 -Subject: [PATCH 106/506] * grub-core/normal/main.c: Don't drop to - rescue console in case of password-protected prompt and no menu entries. - ---- - ChangeLog | 5 +++++ - grub-core/normal/main.c | 10 +++++++--- - grub-core/normal/menu.c | 2 +- - grub-core/normal/menu_entry.c | 2 +- - grub-core/tests/cmdline_cat_test.c | 2 +- - include/grub/normal.h | 2 +- - 6 files changed, 16 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6d4e295..002461c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2014-09-21 Vladimir Serbinenko - -+ * grub-core/normal/main.c: Don't drop to rescue console in -+ case of password-protected prompt and no menu entries. -+ -+2014-09-21 Vladimir Serbinenko -+ - * grub-core/commands/keylayouts.c: Ignore unknown keys. - - 2014-09-21 Vladimir Serbinenko -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 3a926fc..c41f175 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -302,7 +302,7 @@ grub_enter_normal_mode (const char *config) - nested_level++; - grub_normal_execute (config, 0, 0); - grub_boot_time ("Entering shell"); -- grub_cmdline_run (0); -+ grub_cmdline_run (0, 1); - nested_level--; - if (grub_normal_exit_level) - grub_normal_exit_level--; -@@ -424,11 +424,15 @@ grub_normal_read_line (char **line, int cont, - } - - void --grub_cmdline_run (int nested) -+grub_cmdline_run (int nested, int force_auth) - { - grub_err_t err = GRUB_ERR_NONE; - -- err = grub_auth_check_authentication (NULL); -+ do -+ { -+ err = grub_auth_check_authentication (NULL); -+ } -+ while (err && force_auth); - - if (err) - { -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index b47991a..719e2fb 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -773,7 +773,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - - case 'c': - menu_fini (); -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - goto refresh; - - case 'e': -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index b485df8..62c7e16 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -1396,7 +1396,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - - case GRUB_TERM_CTRL | 'c': - case GRUB_TERM_KEY_F2: -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - goto refresh; - - case GRUB_TERM_CTRL | 'x': -diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c -index c3de5c4..f1e2143 100644 ---- a/grub-core/tests/cmdline_cat_test.c -+++ b/grub-core/tests/cmdline_cat_test.c -@@ -109,7 +109,7 @@ cmdline_cat_test (void) - grub_video_checksum ("cmdline_cat"); - - if (!grub_test_use_gfxterm ()) -- grub_cmdline_run (1); -+ grub_cmdline_run (1, 0); - - grub_test_use_gfxterm_end (); - -diff --git a/include/grub/normal.h b/include/grub/normal.h -index c4ab193..218cbab 100644 ---- a/include/grub/normal.h -+++ b/include/grub/normal.h -@@ -66,7 +66,7 @@ void grub_menu_init_page (int nested, int edit, - struct grub_term_output *term); - void grub_normal_init_page (struct grub_term_output *term, int y); - char *grub_file_getline (grub_file_t file); --void grub_cmdline_run (int nested); -+void grub_cmdline_run (int nested, int force_auth); - - /* Defined in `cmdline.c'. */ - char *grub_cmdline_get (const char *prompt); --- -2.4.3 - diff --git a/0107-ACPIhalt-Add-more-ACPI-opcodes.patch b/0107-ACPIhalt-Add-more-ACPI-opcodes.patch deleted file mode 100644 index 51b63d6..0000000 --- a/0107-ACPIhalt-Add-more-ACPI-opcodes.patch +++ /dev/null @@ -1,173 +0,0 @@ -From 0f1f95c7b7bc72cfbeea2f6dc5986855738ad96d Mon Sep 17 00:00:00 2001 -From: Valentin Dornauer -Date: Sun, 21 Sep 2014 18:58:14 +0200 -Subject: [PATCH 107/506] ACPIhalt: Add more ACPI opcodes. - - The AML parser implements only a small subset of possible AML - opcodes. On the Fujitsu Lifebook E744 this and another bug in - the parser (incorrect handling of TermArg data types) would lead - to the laptop not turning off (_S5 not found). - - * grub-core/commands/acpihalt.c: Support OpAlias in the AML parser; - in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs - aren't always simply strings!); Add function to skip TermArgs - * include/grub/acpi.h: Add new opcodes ---- - ChangeLog | 12 +++++++++ - grub-core/commands/acpihalt.c | 59 +++++++++++++++++++++++++++++++++++++++++-- - include/grub/acpi.h | 19 +++++++++++++- - 3 files changed, 87 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 002461c..6b35a5c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,15 @@ -+2014-09-21 Valentin Dornauer -+ -+ The AML parser implements only a small subset of possible AML -+ opcodes. On the Fujitsu Lifebook E744 this and another bug in -+ the parser (incorrect handling of TermArg data types) would lead -+ to the laptop not turning off (_S5 not found). -+ -+ * grub-core/commands/acpihalt.c: Support OpAlias in the AML parser; -+ in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs -+ aren't always simply strings!); Add function to skip TermArgs -+ * include/grub/acpi.h: Add new opcodes -+ - 2014-09-21 Vladimir Serbinenko - - * grub-core/normal/main.c: Don't drop to rescue console in -diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c -index 83bdfe1..da68b5b 100644 ---- a/grub-core/commands/acpihalt.c -+++ b/grub-core/commands/acpihalt.c -@@ -136,6 +136,49 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end) - } - - static inline grub_uint32_t -+skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end) -+{ -+ grub_uint32_t add; -+ const grub_uint8_t *ptr0 = ptr; -+ -+ switch(*ptr) -+ { -+ case GRUB_ACPI_OPCODE_ADD: -+ case GRUB_ACPI_OPCODE_AND: -+ case GRUB_ACPI_OPCODE_CONCAT: -+ case GRUB_ACPI_OPCODE_CONCATRES: -+ case GRUB_ACPI_OPCODE_DIVIDE: -+ case GRUB_ACPI_OPCODE_INDEX: -+ case GRUB_ACPI_OPCODE_LSHIFT: -+ case GRUB_ACPI_OPCODE_MOD: -+ case GRUB_ACPI_OPCODE_MULTIPLY: -+ case GRUB_ACPI_OPCODE_NAND: -+ case GRUB_ACPI_OPCODE_NOR: -+ case GRUB_ACPI_OPCODE_OR: -+ case GRUB_ACPI_OPCODE_RSHIFT: -+ case GRUB_ACPI_OPCODE_SUBTRACT: -+ case GRUB_ACPI_OPCODE_TOSTRING: -+ case GRUB_ACPI_OPCODE_XOR: -+ /* -+ * Parameters for these opcodes: TermArg, TermArg Target, see ACPI -+ * spec r5.0, page 828f. -+ */ -+ ptr++; -+ ptr += add = skip_term (ptr, end); -+ if (!add) -+ return 0; -+ ptr += add = skip_term (ptr, end); -+ if (!add) -+ return 0; -+ ptr += skip_name_string (ptr, end); -+ break; -+ default: -+ return skip_data_ref_object (ptr, end); -+ } -+ return ptr - ptr0; -+} -+ -+static inline grub_uint32_t - skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) - { - const grub_uint8_t *ptr0 = ptr; -@@ -156,10 +199,10 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) - ptr++; - ptr += skip_name_string (ptr, end); - ptr++; -- ptr += add = skip_data_ref_object (ptr, end); -+ ptr += add = skip_term (ptr, end); - if (!add) - return 0; -- ptr += add = skip_data_ref_object (ptr, end); -+ ptr += add = skip_term (ptr, end); - if (!add) - return 0; - break; -@@ -180,6 +223,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) - return ptr - ptr0; - } - -+ - static int - get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, - grub_uint8_t *scope, int scope_len) -@@ -250,6 +294,17 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, - if (!add) - return -1; - break; -+ case GRUB_ACPI_OPCODE_ALIAS: -+ ptr++; -+ /* We need to skip two name strings */ -+ ptr += add = skip_name_string (ptr, end); -+ if (!add) -+ return -1; -+ ptr += add = skip_name_string (ptr, end); -+ if (!add) -+ return -1; -+ break; -+ - case GRUB_ACPI_OPCODE_SCOPE: - { - int scope_sleep_type; -diff --git a/include/grub/acpi.h b/include/grub/acpi.h -index 2ac2bd6..f6e6a11 100644 ---- a/include/grub/acpi.h -+++ b/include/grub/acpi.h -@@ -191,7 +191,8 @@ void grub_acpi_halt (void); - enum - { - GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1, -- GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a, -+ GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_ALIAS = 0x06, -+ GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a, - GRUB_ACPI_OPCODE_WORD_CONST = 0x0b, - GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c, - GRUB_ACPI_OPCODE_STRING_CONST = 0x0d, -@@ -199,6 +200,22 @@ enum - GRUB_ACPI_OPCODE_BUFFER = 0x11, - GRUB_ACPI_OPCODE_PACKAGE = 0x12, - GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b, -+ GRUB_ACPI_OPCODE_ADD = 0x72, -+ GRUB_ACPI_OPCODE_CONCAT = 0x73, -+ GRUB_ACPI_OPCODE_SUBTRACT = 0x74, -+ GRUB_ACPI_OPCODE_MULTIPLY = 0x77, -+ GRUB_ACPI_OPCODE_DIVIDE = 0x78, -+ GRUB_ACPI_OPCODE_LSHIFT = 0x79, -+ GRUB_ACPI_OPCODE_RSHIFT = 0x7a, -+ GRUB_ACPI_OPCODE_AND = 0x7b, -+ GRUB_ACPI_OPCODE_NAND = 0x7c, -+ GRUB_ACPI_OPCODE_OR = 0x7d, -+ GRUB_ACPI_OPCODE_NOR = 0x7e, -+ GRUB_ACPI_OPCODE_XOR = 0x7f, -+ GRUB_ACPI_OPCODE_CONCATRES = 0x84, -+ GRUB_ACPI_OPCODE_MOD = 0x85, -+ GRUB_ACPI_OPCODE_INDEX = 0x88, -+ GRUB_ACPI_OPCODE_TOSTRING = 0x9c, - GRUB_ACPI_OPCODE_CREATE_WORD_FIELD = 0x8b, - GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD = 0x8c, - GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff --- -2.4.3 - diff --git a/0108-Revert-Use-Wl-no-relax-rather-than-mno-relax-for-uni.patch b/0108-Revert-Use-Wl-no-relax-rather-than-mno-relax-for-uni.patch deleted file mode 100644 index 5b8ce4c..0000000 --- a/0108-Revert-Use-Wl-no-relax-rather-than-mno-relax-for-uni.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6d05b6383c0ea1a094cbfdbd503af31af0f6c393 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 21 Sep 2014 19:02:11 +0200 -Subject: [PATCH 108/506] Revert " Use -Wl,--no-relax rather than - -mno-relax for uniformity." - -This reverts commit 063f2a04d158ec1b275a925dfbae74b124708cde. ---- - ChangeLog | 4 ---- - conf/Makefile.common | 2 +- - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6b35a5c..6d786ba 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -988,10 +988,6 @@ - - 2013-12-18 Vladimir Serbinenko - -- Use -Wl,--no-relax rather than -mno-relax for uniformity. -- --2013-12-18 Vladimir Serbinenko -- - * INSTALL: Update comment as to why sparc64 clang isn't usable. - - 2013-12-18 Vladimir Serbinenko -diff --git a/conf/Makefile.common b/conf/Makefile.common -index e4c301f..51fbaf9 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -8,7 +8,7 @@ unexport LC_ALL - # Platform specific options - if COND_sparc64_ieee1275 - CFLAGS_PLATFORM += -mno-app-regs -- LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax -+ LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax - endif - if COND_sparc64_emu - CFLAGS_PLATFORM += -mno-app-regs --- -2.4.3 - diff --git a/0109-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch b/0109-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch deleted file mode 100644 index 9131aef..0000000 --- a/0109-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch +++ /dev/null @@ -1,779 +0,0 @@ -From 954fe77163dc12ccbb3d958b9dbb330aa59b62fe Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Mon, 22 Sep 2014 20:47:10 +0400 -Subject: [PATCH 109/506] cleanup: grub_cpu_to_XXX_compile_time for constants - -This tries to catch all cases where grub_cpu_to_XXX was used for constant -expressions (including sizeof). ---- - ChangeLog | 4 ++++ - grub-core/bus/usb/ehci.c | 44 ++++++++++++++++++++-------------------- - grub-core/bus/usb/ohci.c | 8 ++++---- - grub-core/commands/gptsync.c | 6 +++--- - grub-core/disk/mdraid_linux.c | 12 +++++------ - grub-core/disk/scsi.c | 2 +- - grub-core/disk/usbms.c | 4 ++-- - grub-core/fs/hfs.c | 2 +- - grub-core/fs/reiserfs.c | 12 +++++------ - grub-core/lib/fdt.c | 12 +++++------ - grub-core/loader/i386/linux.c | 2 +- - grub-core/loader/i386/pc/linux.c | 20 +++++++++--------- - grub-core/loader/i386/xen_file.c | 4 ++-- - grub-core/net/arp.c | 4 ++-- - grub-core/net/bootp.c | 4 ++-- - grub-core/net/ip.c | 2 +- - grub-core/net/net.c | 2 +- - grub-core/net/tftp.c | 8 ++++---- - grub-core/partmap/acorn.c | 4 ++-- - grub-core/partmap/bsdlabel.c | 2 +- - grub-core/partmap/gpt.c | 2 +- - grub-core/partmap/msdos.c | 4 ++-- - grub-core/tests/video_checksum.c | 6 +++--- - util/grub-mkfont.c | 4 ++-- - util/grub-mklayout.c | 2 +- - util/mkimage.c | 15 +++++++------- - 26 files changed, 98 insertions(+), 93 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6d786ba..8316b8f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-09-22 Andrei Borzenkov -+ -+ Use grub_cpu_to_XXX_compile_time for constants. -+ - 2014-09-21 Valentin Dornauer - - The AML parser implements only a small subset of possible AML -diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c -index c0feefa..8ece400 100644 ---- a/grub-core/bus/usb/ehci.c -+++ b/grub-core/bus/usb/ehci.c -@@ -670,23 +670,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++) - { - e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td); -- e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -- e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); -+ e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - } - e->td_virt[GRUB_EHCI_N_TD - 1].next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - e->tdfree_virt = e->td_virt; - /* Set Terminate in first QH, which is used in framelist */ -- e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH); -- e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH); -+ e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - e->qh_virt[0].td_overlay.alt_next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - /* Also set Halted bit in token */ -- e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); -+ e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); - /* Set the H bit in first QH used for AL */ -- e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H); -+ e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H); - /* Set Terminate into TD in rest of QHs and set horizontal link - * pointer to itself - these QHs will be used for asynchronous - * schedule and they should have valid value in horiz. link */ -@@ -697,12 +697,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - e->qh_chunk) & - GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH); - e->qh_virt[i].td_overlay.next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - e->qh_virt[i].td_overlay.alt_next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - /* Also set Halted bit in token */ - e->qh_virt[i].td_overlay.token = -- grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); - } - - /* Note: QH 0 and QH 1 are reserved and must not be used anywhere. -@@ -991,7 +991,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer) - target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) | - transfer->devaddr) & GRUB_EHCI_TARGET_MASK; - target = grub_cpu_to_le32 (target); -- mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK); -+ mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK); - - /* low speed interrupt transfers are linked to the periodic */ - /* schedule, everything else to the asynchronous schedule */ -@@ -1200,7 +1200,7 @@ grub_ehci_transaction (struct grub_ehci *e, - grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td)); - - /* Don't point to any TD yet, just terminate. */ -- td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - /* Set alternate pointer. When short packet occurs, alternate TD - * will not be really fetched because it is not active. But don't - * forget, EHCI will try to fetch alternate TD every scan of AL -@@ -1325,9 +1325,9 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, - /* Fill whole alternate TD by zeros (= inactive) and set - * Terminate bits and Halt bit */ - grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td)); -- cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -- cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -- cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); -+ cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); -+ cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); -+ cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); - - /* Allocate appropriate number of TDs and set */ - for (i = 0; i < transfer->transcnt; i++) -@@ -1364,7 +1364,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, - cdata->td_last_virt = td; - cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk); - /* Last TD should not have set alternate TD */ -- cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - - grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n", - cdata,cdata->qh_virt); -@@ -1377,14 +1377,14 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, - /* Start transfer: */ - /* Unlink possible alternate pointer in QH */ - cdata->qh_virt->td_overlay.alt_next_td = -- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); -+ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); - /* Link new TDs with QH via next_td */ - cdata->qh_virt->td_overlay.next_td = - grub_cpu_to_le32 (grub_dma_virt2phys - (cdata->td_first_virt, e->td_chunk)); - /* Reset Active and Halted bits in QH to activate Advance Queue, - * i.e. reset token */ -- cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0); -+ cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0); - - /* Finito */ - transfer->controller_data = cdata; -@@ -1408,9 +1408,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer) - * safely manipulate with QH TD part. */ - cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token - | -- grub_cpu_to_le32 -+ grub_cpu_to_le32_compile_time - (GRUB_EHCI_STATUS_HALTED)) & -- grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE); -+ grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE); - - /* Print debug data here if necessary */ - -diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c -index 946a4ed..d27bfe7 100644 ---- a/grub-core/bus/usb/ohci.c -+++ b/grub-core/bus/usb/ohci.c -@@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed) - * GRUB_OHCI_CTRL_EDS); - for (j=0; j < GRUB_OHCI_CTRL_EDS; j++) -- o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */ -+ o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */ - - grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n", - o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr); -@@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - /* Preset EDs */ - grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS); - for (j=0; j < GRUB_OHCI_BULK_EDS; j++) -- o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */ -+ o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */ - - grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n", - o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr); -@@ -1349,10 +1349,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused))) - /* Set skip in all EDs */ - if (o->ed_bulk) - for (i=0; i < GRUB_OHCI_BULK_EDS; i++) -- o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */ -+ o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */ - if (o->ed_ctrl) - for (i=0; i < GRUB_OHCI_CTRL_EDS; i++) -- o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */ -+ o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */ - - /* We should wait for next SOF to be sure that all EDs are - * unaccessed by OHCI. But OHCI can be non-functional, so -diff --git a/grub-core/commands/gptsync.c b/grub-core/commands/gptsync.c -index 3db6288..16592e9 100644 ---- a/grub-core/commands/gptsync.c -+++ b/grub-core/commands/gptsync.c -@@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), - } - - /* Check if it is valid. */ -- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) -+ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) - { - grub_device_close (dev); - return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); -@@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), - first_sector--; - mbr.entries[0].flag = 0; - mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK; -- mbr.entries[0].start = grub_cpu_to_le32 (1); -+ mbr.entries[0].start = grub_cpu_to_le32_compile_time (1); - lba_to_chs (1, - &(mbr.entries[0].start_sector), - &(mbr.entries[0].start_cylinder), -@@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), - &(mbr.entries[0].end_head)); - mbr.entries[0].length = grub_cpu_to_le32 (first_sector); - -- mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE); -+ mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE); - - if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr)) - { -diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c -index 4aa5882..11024ae 100644 ---- a/grub-core/disk/mdraid_linux.c -+++ b/grub-core/disk/mdraid_linux.c -@@ -33,16 +33,16 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define grub_md_to_cpu64 grub_be_to_cpu64 - #define grub_md_to_cpu32 grub_be_to_cpu32 - #define grub_md_to_cpu16 grub_be_to_cpu16 --#define grub_cpu_to_md64_compile_time grub_cpu_to_be64 --#define grub_cpu_to_md32_compile_time grub_cpu_to_be32 --#define grub_cpu_to_md16_compile_time grub_cpu_to_be16 -+#define grub_cpu_to_md64_compile_time grub_cpu_to_be64_compile_time -+#define grub_cpu_to_md32_compile_time grub_cpu_to_be32_compile_time -+#define grub_cpu_to_md16_compile_time grub_cpu_to_be16_compile_time - #else - #define grub_md_to_cpu64 grub_le_to_cpu64 - #define grub_md_to_cpu32 grub_le_to_cpu32 - #define grub_md_to_cpu16 grub_le_to_cpu16 --#define grub_cpu_to_md64_compile_time grub_cpu_to_le64 --#define grub_cpu_to_md32_compile_time grub_cpu_to_le32 --#define grub_cpu_to_md16_compile_time grub_cpu_to_le16 -+#define grub_cpu_to_md64_compile_time grub_cpu_to_le64_compile_time -+#define grub_cpu_to_md32_compile_time grub_cpu_to_le32_compile_time -+#define grub_cpu_to_md16_compile_time grub_cpu_to_le16_compile_time - #endif - - #define RESERVED_BYTES (64 * 1024) -diff --git a/grub-core/disk/scsi.c b/grub-core/disk/scsi.c -index b6cb2f4..92084d0 100644 ---- a/grub-core/disk/scsi.c -+++ b/grub-core/disk/scsi.c -@@ -201,7 +201,7 @@ grub_scsi_read_capacity16 (grub_scsi_t scsi) - rc.opcode = grub_scsi_cmd_read_capacity16; - rc.lun = (scsi->lun << GRUB_SCSI_LUN_SHIFT) | 0x10; - rc.logical_block_addr = 0; -- rc.alloc_len = grub_cpu_to_be32 (sizeof (rcd)); -+ rc.alloc_len = grub_cpu_to_be32_compile_time (sizeof (rcd)); - rc.PMI = 0; - rc.control = 0; - -diff --git a/grub-core/disk/usbms.c b/grub-core/disk/usbms.c -index 2b769bd..380ca4c 100644 ---- a/grub-core/disk/usbms.c -+++ b/grub-core/disk/usbms.c -@@ -307,7 +307,7 @@ grub_usbms_transfer_bo (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd, - - /* Setup the request. */ - grub_memset (&cbw, 0, sizeof (cbw)); -- cbw.signature = grub_cpu_to_le32 (0x43425355); -+ cbw.signature = grub_cpu_to_le32_compile_time (0x43425355); - cbw.tag = tag; - cbw.transfer_length = grub_cpu_to_le32 (size); - cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT; -@@ -414,7 +414,7 @@ CheckCSW: - - /* If phase error or not valid signature, do bulk-only reset device. */ - if ((status.status == 2) || -- (status.signature != grub_cpu_to_le32(0x53425355))) -+ (status.signature != grub_cpu_to_le32_compile_time(0x53425355))) - { /* Bulk-only reset device. */ - grub_dprintf ("usb", "Bulk-only reset device - bad status\n"); - grub_usbms_reset (dev); -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index 1e59305..d1dc015 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -369,7 +369,7 @@ grub_hfs_mount (grub_disk_t disk) - - /* Lookup the root directory node in the catalog tree using the - volume name. */ -- key.parent_dir = grub_cpu_to_be32 (1); -+ key.parent_dir = grub_cpu_to_be32_compile_time (1); - key.strlen = data->sblock.volname[0]; - grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); - -diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c -index ac65054..de3d4fa 100644 ---- a/grub-core/fs/reiserfs.c -+++ b/grub-core/fs/reiserfs.c -@@ -365,7 +365,7 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key, - key->u.v1.offset = grub_cpu_to_le32 (value); - else - key->u.v2.offset_type \ -- = ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60)) -+ = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (15ULL << 60)) - | grub_cpu_to_le64 (value & (~0ULL >> 4))); - } - -@@ -412,7 +412,7 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key, - key->u.v1.type = grub_cpu_to_le32 (type); - else - key->u.v2.offset_type -- = ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4)) -+ = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (~0ULL >> 4)) - | grub_cpu_to_le64 ((grub_uint64_t) type << 60)); - - assert (grub_reiserfs_get_key_type (key) == grub_type); -@@ -997,8 +997,8 @@ grub_reiserfs_open (struct grub_file *file, const char *name) - data = grub_reiserfs_mount (file->device->disk); - if (! data) - goto fail; -- key.directory_id = grub_cpu_to_le32 (1); -- key.object_id = grub_cpu_to_le32 (2); -+ key.directory_id = grub_cpu_to_le32_compile_time (1); -+ key.object_id = grub_cpu_to_le32_compile_time (2); - key.u.v2.offset_type = 0; - grub_reiserfs_set_key_type (&key, GRUB_REISERFS_DIRECTORY, 2); - grub_reiserfs_set_key_offset (&key, 1); -@@ -1289,8 +1289,8 @@ grub_reiserfs_dir (grub_device_t device, const char *path, - data = grub_reiserfs_mount (device->disk); - if (! data) - goto fail; -- root_key.directory_id = grub_cpu_to_le32 (1); -- root_key.object_id = grub_cpu_to_le32 (2); -+ root_key.directory_id = grub_cpu_to_le32_compile_time (1); -+ root_key.object_id = grub_cpu_to_le32_compile_time (2); - root_key.u.v2.offset_type = 0; - grub_reiserfs_set_key_type (&root_key, GRUB_REISERFS_DIRECTORY, 2); - grub_reiserfs_set_key_offset (&root_key, 1); -diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c -index 907a7bf..7e76dc0 100644 ---- a/grub-core/lib/fdt.c -+++ b/grub-core/lib/fdt.c -@@ -164,10 +164,10 @@ static int add_subnode (void *fdt, int parentoffset, const char *name) - insert: - grub_memmove (token + entry_size / sizeof(*token), token, - (grub_addr_t) end - (grub_addr_t) token); -- *token = grub_cpu_to_be32(FDT_BEGIN_NODE); -+ *token = grub_cpu_to_be32_compile_time(FDT_BEGIN_NODE); - token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */ - grub_strcpy((char *) (token + 1), name); -- token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE); -+ token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32_compile_time(FDT_END_NODE); - grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size); - return ((grub_addr_t) token - (grub_addr_t) fdt - - grub_fdt_get_off_dt_struct(fdt)); -@@ -377,7 +377,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - - prop_name_present = 1; - for (i = 0; i < prop_len / sizeof(grub_uint32_t); i++) -- *(prop + 3 + i) = grub_cpu_to_be32 (FDT_NOP); -+ *(prop + 3 + i) = grub_cpu_to_be32_compile_time (FDT_NOP); - if (len > ALIGN_UP(prop_len, sizeof(grub_uint32_t))) - { - /* Length of new property value is greater than the space allocated -@@ -385,7 +385,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - nameoff field of the current entry and replace the current entry - with NOP tokens. */ - nameoff = grub_be_to_cpu32 (*(prop + 2)); -- *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32 (FDT_NOP); -+ *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32_compile_time (FDT_NOP); - prop = NULL; - } - } -@@ -419,7 +419,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - struct_end(fdt) - (grub_addr_t) prop); - grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt) - + prop_entry_size(len)); -- *prop = grub_cpu_to_be32 (FDT_PROP); -+ *prop = grub_cpu_to_be32_compile_time (FDT_PROP); - *(prop + 2) = grub_cpu_to_be32 (nameoff); - } - *(prop + 1) = grub_cpu_to_be32 (len); -@@ -447,7 +447,7 @@ grub_fdt_create_empty_tree (void *fdt, unsigned int size) - et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE); - et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE); - ((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap = -- grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8)); -+ grub_cpu_to_be32_compile_time (ALIGN_UP (sizeof (grub_fdt_header_t), 8)); - - grub_fdt_set_off_dt_strings (fdt, sizeof (*et)); - grub_fdt_set_off_dt_struct (fdt, -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 2ae1763..0bd060a 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -722,7 +722,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and - still not support 32-bit boot. */ -- if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0203) - { - grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot" -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index b481e46..e88341e 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -151,7 +151,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -- if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)) -+ if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) - { - grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); - goto fail; -@@ -169,7 +169,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - maximal_cmdline_size = 256; - -- if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - && grub_le_to_cpu16 (lh.version) >= 0x0200) - { - grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL); -@@ -188,7 +188,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - if (grub_le_to_cpu16 (lh.version) >= 0x0201) - { -- lh.heap_end_ptr = grub_cpu_to_le16 (GRUB_LINUX_HEAP_END_OFFSET); -+ lh.heap_end_ptr = grub_cpu_to_le16_compile_time (GRUB_LINUX_HEAP_END_OFFSET); - lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; - } - -@@ -196,17 +196,17 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - lh.cmd_line_ptr = grub_linux_real_target + GRUB_LINUX_CL_OFFSET; - else - { -- lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); -- lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); -- lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET -+ lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC); -+ lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET); -+ lh.setup_move_size = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET - + maximal_cmdline_size); - } - } - else - { - /* Your kernel is quite old... */ -- lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); -- lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); -+ lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC); -+ lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET); - - setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; - -@@ -319,7 +319,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -- if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0200) - /* Clear the heap space. */ - grub_memset (grub_linux_real_chunk -@@ -404,7 +404,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - - lh = (struct linux_kernel_header *) grub_linux_real_chunk; - -- if (!(lh->header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - && grub_le_to_cpu16 (lh->version) >= 0x0200)) - { - grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd"); -diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c -index ff23235..5836218 100644 ---- a/grub-core/loader/i386/xen_file.c -+++ b/grub-core/loader/i386/xen_file.c -@@ -38,8 +38,8 @@ grub_xen_file (grub_file_t file) - if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) - goto fail; - -- if (lh.boot_flag != grub_cpu_to_le16 (0xaa55) -- || lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55) -+ || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0208) - { - grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot"); -diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index d62d0cc..8cc390b 100644 ---- a/grub-core/net/arp.c -+++ b/grub-core/net/arp.c -@@ -81,11 +81,11 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - return err; - - arp_header = (struct arphdr *) nb.data; -- arp_header->hrd = grub_cpu_to_be16 (GRUB_NET_ARPHRD_ETHERNET); -+ arp_header->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); - arp_header->hln = 6; - arp_header->pro = grub_cpu_to_be16 (etherpro); - arp_header->pln = addrlen; -- arp_header->op = grub_cpu_to_be16 (ARP_REQUEST); -+ arp_header->op = grub_cpu_to_be16_compile_time (ARP_REQUEST); - aux = (grub_uint8_t *) arp_header + sizeof (*arp_header); - /* Sender hardware address. */ - grub_memcpy (aux, &inf->hwaddress.mac, 6); -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 6310ed4..6136755 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -522,8 +522,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - grub_netbuff_push (nb, sizeof (*udph)); - - udph = (struct udphdr *) nb->data; -- udph->src = grub_cpu_to_be16 (68); -- udph->dst = grub_cpu_to_be16 (67); -+ udph->src = grub_cpu_to_be16_compile_time (68); -+ udph->dst = grub_cpu_to_be16_compile_time (67); - udph->chksum = 0; - udph->len = grub_cpu_to_be16 (nb->tail - nb->data); - target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index c6971f9..5a60954 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -611,7 +611,7 @@ grub_net_send_ip6_packet (struct grub_net_network_level_interface *inf, - grub_netbuff_push (nb, sizeof (*iph)); - iph = (struct ip6hdr *) nb->data; - -- iph->version_class_flow = grub_cpu_to_be32 ((6 << 28)); -+ iph->version_class_flow = grub_cpu_to_be32_compile_time ((6 << 28)); - iph->len = grub_cpu_to_be16 (nb->tail - nb->data - sizeof (*iph)); - iph->protocol = proto; - iph->ttl = 0xff; -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index f2e723b..82af3a0 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -306,7 +306,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card, - return NULL; - - addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -- addr.ipv6[0] = grub_cpu_to_be64 (0xfe80ULL << 48); -+ addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48); - addr.ipv6[1] = grub_net_ipv6_get_id (hwaddr); - - FOR_NET_NETWORK_LEVEL_INTERFACES (inf) -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 5173614..1319671 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -149,7 +149,7 @@ ack (tftp_data_t data, grub_uint64_t block) - return err; - - tftph_ack = (struct tftphdr *) nb_ack.data; -- tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK); -+ tftph_ack->opcode = grub_cpu_to_be16_compile_time (TFTP_ACK); - tftph_ack->u.ack.block = grub_cpu_to_be16 (block); - - err = grub_net_send_udp_packet (data->sock, &nb_ack); -@@ -333,7 +333,7 @@ tftp_open (struct grub_file *file, const char *filename) - rrq = (char *) tftph->u.rrq; - rrqlen = 0; - -- tftph->opcode = grub_cpu_to_be16 (TFTP_RRQ); -+ tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ); - grub_strcpy (rrq, filename); - rrqlen += grub_strlen (filename) + 1; - rrq += grub_strlen (filename) + 1; -@@ -443,8 +443,8 @@ tftp_close (struct grub_file *file) - if (!err) - { - tftph = (struct tftphdr *) nb_err.data; -- tftph->opcode = grub_cpu_to_be16 (TFTP_ERROR); -- tftph->u.err.errcode = grub_cpu_to_be16 (TFTP_EUNDEF); -+ tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_ERROR); -+ tftph->u.err.errcode = grub_cpu_to_be16_compile_time (TFTP_EUNDEF); - grub_memcpy (tftph->u.err.errmsg, "closed", sizeof ("closed")); - - err = grub_net_send_udp_packet (data->sock, &nb_err); -diff --git a/grub-core/partmap/acorn.c b/grub-core/partmap/acorn.c -index 7bb93d9..c022c61 100644 ---- a/grub-core/partmap/acorn.c -+++ b/grub-core/partmap/acorn.c -@@ -25,8 +25,8 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - --#define LINUX_NATIVE_MAGIC grub_cpu_to_le32 (0xdeafa1de) --#define LINUX_SWAP_MAGIC grub_cpu_to_le32 (0xdeafab1e) -+#define LINUX_NATIVE_MAGIC grub_cpu_to_le32_compile_time (0xdeafa1de) -+#define LINUX_SWAP_MAGIC grub_cpu_to_le32_compile_time (0xdeafab1e) - #define LINUX_MAP_ENTRIES (512 / 12) - - #define NONADFS_PARTITION_TYPE_LINUX 9 -diff --git a/grub-core/partmap/bsdlabel.c b/grub-core/partmap/bsdlabel.c -index cf0f967..1d78590 100644 ---- a/grub-core/partmap/bsdlabel.c -+++ b/grub-core/partmap/bsdlabel.c -@@ -53,7 +53,7 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd, - return grub_errno; - - /* Check if it is valid. */ -- if (label.magic != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC)) -+ if (label.magic != grub_cpu_to_le32_compile_time (GRUB_PC_PARTITION_BSD_LABEL_MAGIC)) - return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); - - /* A kludge to determine a base of be.offset. */ -diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c -index 38df7b3..83bcba7 100644 ---- a/grub-core/partmap/gpt.c -+++ b/grub-core/partmap/gpt.c -@@ -65,7 +65,7 @@ grub_gpt_partition_map_iterate (grub_disk_t disk, - return grub_errno; - - /* Check if it is valid. */ -- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) -+ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) - return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); - - /* Make sure the MBR is a protective MBR and not a normal MBR. */ -diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c -index 1d81a53..46c406b 100644 ---- a/grub-core/partmap/msdos.c -+++ b/grub-core/partmap/msdos.c -@@ -162,7 +162,7 @@ grub_partition_msdos_iterate (grub_disk_t disk, - lastaddr = p.offset; - - /* Check if it is valid. */ -- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) -+ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) - return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); - - for (i = 0; i < 4; i++) -@@ -280,7 +280,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, - lastaddr = offset; - - /* Check if it is valid. */ -- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) -+ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) - return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); - - for (i = 0; i < 4; i++) -diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c -index 491bc55..74d5b65 100644 ---- a/grub-core/tests/video_checksum.c -+++ b/grub-core/tests/video_checksum.c -@@ -288,16 +288,16 @@ grub_video_capture_write_bmp (const char *fname, - if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB) - { - head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3); -- head.bmp_off = grub_cpu_to_le32 (sizeof (head)); -+ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head)); - head.bpp = grub_cpu_to_le16_compile_time (24); - } - else - { - head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height); -- head.bmp_off = grub_cpu_to_le32 (sizeof (head) + 3 * 256); -+ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head) + 3 * 256); - head.bpp = grub_cpu_to_le16_compile_time (8); - } -- head.head_size = grub_cpu_to_le32 (sizeof (head) - 14); -+ head.head_size = grub_cpu_to_le32_compile_time (sizeof (head) - 14); - head.width = grub_cpu_to_le16 (mode_info->width); - head.height = grub_cpu_to_le16 (mode_info->height); - head.planes = grub_cpu_to_le16_compile_time (1); -diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index e6485b4..a0cab3a 100644 ---- a/util/grub-mkfont.c -+++ b/util/grub-mkfont.c -@@ -704,7 +704,7 @@ write_be16_section (const char *name, grub_uint16_t data, int* offset, - { - grub_uint32_t leng; - -- leng = grub_cpu_to_be32 (2); -+ leng = grub_cpu_to_be32_compile_time (2); - data = grub_cpu_to_be16 (data); - grub_util_write_image (name, 4, file, filename); - grub_util_write_image ((char *) &leng, 4, file, filename); -@@ -801,7 +801,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file) - - offset = 0; - -- leng = grub_cpu_to_be32 (4); -+ leng = grub_cpu_to_be32_compile_time (4); - grub_util_write_image (FONT_FORMAT_SECTION_NAMES_FILE, - sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1, file, - output_file); -diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c -index 692f881..1a4f1b4 100644 ---- a/util/grub-mklayout.c -+++ b/util/grub-mklayout.c -@@ -329,7 +329,7 @@ write_file (FILE *out, const char *fname, struct grub_keyboard_layout *layout) - grub_uint32_t version; - unsigned i; - -- version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION); -+ version = grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION); - - for (i = 0; i < ARRAY_SIZE (layout->keyboard_map); i++) - layout->keyboard_map[i] = grub_cpu_to_le32(layout->keyboard_map[i]); -diff --git a/util/mkimage.c b/util/mkimage.c -index 26d9816..e6b799f 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -1528,9 +1528,10 @@ grub_install_generate_image (const char *dir, const char *prefix, - text_section->virtual_address = grub_cpu_to_le32 (header_size); - text_section->raw_data_size = grub_cpu_to_le32 (exec_size); - text_section->raw_data_offset = grub_cpu_to_le32 (header_size); -- text_section->characteristics = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_CODE -- | GRUB_PE32_SCN_MEM_EXECUTE -- | GRUB_PE32_SCN_MEM_READ); -+ text_section->characteristics = grub_cpu_to_le32_compile_time ( -+ GRUB_PE32_SCN_CNT_CODE -+ | GRUB_PE32_SCN_MEM_EXECUTE -+ | GRUB_PE32_SCN_MEM_READ); - - data_section = text_section + 1; - strcpy (data_section->name, ".data"); -@@ -1539,7 +1540,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - data_section->raw_data_size = grub_cpu_to_le32 (kernel_size - exec_size); - data_section->raw_data_offset = grub_cpu_to_le32 (header_size + exec_size); - data_section->characteristics -- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA -+ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA - | GRUB_PE32_SCN_MEM_READ - | GRUB_PE32_SCN_MEM_WRITE); - -@@ -1551,7 +1552,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - bss_section->raw_data_size = 0; - bss_section->raw_data_offset = 0; - bss_section->characteristics -- = grub_cpu_to_le32 (GRUB_PE32_SCN_MEM_READ -+ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_MEM_READ - | GRUB_PE32_SCN_MEM_WRITE - | GRUB_PE32_SCN_ALIGN_64BYTES - | GRUB_PE32_SCN_CNT_INITIALIZED_DATA -@@ -1565,7 +1566,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - mods_section->raw_data_size = grub_cpu_to_le32 (reloc_addr - kernel_size - header_size); - mods_section->raw_data_offset = grub_cpu_to_le32 (header_size + kernel_size); - mods_section->characteristics -- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA -+ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA - | GRUB_PE32_SCN_MEM_READ - | GRUB_PE32_SCN_MEM_WRITE); - -@@ -1576,7 +1577,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - reloc_section->raw_data_size = grub_cpu_to_le32 (reloc_size); - reloc_section->raw_data_offset = grub_cpu_to_le32 (reloc_addr); - reloc_section->characteristics -- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA -+ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA - | GRUB_PE32_SCN_MEM_DISCARDABLE - | GRUB_PE32_SCN_MEM_READ); - free (core_img); --- -2.4.3 - diff --git a/0110-Add-a-new-none-platform-that-only-builds-utilities.patch b/0110-Add-a-new-none-platform-that-only-builds-utilities.patch deleted file mode 100644 index 6ee9a8b..0000000 --- a/0110-Add-a-new-none-platform-that-only-builds-utilities.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 5d90f6e533d82abf89f9e1787f90f17f2fab14aa Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Tue, 23 Sep 2014 12:06:30 +0100 -Subject: [PATCH 110/506] Add a new "none" platform that only builds utilities - -This makes it possible to build generally-useful utilities such as -grub-mount even if the rest of GRUB has not been ported to the target -CPU. - -* configure.ac: Add "none" platform. Default to it for unsupported -CPUs rather than stopping with a fatal error. Don't downgrade -x86_64-none to i386. Define COND_real_platform Automake conditional -if the platform is anything other than "none". Don't do any include -directory linking for "none". -* Makefile.am: Skip building grub-core and all bootcheck targets if -!COND_real_platform. -* include/grub/time.h: Don't include if GRUB_UTIL -is defined. ---- - ChangeLog | 14 ++++++++++++++ - Makefile.am | 14 +++++++++++--- - configure.ac | 46 +++++++++++++++++++++++++++++----------------- - include/grub/time.h | 2 +- - 4 files changed, 55 insertions(+), 21 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 8316b8f..08cc7c6 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,17 @@ -+2014-09-23 Colin Watson -+ -+ Add a new "none" platform that only builds utilities -+ -+ * configure.ac: Add "none" platform. Default to it for unsupported -+ CPUs rather than stopping with a fatal error. Don't downgrade -+ x86_64-none to i386. Define COND_real_platform Automake conditional -+ if the platform is anything other than "none". Don't do any include -+ directory linking for "none". -+ * Makefile.am: Skip building grub-core and all bootcheck targets if -+ !COND_real_platform. -+ * include/grub/time.h: Don't include if GRUB_UTIL -+ is defined. -+ - 2014-09-22 Andrei Borzenkov - - Use grub_cpu_to_XXX_compile_time for constants. -diff --git a/Makefile.am b/Makefile.am -index f02ae0a..cc537a2 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -1,7 +1,11 @@ - AUTOMAKE_OPTIONS = subdir-objects -Wno-portability - - DEPDIR = .deps-util --SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d -+SUBDIRS = grub-core/gnulib . -+if COND_real_platform -+SUBDIRS += grub-core -+endif -+SUBDIRS += po docs util/bash-completion.d - - include $(top_srcdir)/conf/Makefile.common - include $(top_srcdir)/conf/Makefile.extra-dist -@@ -132,6 +136,8 @@ nodist_platform_HEADERS = config.h - pkgdata_DATA += grub-mkconfig_lib - - -+if COND_real_platform -+ - if COND_i386_coreboot - QEMU32=qemu-system-i386 - endif -@@ -383,8 +389,6 @@ if COND_powerpc_ieee1275 - BOOTCHECKS = bootcheck-linux-ppc - endif - --EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S -- - .PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \ - bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \ - bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \ -@@ -402,6 +406,10 @@ default_payload.elf: grub-mkstandalone grub-mkimage - pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg - endif - -+endif -+ -+EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S -+ - windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows - windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA) - test -d $(windowsdir) && rm -rf $(windowsdir) || true -diff --git a/configure.ac b/configure.ac -index 8662bac..fdf0fdc 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -125,7 +125,10 @@ if test "x$with_platform" = x; then - ia64-*) platform=efi ;; - arm-*) platform=uboot ;; - arm64-*) platform=efi ;; -- *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; -+ *) -+ AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities]) -+ platform=none -+ ;; - esac - else - platform="$with_platform" -@@ -135,6 +138,7 @@ case "$target_cpu"-"$platform" in - x86_64-efi) ;; - x86_64-emu) ;; - x86_64-xen) ;; -+ x86_64-none) ;; - x86_64-*) target_cpu=i386 ;; - powerpc64-ieee1275) target_cpu=powerpc ;; - esac -@@ -167,6 +171,7 @@ case "$target_cpu"-"$platform" in - arm-efi) ;; - arm64-efi) ;; - *-emu) ;; -+ *-none) ;; - *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; - esac - -@@ -1653,6 +1658,7 @@ AC_SUBST(BUILD_LIBM) - # Automake conditionals - # - -+AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) - AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) - AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes]) - AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) -@@ -1726,24 +1732,30 @@ AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir]) - - - # Output files. --cpudir="${target_cpu}" --if test x${cpudir} = xmipsel; then -- cpudir=mips; --fi --grub_CHECK_LINK_DIR --if test x"$link_dir" = xyes ; then -- AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) -- if test "$platform" != emu ; then -- AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) -+if test "$platform" != none; then -+ cpudir="${target_cpu}" -+ if test x${cpudir} = xmipsel; then -+ cpudir=mips; - fi --else -- mkdir -p include/grub 2>/dev/null -- rm -rf include/grub/cpu -- cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null -- if test "$platform" != emu ; then -- rm -rf include/grub/machine -- cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null -+ grub_CHECK_LINK_DIR -+ if test x"$link_dir" = xyes ; then -+ AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) -+ if test "$platform" != emu ; then -+ AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) -+ fi -+ else -+ mkdir -p include/grub 2>/dev/null -+ rm -rf include/grub/cpu -+ cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null -+ if test "$platform" != emu ; then -+ rm -rf include/grub/machine -+ cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null -+ fi - fi -+else -+ # Just enough to stop the compiler failing with -I$(srcdir)/include. -+ mkdir -p include 2>/dev/null -+ rm -rf include/grub - fi - - AC_CONFIG_FILES([Makefile]) -diff --git a/include/grub/time.h b/include/grub/time.h -index 64ac99a..c919c1f 100644 ---- a/include/grub/time.h -+++ b/include/grub/time.h -@@ -21,7 +21,7 @@ - - #include - #include --#ifndef GRUB_MACHINE_EMU -+#if !defined(GRUB_MACHINE_EMU) && !defined(GRUB_UTIL) - #include - #else - static inline void --- -2.4.3 - diff --git a/0111-Fix-in-tree-platform-none.patch b/0111-Fix-in-tree-platform-none.patch deleted file mode 100644 index 65deb75..0000000 --- a/0111-Fix-in-tree-platform-none.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 77063f4cb672f423272db7e21ca448cf3de98dcf Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 25 Sep 2014 20:59:26 +0100 -Subject: [PATCH 111/506] Fix in-tree --platform=none - -* configure.ac: Only remove include/grub/cpu and -include/grub/machine in the --platform=none case, not all of -include/grub. ---- - ChangeLog | 8 ++++++++ - configure.ac | 2 +- - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 08cc7c6..192e8bc 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,11 @@ -+2014-09-25 Colin Watson -+ -+ Fix in-tree --platform=none -+ -+ * configure.ac: Only remove include/grub/cpu and -+ include/grub/machine in the --platform=none case, not all of -+ include/grub. -+ - 2014-09-23 Colin Watson - - Add a new "none" platform that only builds utilities -diff --git a/configure.ac b/configure.ac -index fdf0fdc..31d2b0b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1755,7 +1755,7 @@ if test "$platform" != none; then - else - # Just enough to stop the compiler failing with -I$(srcdir)/include. - mkdir -p include 2>/dev/null -- rm -rf include/grub -+ rm -rf include/grub/cpu include/grub/machine - fi - - AC_CONFIG_FILES([Makefile]) --- -2.4.3 - diff --git a/0112-Use-full-initializer-for-initrd_ctx-to-avoid-fatal-w.patch b/0112-Use-full-initializer-for-initrd_ctx-to-avoid-fatal-w.patch deleted file mode 100644 index 820a46f..0000000 --- a/0112-Use-full-initializer-for-initrd_ctx-to-avoid-fatal-w.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 9a67e1ac8e92cd0b7521c75a734fcaf2e58523ad Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 14 Oct 2014 20:12:15 +0400 -Subject: [PATCH 112/506] Use full initializer for initrd_ctx to avoid fatal - warnings with older GCC - -struct ... foo = { 0, } is valid initializer, but older GCC emits -warning which is fatal error due to -Werror=missing-field-initializer. -So simply use full initializer to avoid these errors. This was fixed -probably in GCC 4.7. - -See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750 ---- - ChangeLog | 12 ++++++++++++ - 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 +- - 9 files changed, 20 insertions(+), 8 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 192e8bc..190d19d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,15 @@ -+2014-10-14 Andrei Borzenkov -+ -+ * grub-core/loader/arm/linux.c: Use full initializer for initrd_ctx to -+ avoid fatal warnings with older gcc (probably before 4.7). -+ * grub-core/loader/arm64/linux.c: Likewise. -+ * grub-core/loader/i386/linux.c: Likewise. -+ * grub-core/loader/i386/pc/linux.c: Likewise. -+ * grub-core/loader/ia64/efi/linux.c: Likewise. -+ * grub-core/loader/mips/linux.c: Likewise. -+ * grub-core/loader/powerpc/ieee1275/linux.c: Likewise. -+ * grub-core/loader/sparc64/ieee1275/linux.c: Likewise. -+ - 2014-09-25 Colin Watson - - Fix in-tree --platform=none -diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c -index 62cbe75..5b39f02 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 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 0dc144e..564a75a 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 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 0bd060a..291f728 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - - if (argc == 0) - { -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index e88341e..870992b 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - - if (argc == 0) - { -diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c -index eb78e6e..efaa42c 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - - if (argc == 0) - { -diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c -index 4a3e8c5..5f383be 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 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 787d7dc..6e81464 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - - if (argc == 0) - { -diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c -index c5e8dfa..6389170 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 = { 0, }; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - - if (argc == 0) - { --- -2.4.3 - diff --git a/0113-icmp6-fix-no-respond-to-neighbor-solicit-message.patch b/0113-icmp6-fix-no-respond-to-neighbor-solicit-message.patch deleted file mode 100644 index 70615ea..0000000 --- a/0113-icmp6-fix-no-respond-to-neighbor-solicit-message.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 72ec399ad8d6348b6c74ea63d80c79784c8b84ae Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Mon, 3 Nov 2014 16:27:45 +0800 -Subject: [PATCH 113/506] icmp6 fix no respond to neighbor solicit message - -The structure size used in grub_netbuff_pull to get the pointer to -option header is apparently wrong, which leads to subsequent range check -failed and therefore not responding to any neighbor solicit message in my -testing. ---- - ChangeLog | 5 +++++ - grub-core/net/icmp6.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 190d19d..87faadf 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-11-03 Michael Chang -+ -+ * grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size -+ of neighbor solicitation packet in grub_netbuff_pull. -+ - 2014-10-14 Andrei Borzenkov - - * grub-core/loader/arm/linux.c: Use full initializer for initrd_ctx to -diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index bbc9020..796d549 100644 ---- a/grub-core/net/icmp6.c -+++ b/grub-core/net/icmp6.c -@@ -205,7 +205,7 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, - if (ttl != 0xff) - break; - nbh = (struct neighbour_solicit *) nb->data; -- err = grub_netbuff_pull (nb, sizeof (struct router_adv)); -+ err = grub_netbuff_pull (nb, sizeof (*nbh)); - if (err) - { - grub_netbuff_free (nb); --- -2.4.3 - diff --git a/0114-efi-check-path-non-null-before-grub_strrchr.patch b/0114-efi-check-path-non-null-before-grub_strrchr.patch deleted file mode 100644 index ab83223..0000000 --- a/0114-efi-check-path-non-null-before-grub_strrchr.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 004a2b1efdd782cf946387d2060ad9250d61c435 Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Mon, 17 Nov 2014 14:11:01 +0000 -Subject: [PATCH 114/506] efi: check *path non-null before grub_strrchr - -The EFI version of grub_machine_get_bootlocation crops the boot image -name back to the last / in order to get a directory path. However, it -does not check that *name is actually set before calling grub_strrchr -to do this, and neither does grub_strrchr before dereferencing a NULL -pointer. - -Parent function, grub_set_prefix_and_root, does check the pointer -before using. ---- - ChangeLog | 5 +++++ - grub-core/kern/efi/init.c | 11 +++++++---- - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 87faadf..07d0646 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-01-07 Leif Lindholm -+ -+ * grub-core/kern/efi/init.c: check value of *path before -+ dereferencing. -+ - 2014-11-03 Michael Chang - - * grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 942ab02..e9c85de 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -63,10 +63,13 @@ grub_machine_get_bootlocation (char **device, char **path) - if (!*device && grub_efi_net_config) - grub_efi_net_config (image->device_handle, device, path); - -- /* Get the directory. */ -- p = grub_strrchr (*path, '/'); -- if (p) -- *p = '\0'; -+ if (*path) -+ { -+ /* Get the directory. */ -+ p = grub_strrchr (*path, '/'); -+ if (p) -+ *p = '\0'; -+ } - } - - void --- -2.4.3 - diff --git a/0115-Fix-date-in-last-ChangeLog-entry.patch b/0115-Fix-date-in-last-ChangeLog-entry.patch deleted file mode 100644 index feed54e..0000000 --- a/0115-Fix-date-in-last-ChangeLog-entry.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 2ccaa3b9fdc3e71e9e2e68acfa3054233a2a30b2 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 20 Nov 2014 20:54:49 +0300 -Subject: [PATCH 115/506] Fix date in last ChangeLog entry - ---- - ChangeLog | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 07d0646..b86feea 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,4 +1,4 @@ --2014-01-07 Leif Lindholm -+2014-11-07 Leif Lindholm - - * grub-core/kern/efi/init.c: check value of *path before - dereferencing. --- -2.4.3 - diff --git a/0116-grub-fs-tester-consistently-print-output-of-grub-ls-.patch b/0116-grub-fs-tester-consistently-print-output-of-grub-ls-.patch deleted file mode 100644 index 9bd32b3..0000000 --- a/0116-grub-fs-tester-consistently-print-output-of-grub-ls-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e2dd6daa8c33e3e7641e442dc269fcca479c6fda Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 20 Nov 2014 20:56:51 +0300 -Subject: [PATCH 116/506] grub-fs-tester: consistently print output of grub ls - if test fails - ---- - ChangeLog | 5 +++++ - tests/util/grub-fs-tester.in | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index b86feea..6fbec06 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-11-20 Andrei Borzenkov -+ -+ * tests/util/grub-fs-tester.in: Consistently print output -+ of grub ls if test fails. -+ - 2014-11-07 Leif Lindholm - - * grub-core/kern/efi/init.c: check value of *path before -diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in -index 669527a..5656927 100644 ---- a/tests/util/grub-fs-tester.in -+++ b/tests/util/grub-fs-tester.in -@@ -1065,6 +1065,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - : - else - echo NLIST FAIL -+ echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" - exit 1 - fi -@@ -1082,6 +1083,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - : - else - echo LONG LIST FAIL -+ echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" - exit 1 - fi --- -2.4.3 - diff --git a/0117-send-router-solicitation-for-ipv6-address-autoconf-v.patch b/0117-send-router-solicitation-for-ipv6-address-autoconf-v.patch deleted file mode 100644 index aee1165..0000000 --- a/0117-send-router-solicitation-for-ipv6-address-autoconf-v.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 7c4b6b7bb476963ca7e86f79d32036e7f80d27f6 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Tue, 18 Nov 2014 16:03:08 +0800 -Subject: [PATCH 117/506] send router solicitation for ipv6 address autoconf v2 - -Many routers have long router advertisment interval configured by -default. The Neighbor Discovery protocol (RFC4861) has defined default -MaxRtrAdvInterval value as 600 seconds and -MinRtrAdvInterval as 0.33*MaxRtrAdvInterval. This makes -net_ipv6_autoconf fails more often than not as currently it passively -listens the RA message to perfom address autoconfiguration. - -This patch tries to send router solicitation to overcome the problem of -long RA interval. - -v2: -use cpu_to_be macro for network byte order conversion -add missing error handling ---- - grub-core/net/icmp6.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ - grub-core/net/net.c | 4 ++- - include/grub/net/ip.h | 2 ++ - 3 files changed, 88 insertions(+), 1 deletion(-) - -diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index 796d549..7822394 100644 ---- a/grub-core/net/icmp6.c -+++ b/grub-core/net/icmp6.c -@@ -72,6 +72,11 @@ struct neighbour_advertise - grub_uint64_t target[2]; - } GRUB_PACKED; - -+struct router_solicit -+{ -+ grub_uint32_t reserved; -+} GRUB_PACKED; -+ - enum - { - FLAG_SLAAC = 0x40 -@@ -81,6 +86,7 @@ enum - { - ICMP6_ECHO = 128, - ICMP6_ECHO_REPLY = 129, -+ ICMP6_ROUTER_SOLICIT = 133, - ICMP6_ROUTER_ADVERTISE = 134, - ICMP6_NEIGHBOUR_SOLICIT = 135, - ICMP6_NEIGHBOUR_ADVERTISE = 136, -@@ -533,3 +539,80 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf, - grub_netbuff_free (nb); - return err; - } -+ -+grub_err_t -+grub_net_icmp6_send_router_solicit (struct grub_net_network_level_interface *inf) -+{ -+ struct grub_net_buff *nb; -+ grub_err_t err = GRUB_ERR_NONE; -+ grub_net_network_level_address_t multicast; -+ grub_net_link_level_address_t ll_multicast; -+ struct option_header *ohdr; -+ struct router_solicit *sol; -+ struct icmp_header *icmphr; -+ -+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ multicast.ipv6[0] = grub_cpu_to_be64 (0xff02ULL << 48); -+ multicast.ipv6[1] = grub_cpu_to_be64 (0x02ULL); -+ -+ err = grub_net_link_layer_resolve (inf, &multicast, &ll_multicast); -+ if (err) -+ return err; -+ -+ nb = grub_netbuff_alloc (sizeof (struct router_solicit) -+ + sizeof (struct option_header) -+ + 6 -+ + sizeof (struct icmp_header) -+ + GRUB_NET_OUR_IPV6_HEADER_SIZE -+ + GRUB_NET_MAX_LINK_HEADER_SIZE); -+ if (!nb) -+ return grub_errno; -+ err = grub_netbuff_reserve (nb, -+ sizeof (struct router_solicit) -+ + sizeof (struct option_header) -+ + 6 -+ + sizeof (struct icmp_header) -+ + GRUB_NET_OUR_IPV6_HEADER_SIZE -+ + GRUB_NET_MAX_LINK_HEADER_SIZE); -+ if (err) -+ goto fail; -+ -+ err = grub_netbuff_push (nb, 6); -+ if (err) -+ goto fail; -+ -+ grub_memcpy (nb->data, inf->hwaddress.mac, 6); -+ -+ err = grub_netbuff_push (nb, sizeof (*ohdr)); -+ if (err) -+ goto fail; -+ -+ ohdr = (struct option_header *) nb->data; -+ ohdr->type = OPTION_SOURCE_LINK_LAYER_ADDRESS; -+ ohdr->len = 1; -+ -+ err = grub_netbuff_push (nb, sizeof (*sol)); -+ if (err) -+ goto fail; -+ -+ sol = (struct router_solicit *) nb->data; -+ sol->reserved = 0; -+ -+ err = grub_netbuff_push (nb, sizeof (*icmphr)); -+ if (err) -+ goto fail; -+ -+ icmphr = (struct icmp_header *) nb->data; -+ icmphr->type = ICMP6_ROUTER_SOLICIT; -+ icmphr->code = 0; -+ icmphr->checksum = 0; -+ icmphr->checksum = grub_net_ip_transport_checksum (nb, -+ GRUB_NET_IP_ICMPV6, -+ &inf->address, -+ &multicast); -+ err = grub_net_send_ip_packet (inf, &multicast, &ll_multicast, nb, -+ GRUB_NET_IP_ICMPV6); -+ fail: -+ grub_netbuff_free (nb); -+ return err; -+} -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 82af3a0..21a4e94 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -380,12 +380,14 @@ grub_cmd_ipv6_autoconf (struct grub_command *cmd __attribute__ ((unused)), - - for (interval = 200; interval < 10000; interval *= 2) - { -- /* FIXME: send router solicitation. */ - int done = 1; - for (j = 0; j < ncards; j++) - { - if (slaacs[j]->slaac_counter) - continue; -+ err = grub_net_icmp6_send_router_solicit (ifaces[j]); -+ if (err) -+ err = GRUB_ERR_NONE; - done = 0; - } - if (done) -diff --git a/include/grub/net/ip.h b/include/grub/net/ip.h -index 7a8e614..dcceaa5 100644 ---- a/include/grub/net/ip.h -+++ b/include/grub/net/ip.h -@@ -92,4 +92,6 @@ grub_err_t - grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf, - const grub_net_network_level_address_t *proto_addr); - -+grub_err_t -+grub_net_icmp6_send_router_solicit (struct grub_net_network_level_interface *inf); - #endif --- -2.4.3 - diff --git a/0118-grub-mkstandalone-out-of-bound-access-to-tar-header-.patch b/0118-grub-mkstandalone-out-of-bound-access-to-tar-header-.patch deleted file mode 100644 index eb8d293..0000000 --- a/0118-grub-mkstandalone-out-of-bound-access-to-tar-header-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 478b5675209ab0263b8271764ef85d8fc1faec42 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 20:39:22 +0300 -Subject: [PATCH 118/506] grub-mkstandalone: out of bound access to tar header - magic - -Magic size is 6 bytes and we copied 7 bytes in it. - -CID: 73587, 73888 -Closes bug 43690 ---- - ChangeLog | 5 +++++ - util/grub-mkstandalone.c | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6fbec06..930ceb2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-11-28 Andrei Borzenkov -+ -+ * util/grub-mkstandalone.c (add_tar_file): Fix out of bound access -+ to hd.magic (Coverity CID 73587, 73888, bug 43690). -+ - 2014-11-20 Andrei Borzenkov - - * tests/util/grub-fs-tester.in: Consistently print output -diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c -index 8e2a2b8..6017d71 100644 ---- a/util/grub-mkstandalone.c -+++ b/util/grub-mkstandalone.c -@@ -236,7 +236,7 @@ add_tar_file (const char *from, - set_tar_value (hd.size, optr - tcn, 12); - set_tar_value (hd.mtime, mtime, 12); - hd.typeflag = 'L'; -- memcpy (hd.magic, "ustar ", 7); -+ memcpy (hd.magic, MAGIC, sizeof (hd.magic)); - memcpy (hd.uname, "grub", 4); - memcpy (hd.gname, "grub", 4); - -@@ -266,7 +266,7 @@ add_tar_file (const char *from, - set_tar_value (hd.size, size, 12); - set_tar_value (hd.mtime, mtime, 12); - hd.typeflag = '0'; -- memcpy (hd.magic, "ustar ", 7); -+ memcpy (hd.magic, MAGIC, sizeof (hd.magic)); - memcpy (hd.uname, "grub", 4); - memcpy (hd.gname, "grub", 4); - --- -2.4.3 - diff --git a/0119-grub-install-common-avoid-out-of-bound-access-when-r.patch b/0119-grub-install-common-avoid-out-of-bound-access-when-r.patch deleted file mode 100644 index 44744b0..0000000 --- a/0119-grub-install-common-avoid-out-of-bound-access-when-r.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0415dbe28f3dc3520b70745b3bd78073f094fb4d Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 20:45:27 +0300 -Subject: [PATCH 119/506] grub-install-common: avoid out of bound access when - read failed - -Check that modinfo.sh could be read successfully; abort on error. Avoids -potential out-of-bound array access. - -CID: 73819 ---- - ChangeLog | 2 ++ - util/grub-install-common.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 930ceb2..e46b999 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,7 @@ - 2014-11-28 Andrei Borzenkov - -+ * util/grub-install-common.c (grub_install_get_target): Check return -+ value of grub_util_fd_read (Coverity CID 73819). - * util/grub-mkstandalone.c (add_tar_file): Fix out of bound access - to hd.magic (Coverity CID 73587, 73888, bug 43690). - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index c8bedcb..4b5d4d4 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -911,6 +911,8 @@ grub_install_get_target (const char *src) - grub_util_error (_("%s doesn't exist. Please specify --target or --directory"), - fn); - r = grub_util_fd_read (f, buf, sizeof (buf) - 1); -+ if (r < 0) -+ grub_util_error (_("cannot read `%s': %s"), fn, strerror (errno)); - grub_util_fd_close (f); - buf[r] = '\0'; - c = strstr (buf, "grub_modinfo_target_cpu="); --- -2.4.3 - diff --git a/0120-grub-core-disk-luks.c-fix-use-after-free-and-memory-.patch b/0120-grub-core-disk-luks.c-fix-use-after-free-and-memory-.patch deleted file mode 100644 index 7bd0cf9..0000000 --- a/0120-grub-core-disk-luks.c-fix-use-after-free-and-memory-.patch +++ /dev/null @@ -1,136 +0,0 @@ -From ea44693fc8cbe9e8e8566f16e3dc4031c98b063a Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 21:12:00 +0300 -Subject: [PATCH 120/506] grub-core/disk/luks.c: fix use after free and memory - leaks - -configure_ciphers: - -- several memory leaks where allocated ciphers were not freed. CID: 73813, -73710 - -- use after free. It is probably quite innocent as grub is single threaded, -but could potentially be a problem with memory allocator debugger turned on. -CID: 73730 - -luks_recover_key: - -- memory leak. CID: 73854 ---- - ChangeLog | 4 ++++ - grub-core/disk/luks.c | 19 ++++++++++++++++--- - 2 files changed, 20 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index e46b999..0ba21d5 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2014-11-28 Andrei Borzenkov - -+ * grub-core/disk/luks.c (configure_ciphers): Fix memory leaks -+ and use after free (Coverity CID 73813, 73710, 73730) -+ * grub-core/disk/luks.c (luks_recover_key): Fix memory leak (Coverity -+ CID 73854) - * util/grub-install-common.c (grub_install_get_target): Check return - value of grub_util_fd_read (Coverity CID 73819). - * util/grub-mkstandalone.c (add_tar_file): Fix out of bound access -diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c -index 2502029..86c50c6 100644 ---- a/grub-core/disk/luks.c -+++ b/grub-core/disk/luks.c -@@ -143,6 +143,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - { - grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d", - grub_be_to_cpu32 (header.keyBytes)); -+ grub_crypto_cipher_close (cipher); - return NULL; - } - -@@ -181,9 +182,10 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - } - if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) - { -- grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", - cipher->cipher->blocksize); -+ grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) -@@ -191,6 +193,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", - secondary_cipher->cipher->blocksize); -+ grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - } -@@ -200,9 +203,9 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - cipheriv = ciphermode + sizeof ("lrw-") - 1; - if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) - { -- grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d", - cipher->cipher->blocksize); -+ grub_crypto_cipher_close (cipher); - return NULL; - } - } -@@ -225,6 +228,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - || cipher->cipher->blocksize == 0) - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported benbi blocksize: %d", - cipher->cipher->blocksize); -+ /* FIXME should we return an error here? */ - for (benbi_log = 0; - (cipher->cipher->blocksize << benbi_log) < GRUB_DISK_SECTOR_SIZE; - benbi_log++); -@@ -243,6 +247,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - if (!essiv_hash) - { - grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); - grub_error (GRUB_ERR_FILE_NOT_FOUND, - "Couldn't load %s hash", hash_str); - return NULL; -@@ -251,12 +256,14 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - if (!essiv_cipher) - { - grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - } - else - { - grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown IV mode: %s", - cipheriv); - return NULL; -@@ -276,7 +283,12 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - - newdev = grub_zalloc (sizeof (struct grub_cryptodisk)); - if (!newdev) -- return NULL; -+ { -+ grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (essiv_cipher); -+ grub_crypto_cipher_close (secondary_cipher); -+ return NULL; -+ } - newdev->cipher = cipher; - newdev->offset = grub_be_to_cpu32 (header.payloadOffset); - newdev->source_disk = NULL; -@@ -451,6 +463,7 @@ luks_recover_key (grub_disk_t source, - return GRUB_ERR_NONE; - } - -+ grub_free (split_key); - return GRUB_ACCESS_DENIED; - } - --- -2.4.3 - diff --git a/0121-Use-ssize_t-for-grub_util_fd_read-result.patch b/0121-Use-ssize_t-for-grub_util_fd_read-result.patch deleted file mode 100644 index cd91d90..0000000 --- a/0121-Use-ssize_t-for-grub_util_fd_read-result.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 740c08ed2ff33625bdc2e0ad9ef6264978bf32cf Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 21:43:07 +0300 -Subject: [PATCH 121/506] Use ssize_t for grub_util_fd_read result - -Fixes commit 0415dbe28f3dc3520b70745b3bd78073f094fb4d. ---- - util/grub-install-common.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 4b5d4d4..b6dec93 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -902,7 +902,7 @@ grub_install_get_target (const char *src) - char *fn; - grub_util_fd_t f; - char buf[2048]; -- size_t r; -+ ssize_t r; - char *c, *pl, *p; - size_t i; - fn = grub_util_path_concat (2, src, "modinfo.sh"); --- -2.4.3 - diff --git a/0122-grub-core-disk-geli.c-fix-memory-leaks-in-error-path.patch b/0122-grub-core-disk-geli.c-fix-memory-leaks-in-error-path.patch deleted file mode 100644 index 88a22b9..0000000 --- a/0122-grub-core-disk-geli.c-fix-memory-leaks-in-error-path.patch +++ /dev/null @@ -1,50 +0,0 @@ -From bbbcb791ed06c75f3dd6a2671a57a67fa86bf2ca Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 22:23:30 +0300 -Subject: [PATCH 122/506] grub-core/disk/geli.c: fix memory leaks in error - paths - -CID: 73813, 73710 ---- - grub-core/disk/geli.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c -index 9025c9d..1727341 100644 ---- a/grub-core/disk/geli.c -+++ b/grub-core/disk/geli.c -@@ -332,19 +332,29 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - { - secondary_cipher = grub_crypto_cipher_open (ciph); - if (!secondary_cipher) -- return NULL; -+ { -+ grub_crypto_cipher_close (cipher); -+ return NULL; -+ } -+ - } - - if (grub_le_to_cpu16 (header.keylen) > 1024) - { - grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d", - grub_le_to_cpu16 (header.keylen)); -+ grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - - newdev = grub_zalloc (sizeof (struct grub_cryptodisk)); - if (!newdev) -- return NULL; -+ { -+ grub_crypto_cipher_close (cipher); -+ grub_crypto_cipher_close (secondary_cipher); -+ return NULL; -+ } - newdev->cipher = cipher; - newdev->secondary_cipher = secondary_cipher; - newdev->offset = 0; --- -2.4.3 - diff --git a/0123-Fix-ChangeLog.patch b/0123-Fix-ChangeLog.patch deleted file mode 100644 index 57abc42..0000000 --- a/0123-Fix-ChangeLog.patch +++ /dev/null @@ -1,24 +0,0 @@ -From f07784e8901906d47b892bc49b44dd7c832cebdd Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 22:35:01 +0300 -Subject: [PATCH 123/506] Fix ChangeLog - ---- - ChangeLog | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 0ba21d5..504d829 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,7 @@ - 2014-11-28 Andrei Borzenkov - -+ * grub-core/disk/geli.c (configure_ciphers): Fix memory leaks -+ (Coverity CID 73813, 73710) - * grub-core/disk/luks.c (configure_ciphers): Fix memory leaks - and use after free (Coverity CID 73813, 73710, 73730) - * grub-core/disk/luks.c (luks_recover_key): Fix memory leak (Coverity --- -2.4.3 - diff --git a/0124-grub-core-disk-lzopio.c-fix-double-free-in-error-pat.patch b/0124-grub-core-disk-lzopio.c-fix-double-free-in-error-pat.patch deleted file mode 100644 index 7ee8ad2..0000000 --- a/0124-grub-core-disk-lzopio.c-fix-double-free-in-error-pat.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 343dad410eaa37f4f02eff6a4a4114102d211a28 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 28 Nov 2014 22:37:00 +0300 -Subject: [PATCH 124/506] grub-core/disk/lzopio.c: fix double free in error - path - -CID: 73665 ---- - ChangeLog | 1 + - grub-core/io/lzopio.c | 2 -- - 2 files changed, 1 insertion(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 504d829..b6220de 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,6 @@ - 2014-11-28 Andrei Borzenkov - -+ * grub-core/io/lzopio.c (test_header): Fix double free (CID 73665) - * grub-core/disk/geli.c (configure_ciphers): Fix memory leaks - (Coverity CID 73813, 73710) - * grub-core/disk/luks.c (configure_ciphers): Fix memory leaks -diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c -index de2ea67..7559c6c 100644 ---- a/grub-core/io/lzopio.c -+++ b/grub-core/io/lzopio.c -@@ -403,8 +403,6 @@ test_header (grub_file_t file) - return 1; - - CORRUPTED: -- grub_free(name); -- - return 0; - } - --- -2.4.3 - diff --git a/0125-grub-core-lib-syslinux_parse.c-do-not-free-array.patch b/0125-grub-core-lib-syslinux_parse.c-do-not-free-array.patch deleted file mode 100644 index 6fe1ea1..0000000 --- a/0125-grub-core-lib-syslinux_parse.c-do-not-free-array.patch +++ /dev/null @@ -1,40 +0,0 @@ -From dbbac5a04c7cec1c14026e807e998eae387ddee4 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 30 Nov 2014 18:48:42 +0300 -Subject: [PATCH 125/506] grub-core/lib/syslinux_parse.c: do not free array - -say->msg is inline array in a structure and should not be freed. -CID: 73610 ---- - ChangeLog | 5 +++++ - grub-core/lib/syslinux_parse.c | 1 - - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index b6220de..21434ff 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-11-30 Andrei Borzenkov -+ -+ * grub-core/lib/syslinux_parse.c (free_menu): Do not free -+ inline array (CID 73610). -+ - 2014-11-28 Andrei Borzenkov - - * grub-core/io/lzopio.c (test_header): Fix double free (CID 73665) -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 6bc504b..08e451c 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -1351,7 +1351,6 @@ free_menu (struct syslinux_menu *menu) - for (say = menu->say; say ; say = nsay) - { - nsay = say->next; -- grub_free (say->msg); - grub_free (say); - } - --- -2.4.3 - diff --git a/0126-grub-core-fs-zfs-zfsinfo.c-memory-leak-in-print_vdev.patch b/0126-grub-core-fs-zfs-zfsinfo.c-memory-leak-in-print_vdev.patch deleted file mode 100644 index 331bf70..0000000 --- a/0126-grub-core-fs-zfs-zfsinfo.c-memory-leak-in-print_vdev.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 03d79a878ba04db2cfbbe05564728748de0f6a2f Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 1 Dec 2014 20:54:12 +0300 -Subject: [PATCH 126/506] grub-core/fs/zfs/zfsinfo.c: memory leak in - print_vdev_info - -CID: 73635 ---- - ChangeLog | 5 +++++ - grub-core/fs/zfs/zfsinfo.c | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 21434ff..dd44cd8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-12-01 Andrei Borzenkov -+ -+ * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Fix memory leak -+ (CID 73635). -+ - 2014-11-30 Andrei Borzenkov - - * grub-core/lib/syslinux_parse.c (free_menu): Do not free -diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c -index c96bf21..c8a28ac 100644 ---- a/grub-core/fs/zfs/zfsinfo.c -+++ b/grub-core/fs/zfs/zfsinfo.c -@@ -130,10 +130,12 @@ print_vdev_info (char *nvlist, int tab) - grub_free (bootpath); - grub_free (devid); - grub_free (path); -+ grub_free (type); - return GRUB_ERR_NONE; - } - char is_mirror=(grub_strcmp(type,VDEV_TYPE_MIRROR) == 0); - char is_raidz=(grub_strcmp(type,VDEV_TYPE_RAIDZ) == 0); -+ grub_free (type); - - if (is_mirror || is_raidz) - { --- -2.4.3 - diff --git a/0127-grub-core-loader-i386-xen_fileXX.c-memory-leak-in-gr.patch b/0127-grub-core-loader-i386-xen_fileXX.c-memory-leak-in-gr.patch deleted file mode 100644 index 84e93c8..0000000 --- a/0127-grub-core-loader-i386-xen_fileXX.c-memory-leak-in-gr.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 3173c7501ccc02e1475261404fc8b0199be6314e Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 1 Dec 2014 21:23:54 +0300 -Subject: [PATCH 127/506] grub-core/loader/i386/xen_fileXX.c: memory leak in - grub_xen_get_infoXX - -CID: 73645, 73782 ---- - ChangeLog | 2 ++ - grub-core/loader/i386/xen_fileXX.c | 30 +++++++++++++++++++++++------- - 2 files changed, 25 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index dd44cd8..46f049d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,7 @@ - 2014-12-01 Andrei Borzenkov - -+ * grub-core/loader/i386/xen_fileXX.c (grub_xen_get_infoXX): Fix -+ memory leak (CID 73645, 73782). - * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Fix memory leak - (CID 73635). - -diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c -index 73a5f90..1ba5649 100644 ---- a/grub-core/loader/i386/xen_fileXX.c -+++ b/grub-core/loader/i386/xen_fileXX.c -@@ -311,14 +311,19 @@ grub_xen_get_infoXX (grub_elf_t elf, struct grub_xen_file_info *xi) - return grub_errno; - - if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1) -- return grub_errno; -+ { -+ err = grub_errno; -+ goto cleanup; -+ } - - if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize) - { - if (grub_errno) -- return grub_errno; -- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -+ err = grub_errno; -+ else -+ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - elf->file->name); -+ goto cleanup; - } - - s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize); -@@ -330,18 +335,29 @@ grub_xen_get_infoXX (grub_elf_t elf, struct grub_xen_file_info *xi) - char name[sizeof("__xen_guest")]; - grub_memset (name, 0, sizeof (name)); - if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1) -- return grub_errno; -+ { -+ err = grub_errno; -+ goto cleanup; -+ } - - if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) - { - if (grub_errno) -- return grub_errno; -+ { -+ err = grub_errno; -+ goto cleanup; -+ } - continue; - } - if (grub_memcmp (name, "__xen_guest", - sizeof("__xen_guest")) != 0) - continue; -- return parse_xen_guest (elf, xi, s->sh_offset, s->sh_size); -+ err = parse_xen_guest (elf, xi, s->sh_offset, s->sh_size); -+ goto cleanup; - } -- return grub_error (GRUB_ERR_BAD_OS, "no XEN note found"); -+ err = grub_error (GRUB_ERR_BAD_OS, "no XEN note found"); -+ -+cleanup: -+ grub_free (s0); -+ return err; - } --- -2.4.3 - diff --git a/0128-grub-shell-support-files-also-for-net-boot.patch b/0128-grub-shell-support-files-also-for-net-boot.patch deleted file mode 100644 index e3f66c4..0000000 --- a/0128-grub-shell-support-files-also-for-net-boot.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 4b94e3227b611a381e96ab41899cd4e8682f995d Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 5 Dec 2014 19:55:59 +0300 -Subject: [PATCH 128/506] grub-shell: support --files also for net boot - -This allows running tests that require extra files using netboot as well. ---- - ChangeLog | 4 ++++ - tests/util/grub-shell.in | 17 +++++++++++++++++ - 2 files changed, 21 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 46f049d..c163cd5 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2014-12-05 Andrei Borzenkov -+ -+ * tests/util/grub-shell.in: Support --files also for netboot. -+ - 2014-12-01 Andrei Borzenkov - - * grub-core/loader/i386/xen_fileXX.c (grub_xen_get_infoXX): Fix -diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in -index d9a5253..5b66139 100644 ---- a/tests/util/grub-shell.in -+++ b/tests/util/grub-shell.in -@@ -422,11 +422,28 @@ do_trim () - fi - } - -+copy_extra_files() { -+ _destdir="$1" -+ shift -+ -+ # FIXME support '=' in file names -+ for _file in "$@"; do -+ _target="${_file%=*}" -+ _source="${_file#*=}" -+ [ -n "$_source" ] || _source="$_target" -+ _target="$_destdir/$_target" -+ _targetdir="$(dirname "$_target")" -+ [ -d "$_targetdir" ] || mkdir -p "$_targetdir" -+ cp "$_source" "$_target" -+ done -+} -+ - if [ x$boot = xnet ]; then - netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 - pkgdatadir="@builddir@" "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null - cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" - cp "${source}" "$netdir/boot/grub/testcase.cfg" -+ [ -z "$files" ] || copy_extra_files "$netdir" $files - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim - elif [ x$boot = xemu ]; then - grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" --- -2.4.3 - diff --git a/0129-add-file-filters-tests.patch b/0129-add-file-filters-tests.patch deleted file mode 100644 index 3127c5a..0000000 --- a/0129-add-file-filters-tests.patch +++ /dev/null @@ -1,322 +0,0 @@ -From 272e0466da16d0f8ce782895de4189c1585de9f3 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 5 Dec 2014 20:19:58 +0300 -Subject: [PATCH 129/506] add file filters tests - -Tests file access with all filters enabled. It does it both for local -and network access, due to regression in signature checking over network. - -This includes all files in distribution to not depend on existence -of compression tools and gpg. Test preloads all required modules to -avoid having to provide signatures for them. - -Still not implemented is file offset filter (is not available in grub -script, needs extra module) ---- - ChangeLog | 12 +++++++ - Makefile.util.def | 6 ++++ - conf/Makefile.extra-dist | 11 ++++++ - tests/file_filter/file.gz | Bin 0 -> 33 bytes - tests/file_filter/file.gz.sig | Bin 0 -> 96 bytes - tests/file_filter/file.lzop | Bin 0 -> 67 bytes - tests/file_filter/file.lzop.sig | Bin 0 -> 96 bytes - tests/file_filter/file.xz | Bin 0 -> 72 bytes - tests/file_filter/file.xz.sig | Bin 0 -> 96 bytes - tests/file_filter/keys | Bin 0 -> 994 bytes - tests/file_filter/keys.pub | Bin 0 -> 990 bytes - tests/file_filter/test.cfg | 6 ++++ - tests/file_filter_test.in | 76 ++++++++++++++++++++++++++++++++++++++++ - 13 files changed, 111 insertions(+) - create mode 100644 tests/file_filter/file.gz - create mode 100644 tests/file_filter/file.gz.sig - create mode 100644 tests/file_filter/file.lzop - create mode 100644 tests/file_filter/file.lzop.sig - create mode 100644 tests/file_filter/file.xz - create mode 100644 tests/file_filter/file.xz.sig - create mode 100644 tests/file_filter/keys - create mode 100644 tests/file_filter/keys.pub - create mode 100644 tests/file_filter/test.cfg - create mode 100644 tests/file_filter_test.in - -diff --git a/ChangeLog b/ChangeLog -index c163cd5..91ea81f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,6 +1,18 @@ - 2014-12-05 Andrei Borzenkov - - * tests/util/grub-shell.in: Support --files also for netboot. -+ * tests/file_filter_test.in: New file with file filters tests. -+ * Makefile.util.def: Add file_filter_test. -+ * conf/Makefile.extra-dist: ... and here. -+ * tests/file_filter/file.gz: Test file for file_filter_test. -+ * tests/file_filter/file.gz.sig: Likewise. -+ * tests/file_filter/file.lzop: Likewise. -+ * tests/file_filter/file.lzop.sig: Likewise. -+ * tests/file_filter/file.xz: Likewise. -+ * tests/file_filter/file.xz.sig: Likewise. -+ * tests/file_filter/keys: Likewise. -+ * tests/file_filter/keys.pub: Likewise. -+ * tests/file_filter/test.cfg: Likewise. - - 2014-12-01 Andrei Borzenkov - -diff --git a/Makefile.util.def b/Makefile.util.def -index a286a89..fed96d8 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -1150,6 +1150,12 @@ script = { - common = tests/grub_cmd_tr.in; - }; - -+script = { -+ testcase; -+ name = file_filter_test; -+ common = tests/file_filter_test.in; -+}; -+ - program = { - testcase; - name = example_unit_test; -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 51f08c1..1b95ccd 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -110,3 +110,14 @@ EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz - EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz - - EXTRA_DIST += coreboot.cfg -+ -+EXTRA_DIST += tests/file_filter/file -+EXTRA_DIST += tests/file_filter/file.gz -+EXTRA_DIST += tests/file_filter/file.gz.sig -+EXTRA_DIST += tests/file_filter/file.lzop -+EXTRA_DIST += tests/file_filter/file.lzop.sig -+EXTRA_DIST += tests/file_filter/file.xz -+EXTRA_DIST += tests/file_filter/file.xz.sig -+EXTRA_DIST += tests/file_filter/keys -+EXTRA_DIST += tests/file_filter/keys.pub -+EXTRA_DIST += tests/file_filter/test.cfg -diff --git a/tests/file_filter/file.gz b/tests/file_filter/file.gz -new file mode 100644 -index 0000000000000000000000000000000000000000..a07ffcbe0cbad415ea51ec72bbe7b54094284d3d -GIT binary patch -literal 33 -pcmb2|=3qFtrZI$p`LoB_lP9kSYUuju20dY7FxvO)Cocm70|4R_48H&X - -literal 0 -HcmV?d00001 - -diff --git a/tests/file_filter/file.gz.sig b/tests/file_filter/file.gz.sig -new file mode 100644 -index 0000000000000000000000000000000000000000..602e6187e22d7fc288a52ac572f38cc1066083cb -GIT binary patch -literal 96 -zcmV-m0H6PeUIYLU2ml5J0#t#n2LK8Q5M~MT@8nv<3h9^t|7f?gmaE1LNh!Sm;mO#P -zdLo*tTpkl+s!TB^f%Fh1{Q&^Tlz2`!Q4Giq -Ct|zAe - -literal 0 -HcmV?d00001 - -diff --git a/tests/file_filter/file.lzop b/tests/file_filter/file.lzop -new file mode 100644 -index 0000000000000000000000000000000000000000..5f5a97171821de55168fcbdc9b1b335316d295b9 -GIT binary patch -literal 67 -zcmeD5iSlRQ<&xqOFi>dVbYNsjC(Bu@f@NKNp%ec7JvFb-Lz3O)* -CVl0pV - -literal 0 -HcmV?d00001 - -diff --git a/tests/file_filter/file.xz b/tests/file_filter/file.xz -new file mode 100644 -index 0000000000000000000000000000000000000000..151a98029033dd0947d54f8ddad670da85a45185 -GIT binary patch -literal 72 -zcmexsUKJ6=z`*kC+7>q^21Q0O1_p)_{ill=8F)NWb8_-^6iSOzixjzl!VG^@7(cF= -Z)UCz9sLER?d1RaXw$HVUAPJVpC;$*f6z~85 - -literal 0 -HcmV?d00001 - -diff --git a/tests/file_filter/file.xz.sig b/tests/file_filter/file.xz.sig -new file mode 100644 -index 0000000000000000000000000000000000000000..57569242e4742cdfb929307ec19440cf91f49e9a -GIT binary patch -literal 96 -zcmV-m0H6PeUIYLU2ml5J0#t#n3jhiU5M~MT@8nv<3OS$v{x;4Uj6+!wt^-rP*&N$| -z+5zKQ7vOO`?M~+y=au4FasdGNRgV;Q;4TNc&v05)-JLjLl54~a(Q}0wbmOZ2ne0%w -Ci77V# - -literal 0 -HcmV?d00001 - -diff --git a/tests/file_filter/keys b/tests/file_filter/keys -new file mode 100644 -index 0000000000000000000000000000000000000000..1afa71382364060d08bb0c28e36a1ff98d585fe8 -GIT binary patch -literal 994 -zcmV<810DRC11@ew%2nM8awI88}g~WvBj*BJPpr^(@>)pd~ex-<$MMPxbNPGZV|BH -zWj8IQR4B@uXKc3uaPJ1=^^Zq^DT -zGR)3)y_E}*oM=>(9mHp}SKbH+oTA=g$}Y_>Yo72Jn4N$d^(*k!0WN3*`c`xB4p;&y -zxUni$jurte*DGtmax;-CBK;ReR-(#??6SOFAtnGFD6+^8CX~5LD{yPt|2mUMt -zwJE)m>0ZFNaB_Tkn{@&~ymmqz6=oI&zK^|yp26yNF-zSkq2MW>GyFClY9q{@=2rys -zhJs5IhyReW6c9&Zrk@1~&dA`O!?SH6dN^nA@=cwz&`Ezpv7R;6gk|My_?I8#%?Z*v -z0G=T3S|-k)ND-11n=+U)J=DUmZ`*NlWO1qRl1d|e3jZ@ioyPN?bxzIto0ltfBGhMj -z*HF^AUdvgzSm>LzM75fVG>0caAHZcq9dkq@E1ccwLg7IkAD-Uj9eRWey-8OeDLZtP -zFGWnyh(8GDLvyN?Wb=5U*>gB4;O4Q~QA&IhlL~dxCca=f>yhv4IlbS9*wP37G*l-7 -z68Nu9XH0V?#8Mlr_|4bivnV+Xw -zydOTU@TyjupFl11F8p`)R&210tm6Y4QE*AG%aIRbg##g$XGEjNV}o~RH4hXtsdF}8 -zgc#a=4BiAs$WhG?LV$*t4U}ex(o2%HHKsbzt@0q@tiFkDvxZ4j5EO=^&d${9btru+ -zAB}{L36Q;49P;3xdCKCi1x(1w?GNPIz7@+G3MU121``j|n!I&1(;|JmS_t_VuMTgP -z(dkfWGS@ew%2nM8awI88}g~WvBj*BJPpr^(@>)pd~ex-<$MMPxbNPGZV|BH -zWj8IQR4B@uXKc3uaPJ1=^^Zq^DT -zGR)3)y_E}*oM=>(9mHp}SKbH+oTA=g$}Y_>Yo72Jn4N$d^(*k!0WN3*`c`xB4p;&y -zxUni$jurte*DGtmax;-CBK;ReR-(#??6SOFAtnGFD6+^8CX~5LD{yPt|2mUMt -zwJE)m>0ZFNaB_Tkn{@&~ymmqz6=oI&zK^|yp26yNF-zSkq2MW>GyFClY9q{@=2rys -zhJs5IhyReW6c9&Zrk@1~&dA`O!?SH6dN^nA@=cwz&`Ezpv7R;6gk|My_?I8#%?Z*v -z0G=T3S|-k)ND-11n=+U)J=DUmZ`*NlWO1qRl1d|e3jZ@ioyPN?bxzIto0ltfBGhMj -z*HF^AUdvgzSm>LzM75fVG>0caAHZcq9dkq@E1ccwLg7IkAD-Uj9eRWey-8OeDLZtP -zFGWnyh(8GDLvyN?Wb=5U*>gB4;O4Q~QA&IhlL~dxCca=f>yhv4IlbS9*wP37G*l-7 -z68Nu9XH0V?#8Mlr_|4bivnV+Xw -zydOTU@TyjupFl11F8p`)R&210tm6Y4QE*AG%aIRbg##g$XGEjNV}o~RH4hXtsdF}8 -zgc#a=4BiAs$WhG?LV$*t4U}ex(o2%HHKsbzt@0q@tiFkDvxZ4j5EO=^&d${9btru+ -zAB}{L36Q;49P;3xdCKCi1x(1w?GNPIz7@+G3MU121``j|n!I&1(;|JmS_t_VuMTgP -z(dkfWGS. -+ -+set -e -+grubshell=@builddir@/grub-shell -+ -+. "@builddir@/grub-core/modinfo.sh" -+ -+filters="gzio xzio lzopio verify" -+modules="cat mpi" -+ -+for mod in $(cut -d ' ' -f 2 "@builddir@/grub-core/crypto.lst" | sort -u); do -+ modules="$modules $mod" -+done -+ -+for file in file.gz file.xz file.lzop file.gz.sig file.xz.sig file.lzop.sig keys.pub; do -+ files="$files /$file=@srcdir@/tests/file_filter/$file" -+done -+ -+# GRUB cat command adds extra newline after file -+result="Hello, user! -+ -+Hello, user! -+ -+Hello, user!" -+ -+out="$("${grubshell}" --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")" -+if [ "$out" != "$result" ]; then -+ echo LOCAL FAIL -+ echo "$out" -+ exit 1 -+fi -+ -+# Taken from netboot_test -+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in -+ # PLATFORM: emu is different -+ *-emu) -+ exit 0;; -+ # PLATFORM: Flash targets -+ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) -+ exit 0;; -+ # FIXME: currently grub-shell uses only -kernel for loongson -+ mipsel-loongson) -+ exit 0;; -+ # FIXME: no rtl8139 support -+ i386-multiboot) -+ exit 0;; -+ # FIXME: We don't fully support netboot on ARC -+ *-arc) -+ exit 0;; -+ # FIXME: Many QEMU firmware have no netboot capability -+ *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275) -+ exit 0;; -+esac -+ -+out="$("${grubshell}" --boot=net --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")" -+if [ "$out" != "$result" ]; then -+ echo NET FAIL -+ echo "$out" -+ exit 1 -+fi -+ -+exit 0 --- -2.4.3 - diff --git a/0130-fix-memory-corruption-in-pubkey-filter-over-network.patch b/0130-fix-memory-corruption-in-pubkey-filter-over-network.patch deleted file mode 100644 index ce8e661..0000000 --- a/0130-fix-memory-corruption-in-pubkey-filter-over-network.patch +++ /dev/null @@ -1,181 +0,0 @@ -From ebb3d958aa2e1af8993c77018436bb14bec600b4 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 5 Dec 2014 21:17:08 +0300 -Subject: [PATCH 130/506] fix memory corruption in pubkey filter over network - -grub_pubkey_open closed original file after it was read; it set -io->device to NULL to prevent grub_file_close from trying to close device. -But network device itself is stacked (net -> bufio); and bufio preserved -original netfs file which hold reference to device. grub_file_close(io) -called grub_bufio_close which called grub_file_close for original file. -grub_file_close(netfs-file) now also called grub_device_close which -freed file->device->net. So file structure returned by grub_pubkey_open -now had device->net pointed to freed memory. When later file was closed, -it was attempted to be freed again. - -Change grub_pubkey_open to behave like other filters - preserve original -parent file and pass grub_file_close down to parent. In this way only the -original file will close device. We really need to move this logic into -core instead. - -Also plug memory leaks in error paths on the way. - -Reported-By: Robert Kliewer -Closes: bug #43601 ---- - ChangeLog | 2 ++ - grub-core/commands/verify.c | 72 +++++++++++++++++++++++++++++++++++++-------- - 2 files changed, 62 insertions(+), 12 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 91ea81f..a9ed5aa 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -13,6 +13,8 @@ - * tests/file_filter/keys: Likewise. - * tests/file_filter/keys.pub: Likewise. - * tests/file_filter/test.cfg: Likewise. -+ * grub-core/commands/verify.c: Fix memory corruption doing -+ signature check for network files (closes 43601). - - 2014-12-01 Andrei Borzenkov - -diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c -index 525bdd1..d599576 100644 ---- a/grub-core/commands/verify.c -+++ b/grub-core/commands/verify.c -@@ -33,6 +33,13 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - -+struct grub_verified -+{ -+ grub_file_t file; -+ void *buf; -+}; -+typedef struct grub_verified *grub_verified_t; -+ - enum - { - OPTION_SKIP_SIG = 0 -@@ -802,19 +809,39 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt, - - static int sec = 0; - -+static void -+verified_free (grub_verified_t verified) -+{ -+ if (verified) -+ { -+ grub_free (verified->buf); -+ grub_free (verified); -+ } -+} -+ - static grub_ssize_t - verified_read (struct grub_file *file, char *buf, grub_size_t len) - { -- grub_memcpy (buf, (char *) file->data + file->offset, len); -+ grub_verified_t verified = file->data; -+ -+ grub_memcpy (buf, (char *) verified->buf + file->offset, len); - return len; - } - - static grub_err_t - verified_close (struct grub_file *file) - { -- grub_free (file->data); -+ grub_verified_t verified = file->data; -+ -+ grub_file_close (verified->file); -+ verified_free (verified); - file->data = 0; -- return GRUB_ERR_NONE; -+ -+ /* device and name are freed by parent */ -+ file->device = 0; -+ file->name = 0; -+ -+ return grub_errno; - } - - struct grub_fs verified_fs = -@@ -832,6 +859,7 @@ grub_pubkey_open (grub_file_t io, const char *filename) - grub_err_t err; - grub_file_filter_t curfilt[GRUB_FILE_FILTER_MAX]; - grub_file_t ret; -+ grub_verified_t verified; - - if (!sec) - return io; -@@ -857,7 +885,10 @@ grub_pubkey_open (grub_file_t io, const char *filename) - - ret = grub_malloc (sizeof (*ret)); - if (!ret) -- return NULL; -+ { -+ grub_file_close (sig); -+ return NULL; -+ } - *ret = *io; - - ret->fs = &verified_fs; -@@ -866,29 +897,46 @@ grub_pubkey_open (grub_file_t io, const char *filename) - { - grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "big file signature isn't implemented yet"); -+ grub_file_close (sig); -+ grub_free (ret); -+ return NULL; -+ } -+ verified = grub_malloc (sizeof (*verified)); -+ if (!verified) -+ { -+ grub_file_close (sig); -+ grub_free (ret); - return NULL; - } -- ret->data = grub_malloc (ret->size); -- if (!ret->data) -+ verified->buf = grub_malloc (ret->size); -+ if (!verified->buf) - { -+ grub_file_close (sig); -+ grub_free (verified); - grub_free (ret); - return NULL; - } -- if (grub_file_read (io, ret->data, ret->size) != (grub_ssize_t) ret->size) -+ if (grub_file_read (io, verified->buf, ret->size) != (grub_ssize_t) ret->size) - { - if (!grub_errno) - grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"), - filename); -+ grub_file_close (sig); -+ verified_free (verified); -+ grub_free (ret); - return NULL; - } - -- err = grub_verify_signature_real (ret->data, ret->size, 0, sig, NULL); -+ err = grub_verify_signature_real (verified->buf, ret->size, 0, sig, NULL); - grub_file_close (sig); - if (err) -- return NULL; -- io->device = 0; -- io->name = 0; -- grub_file_close (io); -+ { -+ verified_free (verified); -+ grub_free (ret); -+ return NULL; -+ } -+ verified->file = io; -+ ret->data = verified; - return ret; - } - --- -2.4.3 - diff --git a/0131-fix-double-free-in-grub_net_recv_tcp_packet.patch b/0131-fix-double-free-in-grub_net_recv_tcp_packet.patch deleted file mode 100644 index 186f36d..0000000 --- a/0131-fix-double-free-in-grub_net_recv_tcp_packet.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 06eadf5ebf21c8520d696c6438a976e5f7c218c3 Mon Sep 17 00:00:00 2001 -From: Curtis Larsen -Date: Sun, 7 Dec 2014 11:28:57 +0300 -Subject: [PATCH 131/506] fix double free in grub_net_recv_tcp_packet - -Using the http module to download config files, produces memory errors, -after the config file is downloaded. - -The error was traced to the tcp stack in grub-core/net/tcp.c. The wrong -netbuff pointer was being freed in the clean up loop. - -Changing the code to free the correct netbuff pointer removes the runtime -error. - -Closes 42765. ---- - ChangeLog | 5 +++++ - grub-core/net/tcp.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index a9ed5aa..e5c9fd3 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-12-07 Curtis Larsen -+ -+ * grub-core/net/tcp.c (grub_net_recv_tcp_packet): Fix double -+ free when multiple empty segments were received (closes 42765). -+ - 2014-12-05 Andrei Borzenkov - - * tests/util/grub-shell.in: Support --files also for netboot. -diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c -index 2077f55..1d90f1e 100644 ---- a/grub-core/net/tcp.c -+++ b/grub-core/net/tcp.c -@@ -918,7 +918,7 @@ grub_net_recv_tcp_packet (struct grub_net_buff *nb, - do_ack = 1; - } - else -- grub_netbuff_free (nb); -+ grub_netbuff_free (nb_top); - } - if (do_ack) - ack (sock); --- -2.4.3 - diff --git a/0132-Avoid-use-of-non-portable-echo-n-in-grub-mkconfig.patch b/0132-Avoid-use-of-non-portable-echo-n-in-grub-mkconfig.patch deleted file mode 100644 index 2e614d2..0000000 --- a/0132-Avoid-use-of-non-portable-echo-n-in-grub-mkconfig.patch +++ /dev/null @@ -1,162 +0,0 @@ -From cdae5bf208f5fa6093fa34c978c5da7b5bbafc54 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 7 Dec 2014 14:56:17 +0300 -Subject: [PATCH 132/506] Avoid use of non-portable echo -n in grub-mkconfig - -util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed, -final newline is stripped by command substitution. - -util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in, -util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n -completely. - -util/grub.d/30_os-prober.in: add spaces to printed line directly - -Closes 43668. ---- - ChangeLog | 11 +++++++++++ - util/grub-mkconfig_lib.in | 4 ++-- - util/grub.d/10_kfreebsd.in | 9 ++++++--- - util/grub.d/10_linux.in | 14 ++++++++------ - util/grub.d/20_linux_xen.in | 14 ++++++++------ - util/grub.d/30_os-prober.in | 3 +-- - 6 files changed, 36 insertions(+), 19 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index e5c9fd3..b23f069 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,14 @@ -+2014-12-07 Andrei Borzenkov -+ -+ * util/grub-mkconfig_lib.in (version_test_gt): Remove redundant -+ non-portable '-n' echo option. -+ * util/grub.d/10_kfreebsd.in: Change how list is built to avoid -+ non-portable 'echo -n. -+ * util/grub.d/10_linux.in: Likewise (closes 43668). -+ * util/grub.d/20_linux_xen.in: Likewise. -+ * util/grub.d/30_os-prober.in: Print spaces directly to avoid -+ non-portable 'echo -n'. -+ - 2014-12-07 Curtis Larsen - - * grub-core/net/tcp.c (grub_net_recv_tcp_packet): Fix double -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 14fadbc..29ef865 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -246,8 +246,8 @@ version_test_gt () - fi - case "$version_test_gt_a:$version_test_gt_b" in - *.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 ;; - esac - version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" - return "$?" -diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in -index ba7175b..65f6c32 100644 ---- a/util/grub.d/10_kfreebsd.in -+++ b/util/grub.d/10_kfreebsd.in -@@ -143,9 +143,12 @@ EOF - EOF - } - --list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do -- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi -- done` -+list= -+for i in /boot/kfreebsd-* /boot/kernel/kernel ; do -+ if grub_file_is_not_garbage "$i" ; then -+ list="$list $i" -+ fi -+done - prepare_boot_cache= - boot_device_id= - title_correction_code= -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index d2e2a8f..a2a84dc 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -147,13 +147,15 @@ EOF - machine=`uname -m` - 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` ;; -+ 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 ;; - esac - - case "$machine" in -diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 2e77758..de34c8d 100644 ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in -@@ -137,7 +137,8 @@ EOF - EOF - } - --linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do -+linux_list= -+for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do - if grub_file_is_not_garbage "$i"; then - basename=$(basename $i) - version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") -@@ -149,9 +150,9 @@ linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do - break - fi - done -- if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi -+ if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi - fi -- done` -+done - if [ "x${linux_list}" = "x" ] ; then - exit 0 - fi -@@ -165,9 +166,10 @@ file_is_not_sym () { - esac - } - --xen_list=`for i in /boot/xen*; do -- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi -- done` -+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 - prepare_boot_cache= - boot_device_id= - -diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 6f38c82..4ee6015 100644 ---- a/util/grub.d/30_os-prober.in -+++ b/util/grub.d/30_os-prober.in -@@ -322,9 +322,8 @@ EOF - EOF - ;; - *) -- echo -n " " - # TRANSLATORS: %s is replaced by OS name. -- gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2 -+ gettext_printf "%s is not yet supported by grub-mkconfig.\n" " ${LONGNAME}" >&2 - ;; - esac - done --- -2.4.3 - diff --git a/0133-grub-core-fs-ext2.c-grub_ext2_read_block-Support-lar.patch b/0133-grub-core-fs-ext2.c-grub_ext2_read_block-Support-lar.patch deleted file mode 100644 index 37860c1..0000000 --- a/0133-grub-core-fs-ext2.c-grub_ext2_read_block-Support-lar.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 58f66137a37f3d84a8b37fbe7d5be8e49c3c5768 Mon Sep 17 00:00:00 2001 -From: Peter Nelson -Date: Sun, 7 Dec 2014 17:57:49 +0100 -Subject: [PATCH 133/506] * grub-core/fs/ext2.c (grub_ext2_read_block): Support - large sparse chunks. - ---- - ChangeLog | 5 +++++ - grub-core/fs/ext2.c | 4 ++++ - 2 files changed, 9 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index b23f069..6f2924e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-12-07 Peter Nelson -+ -+ * grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse -+ chunks. -+ - 2014-12-07 Andrei Borzenkov - - * util/grub-mkconfig_lib.in (version_test_gt): Remove redundant -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 5f7a2b9..217771d 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -484,6 +484,10 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - - indirect: - do { -+ /* If the indirect block is zero, all child blocks are absent -+ (i.e. filled with zeros.) */ -+ if (indir == 0) -+ return 0; - if (grub_disk_read (data->disk, - ((grub_disk_addr_t) grub_le_to_cpu32 (indir)) - << log2_blksz, --- -2.4.3 - diff --git a/0134-grub-core-kern-arm-misc.S-fix-unaligned-grub_uint64_.patch b/0134-grub-core-kern-arm-misc.S-fix-unaligned-grub_uint64_.patch deleted file mode 100644 index f809eed..0000000 --- a/0134-grub-core-kern-arm-misc.S-fix-unaligned-grub_uint64_.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 17328db3b33d67f2e5365fcb123d41aacc7ab16b Mon Sep 17 00:00:00 2001 -From: David Kozub -Date: Thu, 20 Nov 2014 21:53:14 +0100 -Subject: [PATCH 134/506] grub-core/kern/arm/misc.S: fix unaligned - grub_uint64_t local variable - -The unaligned local in __aeabi_uidivmod leads to a store to a 64bit -value at an address that is not divisible by 8 (in grub_divmod64). -The compiler most likely generates a STRD instruction to store it and -this causes an exception. - -Fixes Savannah bug #43632. - -This includes improvements done by Leif Lindholm. ---- - ChangeLog | 6 ++++++ - grub-core/kern/arm/misc.S | 14 +++++++------- - 2 files changed, 13 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 6f2924e..4150810 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,9 @@ -+2014-12-07 David Kozub -+ -+ * grub-core/kern/arm/misc.S: fix unaligned 64bit local variable -+ in __aeabi_uidivmod -+ Fixes Savannah bug #43632. -+ - 2014-12-07 Peter Nelson - - * grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse -diff --git a/grub-core/kern/arm/misc.S b/grub-core/kern/arm/misc.S -index 8943cc3..16b6f8e 100644 ---- a/grub-core/kern/arm/misc.S -+++ b/grub-core/kern/arm/misc.S -@@ -60,17 +60,17 @@ FUNCTION(__aeabi_lmul) - - .macro division parent - -- stmfd sp!, {lr} -- sub sp, sp, #12 -+ sub sp, sp, #8 @ Allocate naturally aligned 64-bit space -+ stmfd sp!, {r3,lr} @ Dummy r3 to maintain stack alignment -+ add r3, sp, #8 @ Set r3 to address of 64-bit space -+ str r3, [sp] @ Stack parameter, pointer to 64-bit space - mov r2, r1 -- add r1, sp, #4 -- str r1, [sp, #0] - mov r1, #0 - mov r3, #0 - bl \parent -- ldr r1, [sp, #4] -- add sp, sp, #12 -- ldmfd sp!, {lr} -+ ldr r1, [sp, #8] @ Extract remainder -+ ldmfd sp!, {r3,lr} @ Pop into an unused arg/scratch register -+ add sp, sp, #8 - bx lr - .endm - --- -2.4.3 - diff --git a/0135-Fix-serial-rtscts-option-processing.patch b/0135-Fix-serial-rtscts-option-processing.patch deleted file mode 100644 index 2a1c9c4..0000000 --- a/0135-Fix-serial-rtscts-option-processing.patch +++ /dev/null @@ -1,42 +0,0 @@ -From bac5d1a64ab4191058a8fd4c05f6b3b339e249e7 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 9 Dec 2014 21:41:49 +0300 -Subject: [PATCH 135/506] Fix serial --rtscts option processing - ---- - ChangeLog | 5 +++++ - grub-core/term/serial.c | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 4150810..c38917b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2014-12-09 Andrei Borzenkov -+ -+ * grub-core/term/serial.c (grub_cmd_serial): Fix --rtscts -+ option processing. -+ - 2014-12-07 David Kozub - - * grub-core/kern/arm/misc.S: fix unaligned 64bit local variable -diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c -index c9b5574..5784bc2 100644 ---- a/grub-core/term/serial.c -+++ b/grub-core/term/serial.c -@@ -241,9 +241,9 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) - - if (state[OPTION_RTSCTS].set) - { -- if (grub_strcmp (state[OPTION_PARITY].arg, "on") == 0) -+ if (grub_strcmp (state[OPTION_RTSCTS].arg, "on") == 0) - config.rtscts = 1; -- if (grub_strcmp (state[OPTION_PARITY].arg, "off") == 0) -+ else if (grub_strcmp (state[OPTION_RTSCTS].arg, "off") == 0) - config.rtscts = 0; - else - return grub_error (GRUB_ERR_BAD_ARGUMENT, --- -2.4.3 - diff --git a/0136-Support-GELI-v6-and-v7.patch b/0136-Support-GELI-v6-and-v7.patch deleted file mode 100644 index 6b900ad..0000000 --- a/0136-Support-GELI-v6-and-v7.patch +++ /dev/null @@ -1,93 +0,0 @@ -From ba3031f9963dfc5416140ceebd16d8239e22b1e4 Mon Sep 17 00:00:00 2001 -From: Kris Moore -Date: Mon, 19 Jan 2015 21:56:41 +0300 -Subject: [PATCH 136/506] Support GELI v6 and v7 - ---- - ChangeLog | 4 ++++ - grub-core/disk/geli.c | 26 ++++++++++++++++++++------ - 2 files changed, 24 insertions(+), 6 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c38917b..854c008 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2015-01-19 Kris Moore -+ -+ * grub-core/disk/geli.c: Support GELI v6 and v7. -+ - 2014-12-09 Andrei Borzenkov - - * grub-core/term/serial.c (grub_cmd_serial): Fix --rtscts -diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c -index 1727341..4ed07bb 100644 ---- a/grub-core/disk/geli.c -+++ b/grub-core/disk/geli.c -@@ -225,7 +225,7 @@ grub_util_get_geli_uuid (const char *dev) - - /* Look for GELI magic sequence. */ - if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC)) -- || grub_le_to_cpu32 (header->version) > 5 -+ || grub_le_to_cpu32 (header->version) > 7 - || grub_le_to_cpu32 (header->version) < 1) - grub_util_error ("%s", _("wrong ELI magic or version")); - -@@ -265,7 +265,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, - - /* Look for GELI magic sequence. */ - if (grub_memcmp (header.magic, GELI_MAGIC, sizeof (GELI_MAGIC)) -- || grub_le_to_cpu32 (header.version) > 5 -+ || grub_le_to_cpu32 (header.version) > 7 - || grub_le_to_cpu32 (header.version) < 1) - { - grub_dprintf ("geli", "wrong magic %02x\n", header.magic[0]); -@@ -401,6 +401,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) - grub_uint8_t geomkey[GRUB_CRYPTO_MAX_MDLEN]; - grub_uint8_t verify_key[GRUB_CRYPTO_MAX_MDLEN]; - grub_uint8_t zero[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; -+ grub_uint8_t geli_cipher_key[64]; - char passphrase[MAX_PASSPHRASE] = ""; - unsigned i; - gcry_err_code_t gcry_err; -@@ -524,6 +525,19 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) - continue; - grub_printf_ (N_("Slot %d opened\n"), i); - -+ if (grub_le_to_cpu32 (header.version) >= 7) -+ { -+ /* GELI >=7 uses the cipher_key */ -+ grub_memcpy (geli_cipher_key, candidate_key.cipher_key, -+ sizeof (candidate_key.cipher_key)); -+ } -+ else -+ { -+ /* GELI <=6 uses the iv_key */ -+ grub_memcpy (geli_cipher_key, candidate_key.iv_key, -+ sizeof (candidate_key.iv_key)); -+ } -+ - /* Set the master key. */ - if (!dev->rekey) - { -@@ -540,13 +554,13 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) - grub_size_t real_keysize = keysize; - if (grub_le_to_cpu16 (header.alg) == 0x16) - real_keysize *= 2; -- /* For a reason I don't know, the IV key is used in rekeying. */ -- grub_memcpy (dev->rekey_key, candidate_key.iv_key, -- sizeof (candidate_key.iv_key)); -+ -+ grub_memcpy (dev->rekey_key, geli_cipher_key, -+ sizeof (geli_cipher_key)); - dev->rekey_derived_size = real_keysize; - dev->last_rekey = -1; - COMPILE_TIME_ASSERT (sizeof (dev->rekey_key) -- >= sizeof (candidate_key.iv_key)); -+ >= sizeof (geli_cipher_key)); - } - - dev->iv_prefix_len = sizeof (candidate_key.iv_key); --- -2.4.3 - diff --git a/0137-Replace-explicit-sizeof-divisions-by-ARRAY_SIZE.patch b/0137-Replace-explicit-sizeof-divisions-by-ARRAY_SIZE.patch deleted file mode 100644 index b4ee796..0000000 --- a/0137-Replace-explicit-sizeof-divisions-by-ARRAY_SIZE.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 59d403659461db52e08a0bd49d418baaa2fa106b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 12:45:45 +0100 -Subject: [PATCH 137/506] Replace explicit sizeof divisions by ARRAY_SIZE. - ---- - ChangeLog | 4 ++++ - grub-core/commands/i386/pc/sendkey.c | 10 ++++------ - grub-core/kern/emu/hostdisk.c | 6 +++--- - grub-core/lib/syslinux_parse.c | 4 ++-- - grub-core/loader/i386/xnu.c | 4 ++-- - grub-core/normal/color.c | 2 +- - 6 files changed, 16 insertions(+), 14 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 854c008..326f621 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2015-01-20 Vladimir Serbinenko -+ -+ Replace explicit sizeof divisions by ARRAY_SIZE. -+ - 2015-01-19 Kris Moore - - * grub-core/disk/geli.c: Support GELI v6 and v7. -diff --git a/grub-core/commands/i386/pc/sendkey.c b/grub-core/commands/i386/pc/sendkey.c -index d985cb3..26d9acd 100644 ---- a/grub-core/commands/i386/pc/sendkey.c -+++ b/grub-core/commands/i386/pc/sendkey.c -@@ -292,7 +292,7 @@ find_key_code (char *key) - { - unsigned i; - -- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) -+ for (i = 0; i < ARRAY_SIZE(keysym_table); i++) - { - if (keysym_table[i].unshifted_name - && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) -@@ -311,7 +311,7 @@ find_ascii_code (char *key) - { - unsigned i; - -- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) -+ for (i = 0; i < ARRAY_SIZE(keysym_table); i++) - { - if (keysym_table[i].unshifted_name - && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) -@@ -352,15 +352,13 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args) - - { - unsigned i; -- for (i = 0; i < sizeof (simple_flag_offsets) -- / sizeof (simple_flag_offsets[0]); i++) -+ for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++) - grub_sendkey_set_simple_flag (simple_flag_offsets[i], - grub_sendkey_parse_op(state[i])); - } - - /* Set noled. */ -- noled = (state[sizeof (simple_flag_offsets) -- / sizeof (simple_flag_offsets[0])].set); -+ noled = (state[ARRAY_SIZE(simple_flag_offsets)].set); - - return GRUB_ERR_NONE; - } -diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c -index 44b0fcb..a4ebf78 100644 ---- a/grub-core/kern/emu/hostdisk.c -+++ b/grub-core/kern/emu/hostdisk.c -@@ -99,7 +99,7 @@ find_free_slot (void) - { - unsigned int i; - -- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) -+ for (i = 0; i < ARRAY_SIZE (map); i++) - if (! map[i].drive) - return i; - -@@ -115,7 +115,7 @@ grub_util_biosdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, - if (pull != GRUB_DISK_PULL_NONE) - return 0; - -- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) -+ for (i = 0; i < ARRAY_SIZE (map); i++) - if (map[i].drive && hook (map[i].drive, hook_data)) - return 1; - -@@ -581,7 +581,7 @@ grub_util_biosdisk_fini (void) - { - unsigned i; - -- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) -+ for (i = 0; i < ARRAY_SIZE(map); i++) - { - if (map[i].drive) - free (map[i].drive); -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 08e451c..241cefe 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -717,7 +717,7 @@ syslinux_parse_real (struct syslinux_menu *menu) - for (ptr3 = ptr2; grub_isspace (*ptr3) && *ptr3; ptr3++); - for (ptr4 = ptr3; !grub_isspace (*ptr4) && *ptr4; ptr4++); - for (ptr5 = ptr4; grub_isspace (*ptr5) && *ptr5; ptr5++); -- for (i = 0; i < sizeof (commands) / sizeof (commands[0]); i++) -+ for (i = 0; i < ARRAY_SIZE(commands); i++) - if (grub_strlen (commands[i].name1) == (grub_size_t) (ptr2 - ptr1) - && grub_strncasecmp (commands[i].name1, ptr1, ptr2 - ptr1) == 0 - && (commands[i].name2 == NULL -@@ -726,7 +726,7 @@ syslinux_parse_real (struct syslinux_menu *menu) - && grub_strncasecmp (commands[i].name2, ptr3, ptr4 - ptr3) - == 0))) - break; -- if (i == sizeof (commands) / sizeof (commands[0])) -+ if (i == ARRAY_SIZE(commands)) - { - if (sizeof ("text") - 1 == ptr2 - ptr1 - && grub_strncasecmp ("text", ptr1, ptr2 - ptr1) == 0 -diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c -index e83e1e9..94daa02 100644 ---- a/grub-core/loader/i386/xnu.c -+++ b/grub-core/loader/i386/xnu.c -@@ -741,10 +741,10 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out) - *((grub_uint64_t *) curval->data) = (grub_addr_t) ptr; - - /* Create alias. */ -- for (j = 0; j < sizeof (table_aliases) / sizeof (table_aliases[0]); j++) -+ for (j = 0; j < ARRAY_SIZE(table_aliases); j++) - if (grub_memcmp (&table_aliases[j].guid, &guid, sizeof (guid)) == 0) - break; -- if (j != sizeof (table_aliases) / sizeof (table_aliases[0])) -+ if (j != ARRAY_SIZE(table_aliases)) - { - curval = grub_xnu_create_value (&(curkey->first_child), "alias"); - if (!curval) -diff --git a/grub-core/normal/color.c b/grub-core/normal/color.c -index c265423..d22cf90 100644 ---- a/grub-core/normal/color.c -+++ b/grub-core/normal/color.c -@@ -47,7 +47,7 @@ static int - parse_color_name (grub_uint8_t *ret, char *name) - { - grub_uint8_t i; -- for (i = 0; i < sizeof (color_list) / sizeof (*color_list); i++) -+ for (i = 0; i < ARRAY_SIZE(color_list); i++) - if (! grub_strcmp (name, color_list[i])) - { - *ret = i; --- -2.4.3 - diff --git a/0138-grub_script_lexer_yywrap-Update-len-synchronously-wi.patch b/0138-grub_script_lexer_yywrap-Update-len-synchronously-wi.patch deleted file mode 100644 index fd000f5..0000000 --- a/0138-grub_script_lexer_yywrap-Update-len-synchronously-wi.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 66ce4d1aefd54f952f809801380253c28754ed81 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 12:53:20 +0100 -Subject: [PATCH 138/506] grub_script_lexer_yywrap: Update len synchronously - with line. - ---- - ChangeLog | 5 +++++ - grub-core/script/lexer.c | 1 + - 2 files changed, 6 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 326f621..80ef35c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/script/lexer.c (grub_script_lexer_yywrap): Update len -+ synchronously with line. -+ -+2015-01-20 Vladimir Serbinenko -+ - Replace explicit sizeof divisions by ARRAY_SIZE. - - 2015-01-19 Kris Moore -diff --git a/grub-core/script/lexer.c b/grub-core/script/lexer.c -index 128d238..89cf677 100644 ---- a/grub-core/script/lexer.c -+++ b/grub-core/script/lexer.c -@@ -164,6 +164,7 @@ grub_script_lexer_yywrap (struct grub_parser_param *parserstate, - { - grub_free (line); - line = grub_strdup ("\n"); -+ len = 1; - } - else if (len && line[len - 1] != '\n') - { --- -2.4.3 - diff --git a/0139-grub_fshelp_read_file-Don-t-attempt-to-read-past-the.patch b/0139-grub_fshelp_read_file-Don-t-attempt-to-read-past-the.patch deleted file mode 100644 index 771d88b..0000000 --- a/0139-grub_fshelp_read_file-Don-t-attempt-to-read-past-the.patch +++ /dev/null @@ -1,47 +0,0 @@ -From af435524cd39f0967cd46e650e4312ecfeb158ed Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 12:58:17 +0100 -Subject: [PATCH 139/506] grub_fshelp_read_file: Don't attempt to read past the - end of file. - ---- - ChangeLog | 5 +++++ - grub-core/fs/fshelp.c | 7 +++++++ - 2 files changed, 12 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 80ef35c..c18ab2d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/fshelp.c (grub_fshelp_read_file): Don't attempt to read -+ past the end of file. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/script/lexer.c (grub_script_lexer_yywrap): Update len - synchronously with line. - -diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c -index 42bd542..b899bed 100644 ---- a/grub-core/fs/fshelp.c -+++ b/grub-core/fs/fshelp.c -@@ -252,6 +252,13 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node, - grub_disk_addr_t i, blockcnt; - int blocksize = 1 << (log2blocksize + GRUB_DISK_SECTOR_BITS); - -+ if (pos > filesize) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ N_("attempt to read past the end of file")); -+ return -1; -+ } -+ - /* Adjust LEN so it we can't read past the end of the file. */ - if (pos + len > filesize) - len = filesize - pos; --- -2.4.3 - diff --git a/0140-grub-core-fs-minix.c-grub_minix_read_file-Avoid-read.patch b/0140-grub-core-fs-minix.c-grub_minix_read_file-Avoid-read.patch deleted file mode 100644 index b079339..0000000 --- a/0140-grub-core-fs-minix.c-grub_minix_read_file-Avoid-read.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 30e177a05bc2ba8d01c69dd587198a9b88279de1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 13:55:55 +0100 -Subject: [PATCH 140/506] grub-core/fs/minix.c (grub_minix_read_file): Avoid - reading past the end of file. - ---- - ChangeLog | 10 ++++++++++ - grub-core/bus/usb/usbtrans.c | 2 +- - grub-core/fs/minix.c | 7 +++++++ - 3 files changed, 18 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index c18ab2d..1428477 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,15 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/bus/usb/usbtrans.c (grub_usb_bulk_maxpacket): Avoid -+ potentially returning 0. -+ -+2015-01-20 Vladimir Serbinenko -+ -+ * grub-core/fs/minix.c (grub_minix_read_file): Avoid reading past -+ the end of file. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/fshelp.c (grub_fshelp_read_file): Don't attempt to read - past the end of file. - -diff --git a/grub-core/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c -index 557e71c..b614997 100644 ---- a/grub-core/bus/usb/usbtrans.c -+++ b/grub-core/bus/usb/usbtrans.c -@@ -31,7 +31,7 @@ grub_usb_bulk_maxpacket (grub_usb_device_t dev, - struct grub_usb_desc_endp *endpoint) - { - /* Use the maximum packet size given in the endpoint descriptor. */ -- if (dev->initialized && endpoint) -+ if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket) - return endpoint->maxpacket; - - return 64; -diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c -index 98e1b71..6f629a1 100644 ---- a/grub-core/fs/minix.c -+++ b/grub-core/fs/minix.c -@@ -262,6 +262,13 @@ grub_minix_read_file (struct grub_minix_data *data, - grub_uint32_t posblock; - grub_uint32_t blockoff; - -+ if (pos > GRUB_MINIX_INODE_SIZE (data)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ N_("attempt to read past the end of file")); -+ return -1; -+ } -+ - /* Adjust len so it we can't read past the end of the file. */ - if (len + pos > GRUB_MINIX_INODE_SIZE (data)) - len = GRUB_MINIX_INODE_SIZE (data) - pos; --- -2.4.3 - diff --git a/0141-grub_cmd_play-Avoid-division-by-zero.patch b/0141-grub_cmd_play-Avoid-division-by-zero.patch deleted file mode 100644 index ef090c9..0000000 --- a/0141-grub_cmd_play-Avoid-division-by-zero.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 44461d5af23dc00bf31604fa07e191b0d4c5cb67 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:11:32 +0100 -Subject: [PATCH 141/506] grub_cmd_play: Avoid division by zero. - ---- - ChangeLog | 5 +++++ - grub-core/commands/i386/pc/play.c | 15 +++++++++++++++ - 2 files changed, 20 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 1428477..3ae00de 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/commands/i386/pc/play.c (grub_cmd_play): Avoid -+ division by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/bus/usb/usbtrans.c (grub_usb_bulk_maxpacket): Avoid - potentially returning 0. - -diff --git a/grub-core/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c -index 40798c9..7712e2a 100644 ---- a/grub-core/commands/i386/pc/play.c -+++ b/grub-core/commands/i386/pc/play.c -@@ -107,6 +107,14 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), - return grub_errno; - } - -+ if (!tempo) -+ { -+ grub_file_close (file); -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), -+ args[0]); -+ return grub_errno; -+ } -+ - tempo = grub_le_to_cpu32 (tempo); - grub_dprintf ("play","tempo = %d\n", tempo); - -@@ -131,6 +139,13 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), - - tempo = grub_strtoul (args[0], &end, 0); - -+ if (!tempo) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), -+ args[0]); -+ return grub_errno; -+ } -+ - if (*end) - /* Was not a number either, assume it was supposed to be a file name. */ - return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]); --- -2.4.3 - diff --git a/0142-grub-core-disk-AFSplitter.c-AF_merge-Check-that-mdle.patch b/0142-grub-core-disk-AFSplitter.c-AF_merge-Check-that-mdle.patch deleted file mode 100644 index 4e4a0e6..0000000 --- a/0142-grub-core-disk-AFSplitter.c-AF_merge-Check-that-mdle.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1dfe3f973e83b33badeee1c1f7d2644401294d8c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:12:30 +0100 -Subject: [PATCH 142/506] * grub-core/disk/AFSplitter.c (AF_merge): Check that - mdlen is not 0. - ---- - ChangeLog | 4 ++++ - grub-core/disk/AFSplitter.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 3ae00de..0c85b35 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/commands/i386/pc/play.c (grub_cmd_play): Avoid - division by zero. - -diff --git a/grub-core/disk/AFSplitter.c b/grub-core/disk/AFSplitter.c -index d76a1c4..7e1bd57 100644 ---- a/grub-core/disk/AFSplitter.c -+++ b/grub-core/disk/AFSplitter.c -@@ -76,7 +76,7 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst, - if (bufblock == NULL) - return GPG_ERR_OUT_OF_MEMORY; - -- if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN) -+ if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0) - return GPG_ERR_INV_ARG; - - grub_memset (bufblock, 0, blocksize); --- -2.4.3 - diff --git a/0143-grub_ata_setaddress-Check-that-geometry-is-sane-when.patch b/0143-grub_ata_setaddress-Check-that-geometry-is-sane-when.patch deleted file mode 100644 index b4fb0de..0000000 --- a/0143-grub_ata_setaddress-Check-that-geometry-is-sane-when.patch +++ /dev/null @@ -1,46 +0,0 @@ -From f27ccb584ccaf70bfb26b3c893b63124d8563db4 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:16:22 +0100 -Subject: [PATCH 143/506] grub_ata_setaddress: Check that geometry is sane when - using CHS addressing. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ata.c | 6 ++++++ - 2 files changed, 11 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 0c85b35..575bd18 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/ata.c (grub_ata_setaddress): Check that geometry -+ is sane when using CHS addressing. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c -index 2b98849..8ba4e5c 100644 ---- a/grub-core/disk/ata.c -+++ b/grub-core/disk/ata.c -@@ -216,6 +216,12 @@ grub_ata_setaddress (struct grub_ata *dev, - unsigned int head; - unsigned int sect; - -+ if (dev->sectors_per_track == 0 -+ || dev->heads == 0) -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, -+ "sector %d cannot be addressed " -+ "using CHS addressing", sector); -+ - /* Calculate the sector, cylinder and head to use. */ - sect = ((grub_uint32_t) sector % dev->sectors_per_track) + 1; - cylinder = (((grub_uint32_t) sector / dev->sectors_per_track) --- -2.4.3 - diff --git a/0144-Reject-NILFS2-superblocks-with-over-1GiB-blocks.patch b/0144-Reject-NILFS2-superblocks-with-over-1GiB-blocks.patch deleted file mode 100644 index 8c159e9..0000000 --- a/0144-Reject-NILFS2-superblocks-with-over-1GiB-blocks.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 9201cd79a33a5f802cdf78437eca91082f382d55 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:27:27 +0100 -Subject: [PATCH 144/506] Reject NILFS2 superblocks with over 1GiB blocks. - - * grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that - block size is <= 1GiB. ---- - ChangeLog | 7 +++++++ - grub-core/fs/nilfs2.c | 4 ++++ - 2 files changed, 11 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 575bd18..454aef8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,12 @@ - 2015-01-20 Vladimir Serbinenko - -+ Reject NILFS2 superblocks with over 1GiB blocks. -+ -+ * grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that -+ block size is <= 1GiB. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/ata.c (grub_ata_setaddress): Check that geometry - is sane when using CHS addressing. - -diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c -index 388ee18..598a2a5 100644 ---- a/grub-core/fs/nilfs2.c -+++ b/grub-core/fs/nilfs2.c -@@ -724,6 +724,10 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp) - if (grub_le_to_cpu32 (sbp->s_rev_level) != NILFS_SUPORT_REV) - return 0; - -+ /* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */ -+ if (grub_le_to_cpu32 (sbp->s_log_block_size) > 20) -+ return 0; -+ - return 1; - } - --- -2.4.3 - diff --git a/0145-grub_ufs_mount-Check-that-sblock.ino_per_group-is-no.patch b/0145-grub_ufs_mount-Check-that-sblock.ino_per_group-is-no.patch deleted file mode 100644 index 9a1ed36..0000000 --- a/0145-grub_ufs_mount-Check-that-sblock.ino_per_group-is-no.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 245e21b2b56e787ec5953efef6ac6ffe251e136b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:30:05 +0100 -Subject: [PATCH 145/506] grub_ufs_mount: Check that sblock.ino_per_group is - not 0. - ---- - ChangeLog | 5 +++++ - grub-core/fs/ufs.c | 3 ++- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 454aef8..d7d5c40 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/ufs.c (grub_ufs_mount): Check -+ that sblock.ino_per_group is not 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - Reject NILFS2 superblocks with over 1GiB blocks. - - * grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that -diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c -index 4a2161c..f560ad3 100644 ---- a/grub-core/fs/ufs.c -+++ b/grub-core/fs/ufs.c -@@ -604,7 +604,8 @@ grub_ufs_mount (grub_disk_t disk) - endiannesses. */ - if (data->sblock.magic == grub_cpu_to_ufs32_compile_time (GRUB_UFS_MAGIC) - && data->sblock.bsize != 0 -- && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0)) -+ && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0) -+ && data->sblock.ino_per_group != 0) - { - for (data->log2_blksz = 0; - (1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize); --- -2.4.3 - diff --git a/0146-grub-core-fs-ext2.c-grub_ext2_mount-Additional-check.patch b/0146-grub-core-fs-ext2.c-grub_ext2_mount-Additional-check.patch deleted file mode 100644 index 8b804eb..0000000 --- a/0146-grub-core-fs-ext2.c-grub_ext2_mount-Additional-check.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 47cd2645ddc885e7821b4a86a5ccf549dd4d5fcc Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:40:27 +0100 -Subject: [PATCH 146/506] * grub-core/fs/ext2.c (grub_ext2_mount): Additional - checks for superblock validity. - ---- - ChangeLog | 5 +++++ - grub-core/fs/ext2.c | 7 ++++++- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index d7d5c40..f69541e 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/ext2.c (grub_ext2_mount): Additional -+ checks for superblock validity. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/ufs.c (grub_ufs_mount): Check - that sblock.ino_per_group is not 0. - -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 217771d..44c7974 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -577,7 +577,12 @@ grub_ext2_mount (grub_disk_t disk) - - /* Make sure this is an ext2 filesystem. */ - if (data->sblock.magic != grub_cpu_to_le16_compile_time (EXT2_MAGIC) -- || grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16) -+ || grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16 -+ || data->sblock.inodes_per_group == 0 -+ /* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */ -+ || grub_le_to_cpu32 (data->sblock.log2_block_size) > 20 -+ || EXT2_INODE_SIZE (data) == 0 -+ || EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data) == 0) - { - grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem"); - goto fail; --- -2.4.3 - diff --git a/0147-grub-core-fs-minix.c-Additional-filesystem-sanity-ch.patch b/0147-grub-core-fs-minix.c-Additional-filesystem-sanity-ch.patch deleted file mode 100644 index 78bebce..0000000 --- a/0147-grub-core-fs-minix.c-Additional-filesystem-sanity-ch.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 5ed3a5d0491f7e00d76bed0cdf4fa3cb8868ade4 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:53:09 +0100 -Subject: [PATCH 147/506] * grub-core/fs/minix.c: Additional filesystem - sanity checks. - ---- - ChangeLog | 5 +++++ - grub-core/fs/minix.c | 34 ++++++++++++++++++---------------- - 2 files changed, 23 insertions(+), 16 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index f69541e..a5d925a 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/minix.c: Additional filesystem -+ sanity checks. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/ext2.c (grub_ext2_mount): Additional - checks for superblock validity. - -diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c -index 6f629a1..90ddd34 100644 ---- a/grub-core/fs/minix.c -+++ b/grub-core/fs/minix.c -@@ -65,7 +65,6 @@ typedef grub_uint16_t grub_minix_uintn_t; - #define grub_minix_to_cpu_n grub_minix_to_cpu16 - #endif - --#define GRUB_MINIX_INODE_BLKSZ(data) sizeof (grub_minix_uintn_t) - #ifdef MODE_MINIX3 - typedef grub_uint32_t grub_minix_ino_t; - #define grub_minix_to_cpu_ino grub_minix_to_cpu32 -@@ -87,8 +86,6 @@ typedef grub_uint16_t grub_minix_ino_t; - #define GRUB_MINIX_LOG2_ZONESZ (GRUB_MINIX_LOG2_BSIZE \ - + grub_minix_to_cpu16 (data->sblock.log2_zone_size)) - #endif --#define GRUB_MINIX_ZONESZ ((grub_uint64_t) data->block_size << \ -- (GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size))) - - #ifdef MODE_MINIX3 - #define GRUB_MINIX_ZONE2SECT(zone) ((zone) * data->block_size) -@@ -172,6 +169,7 @@ struct grub_minix_data - { - struct grub_minix_sblock sblock; - struct grub_minix_inode inode; -+ grub_uint32_t block_per_zone; - grub_minix_ino_t ino; - int linknest; - grub_disk_t disk; -@@ -202,8 +200,6 @@ static grub_minix_uintn_t - grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk) - { - grub_minix_uintn_t indir; -- const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ -- / GRUB_MINIX_INODE_BLKSZ (data)); - - /* Direct block. */ - if (blk < GRUB_MINIX_INODE_DIR_BLOCKS) -@@ -211,33 +207,33 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk) - - /* Indirect block. */ - blk -= GRUB_MINIX_INODE_DIR_BLOCKS; -- if (blk < block_per_zone) -+ if (blk < data->block_per_zone) - { - indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk); - return indir; - } - - /* Double indirect block. */ -- blk -= block_per_zone; -- if (blk < block_per_zone * block_per_zone) -+ blk -= data->block_per_zone; -+ if (blk < (grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone) - { - indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data), -- blk / block_per_zone); -+ blk / data->block_per_zone); - -- indir = grub_get_indir (data, indir, blk % block_per_zone); -+ indir = grub_get_indir (data, indir, blk % data->block_per_zone); - - return indir; - } - - #if defined (MODE_MINIX3) || defined (MODE_MINIX2) -- blk -= block_per_zone * block_per_zone; -- if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone -- * (grub_uint64_t) block_per_zone)) -+ blk -= data->block_per_zone * data->block_per_zone; -+ if (blk < ((grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone -+ * (grub_uint64_t) data->block_per_zone)) - { - indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone), -- (blk / block_per_zone) / block_per_zone); -- indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone); -- indir = grub_get_indir (data, indir, blk % block_per_zone); -+ (blk / data->block_per_zone) / data->block_per_zone); -+ indir = grub_get_indir (data, indir, (blk / data->block_per_zone) % data->block_per_zone); -+ indir = grub_get_indir (data, indir, blk % data->block_per_zone); - - return indir; - } -@@ -515,6 +511,12 @@ grub_minix_mount (grub_disk_t disk) - data->block_size = 2; - #endif - -+ data->block_per_zone = (((grub_uint64_t) data->block_size << \ -+ (GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size))) -+ / sizeof (grub_minix_uintn_t)); -+ if (!data->block_per_zone) -+ goto fail; -+ - return data; - - fail: --- -2.4.3 - diff --git a/0148-grub-core-fs-hfs.c-grub_hfs_mount-Additional-filesys.patch b/0148-grub-core-fs-hfs.c-grub_hfs_mount-Additional-filesys.patch deleted file mode 100644 index 95c3ca4..0000000 --- a/0148-grub-core-fs-hfs.c-grub_hfs_mount-Additional-filesys.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 98f74998d5749c7e5b8293aaeaaaea5692240073 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 14:59:40 +0100 -Subject: [PATCH 148/506] * grub-core/fs/hfs.c (grub_hfs_mount): Additional - filesystem sanity checks. - ---- - ChangeLog | 5 +++++ - grub-core/fs/hfs.c | 6 ++++++ - 2 files changed, 11 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index a5d925a..473eb14 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem -+ sanity checks. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/minix.c: Additional filesystem - sanity checks. - -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index d1dc015..f46f77a 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -330,6 +330,7 @@ grub_hfs_mount (grub_disk_t disk) - - /* Check if this is a HFS filesystem. */ - if (grub_be_to_cpu16 (data->sblock.magic) != GRUB_HFS_MAGIC -+ || data->sblock.blksz == 0 - || (data->sblock.blksz & grub_cpu_to_be32_compile_time (0xc00001ff))) - { - grub_error (GRUB_ERR_BAD_FS, "not an HFS filesystem"); -@@ -367,6 +368,11 @@ grub_hfs_mount (grub_disk_t disk) - data->cat_root = grub_be_to_cpu32 (treehead.head.root_node); - data->cat_size = grub_be_to_cpu16 (treehead.head.node_size); - -+ if (data->cat_size == 0 -+ || data->blksz < data->cat_size -+ || data->blksz < data->ext_size) -+ goto fail; -+ - /* Lookup the root directory node in the catalog tree using the - volume name. */ - key.parent_dir = grub_cpu_to_be32_compile_time (1); --- -2.4.3 - diff --git a/0149-grub_dmraid_nv_detect-Do-not-divide-by-zero.patch b/0149-grub_dmraid_nv_detect-Do-not-divide-by-zero.patch deleted file mode 100644 index ab0ea17..0000000 --- a/0149-grub_dmraid_nv_detect-Do-not-divide-by-zero.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 935863518f3a9ec12161616a31ac40e5b78bd550 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 15:01:58 +0100 -Subject: [PATCH 149/506] grub_dmraid_nv_detect: Do not divide by zero. - ---- - ChangeLog | 5 +++++ - grub-core/disk/dmraid_nvidia.c | 6 ++++++ - 2 files changed, 11 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 473eb14..8661726 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not -+ divide by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem - sanity checks. - -diff --git a/grub-core/disk/dmraid_nvidia.c b/grub-core/disk/dmraid_nvidia.c -index 6e64055..fc02f57 100644 ---- a/grub-core/disk/dmraid_nvidia.c -+++ b/grub-core/disk/dmraid_nvidia.c -@@ -129,6 +129,9 @@ grub_dmraid_nv_detect (grub_disk_t disk, - case NV_LEVEL_0: - level = 0; - disk_size = sb.capacity / sb.array.total_volumes; -+ if (sb.array.total_volumes == 0) -+ /* Not RAID. */ -+ return NULL; - break; - - case NV_LEVEL_1: -@@ -139,6 +142,9 @@ grub_dmraid_nv_detect (grub_disk_t disk, - case NV_LEVEL_5: - level = 5; - disk_size = sb.capacity / (sb.array.total_volumes - 1); -+ if (sb.array.total_volumes == 0 || sb.array.total_volumes == 1) -+ /* Not RAID. */ -+ return NULL; - break; - - default: --- -2.4.3 - diff --git a/0150-grub-core-disk-ieee1275-nand.c-grub_nand_open-Check-.patch b/0150-grub-core-disk-ieee1275-nand.c-grub_nand_open-Check-.patch deleted file mode 100644 index d369981..0000000 --- a/0150-grub-core-disk-ieee1275-nand.c-grub_nand_open-Check-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From f1959b16957bbb49bfaa16471d04bd9efc77387f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 15:09:42 +0100 -Subject: [PATCH 150/506] * grub-core/disk/ieee1275/nand.c - (grub_nand_open): Check block size validity. - ---- - ChangeLog | 5 +++++ - grub-core/disk/ieee1275/nand.c | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 8661726..bdd5697 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size -+ validity. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not - divide by zero. - -diff --git a/grub-core/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c -index 576e9cc..feffa8c 100644 ---- a/grub-core/disk/ieee1275/nand.c -+++ b/grub-core/disk/ieee1275/nand.c -@@ -113,6 +113,11 @@ grub_nand_open (const char *name, grub_disk_t disk) - } - - data->block_size = (args.size1 >> GRUB_DISK_SECTOR_BITS); -+ if (!data->block_size) -+ { -+ grub_error (GRUB_ERR_UNKNOWN_DEVICE, "invalid block size"); -+ goto fail; -+ } - - INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3); - args.method = (grub_ieee1275_cell_t) "size"; --- -2.4.3 - diff --git a/0151-grub-core-disk-i386-pc-biosdisk.c-Check-disk-size-sa.patch b/0151-grub-core-disk-i386-pc-biosdisk.c-Check-disk-size-sa.patch deleted file mode 100644 index b5ad1d7..0000000 --- a/0151-grub-core-disk-i386-pc-biosdisk.c-Check-disk-size-sa.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 4200ad44fe782193a397bd0f0ab72283a6d25e89 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 15:10:34 +0100 -Subject: [PATCH 151/506] * grub-core/disk/i386/pc/biosdisk.c: Check - disk size sanity. - ---- - ChangeLog | 4 ++++ - grub-core/disk/i386/pc/biosdisk.c | 5 +++++ - 2 files changed, 9 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index bdd5697..e8c1d68 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size - validity. - -diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c -index 6b21525..26a4973 100644 ---- a/grub-core/disk/i386/pc/biosdisk.c -+++ b/grub-core/disk/i386/pc/biosdisk.c -@@ -419,6 +419,11 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) - } - } - -+ if (data->sectors == 0) -+ data->sectors = 63; -+ if (data->heads == 0) -+ data->heads = 255; -+ - if (! total_sectors) - total_sectors = data->cylinders * data->heads * data->sectors; - } --- -2.4.3 - diff --git a/0152-osdep-linux-blocklist.c-grub_install_get_blocklist-C.patch b/0152-osdep-linux-blocklist.c-grub_install_get_blocklist-C.patch deleted file mode 100644 index cadf71e..0000000 --- a/0152-osdep-linux-blocklist.c-grub_install_get_blocklist-C.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 111ab3b9cc4ffbf0901d0303872d80a7e1c08a20 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 15:19:35 +0100 -Subject: [PATCH 152/506] osdep/linux/blocklist.c (grub_install_get_blocklist): - Check blocksize validity. - ---- - ChangeLog | 5 +++++ - grub-core/osdep/linux/blocklist.c | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index e8c1d68..87c4658 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/osdep/linux/blocklist.c (grub_install_get_blocklist): Check -+ blocksize validity. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index f33a7d5..10ddd11 100644 ---- a/grub-core/osdep/linux/blocklist.c -+++ b/grub-core/osdep/linux/blocklist.c -@@ -82,6 +82,8 @@ grub_install_get_blocklist (grub_device_t root_dev, - strerror (errno)); - if (bsize & (GRUB_DISK_SECTOR_SIZE - 1)) - grub_util_error ("%s", _("blocksize is not divisible by 512")); -+ if (!bsize) -+ grub_util_error ("%s", _("invalid zero blocksize")); - mul = bsize >> GRUB_DISK_SECTOR_BITS; - nblocks = (core_size + bsize - 1) / bsize; - if (mul == 0 || nblocks == 0) --- -2.4.3 - diff --git a/0153-grub-core-lib-pbkdf2.c-grub_crypto_pbkdf2-Check-that.patch b/0153-grub-core-lib-pbkdf2.c-grub_crypto_pbkdf2-Check-that.patch deleted file mode 100644 index b6dbe94..0000000 --- a/0153-grub-core-lib-pbkdf2.c-grub_crypto_pbkdf2-Check-that.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 065ed900d4865fc31062f01290560ad1bc189522 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 15:26:09 +0100 -Subject: [PATCH 153/506] grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check - that hash len is not 0. - ---- - ChangeLog | 4 ++++ - grub-core/lib/pbkdf2.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 87c4658..a708ca2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/osdep/linux/blocklist.c (grub_install_get_blocklist): Check - blocksize validity. - -diff --git a/grub-core/lib/pbkdf2.c b/grub-core/lib/pbkdf2.c -index 2fbaa95..01cee39 100644 ---- a/grub-core/lib/pbkdf2.c -+++ b/grub-core/lib/pbkdf2.c -@@ -52,7 +52,7 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md, - grub_uint8_t *tmp; - grub_size_t tmplen = Slen + 4; - -- if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN) -+ if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN || md->mdlen == 0) - return GPG_ERR_INV_ARG; - - if (c == 0) --- -2.4.3 - diff --git a/0154-grub-core-fs-btrfs.c-Avoid-divisions-by-zero.patch b/0154-grub-core-fs-btrfs.c-Avoid-divisions-by-zero.patch deleted file mode 100644 index 407d752..0000000 --- a/0154-grub-core-fs-btrfs.c-Avoid-divisions-by-zero.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 9deb46e363a341d8c243e4c85754e673b4b68571 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 17:36:29 +0100 -Subject: [PATCH 154/506] * grub-core/fs/btrfs.c: Avoid divisions by - zero. - ---- - ChangeLog | 4 ++++ - grub-core/fs/btrfs.c | 35 +++++++++++++++++++++-------------- - 2 files changed, 25 insertions(+), 14 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index a708ca2..8e38fdd 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/btrfs.c: Avoid divisions by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 95a8fa6..9cffa91 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -680,6 +680,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - grub_uint64_t stripen; - grub_uint64_t stripe_offset; - grub_uint64_t off = addr - grub_le_to_cpu64 (key->offset); -+ grub_uint64_t chunk_stripe_length; -+ grub_uint16_t nstripes; - unsigned redundancy = 1; - unsigned i, j; - -@@ -690,15 +692,17 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - "couldn't find the chunk descriptor"); - } - -+ nstripes = grub_le_to_cpu16 (chunk->nstripes) ? : 1; -+ chunk_stripe_length = grub_le_to_cpu64 (chunk->stripe_length) ? : 512; - grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T - "+0x%" PRIxGRUB_UINT64_T - " (%d stripes (%d substripes) of %" - PRIxGRUB_UINT64_T ")\n", - grub_le_to_cpu64 (key->offset), - grub_le_to_cpu64 (chunk->size), -- grub_le_to_cpu16 (chunk->nstripes), -+ nstripes, - grub_le_to_cpu16 (chunk->nsubstripes), -- grub_le_to_cpu64 (chunk->stripe_length)); -+ chunk_stripe_length); - - switch (grub_le_to_cpu64 (chunk->type) - & ~GRUB_BTRFS_CHUNK_TYPE_BITS_DONTCARE) -@@ -708,8 +712,10 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - grub_uint64_t stripe_length; - grub_dprintf ("btrfs", "single\n"); - stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size), -- grub_le_to_cpu16 (chunk->nstripes), -+ nstripes, - NULL); -+ if (stripe_length == 0) -+ stripe_length = 512; - stripen = grub_divmod64 (off, stripe_length, &stripe_offset); - csize = (stripen + 1) * stripe_length - off; - break; -@@ -730,33 +736,34 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - grub_uint64_t low; - grub_dprintf ("btrfs", "RAID0\n"); - middle = grub_divmod64 (off, -- grub_le_to_cpu64 (chunk->stripe_length), -+ chunk_stripe_length, - &low); - -- high = grub_divmod64 (middle, grub_le_to_cpu16 (chunk->nstripes), -+ high = grub_divmod64 (middle, nstripes, - &stripen); - stripe_offset = -- low + grub_le_to_cpu64 (chunk->stripe_length) * high; -- csize = grub_le_to_cpu64 (chunk->stripe_length) - low; -+ low + chunk_stripe_length * high; -+ csize = chunk_stripe_length - low; - break; - } - case GRUB_BTRFS_CHUNK_TYPE_RAID10: - { - grub_uint64_t middle, high; - grub_uint64_t low; -+ grub_uint16_t nsubstripes; -+ nsubstripes = grub_le_to_cpu16 (chunk->nsubstripes) ? : 1; - middle = grub_divmod64 (off, -- grub_le_to_cpu64 (chunk->stripe_length), -+ chunk_stripe_length, - &low); - - high = grub_divmod64 (middle, -- grub_le_to_cpu16 (chunk->nstripes) -- / grub_le_to_cpu16 (chunk->nsubstripes), -+ nstripes / nsubstripes ? : 1, - &stripen); -- stripen *= grub_le_to_cpu16 (chunk->nsubstripes); -- redundancy = grub_le_to_cpu16 (chunk->nsubstripes); -- stripe_offset = low + grub_le_to_cpu64 (chunk->stripe_length) -+ stripen *= nsubstripes; -+ redundancy = nsubstripes; -+ stripe_offset = low + chunk_stripe_length - * high; -- csize = grub_le_to_cpu64 (chunk->stripe_length) - low; -+ csize = chunk_stripe_length - low; - break; - } - default: --- -2.4.3 - diff --git a/0155-grub-core-fs-zfs.c-Avoid-divisions-by-zero.patch b/0155-grub-core-fs-zfs.c-Avoid-divisions-by-zero.patch deleted file mode 100644 index 393d0a1..0000000 --- a/0155-grub-core-fs-zfs.c-Avoid-divisions-by-zero.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 475bffeae67fa0f6787c33147c120b40e89b1985 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 17:46:55 +0100 -Subject: [PATCH 155/506] * grub-core/fs/zfs.c: Avoid divisions by zero. - ---- - ChangeLog | 4 ++++ - grub-core/fs/zfs/zfs.c | 12 ++++++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 8e38fdd..c60a231 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/fs/zfs.c: Avoid divisions by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/btrfs.c: Avoid divisions by zero. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index cfb25c0..c943b52 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -1501,6 +1501,9 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "raidz%d is not supported", desc->nparity); - -+ if (desc->n_children <= desc->nparity || desc->n_children < 1) -+ return grub_error(GRUB_ERR_BAD_FS, "too little devices for given parity"); -+ - orig_s = (((len + (1 << desc->ashift) - 1) >> desc->ashift) - + (desc->n_children - desc->nparity) - 1); - s = orig_s; -@@ -2804,6 +2807,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - dnode_path->dn.endian) - << SPA_MINBLOCKSHIFT); - -+ if (blksz == 0) -+ return grub_error(GRUB_ERR_BAD_FS, "0-sized block"); -+ - sym_value = grub_malloc (sym_sz); - if (!sym_value) - return grub_errno; -@@ -3798,6 +3804,12 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len) - blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, - data->dnode.endian) << SPA_MINBLOCKSHIFT; - -+ if (blksz == 0) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "0-sized block"); -+ return -1; -+ } -+ - /* - * Entire Dnode is too big to fit into the space available. We - * will need to read it in chunks. This could be optimized to --- -2.4.3 - diff --git a/0156-term.h-Avoid-returining-0-sized-terminal-as-it-may-l.patch b/0156-term.h-Avoid-returining-0-sized-terminal-as-it-may-l.patch deleted file mode 100644 index f57efef..0000000 --- a/0156-term.h-Avoid-returining-0-sized-terminal-as-it-may-l.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1b6aaddc456961d87d98e0f342c70b874b2fb232 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 17:55:41 +0100 -Subject: [PATCH 156/506] term.h: Avoid returining 0-sized terminal as it may - lead to division by zero. - ---- - ChangeLog | 5 +++++ - include/grub/term.h | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c60a231..141aa06 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * include/grub/term.h: Avoid returining 0-sized terminal -+ as it may lead to division by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/fs/zfs.c: Avoid divisions by zero. - - 2015-01-20 Vladimir Serbinenko -diff --git a/include/grub/term.h b/include/grub/term.h -index 98c68a5..5ffb38f 100644 ---- a/include/grub/term.h -+++ b/include/grub/term.h -@@ -334,12 +334,12 @@ void grub_term_restore_pos (struct grub_term_coordinate *pos); - - static inline unsigned grub_term_width (struct grub_term_output *term) - { -- return term->getwh(term).x; -+ return term->getwh(term).x ? : 80; - } - - static inline unsigned grub_term_height (struct grub_term_output *term) - { -- return term->getwh(term).y; -+ return term->getwh(term).y ? : 24; - } - - static inline struct grub_term_coordinate --- -2.4.3 - diff --git a/0157-grub-core-disk-diskfilter.c-Validate-volumes-to-avoi.patch b/0157-grub-core-disk-diskfilter.c-Validate-volumes-to-avoi.patch deleted file mode 100644 index 3b8a47f..0000000 --- a/0157-grub-core-disk-diskfilter.c-Validate-volumes-to-avoi.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 750f4bacd3262376ced3f837d8dc78f834ca233a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 19:33:20 +0100 -Subject: [PATCH 157/506] * grub-core/disk/diskfilter.c: Validate volumes to - avoid division by zero. - ---- - ChangeLog | 5 ++ - grub-core/disk/diskfilter.c | 123 ++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 123 insertions(+), 5 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 141aa06..fbdd560 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/disk/diskfilter.c: Validate volumes to avoid division -+ by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * include/grub/term.h: Avoid returining 0-sized terminal - as it may lead to division by zero. - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index e8a3bcb..97ca546 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -483,6 +483,96 @@ grub_diskfilter_read_node (const struct grub_diskfilter_node *node, - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name); - } - -+ -+static grub_err_t -+validate_segment (struct grub_diskfilter_segment *seg); -+ -+static grub_err_t -+validate_lv (struct grub_diskfilter_lv *lv) -+{ -+ unsigned int i; -+ if (!lv) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume"); -+ -+ if (lv->vg->extent_size == 0) -+ return grub_error (GRUB_ERR_READ_ERROR, "invalid volume"); -+ -+ for (i = 0; i < lv->segment_count; i++) -+ { -+ grub_err_t err; -+ err = validate_segment (&lv->segments[1]); -+ if (err) -+ return err; -+ } -+ return GRUB_ERR_NONE; -+} -+ -+ -+static grub_err_t -+validate_node (const struct grub_diskfilter_node *node) -+{ -+ /* Check whether we actually know the physical volume we want to -+ read from. */ -+ if (node->pv) -+ return GRUB_ERR_NONE; -+ if (node->lv) -+ return validate_lv (node->lv); -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name); -+} -+ -+static grub_err_t -+validate_segment (struct grub_diskfilter_segment *seg) -+{ -+ grub_err_t err; -+ -+ if (seg->stripe_size == 0 || seg->node_count == 0) -+ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); -+ -+ switch (seg->type) -+ { -+ case GRUB_DISKFILTER_RAID10: -+ { -+ grub_uint8_t near, far; -+ near = seg->layout & 0xFF; -+ far = (seg->layout >> 8) & 0xFF; -+ if ((seg->layout >> 16) == 0 && far == 0) -+ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); -+ if (near > seg->node_count) -+ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); -+ break; -+ } -+ -+ case GRUB_DISKFILTER_STRIPED: -+ case GRUB_DISKFILTER_MIRROR: -+ break; -+ -+ case GRUB_DISKFILTER_RAID4: -+ case GRUB_DISKFILTER_RAID5: -+ if (seg->node_count <= 1) -+ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); -+ break; -+ -+ case GRUB_DISKFILTER_RAID6: -+ if (seg->node_count <= 2) -+ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); -+ break; -+ -+ default: -+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ "unsupported RAID level %d", seg->type); -+ } -+ -+ unsigned i; -+ for (i = 0; i < seg->node_count; i++) -+ { -+ err = validate_node (&seg->nodes[i]); -+ if (err) -+ return err; -+ } -+ return GRUB_ERR_NONE; -+ -+} -+ - static grub_err_t - read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector, - grub_size_t size, char *buf) -@@ -848,6 +938,32 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - - for (lv = vg->lvs; lv; lv = lv->next) - { -+ /* RAID 1 and single-disk RAID 0 don't use a chunksize but code assumes one so set -+ one. */ -+ for (i = 0; i < lv->segment_count; i++) -+ { -+ if (lv->segments[i].type == 1) -+ lv->segments[i].stripe_size = 64; -+ if (lv->segments[i].type == GRUB_DISKFILTER_STRIPED -+ && lv->segments[i].node_count == 1 -+ && lv->segments[i].stripe_size == 0) -+ lv->segments[i].stripe_size = 64; -+ } -+ } -+ -+ for (lv = vg->lvs; lv; lv = lv->next) -+ { -+ grub_err_t err; -+ -+ /* RAID 1 doesn't use a chunksize but code assumes one so set -+ one. */ -+ for (i = 0; i < lv->segment_count; i++) -+ if (lv->segments[i].type == 1) -+ lv->segments[i].stripe_size = 64; -+ -+ err = validate_lv(lv); -+ if (err) -+ return err; - lv->number = lv_num++; - - if (lv->fullname) -@@ -888,11 +1004,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - lv->fullname = tmp; - } - } -- /* RAID 1 doesn't use a chunksize but code assumes one so set -- one. */ -- for (i = 0; i < lv->segment_count; i++) -- if (lv->segments[i].type == 1) -- lv->segments[i].stripe_size = 64; - lv->vg = vg; - } - /* Add our new array to the list. */ -@@ -926,6 +1037,8 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - n = layout & 0xFF; - if (n == 1) - n = (layout >> 8) & 0xFF; -+ if (n == 0) -+ return NULL; - - totsize = grub_divmod64 (nmemb * disk_size, n, 0); - } --- -2.4.3 - diff --git a/0158-grub-core-video-readers-jpeg.c-Avoid-division-by-zer.patch b/0158-grub-core-video-readers-jpeg.c-Avoid-division-by-zer.patch deleted file mode 100644 index 21bc982..0000000 --- a/0158-grub-core-video-readers-jpeg.c-Avoid-division-by-zer.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4816dcac19a05a1209822015d88903faef3d6f44 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 19:35:49 +0100 -Subject: [PATCH 158/506] * grub-core/video/readers/jpeg.c: Avoid - division by zero. - ---- - ChangeLog | 4 ++++ - grub-core/video/readers/jpeg.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index fbdd560..7b34ba7 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/video/readers/jpeg.c: Avoid sivision by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/disk/diskfilter.c: Validate volumes to avoid division - by zero. - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index 2dc2ee1..38ea239 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -317,7 +317,7 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) - { - data->vs = ss & 0xF; /* Vertical sampling. */ - data->hs = ss >> 4; /* Horizontal sampling. */ -- if ((data->vs > 2) || (data->hs > 2)) -+ if ((data->vs > 2) || (data->hs > 2) || (data->vs == 0) || (data->hs == 0)) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: sampling method not supported"); - } --- -2.4.3 - diff --git a/0159-Avoid-division-by-zero-in-serial.patch b/0159-Avoid-division-by-zero-in-serial.patch deleted file mode 100644 index c799423..0000000 --- a/0159-Avoid-division-by-zero-in-serial.patch +++ /dev/null @@ -1,72 +0,0 @@ -From e95685dab1a7b7ae31b65be1ebc3fd84ebc41c34 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 20:41:36 +0100 -Subject: [PATCH 159/506] Avoid division by zero in serial. - ---- - ChangeLog | 7 +++++++ - grub-core/term/ns8250.c | 2 ++ - grub-core/term/serial.c | 9 ++++++++- - 3 files changed, 17 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 7b34ba7..7d5a651 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,12 @@ - 2015-01-20 Vladimir Serbinenko - -+ Avoid division by zero in serial. -+ -+ * grub-core/term/serial.c (grub_cmd_serial): Ensure speed is not 0. -+ * grub-core/term/ns8250.c (serial_get_divisor): Exit if speed is 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/video/readers/jpeg.c: Avoid sivision by zero. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/term/ns8250.c b/grub-core/term/ns8250.c -index 2959632..39809d0 100644 ---- a/grub-core/term/ns8250.c -+++ b/grub-core/term/ns8250.c -@@ -57,6 +57,8 @@ serial_get_divisor (const struct grub_serial_port *port __attribute__ ((unused)) - base_clock = config->base_clock ? (config->base_clock >> 4) : DEFAULT_BASE_CLOCK; - - divisor = (base_clock + (config->speed / 2)) / config->speed; -+ if (config->speed == 0) -+ return 0; - if (divisor > 0xffff || divisor == 0) - return 0; - actual_speed = base_clock / divisor; -diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c -index 5784bc2..db80b3b 100644 ---- a/grub-core/term/serial.c -+++ b/grub-core/term/serial.c -@@ -220,8 +220,12 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) - - config = port->config; - -- if (state[OPTION_SPEED].set) -+ if (state[OPTION_SPEED].set) { - config.speed = grub_strtoul (state[OPTION_SPEED].arg, 0, 0); -+ if (config.speed == 0) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, -+ N_("unsupported serial port parity")); -+ } - - if (state[OPTION_WORD].set) - config.word_len = grub_strtoul (state[OPTION_WORD].arg, 0, 0); -@@ -275,6 +279,9 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) - config.base_clock *= 1000; - } - -+ if (config.speed == 0) -+ config.speed = 9600; -+ - /* Initialize with new settings. */ - err = port->driver->configure (port, &config); - if (err) --- -2.4.3 - diff --git a/0160-grub-core-term-gfxterm.c-Avoid-division-by-zero.patch b/0160-grub-core-term-gfxterm.c-Avoid-division-by-zero.patch deleted file mode 100644 index 4db98fb..0000000 --- a/0160-grub-core-term-gfxterm.c-Avoid-division-by-zero.patch +++ /dev/null @@ -1,41 +0,0 @@ -From c453760c71282bc01a88ab80fff02a247297c62b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 20:50:35 +0100 -Subject: [PATCH 160/506] * grub-core/term/gfxterm.c: Avoid division by - zero. - ---- - ChangeLog | 4 ++++ - grub-core/term/gfxterm.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 7d5a651..dc882d8 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/term/gfxterm.c: Avoid division by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - Avoid division by zero in serial. - - * grub-core/term/serial.c (grub_cmd_serial): Ensure speed is not 0. -diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c -index dc0669b..70f10f1 100644 ---- a/grub-core/term/gfxterm.c -+++ b/grub-core/term/gfxterm.c -@@ -221,6 +221,8 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, - calculate_normal_character_width (virtual_screen.font); - virtual_screen.normal_char_height = - grub_font_get_max_char_height (virtual_screen.font); -+ if (virtual_screen.normal_char_height == 0) -+ virtual_screen.normal_char_height = 16; - virtual_screen.cursor_x = 0; - virtual_screen.cursor_y = 0; - virtual_screen.cursor_state = 1; --- -2.4.3 - diff --git a/0161-include-grub-misc.h-grub_div_roundup-Remove-as-it-s-.patch b/0161-include-grub-misc.h-grub_div_roundup-Remove-as-it-s-.patch deleted file mode 100644 index b21534a..0000000 --- a/0161-include-grub-misc.h-grub_div_roundup-Remove-as-it-s-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From e360b5d176ef0a6e65cbbc3ddfffe9cf4ae7d07d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 20:52:41 +0100 -Subject: [PATCH 161/506] * include/grub/misc.h (grub_div_roundup): - Remove as it's unused. - ---- - ChangeLog | 4 ++++ - include/grub/misc.h | 7 ------- - 2 files changed, 4 insertions(+), 7 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index dc882d8..ecbe11d 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * include/grub/misc.h (grub_div_roundup): Remove as it's unused. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/term/gfxterm.c: Avoid division by zero. - - 2015-01-20 Vladimir Serbinenko -diff --git a/include/grub/misc.h b/include/grub/misc.h -index c6cd456..4b6ee06 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -390,13 +390,6 @@ grub_abs (int x) - return (unsigned int) x; - } - --/* Rounded-up division */ --static inline unsigned int --grub_div_roundup (unsigned int x, unsigned int y) --{ -- return (x + y - 1) / y; --} -- - /* Reboot the machine. */ - #if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) - void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn)); --- -2.4.3 - diff --git a/0162-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch b/0162-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch deleted file mode 100644 index 5d837dc..0000000 --- a/0162-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch +++ /dev/null @@ -1,46 +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 162/506] * 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(-) - -diff --git a/ChangeLog b/ChangeLog -index ecbe11d..c2551db 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that -+ no division by 0 occurs. -+ -+2015-01-20 Vladimir Serbinenko -+ - * include/grub/misc.h (grub_div_roundup): Remove as it's unused. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c -index 3a4cae6..d7d1783 100644 ---- a/grub-core/kern/i386/tsc.c -+++ b/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 - --- -2.4.3 - diff --git a/0163-grub-core-loader-i386-xnu.c-guessfsb-Avoid-division-.patch b/0163-grub-core-loader-i386-xnu.c-guessfsb-Avoid-division-.patch deleted file mode 100644 index 3d8f4a2..0000000 --- a/0163-grub-core-loader-i386-xnu.c-guessfsb-Avoid-division-.patch +++ /dev/null @@ -1,54 +0,0 @@ -From b666e01b9cb932de5f04fece08f21f0e5f074ebd Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 21:07:41 +0100 -Subject: [PATCH 163/506] * grub-core/loader/i386/xnu.c (guessfsb): - Avoid division by 0. - ---- - ChangeLog | 4 ++++ - grub-core/loader/i386/xnu.c | 8 +++++--- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index c2551db..0376974 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that - no division by 0 occurs. - -diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c -index 94daa02..e0506a6 100644 ---- a/grub-core/loader/i386/xnu.c -+++ b/grub-core/loader/i386/xnu.c -@@ -126,7 +126,7 @@ guessfsb (void) - { - const grub_uint64_t sane_value = 100000000; - grub_uint32_t manufacturer[3], max_cpuid, capabilities, msrlow; -- grub_uint32_t a, b, d; -+ grub_uint32_t a, b, d, divisor; - - if (! grub_cpu_is_cpuid_supported ()) - return sane_value; -@@ -166,8 +166,10 @@ guessfsb (void) - r = (2000ULL << 32) - v * grub_tsc_rate; - v += r / grub_tsc_rate; - -- return grub_divmod64 (v, ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1), -- 0); -+ divisor = ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1); -+ if (divisor == 0) -+ return sane_value; -+ return grub_divmod64 (v, divisor, 0); - } - - struct property_descriptor --- -2.4.3 - diff --git a/0164-rtc_get_time_ms.c-grub_rtc_get_time_ms-Avoid-divisio.patch b/0164-rtc_get_time_ms.c-grub_rtc_get_time_ms-Avoid-divisio.patch deleted file mode 100644 index 0f0b995..0000000 --- a/0164-rtc_get_time_ms.c-grub_rtc_get_time_ms-Avoid-divisio.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 4e0a25a4c03b5e91396912393d5db9871d45bde8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 21:10:55 +0100 -Subject: [PATCH 164/506] rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid - division by zero. - ---- - ChangeLog | 5 +++++ - grub-core/kern/generic/rtc_get_time_ms.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 0376974..40ced5a 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/kern/generic/rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid -+ division by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0. - - 2015-01-20 Vladimir Serbinenko -diff --git a/grub-core/kern/generic/rtc_get_time_ms.c b/grub-core/kern/generic/rtc_get_time_ms.c -index 49f2aca..3e39c8f 100644 ---- a/grub-core/kern/generic/rtc_get_time_ms.c -+++ b/grub-core/kern/generic/rtc_get_time_ms.c -@@ -34,5 +34,5 @@ grub_rtc_get_time_ms (void) - 1 s 1 T rtc ticks - */ - grub_uint64_t ticks_ms_per_sec = ((grub_uint64_t) 1000) * grub_get_rtc (); -- return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND, 0); -+ return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND ? : 1000, 0); - } --- -2.4.3 - diff --git a/0165-haiku-getroot.c-grub_util_find_partition_start_os-Av.patch b/0165-haiku-getroot.c-grub_util_find_partition_start_os-Av.patch deleted file mode 100644 index 6f774b2..0000000 --- a/0165-haiku-getroot.c-grub_util_find_partition_start_os-Av.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ac8bac2496d6ebf74f678288293d89a6b315ff5b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 20 Jan 2015 21:12:46 +0100 -Subject: [PATCH 165/506] haiku/getroot.c (grub_util_find_partition_start_os): - Avoid division by zero. - ---- - ChangeLog | 5 +++++ - grub-core/osdep/haiku/getroot.c | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 40ced5a..1670569 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/osdep/haiku/getroot.c (grub_util_find_partition_start_os): -+ Avoid division by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/kern/generic/rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid - division by zero. - -diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c -index 0852c5e..4e123c0 100644 ---- a/grub-core/osdep/haiku/getroot.c -+++ b/grub-core/osdep/haiku/getroot.c -@@ -65,7 +65,7 @@ grub_util_find_partition_start_os (const char *dev) - device_geometry geo; - if (ioctl (fd, B_GET_GEOMETRY, &geo, sizeof (geo)) < 0) - return 0; -- ret /= geo.bytes_per_sector; -+ ret /= geo.bytes_per_sector ? : 512; - close (fd); - return ret; - } --- -2.4.3 - diff --git a/0166-grub-core-kern-efi-mm.c-grub_efi_get_memory_map-Neve.patch b/0166-grub-core-kern-efi-mm.c-grub_efi_get_memory_map-Neve.patch deleted file mode 100644 index ab7a565..0000000 --- a/0166-grub-core-kern-efi-mm.c-grub_efi_get_memory_map-Neve.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 69aee43fa64601cabf6efa9279c10d69b466662e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 21 Jan 2015 10:17:36 +0100 -Subject: [PATCH 166/506] * grub-core/kern/efi/mm.c - (grub_efi_get_memory_map): Never return a descriptor_size==0 to avoid - potential divisions by zero. - ---- - ChangeLog | 5 +++++ - grub-core/kern/efi/mm.c | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 1670569..f9ac599 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a -+ descriptor_size==0 to avoid potential divisions by zero. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/osdep/haiku/getroot.c (grub_util_find_partition_start_os): - Avoid division by zero. - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index be37afd..20a47aa 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -230,6 +230,7 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size, - grub_efi_boot_services_t *b; - grub_efi_uintn_t key; - grub_efi_uint32_t version; -+ grub_efi_uintn_t size; - - if (grub_efi_is_finished) - { -@@ -259,10 +260,14 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size, - map_key = &key; - if (! descriptor_version) - descriptor_version = &version; -+ if (! descriptor_size) -+ descriptor_size = &size; - - b = grub_efi_system_table->boot_services; - status = efi_call_5 (b->get_memory_map, memory_map_size, memory_map, map_key, - descriptor_size, descriptor_version); -+ if (*descriptor_size == 0) -+ *descriptor_size = sizeof (grub_efi_memory_descriptor_t); - if (status == GRUB_EFI_SUCCESS) - return 1; - else if (status == GRUB_EFI_BUFFER_TOO_SMALL) --- -2.4.3 - diff --git a/0167-unix-cputime.c-Cache-sc_clk_tck-and-check-it-for-san.patch b/0167-unix-cputime.c-Cache-sc_clk_tck-and-check-it-for-san.patch deleted file mode 100644 index 427c8b3..0000000 --- a/0167-unix-cputime.c-Cache-sc_clk_tck-and-check-it-for-san.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 68581b009f6e943bd6ddf3c781db1c884832fa8e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 21 Jan 2015 10:28:52 +0100 -Subject: [PATCH 167/506] unix/cputime.c: Cache sc_clk_tck and check it for - sanity. - ---- - ChangeLog | 5 +++++ - grub-core/osdep/unix/cputime.c | 9 ++++++++- - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index f9ac599..4b9f9b2 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/osdep/unix/cputime.c (grub_util_get_cpu_time_ms): Cache -+ sc_clk_tck and check it for sanity. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a - descriptor_size==0 to avoid potential divisions by zero. - -diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c -index 47e3abc..cff359a 100644 ---- a/grub-core/osdep/unix/cputime.c -+++ b/grub-core/osdep/unix/cputime.c -@@ -9,7 +9,14 @@ grub_uint64_t - grub_util_get_cpu_time_ms (void) - { - struct tms tm; -+ static long sc_clk_tck; -+ if (!sc_clk_tck) -+ { -+ sc_clk_tck = sysconf(_SC_CLK_TCK); -+ if (sc_clk_tck <= 0) -+ sc_clk_tck = 1000; -+ } - - times (&tm); -- return (tm.tms_utime * 1000ULL) / sysconf(_SC_CLK_TCK); -+ return (tm.tms_utime * 1000ULL) / sc_clk_tck; - } --- -2.4.3 - diff --git a/0168-grub_menu_init_page-Avoid-returning-0-geometry-to-av.patch b/0168-grub_menu_init_page-Avoid-returning-0-geometry-to-av.patch deleted file mode 100644 index fbf3f84..0000000 --- a/0168-grub_menu_init_page-Avoid-returning-0-geometry-to-av.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 44b38e49885ffcb286e796b572f3f862f3be371a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 21 Jan 2015 15:51:49 +0100 -Subject: [PATCH 168/506] grub_menu_init_page: Avoid returning 0 geometry to - avoid divisions by 0. - ---- - ChangeLog | 5 +++++ - grub-core/normal/menu_text.c | 3 +++ - 2 files changed, 8 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 4b9f9b2..3383d46 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,10 @@ - 2015-01-20 Vladimir Serbinenko - -+ * grub-core/normal/menu_text.c (grub_menu_init_page): Avoid -+ returning 0 geometry to avoid divisions by 0. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/osdep/unix/cputime.c (grub_util_get_cpu_time_ms): Cache - sc_clk_tck and check it for sanity. - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 2ff2941..e22bb91 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -369,6 +369,9 @@ grub_menu_init_page (int nested, int edit, - geo->border = 0; - } - -+ if (geo->entry_width <= 0) -+ geo->entry_width = 1; -+ - if (geo->num_entries - msg_num_lines < 3 - && geo->timeout_lines == 2) - { --- -2.4.3 - diff --git a/0169-Remove-potential-division-by-0-in-gfxmenu.patch b/0169-Remove-potential-division-by-0-in-gfxmenu.patch deleted file mode 100644 index d005848..0000000 --- a/0169-Remove-potential-division-by-0-in-gfxmenu.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 6866f2ba37aafd807a6370278b49618e348a3677 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 21 Jan 2015 15:56:53 +0100 -Subject: [PATCH 169/506] Remove potential division by 0 in gfxmenu. - ---- - ChangeLog | 4 ++ - grub-core/gfxmenu/gui_circular_progress.c | 88 ++++++++++++++++--------------- - grub-core/gfxmenu/gui_list.c | 3 ++ - grub-core/gfxmenu/gui_progress_bar.c | 12 +++-- - 4 files changed, 61 insertions(+), 46 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 3383d46..2d57d83 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ - 2015-01-20 Vladimir Serbinenko - -+ Remove potential division by 0 in gfxmenu. -+ -+2015-01-20 Vladimir Serbinenko -+ - * grub-core/normal/menu_text.c (grub_menu_init_page): Avoid - returning 0 geometry to avoid divisions by 0. - -diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c -index 04f68b8..354dd7b 100644 ---- a/grub-core/gfxmenu/gui_circular_progress.c -+++ b/grub-core/gfxmenu/gui_circular_progress.c -@@ -138,51 +138,53 @@ circprog_paint (void *vself, const grub_video_rect_t *region) - (height - center_height) / 2, 0, 0, - center_width, center_height); - -- int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1; -- unsigned nticks; -- unsigned tick_begin; -- unsigned tick_end; -- if (self->end <= self->start -- || self->value <= self->start) -- nticks = 0; -- else -- nticks = ((unsigned) (self->num_ticks -- * (self->value - self->start))) -- / ((unsigned) (self->end - self->start)); -- /* Do ticks appear or disappear as the value approached the end? */ -- if (self->ticks_disappear) -+ if (self->num_ticks) - { -- tick_begin = nticks; -- tick_end = self->num_ticks; -- } -- else -- { -- tick_begin = 0; -- tick_end = nticks; -- } -- -- unsigned i; -- for (i = tick_begin; i < tick_end; i++) -- { -- int x; -- int y; -- int angle; -- -- /* Calculate the location of the tick. */ -- angle = self->start_angle -- + i * GRUB_TRIG_ANGLE_MAX / self->num_ticks; -- x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE); -- y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE); -- -- /* Adjust (x,y) so the tick is centered. */ -- x -= tick_width / 2; -- y -= tick_height / 2; -- -- /* Draw the tick. */ -- grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND, -- x, y, 0, 0, tick_width, tick_height); -+ int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1; -+ unsigned nticks; -+ unsigned tick_begin; -+ unsigned tick_end; -+ if (self->end <= self->start -+ || self->value <= self->start) -+ nticks = 0; -+ else -+ nticks = ((unsigned) (self->num_ticks -+ * (self->value - self->start))) -+ / ((unsigned) (self->end - self->start)); -+ /* Do ticks appear or disappear as the value approached the end? */ -+ if (self->ticks_disappear) -+ { -+ tick_begin = nticks; -+ tick_end = self->num_ticks; -+ } -+ else -+ { -+ tick_begin = 0; -+ tick_end = nticks; -+ } -+ -+ unsigned i; -+ for (i = tick_begin; i < tick_end; i++) -+ { -+ int x; -+ int y; -+ int angle; -+ -+ /* Calculate the location of the tick. */ -+ angle = self->start_angle -+ + i * GRUB_TRIG_ANGLE_MAX / self->num_ticks; -+ x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE); -+ y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE); -+ -+ /* Adjust (x,y) so the tick is centered. */ -+ x -= tick_width / 2; -+ y -= tick_height / 2; -+ -+ /* Draw the tick. */ -+ grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND, -+ x, y, 0, 0, tick_width, tick_height); -+ } - } -- - grub_gui_restore_viewport (&vpsave); - } - -diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c -index 5d26811..01477cd 100644 ---- a/grub-core/gfxmenu/gui_list.c -+++ b/grub-core/gfxmenu/gui_list.c -@@ -131,6 +131,9 @@ get_num_shown_items (list_impl_t self) - int max_top_pad = grub_max (item_top_pad, sel_top_pad); - int max_bottom_pad = grub_max (item_bottom_pad, sel_bottom_pad); - -+ if (item_height + item_vspace <= 0) -+ return 1; -+ - return (self->bounds.height + item_vspace - 2 * boxpad - - max_top_pad - max_bottom_pad - - box_top_pad - box_bottom_pad) / (item_height + item_vspace); -diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c -index 3501b01..b128f08 100644 ---- a/grub-core/gfxmenu/gui_progress_bar.c -+++ b/grub-core/gfxmenu/gui_progress_bar.c -@@ -118,9 +118,15 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self) - f.width + 2, f.height + 2); - - /* Bar background. */ -- int barwidth = (f.width -- * (self->value - self->start) -- / (self->end - self->start)); -+ unsigned barwidth; -+ -+ if (self->end <= self->start -+ || self->value <= self->start) -+ barwidth = 0; -+ else -+ barwidth = (f.width -+ * (self->value - self->start) -+ / (self->end - self->start)); - grub_video_fill_rect (grub_video_map_rgba_color (self->bg_color), - f.x + barwidth, f.y, - f.width - barwidth, f.height); --- -2.4.3 - diff --git a/0170-Remove-direct-_llseek-code-and-require-long-filesyst.patch b/0170-Remove-direct-_llseek-code-and-require-long-filesyst.patch deleted file mode 100644 index f9ae6ca..0000000 --- a/0170-Remove-direct-_llseek-code-and-require-long-filesyst.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001 -From: Felix Janda -Date: Thu, 22 Jan 2015 19:54:36 +0100 -Subject: [PATCH 170/506] Remove direct _llseek code and require long - filesystem libc. - ---- - ChangeLog | 4 ++++ - INSTALL | 1 + - configure.ac | 8 ++++++++ - grub-core/osdep/unix/hostdisk.c | 24 ------------------------ - 4 files changed, 13 insertions(+), 24 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 2d57d83..024a876 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2015-01-22 Felix Janda -+ -+ Remove direct _llseek code and require long filesystem libc. -+ - 2015-01-20 Vladimir Serbinenko - - Remove potential division by 0 in gfxmenu. -diff --git a/INSTALL b/INSTALL -index b67cd7f..f6f276c 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -35,6 +35,7 @@ configuring the GRUB. - * GNU binutils 2.9.1.0.23 or later - * Flex 2.5.35 or later - * Other standard GNU/Unix tools -+* a libc with large file support (e.g. glibc 2.1 or later) - - On GNU/Linux, you also need: - -diff --git a/configure.ac b/configure.ac -index 31d2b0b..fdddbad 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -366,6 +366,14 @@ case "$host_os" in - ;; - esac - -+case "$host_os" in -+ cygwin | windows* | mingw32* | aros*) -+ ;; -+ *) -+ AC_CHECK_SIZEOF(off_t) -+ test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);; -+esac -+ - if test x$USE_NLS = xno; then - HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext" - fi -diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c -index 43b56ff..b3bc0e4 100644 ---- a/grub-core/osdep/unix/hostdisk.c -+++ b/grub-core/osdep/unix/hostdisk.c -@@ -48,11 +48,6 @@ - #ifdef __linux__ - # include /* ioctl */ - # include --# if !defined(__GLIBC__) || \ -- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) --/* Maybe libc doesn't have large file support. */ --# include /* _llseek */ --# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ - #endif /* __linux__ */ - - grub_uint64_t -@@ -79,24 +74,6 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz - return st.st_size; - } - --#if defined(__linux__) && (!defined(__GLIBC__) || \ -- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) -- /* Maybe libc doesn't have large file support. */ --int --grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) --{ -- loff_t offset, result; -- static int _llseek (uint filedes, ulong hi, ulong lo, -- loff_t *res, uint wh); -- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, -- loff_t *, res, uint, wh); -- -- offset = (loff_t) off; -- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) -- return -1; -- return GRUB_ERR_NONE; --} --#else - int - grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) - { -@@ -107,7 +84,6 @@ grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) - - return 0; - } --#endif - - - /* Read LEN bytes from FD in BUF. Return less than or equal to zero if an --- -2.4.3 - diff --git a/0171-accept-also-hdX-as-alias-to-native-Xen-disk-name.patch b/0171-accept-also-hdX-as-alias-to-native-Xen-disk-name.patch deleted file mode 100644 index 4d9706c..0000000 --- a/0171-accept-also-hdX-as-alias-to-native-Xen-disk-name.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 2f73d2733ce8f1e60561a4f7c3a7caa3717fb174 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Fri, 23 Jan 2015 19:52:45 +0300 -Subject: [PATCH 171/506] accept also hdX as alias to native Xen disk name - -To be compatible with legacy pv-grub, 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 -Closes: 44026 ---- - ChangeLog | 5 +++++ - grub-core/disk/xen/xendisk.c | 45 +++++++++++++++++++++++++++++++++++--------- - 2 files changed, 41 insertions(+), 9 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index 024a876..3f01f98 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2015-01-23 Andrei Borzenkov -+ -+ * grub-core/disk/xen/xendisk.c: Accept hdX as disk names on Xen to -+ allow legacy menu.lst processing. -+ - 2015-01-22 Felix Janda - - Remove direct _llseek code and require long filesystem libc. -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; - --- -2.4.3 - diff --git a/0172-Mention-platform-none-in-NEWS.patch b/0172-Mention-platform-none-in-NEWS.patch deleted file mode 100644 index ff24371..0000000 --- a/0172-Mention-platform-none-in-NEWS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From edf2db97e72916786ee87b5a7630659369e1ee97 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 23 Jan 2015 21:06:16 +0300 -Subject: [PATCH 172/506] Mention platform "none" in NEWS - ---- - NEWS | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/NEWS b/NEWS -index a61df94..55f09d6 100644 ---- a/NEWS -+++ b/NEWS -@@ -85,6 +85,8 @@ New in 2.02: - * Support for USB debug dongles. - * Support for *-emu on all platforms (previously only i386/x86_64 worked). - * Support *-emu on Windows. -+ * New platform "none" which builds only user level utilities. This is now -+ default if target CPU is not supported. - - * Security: - * Add optional facility to enforce that all files read by the core image --- -2.4.3 - diff --git a/0173-tests-file_filter-file-Really-add-missing-file.patch b/0173-tests-file_filter-file-Really-add-missing-file.patch deleted file mode 100644 index bde4065..0000000 --- a/0173-tests-file_filter-file-Really-add-missing-file.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8acb9dc697627e4189972f15fc219581557365b6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 23 Jan 2015 19:46:02 +0100 -Subject: [PATCH 173/506] * tests/file_filter/file: Really add missing - file. - ---- - ChangeLog | 4 ++++ - tests/file_filter/file | 1 + - 2 files changed, 5 insertions(+) - create mode 100644 tests/file_filter/file - -diff --git a/ChangeLog b/ChangeLog -index 3f01f98..869f6bf 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2015-01-23 Vladimir Serbinenko -+ -+ * tests/file_filter/file: Really add missing file. -+ - 2015-01-23 Andrei Borzenkov - - * grub-core/disk/xen/xendisk.c: Accept hdX as disk names on Xen to -diff --git a/tests/file_filter/file b/tests/file_filter/file -new file mode 100644 -index 0000000..64650ac ---- /dev/null -+++ b/tests/file_filter/file -@@ -0,0 +1 @@ -+Hello, user! --- -2.4.3 - diff --git a/0174-Autogenerate-ChangeLog-from-git-changelog.patch b/0174-Autogenerate-ChangeLog-from-git-changelog.patch deleted file mode 100644 index 533bcdf..0000000 --- a/0174-Autogenerate-ChangeLog-from-git-changelog.patch +++ /dev/null @@ -1,489 +0,0 @@ -From 3bd0868364f693b17b36d592bd390ad974885ee1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 17:29:50 +0100 -Subject: [PATCH 174/506] Autogenerate ChangeLog from git changelog. - -Old ChangeLog is moved to ChangeLog-2015. For all changes starting from -this one ChangeLog will be generated from gitlog only on explicit make -invocation and make dist. ---- - ChangeLog => ChangeLog-2015 | 0 - Makefile.am | 13 +- - build-aux/gitlog-to-changelog | 432 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 444 insertions(+), 1 deletion(-) - rename ChangeLog => ChangeLog-2015 (100%) - create mode 100755 build-aux/gitlog-to-changelog - -diff --git a/ChangeLog b/ChangeLog-2015 -similarity index 100% -rename from ChangeLog -rename to ChangeLog-2015 -diff --git a/Makefile.am b/Makefile.am -index cc537a2..df0a728 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -392,7 +392,7 @@ endif - .PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \ - bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \ - bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \ -- bootcheck-linux-mips -+ bootcheck-linux-mips FORCE - - # Randomly generated - SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d -@@ -439,3 +439,14 @@ windowszip: windowsdir - rm -rf $(windowsdir) - - EXTRA_DIST += linguas.sh -+ -+changelog_start_date = 2015-01-24 -+gitlog_to_changelog = $(top_srcdir)/build-aux/gitlog-to-changelog -+ -+ChangeLog: FORCE -+ if test -d $(top_srcdir)/.git; then \ -+ $(gitlog_to_changelog) --srcdir=$(top_srcdir) --since=$(changelog_start_date) > '$@.tmp'; \ -+ rm -f '$@'; mv '$@.tmp' '$@'; \ -+ fi -+ -+EXTRA_DIST += ChangeLog ChangeLog-2015 -diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog -new file mode 100755 -index 0000000..78afff4 ---- /dev/null -+++ b/build-aux/gitlog-to-changelog -@@ -0,0 +1,432 @@ -+eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' -+ & eval 'exec perl -wS "$0" $argv:q' -+ if 0; -+# Convert git log output to ChangeLog format. -+ -+my $VERSION = '2012-07-29 06:11'; # UTC -+# The definition above must lie within the first 8 lines in order -+# for the Emacs time-stamp write hook (at end) to update it. -+# If you change this file with Emacs, please let the write hook -+# do its job. Otherwise, update this string manually. -+ -+# Copyright (C) 2008-2014 Free Software Foundation, Inc. -+ -+# This program 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. -+ -+# This program 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 this program. If not, see . -+ -+# Written by Jim Meyering -+ -+use strict; -+use warnings; -+use Getopt::Long; -+use POSIX qw(strftime); -+ -+(my $ME = $0) =~ s|.*/||; -+ -+# use File::Coda; # http://meyering.net/code/Coda/ -+END { -+ defined fileno STDOUT or return; -+ close STDOUT and return; -+ warn "$ME: failed to close standard output: $!\n"; -+ $? ||= 1; -+} -+ -+sub usage ($) -+{ -+ my ($exit_code) = @_; -+ my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); -+ if ($exit_code != 0) -+ { -+ print $STREAM "Try '$ME --help' for more information.\n"; -+ } -+ else -+ { -+ print $STREAM < ChangeLog -+ $ME -- -n 5 foo > last-5-commits-to-branch-foo -+ -+SPECIAL SYNTAX: -+ -+The following types of strings are interpreted specially when they appear -+at the beginning of a log message line. They are not copied to the output. -+ -+ Copyright-paperwork-exempt: Yes -+ Append the "(tiny change)" notation to the usual "date name email" -+ ChangeLog header to mark a change that does not require a copyright -+ assignment. -+ Co-authored-by: Joe User -+ List the specified name and email address on a second -+ ChangeLog header, denoting a co-author. -+ Signed-off-by: Joe User -+ These lines are simply elided. -+ -+In a FILE specified via --amend, comment lines (starting with "#") are ignored. -+FILE must consist of pairs where SHA is a 40-byte SHA1 (alone on -+a line) referring to a commit in the current project, and CODE refers to one -+or more consecutive lines of Perl code. Pairs must be separated by one or -+more blank line. -+ -+Here is sample input for use with --amend=FILE, from coreutils: -+ -+3a169f4c5d9159283548178668d2fae6fced3030 -+# fix typo in title: -+s/all tile types/all file types/ -+ -+1379ed974f1fa39b12e2ffab18b3f7a607082202 -+# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself. -+# Change the author to be Paul. Note the escaped "@": -+s,Jim .*>,Paul Eggert , -+ -+EOF -+ } -+ exit $exit_code; -+} -+ -+# If the string $S is a well-behaved file name, simply return it. -+# If it contains white space, quotes, etc., quote it, and return the new string. -+sub shell_quote($) -+{ -+ my ($s) = @_; -+ if ($s =~ m![^\w+/.,-]!) -+ { -+ # Convert each single quote to '\'' -+ $s =~ s/\'/\'\\\'\'/g; -+ # Then single quote the string. -+ $s = "'$s'"; -+ } -+ return $s; -+} -+ -+sub quoted_cmd(@) -+{ -+ return join (' ', map {shell_quote $_} @_); -+} -+ -+# Parse file F. -+# Comment lines (starting with "#") are ignored. -+# F must consist of pairs where SHA is a 40-byte SHA1 -+# (alone on a line) referring to a commit in the current project, and -+# CODE refers to one or more consecutive lines of Perl code. -+# Pairs must be separated by one or more blank line. -+sub parse_amend_file($) -+{ -+ my ($f) = @_; -+ -+ open F, '<', $f -+ or die "$ME: $f: failed to open for reading: $!\n"; -+ -+ my $fail; -+ my $h = {}; -+ my $in_code = 0; -+ my $sha; -+ while (defined (my $line = )) -+ { -+ $line =~ /^\#/ -+ and next; -+ chomp $line; -+ $line eq '' -+ and $in_code = 0, next; -+ -+ if (!$in_code) -+ { -+ $line =~ /^([0-9a-fA-F]{40})$/ -+ or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), -+ $fail = 1, next; -+ $sha = lc $1; -+ $in_code = 1; -+ exists $h->{$sha} -+ and (warn "$ME: $f:$.: duplicate SHA1\n"), -+ $fail = 1, next; -+ } -+ else -+ { -+ $h->{$sha} ||= ''; -+ $h->{$sha} .= "$line\n"; -+ } -+ } -+ close F; -+ -+ $fail -+ and exit 1; -+ -+ return $h; -+} -+ -+# git_dir_option $SRCDIR -+# -+# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR -+# is undef). Return as a list (0 or 1 element). -+sub git_dir_option($) -+{ -+ my ($srcdir) = @_; -+ my @res = (); -+ if (defined $srcdir) -+ { -+ my $qdir = shell_quote $srcdir; -+ my $cmd = "cd $qdir && git rev-parse --show-toplevel"; -+ my $qcmd = shell_quote $cmd; -+ my $git_dir = qx($cmd); -+ defined $git_dir -+ or die "$ME: cannot run $qcmd: $!\n"; -+ $? == 0 -+ or die "$ME: $qcmd had unexpected exit code or signal ($?)\n"; -+ chomp $git_dir; -+ push @res, "--git-dir=$git_dir/.git"; -+ } -+ @res; -+} -+ -+{ -+ my $since_date; -+ my $format_string = '%s%n%b%n'; -+ my $amend_file; -+ my $append_dot = 0; -+ my $cluster = 1; -+ my $strip_tab = 0; -+ my $strip_cherry_pick = 0; -+ my $srcdir; -+ GetOptions -+ ( -+ help => sub { usage 0 }, -+ version => sub { print "$ME version $VERSION\n"; exit }, -+ 'since=s' => \$since_date, -+ 'format=s' => \$format_string, -+ 'amend=s' => \$amend_file, -+ 'append-dot' => \$append_dot, -+ 'cluster!' => \$cluster, -+ 'strip-tab' => \$strip_tab, -+ 'strip-cherry-pick' => \$strip_cherry_pick, -+ 'srcdir=s' => \$srcdir, -+ ) or usage 1; -+ -+ defined $since_date -+ and unshift @ARGV, "--since=$since_date"; -+ -+ # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/) -+ # that makes a correction in the log or attribution of that commit. -+ my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {}; -+ -+ my @cmd = ('git', -+ git_dir_option $srcdir, -+ qw(log --log-size), -+ '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV); -+ open PIPE, '-|', @cmd -+ or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n" -+ . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); -+ -+ my $prev_multi_paragraph; -+ my $prev_date_line = ''; -+ my @prev_coauthors = (); -+ while (1) -+ { -+ defined (my $in = ) -+ or last; -+ $in =~ /^log size (\d+)$/ -+ or die "$ME:$.: Invalid line (expected log size):\n$in"; -+ my $log_nbytes = $1; -+ -+ my $log; -+ my $n_read = read PIPE, $log, $log_nbytes; -+ $n_read == $log_nbytes -+ or die "$ME:$.: unexpected EOF\n"; -+ -+ # Extract leading hash. -+ my ($sha, $rest) = split ':', $log, 2; -+ defined $sha -+ or die "$ME:$.: malformed log entry\n"; -+ $sha =~ /^[0-9a-fA-F]{40}$/ -+ or die "$ME:$.: invalid SHA1: $sha\n"; -+ -+ # If this commit's log requires any transformation, do it now. -+ my $code = $amend_code->{$sha}; -+ if (defined $code) -+ { -+ eval 'use Safe'; -+ my $s = new Safe; -+ # Put the unpreprocessed entry into "$_". -+ $_ = $rest; -+ -+ # Let $code operate on it, safely. -+ my $r = $s->reval("$code") -+ or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n"; -+ -+ # Note that we've used this entry. -+ delete $amend_code->{$sha}; -+ -+ # Update $rest upon success. -+ $rest = $_; -+ } -+ -+ # Remove lines inserted by "git cherry-pick". -+ if ($strip_cherry_pick) -+ { -+ $rest =~ s/^\s*Conflicts:\n.*//sm; -+ $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; -+ } -+ -+ my @line = split "\n", $rest; -+ my $author_line = shift @line; -+ defined $author_line -+ or die "$ME:$.: unexpected EOF\n"; -+ $author_line =~ /^(\d+) (.*>)$/ -+ or die "$ME:$.: Invalid line " -+ . "(expected date/author/email):\n$author_line\n"; -+ -+ # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog -+ # `(tiny change)' annotation. -+ my $tiny = (grep (/^Copyright-paperwork-exempt:\s+[Yy]es$/, @line) -+ ? ' (tiny change)' : ''); -+ -+ my $date_line = sprintf "%s %s$tiny\n", -+ strftime ("%F", localtime ($1)), $2; -+ -+ my @coauthors = grep /^Co-authored-by:.*$/, @line; -+ # Omit meta-data lines we've already interpreted. -+ @line = grep !/^(?:Signed-off-by:[ ].*>$ -+ |Co-authored-by:[ ] -+ |Copyright-paperwork-exempt:[ ] -+ )/x, @line; -+ -+ # Remove leading and trailing blank lines. -+ if (@line) -+ { -+ while ($line[0] =~ /^\s*$/) { shift @line; } -+ while ($line[$#line] =~ /^\s*$/) { pop @line; } -+ } -+ -+ # Record whether there are two or more paragraphs. -+ my $multi_paragraph = grep /^\s*$/, @line; -+ -+ # Format 'Co-authored-by: A U Thor ' lines in -+ # standard multi-author ChangeLog format. -+ for (@coauthors) -+ { -+ s/^Co-authored-by:\s*/\t /; -+ s/\s*/ -+ or warn "$ME: warning: missing email address for " -+ . substr ($_, 5) . "\n"; -+ } -+ -+ # If clustering of commit messages has been disabled, if this header -+ # would be different from the previous date/name/email/coauthors header, -+ # or if this or the previous entry consists of two or more paragraphs, -+ # then print the header. -+ if ( ! $cluster -+ || $date_line ne $prev_date_line -+ || "@coauthors" ne "@prev_coauthors" -+ || $multi_paragraph -+ || $prev_multi_paragraph) -+ { -+ $prev_date_line eq '' -+ or print "\n"; -+ print $date_line; -+ @coauthors -+ and print join ("\n", @coauthors), "\n"; -+ } -+ $prev_date_line = $date_line; -+ @prev_coauthors = @coauthors; -+ $prev_multi_paragraph = $multi_paragraph; -+ -+ # If there were any lines -+ if (@line == 0) -+ { -+ warn "$ME: warning: empty commit message:\n $date_line\n"; -+ } -+ else -+ { -+ if ($append_dot) -+ { -+ # If the first line of the message has enough room, then -+ if (length $line[0] < 72) -+ { -+ # append a dot if there is no other punctuation or blank -+ # at the end. -+ $line[0] =~ /[[:punct:]\s]$/ -+ or $line[0] .= '.'; -+ } -+ } -+ -+ # Remove one additional leading TAB from each line. -+ $strip_tab -+ and map { s/^\t// } @line; -+ -+ # Prefix each non-empty line with a TAB. -+ @line = map { length $_ ? "\t$_" : '' } @line; -+ -+ print "\n", join ("\n", @line), "\n"; -+ } -+ -+ defined ($in = ) -+ or last; -+ $in ne "\n" -+ and die "$ME:$.: unexpected line:\n$in"; -+ } -+ -+ close PIPE -+ or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; -+ # FIXME-someday: include $PROCESS_STATUS in the diagnostic -+ -+ # Complain about any unused entry in the --amend=F specified file. -+ my $fail = 0; -+ foreach my $sha (keys %$amend_code) -+ { -+ warn "$ME:$amend_file: unused entry: $sha\n"; -+ $fail = 1; -+ } -+ -+ exit $fail; -+} -+ -+# Local Variables: -+# mode: perl -+# indent-tabs-mode: nil -+# eval: (add-hook 'write-file-hooks 'time-stamp) -+# time-stamp-start: "my $VERSION = '" -+# time-stamp-format: "%:y-%02m-%02d %02H:%02M" -+# time-stamp-time-zone: "UTC" -+# time-stamp-end: "'; # UTC" -+# End: --- -2.4.3 - diff --git a/0175-conf-Makefile.common-Remove-unused-LD-C-FLAGS_CPU.patch b/0175-conf-Makefile.common-Remove-unused-LD-C-FLAGS_CPU.patch deleted file mode 100644 index 440fd19..0000000 --- a/0175-conf-Makefile.common-Remove-unused-LD-C-FLAGS_CPU.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 11504d523cca9206e0df1e4f128d6d7d59ac1d9a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 17:44:19 +0100 -Subject: [PATCH 175/506] conf/Makefile.common: Remove unused {LD,C}FLAGS_CPU. - ---- - conf/Makefile.common | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 51fbaf9..8c4d148 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -41,19 +41,19 @@ BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) - - LDADD_KERNEL = $(TARGET_LIBGCC) - --CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding --LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC) -+CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding -+LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC) - CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 - CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version - --CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding --LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d -+CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding -+LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d - CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) - CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - --CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin --LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S -+CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin -+LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S - CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) - CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - --- -2.4.3 - diff --git a/0176-util-grub-mkrescue.c-Always-include-part_msdos-and-p.patch b/0176-util-grub-mkrescue.c-Always-include-part_msdos-and-p.patch deleted file mode 100644 index f0735e3..0000000 --- a/0176-util-grub-mkrescue.c-Always-include-part_msdos-and-p.patch +++ /dev/null @@ -1,40 +0,0 @@ -From eeea31b2208d862a3ff50f2739e103b22dc0061b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 17:45:16 +0100 -Subject: [PATCH 176/506] util/grub-mkrescue.c: Always include part_msdos and - part_gpt on EFI. - -When booted from stick, EFI would use GPT partition and our root -device detection algortihm depends on GRUB's ability to see the same -partitions. Hence include msdos and gpt partmap modules on EFI even when -they're not needed to access root filesystem. ---- - util/grub-mkrescue.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index e719839..e02340f 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -653,6 +653,9 @@ main (int argc, char *argv[]) - char *efiimgfat; - grub_install_mkdir_p (efidir_efi_boot); - -+ grub_install_push_module ("part_gpt"); -+ grub_install_push_module ("part_msdos"); -+ - imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi"); - make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname); - free (imgname); -@@ -713,6 +716,8 @@ main (int argc, char *argv[]) - free (efiimgfat); - free (efidir_efi); - free (efidir); -+ grub_install_pop_module (); -+ grub_install_pop_module (); - } - - grub_install_push_module ("part_apple"); --- -2.4.3 - diff --git a/0177-efidisk-Return-the-determined-root-disk-even-if-part.patch b/0177-efidisk-Return-the-determined-root-disk-even-if-part.patch deleted file mode 100644 index 33bc3e8..0000000 --- a/0177-efidisk-Return-the-determined-root-disk-even-if-part.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 7d027b4d3e632b0a3a81dd1f31012a80f7746b74 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 19:53:13 +0100 -Subject: [PATCH 177/506] efidisk: Return the determined root disk even if - partition is unknown. - ---- - grub-core/disk/efi/efidisk.c | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) - -diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index 3b12c34..60a6d3c 100644 ---- a/grub-core/disk/efi/efidisk.c -+++ b/grub-core/disk/efi/efidisk.c -@@ -803,7 +803,6 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) - && (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE - || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)) - { -- int is_cdrom = 0; - struct grub_efidisk_get_device_name_ctx ctx; - char *dev_name; - grub_efi_device_path_t *dup_dp; -@@ -824,9 +823,6 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) - || GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE))) - break; - -- if (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE) -- is_cdrom = 1; -- - 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); -@@ -861,10 +857,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) - - if (! ctx.partition_name) - { -+ /* No partition found. In most cases partition is embed in -+ the root path anyway, so this is not critical. -+ This happens only if partition is on partmap that GRUB -+ doesn't need to access root. -+ */ - grub_disk_close (parent); -- if (is_cdrom) -- return grub_strdup (device_name); -- return 0; -+ return grub_strdup (device_name); - } - - dev_name = grub_xasprintf ("%s,%s", parent->name, --- -2.4.3 - diff --git a/0178-Makefile.am-Fix-Changelog-cutoff-address.patch b/0178-Makefile.am-Fix-Changelog-cutoff-address.patch deleted file mode 100644 index 050e2a1..0000000 --- a/0178-Makefile.am-Fix-Changelog-cutoff-address.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 14c9a720397e6674c8c46e2e0697c2bf2a7132ae Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:12:51 +0100 -Subject: [PATCH 178/506] Makefile.am: Fix Changelog cutoff address. - -gitlog-to-changelog Doesn't generate entries for cutoff day, only -for days after the cutoff date, adjust by one to compensate. ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index df0a728..a232eb1 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -440,7 +440,7 @@ windowszip: windowsdir - - EXTRA_DIST += linguas.sh - --changelog_start_date = 2015-01-24 -+changelog_start_date = 2015-01-23 - gitlog_to_changelog = $(top_srcdir)/build-aux/gitlog-to-changelog - - ChangeLog: FORCE --- -2.4.3 - diff --git a/0179-Generate-empty-ChangeLog-if-no-.git-is-available.patch b/0179-Generate-empty-ChangeLog-if-no-.git-is-available.patch deleted file mode 100644 index 38b7287..0000000 --- a/0179-Generate-empty-ChangeLog-if-no-.git-is-available.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b8f537199a64c7aef68ed39e037f52e9bb629cfc Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:14:59 +0100 -Subject: [PATCH 179/506] Generate empty ChangeLog if no .git is available. - -When making dist from a git snapshot without repo available make dist would -fail to find ChangeLog. Generate empty ChangeLog if no ChangeLog is already -present and repo is not available. - -Reported by: Andrei Borzenkov ---- - Makefile.am | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile.am b/Makefile.am -index a232eb1..f702951 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -447,6 +447,8 @@ ChangeLog: FORCE - if test -d $(top_srcdir)/.git; then \ - $(gitlog_to_changelog) --srcdir=$(top_srcdir) --since=$(changelog_start_date) > '$@.tmp'; \ - rm -f '$@'; mv '$@.tmp' '$@'; \ -+ else \ -+ touch $@; \ - fi - - EXTRA_DIST += ChangeLog ChangeLog-2015 --- -2.4.3 - diff --git a/0180-Always-add-msoft-float-to-avoid-compiler-generating-.patch b/0180-Always-add-msoft-float-to-avoid-compiler-generating-.patch deleted file mode 100644 index 2ea6e1d..0000000 --- a/0180-Always-add-msoft-float-to-avoid-compiler-generating-.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3661261fe17a8fe19681073889b5b36ec1ee823d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:37:08 +0100 -Subject: [PATCH 180/506] Always add -msoft-float to avoid compiler generating - float arithmetics. - ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index fdddbad..b734dd0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -671,6 +671,12 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p - TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" - fi - -+# GRUB doesn't use float or doubles at all. Yet some toolchains may decide -+# that floats are a good fit to run instead of what's written in the code. -+# Given that floating point unit is disabled (if present to begin with) -+# when GRUB is running which may result in various hard crashes. -+TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" -+ - # By default, GCC 4.4 generates .eh_frame sections containing unwind - # information in some cases where it previously did not. GRUB doesn't need - # these and they just use up vital space. Restore the old compiler --- -2.4.3 - diff --git a/0181-uhci-Fix-null-pointer-dereference.patch b/0181-uhci-Fix-null-pointer-dereference.patch deleted file mode 100644 index d4c4fa3..0000000 --- a/0181-uhci-Fix-null-pointer-dereference.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 9ff9d5a54ead6fba080a08fcb1ff8462b8cf2497 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:38:12 +0100 -Subject: [PATCH 181/506] uhci: Fix null pointer dereference. - -Found by: Coverity scan. ---- - grub-core/bus/usb/uhci.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/grub-core/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c -index a95fdfe..7c5811f 100644 ---- a/grub-core/bus/usb/uhci.c -+++ b/grub-core/bus/usb/uhci.c -@@ -625,9 +625,7 @@ grub_uhci_check_transfer (grub_usb_controller_t dev, - return GRUB_USB_ERR_NONE; - } - -- grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status); -- -- if (!(errtd->ctrl_status & (1 << 23))) -+ if (errtd && !(errtd->ctrl_status & (1 << 23))) - { - grub_usb_err_t err = GRUB_USB_ERR_NONE; - --- -2.4.3 - diff --git a/0182-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch b/0182-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch deleted file mode 100644 index 00fa305..0000000 --- a/0182-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch +++ /dev/null @@ -1,38 +0,0 @@ -From e902163e484523698f1cc4f06b64830f30909153 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:41:43 +0100 -Subject: [PATCH 182/506] commands/acpi: Use ALIGN_UP rather than manual - expression. - -Improves readability and hopefully automatic scanning. - -Found by: Coverity Scan. ---- - grub-core/commands/acpi.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c -index 97c2cf2..f66fa2d 100644 ---- a/grub-core/commands/acpi.c -+++ b/grub-core/commands/acpi.c -@@ -227,7 +227,7 @@ grub_acpi_create_ebda (void) - grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target); - v2inebda = target; - target += v2->length; -- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); -+ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); - v2 = 0; - break; - } -@@ -246,7 +246,7 @@ grub_acpi_create_ebda (void) - grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target); - v1inebda = target; - target += sizeof (struct grub_acpi_rsdp_v10); -- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); -+ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); - v1 = 0; - break; - } --- -2.4.3 - diff --git a/0183-commands-file-Change-the-confusing-loop-stop-conditi.patch b/0183-commands-file-Change-the-confusing-loop-stop-conditi.patch deleted file mode 100644 index 0fc2a68..0000000 --- a/0183-commands-file-Change-the-confusing-loop-stop-conditi.patch +++ /dev/null @@ -1,48 +0,0 @@ -From b04c6d32ce816c5d8943c767bb4cc7e56aa3c1c5 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:45:25 +0100 -Subject: [PATCH 183/506] commands/file: Change the confusing loop stop - condition. - -Old condition was used to zero-out header variable on exit of the loop. -This is correct but confusing. Replace with in-loop logic. - -Found by: Coverity Scan. ---- - grub-core/commands/file.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c -index 42d62d4..12fba99 100644 ---- a/grub-core/commands/file.c -+++ b/grub-core/commands/file.c -@@ -476,8 +476,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - be at least 12 bytes and aligned on a 4-byte boundary. */ - for (header = buffer; - ((char *) header <= -- (char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12)) -- || (header = 0); header += step) -+ (char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12)); -+ header += step) - { - if (header[0] == magic - && !(grub_le_to_cpu32 (header[0]) -@@ -485,11 +485,12 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - + grub_le_to_cpu32 (header[2]) - + (type == IS_MULTIBOOT2 - ? grub_le_to_cpu32 (header[3]) : 0))) -- break; -+ { -+ ret = 1; -+ break; -+ } - } - -- if (header != 0) -- ret = 1; - grub_free (buffer); - break; - } --- -2.4.3 - diff --git a/0184-commands-fileXX-Fix-memory-leak.patch b/0184-commands-fileXX-Fix-memory-leak.patch deleted file mode 100644 index aa439ca..0000000 --- a/0184-commands-fileXX-Fix-memory-leak.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 95a8c9182bc8ab25cbd62424f28a32432f823698 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:50:35 +0100 -Subject: [PATCH 184/506] commands/fileXX: Fix memory leak. - -Found by: Coverity Scan. ---- - grub-core/commands/fileXX.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c -index 58e1094..7743f3e 100644 ---- a/grub-core/commands/fileXX.c -+++ b/grub-core/commands/fileXX.c -@@ -40,10 +40,10 @@ grub_file_check_netbsdXX (grub_elf_t elf) - return 0; - - if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1) -- return 0; -+ goto fail; - - if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize) -- return 0; -+ goto fail; - - s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize); - stroff = s->sh_offset; -@@ -59,13 +59,16 @@ grub_file_check_netbsdXX (grub_elf_t elf) - if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) - { - if (grub_errno) -- return grub_errno; -+ goto fail; - continue; - } - if (grub_memcmp (name, ".note.netbsd.ident", - sizeof(".note.netbsd.ident")) != 0) - continue; -+ grub_free (s0); - return 1; - } -+ fail: -+ grub_free (s0); - return 0; - } --- -2.4.3 - diff --git a/0185-gptsync-Add-missing-device_close.patch b/0185-gptsync-Add-missing-device_close.patch deleted file mode 100644 index 9256ab2..0000000 --- a/0185-gptsync-Add-missing-device_close.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9d999852a223b9b00b5f417cb49d3334773408d8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:52:02 +0100 -Subject: [PATCH 185/506] gptsync: Add missing device_close. - -Found by: Coverity scan ---- - grub-core/commands/gptsync.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/commands/gptsync.c b/grub-core/commands/gptsync.c -index 16592e9..444e248 100644 ---- a/grub-core/commands/gptsync.c -+++ b/grub-core/commands/gptsync.c -@@ -235,6 +235,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), - return grub_errno; - } - -+ grub_device_close (dev); -+ - grub_printf_ (N_("New MBR is written to `%s'\n"), args[0]); - - return GRUB_ERR_NONE; --- -2.4.3 - diff --git a/0186-commands-hdparm-Add-missing-grub_disk_close.patch b/0186-commands-hdparm-Add-missing-grub_disk_close.patch deleted file mode 100644 index 1d37b10..0000000 --- a/0186-commands-hdparm-Add-missing-grub_disk_close.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 68cf24376c531ee468615a84aa361e2a6e0406a9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:55:06 +0100 -Subject: [PATCH 186/506] commands/hdparm: Add missing grub_disk_close. - -Found by: Coverity scan. ---- - grub-core/commands/hdparm.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/commands/hdparm.c b/grub-core/commands/hdparm.c -index 3fb0891..f6b178e 100644 ---- a/grub-core/commands/hdparm.c -+++ b/grub-core/commands/hdparm.c -@@ -329,6 +329,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) - break; - } - default: -+ grub_disk_close (disk); - return grub_error (GRUB_ERR_IO, "not an ATA device"); - } - --- -2.4.3 - diff --git a/0187-zfs-Fix-disk-matching-logic.patch b/0187-zfs-Fix-disk-matching-logic.patch deleted file mode 100644 index 8762737..0000000 --- a/0187-zfs-Fix-disk-matching-logic.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 12a9c52e516b94888db0a4502946242e3b14709f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 20:57:26 +0100 -Subject: [PATCH 187/506] zfs: Fix disk-matching logic. - -Reported by: Tim Chase ---- - grub-core/fs/zfs/zfs.c | 14 ++++++-------- - 1 file changed, 6 insertions(+), 8 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index c943b52..c8c7b97 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -252,7 +252,6 @@ struct grub_zfs_data - - uberblock_t current_uberblock; - -- int mounted; - grub_uint64_t guid; - }; - -@@ -957,7 +956,7 @@ nvpair_value (const char *nvp,char **val, - static grub_err_t - check_pool_label (struct grub_zfs_data *data, - struct grub_zfs_device_desc *diskdesc, -- int *inserted) -+ int *inserted, int original) - { - grub_uint64_t pool_state, txg = 0; - char *nvlist,*features; -@@ -1081,11 +1080,12 @@ check_pool_label (struct grub_zfs_data *data, - - grub_dprintf ("zfs", "check 11 passed\n"); - -- if (data->mounted && data->guid != poolguid) -- return grub_error (GRUB_ERR_BAD_FS, "another zpool"); -- else -+ if (original) - data->guid = poolguid; - -+ if (data->guid != poolguid) -+ return grub_error (GRUB_ERR_BAD_FS, "another zpool"); -+ - { - char *nv; - nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE); -@@ -1186,7 +1186,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, - } - grub_dprintf ("zfs", "label ok %d\n", label); - -- err = check_pool_label (data, &desc, inserted); -+ err = check_pool_label (data, &desc, inserted, original); - if (err || !*inserted) - { - grub_errno = GRUB_ERR_NONE; -@@ -3612,8 +3612,6 @@ zfs_mount (grub_device_t dev) - ub_endian) >> 63) & 1; - grub_free (osp); - -- data->mounted = 1; -- - return data; - } - --- -2.4.3 - diff --git a/0188-commands-legacycfg-Fix-resource-leaks.patch b/0188-commands-legacycfg-Fix-resource-leaks.patch deleted file mode 100644 index bc404e8..0000000 --- a/0188-commands-legacycfg-Fix-resource-leaks.patch +++ /dev/null @@ -1,65 +0,0 @@ -From f579f097bbf37d0ec23acb1434f2f1a38f266594 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:06:23 +0100 -Subject: [PATCH 188/506] commands/legacycfg: Fix resource leaks. - ---- - grub-core/commands/legacycfg.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index 2c09fb7..d42d777 100644 ---- a/grub-core/commands/legacycfg.c -+++ b/grub-core/commands/legacycfg.c -@@ -57,14 +57,20 @@ legacy_file (const char *filename) - - file = grub_file_open (filename); - if (! file) -- return grub_errno; -+ { -+ grub_free (suffix); -+ return grub_errno; -+ } - - menu = grub_env_get_menu (); - if (! menu) - { - menu = grub_zalloc (sizeof (*menu)); - if (! menu) -- return grub_errno; -+ { -+ grub_free (suffix); -+ return grub_errno; -+ } - - grub_env_set_menu (menu); - } -@@ -77,6 +83,7 @@ legacy_file (const char *filename) - if (!buf && grub_errno) - { - grub_file_close (file); -+ grub_free (suffix); - return grub_errno; - } - -@@ -173,6 +180,8 @@ legacy_file (const char *filename) - if (!args) - { - grub_file_close (file); -+ grub_free (suffix); -+ grub_free (entrysrc); - return grub_errno; - } - args[0] = entryname; -@@ -376,6 +385,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), - if (part && grub_strcmp (part->partmap->name, "msdos") == 0) - bsd_slice = part->number; - } -+ if (dev) -+ grub_device_close (dev); - } - - /* k*BSD didn't really work well with grub-legacy. */ --- -2.4.3 - diff --git a/0189-commands-macbless-Remove-incorrect-grub_free.patch b/0189-commands-macbless-Remove-incorrect-grub_free.patch deleted file mode 100644 index 6027e9e..0000000 --- a/0189-commands-macbless-Remove-incorrect-grub_free.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 09e84f188b6e18acf7ae2d3d82d798d92c35d7a5 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:08:50 +0100 -Subject: [PATCH 189/506] commands/macbless: Remove incorrect grub_free. - -Found by: Coverity Scan ---- - grub-core/commands/macbless.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c -index 4724edd..cf90eea 100644 ---- a/grub-core/commands/macbless.c -+++ b/grub-core/commands/macbless.c -@@ -203,7 +203,6 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) - grub_device_close (dev); - - grub_free (device_name); -- grub_free (path); - - return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); - } --- -2.4.3 - diff --git a/0190-commands-macbless-Fix-potential-overflow.patch b/0190-commands-macbless-Fix-potential-overflow.patch deleted file mode 100644 index ba3ea13..0000000 --- a/0190-commands-macbless-Fix-potential-overflow.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e3b3e53f72647fa189ae245d73dc560166bb57d3 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:12:02 +0100 -Subject: [PATCH 190/506] commands/macbless: Fix potential overflow. - -Is a minor concern as no such FS would be created under normal circumstances -and failure was benign. - -Found by: Coverity scan. ---- - grub-core/commands/macbless.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c -index cf90eea..f9e01b6 100644 ---- a/grub-core/commands/macbless.c -+++ b/grub-core/commands/macbless.c -@@ -106,7 +106,7 @@ grub_mac_bless_inode (grub_device_t dev, grub_uint32_t inode, int is_dir, - ablk_size = grub_be_to_cpu32 (volheader.hfs.blksz); - ablk_start = grub_be_to_cpu16 (volheader.hfs.first_block); - embedded_offset = (ablk_start -- + extent_start -+ + ((grub_uint64_t) extent_start) - * (ablk_size >> GRUB_DISK_SECTOR_BITS)); - - err = --- -2.4.3 - diff --git a/0191-commands-macbless-Handle-device-opening-errors-corre.patch b/0191-commands-macbless-Handle-device-opening-errors-corre.patch deleted file mode 100644 index 32b0e1a..0000000 --- a/0191-commands-macbless-Handle-device-opening-errors-corre.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 72bbd8046a55f4a7995535696f375e465ccb0237 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:15:14 +0100 -Subject: [PATCH 191/506] commands/macbless: Handle device opening errors - correctly. - -Wrong variable was checked for errors. - -Found by: Coverity scan. ---- - grub-core/commands/macbless.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c -index f9e01b6..18efa1a 100644 ---- a/grub-core/commands/macbless.c -+++ b/grub-core/commands/macbless.c -@@ -183,7 +183,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) - { - char *device_name; - char *path = 0; -- grub_device_t dev; -+ grub_device_t dev = 0; - grub_err_t err; - - if (argc != 1) -@@ -197,7 +197,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) - else - path = path + 1; - -- if (!path || *path == 0 || !device_name) -+ if (!path || *path == 0 || !dev) - { - if (dev) - grub_device_close (dev); --- -2.4.3 - diff --git a/0192-commands-nativedisk-Add-missing-device_close.patch b/0192-commands-nativedisk-Add-missing-device_close.patch deleted file mode 100644 index 32fd904..0000000 --- a/0192-commands-nativedisk-Add-missing-device_close.patch +++ /dev/null @@ -1,33 +0,0 @@ -From bd50aa323d30d064563c213ab7ee8b8846981609 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:18:36 +0100 -Subject: [PATCH 192/506] commands/nativedisk: Add missing device_close. - -Found by: Coverity scan. ---- - grub-core/commands/nativedisk.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c -index 33b6b99..b3bc463 100644 ---- a/grub-core/commands/nativedisk.c -+++ b/grub-core/commands/nativedisk.c -@@ -57,6 +57,7 @@ get_uuid (const char *name, char **uuid, int getnative) - if (!dev->disk) - { - grub_dprintf ("nativedisk", "Skipping non-disk\n"); -+ grub_device_close (dev); - return 0; - } - -@@ -90,6 +91,7 @@ get_uuid (const char *name, char **uuid, int getnative) - case GRUB_DISK_DEVICE_MEMDISK_ID: - grub_dprintf ("nativedisk", "Skipping native disk %s\n", - dev->disk->name); -+ grub_device_close (dev); - return 0; - - /* FIXME: those probably need special handling. */ --- -2.4.3 - diff --git a/0193-commands-parttool-Add-missing-device-close.patch b/0193-commands-parttool-Add-missing-device-close.patch deleted file mode 100644 index 683bf54..0000000 --- a/0193-commands-parttool-Add-missing-device-close.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 4947f11b09184806cbfda7ebb2ae25df25be6693 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:22:02 +0100 -Subject: [PATCH 193/506] commands/parttool: Add missing device close. - -Found by: Coverity scan. ---- - grub-core/commands/parttool.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c -index a47ff07..d907694 100644 ---- a/grub-core/commands/parttool.c -+++ b/grub-core/commands/parttool.c -@@ -243,11 +243,19 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), - } - - if (argc == 1) -- return show_help (dev); -+ { -+ err = show_help (dev); -+ grub_device_close (dev); -+ return err; -+ } - - for (i = 1; i < argc; i++) - if (grub_strcmp (args[i], "help") == 0) -- return show_help (dev); -+ { -+ err = show_help (dev); -+ grub_device_close (dev); -+ return err; -+ } - - parsed = (int *) grub_zalloc (argc * sizeof (int)); - --- -2.4.3 - diff --git a/0194-commands-syslinux-Add-missing-free.patch b/0194-commands-syslinux-Add-missing-free.patch deleted file mode 100644 index 096b3cf..0000000 --- a/0194-commands-syslinux-Add-missing-free.patch +++ /dev/null @@ -1,29 +0,0 @@ -From fbae51dcea91bf5b8d1f11a436867f933d370346 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:23:25 +0100 -Subject: [PATCH 194/506] commands/syslinux: Add missing free. - -Found by: Coverity scan. ---- - grub-core/commands/syslinuxcfg.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/syslinuxcfg.c b/grub-core/commands/syslinuxcfg.c -index 00ae113..7be28fa 100644 ---- a/grub-core/commands/syslinuxcfg.c -+++ b/grub-core/commands/syslinuxcfg.c -@@ -119,7 +119,10 @@ syslinux_file (grub_extcmd_context_t ctxt, const char *filename) - { - menu = grub_zalloc (sizeof (*menu)); - if (! menu) -- return grub_errno; -+ { -+ grub_free (result); -+ return grub_errno; -+ } - - grub_env_set_menu (menu); - } --- -2.4.3 - diff --git a/0195-commands-tr-Simplify-and-fix-missing-parameter-test.patch b/0195-commands-tr-Simplify-and-fix-missing-parameter-test.patch deleted file mode 100644 index 259019a..0000000 --- a/0195-commands-tr-Simplify-and-fix-missing-parameter-test.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6079e67926079d4b3ca35aa570eee2c0f4459f04 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:25:42 +0100 -Subject: [PATCH 195/506] commands/tr: Simplify and fix missing parameter test. - -Found by: Coverity scan ---- - grub-core/commands/tr.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/tr.c b/grub-core/commands/tr.c -index 84ad6ff..ef72841 100644 ---- a/grub-core/commands/tr.c -+++ b/grub-core/commands/tr.c -@@ -80,7 +80,7 @@ grub_cmd_tr (grub_extcmd_context_t ctxt, int argc, char **args) - } else if (argc > 3) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters"); - -- if (argc <= 0 && (!s1 || !s2 || !input)) -+ if (!s1 || !s2 || !input) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing parameters"); - - if (grub_strlen (s1) != grub_strlen (s2)) --- -2.4.3 - diff --git a/0196-commands-verify-Fix-sha1-context-zeroing-out.patch b/0196-commands-verify-Fix-sha1-context-zeroing-out.patch deleted file mode 100644 index d3118c4..0000000 --- a/0196-commands-verify-Fix-sha1-context-zeroing-out.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 37ba761b1cba6e210fa451a7f3dbd6e3dab58a65 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:27:10 +0100 -Subject: [PATCH 196/506] commands/verify: Fix sha1 context zeroing-out. - -Current code doesn't zero-out context completely. It's a minor issue -really as sha1 init already takes care of initing the context. ---- - grub-core/commands/verify.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c -index d599576..6569391 100644 ---- a/grub-core/commands/verify.c -+++ b/grub-core/commands/verify.c -@@ -308,7 +308,7 @@ grub_load_public_key (grub_file_t f) - if (!sk) - goto fail; - -- grub_memset (fingerprint_context, 0, sizeof (fingerprint_context)); -+ grub_memset (fingerprint_context, 0, GRUB_MD_SHA1->contextsize); - GRUB_MD_SHA1->init (fingerprint_context); - GRUB_MD_SHA1->write (fingerprint_context, "\x99", 1); - len_be = grub_cpu_to_be16 (len); --- -2.4.3 - diff --git a/0197-commands-wildcard-Add-missing-free.patch b/0197-commands-wildcard-Add-missing-free.patch deleted file mode 100644 index 5df1772..0000000 --- a/0197-commands-wildcard-Add-missing-free.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 3b1b39c08234ba856ec89748f379bac7c710e11a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:29:19 +0100 -Subject: [PATCH 197/506] commands/wildcard: Add missing free. - -Found by: Coverity scan. ---- - grub-core/commands/wildcard.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index 2807f80..d207acf 100644 ---- a/grub-core/commands/wildcard.c -+++ b/grub-core/commands/wildcard.c -@@ -245,7 +245,10 @@ match_devices_iter (const char *name, void *data) - - t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2)); - if (! t) -- return 1; -+ { -+ grub_free (buffer); -+ return 1; -+ } - - ctx->devs = t; - ctx->devs[ctx->ndev++] = buffer; --- -2.4.3 - diff --git a/0198-disk-AFsplitter-check-argument-validity-before-doing.patch b/0198-disk-AFsplitter-check-argument-validity-before-doing.patch deleted file mode 100644 index 5a23d88..0000000 --- a/0198-disk-AFsplitter-check-argument-validity-before-doing.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 7d973359427394a00d1d8778b352b67c9ff486d6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:33:30 +0100 -Subject: [PATCH 198/506] disk/AFsplitter: check argument validity before doing - any allocs. - -This avoids possible memory leaks. - -Found by: Coverity scan. ---- - grub-core/disk/AFSplitter.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/disk/AFSplitter.c b/grub-core/disk/AFSplitter.c -index 7e1bd57..f5a8ddc 100644 ---- a/grub-core/disk/AFSplitter.c -+++ b/grub-core/disk/AFSplitter.c -@@ -72,13 +72,13 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst, - grub_size_t i; - grub_uint8_t *bufblock; - -+ if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0) -+ return GPG_ERR_INV_ARG; -+ - bufblock = grub_zalloc (blocksize); - if (bufblock == NULL) - return GPG_ERR_OUT_OF_MEMORY; - -- if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0) -- return GPG_ERR_INV_ARG; -- - grub_memset (bufblock, 0, blocksize); - for (i = 0; i < blocknumbers - 1; i++) - { --- -2.4.3 - diff --git a/0199-disk-ahci-Fix-device_map_range-argument.patch b/0199-disk-ahci-Fix-device_map_range-argument.patch deleted file mode 100644 index 76d5d11..0000000 --- a/0199-disk-ahci-Fix-device_map_range-argument.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2a8200bba8d6372fdb2ffb38240542795084f7d8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:37:28 +0100 -Subject: [PATCH 199/506] disk/ahci: Fix device_map_range argument. - -Argument is not used on x86, hence it's gone unnoticed. - -Found by: Coverity scan. ---- - grub-core/disk/ahci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 89365cd..d6bdbdd 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -198,7 +198,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - | GRUB_PCI_COMMAND_MEM_ENABLED); - - hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK, -- sizeof (hba)); -+ sizeof (*hba)); - grub_dprintf ("ahci", "dev: %x:%x.%x\n", dev.bus, dev.device, dev.function); - - grub_dprintf ("ahci", "tfd[0]: %x\n", --- -2.4.3 - diff --git a/0200-disk-cryptodisk-Add-missing-error-check.patch b/0200-disk-cryptodisk-Add-missing-error-check.patch deleted file mode 100644 index fc394c8..0000000 --- a/0200-disk-cryptodisk-Add-missing-error-check.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 4c7337bfe9082c2a005a10ce6dd98293e707943c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:38:22 +0100 -Subject: [PATCH 200/506] disk/cryptodisk: Add missing error check. - -Found by: Coverity scan. ---- - grub-core/disk/cryptodisk.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c -index f0e3a90..376ab83 100644 ---- a/grub-core/disk/cryptodisk.c -+++ b/grub-core/disk/cryptodisk.c -@@ -372,11 +372,13 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev, - break; - case GRUB_CRYPTODISK_MODE_ECB: - if (do_encrypt) -- grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i, -- (1U << dev->log_sector_size)); -+ err = grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i, -+ (1U << dev->log_sector_size)); - else -- grub_crypto_ecb_decrypt (dev->cipher, data + i, data + i, -- (1U << dev->log_sector_size)); -+ err = grub_crypto_ecb_decrypt (dev->cipher, data + i, data + i, -+ (1U << dev->log_sector_size)); -+ if (err) -+ return err; - break; - default: - return GPG_ERR_NOT_IMPLEMENTED; --- -2.4.3 - diff --git a/0201-disk-diskfilter-Add-missing-lv-presence-check.patch b/0201-disk-diskfilter-Add-missing-lv-presence-check.patch deleted file mode 100644 index 5500d39..0000000 --- a/0201-disk-diskfilter-Add-missing-lv-presence-check.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f2baeb194be2f08e9281115df514cd3ceeba6110 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:44:27 +0100 -Subject: [PATCH 201/506] disk/diskfilter: Add missing lv presence check. - -Found by: Coverity scan. ---- - grub-core/disk/diskfilter.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 97ca546..6124846 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -1065,7 +1065,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - array->lvs->segments->extent_count = totsize; - } - -- if (array->lvs->segments -+ if (array->lvs && array->lvs->segments - && array->lvs->segments->raid_member_size > disk_size) - array->lvs->segments->raid_member_size = disk_size; - --- -2.4.3 - diff --git a/0202-disk-geli-Add-missing-seek-success-check.patch b/0202-disk-geli-Add-missing-seek-success-check.patch deleted file mode 100644 index 51e5888..0000000 --- a/0202-disk-geli-Add-missing-seek-success-check.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 6f43e350ed1d122a35c6b1880f6e1756455f0a6c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:46:23 +0100 -Subject: [PATCH 202/506] disk/geli: Add missing seek success check. - -Found by: Coverity scan. ---- - grub-core/disk/geli.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c -index 4ed07bb..bf73fbd 100644 ---- a/grub-core/disk/geli.c -+++ b/grub-core/disk/geli.c -@@ -212,7 +212,8 @@ grub_util_get_geli_uuid (const char *dev) - - s = grub_util_get_fd_size (fd, dev, &log_secsize); - s >>= log_secsize; -- grub_util_fd_seek (fd, (s << log_secsize) - 512); -+ if (grub_util_fd_seek (fd, (s << log_secsize) - 512) < 0) -+ grub_util_error ("%s", _("couldn't read ELI metadata")); - - uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1); - if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0) --- -2.4.3 - diff --git a/0203-disk-geli-Add-missing-free.patch b/0203-disk-geli-Add-missing-free.patch deleted file mode 100644 index cbb9723..0000000 --- a/0203-disk-geli-Add-missing-free.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 7656b72b17c3bf12a3e2173fc04aebf67b286983 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:47:51 +0100 -Subject: [PATCH 203/506] disk/geli: Add missing free. - -Found by: Coverity scan. ---- - grub-core/disk/geli.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c -index bf73fbd..e9d2329 100644 ---- a/grub-core/disk/geli.c -+++ b/grub-core/disk/geli.c -@@ -232,7 +232,10 @@ grub_util_get_geli_uuid (const char *dev) - - err = make_uuid ((void *) &hdr, uuid); - if (err) -- return NULL; -+ { -+ grub_free (uuid); -+ return NULL; -+ } - - return uuid; - } --- -2.4.3 - diff --git a/0204-biosdisk-Add-missing-cast.patch b/0204-biosdisk-Add-missing-cast.patch deleted file mode 100644 index 99cc31e..0000000 --- a/0204-biosdisk-Add-missing-cast.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d1130afa5f22e4fee75ab55f11e16e0fbd98597d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:50:30 +0100 -Subject: [PATCH 204/506] biosdisk: Add missing cast. - -Found by: Coverity scan. ---- - grub-core/disk/i386/pc/biosdisk.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c -index 26a4973..f0aadd1 100644 ---- a/grub-core/disk/i386/pc/biosdisk.c -+++ b/grub-core/disk/i386/pc/biosdisk.c -@@ -382,7 +382,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) - /* Some buggy BIOSes doesn't return the total sectors - correctly but returns zero. So if it is zero, compute - it by C/H/S returned by the LBA BIOS call. */ -- total_sectors = drp->cylinders * drp->heads * drp->sectors; -+ total_sectors = ((grub_uint64_t) drp->cylinders) -+ * drp->heads * drp->sectors; - if (drp->bytes_per_sector - && !(drp->bytes_per_sector & (drp->bytes_per_sector - 1)) - && drp->bytes_per_sector >= 512 -@@ -425,7 +426,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) - data->heads = 255; - - if (! total_sectors) -- total_sectors = data->cylinders * data->heads * data->sectors; -+ total_sectors = ((grub_uint64_t) data->cylinders) -+ * data->heads * data->sectors; - } - - disk->total_sectors = total_sectors; --- -2.4.3 - diff --git a/0205-font-Add-missing-free.patch b/0205-font-Add-missing-free.patch deleted file mode 100644 index 5d21dba..0000000 --- a/0205-font-Add-missing-free.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dd430afbf874f6212742c079d72b4b9e959e0542 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 24 Jan 2015 21:55:18 +0100 -Subject: [PATCH 205/506] font: Add missing free. - -Found by: Coverity Scan. ---- - grub-core/font/font.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 14b93e1..607964b 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -777,6 +777,7 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) - if (grub_file_read (font->file, glyph->bitmap, len) != len) - { - remove_font (font); -+ grub_free (glyph); - return 0; - } - } --- -2.4.3 - diff --git a/0206-fs-cbfs-Add-missing-free.patch b/0206-fs-cbfs-Add-missing-free.patch deleted file mode 100644 index 0ce76e2..0000000 --- a/0206-fs-cbfs-Add-missing-free.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b6f21bcb98f03d61087b4423261bda5d6a58fb1f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 00:00:49 +0100 -Subject: [PATCH 206/506] fs/cbfs: Add missing free. - -Found by: Coverity scan. ---- - grub-core/fs/cbfs.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c -index 35750a0..4ddd683 100644 ---- a/grub-core/fs/cbfs.c -+++ b/grub-core/fs/cbfs.c -@@ -144,7 +144,7 @@ static struct grub_archelp_data * - grub_cbfs_mount (grub_disk_t disk) - { - struct cbfs_file hd; -- struct grub_archelp_data *data; -+ struct grub_archelp_data *data = NULL; - grub_uint32_t ptr; - grub_off_t header_off; - struct cbfs_header head; -@@ -196,6 +196,7 @@ grub_cbfs_mount (grub_disk_t disk) - return data; - - fail: -+ grub_free (data); - grub_error (GRUB_ERR_BAD_FS, "not a cbfs filesystem"); - return 0; - } --- -2.4.3 - diff --git a/0207-fs-cpio_common-Add-a-sanity-check-on-namesize.patch b/0207-fs-cpio_common-Add-a-sanity-check-on-namesize.patch deleted file mode 100644 index eae56f7..0000000 --- a/0207-fs-cpio_common-Add-a-sanity-check-on-namesize.patch +++ /dev/null @@ -1,32 +0,0 @@ -From faad548ce3b906535acaeff95777b46836b817e6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 00:11:59 +0100 -Subject: [PATCH 207/506] fs/cpio_common: Add a sanity check on namesize. - -Found by: Coverity scan. ---- - grub-core/fs/cpio_common.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c -index b0ae9f4..20230a7 100644 ---- a/grub-core/fs/cpio_common.c -+++ b/grub-core/fs/cpio_common.c -@@ -61,6 +61,14 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, - modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); - namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); - -+ /* Don't allow negative numbers. */ -+ if (namesize >= 0x80000000) -+ { -+ /* Probably a corruption, don't attempt to recover. */ -+ *mode = GRUB_ARCHELP_ATTR_END; -+ return GRUB_ERR_NONE; -+ } -+ - if (mode) - *mode = modeval; - --- -2.4.3 - diff --git a/0208-fs-fat-Fix-codepath-to-properly-free-on-error.patch b/0208-fs-fat-Fix-codepath-to-properly-free-on-error.patch deleted file mode 100644 index 81f05fc..0000000 --- a/0208-fs-fat-Fix-codepath-to-properly-free-on-error.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 83543f937a3525ef577c5a6333cb6791aadcee3d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 01:27:44 +0100 -Subject: [PATCH 208/506] fs/fat: Fix codepath to properly free on error. - -Found by: Coverity scan. ---- - grub-core/fs/fat.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c -index 79fe864..71537ff 100644 ---- a/grub-core/fs/fat.c -+++ b/grub-core/fs/fat.c -@@ -1136,7 +1136,7 @@ grub_fat_label (grub_device_t device, char **label) - if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) - { - grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); -- return 0; -+ goto fail; - } - - err = grub_fat_iterate_init (&ctxt); --- -2.4.3 - diff --git a/0209-fs-hfs-hfs_open-Check-that-mount-succeeded.patch b/0209-fs-hfs-hfs_open-Check-that-mount-succeeded.patch deleted file mode 100644 index 0898ae9..0000000 --- a/0209-fs-hfs-hfs_open-Check-that-mount-succeeded.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4387ca78f0aada6ce04e4132e50f6b73fa60671f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 01:28:17 +0100 -Subject: [PATCH 209/506] fs/hfs/hfs_open: Check that mount succeeded. - -Found by: Coverity scan. ---- - grub-core/fs/hfs.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index f46f77a..ab472f4 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -1306,6 +1306,12 @@ grub_hfs_open (struct grub_file *file, const char *name) - - data = grub_hfs_mount (file->device->disk); - -+ if (!data) -+ { -+ grub_dl_unref (my_mod); -+ return grub_errno; -+ } -+ - if (grub_hfs_find_dir (data, name, &frec, 0)) - { - grub_free (data); --- -2.4.3 - diff --git a/0210-fs-hfs-Add-pointer-sanity-checks.patch b/0210-fs-hfs-Add-pointer-sanity-checks.patch deleted file mode 100644 index 7f3855c..0000000 --- a/0210-fs-hfs-Add-pointer-sanity-checks.patch +++ /dev/null @@ -1,63 +0,0 @@ -From d0af2156c3b3e900956651523da17afff4969815 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 11:32:29 +0100 -Subject: [PATCH 210/506] fs/hfs: Add pointer sanity checks. - -Found by: Coverity scan. ---- - grub-core/fs/hfs.c | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index ab472f4..06cf0c7 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -692,6 +692,7 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, - int i; - struct grub_hfs_extent *dat; - int blk; -+ grub_uint16_t reccnt; - - dat = (struct grub_hfs_extent *) (type == 0 - ? (&data->sblock.catalog_recs) -@@ -710,8 +711,12 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, - return grub_errno; - } - -+ reccnt = grub_be_to_cpu16 (node->node.reccnt); -+ if (reccnt > (nodesize >> 1)) -+ reccnt = (nodesize >> 1); -+ - /* Iterate over all records in this node. */ -- for (i = 0; i < grub_be_to_cpu16 (node->node.reccnt); i++) -+ for (i = 0; i < reccnt; i++) - { - int pos = (nodesize >> 1) - 1 - i; - struct pointer -@@ -719,16 +724,19 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, - grub_uint8_t keylen; - grub_uint8_t key; - } GRUB_PACKED *pnt; -- pnt = (struct pointer *) (grub_be_to_cpu16 (node->offsets[pos]) -- + node->rawnode); -+ grub_uint16_t off = grub_be_to_cpu16 (node->offsets[pos]); -+ if (off > nodesize - sizeof(*pnt)) -+ continue; -+ pnt = (struct pointer *) (off + node->rawnode); -+ if (nodesize < (grub_size_t) off + pnt->keylen + 1) -+ continue; - - struct grub_hfs_record rec = - { - &pnt->key, - pnt->keylen, - &pnt->key + pnt->keylen +(pnt->keylen + 1) % 2, -- nodesize - grub_be_to_cpu16 (node->offsets[pos]) -- - pnt->keylen - 1 -+ nodesize - off - pnt->keylen - 1 - }; - - if (node_hook (&node->node, &rec, hook_arg)) --- -2.4.3 - diff --git a/0211-commands-fileXX-Fix-remaining-memory-leak.patch b/0211-commands-fileXX-Fix-remaining-memory-leak.patch deleted file mode 100644 index a97de8d..0000000 --- a/0211-commands-fileXX-Fix-remaining-memory-leak.patch +++ /dev/null @@ -1,26 +0,0 @@ -From fb66b512fa241c98b44ce6032e1d285d9d9f9aa3 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 25 Jan 2015 16:36:30 +0300 -Subject: [PATCH 211/506] commands/fileXX: Fix remaining memory leak. - -Found by: Coverity Scan. ---- - grub-core/commands/fileXX.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c -index 7743f3e..c17d26c 100644 ---- a/grub-core/commands/fileXX.c -+++ b/grub-core/commands/fileXX.c -@@ -54,7 +54,7 @@ grub_file_check_netbsdXX (grub_elf_t elf) - char name[sizeof(".note.netbsd.ident")]; - grub_memset (name, 0, sizeof (name)); - if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1) -- return grub_errno; -+ goto fail; - - if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) - { --- -2.4.3 - diff --git a/0212-grub_iso9660_read-Explicitly-check-read_node-return-.patch b/0212-grub_iso9660_read-Explicitly-check-read_node-return-.patch deleted file mode 100644 index 1c0a588..0000000 --- a/0212-grub_iso9660_read-Explicitly-check-read_node-return-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From ac602ce7005090a34e021f736a9ad3ac033a4cc8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:19:58 +0100 -Subject: [PATCH 212/506] grub_iso9660_read: Explicitly check read_node return - value. - -Not really needed as grub_errno is already checked but is nicer. - -Found by: Coverity scan. ---- - grub-core/fs/iso9660.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 6a66773..67a67cf 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -959,14 +959,15 @@ grub_iso9660_read (grub_file_t file, char *buf, grub_size_t len) - { - struct grub_iso9660_data *data = - (struct grub_iso9660_data *) file->data; -+ grub_err_t err; - - /* XXX: The file is stored in as a single extent. */ - data->disk->read_hook = file->read_hook; - data->disk->read_hook_data = file->read_hook_data; -- read_node (data->node, file->offset, len, buf); -+ err = read_node (data->node, file->offset, len, buf); - data->disk->read_hook = NULL; - -- if (grub_errno) -+ if (err || grub_errno) - return -1; - - return len; --- -2.4.3 - diff --git a/0213-fs-minix-Fix-sector-promotion-to-64-bit.patch b/0213-fs-minix-Fix-sector-promotion-to-64-bit.patch deleted file mode 100644 index e92f8e3..0000000 --- a/0213-fs-minix-Fix-sector-promotion-to-64-bit.patch +++ /dev/null @@ -1,100 +0,0 @@ -From ca793e9c058dd1d08780e176ce5bcdeefa47a6be Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:21:32 +0100 -Subject: [PATCH 213/506] fs/minix: Fix sector promotion to 64-bit. - -While on it make GRUB_MINIX_ZONE2SECT into function. - -Found by: Coverity scan ---- - grub-core/fs/minix.c | 39 +++++++++++++++++++++++---------------- - 1 file changed, 23 insertions(+), 16 deletions(-) - -diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c -index 90ddd34..d451b34 100644 ---- a/grub-core/fs/minix.c -+++ b/grub-core/fs/minix.c -@@ -82,17 +82,6 @@ typedef grub_uint16_t grub_minix_ino_t; - #define GRUB_MINIX_INODE_DINDIR_ZONE(data) (grub_minix_to_cpu_n \ - (data->inode.double_indir_zone)) - --#ifndef MODE_MINIX3 --#define GRUB_MINIX_LOG2_ZONESZ (GRUB_MINIX_LOG2_BSIZE \ -- + grub_minix_to_cpu16 (data->sblock.log2_zone_size)) --#endif -- --#ifdef MODE_MINIX3 --#define GRUB_MINIX_ZONE2SECT(zone) ((zone) * data->block_size) --#else --#define GRUB_MINIX_ZONE2SECT(zone) ((zone) << GRUB_MINIX_LOG2_ZONESZ) --#endif -- - - #ifdef MODE_MINIX3 - struct grub_minix_sblock -@@ -182,15 +171,32 @@ static grub_dl_t my_mod; - static grub_err_t grub_minix_find_file (struct grub_minix_data *data, - const char *path); - -+#ifdef MODE_MINIX3 -+static inline grub_disk_addr_t -+grub_minix_zone2sect (struct grub_minix_data *data, grub_minix_uintn_t zone) -+{ -+ return ((grub_disk_addr_t) zone) * data->block_size; -+} -+#else -+static inline grub_disk_addr_t -+grub_minix_zone2sect (struct grub_minix_data *data, grub_minix_uintn_t zone) -+{ -+ int log2_zonesz = (GRUB_MINIX_LOG2_BSIZE -+ + grub_minix_to_cpu16 (data->sblock.log2_zone_size)); -+ return (((grub_disk_addr_t) zone) << log2_zonesz); -+} -+#endif -+ -+ - /* Read the block pointer in ZONE, on the offset NUM. */ - static grub_minix_uintn_t --grub_get_indir (struct grub_minix_data *data, -+grub_get_indir (struct grub_minix_data *data, - grub_minix_uintn_t zone, - grub_minix_uintn_t num) - { - grub_minix_uintn_t indirn; - grub_disk_read (data->disk, -- GRUB_MINIX_ZONE2SECT(zone), -+ grub_minix_zone2sect(data, zone), - sizeof (grub_minix_uintn_t) * num, - sizeof (grub_minix_uintn_t), (char *) &indirn); - return grub_minix_to_cpu_n (indirn); -@@ -281,7 +287,7 @@ grub_minix_read_file (struct grub_minix_data *data, - - for (i = posblock; i < blockcnt; i++) - { -- grub_disk_addr_t blknr; -+ grub_minix_uintn_t blknr; - grub_uint64_t blockend = data->block_size << GRUB_DISK_SECTOR_BITS; - grub_off_t skipfirst = 0; - -@@ -310,7 +316,7 @@ grub_minix_read_file (struct grub_minix_data *data, - data->disk->read_hook = read_hook; - data->disk->read_hook_data = read_hook_data; - grub_disk_read (data->disk, -- GRUB_MINIX_ZONE2SECT(blknr), -+ grub_minix_zone2sect(data, blknr), - skipfirst, blockend, buf); - data->disk->read_hook = 0; - if (grub_errno) -@@ -336,7 +342,8 @@ grub_minix_read_inode (struct grub_minix_data *data, grub_minix_ino_t ino) - - /* The first inode in minix is inode 1. */ - ino--; -- block = GRUB_MINIX_ZONE2SECT (2 + grub_minix_to_cpu16 (sblock->inode_bmap_size) -+ block = grub_minix_zone2sect (data, -+ 2 + grub_minix_to_cpu16 (sblock->inode_bmap_size) - + grub_minix_to_cpu16 (sblock->zone_bmap_size)); - block += ino / (GRUB_DISK_SECTOR_SIZE / sizeof (struct grub_minix_inode)); - int offs = (ino % (GRUB_DISK_SECTOR_SIZE --- -2.4.3 - diff --git a/0214-fs-ntfs-Add-missing-free.patch b/0214-fs-ntfs-Add-missing-free.patch deleted file mode 100644 index 0b551ec..0000000 --- a/0214-fs-ntfs-Add-missing-free.patch +++ /dev/null @@ -1,29 +0,0 @@ -From bc0ecd7104b3420964364b7a01b7dd7141081b9b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:22:24 +0100 -Subject: [PATCH 214/506] fs/ntfs: Add missing free. - -Found by: Coverity scan. ---- - grub-core/fs/ntfs.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index d3a91f5..2cbcb0b 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -618,7 +618,10 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, - - ustr = get_utf8 (np, ns); - if (ustr == NULL) -- return 0; -+ { -+ grub_free (fdiro); -+ return 0; -+ } - if (namespace) - type |= GRUB_FSHELP_CASE_INSENSITIVE; - --- -2.4.3 - diff --git a/0215-fs-ntfs-Add-sizes-sanity-checks.patch b/0215-fs-ntfs-Add-sizes-sanity-checks.patch deleted file mode 100644 index f866849..0000000 --- a/0215-fs-ntfs-Add-sizes-sanity-checks.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 157f9a9cca0990bf213e5041daaf4641c1764e09 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:28:50 +0100 -Subject: [PATCH 215/506] fs/ntfs: Add sizes sanity checks. - -Found by: Coverity scan. ---- - grub-core/fs/ntfs.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 2cbcb0b..6f84688 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -920,12 +920,16 @@ grub_ntfs_mount (grub_disk_t disk) - - if (bpb.clusters_per_mft > 0) - data->mft_size = ((grub_disk_addr_t) bpb.clusters_per_mft) << data->log_spc; -+ else if (-bpb.clusters_per_mft < GRUB_NTFS_BLK_SHR || -bpb.clusters_per_mft >= 31) -+ goto fail; - else - data->mft_size = 1ULL << (-bpb.clusters_per_mft - GRUB_NTFS_BLK_SHR); - - if (bpb.clusters_per_index > 0) - data->idx_size = (((grub_disk_addr_t) bpb.clusters_per_index) - << data->log_spc); -+ else if (-bpb.clusters_per_index < GRUB_NTFS_BLK_SHR || -bpb.clusters_per_index >= 31) -+ goto fail; - else - data->idx_size = 1ULL << (-bpb.clusters_per_index - GRUB_NTFS_BLK_SHR); - --- -2.4.3 - diff --git a/0216-fs-reiserfs-Fix-sector-count-overflow.patch b/0216-fs-reiserfs-Fix-sector-count-overflow.patch deleted file mode 100644 index 1a8dd86..0000000 --- a/0216-fs-reiserfs-Fix-sector-count-overflow.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 8c1d08668974cc59f00e0cbc1c37c2f03e1a132e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:29:26 +0100 -Subject: [PATCH 216/506] fs/reiserfs: Fix sector count overflow. - -Found by: Coverity scan. ---- - grub-core/fs/reiserfs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c -index de3d4fa..b781665 100644 ---- a/grub-core/fs/reiserfs.c -+++ b/grub-core/fs/reiserfs.c -@@ -1090,7 +1090,7 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, - switch (found.type) - { - case GRUB_REISERFS_DIRECT: -- block = found.block_number * (block_size >> GRUB_DISK_SECTOR_BITS); -+ block = ((grub_disk_addr_t) found.block_number) * (block_size >> GRUB_DISK_SECTOR_BITS); - grub_dprintf ("reiserfs_blocktype", "D: %u\n", (unsigned) block); - if (initial_position < current_position + item_size) - { --- -2.4.3 - diff --git a/0217-fs-sfs-Fix-error-check-and-add-sanity-check.patch b/0217-fs-sfs-Fix-error-check-and-add-sanity-check.patch deleted file mode 100644 index d8f76c6..0000000 --- a/0217-fs-sfs-Fix-error-check-and-add-sanity-check.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 66baeffc0f6373be4745a8f1941c46fc5e104392 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 25 Jan 2015 13:33:03 +0100 -Subject: [PATCH 217/506] fs/sfs: Fix error check and add sanity check. - -Found by: Coverity scan. ---- - grub-core/fs/sfs.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c -index 6c82150..57b8d8d 100644 ---- a/grub-core/fs/sfs.c -+++ b/grub-core/fs/sfs.c -@@ -173,10 +173,11 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block, - struct grub_sfs_btree *tree; - int i; - grub_uint32_t next; -+ grub_size_t blocksize = GRUB_DISK_SECTOR_SIZE << data->log_blocksize; - -- treeblock = grub_malloc (GRUB_DISK_SECTOR_SIZE << data->log_blocksize); -- if (!block) -- return 0; -+ treeblock = grub_malloc (blocksize); -+ if (!treeblock) -+ return grub_errno; - - next = grub_be_to_cpu32 (data->rblock.btree); - tree = (struct grub_sfs_btree *) treeblock; -@@ -184,17 +185,21 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block, - /* Handle this level in the btree. */ - do - { -+ grub_uint16_t nnodes; - grub_disk_read (data->disk, - ((grub_disk_addr_t) next) << data->log_blocksize, -- 0, GRUB_DISK_SECTOR_SIZE << data->log_blocksize, -- treeblock); -+ 0, blocksize, treeblock); - if (grub_errno) - { - grub_free (treeblock); - return grub_errno; - } - -- for (i = grub_be_to_cpu16 (tree->nodes) - 1; i >= 0; i--) -+ nnodes = grub_be_to_cpu16 (tree->nodes); -+ if (nnodes * (grub_uint32_t) (tree)->nodesize > blocksize) -+ break; -+ -+ for (i = (int) nnodes - 1; i >= 0; i--) - { - - #define EXTNODE(tree, index) \ --- -2.4.3 - diff --git a/0218-configure.ac-Always-add-D_FILE_OFFSET_BITS-64.patch b/0218-configure.ac-Always-add-D_FILE_OFFSET_BITS-64.patch deleted file mode 100644 index 65389bd..0000000 --- a/0218-configure.ac-Always-add-D_FILE_OFFSET_BITS-64.patch +++ /dev/null @@ -1,35 +0,0 @@ -From fc7a64bc5aa2ab9b0a9475692c6f392681525b93 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:35:44 +0100 -Subject: [PATCH 218/506] configure.ac: Always add -D_FILE_OFFSET_BITS=64. - ---- - configure.ac | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index b734dd0..a3bca06 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -354,6 +354,9 @@ if test x"$target_cpu-$platform" = xsparc64-emu ; then - HOST_CFLAGS="$HOST_CFLAGS -m64" - fi - -+CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" -+HOST_CPPFLAGS="$HOST_CPPFLAGS -D_FILE_OFFSET_BITS=64" -+ - AC_C_BIGENDIAN - AC_CHECK_SIZEOF(void *) - AC_CHECK_SIZEOF(long) -@@ -1477,7 +1480,7 @@ fi - if test x"$grub_mount_excuse" = x ; then - # Check for fuse headers. - SAVED_CPPFLAGS="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" -+ CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26" - AC_CHECK_HEADERS([fuse/fuse.h], [], - [grub_mount_excuse=["need FUSE headers"]]) - CPPFLAGS="$SAVED_CPPFLAGS" --- -2.4.3 - diff --git a/0219-fs-ufs-Add-missing-error-check.patch b/0219-fs-ufs-Add-missing-error-check.patch deleted file mode 100644 index 9ccc8fe..0000000 --- a/0219-fs-ufs-Add-missing-error-check.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a4e33a8b180a289ee48ab22c63e0f836adb2ade7 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:36:19 +0100 -Subject: [PATCH 219/506] fs/ufs: Add missing error check. - -Found by: Coverity scan. ---- - grub-core/fs/ufs.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c -index f560ad3..0619d6e 100644 ---- a/grub-core/fs/ufs.c -+++ b/grub-core/fs/ufs.c -@@ -465,7 +465,13 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino) - && INODE_SIZE (data) <= sizeof (data->inode.symlink)) - grub_strcpy (symlink, (char *) data->inode.symlink); - else -- grub_ufs_read_file (data, 0, 0, 0, sz, symlink); -+ { -+ if (grub_ufs_read_file (data, 0, 0, 0, sz, symlink) < 0) -+ { -+ grub_free(symlink); -+ return grub_errno; -+ } -+ } - symlink[sz] = '\0'; - - /* The symlink is an absolute path, go back to the root inode. */ --- -2.4.3 - diff --git a/0220-gfxmenu-icon_manager-Fix-null-pointer-dereference.patch b/0220-gfxmenu-icon_manager-Fix-null-pointer-dereference.patch deleted file mode 100644 index 8fc40c6..0000000 --- a/0220-gfxmenu-icon_manager-Fix-null-pointer-dereference.patch +++ /dev/null @@ -1,30 +0,0 @@ -From bd74a925e5026cd0368b3455df8ffcf0b1b4150b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:37:01 +0100 -Subject: [PATCH 220/506] gfxmenu/icon_manager: Fix null pointer dereference. - -Found by: Coverity scan. ---- - grub-core/gfxmenu/icon_manager.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/gfxmenu/icon_manager.c b/grub-core/gfxmenu/icon_manager.c -index ff49ab0..1894682 100644 ---- a/grub-core/gfxmenu/icon_manager.c -+++ b/grub-core/gfxmenu/icon_manager.c -@@ -106,8 +106,10 @@ grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr, - const char *path) - { - /* Clear the cache if the theme path has changed. */ -- if (((mgr->theme_path == 0) != (path == 0)) -- || (grub_strcmp (mgr->theme_path, path) != 0)) -+ if (mgr->theme_path == 0 && path == 0) -+ return; -+ if (mgr->theme_path == 0 || path == 0 -+ || grub_strcmp (mgr->theme_path, path) != 0) - grub_gfxmenu_icon_manager_clear_cache (mgr); - - grub_free (mgr->theme_path); --- -2.4.3 - diff --git a/0221-gfxmenu-theme_loader-Add-missing-allos-error-check.patch b/0221-gfxmenu-theme_loader-Add-missing-allos-error-check.patch deleted file mode 100644 index c5b4742..0000000 --- a/0221-gfxmenu-theme_loader-Add-missing-allos-error-check.patch +++ /dev/null @@ -1,26 +0,0 @@ -From af0be976bf5bb45c0d5d5290ca0f2a83fb380785 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:37:39 +0100 -Subject: [PATCH 221/506] gfxmenu/theme_loader: Add missing allos error check. - -Found by: Coverity scan. ---- - grub-core/gfxmenu/theme_loader.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/gfxmenu/theme_loader.c b/grub-core/gfxmenu/theme_loader.c -index 8a79458..1a6ed1d 100644 ---- a/grub-core/gfxmenu/theme_loader.c -+++ b/grub-core/gfxmenu/theme_loader.c -@@ -774,6 +774,8 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path) - view->canvas->component.ops->destroy (view->canvas); - - view->canvas = grub_gui_canvas_new (); -+ if (!view->canvas) -+ goto fail; - ((grub_gui_component_t) view->canvas) - ->ops->set_bounds ((grub_gui_component_t) view->canvas, - &view->screen); --- -2.4.3 - diff --git a/0222-i386-pc-mmap-Fix-memset-size.patch b/0222-i386-pc-mmap-Fix-memset-size.patch deleted file mode 100644 index 76487a7..0000000 --- a/0222-i386-pc-mmap-Fix-memset-size.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 21f22c71077a4d460049107a946ceca8b514ffb3 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:38:11 +0100 -Subject: [PATCH 222/506] i386/pc/mmap: Fix memset size. - -Found by: Coverity scan. ---- - grub-core/kern/i386/pc/mmap.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c -index f1375f3..c0c3c35 100644 ---- a/grub-core/kern/i386/pc/mmap.c -+++ b/grub-core/kern/i386/pc/mmap.c -@@ -148,7 +148,7 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) - - while (1) - { -- grub_memset (entry, 0, sizeof (entry)); -+ grub_memset (entry, 0, sizeof (*entry)); - - cont = grub_get_mmap_entry (entry, cont); - --- -2.4.3 - diff --git a/0223-lib-syslinux_parse-Add-missing-alloc-check.patch b/0223-lib-syslinux_parse-Add-missing-alloc-check.patch deleted file mode 100644 index ee839b5..0000000 --- a/0223-lib-syslinux_parse-Add-missing-alloc-check.patch +++ /dev/null @@ -1,26 +0,0 @@ -From aa64393144f0a805b191bc2c45b84606b03706a0 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:40:42 +0100 -Subject: [PATCH 223/506] lib/syslinux_parse: Add missing alloc check. - -Found by: Coverity scan. ---- - grub-core/lib/syslinux_parse.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 241cefe..2f1f1a5 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -649,6 +649,8 @@ helptext (const char *line, grub_file_t file, struct syslinux_menu *menu) - grub_size_t helplen, alloclen = 0; - - help = grub_strdup (line); -+ if (!help) -+ return grub_errno; - helplen = grub_strlen (line); - while ((grub_free (buf), buf = grub_file_getline (file))) - { --- -2.4.3 - diff --git a/0224-lib-syslinux_parse-Fix-memory-leak.patch b/0224-lib-syslinux_parse-Fix-memory-leak.patch deleted file mode 100644 index a69bde8..0000000 --- a/0224-lib-syslinux_parse-Fix-memory-leak.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ca7c1fd6f377bebf300d0bfcb61253c34fefc861 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:41:24 +0100 -Subject: [PATCH 224/506] lib/syslinux_parse: Fix memory leak. - -Found by: Coveriy scan. ---- - grub-core/lib/syslinux_parse.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 2f1f1a5..1927c4f 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -684,6 +684,7 @@ helptext (const char *line, grub_file_t file, struct syslinux_menu *menu) - } - - grub_free (buf); -+ grub_free (help); - return grub_errno; - } - --- -2.4.3 - diff --git a/0225-lib-syslinux_parse-Add-missing-error-check.patch b/0225-lib-syslinux_parse-Add-missing-error-check.patch deleted file mode 100644 index 918c0f1..0000000 --- a/0225-lib-syslinux_parse-Add-missing-error-check.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 49978c5c4f5a88a8065042133e5d4b7e3c472eaa Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:42:04 +0100 -Subject: [PATCH 225/506] lib/syslinux_parse: Add missing error check. - -Found by: Coverity scan. ---- - grub-core/lib/syslinux_parse.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 1927c4f..f605326 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -846,7 +846,12 @@ write_entry (struct output_buffer *outbuf, - { - grub_err_t err; - if (curentry->comments) -- print (outbuf, curentry->comments, grub_strlen (curentry->comments)); -+ { -+ err = print (outbuf, curentry->comments, -+ grub_strlen (curentry->comments)); -+ if (err) -+ return err; -+ } - { - struct syslinux_say *say; - for (say = curentry->say; say && say->next; say = say->next); --- -2.4.3 - diff --git a/0226-bsd-Add-missing-null-pointer-check.patch b/0226-bsd-Add-missing-null-pointer-check.patch deleted file mode 100644 index 62ab837..0000000 --- a/0226-bsd-Add-missing-null-pointer-check.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1e0d71837124add3adb810ebbb13607dac037635 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:42:42 +0100 -Subject: [PATCH 226/506] bsd: Add missing null-pointer check. - -Found by: Coverity scan. ---- - grub-core/loader/i386/bsd.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 8f691e0..bc377b3 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -234,7 +234,8 @@ grub_bsd_add_meta_ptr (grub_uint32_t type, void **ptr, grub_uint32_t len) - { - struct bsd_tag *p; - for (p = tags; -- p->type != (FREEBSD_MODINFO_METADATA | FREEBSD_MODINFOMD_KERNEND); -+ p && p->type != (FREEBSD_MODINFO_METADATA -+ | FREEBSD_MODINFOMD_KERNEND); - p = p->next); - - if (p) --- -2.4.3 - diff --git a/0227-multiboot-Simplify-to-avoid-confusing-assignment.patch b/0227-multiboot-Simplify-to-avoid-confusing-assignment.patch deleted file mode 100644 index bca85ca..0000000 --- a/0227-multiboot-Simplify-to-avoid-confusing-assignment.patch +++ /dev/null @@ -1,111 +0,0 @@ -From ef02b4ca933fd4c215e169a23b2b069aab712677 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:43:52 +0100 -Subject: [PATCH 227/506] multiboot: Simplify to avoid confusing assignment. - -Found by: Coverity scan. ---- - grub-core/loader/i386/multiboot_mbi.c | 29 +++++++++++++++++++---------- - grub-core/loader/multiboot_mbi2.c | 32 ++++++++++++++++++++------------ - 2 files changed, 39 insertions(+), 22 deletions(-) - -diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c -index f10c087..956d0e3 100644 ---- a/grub-core/loader/i386/multiboot_mbi.c -+++ b/grub-core/loader/i386/multiboot_mbi.c -@@ -121,6 +121,24 @@ load_kernel (grub_file_t file, const char *filename, - return grub_multiboot_load_elf (file, filename, buffer); - } - -+static struct multiboot_header * -+find_header (char *buffer, grub_ssize_t len) -+{ -+ struct multiboot_header *header; -+ -+ /* Look for the multiboot header in the buffer. The header should -+ be at least 12 bytes and aligned on a 4-byte boundary. */ -+ for (header = (struct multiboot_header *) buffer; -+ ((char *) header <= buffer + len - 12); -+ header = (struct multiboot_header *) ((char *) header + MULTIBOOT_HEADER_ALIGN)) -+ { -+ if (header->magic == MULTIBOOT_HEADER_MAGIC -+ && !(header->magic + header->flags + header->checksum)) -+ return header; -+ } -+ return NULL; -+} -+ - grub_err_t - grub_multiboot_load (grub_file_t file, const char *filename) - { -@@ -143,16 +161,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - return grub_errno; - } - -- /* Look for the multiboot header in the buffer. The header should -- be at least 12 bytes and aligned on a 4-byte boundary. */ -- for (header = (struct multiboot_header *) buffer; -- ((char *) header <= buffer + len - 12) || (header = 0); -- header = (struct multiboot_header *) ((char *) header + MULTIBOOT_HEADER_ALIGN)) -- { -- if (header->magic == MULTIBOOT_HEADER_MAGIC -- && !(header->magic + header->flags + header->checksum)) -- break; -- } -+ header = find_header (buffer, len); - - if (header == 0) - { -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index 83e8919..6f74aee 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -79,6 +79,25 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize, - elf_sections = data; - } - -+static struct multiboot_header * -+find_header (grub_properly_aligned_t *buffer, grub_ssize_t len) -+{ -+ struct multiboot_header *header; -+ /* Look for the multiboot header in the buffer. The header should -+ be at least 12 bytes and aligned on a 4-byte boundary. */ -+ for (header = (struct multiboot_header *) buffer; -+ ((char *) header <= (char *) buffer + len - 12); -+ header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4)) -+ { -+ if (header->magic == MULTIBOOT_HEADER_MAGIC -+ && !(header->magic + header->architecture -+ + header->header_length + header->checksum) -+ && header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT) -+ return header; -+ } -+ return NULL; -+} -+ - grub_err_t - grub_multiboot_load (grub_file_t file, const char *filename) - { -@@ -107,18 +126,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - - COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0); - -- /* Look for the multiboot header in the buffer. The header should -- be at least 12 bytes and aligned on a 4-byte boundary. */ -- for (header = (struct multiboot_header *) buffer; -- ((char *) header <= (char *) buffer + len - 12) || (header = 0); -- header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4)) -- { -- if (header->magic == MULTIBOOT_HEADER_MAGIC -- && !(header->magic + header->architecture -- + header->header_length + header->checksum) -- && header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT) -- break; -- } -+ header = find_header (buffer, len); - - if (header == 0) - { --- -2.4.3 - diff --git a/0228-plan9-Add-missing-grub_device_close.patch b/0228-plan9-Add-missing-grub_device_close.patch deleted file mode 100644 index 62be56b..0000000 --- a/0228-plan9-Add-missing-grub_device_close.patch +++ /dev/null @@ -1,55 +0,0 @@ -From e12c3bed90221fad33c4b08ce208745dd65bd782 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:44:33 +0100 -Subject: [PATCH 228/506] plan9: Add missing grub_device_close. - -Found by: Coverity scan. ---- - grub-core/loader/i386/pc/plan9.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/grub-core/loader/i386/pc/plan9.c b/grub-core/loader/i386/pc/plan9.c -index 0d10b1c..814a49d 100644 ---- a/grub-core/loader/i386/pc/plan9.c -+++ b/grub-core/loader/i386/pc/plan9.c -@@ -342,6 +342,7 @@ fill_disk (const char *name, void *data) - if (!plan9name) - { - grub_print_error (); -+ grub_device_close (dev); - return 0; - } - if (grub_extend_alloc (fill_ctx->pmapptr + grub_strlen (plan9name) -@@ -349,6 +350,7 @@ fill_disk (const char *name, void *data) - &fill_ctx->pmap)) - { - grub_free (plan9name); -+ grub_device_close (dev); - return 1; - } - grub_strcpy (fill_ctx->pmap + fill_ctx->pmapptr, plan9name); -@@ -366,12 +368,19 @@ fill_disk (const char *name, void *data) - fill_ctx->noslash = 1; - grub_memset (fill_ctx->prefixescnt, 0, sizeof (fill_ctx->prefixescnt)); - if (grub_partition_iterate (dev->disk, fill_partition, fill_ctx)) -- return 1; -+ { -+ grub_device_close (dev); -+ return 1; -+ } - if (grub_extend_alloc (fill_ctx->pmapptr + 1, &fill_ctx->pmapalloc, - &fill_ctx->pmap)) -- return 1; -+ { -+ grub_device_close (dev); -+ return 1; -+ } - fill_ctx->pmap[fill_ctx->pmapptr++] = '\n'; - -+ grub_device_close (dev); - return 0; - } - --- -2.4.3 - diff --git a/0229-xnu-Add-missing-error-check.patch b/0229-xnu-Add-missing-error-check.patch deleted file mode 100644 index 04526d8..0000000 --- a/0229-xnu-Add-missing-error-check.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a05a6e6f92335236dc12339c73144ef8d03f07e8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:44:57 +0100 -Subject: [PATCH 229/506] xnu: Add missing error check. - -Found by: Coveriy scan. ---- - grub-core/loader/xnu.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index cdd9715..bc89cdf 100644 ---- a/grub-core/loader/xnu.c -+++ b/grub-core/loader/xnu.c -@@ -1378,6 +1378,8 @@ grub_xnu_fill_devicetree (void) - name[len] = 0; - - curvalue = grub_xnu_create_value (curkey, name); -+ if (!curvalue) -+ return grub_errno; - grub_free (name); - - data = grub_malloc (grub_strlen (var->value) + 1); --- -2.4.3 - diff --git a/0230-normal-main-Fix-error-handling.patch b/0230-normal-main-Fix-error-handling.patch deleted file mode 100644 index a9ba3b7..0000000 --- a/0230-normal-main-Fix-error-handling.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 73b1e8383906910e9da82fb3c79c590e450d598f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:48:46 +0100 -Subject: [PATCH 230/506] normal/main: Fix error handling. - -Found by: Coverity scan. ---- - grub-core/normal/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c41f175..623b93b 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -130,7 +130,7 @@ read_config_file (const char *config) - file = grub_bufio_open (rawfile, 0); - if (! file) - { -- grub_file_close (file); -+ grub_file_close (rawfile); - return 0; - } - --- -2.4.3 - diff --git a/0231-normal-misc-Close-device-on-all-pathes.patch b/0231-normal-misc-Close-device-on-all-pathes.patch deleted file mode 100644 index c4f2482..0000000 --- a/0231-normal-misc-Close-device-on-all-pathes.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6603c22f3125185077d9e6431e1004aff83a473c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:49:32 +0100 -Subject: [PATCH 231/506] normal/misc: Close device on all pathes. - -Found by: Coverity scan. ---- - grub-core/normal/misc.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c -index 34d505e..38f91b9 100644 ---- a/grub-core/normal/misc.c -+++ b/grub-core/normal/misc.c -@@ -184,10 +184,11 @@ grub_normal_print_device_info (const char *name) - /* TRANSLATORS: Replace dot with appropriate decimal separator for - your language. */ - (grub_disk_get_size (dev->disk) & 1) ? _(".5") : ""); -- -- grub_device_close (dev); - } - -+ if (dev) -+ grub_device_close (dev); -+ - grub_xputs ("\n"); - return grub_errno; - } --- -2.4.3 - diff --git a/0232-devmapper-getroot-Fix-memory-leak.patch b/0232-devmapper-getroot-Fix-memory-leak.patch deleted file mode 100644 index 51be1ec..0000000 --- a/0232-devmapper-getroot-Fix-memory-leak.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c14dff3ca722cc139cd9c44261aa99882d8a8ca3 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:50:27 +0100 -Subject: [PATCH 232/506] devmapper/getroot: Fix memory leak. - -Found by: Coverity scan. ---- - grub-core/osdep/devmapper/getroot.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c -index d02386b..0a77a04 100644 ---- a/grub-core/osdep/devmapper/getroot.c -+++ b/grub-core/osdep/devmapper/getroot.c -@@ -160,7 +160,10 @@ grub_util_pull_devmapper (const char *os_dev) - uuid = get_dm_uuid (os_dev); - - if (!grub_util_open_dm (os_dev, &tree, &node)) -- return; -+ { -+ grub_free (uuid); -+ return; -+ } - - while ((child = dm_tree_next_child (&handle, node, 0))) - { -@@ -192,6 +195,7 @@ grub_util_pull_devmapper (const char *os_dev) - } - else - dm_tree_free (tree); -+ grub_free (uuid); - } - - char * -@@ -253,6 +257,7 @@ grub_util_get_devmapper_grub_dev (const char *os_dev) - grub_free (uuid); - return grub_dev; - } -+ grub_free (uuid); - return NULL; - } - -@@ -279,6 +284,7 @@ grub_util_get_vg_uuid (const char *os_dev) - } - optr--; - *optr = '\0'; -+ grub_free (uuid); - return vgid; - } - --- -2.4.3 - diff --git a/0233-linux-blocklist-Fix-memory-leak.patch b/0233-linux-blocklist-Fix-memory-leak.patch deleted file mode 100644 index 57418e0..0000000 --- a/0233-linux-blocklist-Fix-memory-leak.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5adc6d76d3c82ed7d85fc7aaa341743f5378314c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:50:58 +0100 -Subject: [PATCH 233/506] linux/blocklist: Fix memory leak. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/blocklist.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index 10ddd11..c77d608 100644 ---- a/grub-core/osdep/linux/blocklist.c -+++ b/grub-core/osdep/linux/blocklist.c -@@ -130,6 +130,7 @@ grub_install_get_blocklist (grub_device_t root_dev, - & (GRUB_DISK_SECTOR_SIZE - 1), - fie2->fm_extents[i].fe_length, hook_data); - } -+ free (fie2); - } - close (fd); - } --- -2.4.3 - diff --git a/0234-linux-getroot-Fix-error-handling.patch b/0234-linux-getroot-Fix-error-handling.patch deleted file mode 100644 index 2780e62..0000000 --- a/0234-linux-getroot-Fix-error-handling.patch +++ /dev/null @@ -1,97 +0,0 @@ -From cba5a85a67f879b6431833e87ceb93d44b8ac48a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:51:48 +0100 -Subject: [PATCH 234/506] linux/getroot: Fix error handling. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/getroot.c | 24 +++++++++++++++--------- - 1 file changed, 15 insertions(+), 9 deletions(-) - -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 7007193..f48b81a 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -226,7 +226,7 @@ grub_find_root_devices_from_btrfs (const char *dir) - char **ret; - - fd = open (dir, 0); -- if (!fd) -+ if (fd < 0) - return NULL; - - if (ioctl (fd, BTRFS_IOC_FS_INFO, &fsi) < 0) -@@ -274,11 +274,11 @@ get_btrfs_fs_prefix (const char *mount_path) - args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; - - if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) -- return NULL; -+ goto fail; - tree_id = args.treeid; - - if (fstat (fd, &st) < 0) -- return NULL; -+ goto fail; - inode_id = st.st_ino; - - while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID -@@ -309,11 +309,11 @@ get_btrfs_fs_prefix (const char *mount_path) - sargs.key.nr_items = 1; - - if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) -- return NULL; -+ goto fail; - - if (sargs.key.nr_items == 0) -- return NULL; -- -+ goto fail; -+ - tree_id = sargs.buf[2]; - br = (struct grub_btrfs_root_backref *) (sargs.buf + 4); - inode_id = br->inode_id; -@@ -336,10 +336,10 @@ get_btrfs_fs_prefix (const char *mount_path) - sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_INODE_REF; - - if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) -- return NULL; -+ goto fail; - - if (sargs.key.nr_items == 0) -- return NULL; -+ goto fail; - - inode_id = sargs.buf[2]; - -@@ -362,6 +362,10 @@ get_btrfs_fs_prefix (const char *mount_path) - if (!ret) - return xstrdup ("/"); - return ret; -+ fail: -+ free (ret); -+ close (fd); -+ return NULL; - } - - -@@ -688,7 +692,7 @@ char * - grub_util_part_to_disk (const char *os_dev, struct stat *st, - int *is_part) - { -- char *path = xmalloc (PATH_MAX); -+ char *path; - - if (! S_ISBLK (st->st_mode)) - { -@@ -696,6 +700,8 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, - return xstrdup (os_dev); - } - -+ path = xmalloc (PATH_MAX); -+ - if (! realpath (os_dev, path)) - return NULL; - --- -2.4.3 - diff --git a/0235-unix-password-Fix-file-descriptor-leak.patch b/0235-unix-password-Fix-file-descriptor-leak.patch deleted file mode 100644 index 868bec7..0000000 --- a/0235-unix-password-Fix-file-descriptor-leak.patch +++ /dev/null @@ -1,37 +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 235/506] unix/password: Fix file descriptor leak. - -Found by: Coverity scan. ---- - grub-core/osdep/unix/password.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/unix/password.c b/grub-core/osdep/unix/password.c -index 470a6ea..4b9507b 100644 ---- a/grub-core/osdep/unix/password.c -+++ b/grub-core/osdep/unix/password.c -@@ -53,7 +53,10 @@ grub_password_get (char buf[], unsigned buf_size) - 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_password_get (char buf[], unsigned buf_size) - grub_xputs ("\n"); - grub_refresh (); - -+ fclose (in); -+ - return 1; - } --- -2.4.3 - diff --git a/0236-vbe-Fix-incorrect-register-usage.patch b/0236-vbe-Fix-incorrect-register-usage.patch deleted file mode 100644 index 8affde3..0000000 --- a/0236-vbe-Fix-incorrect-register-usage.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c4fcfd8744f320635949d62ec0df4ea60ebe60e8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:53:39 +0100 -Subject: [PATCH 236/506] vbe: Fix incorrect register usage. - -Found by: Coverity scan. ---- - grub-core/video/i386/pc/vbe.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c -index 62b5c22..07a614a 100644 ---- a/grub-core/video/i386/pc/vbe.c -+++ b/grub-core/video/i386/pc/vbe.c -@@ -304,8 +304,7 @@ grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size) - struct grub_bios_int_registers regs; - - regs.eax = 0x4f08; -- regs.ebx = (*dac_mask_size & 0xff) >> 8; -- regs.ebx = set ? 1 : 0; -+ regs.ebx = ((*dac_mask_size & 0xff) << 8) | (set ? 1 : 0); - regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; - grub_bios_interrupt (0x10, ®s); - *dac_mask_size = (regs.ebx >> 8) & 0xff; --- -2.4.3 - diff --git a/0237-util-getroot-Add-missing-grub_disk_close.patch b/0237-util-getroot-Add-missing-grub_disk_close.patch deleted file mode 100644 index 4a08fd6..0000000 --- a/0237-util-getroot-Add-missing-grub_disk_close.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 866f469683a1cc99bb3adeee5b3eb07ec18a000c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:54:14 +0100 -Subject: [PATCH 237/506] util/getroot: Add missing grub_disk_close. - -Found by: Coverity scan. ---- - util/getroot.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/util/getroot.c b/util/getroot.c -index 3958105..345d49b 100644 ---- a/util/getroot.c -+++ b/util/getroot.c -@@ -417,7 +417,10 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) - - name = grub_util_get_ldm (disk, ctx.start); - if (name) -- return name; -+ { -+ grub_disk_close (disk); -+ return name; -+ } - - ctx.partname = NULL; - --- -2.4.3 - diff --git a/0238-grub-install-common-Fix-sizeof-usage.patch b/0238-grub-install-common-Fix-sizeof-usage.patch deleted file mode 100644 index c641db7..0000000 --- a/0238-grub-install-common-Fix-sizeof-usage.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c3f52305976ffcdee679df4229b65d5f71a53023 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:54:50 +0100 -Subject: [PATCH 238/506] grub-install-common: Fix sizeof usage. - -Found by: Coverity scan. ---- - util/grub-install-common.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index b6dec93..a465699 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -238,7 +238,7 @@ grub_install_push_module (const char *val) - if (modules.n_alloc < 16) - modules.n_alloc = 16; - modules.entries = xrealloc (modules.entries, -- modules.n_alloc * sizeof (modules.entries)); -+ modules.n_alloc * sizeof (*modules.entries)); - } - modules.entries[modules.n_entries++] = xstrdup (val); - modules.entries[modules.n_entries] = NULL; --- -2.4.3 - diff --git a/0239-grub-install-Fix-memory-leak.patch b/0239-grub-install-Fix-memory-leak.patch deleted file mode 100644 index e644dd7..0000000 --- a/0239-grub-install-Fix-memory-leak.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 3c6384832bb304078fcafc537195827710f9f6bf Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:55:30 +0100 -Subject: [PATCH 239/506] grub-install: Fix memory leak. - -Found by: Coverity scan. ---- - util/grub-install.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/util/grub-install.c b/util/grub-install.c -index 7d61c32..afbc557 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -622,7 +622,10 @@ device_map_check_duplicates (const char *dev_map) - - fp = grub_util_fopen (dev_map, "r"); - if (! fp) -- return; -+ { -+ free (d); -+ return; -+ } - - while (fgets (buf, sizeof (buf), fp)) - { --- -2.4.3 - diff --git a/0240-grub-macbless-Fix-resource-leak.patch b/0240-grub-macbless-Fix-resource-leak.patch deleted file mode 100644 index c3a94c2..0000000 --- a/0240-grub-macbless-Fix-resource-leak.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5d61a6a6120954380a46a3c1a46a01fdf763e037 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:55:58 +0100 -Subject: [PATCH 240/506] grub-macbless: Fix resource leak. - -Found by: Coverity scan. ---- - util/grub-macbless.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/util/grub-macbless.c b/util/grub-macbless.c -index 742353a..e57e13d 100644 ---- a/util/grub-macbless.c -+++ b/util/grub-macbless.c -@@ -92,6 +92,8 @@ bless (const char *path, int x86) - free (filebuf_via_grub); - free (filebuf_via_sys); - free (drive_name); -+ free (devices); -+ grub_device_close (dev); - } - - static struct argp_option options[] = { --- -2.4.3 - diff --git a/0241-util-misc.c-Check-ftello-return-value.patch b/0241-util-misc.c-Check-ftello-return-value.patch deleted file mode 100644 index 5b7dc3d..0000000 --- a/0241-util-misc.c-Check-ftello-return-value.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 11eed6abce6626edecdbc81876bc7f5b91458c0b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 26 Jan 2015 09:56:24 +0100 -Subject: [PATCH 241/506] util/misc.c: Check ftello return value. - -Found by: Coverity scan. ---- - util/misc.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/util/misc.c b/util/misc.c -index b0e023e..b8ec691 100644 ---- a/util/misc.c -+++ b/util/misc.c -@@ -89,6 +89,8 @@ grub_util_get_image_size (const char *path) - fseeko (f, 0, SEEK_END); - - sz = ftello (f); -+ if (sz < 0) -+ grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); - if (sz != (size_t) sz) - grub_util_error (_("file `%s' is too big"), path); - ret = (size_t) sz; --- -2.4.3 - diff --git a/0242-linux-getroot-fix-descriptor-leak.patch b/0242-linux-getroot-fix-descriptor-leak.patch deleted file mode 100644 index 7306c0b..0000000 --- a/0242-linux-getroot-fix-descriptor-leak.patch +++ /dev/null @@ -1,29 +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 242/506] linux/getroot: fix descriptor leak. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/getroot.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index f48b81a..a2e360f 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -360,8 +360,10 @@ get_btrfs_fs_prefix (const char *mount_path) - ret[1+namelen] = '\0'; - } - if (!ret) -- return xstrdup ("/"); -+ ret = xstrdup ("/"); -+ close (fd); - return ret; -+ - fail: - free (ret); - close (fd); --- -2.4.3 - diff --git a/0243-linux-ofpath-fix-various-memory-leaks.patch b/0243-linux-ofpath-fix-various-memory-leaks.patch deleted file mode 100644 index 0d0d3cf..0000000 --- a/0243-linux-ofpath-fix-various-memory-leaks.patch +++ /dev/null @@ -1,53 +0,0 @@ -From e2a21238da913dd834b6b656170eb295c589e65d Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 21:41:29 +0300 -Subject: [PATCH 243/506] linux/ofpath: fix various memory leaks. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/ofpath.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 8f24bc9..4cc171c 100644 ---- a/grub-core/osdep/linux/ofpath.c -+++ b/grub-core/osdep/linux/ofpath.c -@@ -128,6 +128,8 @@ find_obppath (const char *sysfs_path_orig) - - if (fd < 0 || fstat (fd, &st) < 0) - { -+ if (fd >= 0) -+ close (fd); - kill_trailing_dir(sysfs_path); - if (!strcmp(sysfs_path, "/sys")) - { -@@ -147,6 +149,9 @@ find_obppath (const char *sysfs_path_orig) - { - grub_util_info (_("cannot read `%s': %s"), path, strerror (errno)); - close(fd); -+ free (path); -+ free (of_path); -+ free (sysfs_path); - return NULL; - } - close(fd); -@@ -480,6 +485,7 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev - snprintf(disk, sizeof (disk), - "/sas/%s@%lx,%lu:%c", disk_name, sas_address, longlun, 'a' + (part - 1)); - } -+ free (lunstr); - } - } - strcat(of_path, disk); -@@ -530,7 +536,7 @@ grub_util_devname_to_ofpath (const char *sys_devname) - else - { - grub_util_warn (_("unknown device type %s\n"), device); -- return NULL; -+ ofpath = NULL; - } - - free (devnode); --- -2.4.3 - diff --git a/0244-util-setup-fix-memory-leak.patch b/0244-util-setup-fix-memory-leak.patch deleted file mode 100644 index da66601..0000000 --- a/0244-util-setup-fix-memory-leak.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 64440daa21e150337ee285674eca3dd84de20958 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 21:07:19 +0300 -Subject: [PATCH 244/506] util/setup: fix memory leak. - -Found by: Coverity scan. ---- - util/setup.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/util/setup.c b/util/setup.c -index 9fb91a8..ed4bd11 100644 ---- a/util/setup.c -+++ b/util/setup.c -@@ -322,7 +322,10 @@ SETUP (const char *dir, - continue; - try_dev = grub_device_open (drive); - if (! try_dev) -- continue; -+ { -+ free (drive); -+ continue; -+ } - if (!found && try_dev->disk->id == dest_dev->disk->id - && try_dev->disk->dev->id == dest_dev->disk->dev->id) - { --- -2.4.3 - diff --git a/0245-util-install-fix-memory-leak.patch b/0245-util-install-fix-memory-leak.patch deleted file mode 100644 index 2b3fb36..0000000 --- a/0245-util-install-fix-memory-leak.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5e27fb06f22eda7d7ffd86d16c27262aaf59e132 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 21:11:32 +0300 -Subject: [PATCH 245/506] util/install: fix memory leak. - -Found by: Coverity scan. ---- - util/grub-install-common.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a465699..37c1a98 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -490,6 +490,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - dir, prefix, - outname, mkimage_target, - compnames[compression], note ? "--note" : "", s); -+ free (s); - - tgt = grub_install_get_image_target (mkimage_target); - if (!tgt) --- -2.4.3 - diff --git a/0246-linux-getroot-fix-memory-leak.patch b/0246-linux-getroot-fix-memory-leak.patch deleted file mode 100644 index 37d82bd..0000000 --- a/0246-linux-getroot-fix-memory-leak.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e61f4eba1850c1c6576c0977fc1a305ad02ab0ce Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:08:13 +0300 -Subject: [PATCH 246/506] linux/getroot: fix memory leak. - -Found by: Coverity scan. ---- - grub-core/osdep/unix/getroot.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index e3887cb..10fb56a 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -621,7 +621,10 @@ grub_util_pull_lvm_by_command (const char *os_dev) - free (vgname); - - if (!pid) -- return; -+ { -+ free (vgid); -+ return; -+ } - - /* Parent. Read vgs' output. */ - vgs = fdopen (fd, "r"); -@@ -653,6 +656,7 @@ out: - close (fd); - waitpid (pid, NULL, 0); - free (buf); -+ free (vgid); - } - - /* ZFS has similar problems to those of btrfs (see above). */ --- -2.4.3 - diff --git a/0247-util-grub-install-rearrange-code-to-avoid-memory-lea.patch b/0247-util-grub-install-rearrange-code-to-avoid-memory-lea.patch deleted file mode 100644 index b81db35..0000000 --- a/0247-util-grub-install-rearrange-code-to-avoid-memory-lea.patch +++ /dev/null @@ -1,39 +0,0 @@ -From be0743b052d76c27cc704d94cfd38cc54e7e02b3 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:17:31 +0300 -Subject: [PATCH 247/506] util/grub-install: rearrange code to avoid memory - leak. - -Found by: Coverity scan. ---- - util/grub-install.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/util/grub-install.c b/util/grub-install.c -index afbc557..210f4a7 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -615,17 +615,14 @@ device_map_check_duplicates (const char *dev_map) - char **d; - size_t i; - -- d = xmalloc (alloced * sizeof (d[0])); -- - if (dev_map[0] == '\0') - return; - - fp = grub_util_fopen (dev_map, "r"); - if (! fp) -- { -- free (d); -- return; -- } -+ return; -+ -+ d = xmalloc (alloced * sizeof (d[0])); - - while (fgets (buf, sizeof (buf), fp)) - { --- -2.4.3 - diff --git a/0248-util-grub-mkstandalone-fix-memory-leak.patch b/0248-util-grub-mkstandalone-fix-memory-leak.patch deleted file mode 100644 index e9a7331..0000000 --- a/0248-util-grub-mkstandalone-fix-memory-leak.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bd4e20eedfaa3079a2efcb13559e916772365ee1 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:20:51 +0300 -Subject: [PATCH 248/506] util/grub-mkstandalone: fix memory leak. - -Found by: Coverity scan. ---- - util/grub-mkstandalone.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c -index 6017d71..4907d44 100644 ---- a/util/grub-mkstandalone.c -+++ b/util/grub-mkstandalone.c -@@ -284,6 +284,7 @@ add_tar_file (const char *from, - grub_util_fd_close (in); - - write_pad (size); -+ free (tcn); - } - - int --- -2.4.3 - diff --git a/0249-util-grub-mount-fix-descriptor-leak.patch b/0249-util-grub-mount-fix-descriptor-leak.patch deleted file mode 100644 index cc1caaf..0000000 --- a/0249-util-grub-mount-fix-descriptor-leak.patch +++ /dev/null @@ -1,25 +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 249/506] util/grub-mount: fix descriptor leak. - -Found by: Coverity scan. ---- - util/grub-mount.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/util/grub-mount.c b/util/grub-mount.c -index 19de2e6..4626e54 100644 ---- a/util/grub-mount.c -+++ b/util/grub-mount.c -@@ -516,6 +516,7 @@ argp_parser (int key, char *arg, struct argp_state *state) - return 0; - } - grub_zfs_add_key (buf, real_size, 0); -+ fclose (f); - } - return 0; - --- -2.4.3 - diff --git a/0250-util-mkimage-fix-memory-leaks.patch b/0250-util-mkimage-fix-memory-leaks.patch deleted file mode 100644 index 130760a..0000000 --- a/0250-util-mkimage-fix-memory-leaks.patch +++ /dev/null @@ -1,35 +0,0 @@ -From fe4efe0d50482b433b46de677546f796de46d5ae Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:39:08 +0300 -Subject: [PATCH 250/506] util/mkimage: fix memory leaks. - -Found by: Coverity scan. ---- - util/mkimage.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/util/mkimage.c b/util/mkimage.c -index e6b799f..bccd703 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -1278,6 +1278,8 @@ grub_install_generate_image (const char *dir, const char *prefix, - free (core_img); - core_img = full_img; - core_size = full_size; -+ free (decompress_img); -+ free (decompress_path); - } - - switch (image_target->id) -@@ -1744,6 +1746,8 @@ grub_install_generate_image (const char *dir, const char *prefix, - free (core_img); - core_img = rom_img; - core_size = rom_size; -+ free (boot_img); -+ free (boot_path); - } - break; - case IMAGE_QEMU_MIPS_FLASH: --- -2.4.3 - diff --git a/0251-util-setup-fix-memory-leak.patch b/0251-util-setup-fix-memory-leak.patch deleted file mode 100644 index 167f891..0000000 --- a/0251-util-setup-fix-memory-leak.patch +++ /dev/null @@ -1,36 +0,0 @@ -From bd196014ec4eed6b4671cac4f4cb73621b219afa Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 26 Jan 2015 22:44:45 +0300 -Subject: [PATCH 251/506] util/setup: fix memory leak. - -Found by: Coverity scan. ---- - util/setup.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/util/setup.c b/util/setup.c -index ed4bd11..b299159 100644 ---- a/util/setup.c -+++ b/util/setup.c -@@ -670,15 +670,17 @@ unable_to_embed: - if (dest_dev->disk->id != root_dev->disk->id - || dest_dev->disk->dev->id != root_dev->disk->dev->id) - { -- const char *dest_ofpath; -+ char *dest_ofpath; - dest_ofpath - = grub_util_devname_to_ofpath (grub_util_biosdisk_get_osdev (root_dev->disk)); -+ /* FIXME handle NULL result */ - grub_util_info ("dest_ofpath is `%s'", dest_ofpath); - strncpy (boot_devpath, dest_ofpath, - GRUB_BOOT_MACHINE_BOOT_DEVPATH_END - - GRUB_BOOT_MACHINE_BOOT_DEVPATH - 1); - boot_devpath[GRUB_BOOT_MACHINE_BOOT_DEVPATH_END - - GRUB_BOOT_MACHINE_BOOT_DEVPATH - 1] = 0; -+ free (dest_ofpath); - } - else - { --- -2.4.3 - diff --git a/0252-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch b/0252-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch deleted file mode 100644 index 616285b..0000000 --- a/0252-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 4192f2e3d1779b71f53580a59f280af1bfda1f3b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 10:20:54 +0100 -Subject: [PATCH 252/506] commands/acpi: Use ALIGN_UP rather than manual - expression. - -Improves readability and hopefully automatic scanning. - -Found by: Coverity Scan. ---- - grub-core/commands/acpi.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c -index f66fa2d..5507ffa 100644 ---- a/grub-core/commands/acpi.c -+++ b/grub-core/commands/acpi.c -@@ -265,7 +265,7 @@ grub_acpi_create_ebda (void) - grub_memcpy (target, v2, v2->length); - v2inebda = target; - target += v2->length; -- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); -+ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); - v2 = 0; - break; - } -@@ -282,7 +282,7 @@ grub_acpi_create_ebda (void) - grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10)); - v1inebda = target; - target += sizeof (struct grub_acpi_rsdp_v10); -- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); -+ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); - v1 = 0; - break; - } --- -2.4.3 - diff --git a/0253-fs-cbfs-cpio-Remove-useless-check-if-mode-is-NULL.patch b/0253-fs-cbfs-cpio-Remove-useless-check-if-mode-is-NULL.patch deleted file mode 100644 index f16616f..0000000 --- a/0253-fs-cbfs-cpio-Remove-useless-check-if-mode-is-NULL.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 69a52e95d425502945fe43892cebf6b183290e6e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 10:30:43 +0100 -Subject: [PATCH 253/506] fs/{cbfs,cpio}: Remove useless check if mode is NULL. - -Callers already ensure that it's not null. - -Found by: Coverity Scan. ---- - grub-core/fs/cbfs.c | 3 +-- - grub-core/fs/cpio_common.c | 3 +-- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c -index 4ddd683..a34eb88 100644 ---- a/grub-core/fs/cbfs.c -+++ b/grub-core/fs/cbfs.c -@@ -74,8 +74,7 @@ grub_cbfs_find_file (struct grub_archelp_data *data, char **name, - (void) mtime; - offset = grub_be_to_cpu32 (hd.offset); - -- if (mode) -- *mode = GRUB_ARCHELP_ATTR_FILE | GRUB_ARCHELP_ATTR_NOTIME; -+ *mode = GRUB_ARCHELP_ATTR_FILE | GRUB_ARCHELP_ATTR_NOTIME; - - namesize = offset; - if (namesize >= sizeof (hd)) -diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c -index 20230a7..50fea47 100644 ---- a/grub-core/fs/cpio_common.c -+++ b/grub-core/fs/cpio_common.c -@@ -69,8 +69,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, - return GRUB_ERR_NONE; - } - -- if (mode) -- *mode = modeval; -+ *mode = modeval; - - *name = grub_malloc (namesize + 1); - if (*name == NULL) --- -2.4.3 - diff --git a/0254-fs-zfs-Fix-error-handling.patch b/0254-fs-zfs-Fix-error-handling.patch deleted file mode 100644 index c9eaab7..0000000 --- a/0254-fs-zfs-Fix-error-handling.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0daf46fdbd37627411f3a0dd99390ee4523de1bb Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 16:31:35 +0100 -Subject: [PATCH 254/506] fs/zfs: Fix error handling. - -Found by: Coverity Scan. ---- - grub-core/fs/zfs/zfs.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index c8c7b97..9edac50 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -285,7 +285,7 @@ static const char *spa_feature_names[] = { - - static int - check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx); --static int -+static grub_err_t - check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ); - - static grub_err_t -@@ -1975,7 +1975,7 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, - dn->endian) - << SPA_MINBLOCKSHIFT; - *buf = grub_malloc (size); -- if (*buf) -+ if (!*buf) - { - err = grub_errno; - break; -@@ -3979,7 +3979,12 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) - dnode_end_t dn; - grub_memset (&info, 0, sizeof (info)); - -- dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data); -+ err = dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data); -+ if (err) -+ { -+ grub_print_error (); -+ return 0; -+ } - - if (dn.dn.dn_bonustype == DMU_OT_SA) - { -@@ -4200,11 +4205,11 @@ check_feature (const char *name, grub_uint64_t val, - * errnum: Failure. - */ - --static int -+static grub_err_t - check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ) - { - grub_uint64_t objnum; -- grub_uint8_t errnum = 0; -+ grub_err_t errnum = 0; - dnode_end_t dn,mosmdn; - mzap_phys_t* mzp; - grub_zfs_endian_t endianzap; --- -2.4.3 - diff --git a/0255-fs-zfscrypt-Add-missing-explicit-cast.patch b/0255-fs-zfscrypt-Add-missing-explicit-cast.patch deleted file mode 100644 index eeed2d2..0000000 --- a/0255-fs-zfscrypt-Add-missing-explicit-cast.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 916733ea6ae90c56797d39bb41b72427da3e1e4f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 16:35:37 +0100 -Subject: [PATCH 255/506] fs/zfscrypt: Add missing explicit cast. - -Found by: Coverity scan. ---- - grub-core/fs/zfs/zfscrypt.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c -index 88dae72..91a0af6 100644 ---- a/grub-core/fs/zfs/zfscrypt.c -+++ b/grub-core/fs/zfs/zfscrypt.c -@@ -238,7 +238,7 @@ grub_gcm_decrypt (grub_crypto_cipher_handle_t cipher, - grub_crypto_xor (out + 16 * i, in + 16 * i, mul, csize); - } - for (j = 0; j < 8; j++) -- mac[15 - j] ^= ((psize * 8) >> (8 * j)); -+ mac[15 - j] ^= ((((grub_uint64_t) psize) * 8) >> (8 * j)); - grub_gcm_mul (mac, h); - - if (mac_out) --- -2.4.3 - diff --git a/0256-linux-hostdisk-Limit-strcpy-size-to-buffer-size.patch b/0256-linux-hostdisk-Limit-strcpy-size-to-buffer-size.patch deleted file mode 100644 index c1186bd..0000000 --- a/0256-linux-hostdisk-Limit-strcpy-size-to-buffer-size.patch +++ /dev/null @@ -1,35 +0,0 @@ -From c2fc41990a77923c44a71d616561920ae186db56 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 16:48:53 +0100 -Subject: [PATCH 256/506] linux/hostdisk: Limit strcpy size to buffer size. - -Found by: Coverity scan. ---- - grub-core/osdep/linux/hostdisk.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index c96427a..75cb8f5 100644 ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -376,7 +376,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f - - part_start = grub_partition_get_start (disk->partition); - -- strcpy (dev, grub_util_biosdisk_get_osdev (disk)); -+ strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev)); - if (disk->partition - && strncmp (dev, "/dev/", 5) == 0) - { -@@ -439,7 +439,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f - if (*max == 0) - *max = ~0ULL; - is_partition = 0; -- strcpy (dev, grub_util_biosdisk_get_osdev (disk)); -+ strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev)); - goto reopen; - } - sector -= part_start; --- -2.4.3 - diff --git a/0257-linux-ofpath-Fix-error-handling.patch b/0257-linux-ofpath-Fix-error-handling.patch deleted file mode 100644 index 3b7a39e..0000000 --- a/0257-linux-ofpath-Fix-error-handling.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 8f95eae423fc7220af3c1f6150ac35e98281bb96 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 16:49:49 +0100 -Subject: [PATCH 257/506] linux/ofpath: Fix error handling. - -Found by: Coverity Scan. ---- - grub-core/osdep/linux/ofpath.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 4cc171c..f716fd2 100644 ---- a/grub-core/osdep/linux/ofpath.c -+++ b/grub-core/osdep/linux/ofpath.c -@@ -334,7 +334,7 @@ vendor_is_ATA(const char *path) - } - - static void --check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address) -+check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address) - { - char *ed = strstr (sysfs_path, "end_device"); - char *p, *q, *path; -@@ -346,8 +346,10 @@ check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address) - return; - - /* SAS devices are identified using disk@$PHY_ID */ -- p = strdup (sysfs_path); -+ p = xstrdup (sysfs_path); - ed = strstr(p, "end_device"); -+ if (!ed) -+ return; - - q = ed; - while (*q && *q != '/') --- -2.4.3 - diff --git a/0258-Document-intentional-fallthroughs.patch b/0258-Document-intentional-fallthroughs.patch deleted file mode 100644 index 4b85a9e..0000000 --- a/0258-Document-intentional-fallthroughs.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 9ee5ae1fae1d7e19f76d4758d9658af90018b0f9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 27 Jan 2015 17:17:58 +0100 -Subject: [PATCH 258/506] Document intentional fallthroughs. - -Found by: Coverity scan. ---- - grub-core/disk/diskfilter.c | 3 +++ - grub-core/font/font.c | 3 ++- - grub-core/fs/udf.c | 1 + - grub-core/lib/legacy_parse.c | 1 + - grub-core/loader/i386/pc/linux.c | 3 +++ - grub-core/normal/charset.c | 1 + - grub-core/video/bochs.c | 1 + - grub-core/video/cirrus.c | 1 + - grub-core/video/i386/pc/vbe.c | 2 ++ - util/getroot.c | 1 + - util/grub-install.c | 2 +- - 11 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 6124846..80966ac 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -71,10 +71,12 @@ is_lv_readable (struct grub_diskfilter_lv *lv, int easily) - case GRUB_DISKFILTER_RAID6: - if (!easily) - need--; -+ /* Fallthrough. */ - case GRUB_DISKFILTER_RAID4: - case GRUB_DISKFILTER_RAID5: - if (!easily) - need--; -+ /* Fallthrough. */ - case GRUB_DISKFILTER_STRIPED: - break; - -@@ -584,6 +586,7 @@ read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector, - if (seg->node_count == 1) - return grub_diskfilter_read_node (&seg->nodes[0], - sector, size, buf); -+ /* Fallthrough. */ - case GRUB_DISKFILTER_MIRROR: - case GRUB_DISKFILTER_RAID10: - { -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 607964b..53d76a6 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1286,7 +1286,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - - grub_font_get_xheight (combining_glyphs[i]->font) - 1; - if (space <= 0) - space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; -- -+ /* Fallthrough. */ - case GRUB_UNICODE_STACK_ATTACHED_ABOVE: - do_blit (combining_glyphs[i], targetx, - -(ctx.bounds.height + ctx.bounds.y + space -@@ -1327,6 +1327,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - + combining_glyphs[i]->height); - if (space <= 0) - space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; -+ /* Fallthrough. */ - - case GRUB_UNICODE_STACK_ATTACHED_BELOW: - do_blit (combining_glyphs[i], targetx, -(ctx.bounds.y - space), -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index fd41283..839bff8 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -986,6 +986,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - case 1: - if (ptr[1]) - goto fail; -+ /* Fallthrough. */ - case 2: - /* in 4 bytes. out: 1 byte. */ - optr = out; -diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c -index 61266d9..ef56150 100644 ---- a/grub-core/lib/legacy_parse.c -+++ b/grub-core/lib/legacy_parse.c -@@ -664,6 +664,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix) - { - case TYPE_FILE_NO_CONSUME: - hold_arg = 1; -+ /* Fallthrough. */ - case TYPE_PARTITION: - case TYPE_FILE: - args[i] = adjust_file (curarg, curarglen); -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 870992b..a293b17 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -280,10 +280,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - { - case 'g': - shift += 10; -+ /* Fallthrough. */ - case 'm': - shift += 10; -+ /* Fallthrough. */ - case 'k': - shift += 10; -+ /* Fallthrough. */ - default: - break; - } -diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c -index 3e4c337..eeb7ec1 100644 ---- a/grub-core/normal/charset.c -+++ b/grub-core/normal/charset.c -@@ -929,6 +929,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, - case GRUB_BIDI_TYPE_R: - case GRUB_BIDI_TYPE_AL: - bidi_needed = 1; -+ /* Fallthrough. */ - default: - { - if (join_state == JOIN_FORCE) -diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c -index 9098f90..3bcfa53 100644 ---- a/grub-core/video/bochs.c -+++ b/grub-core/video/bochs.c -@@ -359,6 +359,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height, - case 32: - framebuffer.mode_info.reserved_mask_size = 8; - framebuffer.mode_info.reserved_field_pos = 24; -+ /* Fallthrough. */ - - case 24: - framebuffer.mode_info.red_mask_size = 8; -diff --git a/grub-core/video/cirrus.c b/grub-core/video/cirrus.c -index 4913084..e2149e8 100644 ---- a/grub-core/video/cirrus.c -+++ b/grub-core/video/cirrus.c -@@ -440,6 +440,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, - case 32: - framebuffer.mode_info.reserved_mask_size = 8; - framebuffer.mode_info.reserved_field_pos = 24; -+ /* Fallthrough. */ - - case 24: - framebuffer.mode_info.red_mask_size = 8; -diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c -index 07a614a..b7f9119 100644 ---- a/grub-core/video/i386/pc/vbe.c -+++ b/grub-core/video/i386/pc/vbe.c -@@ -874,6 +874,7 @@ vbe2videoinfo (grub_uint32_t mode, - /* CGA is basically 4-bit packed pixel. */ - case GRUB_VBE_MEMORY_MODEL_CGA: - mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA; -+ /* Fallthrough. */ - case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL: - mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; - break; -@@ -886,6 +887,7 @@ vbe2videoinfo (grub_uint32_t mode, - /* Non chain 4 is a special case of planar. */ - case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256: - mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4; -+ /* Fallthrough. */ - case GRUB_VBE_MEMORY_MODEL_PLANAR: - mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR - | GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; -diff --git a/util/getroot.c b/util/getroot.c -index 345d49b..3c1f12d 100644 ---- a/util/getroot.c -+++ b/util/getroot.c -@@ -107,6 +107,7 @@ grub_util_pull_device (const char *os_dev) - default: - if (grub_util_pull_device_os (os_dev, ab)) - return; -+ /* Fallthrough. */ - case GRUB_DEV_ABSTRACTION_NONE: - free (grub_util_biosdisk_get_grub_dev (os_dev)); - return; -diff --git a/util/grub-install.c b/util/grub-install.c -index 210f4a7..cedc188 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -1809,7 +1809,7 @@ main (int argc, char *argv[]) - grub_install_copy_file (imgfile, dst, 1); - free (dst); - } -- -+ /* Fallthrough. */ - case GRUB_INSTALL_PLATFORM_X86_64_EFI: - if (efidir_is_mac) - { --- -2.4.3 - diff --git a/0259-linux-hostdisk-use-strncpy-instead-of-strlcpy.patch b/0259-linux-hostdisk-use-strncpy-instead-of-strlcpy.patch deleted file mode 100644 index 20678b0..0000000 --- a/0259-linux-hostdisk-use-strncpy-instead-of-strlcpy.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 7ba137f6286dcd17a1104f1dfc6eb1f58c5ef743 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 20:00:23 +0300 -Subject: [PATCH 259/506] linux/hostdisk: use strncpy instead of strlcpy - -strlcpy is not available on Linux as part of standard libraries. -It probably is not worth extra configure checks espicially as we -need to handle missing function anyway. ---- - grub-core/osdep/linux/hostdisk.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index 75cb8f5..06179fc 100644 ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -376,7 +376,8 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f - - part_start = grub_partition_get_start (disk->partition); - -- strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev)); -+ strncpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev) - 1); -+ dev[sizeof(dev) - 1] = '\0'; - if (disk->partition - && strncmp (dev, "/dev/", 5) == 0) - { -@@ -439,7 +440,8 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f - if (*max == 0) - *max = ~0ULL; - is_partition = 0; -- strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev)); -+ strncpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev) - 1); -+ dev[sizeof(dev) - 1] = '\0'; - goto reopen; - } - sector -= part_start; --- -2.4.3 - diff --git a/0260-linux-ofpath-fix-descriptor-leak.patch b/0260-linux-ofpath-fix-descriptor-leak.patch deleted file mode 100644 index 7aadf2a..0000000 --- a/0260-linux-ofpath-fix-descriptor-leak.patch +++ /dev/null @@ -1,26 +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 260/506] linux/ofpath: fix descriptor leak - -Found by: Coverity scan ---- - grub-core/osdep/linux/ofpath.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index f716fd2..05b1ecd 100644 ---- a/grub-core/osdep/linux/ofpath.c -+++ b/grub-core/osdep/linux/ofpath.c -@@ -122,6 +122,8 @@ find_obppath (const char *sysfs_path_orig) - 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); - } --- -2.4.3 - diff --git a/0261-fs-zfs-zfs.c-fix-memory-leak.patch b/0261-fs-zfs-zfs.c-fix-memory-leak.patch deleted file mode 100644 index 3a40e60..0000000 --- a/0261-fs-zfs-zfs.c-fix-memory-leak.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e871994849802889af1ad26ddde68e9a12466ba1 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 20:52:27 +0300 -Subject: [PATCH 261/506] fs/zfs/zfs.c: fix memory leak. - -Found by: Coverity scan. ---- - grub-core/fs/zfs/zfs.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 9edac50..057b471 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -2835,6 +2835,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - if (!path_buf) - { - grub_free (oldpathbuf); -+ if (free_symval) -+ grub_free (sym_value); - return grub_errno; - } - grub_memcpy (path, sym_value, sym_sz); --- -2.4.3 - diff --git a/0262-commands-parttool-fix-memory-leak.patch b/0262-commands-parttool-fix-memory-leak.patch deleted file mode 100644 index 07ee418..0000000 --- a/0262-commands-parttool-fix-memory-leak.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3db4f05a10e98a4835ddd87f9d1ef9185e8eef84 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 20:55:25 +0300 -Subject: [PATCH 262/506] commands/parttool: fix memory leak. - -Found by: Coverity scan. ---- - grub-core/commands/parttool.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c -index d907694..42c590e 100644 ---- a/grub-core/commands/parttool.c -+++ b/grub-core/commands/parttool.c -@@ -282,8 +282,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), - break; - } - if (! cur) -- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), -+ { -+ grub_device_close (dev); -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), - args[i]); -+ } - ptool = cur; - pargs = (struct grub_parttool_args *) - grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args)); --- -2.4.3 - diff --git a/0263-fs-zfs-zfscrypt.c-fix-memory-leaks.patch b/0263-fs-zfs-zfscrypt.c-fix-memory-leaks.patch deleted file mode 100644 index 2edb3d6..0000000 --- a/0263-fs-zfs-zfscrypt.c-fix-memory-leaks.patch +++ /dev/null @@ -1,67 +0,0 @@ -From fa13e605270f46dc78cbfded62e4cc58a31dff50 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 21:12:19 +0300 -Subject: [PATCH 263/506] fs/zfs/zfscrypt.c: fix memory leaks. - -Found by: Coverity scan. ---- - grub-core/fs/zfs/zfscrypt.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c -index 91a0af6..834f858 100644 ---- a/grub-core/fs/zfs/zfscrypt.c -+++ b/grub-core/fs/zfs/zfscrypt.c -@@ -354,6 +354,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - if (err) - { - grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (cipher); - continue; - } - -@@ -362,6 +363,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - if (err) - { - grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (cipher); - continue; - } - -@@ -372,6 +374,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - { - grub_dprintf ("zfs", "key loading failed\n"); - grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (cipher); - continue; - } - -@@ -381,12 +384,14 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - { - grub_dprintf ("zfs", "key loading failed\n"); - grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (cipher); - continue; - } - ret = grub_crypto_cipher_open (GRUB_CIPHER_AES); - if (!ret) - { - grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (cipher); - continue; - } - err = grub_crypto_cipher_set_key (ret, decrypted, keylen); -@@ -394,8 +399,10 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - { - grub_errno = GRUB_ERR_NONE; - grub_crypto_cipher_close (ret); -+ grub_crypto_cipher_close (cipher); - continue; - } -+ grub_crypto_cipher_close (cipher); - return ret; - } - return NULL; --- -2.4.3 - diff --git a/0264-fs-zfs-zfscrypt.c-fix-indentation.patch b/0264-fs-zfs-zfscrypt.c-fix-indentation.patch deleted file mode 100644 index 935e1fa..0000000 --- a/0264-fs-zfs-zfscrypt.c-fix-indentation.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3900726fa8a794869c42a0a33fbd96b5cd4ba14f Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 21:13:10 +0300 -Subject: [PATCH 264/506] fs/zfs/zfscrypt.c: fix indentation. - ---- - grub-core/fs/zfs/zfscrypt.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c -index 834f858..87eef62 100644 ---- a/grub-core/fs/zfs/zfscrypt.c -+++ b/grub-core/fs/zfs/zfscrypt.c -@@ -397,11 +397,11 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - err = grub_crypto_cipher_set_key (ret, decrypted, keylen); - if (err) - { -- grub_errno = GRUB_ERR_NONE; -- grub_crypto_cipher_close (ret); -- grub_crypto_cipher_close (cipher); -- continue; -- } -+ grub_errno = GRUB_ERR_NONE; -+ grub_crypto_cipher_close (ret); -+ grub_crypto_cipher_close (cipher); -+ continue; -+ } - grub_crypto_cipher_close (cipher); - return ret; - } --- -2.4.3 - diff --git a/0265-fs-hfsplus-fix-memory-leak.patch b/0265-fs-hfsplus-fix-memory-leak.patch deleted file mode 100644 index 9f1a840..0000000 --- a/0265-fs-hfsplus-fix-memory-leak.patch +++ /dev/null @@ -1,41 +0,0 @@ -From edc94e4b0bd026bf08861a4f4010a36bec0775cd Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 21:19:28 +0300 -Subject: [PATCH 265/506] fs/hfsplus: fix memory leak. - -Found by: Coverity scan. ---- - grub-core/fs/hfsplus.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 950d8a1..8f07f85 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -723,7 +723,10 @@ list_nodes (void *record, void *hook_arg) - - /* If the name is obviously invalid, skip this node. */ - if (catkey->name[i] == 0) -- return 0; -+ { -+ grub_free (filename); -+ return 0; -+ } - } - - *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, -@@ -745,7 +748,10 @@ list_nodes (void *record, void *hook_arg) - callback function. */ - node = grub_malloc (sizeof (*node)); - if (!node) -- return 1; -+ { -+ grub_free (filename); -+ return 1; -+ } - node->data = ctx->dir->data; - node->compressed = 0; - node->cbuf = 0; --- -2.4.3 - diff --git a/0266-util-grub-probe-fix-memory-leaks.patch b/0266-util-grub-probe-fix-memory-leaks.patch deleted file mode 100644 index 0002841..0000000 --- a/0266-util-grub-probe-fix-memory-leaks.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 11aae26cc374d01c9bf4fa33f792bff16b444ef5 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 21:29:55 +0300 -Subject: [PATCH 266/506] util/grub-probe: fix memory leaks. - -Found by: Coverity scan. ---- - util/grub-probe.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/util/grub-probe.c b/util/grub-probe.c -index ecb7b6b..8a0c4f3 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -295,6 +295,7 @@ probe (const char *path, char **device_names, char delim) - } - printf ("%s", disk); - putchar (delim); -+ free (disk); - } - return; - } -@@ -496,6 +497,7 @@ probe (const char *path, char **device_names, char delim) - { - grub_util_fprint_full_disk_name (stdout, dev->disk->name, dev); - putchar (delim); -+ grub_device_close (dev); - continue; - } - -@@ -542,7 +544,7 @@ probe (const char *path, char **device_names, char delim) - if (print == PRINT_IEEE1275_HINT) - { - const char *osdev = grub_util_biosdisk_get_osdev (dev->disk); -- const char *ofpath = grub_util_devname_to_ofpath (osdev); -+ char *ofpath = grub_util_devname_to_ofpath (osdev); - const char *map; - - map = grub_util_biosdisk_get_compatibility_hint (dev->disk); -@@ -560,6 +562,7 @@ probe (const char *path, char **device_names, char delim) - strcpy (p, ofpath); - grub_util_fprint_full_disk_name (stdout, tmp, dev); - free (tmp); -+ free (ofpath); - putchar (delim); - } - --- -2.4.3 - diff --git a/0267-loader-xnu-fix-memory-leak.patch b/0267-loader-xnu-fix-memory-leak.patch deleted file mode 100644 index 686d4b1..0000000 --- a/0267-loader-xnu-fix-memory-leak.patch +++ /dev/null @@ -1,53 +0,0 @@ -From fbb4aa1c050162bef5478b5441abeeaefb4d94f2 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 21:49:45 +0300 -Subject: [PATCH 267/506] loader/xnu: fix memory leak. - -Foound by: Coverity scan. ---- - grub-core/loader/xnu.c | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index bc89cdf..c9885b1 100644 ---- a/grub-core/loader/xnu.c -+++ b/grub-core/loader/xnu.c -@@ -689,10 +689,10 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, - /* Allocate the space. */ - err = grub_xnu_align_heap (GRUB_XNU_PAGESIZE); - if (err) -- return err; -+ goto fail; - err = grub_xnu_heap_malloc (neededspace, &buf0, &buf_target); - if (err) -- return err; -+ goto fail; - buf = buf0; - - exthead = (struct grub_xnu_extheader *) buf; -@@ -709,10 +709,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, - else - err = grub_macho_readfile32 (macho, filename, buf); - if (err) -- { -- grub_macho_close (macho); -- return err; -- } -+ goto fail; - grub_macho_close (macho); - buf += machosize; - } -@@ -747,6 +744,10 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, - /* Announce to kernel */ - return grub_xnu_register_memory ("Driver-", &driversnum, buf_target, - neededspace); -+fail: -+ if (macho) -+ grub_macho_close (macho); -+ return err; - } - - /* Load mkext. */ --- -2.4.3 - diff --git a/0268-Change-quotes-to-match-overall-style-in-NEWS.patch b/0268-Change-quotes-to-match-overall-style-in-NEWS.patch deleted file mode 100644 index 98675a1..0000000 --- a/0268-Change-quotes-to-match-overall-style-in-NEWS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1a4e47879c55390bd80e6f06bee68317b4f16cfa Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Tue, 27 Jan 2015 22:34:50 +0300 -Subject: [PATCH 268/506] Change quotes to match overall style in NEWS - ---- - NEWS | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/NEWS b/NEWS -index 55f09d6..e417eba 100644 ---- a/NEWS -+++ b/NEWS -@@ -85,7 +85,7 @@ New in 2.02: - * Support for USB debug dongles. - * Support for *-emu on all platforms (previously only i386/x86_64 worked). - * Support *-emu on Windows. -- * New platform "none" which builds only user level utilities. This is now -+ * New platform `none' which builds only user level utilities. This is now - default if target CPU is not supported. - - * Security: --- -2.4.3 - diff --git a/0269-syslinux_parse-fix-memory-leak.patch b/0269-syslinux_parse-fix-memory-leak.patch deleted file mode 100644 index 0e6a758..0000000 --- a/0269-syslinux_parse-fix-memory-leak.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2efab86d5a45da41adbe20ac59cc4d5b946de61e Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 28 Jan 2015 20:09:25 +0300 -Subject: [PATCH 269/506] syslinux_parse: fix memory leak. - -Found by: Coverity scan. ---- - grub-core/lib/syslinux_parse.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index f605326..2c874b1 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -922,6 +922,8 @@ write_entry (struct output_buffer *outbuf, - - print_string ("\n"); - } -+ if (ptr && *ptr) -+ grub_free (cmdline); - } - break; - case KERNEL_CHAINLOADER: --- -2.4.3 - diff --git a/0270-script-execute.c-fix-memory-leak.patch b/0270-script-execute.c-fix-memory-leak.patch deleted file mode 100644 index 27824d8..0000000 --- a/0270-script-execute.c-fix-memory-leak.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 9883307a527a0d0e39fe9d500c22ef3eccda83ba Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 28 Jan 2015 20:35:28 +0300 -Subject: [PATCH 270/506] script/execute.c: fix memory leak. - -Make sure to continue loop over array after failure to free -allocated strings. - -Found by: Coverity scan. ---- - grub-core/script/execute.c | 120 ++++++++++++++++++++++++++------------------- - 1 file changed, 70 insertions(+), 50 deletions(-) - -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index afd5513..bb70ebf 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -635,57 +635,77 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist, - { - case GRUB_SCRIPT_ARG_TYPE_VAR: - case GRUB_SCRIPT_ARG_TYPE_DQVAR: -- values = grub_script_env_get (arg->str, arg->type); -- for (i = 0; values && values[i]; i++) -- { -- if (i != 0 && grub_script_argv_next (&result)) -- goto fail; -+ { -+ int need_cleanup = 0; - -- if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR) -- { -- int len; -- char ch; -- char *p; -- char *op; -- const char *s = values[i]; -- -- len = grub_strlen (values[i]); -- /* \? -> \\\? */ -- /* \* -> \\\* */ -- /* \ -> \\ */ -- p = grub_malloc (len * 2 + 1); -- if (! p) -- goto fail; -- -- op = p; -- while ((ch = *s++)) -- { -- if (ch == '\\') -- { -- *op++ = '\\'; -- if (*s == '?' || *s == '*') -- *op++ = '\\'; -- } -- *op++ = ch; -- } -- *op = '\0'; -- -- if (grub_script_argv_append (&result, p, op - p)) -- { -- grub_free (p); -- goto fail; -- } -- } -- else -- { -- if (append (&result, values[i], 1)) -- goto fail; -- } -- -- grub_free (values[i]); -- } -- grub_free (values); -- break; -+ values = grub_script_env_get (arg->str, arg->type); -+ for (i = 0; values && values[i]; i++) -+ { -+ if (!need_cleanup) -+ { -+ if (i != 0 && grub_script_argv_next (&result)) -+ { -+ need_cleanup = 1; -+ goto cleanup; -+ } -+ -+ if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR) -+ { -+ int len; -+ char ch; -+ char *p; -+ char *op; -+ const char *s = values[i]; -+ -+ len = grub_strlen (values[i]); -+ /* \? -> \\\? */ -+ /* \* -> \\\* */ -+ /* \ -> \\ */ -+ p = grub_malloc (len * 2 + 1); -+ if (! p) -+ { -+ need_cleanup = 1; -+ goto cleanup; -+ } -+ -+ op = p; -+ while ((ch = *s++)) -+ { -+ if (ch == '\\') -+ { -+ *op++ = '\\'; -+ if (*s == '?' || *s == '*') -+ *op++ = '\\'; -+ } -+ *op++ = ch; -+ } -+ *op = '\0'; -+ -+ if (grub_script_argv_append (&result, p, op - p)) -+ { -+ grub_free (p); -+ need_cleanup = 1; -+ /* Fall through to cleanup */ -+ } -+ } -+ else -+ { -+ if (append (&result, values[i], 1)) -+ need_cleanup = 1; -+ /* Fall through to cleanup */ -+ } -+ } -+ -+cleanup: -+ grub_free (values[i]); -+ } -+ grub_free (values); -+ -+ if (need_cleanup) -+ goto fail; -+ -+ break; -+ } - - case GRUB_SCRIPT_ARG_TYPE_BLOCK: - { --- -2.4.3 - diff --git a/0271-configure.ac-don-t-use-msoft-float-for-arm64.patch b/0271-configure.ac-don-t-use-msoft-float-for-arm64.patch deleted file mode 100644 index a6f12bc..0000000 --- a/0271-configure.ac-don-t-use-msoft-float-for-arm64.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2da4171eabfe0d1b9b1be6146f628099d08aac02 Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Wed, 28 Jan 2015 20:17:18 +0000 -Subject: [PATCH 271/506] configure.ac: don't use -msoft-float for arm64 - -aarch64 toolchains do not support the -msoft-float option added by -commit 3661261f. Insted, for arm64 use -march=armv8-a+nofp+nosimd. - -Reported-by: Ryan Harkin ---- - configure.ac | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index a3bca06..6d31ed0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -678,7 +678,11 @@ fi - # that floats are a good fit to run instead of what's written in the code. - # Given that floating point unit is disabled (if present to begin with) - # when GRUB is running which may result in various hard crashes. --TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" -+if test "x$target_cpu" = xarm64; then -+ TARGET_CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd" -+else -+ TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" -+fi - - # By default, GCC 4.4 generates .eh_frame sections containing unwind - # information in some cases where it previously did not. GRUB doesn't need --- -2.4.3 - diff --git a/0272-test-do-not-stop-after-first-file-test-or-closing-br.patch b/0272-test-do-not-stop-after-first-file-test-or-closing-br.patch deleted file mode 100644 index 3d919ee..0000000 --- a/0272-test-do-not-stop-after-first-file-test-or-closing-br.patch +++ /dev/null @@ -1,63 +0,0 @@ -From d29259b134257458a98c1ddc05d2a36c677ded37 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 20:10:43 +0300 -Subject: [PATCH 272/506] test: do not stop after first file test or closing - bracket - -Closes: 44115 ---- - grub-core/commands/test.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c -index c98c13d..f58b87c 100644 ---- a/grub-core/commands/test.c -+++ b/grub-core/commands/test.c -@@ -332,7 +332,7 @@ test_parse (char **args, int *argn, int argc) - get_fileinfo (args[*argn + 1], &ctx); - update_val (ctx.file_exists && ctx.file_info.dir, &ctx); - (*argn) += 2; -- return ctx.or || ctx.and; -+ continue; - } - - if (grub_strcmp (args[*argn], "-e") == 0) -@@ -340,7 +340,7 @@ test_parse (char **args, int *argn, int argc) - get_fileinfo (args[*argn + 1], &ctx); - update_val (ctx.file_exists, &ctx); - (*argn) += 2; -- return ctx.or || ctx.and; -+ continue; - } - - if (grub_strcmp (args[*argn], "-f") == 0) -@@ -349,7 +349,7 @@ test_parse (char **args, int *argn, int argc) - /* FIXME: check for other types. */ - update_val (ctx.file_exists && ! ctx.file_info.dir, &ctx); - (*argn) += 2; -- return ctx.or || ctx.and; -+ continue; - } - - if (grub_strcmp (args[*argn], "-s") == 0) -@@ -362,7 +362,7 @@ test_parse (char **args, int *argn, int argc) - grub_file_close (file); - grub_errno = GRUB_ERR_NONE; - (*argn) += 2; -- return ctx.or || ctx.and; -+ continue; - } - - /* String tests. */ -@@ -387,7 +387,7 @@ test_parse (char **args, int *argn, int argc) - if (grub_strcmp (args[*argn], ")") == 0) - { - (*argn)++; -- return ctx.or || ctx.and; -+ continue; - } - /* Recursively invoke if parenthesis. */ - if (grub_strcmp (args[*argn], "(") == 0) --- -2.4.3 - diff --git a/0273-test-fix-previous-commit-we-need-to-return-from-sube.patch b/0273-test-fix-previous-commit-we-need-to-return-from-sube.patch deleted file mode 100644 index 98405a3..0000000 --- a/0273-test-fix-previous-commit-we-need-to-return-from-sube.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 958167b91cdebe55c6cccdd28ad007c554df56d7 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 20:21:56 +0300 -Subject: [PATCH 273/506] test: fix previous commit - we need to return from - subexpression - -( ... ) was processed recursively, we need to return from it. Revert -this change. ---- - grub-core/commands/test.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c -index f58b87c..5f06642 100644 ---- a/grub-core/commands/test.c -+++ b/grub-core/commands/test.c -@@ -387,7 +387,7 @@ test_parse (char **args, int *argn, int argc) - if (grub_strcmp (args[*argn], ")") == 0) - { - (*argn)++; -- continue; -+ return ctx.or || ctx.and; - } - /* Recursively invoke if parenthesis. */ - if (grub_strcmp (args[*argn], "(") == 0) --- -2.4.3 - diff --git a/0274-test-consistently-use-TMPDIR-and-same-name-pattern-f.patch b/0274-test-consistently-use-TMPDIR-and-same-name-pattern-f.patch deleted file mode 100644 index 27b7a3b..0000000 --- a/0274-test-consistently-use-TMPDIR-and-same-name-pattern-f.patch +++ /dev/null @@ -1,41 +0,0 @@ -From f153fcb5a5863d7ce190cfc531b7dff1000316a0 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 20:31:20 +0300 -Subject: [PATCH 274/506] test: consistently use TMPDIR and same name pattern - for temp files - ---- - tests/test_sha512sum.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in -index 524c1d1..d5ef7f9 100644 ---- a/tests/test_sha512sum.in -+++ b/tests/test_sha512sum.in -@@ -1,7 +1,7 @@ - #! /bin/bash - - # create a randome file --file=`mktemp` -+file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 - cat >$file <$outfile1 <$outfile2 - - SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ ` --- -2.4.3 - diff --git a/0275-tests-add-test-command-file-tests.patch b/0275-tests-add-test-command-file-tests.patch deleted file mode 100644 index cb42a34..0000000 --- a/0275-tests-add-test-command-file-tests.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 1e047e53aeb684a3a21a4269a99c708c381b96b5 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 21:42:46 +0300 -Subject: [PATCH 275/506] tests: add test command file tests - -This requires access to files in both host and grub image, so -implementing as separate test unit instead of script test was -more easy. ---- - Makefile.util.def | 6 +++++ - tests/grub_cmd_test.in | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 73 insertions(+) - create mode 100644 tests/grub_cmd_test.in - -diff --git a/Makefile.util.def b/Makefile.util.def -index fed96d8..378b577 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -1156,6 +1156,12 @@ script = { - common = tests/file_filter_test.in; - }; - -+script = { -+ testcase; -+ name = grub_cmd_test; -+ common = tests/grub_cmd_test.in; -+}; -+ - program = { - testcase; - name = example_unit_test; -diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in -new file mode 100644 -index 0000000..6269891 ---- /dev/null -+++ b/tests/grub_cmd_test.in -@@ -0,0 +1,67 @@ -+#! /bin/bash -+ -+# create a randome file -+empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 -+non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 -+cat >$non_empty <$outfile < /dev/null 2>&1; then -+ echo "GRUB test command file tests failed." -+ cat "$outfile" -+ exit 1 -+else -+ rm -f "${outfile}" -+ exit 0 -+fi --- -2.4.3 - diff --git a/0276-net-ip-check-result-of-grub_netbuff_push.patch b/0276-net-ip-check-result-of-grub_netbuff_push.patch deleted file mode 100644 index c54f912..0000000 --- a/0276-net-ip-check-result-of-grub_netbuff_push.patch +++ /dev/null @@ -1,59 +0,0 @@ -From b40fde29a446d9fa5a6ebea7aafb34e3c958afbb Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 22:09:51 +0300 -Subject: [PATCH 276/506] net/ip: check result of grub_netbuff_push - -Found by: Coverity scan. ---- - grub-core/net/ip.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index 5a60954..8c56baa 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -191,15 +191,18 @@ grub_net_send_ip4_packet (struct grub_net_network_level_interface *inf, - grub_net_ip_protocol_t proto) - { - struct iphdr *iph; -+ grub_err_t err; - - COMPILE_TIME_ASSERT (GRUB_NET_OUR_IPV4_HEADER_SIZE == sizeof (*iph)); - - if (nb->tail - nb->data + sizeof (struct iphdr) > inf->card->mtu) - return send_fragmented (inf, target, nb, proto, *ll_target_addr); - -- grub_netbuff_push (nb, sizeof (*iph)); -- iph = (struct iphdr *) nb->data; -+ err = grub_netbuff_push (nb, sizeof (*iph)); -+ if (err) -+ return err; - -+ iph = (struct iphdr *) nb->data; - iph->verhdrlen = ((4 << 4) | 5); - iph->service = 0; - iph->len = grub_cpu_to_be16 (nb->tail - nb->data); -@@ -602,15 +605,18 @@ grub_net_send_ip6_packet (struct grub_net_network_level_interface *inf, - grub_net_ip_protocol_t proto) - { - struct ip6hdr *iph; -+ grub_err_t err; - - COMPILE_TIME_ASSERT (GRUB_NET_OUR_IPV6_HEADER_SIZE == sizeof (*iph)); - - if (nb->tail - nb->data + sizeof (struct iphdr) > inf->card->mtu) - return grub_error (GRUB_ERR_NET_PACKET_TOO_BIG, "packet too big"); - -- grub_netbuff_push (nb, sizeof (*iph)); -- iph = (struct ip6hdr *) nb->data; -+ err = grub_netbuff_push (nb, sizeof (*iph)); -+ if (err) -+ return err; - -+ iph = (struct ip6hdr *) nb->data; - iph->version_class_flow = grub_cpu_to_be32_compile_time ((6 << 28)); - iph->len = grub_cpu_to_be16 (nb->tail - nb->data - sizeof (*iph)); - iph->protocol = proto; --- -2.4.3 - diff --git a/0277-grub-mkimage-fix-potential-NULL-pointer-dereference.patch b/0277-grub-mkimage-fix-potential-NULL-pointer-dereference.patch deleted file mode 100644 index 4aa4721..0000000 --- a/0277-grub-mkimage-fix-potential-NULL-pointer-dereference.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 7aaed66455cc172bd9a3db1893925aa156ba2e14 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 22:26:05 +0300 -Subject: [PATCH 277/506] grub-mkimage: fix potential NULL pointer dereference - -Move fatal check whether symtab_section is NULL before first reference. - -Found by: Coverity scan. ---- - util/grub-mkimagexx.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index 0a1ac9e..3c76d07 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -1539,6 +1539,8 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size, - symtab_section = s; - break; - } -+ if (! symtab_section) -+ grub_util_error ("%s", _("no symbol table")); - - #ifdef MKIMAGE_ELF32 - if (image_target->elf_target == EM_ARM) -@@ -1577,8 +1579,6 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size, - } - #endif - -- if (! symtab_section) -- grub_util_error ("%s", _("no symbol table")); - } - else - { --- -2.4.3 - diff --git a/0278-net-pxe-fix-error-condition.patch b/0278-net-pxe-fix-error-condition.patch deleted file mode 100644 index 6d5c7aa..0000000 --- a/0278-net-pxe-fix-error-condition.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 12abe75aa03695dfa5f6963013a5eb20f656224d Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 22:39:11 +0300 -Subject: [PATCH 278/506] net/pxe: fix error condition - -Test return value of grub_netbuff_reserve(), buf itself cannot be -NULL here. - -Found by: Coverity scan. ---- - grub-core/net/drivers/i386/pc/pxe.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c -index e8c0b22..3f4152d 100644 ---- a/grub-core/net/drivers/i386/pc/pxe.c -+++ b/grub-core/net/drivers/i386/pc/pxe.c -@@ -218,8 +218,7 @@ grub_pxe_recv (struct grub_net_card *dev __attribute__ ((unused))) - return NULL; - /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible - by 4. So that IP header is aligned on 4 bytes. */ -- grub_netbuff_reserve (buf, 2); -- if (!buf) -+ if (grub_netbuff_reserve (buf, 2)) - { - grub_netbuff_free (buf); - return NULL; --- -2.4.3 - diff --git a/0279-grub-fstest-fix-descriptor-leak.patch b/0279-grub-fstest-fix-descriptor-leak.patch deleted file mode 100644 index a672151..0000000 --- a/0279-grub-fstest-fix-descriptor-leak.patch +++ /dev/null @@ -1,31 +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 279/506] grub-fstest: fix descriptor leak - -Found by: Coverity scan. ---- - util/grub-fstest.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 31af2a7..02cd3e3 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -570,12 +570,12 @@ argp_parser (int key, char *arg, struct argp_state *state) - 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); --- -2.4.3 - diff --git a/0280-setup-fix-blocklist-size-calculation.patch b/0280-setup-fix-blocklist-size-calculation.patch deleted file mode 100644 index 6668934..0000000 --- a/0280-setup-fix-blocklist-size-calculation.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 016875dd52456c38c8dee55a8390c0f9fc092afe Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 30 Jan 2015 22:57:39 +0300 -Subject: [PATCH 280/506] setup: fix blocklist size calculation - -Found by: Coverity scan. ---- - util/setup.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/setup.c b/util/setup.c -index b299159..8f20e99 100644 ---- a/util/setup.c -+++ b/util/setup.c -@@ -529,7 +529,7 @@ SETUP (const char *dir, - bl.block = bl.first_block; - while (bl.block->len) - { -- grub_memset (bl.block, 0, sizeof (bl.block)); -+ grub_memset (bl.block, 0, sizeof (*bl.block)); - - bl.block--; - --- -2.4.3 - diff --git a/0281-arm-implement-additional-relocations-generated-by-gc.patch b/0281-arm-implement-additional-relocations-generated-by-gc.patch deleted file mode 100644 index ddf20a2..0000000 --- a/0281-arm-implement-additional-relocations-generated-by-gc.patch +++ /dev/null @@ -1,113 +0,0 @@ -From c0f529ea679bdf48cbe1c4b3dd92fb552456a1fe Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Tue, 3 Feb 2015 21:16:36 +0000 -Subject: [PATCH 281/506] arm: implement additional relocations generated by - gcc 4.9 at -O3 - -GCC 4.9 also generates R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS, -as an alternative to ABS32. - -Signed-off-by: Leif Lindholm ---- - grub-core/kern/arm/dl.c | 15 +++++++++++++++ - grub-core/kern/arm/dl_helper.c | 39 +++++++++++++++++++++++++++++++++++++++ - include/grub/arm/reloc.h | 5 +++++ - 3 files changed, 59 insertions(+) - -diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c -index 57cac2e..5cbd65e 100644 ---- a/grub-core/kern/arm/dl.c -+++ b/grub-core/kern/arm/dl.c -@@ -205,6 +205,21 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - */ - case R_ARM_V4BX: - break; -+ case R_ARM_THM_MOVW_ABS_NC: -+ case R_ARM_THM_MOVT_ABS: -+ { -+ grub_uint32_t offset; -+ offset = grub_arm_thm_movw_movt_get_value((grub_uint16_t *) target); -+ offset += sym_addr; -+ -+ if (ELF_R_TYPE (rel->r_info) == R_ARM_THM_MOVT_ABS) -+ offset >>= 16; -+ else -+ offset &= 0xffff; -+ -+ grub_arm_thm_movw_movt_set_value((grub_uint16_t *) target, offset); -+ } -+ break; - case R_ARM_THM_JUMP19: - { - /* Thumb instructions can be 16-bit aligned */ -diff --git a/grub-core/kern/arm/dl_helper.c b/grub-core/kern/arm/dl_helper.c -index 5721939..8a72632 100644 ---- a/grub-core/kern/arm/dl_helper.c -+++ b/grub-core/kern/arm/dl_helper.c -@@ -25,6 +25,20 @@ - #include - #include - -+static inline grub_uint32_t -+thumb_get_instruction_word(grub_uint16_t *target) -+{ -+ /* Extract instruction word in alignment-safe manner */ -+ return grub_le_to_cpu16 ((*target)) << 16 | grub_le_to_cpu16 (*(target + 1)); -+} -+ -+static inline void -+thumb_set_instruction_word(grub_uint16_t *target, grub_uint32_t insword) -+{ -+ *target = grub_cpu_to_le16 (insword >> 16); -+ *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); -+} -+ - /* - * R_ARM_ABS32 - * -@@ -214,3 +228,28 @@ grub_arm_jump24_set_offset (grub_uint32_t *target, - - *target = grub_cpu_to_le32 (insword); - } -+ -+grub_uint16_t -+grub_arm_thm_movw_movt_get_value (grub_uint16_t *target) -+{ -+ grub_uint32_t insword; -+ -+ insword = thumb_get_instruction_word (target); -+ -+ return ((insword & 0xf0000) >> 4) | ((insword & 0x04000000) >> 15) | \ -+ ((insword & 0x7000) >> 4) | (insword & 0xff); -+} -+ -+void -+grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value) -+{ -+ grub_uint32_t insword; -+ -+ insword = thumb_get_instruction_word (target); -+ insword &= 0xfbf08f00; -+ -+ insword |= ((value & 0xf000) << 4) | ((value & 0x0800) << 15) | \ -+ ((value & 0x0700) << 4) | (value & 0xff); -+ -+ thumb_set_instruction_word (target, insword); -+} -diff --git a/include/grub/arm/reloc.h b/include/grub/arm/reloc.h -index b938037..ae92e21 100644 ---- a/include/grub/arm/reloc.h -+++ b/include/grub/arm/reloc.h -@@ -43,4 +43,9 @@ void - grub_arm_jump24_set_offset (grub_uint32_t *target, - grub_int32_t offset); - -+grub_uint16_t -+grub_arm_thm_movw_movt_get_value (grub_uint16_t *target); -+void -+grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value); -+ - #endif --- -2.4.3 - diff --git a/0282-util-mkimage-fix-gcc5-build-failure.patch b/0282-util-mkimage-fix-gcc5-build-failure.patch deleted file mode 100644 index 8238098..0000000 --- a/0282-util-mkimage-fix-gcc5-build-failure.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 32cd33bd19348afb77ab849846e0b6d6157ea308 Mon Sep 17 00:00:00 2001 -From: Jiri Slaby -Date: Thu, 12 Feb 2015 11:02:09 +0100 -Subject: [PATCH 282/506] util: mkimage, fix gcc5 build failure - -gcc5 reports: -../util/mkimage.c: In function 'grub_install_get_image_target': -../util/mkimage.c:954:5: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations] - && j < ARRAY_SIZE (image_targets[i].names); j++) - ^ -../util/mkimage.c:953:39: note: possible undefined statement is here - for (j = 0; image_targets[i].names[j] - ^ - -Well, let's move the index 'j' test before accesing the array to: -1) make the loop obvious -2) make gcc happy - -Signed-off-by: Jiri Slaby ---- - util/mkimage.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/mkimage.c b/util/mkimage.c -index bccd703..7821dc5 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -937,8 +937,8 @@ grub_install_get_image_target (const char *arg) - { - unsigned i, j; - for (i = 0; i < ARRAY_SIZE (image_targets); i++) -- for (j = 0; image_targets[i].names[j] -- && j < ARRAY_SIZE (image_targets[i].names); j++) -+ for (j = 0; j < ARRAY_SIZE (image_targets[i].names) && -+ image_targets[i].names[j]; j++) - if (strcmp (arg, image_targets[i].names[j]) == 0) - return &image_targets[i]; - return NULL; --- -2.4.3 - diff --git a/0283-diskfilter-fix-crash-in-validate_lv-for-mdraid-array.patch b/0283-diskfilter-fix-crash-in-validate_lv-for-mdraid-array.patch deleted file mode 100644 index 1f2a186..0000000 --- a/0283-diskfilter-fix-crash-in-validate_lv-for-mdraid-array.patch +++ /dev/null @@ -1,89 +0,0 @@ -From e27fdbd6866a3dc9c6ee4d777d89c861f04368e7 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sat, 14 Feb 2015 17:55:35 +0300 -Subject: [PATCH 283/506] diskfilter: fix crash in validate_lv for mdraid - arrays - -Commit 750f4bacd3262376ced3f837d8dc78f834ca233a put LV validation before -actual vg assignment. Make grub_diskfilter_make_raid to assign ->vg as -happens in other cases for consistency. Also clean up redundant code and add -explicit NULL lv->vg check in validate_lv. - -Also fix segment validation in validate_lv; it became obvious when crash -was fixed. - -Closes: 44199 ---- - grub-core/disk/diskfilter.c | 23 +++++++---------------- - 1 file changed, 7 insertions(+), 16 deletions(-) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 80966ac..ad558fa 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -496,13 +496,13 @@ validate_lv (struct grub_diskfilter_lv *lv) - if (!lv) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume"); - -- if (lv->vg->extent_size == 0) -+ if (!lv->vg || lv->vg->extent_size == 0) - return grub_error (GRUB_ERR_READ_ERROR, "invalid volume"); - - for (i = 0; i < lv->segment_count; i++) - { - grub_err_t err; -- err = validate_segment (&lv->segments[1]); -+ err = validate_segment (&lv->segments[i]); - if (err) - return err; - } -@@ -941,8 +941,10 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - - for (lv = vg->lvs; lv; lv = lv->next) - { -- /* RAID 1 and single-disk RAID 0 don't use a chunksize but code assumes one so set -- one. */ -+ grub_err_t err; -+ -+ /* RAID 1 and single-disk RAID 0 don't use a chunksize but code -+ assumes one so set one. */ - for (i = 0; i < lv->segment_count; i++) - { - if (lv->segments[i].type == 1) -@@ -952,17 +954,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - && lv->segments[i].stripe_size == 0) - lv->segments[i].stripe_size = 64; - } -- } -- -- for (lv = vg->lvs; lv; lv = lv->next) -- { -- grub_err_t err; -- -- /* RAID 1 doesn't use a chunksize but code assumes one so set -- one. */ -- for (i = 0; i < lv->segment_count; i++) -- if (lv->segments[i].type == 1) -- lv->segments[i].stripe_size = 64; - - err = validate_lv(lv); - if (err) -@@ -1007,7 +998,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - lv->fullname = tmp; - } - } -- lv->vg = vg; - } - /* Add our new array to the list. */ - vg->next = array_list; -@@ -1101,6 +1091,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - array->lvs->visible = 1; - array->lvs->name = array->name; - array->lvs->fullname = array->name; -+ array->lvs->vg = array; - - array->lvs->idname = grub_malloc (sizeof ("mduuid/") + 2 * uuidlen); - if (!array->lvs->idname) --- -2.4.3 - diff --git a/0284-diskfilter-fix-double-free-of-lv-names-for-mdraid.patch b/0284-diskfilter-fix-double-free-of-lv-names-for-mdraid.patch deleted file mode 100644 index c26375f..0000000 --- a/0284-diskfilter-fix-double-free-of-lv-names-for-mdraid.patch +++ /dev/null @@ -1,75 +0,0 @@ -From fc535b32b9fe0cd84213724ffba43b98e2da6ab4 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sat, 14 Feb 2015 19:08:58 +0300 -Subject: [PATCH 284/506] diskfilter: fix double free of lv names for mdraid - -Avoid micro-optimization in grub_diskfilter_make_raid and make sure -name and fullname are independent strings. This avoids need to special -case it everywhere else. - -Also fix memory leak in failure case in grub_diskfilter_make_raid. - -Closes: 41582 ---- - grub-core/disk/diskfilter.c | 31 ++++++++++++++++++++++++------- - 1 file changed, 24 insertions(+), 7 deletions(-) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index ad558fa..1b7464d 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -1089,8 +1089,15 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - goto fail; - array->lvs->segment_count = 1; - array->lvs->visible = 1; -- array->lvs->name = array->name; -- array->lvs->fullname = array->name; -+ if (array->name) -+ { -+ array->lvs->name = grub_strdup (array->name); -+ if (!array->lvs->name) -+ goto fail; -+ array->lvs->fullname = grub_strdup (array->name); -+ if (!array->lvs->fullname) -+ goto fail; -+ } - array->lvs->vg = array; - - array->lvs->idname = grub_malloc (sizeof ("mduuid/") + 2 * uuidlen); -@@ -1141,7 +1148,18 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - return array; - - fail: -- grub_free (array->lvs); -+ if (array->lvs) -+ { -+ grub_free (array->lvs->name); -+ grub_free (array->lvs->fullname); -+ grub_free (array->lvs->idname); -+ if (array->lvs->segments) -+ { -+ grub_free (array->lvs->segments->nodes); -+ grub_free (array->lvs->segments); -+ } -+ grub_free (array->lvs); -+ } - while (array->pvs) - { - pv = array->pvs->next; -@@ -1250,10 +1268,9 @@ free_array (void) - { - unsigned i; - vg->lvs = lv->next; -- if (lv->name != lv->fullname) -- grub_free (lv->fullname); -- if (lv->name != vg->name) -- grub_free (lv->name); -+ grub_free (lv->fullname); -+ grub_free (lv->name); -+ grub_free (lv->idname); - for (i = 0; i < lv->segment_count; i++) - grub_free (lv->segments[i].nodes); - grub_free (lv->segments); --- -2.4.3 - diff --git a/0285-multiboot2-Fix-information-request-tag-size-calculat.patch b/0285-multiboot2-Fix-information-request-tag-size-calculat.patch deleted file mode 100644 index c8891d2..0000000 --- a/0285-multiboot2-Fix-information-request-tag-size-calculat.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8e5bc2f4d3767485e729ed96ea943570d1cb1e45 Mon Sep 17 00:00:00 2001 -From: Daniel Kiper -Date: Fri, 30 Jan 2015 18:59:24 +0100 -Subject: [PATCH 285/506] multiboot2: Fix information request tag size - calculation - -Signed-off-by: Daniel Kiper ---- - grub-core/loader/multiboot_mbi2.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index 6f74aee..d7c19bc 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - = (struct multiboot_header_tag_information_request *) tag; - if (request_tag->flags & MULTIBOOT_HEADER_TAG_OPTIONAL) - break; -- for (i = 0; i < (request_tag->size - sizeof (request_tag)) -+ for (i = 0; i < (request_tag->size - sizeof (*request_tag)) - / sizeof (request_tag->requests[0]); i++) - switch (request_tag->requests[i]) - { --- -2.4.3 - diff --git a/0286-disk-lvm-Use-zalloc-to-ensure-that-segments-are-init.patch b/0286-disk-lvm-Use-zalloc-to-ensure-that-segments-are-init.patch deleted file mode 100644 index 55a4ee7..0000000 --- a/0286-disk-lvm-Use-zalloc-to-ensure-that-segments-are-init.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2ae9457e6eb4c352051fb32bc6fc931a22528ab2 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 14 Feb 2015 20:31:00 +0100 -Subject: [PATCH 286/506] disk/lvm: Use zalloc to ensure that segments are - initialised to sane value. - -Reported by: EmanueL Czirai. ---- - grub-core/disk/lvm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 862a966..1e7f197 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -426,7 +426,7 @@ grub_lvm_detect (grub_disk_t disk, - #endif - goto lvs_fail; - } -- lv->segments = grub_malloc (sizeof (*seg) * lv->segment_count); -+ lv->segments = grub_zalloc (sizeof (*seg) * lv->segment_count); - seg = lv->segments; - - for (i = 0; i < lv->segment_count; i++) --- -2.4.3 - diff --git a/0287-diskfilter_make_raid-more-memory-leaks-in-failure-pa.patch b/0287-diskfilter_make_raid-more-memory-leaks-in-failure-pa.patch deleted file mode 100644 index 58b8057..0000000 --- a/0287-diskfilter_make_raid-more-memory-leaks-in-failure-pa.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 8f5ebb1245446f8e26c64cf0ebbb514dfb1a8d57 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 15 Feb 2015 10:10:03 +0300 -Subject: [PATCH 287/506] diskfilter_make_raid: more memory leaks in failure - path - ---- - grub-core/disk/diskfilter.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 1b7464d..c4f6678 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -1031,7 +1031,10 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - if (n == 1) - n = (layout >> 8) & 0xFF; - if (n == 0) -- return NULL; -+ { -+ grub_free (uuid); -+ return NULL; -+ } - - totsize = grub_divmod64 (nmemb * disk_size, n, 0); - } -@@ -1045,6 +1048,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - break; - - default: -+ grub_free (uuid); - return NULL; - } - -@@ -1067,7 +1071,10 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - } - array = grub_zalloc (sizeof (*array)); - if (!array) -- return NULL; -+ { -+ grub_free (uuid); -+ return NULL; -+ } - array->uuid = uuid; - array->uuid_len = uuidlen; - if (name) -@@ -1166,6 +1173,8 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - grub_free (array->pvs); - array->pvs = pv; - } -+ grub_free (array->name); -+ grub_free (array->uuid); - grub_free (array); - return NULL; - } --- -2.4.3 - diff --git a/0288-syslinux_parse-Always-output-comments-even-if-no-ent.patch b/0288-syslinux_parse-Always-output-comments-even-if-no-ent.patch deleted file mode 100644 index e4b598f..0000000 --- a/0288-syslinux_parse-Always-output-comments-even-if-no-ent.patch +++ /dev/null @@ -1,44 +0,0 @@ -From b23635fcff62b68b6d5bfde541350095d743a13a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 16 Feb 2015 10:54:20 +0100 -Subject: [PATCH 288/506] syslinux_parse: Always output comments even if no - entries are found. - ---- - grub-core/lib/syslinux_parse.c | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 2c874b1..46eff1e 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -1430,6 +1430,13 @@ config_file (struct output_buffer *outbuf, - print_string ("\n"); - } - -+ if (menu.comments) -+ { -+ err = print (outbuf, menu.comments, grub_strlen (menu.comments)); -+ if (err) -+ return err; -+ } -+ - if (menu.timeout == 0 && menu.entries && menu.def) - { - err = print_entry (outbuf, &menu, menu.def); -@@ -1446,12 +1453,6 @@ config_file (struct output_buffer *outbuf, - if (err) - return err; - print_string ("\n"); -- if (menu.comments) -- { -- err = print (outbuf, menu.comments, grub_strlen (menu.comments)); -- if (err) -- return err; -- } - - if (menu.def) - { --- -2.4.3 - diff --git a/0289-Don-t-remove-initrd-parameter.patch b/0289-Don-t-remove-initrd-parameter.patch deleted file mode 100644 index e60c813..0000000 --- a/0289-Don-t-remove-initrd-parameter.patch +++ /dev/null @@ -1,75 +0,0 @@ -From e29af836d02a267d6ad9bd6eba808d5bf0a96949 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 16 Feb 2015 15:56:26 +0100 -Subject: [PATCH 289/506] Don't remove initrd= parameter. - -Based on simplified patch by Lunar. - -Reported by: Lunar ---- - grub-core/lib/syslinux_parse.c | 28 +++++++--------------------- - 1 file changed, 7 insertions(+), 21 deletions(-) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 46eff1e..afc12b5 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -869,7 +869,6 @@ write_entry (struct output_buffer *outbuf, - case KERNEL_LINUX: - { - char *ptr; -- char *cmdline; - char *initrd = NULL; - for (ptr = curentry->append; ptr && *ptr; ptr++) - if ((ptr == curentry->append || grub_isspace (ptr[-1])) -@@ -879,31 +878,19 @@ write_entry (struct output_buffer *outbuf, - if (ptr && *ptr) - { - char *ptr2; -- grub_size_t totlen = grub_strlen (curentry->append); -- initrd = ptr + sizeof ("initrd=") - 1; -- for (ptr2 = ptr; *ptr2 && !grub_isspace (*ptr2); ptr2++); -- if (*ptr2) -- { -- *ptr2 = 0; -- ptr2++; -- } -- cmdline = grub_malloc (totlen + 1 - (ptr2 - ptr)); -- if (!cmdline) -+ initrd = grub_strdup(ptr + sizeof ("initrd=") - 1); -+ if (!initrd) - return grub_errno; -- grub_memcpy (cmdline, curentry->append, ptr - curentry->append); -- grub_memcpy (cmdline + (ptr - curentry->append), -- ptr2, totlen - (ptr2 - curentry->append)); -- *(cmdline + totlen - (ptr2 - ptr)) = 0; -+ for (ptr2 = initrd; *ptr2 && !grub_isspace (*ptr2); ptr2++); -+ *ptr2 = 0; - } -- else -- cmdline = curentry->append; - print_string (" if test x$grub_platform = xpc; then " - "linux_suffix=16; else linux_suffix= ; fi\n"); - print_string (" linux$linux_suffix "); - print_file (outbuf, menu, curentry->kernel_file, NULL); - print_string (" "); -- if (cmdline) -- print (outbuf, cmdline, grub_strlen (cmdline)); -+ if (curentry->append) -+ print (outbuf, curentry->append, grub_strlen (curentry->append)); - print_string ("\n"); - if (initrd || curentry->initrds) - { -@@ -922,8 +909,7 @@ write_entry (struct output_buffer *outbuf, - - print_string ("\n"); - } -- if (ptr && *ptr) -- grub_free (cmdline); -+ grub_free (initrd); - } - break; - case KERNEL_CHAINLOADER: --- -2.4.3 - diff --git a/0290-Add-test-for-syslinux-converter.patch b/0290-Add-test-for-syslinux-converter.patch deleted file mode 100644 index 6951517..0000000 --- a/0290-Add-test-for-syslinux-converter.patch +++ /dev/null @@ -1,535 +0,0 @@ -From d3d2e549119477d92b506477fd923c51162b9beb Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 16 Feb 2015 15:58:59 +0100 -Subject: [PATCH 290/506] Add test for syslinux converter - ---- - Makefile.util.def | 6 + - tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg | 0 - tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg | 52 +++++ - tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg | 3 + - tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg | 12 ++ - tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg | 6 + - tests/syslinux/ubuntu10.04/isolinux/menu.cfg | 23 +++ - tests/syslinux/ubuntu10.04/isolinux/po4a.cfg | 3 + - tests/syslinux/ubuntu10.04/isolinux/prompt.cfg | 16 ++ - tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg | 4 + - tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg | 15 ++ - tests/syslinux/ubuntu10.04/isolinux/txt.cfg | 19 ++ - tests/syslinux/ubuntu10.04_grub.cfg | 236 +++++++++++++++++++++++ - tests/syslinux_test.in | 16 ++ - 14 files changed, 411 insertions(+) - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/menu.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/po4a.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/prompt.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg - create mode 100644 tests/syslinux/ubuntu10.04/isolinux/txt.cfg - create mode 100644 tests/syslinux/ubuntu10.04_grub.cfg - create mode 100644 tests/syslinux_test.in - -diff --git a/Makefile.util.def b/Makefile.util.def -index 378b577..67dfb29 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -1162,6 +1162,12 @@ script = { - common = tests/grub_cmd_test.in; - }; - -+script = { -+ testcase; -+ name = syslinux_test; -+ common = tests/syslinux_test.in; -+}; -+ - program = { - testcase; - name = example_unit_test; -diff --git a/tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg b/tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg -new file mode 100644 -index 0000000..e69de29 -diff --git a/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg b/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg -new file mode 100644 -index 0000000..2e107fa ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg -@@ -0,0 +1,52 @@ -+menu hshift 9 -+menu width 58 -+ -+menu begin desktop -+ include stdmenu.cfg -+ menu hshift 13 -+ menu width 49 -+ menu label Alternative desktop environments -+ menu title Desktop environment menu -+ label mainmenu-kde -+ menu label ^Back.. -+ text help -+ Higher level options install the GNOME desktop environment -+ endtext -+ menu exit -+ menu begin kde-desktop -+ include stdmenu.cfg -+ menu label ^KDE -+ menu title KDE desktop boot menu -+ text help -+ Select the 'K Desktop Environment' for the Desktop task -+ endtext -+ label mainmenu-kde -+ menu label ^Back.. -+ menu exit -+ include kde/menu.cfg -+ menu end -+ menu begin lxde-desktop -+ include stdmenu.cfg -+ menu label ^LXDE -+ menu title LXDE desktop boot menu -+ text help -+ Select the 'Lightweight X11 Desktop Environment' for the Desktop task -+ endtext -+ label mainmenu-lxde -+ menu label ^Back.. -+ menu exit -+ include lxde/menu.cfg -+ menu end -+ menu begin xfce-desktop -+ include stdmenu.cfg -+ menu label ^Xfce -+ menu title Xfce desktop boot menu -+ text help -+ Select the 'Xfce lightweight desktop environment' for the Desktop task -+ endtext -+ label mainmenu-xfce -+ menu label ^Back.. -+ menu exit -+ include xfce/menu.cfg -+ menu end -+menu end -diff --git a/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg b/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg -new file mode 100644 -index 0000000..3119e65 ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg -@@ -0,0 +1,3 @@ -+label menu -+ kernel vesamenu.c32 -+ config isolinux.cfg -diff --git a/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg b/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg -new file mode 100644 -index 0000000..b799cb5 ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg -@@ -0,0 +1,12 @@ -+foreground=0xFFFFFF -+background=0x958490 -+screen-colour=0x270A1E -+hidden-timeout=2 -+label normal=Normal -+append normal= -+label driverupdates=Use driver update disc -+append driverupdates=debian-installer/driver-update=true -+applies driverupdates=live live-install -+label oem=OEM install (for manufacturers) -+append oem=oem-config/enable=true -+applies oem=live live-install install -diff --git a/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg b/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg -new file mode 100644 -index 0000000..fd9c333 ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg -@@ -0,0 +1,6 @@ -+# D-I config version 2.0 -+include menu.cfg -+default vesamenu.c32 -+prompt 0 -+timeout 50 -+ui gfxboot bootlogo -diff --git a/tests/syslinux/ubuntu10.04/isolinux/menu.cfg b/tests/syslinux/ubuntu10.04/isolinux/menu.cfg -new file mode 100644 -index 0000000..9f5607d ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/menu.cfg -@@ -0,0 +1,23 @@ -+menu hshift 13 -+menu width 49 -+menu margin 8 -+ -+menu title Installer boot menu -+include stdmenu.cfg -+include txt.cfg -+include gtk.cfg -+menu begin advanced -+ menu title Advanced options -+ include stdmenu.cfg -+ label mainmenu -+ menu label ^Back.. -+ menu exit -+ include adtxt.cfg -+ include adgtk.cfg -+menu end -+label help -+ menu label ^Help -+ text help -+ Display help screens; type 'menu' at boot prompt to return to this menu -+ endtext -+ config prompt.cfg -diff --git a/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg b/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg -new file mode 100644 -index 0000000..75f6788 ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg -@@ -0,0 +1,3 @@ -+[po4a_langs] ar bn ca cs da de es eu fi fr gl hu id it ja ka ko ku lv nb nl pl pt pt_BR ru sk sv ta tr vi zh_CN zh_TW -+[po4a_paths] po/help.pot $lang:po/$lang.po -+[type:docbook] help.xml -diff --git a/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg b/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg -new file mode 100644 -index 0000000..f9984ae ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg -@@ -0,0 +1,16 @@ -+prompt 1 -+display f1.txt -+timeout 50 -+include menu.cfg -+include exithelp.cfg -+ -+f1 f1.txt -+f2 f2.txt -+f3 f3.txt -+f4 f4.txt -+f5 f5.txt -+f6 f6.txt -+f7 f7.txt -+f8 f8.txt -+f9 f9.txt -+f0 f10.txt -diff --git a/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg b/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg -new file mode 100644 -index 0000000..bdf6231 ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg -@@ -0,0 +1,4 @@ -+label rescue -+ menu label ^Rescue mode -+ kernel /install/vmlinuz -+ append vga=788 initrd=/install/initrd.gz rescue/enable=true -- quiet -diff --git a/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg b/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg -new file mode 100644 -index 0000000..671b16f ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg -@@ -0,0 +1,15 @@ -+menu background splash.png -+menu color title * #FFFFFFFF * -+menu color border * #00000000 #00000000 none -+menu color sel * #ffffffff #76a1d0ff * -+menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff * -+menu color tabmsg * #ffffffff #00000000 * -+menu color help 37;40 #ffdddd00 #00000000 none -+menu vshift 12 -+menu rows 10 -+menu helpmsgrow 15 -+# The command line must be at least one line from the bottom. -+menu cmdlinerow 16 -+menu timeoutrow 16 -+menu tabmsgrow 18 -+menu tabmsg Press ENTER to boot or TAB to edit a menu entry -diff --git a/tests/syslinux/ubuntu10.04/isolinux/txt.cfg b/tests/syslinux/ubuntu10.04/isolinux/txt.cfg -new file mode 100644 -index 0000000..860daad ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04/isolinux/txt.cfg -@@ -0,0 +1,19 @@ -+default live -+label live -+ menu label ^Try Ubuntu without installing -+ kernel /casper/vmlinuz -+ append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- -+label live-install -+ menu label ^Install Ubuntu -+ kernel /casper/vmlinuz -+ append file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- -+label check -+ menu label ^Check disc for defects -+ kernel /casper/vmlinuz -+ append boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- -+label memtest -+ menu label Test ^memory -+ kernel /install/mt86plus -+label hd -+ menu label ^Boot from first hard disk -+ localboot 0x80 -diff --git a/tests/syslinux/ubuntu10.04_grub.cfg b/tests/syslinux/ubuntu10.04_grub.cfg -new file mode 100644 -index 0000000..e6bd82c ---- /dev/null -+++ b/tests/syslinux/ubuntu10.04_grub.cfg -@@ -0,0 +1,236 @@ -+ background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux'/'splash.png' -+# D-I config version 2.0 -+ # UNSUPPORTED command 'menu hshift 13' -+ # UNSUPPORTED command 'menu width 49' -+ # UNSUPPORTED command 'menu margin 8' -+ -+ # UNSUPPORTED command 'menu title Installer boot menu' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+set timeout=5 -+ default='vesamenu.c32' -+menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Test memory' --hotkey 'm' --id 'memtest' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/install/mt86plus' -+} -+menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/gtk.cfg not found -+ # UNSUPPORTED command 'menu begin advanced' -+ # UNSUPPORTED command 'menu title Advanced options' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+ root=hd0; -+ chainloader +1; -+} -+menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { -+ # UNSUPPORTED command 'menu exit' -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/adgtk.cfg not found -+ # UNSUPPORTED command 'menu end' -+ # UNSUPPORTED entry type 0 -+true; -+} -+menuentry 'Help' --hotkey 'h' --id 'help' { -+ # UNSUPPORTED command 'ui gfxboot bootlogo' -+#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'splash.png' -+ # UNSUPPORTED command 'display f1.txt' -+ # UNSUPPORTED command 'menu hshift 13' -+ # UNSUPPORTED command 'menu width 49' -+ # UNSUPPORTED command 'menu margin 8' -+ -+ # UNSUPPORTED command 'menu title Installer boot menu' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+set timeout=5 -+ default='live' -+menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Test memory' --hotkey 'm' --id 'memtest' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/install/mt86plus' -+} -+menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//gtk.cfg not found -+ # UNSUPPORTED command 'menu begin advanced' -+ # UNSUPPORTED command 'menu title Advanced options' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+ root=hd0; -+ chainloader +1; -+} -+menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { -+ # UNSUPPORTED command 'menu exit' -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//adgtk.cfg not found -+ # UNSUPPORTED command 'menu end' -+ # UNSUPPORTED entry type 0 -+true; -+} -+menuentry 'Help' --hotkey 'h' --id 'help' { -+#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ syslinux_configfile -r '/'/'/' -c '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'' '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' -+} -+menuentry 'menu' --id 'menu' { -+ # UNSUPPORTED command 'f1 f1.txt' -+ # UNSUPPORTED command 'f2 f2.txt' -+ # UNSUPPORTED command 'f3 f3.txt' -+ # UNSUPPORTED command 'f4 f4.txt' -+ # UNSUPPORTED command 'f5 f5.txt' -+ # UNSUPPORTED command 'f6 f6.txt' -+ # UNSUPPORTED command 'f7 f7.txt' -+ # UNSUPPORTED command 'f8 f8.txt' -+ # UNSUPPORTED command 'f9 f9.txt' -+ # UNSUPPORTED command 'f0 f10.txt' -+#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg: -+ background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'splash.png' -+# D-I config version 2.0 -+ # UNSUPPORTED command 'menu hshift 13' -+ # UNSUPPORTED command 'menu width 49' -+ # UNSUPPORTED command 'menu margin 8' -+ -+ # UNSUPPORTED command 'menu title Installer boot menu' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+set timeout=5 -+ default='vesamenu.c32' -+menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- -+ initrd$linux_suffix '/'/'/casper/initrd.lz' -+} -+menuentry 'Test memory' --hotkey 'm' --id 'memtest' { -+ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi -+ linux$linux_suffix '/'/'/install/mt86plus' -+} -+menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux///gtk.cfg not found -+ # UNSUPPORTED command 'menu begin advanced' -+ # UNSUPPORTED command 'menu title Advanced options' -+ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -+ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' -+ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' -+ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' -+ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' -+ # UNSUPPORTED command 'menu vshift 12' -+ # UNSUPPORTED command 'menu rows 10' -+ # UNSUPPORTED command 'menu helpmsgrow 15' -+# The command line must be at least one line from the bottom. -+ # UNSUPPORTED command 'menu cmdlinerow 16' -+ # UNSUPPORTED command 'menu timeoutrow 16' -+ # UNSUPPORTED command 'menu tabmsgrow 18' -+ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' -+ root=hd0; -+ chainloader +1; -+} -+menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { -+ # UNSUPPORTED command 'menu exit' -+# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux///adgtk.cfg not found -+ # UNSUPPORTED command 'menu end' -+ # UNSUPPORTED entry type 0 -+true; -+} -+menuentry 'Help' --hotkey 'h' --id 'help' { -+ # UNSUPPORTED command 'ui gfxboot bootlogo' -+#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ syslinux_configfile -r '/'/'/' -c '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'' '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' -+} -+} -+} -diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in -new file mode 100644 -index 0000000..08d28da ---- /dev/null -+++ b/tests/syslinux_test.in -@@ -0,0 +1,16 @@ -+#!/bin/sh -+ -+set -e -+ -+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 -+ -+"@builddir@/grub-syslinux2cfg" -r "@srcdir@/tests/syslinux/ubuntu10.04" "@srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile" -+ -+echo "$outfile" -+ -+if ! diff -u "$outfile" "@srcdir@/tests/syslinux/ubuntu10.04_grub.cfg"; then -+ echo "Mismatch in ubuntu10.04" -+ exit 1; -+fi -+ -+exit 0 --- -2.4.3 - diff --git a/0291-build-sys-add-syslinux-test-files-to-tarball.patch b/0291-build-sys-add-syslinux-test-files-to-tarball.patch deleted file mode 100644 index 41f39f7..0000000 --- a/0291-build-sys-add-syslinux-test-files-to-tarball.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 251ddf26dc80d1fa91ca3f242da8613bc59c930d Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 16 Feb 2015 20:31:22 +0300 -Subject: [PATCH 291/506] build-sys: add syslinux test files to tarball - ---- - conf/Makefile.extra-dist | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 1b95ccd..8a65e37 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -121,3 +121,15 @@ EXTRA_DIST += tests/file_filter/file.xz.sig - EXTRA_DIST += tests/file_filter/keys - EXTRA_DIST += tests/file_filter/keys.pub - EXTRA_DIST += tests/file_filter/test.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/prompt.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/txt.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/menu.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/po4a.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04_grub.cfg --- -2.4.3 - diff --git a/0292-tests-remove-hardcoded-paths-from-syslinux_test.patch b/0292-tests-remove-hardcoded-paths-from-syslinux_test.patch deleted file mode 100644 index 8e48975..0000000 --- a/0292-tests-remove-hardcoded-paths-from-syslinux_test.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 35a492e4a2c70d27bc0a7f0c567b2a3405f31599 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 16 Feb 2015 22:07:33 +0300 -Subject: [PATCH 292/506] tests: remove hardcoded paths from syslinux_test - -abs_top_srcdir appeared in Autoconf 2.52f. Minimal grub requirement -is 2.60 so we should be good here. ---- - Makefile.am | 6 +++++ - conf/Makefile.extra-dist | 2 +- - ...buntu10.04_grub.cfg => ubuntu10.04_grub.cfg.in} | 30 +++++++++++----------- - tests/syslinux_test.in | 4 +-- - 4 files changed, 24 insertions(+), 18 deletions(-) - rename tests/syslinux/{ubuntu10.04_grub.cfg => ubuntu10.04_grub.cfg.in} (85%) - -diff --git a/Makefile.am b/Makefile.am -index f702951..994ebbd 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -452,3 +452,9 @@ ChangeLog: FORCE - fi - - EXTRA_DIST += ChangeLog ChangeLog-2015 -+ -+syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg -+ -+tests/syslinux/ubuntu10.04_grub.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg.in -+ (for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:- -+CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 8a65e37..db6cfd1 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -132,4 +132,4 @@ EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg - EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg - EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/po4a.cfg - EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg --EXTRA_DIST += tests/syslinux/ubuntu10.04_grub.cfg -+EXTRA_DIST += tests/syslinux/ubuntu10.04_grub.cfg.in -diff --git a/tests/syslinux/ubuntu10.04_grub.cfg b/tests/syslinux/ubuntu10.04_grub.cfg.in -similarity index 85% -rename from tests/syslinux/ubuntu10.04_grub.cfg -rename to tests/syslinux/ubuntu10.04_grub.cfg.in -index e6bd82c..846e4ac 100644 ---- a/tests/syslinux/ubuntu10.04_grub.cfg -+++ b/tests/syslinux/ubuntu10.04_grub.cfg.in -@@ -1,4 +1,4 @@ -- background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux'/'splash.png' -+ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'splash.png' - # D-I config version 2.0 - # UNSUPPORTED command 'menu hshift 13' - # UNSUPPORTED command 'menu width 49' -@@ -41,7 +41,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' { - linux$linux_suffix '/'/'/install/mt86plus' - } - menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/gtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/gtk.cfg not found - # UNSUPPORTED command 'menu begin advanced' - # UNSUPPORTED command 'menu title Advanced options' - # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -@@ -63,15 +63,15 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { - } - menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { - # UNSUPPORTED command 'menu exit' --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/adgtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/adgtk.cfg not found - # UNSUPPORTED command 'menu end' - # UNSUPPORTED entry type 0 - true; - } - menuentry 'Help' --hotkey 'h' --id 'help' { - # UNSUPPORTED command 'ui gfxboot bootlogo' --#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -- background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'splash.png' -+#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'splash.png' - # UNSUPPORTED command 'display f1.txt' - # UNSUPPORTED command 'menu hshift 13' - # UNSUPPORTED command 'menu width 49' -@@ -114,7 +114,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' { - linux$linux_suffix '/'/'/install/mt86plus' - } - menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//gtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//gtk.cfg not found - # UNSUPPORTED command 'menu begin advanced' - # UNSUPPORTED command 'menu title Advanced options' - # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -@@ -136,14 +136,14 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { - } - menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { - # UNSUPPORTED command 'menu exit' --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//adgtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//adgtk.cfg not found - # UNSUPPORTED command 'menu end' - # UNSUPPORTED entry type 0 - true; - } - menuentry 'Help' --hotkey 'h' --id 'help' { --#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -- syslinux_configfile -r '/'/'/' -c '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'' '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' -+#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' - } - menuentry 'menu' --id 'menu' { - # UNSUPPORTED command 'f1 f1.txt' -@@ -156,8 +156,8 @@ menuentry 'menu' --id 'menu' { - # UNSUPPORTED command 'f8 f8.txt' - # UNSUPPORTED command 'f9 f9.txt' - # UNSUPPORTED command 'f0 f10.txt' --#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg: -- background_image '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'splash.png' -+#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg: -+ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'splash.png' - # D-I config version 2.0 - # UNSUPPORTED command 'menu hshift 13' - # UNSUPPORTED command 'menu width 49' -@@ -200,7 +200,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' { - linux$linux_suffix '/'/'/install/mt86plus' - } - menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux///gtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///gtk.cfg not found - # UNSUPPORTED command 'menu begin advanced' - # UNSUPPORTED command 'menu title Advanced options' - # UNSUPPORTED command 'menu color title * #FFFFFFFF *' -@@ -222,15 +222,15 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { - } - menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { - # UNSUPPORTED command 'menu exit' --# File (host)//home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux///adgtk.cfg not found -+# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///adgtk.cfg not found - # UNSUPPORTED command 'menu end' - # UNSUPPORTED entry type 0 - true; - } - menuentry 'Help' --hotkey 'h' --id 'help' { - # UNSUPPORTED command 'ui gfxboot bootlogo' --#'/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' (host)/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -- syslinux_configfile -r '/'/'/' -c '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'' '/home/phcoder/grub2/git/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' -+#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: -+ syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' - } - } - } -diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in -index 08d28da..fc4edd8 100644 ---- a/tests/syslinux_test.in -+++ b/tests/syslinux_test.in -@@ -4,11 +4,11 @@ set -e - - outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 - --"@builddir@/grub-syslinux2cfg" -r "@srcdir@/tests/syslinux/ubuntu10.04" "@srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile" -+"@builddir@/grub-syslinux2cfg" -r "@abs_top_srcdir@/tests/syslinux/ubuntu10.04" "@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile" - - echo "$outfile" - --if ! diff -u "$outfile" "@srcdir@/tests/syslinux/ubuntu10.04_grub.cfg"; then -+if ! diff -u "$outfile" "@builddir@/tests/syslinux/ubuntu10.04_grub.cfg"; then - echo "Mismatch in ubuntu10.04" - exit 1; - fi --- -2.4.3 - diff --git a/0293-ext2-Support-META_BG.patch b/0293-ext2-Support-META_BG.patch deleted file mode 100644 index 8c13b6a..0000000 --- a/0293-ext2-Support-META_BG.patch +++ /dev/null @@ -1,134 +0,0 @@ -From e20aa39ea4298011ba716087713cff26c6c52006 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 16 Feb 2015 20:53:26 +0100 -Subject: [PATCH 293/506] ext2: Support META_BG. - -This fixes bug that system would become unbootable after ext* -online resize if no resize_inode was created at ext* format time. ---- - grub-core/fs/ext2.c | 61 +++++++++++++++++++++++++++++++++++++++++--- - tests/ext234_test.in | 1 + - tests/util/grub-fs-tester.in | 6 ++++- - 3 files changed, 63 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 44c7974..4d45edc 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -107,6 +107,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT2_DRIVER_SUPPORTED_INCOMPAT ( EXT2_FEATURE_INCOMPAT_FILETYPE \ - | EXT4_FEATURE_INCOMPAT_EXTENTS \ - | EXT4_FEATURE_INCOMPAT_FLEX_BG \ -+ | EXT2_FEATURE_INCOMPAT_META_BG \ - | EXT4_FEATURE_INCOMPAT_64BIT) - /* List of rationales for the ignored "incompatible" features: - * needs_recovery: Not really back-incompatible - was added as such to forbid -@@ -331,16 +332,68 @@ static grub_dl_t my_mod; - - - -+/* Check is a = b^x for some x. */ -+static inline int -+is_power_of (grub_uint64_t a, grub_uint32_t b) -+{ -+ grub_uint64_t c; -+ /* Prevent overflow assuming b < 8. */ -+ if (a >= (1LL << 60)) -+ return 0; -+ for (c = 1; c <= a; c *= b); -+ return (c == a); -+} -+ -+ -+static inline int -+group_has_super_block (struct grub_ext2_data *data, grub_uint64_t group) -+{ -+ if (!(data->sblock.feature_ro_compat -+ & grub_cpu_to_le32_compile_time(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))) -+ return 1; -+ /* Algorithm looked up in Linux source. */ -+ if (group <= 1) -+ return 1; -+ /* Even number is never a power of odd number. */ -+ if (!(group & 1)) -+ return 0; -+ return (is_power_of(group, 7) || is_power_of(group, 5) || -+ is_power_of(group, 3)); -+} -+ - /* Read into BLKGRP the blockgroup descriptor of blockgroup GROUP of - the mounted filesystem DATA. */ - inline static grub_err_t --grub_ext2_blockgroup (struct grub_ext2_data *data, int group, -+grub_ext2_blockgroup (struct grub_ext2_data *data, grub_uint64_t group, - struct grub_ext2_block_group *blkgrp) - { -+ grub_uint64_t full_offset = (group << data->log_group_desc_size); -+ grub_uint64_t block, offset; -+ block = (full_offset >> LOG2_BLOCK_SIZE (data)); -+ offset = (full_offset & ((1 << LOG2_BLOCK_SIZE (data)) - 1)); -+ if ((data->sblock.feature_incompat -+ & grub_cpu_to_le32_compile_time (EXT2_FEATURE_INCOMPAT_META_BG)) -+ && block >= grub_le_to_cpu32(data->sblock.first_meta_bg)) -+ { -+ grub_uint64_t first_block_group; -+ /* Find the first block group for which a descriptor -+ is stored in given block. */ -+ first_block_group = (block << (LOG2_BLOCK_SIZE (data) -+ - data->log_group_desc_size)); -+ -+ block = (first_block_group -+ * grub_le_to_cpu32(data->sblock.blocks_per_group)); -+ -+ if (group_has_super_block (data, first_block_group)) -+ block++; -+ } -+ else -+ /* Superblock. */ -+ block++; - return grub_disk_read (data->disk, -- ((grub_le_to_cpu32 (data->sblock.first_data_block) + 1) -- << LOG2_EXT2_BLOCK_SIZE (data)), -- group << data->log_group_desc_size, -+ ((grub_le_to_cpu32 (data->sblock.first_data_block) -+ + block) -+ << LOG2_EXT2_BLOCK_SIZE (data)), offset, - sizeof (struct grub_ext2_block_group), blkgrp); - } - -diff --git a/tests/ext234_test.in b/tests/ext234_test.in -index 8910b71..c986960 100644 ---- a/tests/ext234_test.in -+++ b/tests/ext234_test.in -@@ -29,3 +29,4 @@ fi - "@builddir@/grub-fs-tester" ext2 - "@builddir@/grub-fs-tester" ext3 - "@builddir@/grub-fs-tester" ext4 -+"@builddir@/grub-fs-tester" ext4_metabg -diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in -index 5656927..9ecbe0f 100644 ---- a/tests/util/grub-fs-tester.in -+++ b/tests/util/grub-fs-tester.in -@@ -281,7 +281,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - #FSLABEL="g;/_é莭ð¯¦ðŸ˜ÐºÐ¸Ñ‚ u" - ;; - # FS LIMITATION: reiserfs, extN and jfs label is at most 16 UTF-8 characters -- x"reiserfs_old" | x"reiserfs" | x"ext2" | xext2_old | x"ext3" | x"ext4" | x"lvm"* | x"mdraid"* | x"jfs" | x"jfs_caseins") -+ x"reiserfs_old" | x"reiserfs" | x"ext"* | x"lvm"* | x"mdraid"* | x"jfs" | x"jfs_caseins") - FSLABEL="g;/éт 莭ðŸ˜";; - # FS LIMITATION: No underscore, space, semicolon, slash or international characters in UFS* in label. Limited to 32 UTF-8 characters - x"ufs1" | x"ufs1_sun" | x"ufs2") -@@ -746,6 +746,10 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext2" -r 0 -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" - MOUNTFS=ext2 - ;; -+ xext4_metabg) -+ MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O meta_bg,^resize_inode -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" -+ MOUNTFS=ext4 -+ ;; - xext*) - MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.$fs" -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" ;; - xxfs) --- -2.4.3 - diff --git a/0294-ext2-Ignore-INCOMPAT_MMP.patch b/0294-ext2-Ignore-INCOMPAT_MMP.patch deleted file mode 100644 index d182537..0000000 --- a/0294-ext2-Ignore-INCOMPAT_MMP.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 5537a586e0b92b94910d0170a128ae8a85787713 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 16 Feb 2015 21:08:37 +0100 -Subject: [PATCH 294/506] ext2: Ignore INCOMPAT_MMP. - -It's not really incompatible as long as driver never writes to FS. ---- - grub-core/fs/ext2.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 4d45edc..5199cb0 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -100,6 +100,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 - #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* Extents used */ - #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 -+#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 - #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 - - /* The set of back-incompatible features this driver DOES support. Add (OR) -@@ -115,8 +116,13 @@ GRUB_MOD_LICENSE ("GPLv3+"); - * journal because they will ignore the journal, but the next - * ext3 driver to mount the volume will find the journal and - * replay it, potentially corrupting the metadata written by -- * the ext2 drivers. Safe to ignore for this RO driver. */ --#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER ) -+ * the ext2 drivers. Safe to ignore for this RO driver. -+ * mmp: Not really back-incompatible - was added as such to -+ * avoid multiple read-write mounts. Safe to ignore for this -+ * RO driver. -+ */ -+#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ -+ | EXT4_FEATURE_INCOMPAT_MMP) - - - #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U --- -2.4.3 - diff --git a/0295-configure-Add-missing-comma.patch b/0295-configure-Add-missing-comma.patch deleted file mode 100644 index d381fab..0000000 --- a/0295-configure-Add-missing-comma.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 86f05f1491b87550d69adbd003b9975ad7222557 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Feb 2015 21:29:35 +0100 -Subject: [PATCH 295/506] configure: Add missing comma. - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 6d31ed0..9f54158 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -552,7 +552,7 @@ int main (void); - - TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags" - --AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang] -+AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang], - [ - CFLAGS="$TARGET_CFLAGS" - AC_COMPILE_IFELSE( --- -2.4.3 - diff --git a/0296-configure-Move-adding-of-include-options-to-the-very.patch b/0296-configure-Move-adding-of-include-options-to-the-very.patch deleted file mode 100644 index 80fb02b..0000000 --- a/0296-configure-Move-adding-of-include-options-to-the-very.patch +++ /dev/null @@ -1,43 +0,0 @@ -From b46bf3cd1c3682df0a6460dcee95ce4d9da4d1fd Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Feb 2015 21:30:34 +0100 -Subject: [PATCH 296/506] configure: Move adding of include options to the very - end to avoid subshell. - ---- - configure.ac | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 9f54158..8945afa 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -78,12 +78,9 @@ fi - - # Default HOST_CPPFLAGS - HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" --HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" - HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" - - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" --TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" --TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" - - case "$target_cpu" in - i[[3456]]86) target_cpu=i386 ;; -@@ -1643,6 +1640,12 @@ fi - TARGET_CPP="$TARGET_CC -E" - TARGET_CCAS=$TARGET_CC - -+# Includes which include make-time substitutions. They must come last -+# as to avoid executing top_builddir in shell. -+HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" -+TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" -+TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" -+ - GRUB_TARGET_CPU="${target_cpu}" - GRUB_PLATFORM="${platform}" - --- -2.4.3 - diff --git a/0297-Strip-.MIPS.abiflags-which-causes-compile-failure.patch b/0297-Strip-.MIPS.abiflags-which-causes-compile-failure.patch deleted file mode 100644 index 96b5071..0000000 --- a/0297-Strip-.MIPS.abiflags-which-causes-compile-failure.patch +++ /dev/null @@ -1,39 +0,0 @@ -From e3c7aca76d5a3467f1bf0736dcd439a0d6f55ae9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:01:53 +0100 -Subject: [PATCH 297/506] Strip .MIPS.abiflags which causes compile failure - ---- - conf/Makefile.common | 2 +- - gentpl.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 8c4d148..66c9fdb 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -45,7 +45,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC) - CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 - CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) --STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -+STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags - - CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d -diff --git a/gentpl.py b/gentpl.py -index bdcae1a..c986cec 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -753,7 +753,7 @@ def image(defn, platform): - if test x$(TARGET_APPLE_LINKER) = x1; then \ - $(MACHO2IMG) $< $@; \ - else \ -- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ -+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ - fi - """) - --- -2.4.3 - diff --git a/0298-INSTALL-Fix-names-of-host-flags-to-match-actual-beha.patch b/0298-INSTALL-Fix-names-of-host-flags-to-match-actual-beha.patch deleted file mode 100644 index b47c667..0000000 --- a/0298-INSTALL-Fix-names-of-host-flags-to-match-actual-beha.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d93147abb70fba583091ac6ec0426a0bf504d697 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:03:11 +0100 -Subject: [PATCH 298/506] INSTALL: Fix names of host flags to match actual - behaviour - ---- - INSTALL | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/INSTALL b/INSTALL -index f6f276c..05cc443 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -175,9 +175,9 @@ corresponding platform are not needed for the platform in question. - - For host - 1. --host= to autoconf name of host. - 2. CC= for gcc able to compile for host -- 3. CFLAGS= for C options for host. -- 4. CPPFLAGS= for C preprocessor options for host. -- 5. LDFLAGS= for linker options for host. -+ 3. HOST_CFLAGS= for C options for host. -+ 4. HOST_CPPFLAGS= for C preprocessor options for host. -+ 5. HOST_LDFLAGS= for linker options for host. - 6. FREETYPE= for freetype-config for host (optional). - 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional). - 8. Libfuse if any must be in standard linker folders (-lfuse) (optional). --- -2.4.3 - diff --git a/0299-div_test-Don-t-try-to-divide-by-zero.patch b/0299-div_test-Don-t-try-to-divide-by-zero.patch deleted file mode 100644 index d968715..0000000 --- a/0299-div_test-Don-t-try-to-divide-by-zero.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2426ac36d3b42b6be507bde733c4bbd58883fe09 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:05:45 +0100 -Subject: [PATCH 299/506] div_test: Don't try to divide by zero - ---- - grub-core/tests/div_test.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/tests/div_test.c b/grub-core/tests/div_test.c -index 1928f85..7bdc80b 100644 ---- a/grub-core/tests/div_test.c -+++ b/grub-core/tests/div_test.c -@@ -34,6 +34,8 @@ static void - test32 (grub_uint32_t a, grub_uint32_t b) - { - grub_uint64_t q, r; -+ if (b == 0) -+ return; - q = grub_divmod64 (a, b, &r); - grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx", - (long long) a, (long long) b, (long long) r); --- -2.4.3 - diff --git a/0300-Provide-__aeabi_mem-cpy-set.patch b/0300-Provide-__aeabi_mem-cpy-set.patch deleted file mode 100644 index dd9d783..0000000 --- a/0300-Provide-__aeabi_mem-cpy-set.patch +++ /dev/null @@ -1,45 +0,0 @@ -From aee2502cb54d29d7d86240be7259895bdee15d07 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:07:59 +0100 -Subject: [PATCH 300/506] Provide __aeabi_mem{cpy,set} - -Fixes ARM compilation ---- - grub-core/kern/misc.c | 4 ++++ - include/grub/misc.h | 5 +++++ - 2 files changed, 9 insertions(+) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index c5c815d..883d353 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -735,6 +735,10 @@ __ctzsi2 (grub_uint32_t x) - grub_uint32_t - __aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) - __attribute__ ((alias ("__udivsi3"))); -+void *__aeabi_memcpy (void *dest, const void *src, grub_size_t n) -+ __attribute__ ((alias ("grub_memcpy"))); -+void *__aeabi_memset (void *s, int c, grub_size_t n) -+ __attribute__ ((alias ("grub_memset"))); - #endif - - #if defined (__ia64__) -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 4b6ee06..e35934c 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -469,6 +469,11 @@ EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); - grub_uint64_t - EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); - -+void * -+EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); -+void * -+EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); -+ - #endif - - #if defined (__ia64__) --- -2.4.3 - diff --git a/0301-mips-startup_raw-Use-more-portable-.asciz.patch b/0301-mips-startup_raw-Use-more-portable-.asciz.patch deleted file mode 100644 index e733bde..0000000 --- a/0301-mips-startup_raw-Use-more-portable-.asciz.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e5851b63e0b84cc648faaeff50d6300a16f9236a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:09:46 +0100 -Subject: [PATCH 301/506] mips/startup_raw: Use more portable .asciz - ---- - grub-core/boot/mips/startup_raw.S | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/grub-core/boot/mips/startup_raw.S b/grub-core/boot/mips/startup_raw.S -index 29e93c1..c169ca3 100644 ---- a/grub-core/boot/mips/startup_raw.S -+++ b/grub-core/boot/mips/startup_raw.S -@@ -150,18 +150,18 @@ digcont: - 1: - jr $ra - nop --busclockstr: .asciiz "busclock=" --cpuclockstr: .asciiz "cpuclock=" --memsizestr: .asciiz "memsize=" --highmemsizestr: .asciiz "highmemsize=" --machtype_yeeloong_str1: .asciiz "machtype=8.9" --machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-" --machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f" --machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e" --pmon_yeeloong_str: .asciiz "PMON_VER=LM8" --pmon_fuloong2f_str: .asciiz "PMON_VER=LM6" --pmon_yeeloong_verstr: .asciiz "Version=LM8" --pmon_fuloong2f_verstr: .asciiz "Version=LM6" -+busclockstr: .asciz "busclock=" -+cpuclockstr: .asciz "cpuclock=" -+memsizestr: .asciz "memsize=" -+highmemsizestr: .asciz "highmemsize=" -+machtype_yeeloong_str1: .asciz "machtype=8.9" -+machtype_yeeloong_str2: .asciz "machtype=lemote-yeeloong-" -+machtype_fuloong2f_str: .asciz "machtype=lemote-fuloong-2f" -+machtype_fuloong2e_str: .asciz "machtype=lemote-fuloong-2e" -+pmon_yeeloong_str: .asciz "PMON_VER=LM8" -+pmon_fuloong2f_str: .asciz "PMON_VER=LM6" -+pmon_yeeloong_verstr: .asciz "Version=LM8" -+pmon_fuloong2f_verstr: .asciz "Version=LM6" - .p2align 2 - - argdone: --- -2.4.3 - diff --git a/0302-configure-Add-msoft-float-to-CCASFLAGS.patch b/0302-configure-Add-msoft-float-to-CCASFLAGS.patch deleted file mode 100644 index 11ac584..0000000 --- a/0302-configure-Add-msoft-float-to-CCASFLAGS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ef7c843b443da6aac23cac6d73f90a951dff7436 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:13:11 +0100 -Subject: [PATCH 302/506] configure: Add -msoft-float to CCASFLAGS - -Otherwise mismatch between API flags triggers linker failure ---- - configure.ac | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configure.ac b/configure.ac -index 8945afa..4ef67f0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -679,6 +679,7 @@ if test "x$target_cpu" = xarm64; then - TARGET_CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd" - else - TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -msoft-float" - fi - - # By default, GCC 4.4 generates .eh_frame sections containing unwind --- -2.4.3 - diff --git a/0303-ofdisk-Exclude-floppies-from-scanning.patch b/0303-ofdisk-Exclude-floppies-from-scanning.patch deleted file mode 100644 index 03f6637..0000000 --- a/0303-ofdisk-Exclude-floppies-from-scanning.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 967e5aa591cdd3bd462ffca4028c00e6a6dbc96d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:16:48 +0100 -Subject: [PATCH 303/506] ofdisk: Exclude floppies from scanning. - -It causes similar hang as CD on at least the qemu. ---- - grub-core/disk/ieee1275/ofdisk.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 6870b39..5d88637 100644 ---- a/grub-core/disk/ieee1275/ofdisk.c -+++ b/grub-core/disk/ieee1275/ofdisk.c -@@ -34,7 +34,7 @@ struct ofdisk_hash_ent - char *open_path; - char *grub_devpath; - int is_boot; -- int is_cdrom; -+ int is_removable; - /* Pointer to shortest available name on nodes representing canonical names, - otherwise NULL. */ - const char *shortest; -@@ -123,7 +123,7 @@ ofdisk_hash_add_real (char *devpath) - } - - static int --check_string_cdrom (const char *str) -+check_string_removable (const char *str) - { - const char *ptr = grub_strrchr (str, '/'); - -@@ -131,7 +131,7 @@ check_string_cdrom (const char *str) - ptr++; - else - ptr = str; -- return (grub_strncmp (ptr, "cdrom", 5) == 0); -+ return (grub_strncmp (ptr, "cdrom", 5) == 0 || grub_strncmp (ptr, "fd", 2) == 0); - } - - static struct ofdisk_hash_ent * -@@ -147,8 +147,8 @@ ofdisk_hash_add (char *devpath, char *curcan) - { - p->shortest = p->devpath; - p->grub_shortest = p->grub_devpath; -- if (check_string_cdrom (devpath)) -- p->is_cdrom = 1; -+ if (check_string_removable (devpath)) -+ p->is_removable = 1; - return p; - } - -@@ -158,8 +158,8 @@ ofdisk_hash_add (char *devpath, char *curcan) - else - grub_free (curcan); - -- if (check_string_cdrom (devpath) || check_string_cdrom (curcan)) -- pcan->is_cdrom = 1; -+ if (check_string_removable (devpath) || check_string_removable (curcan)) -+ pcan->is_removable = 1; - - if (!pcan) - grub_errno = GRUB_ERR_NONE; -@@ -330,7 +330,7 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, - } - } - -- if (!ent->is_boot && ent->is_cdrom) -+ if (!ent->is_boot && ent->is_removable) - continue; - - if (hook (ent->grub_shortest, hook_data)) --- -2.4.3 - diff --git a/0304-wildcard-Mark-unused-argument-as-such.patch b/0304-wildcard-Mark-unused-argument-as-such.patch deleted file mode 100644 index 8be1378..0000000 --- a/0304-wildcard-Mark-unused-argument-as-such.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ec65605af487d702577bfba214c27efd1a0d8b73 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:19:09 +0100 -Subject: [PATCH 304/506] wildcard: Mark unused argument as such. - ---- - grub-core/commands/wildcard.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index d207acf..9b4e727 100644 ---- a/grub-core/commands/wildcard.c -+++ b/grub-core/commands/wildcard.c -@@ -293,7 +293,8 @@ struct match_files_ctx - - /* Helper for match_files. */ - static int --match_files_iter (const char *name, const struct grub_dirhook_info *info, -+match_files_iter (const char *name, -+ const struct grub_dirhook_info *info __attribute__((unused)), - void *data) - { - struct match_files_ctx *ctx = data; --- -2.4.3 - diff --git a/0305-zfs-mzap_lookup-Fix-argument-types.patch b/0305-zfs-mzap_lookup-Fix-argument-types.patch deleted file mode 100644 index 6fcc587..0000000 --- a/0305-zfs-mzap_lookup-Fix-argument-types.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 87a04adb6541c4bf169644bb2f84036a7c8558dd Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:22:01 +0100 -Subject: [PATCH 305/506] zfs/mzap_lookup: Fix argument types - ---- - grub-core/fs/zfs/zfs.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 057b471..0cbb84b 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -2013,12 +2013,14 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, - */ - static grub_err_t - mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian, -- int objsize, const char *name, grub_uint64_t * value, -+ grub_uint16_t objsize, const char *name, grub_uint64_t * value, - int case_insensitive) - { -- int i, chunks; -+ grub_uint16_t i, chunks; - mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; - -+ if (objsize < MZAP_ENT_LEN) -+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name); - chunks = objsize / MZAP_ENT_LEN - 1; - for (i = 0; i < chunks; i++) - { -@@ -2426,7 +2428,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, - struct grub_zfs_data *data, int case_insensitive) - { - grub_uint64_t block_type; -- int size; -+ grub_uint16_t size; - void *zapbuf; - grub_err_t err; - grub_zfs_endian_t endian; --- -2.4.3 - diff --git a/0306-INSTALL-clarify-that-clang-support-is-experimental.patch b/0306-INSTALL-clarify-that-clang-support-is-experimental.patch deleted file mode 100644 index fda791b..0000000 --- a/0306-INSTALL-clarify-that-clang-support-is-experimental.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0b02bfa034be0102507fd1df56d577c9c1892df1 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:22:48 +0100 -Subject: [PATCH 306/506] INSTALL: clarify that clang support is experimental - ---- - INSTALL | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/INSTALL b/INSTALL -index 05cc443..afbb660 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -13,6 +13,9 @@ configuring the GRUB. - - * GCC 4.1.3 or later - Note: older versions may work but support is limited -+ -+ Experimental support for clang 3.3 or later (results in much bigger binaries) -+ for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc - Note: clang 3.2 or later works for i386 and x86_64 targets but results in - much bigger binaries. - earlier versions not tested --- -2.4.3 - diff --git a/0307-Test-which-flags-make-our-asm-compile.patch b/0307-Test-which-flags-make-our-asm-compile.patch deleted file mode 100644 index 2144084..0000000 --- a/0307-Test-which-flags-make-our-asm-compile.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 065ad910f1938fb8c02a14fe020819ed28429bad Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 16:29:28 +0100 -Subject: [PATCH 307/506] Test which flags make our asm compile. - -Previously we relied on assumption that clang always needs -no-integrated-as -but it's not always true. ---- - asm-tests/arm.S | 20 ++++++++++++++++++ - asm-tests/i386.S | 10 +++++++++ - asm-tests/mips.S | 11 ++++++++++ - asm-tests/powerpc.S | 8 +++++++ - asm-tests/sparc64.S | 9 ++++++++ - configure.ac | 60 ++++++++++++++++++++++++++++------------------------- - 6 files changed, 90 insertions(+), 28 deletions(-) - create mode 100644 asm-tests/arm.S - create mode 100644 asm-tests/i386.S - create mode 100644 asm-tests/mips.S - create mode 100644 asm-tests/powerpc.S - create mode 100644 asm-tests/sparc64.S - -diff --git a/asm-tests/arm.S b/asm-tests/arm.S -new file mode 100644 -index 0000000..97c2546 ---- /dev/null -+++ b/asm-tests/arm.S -@@ -0,0 +1,20 @@ -+/* on arm clang doesn't support .arch directive */ -+ -+ .text -+ .syntax unified -+ -+#if !defined (__thumb2__) -+ .arch armv7a -+ .arm -+#else -+ .arch armv7 -+ .thumb -+#endif -+ mcr p15, 0, r11, c7, c14, 2 -+ -+ /* clang restricts access to dsb/isb despite .arch */ -+ dsb -+ isb -+ -+ -+ -diff --git a/asm-tests/i386.S b/asm-tests/i386.S -new file mode 100644 -index 0000000..97cd32a ---- /dev/null -+++ b/asm-tests/i386.S -@@ -0,0 +1,10 @@ -+/* on x86 old clang doesn't support .code16 -+ newer clang supports it but creates 6-byte jumps instead of 3-byte ones -+ which makes us go over boot sector size. */ -+ -+ .code16 -+ jmp far -+ .org 4 -+ .space 300 -+far: -+ .byte 0 -diff --git a/asm-tests/mips.S b/asm-tests/mips.S -new file mode 100644 -index 0000000..8233dfc ---- /dev/null -+++ b/asm-tests/mips.S -@@ -0,0 +1,11 @@ -+/* on mips clang doesn't support privilegied instructions, doubleword store/load -+ and crashes with hand-written assembly -+ */ -+ -+ .set mips3 -+ sync -+ ld $t2, 0($t6) -+ -+a: -+ addiu $t7, $s0, (b - a) -+b: nop -diff --git a/asm-tests/powerpc.S b/asm-tests/powerpc.S -new file mode 100644 -index 0000000..396a6cc ---- /dev/null -+++ b/asm-tests/powerpc.S -@@ -0,0 +1,8 @@ -+/* clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly -+ used by gcrypt */ -+/* Cache invalidation loop is a fair test. */ -+ li 5, 0 -+1: icbi 5, 3 -+ addi 5, 5, 32 -+ cmpw 5, 4 -+ blt 1b -diff --git a/asm-tests/sparc64.S b/asm-tests/sparc64.S -new file mode 100644 -index 0000000..03c5fe0 ---- /dev/null -+++ b/asm-tests/sparc64.S -@@ -0,0 +1,9 @@ -+ .text -+1: -+ /* A small list of examples of what clang doesn't support. */ -+ clr %o0 -+ lduw [%o4 + 4], %o4 -+ and %o6, ~0xff, %o6 -+ stw %o5, [%o3] -+ bne,pt %icc, 1b -+ nop -diff --git a/configure.ac b/configure.ac -index 4ef67f0..40b7329 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -560,35 +560,39 @@ AC_COMPILE_IFELSE( - ]])], - [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])]) - --# on x86 clang doesn't support .code16 --# on arm clang doesn't support .arch directive --# on mips clang doesn't support privilegied instructions, doubleword store/load --# and crashes with hand-written assembly --if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \ -- || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \ -- || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" --fi -- --if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then --AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame] --[ --CFLAGS="$TARGET_CFLAGS" --AC_COMPILE_IFELSE( --[AC_LANG_PROGRAM([], [[ -- unsigned int a = 0, b = 0; -- asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b)); -- if (a) -- return 1; --]])], --[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])]) -- # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly -- # used by gcrypt -- if test x$grub_cv_cc_target_clang_ame = xno ; then -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" -- TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as" -- fi -+AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ -+test_program= -+case "x$target_cpu" in -+ xmips | xmipsel) -+ test_program=mips -+ ;; -+ xi386 | xx86_64) -+ test_program=i386 -+ ;; -+ xpowerpc | xsparc64 | xarm) -+ test_program=$target_cpu -+ ;; -+esac -+if test x"$test_program" = x ; then -+ grub_cv_cc_target_asm_compile= -+else -+ found=no -+ for arg in "" "-no-integrated-as"; do -+ cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S" -+ echo "Running $cmdline" >&AS_MESSAGE_LOG_FD -+ if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then -+ grub_cv_cc_target_asm_compile="$arg" -+ found=yes -+ break -+ fi -+ done -+ if test x"$found" = xno ; then -+ AC_MSG_ERROR([could not compile assembly]) -+ fi - fi -+]) -+ -+TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_cc_target_asm_compile" - - if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then - TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" --- -2.4.3 - diff --git a/0308-i386-Move-from-explicit-ADDR32-DATA32-prefixes-to-in.patch b/0308-i386-Move-from-explicit-ADDR32-DATA32-prefixes-to-in.patch deleted file mode 100644 index 25f65f9..0000000 --- a/0308-i386-Move-from-explicit-ADDR32-DATA32-prefixes-to-in.patch +++ /dev/null @@ -1,114 +0,0 @@ -From f571dc1af85e2044141a1dfff3af85a18c30fcd5 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 17:13:23 +0100 -Subject: [PATCH 308/506] i386: Move from explicit ADDR32/DATA32 prefixes to - instruction suffixes. - -Is more portable. -Binary is unchanged (verified). ---- - grub-core/boot/i386/pc/startup_raw.S | 4 ++-- - grub-core/boot/i386/qemu/boot.S | 2 +- - grub-core/kern/i386/pc/startup.S | 2 +- - grub-core/kern/i386/realmode.S | 10 +++++----- - 4 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S -index 2796740..812ff54 100644 ---- a/grub-core/boot/i386/pc/startup_raw.S -+++ b/grub-core/boot/i386/pc/startup_raw.S -@@ -95,7 +95,7 @@ LOCAL (codestart): - int $0x13 - - /* transition to protected mode */ -- DATA32 call real_to_prot -+ calll real_to_prot - - /* The ".code32" directive takes GAS out of 16-bit mode. */ - .code32 -@@ -149,7 +149,7 @@ gate_a20_try_bios: - movw $0x2401, %ax - int $0x15 - -- DATA32 call real_to_prot -+ calll real_to_prot - .code32 - - popl %ebp -diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S -index bdd68c7..8d97fc1 100644 ---- a/grub-core/boot/i386/qemu/boot.S -+++ b/grub-core/boot/i386/qemu/boot.S -@@ -48,7 +48,7 @@ VARIABLE(grub_core_entry_addr) - /* Transition to protected mode. We use pushl to force generation - of a flat return address. */ - pushl $1f -- DATA32 jmp real_to_prot -+ jmpl real_to_prot - .code32 - /* Ensure A20 is enabled. We're in qemu, so control port A works - and there is no need to wait since there is no real logic, it's -diff --git a/grub-core/kern/i386/pc/startup.S b/grub-core/kern/i386/pc/startup.S -index 6bb36c6..b8a9b33 100644 ---- a/grub-core/kern/i386/pc/startup.S -+++ b/grub-core/kern/i386/pc/startup.S -@@ -135,7 +135,7 @@ LOCAL(prot_to_real_addr): - - .macro REAL_TO_PROT - movl LOCAL(real_to_prot_addr), %eax -- DATA32 call *%ax -+ calll *%eax - .endm - - /* -diff --git a/grub-core/kern/i386/realmode.S b/grub-core/kern/i386/realmode.S -index 541cedc..732697c 100644 ---- a/grub-core/kern/i386/realmode.S -+++ b/grub-core/kern/i386/realmode.S -@@ -54,7 +54,7 @@ protstack: - .endm - - .macro REAL_TO_PROT -- DATA32 call real_to_prot -+ calll real_to_prot - .endm - - /* -@@ -137,7 +137,7 @@ real_to_prot: - /* load the GDT register */ - xorw %ax, %ax - movw %ax, %ds -- DATA32 ADDR32 lgdt gdtdesc -+ ADDR32 lgdtl gdtdesc - - /* turn on protected mode */ - movl %cr0, %eax -@@ -145,7 +145,7 @@ real_to_prot: - movl %eax, %cr0 - - /* jump to relocation, flush prefetch queue, and reload %cs */ -- DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg -+ ljmpl $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg - - .code32 - protcseg: -@@ -237,7 +237,7 @@ tmpcseg: - movl %eax, %cr0 - - /* flush prefetch queue, reload %cs */ -- DATA32 ljmp $0, $realcseg -+ ljmpl $0, $realcseg - - realcseg: - /* we are in real mode now -@@ -258,6 +258,6 @@ realcseg: - #endif - - /* return on new stack! */ -- DATA32 ret -+ retl - - .code32 --- -2.4.3 - diff --git a/0309-Change-dot-assignmnet-to-more-portable-.org.patch b/0309-Change-dot-assignmnet-to-more-portable-.org.patch deleted file mode 100644 index 7199d4e..0000000 --- a/0309-Change-dot-assignmnet-to-more-portable-.org.patch +++ /dev/null @@ -1,199 +0,0 @@ -From bc29c6d019c8645e6da843c78ba522f17165e808 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 17:19:01 +0100 -Subject: [PATCH 309/506] Change dot assignmnet to more portable .org. - -Binary is unchanged (verified) ---- - grub-core/boot/i386/pc/boot.S | 20 ++++++++++---------- - grub-core/boot/i386/pc/cdboot.S | 4 ++-- - grub-core/boot/i386/pc/diskboot.S | 2 +- - grub-core/boot/i386/pc/lnxboot.S | 4 ++-- - grub-core/boot/i386/pc/pxeboot.S | 2 +- - grub-core/boot/i386/pc/startup_raw.S | 10 +++++----- - 6 files changed, 21 insertions(+), 21 deletions(-) - -diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index b4975e2..d17a138 100644 ---- a/grub-core/boot/i386/pc/boot.S -+++ b/grub-core/boot/i386/pc/boot.S -@@ -165,8 +165,8 @@ start: - * this area. - */ - -- . = _start + GRUB_BOOT_MACHINE_BPB_START -- . = _start + 4 -+ .org GRUB_BOOT_MACHINE_BPB_START -+ .org 4 - #endif - #ifdef HYBRID_BOOT - floppy -@@ -174,7 +174,7 @@ start: - scratch - #endif - -- . = _start + GRUB_BOOT_MACHINE_BPB_END -+ .org GRUB_BOOT_MACHINE_BPB_END - /* - * End of BIOS parameter block. - */ -@@ -183,14 +183,14 @@ kernel_address: - .word GRUB_BOOT_MACHINE_KERNEL_ADDR - - #ifndef HYBRID_BOOT -- . = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR -+ .org GRUB_BOOT_MACHINE_KERNEL_SECTOR - kernel_sector: - .long 1 - kernel_sector_high: - .long 0 - #endif - -- . = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE -+ .org GRUB_BOOT_MACHINE_BOOT_DRIVE - boot_drive: - .byte 0xff /* the disk to load kernel from */ - /* 0xff means use the boot drive */ -@@ -208,7 +208,7 @@ LOCAL(after_BPB): - * possible boot drive. If GRUB is installed into a floppy, - * this does nothing (only jump). - */ -- . = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK -+ .org GRUB_BOOT_MACHINE_DRIVE_CHECK - boot_drive_check: - jmp 3f /* grub-setup may overwrite this jump */ - testb $0x80, %dl -@@ -511,13 +511,13 @@ LOCAL(message): - */ - - #ifdef HYBRID_BOOT -- . = _start + 0x1b0 -+ .org 0x1b0 - kernel_sector: - .long 1 - kernel_sector_high: - .long 0 - #endif -- . = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC -+ .org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC - nt_magic: - .long 0 - .word 0 -@@ -528,7 +528,7 @@ nt_magic: - * sneaky, huh? - */ - -- . = _start + GRUB_BOOT_MACHINE_PART_START -+ .org GRUB_BOOT_MACHINE_PART_START - - #ifndef HYBRID_BOOT - floppy -@@ -536,7 +536,7 @@ nt_magic: - scratch - #endif - -- . = _start + GRUB_BOOT_MACHINE_PART_END -+ .org GRUB_BOOT_MACHINE_PART_END - - /* the last 2 bytes in the sector 0 contain the signature */ - .word GRUB_BOOT_MACHINE_SIGNATURE -diff --git a/grub-core/boot/i386/pc/cdboot.S b/grub-core/boot/i386/pc/cdboot.S -index 92df7c7..de4f809 100644 ---- a/grub-core/boot/i386/pc/cdboot.S -+++ b/grub-core/boot/i386/pc/cdboot.S -@@ -43,7 +43,7 @@ _start: - LOCAL(next): - jmp 1f - -- . = start + 8 -+ .org 8 - - bi_pvd: - .long 0 /* LBA of primary volume descriptor. */ -@@ -168,6 +168,6 @@ err_noboot_msg: - err_cdfail_msg: - .ascii "cdrom read fails\0" - -- . = start + 0x7FF -+ .org 0x7FF - - .byte 0 -diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index d030a14..1ee4cf5 100644 ---- a/grub-core/boot/i386/pc/diskboot.S -+++ b/grub-core/boot/i386/pc/diskboot.S -@@ -362,7 +362,7 @@ LOCAL(message): - .word 0 - .word 0 - -- . = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE -+ .org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE - LOCAL(firstlist): /* this label has to be before the first list entry!!! */ - /* fill the first data listing with the default */ - blocklist_default_start: -diff --git a/grub-core/boot/i386/pc/lnxboot.S b/grub-core/boot/i386/pc/lnxboot.S -index 87e56a2..2dda0e0 100644 ---- a/grub-core/boot/i386/pc/lnxboot.S -+++ b/grub-core/boot/i386/pc/lnxboot.S -@@ -41,7 +41,7 @@ data_start: - xorl %ebp, %ebp - jmp LOCAL(linux_next) - -- . = data_start + 0x1F1 -+ .org 0x1F1 - - setup_sects: - .byte CODE_SECTORS -@@ -292,4 +292,4 @@ LOCAL(fail): - err_int15_msg: - .ascii "move memory fails\0" - -- . = _start + CODE_SECTORS * 512 -+ .org (CODE_SECTORS * 512 + 512) -diff --git a/grub-core/boot/i386/pc/pxeboot.S b/grub-core/boot/i386/pc/pxeboot.S -index 446bfc7..b695b24 100644 ---- a/grub-core/boot/i386/pc/pxeboot.S -+++ b/grub-core/boot/i386/pc/pxeboot.S -@@ -38,5 +38,5 @@ start: - /* This region is a junk. Do you say that this is wasteful? - But I like that the memory layout of the body is consistent - among different kernels rather than scamping just for 1.5KB. */ -- . = _start + 0x8200 - 0x7C00 - 0x200 - 1 -+ .org 0x8200 - 0x7C00 - 0x200 - 1 - .byte 0 -diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S -index 812ff54..0f8806c 100644 ---- a/grub-core/boot/i386/pc/startup_raw.S -+++ b/grub-core/boot/i386/pc/startup_raw.S -@@ -50,23 +50,23 @@ LOCAL (base): - * This is a special data area. - */ - -- . = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE -+ .org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - LOCAL(compressed_size): - .long 0 -- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE -+ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - LOCAL(uncompressed_size): - .long 0 - -- . = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY -+ .org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY - reed_solomon_redundancy: - .long 0 -- . = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH -+ .org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH - .short (LOCAL(reed_solomon_part) - _start) - - /* - * This is the area for all of the special variables. - */ -- . = _start + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE -+ .org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE - LOCAL(boot_dev): - .byte 0xFF, 0xFF, 0xFF - LOCAL(boot_drive): --- -2.4.3 - diff --git a/0310-i386-pc-boot-Explicitly-mark-kernel_address-_high-as.patch b/0310-i386-pc-boot-Explicitly-mark-kernel_address-_high-as.patch deleted file mode 100644 index 3aa7c78..0000000 --- a/0310-i386-pc-boot-Explicitly-mark-kernel_address-_high-as.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 1998d63688080e59abda2092ff4b58a1eeb19b90 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 17:20:10 +0100 -Subject: [PATCH 310/506] i386-pc/boot: Explicitly mark kernel_address[_high] - as local. - -Otherwise apple asm might try to make accesses relocatable. ---- - grub-core/boot/i386/pc/boot.S | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index d17a138..2bd0b2d 100644 ---- a/grub-core/boot/i386/pc/boot.S -+++ b/grub-core/boot/i386/pc/boot.S -@@ -179,14 +179,14 @@ start: - * End of BIOS parameter block. - */ - --kernel_address: -+LOCAL(kernel_address): - .word GRUB_BOOT_MACHINE_KERNEL_ADDR - - #ifndef HYBRID_BOOT - .org GRUB_BOOT_MACHINE_KERNEL_SECTOR --kernel_sector: -+LOCAL(kernel_sector): - .long 1 --kernel_sector_high: -+LOCAL(kernel_sector_high): - .long 0 - #endif - -@@ -275,7 +275,7 @@ real_start: - andw $1, %cx - jz LOCAL(chs_mode) - --lba_mode: -+LOCAL(lba_mode): - xorw %ax, %ax - movw %ax, 4(%si) - -@@ -290,9 +290,9 @@ lba_mode: - movw $0x0010, (%si) - - /* the absolute address */ -- movl kernel_sector, %ebx -+ movl LOCAL(kernel_sector), %ebx - movl %ebx, 8(%si) -- movl kernel_sector_high, %ebx -+ movl LOCAL(kernel_sector_high), %ebx - movl %ebx, 12(%si) - - /* the segment of buffer address */ -@@ -361,13 +361,13 @@ LOCAL(final_init): - - setup_sectors: - /* load logical sector start (top half) */ -- movl kernel_sector_high, %eax -+ movl LOCAL(kernel_sector_high), %eax - - orl %eax, %eax - jnz LOCAL(geometry_error) - - /* load logical sector start (bottom half) */ -- movl kernel_sector, %eax -+ movl LOCAL(kernel_sector), %eax - - /* zero %edx */ - xorl %edx, %edx -@@ -452,7 +452,7 @@ LOCAL(copy_buffer): - popa - - /* boot kernel */ -- jmp *(kernel_address) -+ jmp *(LOCAL(kernel_address)) - - /* END OF MAIN LOOP */ - -@@ -512,9 +512,9 @@ LOCAL(message): - - #ifdef HYBRID_BOOT - .org 0x1b0 --kernel_sector: -+LOCAL(kernel_sector): - .long 1 --kernel_sector_high: -+LOCAL(kernel_sector_high): - .long 0 - #endif - .org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC --- -2.4.3 - diff --git a/0311-i386-Remove-needless-ADDR32-prefixes-when-address-is.patch b/0311-i386-Remove-needless-ADDR32-prefixes-when-address-is.patch deleted file mode 100644 index 7b8f6f0..0000000 --- a/0311-i386-Remove-needless-ADDR32-prefixes-when-address-is.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 37353f0ae5b9a4123ca9fe132a2336c08f30615a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 17:38:56 +0100 -Subject: [PATCH 311/506] i386: Remove needless ADDR32 prefixes when address is - known and fixed. - -Shaves off 6 bytes in lzma_decompress.img. ---- - grub-core/boot/i386/pc/startup_raw.S | 2 +- - grub-core/kern/i386/realmode.S | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S -index 0f8806c..8bce798 100644 ---- a/grub-core/boot/i386/pc/startup_raw.S -+++ b/grub-core/boot/i386/pc/startup_raw.S -@@ -89,7 +89,7 @@ LOCAL (codestart): - sti /* we're safe again */ - - /* save the boot drive */ -- ADDR32 movb %dl, LOCAL(boot_drive) -+ movb %dl, LOCAL(boot_drive) - - /* reset disk system (%ah = 0) */ - int $0x13 -diff --git a/grub-core/kern/i386/realmode.S b/grub-core/kern/i386/realmode.S -index 732697c..1384d52 100644 ---- a/grub-core/kern/i386/realmode.S -+++ b/grub-core/kern/i386/realmode.S -@@ -137,7 +137,7 @@ real_to_prot: - /* load the GDT register */ - xorw %ax, %ax - movw %ax, %ds -- ADDR32 lgdtl gdtdesc -+ lgdtl gdtdesc - - /* turn on protected mode */ - movl %cr0, %eax --- -2.4.3 - diff --git a/0312-Remove-obsolete-ADDR32-and-DATA32-checks.patch b/0312-Remove-obsolete-ADDR32-and-DATA32-checks.patch deleted file mode 100644 index 8225d9c..0000000 --- a/0312-Remove-obsolete-ADDR32-and-DATA32-checks.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 6505b241fd86456626dda85651f22467df8294fa Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 17:44:41 +0100 -Subject: [PATCH 312/506] Remove obsolete ADDR32 and DATA32 checks. - ---- - acinclude.m4 | 74 ------------------------------------------------- - config.h.in | 4 --- - configure.ac | 4 --- - grub-core/modinfo.sh.in | 2 -- - 4 files changed, 84 deletions(-) - -diff --git a/acinclude.m4 b/acinclude.m4 -index b2bb88d..609c4f2 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -210,80 +210,6 @@ fi - ]) - - --dnl Mass confusion! --dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit --dnl instructions, but implicitly insert addr32 and data32 bytes so --dnl that the code works in real mode''. --dnl --dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit --dnl instructions,'' which seems right. This requires the programmer --dnl to explicitly insert addr32 and data32 instructions when they want --dnl them. --dnl --dnl We only support the newer versions, because the old versions cause --dnl major pain, by requiring manual assembly to get 16-bit instructions into --dnl asm files. --AC_DEFUN([grub_I386_ASM_ADDR32], --[AC_REQUIRE([AC_PROG_CC]) --AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT]) --AC_MSG_CHECKING([for .code16 addr32 assembler support]) --AC_CACHE_VAL(grub_cv_i386_asm_addr32, --[cat > conftest.s.in <<\EOF -- .code16 --l1: @ADDR32@ movb %al, l1 --EOF -- --if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then -- sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s --else -- sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s --fi -- --if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then -- grub_cv_i386_asm_addr32=yes --else -- grub_cv_i386_asm_addr32=no --fi -- --rm -f conftest*]) -- --AC_MSG_RESULT([$grub_cv_i386_asm_addr32])]) -- --dnl Later versions of GAS requires that addr32 and data32 prefixes --dnl appear in the same lines as the instructions they modify, while --dnl earlier versions requires that they appear in separate lines. --AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT], --[AC_REQUIRE([AC_PROG_CC]) --AC_MSG_CHECKING(dnl --[whether addr32 must be in the same line as the instruction]) --AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement, --[cat > conftest.s <<\EOF -- .code16 --l1: addr32 movb %al, l1 --EOF -- --if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then -- grub_cv_i386_asm_prefix_requirement=yes --else -- grub_cv_i386_asm_prefix_requirement=no --fi -- --rm -f conftest*]) -- --if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then -- grub_tmp_addr32="addr32" -- grub_tmp_data32="data32" --else -- grub_tmp_addr32="addr32;" -- grub_tmp_data32="data32;" --fi -- --ADDR32=$grub_tmp_addr32 --DATA32=$grub_tmp_data32 -- --AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])]) -- -- - dnl Check what symbol is defined as a bss start symbol. - dnl Written by Michael Hohmoth and Yoshinori K. Okuji. - AC_DEFUN([grub_CHECK_BSS_START_SYMBOL], -diff --git a/config.h.in b/config.h.in -index 4b63014..d93b687 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -31,10 +31,6 @@ - #define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ - /* Define if C symbols get an underscore after compilation. */ - #define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ --/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */ --#define ADDR32 @ADDR32@ --/* Define it to \"data32\" or \"data32;\" to make GAS happy. */ --#define DATA32 @DATA32@ - /* Define it to one of __bss_start, edata and _edata. */ - #define BSS_START_SYMBOL @BSS_START_SYMBOL@ - /* Define it to either end or _end. */ -diff --git a/configure.ac b/configure.ac -index 40b7329..8ddb5d3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1096,8 +1096,6 @@ if test "x$target_cpu" = xi386; then - grub_CHECK_END_SYMBOL - fi - CFLAGS="$TARGET_CFLAGS" -- grub_I386_ASM_PREFIX_REQUIREMENT -- grub_I386_ASM_ADDR32 - fi - - grub_PROG_NM_WORKS -@@ -1621,8 +1619,6 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], - [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) - - AC_SUBST(HAVE_ASM_USCORE) --AC_SUBST(ADDR32) --AC_SUBST(DATA32) - AC_SUBST(BSS_START_SYMBOL) - AC_SUBST(END_SYMBOL) - AC_SUBST(PACKAGE) -diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in -index 69d8334..09d22f9 100644 ---- a/grub-core/modinfo.sh.in -+++ b/grub-core/modinfo.sh.in -@@ -9,8 +9,6 @@ grub_have_font_source=@HAVE_FONT_SOURCE@ - - # Autodetected config - grub_have_asm_uscore=@HAVE_ASM_USCORE@ --grub_i8086_addr32="@ADDR32@" --grub_i8086_data32="@DATA32@" - grub_bss_start_symbol="@BSS_START_SYMBOL@" - grub_end_symbol="@END_SYMBOL@" - --- -2.4.3 - diff --git a/0313-Remove-realmode.S-from-coreboot-and-qemu.patch b/0313-Remove-realmode.S-from-coreboot-and-qemu.patch deleted file mode 100644 index 430e66f..0000000 --- a/0313-Remove-realmode.S-from-coreboot-and-qemu.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 44ff462e836cb24bde0de184fb1e3cdeedcdd572 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 19:53:18 +0100 -Subject: [PATCH 313/506] Remove realmode.S from coreboot and qemu. - -It's not used there. ---- - grub-core/kern/i386/coreboot/startup.S | 5 ----- - grub-core/kern/i386/qemu/startup.S | 2 -- - 2 files changed, 7 deletions(-) - -diff --git a/grub-core/kern/i386/coreboot/startup.S b/grub-core/kern/i386/coreboot/startup.S -index 8c32838..c848654 100644 ---- a/grub-core/kern/i386/coreboot/startup.S -+++ b/grub-core/kern/i386/coreboot/startup.S -@@ -61,8 +61,3 @@ multiboot_header: - /* checksum */ - .long -0x1BADB002 - MULTIBOOT_MEMORY_INFO - --/* -- * prot_to_real and associated structures (but NOT real_to_prot, that is -- * only needed for BIOS gates). -- */ --#include "../realmode.S" -diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S -index 3d47d1e..17aace9 100644 ---- a/grub-core/kern/i386/qemu/startup.S -+++ b/grub-core/kern/i386/qemu/startup.S -@@ -73,5 +73,3 @@ codestart: - 1: - hlt - jmp 1b -- --#include "../realmode.S" --- -2.4.3 - diff --git a/0314-qemu-Fix-compilation.patch b/0314-qemu-Fix-compilation.patch deleted file mode 100644 index 83a2116..0000000 --- a/0314-qemu-Fix-compilation.patch +++ /dev/null @@ -1,70 +0,0 @@ -From e62ca2a870ecec4d46fcc03556e8e61592e9dd18 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 19:55:53 +0100 -Subject: [PATCH 314/506] qemu: Fix compilation - ---- - grub-core/boot/i386/qemu/boot.S | 2 +- - grub-core/kern/i386/realmode.S | 20 +++++++++++++++++++- - 2 files changed, 20 insertions(+), 2 deletions(-) - -diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S -index 8d97fc1..354436e 100644 ---- a/grub-core/boot/i386/qemu/boot.S -+++ b/grub-core/boot/i386/qemu/boot.S -@@ -48,7 +48,7 @@ VARIABLE(grub_core_entry_addr) - /* Transition to protected mode. We use pushl to force generation - of a flat return address. */ - pushl $1f -- jmpl real_to_prot -+ jmp real_to_prot - .code32 - /* Ensure A20 is enabled. We're in qemu, so control port A works - and there is no need to wait since there is no real logic, it's -diff --git a/grub-core/kern/i386/realmode.S b/grub-core/kern/i386/realmode.S -index 1384d52..998fdc7 100644 ---- a/grub-core/kern/i386/realmode.S -+++ b/grub-core/kern/i386/realmode.S -@@ -137,7 +137,22 @@ real_to_prot: - /* load the GDT register */ - xorw %ax, %ax - movw %ax, %ds -+#ifdef GRUB_MACHINE_QEMU -+ /* -+ qemu is special: gdtdesc is in ROM. -+ %cs = 0xf000 -+ _start + GRUB_BOOT_MACHINE_SIZE = 0x100000 -+ So -+ _start + GRUB_BOOT_MACHINE_SIZE - 0x10000 points to the same point -+ as %cs. -+ gdtdesc - (_start + GRUB_BOOT_MACHINE_SIZE - 0x10000) -+ = gdtdesc - _start - GRUB_BOOT_MACHINE_SIZE + 0x10000 -+ but the later can be computed by assembly. -+ */ -+ lgdtl %cs:(gdtdesc - _start - GRUB_BOOT_MACHINE_SIZE + 0x10000) -+#else - lgdtl gdtdesc -+#endif - - /* turn on protected mode */ - movl %cr0, %eax -@@ -178,6 +193,9 @@ protcseg: - - /* return on the old (or initialized) stack! */ - ret -+ /* prot_to_real assumes that this code is under 64K which is not -+ true for qemu. */ -+#ifndef GRUB_MACHINE_QEMU - /* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2009,2010 Free Software Foundation, Inc. -@@ -259,5 +277,5 @@ realcseg: - - /* return on new stack! */ - retl -- -+#endif - .code32 --- -2.4.3 - diff --git a/0315-qemu-Fix-GateA20-enabling.patch b/0315-qemu-Fix-GateA20-enabling.patch deleted file mode 100644 index 6fd8b80..0000000 --- a/0315-qemu-Fix-GateA20-enabling.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8afd8f3b641aaa80b70bb6629ea8eecae5d359df Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:00:18 +0100 -Subject: [PATCH 315/506] qemu: Fix GateA20 enabling. - -GateA20 code was inactive due to address error. ---- - grub-core/boot/i386/qemu/boot.S | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S -index 354436e..c5343bf 100644 ---- a/grub-core/boot/i386/qemu/boot.S -+++ b/grub-core/boot/i386/qemu/boot.S -@@ -50,6 +50,7 @@ VARIABLE(grub_core_entry_addr) - pushl $1f - jmp real_to_prot - .code32 -+1: - /* Ensure A20 is enabled. We're in qemu, so control port A works - and there is no need to wait since there is no real logic, it's - all emulated. */ -@@ -57,7 +58,6 @@ VARIABLE(grub_core_entry_addr) - andb $(~0x03), %al - orb $0x02, %al - outb $0x92 --1: - movl EXT_C(grub_core_entry_addr), %edx - jmp *%edx - --- -2.4.3 - diff --git a/0316-qemu-Switch-to-more-portable-.org.patch b/0316-qemu-Switch-to-more-portable-.org.patch deleted file mode 100644 index 6f164ef..0000000 --- a/0316-qemu-Switch-to-more-portable-.org.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 3c6043245e9618a499766fdb0e51c4953d5d3da9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:13:58 +0100 -Subject: [PATCH 316/506] qemu: Switch to more portable .org - -Binary is checked identical. ---- - grub-core/boot/i386/qemu/boot.S | 6 +++--- - grub-core/kern/i386/qemu/startup.S | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S -index c5343bf..8c3a1db 100644 ---- a/grub-core/boot/i386/qemu/boot.S -+++ b/grub-core/boot/i386/qemu/boot.S -@@ -31,7 +31,7 @@ _start: - - jmp 1f - -- . = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR -+ .org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR - VARIABLE(grub_core_entry_addr) - .long 0 - 1: -@@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr) - /* Intel, in its infinite wisdom, decided to put the i8086 entry point - *right here* and this is why we need this kludge. */ - -- . = GRUB_BOOT_MACHINE_SIZE - 16 -+ .org GRUB_BOOT_MACHINE_SIZE - 16 - - .code16 - - jmp _start -- . = GRUB_BOOT_MACHINE_SIZE -+ .org GRUB_BOOT_MACHINE_SIZE -diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S -index 17aace9..0d89858 100644 ---- a/grub-core/kern/i386/qemu/startup.S -+++ b/grub-core/kern/i386/qemu/startup.S -@@ -28,7 +28,7 @@ - _start: - jmp codestart - -- . = _start + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR -+ .org GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR - VARIABLE(grub_core_entry_addr) - .long 0 - --- -2.4.3 - diff --git a/0317-Relax-requirements-on-asm-for-non-BIOS-i386-platform.patch b/0317-Relax-requirements-on-asm-for-non-BIOS-i386-platform.patch deleted file mode 100644 index 2f31aa3..0000000 --- a/0317-Relax-requirements-on-asm-for-non-BIOS-i386-platform.patch +++ /dev/null @@ -1,77 +0,0 @@ -From f16b8c04057925270d765532fa5710757119c6da Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:18:18 +0100 -Subject: [PATCH 317/506] Relax requirements on asm for non-BIOS i386 - platforms. - -These platforms don't have a hard limit on size of resulting code16 -code, so we don't care if assembly is bigger than necessarry. ---- - asm-tests/i386-pc.S | 10 ++++++++++ - asm-tests/i386.S | 10 ++-------- - configure.ac | 11 +++++++---- - 3 files changed, 19 insertions(+), 12 deletions(-) - create mode 100644 asm-tests/i386-pc.S - -diff --git a/asm-tests/i386-pc.S b/asm-tests/i386-pc.S -new file mode 100644 -index 0000000..97cd32a ---- /dev/null -+++ b/asm-tests/i386-pc.S -@@ -0,0 +1,10 @@ -+/* on x86 old clang doesn't support .code16 -+ newer clang supports it but creates 6-byte jumps instead of 3-byte ones -+ which makes us go over boot sector size. */ -+ -+ .code16 -+ jmp far -+ .org 4 -+ .space 300 -+far: -+ .byte 0 -diff --git a/asm-tests/i386.S b/asm-tests/i386.S -index 97cd32a..30adc4f 100644 ---- a/asm-tests/i386.S -+++ b/asm-tests/i386.S -@@ -1,10 +1,4 @@ --/* on x86 old clang doesn't support .code16 -- newer clang supports it but creates 6-byte jumps instead of 3-byte ones -- which makes us go over boot sector size. */ -+/* on x86 old clang doesn't support .code16 */ - - .code16 -- jmp far -- .org 4 -- .space 300 --far: -- .byte 0 -+ movb %al, %bl -diff --git a/configure.ac b/configure.ac -index 8ddb5d3..8b94d34 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -562,14 +562,17 @@ AC_COMPILE_IFELSE( - - AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ - test_program= --case "x$target_cpu" in -- xmips | xmipsel) -+case "x$target_cpu-$platform" in -+ xmips-* | xmipsel-*) - test_program=mips - ;; -- xi386 | xx86_64) -+ xi386-pc) -+ test_program=i386-pc -+ ;; -+ xi386-* | xx86_64-*) - test_program=i386 - ;; -- xpowerpc | xsparc64 | xarm) -+ xpowerpc-* | xsparc64-* | xarm-*) - test_program=$target_cpu - ;; - esac --- -2.4.3 - diff --git a/0318-kernel-8086-Switch-to-more-portable-.org.patch b/0318-kernel-8086-Switch-to-more-portable-.org.patch deleted file mode 100644 index 9116a2b..0000000 --- a/0318-kernel-8086-Switch-to-more-portable-.org.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e77dc3d9a0b672d933f328fce4332a61a9f5f707 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:24:59 +0100 -Subject: [PATCH 318/506] kernel-8086: Switch to more portable .org. - ---- - grub-core/tests/boot/kernel-8086.S | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/tests/boot/kernel-8086.S b/grub-core/tests/boot/kernel-8086.S -index 510897c..5ec5368 100644 ---- a/grub-core/tests/boot/kernel-8086.S -+++ b/grub-core/tests/boot/kernel-8086.S -@@ -46,5 +46,5 @@ message: - .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" - .byte 0 - -- . = base + 510 -- .short 0xaa55 -\ No newline at end of file -+ .org 510 -+ .short 0xaa55 --- -2.4.3 - diff --git a/0319-sparc64-Switch-to-more-portable-.org.patch b/0319-sparc64-Switch-to-more-portable-.org.patch deleted file mode 100644 index f8b4c3c..0000000 --- a/0319-sparc64-Switch-to-more-portable-.org.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 49e5fcb9fb1efd1c9b9622d1bc0fe5fa23e99b81 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:32:03 +0100 -Subject: [PATCH 319/506] sparc64: Switch to more portable .org. - -Binaries are unchanged. ---- - grub-core/boot/sparc64/ieee1275/boot.S | 8 ++++---- - grub-core/boot/sparc64/ieee1275/diskboot.S | 2 +- - grub-core/kern/sparc64/ieee1275/crt0.S | 2 +- - 3 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S -index 5073677..586efb4 100644 ---- a/grub-core/boot/sparc64/ieee1275/boot.S -+++ b/grub-core/boot/sparc64/ieee1275/boot.S -@@ -41,9 +41,9 @@ pic_base: - * After loading in that block we will execute it by jumping to the - * load address plus the size of the prepended A.OUT header (32 bytes). - */ -- . = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH -+ .org GRUB_BOOT_MACHINE_BOOT_DEVPATH - boot_path: -- . = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE -+ .org GRUB_BOOT_MACHINE_KERNEL_BYTE - boot_path_end: - kernel_byte: .xword (2 << 9) - kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR -@@ -52,7 +52,7 @@ kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR - #define boot_path_end (_start + 1024) - #include - -- . = _start + 8 -+ .org 8 - kernel_byte: .xword (2 << 9) - kernel_size: .word 512 - kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS -@@ -224,7 +224,7 @@ bootpath_known: - #else - nop - #endif -- . = _start + GRUB_BOOT_MACHINE_CODE_END -+ .org GRUB_BOOT_MACHINE_CODE_END - - /* the last 4 bytes in the sector 0 contain the signature */ - .word GRUB_BOOT_MACHINE_SIGNATURE -diff --git a/grub-core/boot/sparc64/ieee1275/diskboot.S b/grub-core/boot/sparc64/ieee1275/diskboot.S -index e020f62..35e02c1 100644 ---- a/grub-core/boot/sparc64/ieee1275/diskboot.S -+++ b/grub-core/boot/sparc64/ieee1275/diskboot.S -@@ -136,7 +136,7 @@ lastlist: - .word 0 - .word 0 - -- . = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE) -+ .org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE) - blocklist_default_start: - .word 0 - .word 2 -diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S -index 79b6bb3..03b916f 100644 ---- a/grub-core/kern/sparc64/ieee1275/crt0.S -+++ b/grub-core/kern/sparc64/ieee1275/crt0.S -@@ -27,7 +27,7 @@ _start: - ba codestart - mov %o4, %o0 - -- . = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE -+ .org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE - - VARIABLE(grub_total_module_size) - .word 0 --- -2.4.3 - diff --git a/0320-mips-Switch-to-more-portable-.org.patch b/0320-mips-Switch-to-more-portable-.org.patch deleted file mode 100644 index b93611e..0000000 --- a/0320-mips-Switch-to-more-portable-.org.patch +++ /dev/null @@ -1,78 +0,0 @@ -From da9f30b455a3d1b9e52ae6875b4724c0784c9e8a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 20:43:57 +0100 -Subject: [PATCH 320/506] mips: Switch to more portable .org - -Binary is unchanged. ---- - grub-core/boot/mips/loongson/fwstart.S | 6 +++--- - grub-core/boot/mips/startup_raw.S | 6 +++--- - grub-core/kern/mips/startup.S | 2 +- - 3 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/grub-core/boot/mips/loongson/fwstart.S b/grub-core/boot/mips/loongson/fwstart.S -index 6ae3269..71bab6d 100644 ---- a/grub-core/boot/mips/loongson/fwstart.S -+++ b/grub-core/boot/mips/loongson/fwstart.S -@@ -162,7 +162,7 @@ retry_cs5536: - - b continue - -- . = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START -+ .org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START - tlb_refill: - mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC - mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR -@@ -196,13 +196,13 @@ tlb_refill: - b fatal - addiu $a0, $a0, %lo(unhandled_tlb_refill) - -- . = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START -+ .org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START - cache_error: - lui $a0, %hi(unhandled_cache_error) - b fatal - addiu $a0, $a0, %lo(unhandled_cache_error) - -- . = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START -+ .org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START - other_exception: - mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE - mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC -diff --git a/grub-core/boot/mips/startup_raw.S b/grub-core/boot/mips/startup_raw.S -index c169ca3..ca3413b 100644 ---- a/grub-core/boot/mips/startup_raw.S -+++ b/grub-core/boot/mips/startup_raw.S -@@ -39,13 +39,13 @@ start: - bal codestart - nop - base: -- . = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE -+ .org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - compressed_size: - .long 0 -- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE -+ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - uncompressed_size: - .long 0 -- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR -+ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - uncompressed_addr: - .long 0 - codestart: -diff --git a/grub-core/kern/mips/startup.S b/grub-core/kern/mips/startup.S -index 709a91a..339ab33 100644 ---- a/grub-core/kern/mips/startup.S -+++ b/grub-core/kern/mips/startup.S -@@ -36,7 +36,7 @@ start: - bal cont - nop - -- . = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE -+ .org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE - VARIABLE(grub_total_modules_size) - .long 0 - --- -2.4.3 - diff --git a/0321-Discover-which-option-provides-soft-float-on-configu.patch b/0321-Discover-which-option-provides-soft-float-on-configu.patch deleted file mode 100644 index 8c2f774..0000000 --- a/0321-Discover-which-option-provides-soft-float-on-configu.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ebe316e4dfebb83c2e1de437b316b60195470961 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 21 Feb 2015 23:46:47 +0100 -Subject: [PATCH 321/506] Discover which option provides soft-float on - configure stage. - -Deals with clang needing other arguments to stop issuing floating -instructions than gcc. ---- - configure.ac | 38 +++++++++++++++++++++++++++++++++----- - 1 file changed, 33 insertions(+), 5 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 8b94d34..10a6bf9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -682,11 +682,39 @@ fi - # that floats are a good fit to run instead of what's written in the code. - # Given that floating point unit is disabled (if present to begin with) - # when GRUB is running which may result in various hard crashes. --if test "x$target_cpu" = xarm64; then -- TARGET_CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd" --else -- TARGET_CFLAGS="$TARGET_CFLAGS -msoft-float" -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -msoft-float" -+if test x"$platform" != xemu ; then -+ AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ -+ grub_cv_target_cc_soft_float=no -+ if test "x$target_cpu" = xarm64; then -+ CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd -Werror" -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -+ [grub_cv_target_cc_soft_float="-march=armv8-a+nofp+nosimd"], []) -+ fi -+ for cand in "-Xclang -msoft-float -Xclang -no-implicit-float" \ -+ "-Xclang -msoft-float" "-msoft-float"; do -+ if test x"$grub_cv_target_cc_soft_float" != xno ; then -+ break -+ fi -+ CFLAGS="$TARGET_CFLAGS $cand -Werror" -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -+ [grub_cv_target_cc_soft_float="$cand"], []) -+ done -+ ]) -+ -+ if test x"$grub_cv_target_cc_soft_float" = xno ; then -+ AC_MSG_ERROR([could not force soft-float]) -+ fi -+ -+ case x"$grub_cv_target_cc_soft_float" in -+ x"-Xclang"*) -+ # A trick so that clang doesn't see it on link stаge -+ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float" -+ ;; -+ *) -+ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float" -+ ;; -+ esac -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" - fi - - # By default, GCC 4.4 generates .eh_frame sections containing unwind --- -2.4.3 - diff --git a/0322-Experimental-support-for-clang-for-sparc64.patch b/0322-Experimental-support-for-clang-for-sparc64.patch deleted file mode 100644 index bb30bb7..0000000 --- a/0322-Experimental-support-for-clang-for-sparc64.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 155f334f5740a33948ee92432a9eacfd0bf4a398 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 01:53:00 +0100 -Subject: [PATCH 322/506] Experimental support for clang for sparc64. - -Automatically discover command line options to make clang and -gcc behave in same way. - -Tested with qemu. ---- - INSTALL | 5 +++-- - conf/Makefile.common | 7 +------ - configure.ac | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 55 insertions(+), 10 deletions(-) - -diff --git a/INSTALL b/INSTALL -index afbb660..846ac38 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -15,7 +15,7 @@ configuring the GRUB. - Note: older versions may work but support is limited - - Experimental support for clang 3.3 or later (results in much bigger binaries) -- for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc -+ for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc, sparc64 - Note: clang 3.2 or later works for i386 and x86_64 targets but results in - much bigger binaries. - earlier versions not tested -@@ -29,7 +29,8 @@ configuring the GRUB. - fail. - Note: clang 3.2 or later works for powerpc - earlier versions not tested -- Note: clang doesn't support -mno-app-regs and so can't be used for sparc64 -+ Note: clang 3.5 or later works for sparc64 -+ earlier versions return "error: unable to interface with target machine" - Note: clang has no support for ia64 and hence you can't compile GRUB - for ia64 with clang - * GNU Make -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 66c9fdb..8861096 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -7,12 +7,7 @@ unexport LC_ALL - - # Platform specific options - if COND_sparc64_ieee1275 -- CFLAGS_PLATFORM += -mno-app-regs -- LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax --endif --if COND_sparc64_emu -- CFLAGS_PLATFORM += -mno-app-regs -- LDFLAGS_PLATFORM = -Wl,--no-relax -+ LDFLAGS_PLATFORM = -Wl,-melf64_sparc - endif - if COND_arm - if !COND_emu -diff --git a/configure.ac b/configure.ac -index 10a6bf9..4d59fbe 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -717,6 +717,55 @@ if test x"$platform" != xemu ; then - TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" - fi - -+if test x"$target_cpu" = xsparc64 ; then -+ AC_CACHE_CHECK([for options to reserve application registers], grub_cv_target_cc_mno_app_regs, [ -+ grub_cv_target_cc_mno_app_regs=no -+ for cand in "-mllvm -sparc-reserve-app-registers" \ -+ "-mno-app-regs"; do -+ if test x"$grub_cv_target_cc_mno_app_regs" != xno ; then -+ break -+ fi -+ CFLAGS="$TARGET_CFLAGS $cand -Werror" -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -+ [grub_cv_target_cc_mno_app_regs="$cand"], []) -+ done -+ ]) -+ -+ if test x"$grub_cv_target_cc_mno_app_regs" = xno ; then -+ AC_MSG_ERROR([could not reserve application registers]) -+ fi -+ if test x"$grub_cv_target_cc_mno_app_regs" = x"-mllvm -sparc-reserve-app-registers" ; then -+ # A trick so that clang doesn't see it on link stаge -+ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_app_regs" -+ else -+ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_app_regs" -+ fi -+ -+ AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [ -+ grub_cv_target_cc_mno_relax=no -+ for cand in "-mno-relax" "-Wl,--no-relax"; do -+ if test x"$grub_cv_target_cc_mno_relax" != xno ; then -+ break -+ fi -+ LDFLAGS="$TARGET_LDFLAGS $cand -nostdlib -static" -+ CFLAGS="$TARGET_CFLAGS -Werror" -+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -+ asm (".globl start; start:"); -+ void __main (void); -+ void __main (void) {} -+ int main (void); -+ ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], []) -+ done -+ ]) -+ LDFLAGS="$TARGET_LDFLAGS" -+ CFLAGS="$TARGET_CFLAGS" -+ -+ if test x"$grub_cv_target_cc_mno_relax" = xno ; then -+ AC_MSG_ERROR([could not find no-relax options]) -+ fi -+ TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" -+fi -+ - # By default, GCC 4.4 generates .eh_frame sections containing unwind - # information in some cases where it previously did not. GRUB doesn't need - # these and they just use up vital space. Restore the old compiler -@@ -918,7 +967,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) - - LDFLAGS="$TARGET_LDFLAGS" - --if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then -+if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then - # Use large model to support 4G memory - AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ - CFLAGS="$TARGET_CFLAGS -mcmodel=large" -@@ -928,7 +977,7 @@ if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; t - ]) - if test "x$grub_cv_cc_mcmodel" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" -- elif test "$target_cpu-$platform" = sparc64-emu; then -+ elif test "$target_cpu" = sparc64; then - TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" - fi - fi --- -2.4.3 - diff --git a/0323-i386-tsc-Fix-unused-function-warning-on-xen.patch b/0323-i386-tsc-Fix-unused-function-warning-on-xen.patch deleted file mode 100644 index a8f4694..0000000 --- a/0323-i386-tsc-Fix-unused-function-warning-on-xen.patch +++ /dev/null @@ -1,34 +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 323/506] i386/tsc: Fix unused function warning on xen. - ---- - grub-core/kern/i386/tsc.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c -index d7d1783..bc441d0 100644 ---- a/grub-core/kern/i386/tsc.c -+++ b/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) - { --- -2.4.3 - diff --git a/0324-configure.ac-Add-ia64-specific-way-to-disable-floats.patch b/0324-configure.ac-Add-ia64-specific-way-to-disable-floats.patch deleted file mode 100644 index 7bb17af..0000000 --- a/0324-configure.ac-Add-ia64-specific-way-to-disable-floats.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ea39b87a8b258a0f19752f5e5607e14deec54c44 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 14:42:19 +0100 -Subject: [PATCH 324/506] configure.ac: Add ia64-specific way to disable - floats. - ---- - configure.ac | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 4d59fbe..94f96c4 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -690,6 +690,11 @@ if test x"$platform" != xemu ; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_target_cc_soft_float="-march=armv8-a+nofp+nosimd"], []) - fi -+ if test "x$target_cpu" = xia64; then -+ CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror" -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -+ [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], []) -+ fi - for cand in "-Xclang -msoft-float -Xclang -no-implicit-float" \ - "-Xclang -msoft-float" "-msoft-float"; do - if test x"$grub_cv_target_cc_soft_float" != xno ; then --- -2.4.3 - diff --git a/0325-acpi-Fix-unused-function-warning.patch b/0325-acpi-Fix-unused-function-warning.patch deleted file mode 100644 index cb29f83..0000000 --- a/0325-acpi-Fix-unused-function-warning.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e1d4520bfb63aa669fc197f44623f6c9228f7757 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 14:42:43 +0100 -Subject: [PATCH 325/506] acpi: Fix unused function warning. - ---- - grub-core/commands/acpi.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c -index 5507ffa..05a6dca 100644 ---- a/grub-core/commands/acpi.c -+++ b/grub-core/commands/acpi.c -@@ -131,6 +131,8 @@ grub_acpi_get_rsdpv1 (void) - return grub_machine_acpi_get_rsdpv1 (); - } - -+#if defined (__i386__) || defined (__x86_64__) -+ - static inline int - iszero (grub_uint8_t *reg, int size) - { -@@ -141,7 +143,6 @@ iszero (grub_uint8_t *reg, int size) - return 1; - } - --#if defined (__i386__) || defined (__x86_64__) - /* Context for grub_acpi_create_ebda. */ - struct grub_acpi_create_ebda_ctx { - int ebda_len; --- -2.4.3 - diff --git a/0326-Supply-signed-division-to-fix-ARM-compilation.patch b/0326-Supply-signed-division-to-fix-ARM-compilation.patch deleted file mode 100644 index 66b1390..0000000 --- a/0326-Supply-signed-division-to-fix-ARM-compilation.patch +++ /dev/null @@ -1,425 +0,0 @@ -From f034fab6206173d411407fab6eb9a44c90e02dca Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 17:24:28 +0100 -Subject: [PATCH 326/506] Supply signed division to fix ARM compilation. - -Previously we supplied only unsigned divisions on platforms that need software -division. -Yet compiler may itself use a signed division. A typical example would be a -difference between 2 pointers which involves division by object size. ---- - gentpl.py | 6 ++++ - grub-core/Makefile.core.def | 8 +++++ - grub-core/kern/arm/misc.S | 13 +++----- - grub-core/kern/misc.c | 71 ++++++++++++++++++++++++++++------------- - grub-core/tests/div_test.c | 73 +++++++++++++++++++++++++++++++++++++++--- - include/grub/misc.h | 78 +++++++++++++++++++++++++++++++++++---------- - 6 files changed, 198 insertions(+), 51 deletions(-) - -diff --git a/gentpl.py b/gentpl.py -index c986cec..d2aa035 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -76,6 +76,12 @@ for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i) - # Flattened Device Trees (FDT) - GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi" ] - -+# Needs software helpers for division -+# Must match GRUB_DIVISION_IN_SOFTWARE in misc.h -+GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"] -+GROUPS["no_softdiv"] = GRUB_PLATFORMS[:] -+for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i) -+ - # Miscelaneous groups schedulded to disappear in future - GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"] - GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 42443bc..b539ccf 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -159,6 +159,8 @@ kernel = { - terminfoinkernel = commands/extcmd.c; - terminfoinkernel = lib/arg.c; - -+ softdiv = lib/division.c; -+ - i386 = kern/i386/dl.c; - i386_xen = kern/i386/dl.c; - -@@ -1970,6 +1972,12 @@ module = { - }; - - module = { -+ name = div; -+ common = lib/division.c; -+ enable = no_softdiv; -+}; -+ -+module = { - name = div_test; - common = tests/div_test.c; - }; -diff --git a/grub-core/kern/arm/misc.S b/grub-core/kern/arm/misc.S -index 16b6f8e..645b42f 100644 ---- a/grub-core/kern/arm/misc.S -+++ b/grub-core/kern/arm/misc.S -@@ -58,15 +58,11 @@ FUNCTION(__aeabi_lmul) - ldmfd sp!, {r4, fp} - bx lr - -- .macro division parent -+ .macro division32 parent - - sub sp, sp, #8 @ Allocate naturally aligned 64-bit space - stmfd sp!, {r3,lr} @ Dummy r3 to maintain stack alignment -- add r3, sp, #8 @ Set r3 to address of 64-bit space -- str r3, [sp] @ Stack parameter, pointer to 64-bit space -- mov r2, r1 -- mov r1, #0 -- mov r3, #0 -+ add r2, sp, #8 @ Set r2 to address of 64-bit space - bl \parent - ldr r1, [sp, #8] @ Extract remainder - ldmfd sp!, {r3,lr} @ Pop into an unused arg/scratch register -@@ -75,8 +71,9 @@ FUNCTION(__aeabi_lmul) - .endm - - FUNCTION(__aeabi_uidivmod) -- division grub_divmod64 -- -+ division32 grub_divmod32 -+FUNCTION(__aeabi_idivmod) -+ division32 grub_divmod32s - - /* - * Null divide-by-zero handler -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 883d353..b0347e7 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -594,10 +594,10 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) - grub_uint64_t m = 0; - - /* ARM and IA64 don't have a fast 32-bit division. -- Using that code would just make us use libgcc routines, calling -- them twice (once for modulo and once for quotient. -+ Using that code would just make us use software division routines, calling -+ ourselves indirectly and hence getting infinite recursion. - */ --#if !defined (__arm__) && !defined (__ia64__) -+#if !GRUB_DIVISION_IN_SOFTWARE - /* Skip the slow computation if 32-bit arithmetic is possible. */ - if (n < 0xffffffff && d < 0xffffffff) - { -@@ -633,7 +633,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) - - #if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) - --#if defined (__arm__) -+#if GRUB_DIVISION_IN_SOFTWARE - - grub_uint32_t - __udivsi3 (grub_uint32_t a, grub_uint32_t b) -@@ -641,6 +641,12 @@ __udivsi3 (grub_uint32_t a, grub_uint32_t b) - return grub_divmod64 (a, b, 0); - } - -+grub_int32_t -+__divsi3 (grub_int32_t a, grub_int32_t b) -+{ -+ return grub_divmod64s (a, b, 0); -+} -+ - grub_uint32_t - __umodsi3 (grub_uint32_t a, grub_uint32_t b) - { -@@ -649,6 +655,42 @@ __umodsi3 (grub_uint32_t a, grub_uint32_t b) - return ret; - } - -+grub_int32_t -+__modsi3 (grub_int32_t a, grub_int32_t b) -+{ -+ grub_int64_t ret; -+ grub_divmod64s (a, b, &ret); -+ return ret; -+} -+ -+grub_uint64_t -+__udivdi3 (grub_uint64_t a, grub_uint64_t b) -+{ -+ return grub_divmod64 (a, b, 0); -+} -+ -+grub_uint64_t -+__umoddi3 (grub_uint64_t a, grub_uint64_t b) -+{ -+ grub_uint64_t ret; -+ grub_divmod64 (a, b, &ret); -+ return ret; -+} -+ -+grub_int64_t -+__divdi3 (grub_int64_t a, grub_int64_t b) -+{ -+ return grub_divmod64s (a, b, 0); -+} -+ -+grub_int64_t -+__moddi3 (grub_int64_t a, grub_int64_t b) -+{ -+ grub_int64_t ret; -+ grub_divmod64s (a, b, &ret); -+ return ret; -+} -+ - #endif - - #ifdef NEED_CTZDI2 -@@ -735,30 +777,15 @@ __ctzsi2 (grub_uint32_t x) - grub_uint32_t - __aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) - __attribute__ ((alias ("__udivsi3"))); -+grub_int32_t -+__aeabi_idiv (grub_int32_t a, grub_int32_t b) -+ __attribute__ ((alias ("__divsi3"))); - void *__aeabi_memcpy (void *dest, const void *src, grub_size_t n) - __attribute__ ((alias ("grub_memcpy"))); - void *__aeabi_memset (void *s, int c, grub_size_t n) - __attribute__ ((alias ("grub_memset"))); - #endif - --#if defined (__ia64__) -- --grub_uint64_t --__udivdi3 (grub_uint64_t a, grub_uint64_t b) --{ -- return grub_divmod64 (a, b, 0); --} -- --grub_uint64_t --__umoddi3 (grub_uint64_t a, grub_uint64_t b) --{ -- grub_uint64_t ret; -- grub_divmod64 (a, b, &ret); -- return ret; --} -- --#endif -- - #endif /* GRUB_UTIL */ - - /* Convert a long long value to a string. This function avoids 64-bit -diff --git a/grub-core/tests/div_test.c b/grub-core/tests/div_test.c -index 7bdc80b..9abc6d5 100644 ---- a/grub-core/tests/div_test.c -+++ b/grub-core/tests/div_test.c -@@ -97,6 +97,72 @@ test64 (grub_uint64_t a, grub_uint64_t b) - #endif - } - -+static grub_int64_t -+abs64(grub_int64_t a) -+{ -+ return a > 0 ? a : -a; -+} -+ -+static void -+test32s (grub_int32_t a, grub_int32_t b) -+{ -+ grub_int64_t q, r; -+ if (b == 0) -+ return; -+ -+ q = grub_divmod64s (a, b, &r); -+ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld", -+ (long long) a, (long long) b, (long long) r); -+ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld", -+ (long long) a, (long long) b, (long long) q); -+ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld", -+ (long long) a, (long long) b, (long long) r); -+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: %lld * %lld + %lld != %lld", (long long) q, (long long) b, (long long) r, -+ (long long) a); -+ if (0) { grub_test_assert (q == (a / b), -+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b); -+ grub_test_assert (r == (a % b), -+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b); -+ } -+} -+ -+static void -+test64s (grub_int64_t a, grub_int64_t b) -+{ -+ grub_int64_t q, r; -+ q = grub_divmod64s (a, b, &r); -+ -+ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld", -+ (long long) a, (long long) b, (long long) r); -+ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld", -+ (long long) a, (long long) b, (long long) q); -+ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld", -+ (long long) a, (long long) b, (long long) r); -+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: 0x%llx * 0x%llx + 0x%llx != 0x%llx", (long long) q, (long long) b, (long long) r, -+ (long long) a); -+#if GRUB_TARGET_SIZEOF_VOID_P == 8 -+ grub_test_assert (q == (a / b), -+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b); -+ grub_test_assert (r == (a % b), -+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b); -+#endif -+} -+ -+static void -+test_all(grub_uint64_t a, grub_uint64_t b) -+{ -+ test64 (a, b); -+ test32 (a, b); -+ test64s (a, b); -+ test32s (a, b); -+ test64s (a, -b); -+ test32s (a, -b); -+ test64s (-a, b); -+ test32s (-a, b); -+ test64s (-a, -b); -+ test32s (-a, -b); -+} -+ - static void - div_test (void) - { -@@ -105,8 +171,7 @@ div_test (void) - - for (i = 0; i < ARRAY_SIZE (vectors); i++) - { -- test64 (vectors[i][0], vectors[i][1]); -- test32 (vectors[i][0], vectors[i][1]); -+ test_all (vectors[i][0], vectors[i][1]); - } - for (i = 0; i < 40000; i++) - { -@@ -116,9 +181,7 @@ div_test (void) - b = 1; - if (a == 0) - a = 1; -- test64 (a, b); -- test32 (a, b); -- -+ test_all (a, b); - } - } - -diff --git a/include/grub/misc.h b/include/grub/misc.h -index e35934c..a05b3fd 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -358,6 +358,64 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, - grub_uint64_t d, - grub_uint64_t *r); - -+/* Must match softdiv group in gentpl.py. */ -+#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__ia64__)) -+#define GRUB_DIVISION_IN_SOFTWARE 1 -+#else -+#define GRUB_DIVISION_IN_SOFTWARE 0 -+#endif -+ -+/* Some division functions need to be in kernel if compiler generates calls -+ to them. Otherwise we still need them for consistent tests but they go -+ into a separate module. */ -+#if GRUB_DIVISION_IN_SOFTWARE -+#define EXPORT_FUNC_IF_SOFTDIV EXPORT_FUNC -+#else -+#define EXPORT_FUNC_IF_SOFTDIV(x) x -+#endif -+ -+grub_int64_t -+EXPORT_FUNC_IF_SOFTDIV(grub_divmod64s) (grub_int64_t n, -+ grub_int64_t d, -+ grub_int64_t *r); -+grub_uint32_t -+EXPORT_FUNC_IF_SOFTDIV (grub_divmod32) (grub_uint32_t n, -+ grub_uint32_t d, -+ grub_uint32_t *r); -+ -+grub_int32_t -+EXPORT_FUNC_IF_SOFTDIV (grub_divmod32s) (grub_int32_t n, -+ grub_int32_t d, -+ grub_int32_t *r); -+ -+#if defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE -+ -+grub_uint32_t -+EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); -+ -+grub_uint32_t -+EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); -+ -+grub_int32_t -+EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); -+ -+grub_int32_t -+EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); -+ -+grub_int64_t -+EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); -+ -+grub_int64_t -+EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); -+ -+grub_uint64_t -+EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); -+ -+grub_uint64_t -+EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); -+ -+#endif -+ - #if (defined (__MINGW32__) || defined (__CYGWIN__)) && !defined(GRUB_UTIL) - void EXPORT_FUNC (__register_frame_info) (void); - void EXPORT_FUNC (__deregister_frame_info) (void); -@@ -437,12 +495,6 @@ grub_error_load (const struct grub_error_saved *save) - - #if defined (__arm__) - --grub_uint32_t --EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); -- --grub_uint32_t --EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); -- - #endif - - #if defined (__sparc__) || defined (__powerpc__) -@@ -460,8 +512,12 @@ EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); - #ifdef __arm__ - grub_uint32_t - EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); -+grub_int32_t -+EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); - grub_uint32_t - EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); -+grub_int32_t -+EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); - - /* Needed for allowing modules to be compiled as thumb. */ - grub_uint64_t -@@ -476,16 +532,6 @@ EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); - - #endif - --#if defined (__ia64__) -- --grub_uint64_t --EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); -- --grub_uint64_t --EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); -- --#endif -- - #endif /* GRUB_UTIL */ - - --- -2.4.3 - diff --git a/0327-arm64-Fix-compilation-failure.patch b/0327-arm64-Fix-compilation-failure.patch deleted file mode 100644 index be446fc..0000000 --- a/0327-arm64-Fix-compilation-failure.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 345076a78a15a61e1545eec60e7661e13b2dc62f Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 17:41:12 +0100 -Subject: [PATCH 327/506] arm64: Fix compilation failure. - -Don't supply +nosimd to asm files. -Otherwise +nosimd coming from flags forbids some of instructions -used in cache_flush. ---- - configure.ac | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 94f96c4..35f430a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -719,7 +719,16 @@ if test x"$platform" != xemu ; then - TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float" - ;; - esac -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" -+ case x"$grub_cv_target_cc_soft_float" in -+ x"-march=armv8-a+nofp+nosimd") -+ # +nosimd disables also the cache opcodes that we need in asm. -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -march=armv8-a+nofp" -+ ;; -+ *) -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" -+ ;; -+ esac -+ - fi - - if test x"$target_cpu" = xsparc64 ; then --- -2.4.3 - diff --git a/0328-Allow-clang-compilation-for-thumb-with-mthumb-interw.patch b/0328-Allow-clang-compilation-for-thumb-with-mthumb-interw.patch deleted file mode 100644 index f9c79a1..0000000 --- a/0328-Allow-clang-compilation-for-thumb-with-mthumb-interw.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2066c35b3ff6e35edf2a4e903f9aa79a23b6aefe Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 17:45:30 +0100 -Subject: [PATCH 328/506] Allow clang compilation for thumb with - -mthumb-interwork. - -clang already uses -mthumb-interwork behaviour even thout it doesn't -support the option. ---- - configure.ac | 13 +------------ - 1 file changed, 1 insertion(+), 12 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 35f430a..8f9ab81 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1029,20 +1029,9 @@ if test "x$target_cpu" = xarm; then - ]) - if test "x$grub_cv_cc_mthumb_interwork" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork" -+ # Clang defaults to thumb interworking - elif test "x$grub_cv_cc_target_clang" = xno ; then - AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork]) -- else -- CFLAGS="$TARGET_CFLAGS" -- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ --#if defined (__thumb__) && !defined (__thumb2__) --#error thumb without interworking --#endif --]])], -- [no_interwork_ok=yes], -- [no_interwork_ok=no]) -- if test x$no_interwork_ok = xno ; then -- AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork]) -- fi - fi - fi - --- -2.4.3 - diff --git a/0329-Add-missing-grub_-prefix-in-memcpy-invocation.patch b/0329-Add-missing-grub_-prefix-in-memcpy-invocation.patch deleted file mode 100644 index 573b8b1..0000000 --- a/0329-Add-missing-grub_-prefix-in-memcpy-invocation.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 7ea452a142d55e80b2a33d59958eef41559fb8eb Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sun, 22 Feb 2015 19:34:46 +0100 -Subject: [PATCH 329/506] Add missing grub_ prefix in memcpy invocation - ---- - grub-core/kern/dl.c | 2 +- - grub-core/loader/sparc64/ieee1275/linux.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 6850e04..3a438e9 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -340,7 +340,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) - mod->symtab = grub_malloc (s->sh_size); - if (!mod->symtab) - return grub_errno; -- memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size); -+ grub_memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size); - #else - mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset); - #endif -diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c -index 6389170..63d6a1f 100644 ---- a/grub-core/loader/sparc64/ieee1275/linux.c -+++ b/grub-core/loader/sparc64/ieee1275/linux.c -@@ -110,7 +110,7 @@ grub_linux_boot (void) - int len = grub_strlen (linux_args) + 1; - if (bp->len < len) - len = bp->len; -- memcpy(bp->buf, linux_args, len); -+ grub_memcpy(bp->buf, linux_args, len); - bp->buf[len-1] = '\0'; - bp->valid = 1; - } --- -2.4.3 - diff --git a/0330-mips-Fix-soft-float-handling.patch b/0330-mips-Fix-soft-float-handling.patch deleted file mode 100644 index 3b6e16a..0000000 --- a/0330-mips-Fix-soft-float-handling.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 6a4ecd276ed39f66be0ad6ff0f8ff67598098605 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Mon, 23 Feb 2015 22:33:28 +0100 -Subject: [PATCH 330/506] mips: Fix soft-float handling. - -Add -msoft-float alongside clang arguments to specify ABI. -Specify ABI in asm files explicitly. -This trigers asm warning due to gcc failing to propagate -msoft-float -but it's tolerable. ---- - configure.ac | 5 +++-- - grub-core/boot/mips/startup_raw.S | 2 ++ - grub-core/kern/mips/cache.S | 4 +++- - grub-core/kern/mips/startup.S | 2 ++ - grub-core/lib/mips/relocator_asm.S | 2 ++ - include/grub/mips/kernel.h | 4 ++++ - 6 files changed, 16 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 8f9ab81..908bb81 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -695,7 +695,8 @@ if test x"$platform" != xemu ; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], []) - fi -- for cand in "-Xclang -msoft-float -Xclang -no-implicit-float" \ -+ for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \ -+ "-Xclang -msoft-float -Xclang -no-implicit-float" \ - "-Xclang -msoft-float" "-msoft-float"; do - if test x"$grub_cv_target_cc_soft_float" != xno ; then - break -@@ -711,7 +712,7 @@ if test x"$platform" != xemu ; then - fi - - case x"$grub_cv_target_cc_soft_float" in -- x"-Xclang"*) -+ x*"-Xclang"*) - # A trick so that clang doesn't see it on link stаge - TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float" - ;; -diff --git a/grub-core/boot/mips/startup_raw.S b/grub-core/boot/mips/startup_raw.S -index ca3413b..fd95c31 100644 ---- a/grub-core/boot/mips/startup_raw.S -+++ b/grub-core/boot/mips/startup_raw.S -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - - #define BASE_ADDR 8 -@@ -32,6 +33,7 @@ - .globl __start, _start, start - .set noreorder - .set nomacro -+ mips_attributes - __start: - _start: - start: -diff --git a/grub-core/kern/mips/cache.S b/grub-core/kern/mips/cache.S -index 78e40bc..e83960f 100644 ---- a/grub-core/kern/mips/cache.S -+++ b/grub-core/kern/mips/cache.S -@@ -1,8 +1,10 @@ - - #include -+#include - - .set noreorder - .set nomacro -+ mips_attributes - - FUNCTION (grub_arch_sync_caches) - #include "cache_flush.S" -@@ -65,4 +67,4 @@ FUNCTION (grub_arch_sync_dma_caches) - #endif - sync_op - -- jr $ra -\ No newline at end of file -+ jr $ra -diff --git a/grub-core/kern/mips/startup.S b/grub-core/kern/mips/startup.S -index 339ab33..337aca9 100644 ---- a/grub-core/kern/mips/startup.S -+++ b/grub-core/kern/mips/startup.S -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - - #define BASE_ADDR 8 -@@ -28,6 +29,7 @@ - .globl __start, _start, start - .set noreorder - .set nomacro -+ mips_attributes - __start: - _start: - start: -diff --git a/grub-core/lib/mips/relocator_asm.S b/grub-core/lib/mips/relocator_asm.S -index 1d142a4..959893c 100644 ---- a/grub-core/lib/mips/relocator_asm.S -+++ b/grub-core/lib/mips/relocator_asm.S -@@ -17,11 +17,13 @@ - */ - - #include -+#include - - .p2align 4 /* force 16-byte alignment */ - - .set noreorder - .set nomacro -+ mips_attributes - - VARIABLE (grub_relocator_forward_start) - move $a0, $9 -diff --git a/include/grub/mips/kernel.h b/include/grub/mips/kernel.h -index 07b0884..d0e09dd 100644 ---- a/include/grub/mips/kernel.h -+++ b/include/grub/mips/kernel.h -@@ -21,4 +21,8 @@ - - #include - -+#ifdef ASM_FILE -+#define mips_attributes .gnu_attribute 4, 3 -+#endif -+ - #endif /* ! GRUB_KERNEL_MACHINE_HEADER */ --- -2.4.3 - diff --git a/0331-minilzo-Skip-parts-tha-we-don-t-need.patch b/0331-minilzo-Skip-parts-tha-we-don-t-need.patch deleted file mode 100644 index 6c125ed..0000000 --- a/0331-minilzo-Skip-parts-tha-we-don-t-need.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c5a4e79335cebc026684de623bdd327312139330 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 18:11:53 +0100 -Subject: [PATCH 331/506] minilzo: Skip parts tha we don't need. - ---- - config.h.in | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/config.h.in b/config.h.in -index d93b687..ea0f383 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -12,6 +12,14 @@ - #define DISK_CACHE_STATS @DISK_CACHE_STATS@ - #define BOOT_TIME_STATS @BOOT_TIME_STATS@ - -+/* We don't need those. */ -+#define MINILZO_CFG_SKIP_LZO_PTR 1 -+#define MINILZO_CFG_SKIP_LZO_UTIL 1 -+#define MINILZO_CFG_SKIP_LZO_STRING 1 -+#define MINILZO_CFG_SKIP_LZO_INIT 1 -+#define MINILZO_CFG_SKIP_LZO1X_1_COMPRESS 1 -+#define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1 -+ - #if defined (GRUB_BUILD) - #undef ENABLE_NLS - #define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ --- -2.4.3 - diff --git a/0332-bitmap_scale-Optimize-by-moving-division-out-of-the-.patch b/0332-bitmap_scale-Optimize-by-moving-division-out-of-the-.patch deleted file mode 100644 index 62f450f..0000000 --- a/0332-bitmap_scale-Optimize-by-moving-division-out-of-the-.patch +++ /dev/null @@ -1,178 +0,0 @@ -From dd4889f727c535948fd6ab67154a52b10bc544c9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 18:13:36 +0100 -Subject: [PATCH 332/506] bitmap_scale: Optimize by moving division out of the - loop. - ---- - grub-core/video/bitmap_scale.c | 114 +++++++++++++++++++++++++---------------- - 1 file changed, 69 insertions(+), 45 deletions(-) - -diff --git a/grub-core/video/bitmap_scale.c b/grub-core/video/bitmap_scale.c -index 0b93d02..70c32f0 100644 ---- a/grub-core/video/bitmap_scale.c -+++ b/grub-core/video/bitmap_scale.c -@@ -361,35 +361,46 @@ scale_nn (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) - unsigned dh = dst->mode_info.height; - unsigned sw = src->mode_info.width; - unsigned sh = src->mode_info.height; -- unsigned dstride = dst->mode_info.pitch; -- unsigned sstride = src->mode_info.pitch; -+ int dstride = dst->mode_info.pitch; -+ int sstride = src->mode_info.pitch; - /* bytes_per_pixel is the same for both src and dst. */ -- unsigned bytes_per_pixel = dst->mode_info.bytes_per_pixel; -+ int bytes_per_pixel = dst->mode_info.bytes_per_pixel; -+ unsigned dy, sy, ystep, yfrac, yover; -+ unsigned sx, xstep, xfrac, xover; -+ grub_uint8_t *dptr, *dline_end, *sline; - -- unsigned dy; -- for (dy = 0; dy < dh; dy++) -+ xstep = sw / dw; -+ xover = sw % dw; -+ ystep = sh / dh; -+ yover = sh % dh; -+ -+ for (dy = 0, sy = 0, yfrac = 0; dy < dh; dy++, sy += ystep, yfrac += yover) - { -- unsigned dx; -- for (dx = 0; dx < dw; dx++) -+ if (yfrac >= dh) -+ { -+ yfrac -= dh; -+ sy++; -+ } -+ dptr = ddata + dy * dstride; -+ dline_end = dptr + dw * bytes_per_pixel; -+ sline = sdata + sy * sstride; -+ for (sx = 0, xfrac = 0; dptr < dline_end; sx += xstep, xfrac += xover, dptr += bytes_per_pixel) - { -- grub_uint8_t *dptr; - grub_uint8_t *sptr; -- unsigned sx; -- unsigned sy; -- unsigned comp; -+ int comp; - -- /* Compute the source coordinate that the destination coordinate -- maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */ -- sx = sw * dx / dw; -- sy = sh * dy / dh; -+ if (xfrac >= dw) -+ { -+ xfrac -= dw; -+ sx++; -+ } - - /* Get the address of the pixels in src and dst. */ -- dptr = ddata + dy * dstride + dx * bytes_per_pixel; -- sptr = sdata + sy * sstride + sx * bytes_per_pixel; -+ sptr = sline + sx * bytes_per_pixel; - -- /* Copy the pixel color value. */ -- for (comp = 0; comp < bytes_per_pixel; comp++) -- dptr[comp] = sptr[comp]; -+ /* Copy the pixel color value. */ -+ for (comp = 0; comp < bytes_per_pixel; comp++) -+ dptr[comp] = sptr[comp]; - } - } - return GRUB_ERR_NONE; -@@ -422,27 +433,40 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) - int sstride = src->mode_info.pitch; - /* bytes_per_pixel is the same for both src and dst. */ - int bytes_per_pixel = dst->mode_info.bytes_per_pixel; -+ unsigned dy, syf, sy, ystep, yfrac, yover; -+ unsigned sxf, sx, xstep, xfrac, xover; -+ grub_uint8_t *dptr, *dline_end, *sline; -+ -+ xstep = (sw << 8) / dw; -+ xover = (sw << 8) % dw; -+ ystep = (sh << 8) / dh; -+ yover = (sh << 8) % dh; - -- unsigned dy; -- for (dy = 0; dy < dh; dy++) -+ for (dy = 0, syf = 0, yfrac = 0; dy < dh; dy++, syf += ystep, yfrac += yover) - { -- unsigned dx; -- for (dx = 0; dx < dw; dx++) -+ if (yfrac >= dh) -+ { -+ yfrac -= dh; -+ syf++; -+ } -+ sy = syf >> 8; -+ dptr = ddata + dy * dstride; -+ dline_end = dptr + dw * bytes_per_pixel; -+ sline = sdata + sy * sstride; -+ for (sxf = 0, xfrac = 0; dptr < dline_end; sxf += xstep, xfrac += xover, dptr += bytes_per_pixel) - { -- grub_uint8_t *dptr; - grub_uint8_t *sptr; -- unsigned sx; -- unsigned sy; - int comp; - -- /* Compute the source coordinate that the destination coordinate -- maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */ -- sx = sw * dx / dw; -- sy = sh * dy / dh; -+ if (xfrac >= dw) -+ { -+ xfrac -= dw; -+ sxf++; -+ } - - /* Get the address of the pixels in src and dst. */ -- dptr = ddata + dy * dstride + dx * bytes_per_pixel; -- sptr = sdata + sy * sstride + sx * bytes_per_pixel; -+ sx = sxf >> 8; -+ sptr = sline + sx * bytes_per_pixel; - - /* If we have enough space to do so, use bilinear interpolation. - Otherwise, fall back to nearest neighbor for this pixel. */ -@@ -453,27 +477,27 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) - /* Fixed-point .8 numbers representing the fraction of the - distance in the x (u) and y (v) direction within the - box of 4 pixels in the source. */ -- int u = (256 * sw * dx / dw) - (sx * 256); -- int v = (256 * sh * dy / dh) - (sy * 256); -+ unsigned u = sxf & 0xff; -+ unsigned v = syf & 0xff; - - for (comp = 0; comp < bytes_per_pixel; comp++) - { - /* Get the component's values for the - four source corner pixels. */ -- int f00 = sptr[comp]; -- int f10 = sptr[comp + bytes_per_pixel]; -- int f01 = sptr[comp + sstride]; -- int f11 = sptr[comp + sstride + bytes_per_pixel]; -+ unsigned f00 = sptr[comp]; -+ unsigned f10 = sptr[comp + bytes_per_pixel]; -+ unsigned f01 = sptr[comp + sstride]; -+ unsigned f11 = sptr[comp + sstride + bytes_per_pixel]; - - /* Count coeffecients. */ -- int c00 = (256 - u) * (256 - v); -- int c10 = u * (256 - v); -- int c01 = (256 - u) * v; -- int c11 = u * v; -+ unsigned c00 = (256 - u) * (256 - v); -+ unsigned c10 = u * (256 - v); -+ unsigned c01 = (256 - u) * v; -+ unsigned c11 = u * v; - - /* Interpolate. */ -- int fxy = c00 * f00 + c01 * f01 + c10 * f10 + c11 * f11; -- fxy = fxy / (256 * 256); -+ unsigned fxy = c00 * f00 + c01 * f01 + c10 * f10 + c11 * f11; -+ fxy = fxy >> 16; - - dptr[comp] = fxy; - } --- -2.4.3 - diff --git a/0333-fbblit-Optimize-by-replacing-division-with-additions.patch b/0333-fbblit-Optimize-by-replacing-division-with-additions.patch deleted file mode 100644 index 7f5fdef..0000000 --- a/0333-fbblit-Optimize-by-replacing-division-with-additions.patch +++ /dev/null @@ -1,160 +0,0 @@ -From f51218bc15ff7b82894a2096ec1cdb7c8f0084f4 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 18:14:28 +0100 -Subject: [PATCH 333/506] fbblit: Optimize by replacing division with additions - and shifts. - ---- - grub-core/video/fb/fbblit.c | 71 ++++++++++++++++++++++++++------------------- - 1 file changed, 41 insertions(+), 30 deletions(-) - -diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c -index 3a073ce..d559248 100644 ---- a/grub-core/video/fb/fbblit.c -+++ b/grub-core/video/fb/fbblit.c -@@ -1145,6 +1145,20 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst, - } - } - -+static inline grub_uint8_t -+alpha_dilute (grub_uint8_t bg, grub_uint8_t fg, grub_uint8_t alpha) -+{ -+ grub_uint16_t s; -+ grub_uint16_t h, l; -+ s = (fg * alpha) + (bg * (255 ^ alpha)); -+ /* Optimised division by 255. */ -+ h = s >> 8; -+ l = s & 0xff; -+ if (h + l >= 255) -+ h++; -+ return h; -+} -+ - /* Generic blending blitter. Works for every supported format. */ - static void - grub_video_fbblit_blend (struct grub_video_fbblit_info *dst, -@@ -1190,12 +1204,9 @@ grub_video_fbblit_blend (struct grub_video_fbblit_info *dst, - grub_video_fb_unmap_color_int (dst, dst_color, &dst_red, - &dst_green, &dst_blue, &dst_alpha); - -- dst_red = (((src_red * src_alpha) -- + (dst_red * (255 ^ src_alpha))) / 255U); -- dst_green = (((src_green * src_alpha) -- + (dst_green * (255 ^ src_alpha))) / 255U); -- dst_blue = (((src_blue * src_alpha) -- + (dst_blue * (255 ^ src_alpha))) / 255U); -+ dst_red = alpha_dilute (dst_red, src_red, src_alpha); -+ dst_green = alpha_dilute (dst_green, src_green, src_alpha); -+ dst_blue = alpha_dilute (dst_blue, src_blue, src_alpha); - - dst_alpha = src_alpha; - dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue, -@@ -1270,11 +1281,11 @@ grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst, - color = *dstptr; - - dr = (color >> 16) & 0xFF; -- dr = (dr * (255 ^ a) + sr * a) / 255U; -+ dr = alpha_dilute (dr, sr, a); - dg = (color >> 8) & 0xFF; -- dg = (dg * (255 ^ a) + sg * a) / 255U; -+ dg = alpha_dilute (dg, sg, a); - db = (color >> 0) & 0xFF; -- db = (db * (255 ^ a) + sb * a) / 255U; -+ db = alpha_dilute (db, sb, a); - } - - color = (a << 24) | (dr << 16) | (dg << 8) | db; -@@ -1360,9 +1371,9 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst, - db = dstptr[2]; - #endif - -- db = (db * (255 ^ a) + sb * a) / 255U; -- dg = (dg * (255 ^ a) + sg * a) / 255U; -- dr = (dr * (255 ^ a) + sr * a) / 255U; -+ db = alpha_dilute (db, sb, a); -+ dg = alpha_dilute (dg, sg, a); -+ dr = alpha_dilute (dr, sr, a); - } - - #ifndef GRUB_CPU_WORDS_BIGENDIAN -@@ -1440,9 +1451,9 @@ grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst, - dg = (color >> 8) & 0xFF; - db = (color >> 16) & 0xFF; - -- dr = (dr * (255 ^ a) + sr * a) / 255U; -- dg = (dg * (255 ^ a) + sg * a) / 255U; -- db = (db * (255 ^ a) + sb * a) / 255U; -+ dr = alpha_dilute (dr, sr, a); -+ dg = alpha_dilute (dg, sg, a); -+ db = alpha_dilute (db, sb, a); - - color = (a << 24) | (db << 16) | (dg << 8) | dr; - -@@ -1525,9 +1536,9 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst, - dr = dstptr[2]; - #endif - -- dr = (dr * (255 ^ a) + sr * a) / 255U; -- dg = (dg * (255 ^ a) + sg * a) / 255U; -- db = (db * (255 ^ a) + sb * a) / 255U; -+ dr = alpha_dilute (dr, sr, a); -+ dg = alpha_dilute (dg, sg, a); -+ db = alpha_dilute (db, sb, a); - - #ifndef GRUB_CPU_WORDS_BIGENDIAN - *dstptr++ = dr; -@@ -1601,9 +1612,9 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst, - - grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da); - -- dr = (dr * (255 ^ a) + sr * a) / 255U; -- dg = (dg * (255 ^ a) + sg * a) / 255U; -- db = (db * (255 ^ a) + sb * a) / 255U; -+ dr = alpha_dilute (dr, sr, a); -+ dg = alpha_dilute (dg, sg, a); -+ db = alpha_dilute (db, sb, a); - - color = grub_video_fb_map_rgb(dr, dg, db); - -@@ -1683,9 +1694,9 @@ grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst, - grub_uint8_t d2 = (*dstptr >> 8) & 0xFF; - grub_uint8_t d3 = (*dstptr >> 16) & 0xFF; - -- d1 = (d1 * (255 ^ a) + s1 * a) / 255U; -- d2 = (d2 * (255 ^ a) + s2 * a) / 255U; -- d3 = (d3 * (255 ^ a) + s3 * a) / 255U; -+ d1 = alpha_dilute (d1, s1, a); -+ d2 = alpha_dilute (d2, s2, a); -+ d3 = alpha_dilute (d3, s3, a); - - *dstptr = (a << 24) | (d3 << 16) | (d2 << 8) | d1; - } -@@ -1791,9 +1802,9 @@ grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst, - grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF; - grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF; - -- ((grub_uint8_t *) dstptr)[0] = (d1 * (255 ^ a) + s1 * a) / 255U; -- ((grub_uint8_t *) dstptr)[1] = (d2 * (255 ^ a) + s2 * a) / 255U; -- ((grub_uint8_t *) dstptr)[2] = (d3 * (255 ^ a) + s3 * a) / 255U; -+ ((grub_uint8_t *) dstptr)[0] = alpha_dilute (d1, s1, a); -+ ((grub_uint8_t *) dstptr)[1] = alpha_dilute (d2, s2, a); -+ ((grub_uint8_t *) dstptr)[2] = alpha_dilute (d3, s3, a); - } - - srcmask >>= 1; -@@ -1887,9 +1898,9 @@ grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst, - grub_uint8_t d2 = (*dstptr >> 5) & 0x3F; - grub_uint8_t d3 = (*dstptr >> 11) & 0x1F; - -- d1 = (d1 * (255 ^ a) + s1 * a) / 255U; -- d2 = (d2 * (255 ^ a) + s2 * a) / 255U; -- d3 = (d3 * (255 ^ a) + s3 * a) / 255U; -+ d1 = alpha_dilute (d1, s1, a); -+ d2 = alpha_dilute (d2, s2, a); -+ d3 = alpha_dilute (d3, s3, a); - - *dstptr = (d1 & 0x1f) | ((d2 & 0x3f) << 5) | ((d3 & 0x1f) << 11); - } --- -2.4.3 - diff --git a/0334-Add-missing-lib-division.c.patch b/0334-Add-missing-lib-division.c.patch deleted file mode 100644 index 7ef0048..0000000 --- a/0334-Add-missing-lib-division.c.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 80310ad07dfbd682ade52f2db2e536e0e7ccc471 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 18:22:40 +0100 -Subject: [PATCH 334/506] Add missing lib/division.c - ---- - grub-core/lib/division.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 73 insertions(+) - create mode 100644 grub-core/lib/division.c - -diff --git a/grub-core/lib/division.c b/grub-core/lib/division.c -new file mode 100644 -index 0000000..920a79f ---- /dev/null -+++ b/grub-core/lib/division.c -@@ -0,0 +1,73 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_uint64_t -+abs64(grub_int64_t a) -+{ -+ return a > 0 ? a : -a; -+} -+ -+grub_int64_t -+grub_divmod64s (grub_int64_t n, -+ grub_int64_t d, -+ grub_int64_t *ro) -+{ -+ grub_uint64_t ru; -+ grub_int64_t q, r; -+ q = grub_divmod64 (abs64(n), abs64(d), &ru); -+ r = ru; -+ /* Now: |n| = |d| * q + r */ -+ if (n < 0) -+ { -+ /* -|n| = |d| * (-q) + (-r) */ -+ q = -q; -+ r = -r; -+ } -+ /* Now: n = |d| * q + r */ -+ if (d < 0) -+ { -+ /* n = (-|d|) * (-q) + r */ -+ q = -q; -+ } -+ /* Now: n = d * q + r */ -+ *ro = r; -+ return q; -+} -+ -+grub_uint32_t -+grub_divmod32 (grub_uint32_t n, grub_uint32_t d, grub_uint32_t *ro) -+{ -+ grub_uint64_t q, r; -+ q = grub_divmod64 (n, d, &r); -+ *ro = r; -+ return q; -+} -+ -+grub_int32_t -+grub_divmod32s (grub_int32_t n, grub_int32_t d, grub_int32_t *ro) -+{ -+ grub_int64_t q, r; -+ q = grub_divmod64s (n, d, &r); -+ *ro = r; -+ return q; -+} --- -2.4.3 - diff --git a/0335-png-Optimize-by-avoiding-divisions.patch b/0335-png-Optimize-by-avoiding-divisions.patch deleted file mode 100644 index de79bec..0000000 --- a/0335-png-Optimize-by-avoiding-divisions.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 18125877eec4e6d7b0b6567b6c92eab1df946f47 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 18:27:43 +0100 -Subject: [PATCH 335/506] png: Optimize by avoiding divisions. - ---- - grub-core/video/readers/png.c | 29 ++++++++++++++++++++--------- - 1 file changed, 20 insertions(+), 9 deletions(-) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index 1f03f88..e1a01e9 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -227,7 +227,7 @@ grub_png_decode_image_palette (struct grub_png_data *data, - { - unsigned i = 0, j; - -- if (len == 0 || len % 3 != 0) -+ if (len == 0) - return GRUB_ERR_NONE; - - for (i = 0; 3 * i < len && i < 256; i++) -@@ -851,15 +851,26 @@ grub_png_convert_image (struct grub_png_data *data) - int mask = (1 << data->color_bits) - 1; - unsigned j; - if (data->is_gray) -- for (i = 0; i < (1U << data->color_bits); i++) -- { -- grub_uint8_t col = (0xff * i) / ((1U << data->color_bits) - 1); -- palette[i][0] = col; -- palette[i][1] = col; -- palette[i][2] = col; -- } -+ { -+ /* Generic formula is -+ (0xff * i) / ((1U << data->color_bits) - 1) -+ but for allowed bit depth of 1, 2 and for it's -+ equivalent to -+ (0xff / ((1U << data->color_bits) - 1)) * i -+ Precompute the multipliers to avoid division. -+ */ -+ -+ const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 }; -+ for (i = 0; i < (1U << data->color_bits); i++) -+ { -+ grub_uint8_t col = multipliers[data->color_bits] * i; -+ palette[i][0] = col; -+ palette[i][1] = col; -+ palette[i][2] = col; -+ } -+ } - else -- grub_memcpy (palette, data->palette, 16 * 3); -+ grub_memcpy (palette, data->palette, 3 << data->color_bits); - d1c = d1; - d2c = d2; - for (j = 0; j < data->image_height; j++, d1c += data->image_width * 3, --- -2.4.3 - diff --git a/0336-jpeg-Optimise-by-replacing-division-with-shifts.patch b/0336-jpeg-Optimise-by-replacing-division-with-shifts.patch deleted file mode 100644 index 6f3f754..0000000 --- a/0336-jpeg-Optimise-by-replacing-division-with-shifts.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 7213c1e02807e760febec06a0f19b11173abc55a Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 21:27:32 +0100 -Subject: [PATCH 336/506] jpeg: Optimise by replacing division with shifts. - ---- - grub-core/video/readers/jpeg.c | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index 38ea239..c3e0df2 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -94,7 +94,7 @@ struct grub_jpeg_data - jpeg_data_unit_t crdu; - jpeg_data_unit_t cbdu; - -- unsigned vs, hs; -+ unsigned log_vs, log_hs; - int dri; - unsigned r1; - -@@ -315,11 +315,14 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) - ss = grub_jpeg_get_byte (data); /* Sampling factor. */ - if (!id) - { -- data->vs = ss & 0xF; /* Vertical sampling. */ -- data->hs = ss >> 4; /* Horizontal sampling. */ -- if ((data->vs > 2) || (data->hs > 2) || (data->vs == 0) || (data->hs == 0)) -+ grub_uint8_t vs, hs; -+ vs = ss & 0xF; /* Vertical sampling. */ -+ hs = ss >> 4; /* Horizontal sampling. */ -+ if ((vs > 2) || (hs > 2) || (vs == 0) || (hs == 0)) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: sampling method not supported"); -+ data->log_vs = (vs == 2); -+ data->log_hs = (hs == 2); - } - else if (ss != JPEG_SAMPLING_1x1) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, -@@ -616,10 +619,10 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - unsigned c1, vb, hb, nr1, nc1; - int rst = data->dri; - -- vb = data->vs * 8; -- hb = data->hs * 8; -- nr1 = (data->image_height + vb - 1) / vb; -- nc1 = (data->image_width + hb - 1) / hb; -+ vb = 8 << data->log_vs; -+ hb = 8 << data->log_hs; -+ nr1 = (data->image_height + vb - 1) >> (3 + data->log_vs); -+ nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs); - - for (; data->r1 < nr1 && (!data->dri || rst); - data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) -@@ -629,8 +632,8 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - unsigned r2, c2, nr2, nc2; - grub_uint8_t *ptr2; - -- for (r2 = 0; r2 < data->vs; r2++) -- for (c2 = 0; c2 < data->hs; c2++) -+ for (r2 = 0; r2 < (1U << data->log_vs); r2++) -+ for (c2 = 0; c2 < (1U << data->log_hs); c2++) - grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); - - if (data->color_components >= 3) -@@ -652,7 +655,7 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - unsigned i0; - int yy; - -- i0 = (r2 / data->vs) * 8 + (c2 / data->hs); -+ i0 = (r2 >> data->log_vs) * 8 + (c2 >> data->log_hs); - yy = data->ydu[(r2 / 8) * 2 + (c2 / 8)][(r2 % 8) * 8 + (c2 % 8)]; - - if (data->color_components >= 3) --- -2.4.3 - diff --git a/0337-crypto-restrict-cipher-block-size-to-power-of-2.patch b/0337-crypto-restrict-cipher-block-size-to-power-of-2.patch deleted file mode 100644 index 858ea85..0000000 --- a/0337-crypto-restrict-cipher-block-size-to-power-of-2.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 94f701a826b54e6652044bdba9a8b6a9aa2b479e Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:04:40 +0100 -Subject: [PATCH 337/506] crypto: restrict cipher block size to power of 2. - -All current ciphers have blocks which are power of 2 and it's -unlikely to change. Other block length would be tricky to handle anyway. -This restriction allows avoiding extra divisions. ---- - grub-core/disk/cryptodisk.c | 36 +++++++++++++++++++++--------------- - grub-core/lib/crypto.c | 42 +++++++++++++++++++++++++++--------------- - 2 files changed, 48 insertions(+), 30 deletions(-) - -diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c -index 376ab83..82a3dcb 100644 ---- a/grub-core/disk/cryptodisk.c -+++ b/grub-core/disk/cryptodisk.c -@@ -110,20 +110,23 @@ grub_crypto_pcbc_decrypt (grub_crypto_cipher_handle_t cipher, - { - grub_uint8_t *inptr, *outptr, *end; - grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; -- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) -- return GPG_ERR_INV_ARG; -+ grub_size_t blocksize; - if (!cipher->cipher->decrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) -+ return GPG_ERR_INV_ARG; -+ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) - return GPG_ERR_INV_ARG; - end = (grub_uint8_t *) in + size; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - { -- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); -+ grub_memcpy (ivt, inptr, blocksize); - cipher->cipher->decrypt (cipher->ctx, outptr, inptr); -- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); -- grub_crypto_xor (iv, ivt, outptr, cipher->cipher->blocksize); -+ grub_crypto_xor (outptr, outptr, iv, blocksize); -+ grub_crypto_xor (iv, ivt, outptr, blocksize); - } - return GPG_ERR_NO_ERROR; - } -@@ -135,20 +138,23 @@ grub_crypto_pcbc_encrypt (grub_crypto_cipher_handle_t cipher, - { - grub_uint8_t *inptr, *outptr, *end; - grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; -- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) -- return GPG_ERR_INV_ARG; -- if (!cipher->cipher->decrypt) -+ grub_size_t blocksize; -+ if (!cipher->cipher->encrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) -+ return GPG_ERR_INV_ARG; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) - return GPG_ERR_INV_ARG; - end = (grub_uint8_t *) in + size; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - { -- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); -- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); -+ grub_memcpy (ivt, inptr, blocksize); -+ grub_crypto_xor (outptr, outptr, iv, blocksize); - cipher->cipher->encrypt (cipher->ctx, outptr, inptr); -- grub_crypto_xor (iv, ivt, outptr, cipher->cipher->blocksize); -+ grub_crypto_xor (iv, ivt, outptr, blocksize); - } - return GPG_ERR_NO_ERROR; - } -diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index 8e8426c..010e550 100644 ---- a/grub-core/lib/crypto.c -+++ b/grub-core/lib/crypto.c -@@ -205,13 +205,16 @@ grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher, - { - const grub_uint8_t *inptr, *end; - grub_uint8_t *outptr; -+ grub_size_t blocksize; - if (!cipher->cipher->decrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) - return GPG_ERR_INV_ARG; - end = (const grub_uint8_t *) in + size; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - cipher->cipher->decrypt (cipher->ctx, outptr, inptr); - return GPG_ERR_NO_ERROR; - } -@@ -222,13 +225,16 @@ grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher, - { - const grub_uint8_t *inptr, *end; - grub_uint8_t *outptr; -+ grub_size_t blocksize; - if (!cipher->cipher->encrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) - return GPG_ERR_INV_ARG; - end = (const grub_uint8_t *) in + size; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - cipher->cipher->encrypt (cipher->ctx, outptr, inptr); - return GPG_ERR_NO_ERROR; - } -@@ -241,20 +247,23 @@ grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher, - grub_uint8_t *outptr; - const grub_uint8_t *inptr, *end; - void *iv; -- if (!cipher->cipher->decrypt) -+ grub_size_t blocksize; -+ if (!cipher->cipher->encrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) - return GPG_ERR_INV_ARG; - end = (const grub_uint8_t *) in + size; - iv = iv_in; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - { -- grub_crypto_xor (outptr, inptr, iv, cipher->cipher->blocksize); -+ grub_crypto_xor (outptr, inptr, iv, blocksize); - cipher->cipher->encrypt (cipher->ctx, outptr, outptr); - iv = outptr; - } -- grub_memcpy (iv_in, iv, cipher->cipher->blocksize); -+ grub_memcpy (iv_in, iv, blocksize); - return GPG_ERR_NO_ERROR; - } - -@@ -266,20 +275,23 @@ grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher, - const grub_uint8_t *inptr, *end; - grub_uint8_t *outptr; - grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; -+ grub_size_t blocksize; - if (!cipher->cipher->decrypt) - return GPG_ERR_NOT_SUPPORTED; -- if (size % cipher->cipher->blocksize != 0) -+ blocksize = cipher->cipher->blocksize; -+ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) -+ || ((size & (blocksize - 1)) != 0)) - return GPG_ERR_INV_ARG; -- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) -+ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) - return GPG_ERR_INV_ARG; - end = (const grub_uint8_t *) in + size; - for (inptr = in, outptr = out; inptr < end; -- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) -+ inptr += blocksize, outptr += blocksize) - { -- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); -+ grub_memcpy (ivt, inptr, blocksize); - cipher->cipher->decrypt (cipher->ctx, outptr, inptr); -- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); -- grub_memcpy (iv, ivt, cipher->cipher->blocksize); -+ grub_crypto_xor (outptr, outptr, iv, blocksize); -+ grub_memcpy (iv, ivt, blocksize); - } - return GPG_ERR_NO_ERROR; - } --- -2.4.3 - diff --git a/0338-dmraid_nvidia-Fix-division-by-0-and-missing-byte-swa.patch b/0338-dmraid_nvidia-Fix-division-by-0-and-missing-byte-swa.patch deleted file mode 100644 index c7ded2d..0000000 --- a/0338-dmraid_nvidia-Fix-division-by-0-and-missing-byte-swa.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f76c98b79eabccd1bdbd0d7c2763e09aa1e58e06 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:06:19 +0100 -Subject: [PATCH 338/506] dmraid_nvidia: Fix division by 0 and missing - byte-swap. - ---- - grub-core/disk/dmraid_nvidia.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/grub-core/disk/dmraid_nvidia.c b/grub-core/disk/dmraid_nvidia.c -index fc02f57..881508c 100644 ---- a/grub-core/disk/dmraid_nvidia.c -+++ b/grub-core/disk/dmraid_nvidia.c -@@ -99,6 +99,8 @@ grub_dmraid_nv_detect (grub_disk_t disk, - struct grub_nv_super sb; - int level; - grub_uint64_t disk_size; -+ grub_uint32_t capacity; -+ grub_uint8_t total_volumes; - char *uuid; - - if (disk->partition) -@@ -124,14 +126,17 @@ grub_dmraid_nv_detect (grub_disk_t disk, - return NULL; - } - -+ capacity = grub_le_to_cpu32 (sb.capacity); -+ total_volumes = sb.array.total_volumes; -+ - switch (sb.array.raid_level) - { - case NV_LEVEL_0: - level = 0; -- disk_size = sb.capacity / sb.array.total_volumes; -- if (sb.array.total_volumes == 0) -+ if (total_volumes == 0) - /* Not RAID. */ - return NULL; -+ disk_size = capacity / total_volumes; - break; - - case NV_LEVEL_1: -@@ -141,10 +146,10 @@ grub_dmraid_nv_detect (grub_disk_t disk, - - case NV_LEVEL_5: - level = 5; -- disk_size = sb.capacity / (sb.array.total_volumes - 1); -- if (sb.array.total_volumes == 0 || sb.array.total_volumes == 1) -+ if (total_volumes == 0 || total_volumes == 1) - /* Not RAID. */ - return NULL; -+ disk_size = capacity / (total_volumes - 1); - break; - - default: --- -2.4.3 - diff --git a/0339-raid6-Optimize-by-removing-division.patch b/0339-raid6-Optimize-by-removing-division.patch deleted file mode 100644 index 98417a0..0000000 --- a/0339-raid6-Optimize-by-removing-division.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 67a6a9512a52fee34a452752787dc80577fa7838 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:07:22 +0100 -Subject: [PATCH 339/506] raid6: Optimize by removing division. - ---- - grub-core/disk/raid6_recover.c | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/grub-core/disk/raid6_recover.c b/grub-core/disk/raid6_recover.c -index f9ec632..aa674f6 100644 ---- a/grub-core/disk/raid6_recover.c -+++ b/grub-core/disk/raid6_recover.c -@@ -63,6 +63,16 @@ grub_raid6_init_table (void) - } - } - -+static unsigned -+mod_255 (unsigned x) -+{ -+ while (x > 0xff) -+ x = (x >> 8) + (x & 0xff); -+ if (x == 0xff) -+ return 0; -+ return x; -+} -+ - static grub_err_t - grub_raid6_recover (struct grub_diskfilter_segment *array, int disknr, int p, - char *buf, grub_disk_addr_t sector, grub_size_t size) -@@ -162,11 +172,11 @@ grub_raid6_recover (struct grub_diskfilter_segment *array, int disknr, int p, - - grub_crypto_xor (qbuf, qbuf, buf, size); - -- c = ((255 ^ bad1) -- + (255 ^ powx_inv[(powx[bad2 + (bad1 ^ 255)] ^ 1)])) % 255; -+ c = mod_255((255 ^ bad1) -+ + (255 ^ powx_inv[(powx[bad2 + (bad1 ^ 255)] ^ 1)])); - grub_raid_block_mulx (c, qbuf, size); - -- c = ((unsigned) bad2 + c) % 255; -+ c = mod_255((unsigned) bad2 + c); - grub_raid_block_mulx (c, pbuf, size); - - grub_crypto_xor (pbuf, pbuf, qbuf, size); --- -2.4.3 - diff --git a/0340-gzio-Optimize-by-removing-division.patch b/0340-gzio-Optimize-by-removing-division.patch deleted file mode 100644 index 73f8ef0..0000000 --- a/0340-gzio-Optimize-by-removing-division.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 7ba066419a2e0f777a0c103b058fba49e1492f04 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:10:09 +0100 -Subject: [PATCH 340/506] gzio: Optimize by removing division. - ---- - grub-core/io/gzio.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c -index 129209e..0f2ea6b 100644 ---- a/grub-core/io/gzio.c -+++ b/grub-core/io/gzio.c -@@ -1161,6 +1161,19 @@ grub_gzio_open (grub_file_t io, const char *name __attribute__ ((unused))) - return file; - } - -+static grub_uint8_t -+mod_31 (grub_uint16_t v) -+{ -+ /* At most 2 iterations for any number that -+ we can get here. -+ In any case faster than real division. */ -+ while (v > 0x1f) -+ v = (v & 0x1f) + (v >> 5); -+ if (v == 0x1f) -+ return 0; -+ return v; -+} -+ - static int - test_zlib_header (grub_gzio_t gzio) - { -@@ -1178,7 +1191,10 @@ test_zlib_header (grub_gzio_t gzio) - return 0; - } - -- if ((cmf * 256U + flg) % 31U) -+ /* Usually it would be: (cmf * 256 + flg) % 31 != 0. */ -+ /* But 256 == 8 (31). */ -+ /* By multiplying by 4 and using 32 == 1 (31). We get our formula. */ -+ if (mod_31 (cmf + flg * 4) != 0) - { - grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, N_("unsupported gzip format")); - return 0; --- -2.4.3 - diff --git a/0341-arm-dl-Fix-handling-of-nonstandard-relocation-sizes.patch b/0341-arm-dl-Fix-handling-of-nonstandard-relocation-sizes.patch deleted file mode 100644 index 27c99c8..0000000 --- a/0341-arm-dl-Fix-handling-of-nonstandard-relocation-sizes.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 38b7a3026900670159f299f2daa7e35957752942 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:10:29 +0100 -Subject: [PATCH 341/506] arm/dl: Fix handling of nonstandard relocation sizes - ---- - grub-core/kern/arm/dl.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c -index 5cbd65e..24364e1 100644 ---- a/grub-core/kern/arm/dl.c -+++ b/grub-core/kern/arm/dl.c -@@ -78,9 +78,9 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, - const Elf_Rel *rel, *max; - - for (rel = (const Elf_Rel *) ((grub_addr_t) e + s->sh_offset), -- max = rel + s->sh_size / s->sh_entsize; -- rel < max; -- rel++) -+ max = (const Elf_Rel *) ((grub_addr_t) rel + s->sh_size); -+ rel + 1 <= max; -+ rel = (const Elf_Rel *) ((grub_addr_t) rel + s->sh_entsize)) - switch (ELF_R_TYPE (rel->r_info)) - { - case R_ARM_CALL: --- -2.4.3 - diff --git a/0342-emu-cache-Change-declaration-of-__clear_cache-to-mat.patch b/0342-emu-cache-Change-declaration-of-__clear_cache-to-mat.patch deleted file mode 100644 index c55d396..0000000 --- a/0342-emu-cache-Change-declaration-of-__clear_cache-to-mat.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 66b0e6649b8aa169db1b026abc4dd4167bb312e8 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 26 Feb 2015 22:20:59 +0100 -Subject: [PATCH 342/506] emu/cache: Change declaration of __clear_cache to - match builtin declaration. - -Fixes compile of arm64-emu. ---- - grub-core/kern/emu/cache.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/emu/cache.c b/grub-core/kern/emu/cache.c -index 07be675..6f89e87 100644 ---- a/grub-core/kern/emu/cache.c -+++ b/grub-core/kern/emu/cache.c -@@ -8,7 +8,7 @@ - #include "../ia64/cache.c" - #elif defined (__arm__) || defined (__aarch64__) - --void __clear_cache (char *beg, char *end); -+void __clear_cache (void *beg, void *end); - - void - grub_arch_sync_caches (void *address, grub_size_t len) --- -2.4.3 - diff --git a/0343-ntfs_test-Skip-is-setfattr-is-unavailable.patch b/0343-ntfs_test-Skip-is-setfattr-is-unavailable.patch deleted file mode 100644 index e80ca96..0000000 --- a/0343-ntfs_test-Skip-is-setfattr-is-unavailable.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 050505ab8f695c10b3e4e768a4188688ebe5e366 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 28 Feb 2015 15:13:41 +0100 -Subject: [PATCH 343/506] ntfs_test: Skip is setfattr is unavailable. - ---- - tests/ntfs_test.in | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tests/ntfs_test.in b/tests/ntfs_test.in -index 6bf09e6..e25c638 100644 ---- a/tests/ntfs_test.in -+++ b/tests/ntfs_test.in -@@ -15,5 +15,10 @@ if ! which mkfs.ntfs >/dev/null 2>&1; then - exit 77 - fi - -+if ! which setfattr >/dev/null 2>&1; then -+ echo "setfattr not installed; cannot test ntfs." -+ exit 77 -+fi -+ - "@builddir@/grub-fs-tester" ntfs --"@builddir@/grub-fs-tester" ntfscomp -\ No newline at end of file -+"@builddir@/grub-fs-tester" ntfscomp --- -2.4.3 - diff --git a/0344-grub-shell-Add-missing-locale-directory.patch b/0344-grub-shell-Add-missing-locale-directory.patch deleted file mode 100644 index fcc2312..0000000 --- a/0344-grub-shell-Add-missing-locale-directory.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ddde9ca71ac7e0c42a445f5a37085c5895098e34 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 28 Feb 2015 15:14:16 +0100 -Subject: [PATCH 344/506] grub-shell: Add missing --locale-directory. - -Fixes the language tests is no make install was done. ---- - tests/util/grub-shell.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in -index 5b66139..6d2b132 100644 ---- a/tests/util/grub-shell.in -+++ b/tests/util/grub-shell.in -@@ -349,6 +349,7 @@ fi - if [ x$boot != xnet ] && [ x$boot != xemu ]; then - pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ - --rom-directory="${rom_directory}" \ -+ --locale-directory="@srcdir@/po" \ - --themes-directory="@srcdir@/themes" \ - $mkimage_extra_arg ${mkrescue_args} \ - "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ --- -2.4.3 - diff --git a/0345-grub-probe-Mark-a-default-for-translation.patch b/0345-grub-probe-Mark-a-default-for-translation.patch deleted file mode 100644 index 4d324e6..0000000 --- a/0345-grub-probe-Mark-a-default-for-translation.patch +++ /dev/null @@ -1,32 +0,0 @@ -From afd6b6bbaedfd7724e6ccc0401c76021a429779b Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 28 Feb 2015 16:22:46 +0100 -Subject: [PATCH 345/506] grub-probe: Mark a "[default=]" for translation. - ---- - util/grub-probe.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 8a0c4f3..08d477f 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -728,10 +728,12 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) - - case 't': - { -- char *ret, *t = get_targets_string (); -+ char *ret, *t = get_targets_string (), *def; - -- ret = xasprintf ("%s\n%s %s [default=%s]", _("print TARGET"), -- _("available targets:"), t, targets[print]); -+ def = xasprintf (_("[default=%s]"), targets[print]); -+ -+ ret = xasprintf ("%s\n%s %s %s", _("print TARGET"), -+ _("available targets:"), t, def); - free (t); - return ret; - } --- -2.4.3 - diff --git a/0346-exclude.pot-Add-new-technical-strings.patch b/0346-exclude.pot-Add-new-technical-strings.patch deleted file mode 100644 index 5f5256a..0000000 --- a/0346-exclude.pot-Add-new-technical-strings.patch +++ /dev/null @@ -1,356 +0,0 @@ -From 0d6498a67d4542244c2ca183e05cfc3d858218be Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Sat, 28 Feb 2015 16:23:27 +0100 -Subject: [PATCH 346/506] exclude.pot: Add new technical strings - ---- - po/exclude.pot | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 291 insertions(+), 20 deletions(-) - -diff --git a/po/exclude.pot b/po/exclude.pot -index 1659eb0..ab52e99 100644 ---- a/po/exclude.pot -+++ b/po/exclude.pot -@@ -2296,10 +2296,6 @@ msgstr "" - msgid "WEEKDAY" - msgstr "" - --#: grub-core/io/lzopio.c:30 --msgid "‰LZO" --msgstr "" -- - #: grub-core/kern/dl.c:412 - msgid "grub_mod_init" - msgstr "" -@@ -4215,22 +4211,10 @@ msgstr "" - msgid "ext*" - msgstr "" - --#: grub-core/partmap/msdos.c:74 --msgid "ÔA õ" --msgstr "" -- --#: grub-core/partmap/msdos.c:80 --msgid "ØA õ" --msgstr "" -- - #: grub-core/partmap/msdos.c:86 - msgid "HP Backup and Recovery Manager (?)" - msgstr "" - --#: grub-core/partmap/msdos.c:87 --msgid "pŠ]F5Å“®=†ý±U>à" --msgstr "" -- - #: grub-core/partmap/msdos.c:94 - msgid "ycgl" - msgstr "" -@@ -4574,10 +4558,6 @@ msgstr "" - msgid " failed: %ld\n" - msgstr "" - --#: grub-core/lib/xzembed/xz_stream.h:35 --msgid "ý7zXZ" --msgstr "" -- - #: grub-core/lib/xzembed/xz_stream.h:38 - msgid "YZ" - msgstr "" -@@ -7173,3 +7153,294 @@ msgstr "" - #: util/grub-mkimagexx.c:845 - msgid "CALL26 Relocation out of range" - msgstr "" -+ -+#: grub-core/commands/verify.c:313 -+msgid "\x99" -+msgstr "" -+ -+#: grub-core/commands/videotest.c:122 -+msgid "Unicode test: happy\xE2\x98\xBA \xC2\xA3 5.00" -+ " \xC2\xA1\xCF\x84\xC3\xA4u! " -+ " \xE2\x84\xA4\xE2\x8A\x86\xE2\x84\x9D" -+msgstr "" -+ -+#: grub-core/disk/luks.c:40 -+msgid "LUKS\xBA\xBE" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:67 grub-core/disk/lvmparse.c:69 -+msgid " = [" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:115 grub-core/disk/lvmparse.c:123 -+#: grub-core/disk/lvmparse.c:167 grub-core/disk/lvmparse.c:170 -+msgid "id = \"" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:127 -+msgid "extent_size = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:143 grub-core/disk/lvmparse.c:146 -+msgid "physical_volumes {" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:174 -+msgid "pe_start = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:199 -+msgid "logical_volumes" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:202 -+msgid "logical_volumes = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:226 grub-core/disk/lvmparse.c:227 -+msgid "status" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:226 -+msgid "VISIBLE" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:227 -+msgid "PVMOVE" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:228 -+msgid "segment_count = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:246 -+msgid "segment" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:255 -+msgid "start_extent = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:263 -+msgid "extent_count = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:272 grub-core/disk/lvmparse.c:275 -+msgid "type = \"" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:277 grub-core/disk/lvmparse.c:278 -+msgid "striped\"" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:282 -+msgid "stripe_count = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:292 grub-core/disk/lvmparse.c:396 -+msgid "stripe_size = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:299 grub-core/disk/lvmparse.c:307 -+msgid "stripes = [" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:332 -+msgid "mirror\"" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:336 -+msgid "mirror_count = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:350 grub-core/disk/lvmparse.c:358 -+msgid "mirrors = [" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:375 grub-core/disk/lvmparse.c:376 -+#: grub-core/disk/lvmparse.c:377 grub-core/disk/lvmparse.c:384 -+msgid "raid" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:378 -+msgid "raidX" -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:386 -+msgid "device_count = " -+msgstr "" -+ -+#: grub-core/disk/lvmparse.c:410 grub-core/disk/lvmparse.c:418 -+msgid "raids = [" -+msgstr "" -+ -+#: grub-core/fs/cpio.c:24 -+msgid "\xc7\x71" -+msgstr "" -+ -+#: grub-core/fs/cpio_be.c:23 -+msgid "\x71\xc7" -+msgstr "" -+ -+#: grub-core/gfxmenu/gui_circular_progress.c:244 -+msgid "\xc2\xb0" -+msgstr "" -+ -+#: grub-core/kern/ieee1275/cmain.c:88 -+msgid "IBM pSeries (emulated by qemu)" -+msgstr "" -+ -+#: grub-core/lib/all_video.c:36 -+msgid "/video.lst" -+msgstr "" -+ -+#: grub-core/osdep/unix/config.c:108 -+#, c-format -+msgid "" -+"'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" " -+"\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\"" -+msgstr "" -+ -+#: include/grub/dl.h:141 -+msgid "license" -+msgstr "" -+ -+#: util/grub-install.c:1106 -+msgid "BOOTAA64.EFI" -+msgstr "" -+ -+#: util/grub-install.c:1133 -+msgid "grubaa64.efi" -+msgstr "" -+ -+#: util/grub-install.c:1274 -+msgid "GRUB_ENABLE_CRYPTODISK=y" -+msgstr "" -+ -+#: util/grub-mkrescue.c:656 -+msgid "part_gpt" -+msgstr "" -+ -+#: util/grub-mkrescue.c:657 -+msgid "part_msdos" -+msgstr "" -+ -+#: util/grub-mkrescue.c:663 util/grub-mkrescue.c:668 util/grub-mkrescue.c:723 -+msgid "part_apple" -+msgstr "" -+ -+#: util/grub-mkrescue.c:677 -+msgid "bootaa64.efi" -+msgstr "" -+ -+#: util/grub-probe.c:136 util/grub-probe.c:151 util/grub-probe.c:190 -+#: util/grub-probe.c:247 -+#, c-format -+msgid "%s%c" -+msgstr "" -+ -+#: util/grub-probe.c:233 -+#, c-format -+msgid "lvm%c" -+msgstr "" -+ -+#: util/grub-probe.c:237 -+#, c-format -+msgid "ldm%c" -+msgstr "" -+ -+#: util/grub-probe.c:245 -+#, c-format -+msgid "diskfilter%c" -+msgstr "" -+ -+#: util/grub-probe.c:250 -+#, c-format -+msgid "raid5rec%c" -+msgstr "" -+ -+#: util/grub-probe.c:252 -+#, c-format -+msgid "raid6rec%c" -+msgstr "" -+ -+#: util/grub-mkrescue.c:136 -+#, c-format -+msgid "%s\n\n%s\n\n%s" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:133 -+msgid "couldn't get memory map, not enabling caches" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:149 -+#, c-format -+msgid "%d crossers\n" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:154 -+msgid "couldn't allocate place for MMU table, not enabling caches" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:212 -+msgid "MMU tables generated\n" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:216 -+msgid "enabling MMU\n" -+msgstr "" -+ -+#: grub-core/kern/arm/cache.c:218 -+msgid "MMU enabled\n" -+msgstr "" -+ -+#: grub-core/commands/verify.c:313 -+msgid "™" -+msgstr "" -+ -+#: grub-core/commands/videotest.c:122 -+msgid "Unicode test: happy☺ £ 5.00 ¡Ã„äu! ℤ⊆â„Â" -+msgstr "" -+ -+#: grub-core/disk/luks.c:40 -+msgid "LUKSº¾" -+msgstr "" -+ -+#: grub-core/fs/cpio.c:24 -+msgid "Çq" -+msgstr "" -+ -+#: grub-core/fs/cpio_be.c:23 -+msgid "qÇ" -+msgstr "" -+ -+#: grub-core/gfxmenu/gui_circular_progress.c:244 -+msgid "°" -+msgstr "" -+ -+#: grub-core/lib/xzembed/xz_stream.h:35 -+msgid "ý7zXZ" -+msgstr "" -+ -+#: grub-core/partmap/msdos.c:74 -+msgid "ÔA õ" -+msgstr "" -+ -+#: grub-core/partmap/msdos.c:80 -+msgid "ØA õ" -+msgstr "" -+ -+#: grub-core/partmap/msdos.c:87 -+msgid "pŠ]F5Ã…“®=†ý±U>à" -+msgstr "" -+ -+#: grub-core/io/lzopio.c:30 -+msgid "" -+"‰LZO\n" -+"\n" -+msgstr "" -+ -+#: util/grub-probe.c:735 -+#, c-format -+msgid "%s\n%s %s %s" -+msgstr "" --- -2.4.3 - diff --git a/0347-grub-probe-free-temporary-variable.patch b/0347-grub-probe-free-temporary-variable.patch deleted file mode 100644 index e91d603..0000000 --- a/0347-grub-probe-free-temporary-variable.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 018f79da6f6f0aab34ce501e62db77c89a23aca1 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sat, 28 Feb 2015 20:19:57 +0300 -Subject: [PATCH 347/506] grub-probe: free temporary variable - ---- - util/grub-probe.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 08d477f..8f4aa61 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -735,6 +735,7 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) - ret = xasprintf ("%s\n%s %s %s", _("print TARGET"), - _("available targets:"), t, def); - free (t); -+ free (def); - return ret; - } - --- -2.4.3 - diff --git a/0348-Don-t-continue-to-query-block-size-if-disk-doesn-t-h.patch b/0348-Don-t-continue-to-query-block-size-if-disk-doesn-t-h.patch deleted file mode 100644 index 39654b2..0000000 --- a/0348-Don-t-continue-to-query-block-size-if-disk-doesn-t-h.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 87ec3b7fa9061f470616ed927fc140e995831c00 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 27 Feb 2015 14:26:00 +0100 -Subject: [PATCH 348/506] Don't continue to query block-size if disk doesn't - have it. - -Stops poluting screen with a lot of "block-size: exception -21". ---- - grub-core/disk/ieee1275/ofdisk.c | 62 ++++++++++++++++++++++++++++------------ - include/grub/ieee1275/ofdisk.h | 3 -- - 2 files changed, 44 insertions(+), 21 deletions(-) - -diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 5d88637..331769b 100644 ---- a/grub-core/disk/ieee1275/ofdisk.c -+++ b/grub-core/disk/ieee1275/ofdisk.c -@@ -35,6 +35,7 @@ struct ofdisk_hash_ent - char *grub_devpath; - int is_boot; - int is_removable; -+ int block_size_fails; - /* Pointer to shortest available name on nodes representing canonical names, - otherwise NULL. */ - const char *shortest; -@@ -42,6 +43,10 @@ struct ofdisk_hash_ent - struct ofdisk_hash_ent *next; - }; - -+static grub_err_t -+grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, -+ struct ofdisk_hash_ent *op); -+ - #define OFDISK_HASH_SZ 8 - static struct ofdisk_hash_ent *ofdisk_hash[OFDISK_HASH_SZ]; - -@@ -375,6 +380,8 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) - /* XXX: This should be large enough for any possible case. */ - char prop[64]; - grub_ssize_t actual; -+ grub_uint32_t block_size = 0; -+ grub_err_t err; - - if (grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) != 0) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, -@@ -405,14 +412,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device"); - } - -- grub_uint32_t block_size = 0; -- if (grub_ofdisk_get_block_size (devpath, &block_size) == 0) -- { -- for (disk->log_sector_size = 0; -- (1U << disk->log_sector_size) < block_size; -- disk->log_sector_size++); -- } -- - /* XXX: There is no property to read the number of blocks. There - should be a property `#blocks', but it is not there. Perhaps it - is possible to use seek for this. */ -@@ -429,6 +428,18 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) - return grub_errno; - disk->id = (unsigned long) op; - disk->data = op->open_path; -+ -+ err = grub_ofdisk_get_block_size (devpath, &block_size, op); -+ if (err) -+ return err; -+ if (block_size != 0) -+ { -+ for (disk->log_sector_size = 0; -+ (1U << disk->log_sector_size) < block_size; -+ disk->log_sector_size++); -+ } -+ else -+ disk->log_sector_size = 9; - } - - return 0; -@@ -589,8 +600,9 @@ grub_ofdisk_init (void) - grub_disk_dev_register (&grub_ofdisk_dev); - } - --grub_err_t --grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size) -+static grub_err_t -+grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, -+ struct ofdisk_hash_ent *op) - { - struct size_args_ieee1275 - { -@@ -612,20 +624,34 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size) - if (! last_ihandle) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); - -+ *block_size = 0; -+ -+ if (op->block_size_fails >= 2) -+ return GRUB_ERR_NONE; -+ - INIT_IEEE1275_COMMON (&args_ieee1275.common, "call-method", 2, 2); - args_ieee1275.method = (grub_ieee1275_cell_t) "block-size"; - args_ieee1275.ihandle = last_ihandle; - args_ieee1275.result = 1; - -- *block_size = GRUB_DISK_SECTOR_SIZE; -- -- if ((IEEE1275_CALL_ENTRY_FN (&args_ieee1275) == -1) || (args_ieee1275.result)) -- grub_dprintf ("disk", "can't get block size\n"); -- else -- if (args_ieee1275.size1 -- && !(args_ieee1275.size1 & (args_ieee1275.size1 - 1)) -- && args_ieee1275.size1 >= 512 && args_ieee1275.size1 <= 16384) -+ if (IEEE1275_CALL_ENTRY_FN (&args_ieee1275) == -1) -+ { -+ grub_dprintf ("disk", "can't get block size: failed call-method\n"); -+ op->block_size_fails++; -+ } -+ else if (args_ieee1275.result) -+ { -+ grub_dprintf ("disk", "can't get block size: %lld\n", -+ (long long) args_ieee1275.result); -+ op->block_size_fails++; -+ } -+ else if (args_ieee1275.size1 -+ && !(args_ieee1275.size1 & (args_ieee1275.size1 - 1)) -+ && args_ieee1275.size1 >= 512 && args_ieee1275.size1 <= 16384) -+ { -+ op->block_size_fails = 0; - *block_size = args_ieee1275.size1; -+ } - - return 0; - } -diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h -index 3f58317..2f69e3f 100644 ---- a/include/grub/ieee1275/ofdisk.h -+++ b/include/grub/ieee1275/ofdisk.h -@@ -22,7 +22,4 @@ - extern void grub_ofdisk_init (void); - extern void grub_ofdisk_fini (void); - --extern grub_err_t grub_ofdisk_get_block_size (const char *device, -- grub_uint32_t *block_size); -- - #endif /* ! GRUB_INIT_HEADER */ --- -2.4.3 - diff --git a/0349-configure.ac-Set-CPPFLAGS-when-checking-for-no_app_r.patch b/0349-configure.ac-Set-CPPFLAGS-when-checking-for-no_app_r.patch deleted file mode 100644 index b5b5ad5..0000000 --- a/0349-configure.ac-Set-CPPFLAGS-when-checking-for-no_app_r.patch +++ /dev/null @@ -1,26 +0,0 @@ -From aa6ccc05c10df14bc39a6a7d9d928d8180e3ef79 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 3 Mar 2015 09:07:53 +0100 -Subject: [PATCH 349/506] configure.ac: Set $CPPFLAGS when checking for - no_app_regs. - -Fixes compilation for sparc64 with clang. ---- - configure.ac | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configure.ac b/configure.ac -index 908bb81..9e24d89 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -741,6 +741,7 @@ if test x"$target_cpu" = xsparc64 ; then - break - fi - CFLAGS="$TARGET_CFLAGS $cand -Werror" -+ CPPFLAGS="$TARGET_CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_target_cc_mno_app_regs="$cand"], []) - done --- -2.4.3 - diff --git a/0350-types.h-Use-__builtin_bswap-with-clang.patch b/0350-types.h-Use-__builtin_bswap-with-clang.patch deleted file mode 100644 index 588d0ba..0000000 --- a/0350-types.h-Use-__builtin_bswap-with-clang.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 77697d14e55eaf878639a630ab45563fa9556a97 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 3 Mar 2015 09:12:10 +0100 -Subject: [PATCH 350/506] types.h: Use __builtin_bswap* with clang. - -clang pretends to be GCC 4.2 but we use __builtin_bswap* only with GCC 4.3+. -clang support __builtin_bswap*, so use it. ---- - include/grub/types.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/grub/types.h b/include/grub/types.h -index 79f765c..e732efb 100644 ---- a/include/grub/types.h -+++ b/include/grub/types.h -@@ -179,7 +179,7 @@ static inline grub_uint16_t grub_swap_bytes16(grub_uint16_t _x) - | (_x >> 56)); \ - }) - --#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3) -+#if (defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)) || defined(__clang__) - static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x) - { - return __builtin_bswap32(x); --- -2.4.3 - diff --git a/0351-Remove-libgcc-dependency.patch b/0351-Remove-libgcc-dependency.patch deleted file mode 100644 index 1cfa754..0000000 --- a/0351-Remove-libgcc-dependency.patch +++ /dev/null @@ -1,2313 +0,0 @@ -From 064360e6671e0c5f2f47b73fd03b33be8a81f72c Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 3 Mar 2015 20:23:42 +0100 -Subject: [PATCH 351/506] Remove libgcc dependency. - -libgcc for boot environment isn't always present and compatible. -libgcc is often absent if endianness or bit-size at boot is different -from running OS. -libgcc may use optimised opcodes that aren't available on boot time. -So instead of relying on libgcc shipped with the compiler, supply -the functions in GRUB directly. -Tests are present to ensure that those replacement functions behave the -way compiler expects them to. ---- - conf/Makefile.common | 4 +- - config.h.in | 1 + - configure.ac | 25 +- - grub-core/Makefile.am | 8 +- - grub-core/Makefile.core.def | 43 ++- - grub-core/boot/decompressor/minilib.c | 11 +- - grub-core/kern/arm/{misc.S => compiler-rt.S} | 0 - grub-core/kern/compiler-rt.c | 404 +++++++++++++++++++++++++++ - grub-core/kern/misc.c | 232 --------------- - grub-core/kern/powerpc/compiler-rt.S | 130 +++++++++ - grub-core/lib/posix_wrap/string.h | 20 +- - grub-core/tests/bswap_test.c | 121 ++++++++ - grub-core/tests/cmp_test.c | 190 +++++++++++++ - grub-core/tests/ctz_test.c | 111 ++++++++ - grub-core/tests/lib/functional_test.c | 5 + - grub-core/tests/mul_test.c | 73 +++++ - grub-core/tests/shift_test.c | 157 +++++++++++ - include/grub/compiler-rt.h | 193 +++++++++++++ - include/grub/libgcc.h | 91 ------ - include/grub/misc.h | 99 +------ - include/grub/xen.h | 2 + - 21 files changed, 1441 insertions(+), 479 deletions(-) - rename grub-core/kern/arm/{misc.S => compiler-rt.S} (100%) - create mode 100644 grub-core/kern/compiler-rt.c - create mode 100644 grub-core/kern/powerpc/compiler-rt.S - create mode 100644 grub-core/tests/bswap_test.c - create mode 100644 grub-core/tests/cmp_test.c - create mode 100644 grub-core/tests/ctz_test.c - create mode 100644 grub-core/tests/mul_test.c - create mode 100644 grub-core/tests/shift_test.c - create mode 100644 include/grub/compiler-rt.h - delete mode 100644 include/grub/libgcc.h - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 8861096..96e58c9 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -34,10 +34,8 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/ - CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1 - BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) - --LDADD_KERNEL = $(TARGET_LIBGCC) -- - CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding --LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC) -+LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) - CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 - CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -diff --git a/config.h.in b/config.h.in -index ea0f383..9e8f991 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -7,6 +7,7 @@ - #endif - - #define GCRYPT_NO_DEPRECATED 1 -+#define HAVE_MEMMOVE 1 - - /* Define to 1 to enable disk cache statistics. */ - #define DISK_CACHE_STATS @DISK_CACHE_STATS@ -diff --git a/configure.ac b/configure.ac -index 9e24d89..be980ad 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1131,22 +1131,17 @@ fi - - # Set them to their new values for the tests below. - CC="$TARGET_CC" --if test "x$TARGET_APPLE_LINKER" = x1 ; then -+if test x"$platform" = xemu ; then -+CFLAGS="$TARGET_CFLAGS -Wno-error" -+elif test "x$TARGET_APPLE_LINKER" = x1 ; then - CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error" - 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 --TARGET_LIBGCC= --else --TARGET_LIBGCC=-lgcc --fi -- --LIBS="$TARGET_LIBGCC" - - grub_ASM_USCORE --if test "x$TARGET_APPLE_LINKER" = x0 ; then -+if test "x$TARGET_APPLE_LINKER" = x0 && test x"$platform" != xemu; then - if test x$grub_cv_asm_uscore = xyes; then - DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main" - else -@@ -1156,7 +1151,9 @@ CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM" - fi - - # Check for libgcc symbols --AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x) -+if test x"$platform" = xemu; then -+AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) -+fi - - if test "x$TARGET_APPLE_LINKER" = x1 ; then - CFLAGS="$TARGET_CFLAGS -nostdlib -static" -@@ -1717,12 +1714,6 @@ if test x"$enable_werror" != xno ; then - HOST_CFLAGS="$HOST_CFLAGS -Werror" - fi - --if test "x$grub_cv_cc_target_clang" = xno; then -- TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc" --else -- TARGET_LDFLAGS_STATIC_LIBGCC= --fi -- - TARGET_CPP="$TARGET_CC -E" - TARGET_CCAS=$TARGET_CC - -@@ -1739,8 +1730,6 @@ AC_SUBST(GRUB_TARGET_CPU) - AC_SUBST(GRUB_PLATFORM) - - AC_SUBST(TARGET_OBJCONV) --AC_SUBST(TARGET_LIBGCC) --AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC) - AC_SUBST(TARGET_CPP) - AC_SUBST(TARGET_CCAS) - AC_SUBST(TARGET_OBJ2ELF) -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 5c087c8..57c0b64 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -76,6 +76,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h -+if COND_emu -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h -+else -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h -+endif - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h -@@ -83,9 +88,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h - 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 --KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h --endif - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h - - if COND_i386_pc -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index b539ccf..7a6fa21 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -132,6 +132,7 @@ kernel = { - common = kern/rescue_reader.c; - common = kern/term.c; - -+ noemu = kern/compiler-rt.c; - noemu = kern/mm.c; - noemu = kern/time.c; - noemu = kern/generic/millisleep.c; -@@ -254,6 +255,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; -@@ -265,7 +267,7 @@ kernel = { - arm = kern/arm/cache_armv7.S; - extra_dist = kern/arm/cache.S; - arm = kern/arm/cache.c; -- arm = kern/arm/misc.S; -+ arm = kern/arm/compiler-rt.S; - - arm64 = kern/arm64/cache.c; - arm64 = kern/arm64/cache_flush.S; -@@ -443,13 +445,13 @@ image = { - common = lib/xzembed/xz_dec_bcj.c; - common = lib/xzembed/xz_dec_lzma2.c; - common = lib/xzembed/xz_dec_stream.c; -+ common = kern/compiler-rt.c; - - cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1'; - - objcopyflags = '-O binary'; -- mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; -- ldadd = '$(TARGET_LIBGCC)'; -- cflags = '-Wno-unreachable-code $(TARGET_LDFLAGS_STATIC_LIBGCC)'; -+ mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; -+ cflags = '-Wno-unreachable-code'; - enable = mips; - }; - -@@ -461,9 +463,7 @@ image = { - cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1'; - - objcopyflags = '-O binary'; -- mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; -- ldadd = '$(TARGET_LIBGCC)'; -- cflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC)'; -+ mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; - enable = mips; - }; - -@@ -481,7 +481,7 @@ image = { - name = fwstart; - mips_loongson = boot/mips/loongson/fwstart.S; - objcopyflags = '-O binary'; -- ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; -+ ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; - enable = mips_loongson; - }; - -@@ -489,7 +489,7 @@ image = { - name = fwstart_fuloong2f; - mips_loongson = boot/mips/loongson/fuloong2f.S; - objcopyflags = '-O binary'; -- ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; -+ ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; - enable = mips_loongson; - }; - -@@ -1983,6 +1983,31 @@ module = { - }; - - module = { -+ name = mul_test; -+ common = tests/mul_test.c; -+}; -+ -+module = { -+ name = shift_test; -+ common = tests/shift_test.c; -+}; -+ -+module = { -+ name = cmp_test; -+ common = tests/cmp_test.c; -+}; -+ -+module = { -+ name = ctz_test; -+ common = tests/ctz_test.c; -+}; -+ -+module = { -+ name = bswap_test; -+ common = tests/bswap_test.c; -+}; -+ -+module = { - name = videotest_checksum; - common = tests/videotest_checksum.c; - }; -diff --git a/grub-core/boot/decompressor/minilib.c b/grub-core/boot/decompressor/minilib.c -index 94edfd5..fc46ee0 100644 ---- a/grub-core/boot/decompressor/minilib.c -+++ b/grub-core/boot/decompressor/minilib.c -@@ -21,7 +21,7 @@ - #include - - void * --memset (void *s, int c, grub_size_t len) -+grub_memset (void *s, int c, grub_size_t len) - { - grub_uint8_t *ptr; - for (ptr = s; len; ptr++, len--) -@@ -68,15 +68,6 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n) - return 0; - } - --int memcmp (const void *s1, const void *s2, grub_size_t n) -- __attribute__ ((alias ("grub_memcmp"))); -- --void *memmove (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); -- --void *memcpy (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); -- - void *grub_decompressor_scratch; - - void -diff --git a/grub-core/kern/arm/misc.S b/grub-core/kern/arm/compiler-rt.S -similarity index 100% -rename from grub-core/kern/arm/misc.S -rename to grub-core/kern/arm/compiler-rt.S -diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-rt.c -new file mode 100644 -index 0000000..d4cc155 ---- /dev/null -+++ b/grub-core/kern/compiler-rt.c -@@ -0,0 +1,404 @@ -+/* compiler-rt.c - compiler helpers. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 1999,2000,2001,2002,2003,2004,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 . -+ */ -+ -+#include -+#include -+ -+#ifndef GRUB_EMBED_DECOMPRESSOR -+void * GRUB_BUILTIN_ATTR -+memcpy (void *dest, const void *src, grub_size_t n) -+{ -+ return grub_memmove (dest, src, n); -+} -+void * GRUB_BUILTIN_ATTR -+memmove (void *dest, const void *src, grub_size_t n) -+{ -+ return grub_memmove (dest, src, n); -+} -+int GRUB_BUILTIN_ATTR -+memcmp (const void *s1, const void *s2, grub_size_t n) -+{ -+ return grub_memcmp (s1, s2, n); -+} -+void * GRUB_BUILTIN_ATTR -+memset (void *s, int c, grub_size_t n) -+{ -+ return grub_memset (s, c, n); -+} -+ -+#ifdef __APPLE__ -+ -+void GRUB_BUILTIN_ATTR -+__bzero (void *s, grub_size_t n) -+{ -+ grub_memset (s, 0, n); -+} -+ -+#endif -+ -+#if GRUB_DIVISION_IN_SOFTWARE -+ -+grub_uint32_t -+__udivsi3 (grub_uint32_t a, grub_uint32_t b) -+{ -+ return grub_divmod64 (a, b, 0); -+} -+ -+grub_int32_t -+__divsi3 (grub_int32_t a, grub_int32_t b) -+{ -+ return grub_divmod64s (a, b, 0); -+} -+ -+grub_uint32_t -+__umodsi3 (grub_uint32_t a, grub_uint32_t b) -+{ -+ grub_uint64_t ret; -+ grub_divmod64 (a, b, &ret); -+ return ret; -+} -+ -+grub_int32_t -+__modsi3 (grub_int32_t a, grub_int32_t b) -+{ -+ grub_int64_t ret; -+ grub_divmod64s (a, b, &ret); -+ return ret; -+} -+ -+grub_uint64_t -+__udivdi3 (grub_uint64_t a, grub_uint64_t b) -+{ -+ return grub_divmod64 (a, b, 0); -+} -+ -+grub_uint64_t -+__umoddi3 (grub_uint64_t a, grub_uint64_t b) -+{ -+ grub_uint64_t ret; -+ grub_divmod64 (a, b, &ret); -+ return ret; -+} -+ -+grub_int64_t -+__divdi3 (grub_int64_t a, grub_int64_t b) -+{ -+ return grub_divmod64s (a, b, 0); -+} -+ -+grub_int64_t -+__moddi3 (grub_int64_t a, grub_int64_t b) -+{ -+ grub_int64_t ret; -+ grub_divmod64s (a, b, &ret); -+ return ret; -+} -+ -+#endif -+ -+#endif -+ -+#ifdef NEED_CTZDI2 -+ -+unsigned -+__ctzdi2 (grub_uint64_t x) -+{ -+ unsigned ret = 0; -+ if (!x) -+ return 64; -+ if (!(x & 0xffffffff)) -+ { -+ x >>= 32; -+ ret |= 32; -+ } -+ if (!(x & 0xffff)) -+ { -+ x >>= 16; -+ ret |= 16; -+ } -+ if (!(x & 0xff)) -+ { -+ x >>= 8; -+ ret |= 8; -+ } -+ if (!(x & 0xf)) -+ { -+ x >>= 4; -+ ret |= 4; -+ } -+ if (!(x & 0x3)) -+ { -+ x >>= 2; -+ ret |= 2; -+ } -+ if (!(x & 0x1)) -+ { -+ x >>= 1; -+ ret |= 1; -+ } -+ return ret; -+} -+#endif -+ -+#ifdef NEED_CTZSI2 -+unsigned -+__ctzsi2 (grub_uint32_t x) -+{ -+ unsigned ret = 0; -+ if (!x) -+ return 32; -+ -+ if (!(x & 0xffff)) -+ { -+ x >>= 16; -+ ret |= 16; -+ } -+ if (!(x & 0xff)) -+ { -+ x >>= 8; -+ ret |= 8; -+ } -+ if (!(x & 0xf)) -+ { -+ x >>= 4; -+ ret |= 4; -+ } -+ if (!(x & 0x3)) -+ { -+ x >>= 2; -+ ret |= 2; -+ } -+ if (!(x & 0x1)) -+ { -+ x >>= 1; -+ ret |= 1; -+ } -+ return ret; -+} -+ -+#endif -+ -+ -+#if defined (__clang__) && !defined(GRUB_EMBED_DECOMPRESSOR) -+/* clang emits references to abort(). */ -+void __attribute__ ((noreturn)) -+abort (void) -+{ -+ grub_fatal ("compiler abort"); -+} -+#endif -+ -+#if (defined (__MINGW32__) || defined (__CYGWIN__)) -+void __register_frame_info (void) -+{ -+} -+ -+void __deregister_frame_info (void) -+{ -+} -+ -+void ___chkstk_ms (void) -+{ -+} -+ -+void __chkstk_ms (void) -+{ -+} -+#endif -+ -+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__) || defined (__arm__) || defined(__mips__) -+ -+/* 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 = ((grub_int32_t) uu.high) >> (32 - 1); -+ w.low = ((grub_int32_t) uu.high) >> -bm; -+ } -+ else -+ { -+ const grub_uint32_t carries = ((grub_uint32_t) uu.high) << bm; -+ -+ w.high = ((grub_int32_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 -+__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; -+} -+ -+/* 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; -+} -+ -+#endif -+ -+#if defined (__powerpc__) || defined(__mips__) || defined(__sparc__) || defined(__arm__) -+ -+/* Based on libgcc2.c from gcc suite. */ -+grub_uint32_t -+__bswapsi2 (grub_uint32_t u) -+{ -+ return ((((u) & 0xff000000) >> 24) -+ | (((u) & 0x00ff0000) >> 8) -+ | (((u) & 0x0000ff00) << 8) -+ | (((u) & 0x000000ff) << 24)); -+} -+ -+/* Based on libgcc2.c from gcc suite. */ -+grub_uint64_t -+__bswapdi2 (grub_uint64_t u) -+{ -+ return ((((u) & 0xff00000000000000ull) >> 56) -+ | (((u) & 0x00ff000000000000ull) >> 40) -+ | (((u) & 0x0000ff0000000000ull) >> 24) -+ | (((u) & 0x000000ff00000000ull) >> 8) -+ | (((u) & 0x00000000ff000000ull) << 8) -+ | (((u) & 0x0000000000ff0000ull) << 24) -+ | (((u) & 0x000000000000ff00ull) << 40) -+ | (((u) & 0x00000000000000ffull) << 56)); -+} -+ -+ -+#endif -+ -+#ifdef __arm__ -+grub_uint32_t -+__aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) -+ __attribute__ ((alias ("__udivsi3"))); -+grub_int32_t -+__aeabi_idiv (grub_int32_t a, grub_int32_t b) -+ __attribute__ ((alias ("__divsi3"))); -+void *__aeabi_memcpy (void *dest, const void *src, grub_size_t n) -+ __attribute__ ((alias ("grub_memcpy"))); -+void *__aeabi_memset (void *s, int c, grub_size_t n) -+ __attribute__ ((alias ("memset"))); -+ -+int -+__aeabi_ulcmp (grub_uint64_t a, grub_uint64_t b) -+{ -+ return __ucmpdi2 (a, b) - 1; -+} -+ -+grub_uint64_t -+__aeabi_lasr (grub_uint64_t u, int b) -+ __attribute__ ((alias ("__ashrdi3"))); -+grub_uint64_t -+__aeabi_llsr (grub_uint64_t u, int b) -+ __attribute__ ((alias ("__lshrdi3"))); -+ -+grub_uint64_t -+__aeabi_llsl (grub_uint64_t u, int b) -+ __attribute__ ((alias ("__ashldi3"))); -+ -+#endif -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index b0347e7..906d2c2 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -95,25 +95,6 @@ grub_memmove (void *dest, const void *src, grub_size_t n) - return dest; - } - --#ifndef __APPLE__ --void *memmove (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); --/* GCC emits references to memcpy() for struct copies etc. */ --void *memcpy (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); --#else --void * GRUB_BUILTIN_ATTR --memcpy (void *dest, const void *src, grub_size_t n) --{ -- return grub_memmove (dest, src, n); --} --void * GRUB_BUILTIN_ATTR --memmove (void *dest, const void *src, grub_size_t n) --{ -- return grub_memmove (dest, src, n); --} --#endif -- - char * - grub_strcpy (char *dest, const char *src) - { -@@ -253,16 +234,6 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n) - - return 0; - } --#ifndef __APPLE__ --int memcmp (const void *s1, const void *s2, grub_size_t n) -- __attribute__ ((alias ("grub_memcmp"))); --#else --int GRUB_BUILTIN_ATTR --memcmp (const void *s1, const void *s2, grub_size_t n) --{ -- return grub_memcmp (s1, s2, n); --} --#endif - - int - grub_strcmp (const char *s1, const char *s2) -@@ -532,26 +503,6 @@ grub_memset (void *s, int c, grub_size_t len) - - return s; - } --#ifndef __APPLE__ --void *memset (void *s, int c, grub_size_t n) -- __attribute__ ((alias ("grub_memset"))); --#else --void * GRUB_BUILTIN_ATTR --memset (void *s, int c, grub_size_t n) --{ -- return grub_memset (s, c, n); --} -- --#endif -- --#if !defined(GRUB_UTIL) && defined(__APPLE__) --void GRUB_BUILTIN_ATTR --__bzero (void *s, grub_size_t n) --{ -- grub_memset (s, 0, n); --} -- --#endif - - grub_size_t - grub_strlen (const char *s) -@@ -631,163 +582,6 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) - return q; - } - --#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) -- --#if GRUB_DIVISION_IN_SOFTWARE -- --grub_uint32_t --__udivsi3 (grub_uint32_t a, grub_uint32_t b) --{ -- return grub_divmod64 (a, b, 0); --} -- --grub_int32_t --__divsi3 (grub_int32_t a, grub_int32_t b) --{ -- return grub_divmod64s (a, b, 0); --} -- --grub_uint32_t --__umodsi3 (grub_uint32_t a, grub_uint32_t b) --{ -- grub_uint64_t ret; -- grub_divmod64 (a, b, &ret); -- return ret; --} -- --grub_int32_t --__modsi3 (grub_int32_t a, grub_int32_t b) --{ -- grub_int64_t ret; -- grub_divmod64s (a, b, &ret); -- return ret; --} -- --grub_uint64_t --__udivdi3 (grub_uint64_t a, grub_uint64_t b) --{ -- return grub_divmod64 (a, b, 0); --} -- --grub_uint64_t --__umoddi3 (grub_uint64_t a, grub_uint64_t b) --{ -- grub_uint64_t ret; -- grub_divmod64 (a, b, &ret); -- return ret; --} -- --grub_int64_t --__divdi3 (grub_int64_t a, grub_int64_t b) --{ -- return grub_divmod64s (a, b, 0); --} -- --grub_int64_t --__moddi3 (grub_int64_t a, grub_int64_t b) --{ -- grub_int64_t ret; -- grub_divmod64s (a, b, &ret); -- return ret; --} -- --#endif -- --#ifdef NEED_CTZDI2 -- --unsigned --__ctzdi2 (grub_uint64_t x) --{ -- unsigned ret = 0; -- if (!x) -- return 64; -- if (!(x & 0xffffffff)) -- { -- x >>= 32; -- ret |= 32; -- } -- if (!(x & 0xffff)) -- { -- x >>= 16; -- ret |= 16; -- } -- if (!(x & 0xff)) -- { -- x >>= 8; -- ret |= 8; -- } -- if (!(x & 0xf)) -- { -- x >>= 4; -- ret |= 4; -- } -- if (!(x & 0x3)) -- { -- x >>= 2; -- ret |= 2; -- } -- if (!(x & 0x1)) -- { -- x >>= 1; -- ret |= 1; -- } -- return ret; --} --#endif -- --#ifdef NEED_CTZSI2 --unsigned --__ctzsi2 (grub_uint32_t x) --{ -- unsigned ret = 0; -- if (!x) -- return 32; -- -- if (!(x & 0xffff)) -- { -- x >>= 16; -- ret |= 16; -- } -- if (!(x & 0xff)) -- { -- x >>= 8; -- ret |= 8; -- } -- if (!(x & 0xf)) -- { -- x >>= 4; -- ret |= 4; -- } -- if (!(x & 0x3)) -- { -- x >>= 2; -- ret |= 2; -- } -- if (!(x & 0x1)) -- { -- x >>= 1; -- ret |= 1; -- } -- return ret; --} -- --#endif -- --#ifdef __arm__ --grub_uint32_t --__aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) -- __attribute__ ((alias ("__udivsi3"))); --grub_int32_t --__aeabi_idiv (grub_int32_t a, grub_int32_t b) -- __attribute__ ((alias ("__divsi3"))); --void *__aeabi_memcpy (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memcpy"))); --void *__aeabi_memset (void *s, int c, grub_size_t n) -- __attribute__ ((alias ("grub_memset"))); --#endif -- --#endif /* GRUB_UTIL */ -- - /* Convert a long long value to a string. This function avoids 64-bit - modular arithmetic or divisions. */ - static inline char * -@@ -1296,15 +1090,6 @@ grub_abort (void) - grub_exit (); - } - --#if defined (__clang__) && !defined (GRUB_UTIL) --/* clang emits references to abort(). */ --void __attribute__ ((noreturn)) --abort (void) --{ -- grub_abort (); --} --#endif -- - void - grub_fatal (const char *fmt, ...) - { -@@ -1317,23 +1102,6 @@ grub_fatal (const char *fmt, ...) - grub_abort (); - } - --#if (defined (__MINGW32__) || defined (__CYGWIN__)) && !defined(GRUB_UTIL) --void __register_frame_info (void) --{ --} -- --void __deregister_frame_info (void) --{ --} --void ___chkstk_ms (void) --{ --} -- --void __chkstk_ms (void) --{ --} --#endif -- - #if BOOT_TIME_STATS - - #include -diff --git a/grub-core/kern/powerpc/compiler-rt.S b/grub-core/kern/powerpc/compiler-rt.S -new file mode 100644 -index 0000000..b3b912d ---- /dev/null -+++ b/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 -diff --git a/grub-core/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h -index c4b9bf0..7ae6eee 100644 ---- a/grub-core/lib/posix_wrap/string.h -+++ b/grub-core/lib/posix_wrap/string.h -@@ -42,21 +42,6 @@ strcasecmp (const char *s1, const char *s2) - return grub_strcasecmp (s1, s2); - } - --#ifdef GRUB_UTIL --static inline void * --memcpy (void *dest, const void *src, grub_size_t n) --{ -- return grub_memcpy (dest, src, n); --} -- --static inline int --memcmp (const void *s1, const void *s2, grub_size_t n) --{ -- return grub_memcmp (s1, s2, n); --} -- --#endif -- - static inline void - bcopy (const void *src, void *dest, grub_size_t n) - { -@@ -99,4 +84,9 @@ memchr (const void *s, int c, grub_size_t n) - return grub_memchr (s, c, n); - } - -+#define memcmp grub_memcmp -+#define memcpy grub_memcpy -+#define memmove grub_memmove -+#define memset grub_memset -+ - #endif -diff --git a/grub-core/tests/bswap_test.c b/grub-core/tests/bswap_test.c -new file mode 100644 -index 0000000..4eb3a98 ---- /dev/null -+++ b/grub-core/tests/bswap_test.c -@@ -0,0 +1,121 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_uint64_t vectors[] = { -+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL -+}; -+ -+static void -+test16 (grub_uint16_t a) -+{ -+ grub_uint16_t b, c; -+ grub_uint8_t *ap, *bp; -+ int i; -+ b = grub_swap_bytes16 (a); -+ c = grub_swap_bytes16 (b); -+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", -+ (long long) a, (long long) b, (long long) c); -+ ap = (grub_uint8_t *) &a; -+ bp = (grub_uint8_t *) &b; -+ for (i = 0; i < 2; i++) -+ { -+ grub_test_assert (ap[i] == bp[1 - i], -+ "bswap bytes wrong: 0x%llx, 0x%llx", -+ (long long) a, (long long) b); -+ } -+} -+ -+static void -+test32 (grub_uint32_t a) -+{ -+ grub_uint32_t b, c; -+ grub_uint8_t *ap, *bp; -+ int i; -+ b = grub_swap_bytes32 (a); -+ c = grub_swap_bytes32 (b); -+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", -+ (long long) a, (long long) b, (long long) c); -+ ap = (grub_uint8_t *) &a; -+ bp = (grub_uint8_t *) &b; -+ for (i = 0; i < 4; i++) -+ { -+ grub_test_assert (ap[i] == bp[3 - i], -+ "bswap bytes wrong: 0x%llx, 0x%llx", -+ (long long) a, (long long) b); -+ } -+} -+ -+static void -+test64 (grub_uint64_t a) -+{ -+ grub_uint64_t b, c; -+ grub_uint8_t *ap, *bp; -+ int i; -+ b = grub_swap_bytes64 (a); -+ c = grub_swap_bytes64 (b); -+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", -+ (long long) a, (long long) b, (long long) c); -+ ap = (grub_uint8_t *) &a; -+ bp = (grub_uint8_t *) &b; -+ for (i = 0; i < 4; i++) -+ { -+ grub_test_assert (ap[i] == bp[7 - i], -+ "bswap bytes wrong: 0x%llx, 0x%llx", -+ (long long) a, (long long) b); -+ } -+} -+ -+static void -+test_all(grub_uint64_t a) -+{ -+ test64 (a); -+ test32 (a); -+ test16 (a); -+} -+ -+static void -+bswap_test (void) -+{ -+ grub_uint64_t a = 404, b = 7; -+ grub_size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE (vectors); i++) -+ { -+ test_all (vectors[i]); -+ } -+ for (i = 0; i < 40000; i++) -+ { -+ a = 17 * a + 13 * b; -+ b = 23 * a + 29 * b; -+ if (b == 0) -+ b = 1; -+ if (a == 0) -+ a = 1; -+ test_all (a); -+ test_all (b); -+ } -+} -+ -+/* Register example_test method as a functional test. */ -+GRUB_FUNCTIONAL_TEST (bswap_test, bswap_test); -diff --git a/grub-core/tests/cmp_test.c b/grub-core/tests/cmp_test.c -new file mode 100644 -index 0000000..af5b395 ---- /dev/null -+++ b/grub-core/tests/cmp_test.c -@@ -0,0 +1,190 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_uint64_t vectors[][2] = { -+ { 0xffffffffffffffffULL, 1}, -+ { 1, 0xffffffffffffffffULL}, -+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL}, -+ { 1, 1 }, -+ { 2, 1 } -+}; -+ -+/* Don't change those to use shift as shift may call to compile rt -+ functions and we're not testing them now. -+ */ -+static int -+leading_bit64 (grub_uint64_t a) -+{ -+ return !!(a & 0x8000000000000000LL); -+} -+ -+static int -+leading_bit32 (grub_uint32_t a) -+{ -+ return !!(a & 0x80000000); -+} -+ -+/* Computes (a < b) without involving comparison operator. */ -+static int -+is_less32 (grub_uint32_t a, grub_uint32_t b) -+{ -+ if (leading_bit32(a) && !leading_bit32(b)) -+ return 0; -+ if (!leading_bit32(a) && leading_bit32(b)) -+ return 1; -+ return leading_bit32(a - b); -+} -+ -+static void -+test32 (grub_uint32_t a, grub_uint32_t b) -+{ -+ grub_test_assert ((a < b) == is_less32(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((a > b) == is_less32(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b < a) == is_less32(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b > a) == is_less32(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert (!(is_less32(a, b) && is_less32(b, a)), "comparison inconsistent: %lld, %lld", -+ (long long) a, (long long) b); -+} -+ -+/* Computes (a > b) without involving comparison operator. */ -+static int -+is_less32s (grub_int32_t a, grub_int32_t b) -+{ -+ if (leading_bit32(a) && !leading_bit32(b)) -+ return 1; /* a < 0 && b >= 0. */ -+ if (!leading_bit32(a) && leading_bit32(b)) -+ return 0; /* b < 0 && a >= 0. */ -+ return leading_bit32(a - b); -+} -+ -+static void -+test32s (grub_int32_t a, grub_int32_t b) -+{ -+ grub_test_assert ((a < b) == is_less32s(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((a > b) == is_less32s(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b < a) == is_less32s(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b > a) == is_less32s(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert (!(is_less32s(a, b) && is_less32s(b, a)), "comparison inconsistent: %lld, %lld", -+ (long long) a, (long long) b); -+} -+ -+/* Computes (a > b) without involving comparison operator. */ -+static int -+is_less64 (grub_uint64_t a, grub_uint64_t b) -+{ -+ if (leading_bit64(a) && !leading_bit64(b)) -+ return 0; -+ if (!leading_bit64(a) && leading_bit64(b)) -+ return 1; -+ return leading_bit64(a - b); -+} -+ -+static void -+test64 (grub_uint64_t a, grub_uint64_t b) -+{ -+ grub_test_assert ((a < b) == is_less64(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((a > b) == is_less64(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b < a) == is_less64(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b > a) == is_less64(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert (!(is_less64(a, b) && is_less64(b, a)), "comparison inconsistent: %lld, %lld", -+ (long long) a, (long long) b); -+} -+ -+/* Computes (a > b) without involving comparison operator. */ -+static int -+is_less64s (grub_int64_t a, grub_int64_t b) -+{ -+ if (leading_bit64(a) && !leading_bit64(b)) -+ return 1; /* a < 0 && b >= 0. */ -+ if (!leading_bit64(a) && leading_bit64(b)) -+ return 0; /* b < 0 && a >= 0. */ -+ return leading_bit64(a - b); -+} -+ -+static void -+test64s (grub_int64_t a, grub_int64_t b) -+{ -+ grub_test_assert ((a < b) == is_less64s(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((a > b) == is_less64s(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b < a) == is_less64s(b, a), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert ((b > a) == is_less64s(a, b), "comparison result mismatch: %lld, %lld", -+ (long long) a, (long long) b); -+ grub_test_assert (!(is_less64s(a, b) && is_less64s(b, a)), "comparison inconsistent: %lld, %lld", -+ (long long) a, (long long) b); -+} -+ -+static void -+test_all(grub_uint64_t a, grub_uint64_t b) -+{ -+ test64 (a, b); -+ test32 (a, b); -+ test64s (a, b); -+ test32s (a, b); -+ test64s (a, -b); -+ test32s (a, -b); -+ test64s (-a, b); -+ test32s (-a, b); -+ test64s (-a, -b); -+ test32s (-a, -b); -+} -+ -+static void -+cmp_test (void) -+{ -+ grub_uint64_t a = 404, b = 7; -+ grub_size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE (vectors); i++) -+ { -+ test_all (vectors[i][0], vectors[i][1]); -+ } -+ for (i = 0; i < 40000; i++) -+ { -+ a = 17 * a + 13 * b; -+ b = 23 * a + 29 * b; -+ if (b == 0) -+ b = 1; -+ if (a == 0) -+ a = 1; -+ test_all (a, b); -+ } -+} -+ -+/* Register example_test method as a functional test. */ -+GRUB_FUNCTIONAL_TEST (cmp_test, cmp_test); -diff --git a/grub-core/tests/ctz_test.c b/grub-core/tests/ctz_test.c -new file mode 100644 -index 0000000..eb7a1df ---- /dev/null -+++ b/grub-core/tests/ctz_test.c -@@ -0,0 +1,111 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2013 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+/* ull version is not used on i386 other than in this test. -+ Avoid requiring extra function. -+ */ -+#if defined (__i386__) -+#define SKIP_ULL 1 -+#endif -+ -+static grub_uint64_t vectors[] = { -+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL -+}; -+ -+static void -+test_ui (unsigned int a) -+{ -+ int i; -+ a |= 1; -+ for (i = 0; i < (int) (8 * sizeof (a)); i++) -+ { -+ grub_test_assert (__builtin_ctz(a << i) == i, -+ "ctz mismatch: ctz(0x%llx) != 0x%x", -+ (long long) (a << i), __builtin_ctz(a << i)); -+ } -+} -+ -+static void -+test_ul (unsigned long a) -+{ -+ int i; -+ a |= 1; -+ for (i = 0; i < (int) (8 * sizeof (a)); i++) -+ { -+ grub_test_assert (__builtin_ctzl(a << i) == i, -+ "ctzl mismatch: ctzl(0x%llx) != 0x%x", -+ (long long) (a << i), __builtin_ctz(a << i)); -+ } -+} -+ -+#ifndef SKIP_ULL -+static void -+test_ull (unsigned long long a) -+{ -+ int i; -+ a |= 1; -+ for (i = 0; i < (int) (8 * sizeof (a)); i++) -+ { -+ grub_test_assert (__builtin_ctzll(a << i) == i, -+ "ctzll mismatch: ctzll(0x%llx) != 0x%x", -+ (long long) (a << i), __builtin_ctz(a << i)); -+ } -+} -+#endif -+ -+static void -+test_all(grub_uint64_t a) -+{ -+ test_ui (a); -+ test_ul (a); -+#ifndef SKIP_ULL -+ test_ull (a); -+#endif -+} -+ -+static void -+ctz_test (void) -+{ -+ grub_uint64_t a = 404, b = 7; -+ grub_size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE (vectors); i++) -+ { -+ test_all (vectors[i]); -+ } -+ for (i = 0; i < 40000; i++) -+ { -+ a = 17 * a + 13 * b; -+ b = 23 * a + 29 * b; -+ if (b == 0) -+ b = 1; -+ if (a == 0) -+ a = 1; -+ test_all (a); -+ test_all (b); -+ } -+} -+ -+/* Register example_test method as a functional test. */ -+GRUB_FUNCTIONAL_TEST (ctz_test, ctz_test); -diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c -index 5be7a58..d4822a1 100644 ---- a/grub-core/tests/lib/functional_test.c -+++ b/grub-core/tests/lib/functional_test.c -@@ -65,6 +65,11 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), - grub_dl_load ("pbkdf2_test"); - grub_dl_load ("signature_test"); - grub_dl_load ("sleep_test"); -+ grub_dl_load ("bswap_test"); -+ grub_dl_load ("ctz_test"); -+ grub_dl_load ("cmp_test"); -+ grub_dl_load ("mul_test"); -+ grub_dl_load ("shift_test"); - - FOR_LIST_ELEMENTS (test, grub_test_list) - ok = !grub_test_run (test) && ok; -diff --git a/grub-core/tests/mul_test.c b/grub-core/tests/mul_test.c -new file mode 100644 -index 0000000..cd64231 ---- /dev/null -+++ b/grub-core/tests/mul_test.c -@@ -0,0 +1,73 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2013 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_uint64_t vectors[][2] = { -+ { 0xffffffffffffffffULL, 1}, -+ { 1, 0xffffffffffffffffULL}, -+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL}, -+ { 1, 1 }, -+ { 2, 1 } -+}; -+ -+static void -+test64(grub_uint64_t a, grub_uint64_t b) -+{ -+ grub_uint64_t r1 = a * b, r2 = 0, r3; -+ int i; -+ for (i = 0; i < 64; i++) -+ if ((a & (1LL << i))) -+ r2 += b << i; -+ r3 = ((grub_int64_t) a) * ((grub_int64_t) b); -+ grub_test_assert (r1 == r2, -+ "multiplication mismatch (u): 0x%llx x 0x%llx = 0x%llx != 0x%llx", -+ (long long) a, (long long) b, (long long) r2, (long long) r1); -+ grub_test_assert (r3 == r2, -+ "multiplication mismatch (s): 0x%llx x 0x%llx = 0x%llx != 0x%llx", -+ (long long) a, (long long) b, (long long) r2, (long long) r3); -+} -+ -+static void -+mul_test (void) -+{ -+ grub_uint64_t a = 404, b = 7; -+ grub_size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE (vectors); i++) -+ { -+ test64 (vectors[i][0], vectors[i][1]); -+ } -+ for (i = 0; i < 40000; i++) -+ { -+ a = 17 * a + 13 * b; -+ b = 23 * a + 29 * b; -+ if (b == 0) -+ b = 1; -+ if (a == 0) -+ a = 1; -+ test64 (a, b); -+ } -+} -+ -+/* Register example_test method as a functional test. */ -+GRUB_FUNCTIONAL_TEST (mul_test, mul_test); -diff --git a/grub-core/tests/shift_test.c b/grub-core/tests/shift_test.c -new file mode 100644 -index 0000000..4120f52 ---- /dev/null -+++ b/grub-core/tests/shift_test.c -@@ -0,0 +1,157 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 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 -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_uint64_t vectors[] = { -+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL -+}; -+ -+/* We're testing shifts, don't replace access to this with a shift. */ -+static const grub_uint8_t bitmask[] = -+ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; -+ -+typedef union { -+ grub_uint64_t v64; -+ grub_uint8_t v8[8]; -+} grub_raw_u64_t; -+ -+static int -+get_bit64 (grub_uint64_t v, int b) -+{ -+ grub_raw_u64_t vr = { .v64 = v }; -+ grub_uint8_t *p = vr.v8; -+ if (b >= 64) -+ return 0; -+#ifdef GRUB_CPU_WORDS_BIGENDIAN -+ p += 7 - b / 8; -+#else -+ p += b / 8; -+#endif -+ return !!(*p & bitmask[b % 8]); -+} -+ -+static grub_uint64_t -+set_bit64 (grub_uint64_t v, int b) -+{ -+ grub_raw_u64_t vr = { .v64 = v }; -+ grub_uint8_t *p = vr.v8; -+ if (b >= 64) -+ return v; -+#ifdef GRUB_CPU_WORDS_BIGENDIAN -+ p += 7 - b / 8; -+#else -+ p += b / 8; -+#endif -+ *p |= bitmask[b % 8]; -+ return vr.v64; -+} -+ -+static grub_uint64_t -+left_shift64 (grub_uint64_t v, int s) -+{ -+ grub_uint64_t r = 0; -+ int i; -+ for (i = 0; i + s < 64; i++) -+ if (get_bit64 (v, i)) -+ r = set_bit64 (r, i + s); -+ return r; -+} -+ -+static grub_uint64_t -+right_shift64 (grub_uint64_t v, int s) -+{ -+ grub_uint64_t r = 0; -+ int i; -+ for (i = s; i < 64; i++) -+ if (get_bit64 (v, i)) -+ r = set_bit64 (r, i - s); -+ return r; -+} -+ -+static grub_uint64_t -+arithmetic_right_shift64 (grub_uint64_t v, int s) -+{ -+ grub_uint64_t r = 0; -+ int i; -+ for (i = s; i < 64; i++) -+ if (get_bit64 (v, i)) -+ r = set_bit64 (r, i - s); -+ if (get_bit64 (v, 63)) -+ for (i -= s; i < 64; i++) -+ r = set_bit64 (r, i); -+ -+ return r; -+} -+ -+static void -+test64 (grub_uint64_t v) -+{ -+ int i; -+ for (i = 0; i < 64; i++) -+ { -+ grub_test_assert ((v << i) == left_shift64 (v, i), -+ "lshift wrong: 0x%llx << %d: 0x%llx, 0x%llx", -+ (long long) v, i, -+ (long long) (v << i), (long long) left_shift64 (v, i)); -+ grub_test_assert ((v >> i) == right_shift64 (v, i), -+ "rshift wrong: 0x%llx >> %d: 0x%llx, 0x%llx", -+ (long long) v, i, -+ (long long) (v >> i), (long long) right_shift64 (v, i)); -+ grub_test_assert ((((grub_int64_t) v) >> i) == (grub_int64_t) arithmetic_right_shift64 (v, i), -+ "arithmetic rshift wrong: ((grub_int64_t) 0x%llx) >> %d: 0x%llx, 0x%llx", -+ (long long) v, i, -+ (long long) (((grub_int64_t) v) >> i), (long long) arithmetic_right_shift64 (v, i)); -+ } -+} -+ -+static void -+test_all(grub_uint64_t a) -+{ -+ test64 (a); -+} -+ -+static void -+shift_test (void) -+{ -+ grub_uint64_t a = 404, b = 7; -+ grub_size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE (vectors); i++) -+ { -+ test_all (vectors[i]); -+ } -+ for (i = 0; i < 4000; i++) -+ { -+ a = 17 * a + 13 * b; -+ b = 23 * a + 29 * b; -+ if (b == 0) -+ b = 1; -+ if (a == 0) -+ a = 1; -+ test_all (a); -+ test_all (b); -+ } -+} -+ -+/* Register example_test method as a functional test. */ -+GRUB_FUNCTIONAL_TEST (shift_test, shift_test); -diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h -new file mode 100644 -index 0000000..9265c7e ---- /dev/null -+++ b/include/grub/compiler-rt.h -@@ -0,0 +1,193 @@ -+/* compiler-rt.h - prototypes for compiler helpers. */ -+/* -+ * 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_RT_HEADER -+#define GRUB_COMPILER_RT_HEADER 1 -+ -+#include -+#include -+#include -+#include -+ -+#if defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE -+ -+grub_uint32_t -+EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); -+ -+grub_uint32_t -+EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); -+ -+grub_int32_t -+EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); -+ -+grub_int32_t -+EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); -+ -+grub_int64_t -+EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); -+ -+grub_int64_t -+EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); -+ -+grub_uint64_t -+EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); -+ -+grub_uint64_t -+EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); -+ -+#endif -+ -+#if defined (__sparc__) || defined (__powerpc__) || defined (__mips__) || defined (__arm__) -+unsigned -+EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); -+#define NEED_CTZDI2 1 -+#endif -+ -+#if defined (__mips__) || defined (__arm__) -+unsigned -+EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); -+#define NEED_CTZSI2 1 -+#endif -+ -+#ifdef __arm__ -+grub_uint32_t -+EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); -+grub_uint32_t -+EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); -+ -+grub_int32_t -+EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); -+grub_int32_t -+EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); -+ -+int -+EXPORT_FUNC (__aeabi_ulcmp) (grub_uint64_t a, grub_uint64_t b); -+ -+/* Needed for allowing modules to be compiled as thumb. */ -+grub_uint64_t -+EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); -+grub_uint64_t -+EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); -+ -+void * -+EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); -+void * -+EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); -+ -+grub_uint64_t -+EXPORT_FUNC (__aeabi_lasr) (grub_uint64_t u, int b); -+ -+grub_uint64_t -+EXPORT_FUNC (__aeabi_llsl) (grub_uint64_t u, int b); -+ -+grub_uint64_t -+EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b); -+ -+#endif -+ -+ -+#if defined (__powerpc__) -+ -+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 (__powerpc__) || defined(__mips__) || defined (__arm__) -+ -+int -+EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b); -+ -+grub_uint64_t -+EXPORT_FUNC(__ashldi3) (grub_uint64_t u, int b); -+ -+grub_uint64_t -+EXPORT_FUNC(__ashrdi3) (grub_uint64_t u, int b); -+ -+grub_uint64_t -+EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b); -+#endif -+ -+#if defined (__powerpc__) || defined(__mips__) || defined(__sparc__) || defined (__arm__) -+grub_uint32_t -+EXPORT_FUNC(__bswapsi2) (grub_uint32_t u); -+ -+grub_uint64_t -+EXPORT_FUNC(__bswapdi2) (grub_uint64_t u); -+#endif -+ -+#if defined (__APPLE__) && defined(__i386__) -+#define GRUB_BUILTIN_ATTR __attribute__ ((regparm(0))) -+#else -+#define GRUB_BUILTIN_ATTR -+#endif -+ -+/* Prototypes for aliases. */ -+int GRUB_BUILTIN_ATTR EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); -+void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); -+void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); -+void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); -+ -+#ifdef __APPLE__ -+void GRUB_BUILTIN_ATTR EXPORT_FUNC (__bzero) (void *s, grub_size_t n); -+#endif -+ -+#if defined (__MINGW32__) || defined (__CYGWIN__) -+void EXPORT_FUNC (__register_frame_info) (void); -+void EXPORT_FUNC (__deregister_frame_info) (void); -+void EXPORT_FUNC (___chkstk_ms) (void); -+void EXPORT_FUNC (__chkstk_ms) (void); -+#endif -+ -+#endif -+ -diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h -deleted file mode 100644 -index 8e93b67..0000000 ---- a/include/grub/libgcc.h -+++ /dev/null -@@ -1,91 +0,0 @@ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2004,2007,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 . -- */ -- --/* 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 --#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); --void EXPORT_FUNC (__aeabi_llsr) (void); --void EXPORT_FUNC (__aeabi_ulcmp) (void); --#endif -diff --git a/include/grub/misc.h b/include/grub/misc.h -index a05b3fd..2a9f87c 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -71,12 +71,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t n) - return grub_memmove (dest, src, n); - } - --#if defined (__APPLE__) && defined(__i386__) && !defined (GRUB_UTIL) --#define GRUB_BUILTIN_ATTR __attribute__ ((regparm(0))) --#else --#define GRUB_BUILTIN_ATTR --#endif -- - #if defined(__x86_64__) && !defined (GRUB_UTIL) - #if defined (__MINGW32__) || defined (__CYGWIN__) || defined (__MINGW64__) - #define GRUB_ASM_ATTR __attribute__ ((sysv_abi)) -@@ -85,19 +79,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t n) - #endif - #endif - --/* Prototypes for aliases. */ --#ifndef GRUB_UTIL --int GRUB_BUILTIN_ATTR EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); --void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); --void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); --void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); -- --#ifdef __APPLE__ --void GRUB_BUILTIN_ATTR EXPORT_FUNC (__bzero) (void *s, grub_size_t n); --#endif -- --#endif -- - int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); - int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2); - int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); -@@ -378,6 +359,7 @@ grub_int64_t - EXPORT_FUNC_IF_SOFTDIV(grub_divmod64s) (grub_int64_t n, - grub_int64_t d, - grub_int64_t *r); -+ - grub_uint32_t - EXPORT_FUNC_IF_SOFTDIV (grub_divmod32) (grub_uint32_t n, - grub_uint32_t d, -@@ -388,41 +370,6 @@ EXPORT_FUNC_IF_SOFTDIV (grub_divmod32s) (grub_int32_t n, - grub_int32_t d, - grub_int32_t *r); - --#if defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE -- --grub_uint32_t --EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); -- --grub_uint32_t --EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); -- --grub_int32_t --EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); -- --grub_int32_t --EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); -- --grub_int64_t --EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); -- --grub_int64_t --EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); -- --grub_uint64_t --EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); -- --grub_uint64_t --EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); -- --#endif -- --#if (defined (__MINGW32__) || defined (__CYGWIN__)) && !defined(GRUB_UTIL) --void EXPORT_FUNC (__register_frame_info) (void); --void EXPORT_FUNC (__deregister_frame_info) (void); --void EXPORT_FUNC (___chkstk_ms) (void); --void EXPORT_FUNC (__chkstk_ms) (void); --#endif -- - /* Inline functions. */ - - static inline char * -@@ -491,50 +438,6 @@ grub_error_load (const struct grub_error_saved *save) - grub_errno = save->grub_errno; - } - --#ifndef GRUB_UTIL -- --#if defined (__arm__) -- --#endif -- --#if defined (__sparc__) || defined (__powerpc__) --unsigned --EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); --#define NEED_CTZDI2 1 --#endif -- --#if defined (__mips__) || defined (__arm__) --unsigned --EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); --#define NEED_CTZSI2 1 --#endif -- --#ifdef __arm__ --grub_uint32_t --EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); --grub_int32_t --EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); --grub_uint32_t --EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); --grub_int32_t --EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); -- --/* Needed for allowing modules to be compiled as thumb. */ --grub_uint64_t --EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); --grub_uint64_t --EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); -- --void * --EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); --void * --EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); -- --#endif -- --#endif /* GRUB_UTIL */ -- -- - #if BOOT_TIME_STATS - struct grub_boot_time - { -diff --git a/include/grub/xen.h b/include/grub/xen.h -index 6035d1a..9ba3b8e 100644 ---- a/include/grub/xen.h -+++ b/include/grub/xen.h -@@ -21,6 +21,8 @@ - - #define __XEN_INTERFACE_VERSION__ 0x0003020a - -+#define memset grub_memset -+ - #ifdef ASM_FILE - #define __ASSEMBLY__ - #include --- -2.4.3 - diff --git a/0352-configure.ac-Remove-unused-COND_clang.patch b/0352-configure.ac-Remove-unused-COND_clang.patch deleted file mode 100644 index 1b6997d..0000000 --- a/0352-configure.ac-Remove-unused-COND_clang.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 9f95d12153098f8b3e4c34ad106c6402cd4dc0ff Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 3 Mar 2015 20:49:48 +0100 -Subject: [PATCH 352/506] configure.ac: Remove unused COND_clang - ---- - configure.ac | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index be980ad..16fa0da 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1759,7 +1759,6 @@ AC_SUBST(BUILD_LIBM) - - AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) - AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) --AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes]) - AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) - AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) - AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) --- -2.4.3 - diff --git a/0353-Remove-emu-libusb-support.patch b/0353-Remove-emu-libusb-support.patch deleted file mode 100644 index 79e898d..0000000 --- a/0353-Remove-emu-libusb-support.patch +++ /dev/null @@ -1,420 +0,0 @@ -From 9d25b0da9a8cce9b3766f4e1b449d7936d5ba124 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Tue, 3 Mar 2015 20:59:36 +0100 -Subject: [PATCH 353/506] Remove emu libusb support. - -It's disabled by default and has been broken for a long time. -As nobody is interested in fixing and maintaining it, remove it. ---- - configure.ac | 44 ---------- - gentpl.py | 2 +- - grub-core/Makefile.am | 3 - - grub-core/Makefile.core.def | 14 --- - grub-core/bus/usb/emu/usb.c | 203 -------------------------------------------- - include/grub/libusb.h | 29 ------- - 6 files changed, 1 insertion(+), 294 deletions(-) - delete mode 100644 grub-core/bus/usb/emu/usb.c - delete mode 100644 include/grub/libusb.h - -diff --git a/configure.ac b/configure.ac -index 16fa0da..2200776 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1255,10 +1255,6 @@ else - fi - AC_SUBST([BOOT_TIME_STATS]) - --AC_ARG_ENABLE([grub-emu-usb], -- [AS_HELP_STRING([--enable-grub-emu-usb], -- [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) -- - AC_ARG_ENABLE([grub-emu-sdl], - [AS_HELP_STRING([--enable-grub-emu-sdl], - [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -1269,34 +1265,6 @@ AC_ARG_ENABLE([grub-emu-pci], - - if test "$platform" = emu; then - --if test x"$enable_grub_emu_usb" != xyes ; then -- grub_emu_usb_excuse="not enabled" --fi -- --if test x"$enable_grub_emu_pci" = xyes ; then -- grub_emu_usb_excuse="conflicts with PCI support" --fi -- --[if [ x"$grub_emu_usb_excuse" = x ]; then -- # Check for libusb libraries.] --AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], -- [grub_emu_usb_excuse=["need libusb library"]]) -- AC_SUBST([LIBUSB]) --[fi] --[if [ x"$grub_emu_usb_excuse" = x ]; then -- # Check for headers.] -- AC_CHECK_HEADERS([usb.h], [], -- [grub_emu_usb_excuse=["need libusb headers"]]) --[fi] --if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then -- AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)]) --fi --if test x"$grub_emu_usb_excuse" = x ; then --enable_grub_emu_usb=yes --else --enable_grub_emu_usb=no --fi -- - if test x"$enable_grub_emu_sdl" = xno ; then - grub_emu_sdl_excuse="explicitly disabled" - fi -@@ -1326,10 +1294,6 @@ if test x"$enable_grub_emu_pci" != xyes ; then - grub_emu_pci_excuse="not enabled" - fi - --if test x"$enable_grub_emu_usb" = xyes ; then -- grub_emu_pci_excuse="conflicts with USB support" --fi -- - [if [ x"$grub_emu_pci_excuse" = x ]; then - # Check for libpci libraries.] - AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], -@@ -1350,14 +1314,12 @@ enable_grub_emu_pci=no - fi - - AC_SUBST([enable_grub_emu_sdl]) --AC_SUBST([enable_grub_emu_usb]) - AC_SUBST([enable_grub_emu_pci]) - - else - - # Ignore --enable-emu-* if platform is not emu - enable_grub_emu_sdl=no --enable_grub_emu_usb=no - enable_grub_emu_pci=no - fi - -@@ -1793,7 +1755,6 @@ AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu]) - AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos]) - - AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) --AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) - AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) - AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) - AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) -@@ -1871,11 +1832,6 @@ echo "*******************************************************" - echo GRUB2 will be compiled with following components: - echo Platform: "$target_cpu"-"$platform" - if [ x"$platform" = xemu ]; then --if [ x"$grub_emu_usb_excuse" = x ]; then --echo USB support for grub-emu: Yes --else --echo USB support for grub-emu: No "($grub_emu_usb_excuse)" --fi - if [ x"$grub_emu_sdl_excuse" = x ]; then - echo SDL support for grub-emu: Yes - else -diff --git a/gentpl.py b/gentpl.py -index d2aa035..f177883 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -606,7 +606,7 @@ def foreach_enabled_platform(defn, closure): - # enable = emu; - # enable = i386; - # enable = mips_loongson; --# emu_condition = COND_GRUB_EMU_USB; -+# emu_condition = COND_GRUB_EMU_SDL; - # }; - # - def under_platform_specific_conditionals(defn, platform, closure): -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 57c0b64..af0c7f4 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -250,9 +250,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h - if COND_GRUB_EMU_SDL - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h - endif --if COND_GRUB_EMU_USB --KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h --endif - if COND_GRUB_EMU_PCI - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h - endif -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 7a6fa21..8eaae45 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -512,13 +512,6 @@ module = { - }; - - module = { -- name = libusb; -- emu = bus/usb/emu/usb.c; -- enable = emu; -- condition = COND_GRUB_EMU_USB; --}; -- --module = { - name = lsspd; - mips_loongson = commands/mips/loongson/lsspd.c; - enable = mips_loongson; -@@ -533,13 +526,6 @@ module = { - }; - - module = { -- name = emuusb; -- common = bus/usb/usb.c; -- enable = emu; -- condition = COND_GRUB_EMU_USB; --}; -- --module = { - name = usbserial_common; - common = bus/usb/serial/common.c; - enable = usb; -diff --git a/grub-core/bus/usb/emu/usb.c b/grub-core/bus/usb/emu/usb.c -deleted file mode 100644 -index 3ad2fc3..0000000 ---- a/grub-core/bus/usb/emu/usb.c -+++ /dev/null -@@ -1,203 +0,0 @@ --/* usb.c -- libusb USB support for GRUB. */ --/* -- * 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 -- --GRUB_MOD_LICENSE ("GPLv3+"); -- -- --static struct grub_usb_controller_dev usb_controller = --{ -- .name = "libusb" --}; -- --static struct grub_usb_device *grub_usb_devs[128]; -- --struct usb_bus *busses; -- --static grub_err_t --grub_libusb_devices (void) -- --{ -- struct usb_bus *bus; -- int last = 0; -- -- busses = usb_get_busses(); -- -- for (bus = busses; bus; bus = bus->next) -- { -- struct usb_device *usbdev; -- struct grub_usb_device *dev; -- -- for (usbdev = bus->devices; usbdev; usbdev = usbdev->next) -- { -- struct usb_device_descriptor *desc = &usbdev->descriptor; -- grub_err_t err; -- -- if (! desc->bcdUSB) -- continue; -- -- dev = grub_malloc (sizeof (*dev)); -- if (! dev) -- return grub_errno; -- -- dev->data = usbdev; -- -- /* Fill in all descriptors. */ -- err = grub_usb_device_initialize (dev); -- if (err) -- { -- grub_errno = GRUB_ERR_NONE; -- continue; -- } -- -- /* Register the device. */ -- grub_usb_devs[last++] = dev; -- } -- } -- -- return GRUB_USB_ERR_NONE; --} -- --void --grub_usb_poll_devices (void) --{ -- /* TODO: recheck grub_usb_devs */ --} -- -- --int --grub_usb_iterate (grub_usb_iterate_hook_t hook, void *hook_data) --{ -- int i; -- -- for (i = 0; i < 128; i++) -- { -- if (grub_usb_devs[i]) -- { -- if (hook (grub_usb_devs[i], hook_data)) -- return 1; -- } -- } -- -- return 0; --} -- --grub_usb_err_t --grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused))) --{ -- return GRUB_USB_ERR_NONE; --} -- --grub_usb_err_t --grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype, -- grub_uint8_t request, grub_uint16_t value, -- grub_uint16_t idx, grub_size_t size, char *data) --{ -- usb_dev_handle *devh; -- struct usb_device *d = dev->data; -- -- devh = usb_open (d); -- if (usb_control_msg (devh, reqtype, request, -- value, idx, data, size, 20) < 0) -- { -- usb_close (devh); -- return GRUB_USB_ERR_STALL; -- } -- -- usb_close (devh); -- -- return GRUB_USB_ERR_NONE; --} -- --grub_usb_err_t --grub_usb_bulk_read (grub_usb_device_t dev, -- int endpoint, grub_size_t size, char *data) --{ -- usb_dev_handle *devh; -- struct usb_device *d = dev->data; -- -- devh = usb_open (d); -- if (usb_claim_interface (devh, 0) < 1) -- { -- usb_close (devh); -- return GRUB_USB_ERR_STALL; -- } -- -- if (usb_bulk_read (devh, endpoint, data, size, 20) < 1) -- { -- usb_close (devh); -- return GRUB_USB_ERR_STALL; -- } -- -- usb_release_interface (devh, 0); -- usb_close (devh); -- -- return GRUB_USB_ERR_NONE; --} -- --grub_usb_err_t --grub_usb_bulk_write (grub_usb_device_t dev, -- int endpoint, grub_size_t size, char *data) --{ -- usb_dev_handle *devh; -- struct usb_device *d = dev->data; -- -- devh = usb_open (d); -- if (usb_claim_interface (devh, 0) < 0) -- goto fail; -- -- if (usb_bulk_write (devh, endpoint, data, size, 20) < 0) -- goto fail; -- -- if (usb_release_interface (devh, 0) < 0) -- goto fail; -- -- usb_close (devh); -- -- return GRUB_USB_ERR_NONE; -- -- fail: -- usb_close (devh); -- return GRUB_USB_ERR_STALL; --} -- --GRUB_MOD_INIT (libusb) --{ -- usb_init(); -- usb_find_busses(); -- usb_find_devices(); -- -- if (grub_libusb_devices ()) -- return; -- -- grub_usb_controller_dev_register (&usb_controller); -- -- return; --} -- --GRUB_MOD_FINI (libusb) --{ -- return; --} -diff --git a/include/grub/libusb.h b/include/grub/libusb.h -deleted file mode 100644 -index 26548bc..0000000 ---- a/include/grub/libusb.h -+++ /dev/null -@@ -1,29 +0,0 @@ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2010 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 . -- */ -- --void EXPORT_FUNC (usb_bulk_write) (void); --void EXPORT_FUNC (usb_find_busses) (void); --void EXPORT_FUNC (usb_init) (void); --void EXPORT_FUNC (usb_find_devices) (void); --void EXPORT_FUNC (usb_open) (void); --void EXPORT_FUNC (usb_get_busses) (void); --void EXPORT_FUNC (usb_control_msg) (void); --void EXPORT_FUNC (usb_release_interface) (void); --void EXPORT_FUNC (usb_close) (void); --void EXPORT_FUNC (usb_bulk_read) (void); --void EXPORT_FUNC (usb_claim_interface) (void); --- -2.4.3 - diff --git a/0354-Fix-canonicalize_file_name-clash.patch b/0354-Fix-canonicalize_file_name-clash.patch deleted file mode 100644 index e9f229a..0000000 --- a/0354-Fix-canonicalize_file_name-clash.patch +++ /dev/null @@ -1,381 +0,0 @@ -From 27d1a67f8a99e62b0900c68198477143f5bfbaa5 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 4 Mar 2015 01:00:19 +0100 -Subject: [PATCH 354/506] Fix canonicalize_file_name clash. - -canonicalize_file_name clashed with gnulib function. Additionally -it was declared in 2 places: emu/misc.h and util/misc.h. Added -grub_ prefix and removed second declaration. ---- - grub-core/bus/emu/pci.c | 7 ++++--- - grub-core/kern/emu/hostdisk.c | 4 ++-- - grub-core/osdep/aros/hostdisk.c | 2 +- - grub-core/osdep/unix/getroot.c | 4 ++-- - grub-core/osdep/unix/hostdisk.c | 2 +- - grub-core/osdep/unix/relpath.c | 2 +- - grub-core/osdep/windows/hostdisk.c | 2 +- - grub-core/osdep/windows/init.c | 2 +- - include/grub/emu/misc.h | 3 +-- - include/grub/util/misc.h | 2 +- - util/getroot.c | 2 +- - util/grub-file.c | 2 +- - util/grub-fstest.c | 2 +- - util/grub-install.c | 4 ++-- - util/grub-macbless.c | 2 +- - util/grub-mount.c | 2 +- - util/grub-probe.c | 2 +- - util/grub-syslinux2cfg.c | 6 +++--- - util/probe.c | 6 +++--- - util/render-label.c | 2 +- - 20 files changed, 30 insertions(+), 30 deletions(-) - -diff --git a/grub-core/bus/emu/pci.c b/grub-core/bus/emu/pci.c -index 9d32963..663e554 100644 ---- a/grub-core/bus/emu/pci.c -+++ b/grub-core/bus/emu/pci.c -@@ -55,7 +55,8 @@ grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base, - int err; - err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr); - if (err) -- grub_util_error ("mapping 0x%x failed (error %d)\n", base, err); -+ grub_util_error ("mapping 0x%llx failed (error %d)\n", -+ (unsigned long long) base, err); - return addr; - } - -@@ -66,12 +67,12 @@ grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem, - pci_device_unmap_range (dev, mem, size); - } - --GRUB_MOD_INIT (pci) -+GRUB_MOD_INIT (emupci) - { - pci_system_init (); - } - --GRUB_MOD_FINI (pci) -+GRUB_MOD_FINI (emupci) - { - pci_system_cleanup (); - } -diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c -index a4ebf78..a3b00c8 100644 ---- a/grub-core/kern/emu/hostdisk.c -+++ b/grub-core/kern/emu/hostdisk.c -@@ -184,7 +184,7 @@ grub_hostdisk_os_dev_to_grub_drive (const char *os_disk, int add) - unsigned int i; - char *canon; - -- canon = canonicalize_file_name (os_disk); -+ canon = grub_canonicalize_file_name (os_disk); - if (!canon) - canon = xstrdup (os_disk); - -@@ -535,7 +535,7 @@ read_device_map (const char *dev_map) - /* On Linux, the devfs uses symbolic links horribly, and that - confuses the interface very much, so use realpath to expand - symbolic links. */ -- map[drive].device = canonicalize_file_name (p); -+ map[drive].device = grub_canonicalize_file_name (p); - if (! map[drive].device) - map[drive].device = xstrdup (p); - -diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c -index e1eeea7..7d99b54 100644 ---- a/grub-core/osdep/aros/hostdisk.c -+++ b/grub-core/osdep/aros/hostdisk.c -@@ -61,7 +61,7 @@ - static ULONG *bounce; - - char * --canonicalize_file_name (const char *path) -+grub_canonicalize_file_name (const char *path) - { - char *ret; - BPTR lck; -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 10fb56a..ccee7ce 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -491,7 +491,7 @@ grub_guess_root_devices (const char *dir_in) - char **os_dev = NULL; - struct stat st; - dev_t dev; -- char *dir = canonicalize_file_name (dir_in); -+ char *dir = grub_canonicalize_file_name (dir_in); - - if (!dir) - grub_util_error (_("failed to get canonical path of `%s'"), dir_in); -@@ -516,7 +516,7 @@ grub_guess_root_devices (const char *dir_in) - *cur = tmp; - else - { -- *cur = canonicalize_file_name (tmp); -+ *cur = grub_canonicalize_file_name (tmp); - if (*cur == NULL) - grub_util_error (_("failed to get canonical path of `%s'"), tmp); - free (tmp); -diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c -index b3bc0e4..2a8c588 100644 ---- a/grub-core/osdep/unix/hostdisk.c -+++ b/grub-core/osdep/unix/hostdisk.c -@@ -198,7 +198,7 @@ grub_util_fd_close (grub_util_fd_t fd) - } - - char * --canonicalize_file_name (const char *path) -+grub_canonicalize_file_name (const char *path) - { - #if defined (PATH_MAX) - char *ret; -diff --git a/grub-core/osdep/unix/relpath.c b/grub-core/osdep/unix/relpath.c -index 71c19d8..8fdc3a7 100644 ---- a/grub-core/osdep/unix/relpath.c -+++ b/grub-core/osdep/unix/relpath.c -@@ -44,7 +44,7 @@ grub_make_system_path_relative_to_its_root (const char *path) - char *poolfs = NULL; - - /* canonicalize. */ -- p = canonicalize_file_name (path); -+ p = grub_canonicalize_file_name (path); - if (p == NULL) - grub_util_error (_("failed to get canonical path of `%s'"), path); - -diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c -index d390b25..85507af 100644 ---- a/grub-core/osdep/windows/hostdisk.c -+++ b/grub-core/osdep/windows/hostdisk.c -@@ -328,7 +328,7 @@ grub_util_fd_strerror (void) - } - - char * --canonicalize_file_name (const char *path) -+grub_canonicalize_file_name (const char *path) - { - char *ret; - LPTSTR windows_path; -diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c -index 98c325c..e8ffd62 100644 ---- a/grub-core/osdep/windows/init.c -+++ b/grub-core/osdep/windows/init.c -@@ -170,7 +170,7 @@ grub_util_host_init (int *argc __attribute__ ((unused)), - #error "Unsupported TCHAR size" - #endif - -- grub_util_base_directory = canonicalize_file_name ((*argv)[0]); -+ grub_util_base_directory = grub_canonicalize_file_name ((*argv)[0]); - if (!grub_util_base_directory) - grub_util_base_directory = xstrdup ((*argv)[0]); - for (ptr = grub_util_base_directory + strlen (grub_util_base_directory) - 1; -diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index a588ba2..df6085b 100644 ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - extern int verbosity; - extern const char *program_name; -@@ -61,8 +62,6 @@ void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format - - grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); - --extern char * canonicalize_file_name (const char *path); -- - #ifdef HAVE_DEVICE_MAPPER - int grub_device_mapper_supported (void); - #endif -diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h -index 192874d..e9e0a67 100644 ---- a/include/grub/util/misc.h -+++ b/include/grub/util/misc.h -@@ -41,7 +41,7 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset, - - char *make_system_path_relative_to_its_root (const char *path); - --char *canonicalize_file_name (const char *path); -+char *grub_canonicalize_file_name (const char *path); - - void grub_util_init_nls (void); - -diff --git a/util/getroot.c b/util/getroot.c -index 3c1f12d..36f1730 100644 ---- a/util/getroot.c -+++ b/util/getroot.c -@@ -406,7 +406,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) - os_dev); - grub_errno = GRUB_ERR_NONE; - -- canon = canonicalize_file_name (os_dev); -+ canon = grub_canonicalize_file_name (os_dev); - drive = grub_hostdisk_os_dev_to_grub_drive (canon ? : os_dev, 1); - if (canon) - free (canon); -diff --git a/util/grub-file.c b/util/grub-file.c -index 9989dfe..50c18b6 100644 ---- a/util/grub-file.c -+++ b/util/grub-file.c -@@ -77,7 +77,7 @@ main (int argc, char *argv[]) - } - if (had_file) - grub_util_error ("one argument expected"); -- argv2[i - 1] = canonicalize_file_name (argv[i]); -+ argv2[i - 1] = grub_canonicalize_file_name (argv[i]); - if (!argv2[i - 1]) - { - grub_util_error (_("cannot open `%s': %s"), argv[i], -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 02cd3e3..a358ae4 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -651,7 +651,7 @@ argp_parser (int key, char *arg, struct argp_state *state) - { - if (args_count == 0) - images = xmalloc (num_disks * sizeof (images[0])); -- images[args_count] = canonicalize_file_name (arg); -+ images[args_count] = grub_canonicalize_file_name (arg); - args_count++; - return 0; - } -diff --git a/util/grub-install.c b/util/grub-install.c -index cedc188..7b394c9 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -967,7 +967,7 @@ main (int argc, char *argv[]) - { - char * t = grub_util_path_concat (2, bootdir, GRUB_DIR_NAME); - grub_install_mkdir_p (t); -- grubdir = canonicalize_file_name (t); -+ grubdir = grub_canonicalize_file_name (t); - if (!grubdir) - grub_util_error (_("failed to get canonical path of `%s'"), t); - free (t); -@@ -1299,7 +1299,7 @@ main (int argc, char *argv[]) - { - char *t = grub_util_path_concat (2, grubdir, - platname); -- platdir = canonicalize_file_name (t); -+ platdir = grub_canonicalize_file_name (t); - if (!platdir) - grub_util_error (_("failed to get canonical path of `%s'"), - t); -diff --git a/util/grub-macbless.c b/util/grub-macbless.c -index e57e13d..e9b15a0 100644 ---- a/util/grub-macbless.c -+++ b/util/grub-macbless.c -@@ -64,7 +64,7 @@ bless (const char *path, int x86) - grub_err_t err; - struct stat st; - -- grub_path = canonicalize_file_name (path); -+ grub_path = grub_canonicalize_file_name (path); - - if (stat (grub_path, &st) < 0) - grub_util_error (N_("cannot stat `%s': %s"), -diff --git a/util/grub-mount.c b/util/grub-mount.c -index 4626e54..0d0fea5 100644 ---- a/util/grub-mount.c -+++ b/util/grub-mount.c -@@ -547,7 +547,7 @@ argp_parser (int key, char *arg, struct argp_state *state) - } - - images = xrealloc (images, (num_disks + 1) * sizeof (images[0])); -- images[num_disks] = canonicalize_file_name (arg); -+ images[num_disks] = grub_canonicalize_file_name (arg); - num_disks++; - - return 0; -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 8f4aa61..6075cb3 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -262,7 +262,7 @@ probe (const char *path, char **device_names, char delim) - - if (path != NULL) - { -- grub_path = canonicalize_file_name (path); -+ grub_path = grub_canonicalize_file_name (path); - if (! grub_path) - grub_util_error (_("failed to get canonical path of `%s'"), path); - device_names = grub_guess_root_devices (grub_path); -diff --git a/util/grub-syslinux2cfg.c b/util/grub-syslinux2cfg.c -index f4fda6d..85fa0da 100644 ---- a/util/grub-syslinux2cfg.c -+++ b/util/grub-syslinux2cfg.c -@@ -175,7 +175,7 @@ main (int argc, char *argv[]) - grub_host_init (); - - char *t, *inpfull, *rootfull, *res; -- t = canonicalize_file_name (arguments.input); -+ t = grub_canonicalize_file_name (arguments.input); - if (!t) - { - grub_util_error (_("cannot open `%s': %s"), arguments.input, -@@ -185,7 +185,7 @@ main (int argc, char *argv[]) - inpfull = xasprintf ("(host)/%s", t); - free (t); - -- t = canonicalize_file_name (arguments.root ? : "/"); -+ t = grub_canonicalize_file_name (arguments.root ? : "/"); - if (!t) - { - grub_util_error (_("cannot open `%s': %s"), arguments.root, -@@ -206,7 +206,7 @@ main (int argc, char *argv[]) - cwd = xstrdup ("."); - } - -- t = canonicalize_file_name (arguments.cwd ? : cwd); -+ t = grub_canonicalize_file_name (arguments.cwd ? : cwd); - if (!t) - { - grub_util_error (_("cannot open `%s': %s"), arguments.root, -diff --git a/util/probe.c b/util/probe.c -index c389f5d..fa7ca34 100644 ---- a/util/probe.c -+++ b/util/probe.c -@@ -73,7 +73,7 @@ grub_util_guess_bios_drive (const char *orig_path) - { - char *canon; - char *ptr; -- canon = canonicalize_file_name (orig_path); -+ canon = grub_canonicalize_file_name (orig_path); - if (!canon) - return NULL; - ptr = strrchr (orig_path, '/'); -@@ -102,7 +102,7 @@ grub_util_guess_efi_drive (const char *orig_path) - { - char *canon; - char *ptr; -- canon = canonicalize_file_name (orig_path); -+ canon = grub_canonicalize_file_name (orig_path); - if (!canon) - return NULL; - ptr = strrchr (orig_path, '/'); -@@ -131,7 +131,7 @@ grub_util_guess_baremetal_drive (const char *orig_path) - { - char *canon; - char *ptr; -- canon = canonicalize_file_name (orig_path); -+ canon = grub_canonicalize_file_name (orig_path); - if (!canon) - return NULL; - ptr = strrchr (orig_path, '/'); -diff --git a/util/render-label.c b/util/render-label.c -index 39663a8..91c080c 100644 ---- a/util/render-label.c -+++ b/util/render-label.c -@@ -157,7 +157,7 @@ grub_util_render_label (const char *label_font, - ieee1275_palette[cptr].a = 0xff; - - char * t; -- t = canonicalize_file_name (label_font); -+ t = grub_canonicalize_file_name (label_font); - if (!t) - { - grub_util_error (_("cannot open `%s': %s"), label_font, --- -2.4.3 - diff --git a/0355-configure.ac-Fix-the-name-of-pciaccess-header.patch b/0355-configure.ac-Fix-the-name-of-pciaccess-header.patch deleted file mode 100644 index a4cbaae..0000000 --- a/0355-configure.ac-Fix-the-name-of-pciaccess-header.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5959b15c1cf2113999968291e0723337888d4979 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 4 Mar 2015 01:01:45 +0100 -Subject: [PATCH 355/506] configure.ac: Fix the name of pciaccess header. - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 2200776..891c14f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1302,7 +1302,7 @@ fi - [fi] - [if [ x"$grub_emu_pci_excuse" = x ]; then - # Check for headers.] -- AC_CHECK_HEADERS([pci/pci.h], [], -+ AC_CHECK_HEADERS([pciaccess.h], [], - [grub_emu_pci_excuse=["need libpciaccess headers"]]) - [fi] - --- -2.4.3 - diff --git a/0356-syslinux_parse-Fix-the-case-of-unknown-localboot.patch b/0356-syslinux_parse-Fix-the-case-of-unknown-localboot.patch deleted file mode 100644 index 1a1fed1..0000000 --- a/0356-syslinux_parse-Fix-the-case-of-unknown-localboot.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dc06aa949b7ff25cec78e6c415a65b444c11d8d9 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 4 Mar 2015 14:19:29 +0100 -Subject: [PATCH 356/506] syslinux_parse: Fix the case of unknown localboot. - -Reported by: Jordan Uggla ---- - grub-core/lib/syslinux_parse.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index afc12b5..22389eb 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -945,6 +945,7 @@ write_entry (struct output_buffer *outbuf, - break; - } - print_string (" # UNSUPPORTED localboot type "); -+ print_string ("\ntrue;\n"); - if (print_num (outbuf, n)) - return grub_errno; - print_string ("\n"); --- -2.4.3 - diff --git a/0357-update-m4-extern-inline.m4-to-upstream-version-to-fi.patch b/0357-update-m4-extern-inline.m4-to-upstream-version-to-fi.patch deleted file mode 100644 index 8e612f0..0000000 --- a/0357-update-m4-extern-inline.m4-to-upstream-version-to-fi.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 20f21d897858d827210d67c75f42d18887cbce81 Mon Sep 17 00:00:00 2001 -From: Andrey Borzenkov -Date: Thu, 5 Mar 2015 19:25:56 +0300 -Subject: [PATCH 357/506] update m4/extern-inline.m4 to upstream version to fix - compilation on FreeBSD - -In file included from util/grub-mkimage.c:54:0: -./grub-core/gnulib/argp.h:627:49: error: '__sbistype' is static but -used in inline function '_option_is_short' which is not static -[-Werror] cc1: all warnings being treated as errors gmake[2]: *** -[util/grub_mkimage-grub-mkimage.o] Error 1 - -Update m4/extern-inline.m4 to current upstream gnulib version that -contains fix for this (commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d). - -Reported-By: Beeblebrox ---- - m4/extern-inline.m4 | 71 +++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 53 insertions(+), 18 deletions(-) - -diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 -index 0152f29..e74339a 100644 ---- a/m4/extern-inline.m4 -+++ b/m4/extern-inline.m4 -@@ -1,6 +1,6 @@ - dnl 'extern inline' a la ISO C99. - --dnl Copyright 2012-2013 Free Software Foundation, Inc. -+dnl Copyright 2012-2015 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. -@@ -8,42 +8,77 @@ dnl with or without modifications, as long as this notice is preserved. - AC_DEFUN([gl_EXTERN_INLINE], - [ - AH_VERBATIM([extern_inline], --[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. -- _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. -- _GL_INLINE_HEADER_BEGIN contains useful stuff to put -- in an include file, before uses of _GL_INLINE. -- It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, -- when FOO is an inline function in the header; see -- . -- _GL_INLINE_HEADER_END contains useful stuff to put -- in the same include file, after uses of _GL_INLINE. -+[/* Please see the Gnulib manual for how to use these macros. - - Suppress extern inline with HP-UX cc, as it appears to be broken; see - . - -- Suppress the use of extern inline on Apple's platforms, -- as Libc-825.25 (2012-09-19) is incompatible with it; see -- . -- Perhaps Apple will fix this some day. */ -+ Suppress extern inline with Sun C in standards-conformance mode, as it -+ mishandles inline functions that call each other. E.g., for 'inline void f -+ (void) { } inline void g (void) { f (); }', c99 incorrectly complains -+ 'reference to static identifier "f" in extern inline function'. -+ This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. -+ -+ Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) -+ on configurations that mistakenly use 'static inline' to implement -+ functions or macros in standard C headers like . For example, -+ if isdigit is mistakenly implemented via a static inline function, -+ a program containing an extern inline function that calls isdigit -+ may not work since the C standard prohibits extern inline functions -+ from calling static functions. This bug is known to occur on: -+ -+ OS X 10.8 and earlier; see: -+ http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html -+ -+ DragonFly; see -+ http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log -+ -+ FreeBSD; see: -+ http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html -+ -+ OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and -+ for clang but remains for g++; see . -+ Assume DragonFly and FreeBSD will be similar. */ -+#if (((defined __APPLE__ && defined __MACH__) \ -+ || defined __DragonFly__ || defined __FreeBSD__) \ -+ && (defined __header_inline \ -+ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ -+ && ! defined __clang__) \ -+ : ((! defined _DONT_USE_CTYPE_INLINE_ \ -+ && (defined __GNUC__ || defined __cplusplus)) \ -+ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ -+ && defined __GNUC__ && ! defined __cplusplus)))) -+# define _GL_EXTERN_INLINE_STDHEADER_BUG -+#endif - #if ((__GNUC__ \ - ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ -- : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \ -- && !defined __APPLE__) -+ : (199901L <= __STDC_VERSION__ \ -+ && !defined __HP_cc \ -+ && !(defined __SUNPRO_C && __STDC__))) \ -+ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) - # define _GL_INLINE inline - # define _GL_EXTERN_INLINE extern inline --#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__ --# if __GNUC_GNU_INLINE__ -+# define _GL_EXTERN_INLINE_IN_USE -+#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ -+ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) -+# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ - /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ - # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) - # else - # define _GL_INLINE extern inline - # endif - # define _GL_EXTERN_INLINE extern -+# define _GL_EXTERN_INLINE_IN_USE - #else - # define _GL_INLINE static _GL_UNUSED - # define _GL_EXTERN_INLINE static _GL_UNUSED - #endif - -+/* In GCC, suppress bogus "no previous prototype for 'FOO'" -+ and "no previous declaration for 'FOO'" diagnostics, -+ when FOO is an inline function in the header; see -+ and -+ . */ - #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) - # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ - # define _GL_INLINE_HEADER_CONST_PRAGMA --- -2.4.3 - diff --git a/0358-update-gnulib-argp-help.c-to-fix-garbage-in-grub-mkn.patch b/0358-update-gnulib-argp-help.c-to-fix-garbage-in-grub-mkn.patch deleted file mode 100644 index 293bacd..0000000 --- a/0358-update-gnulib-argp-help.c-to-fix-garbage-in-grub-mkn.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 8842991a56f062c6bff03da9c2f7dcffa7e31492 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 5 Mar 2015 20:19:47 +0300 -Subject: [PATCH 358/506] update gnulib/argp-help.c to fix garbage in - grub-mknetdir --help output -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -argp_help attempts to translate empty string, which results in printing -meta information about translation, like in - -bor@opensuse:~/build/grub> grub2-mknetdir --help -ИÑпользование: grub2-mknetdir [ПÐРÐМЕТР…] -Project-Id-Version: grub 2.02-pre2 -Report-Msgid-Bugs-To: bug-grub@gnu.org -... - -Update gnulib/argp-help.c to the current version which fixes this -(commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d). ---- - grub-core/gnulib/argp-help.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/grub-core/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c -index 2914f47..b9be63f 100644 ---- a/grub-core/gnulib/argp-help.c -+++ b/grub-core/gnulib/argp-help.c -@@ -1,5 +1,5 @@ - /* Hierarchical argument parsing help output -- Copyright (C) 1995-2005, 2007, 2009-2013 Free Software Foundation, Inc. -+ Copyright (C) 1995-2005, 2007, 2009-2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader . - -@@ -650,7 +650,7 @@ hol_find_entry (struct hol *hol, const char *name) - return 0; - } - --/* If an entry with the long option NAME occurs in HOL, set it's special -+/* If an entry with the long option NAME occurs in HOL, set its special - sort position to GROUP. */ - static void - hol_set_group (struct hol *hol, const char *name, int group) -@@ -1507,11 +1507,15 @@ argp_doc (const struct argp *argp, const struct argp_state *state, - if (vt) - { - if (post) -- inp_text = vt + 1; -+ { -+ inp_text = vt + 1; -+ if (! *inp_text) -+ inp_text = 0; -+ } - else - { - inp_text_len = vt - argp->doc; -- inp_text = __strndup (argp->doc, inp_text_len); -+ inp_text = inp_text_len ? __strndup (argp->doc, inp_text_len) : 0; - } - } - else --- -2.4.3 - diff --git a/0359-autogen.sh-Allow-overriding-the-python-to-be-used-by.patch b/0359-autogen.sh-Allow-overriding-the-python-to-be-used-by.patch deleted file mode 100644 index b9f8e93..0000000 --- a/0359-autogen.sh-Allow-overriding-the-python-to-be-used-by.patch +++ /dev/null @@ -1,68 +0,0 @@ -From be41c1cf11313bc433eaad4792f1e5a90d30e5b5 Mon Sep 17 00:00:00 2001 -From: Jon McCune -Date: Fri, 6 Mar 2015 00:33:41 +0100 -Subject: [PATCH 359/506] autogen.sh: Allow overriding the python to be used by - setting $PYTHON. - -Some installations have several python versions installed. Allow user -to choose which one to use by setting $PYTHON. ---- - INSTALL | 3 +++ - autogen.sh | 11 +++++++---- - 2 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/INSTALL b/INSTALL -index 846ac38..e5b0811 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -104,6 +104,9 @@ The simplest way to compile this package is: - - 3. Type `./autogen.sh'. - -+ * autogen.sh uses python. By default invocation is "python" but can be -+ overriden by setting variable $PYTHON. -+ - 4. Type `./configure' to configure the package for your system. - If you're using `csh' on an old version of System V, you might - need to type `sh ./configure' instead to prevent `csh' from trying -diff --git a/autogen.sh b/autogen.sh -index 7424428..5020456 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -2,6 +2,9 @@ - - set -e - -+# Set ${PYTHON} to plain 'python' if not set already -+: ${PYTHON:=python} -+ - export LC_COLLATE=C - unset LC_ALL - -@@ -9,10 +12,10 @@ find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './b - find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in - - echo "Importing unicode..." --python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c -+${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c - - echo "Importing libgcrypt..." --python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core -+${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core - sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h - if [ -f include/grub/gcrypt/g10lib.h ]; then - rm include/grub/gcrypt/g10lib.h -@@ -54,8 +57,8 @@ for extra in contrib/*/Makefile.core.def; do - fi - done - --python gentpl.py $UTIL_DEFS > Makefile.util.am --python gentpl.py $CORE_DEFS > grub-core/Makefile.core.am -+${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am -+${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am - - for extra in contrib/*/Makefile.common; do - if test -e "$extra"; then --- -2.4.3 - diff --git a/0360-hfsplus-Fix-potential-access-to-uninited-memory-on-i.patch b/0360-hfsplus-Fix-potential-access-to-uninited-memory-on-i.patch deleted file mode 100644 index e31cca2..0000000 --- a/0360-hfsplus-Fix-potential-access-to-uninited-memory-on-i.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 5fe21c996893b9ef4d22a728b40f75d4b4cd7566 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 6 Mar 2015 22:33:20 +0100 -Subject: [PATCH 360/506] hfsplus: Fix potential access to uninited memory on - invalid FS - ---- - grub-core/fs/hfsplus.c | 6 ++++++ - include/grub/hfsplus.h | 14 +++++++++----- - 2 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 8f07f85..110d858 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -336,6 +336,9 @@ grub_hfsplus_mount (grub_disk_t disk) - data->case_sensitive = ((magic == GRUB_HFSPLUSX_MAGIC) && - (header.key_compare == GRUB_HFSPLUSX_BINARYCOMPARE)); - -+ if (data->catalog_tree.nodesize < 2) -+ goto fail; -+ - if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0, - sizeof (struct grub_hfsplus_btnode), - sizeof (header), (char *) &header) <= 0) -@@ -350,6 +353,9 @@ grub_hfsplus_mount (grub_disk_t disk) - data->extoverflow_tree.root = grub_be_to_cpu32 (header.root); - data->extoverflow_tree.nodesize = grub_be_to_cpu16 (header.nodesize); - -+ if (data->extoverflow_tree.nodesize < 2) -+ goto fail; -+ - if (grub_hfsplus_read_file (&data->attr_tree.file, 0, 0, - sizeof (struct grub_hfsplus_btnode), - sizeof (header), (char *) &header) <= 0) -diff --git a/include/grub/hfsplus.h b/include/grub/hfsplus.h -index 8ba8f32..117740a 100644 ---- a/include/grub/hfsplus.h -+++ b/include/grub/hfsplus.h -@@ -171,7 +171,7 @@ struct grub_hfsplus_catkey - grub_uint16_t keylen; - grub_uint32_t parent; - grub_uint16_t namelen; -- grub_uint16_t name[30]; -+ grub_uint16_t name[0]; - } GRUB_PACKED; - - /* The on disk layout of an extent overflow file key. */ -@@ -207,12 +207,14 @@ struct grub_hfsplus_btnode - - /* Return the offset of the record with the index INDEX, in the node - NODE which is part of the B+ tree BTREE. */ --static inline grub_off_t -+static inline grub_uint16_t - grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, -- struct grub_hfsplus_btnode *node, int index) -+ struct grub_hfsplus_btnode *node, unsigned index) - { - char *cnode = (char *) node; - void *recptr; -+ if (btree->nodesize < index * sizeof (grub_uint16_t) + 2) -+ index = 0; - recptr = (&cnode[btree->nodesize - index * sizeof (grub_uint16_t) - 2]); - return grub_be_to_cpu16 (grub_get_unaligned16 (recptr)); - } -@@ -221,11 +223,13 @@ grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, - NODE which is part of the B+ tree BTREE. */ - static inline struct grub_hfsplus_key * - grub_hfsplus_btree_recptr (struct grub_hfsplus_btree *btree, -- struct grub_hfsplus_btnode *node, int index) -+ struct grub_hfsplus_btnode *node, unsigned index) - { - char *cnode = (char *) node; -- grub_off_t offset; -+ grub_uint16_t offset; - offset = grub_hfsplus_btree_recoffset (btree, node, index); -+ if (offset > btree->nodesize - sizeof (struct grub_hfsplus_key)) -+ offset = 0; - return (struct grub_hfsplus_key *) &cnode[offset]; - } - --- -2.4.3 - diff --git a/0361-grub-fs-tester-better-estimation-of-filesystem-time-.patch b/0361-grub-fs-tester-better-estimation-of-filesystem-time-.patch deleted file mode 100644 index fd70feb..0000000 --- a/0361-grub-fs-tester-better-estimation-of-filesystem-time-.patch +++ /dev/null @@ -1,54 +0,0 @@ -From fa07d919d1ff868b18d8a42276d094b63a58e299 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 15 Mar 2015 21:06:26 +0300 -Subject: [PATCH 361/506] grub-fs-tester: better estimation of filesystem time - for LVM/RAID - -Write activity with LVM/RAID can happen after filesystem is unmounted. -In my testing modification time of loop files was 15 - 20 seconds -after unmount. So use time as close to unmount as possible as -reference instead. ---- - tests/util/grub-fs-tester.in | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in -index 9ecbe0f..4f7f920 100644 ---- a/tests/util/grub-fs-tester.in -+++ b/tests/util/grub-fs-tester.in -@@ -993,6 +993,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - fi - sleep 1; - done -+ UMOUNT_TIME=$(date -u "+%Y-%m-%d %H:%M:%S") - sleep 1 - vgchange -a n grub_test - ;; -@@ -1004,6 +1005,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - fi - sleep 1; - done -+ UMOUNT_TIME=$(date -u "+%Y-%m-%d %H:%M:%S") - sleep 1 - mdadm --stop /dev/md/"${fs}_$NDEVICES" - ;; -@@ -1214,10 +1216,15 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - case x$fs in - xiso9660 | xziso9660 | xrockridge | xjoliet | xrockridge_joliet | xiso9660_1999 | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) - FSTIME="$(date -d "$(echo ${FSUUID} | awk -F - '{ print $1"-"$2"-"$3" "$4":"$5":"$6 ;}')" '+%Y-%m-%d %H:%M:%S')";; -+ xlvm*|xmdraid*) -+ # With some abstractions like mdraid flushing to disk -+ # may be delayed for a long time. -+ FSTIME="$UMOUNT_TIME";; - *) - FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGES[0]}"|awk '{print $6; }'|sed 's,_, ,g')";; - esac -- # With some abstractions like mdraid it may take up to 2 seconds for the data to reach the disks after it was flushed by FS in these tests. -+ # With some abstractions like mdraid computing of UMOUNT_TIME -+ # is not precise. Account for small difference here. - FSTIMEM1="$(date -d "$FSTIME UTC -1 second" -u "+%Y-%m-%d %H:%M:%S")" - FSTIMEM2="$(date -d "$FSTIME UTC -2 second" -u "+%Y-%m-%d %H:%M:%S")" - --- -2.4.3 - diff --git a/0362-grub-fs-tester-explicitly-set-segment-type-for-LVM-m.patch b/0362-grub-fs-tester-explicitly-set-segment-type-for-LVM-m.patch deleted file mode 100644 index 8a034ea..0000000 --- a/0362-grub-fs-tester-explicitly-set-segment-type-for-LVM-m.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7c9309e50a124817e67de38b30c6291acecad560 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 16 Mar 2015 21:16:19 +0300 -Subject: [PATCH 362/506] grub-fs-tester: explicitly set segment type for LVM - mirror - -LVM mirror defaults to RAID1 today and can be different on different -systems as set in lvm.conf. ---- - tests/util/grub-fs-tester.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in -index 4f7f920..f63ed0b 100644 ---- a/tests/util/grub-fs-tester.in -+++ b/tests/util/grub-fs-tester.in -@@ -729,9 +729,9 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - elif [ x$fs = xlvm_stripe ] ; then - lvcreate -l "$((NDEVICES*7*LVMBLKMUL))" -i "$NDEVICES" -n testvol grub_test - elif [ x$fs = xlvm_mirror1 ] ; then -- lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" -n testvol grub_test -+ lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" --type mirror -n testvol grub_test - elif [ x$fs = xlvm_mirrorall ] ; then -- lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL))" -n testvol grub_test -+ lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL))" --type mirror -n testvol grub_test - elif [ x$fs = xlvm_raid4 ] || [ x$fs = xlvm_raid5 ]; then - lvcreate -l "$(((NDEVICES-1) * 5*LVMBLKMUL))" -i "$((NDEVICES-1))" --type "${fs/lvm_/}" -n testvol grub_test - elif [ x$fs = xlvm_raid6 ]; then --- -2.4.3 - diff --git a/0363-core-add-LVM-RAID1-support.patch b/0363-core-add-LVM-RAID1-support.patch deleted file mode 100644 index d2b2310..0000000 --- a/0363-core-add-LVM-RAID1-support.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 527eeeeee6c8d3d8e3bb1fac408d47bb1dcbec95 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 19 Mar 2015 21:30:27 +0300 -Subject: [PATCH 363/506] core: add LVM RAID1 support - -Closes 44534. ---- - grub-core/disk/lvm.c | 24 +++++++++++++++--------- - 1 file changed, 15 insertions(+), 9 deletions(-) - -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 1e7f197..9b97004 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -577,13 +577,17 @@ grub_lvm_detect (grub_disk_t disk, - if (is_pvmove) - seg->node_count = 1; - } -- else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) -- == 0 && (p[sizeof ("raid") - 1] >= '4' -- && p[sizeof ("raid") - 1] <= '6') -+ else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) == 0 -+ && ((p[sizeof ("raid") - 1] >= '4' -+ && p[sizeof ("raid") - 1] <= '6') -+ || p[sizeof ("raid") - 1] == '1') - && p[sizeof ("raidX") - 1] == '"') - { - switch (p[sizeof ("raid") - 1]) - { -+ case '1': -+ seg->type = GRUB_DISKFILTER_MIRROR; -+ break; - case '4': - seg->type = GRUB_DISKFILTER_RAID4; - seg->layout = GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC; -@@ -608,16 +612,18 @@ grub_lvm_detect (grub_disk_t disk, - goto lvs_segment_fail; - } - -- seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); -- if (p == NULL) -+ if (seg->type != GRUB_DISKFILTER_MIRROR) - { -+ seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); -+ if (p == NULL) -+ { - #ifdef GRUB_UTIL -- grub_util_info ("unknown stripe_size\n"); -+ grub_util_info ("unknown stripe_size\n"); - #endif -- goto lvs_segment_fail; -+ goto lvs_segment_fail; -+ } - } - -- - seg->nodes = grub_zalloc (sizeof (seg->nodes[0]) - * seg->node_count); - -@@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown mirrors\n"); -+ grub_util_info ("unknown raids\n"); - #endif - goto lvs_segment_fail2; - } --- -2.4.3 - diff --git a/0364-grub-fs-tester-add-LVM-RAID1-support.patch b/0364-grub-fs-tester-add-LVM-RAID1-support.patch deleted file mode 100644 index e663713..0000000 --- a/0364-grub-fs-tester-add-LVM-RAID1-support.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 19c4156d1694e3ab82e412d280d1d6677b711d2c Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 19 Mar 2015 21:31:26 +0300 -Subject: [PATCH 364/506] grub-fs-tester: add LVM RAID1 support - -LVM miscalculates bitmap size with small extent, so start with 16K as -for other RAID types. - -Until version 2.02.103 LVM counts metadata segments twice when checking -available space, reduce segment count by one to account for this bug. ---- - tests/util/grub-fs-tester.in | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in -index f63ed0b..e9e85c2 100644 ---- a/tests/util/grub-fs-tester.in -+++ b/tests/util/grub-fs-tester.in -@@ -102,7 +102,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - # OS LIMITATION: Linux oopses with >=32768K - MAXBLKSIZE=$((16384*1024)) - ;; -- x"lvm_raid4" | x"lvm_raid5" | x"lvm_raid6") -+ x"lvm_raid1"* | x"lvm_raid4" | x"lvm_raid5" | x"lvm_raid6") - # OS LIMITATION: Linux crashes with less than 16384 - MINBLKSIZE=16384 - # Could go further but what's the point? -@@ -166,7 +166,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - x"zfs_raidz" | x"zfs_stripe" | x"zfs_mirror" | xbtrfs_raid0 \ - | xbtrfs_raid1 | x"mdraid"*"_raid4" | x"mdraid"*"_raid5" \ - | x"mdraid"*"_linear" \ -- | x"mdraid"*"_raid10" | xlvm_mirror1 | xlvm_mirrorall) -+ | x"mdraid"*"_raid10" | xlvm_raid1* | xlvm_mirror1 | xlvm_mirrorall) - MINDEVICES=2 - MAXDEVICES=7 - ;; -@@ -199,7 +199,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - - case x$fs in - # RAID 1 has to work with even one device of the set. -- xzfs_mirror | x"mdraid"*"_raid1" | xlvm_mirrorall) -+ xzfs_mirror | x"mdraid"*"_raid1" | xlvm_mirrorall | xlvm_raid1all) - NEED_IMAGES_N=1;; - # Degrade raidz by removing 3 devices - xzfs_raidz3) -@@ -210,7 +210,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - # Degrade raidz and btrfs RAID1 by removing one device - xbtrfs_raid1 | xbtrfs_raid10 | xzfs_raidz | x"mdraid"*"_raid4" \ - | x"mdraid"*"_raid5" | x"mdraid"*"_raid10" | xlvm_mirror1 \ -- | x"lvm_raid4" | x"lvm_raid5") -+ | x"lvm_raid1" | x"lvm_raid4" | x"lvm_raid5") - NEED_IMAGES_N=$((NDEVICES-1));; - *) - NEED_IMAGES_N=$NDEVICES;; -@@ -728,10 +728,15 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - lvcreate -l "$((NDEVICES*7*LVMBLKMUL))" -n testvol grub_test - elif [ x$fs = xlvm_stripe ] ; then - lvcreate -l "$((NDEVICES*7*LVMBLKMUL))" -i "$NDEVICES" -n testvol grub_test -- elif [ x$fs = xlvm_mirror1 ] ; then -- lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" --type mirror -n testvol grub_test -+ elif [ x$fs = xlvm_mirror1 ] || [ x$fs = xlvm_raid1 ] ; then -+ lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" --type "${fs/lvm_/}" -n testvol grub_test - elif [ x$fs = xlvm_mirrorall ] ; then - lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL))" --type mirror -n testvol grub_test -+ elif [ x$fs = xlvm_raid1all ] ; then -+ # Until version 2.02.103 LVM counts metadata segments -+ # twice when checking available space. Reduce segment -+ # count to work around it. -+ lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL - 1))" --type raid1 -n testvol grub_test - elif [ x$fs = xlvm_raid4 ] || [ x$fs = xlvm_raid5 ]; then - lvcreate -l "$(((NDEVICES-1) * 5*LVMBLKMUL))" -i "$((NDEVICES-1))" --type "${fs/lvm_/}" -n testvol grub_test - elif [ x$fs = xlvm_raid6 ]; then --- -2.4.3 - diff --git a/0365-cacheinfo-Add-missing-license-information.patch b/0365-cacheinfo-Add-missing-license-information.patch deleted file mode 100644 index 899d0ef..0000000 --- a/0365-cacheinfo-Add-missing-license-information.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 9c07daaf917ddbcb738233aa1d3a209b179f3444 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 11:13:58 +0100 -Subject: [PATCH 365/506] cacheinfo: Add missing license information. - ---- - grub-core/commands/cacheinfo.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/commands/cacheinfo.c b/grub-core/commands/cacheinfo.c -index ead6ff8..d34a346 100644 ---- a/grub-core/commands/cacheinfo.c -+++ b/grub-core/commands/cacheinfo.c -@@ -23,6 +23,8 @@ - #include - #include - -+GRUB_MOD_LICENSE ("GPLv3+"); -+ - static grub_err_t - grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)), - int argc __attribute__ ((unused)), --- -2.4.3 - diff --git a/0366-grub-mkrescue-pass-all-unrecognized-options-unchange.patch b/0366-grub-mkrescue-pass-all-unrecognized-options-unchange.patch deleted file mode 100644 index 3c38ca0..0000000 --- a/0366-grub-mkrescue-pass-all-unrecognized-options-unchange.patch +++ /dev/null @@ -1,154 +0,0 @@ -From cf47a2fba5852014bc59959c5e357e8313933414 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 12:55:27 +0100 -Subject: [PATCH 366/506] grub-mkrescue: pass all unrecognized options - unchanged to xorriso. - ---- - util/grub-mkrescue.c | 103 ++++++++++++++++++++++++++++++++++++++++++++------- - 1 file changed, 89 insertions(+), 14 deletions(-) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index e02340f..5d3ec0d 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -44,9 +44,6 @@ static char *label_color; - static char *label_bgcolor; - static char *product_name; - static char *product_version; --static int xorriso_tail_argc; --static int xorriso_tail_arg_alloc; --static char **xorriso_tail_argv; - static char *output_image; - static char *xorriso; - static char *boot_grub; -@@ -215,16 +212,6 @@ argp_parser (int key, char *arg, struct argp_state *state) - xorriso = xstrdup (arg); - return 0; - -- case ARGP_KEY_ARG: -- if (xorriso_tail_arg_alloc <= xorriso_tail_argc) -- { -- xorriso_tail_arg_alloc = 2 * (4 + xorriso_tail_argc); -- xorriso_tail_argv = xrealloc (xorriso_tail_argv, -- sizeof (xorriso_tail_argv[0]) -- * xorriso_tail_arg_alloc); -- } -- xorriso_tail_argv[xorriso_tail_argc++] = xstrdup (arg); -- return 0; - default: - return ARGP_ERR_UNKNOWN; - } -@@ -374,12 +361,70 @@ make_image_fwdisk (enum grub_install_plat plat, - free (out); - } - -+static int -+option_is_end (const struct argp_option *opt) -+{ -+ return !opt->key && !opt->name && !opt->doc && !opt->group; -+} -+ -+ -+static int -+args_to_eat (const char *arg) -+{ -+ int j; -+ -+ if (arg[0] != '-') -+ return 0; -+ -+ if (arg[1] == '-') -+ { -+ for (j = 0; !option_is_end(&options[j]); j++) -+ { -+ size_t len = strlen (options[j].name); -+ if (strncmp (arg + 2, options[j].name, len) == 0) -+ { -+ if (arg[2 + len] == '=') -+ return 1; -+ if (arg[2 + len] == '\0' && options[j].arg) -+ return 2; -+ if (arg[2 + len] == '\0') -+ return 1; -+ } -+ } -+ if (strcmp (arg, "--help") == 0) -+ return 1; -+ if (strcmp (arg, "--usage") == 0) -+ return 1; -+ if (strcmp (arg, "--version") == 0) -+ return 1; -+ return 0; -+ } -+ if (arg[2] && arg[3]) -+ return 0; -+ for (j = 0; !option_is_end(&options[j]); j++) -+ { -+ if (options[j].key > 0 && options[j].key < 128 && arg[1] == options[j].key) -+ { -+ if (options[j].arg) -+ return 2; -+ return 1; -+ } -+ if (arg[1] == '?' || arg[1] == 'V') -+ return 1; -+ } -+ return 0; -+} -+ - int - main (int argc, char *argv[]) - { - char *romdir; - char *sysarea_img = NULL; - const char *pkgdatadir; -+ int argp_argc; -+ char **argp_argv; -+ int xorriso_tail_argc; -+ char **xorriso_tail_argv; - - grub_util_host_init (&argc, &argv); - grub_util_disable_fd_syncs (); -@@ -391,7 +436,37 @@ main (int argc, char *argv[]) - xorriso = xstrdup ("xorriso"); - label_font = grub_util_path_concat (2, pkgdatadir, "unicode.pf2"); - -- argp_parse (&argp, argc, argv, 0, 0, 0); -+ argp_argv = xmalloc (sizeof (argp_argv[0]) * argc); -+ xorriso_tail_argv = xmalloc (sizeof (argp_argv[0]) * argc); -+ -+ xorriso_tail_argc = 0; -+ /* Program name */ -+ argp_argv[0] = argv[0]; -+ argp_argc = 1; -+ -+ /* argp doesn't allow us to catch unknwon arguments, -+ so catch them before passing to argp -+ */ -+ { -+ int i; -+ for (i = 1; i < argc; i++) -+ { -+ switch (args_to_eat (argv[i])) -+ { -+ case 2: -+ argp_argv[argp_argc++] = argv[i++]; -+ /* Fallthrough */ -+ case 1: -+ argp_argv[argp_argc++] = argv[i]; -+ break; -+ case 0: -+ xorriso_tail_argv[xorriso_tail_argc++] = argv[i]; -+ break; -+ } -+ } -+ } -+ -+ argp_parse (&argp, argp_argc, argp_argv, 0, 0, 0); - - if (!output_image) - grub_util_error ("%s", _("output file must be specified")); --- -2.4.3 - diff --git a/0367-fddboot_test-Add-no-pad-to-xorriso.patch b/0367-fddboot_test-Add-no-pad-to-xorriso.patch deleted file mode 100644 index fe63a58..0000000 --- a/0367-fddboot_test-Add-no-pad-to-xorriso.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 237510486af6e2d73fa57075f72b407d24ad8874 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 12:58:08 +0100 -Subject: [PATCH 367/506] fddboot_test: Add -no-pad to xorriso. - ---- - tests/fddboot_test.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in -index a05eb3e..a59645b 100644 ---- a/tests/fddboot_test.in -+++ b/tests/fddboot_test.in -@@ -46,6 +46,6 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in - exit 0;; - esac - --if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes=")" != "Hello World" ]; then -+if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad")" != "Hello World" ]; then - exit 1 - fi --- -2.4.3 - diff --git a/0368-emunet-Fix-init-error-checking.patch b/0368-emunet-Fix-init-error-checking.patch deleted file mode 100644 index e8375c6..0000000 --- a/0368-emunet-Fix-init-error-checking.patch +++ /dev/null @@ -1,26 +0,0 @@ -From fe6695b7d6cd8beae55981b5efbd21f592a0afc0 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 12:59:00 +0100 -Subject: [PATCH 368/506] emunet: Fix init error checking. - -Otherwise emunet doesn't expose any cards. ---- - grub-core/net/drivers/emu/emunet.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c -index 7c977cd..b194920 100644 ---- a/grub-core/net/drivers/emu/emunet.c -+++ b/grub-core/net/drivers/emu/emunet.c -@@ -98,7 +98,7 @@ static int registered = 0; - - GRUB_MOD_INIT(emunet) - { -- if (grub_emunet_create (&emucard.mtu)) -+ if (!grub_emunet_create (&emucard.mtu)) - { - grub_net_card_register (&emucard); - registered = 1; --- -2.4.3 - diff --git a/0369-compiler-rt-emu-Add-missing-file.patch b/0369-compiler-rt-emu-Add-missing-file.patch deleted file mode 100644 index 524324e..0000000 --- a/0369-compiler-rt-emu-Add-missing-file.patch +++ /dev/null @@ -1,254 +0,0 @@ -From e9f68f1f4cc1a07d94d200f1e7bdcfb1c4d7e40d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 13:00:53 +0100 -Subject: [PATCH 369/506] compiler-rt-emu: Add missing file. - ---- - include/grub/compiler-rt-emu.h | 235 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 235 insertions(+) - create mode 100644 include/grub/compiler-rt-emu.h - -diff --git a/include/grub/compiler-rt-emu.h b/include/grub/compiler-rt-emu.h -new file mode 100644 -index 0000000..edc8299 ---- /dev/null -+++ b/include/grub/compiler-rt-emu.h -@@ -0,0 +1,235 @@ -+/* compiler-rt-emu.h - prototypes for compiler helpers. */ -+/* -+ * 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_RT_HEADER -+#define GRUB_COMPILER_RT_HEADER 1 -+ -+#include -+#include -+#include -+ -+#ifdef HAVE___UDIVSI3 -+grub_uint32_t -+EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); -+#endif -+ -+#ifdef HAVE___UMODSI3 -+grub_uint32_t -+EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); -+#endif -+ -+#ifdef HAVE___DIVSI3 -+grub_int32_t -+EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); -+#endif -+ -+#ifdef HAVE___MODSI3 -+grub_int32_t -+EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); -+#endif -+ -+#ifdef HAVE___DIVDI3 -+grub_int64_t -+EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); -+#endif -+ -+#ifdef HAVE___MODDI3 -+grub_int64_t -+EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); -+#endif -+ -+#ifdef HAVE___UDIVDI3 -+grub_uint64_t -+EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+#ifdef HAVE___UMODDI3 -+grub_uint64_t -+EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+#ifdef HAVE___CTZDI2 -+unsigned -+EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); -+#endif -+ -+#ifdef HAVE___CTZSI2 -+unsigned -+EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); -+#endif -+ -+#ifdef HAVE___AEABI_UIDIV -+grub_uint32_t -+EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); -+#endif -+ -+#ifdef HAVE___AEABI_UIDIVMOD -+grub_uint32_t -+EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); -+#endif -+ -+#ifdef HAVE___AEABI_IDIV -+grub_int32_t -+EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); -+#endif -+ -+#ifdef HAVE___AEABI_IDIVMOD -+grub_int32_t -+EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); -+#endif -+ -+#ifdef HAVE___AEABI_ULCMP -+int -+EXPORT_FUNC (__aeabi_ulcmp) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+/* Needed for allowing modules to be compiled as thumb. */ -+#ifdef HAVE___MULDI3 -+grub_uint64_t -+EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+#ifdef HAVE___AEABI_LMUL -+grub_uint64_t -+EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+#ifdef HAVE___AEABI_MEMCPY -+void * -+EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); -+#endif -+ -+#ifdef HAVE___AEABI_MEMSET -+void * -+EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); -+#endif -+ -+#ifdef HAVE___AEABI_LASR -+grub_uint64_t -+EXPORT_FUNC (__aeabi_lasr) (grub_uint64_t u, int b); -+#endif -+ -+#ifdef HAVE___AEABI_LLSL -+grub_uint64_t -+EXPORT_FUNC (__aeabi_llsl) (grub_uint64_t u, int b); -+#endif -+ -+#ifdef HAVE___AEABI_LLSR -+grub_uint64_t -+EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b); -+#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 -+ -+#ifdef HAVE___UCMPDI2 -+int -+EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b); -+#endif -+ -+#ifdef HAVE___ASHLDI3 -+grub_uint64_t -+EXPORT_FUNC(__ashldi3) (grub_uint64_t u, int b); -+#endif -+ -+#ifdef HAVE___ASHRDI3 -+grub_uint64_t -+EXPORT_FUNC(__ashrdi3) (grub_uint64_t u, int b); -+#endif -+ -+#ifdef HAVE___LSHRDI3 -+grub_uint64_t -+EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b); -+#endif -+ -+#ifdef HAVE___BSWAPSI2 -+grub_uint32_t -+EXPORT_FUNC(__bswapsi2) (grub_uint32_t u); -+#endif -+ -+#ifdef HAVE___BSWAPDI2 -+grub_uint64_t -+EXPORT_FUNC(__bswapdi2) (grub_uint64_t u); -+#endif -+ -+int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); -+void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); -+void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); -+void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); -+ -+#ifdef HAVE___BZERO -+void EXPORT_FUNC (__bzero) (void *s, grub_size_t n); -+#endif -+ -+#ifdef HAVE___REGISTER_FRAME_INFO -+void EXPORT_FUNC (__register_frame_info) (void); -+#endif -+ -+#ifdef HAVE___DEREGISTER_FRAME_INFO -+void EXPORT_FUNC (__deregister_frame_info) (void); -+#endif -+#ifdef HAVE____CHKSTK_MS -+void EXPORT_FUNC (___chkstk_ms) (void); -+#endif -+ -+#ifdef HAVE___CHKSTK_MS -+void EXPORT_FUNC (__chkstk_ms) (void); -+#endif -+ -+#endif -+ --- -2.4.3 - diff --git a/0370-hostfs-Drop-unnecessary-feature-test-macros.patch b/0370-hostfs-Drop-unnecessary-feature-test-macros.patch deleted file mode 100644 index 4d46617..0000000 --- a/0370-hostfs-Drop-unnecessary-feature-test-macros.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5974d4ba65fc5ad9253857bf992ffd3c635baf2a Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Mon, 23 Mar 2015 14:27:41 +0000 -Subject: [PATCH 370/506] hostfs: Drop unnecessary feature test macros - -_BSD_SOURCE was added to allow the use of DT_DIR, but that was removed -in e768b77068a0b030a07576852bd0f121c9a077eb. While adding -_DEFAULT_SOURCE as well works around problems with current glibc, -neither is in fact needed nowadays. ---- - grub-core/kern/emu/hostfs.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c -index 823116d..7b28c00 100644 ---- a/grub-core/kern/emu/hostfs.c -+++ b/grub-core/kern/emu/hostfs.c -@@ -19,11 +19,6 @@ - - #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.4.3 - diff --git a/0371-arp-icmp-Fix-handling-in-case-of-oversized-or-invali.patch b/0371-arp-icmp-Fix-handling-in-case-of-oversized-or-invali.patch deleted file mode 100644 index 07b8613..0000000 --- a/0371-arp-icmp-Fix-handling-in-case-of-oversized-or-invali.patch +++ /dev/null @@ -1,314 +0,0 @@ -From 63034d32612dd34f577605dfa8b417ee9144d8cb Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 21:14:23 +0100 -Subject: [PATCH 371/506] arp, icmp: Fix handling in case of oversized or - invalid packets. - -This restrict ARP handling to MAC and IP addresses but in practice we need -only this case anyway and other cases are very rar if exist at all. It makes -code much simpler and less error-prone. ---- - grub-core/net/arp.c | 145 +++++++++++++++++++++------------------------ - grub-core/net/icmp.c | 14 +---- - grub-core/net/netbuff.c | 20 +++++++ - include/grub/net/netbuff.h | 1 + - 4 files changed, 92 insertions(+), 88 deletions(-) - -diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 8cc390b..46a56e0 100644 ---- a/grub-core/net/arp.c -+++ b/grub-core/net/arp.c -@@ -37,12 +37,16 @@ enum - GRUB_NET_ARPHRD_ETHERNET = 1 - }; - --struct arphdr { -+struct arppkt { - grub_uint16_t hrd; - grub_uint16_t pro; - grub_uint8_t hln; - grub_uint8_t pln; - grub_uint16_t op; -+ grub_uint8_t sender_mac[6]; -+ grub_uint32_t sender_ip; -+ grub_uint8_t recv_mac[6]; -+ grub_uint32_t recv_ip; - } GRUB_PACKED; - - static int have_pending; -@@ -53,21 +57,14 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - const grub_net_network_level_address_t *proto_addr) - { - struct grub_net_buff nb; -- struct arphdr *arp_header; -- grub_net_link_level_address_t target_hw_addr; -- grub_uint8_t *aux, arp_data[128]; -+ struct arppkt *arp_packet; -+ grub_net_link_level_address_t target_mac_addr; - grub_err_t err; - int i; -- grub_size_t addrlen; -- grub_uint16_t etherpro; - grub_uint8_t *nbd; -+ grub_uint8_t arp_data[128]; - -- if (proto_addr->type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4) -- { -- addrlen = 4; -- etherpro = GRUB_NET_ETHERTYPE_IP; -- } -- else -+ if (proto_addr->type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4) - return grub_error (GRUB_ERR_BUG, "unsupported address family"); - - /* Build a request packet. */ -@@ -76,34 +73,26 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - grub_netbuff_clear (&nb); - grub_netbuff_reserve (&nb, 128); - -- err = grub_netbuff_push (&nb, sizeof (*arp_header) + 2 * (6 + addrlen)); -+ err = grub_netbuff_push (&nb, sizeof (*arp_packet)); - if (err) - return err; - -- arp_header = (struct arphdr *) nb.data; -- arp_header->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); -- arp_header->hln = 6; -- arp_header->pro = grub_cpu_to_be16 (etherpro); -- arp_header->pln = addrlen; -- arp_header->op = grub_cpu_to_be16_compile_time (ARP_REQUEST); -- aux = (grub_uint8_t *) arp_header + sizeof (*arp_header); -+ arp_packet = (struct arppkt *) nb.data; -+ arp_packet->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); -+ arp_packet->hln = 6; -+ arp_packet->pro = grub_cpu_to_be16 (GRUB_NET_ETHERTYPE_IP); -+ arp_packet->pln = 4; -+ arp_packet->op = grub_cpu_to_be16_compile_time (ARP_REQUEST); - /* Sender hardware address. */ -- grub_memcpy (aux, &inf->hwaddress.mac, 6); -- -- aux += 6; -- /* Sender protocol address */ -- grub_memcpy (aux, &inf->address.ipv4, 4); -- aux += addrlen; -- /* Target hardware address */ -- for (i = 0; i < 6; i++) -- aux[i] = 0x00; -- aux += 6; -+ grub_memcpy (arp_packet->sender_mac, &inf->hwaddress.mac, 6); -+ arp_packet->sender_ip = inf->address.ipv4; -+ grub_memset (arp_packet->recv_mac, 0, 6); -+ arp_packet->recv_ip = proto_addr->ipv4; - /* Target protocol address */ -- grub_memcpy (aux, &proto_addr->ipv4, 4); -- grub_memset (&target_hw_addr.mac, 0xff, 6); -+ grub_memset (&target_mac_addr.mac, 0xff, 6); - - nbd = nb.data; -- send_ethernet_packet (inf, &nb, target_hw_addr, GRUB_NET_ETHERTYPE_ARP); -+ send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); - for (i = 0; i < GRUB_NET_TRIES; i++) - { - if (grub_net_link_layer_resolve_check (inf, proto_addr)) -@@ -115,7 +104,7 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - if (grub_net_link_layer_resolve_check (inf, proto_addr)) - return GRUB_ERR_NONE; - nb.data = nbd; -- send_ethernet_packet (inf, &nb, target_hw_addr, GRUB_NET_ETHERTYPE_ARP); -+ send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); - } - - return GRUB_ERR_NONE; -@@ -125,63 +114,67 @@ grub_err_t - grub_net_arp_receive (struct grub_net_buff *nb, - struct grub_net_card *card) - { -- struct arphdr *arp_header = (struct arphdr *) nb->data; -- grub_uint8_t *sender_hardware_address; -- grub_uint8_t *target_hardware_address; -+ struct arppkt *arp_packet = (struct arppkt *) nb->data; - grub_net_network_level_address_t sender_addr, target_addr; -- grub_net_link_level_address_t sender_hw_addr; -+ grub_net_link_level_address_t sender_mac_addr; - struct grub_net_network_level_interface *inf; -- grub_uint8_t *sender_protocol_address, *target_protocol_address; -- -- sender_hardware_address = -- (grub_uint8_t *) arp_header + sizeof (*arp_header); -- sender_protocol_address = sender_hardware_address + arp_header->hln; -- target_hardware_address = sender_protocol_address + arp_header->pln; -- target_protocol_address = target_hardware_address + arp_header->hln; -- if (grub_be_to_cpu16 (arp_header->pro) == GRUB_NET_ETHERTYPE_IP -- && arp_header->pln == 4) -- { -- sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -- grub_memcpy (&sender_addr.ipv4, sender_protocol_address, 4); -- grub_memcpy (&target_addr.ipv4, target_protocol_address, 4); -- if (grub_memcmp (sender_protocol_address, &pending_req, 4) == 0) -- have_pending = 1; -- } -- else -+ -+ if (arp_packet->pro != grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP) -+ || arp_packet->pln != 4 || arp_packet->hln != 6 -+ || nb->tail - nb->data < (int) sizeof (*arp_packet)) - return GRUB_ERR_NONE; - -- sender_hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; -- grub_memcpy (sender_hw_addr.mac, sender_hardware_address, -- sizeof (sender_hw_addr.mac)); -- grub_net_link_layer_add_address (card, &sender_addr, &sender_hw_addr, 1); -+ sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -+ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -+ sender_addr.ipv4 = arp_packet->sender_ip; -+ target_addr.ipv4 = arp_packet->recv_ip; -+ if (arp_packet->sender_ip == pending_req) -+ have_pending = 1; -+ -+ sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; -+ grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac, -+ sizeof (sender_mac_addr.mac)); -+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); - - FOR_NET_NETWORK_LEVEL_INTERFACES (inf) - { - /* 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) -+ && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) - { - grub_net_link_level_address_t target; -- /* We've already checked that pln is either 4 or 16. */ -- char tmp[16]; -- grub_size_t pln = arp_header->pln; -- -- if (pln > 16) -- pln = 16; -+ struct grub_net_buff nb_reply; -+ struct arppkt *arp_reply; -+ grub_uint8_t arp_data[128]; -+ grub_err_t err; -+ -+ nb_reply.head = arp_data; -+ nb_reply.end = arp_data + sizeof (arp_data); -+ grub_netbuff_clear (&nb_reply); -+ grub_netbuff_reserve (&nb_reply, 128); -+ -+ err = grub_netbuff_push (&nb_reply, sizeof (*arp_packet)); -+ if (err) -+ return err; -+ -+ arp_reply = (struct arppkt *) nb_reply.data; -+ -+ arp_reply->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); -+ arp_reply->pro = grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP); -+ arp_reply->pln = 4; -+ arp_reply->hln = 6; -+ arp_reply->op = grub_cpu_to_be16_compile_time (ARP_REPLY); -+ arp_reply->sender_ip = arp_packet->recv_ip; -+ arp_reply->recv_ip = arp_packet->sender_ip; -+ arp_reply->hln = 6; - - target.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; -- grub_memcpy (target.mac, sender_hardware_address, 6); -- grub_memcpy (target_hardware_address, target.mac, 6); -- grub_memcpy (sender_hardware_address, inf->hwaddress.mac, 6); -- -- grub_memcpy (tmp, sender_protocol_address, pln); -- grub_memcpy (sender_protocol_address, target_protocol_address, pln); -- grub_memcpy (target_protocol_address, tmp, pln); -+ grub_memcpy (target.mac, arp_packet->sender_mac, 6); -+ grub_memcpy (arp_reply->sender_mac, inf->hwaddress.mac, 6); -+ grub_memcpy (arp_reply->recv_mac, arp_packet->sender_mac, 6); - - /* Change operation to REPLY and send packet */ -- arp_header->op = grub_be_to_cpu16 (ARP_REPLY); -- send_ethernet_packet (inf, nb, target, GRUB_NET_ETHERTYPE_ARP); -+ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); - } - } - return GRUB_ERR_NONE; -diff --git a/grub-core/net/icmp.c b/grub-core/net/icmp.c -index 28d825b..b1eef11 100644 ---- a/grub-core/net/icmp.c -+++ b/grub-core/net/icmp.c -@@ -85,22 +85,13 @@ grub_net_recv_icmp_packet (struct grub_net_buff *nb, - struct icmp_header *icmphr; - if (icmph->code) - break; -- nb_reply = grub_netbuff_alloc (nb->tail - nb->data + 512); -+ nb_reply = grub_netbuff_make_pkt (nb->tail - nb->data + sizeof (*icmphr)); - if (!nb_reply) - { - grub_netbuff_free (nb); - return grub_errno; - } -- err = grub_netbuff_reserve (nb_reply, nb->tail - nb->data + 512); -- if (err) -- goto ping_fail; -- err = grub_netbuff_push (nb_reply, nb->tail - nb->data); -- if (err) -- goto ping_fail; -- grub_memcpy (nb_reply->data, nb->data, nb->tail - nb->data); -- err = grub_netbuff_push (nb_reply, sizeof (*icmphr)); -- if (err) -- goto ping_fail; -+ grub_memcpy (nb_reply->data + sizeof (*icmphr), nb->data, nb->tail - nb->data); - icmphr = (struct icmp_header *) nb_reply->data; - icmphr->type = ICMP_ECHO_REPLY; - icmphr->code = 0; -@@ -110,7 +101,6 @@ grub_net_recv_icmp_packet (struct grub_net_buff *nb, - err = grub_net_send_ip_packet (inf, src, ll_src, - nb_reply, GRUB_NET_IP_ICMP); - -- ping_fail: - grub_netbuff_free (nb); - grub_netbuff_free (nb_reply); - return err; -diff --git a/grub-core/net/netbuff.c b/grub-core/net/netbuff.c -index e97ecd2..dbeeefe 100644 ---- a/grub-core/net/netbuff.c -+++ b/grub-core/net/netbuff.c -@@ -97,6 +97,26 @@ grub_netbuff_alloc (grub_size_t len) - return nb; - } - -+struct grub_net_buff * -+grub_netbuff_make_pkt (grub_size_t len) -+{ -+ struct grub_net_buff *nb; -+ grub_err_t err; -+ nb = grub_netbuff_alloc (len + 512); -+ if (!nb) -+ return NULL; -+ err = grub_netbuff_reserve (nb, len + 512); -+ if (err) -+ goto fail; -+ err = grub_netbuff_push (nb, len); -+ if (err) -+ goto fail; -+ return nb; -+ fail: -+ grub_netbuff_free (nb); -+ return NULL; -+} -+ - void - grub_netbuff_free (struct grub_net_buff *nb) - { -diff --git a/include/grub/net/netbuff.h b/include/grub/net/netbuff.h -index 9ac168c..1177c12 100644 ---- a/include/grub/net/netbuff.h -+++ b/include/grub/net/netbuff.h -@@ -25,6 +25,7 @@ grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff, grub_size_t len); - grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff, grub_size_t len); - grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff); - struct grub_net_buff * grub_netbuff_alloc (grub_size_t len); -+struct grub_net_buff * grub_netbuff_make_pkt (grub_size_t len); - void grub_netbuff_free (struct grub_net_buff *net_buff); - - #endif --- -2.4.3 - diff --git a/0372-Makefile.core.def-Remove-obsolete-LDADD_KERNEL.patch b/0372-Makefile.core.def-Remove-obsolete-LDADD_KERNEL.patch deleted file mode 100644 index 58dffdf..0000000 --- a/0372-Makefile.core.def-Remove-obsolete-LDADD_KERNEL.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 94222b72b53cc5fc36aa15346ff389f37302aa85 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 21:41:17 +0100 -Subject: [PATCH 372/506] Makefile.core.def: Remove obsolete LDADD_KERNEL - ---- - grub-core/Makefile.core.def | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8eaae45..a6101de 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -83,8 +83,6 @@ kernel = { - x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; - x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; - -- ldadd = '$(LDADD_KERNEL)'; -- - mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; - powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; - sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; --- -2.4.3 - diff --git a/0373-modinfo.sh.in-Add-missing-config-variables.patch b/0373-modinfo.sh.in-Add-missing-config-variables.patch deleted file mode 100644 index 351cd37..0000000 --- a/0373-modinfo.sh.in-Add-missing-config-variables.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c14f8a9366517270c2171757e1b9a13fe0205dd3 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 20 Mar 2015 21:42:48 +0100 -Subject: [PATCH 373/506] modinfo.sh.in: Add missing config variables. - ---- - grub-core/modinfo.sh.in | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in -index 09d22f9..faf0ad3 100644 ---- a/grub-core/modinfo.sh.in -+++ b/grub-core/modinfo.sh.in -@@ -19,11 +19,17 @@ grub_target_cflags='@TARGET_CFLAGS@' - grub_target_cppflags='@TARGET_CPPFLAGS@' - grub_target_ccasflags='@TARGET_CCASFLAGS@' - grub_target_ldflags='@TARGET_LDFLAGS@' -+grub_cflags='@CFLAGS@' -+grub_cppflags='@CPPFLAGS@' -+grub_ccasflags='@CCASFLAGS@' -+grub_ldflags='@LDFLAGS@' - grub_target_strip='@TARGET_STRIP@' - grub_target_nm='@TARGET_NM@' - grub_target_ranlib='@TARGET_RANLIB@' - grub_target_objconf='@TARGET_OBJCONV@' - grub_target_obj2elf='@TARGET_OBJ2ELF@' -+grub_target_img_base_ldopt='@TARGET_IMG_BASE_LDOPT@' -+grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@' - - # Version - grub_version="@VERSION@" --- -2.4.3 - diff --git a/0374-util-mkimage-Use-stable-timestamp-when-generating-bi.patch b/0374-util-mkimage-Use-stable-timestamp-when-generating-bi.patch deleted file mode 100644 index feef876..0000000 --- a/0374-util-mkimage-Use-stable-timestamp-when-generating-bi.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 85a7be2414c4718e96d81a2ebaa70d0d42152e62 Mon Sep 17 00:00:00 2001 -From: Daniel Kahn Gillmor -Date: Fri, 27 Mar 2015 13:26:48 +0100 -Subject: [PATCH 374/506] util/mkimage: Use stable timestamp when generating - binaries. - ---- - util/mkimage.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/util/mkimage.c b/util/mkimage.c -index 7821dc5..52265b5 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -55,6 +55,9 @@ - - #define TARGET_NO_FIELD 0xffffffff - -+/* use 2015-01-01T00:00:00+0000 as a stock timestamp */ -+#define STABLE_EMBEDDING_TIMESTAMP 1420070400 -+ - struct grub_install_image_target_desc - { - const char *dirname; -@@ -1439,7 +1442,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - c->machine = grub_host_to_target16 (image_target->pe_target); - - c->num_sections = grub_host_to_target16 (4); -- c->time = grub_host_to_target32 (time (0)); -+ c->time = grub_host_to_target32 (STABLE_EMBEDDING_TIMESTAMP); - c->characteristics = grub_host_to_target16 (GRUB_PE32_EXECUTABLE_IMAGE - | GRUB_PE32_LINE_NUMS_STRIPPED - | ((image_target->voidp_sizeof == 4) -@@ -1782,7 +1785,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - - memset (hdr, 0, sizeof (*hdr)); - hdr->ih_magic = grub_cpu_to_be32_compile_time (GRUB_UBOOT_IH_MAGIC); -- hdr->ih_time = grub_cpu_to_be32 (time (0)); -+ hdr->ih_time = grub_cpu_to_be32 (STABLE_EMBEDDING_TIMESTAMP); - hdr->ih_size = grub_cpu_to_be32 (core_size); - hdr->ih_load = grub_cpu_to_be32 (image_target->link_addr); - hdr->ih_ep = grub_cpu_to_be32 (image_target->link_addr); --- -2.4.3 - diff --git a/0375-Make-Makefile.util.def-independent-of-platform.patch b/0375-Make-Makefile.util.def-independent-of-platform.patch deleted file mode 100644 index 6cb964f..0000000 --- a/0375-Make-Makefile.util.def-independent-of-platform.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 1f23c87c19b3002231c2939a8d03fa4b67f7bcb6 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 27 Mar 2015 14:04:41 +0100 -Subject: [PATCH 375/506] Make Makefile.util.def independent of platform. - ---- - Makefile.util.def | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/Makefile.util.def b/Makefile.util.def -index 67dfb29..3cb6b21 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -613,7 +613,6 @@ program = { - common = grub-core/disk/host.c; - - common = util/resolve.c; -- enable = noemu; - common = grub-core/kern/emu/argp_common.c; - common = grub-core/osdep/init.c; - --- -2.4.3 - diff --git a/0376-efinet-Check-for-immediate-completition.patch b/0376-efinet-Check-for-immediate-completition.patch deleted file mode 100644 index 425f565..0000000 --- a/0376-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 376/506] 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.4.3 - diff --git a/0377-dl_helper-Cleanup.patch b/0377-dl_helper-Cleanup.patch deleted file mode 100644 index 0a7d260..0000000 --- a/0377-dl_helper-Cleanup.patch +++ /dev/null @@ -1,166 +0,0 @@ -From d47e8ab4b945d1dd50bc7d7ebbbf6f1f255f8f58 Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Fri, 27 Mar 2015 14:37:16 +0100 -Subject: [PATCH 377/506] dl_helper: Cleanup - -Use the new thumb_get_instruction_word/thumb_set_instruction_word -helpers throughout. - -Style cleanup (missing spaces). - -Move Thumb MOVW/MOVT handlers into Thumb relocation section of file. ---- - grub-core/kern/arm/dl_helper.c | 78 ++++++++++++++++++------------------------ - 1 file changed, 34 insertions(+), 44 deletions(-) - -diff --git a/grub-core/kern/arm/dl_helper.c b/grub-core/kern/arm/dl_helper.c -index 8a72632..21d77f7 100644 ---- a/grub-core/kern/arm/dl_helper.c -+++ b/grub-core/kern/arm/dl_helper.c -@@ -26,14 +26,14 @@ - #include - - static inline grub_uint32_t --thumb_get_instruction_word(grub_uint16_t *target) -+thumb_get_instruction_word (grub_uint16_t *target) - { - /* Extract instruction word in alignment-safe manner */ - return grub_le_to_cpu16 ((*target)) << 16 | grub_le_to_cpu16 (*(target + 1)); - } - - static inline void --thumb_set_instruction_word(grub_uint16_t *target, grub_uint32_t insword) -+thumb_set_instruction_word (grub_uint16_t *target, grub_uint32_t insword) - { - *target = grub_cpu_to_le16 (insword >> 16); - *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); -@@ -70,9 +70,7 @@ grub_arm_thm_call_get_offset (grub_uint16_t *target) - grub_uint32_t insword; - grub_int32_t offset; - -- /* Extract instruction word in alignment-safe manner */ -- insword = (grub_le_to_cpu16 (*target) << 16) -- | (grub_le_to_cpu16(*(target + 1))); -+ insword = thumb_get_instruction_word (target); - - /* Extract bitfields from instruction words */ - sign = (insword >> 26) & 1; -@@ -97,9 +95,7 @@ grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset) - grub_uint32_t insword; - int is_blx; - -- /* Extract instruction word in alignment-safe manner */ -- insword = (grub_le_to_cpu16 (*target) << 16) -- | (grub_le_to_cpu16(*(target + 1))); -+ insword = thumb_get_instruction_word (target); - - if (((insword >> 12) & 0xd) == 0xc) - is_blx = 1; -@@ -122,9 +118,7 @@ grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset) - (((offset >> 12) & 0x03ff) << 16) | - (j1 << 13) | (j2 << 11) | ((offset >> 1) & 0x07ff); - -- /* Write instruction word back in alignment-safe manner */ -- *target = grub_cpu_to_le16 ((insword >> 16) & 0xffff); -- *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); -+ thumb_set_instruction_word (target, insword); - - grub_dprintf ("dl", " *insword = 0x%08x", insword); - -@@ -137,9 +131,7 @@ grub_arm_thm_jump19_get_offset (grub_uint16_t *target) - grub_int32_t offset; - grub_uint32_t insword; - -- /* Extract instruction word in alignment-safe manner */ -- insword = (grub_le_to_cpu16 (*target) << 16) -- | (grub_le_to_cpu16(*(target + 1))); -+ insword = thumb_get_instruction_word (target); - - /* Extract and sign extend offset */ - offset = ((insword >> 26) & 1) << 19 -@@ -163,9 +155,7 @@ grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset) - offset >>= 1; - offset &= 0xfffff; - -- /* Extract instruction word in alignment-safe manner */ -- insword = grub_le_to_cpu16 ((*target)) << 16 -- | grub_le_to_cpu16 (*(target + 1)); -+ insword = thumb_get_instruction_word (target); - - /* Reassemble instruction word and write back */ - insword &= insmask; -@@ -174,8 +164,7 @@ grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset) - | ((offset >> 17) & 1) << 13 - | ((offset >> 11) & 0x3f) << 16 - | (offset & 0x7ff); -- *target = grub_cpu_to_le16 (insword >> 16); -- *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); -+ thumb_set_instruction_word (target, insword); - } - - int -@@ -186,6 +175,32 @@ grub_arm_thm_jump19_check_offset (grub_int32_t offset) - return 1; - } - -+grub_uint16_t -+grub_arm_thm_movw_movt_get_value (grub_uint16_t *target) -+{ -+ grub_uint32_t insword; -+ -+ insword = thumb_get_instruction_word (target); -+ -+ return ((insword & 0xf0000) >> 4) | ((insword & 0x04000000) >> 15) | \ -+ ((insword & 0x7000) >> 4) | (insword & 0xff); -+} -+ -+void -+grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value) -+{ -+ grub_uint32_t insword; -+ const grub_uint32_t insmask = 0xfbf08f00; -+ -+ insword = thumb_get_instruction_word (target); -+ insword &= insmask; -+ -+ insword |= ((value & 0xf000) << 4) | ((value & 0x0800) << 15) | \ -+ ((value & 0x0700) << 4) | (value & 0xff); -+ -+ thumb_set_instruction_word (target, insword); -+} -+ - - /*********************************************************** - * ARM (A32) relocations: * -@@ -228,28 +243,3 @@ grub_arm_jump24_set_offset (grub_uint32_t *target, - - *target = grub_cpu_to_le32 (insword); - } -- --grub_uint16_t --grub_arm_thm_movw_movt_get_value (grub_uint16_t *target) --{ -- grub_uint32_t insword; -- -- insword = thumb_get_instruction_word (target); -- -- return ((insword & 0xf0000) >> 4) | ((insword & 0x04000000) >> 15) | \ -- ((insword & 0x7000) >> 4) | (insword & 0xff); --} -- --void --grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value) --{ -- grub_uint32_t insword; -- -- insword = thumb_get_instruction_word (target); -- insword &= 0xfbf08f00; -- -- insword |= ((value & 0xf000) << 4) | ((value & 0x0800) << 15) | \ -- ((value & 0x0700) << 4) | (value & 0xff); -- -- thumb_set_instruction_word (target, insword); --} --- -2.4.3 - diff --git a/0378-Add-missing-initializers-to-silence-suprious-warning.patch b/0378-Add-missing-initializers-to-silence-suprious-warning.patch deleted file mode 100644 index 59c2a87..0000000 --- a/0378-Add-missing-initializers-to-silence-suprious-warning.patch +++ /dev/null @@ -1,67 +0,0 @@ -From ed07b7e1289dd00b9d6dc8ac5dd56130f3376bc9 Mon Sep 17 00:00:00 2001 -From: Michael Zimmermann -Date: Fri, 27 Mar 2015 14:44:41 +0100 -Subject: [PATCH 378/506] Add missing initializers to silence suprious - warnings. - ---- - grub-core/commands/verify.c | 2 +- - grub-core/fs/hfsplus.c | 8 ++++---- - grub-core/normal/main.c | 2 +- - 3 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c -index 6569391..9620a3b 100644 ---- a/grub-core/commands/verify.c -+++ b/grub-core/commands/verify.c -@@ -454,7 +454,7 @@ grub_verify_signature_real (char *buf, grub_size_t size, - grub_err_t err; - grub_size_t i; - gcry_mpi_t mpis[10]; -- grub_uint8_t type; -+ grub_uint8_t type = 0; - - err = read_packet_header (sig, &type, &len); - if (err) -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 110d858..21159e8 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -792,8 +792,8 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, - }; - - struct grub_hfsplus_key_internal intern; -- struct grub_hfsplus_btnode *node; -- grub_disk_addr_t ptr; -+ struct grub_hfsplus_btnode *node = NULL; -+ grub_disk_addr_t ptr = 0; - - { - struct grub_fshelp_node *fsnode; -@@ -976,8 +976,8 @@ grub_hfsplus_label (grub_device_t device, char **label) - struct grub_hfsplus_catkey *catkey; - int i, label_len; - struct grub_hfsplus_key_internal intern; -- struct grub_hfsplus_btnode *node; -- grub_disk_addr_t ptr; -+ struct grub_hfsplus_btnode *node = NULL; -+ grub_disk_addr_t ptr = 0; - - *label = 0; - -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 623b93b..78a70a8 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -445,7 +445,7 @@ grub_cmdline_run (int nested, int force_auth) - - while (1) - { -- char *line; -+ char *line = NULL; - - if (grub_normal_exit_level) - break; --- -2.4.3 - diff --git a/0379-Recognize-EFI-platform-even-in-case-of-mismatch-betw.patch b/0379-Recognize-EFI-platform-even-in-case-of-mismatch-betw.patch deleted file mode 100644 index e546170..0000000 --- a/0379-Recognize-EFI-platform-even-in-case-of-mismatch-betw.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 1a33de8b5612f8d7ab344546f8a91fa814f712b5 Mon Sep 17 00:00:00 2001 -From: Steve McIntyre -Date: Fri, 27 Mar 2015 14:51:51 +0100 -Subject: [PATCH 379/506] Recognize EFI platform even in case of mismatch - between Linux and EFI. - -Some x86 systems might be capable of running a 64-bit Linux kernel but -only use a 32-bit EFI (e.g. Intel Bay Trail systems). It's useful for -grub-install to be able to recognise such systems, to set the default -x86 platform correctly. - -To allow grub-install to know the size of the firmware rather than -just the size of the kernel, 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 ---- - grub-core/osdep/linux/platform.c | 39 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 38 insertions(+), 1 deletion(-) - -diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c -index 4b9f6ef..775b6c0 100644 ---- a/grub-core/osdep/linux/platform.c -+++ b/grub-core/osdep/linux/platform.c -@@ -60,6 +60,43 @@ 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) >= 3) /* 2 digits plus newline */ -+ { -+ 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) - { -@@ -77,7 +114,7 @@ grub_install_get_default_x86_platform (void) - if (is_not_empty_directory ("/sys/firmware/efi")) - { - grub_util_info ("...found"); -- if (is_64_kernel ()) -+ if (read_platform_size() == 64) - return "x86_64-efi"; - else - return "i386-efi"; --- -2.4.3 - diff --git a/0380-syslinux-Support-vesa-menu.c32.patch b/0380-syslinux-Support-vesa-menu.c32.patch deleted file mode 100644 index 9e52032..0000000 --- a/0380-syslinux-Support-vesa-menu.c32.patch +++ /dev/null @@ -1,208 +0,0 @@ -From c9ee9bedefe71df6bb18868e47ff2189e79d821e Mon Sep 17 00:00:00 2001 -From: Lunar -Date: Fri, 27 Mar 2015 15:15:13 +0100 -Subject: [PATCH 380/506] syslinux: Support {vesa,}menu.c32. - ---- - grub-core/lib/syslinux_parse.c | 165 ++++++++++++++++++++++++++--------------- - 1 file changed, 107 insertions(+), 58 deletions(-) - -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 22389eb..153260b 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -840,6 +840,82 @@ simplify_filename (char *str) - } - - static grub_err_t -+print_config (struct output_buffer *outbuf, -+ struct syslinux_menu *menu, -+ const char *filename, const char *basedir) -+{ -+ struct syslinux_menu *menuptr; -+ grub_err_t err = GRUB_ERR_NONE; -+ char *new_cwd = NULL; -+ char *new_target_cwd = NULL; -+ char *newname = NULL; -+ int depth = 0; -+ -+ new_cwd = get_read_filename (menu, basedir); -+ if (!new_cwd) -+ { -+ err = grub_errno; -+ goto out; -+ } -+ new_target_cwd = get_target_filename (menu, basedir); -+ if (!new_target_cwd) -+ { -+ err = grub_errno; -+ goto out; -+ } -+ newname = get_read_filename (menu, filename); -+ if (!newname) -+ { -+ err = grub_errno; -+ goto out; -+ } -+ simplify_filename (newname); -+ -+ print_string ("#"); -+ print_file (outbuf, menu, filename, NULL); -+ print_string (" "); -+ print (outbuf, newname, grub_strlen (newname)); -+ print_string (":\n"); -+ -+ for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++) -+ if (grub_strcmp (menuptr->filename, newname) == 0 -+ || depth > 20) -+ break; -+ if (menuptr) -+ { -+ print_string (" syslinux_configfile -r "); -+ print_file (outbuf, menu, "/", NULL); -+ print_string (" -c "); -+ print_file (outbuf, menu, basedir, NULL); -+ print_string (" "); -+ print_file (outbuf, menu, filename, NULL); -+ print_string ("\n"); -+ } -+ else -+ { -+ err = config_file (outbuf, menu->root_read_directory, -+ menu->root_target_directory, new_cwd, new_target_cwd, -+ newname, menu, menu->flavour); -+ if (err == GRUB_ERR_FILE_NOT_FOUND -+ || err == GRUB_ERR_BAD_FILENAME) -+ { -+ grub_errno = err = GRUB_ERR_NONE; -+ print_string ("# File "); -+ err = print (outbuf, newname, grub_strlen (newname)); -+ if (err) -+ goto out; -+ print_string (" not found\n"); -+ } -+ } -+ -+ out: -+ grub_free (newname); -+ grub_free (new_cwd); -+ grub_free (new_target_cwd); -+ return err; -+} -+ -+static grub_err_t - write_entry (struct output_buffer *outbuf, - struct syslinux_menu *menu, - struct syslinux_menuentry *curentry) -@@ -1227,6 +1303,36 @@ write_entry (struct output_buffer *outbuf, - break; - } - -+ if (grub_strcasecmp (basename, "menu.c32") == 0 || -+ grub_strcasecmp (basename, "vesamenu.c32") == 0) -+ { -+ char *ptr; -+ char *end; -+ -+ ptr = curentry->append; -+ if (!ptr) -+ return grub_errno; -+ -+ while (*ptr) -+ { -+ end = ptr; -+ for (end = ptr; *end && !grub_isspace (*end); end++); -+ if (*end) -+ *end++ = '\0'; -+ -+ /* "~" is supposed to be current file, so let's skip it */ -+ if (grub_strcmp (ptr, "~") != 0) -+ { -+ err = print_config (outbuf, menu, ptr, ""); -+ if (err != GRUB_ERR_NONE) -+ break; -+ } -+ for (ptr = end; *ptr && grub_isspace (*ptr); ptr++); -+ } -+ err = GRUB_ERR_NONE; -+ break; -+ } -+ - /* FIXME: gdb, GFXBoot, Hdt, Ifcpu, Ifplop, Kbdmap, - FIXME: Linux, Lua, Meminfo, rosh, Sanbboot */ - -@@ -1239,70 +1345,13 @@ write_entry (struct output_buffer *outbuf, - } - case KERNEL_CONFIG: - { -- char *new_cwd, *new_target_cwd; - const char *ap; - ap = curentry->append; - if (!ap) - ap = curentry->argument; - if (!ap) - ap = ""; -- new_cwd = get_read_filename (menu, ap); -- if (!new_cwd) -- return grub_errno; -- new_target_cwd = get_target_filename (menu, ap); -- if (!new_target_cwd) -- return grub_errno; -- -- struct syslinux_menu *menuptr; -- char *newname; -- int depth = 0; -- -- newname = get_read_filename (menu, curentry->kernel_file); -- if (!newname) -- return grub_errno; -- simplify_filename (newname); -- -- print_string ("#"); -- print_file (outbuf, menu, curentry->kernel_file, NULL); -- print_string (" "); -- print (outbuf, newname, grub_strlen (newname)); -- print_string (":\n"); -- -- for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++) -- if (grub_strcmp (menuptr->filename, newname) == 0 -- || depth > 20) -- break; -- if (menuptr) -- { -- print_string (" syslinux_configfile -r "); -- print_file (outbuf, menu, "/", NULL); -- print_string (" -c "); -- print_file (outbuf, menu, ap, NULL); -- print_string (" "); -- print_file (outbuf, menu, curentry->kernel_file, NULL); -- print_string ("\n"); -- } -- else -- { -- err = config_file (outbuf, menu->root_read_directory, -- menu->root_target_directory, new_cwd, new_target_cwd, -- newname, menu, menu->flavour); -- if (err == GRUB_ERR_FILE_NOT_FOUND -- || err == GRUB_ERR_BAD_FILENAME) -- { -- grub_errno = err = GRUB_ERR_NONE; -- print_string ("# File "); -- err = print (outbuf, newname, grub_strlen (newname)); -- if (err) -- return err; -- print_string (" not found\n"); -- } -- if (err) -- return err; -- } -- grub_free (newname); -- grub_free (new_cwd); -- grub_free (new_target_cwd); -+ print_config (outbuf, menu, curentry->kernel_file, ap); - } - break; - case KERNEL_NO_KERNEL: --- -2.4.3 - diff --git a/0381-net-trivial-grub_cpu_to_XX_compile_time-cleanup.patch b/0381-net-trivial-grub_cpu_to_XX_compile_time-cleanup.patch deleted file mode 100644 index d8d4d9f..0000000 --- a/0381-net-trivial-grub_cpu_to_XX_compile_time-cleanup.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ebd92af8c3f8fc30c48bbf36a1875fda1246981c Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 27 Mar 2015 18:58:57 +0300 -Subject: [PATCH 381/506] net: trivial grub_cpu_to_XX_compile_time cleanup - ---- - grub-core/net/arp.c | 2 +- - grub-core/net/icmp6.c | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 46a56e0..4b68c41 100644 ---- a/grub-core/net/arp.c -+++ b/grub-core/net/arp.c -@@ -80,7 +80,7 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - arp_packet = (struct arppkt *) nb.data; - arp_packet->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); - arp_packet->hln = 6; -- arp_packet->pro = grub_cpu_to_be16 (GRUB_NET_ETHERTYPE_IP); -+ arp_packet->pro = grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP); - arp_packet->pln = 4; - arp_packet->op = grub_cpu_to_be16_compile_time (ARP_REQUEST); - /* Sender hardware address. */ -diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index 7822394..7953e68 100644 ---- a/grub-core/net/icmp6.c -+++ b/grub-core/net/icmp6.c -@@ -552,8 +552,8 @@ grub_net_icmp6_send_router_solicit (struct grub_net_network_level_interface *inf - struct icmp_header *icmphr; - - multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -- multicast.ipv6[0] = grub_cpu_to_be64 (0xff02ULL << 48); -- multicast.ipv6[1] = grub_cpu_to_be64 (0x02ULL); -+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); -+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x02ULL); - - err = grub_net_link_layer_resolve (inf, &multicast, &ll_multicast); - if (err) --- -2.4.3 - diff --git a/0382-grub-core-loader-i386-xen.c-Initialized-initrd_ctx-s.patch b/0382-grub-core-loader-i386-xen.c-Initialized-initrd_ctx-s.patch deleted file mode 100644 index 0c4f6ab..0000000 --- a/0382-grub-core-loader-i386-xen.c-Initialized-initrd_ctx-s.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7d3993847466435bcc8c82267f101c5e8193f4be Mon Sep 17 00:00:00 2001 -From: Sarah Newman -Date: Fri, 27 Mar 2015 12:56:43 -0700 -Subject: [PATCH 382/506] grub-core/loader/i386/xen.c: Initialized initrd_ctx - so we don't free a random pointer from the stack. - -Signed-off-by: Sarah Newman ---- - grub-core/loader/i386/xen.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c -index c16b4b2..c4d9689 100644 ---- a/grub-core/loader/i386/xen.c -+++ b/grub-core/loader/i386/xen.c -@@ -521,7 +521,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_size_t size = 0; - grub_err_t err; -- struct grub_linux_initrd_context initrd_ctx; -+ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; - grub_relocator_chunk_t ch; - - if (argc == 0) --- -2.4.3 - diff --git a/0383-do-not-emit-cryptomount-without-crypto-UUID.patch b/0383-do-not-emit-cryptomount-without-crypto-UUID.patch deleted file mode 100644 index 89c92ef..0000000 --- a/0383-do-not-emit-cryptomount-without-crypto-UUID.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 12bf55703940cde06448a1c1a19001556c1450f9 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sat, 28 Mar 2015 22:13:35 +0300 -Subject: [PATCH 383/506] do not emit cryptomount without crypto UUID - ---- - util/grub-mkconfig_lib.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 29ef865..60b31ca 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -145,7 +145,7 @@ prepare_grub_to_access_device () - done - - if [ x$GRUB_ENABLE_CRYPTODISK = xy ]; then -- for uuid in "`"${grub_probe}" --device $@ --target=cryptodisk_uuid`"; do -+ for uuid in `"${grub_probe}" --device $@ --target=cryptodisk_uuid`; do - echo "cryptomount -u $uuid" - done - fi --- -2.4.3 - diff --git a/0384-core-avoid-NULL-derefrence-in-grub_divmod64s.patch b/0384-core-avoid-NULL-derefrence-in-grub_divmod64s.patch deleted file mode 100644 index 7681218..0000000 --- a/0384-core-avoid-NULL-derefrence-in-grub_divmod64s.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f11db3c7fc50b0b7de22e5ccdcb06bcbccb22a46 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 6 Apr 2015 19:25:02 +0300 -Subject: [PATCH 384/506] core: avoid NULL derefrence in grub_divmod64s - -It can be called with NULL for third argument. grub_divmod32* for -now are called only from within wrappers, so skip check. - -Reported-By: Michael Zimmermann ---- - grub-core/lib/division.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/lib/division.c b/grub-core/lib/division.c -index 920a79f..35606fe 100644 ---- a/grub-core/lib/division.c -+++ b/grub-core/lib/division.c -@@ -50,7 +50,8 @@ grub_divmod64s (grub_int64_t n, - q = -q; - } - /* Now: n = d * q + r */ -- *ro = r; -+ if (ro) -+ *ro = r; - return q; - } - --- -2.4.3 - diff --git a/0385-docs-grub.texi-Fix-spelling-of-cbfstool.patch b/0385-docs-grub.texi-Fix-spelling-of-cbfstool.patch deleted file mode 100644 index b3fd906..0000000 --- a/0385-docs-grub.texi-Fix-spelling-of-cbfstool.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e97f5f4968c4b92c43985833604118149cbba128 Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Sat, 11 Apr 2015 21:40:50 +0200 -Subject: [PATCH 385/506] docs/grub.texi: Fix spelling of cbfstool - ---- - docs/grub.texi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 46b9e7f..4af22af 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -5848,7 +5848,7 @@ Following variables must be defined: - - @multitable @columnfractions .30 .65 - @item GRUB_PAYLOADS_DIR @tab directory containing the required kernels --@item GRUB_CBFSTOOL @tab cbfstoll from Coreboot package (for coreboot platform only) -+@item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only) - @item GRUB_COREBOOT_ROM @tab empty Coreboot ROM - @item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU - @end multitable --- -2.4.3 - diff --git a/0386-core-partmap-rename-sun-to-avoid-clash-with-predefin.patch b/0386-core-partmap-rename-sun-to-avoid-clash-with-predefin.patch deleted file mode 100644 index c9b2154..0000000 --- a/0386-core-partmap-rename-sun-to-avoid-clash-with-predefin.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 5b5d8666a748109a3a0175f8140382d295a7938a Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Mon, 13 Apr 2015 19:49:15 +0300 -Subject: [PATCH 386/506] core/partmap: rename 'sun' to avoid clash with - predefined symbol -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -the symbol “sun†is defined macro in solaris derived systems, from -gcc -dM -E: - -and therefore can not be used as name. ---- - grub-core/partmap/sun.c | 14 +++++++------- - grub-core/partmap/sunpc.c | 10 +++++----- - 2 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/grub-core/partmap/sun.c b/grub-core/partmap/sun.c -index dae3602..aac30a3 100644 ---- a/grub-core/partmap/sun.c -+++ b/grub-core/partmap/sun.c -@@ -91,7 +91,7 @@ sun_partition_map_iterate (grub_disk_t disk, - struct grub_partition p; - union - { -- struct grub_sun_block sun; -+ struct grub_sun_block sun_block; - grub_uint16_t raw[0]; - } block; - int partnum; -@@ -103,7 +103,7 @@ sun_partition_map_iterate (grub_disk_t disk, - if (err) - return err; - -- if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sun.magic)) -+ if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sun_block.magic)) - return grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table"); - - if (! grub_sun_is_valid (block.raw)) -@@ -115,14 +115,14 @@ sun_partition_map_iterate (grub_disk_t disk, - { - struct grub_sun_partition_descriptor *desc; - -- if (block.sun.infos[partnum].id == 0 -- || block.sun.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID) -+ if (block.sun_block.infos[partnum].id == 0 -+ || block.sun_block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID) - continue; - -- desc = &block.sun.partitions[partnum]; -+ desc = &block.sun_block.partitions[partnum]; - p.start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder) -- * grub_be_to_cpu16 (block.sun.ntrks) -- * grub_be_to_cpu16 (block.sun.nsect)); -+ * grub_be_to_cpu16 (block.sun_block.ntrks) -+ * grub_be_to_cpu16 (block.sun_block.nsect)); - p.len = grub_be_to_cpu32 (desc->num_sectors); - p.number = p.index = partnum; - if (p.len) -diff --git a/grub-core/partmap/sunpc.c b/grub-core/partmap/sunpc.c -index 442763e..73a430c 100644 ---- a/grub-core/partmap/sunpc.c -+++ b/grub-core/partmap/sunpc.c -@@ -74,7 +74,7 @@ sun_pc_partition_map_iterate (grub_disk_t disk, - grub_partition_t p; - union - { -- struct grub_sun_pc_block sun; -+ struct grub_sun_pc_block sun_block; - grub_uint16_t raw[0]; - } block; - int partnum; -@@ -92,7 +92,7 @@ sun_pc_partition_map_iterate (grub_disk_t disk, - return err; - } - -- if (GRUB_PARTMAP_SUN_PC_MAGIC != grub_le_to_cpu16 (block.sun.magic)) -+ if (GRUB_PARTMAP_SUN_PC_MAGIC != grub_le_to_cpu16 (block.sun_block.magic)) - { - grub_free (p); - return grub_error (GRUB_ERR_BAD_PART_TABLE, -@@ -111,12 +111,12 @@ sun_pc_partition_map_iterate (grub_disk_t disk, - { - struct grub_sun_pc_partition_descriptor *desc; - -- if (block.sun.partitions[partnum].id == 0 -- || block.sun.partitions[partnum].id -+ if (block.sun_block.partitions[partnum].id == 0 -+ || block.sun_block.partitions[partnum].id - == GRUB_PARTMAP_SUN_PC_WHOLE_DISK_ID) - continue; - -- desc = &block.sun.partitions[partnum]; -+ desc = &block.sun_block.partitions[partnum]; - p->start = grub_le_to_cpu32 (desc->start_sector); - p->len = grub_le_to_cpu32 (desc->num_sectors); - p->number = partnum; --- -2.4.3 - diff --git a/0387-getroot-include-sys-mkdev.h-for-makedev.patch b/0387-getroot-include-sys-mkdev.h-for-makedev.patch deleted file mode 100644 index 238da12..0000000 --- a/0387-getroot-include-sys-mkdev.h-for-makedev.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 677dcaa92bdd31f38d49a4d5575f2adca8479d94 Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Mon, 13 Apr 2015 19:52:28 +0300 -Subject: [PATCH 387/506] getroot: include sys/mkdev.h for makedev - -Solaris (like) systems need to include sys/mkdev.h for makedev() function. ---- - grub-core/osdep/unix/getroot.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index ccee7ce..b98b2df 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -57,6 +57,9 @@ - #endif - - #include -+#if defined(HAVE_SYS_MKDEV_H) -+#include -+#endif - - #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) - # include --- -2.4.3 - diff --git a/0388-Remove-V-in-grub-mkrescue.c.patch b/0388-Remove-V-in-grub-mkrescue.c.patch deleted file mode 100644 index 3dae318..0000000 --- a/0388-Remove-V-in-grub-mkrescue.c.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 70b002de55abbfd6b2d2f2ea4408078d93c9e0de Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Fri, 24 Apr 2015 17:52:30 +0200 -Subject: [PATCH 388/506] Remove -V in grub-mkrescue.c - -It clashhes with -V which is alias to -volid. ---- - util/grub-mkrescue.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 5d3ec0d..815fc91 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -409,7 +409,7 @@ args_to_eat (const char *arg) - return 2; - return 1; - } -- if (arg[1] == '?' || arg[1] == 'V') -+ if (arg[1] == '?') - return 1; - } - return 0; --- -2.4.3 - diff --git a/0389-grub-mkconfig-use-pkgdatadir-in-scripts.patch b/0389-grub-mkconfig-use-pkgdatadir-in-scripts.patch deleted file mode 100644 index 6817b57..0000000 --- a/0389-grub-mkconfig-use-pkgdatadir-in-scripts.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 104dff36eabe25dec143838167466fd6a8ddbc79 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 29 Apr 2015 19:18:54 +0300 -Subject: [PATCH 389/506] grub-mkconfig: use $pkgdatadir in scripts - -Otherwise scripts will source wrong grub-mkconfig_lib. ---- - util/grub-mkconfig.in | 3 +++ - util/grub.d/00_header.in | 2 +- - util/grub.d/10_hurd.in | 2 +- - util/grub.d/10_illumos.in | 2 +- - util/grub.d/10_kfreebsd.in | 2 +- - util/grub.d/10_linux.in | 2 +- - util/grub.d/10_netbsd.in | 2 +- - util/grub.d/10_windows.in | 2 +- - util/grub.d/10_xnu.in | 2 +- - util/grub.d/20_linux_xen.in | 2 +- - util/grub.d/30_os-prober.in | 2 +- - 11 files changed, 13 insertions(+), 10 deletions(-) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index d1fae49..3183744 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -33,6 +33,9 @@ datadir="@datadir@" - if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" - fi -+# export it for scripts -+export pkgdatadir -+ - grub_cfg="" - grub_mkconfig_dir="${sysconfdir}"/grub.d - -diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index ce2ec81..93a9023 100644 ---- a/util/grub.d/00_header.in -+++ b/util/grub.d/00_header.in -@@ -25,7 +25,7 @@ grub_lang=`echo $LANG | cut -d . -f 1` - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - # Do this as early as possible, since other commands might depend on it. - # (e.g. the `loadfont' command might need lvm or raid modules) -diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in -index 29b4554..59a9a48 100644 ---- a/util/grub.d/10_hurd.in -+++ b/util/grub.d/10_hurd.in -@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - CLASS="--class gnu --class os" - -diff --git a/util/grub.d/10_illumos.in b/util/grub.d/10_illumos.in -index 0de616e..a133e1b 100644 ---- a/util/grub.d/10_illumos.in -+++ b/util/grub.d/10_illumos.in -@@ -20,7 +20,7 @@ set -e - prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" -diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in -index 65f6c32..9d8e8fd 100644 ---- a/util/grub.d/10_kfreebsd.in -+++ b/util/grub.d/10_kfreebsd.in -@@ -20,7 +20,7 @@ set -e - prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index a2a84dc..859b608 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -21,7 +21,7 @@ prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" -diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in -index 9988a42..874f599 100644 ---- a/util/grub.d/10_netbsd.in -+++ b/util/grub.d/10_netbsd.in -@@ -20,7 +20,7 @@ set -e - prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" -diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in -index 48bd955..554c561 100644 ---- a/util/grub.d/10_windows.in -+++ b/util/grub.d/10_windows.in -@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - case "`uname 2>/dev/null`" in - CYGWIN*) ;; -diff --git a/util/grub.d/10_xnu.in b/util/grub.d/10_xnu.in -index 4270385..51ee2f4 100644 ---- a/util/grub.d/10_xnu.in -+++ b/util/grub.d/10_xnu.in -@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - osx_entry() { - if [ x$2 = x32 ]; then -diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index de34c8d..f532fb9 100644 ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in -@@ -21,7 +21,7 @@ prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" -diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 4ee6015..5fc4f0c 100644 ---- a/util/grub.d/30_os-prober.in -+++ b/util/grub.d/30_os-prober.in -@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - --. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+. "$pkgdatadir/grub-mkconfig_lib" - - if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then - exit 0 --- -2.4.3 - diff --git a/0390-zfs-com.delphix-hole_birth-feature-support.patch b/0390-zfs-com.delphix-hole_birth-feature-support.patch deleted file mode 100644 index 82468a5..0000000 --- a/0390-zfs-com.delphix-hole_birth-feature-support.patch +++ /dev/null @@ -1,55 +0,0 @@ -From a1007c6af296172c788f3346ff3ad30b9020f723 Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Thu, 16 Apr 2015 08:22:08 +0300 -Subject: [PATCH 390/506] zfs: com.delphix:hole_birth feature support - -In the past birth was always zero for holes. This feature started -to make use of birth for holes as well, so change code to test for -valid DVA address instead. ---- - grub-core/fs/zfs/zfs.c | 6 ++++-- - include/grub/zfs/spa.h | 4 +++- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 0cbb84b..71c155d 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -280,7 +280,9 @@ grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key - */ - #define MAX_SUPPORTED_FEATURE_STRLEN 50 - static const char *spa_feature_names[] = { -- "org.illumos:lz4_compress",NULL -+ "org.illumos:lz4_compress", -+ "com.delphix:hole_birth", -+ NULL - }; - - static int -@@ -1751,7 +1753,7 @@ zio_read_gang (blkptr_t * bp, grub_zfs_endian_t endian, dva_t * dva, void *buf, - - for (i = 0; i < SPA_GBH_NBLKPTRS; i++) - { -- if (zio_gb->zg_blkptr[i].blk_birth == 0) -+ if (BP_IS_HOLE(&zio_gb->zg_blkptr[i])) - continue; - - err = zio_read_data (&zio_gb->zg_blkptr[i], endian, buf, data); -diff --git a/include/grub/zfs/spa.h b/include/grub/zfs/spa.h -index 7edb8ab..df43b6b 100644 ---- a/include/grub/zfs/spa.h -+++ b/include/grub/zfs/spa.h -@@ -279,7 +279,9 @@ typedef struct blkptr { - - #define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) - #define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) --#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) -+#define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \ -+ (dva)->dva_word[1] == 0ULL) -+#define BP_IS_HOLE(bp) DVA_IS_EMPTY(BP_IDENTITY(bp)) - - /* BP_IS_RAIDZ(bp) assumes no block compression */ - #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \ --- -2.4.3 - diff --git a/0391-zfs-com.delphix-embedded_data-feature-support.patch b/0391-zfs-com.delphix-embedded_data-feature-support.patch deleted file mode 100644 index 3dea141..0000000 --- a/0391-zfs-com.delphix-embedded_data-feature-support.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 4a7ea4003bd9f39e9bf2ebadbe4ab38f8874be66 Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Thu, 16 Apr 2015 08:23:22 +0300 -Subject: [PATCH 391/506] zfs: com.delphix:embedded_data feature support - ---- - grub-core/fs/zfs/zfs.c | 84 +++++++++++++++++++++++++++++++++++++++++--------- - include/grub/zfs/spa.h | 27 +++++++++++++--- - 2 files changed, 93 insertions(+), 18 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 71c155d..03d587d 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -282,6 +282,7 @@ grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key - static const char *spa_feature_names[] = { - "org.illumos:lz4_compress", - "com.delphix:hole_birth", -+ "com.delphix:embedded_data", - NULL - }; - -@@ -1803,6 +1804,39 @@ zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, - } - - /* -+ * buf must be at least BPE_GET_PSIZE(bp) bytes long (which will never be -+ * more than BPE_PAYLOAD_SIZE bytes). -+ */ -+static grub_err_t -+decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) -+{ -+ grub_size_t psize, i; -+ grub_uint8_t *buf8 = buf; -+ grub_uint64_t w = 0; -+ const grub_uint64_t *bp64 = (const grub_uint64_t *)bp; -+ -+ psize = BPE_GET_PSIZE(bp); -+ -+ /* -+ * Decode the words of the block pointer into the byte array. -+ * Low bits of first word are the first byte (little endian). -+ */ -+ for (i = 0; i < psize; i++) -+ { -+ if (i % sizeof (w) == 0) -+ { -+ /* beginning of a word */ -+ w = *bp64; -+ bp64++; -+ if (!BPE_IS_PAYLOADWORD(bp, bp64)) -+ bp64++; -+ } -+ buf8[i] = BF64_GET(w, (i % sizeof (w)) * 8, 8); -+ } -+ return GRUB_ERR_NONE; -+} -+ -+/* - * Read in a block of data, verify its checksum, decompress if needed, - * and put the uncompressed data in buf. - */ -@@ -1820,12 +1854,26 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - *buf = NULL; - - checksum = (grub_zfs_to_cpu64((bp)->blk_prop, endian) >> 40) & 0xff; -- comp = (grub_zfs_to_cpu64((bp)->blk_prop, endian)>>32) & 0xff; -+ comp = (grub_zfs_to_cpu64((bp)->blk_prop, endian)>>32) & 0x7f; - encrypted = ((grub_zfs_to_cpu64((bp)->blk_prop, endian) >> 60) & 3); -- lsize = (BP_IS_HOLE(bp) ? 0 : -- (((grub_zfs_to_cpu64 ((bp)->blk_prop, endian) & 0xffff) + 1) -- << SPA_MINBLOCKSHIFT)); -- psize = get_psize (bp, endian); -+ if (BP_IS_EMBEDDED(bp)) -+ { -+ if (BPE_GET_ETYPE(bp) != BP_EMBEDDED_TYPE_DATA) -+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ "unsupported embedded BP (type=%u)\n", -+ BPE_GET_ETYPE(bp)); -+ lsize = BPE_GET_LSIZE(bp); -+ psize = BF64_GET_SB(grub_zfs_to_cpu64 ((bp)->blk_prop, endian), 25, 7, 0, 1); -+ } -+ else -+ { -+ lsize = (BP_IS_HOLE(bp) ? 0 : -+ (((grub_zfs_to_cpu64 ((bp)->blk_prop, endian) & 0xffff) + 1) -+ << SPA_MINBLOCKSHIFT)); -+ psize = get_psize (bp, endian); -+ } -+ grub_dprintf("zfs", "zio_read: E %d: size %" PRIdGRUB_SSIZE "/%" -+ PRIdGRUB_SSIZE "\n", (int)BP_IS_EMBEDDED(bp), lsize, psize); - - if (size) - *size = lsize; -@@ -1849,23 +1897,31 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - compbuf = *buf = grub_malloc (lsize); - - grub_dprintf ("zfs", "endian = %d\n", endian); -- err = zio_read_data (bp, endian, compbuf, data); -+ if (BP_IS_EMBEDDED(bp)) -+ err = decode_embedded_bp_compressed(bp, compbuf); -+ else -+ { -+ err = zio_read_data (bp, endian, compbuf, data); -+ grub_memset (compbuf, 0, ALIGN_UP (psize, 16) - psize); -+ } - if (err) - { - grub_free (compbuf); - *buf = NULL; - return err; - } -- grub_memset (compbuf, 0, ALIGN_UP (psize, 16) - psize); - -- err = zio_checksum_verify (zc, checksum, endian, -- compbuf, psize); -- if (err) -+ if (!BP_IS_EMBEDDED(bp)) - { -- grub_dprintf ("zfs", "incorrect checksum\n"); -- grub_free (compbuf); -- *buf = NULL; -- return err; -+ err = zio_checksum_verify (zc, checksum, endian, -+ compbuf, psize); -+ if (err) -+ { -+ grub_dprintf ("zfs", "incorrect checksum\n"); -+ grub_free (compbuf); -+ *buf = NULL; -+ return err; -+ } - } - - if (encrypted) -diff --git a/include/grub/zfs/spa.h b/include/grub/zfs/spa.h -index df43b6b..8dd1fa8 100644 ---- a/include/grub/zfs/spa.h -+++ b/include/grub/zfs/spa.h -@@ -126,7 +126,7 @@ typedef struct zio_cksum { - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 5 |G| offset3 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ -- * 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE | -+ * 6 |BDX|lvl| type | cksum |E| comp| PSIZE | LSIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 7 | padding | - * +-------+-------+-------+-------+-------+-------+-------+-------+ -@@ -160,7 +160,8 @@ typedef struct zio_cksum { - * G gang block indicator - * B byteorder (endianness) - * D dedup -- * X unused -+ * X encryption -+ * E blkptr_t contains embedded data - * lvl level of indirection - * type DMU object type - * phys birth txg of block allocation; zero if same as logical birth txg -@@ -203,8 +204,8 @@ typedef struct blkptr { - #define BP_SET_LSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) - --#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) --#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) -+#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7) -+#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x) - - #define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) - #define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) -@@ -215,6 +216,8 @@ typedef struct blkptr { - #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) - #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) - -+#define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) -+ - #define BP_GET_PROP_BIT_61(bp) BF64_GET((bp)->blk_prop, 61, 1) - #define BP_SET_PROP_BIT_61(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x) - -@@ -277,6 +280,22 @@ typedef struct blkptr { - (zcp)->zc_word[3] = w3; \ - } - -+#define BPE_GET_ETYPE(bp) BP_GET_CHECKSUM(bp) -+#define BPE_GET_LSIZE(bp) \ -+ BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1) -+#define BPE_GET_PSIZE(bp) \ -+ BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1) -+ -+typedef enum bp_embedded_type { -+ BP_EMBEDDED_TYPE_DATA, -+ NUM_BP_EMBEDDED_TYPES -+} bp_embedded_type_t; -+ -+#define BPE_NUM_WORDS 14 -+#define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof(grub_uint64_t)) -+#define BPE_IS_PAYLOADWORD(bp, wp) \ -+ ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth) -+ - #define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) - #define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) - #define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \ --- -2.4.3 - diff --git a/0392-zfs-add-missing-NULL-check-and-fix-incorrect-buffer-.patch b/0392-zfs-add-missing-NULL-check-and-fix-incorrect-buffer-.patch deleted file mode 100644 index c443e7a..0000000 --- a/0392-zfs-add-missing-NULL-check-and-fix-incorrect-buffer-.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 6210b8e8f7b4640711dd449ca8301d06fee62334 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 3 May 2015 18:55:13 +0300 -Subject: [PATCH 392/506] zfs: add missing NULL check and fix incorrect buffer - overwrite - -grub_memset should zero out padding after data end. It is not clear -why it is needed at all - ZFS block is at least 512 bytes and power -of two, so it is always multiple of 16 bytes. This grub_memset -apparently never did anything. ---- - grub-core/fs/zfs/zfs.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 03d587d..08ed453 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -1887,14 +1887,12 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - "compression algorithm %s not supported\n", decomp_table[comp].name); - - if (comp != ZIO_COMPRESS_OFF) -- { -- /* It's not really necessary to align to 16, just for safety. */ -- compbuf = grub_malloc (ALIGN_UP (psize, 16)); -- if (! compbuf) -- return grub_errno; -- } -+ /* It's not really necessary to align to 16, just for safety. */ -+ compbuf = grub_malloc (ALIGN_UP (psize, 16)); - else - compbuf = *buf = grub_malloc (lsize); -+ if (! compbuf) -+ return grub_errno; - - grub_dprintf ("zfs", "endian = %d\n", endian); - if (BP_IS_EMBEDDED(bp)) -@@ -1902,7 +1900,9 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - else - { - err = zio_read_data (bp, endian, compbuf, data); -- grub_memset (compbuf, 0, ALIGN_UP (psize, 16) - psize); -+ /* FIXME is it really necessary? */ -+ if (comp != ZIO_COMPRESS_OFF) -+ grub_memset (compbuf + psize, 0, ALIGN_UP (psize, 16) - psize); - } - if (err) - { --- -2.4.3 - diff --git a/0393-efinet-memory-leak-on-module-removal.patch b/0393-efinet-memory-leak-on-module-removal.patch deleted file mode 100644 index 5be04eb..0000000 --- a/0393-efinet-memory-leak-on-module-removal.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8d3c4544ffdd0289a4b0bdeb0cdc6355f801a4b3 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 4 May 2015 08:08:57 +0300 -Subject: [PATCH 393/506] efinet: memory leak on module removal - ---- - grub-core/net/drivers/efi/efinet.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index f171f20..eb1e682 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -278,6 +278,12 @@ GRUB_MOD_FINI(efinet) - - FOR_NET_CARDS_SAFE (card, next) - if (card->driver == &efidriver) -- grub_net_card_unregister (card); -+ { -+ grub_net_card_unregister (card); -+ grub_free (card->txbuf); -+ grub_free (card->rcvbuf); -+ grub_free (card->name); -+ grub_free (card); -+ } - } - --- -2.4.3 - diff --git a/0394-efinet-cannot-free-const-char-pointer.patch b/0394-efinet-cannot-free-const-char-pointer.patch deleted file mode 100644 index 4e82769..0000000 --- a/0394-efinet-cannot-free-const-char-pointer.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 47b2bee3ef0ea60fc3f5bfc37f3784e559385297 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 4 May 2015 08:39:29 +0300 -Subject: [PATCH 394/506] efinet: cannot free const char * pointer - ---- - grub-core/net/drivers/efi/efinet.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index eb1e682..a879dec 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -282,7 +282,7 @@ GRUB_MOD_FINI(efinet) - grub_net_card_unregister (card); - grub_free (card->txbuf); - grub_free (card->rcvbuf); -- grub_free (card->name); -+ grub_free ((char *)card->name); - grub_free (card); - } - } --- -2.4.3 - diff --git a/0395-Revert-efinet-memory-leak-on-module-removal.patch b/0395-Revert-efinet-memory-leak-on-module-removal.patch deleted file mode 100644 index f0920a1..0000000 --- a/0395-Revert-efinet-memory-leak-on-module-removal.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cc699535e57e0d0f099090e64a63037c7834f104 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Mon, 4 May 2015 09:13:53 +0300 -Subject: [PATCH 395/506] Revert "efinet: memory leak on module removal" - -This reverts commits 47b2bee3ef0ea60fc3f5bfc37f3784e559385297 -and 8d3c4544ffdd0289a4b0bdeb0cdc6355f801a4b3. It is not safe -to free allocated cards, dangling pointers main remain. Such -cleanup requires more changes in net core. ---- - grub-core/net/drivers/efi/efinet.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index a879dec..f171f20 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -278,12 +278,6 @@ GRUB_MOD_FINI(efinet) - - FOR_NET_CARDS_SAFE (card, next) - if (card->driver == &efidriver) -- { -- grub_net_card_unregister (card); -- grub_free (card->txbuf); -- grub_free (card->rcvbuf); -- grub_free ((char *)card->name); -- grub_free (card); -- } -+ grub_net_card_unregister (card); - } - --- -2.4.3 - diff --git a/0396-arm64-Export-useful-functions-from-linux.c.patch b/0396-arm64-Export-useful-functions-from-linux.c.patch deleted file mode 100644 index a8f280c..0000000 --- a/0396-arm64-Export-useful-functions-from-linux.c.patch +++ /dev/null @@ -1,291 +0,0 @@ -From f8451af8251a3866cb8b7307b9917dd5d34fbd0a Mon Sep 17 00:00:00 2001 -From: Fu Wei -Date: Thu, 7 May 2015 15:11:04 +0200 -Subject: [PATCH 396/506] arm64: Export useful functions from linux.c - -Signed-off-by: Fu Wei ---- - gentpl.py | 2 +- - grub-core/loader/arm64/linux.c | 59 +++++++++++++++++++++--------------------- - grub-core/loader/i386/linux.c | 11 ++++---- - grub-core/loader/linux.c | 3 ++- - include/grub/arm64/linux.h | 11 ++++++++ - 5 files changed, 49 insertions(+), 37 deletions(-) - -diff --git a/gentpl.py b/gentpl.py -index f177883..0fd5ba4 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -759,7 +759,7 @@ def image(defn, platform): - if test x$(TARGET_APPLE_LINKER) = x1; then \ - $(MACHO2IMG) $< $@; \ - else \ -- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ -+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .hash -R .dynsym -R .dynstr -R .rel.text $< $@; \ - fi - """) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 564a75a..987f5b9 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -33,12 +33,6 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - --#define GRUB_EFI_PAGE_SHIFT 12 --#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) --#define GRUB_EFI_PE_MAGIC 0x5A4D -- --static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; -- - static grub_dl_t my_mod; - static int loaded; - -@@ -58,6 +52,7 @@ 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; - -@@ -75,8 +70,8 @@ get_firmware_fdt (void) - return firmware_fdt; - } - --static void --get_fdt (void) -+void * -+grub_linux_get_fdt (void) - { - void *raw_fdt; - grub_size_t size; -@@ -99,7 +94,7 @@ get_fdt (void) - grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size); - fdt = grub_efi_allocate_pages (0, BYTES_TO_PAGES (size)); - if (!fdt) -- return; -+ return NULL; - - if (raw_fdt) - { -@@ -110,10 +105,11 @@ get_fdt (void) - { - grub_fdt_create_empty_tree (fdt, size); - } -+ return fdt; - } - --static grub_err_t --check_kernel (struct grub_arm64_linux_kernel_header *lh) -+grub_err_t -+grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh) - { - if (lh->magic != GRUB_ARM64_LINUX_MAGIC) - return grub_error(GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -131,14 +127,14 @@ check_kernel (struct grub_arm64_linux_kernel_header *lh) - } - - static grub_err_t --finalize_params (void) -+finalize_params_linux (void) - { - grub_efi_boot_services_t *b; -+ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; - grub_efi_status_t status; - int node, retval; - -- get_fdt (); -- if (!fdt) -+ if (!grub_linux_get_fdt ()) - goto failure; - - node = grub_fdt_find_subnode (fdt, 0, "chosen"); -@@ -240,21 +236,16 @@ out: - return grub_errno; - } - --static grub_err_t --grub_linux_boot (void) -+grub_err_t -+grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) - { - grub_efi_memory_mapped_device_path_t *mempath; - grub_efi_handle_t image_handle; - grub_efi_boot_services_t *b; - grub_efi_status_t status; -- grub_err_t retval; - grub_efi_loaded_image_t *loaded_image; - int len; - -- retval = finalize_params(); -- if (retval != GRUB_ERR_NONE) -- return retval; -- - mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t)); - if (!mempath) - return grub_errno; -@@ -263,8 +254,8 @@ grub_linux_boot (void) - mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE; - mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath)); - mempath[0].memory_type = GRUB_EFI_LOADER_DATA; -- mempath[0].start_address = (grub_addr_t) kernel_addr; -- mempath[0].end_address = (grub_addr_t) kernel_addr + kernel_size; -+ mempath[0].start_address = addr; -+ mempath[0].end_address = addr + size; - - mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE; - mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -273,16 +264,16 @@ grub_linux_boot (void) - b = grub_efi_system_table->boot_services; - status = b->load_image (0, grub_efi_image_handle, - (grub_efi_device_path_t *) mempath, -- kernel_addr, kernel_size, &image_handle); -+ (void *) addr, size, &image_handle); - if (status != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_BAD_OS, "cannot load image"); - -- grub_dprintf ("linux", "linux command line: '%s'\n", linux_args); -+ grub_dprintf ("linux", "linux command line: '%s'\n", args); - - /* Convert command line to UCS-2 */ - loaded_image = grub_efi_get_loaded_image (image_handle); - loaded_image->load_options_size = len = -- (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t); -+ (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t); - loaded_image->load_options = - grub_efi_allocate_pages (0, - BYTES_TO_PAGES (loaded_image->load_options_size)); -@@ -291,9 +282,9 @@ grub_linux_boot (void) - - loaded_image->load_options_size = - 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, -- (grub_uint8_t *) linux_args, len, NULL); -+ (grub_uint8_t *) args, len, NULL); - -- grub_dprintf("linux", "starting image %p\n", image_handle); -+ grub_dprintf ("linux", "starting image %p\n", image_handle); - status = b->start_image (image_handle, 0, NULL); - - /* When successful, not reached */ -@@ -305,6 +296,16 @@ grub_linux_boot (void) - } - - static grub_err_t -+grub_linux_boot (void) -+{ -+ if (finalize_params_linux () != GRUB_ERR_NONE) -+ return grub_errno; -+ -+ return (grub_arm64_uefi_boot_image((grub_addr_t)kernel_addr, -+ kernel_size, linux_args)); -+} -+ -+static grub_err_t - grub_linux_unload (void) - { - grub_dl_unref (my_mod); -@@ -400,7 +401,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) - return grub_errno; - -- if (check_kernel (&lh) != GRUB_ERR_NONE) -+ if (grub_arm64_uefi_check_image (&lh) != GRUB_ERR_NONE) - goto fail; - - grub_loader_unset(); -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 291f728..fddcc46 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -69,7 +69,6 @@ static grub_addr_t prot_mode_target; - static void *initrd_mem; - static grub_addr_t initrd_mem_target; - static grub_size_t prot_init_space; --static grub_uint32_t initrd_pages; - static struct grub_relocator *relocator = NULL; - static void *efi_mmap_buf; - static grub_size_t maximal_cmdline_size; -@@ -1046,7 +1045,7 @@ static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { -- grub_size_t size = 0; -+ grub_size_t size = 0, aligned_size = 0; - grub_addr_t addr_min, addr_max; - grub_addr_t addr; - grub_err_t err; -@@ -1068,8 +1067,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - goto fail; - - size = grub_get_initrd_size (&initrd_ctx); -- -- initrd_pages = (page_align (size) >> 12); -+ aligned_size = ALIGN_UP (size, 4096); - - /* Get the highest address available for the initrd. */ - if (grub_le_to_cpu16 (linux_params.version) >= 0x0203) -@@ -1097,7 +1095,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - addr_min = (grub_addr_t) prot_mode_target + prot_init_space; - - /* Put the initrd as high as possible, 4KiB aligned. */ -- addr = (addr_max - size) & ~0xFFF; -+ addr = (addr_max - aligned_size) & ~0xFFF; - - if (addr < addr_min) - { -@@ -1108,7 +1106,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_relocator_chunk_t ch; - err = grub_relocator_alloc_chunk_align (relocator, &ch, -- addr_min, addr, size, 0x1000, -+ addr_min, addr, aligned_size, -+ 0x1000, - GRUB_RELOCATOR_PREFERENCE_HIGH, - 1); - if (err) -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index 117232f..a63a11a 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -205,7 +205,8 @@ grub_initrd_init (int argc, char *argv[], - initrd_ctx->nfiles++; - initrd_ctx->components[i].size - = grub_file_size (initrd_ctx->components[i].file); -- initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); -+ if (argc != 1) -+ initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); - } - - if (newc) -diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 864e5dc..65796d9 100644 ---- a/include/grub/arm64/linux.h -+++ b/include/grub/arm64/linux.h -@@ -23,6 +23,10 @@ - - #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */ - -+#define GRUB_EFI_PAGE_SHIFT 12 -+#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) -+#define GRUB_EFI_PE_MAGIC 0x5A4D -+ - /* From linux/Documentation/arm64/booting.txt */ - struct grub_arm64_linux_kernel_header - { -@@ -38,4 +42,11 @@ struct grub_arm64_linux_kernel_header - grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ - }; - -+/* Declare the functions for getting dtb and checking/booting image */ -+void *grub_linux_get_fdt (void); -+grub_err_t grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header -+ *lh); -+grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, -+ char *args); -+ - #endif /* ! GRUB_LINUX_CPU_HEADER */ --- -2.4.3 - diff --git a/0397-fdt.h-Add-grub_fdt_set_reg64-macro.patch b/0397-fdt.h-Add-grub_fdt_set_reg64-macro.patch deleted file mode 100644 index 2fe7951..0000000 --- a/0397-fdt.h-Add-grub_fdt_set_reg64-macro.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cfe2ae89360954f0cbc585f5c72e60a07eb066a2 Mon Sep 17 00:00:00 2001 -From: Fu Wei -Date: Thu, 7 May 2015 15:13:25 +0200 -Subject: [PATCH 397/506] fdt.h: Add grub_fdt_set_reg64 macro - -Signed-off-by: Fu Wei ---- - include/grub/fdt.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index 3016998..fdfca75 100644 ---- a/include/grub/fdt.h -+++ b/include/grub/fdt.h -@@ -117,4 +117,16 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - grub_fdt_set_prop ((fdt), (nodeoffset), (name), &_val, 8); \ - }) - -+/* Setup "reg" property for -+ * #address-cells = <0x2> -+ * #size-cells = <0x2> -+ */ -+#define grub_fdt_set_reg64(fdt, nodeoffset, addr, size) \ -+({ \ -+ grub_uint64_t reg_64[2]; \ -+ reg_64[0] = grub_cpu_to_be64(addr); \ -+ reg_64[1] = grub_cpu_to_be64(size); \ -+ grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ -+}) -+ - #endif /* ! GRUB_FDT_HEADER */ --- -2.4.3 - diff --git a/0398-Revert-parts-accidentally-committed-2-commits-ago.patch b/0398-Revert-parts-accidentally-committed-2-commits-ago.patch deleted file mode 100644 index 6388465..0000000 --- a/0398-Revert-parts-accidentally-committed-2-commits-ago.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 9f731abc7f960a96a4c58d89717915e632837389 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 7 May 2015 16:21:34 +0200 -Subject: [PATCH 398/506] Revert parts accidentally committed 2 commits ago. - ---- - gentpl.py | 2 +- - grub-core/loader/i386/linux.c | 11 ++++++----- - grub-core/loader/linux.c | 3 +-- - 3 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/gentpl.py b/gentpl.py -index 0fd5ba4..f177883 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -759,7 +759,7 @@ def image(defn, platform): - if test x$(TARGET_APPLE_LINKER) = x1; then \ - $(MACHO2IMG) $< $@; \ - else \ -- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .hash -R .dynsym -R .dynstr -R .rel.text $< $@; \ -+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ - fi - """) - -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index fddcc46..291f728 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -69,6 +69,7 @@ static grub_addr_t prot_mode_target; - static void *initrd_mem; - static grub_addr_t initrd_mem_target; - static grub_size_t prot_init_space; -+static grub_uint32_t initrd_pages; - static struct grub_relocator *relocator = NULL; - static void *efi_mmap_buf; - static grub_size_t maximal_cmdline_size; -@@ -1045,7 +1046,7 @@ static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { -- grub_size_t size = 0, aligned_size = 0; -+ grub_size_t size = 0; - grub_addr_t addr_min, addr_max; - grub_addr_t addr; - grub_err_t err; -@@ -1067,7 +1068,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - goto fail; - - size = grub_get_initrd_size (&initrd_ctx); -- aligned_size = ALIGN_UP (size, 4096); -+ -+ initrd_pages = (page_align (size) >> 12); - - /* Get the highest address available for the initrd. */ - if (grub_le_to_cpu16 (linux_params.version) >= 0x0203) -@@ -1095,7 +1097,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - addr_min = (grub_addr_t) prot_mode_target + prot_init_space; - - /* Put the initrd as high as possible, 4KiB aligned. */ -- addr = (addr_max - aligned_size) & ~0xFFF; -+ addr = (addr_max - size) & ~0xFFF; - - if (addr < addr_min) - { -@@ -1106,8 +1108,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_relocator_chunk_t ch; - err = grub_relocator_alloc_chunk_align (relocator, &ch, -- addr_min, addr, aligned_size, -- 0x1000, -+ addr_min, addr, size, 0x1000, - GRUB_RELOCATOR_PREFERENCE_HIGH, - 1); - if (err) -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index a63a11a..117232f 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -205,8 +205,7 @@ grub_initrd_init (int argc, char *argv[], - initrd_ctx->nfiles++; - initrd_ctx->components[i].size - = grub_file_size (initrd_ctx->components[i].file); -- if (argc != 1) -- initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); -+ initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); - } - - if (newc) --- -2.4.3 - diff --git a/0399-linux.c-Ensure-that-initrd-is-page-aligned.patch b/0399-linux.c-Ensure-that-initrd-is-page-aligned.patch deleted file mode 100644 index cdf3cc3..0000000 --- a/0399-linux.c-Ensure-that-initrd-is-page-aligned.patch +++ /dev/null @@ -1,62 +0,0 @@ -From e5b4ba8c2b2cfbb84e5b8254fb7d0b15b799fe78 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 7 May 2015 16:23:39 +0200 -Subject: [PATCH 399/506] linux.c: Ensure that initrd is page-aligned. - ---- - grub-core/loader/i386/linux.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 291f728..fddcc46 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -69,7 +69,6 @@ static grub_addr_t prot_mode_target; - static void *initrd_mem; - static grub_addr_t initrd_mem_target; - static grub_size_t prot_init_space; --static grub_uint32_t initrd_pages; - static struct grub_relocator *relocator = NULL; - static void *efi_mmap_buf; - static grub_size_t maximal_cmdline_size; -@@ -1046,7 +1045,7 @@ static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { -- grub_size_t size = 0; -+ grub_size_t size = 0, aligned_size = 0; - grub_addr_t addr_min, addr_max; - grub_addr_t addr; - grub_err_t err; -@@ -1068,8 +1067,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - goto fail; - - size = grub_get_initrd_size (&initrd_ctx); -- -- initrd_pages = (page_align (size) >> 12); -+ aligned_size = ALIGN_UP (size, 4096); - - /* Get the highest address available for the initrd. */ - if (grub_le_to_cpu16 (linux_params.version) >= 0x0203) -@@ -1097,7 +1095,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - addr_min = (grub_addr_t) prot_mode_target + prot_init_space; - - /* Put the initrd as high as possible, 4KiB aligned. */ -- addr = (addr_max - size) & ~0xFFF; -+ addr = (addr_max - aligned_size) & ~0xFFF; - - if (addr < addr_min) - { -@@ -1108,7 +1106,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_relocator_chunk_t ch; - err = grub_relocator_alloc_chunk_align (relocator, &ch, -- addr_min, addr, size, 0x1000, -+ addr_min, addr, aligned_size, -+ 0x1000, - GRUB_RELOCATOR_PREFERENCE_HIGH, - 1); - if (err) --- -2.4.3 - diff --git a/0400-grub-mkrescue-Recognize-output-as-an-alias-of-output.patch b/0400-grub-mkrescue-Recognize-output-as-an-alias-of-output.patch deleted file mode 100644 index 5777191..0000000 --- a/0400-grub-mkrescue-Recognize-output-as-an-alias-of-output.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 5fd1cb980af603126b82f421417f15326b0ca38d Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 7 May 2015 16:34:34 +0200 -Subject: [PATCH 400/506] grub-mkrescue: Recognize -output as an alias of - --output. - -This helps us to be in line with xorriso -as mkisofs. - -Suggested by: Thomas Schmitt ---- - util/grub-mkrescue.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 815fc91..5a7993f 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -451,6 +451,12 @@ main (int argc, char *argv[]) - int i; - for (i = 1; i < argc; i++) - { -+ if (strcmp (argv[i], "-output") == 0) { -+ argp_argv[argp_argc++] = "--output"; -+ i++; -+ argp_argv[argp_argc++] = argv[i]; -+ continue; -+ } - switch (args_to_eat (argv[i])) - { - case 2: --- -2.4.3 - diff --git a/0401-grub-install-common-Increase-buf-size-to-8192-as-mod.patch b/0401-grub-install-common-Increase-buf-size-to-8192-as-mod.patch deleted file mode 100644 index ece663e..0000000 --- a/0401-grub-install-common-Increase-buf-size-to-8192-as-mod.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9916ed6f82d12b203b61cbc6d6bb9c56af707c02 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 7 May 2015 17:09:58 +0200 -Subject: [PATCH 401/506] grub-install-common: Increase buf size to 8192 as - modinfo.sh is bigger. - ---- - util/grub-install-common.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 37c1a98..0364b32 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -902,7 +902,7 @@ grub_install_get_target (const char *src) - { - char *fn; - grub_util_fd_t f; -- char buf[2048]; -+ char buf[8192]; - ssize_t r; - char *c, *pl, *p; - size_t i; --- -2.4.3 - diff --git a/0402-i386-relocator-Remove-unused-extern-grub_relocator64.patch b/0402-i386-relocator-Remove-unused-extern-grub_relocator64.patch deleted file mode 100644 index 4589d1a..0000000 --- a/0402-i386-relocator-Remove-unused-extern-grub_relocator64.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 71783dc9780c1e1897a59ec3273e6259807f47eb Mon Sep 17 00:00:00 2001 -From: Daniel Kiper -Date: Thu, 7 May 2015 18:00:47 +0200 -Subject: [PATCH 402/506] i386/relocator: Remove unused extern - grub_relocator64_rip_addr - -Signed-off-by: Daniel Kiper ---- - grub-core/lib/i386/relocator.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c -index ffaf25f..71dd4f0 100644 ---- a/grub-core/lib/i386/relocator.c -+++ b/grub-core/lib/i386/relocator.c -@@ -64,7 +64,6 @@ extern grub_uint64_t grub_relocator64_rbx; - extern grub_uint64_t grub_relocator64_rcx; - extern grub_uint64_t grub_relocator64_rdx; - extern grub_uint64_t grub_relocator64_rip; --extern grub_uint64_t grub_relocator64_rip_addr; - extern grub_uint64_t grub_relocator64_rsp; - extern grub_uint64_t grub_relocator64_rsi; - extern grub_addr_t grub_relocator64_cr3; --- -2.4.3 - diff --git a/0403-loader-linux-do-not-pad-initrd-with-zeroes-at-the-en.patch b/0403-loader-linux-do-not-pad-initrd-with-zeroes-at-the-en.patch deleted file mode 100644 index 6601d9a..0000000 --- a/0403-loader-linux-do-not-pad-initrd-with-zeroes-at-the-en.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a8c473288d3f0a5e17a903a5121dea1a695dda3b Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 7 May 2015 20:24:24 +0300 -Subject: [PATCH 403/506] loader/linux: do not pad initrd with zeroes at the - end - -Syslinux memdisk is using initrd image and needs to know uncompressed -size in advance. For gzip uncompressed size is at the end of compressed -stream. Grub padded each input file to 4 bytes at the end, which means -syslinux got wrong size. - -Linux initramfs loader apparently does not care about trailing alignment. -So change code to align beginning of each file instead which atomatically -gives us the correct size for single file. - -Reported-By: David Shaw ---- - grub-core/loader/linux.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index 117232f..d2cd591 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -161,6 +161,9 @@ grub_initrd_init (int argc, char *argv[], - for (i = 0; i < argc; i++) - { - const char *fname = argv[i]; -+ -+ initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); -+ - if (grub_memcmp (argv[i], "newc:", 5) == 0) - { - const char *ptr, *eptr; -@@ -205,7 +208,7 @@ grub_initrd_init (int argc, char *argv[], - initrd_ctx->nfiles++; - initrd_ctx->components[i].size - = grub_file_size (initrd_ctx->components[i].file); -- initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); -+ initrd_ctx->size += initrd_ctx->components[i].size; - } - - if (newc) -@@ -248,10 +251,12 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, - int i; - int newc = 0; - struct dir *root = 0; -+ grub_ssize_t cursize = 0; - - for (i = 0; i < initrd_ctx->nfiles; i++) - { -- grub_ssize_t cursize; -+ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); -+ ptr += ALIGN_UP_OVERHEAD (cursize, 4); - - if (initrd_ctx->components[i].newc_name) - { -@@ -283,8 +288,6 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, - return grub_errno; - } - ptr += cursize; -- grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); -- ptr += ALIGN_UP_OVERHEAD (cursize, 4); - } - if (newc) - ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0); --- -2.4.3 - diff --git a/0404-convert-to-not-from-CPU-byte-order-in-DNS-receive-fu.patch b/0404-convert-to-not-from-CPU-byte-order-in-DNS-receive-fu.patch deleted file mode 100644 index 24cfa16..0000000 --- a/0404-convert-to-not-from-CPU-byte-order-in-DNS-receive-fu.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 16a7e723ea37d4596348a76f54a6675c6e03fedc Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 7 May 2015 20:33:28 +0300 -Subject: [PATCH 404/506] convert to, not from, CPU byte order in DNS receive - function - ---- - grub-core/net/dns.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c -index 0b771fb..9d0c8fc 100644 ---- a/grub-core/net/dns.c -+++ b/grub-core/net/dns.c -@@ -262,7 +262,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), - grub_netbuff_free (nb); - return GRUB_ERR_NONE; - } -- for (i = 0; i < grub_cpu_to_be16 (head->qdcount); i++) -+ for (i = 0; i < grub_be_to_cpu16 (head->qdcount); i++) - { - if (ptr >= nb->tail) - { -@@ -277,7 +277,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), - ptr += 4; - } - *data->addresses = grub_malloc (sizeof ((*data->addresses)[0]) -- * grub_cpu_to_be16 (head->ancount)); -+ * grub_be_to_cpu16 (head->ancount)); - if (!*data->addresses) - { - grub_errno = GRUB_ERR_NONE; -@@ -286,7 +286,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), - } - reparse_ptr = ptr; - reparse: -- for (i = 0, ptr = reparse_ptr; i < grub_cpu_to_be16 (head->ancount); i++) -+ for (i = 0, ptr = reparse_ptr; i < grub_be_to_cpu16 (head->ancount); i++) - { - int ignored = 0; - grub_uint8_t class; --- -2.4.3 - diff --git a/0405-efidisk-move-device-path-helpers-in-core-for-efinet.patch b/0405-efidisk-move-device-path-helpers-in-core-for-efinet.patch deleted file mode 100644 index 20e8363..0000000 --- a/0405-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 405/506] 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.4.3 - diff --git a/0406-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch b/0406-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch deleted file mode 100644 index 59288c5..0000000 --- a/0406-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 406/506] 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.4.3 - diff --git a/0407-efinet-open-Simple-Network-Protocol-exclusively.patch b/0407-efinet-open-Simple-Network-Protocol-exclusively.patch deleted file mode 100644 index fbeff65..0000000 --- a/0407-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 407/506] 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.4.3 - diff --git a/0408-util-grub-mkrescue-Fix-compilation.patch b/0408-util-grub-mkrescue-Fix-compilation.patch deleted file mode 100644 index fb56af7..0000000 --- a/0408-util-grub-mkrescue-Fix-compilation.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2dcf260d899f65cd84e4f676e03d76f51ae01736 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Thu, 7 May 2015 19:45:06 +0200 -Subject: [PATCH 408/506] util/grub-mkrescue: Fix compilation - ---- - util/grub-mkrescue.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 5a7993f..4511826 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -452,7 +452,7 @@ main (int argc, char *argv[]) - for (i = 1; i < argc; i++) - { - if (strcmp (argv[i], "-output") == 0) { -- argp_argv[argp_argc++] = "--output"; -+ argp_argv[argp_argc++] = (char *) "--output"; - i++; - argp_argv[argp_argc++] = argv[i]; - continue; --- -2.4.3 - diff --git a/0409-Add-asm-tests-to-tarball.patch b/0409-Add-asm-tests-to-tarball.patch deleted file mode 100644 index 5c33685..0000000 --- a/0409-Add-asm-tests-to-tarball.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 6a5c78c8c85c890034974a297bfb009dff0954c6 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 7 May 2015 22:13:34 +0300 -Subject: [PATCH 409/506] Add asm-tests to tarball - ---- - conf/Makefile.extra-dist | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index db6cfd1..ea6b9df 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -5,6 +5,7 @@ EXTRA_DIST += gentpl.py - EXTRA_DIST += Makefile.util.def - EXTRA_DIST += Makefile.utilgcry.def - -+EXTRA_DIST += asm-tests - EXTRA_DIST += unicode - - EXTRA_DIST += util/import_gcry.py --- -2.4.3 - diff --git a/0410-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch b/0410-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch deleted file mode 100644 index dbd47cb..0000000 --- a/0410-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch +++ /dev/null @@ -1,83 +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 410/506] 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(-) - -diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c -index 05a6dca..c3861f5 100644 ---- a/grub-core/commands/acpi.c -+++ b/grub-core/commands/acpi.c -@@ -180,8 +180,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; -@@ -495,6 +497,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) - if (! rsdp) - rsdp = grub_machine_acpi_get_rsdpv1 (); - -+ grub_dprintf ("acpi", "RSDP @%p\n", rsdp); -+ - if (rsdp) - { - grub_uint32_t *entry_ptr; -diff --git a/grub-core/commands/i386/pc/acpi.c b/grub-core/commands/i386/pc/acpi.c -index d415d23..297f5d0 100644 ---- a/grub-core/commands/i386/pc/acpi.c -+++ b/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) --- -2.4.3 - diff --git a/0411-xfs-Fix-termination-loop-for-directory-iteration.patch b/0411-xfs-Fix-termination-loop-for-directory-iteration.patch deleted file mode 100644 index f326325..0000000 --- a/0411-xfs-Fix-termination-loop-for-directory-iteration.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1570140f0362d9936f97a014a9fa5cecbca54f07 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Mon, 14 Jul 2014 17:21:29 +0200 -Subject: [PATCH 411/506] 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 16ffd3f..4bd52d1 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -603,8 +603,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; --- -2.4.3 - diff --git a/0412-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch b/0412-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch deleted file mode 100644 index cabb02a..0000000 --- a/0412-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch +++ /dev/null @@ -1,82 +0,0 @@ -From a139188eb559ee23f51540948ec84ef5948fb2d1 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Mon, 14 Jul 2014 17:21:30 +0200 -Subject: [PATCH 412/506] 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 4bd52d1..0d704e9 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 -@@ -506,13 +506,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 `..'. */ -@@ -545,7 +544,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'; -@@ -627,7 +625,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; -@@ -689,7 +688,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); --- -2.4.3 - diff --git a/0413-remove-extra-newlines-in-grub_util_-strings.patch b/0413-remove-extra-newlines-in-grub_util_-strings.patch deleted file mode 100644 index 2312c4a..0000000 --- a/0413-remove-extra-newlines-in-grub_util_-strings.patch +++ /dev/null @@ -1,323 +0,0 @@ -From 5082ea618439fe59956d071777be0c9c74fbbcf5 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 13 May 2015 09:47:17 +0300 -Subject: [PATCH 413/506] remove extra newlines in grub_util_* strings - -grub_util_{info,warn,error} already add trailing newlines, so remove -them from format strings. Also trailing full stops are already added. ---- - grub-core/bus/emu/pci.c | 2 +- - grub-core/disk/lvm.c | 40 ++++++++++++++++++++-------------------- - grub-core/osdep/linux/ofpath.c | 2 +- - util/grub-install-common.c | 2 +- - util/grub-install.c | 6 +++--- - util/grub-mknetdir.c | 2 +- - util/grub-pe2elf.c | 2 +- - util/mkimage.c | 4 ++-- - 8 files changed, 30 insertions(+), 30 deletions(-) - -diff --git a/grub-core/bus/emu/pci.c b/grub-core/bus/emu/pci.c -index 663e554..267f262 100644 ---- a/grub-core/bus/emu/pci.c -+++ b/grub-core/bus/emu/pci.c -@@ -55,7 +55,7 @@ grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base, - int err; - err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr); - if (err) -- grub_util_error ("mapping 0x%llx failed (error %d)\n", -+ grub_util_error ("mapping 0x%llx failed (error %d)", - (unsigned long long) base, err); - return addr; - } -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 9b97004..7b265c7 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -160,7 +160,7 @@ grub_lvm_detect (grub_disk_t disk, - "we don't support multiple LVM data areas"); - - #ifdef GRUB_UTIL -- grub_util_info ("we don't support multiple LVM data areas\n"); -+ grub_util_info ("we don't support multiple LVM data areas"); - #endif - goto fail; - } -@@ -189,7 +189,7 @@ grub_lvm_detect (grub_disk_t disk, - grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "unknown LVM metadata header"); - #ifdef GRUB_UTIL -- grub_util_info ("unknown LVM metadata header\n"); -+ grub_util_info ("unknown LVM metadata header"); - #endif - goto fail2; - } -@@ -213,7 +213,7 @@ grub_lvm_detect (grub_disk_t disk, - if (q == metadatabuf + mda_size) - { - #ifdef GRUB_UTIL -- grub_util_info ("error parsing metadata\n"); -+ grub_util_info ("error parsing metadata"); - #endif - goto fail2; - } -@@ -230,7 +230,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("couldn't find ID\n"); -+ grub_util_info ("couldn't find ID"); - #endif - goto fail3; - } -@@ -258,7 +258,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown extent size\n"); -+ grub_util_info ("unknown extent size"); - #endif - goto fail4; - } -@@ -306,7 +306,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown pe_start\n"); -+ grub_util_info ("unknown pe_start"); - #endif - goto pvs_fail; - } -@@ -315,7 +315,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("error parsing pe_start\n"); -+ grub_util_info ("error parsing pe_start"); - #endif - goto pvs_fail; - } -@@ -402,7 +402,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("couldn't find ID\n"); -+ grub_util_info ("couldn't find ID"); - #endif - goto lvs_fail; - } -@@ -422,7 +422,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown segment_count\n"); -+ grub_util_info ("unknown segment_count"); - #endif - goto lvs_fail; - } -@@ -436,7 +436,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown segment\n"); -+ grub_util_info ("unknown segment"); - #endif - goto lvs_segment_fail; - } -@@ -445,7 +445,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown start_extent\n"); -+ grub_util_info ("unknown start_extent"); - #endif - goto lvs_segment_fail; - } -@@ -453,7 +453,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown extent_count\n"); -+ grub_util_info ("unknown extent_count"); - #endif - goto lvs_segment_fail; - } -@@ -475,7 +475,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown stripe_count\n"); -+ grub_util_info ("unknown stripe_count"); - #endif - goto lvs_segment_fail; - } -@@ -491,7 +491,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown stripes\n"); -+ grub_util_info ("unknown stripes"); - #endif - goto lvs_segment_fail2; - } -@@ -533,7 +533,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown mirror_count\n"); -+ grub_util_info ("unknown mirror_count"); - #endif - goto lvs_segment_fail; - } -@@ -545,7 +545,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown mirrors\n"); -+ grub_util_info ("unknown mirrors"); - #endif - goto lvs_segment_fail2; - } -@@ -607,7 +607,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown device_count\n"); -+ grub_util_info ("unknown device_count"); - #endif - goto lvs_segment_fail; - } -@@ -618,7 +618,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown stripe_size\n"); -+ grub_util_info ("unknown stripe_size"); - #endif - goto lvs_segment_fail; - } -@@ -631,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk, - if (p == NULL) - { - #ifdef GRUB_UTIL -- grub_util_info ("unknown raids\n"); -+ grub_util_info ("unknown raids"); - #endif - goto lvs_segment_fail2; - } -@@ -678,7 +678,7 @@ grub_lvm_detect (grub_disk_t disk, - p2 = grub_strchr (p, '"'); - if (p2) - *p2 = 0; -- grub_util_info ("unknown LVM type %s\n", p); -+ grub_util_info ("unknown LVM type %s", p); - if (p2) - *p2 ='"'; - #endif -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 05b1ecd..a79682a 100644 ---- a/grub-core/osdep/linux/ofpath.c -+++ b/grub-core/osdep/linux/ofpath.c -@@ -539,7 +539,7 @@ grub_util_devname_to_ofpath (const char *sys_devname) - ofpath = xstrdup ("floppy"); - else - { -- grub_util_warn (_("unknown device type %s\n"), device); -+ grub_util_warn (_("unknown device type %s"), device); - ofpath = NULL; - } - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 0364b32..2598308 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -494,7 +494,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - - tgt = grub_install_get_image_target (mkimage_target); - if (!tgt) -- grub_util_error (_("unknown target format %s\n"), mkimage_target); -+ grub_util_error (_("unknown target format %s"), mkimage_target); - - grub_install_generate_image (dir, prefix, fp, outname, - modules.entries, memdisk_path, -diff --git a/util/grub-install.c b/util/grub-install.c -index 7b394c9..5662726 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -773,7 +773,7 @@ bless (grub_device_t dev, const char *path, int x86) - err = grub_mac_bless_inode (dev, st.st_ino, S_ISDIR (st.st_mode), x86); - if (err) - grub_util_error ("%s", grub_errmsg); -- grub_util_info ("blessed\n"); -+ grub_util_info ("blessed"); - } - - static void -@@ -1070,7 +1070,7 @@ main (int argc, char *argv[]) - efidir_is_mac = 1; - - if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0) -- grub_util_error (_("%s doesn't look like an EFI partition.\n"), efidir); -+ grub_util_error (_("%s doesn't look like an EFI partition"), efidir); - - /* The EFI specification requires that an EFI System Partition must - contain an "EFI" subdirectory, and that OS loaders are stored in -@@ -1271,7 +1271,7 @@ main (int argc, char *argv[]) - - if (!config.is_cryptodisk_enabled && have_cryptodisk) - grub_util_error (_("attempt to install to encrypted disk without cryptodisk enabled. " -- "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=y", -+ "Set `%s' in file `%s'"), "GRUB_ENABLE_CRYPTODISK=y", - grub_util_get_config_filename ()); - - if (disk_module && grub_strcmp (disk_module, "ata") == 0) -diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index 8366a11..3813e8b 100644 ---- a/util/grub-mknetdir.c -+++ b/util/grub-mknetdir.c -@@ -140,7 +140,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) - - prefix = xasprintf ("/%s", subdir); - if (!targets[platform].mkimage_target) -- grub_util_error (_("unsupported platform %s\n"), platsub); -+ grub_util_error (_("unsupported platform %s"), platsub); - - grub_cfg = grub_util_path_concat (2, grubdir, "grub.cfg"); - cfg = grub_util_fopen (grub_cfg, "wb"); -diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c -index f4abf70..0d4084a 100644 ---- a/util/grub-pe2elf.c -+++ b/util/grub-pe2elf.c -@@ -279,7 +279,7 @@ write_reloc_section (FILE* fp, const char *name, char *image, - break; - #endif - default: -- grub_util_error ("unknown pe relocation type %d\n", pe_rel->type); -+ grub_util_error ("unknown pe relocation type %d", pe_rel->type); - } - - if (type == -diff --git a/util/mkimage.c b/util/mkimage.c -index 52265b5..35df998 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -823,7 +823,7 @@ compress_kernel (const struct grub_install_image_target_desc *image_target, char - - if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS - && (comp != GRUB_COMPRESSION_NONE)) -- grub_util_error (_("unknown compression %d\n"), comp); -+ grub_util_error (_("unknown compression %d"), comp); - - *core_img = xmalloc (kernel_size); - memcpy (*core_img, kernel_img, kernel_size); -@@ -1234,7 +1234,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - name = "none_decompress.img"; - break; - default: -- grub_util_error (_("unknown compression %d\n"), comp); -+ grub_util_error (_("unknown compression %d"), comp); - } - - decompress_path = grub_util_get_path (dir, name); --- -2.4.3 - diff --git a/0414-zfs-fix-integer-truncation-in-zap_lookup.patch b/0414-zfs-fix-integer-truncation-in-zap_lookup.patch deleted file mode 100644 index 734a1fa..0000000 --- a/0414-zfs-fix-integer-truncation-in-zap_lookup.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 5370dcfdae66b60cff3507ad925300a679fe4117 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Thu, 14 May 2015 07:50:33 +0300 -Subject: [PATCH 414/506] zfs: fix integer truncation in zap_lookup - -Size after shift could exceed 16 bits; use grub_unit32_t for result. - -Reported and tested by: Kostya Berger -Closes: 44448 ---- - grub-core/fs/zfs/zfs.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 08ed453..aac6f28 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -2071,10 +2071,10 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, - */ - static grub_err_t - mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian, -- grub_uint16_t objsize, const char *name, grub_uint64_t * value, -+ grub_uint32_t objsize, const char *name, grub_uint64_t * value, - int case_insensitive) - { -- grub_uint16_t i, chunks; -+ grub_uint32_t i, chunks; - mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; - - if (objsize < MZAP_ENT_LEN) -@@ -2486,7 +2486,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, - struct grub_zfs_data *data, int case_insensitive) - { - grub_uint64_t block_type; -- grub_uint16_t size; -+ grub_uint32_t size; - void *zapbuf; - grub_err_t err; - grub_zfs_endian_t endian; -@@ -2494,7 +2494,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, - grub_dprintf ("zfs", "looking for '%s'\n", name); - - /* Read in the first block of the zap object data. */ -- size = grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, -+ size = (grub_uint32_t) grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, - zap_dnode->endian) << SPA_MINBLOCKSHIFT; - err = dmu_read (zap_dnode, 0, &zapbuf, &endian, data); - if (err) --- -2.4.3 - diff --git a/0415-hostdisk-fix-crash-with-NULL-device.map.patch b/0415-hostdisk-fix-crash-with-NULL-device.map.patch deleted file mode 100644 index 87ba18b..0000000 --- a/0415-hostdisk-fix-crash-with-NULL-device.map.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2498dc7a3aee638215ad47899031496b50633d55 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 17 May 2015 14:16:36 +0300 -Subject: [PATCH 415/506] hostdisk: fix crash with NULL device.map - -grub-macbless calls grub_util_biosdisk_init with NULL device.map. ---- - grub-core/kern/emu/hostdisk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c -index a3b00c8..610518d 100644 ---- a/grub-core/kern/emu/hostdisk.c -+++ b/grub-core/kern/emu/hostdisk.c -@@ -422,7 +422,7 @@ read_device_map (const char *dev_map) - char buf[1024]; /* XXX */ - int lineno = 0; - -- if (dev_map[0] == '\0') -+ if (!dev_map || dev_map[0] == '\0') - { - grub_util_info ("no device.map"); - return; --- -2.4.3 - diff --git a/0416-bootp-ignore-gateway_ip-relay-field.patch b/0416-bootp-ignore-gateway_ip-relay-field.patch deleted file mode 100644 index 795850b..0000000 --- a/0416-bootp-ignore-gateway_ip-relay-field.patch +++ /dev/null @@ -1,75 +0,0 @@ -From a666c8bd18aee7bf1b202b6b8c0ffe953bd2c1b6 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sun, 17 May 2015 22:38:30 +0300 -Subject: [PATCH 416/506] bootp: ignore gateway_ip (relay) field. - -From RFC1542: - - The 'giaddr' field is rather poorly named. It exists to facilitate - the transfer of BOOTREQUEST messages from a client, through BOOTP - relay agents, to servers on different networks than the client. - Similarly, it facilitates the delivery of BOOTREPLY messages from the - servers, through BOOTP relay agents, back to the client. In no case - does it represent a general IP router to be used by the client. A - BOOTP client MUST set the 'giaddr' field to zero (0.0.0.0) in all - BOOTREQUEST messages it generates. - - A BOOTP client MUST NOT interpret the 'giaddr' field of a BOOTREPLY - message to be the IP address of an IP router. A BOOTP client SHOULD - completely ignore the contents of the 'giaddr' field in BOOTREPLY - messages. - -Leave code ifdef'd out for the time being in case we see regression. - -Suggested by: Rink Springer -Closes: 43396 ---- - docs/grub.texi | 6 ++++-- - grub-core/net/bootp.c | 7 +++++++ - 2 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 4af22af..88bd75f 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -5162,8 +5162,10 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}). - Perform configuration of @var{card} using DHCP protocol. If no card name - is specified, try to configure all existing cards. If configuration was - successful, interface with name @var{card}@samp{:dhcp} and configured --address is added to @var{card}. If server provided gateway information in --DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. Additionally the following DHCP options are recognized and processed: -+address is added to @var{card}. -+@comment If server provided gateway information in -+@comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. -+Additionally the following DHCP options are recognized and processed: - - @table @samp - @item 1 (Subnet Mask) -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 6136755..4fdeac3 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -157,6 +157,12 @@ grub_net_configure_by_dhcp_ack (const char *name, - hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - - inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags); -+#if 0 -+ /* This is likely based on misunderstanding. gateway_ip refers to -+ address of BOOTP relay and should not be used after BOOTP transaction -+ is complete. -+ See RFC1542, 3.4 Interpretation of the 'giaddr' field -+ */ - if (bp->gateway_ip) - { - grub_net_network_level_netaddress_t target; -@@ -178,6 +184,7 @@ grub_net_configure_by_dhcp_ack (const char *name, - target.ipv4.masksize = 32; - grub_net_add_route (name, target, inter); - } -+#endif - - if (size > OFFSET_OF (boot_file, bp)) - grub_env_set_net_property (name, "boot_file", bp->boot_file, --- -2.4.3 - diff --git a/0417-cb_timestamps.c-Add-new-time-stamp-descriptions.patch b/0417-cb_timestamps.c-Add-new-time-stamp-descriptions.patch deleted file mode 100644 index c46b47c..0000000 --- a/0417-cb_timestamps.c-Add-new-time-stamp-descriptions.patch +++ /dev/null @@ -1,45 +0,0 @@ -From f4e62af000116de93f0c9d1c5f8aaf40934d5a01 Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Fri, 15 May 2015 17:35:00 +0200 -Subject: [PATCH 417/506] cb_timestamps.c: Add new time stamp descriptions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add the descriptions of the “coreâ€, that means no vendorcode or payload, -coreboot time stamps added up to coreboot commit a7d92441 (timestamps: -You can never have enough of them!) [1]. - -Running `coreboot_boottime` in the GRUB command line interface now shows -descriptions for all time stamps again on the ASRock E350M1. - -[1] http://review.coreboot.org/9608 ---- - grub-core/commands/i386/coreboot/cb_timestamps.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/grub-core/commands/i386/coreboot/cb_timestamps.c b/grub-core/commands/i386/coreboot/cb_timestamps.c -index 07fbb02..e72f38d 100644 ---- a/grub-core/commands/i386/coreboot/cb_timestamps.c -+++ b/grub-core/commands/i386/coreboot/cb_timestamps.c -@@ -39,9 +39,17 @@ static const char *descs[] = { - [2] = "before RAM init", - [3] = "after RAM init", - [4] = "end of romstage", -+ [5] = "start of verified boot", -+ [6] = "end of verified boot", - [8] = "start of RAM copy", - [9] = "end of RAM copy", - [10] = "start of ramstage", -+ [11] = "start of bootblock", -+ [12] = "end of bootblock", -+ [13] = "starting to load romstage", -+ [14] = "finished loading romstage", -+ [15] = "starting LZMA decompress (ignore for x86)", -+ [16] = "finished LZMA decompress (ignore for x86)", - [30] = "device enumerate", - [40] = "device configure", - [50] = "device enable", --- -2.4.3 - diff --git a/0418-disk-ahci-Use-defines-GRUB_ATA_STATUS_BUSY-and-GRUB_.patch b/0418-disk-ahci-Use-defines-GRUB_ATA_STATUS_BUSY-and-GRUB_.patch deleted file mode 100644 index 9de38b3..0000000 --- a/0418-disk-ahci-Use-defines-GRUB_ATA_STATUS_BUSY-and-GRUB_.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5e74a3e6dfc4e5992c423bf740a4b3604030b007 Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Sun, 24 May 2015 11:11:25 +0200 -Subject: [PATCH 418/506] disk/ahci: Use defines `GRUB_ATA_STATUS_BUSY` and - `GRUB_ATA_STATUS_DRQ` - -Instead of hard coding `0x88` use the macros defined in `disk/ata.h`. ---- - grub-core/disk/ahci.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index d6bdbdd..7f75724 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -565,14 +565,14 @@ grub_ahci_pciinit (grub_pci_device_t dev, - while (grub_get_time_ms () < endtime) - { - for (i = 0; i < nports; i++) -- if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) -+ if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ))) - break; - if (i == nports) - break; - } - - for (i = 0; i < nports; i++) -- if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) -+ if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ))) - { - grub_dprintf ("ahci", "port %d is busy\n", i); - failed_adevs[i] = adevs[i]; --- -2.4.3 - diff --git a/0419-multiboot1-never-place-modules-in-low-memory.patch b/0419-multiboot1-never-place-modules-in-low-memory.patch deleted file mode 100644 index 077196c..0000000 --- a/0419-multiboot1-never-place-modules-in-low-memory.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c856be6bca6f963a9a2c91eda954ab687bc7e573 Mon Sep 17 00:00:00 2001 -From: Vladimir Serbinenko -Date: Wed, 27 May 2015 08:37:55 +0200 -Subject: [PATCH 419/506] multiboot1: never place modules in low memory. - -While in theory permitted by the spec, modules rarely fit in low memory -anyway and not every kernel is able to handle modules in low memory anyway. -At least VMWare is known not to be able to handle modules at arbitrary -locations. ---- - grub-core/loader/multiboot.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 4b71f33..fd8f28e 100644 ---- a/grub-core/loader/multiboot.c -+++ b/grub-core/loader/multiboot.c -@@ -333,6 +333,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - return grub_errno; - - #ifndef GRUB_USE_MULTIBOOT2 -+ lowest_addr = 0x100000; - if (grub_multiboot_quirks & GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL) - lowest_addr = ALIGN_UP (highest_load + 1048576, 4096); - #endif --- -2.4.3 - diff --git a/0420-zfs-extensible_dataset-and-large_blocks-feature-supp.patch b/0420-zfs-extensible_dataset-and-large_blocks-feature-supp.patch deleted file mode 100644 index 0f1aad0..0000000 --- a/0420-zfs-extensible_dataset-and-large_blocks-feature-supp.patch +++ /dev/null @@ -1,88 +0,0 @@ -From cad5cc0f5d3d3630ccfbe242552958b13f2120d6 Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Thu, 16 Apr 2015 08:24:38 +0300 -Subject: [PATCH 420/506] zfs extensible_dataset and large_blocks feature - support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -large blocks basically use extensible dataset feature, or to be exact, -setting recordsize above 128k will trigger large_block feature to be -enabled and storing such blocks is using feature extensible dataset. so -the extensible dataset is prerequisite. - -Changes implement read support extensible dataset… instead of fixed DMU -types they dont specify type, making it possible to use fat zap objects -from bonus area. ---- - grub-core/fs/zfs/zfs.c | 18 +++++++++++------- - 1 file changed, 11 insertions(+), 7 deletions(-) - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index aac6f28..f9ca0e7 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -283,6 +283,8 @@ static const char *spa_feature_names[] = { - "org.illumos:lz4_compress", - "com.delphix:hole_birth", - "com.delphix:embedded_data", -+ "com.delphix:extensible_dataset", -+ "org.open-zfs:large_blocks", - NULL - }; - -@@ -3080,7 +3082,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, - - grub_dprintf ("zfs", "alive\n"); - -- err = dnode_get (mosmdn, objnum, DMU_OT_DSL_DIR, mdn, data); -+ err = dnode_get (mosmdn, objnum, 0, mdn, data); - if (err) - return err; - -@@ -3113,7 +3115,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, - if (err) - return err; - -- err = dnode_get (mosmdn, objnum, DMU_OT_DSL_DIR, mdn, data); -+ err = dnode_get (mosmdn, objnum, 0, mdn, data); - if (err) - return err; - -@@ -3268,8 +3270,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, - - grub_dprintf ("zfs", "endian = %d\n", subvol->mdn.endian); - -- err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &subvol->mdn, -- data); -+ err = dnode_get (&(data->mos), headobj, 0, &subvol->mdn, data); - if (err) - { - grub_free (fsname); -@@ -3665,8 +3666,11 @@ zfs_mount (grub_device_t dev) - if (ub->ub_version >= SPA_VERSION_FEATURES && - check_mos_features(&((objset_phys_t *) osp)->os_meta_dnode,ub_endian, - data) != 0) -- return NULL; -- -+ { -+ grub_error (GRUB_ERR_BAD_FS, "Unsupported features in pool"); -+ return NULL; -+ } -+ - /* Got the MOS. Save it at the memory addr MOS. */ - grub_memmove (&(data->mos.dn), &((objset_phys_t *) osp)->os_meta_dnode, - DNODE_SIZE); -@@ -3963,7 +3967,7 @@ fill_fs_info (struct grub_dirhook_info *info, - { - headobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&mdn.dn))->dd_head_dataset_obj, mdn.endian); - -- err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &mdn, data); -+ err = dnode_get (&(data->mos), headobj, 0, &mdn, data); - if (err) - { - grub_dprintf ("zfs", "failed here\n"); --- -2.4.3 - diff --git a/0421-Correct-spelling-of-scheduled.patch b/0421-Correct-spelling-of-scheduled.patch deleted file mode 100644 index b3a97f8..0000000 --- a/0421-Correct-spelling-of-scheduled.patch +++ /dev/null @@ -1,46 +0,0 @@ -From fd73b3d00881abae3daf820fe0009434edf2e3d4 Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Sun, 24 May 2015 23:27:46 +0200 -Subject: [PATCH 421/506] Correct spelling of *scheduled* - -Run the command below - - $ git grep -l schedulded | xargs sed -i 's/schedulded/scheduled/g' - -and revert the change in `ChangeLog-2015`. - -Including "miscellaneous" spelling fix noted by richardvoigt@gmail.com ---- - gentpl.py | 2 +- - grub-core/disk/ahci.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gentpl.py b/gentpl.py -index f177883..37b1f45 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -82,7 +82,7 @@ GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"] - GROUPS["no_softdiv"] = GRUB_PLATFORMS[:] - for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i) - --# Miscelaneous groups schedulded to disappear in future -+# Miscellaneous groups scheduled to disappear in future - GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"] - GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 7f75724..4e8619c 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -1002,7 +1002,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - if (parms->write) - grub_memcpy ((char *) grub_dma_get_virt (bufc), parms->buffer, parms->size); - -- grub_dprintf ("ahci", "AHCI command schedulded\n"); -+ grub_dprintf ("ahci", "AHCI command scheduled\n"); - grub_dprintf ("ahci", "AHCI tfd = %x\n", - dev->hba->ports[dev->port].task_file_data); - grub_dprintf ("ahci", "AHCI inten = %x\n", --- -2.4.3 - diff --git a/0422-Clarify-use-of-superusers-variable-and-menu-entry-ac.patch b/0422-Clarify-use-of-superusers-variable-and-menu-entry-ac.patch deleted file mode 100644 index 62e7ce3..0000000 --- a/0422-Clarify-use-of-superusers-variable-and-menu-entry-ac.patch +++ /dev/null @@ -1,38 +0,0 @@ -From dec7718878f8a4566cd2894ab8970e1bec19dbb9 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Sat, 30 May 2015 19:36:41 +0300 -Subject: [PATCH 422/506] Clarify use of superusers variable and menu entry - access - -superusers controls both CLI and editing. Also explicitly mention that -empty superusers disables them. - -"Access to menuentry" is a bit vague - change to "execute menuentry" -to make it obvious, what access is granted. ---- - docs/grub.texi | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 88bd75f..b9f41a7 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -5428,10 +5428,12 @@ In order to enable authentication support, the @samp{superusers} environment - variable must be set to a list of usernames, separated by any of spaces, - commas, semicolons, pipes, or ampersands. Superusers are permitted to use - the GRUB command line, edit menu entries, and execute any menu entry. If --@samp{superusers} is set, then use of the command line is automatically --restricted to superusers. -+@samp{superusers} is set, then use of the command line and editing of menu -+entries are automatically restricted to superusers. Setting @samp{superusers} -+to empty string effectively disables both access to CLI and editing of menu -+entries. - --Other users may be given access to specific menu entries by giving a list of -+Other users may be allowed to execute specific menu entries by giving a list of - usernames (as above) using the @option{--users} option to the - @samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted} - option is used for a menu entry, then that entry is unrestricted. --- -2.4.3 - diff --git a/0423-disk-ahci.c-Add-port-number-to-port-debug-messages.patch b/0423-disk-ahci.c-Add-port-number-to-port-debug-messages.patch deleted file mode 100644 index 291d40a..0000000 --- a/0423-disk-ahci.c-Add-port-number-to-port-debug-messages.patch +++ /dev/null @@ -1,103 +0,0 @@ -From ca59c24bd0e2a90db764065e24829775aa2b363c Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Wed, 27 May 2015 22:48:57 +0200 -Subject: [PATCH 423/506] disk/ahci.c: Add port number to port debug messages - -Currently, some messages cannot be mapped to the port they belong to as -the port number is missing from the output. So add `port: n` to the -debug messages. ---- - grub-core/disk/ahci.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 4e8619c..da5fead 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -355,7 +355,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - if (adevs[i]) - { - adevs[i]->hba->ports[adevs[i]->port].sata_error = adevs[i]->hba->ports[adevs[i]->port].sata_error; -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32); -@@ -440,7 +440,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - adevs[i]->hba->ports[adevs[i]->port].intstatus = ~0; - // adevs[i]->hba->ports[adevs[i]->port].fbs = 0; - -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->rfis = grub_memalign_dma32 (4096, -@@ -480,7 +480,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - for (i = 0; i < nports; i++) - if (adevs[i]) - { -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - fr_running |= (1 << i); - -@@ -488,7 +488,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, - adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; - adevs[i]->hba->ports[adevs[i]->port].command |= 1 << 28; - -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - } - -@@ -515,26 +515,26 @@ grub_ahci_pciinit (grub_pci_device_t dev, - for (i = 0; i < nports; i++) - if (adevs[i]) - { -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; - adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_SPIN_UP; - -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->hba->ports[adevs[i]->port].sata_error = ~0; -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - -- grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", -+ grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port, - (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - - (char *) adevs[i]->hba), - adevs[i]->hba->ports[adevs[i]->port].task_file_data, - adevs[i]->hba->ports[adevs[i]->port].command); - -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - } - -@@ -542,13 +542,13 @@ grub_ahci_pciinit (grub_pci_device_t dev, - for (i = 0; i < nports; i++) - if (adevs[i]) - { -- grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", -+ grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port, - (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - - (char *) adevs[i]->hba), - adevs[i]->hba->ports[adevs[i]->port].task_file_data, - adevs[i]->hba->ports[adevs[i]->port].command); - -- grub_dprintf ("ahci", "err: %x\n", -+ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->hba->ports[adevs[i]->port].command --- -2.4.3 - diff --git a/0424-arm64-setjmp-Add-missing-license-macro.patch b/0424-arm64-setjmp-Add-missing-license-macro.patch deleted file mode 100644 index dbdac74..0000000 --- a/0424-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 424/506] 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.3 - diff --git a/0425-configure.ac-clean-up-arm64-soft-float-handling.patch b/0425-configure.ac-clean-up-arm64-soft-float-handling.patch deleted file mode 100644 index 38c85bd..0000000 --- a/0425-configure.ac-clean-up-arm64-soft-float-handling.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 43d4231432838821cabe4f6aea4f0f50e87af9c4 Mon Sep 17 00:00:00 2001 -From: Leif Lindholm -Date: Tue, 2 Jun 2015 15:41:09 +0100 -Subject: [PATCH 425/506] configure.ac: clean up arm64 soft-float handling - -Fix compilation with gcc 5.1 (avoid internal compiler error), by -replacing explicit -march +nofp+nosimd options with -mgeneral-regs-only. - -This also enables the removal of some further conditional build flag -setting. ---- - configure.ac | 14 +++----------- - 1 file changed, 3 insertions(+), 11 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 891c14f..fd8a62e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -686,9 +686,9 @@ if test x"$platform" != xemu ; then - AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ - grub_cv_target_cc_soft_float=no - if test "x$target_cpu" = xarm64; then -- CFLAGS="$TARGET_CFLAGS -march=armv8-a+nofp+nosimd -Werror" -+ CFLAGS="$TARGET_CFLAGS -mgeneral-regs-only -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -- [grub_cv_target_cc_soft_float="-march=armv8-a+nofp+nosimd"], []) -+ [grub_cv_target_cc_soft_float="-mgeneral-regs-only"], []) - fi - if test "x$target_cpu" = xia64; then - CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror" -@@ -720,15 +720,7 @@ if test x"$platform" != xemu ; then - TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float" - ;; - esac -- case x"$grub_cv_target_cc_soft_float" in -- x"-march=armv8-a+nofp+nosimd") -- # +nosimd disables also the cache opcodes that we need in asm. -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -march=armv8-a+nofp" -- ;; -- *) -- TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" -- ;; -- esac -+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" - - fi - --- -2.4.3 - diff --git a/0426-multiboot_header_tag_module_align-fix-to-confirm-mul.patch b/0426-multiboot_header_tag_module_align-fix-to-confirm-mul.patch deleted file mode 100644 index 2df3849..0000000 --- a/0426-multiboot_header_tag_module_align-fix-to-confirm-mul.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 697eceff6a168e8712fb7b784b333e0aeb925958 Mon Sep 17 00:00:00 2001 -From: Toomas Soome -Date: Thu, 4 Jun 2015 19:41:54 +0300 -Subject: [PATCH 426/506] multiboot_header_tag_module_align fix to confirm - multiboot specification - ---- - include/multiboot2.h | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/include/multiboot2.h b/include/multiboot2.h -index 3ccff15..9d48627 100644 ---- a/include/multiboot2.h -+++ b/include/multiboot2.h -@@ -156,9 +156,6 @@ struct multiboot_header_tag_module_align - multiboot_uint16_t type; - multiboot_uint16_t flags; - multiboot_uint32_t size; -- multiboot_uint32_t width; -- multiboot_uint32_t height; -- multiboot_uint32_t depth; - }; - - struct multiboot_color --- -2.4.3 - diff --git a/0427-xfs-Add-helpers-for-inode-size.patch b/0427-xfs-Add-helpers-for-inode-size.patch deleted file mode 100644 index 21dd28e..0000000 --- a/0427-xfs-Add-helpers-for-inode-size.patch +++ /dev/null @@ -1,97 +0,0 @@ -From d3ffeb9a9a54148af610cd122028783217d30699 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Mon, 1 Jun 2015 14:28:45 +0200 -Subject: [PATCH 427/506] xfs: Add helpers for inode size - -Add helpers to return size of XFS inode on disk and when loaded in -memory. - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 35 ++++++++++++++++++++++++----------- - 1 file changed, 24 insertions(+), 11 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 0d704e9..26d8147 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -255,6 +255,24 @@ grub_xfs_inode_offset (struct grub_xfs_data *data, - data->sblock.log2_inode); - } - -+static inline grub_size_t -+grub_xfs_inode_size(struct grub_xfs_data *data) -+{ -+ return 1 << data->sblock.log2_inode; -+} -+ -+/* -+ * Returns size occupied by XFS inode stored in memory - we store struct -+ * grub_fshelp_node there but on disk inode size may be actually larger than -+ * struct grub_xfs_inode so we need to account for that so that we can read -+ * from disk directly into in-memory structure. -+ */ -+static inline grub_size_t -+grub_xfs_fshelp_size(struct grub_xfs_data *data) -+{ -+ return sizeof (struct grub_fshelp_node) - sizeof (struct grub_xfs_inode) -+ + grub_xfs_inode_size(data); -+} - - static grub_err_t - grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, -@@ -264,8 +282,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 +315,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)); -@@ -456,9 +474,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, - struct grub_fshelp_node *fdiro; - grub_err_t err; - -- fdiro = grub_malloc (sizeof (struct grub_fshelp_node) -- - sizeof (struct grub_xfs_inode) -- + (1 << ctx->diro->data->sblock.log2_inode) + 1); -+ fdiro = grub_malloc (grub_xfs_fshelp_size(ctx->diro->data) + 1); - if (!fdiro) - { - grub_print_error (); -@@ -682,7 +698,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; -@@ -797,10 +813,7 @@ grub_xfs_open (struct grub_file *file, const char *name) - - if (fdiro != &data->diropen) - { -- grub_memcpy (&data->diropen, fdiro, -- sizeof (struct grub_fshelp_node) -- - sizeof (struct grub_xfs_inode) -- + (1 << data->sblock.log2_inode)); -+ grub_memcpy (&data->diropen, fdiro, grub_xfs_fshelp_size(data)); - grub_free (fdiro); - } - --- -2.4.3 - diff --git a/0428-xfs-V5-filesystem-format-support.patch b/0428-xfs-V5-filesystem-format-support.patch deleted file mode 100644 index 026f6aa..0000000 --- a/0428-xfs-V5-filesystem-format-support.patch +++ /dev/null @@ -1,579 +0,0 @@ -From b6e80c7778b708c1632d957d00507aad60d9e255 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Mon, 1 Jun 2015 14:28:46 +0200 -Subject: [PATCH 428/506] xfs: V5 filesystem format support - -Add support for new XFS on disk format. We have to handle optional -filetype fields in directory entries, additional CRC, LSN, UUID entries -in some structures, etc. - -Signed-off-by: Jan Kara ---- - grub-core/fs/xfs.c | 332 ++++++++++++++++++++++++++++++++++++++++------------- - 1 file changed, 252 insertions(+), 80 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 26d8147..f00e43e 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -34,6 +34,50 @@ 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_ATTRBIT 0x0010 -+#define XFS_SB_VERSION_NLINKBIT 0x0020 -+#define XFS_SB_VERSION_QUOTABIT 0x0040 -+#define XFS_SB_VERSION_ALIGNBIT 0x0080 -+#define XFS_SB_VERSION_DALIGNBIT 0x0100 -+#define XFS_SB_VERSION_LOGV2BIT 0x0400 -+#define XFS_SB_VERSION_SECTORBIT 0x0800 -+#define XFS_SB_VERSION_EXTFLGBIT 0x1000 -+#define XFS_SB_VERSION_DIRV2BIT 0x2000 -+#define XFS_SB_VERSION_MOREBITSBIT 0x8000 -+#define XFS_SB_VERSION_BITS_SUPPORTED \ -+ (XFS_SB_VERSION_NUMBITS | \ -+ XFS_SB_VERSION_ATTRBIT | \ -+ XFS_SB_VERSION_NLINKBIT | \ -+ XFS_SB_VERSION_QUOTABIT | \ -+ XFS_SB_VERSION_ALIGNBIT | \ -+ XFS_SB_VERSION_DALIGNBIT | \ -+ XFS_SB_VERSION_LOGV2BIT | \ -+ XFS_SB_VERSION_SECTORBIT | \ -+ XFS_SB_VERSION_EXTFLGBIT | \ -+ XFS_SB_VERSION_DIRV2BIT | \ -+ XFS_SB_VERSION_MOREBITSBIT) -+ -+/* Recognized xfs format versions */ -+#define XFS_SB_VERSION_4 4 /* Good old XFS filesystem */ -+#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */ -+ -+/* features2 field flags */ -+#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ -+#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */ -+#define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32-bit project ids */ -+#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */ -+#define XFS_SB_VERSION2_BITS_SUPPORTED \ -+ (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ -+ XFS_SB_VERSION2_ATTR2BIT | \ -+ XFS_SB_VERSION2_PROJID32BIT | \ -+ XFS_SB_VERSION2_FTYPE) -+ -+/* incompat feature flags */ -+#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ -+#define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ -+ (XFS_SB_FEAT_INCOMPAT_FTYPE) - - struct grub_xfs_sblock - { -@@ -45,7 +89,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 +100,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 +120,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 +145,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,19 +179,11 @@ 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; - -+#define XFS_V2_INODE_SIZE sizeof(struct grub_xfs_inode) -+#define XFS_V3_INODE_SIZE (XFS_V2_INODE_SIZE + 76) -+ - struct grub_xfs_dirblock_tail - { - grub_uint32_t leaf_count; -@@ -157,6 +205,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 +214,71 @@ static grub_dl_t my_mod; - - - -+static int grub_xfs_sb_hascrc(struct grub_xfs_data *data) -+{ -+ return (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == -+ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5); -+} -+ -+static int grub_xfs_sb_hasftype(struct grub_xfs_data *data) -+{ -+ if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == -+ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5) && -+ data->sblock.sb_features_incompat & grub_cpu_to_be32_compile_time(XFS_SB_FEAT_INCOMPAT_FTYPE)) -+ return 1; -+ if (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_MOREBITSBIT) && -+ data->sblock.features2 & grub_cpu_to_be32_compile_time(XFS_SB_VERSION2_FTYPE)) -+ return 1; -+ return 0; -+} -+ -+static int grub_xfs_sb_valid(struct grub_xfs_data *data) -+{ -+ grub_dprintf("xfs", "Validating superblock\n"); -+ if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4) -+ || data->sblock.log2_bsize < GRUB_DISK_SECTOR_BITS -+ || ((int) data->sblock.log2_bsize -+ + (int) data->sblock.log2_dirblk) >= 27) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem"); -+ return 0; -+ } -+ if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == -+ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5)) -+ { -+ grub_dprintf("xfs", "XFS v5 superblock detected\n"); -+ if (data->sblock.sb_features_incompat & -+ grub_cpu_to_be32_compile_time(~XFS_SB_FEAT_INCOMPAT_SUPPORTED)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem has unsupported " -+ "incompatible features"); -+ return 0; -+ } -+ return 1; -+ } -+ else if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == -+ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_4)) -+ { -+ grub_dprintf("xfs", "XFS v4 superblock detected\n"); -+ if (!(data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_DIRV2BIT))) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem without V2 directories " -+ "is unsupported"); -+ return 0; -+ } -+ if (data->sblock.version & grub_cpu_to_be16_compile_time(~XFS_SB_VERSION_BITS_SUPPORTED) || -+ (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_MOREBITSBIT) && -+ data->sblock.features2 & grub_cpu_to_be16_compile_time(~XFS_SB_VERSION2_BITS_SUPPORTED))) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem has unsupported version " -+ "bits"); -+ return 0; -+ } -+ return 1; -+ } -+ return 0; -+} -+ - /* Filetype information as used in inodes. */ - #define FILETYPE_INO_MASK 0170000 - #define FILETYPE_INO_REG 0100000 -@@ -219,18 +334,6 @@ GRUB_XFS_EXTENT_SIZE (grub_xfs_extent *exts, int ex) - 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, -@@ -274,6 +377,85 @@ grub_xfs_fshelp_size(struct grub_xfs_data *data) - + grub_xfs_inode_size(data); - } - -+static void * -+grub_xfs_inode_data(struct grub_xfs_inode *inode) -+{ -+ if (inode->version <= 2) -+ return ((char *)inode) + XFS_V2_INODE_SIZE; -+ return ((char *)inode) + XFS_V3_INODE_SIZE; -+} -+ -+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 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) + ALIGN_UP(size, 8)); -+} -+ -+static grub_uint64_t * -+grub_xfs_btree_keys(struct grub_xfs_data *data, -+ struct grub_xfs_btree_node *leaf) -+{ -+ grub_uint64_t *keys = (grub_uint64_t *)(leaf + 1); -+ -+ if (data->hascrc) -+ keys += 6; /* skip crc, uuid, ... */ -+ return keys; -+} -+ - static grub_err_t - grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, - struct grub_xfs_inode *inode) -@@ -281,6 +463,8 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, - grub_uint64_t block = grub_xfs_inode_block (data, ino); - int offset = grub_xfs_inode_offset (data, ino); - -+ grub_dprintf("xfs", "Reading inode (%"PRIuGRUB_UINT64_T") - %"PRIuGRUB_UINT64_T", %d\n", -+ ino, block, offset); - /* Read the inode. */ - if (grub_disk_read (data->disk, block, offset, grub_xfs_inode_size(data), - inode)) -@@ -303,6 +487,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - - if (node->inode.format == XFS_INODE_FORMAT_BTREE) - { -+ struct grub_xfs_btree_root *root; - const grub_uint64_t *keys; - int recoffset; - -@@ -310,15 +495,15 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - 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; -@@ -340,7 +525,10 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - 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"); -@@ -348,8 +536,8 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - } - - 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))); - } -@@ -359,7 +547,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - 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 - { -@@ -417,7 +605,7 @@ grub_xfs_read_symlink (grub_fshelp_node_t 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: - { -@@ -512,23 +700,18 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - { - 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)) -@@ -537,12 +720,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - 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. */ -@@ -567,10 +748,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - 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; - } -@@ -597,15 +775,11 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - >> 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, -@@ -617,13 +791,11 @@ 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 < 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) -@@ -631,14 +803,16 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - 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), -@@ -655,8 +829,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - 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); -@@ -681,19 +854,14 @@ 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)) - goto fail; - -- if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4) -- || data->sblock.log2_bsize < GRUB_DISK_SECTOR_BITS -- || ((int) data->sblock.log2_bsize -- + (int) data->sblock.log2_dirblk) >= 27) -- { -- grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem"); -- goto fail; -- } -+ if (!grub_xfs_sb_valid(data)) -+ goto fail; - - data = grub_realloc (data, - sizeof (struct grub_xfs_data) -@@ -708,9 +876,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 %"PRIuGRUB_UINT64_T"\n", -+ grub_cpu_to_be64(data->sblock.rootino)); - - grub_xfs_read_inode (data, data->diropen.ino, &data->diropen.inode); - --- -2.4.3 - diff --git a/0429-NEWS-XFS-v5-support.patch b/0429-NEWS-XFS-v5-support.patch deleted file mode 100644 index 57b7111..0000000 --- a/0429-NEWS-XFS-v5-support.patch +++ /dev/null @@ -1,24 +0,0 @@ -From df2aaf94b8d76b1ff7479ad5dc990f3efa30e419 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Fri, 12 Jun 2015 09:40:00 +0300 -Subject: [PATCH 429/506] NEWS: XFS v5 support - ---- - NEWS | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/NEWS b/NEWS -index e417eba..ad572ff 100644 ---- a/NEWS -+++ b/NEWS -@@ -17,6 +17,7 @@ New in 2.02: - files. - * ZFS features support. - * ZFS LZ4 support. -+ * XFS V5 format support. - - * New/improved terminal and video support: - * Monochrome text (matching `hercules' in GRUB Legacy). --- -2.4.3 - diff --git a/0430-disk-ahci.c-Use-defines-GRUB_AHCI_HBA_PORT_CMD_SPIN_.patch b/0430-disk-ahci.c-Use-defines-GRUB_AHCI_HBA_PORT_CMD_SPIN_.patch deleted file mode 100644 index c0b85f0..0000000 --- a/0430-disk-ahci.c-Use-defines-GRUB_AHCI_HBA_PORT_CMD_SPIN_.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f4b1b48a837a034748a103adc7e9fd719a39ce42 Mon Sep 17 00:00:00 2001 -From: Paul Menzel -Date: Thu, 28 May 2015 19:14:19 +0200 -Subject: [PATCH 430/506] disk/ahci.c: Use defines - `GRUB_AHCI_HBA_PORT_CMD_SPIN_UP` and `GRUB_AHCI_HBA_PORT_CMD_POWER_ON` - -Instead of hard coding `2` and `4` use the macros defined already at the -top of the file. As a consequence, wrap the now too long line. ---- - grub-core/disk/ahci.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index da5fead..f4725e8 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -552,7 +552,9 @@ grub_ahci_pciinit (grub_pci_device_t dev, - adevs[i]->hba->ports[adevs[i]->port].sata_error); - - adevs[i]->hba->ports[adevs[i]->port].command -- = (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) | 2 | 4; -+ = (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) -+ | GRUB_AHCI_HBA_PORT_CMD_SPIN_UP -+ | GRUB_AHCI_HBA_PORT_CMD_POWER_ON; - - /* struct grub_disk_ata_pass_through_parms parms2; - grub_memset (&parms2, 0, sizeof (parms2)); --- -2.4.3 - diff --git a/0431-Fix-exit-to-EFI-firmware.patch b/0431-Fix-exit-to-EFI-firmware.patch deleted file mode 100644 index c408650..0000000 --- a/0431-Fix-exit-to-EFI-firmware.patch +++ /dev/null @@ -1,55 +0,0 @@ -From c945ca75c3b2b900040b905323b1226cb60a1166 Mon Sep 17 00:00:00 2001 -From: Mark Salter -Date: Fri, 15 Aug 2014 12:22:43 -0400 -Subject: [PATCH 431/506] Fix exit to EFI firmware - -The current code for EFI grub_exit() calls grub_efi_fini() before -returning to firmware. In the case of ARM, this leaves a timer -event running which could lead to a firmware crash. This patch -changes this so that grub_machine_fini() is called with a NORETURN -flag. This allows machine-specific shutdown to happen as well -as the shutdown done by grub_efi_fini(). - -Signed-off-by: Mark Salter ---- - grub-core/kern/arm/efi/init.c | 2 +- - grub-core/kern/efi/efi.c | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c -index a6ae034..2572ca8 100644 ---- a/grub-core/kern/arm/efi/init.c -+++ b/grub-core/kern/arm/efi/init.c -@@ -67,7 +67,7 @@ grub_machine_fini (int flags) - - b = grub_efi_system_table->boot_services; - -- efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0); -+ efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0); - efi_call_1 (b->close_event, tmr_evt); - - grub_efi_fini (); -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 49a1501..2e77834 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - /* The handle of GRUB itself. Filled in by the startup code. */ - grub_efi_handle_t grub_efi_image_handle; -@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) - void - grub_exit (void) - { -- grub_efi_fini (); -+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); - efi_call_4 (grub_efi_system_table->boot_services->exit, - grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0); - for (;;) ; --- -2.4.3 - diff --git a/0484-Add-powerpc-little-endian-ppc64le-flags.patch b/0484-Add-powerpc-little-endian-ppc64le-flags.patch deleted file mode 100644 index 1f65793..0000000 --- a/0484-Add-powerpc-little-endian-ppc64le-flags.patch +++ /dev/null @@ -1,104 +0,0 @@ -From eaf3b8f6a44f827047eb5a5197fec3daae453005 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Wed, 13 Aug 2014 18:59:58 +0000 -Subject: [PATCH 484/506] 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 | 26 ++++++++++++++++++++++++++ - grub-core/Makefile.am | 3 +++ - 2 files changed, 29 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 6275310..9306223 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -139,6 +139,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 ;; -@@ -161,6 +162,7 @@ case "$target_cpu"-"$platform" in - x86_64-none) ;; - 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. -@@ -624,6 +626,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" -@@ -1154,6 +1163,14 @@ 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 \ -+ || ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then -+TARGET_LIBGCC= -+else -+TARGET_LIBGCC=-lgcc -+fi -+ -+LIBS="$TARGET_LIBGCC" - - grub_ASM_USCORE - if test "x$TARGET_APPLE_LINKER" = x0 && test x"$platform" != xemu; then -@@ -1691,6 +1708,14 @@ if test x"$enable_werror" != xno ; then - HOST_CFLAGS="$HOST_CFLAGS -Werror" - fi - -+# 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= -+fi -+ - TARGET_CPP="$TARGET_CC -E" - TARGET_CCAS=$TARGET_CC - -@@ -1752,6 +1777,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 af0c7f4..8c37782 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -88,6 +88,9 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h - 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_powerpc_le -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h -+endif - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h - - if COND_i386_pc --- -2.4.3 - diff --git a/0485-Files-reorganization-and-include-some-libgcc-fuction.patch b/0485-Files-reorganization-and-include-some-libgcc-fuction.patch deleted file mode 100644 index 31b6949..0000000 --- a/0485-Files-reorganization-and-include-some-libgcc-fuction.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 2470ef3c7e4ea175d8b70ff2676d0e715ac50816 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Wed, 13 Aug 2014 19:00:19 +0000 -Subject: [PATCH 485/506] 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/kern/misc.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ - include/grub/compiler.h | 61 +++++++++++++++++++++++++++ - include/grub/libgcc.h | 24 +++++++++++ - 3 files changed, 192 insertions(+) - create mode 100644 include/grub/libgcc.h - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 6b3397f..66f11f8 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -1144,3 +1144,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 -diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index c9e1d7a..a9a684c 100644 ---- a/include/grub/compiler.h -+++ b/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 */ -diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h -new file mode 100644 -index 0000000..5bdb8fb ---- /dev/null -+++ b/include/grub/libgcc.h -@@ -0,0 +1,24 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2004,2007,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 . -+ */ -+ -+#if defined (__arm__) -+void EXPORT_FUNC (__aeabi_lasr) (void); -+void EXPORT_FUNC (__aeabi_llsl) (void); -+void EXPORT_FUNC (__aeabi_llsr) (void); -+void EXPORT_FUNC (__aeabi_ulcmp) (void); -+#endif --- -2.4.3 - diff --git a/10001-Put-the-correct-.file-directives-in-our-.S-files.patch b/10001-Put-the-correct-.file-directives-in-our-.S-files.patch new file mode 100644 index 0000000..d6891f3 --- /dev/null +++ b/10001-Put-the-correct-.file-directives-in-our-.S-files.patch @@ -0,0 +1,455 @@ +From b29ab8b194e3543aa481568e4af0e9ffbad01636 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 21 Jul 2015 20:30:00 -0400 +Subject: [PATCH 1/6] Put the correct .file directives in our .S files. + +The wrong path makes generating debuginfo not work correctly. + +Signed-off-by: Peter Jones +--- + grub-core/boot/i386/pc/boot.S | 2 +- + grub-core/boot/i386/pc/cdboot.S | 2 +- + grub-core/boot/i386/pc/diskboot.S | 2 +- + grub-core/boot/i386/pc/lnxboot.S | 2 +- + grub-core/boot/i386/pc/pxeboot.S | 2 +- + grub-core/boot/i386/pc/startup_raw.S | 2 +- + grub-core/efiemu/runtime/efiemu.S | 2 +- + grub-core/kern/arm/cache.S | 2 +- + grub-core/kern/arm/cache_armv6.S | 2 +- + grub-core/kern/arm/cache_armv7.S | 4 ++-- + grub-core/kern/arm/compiler-rt.S | 2 +- + grub-core/kern/arm/efi/startup.S | 2 +- + grub-core/kern/arm64/cache_flush.S | 2 +- + grub-core/kern/arm64/efi/startup.S | 2 +- + grub-core/kern/i386/coreboot/startup.S | 2 +- + grub-core/kern/i386/efi/startup.S | 2 +- + grub-core/kern/i386/ieee1275/startup.S | 2 +- + grub-core/kern/i386/pc/startup.S | 2 +- + grub-core/kern/i386/xen/startup.S | 2 +- + grub-core/kern/sparc64/cache.S | 2 +- + grub-core/kern/x86_64/efi/callwrap.S | 2 +- + grub-core/kern/x86_64/efi/startup.S | 2 +- + grub-core/kern/x86_64/xen/startup.S | 2 +- + grub-core/lib/arm/setjmp.S | 2 +- + grub-core/lib/arm64/setjmp.S | 2 +- + grub-core/lib/i386/setjmp.S | 2 +- + grub-core/lib/ia64/setjmp.S | 2 +- + grub-core/lib/mips/setjmp.S | 2 +- + grub-core/lib/powerpc/setjmp.S | 2 +- + grub-core/lib/sparc64/setjmp.S | 2 +- + grub-core/lib/x86_64/setjmp.S | 2 +- + 31 files changed, 32 insertions(+), 32 deletions(-) + +diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S +index ea167fe..96ced2f 100644 +--- a/grub-core/boot/i386/pc/boot.S ++++ b/grub-core/boot/i386/pc/boot.S +@@ -108,7 +108,7 @@ cylinder_start: + /* more space... */ + .endm + +- .file "boot.S" ++ .file "grub-core/boot/i386/pc/boot.S" + + .text + +diff --git a/grub-core/boot/i386/pc/cdboot.S b/grub-core/boot/i386/pc/cdboot.S +index de4f809..d30b4be 100644 +--- a/grub-core/boot/i386/pc/cdboot.S ++++ b/grub-core/boot/i386/pc/cdboot.S +@@ -22,7 +22,7 @@ + #include + #include + +- .file "cdboot.S" ++ .file "grub-core/boot/i386/pc/cdboot.S" + + #define CODE_ADDR 0x6000 + #define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200) +diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S +index c8b87ed..14c6d83 100644 +--- a/grub-core/boot/i386/pc/diskboot.S ++++ b/grub-core/boot/i386/pc/diskboot.S +@@ -25,7 +25,7 @@ + + #define MSG(x) movw $x, %si; call LOCAL(message) + +- .file "diskboot.S" ++ .file "grub-core/boot/i386/pc/diskboot.S" + + .text + +diff --git a/grub-core/boot/i386/pc/lnxboot.S b/grub-core/boot/i386/pc/lnxboot.S +index 2dda0e0..ca8e2b9 100644 +--- a/grub-core/boot/i386/pc/lnxboot.S ++++ b/grub-core/boot/i386/pc/lnxboot.S +@@ -23,7 +23,7 @@ + #include + #include + +- .file "lnxboot.S" ++ .file "grub-core/boot/i386/pc/lnxboot.S" + + #define CODE_ADDR 0x6000 + #define CODE_SECTORS 1 +diff --git a/grub-core/boot/i386/pc/pxeboot.S b/grub-core/boot/i386/pc/pxeboot.S +index b695b24..d200c69 100644 +--- a/grub-core/boot/i386/pc/pxeboot.S ++++ b/grub-core/boot/i386/pc/pxeboot.S +@@ -18,7 +18,7 @@ + + #include + +- .file "pxeboot.S" ++ .file "grub-core/boot/i386/pc/pxeboot.S" + .text + + /* Start with the prehistoric environment... */ +diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S +index 8bce798..ded7060 100644 +--- a/grub-core/boot/i386/pc/startup_raw.S ++++ b/grub-core/boot/i386/pc/startup_raw.S +@@ -25,7 +25,7 @@ + + #define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) + +- .file "startup_raw.S" ++ .file "grub-core/boot/i386/pc/startup_raw.S" + + .text + +diff --git a/grub-core/efiemu/runtime/efiemu.S b/grub-core/efiemu/runtime/efiemu.S +index b502314..cca0e6c 100644 +--- a/grub-core/efiemu/runtime/efiemu.S ++++ b/grub-core/efiemu/runtime/efiemu.S +@@ -30,7 +30,7 @@ + * + */ + +- .file "efiemu.S" ++ .file "grub-core/efiemu/runtime/efiemu.S" + .text + + FUNCTION (efiemu_get_time) +diff --git a/grub-core/kern/arm/cache.S b/grub-core/kern/arm/cache.S +index 354a069..85f93dd 100644 +--- a/grub-core/kern/arm/cache.S ++++ b/grub-core/kern/arm/cache.S +@@ -18,7 +18,7 @@ + + #include + +- .file "cache.S" ++ .file "grub-core/kern/arm/cache.S" + .text + .syntax unified + #if !defined (__thumb2__) || !defined (ARMV7) +diff --git a/grub-core/kern/arm/cache_armv6.S b/grub-core/kern/arm/cache_armv6.S +index dfaded0..4e592b3 100644 +--- a/grub-core/kern/arm/cache_armv6.S ++++ b/grub-core/kern/arm/cache_armv6.S +@@ -18,7 +18,7 @@ + + #include + +- .file "cache_armv6.S" ++ .file "grub-core/kern/arm/cache_armv6.S" + .text + .syntax unified + .arm +diff --git a/grub-core/kern/arm/cache_armv7.S b/grub-core/kern/arm/cache_armv7.S +index 1ef2754..bb4f0ad 100644 +--- a/grub-core/kern/arm/cache_armv7.S ++++ b/grub-core/kern/arm/cache_armv7.S +@@ -18,7 +18,7 @@ + + #include + +- .file "cache_armv7.S" ++ .file "grub-core/kern/arm/cache_armv7.S" + .text + .syntax unified + #if !defined (__thumb2__) +@@ -123,4 +123,4 @@ clean_invalidate_dcache: + pop {r4-r12, lr} + bx lr + +-#include "cache.S" +\ No newline at end of file ++#include "cache.S" +diff --git a/grub-core/kern/arm/compiler-rt.S b/grub-core/kern/arm/compiler-rt.S +index 645b42f..8b9168d 100644 +--- a/grub-core/kern/arm/compiler-rt.S ++++ b/grub-core/kern/arm/compiler-rt.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "misc.S" ++ .file "grub-core/kern/arm/compiler-rt.S" + .text + .syntax unified + #if !defined (__thumb2__) +diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S +index 9f82653..09009f3 100644 +--- a/grub-core/kern/arm/efi/startup.S ++++ b/grub-core/kern/arm/efi/startup.S +@@ -20,7 +20,7 @@ + + #include + +- .file "startup.S" ++ .file "grub-core/kern/arm/efi/startup.S" + .text + .arm + FUNCTION(_start) +diff --git a/grub-core/kern/arm64/cache_flush.S b/grub-core/kern/arm64/cache_flush.S +index e064f7e..bf8192b 100644 +--- a/grub-core/kern/arm64/cache_flush.S ++++ b/grub-core/kern/arm64/cache_flush.S +@@ -18,7 +18,7 @@ + + #include + +- .file "cache_flush.S" ++ .file "grub-core/kern/arm64/cache_flush.S" + .text + + /* +diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S +index 666a7ee..82b566c 100644 +--- a/grub-core/kern/arm64/efi/startup.S ++++ b/grub-core/kern/arm64/efi/startup.S +@@ -18,7 +18,7 @@ + + #include + +- .file "startup.S" ++ .file "grub-core/kern/arm64/efi/startup.S" + .text + FUNCTION(_start) + /* +diff --git a/grub-core/kern/i386/coreboot/startup.S b/grub-core/kern/i386/coreboot/startup.S +index c848654..7bdbfcc 100644 +--- a/grub-core/kern/i386/coreboot/startup.S ++++ b/grub-core/kern/i386/coreboot/startup.S +@@ -31,7 +31,7 @@ + * with "ret $N" where N is ((the number of arguments) - 3) * 4. + */ + +- .file "startup.S" ++ .file "grub-core/kern/i386/coreboot/startup.S" + .text + .globl start, _start + start: +diff --git a/grub-core/kern/i386/efi/startup.S b/grub-core/kern/i386/efi/startup.S +index fc5ea3d..5f27e07 100644 +--- a/grub-core/kern/i386/efi/startup.S ++++ b/grub-core/kern/i386/efi/startup.S +@@ -20,7 +20,7 @@ + #include + #include + +- .file "startup.S" ++ .file "grub-core/kern/i386/efi/startup.S" + .text + .globl start, _start + start: +diff --git a/grub-core/kern/i386/ieee1275/startup.S b/grub-core/kern/i386/ieee1275/startup.S +index 245583b..ae6476c 100644 +--- a/grub-core/kern/i386/ieee1275/startup.S ++++ b/grub-core/kern/i386/ieee1275/startup.S +@@ -30,7 +30,7 @@ + * with "ret $N" where N is ((the number of arguments) - 3) * 4. + */ + +- .file "startup.S" ++ .file "grub-core/kern/i386/ieee1275/startup.S" + .text + .globl start, _start + +diff --git a/grub-core/kern/i386/pc/startup.S b/grub-core/kern/i386/pc/startup.S +index b8a9b33..e7eb91c 100644 +--- a/grub-core/kern/i386/pc/startup.S ++++ b/grub-core/kern/i386/pc/startup.S +@@ -48,7 +48,7 @@ + #include + #endif + +- .file "startup.S" ++ .file "grub-core/kern/i386/pc/startup.S" + + .text + +diff --git a/grub-core/kern/i386/xen/startup.S b/grub-core/kern/i386/xen/startup.S +index fbe8300..52b2926 100644 +--- a/grub-core/kern/i386/xen/startup.S ++++ b/grub-core/kern/i386/xen/startup.S +@@ -20,7 +20,7 @@ + #include + #include + +- .file "startup.S" ++ .file "grub-core/kern/i386/xen/startup.S" + .text + .globl start, _start + .code32 +diff --git a/grub-core/kern/sparc64/cache.S b/grub-core/kern/sparc64/cache.S +index 1a16add..15cfadf 100644 +--- a/grub-core/kern/sparc64/cache.S ++++ b/grub-core/kern/sparc64/cache.S +@@ -19,7 +19,7 @@ + + #include + +- .file "cache.S" ++ .file "grub-core/kern/sparc64/cache.S" + + .text + +diff --git a/grub-core/kern/x86_64/efi/callwrap.S b/grub-core/kern/x86_64/efi/callwrap.S +index 1337fd9..ba6f306 100644 +--- a/grub-core/kern/x86_64/efi/callwrap.S ++++ b/grub-core/kern/x86_64/efi/callwrap.S +@@ -32,7 +32,7 @@ + * + */ + +- .file "callwrap.S" ++ .file "grub-core/kern/x86_64/efi/callwrap.S" + .text + + FUNCTION(efi_wrap_0) +diff --git a/grub-core/kern/x86_64/efi/startup.S b/grub-core/kern/x86_64/efi/startup.S +index 9357e5c..d223648 100644 +--- a/grub-core/kern/x86_64/efi/startup.S ++++ b/grub-core/kern/x86_64/efi/startup.S +@@ -20,7 +20,7 @@ + #include + #include + +- .file "startup.S" ++ .file "grub-core/kern/x86_64/efi/startup.S" + .text + .globl start, _start + .code64 +diff --git a/grub-core/kern/x86_64/xen/startup.S b/grub-core/kern/x86_64/xen/startup.S +index 21a139f..cc74fe9 100644 +--- a/grub-core/kern/x86_64/xen/startup.S ++++ b/grub-core/kern/x86_64/xen/startup.S +@@ -20,7 +20,7 @@ + #include + #include + +- .file "startup.S" ++ .file "grub-core/kern/x86_64/xen/startup.S" + .text + .globl start, _start + .code64 +diff --git a/grub-core/lib/arm/setjmp.S b/grub-core/lib/arm/setjmp.S +index a5373d3..6f58685 100644 +--- a/grub-core/lib/arm/setjmp.S ++++ b/grub-core/lib/arm/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/arm/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +diff --git a/grub-core/lib/arm64/setjmp.S b/grub-core/lib/arm64/setjmp.S +index eabfd99..006660b 100644 +--- a/grub-core/lib/arm64/setjmp.S ++++ b/grub-core/lib/arm64/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/arm64/setjmp.S" + GRUB_MOD_LICENSE "GPLv3+" + .text + +diff --git a/grub-core/lib/i386/setjmp.S b/grub-core/lib/i386/setjmp.S +index 0b0740f..08271c9 100644 +--- a/grub-core/lib/i386/setjmp.S ++++ b/grub-core/lib/i386/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/i386/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +diff --git a/grub-core/lib/ia64/setjmp.S b/grub-core/lib/ia64/setjmp.S +index a0382d8..dba2cbf 100644 +--- a/grub-core/lib/ia64/setjmp.S ++++ b/grub-core/lib/ia64/setjmp.S +@@ -67,7 +67,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/ia64/setjmp.S" + + GRUB_MOD_LICENSE "GPLv2+" + +diff --git a/grub-core/lib/mips/setjmp.S b/grub-core/lib/mips/setjmp.S +index f012945..365824c 100644 +--- a/grub-core/lib/mips/setjmp.S ++++ b/grub-core/lib/mips/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/mips/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +diff --git a/grub-core/lib/powerpc/setjmp.S b/grub-core/lib/powerpc/setjmp.S +index 716b563..2e6cf16 100644 +--- a/grub-core/lib/powerpc/setjmp.S ++++ b/grub-core/lib/powerpc/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/powerpc/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +diff --git a/grub-core/lib/sparc64/setjmp.S b/grub-core/lib/sparc64/setjmp.S +index 6c11bdd..ef516a5 100644 +--- a/grub-core/lib/sparc64/setjmp.S ++++ b/grub-core/lib/sparc64/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/sparc64/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +diff --git a/grub-core/lib/x86_64/setjmp.S b/grub-core/lib/x86_64/setjmp.S +index 6b151bc..c975897 100644 +--- a/grub-core/lib/x86_64/setjmp.S ++++ b/grub-core/lib/x86_64/setjmp.S +@@ -19,7 +19,7 @@ + #include + #include + +- .file "setjmp.S" ++ .file "grub-core/lib/x86_64/setjmp.S" + + GRUB_MOD_LICENSE "GPLv3+" + +-- +2.4.3 + diff --git a/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch b/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch new file mode 100644 index 0000000..eb89e2e --- /dev/null +++ b/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -0,0 +1,79 @@ +From 5804ce3d46ef5792ea4aa53e1460c341137961e9 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 25 Jun 2015 11:59:09 -0400 +Subject: [PATCH 2/6] Make efi machines load an env block from a variable + +Signed-off-by: Peter Jones +--- + grub-core/Makefile.core.def | 1 + + grub-core/kern/efi/init.c | 32 ++++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 38291ce..b3ba5ed 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -174,6 +174,7 @@ kernel = { + efi = kern/efi/init.c; + efi = kern/efi/mm.c; + efi = term/efi/console.c; ++ efi = lib/envblk.c; + + x86 = kern/i386/tsc.c; + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index e9c85de..d17d18e 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -25,9 +25,40 @@ + #include + #include + #include ++#include + + grub_addr_t grub_modbase; + ++#define GRUB_EFI_GRUB_VARIABLE_GUID \ ++ { 0x91376aff, 0xcba6, 0x42be, \ ++ { 0x94, 0x9d, 0x06, 0xfd, 0xe8, 0x11, 0x28, 0xe8 } \ ++ } ++ ++/* Helper for grub_efi_env_init */ ++static int ++set_var (const char *name, const char *value, ++ void *whitelist __attribute__((__unused__))) ++{ ++ grub_env_set (name, value); ++ return 0; ++} ++ ++static void ++grub_efi_env_init (void) ++{ ++ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID; ++ struct grub_envblk envblk_s = { NULL, 0 }; ++ grub_envblk_t envblk = &envblk_s; ++ ++ envblk_s.buf = grub_efi_get_variable ("GRUB_ENV", &efi_grub_guid, ++ &envblk_s.size); ++ if (!envblk_s.buf || envblk_s.size < 1) ++ return; ++ ++ grub_envblk_iterate (envblk, NULL, set_var); ++ grub_free (envblk_s.buf); ++} ++ + void + grub_efi_init (void) + { +@@ -42,6 +73,7 @@ grub_efi_init (void) + efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer, + 0, 0, 0, NULL); + ++ grub_efi_env_init (); + grub_efidisk_init (); + } + +-- +2.4.3 + diff --git a/10003-Make-it-possible-to-enabled-build-id-sha1.patch b/10003-Make-it-possible-to-enabled-build-id-sha1.patch new file mode 100644 index 0000000..ab53021 --- /dev/null +++ b/10003-Make-it-possible-to-enabled-build-id-sha1.patch @@ -0,0 +1,64 @@ +From bdcd66a767a861370e55a3c2d624383a1f2ec2f5 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 25 Jun 2015 15:41:06 -0400 +Subject: [PATCH 3/6] Make it possible to enabled --build-id=sha1 + +Signed-off-by: Peter Jones +--- + acinclude.m4 | 19 +++++++++++++++++++ + configure.ac | 8 ++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/acinclude.m4 b/acinclude.m4 +index 609c4f2..8dd0989 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then + fi + ]) + ++dnl Supply --build-id=sha1 to ld if building modules. ++dnl This suppresses warnings from ld on some systems ++AC_DEFUN([grub_PROG_LD_BUILD_ID_SHA1], ++[AC_MSG_CHECKING([whether linker accepts --build-id=sha1]) ++AC_CACHE_VAL(grub_cv_prog_ld_build_id_sha1, ++[save_LDFLAGS="$LDFLAGS" ++LDFLAGS="$LDFLAGS -Wl,--build-id=sha1" ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_prog_ld_build_id_sha1=yes], ++ [grub_cv_prog_ld_build_id_sha1=no]) ++LDFLAGS="$save_LDFLAGS" ++]) ++AC_MSG_RESULT([$grub_cv_prog_ld_build_id_sha1]) ++ ++if test "x$grub_cv_prog_ld_build_id_sha1" = xyes; then ++ TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=sha1" ++fi ++]) ++ + dnl Check nm + AC_DEFUN([grub_PROG_NM_WORKS], + [AC_MSG_CHECKING([whether nm works]) +diff --git a/configure.ac b/configure.ac +index 991cb15..8d780e3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1202,7 +1202,15 @@ grub_PROG_TARGET_CC + if test "x$TARGET_APPLE_LINKER" != x1 ; then + grub_PROG_OBJCOPY_ABSOLUTE + fi ++ ++AC_ARG_ENABLE([build-id], ++ [AS_HELP_STRING([--enable-build-id], ++ [ask the linker to supply build-id notes (default=no)])]) ++if test x$enable_build_id = xyes; then ++grub_PROG_LD_BUILD_ID_SHA1 ++else + grub_PROG_LD_BUILD_ID_NONE ++fi + if test "x$target_cpu" = xi386; then + if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then + if test ! -z "$TARGET_IMG_LDSCRIPT"; then +-- +2.4.3 + diff --git a/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch b/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch new file mode 100644 index 0000000..5b5db09 --- /dev/null +++ b/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch @@ -0,0 +1,71 @@ +From 22ba237a041b493cd0b7bb3e1c3fcd0a34dbdc2d Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 28 Jun 2015 17:57:24 -0400 +Subject: [PATCH 4/6] Don't tell the compiler to do annoying things with -f. + +--- + configure.ac | 34 ++-------------------------------- + 1 file changed, 2 insertions(+), 32 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8d780e3..5e2529a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -548,8 +548,8 @@ LDFLAGS="$TARGET_LDFLAGS" + LIBS="" + + # debug flags. +-TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" +-TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" ++TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g3 -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" ++TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g3" + + if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then + TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align" +@@ -809,21 +809,6 @@ if test x"$target_cpu" = xsparc64 ; then + TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" + fi + +-# By default, GCC 4.4 generates .eh_frame sections containing unwind +-# information in some cases where it previously did not. GRUB doesn't need +-# these and they just use up vital space. Restore the old compiler +-# behaviour. +-AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ +- CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [grub_cv_cc_fno_dwarf2_cfi_asm=yes], +- [grub_cv_cc_fno_dwarf2_cfi_asm=no]) +-]) +- +-if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" +-fi +- + if test x"$target_os" = xcygwin; then + AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [ + CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" +@@ -837,21 +822,6 @@ if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xy + TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" + fi + +-# By default, GCC 4.6 generates .eh_frame sections containing unwind +-# information in some cases where it previously did not. GRUB doesn't need +-# these and they just use up vital space. Restore the old compiler +-# behaviour. +-AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [ +- CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [grub_cv_cc_fno_asynchronous_unwind_tables=yes], +- [grub_cv_cc_fno_asynchronous_unwind_tables=no]) +-]) +- +-if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" +-fi +- + AC_ARG_ENABLE([efiemu], + [AS_HELP_STRING([--enable-efiemu], + [build and install the efiemu runtimes (default=guessed)])]) +-- +2.4.3 + diff --git a/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch new file mode 100644 index 0000000..9843899 --- /dev/null +++ b/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -0,0 +1,59 @@ +From fa89f53a982350e80fcabbceb8c7066636b30761 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 28 Jun 2015 13:09:58 -0400 +Subject: [PATCH 5/6] Add grub_qdprintf() - grub_dprintf() without the + file+line number. + +This just makes copy+paste of our debug loading info easier. + +Signed-off-by: Peter Jones +--- + grub-core/kern/misc.c | 18 ++++++++++++++++++ + include/grub/misc.h | 2 ++ + 2 files changed, 20 insertions(+) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index be6aa63..71f597d 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -178,6 +178,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, + } + } + ++void ++grub_qdprintf (const char *condition, const char *fmt, ...) ++{ ++ va_list args; ++ const char *debug = grub_env_get ("debug"); ++ ++ if (! debug) ++ return; ++ ++ if (grub_strword (debug, "all") || grub_strword (debug, condition)) ++ { ++ va_start (args, fmt); ++ grub_vprintf (fmt, args); ++ va_end (args); ++ grub_refresh (); ++ } ++} ++ + #define PREALLOC_SIZE 255 + + int +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 2a9f87c..da44520 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -326,6 +326,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, + const int line, + const char *condition, + const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); ++void EXPORT_FUNC(grub_qdprintf) (const char *condition, ++ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3))); + int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); + int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) + __attribute__ ((format (GNU_PRINTF, 3, 4))); +-- +2.4.3 + diff --git a/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch new file mode 100644 index 0000000..0d95328 --- /dev/null +++ b/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -0,0 +1,191 @@ +From 2053c4610482deff681feb96f2637933c44f8f3f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 25 Jun 2015 15:11:36 -0400 +Subject: [PATCH 6/6] Make a "gdb" dprintf that tells us load addresses. + +This makes a grub_dprintf() call during platform init and during module +loading that tells us the virtual addresses of the .text and .data +sections of grub-core/kernel.exec and any modules it loads. + +Specifically, it displays them in the gdb "add-symbol-file" syntax, with +the presumption that there's a variable $grubdir that reflects the path +to any such binaries. + +Signed-off-by: Peter Jones +--- + grub-core/kern/dl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ + grub-core/kern/efi/efi.c | 5 +++-- + grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++- + include/grub/efi/efi.h | 2 +- + 4 files changed, 81 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 58931fa..82c7abd 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -453,6 +453,24 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) + return NULL; + } + ++static long ++grub_dl_find_section_index (Elf_Ehdr *e, const char *name) ++{ ++ Elf_Shdr *s; ++ const char *str; ++ unsigned i; ++ ++ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); ++ str = (char *) e + s->sh_offset; ++ ++ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); ++ i < e->e_shnum; ++ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) ++ if (grub_strcmp (str + s->sh_name, name) == 0) ++ return (long)i; ++ return -1; ++} ++ + /* Me, Vladimir Serbinenko, hereby I add this module check as per new + GNU module policy. Note that this license check is informative only. + Modules have to be licensed under GPLv3 or GPLv3+ (optionally +@@ -593,6 +611,38 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + return GRUB_ERR_NONE; + } + ++static void ++grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) ++{ ++ void *text, *data = NULL; ++ long idx; ++ ++ idx = grub_dl_find_section_index (e, ".text"); ++ if (idx < 0) ++ return; ++ ++ text = grub_dl_get_section_addr (mod, idx); ++ if (!text) ++ return; ++ ++ idx = grub_dl_find_section_index (e, ".data"); ++ if (idx >= 0) ++ data = grub_dl_get_section_addr (mod, idx); ++ ++ if (data) ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n %p -s .data %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text, data); ++ else ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n%p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text); ++} ++ + /* Load a module from core memory. */ + grub_dl_t + grub_dl_load_core_noinit (void *addr, grub_size_t size) +@@ -651,6 +701,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + grub_dprintf ("modules", "module name: %s\n", mod->name); + grub_dprintf ("modules", "init function: %p\n", mod->init); + ++ grub_dl_print_gdb_info (mod, e); ++ + if (grub_dl_add (mod)) + { + grub_dl_unload (mod); +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 95c75d4..d757b2a 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -298,7 +298,7 @@ grub_efi_secure_boot (void) + /* Search the mods section from the PE32/PE32+ image. This code uses + a PE32 header, but should work with PE32+ as well. */ + grub_addr_t +-grub_efi_modules_addr (void) ++grub_efi_section_addr (const char *section_name) + { + grub_efi_loaded_image_t *image; + struct grub_pe32_header *header; +@@ -312,6 +312,7 @@ grub_efi_modules_addr (void) + if (! image) + return 0; + ++ + header = image->image_base; + coff_header = &(header->coff_header); + sections +@@ -323,7 +324,7 @@ grub_efi_modules_addr (void) + i < coff_header->num_sections; + i++, section++) + { +- if (grub_strcmp (section->name, "mods") == 0) ++ if (grub_strcmp (section->name, section_name) == 0) + break; + } + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index d17d18e..86935c6 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -59,10 +59,33 @@ grub_efi_env_init (void) + grub_free (envblk_s.buf); + } + ++static void ++grub_efi_print_gdb_info (void) ++{ ++ grub_addr_t text; ++ grub_addr_t data; ++ ++ text = grub_efi_section_addr (".text"); ++ if (!text) ++ return; ++ ++ data = grub_efi_section_addr (".data"); ++ if (data) ++ grub_qdprintf ("gdb", ++ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" ++ "kernel.exec %p -s .data %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data); ++ else ++ grub_qdprintf ("gdb", ++ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" ++ "kernel.exec %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text); ++} ++ + void + grub_efi_init (void) + { +- grub_modbase = grub_efi_modules_addr (); ++ grub_modbase = grub_efi_section_addr ("mods"); + /* First of all, initialize the console so that GRUB can display + messages. */ + grub_console_init (); +@@ -74,6 +97,7 @@ grub_efi_init (void) + 0, 0, 0, NULL); + + grub_efi_env_init (); ++ grub_efi_print_gdb_info (); + grub_efidisk_init (); + } + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 2245632..6aa0106 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -85,7 +85,7 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + char **device, + char **path); + +-grub_addr_t grub_efi_modules_addr (void); ++grub_addr_t grub_efi_section_addr (const char *section); + + void grub_efi_mm_init (void); + void grub_efi_mm_fini (void); +-- +2.4.3 + diff --git a/grub-2.02-beta2-to-origin-master.patch b/grub-2.02-beta2-to-origin-master.patch new file mode 100644 index 0000000..f936f99 --- /dev/null +++ b/grub-2.02-beta2-to-origin-master.patch @@ -0,0 +1,22148 @@ +From: Peter Jones +Date: Wed Jul 22 10:18:00 2015 -0400 +Subject: Stop trying to "git format-patch ..." across a merge that confuses it. :/ + +diff --git a/.gitignore b/.gitignore +index 2b0156a..18ab8e8 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -58,6 +58,8 @@ grub-emu.exe + grub-emu-lite.exe + grub_emu_init.c + grub_emu_init.h ++/grub-file ++/grub-file.exe + grub-fstest + grub-fstest.exe + grub_fstest_init.c +@@ -66,6 +68,8 @@ grub_func_test + grub-install + grub-install.exe + grub-kbdcomp ++/grub-macbless ++/grub-macbless.exe + grub-macho2img + /grub-menulst2cfg + /grub-menulst2cfg.exe +@@ -120,6 +124,8 @@ grub-shell + grub-shell-tester + grub-sparc64-setup + grub-sparc64-setup.exe ++/grub-syslinux2cfg ++/grub-syslinux2cfg.exe + gzcompress_test + hddboot_test + help_test +@@ -194,6 +200,7 @@ grub-core/modinfo.sh + grub-core/*.module + grub-core/*.module.exe + grub-core/*.pp ++grub-core/kernel.img.bin + util/bash-completion.d/grub + grub-core/gnulib/alloca.h + grub-core/gnulib/arg-nonnull.h +diff --git a/ChangeLog b/ChangeLog-2015 +similarity index 98% +rename from ChangeLog +rename to ChangeLog-2015 +index 41bcebf..869f6bf 100644 +--- a/ChangeLog ++++ b/ChangeLog-2015 +@@ -1,3 +1,889 @@ ++2015-01-23 Vladimir Serbinenko ++ ++ * tests/file_filter/file: Really add missing file. ++ ++2015-01-23 Andrei Borzenkov ++ ++ * grub-core/disk/xen/xendisk.c: Accept hdX as disk names on Xen to ++ allow legacy menu.lst processing. ++ ++2015-01-22 Felix Janda ++ ++ Remove direct _llseek code and require long filesystem libc. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ Remove potential division by 0 in gfxmenu. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/normal/menu_text.c (grub_menu_init_page): Avoid ++ returning 0 geometry to avoid divisions by 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/osdep/unix/cputime.c (grub_util_get_cpu_time_ms): Cache ++ sc_clk_tck and check it for sanity. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a ++ descriptor_size==0 to avoid potential divisions by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/osdep/haiku/getroot.c (grub_util_find_partition_start_os): ++ Avoid division by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/kern/generic/rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid ++ division by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that ++ no division by 0 occurs. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * include/grub/misc.h (grub_div_roundup): Remove as it's unused. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/term/gfxterm.c: Avoid division by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ Avoid division by zero in serial. ++ ++ * grub-core/term/serial.c (grub_cmd_serial): Ensure speed is not 0. ++ * grub-core/term/ns8250.c (serial_get_divisor): Exit if speed is 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/video/readers/jpeg.c: Avoid sivision by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/diskfilter.c: Validate volumes to avoid division ++ by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * include/grub/term.h: Avoid returining 0-sized terminal ++ as it may lead to division by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/zfs.c: Avoid divisions by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/btrfs.c: Avoid divisions by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/osdep/linux/blocklist.c (grub_install_get_blocklist): Check ++ blocksize validity. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size ++ validity. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not ++ divide by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem ++ sanity checks. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/minix.c: Additional filesystem ++ sanity checks. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/ext2.c (grub_ext2_mount): Additional ++ checks for superblock validity. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/ufs.c (grub_ufs_mount): Check ++ that sblock.ino_per_group is not 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ Reject NILFS2 superblocks with over 1GiB blocks. ++ ++ * grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that ++ block size is <= 1GiB. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/ata.c (grub_ata_setaddress): Check that geometry ++ is sane when using CHS addressing. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/commands/i386/pc/play.c (grub_cmd_play): Avoid ++ division by zero. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/bus/usb/usbtrans.c (grub_usb_bulk_maxpacket): Avoid ++ potentially returning 0. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/minix.c (grub_minix_read_file): Avoid reading past ++ the end of file. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/fs/fshelp.c (grub_fshelp_read_file): Don't attempt to read ++ past the end of file. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ * grub-core/script/lexer.c (grub_script_lexer_yywrap): Update len ++ synchronously with line. ++ ++2015-01-20 Vladimir Serbinenko ++ ++ Replace explicit sizeof divisions by ARRAY_SIZE. ++ ++2015-01-19 Kris Moore ++ ++ * grub-core/disk/geli.c: Support GELI v6 and v7. ++ ++2014-12-09 Andrei Borzenkov ++ ++ * grub-core/term/serial.c (grub_cmd_serial): Fix --rtscts ++ option processing. ++ ++2014-12-07 David Kozub ++ ++ * grub-core/kern/arm/misc.S: fix unaligned 64bit local variable ++ in __aeabi_uidivmod ++ Fixes Savannah bug #43632. ++ ++2014-12-07 Peter Nelson ++ ++ * grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse ++ chunks. ++ ++2014-12-07 Andrei Borzenkov ++ ++ * util/grub-mkconfig_lib.in (version_test_gt): Remove redundant ++ non-portable '-n' echo option. ++ * util/grub.d/10_kfreebsd.in: Change how list is built to avoid ++ non-portable 'echo -n. ++ * util/grub.d/10_linux.in: Likewise (closes 43668). ++ * util/grub.d/20_linux_xen.in: Likewise. ++ * util/grub.d/30_os-prober.in: Print spaces directly to avoid ++ non-portable 'echo -n'. ++ ++2014-12-07 Curtis Larsen ++ ++ * grub-core/net/tcp.c (grub_net_recv_tcp_packet): Fix double ++ free when multiple empty segments were received (closes 42765). ++ ++2014-12-05 Andrei Borzenkov ++ ++ * tests/util/grub-shell.in: Support --files also for netboot. ++ * tests/file_filter_test.in: New file with file filters tests. ++ * Makefile.util.def: Add file_filter_test. ++ * conf/Makefile.extra-dist: ... and here. ++ * tests/file_filter/file.gz: Test file for file_filter_test. ++ * tests/file_filter/file.gz.sig: Likewise. ++ * tests/file_filter/file.lzop: Likewise. ++ * tests/file_filter/file.lzop.sig: Likewise. ++ * tests/file_filter/file.xz: Likewise. ++ * tests/file_filter/file.xz.sig: Likewise. ++ * tests/file_filter/keys: Likewise. ++ * tests/file_filter/keys.pub: Likewise. ++ * tests/file_filter/test.cfg: Likewise. ++ * grub-core/commands/verify.c: Fix memory corruption doing ++ signature check for network files (closes 43601). ++ ++2014-12-01 Andrei Borzenkov ++ ++ * grub-core/loader/i386/xen_fileXX.c (grub_xen_get_infoXX): Fix ++ memory leak (CID 73645, 73782). ++ * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Fix memory leak ++ (CID 73635). ++ ++2014-11-30 Andrei Borzenkov ++ ++ * grub-core/lib/syslinux_parse.c (free_menu): Do not free ++ inline array (CID 73610). ++ ++2014-11-28 Andrei Borzenkov ++ ++ * grub-core/io/lzopio.c (test_header): Fix double free (CID 73665) ++ * grub-core/disk/geli.c (configure_ciphers): Fix memory leaks ++ (Coverity CID 73813, 73710) ++ * grub-core/disk/luks.c (configure_ciphers): Fix memory leaks ++ and use after free (Coverity CID 73813, 73710, 73730) ++ * grub-core/disk/luks.c (luks_recover_key): Fix memory leak (Coverity ++ CID 73854) ++ * util/grub-install-common.c (grub_install_get_target): Check return ++ value of grub_util_fd_read (Coverity CID 73819). ++ * util/grub-mkstandalone.c (add_tar_file): Fix out of bound access ++ to hd.magic (Coverity CID 73587, 73888, bug 43690). ++ ++2014-11-20 Andrei Borzenkov ++ ++ * tests/util/grub-fs-tester.in: Consistently print output ++ of grub ls if test fails. ++ ++2014-11-07 Leif Lindholm ++ ++ * grub-core/kern/efi/init.c: check value of *path before ++ dereferencing. ++ ++2014-11-03 Michael Chang ++ ++ * grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size ++ of neighbor solicitation packet in grub_netbuff_pull. ++ ++2014-10-14 Andrei Borzenkov ++ ++ * grub-core/loader/arm/linux.c: Use full initializer for initrd_ctx to ++ avoid fatal warnings with older gcc (probably before 4.7). ++ * grub-core/loader/arm64/linux.c: Likewise. ++ * grub-core/loader/i386/linux.c: Likewise. ++ * grub-core/loader/i386/pc/linux.c: Likewise. ++ * grub-core/loader/ia64/efi/linux.c: Likewise. ++ * grub-core/loader/mips/linux.c: Likewise. ++ * grub-core/loader/powerpc/ieee1275/linux.c: Likewise. ++ * grub-core/loader/sparc64/ieee1275/linux.c: Likewise. ++ ++2014-09-25 Colin Watson ++ ++ Fix in-tree --platform=none ++ ++ * configure.ac: Only remove include/grub/cpu and ++ include/grub/machine in the --platform=none case, not all of ++ include/grub. ++ ++2014-09-23 Colin Watson ++ ++ Add a new "none" platform that only builds utilities ++ ++ * configure.ac: Add "none" platform. Default to it for unsupported ++ CPUs rather than stopping with a fatal error. Don't downgrade ++ x86_64-none to i386. Define COND_real_platform Automake conditional ++ if the platform is anything other than "none". Don't do any include ++ directory linking for "none". ++ * Makefile.am: Skip building grub-core and all bootcheck targets if ++ !COND_real_platform. ++ * include/grub/time.h: Don't include if GRUB_UTIL ++ is defined. ++ ++2014-09-22 Andrei Borzenkov ++ ++ Use grub_cpu_to_XXX_compile_time for constants. ++ ++2014-09-21 Valentin Dornauer ++ ++ The AML parser implements only a small subset of possible AML ++ opcodes. On the Fujitsu Lifebook E744 this and another bug in ++ the parser (incorrect handling of TermArg data types) would lead ++ to the laptop not turning off (_S5 not found). ++ ++ * grub-core/commands/acpihalt.c: Support OpAlias in the AML parser; ++ in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs ++ aren't always simply strings!); Add function to skip TermArgs ++ * include/grub/acpi.h: Add new opcodes ++ ++2014-09-21 Vladimir Serbinenko ++ ++ * grub-core/normal/main.c: Don't drop to rescue console in ++ case of password-protected prompt and no menu entries. ++ ++2014-09-21 Vladimir Serbinenko ++ ++ * grub-core/commands/keylayouts.c: Ignore unknown keys. ++ ++2014-09-21 Vladimir Serbinenko ++ ++ * grub-core/gmodule.pl.in: Accept newer binutils which output ++ empty column rather than 0x0. ++ ++2014-09-21 Michael Chang ++ ++ * grub-core/osdep/unix/config.c: Remove extraneous comma. ++ ++2014-09-21 Peter Jones ++ ++ * grub-core/loader/arm/linux.c: Initialized initrd_ctx so ++ we don't free a random pointer from the stack. ++ * grub-core/loader/arm64/linux.c: Likewise. ++ * grub-core/loader/i386/linux.c: Likewise. ++ * grub-core/loader/i386/pc/linux.c: Likewise. ++ * grub-core/loader/ia64/efi/linux.c: Likewise. ++ * grub-core/loader/mips/linux.c: Likewise. ++ * grub-core/loader/powerpc/ieee1275/linux.c: Likewise. ++ * grub-core/loader/sparc64/ieee1275/linux.c: Likewise. ++ ++2014-09-15 Khem Raj ++ ++ * grub-core/kern/emu/hostfs.c: use _DEFAULT_SOURCE in addition to ++ _BSD_SOURCE to avoid warnings under glibc 2.20+. ++ ++2014-09-08 Michael Chang ++ ++ * grub-core/fs/btrfs.c (grub_btrfs_extent_read): Fix extent size ++ check; comparing &data->extent against addresses in the region it ++ points to is unpredictable. ++ ++2014-09-07 Colin Watson ++ ++ Support grub-emu on x32 (ILP32 but with x86-64 instruction set) ++ ++ * configure.ac: Remove -m64 from checks for -mcmodel=large and ++ -mno-red-zone. These are always either unnecessary (x86_64-emu) or ++ already in TARGET_CFLAGS at this point, and they produce incorrect ++ results when building for x32. ++ * grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast ++ pointers to Elf64_Xword via grub_addr_t, in order to work on x32. ++ * include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P, ++ GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32. ++ ++2014-09-07 Colin Watson ++ ++ * configure.ac: Remove several unnecessary semicolons. ++ ++2014-08-25 Colin Watson ++ ++ * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation): ++ Initialise pend to pacify GCC. ++ ++2014-08-14 Andrey Borzenkov ++ ++ * util/grub-mkconfig.in: Fix typo (gettext_print instead of ++ gettext_printf). ++ ++2014-08-13 Vladimir Serbinenko ++ ++ * grub-core/term/at_keyboard.c: Retry probing keyboard if ++ scancode setup failed. ++ ++2014-08-10 Vladimir Serbinenko ++ ++ * grub-core/kern/disk_common.c: Clump disk size to 1EiB. ++ ++2014-08-10 Vladimir Serbinenko ++ ++ * grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Add ++ safety to avoid triggerring VirtualBox bug. ++ ++2014-08-10 Vladimir Serbinenko ++ ++ * grub-core/fs/cbfs.c: Don't probe disks of unknow size. ++ ++ Fixes hang on virtualbox. ++ ++2014-07-08 Colin Watson ++ ++ * util/grub.d/10_hurd.in: Make kernel list progression not fail on ++ kernels whose paths contain regex metacharacters. ++ * util/grub.d/10_kfreebsd.in: Likewise. ++ * util/grub.d/10_linux.in: Likewise. ++ * util/grub.d/20_linux_xen.in: Likewise. ++ ++ Reported by: Heimo Stranner. ++ ++2014-06-26 Colin Watson ++ ++ * docs/grub-dev.texi (Finding your way around): The build system no ++ longer uses AutoGen directly. ++ ++2014-06-21 Роман Пехов ++ ++ * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check. ++ ++2014-06-21 Glenn Washburn ++ ++ * util/grub-install.c: Fix handling of --disk-module. ++ ++2014-06-21 Stephane Rochoy ++ ++ * grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to ++ EFI system table. ++ ++2014-06-21 Stephane Rochoy ++ ++ * grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show ++ EFI system table physical address. ++ ++2014-06-21 Trevor Woerner ++ ++ * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. ++ ++2014-06-21 Vladimir Serbinenko ++ ++ * grub-core/commands/verify.c (grub_pubkey_open): Trust procfs. ++ ++2014-06-21 Vladimir Serbinenko ++ ++ * grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk ++ check. ++ ++2014-04-20 Vladimir Serbinenko ++ ++ * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL. ++ ++ Reported by: Yves Blusseau . ++ ++2014-04-20 Piotr Krysiuk ++ ++ * grub-core/lib/i386/relocator.c: Allow loading old kernels by placing ++ GDT in conventional memory. ++ ++2014-04-10 Colin Watson ++ ++ * util/grub.d/30_os-prober.in: Tolerate devices with no filesystem ++ UUID. Other parts of grub-mkconfig tolerate these, they were ++ previously allowed here up to commit ++ 55e706c918922def17f5012c23cfe88c4c645208, and they can arise in ++ practice when the system has active LVM snapshots. ++ Fixes Ubuntu bug #1287436. ++ ++2014-04-10 Colin Watson ++ ++ * grub-core/disk/lvm.c (grub_lvm_detect): Search for ++ "logical_volumes" block a little more accurately. ++ ++2014-04-06 Vladimir Serbinenko ++ ++ * grub-core/lib/syslinux_parse.c: Fix timeout quoting. ++ ++2014-04-04 Vladimir Serbinenko ++ ++ * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer ++ pulled from libgcc. ++ ++2014-04-04 Vladimir Serbinenko ++ ++ Replace few instances of memcmp/memcpy in the code that should be ++ grub_memcmp/grub_memcpy. ++ ++2014-04-03 Vladimir Serbinenko ++ ++ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe ++ device names. ++ ++2014-03-31 Thomas Falcon ++ ++ 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. ++ ++2014-03-31 Colin Watson ++ ++ Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig. ++ ++ Commit 588744d0dc655177d5883bdcb8f72ff5160109ed caused grub-mkconfig ++ no longer to be forgiving of trailing spaces on grub-probe output ++ lines, which among other things means that util/grub.d/10_linux.in ++ no longer detects LVM. To fix this, make grub-probe's output ++ delimiting more consistent. As a bonus, this improves the coverage ++ of the -0 option. ++ ++ Fixes Debian bug #735935. ++ ++ * grub-core/disk/cryptodisk.c ++ (grub_util_cryptodisk_get_abstraction): Add a user-data argument. ++ * grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap): ++ Likewise. ++ * include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction): ++ Update prototype. ++ * include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise. ++ * util/grub-install.c (push_partmap_module, push_cryptodisk_module, ++ probe_mods): Adjust for extra user-data arguments. ++ * util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid, ++ probe_abstraction): Use configured delimiter. Update callers. ++ ++2014-03-31 Colin Watson ++ ++ * util/grub-probe,c (options): Make -0 work again (broken by ++ conversion to argp). ++ (main): Simplify logic. ++ ++2014-03-26 Vladimir Serbinenko ++ ++ * grub-core/lib/relocator.c: Fix the case when end of leftover is used. ++ ++2014-03-26 Fu Wei ++ ++ * grub-core/loader/arm64/linux.c: Remove redundant "0x". ++ ++2014-02-28 Vladimir Serbinenko ++ ++ * include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields. ++ * grub-core/loader/i386/bsd.c (grub_cmd_openbsd): Fill addr field. ++ ++ Suggested by: Markus Müller. ++ ++2014-02-28 Vladimir Serbinenko ++ ++ * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map ++ if E820 failed to return any regions. ++ ++2014-02-28 Vladimir Serbinenko ++ ++ * grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low ++ tables for low memory calculations. ++ ++2014-02-28 Vladimir Serbinenko ++ ++ * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit ++ location to 640K. ++ ++2014-02-28 Vladimir Serbinenko ++ ++ * grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000 ++ region. ++ ++2014-02-20 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI ++ exclusively. ++ ++2014-02-04 Paulo Flabiano Smorigo ++ ++ Add bootpath 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_bootpath ++ and call it at grub_ieee1275_net_config_real. ++ * grub-core/kern/ieee1275/init.c: Add bootpath to ++ grub_ieee1275_net_config. ++ * include/grub/ieee1275/ieee1275.h: Likewise. ++ ++ ++2014-02-04 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. ++ * include/grub/net.h: Likewise. ++ ++2014-02-03 Vladimir Serbinenko ++ ++ * util/grub-mkrescue.c: Build fix for argp.h with older gcc. ++ ++2014-02-03 Vladimir Serbinenko ++ ++ * util/grub-mkfont.c: Build fix for argp.h with older gcc. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to ++ 7 seconds to recover if last poweroff was bad. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Properly handle transactions with no ++ transferred data. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Add safety cleanups. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Allocate and clean space for all possible 32 ++ slots to avoid pointing to uninited area. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/disk/ahci.c: Do not enable I/O decoding and keep ++ enabling busmaster for the end. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * util/grub-mkfont.c: Downgrade warnings about unhandled features ++ to debug. ++ ++2014-01-29 Vladimir Serbinenko ++ ++ * grub-core/term/at_keyboard.c: Tolerate missing keyboard. ++ ++2014-01-29 Paulo Flabiano Smorigo ++ ++ * .gitignore: add missing files and .exe variants. ++ ++2014-01-26 Mike Gilbert ++ ++ grub-install: support for partitioned partx loop devices. ++ ++ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect ++ /dev/loopX as being the parent of /dev/loopXpY. ++ ++2014-01-26 Vladimir Serbinenko ++ ++ * grub-core/term/serial.c (grub_serial_register): Fix invalid free. ++ Ensure that pointers are inited to NULL and that pointers are not ++ accessed after free. ++ ++2014-01-25 Andrey Borzenkov ++ ++ * include/grub/crypto.h: Replace __attribute__ ((format (printf)) with ++ __attribute__ ((format (__printf__)) to fix compilation under MinGW-w64. ++ * include/grub/emu/misc.h: ... and here. ++ * include/grub/err.h: ... and here. ++ * util/import_gcry.py: ... and here (in files g10lib.h). ++ ++2014-01-25 Andrey Borzenkov ++ ++ * util/grub-mkimage.c: Make prefix argument mandatory. ++ ++2014-01-24 Vladimir Serbinenko ++ ++ Fix several translatable strings. ++ ++ Suggested by: D. Prévot. ++ ++2014-01-24 Vladimir Serbinenko ++ ++ * util/grub-install.c: List available targets. ++ ++2014-01-23 Colin Watson ++ ++ * util/grub-install.c (write_to_disk): Add an info message. ++ ++2014-01-21 Andrey Borzenkov ++ ++ * Makefile.am: Allow adding extra files to generated Windows ZIP ++ archive by setting GRUB_WINDOWS_EXTRA_DIST. ++ ++2014-01-21 Andrey Borzenkov ++ ++ * configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype. ++ Show detected font path in summary. ++ ++2014-01-21 Paulo Flabiano Smorigo ++ ++ * 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. ++ ++2014-01-21 Paulo Flabiano Smorigo ++ ++ * grub-core/net/net.c (receive_packets): 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. ++ ++2014-01-19 Colin Watson ++ ++ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore ++ EPERM when modifying kern.geom.debugflags. It is only a problem for ++ such things as installing GRUB to the MBR, in which case there'll be ++ an error later anyway, not for opening files during tests. ++ ++2014-01-18 Andrey Borzenkov ++ ++ * grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES ++ instead of MOD_FILES. ++ * grub-core/genemuinit.sh: Simplify stripping of suffix so it works ++ both with and without .exe. ++ * grub-core/genemuinitheader.sh: Same. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * util/grub-install.c: Fix a typo. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * grub-core/normal/main.c (read_config_file): Buffer config file. ++ Reduces boot time. ++ ++2014-01-18 Andrey Borzenkov ++ ++ * acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove ++ symbolic link to directory. It fails in Msys shell on Windows 2003. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * Makefile.am (default_payload.elf): Add modules ++ multiboot cbmemc linux16 gzio echo help. ++ ++2014-01-18 Mike Gilbert ++ ++ * Makefile.util.def: Link grub-ofpathname with zfs libs. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * grub-core/commands/macbless.c: Rename FILE and DIR to avoid ++ conflicts. ++ ++ Reported by: Andrey Borzenkov. ++ ++2014-01-18 Andrey Borzenkov ++ ++ * include/grub/misc.h: Move macros for compiler features to ... ++ * include/grub/compiler.h: ... new file. ++ * include/grub/list.h: Include instead of . ++ * grub-core/commands/fileXX.c: Include . ++ * grub-core/efiemu/prepare.c: Include . ++ * grub-core/loader/i386/xen_file.c: Include . ++ * grub-core/loader/i386/xen_fileXX.c: Include . ++ * grub-core/video/capture.c: Include . ++ * include/grub/command.h: Include . ++ * include/grub/dl.h: Include . ++ * include/grub/procfs.h: Include . ++ ++2014-01-18 Andrey Borzenkov ++ ++ * configure.ac: Add support for BUILD_EXEEXT and use it ... ++ * Makefile.am: ... here. ++ * Makefile.util.def: ... and here. ++ * grub-core/Makefile.am: ... and here. ++ ++2014-01-18 Andrey Borzenkov ++ ++ * include/grub/osdep/hostfile_windows.h: Use _W64 instead of ++ FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * grub-core/term/terminfo.c: Recognize keys F1-F12. ++ ++2014-01-18 Andrey Borzenkov ++ ++ * configure.ac: Add support for BUILD_LDFLAGS. ++ * Makefile.am: Use BUILD_LDFLAGS for build time programs here ... ++ * grub-core/Makefile.am: ... and here. ++ * INSTALL: Mention BUILD_LDFLAGS. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * util/grub-mount.c: Extend GCC warning workaround to grub-mount. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * grub-core/kern/efi/efi.c: Ensure that the result starts with / ++ and has no //. ++ ++2014-01-18 Vladimir Serbinenko ++ ++ * NEWS: Add few missing entries. ++ ++2014-01-17 Colin Watson ++ ++ * util/grub.d/00_header.in (make_timeout): Use && rather than test ++ -a. ++ * util/grub.d/10_windows.in: Likewise. ++ * util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather ++ than test -o. ++ * util/grub.d/30_os-prober.in: Use && rather than test -a, and || ++ rather than test -o. ++ ++2014-01-17 Colin Watson ++ ++ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove ++ redundant preprocessor conditional. ++ ++2014-01-08 Colin Watson ++ ++ * Makefile.util.def (grub-macbless): Change mansection to 8. ++ ++2014-01-07 Leif Lindholm ++ ++ * grub-core/loader/arm64/linux.c: correctly set device path end length. ++ ++2014-01-07 Andrey Borzenkov ++ ++ * util/grub-install.c: Use bootaa64.efi instead of bootaarch64.efi on ++ arm64 to comply with EFI specification. Also use grubaa64.efi for ++ consistency. ++ * util/grub-mkrescue.c: Change to use bootaa64.efi too. ++ ++2014-01-07 Andrey Borzenkov ++ ++ * include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello ++ on MinGW-64 when compiling for 32 bits. ++ ++2013-12-30 Andrey Borzenkov ++ ++ * grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi. ++ ++2013-12-30 Vladimir Serbinenko ++ ++ * NEWS: Add few missing entries. Correct existing ones. ++ ++2013-12-28 Vladimir Serbinenko ++ ++ Don't abort() on unavailable coreboot tables if not running on coreboot. ++ ++2013-12-28 Andrey Borzenkov ++ ++ * grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation ++ on mingw. ++ ++2013-12-28 Colin Watson ++ ++ * NEWS: The cmosclean command in fact dates back to 1.99. Remove ++ mention of it from 2.02. ++ ++2013-12-27 Vladimir Serbinenko ++ ++ * grub-core/kern/arm/cache_armv6.S: Remove .arch directive. ++ ++ As these functions are used on pre-ARMv6 CPUs as well we don't want ++ to make assembler assume that architecture is higher than default one. ++ ++2013-12-27 Colin Watson ++ ++ * NEWS: First draft of 2.02 entry. ++ ++2013-12-27 Colin Watson ++ ++ * INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes. ++ * docs/grub.texi (Getting the source code): Likewise. ++ ++2013-12-25 Andrey Borzenkov ++ ++ * grub-core/osdep/windows/platform.c (get_platform): Fix EFI ++ detection. ++ + 2013-12-24 Vladimir Serbinenko + + * configure.ac: Set version to 2.02~beta2. +@@ -411,10 +1297,6 @@ + + 2013-12-18 Vladimir Serbinenko + +- Use -Wl,--no-relax rather than -mno-relax for uniformity. +- +-2013-12-18 Vladimir Serbinenko +- + * INSTALL: Update comment as to why sparc64 clang isn't usable. + + 2013-12-18 Vladimir Serbinenko +@@ -866,7 +1748,7 @@ + + 2013-12-14 Vladimir Serbinenko + +- * .gitignore: Add .exe variants. Add missing files. Remove few outdated ++ * .gitignore: add .exe variants. add missing files. remove few outdated + entries. + + 2013-12-14 Vladimir Serbinenko +diff --git a/INSTALL b/INSTALL +index afc957c..e5b0811 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -13,6 +13,9 @@ configuring the GRUB. + + * GCC 4.1.3 or later + Note: older versions may work but support is limited ++ ++ Experimental support for clang 3.3 or later (results in much bigger binaries) ++ for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc, sparc64 + Note: clang 3.2 or later works for i386 and x86_64 targets but results in + much bigger binaries. + earlier versions not tested +@@ -26,7 +29,8 @@ configuring the GRUB. + fail. + Note: clang 3.2 or later works for powerpc + earlier versions not tested +- Note: clang doesn't support -mno-app-regs and so can't be used for sparc64 ++ Note: clang 3.5 or later works for sparc64 ++ earlier versions return "error: unable to interface with target machine" + Note: clang has no support for ia64 and hence you can't compile GRUB + for ia64 with clang + * GNU Make +@@ -35,6 +39,7 @@ configuring the GRUB. + * GNU binutils 2.9.1.0.23 or later + * Flex 2.5.35 or later + * Other standard GNU/Unix tools ++* a libc with large file support (e.g. glibc 2.1 or later) + + On GNU/Linux, you also need: + +@@ -99,6 +104,9 @@ The simplest way to compile this package is: + + 3. Type `./autogen.sh'. + ++ * autogen.sh uses python. By default invocation is "python" but can be ++ overriden by setting variable $PYTHON. ++ + 4. Type `./configure' to configure the package for your system. + If you're using `csh' on an old version of System V, you might + need to type `sh ./configure' instead to prevent `csh' from trying +@@ -140,7 +148,7 @@ If build and host are different make check isn't available. + If build and host are different man pages are not generated. + + As an example imagine you have a build system running on FreeBSD on sparc +-which prepares packages for developpers running amd64 GNU/Linux laptop and ++which prepares packages for developers running amd64 GNU/Linux laptop and + they need to make images for ARM board running U-boot. In this case: + + build=sparc64-freebsd +@@ -149,7 +157,7 @@ target=arm-uboot + + For this example the configure line might look like (more details below) + (some options are optional and included here for completeness but some rarely +-used options are omited): ++used options are omitted): + + ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu + CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config +@@ -168,14 +176,15 @@ corresponding platform are not needed for the platform in question. + generate sin and cos tables. + 2. BUILD_CFLAGS= for C options for build. + 3. BUILD_CPPFLAGS= for C preprocessor options for build. +- 4. BUILD_FREETYPE= for freetype-config for build (optional). ++ 4. BUILD_LDFLAGS= for linker options for build. ++ 5. BUILD_FREETYPE= for freetype-config for build (optional). + + - For host + 1. --host= to autoconf name of host. + 2. CC= for gcc able to compile for host +- 3. CFLAGS= for C options for host. +- 4. CPPFLAGS= for C preprocessor options for host. +- 5. LDFLAGS= for linker options for host. ++ 3. HOST_CFLAGS= for C options for host. ++ 4. HOST_CPPFLAGS= for C preprocessor options for host. ++ 5. HOST_LDFLAGS= for linker options for host. + 6. FREETYPE= for freetype-config for host (optional). + 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional). + 8. Libfuse if any must be in standard linker folders (-lfuse) (optional). +@@ -196,9 +205,9 @@ corresponding platform are not needed for the platform in question. + 11. TARGET_RANLIB= for ranlib for target. + + - Additionally for emu, for host and target. +- 1. SDL is looked for in stadard linker directories (-lSDL) (optional) +- 2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional) +- 3. libusb is looked for in stadard linker directories (-lusb) (optional) ++ 1. SDL is looked for in standard linker directories (-lSDL) (optional) ++ 2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional) ++ 3. libusb is looked for in standard linker directories (-lusb) (optional) + + - Platform-agnostic tools and data. + 1. make is the tool you execute after ./configure. +diff --git a/Makefile.am b/Makefile.am +index 320e86f..994ebbd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,7 +1,11 @@ + AUTOMAKE_OPTIONS = subdir-objects -Wno-portability + + DEPDIR = .deps-util +-SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d ++SUBDIRS = grub-core/gnulib . ++if COND_real_platform ++SUBDIRS += grub-core ++endif ++SUBDIRS += po docs util/bash-completion.d + + include $(top_srcdir)/conf/Makefile.common + include $(top_srcdir)/conf/Makefile.extra-dist +@@ -66,22 +70,22 @@ endif + + starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 + +-build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) +-CLEANFILES += build-grub-mkfont ++build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) ++CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT) + +-garbage-gen: util/garbage-gen.c +- $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^ +-CLEANFILES += garbage-gen ++garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c ++ $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ ++CLEANFILES += garbage-gen$(BUILD_EXEEXT) + EXTRA_DIST += util/garbage-gen.c + +-build-grub-gen-asciih: util/grub-gen-asciih.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror +-CLEANFILES += build-grub-gen-asciih ++build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror ++CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT) + +-build-grub-gen-widthspec: util/grub-gen-widthspec.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror +-CLEANFILES += build-grub-gen-widthspec ++build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror ++CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT) + + if COND_STARFIELD + starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files) +@@ -132,6 +136,8 @@ nodist_platform_HEADERS = config.h + pkgdata_DATA += grub-mkconfig_lib + + ++if COND_real_platform ++ + if COND_i386_coreboot + QEMU32=qemu-system-i386 + endif +@@ -383,12 +389,10 @@ if COND_powerpc_ieee1275 + BOOTCHECKS = bootcheck-linux-ppc + endif + +-EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S +- + .PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \ + bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \ + bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \ +- bootcheck-linux-mips ++ bootcheck-linux-mips FORCE + + # Randomly generated + SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d +@@ -399,9 +403,13 @@ bootcheck: $(BOOTCHECKS) + + if COND_i386_coreboot + default_payload.elf: grub-mkstandalone grub-mkimage +- pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg ++ pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg + endif + ++endif ++ ++EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S ++ + windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows + windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA) + test -d $(windowsdir) && rm -rf $(windowsdir) || true +@@ -420,10 +428,33 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA) + for x in $(starfield_DATA); do \ + cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \ + done ++ for x in $(GRUB_WINDOWS_EXTRA_DIST); do \ ++ cp -fp $$x $(windowsdir); \ ++ done + + windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip + windowszip: windowsdir + test -f $(windowszip) && rm $(windowszip) || true + zip -r $(windowszip) $(windowsdir) ++ rm -rf $(windowsdir) + + EXTRA_DIST += linguas.sh ++ ++changelog_start_date = 2015-01-23 ++gitlog_to_changelog = $(top_srcdir)/build-aux/gitlog-to-changelog ++ ++ChangeLog: FORCE ++ if test -d $(top_srcdir)/.git; then \ ++ $(gitlog_to_changelog) --srcdir=$(top_srcdir) --since=$(changelog_start_date) > '$@.tmp'; \ ++ rm -f '$@'; mv '$@.tmp' '$@'; \ ++ else \ ++ touch $@; \ ++ fi ++ ++EXTRA_DIST += ChangeLog ChangeLog-2015 ++ ++syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg ++ ++tests/syslinux/ubuntu10.04_grub.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg.in ++ (for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:- ++CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg +diff --git a/Makefile.util.def b/Makefile.util.def +index 985e76c..3cb6b21 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -384,7 +384,7 @@ program = { + ldadd = libgrubgcry.a; + ldadd = libgrubkern.a; + ldadd = grub-core/gnulib/libgnu.a; +- ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)'; ++ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + }; + + program = { +@@ -405,7 +405,7 @@ program = { + program = { + name = grub-macbless; + installdir = sbin; +- mansection = 1; ++ mansection = 8; + common = util/grub-macbless.c; + common = grub-core/osdep/init.c; + common = grub-core/kern/emu/argp_common.c; +@@ -613,7 +613,6 @@ program = { + common = grub-core/disk/host.c; + + common = util/resolve.c; +- enable = noemu; + common = grub-core/kern/emu/argp_common.c; + common = grub-core/osdep/init.c; + +@@ -708,7 +707,7 @@ script = { + name = grub-fs-tester; + common = tests/util/grub-fs-tester.in; + installdir = noinst; +- dependencies = garbage-gen; ++ dependencies = 'garbage-gen$(BUILD_EXEEXT)'; + }; + + script = { +@@ -1150,6 +1149,24 @@ script = { + common = tests/grub_cmd_tr.in; + }; + ++script = { ++ testcase; ++ name = file_filter_test; ++ common = tests/file_filter_test.in; ++}; ++ ++script = { ++ testcase; ++ name = grub_cmd_test; ++ common = tests/grub_cmd_test.in; ++}; ++ ++script = { ++ testcase; ++ name = syslinux_test; ++ common = tests/syslinux_test.in; ++}; ++ + program = { + testcase; + name = example_unit_test; +diff --git a/NEWS b/NEWS +index 4bb5f98..4abd873 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,158 @@ ++New in 2.02: ++ ++* New/improved filesystem and disk support: ++ * Big-endian UFS1. ++ * Experimental 64-bit ext2 support. ++ * Various fixes for non-512-byte sector devices. ++ * New `proc' filesystem framework, used by LUKS disks. ++ * Fix DM-RAID partition handling. ++ * New `nativedisk' command to switch from firmware to native disk drivers. ++ * Compressed HFS+. ++ * DragonFly BSD labels. ++ * CBFS (coreboot). ++ * Handle partitioned LVM properly. ++ * Use LVM UUIDs whenever possible. ++ * GPT PReP. ++ * New `progress' module that shows progress information while reading ++ files. ++ * ZFS features support. ++ * ZFS LZ4 support. ++ * XFS V5 format support. ++ ++* New/improved terminal and video support: ++ * Monochrome text (matching `hercules' in GRUB Legacy). ++ * Morse code output using system speaker. ++ * `spkmodem' output (simple data protocol using system speaker). ++ * Handle Japanese special keys. ++ * coreboot framebuffer. ++ * Serial on ARC. ++ * Native vt100 handling for grub-emu, replacing the use of the curses ++ library. ++ * New gfxmenu options for terminal window positioning, theme background ++ image handling, and scrollbar padding, plus `item_pixmap_style' and ++ `highlight_overlay'. ++ * Support several more image types (paletted and greyscale). ++ ++* Boot protocol improvements: ++ * Support Apple FAT binaries on non-Apple platforms. ++ * Improve FreeDOS direct loading support compatibility. ++ * Enable `linux16' on all x86 platforms, not just BIOS. ++ * New TrueCrypt ISO loader. ++ * multiboot2 boot-services EFI specification. ++ * multiboot2 EFI memory map specification. ++ * multiboot2 full-file specfication. ++ ++* New/improved network support: ++ * New variables `net_default_*' containing properties of the default ++ interface. ++ * Autoload `http' and `tftp' modules if necessary. ++ * Improve TFTP robustness. ++ * Parse `nd' disk names in GRUB Legacy configuration files. ++ * Issue separate DNS queries for IPv4 and IPv6. ++ ++* Coreboot improvements: ++ * CBFS support both in on-disk images (loopback) and flash. ++ * Ability to launch another payload from flash or disk ++ * Coreboot framebuffer ++ * CBMEMC support (both logging and inspecting logs) ++ * Command for inspecting coreboot timestamps (`coreboot_boottime'). ++ * Command for inspecting coreboot tables (`lscoreboot'). ++ * New target default_payload.elf. ++ * Increased maximal core size. ++ ++* New/improved platform support: ++ * New `efifwsetup' and `lsefi' commands on EFI platforms. ++ * New `cmosdump' and `cmosset' commands on platforms with CMOS support. ++ * New command `pcidump' for PCI platforms. ++ * Improve opcode parsing in ACPI halt implementation. ++ * Use the TSC as a possible time source on i386-ieee1275. ++ * Merge PowerPC grub-mkrescue implementation with the common one. ++ * Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such ++ as pSeries, and mips-arc. ++ * Make grub-mkrescue better support Apple Intel Macs on CD. ++ * Enable GRUB Legacy configuration file parsing on EFI. ++ * Support halt for Loongson 2E. ++ * ARM U-Boot and EFI ports. ++ * Reorganise platform-dependent code in utilities to avoid #ifdef mess. ++ * AROS and Haiku support for userspace utilities. ++ * Xen PV port. ++ * Fix EFI stack alignment. ++ * ARM64 EFI port. ++ * On Linux, read partition start offsets from sysfs if possible. ++ * New grub-macbless utility, and better integration with Mac firmware in ++ grub-install. ++ * Support Yeeloong 3A. ++ * Add `cpuid --pae' option to detect Physical Address Extension on x86. ++ * Support for USB debug dongles. ++ * Support for *-emu on all platforms (previously only i386/x86_64 worked). ++ * Support *-emu on Windows. ++ * New platform `none' which builds only user level utilities. This is now ++ default if target CPU is not supported. ++ ++* Security: ++ * Add optional facility to enforce that all files read by the core image ++ from disk have a valid detached digital signature. ++ ++* Performance: ++ * Avoid costly division operations in many places. ++ * New boot time analysis framework (`./configure --enable-boot-time'). ++ * Initialise USB ports in parallel. ++ * New `testspeed' command to test file read speed. ++ * Speed-up gfxterm by storing intermediate results in more compact format. ++ * Lazy LVM/mdraid scan. ++ * Disk hints. ++ ++* Scripting: ++ * New `eval' and `tr' commands. ++ * grub-script-check fails on scripts containing no commands. ++ ++* Installation and other utility improvements: ++ * Add option to compress files on installation or image creation. ++ * Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'. ++ * Support probing EFI System Partition (requires os-prober >= 1.58). ++ * Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and ++ `GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently. ++ * grub-mount handles symbolic links to directories. ++ * Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key ++ for grub-mkconfig. ++ * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone ++ rewritten in C. They should now work in supported non-Unix-like ++ environments. ++ * Native mingw support. ++ * Ability to install on EFI under windows. ++ * Reorganise timeout handling using new `timeout_style' environment ++ variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig. ++ Menu hotkeys pressed during a hidden timeout now boot the corresponding ++ menu entry immediately. ++ * New `file' command and grub-file utility to check file types. ++ * New syslinux configuration file parser. ++ ++* Build system: ++ * Remove all uses of nested functions; GRUB no longer requires an ++ executable stack. ++ * Fix documentation build with Texinfo >= 5.1. ++ * More robust and documented cross-compiling support. ++ * Partial clang support for some platforms (experimental). ++ * Partial mingw64 x86_64-efi compile support (highly experimental). ++ * Partial mingw32 i386-* (other than already present i386-pc) ++ compile support (highly experimental). ++ * Support for grub-mkpasswd on Windows. ++ * Eliminate the use of AutoGen. This allowed some performance ++ improvements to the build system. ++ * Remove variable length arrays. ++ * OpenBSD compile and tools support (NetBSD and FreeBSD were already supported). ++ * Fix build with FreeType >= 2.5.1. ++ * Make gentpl.py compatible with Python 3. It now requires at least ++ Python 2.6. ++ * modinfo.sh contains build information now. ++ * Added many new tests to improve robustness. ++ * Target is built without libgcc now. Necessary builtins are reimplemented ++ directly. This removes requirement for target-specific runtime on build ++ system. ++ * emu libusb support removed (was broken and unmaintained). ++ ++* Revision control moved to git. ++ + New in 2.00: + + * Appearance: +@@ -24,7 +179,6 @@ New in 2.00: + * IEEE1275 serial. + * EFI serial. + * Network stack for BIOS, IEEE1275, EMU and EFI, including TFTP, HTTP and DNS. +- * VBE on coreboot support. + + * New filesystem, filters and disks formats: + * DVH partition map. +@@ -48,7 +202,7 @@ New in 2.00: + * multidevice, mirrored and raidz(2,3) ZFS support. + * RAID LVM (internal RAIDing) support. + * ZFS crypto support. +- * ZLE and GZIP on ZFS support. ++ * ZLE, LZ4 and GZIP on ZFS support. + * Support ZFS up to 33. + * HFS string is now treated like mac-roman and not UTF-8 + * HFS mtime support. +diff --git a/acinclude.m4 b/acinclude.m4 +index 32d5477..526f97a 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -93,7 +93,7 @@ else + fi + grub_cv_prog_objcopy_absolute=yes + for link_addr in 0x2000 0x8000 0x7C00; do +- if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then : ++ if AC_TRY_COMMAND([${CC-cc} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then : + else + AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) + fi +@@ -210,80 +210,6 @@ fi + ]) + + +-dnl Mass confusion! +-dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit +-dnl instructions, but implicitly insert addr32 and data32 bytes so +-dnl that the code works in real mode''. +-dnl +-dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit +-dnl instructions,'' which seems right. This requires the programmer +-dnl to explicitly insert addr32 and data32 instructions when they want +-dnl them. +-dnl +-dnl We only support the newer versions, because the old versions cause +-dnl major pain, by requiring manual assembly to get 16-bit instructions into +-dnl asm files. +-AC_DEFUN([grub_I386_ASM_ADDR32], +-[AC_REQUIRE([AC_PROG_CC]) +-AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT]) +-AC_MSG_CHECKING([for .code16 addr32 assembler support]) +-AC_CACHE_VAL(grub_cv_i386_asm_addr32, +-[cat > conftest.s.in <<\EOF +- .code16 +-l1: @ADDR32@ movb %al, l1 +-EOF +- +-if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then +- sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s +-else +- sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s +-fi +- +-if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then +- grub_cv_i386_asm_addr32=yes +-else +- grub_cv_i386_asm_addr32=no +-fi +- +-rm -f conftest*]) +- +-AC_MSG_RESULT([$grub_cv_i386_asm_addr32])]) +- +-dnl Later versions of GAS requires that addr32 and data32 prefixes +-dnl appear in the same lines as the instructions they modify, while +-dnl earlier versions requires that they appear in separate lines. +-AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT], +-[AC_REQUIRE([AC_PROG_CC]) +-AC_MSG_CHECKING(dnl +-[whether addr32 must be in the same line as the instruction]) +-AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement, +-[cat > conftest.s <<\EOF +- .code16 +-l1: addr32 movb %al, l1 +-EOF +- +-if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then +- grub_cv_i386_asm_prefix_requirement=yes +-else +- grub_cv_i386_asm_prefix_requirement=no +-fi +- +-rm -f conftest*]) +- +-if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then +- grub_tmp_addr32="addr32" +- grub_tmp_data32="data32" +-else +- grub_tmp_addr32="addr32;" +- grub_tmp_data32="data32;" +-fi +- +-ADDR32=$grub_tmp_addr32 +-DATA32=$grub_tmp_data32 +- +-AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])]) +- +- + dnl Check what symbol is defined as a bss start symbol. + dnl Written by Michael Hohmoth and Yoshinori K. Okuji. + AC_DEFUN([grub_CHECK_BSS_START_SYMBOL], +@@ -418,15 +344,15 @@ else + [fi] + ]) + +-dnl Check if ln can handle directories properly (mingw). ++dnl Check if ln -s can handle directories properly (mingw). + AC_DEFUN([grub_CHECK_LINK_DIR],[ +-AC_MSG_CHECKING([whether ln can handle directories properly]) ++AC_MSG_CHECKING([whether ln -s can handle directories properly]) + [mkdir testdir 2>/dev/null + case $srcdir in + [\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;; + *) reldir=../$srcdir/include/grub/util ;; + esac +-if ln -s $reldir testdir/util 2>/dev/null ; then] ++if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null ; then] + AC_MSG_RESULT([yes]) + [link_dir=yes + else +diff --git a/asm-tests/arm.S b/asm-tests/arm.S +new file mode 100644 +index 0000000..97c2546 +--- /dev/null ++++ b/asm-tests/arm.S +@@ -0,0 +1,20 @@ ++/* on arm clang doesn't support .arch directive */ ++ ++ .text ++ .syntax unified ++ ++#if !defined (__thumb2__) ++ .arch armv7a ++ .arm ++#else ++ .arch armv7 ++ .thumb ++#endif ++ mcr p15, 0, r11, c7, c14, 2 ++ ++ /* clang restricts access to dsb/isb despite .arch */ ++ dsb ++ isb ++ ++ ++ +diff --git a/asm-tests/i386-pc.S b/asm-tests/i386-pc.S +new file mode 100644 +index 0000000..97cd32a +--- /dev/null ++++ b/asm-tests/i386-pc.S +@@ -0,0 +1,10 @@ ++/* on x86 old clang doesn't support .code16 ++ newer clang supports it but creates 6-byte jumps instead of 3-byte ones ++ which makes us go over boot sector size. */ ++ ++ .code16 ++ jmp far ++ .org 4 ++ .space 300 ++far: ++ .byte 0 +diff --git a/asm-tests/i386.S b/asm-tests/i386.S +new file mode 100644 +index 0000000..30adc4f +--- /dev/null ++++ b/asm-tests/i386.S +@@ -0,0 +1,4 @@ ++/* on x86 old clang doesn't support .code16 */ ++ ++ .code16 ++ movb %al, %bl +diff --git a/asm-tests/mips.S b/asm-tests/mips.S +new file mode 100644 +index 0000000..8233dfc +--- /dev/null ++++ b/asm-tests/mips.S +@@ -0,0 +1,11 @@ ++/* on mips clang doesn't support privilegied instructions, doubleword store/load ++ and crashes with hand-written assembly ++ */ ++ ++ .set mips3 ++ sync ++ ld $t2, 0($t6) ++ ++a: ++ addiu $t7, $s0, (b - a) ++b: nop +diff --git a/asm-tests/powerpc.S b/asm-tests/powerpc.S +new file mode 100644 +index 0000000..396a6cc +--- /dev/null ++++ b/asm-tests/powerpc.S +@@ -0,0 +1,8 @@ ++/* clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly ++ used by gcrypt */ ++/* Cache invalidation loop is a fair test. */ ++ li 5, 0 ++1: icbi 5, 3 ++ addi 5, 5, 32 ++ cmpw 5, 4 ++ blt 1b +diff --git a/asm-tests/sparc64.S b/asm-tests/sparc64.S +new file mode 100644 +index 0000000..03c5fe0 +--- /dev/null ++++ b/asm-tests/sparc64.S +@@ -0,0 +1,9 @@ ++ .text ++1: ++ /* A small list of examples of what clang doesn't support. */ ++ clr %o0 ++ lduw [%o4 + 4], %o4 ++ and %o6, ~0xff, %o6 ++ stw %o5, [%o3] ++ bne,pt %icc, 1b ++ nop +diff --git a/autogen.sh b/autogen.sh +index 7424428..5020456 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -2,6 +2,9 @@ + + set -e + ++# Set ${PYTHON} to plain 'python' if not set already ++: ${PYTHON:=python} ++ + export LC_COLLATE=C + unset LC_ALL + +@@ -9,10 +12,10 @@ find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './b + find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in + + echo "Importing unicode..." +-python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c ++${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c + + echo "Importing libgcrypt..." +-python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core ++${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core + sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h + if [ -f include/grub/gcrypt/g10lib.h ]; then + rm include/grub/gcrypt/g10lib.h +@@ -54,8 +57,8 @@ for extra in contrib/*/Makefile.core.def; do + fi + done + +-python gentpl.py $UTIL_DEFS > Makefile.util.am +-python gentpl.py $CORE_DEFS > grub-core/Makefile.core.am ++${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am ++${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am + + for extra in contrib/*/Makefile.common; do + if test -e "$extra"; then +diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog +new file mode 100755 +index 0000000..78afff4 +--- /dev/null ++++ b/build-aux/gitlog-to-changelog +@@ -0,0 +1,432 @@ ++eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' ++ & eval 'exec perl -wS "$0" $argv:q' ++ if 0; ++# Convert git log output to ChangeLog format. ++ ++my $VERSION = '2012-07-29 06:11'; # UTC ++# The definition above must lie within the first 8 lines in order ++# for the Emacs time-stamp write hook (at end) to update it. ++# If you change this file with Emacs, please let the write hook ++# do its job. Otherwise, update this string manually. ++ ++# Copyright (C) 2008-2014 Free Software Foundation, Inc. ++ ++# This program 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. ++ ++# This program 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 this program. If not, see . ++ ++# Written by Jim Meyering ++ ++use strict; ++use warnings; ++use Getopt::Long; ++use POSIX qw(strftime); ++ ++(my $ME = $0) =~ s|.*/||; ++ ++# use File::Coda; # http://meyering.net/code/Coda/ ++END { ++ defined fileno STDOUT or return; ++ close STDOUT and return; ++ warn "$ME: failed to close standard output: $!\n"; ++ $? ||= 1; ++} ++ ++sub usage ($) ++{ ++ my ($exit_code) = @_; ++ my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); ++ if ($exit_code != 0) ++ { ++ print $STREAM "Try '$ME --help' for more information.\n"; ++ } ++ else ++ { ++ print $STREAM < ChangeLog ++ $ME -- -n 5 foo > last-5-commits-to-branch-foo ++ ++SPECIAL SYNTAX: ++ ++The following types of strings are interpreted specially when they appear ++at the beginning of a log message line. They are not copied to the output. ++ ++ Copyright-paperwork-exempt: Yes ++ Append the "(tiny change)" notation to the usual "date name email" ++ ChangeLog header to mark a change that does not require a copyright ++ assignment. ++ Co-authored-by: Joe User ++ List the specified name and email address on a second ++ ChangeLog header, denoting a co-author. ++ Signed-off-by: Joe User ++ These lines are simply elided. ++ ++In a FILE specified via --amend, comment lines (starting with "#") are ignored. ++FILE must consist of pairs where SHA is a 40-byte SHA1 (alone on ++a line) referring to a commit in the current project, and CODE refers to one ++or more consecutive lines of Perl code. Pairs must be separated by one or ++more blank line. ++ ++Here is sample input for use with --amend=FILE, from coreutils: ++ ++3a169f4c5d9159283548178668d2fae6fced3030 ++# fix typo in title: ++s/all tile types/all file types/ ++ ++1379ed974f1fa39b12e2ffab18b3f7a607082202 ++# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself. ++# Change the author to be Paul. Note the escaped "@": ++s,Jim .*>,Paul Eggert , ++ ++EOF ++ } ++ exit $exit_code; ++} ++ ++# If the string $S is a well-behaved file name, simply return it. ++# If it contains white space, quotes, etc., quote it, and return the new string. ++sub shell_quote($) ++{ ++ my ($s) = @_; ++ if ($s =~ m![^\w+/.,-]!) ++ { ++ # Convert each single quote to '\'' ++ $s =~ s/\'/\'\\\'\'/g; ++ # Then single quote the string. ++ $s = "'$s'"; ++ } ++ return $s; ++} ++ ++sub quoted_cmd(@) ++{ ++ return join (' ', map {shell_quote $_} @_); ++} ++ ++# Parse file F. ++# Comment lines (starting with "#") are ignored. ++# F must consist of pairs where SHA is a 40-byte SHA1 ++# (alone on a line) referring to a commit in the current project, and ++# CODE refers to one or more consecutive lines of Perl code. ++# Pairs must be separated by one or more blank line. ++sub parse_amend_file($) ++{ ++ my ($f) = @_; ++ ++ open F, '<', $f ++ or die "$ME: $f: failed to open for reading: $!\n"; ++ ++ my $fail; ++ my $h = {}; ++ my $in_code = 0; ++ my $sha; ++ while (defined (my $line = )) ++ { ++ $line =~ /^\#/ ++ and next; ++ chomp $line; ++ $line eq '' ++ and $in_code = 0, next; ++ ++ if (!$in_code) ++ { ++ $line =~ /^([0-9a-fA-F]{40})$/ ++ or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), ++ $fail = 1, next; ++ $sha = lc $1; ++ $in_code = 1; ++ exists $h->{$sha} ++ and (warn "$ME: $f:$.: duplicate SHA1\n"), ++ $fail = 1, next; ++ } ++ else ++ { ++ $h->{$sha} ||= ''; ++ $h->{$sha} .= "$line\n"; ++ } ++ } ++ close F; ++ ++ $fail ++ and exit 1; ++ ++ return $h; ++} ++ ++# git_dir_option $SRCDIR ++# ++# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR ++# is undef). Return as a list (0 or 1 element). ++sub git_dir_option($) ++{ ++ my ($srcdir) = @_; ++ my @res = (); ++ if (defined $srcdir) ++ { ++ my $qdir = shell_quote $srcdir; ++ my $cmd = "cd $qdir && git rev-parse --show-toplevel"; ++ my $qcmd = shell_quote $cmd; ++ my $git_dir = qx($cmd); ++ defined $git_dir ++ or die "$ME: cannot run $qcmd: $!\n"; ++ $? == 0 ++ or die "$ME: $qcmd had unexpected exit code or signal ($?)\n"; ++ chomp $git_dir; ++ push @res, "--git-dir=$git_dir/.git"; ++ } ++ @res; ++} ++ ++{ ++ my $since_date; ++ my $format_string = '%s%n%b%n'; ++ my $amend_file; ++ my $append_dot = 0; ++ my $cluster = 1; ++ my $strip_tab = 0; ++ my $strip_cherry_pick = 0; ++ my $srcdir; ++ GetOptions ++ ( ++ help => sub { usage 0 }, ++ version => sub { print "$ME version $VERSION\n"; exit }, ++ 'since=s' => \$since_date, ++ 'format=s' => \$format_string, ++ 'amend=s' => \$amend_file, ++ 'append-dot' => \$append_dot, ++ 'cluster!' => \$cluster, ++ 'strip-tab' => \$strip_tab, ++ 'strip-cherry-pick' => \$strip_cherry_pick, ++ 'srcdir=s' => \$srcdir, ++ ) or usage 1; ++ ++ defined $since_date ++ and unshift @ARGV, "--since=$since_date"; ++ ++ # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/) ++ # that makes a correction in the log or attribution of that commit. ++ my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {}; ++ ++ my @cmd = ('git', ++ git_dir_option $srcdir, ++ qw(log --log-size), ++ '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV); ++ open PIPE, '-|', @cmd ++ or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n" ++ . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); ++ ++ my $prev_multi_paragraph; ++ my $prev_date_line = ''; ++ my @prev_coauthors = (); ++ while (1) ++ { ++ defined (my $in = ) ++ or last; ++ $in =~ /^log size (\d+)$/ ++ or die "$ME:$.: Invalid line (expected log size):\n$in"; ++ my $log_nbytes = $1; ++ ++ my $log; ++ my $n_read = read PIPE, $log, $log_nbytes; ++ $n_read == $log_nbytes ++ or die "$ME:$.: unexpected EOF\n"; ++ ++ # Extract leading hash. ++ my ($sha, $rest) = split ':', $log, 2; ++ defined $sha ++ or die "$ME:$.: malformed log entry\n"; ++ $sha =~ /^[0-9a-fA-F]{40}$/ ++ or die "$ME:$.: invalid SHA1: $sha\n"; ++ ++ # If this commit's log requires any transformation, do it now. ++ my $code = $amend_code->{$sha}; ++ if (defined $code) ++ { ++ eval 'use Safe'; ++ my $s = new Safe; ++ # Put the unpreprocessed entry into "$_". ++ $_ = $rest; ++ ++ # Let $code operate on it, safely. ++ my $r = $s->reval("$code") ++ or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n"; ++ ++ # Note that we've used this entry. ++ delete $amend_code->{$sha}; ++ ++ # Update $rest upon success. ++ $rest = $_; ++ } ++ ++ # Remove lines inserted by "git cherry-pick". ++ if ($strip_cherry_pick) ++ { ++ $rest =~ s/^\s*Conflicts:\n.*//sm; ++ $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; ++ } ++ ++ my @line = split "\n", $rest; ++ my $author_line = shift @line; ++ defined $author_line ++ or die "$ME:$.: unexpected EOF\n"; ++ $author_line =~ /^(\d+) (.*>)$/ ++ or die "$ME:$.: Invalid line " ++ . "(expected date/author/email):\n$author_line\n"; ++ ++ # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog ++ # `(tiny change)' annotation. ++ my $tiny = (grep (/^Copyright-paperwork-exempt:\s+[Yy]es$/, @line) ++ ? ' (tiny change)' : ''); ++ ++ my $date_line = sprintf "%s %s$tiny\n", ++ strftime ("%F", localtime ($1)), $2; ++ ++ my @coauthors = grep /^Co-authored-by:.*$/, @line; ++ # Omit meta-data lines we've already interpreted. ++ @line = grep !/^(?:Signed-off-by:[ ].*>$ ++ |Co-authored-by:[ ] ++ |Copyright-paperwork-exempt:[ ] ++ )/x, @line; ++ ++ # Remove leading and trailing blank lines. ++ if (@line) ++ { ++ while ($line[0] =~ /^\s*$/) { shift @line; } ++ while ($line[$#line] =~ /^\s*$/) { pop @line; } ++ } ++ ++ # Record whether there are two or more paragraphs. ++ my $multi_paragraph = grep /^\s*$/, @line; ++ ++ # Format 'Co-authored-by: A U Thor ' lines in ++ # standard multi-author ChangeLog format. ++ for (@coauthors) ++ { ++ s/^Co-authored-by:\s*/\t /; ++ s/\s*/ ++ or warn "$ME: warning: missing email address for " ++ . substr ($_, 5) . "\n"; ++ } ++ ++ # If clustering of commit messages has been disabled, if this header ++ # would be different from the previous date/name/email/coauthors header, ++ # or if this or the previous entry consists of two or more paragraphs, ++ # then print the header. ++ if ( ! $cluster ++ || $date_line ne $prev_date_line ++ || "@coauthors" ne "@prev_coauthors" ++ || $multi_paragraph ++ || $prev_multi_paragraph) ++ { ++ $prev_date_line eq '' ++ or print "\n"; ++ print $date_line; ++ @coauthors ++ and print join ("\n", @coauthors), "\n"; ++ } ++ $prev_date_line = $date_line; ++ @prev_coauthors = @coauthors; ++ $prev_multi_paragraph = $multi_paragraph; ++ ++ # If there were any lines ++ if (@line == 0) ++ { ++ warn "$ME: warning: empty commit message:\n $date_line\n"; ++ } ++ else ++ { ++ if ($append_dot) ++ { ++ # If the first line of the message has enough room, then ++ if (length $line[0] < 72) ++ { ++ # append a dot if there is no other punctuation or blank ++ # at the end. ++ $line[0] =~ /[[:punct:]\s]$/ ++ or $line[0] .= '.'; ++ } ++ } ++ ++ # Remove one additional leading TAB from each line. ++ $strip_tab ++ and map { s/^\t// } @line; ++ ++ # Prefix each non-empty line with a TAB. ++ @line = map { length $_ ? "\t$_" : '' } @line; ++ ++ print "\n", join ("\n", @line), "\n"; ++ } ++ ++ defined ($in = ) ++ or last; ++ $in ne "\n" ++ and die "$ME:$.: unexpected line:\n$in"; ++ } ++ ++ close PIPE ++ or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; ++ # FIXME-someday: include $PROCESS_STATUS in the diagnostic ++ ++ # Complain about any unused entry in the --amend=F specified file. ++ my $fail = 0; ++ foreach my $sha (keys %$amend_code) ++ { ++ warn "$ME:$amend_file: unused entry: $sha\n"; ++ $fail = 1; ++ } ++ ++ exit $fail; ++} ++ ++# Local Variables: ++# mode: perl ++# indent-tabs-mode: nil ++# eval: (add-hook 'write-file-hooks 'time-stamp) ++# time-stamp-start: "my $VERSION = '" ++# time-stamp-format: "%:y-%02m-%02d %02H:%02M" ++# time-stamp-time-zone: "UTC" ++# time-stamp-end: "'; # UTC" ++# End: +diff --git a/conf/Makefile.common b/conf/Makefile.common +index e4c301f..fcb8d2e 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -7,12 +7,7 @@ unexport LC_ALL + + # Platform specific options + if COND_sparc64_ieee1275 +- CFLAGS_PLATFORM += -mno-app-regs +- LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax +-endif +-if COND_sparc64_emu +- CFLAGS_PLATFORM += -mno-app-regs +- LDFLAGS_PLATFORM = -Wl,--no-relax ++ LDFLAGS_PLATFORM = -Wl,-melf64_sparc + endif + if COND_arm + if !COND_emu +@@ -22,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 +@@ -39,21 +37,19 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/ + CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1 + BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) + +-LDADD_KERNEL = $(TARGET_LIBGCC) +- +-CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +-LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC) ++CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding ++LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) + CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 + CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +-STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version ++STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags + +-CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +-LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d ++CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding ++LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d + CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) + CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +-CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin +-LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S ++CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin ++LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S + CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) + CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index 51f08c1..ea6b9df 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -5,6 +5,7 @@ EXTRA_DIST += gentpl.py + EXTRA_DIST += Makefile.util.def + EXTRA_DIST += Makefile.utilgcry.def + ++EXTRA_DIST += asm-tests + EXTRA_DIST += unicode + + EXTRA_DIST += util/import_gcry.py +@@ -110,3 +111,26 @@ EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz + EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz + + EXTRA_DIST += coreboot.cfg ++ ++EXTRA_DIST += tests/file_filter/file ++EXTRA_DIST += tests/file_filter/file.gz ++EXTRA_DIST += tests/file_filter/file.gz.sig ++EXTRA_DIST += tests/file_filter/file.lzop ++EXTRA_DIST += tests/file_filter/file.lzop.sig ++EXTRA_DIST += tests/file_filter/file.xz ++EXTRA_DIST += tests/file_filter/file.xz.sig ++EXTRA_DIST += tests/file_filter/keys ++EXTRA_DIST += tests/file_filter/keys.pub ++EXTRA_DIST += tests/file_filter/test.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/prompt.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/txt.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/menu.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/po4a.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg ++EXTRA_DIST += tests/syslinux/ubuntu10.04_grub.cfg.in +diff --git a/config.h.in b/config.h.in +index 4b63014..9e8f991 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -7,11 +7,20 @@ + #endif + + #define GCRYPT_NO_DEPRECATED 1 ++#define HAVE_MEMMOVE 1 + + /* Define to 1 to enable disk cache statistics. */ + #define DISK_CACHE_STATS @DISK_CACHE_STATS@ + #define BOOT_TIME_STATS @BOOT_TIME_STATS@ + ++/* We don't need those. */ ++#define MINILZO_CFG_SKIP_LZO_PTR 1 ++#define MINILZO_CFG_SKIP_LZO_UTIL 1 ++#define MINILZO_CFG_SKIP_LZO_STRING 1 ++#define MINILZO_CFG_SKIP_LZO_INIT 1 ++#define MINILZO_CFG_SKIP_LZO1X_1_COMPRESS 1 ++#define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1 ++ + #if defined (GRUB_BUILD) + #undef ENABLE_NLS + #define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ +@@ -31,10 +40,6 @@ + #define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ + /* Define if C symbols get an underscore after compilation. */ + #define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ +-/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */ +-#define ADDR32 @ADDR32@ +-/* Define it to \"data32\" or \"data32;\" to make GAS happy. */ +-#define DATA32 @DATA32@ + /* Define it to one of __bss_start, edata and _edata. */ + #define BSS_START_SYMBOL @BSS_START_SYMBOL@ + /* Define it to either end or _end. */ +diff --git a/configure.ac b/configure.ac +index 7c5d080..e54b9df 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -26,11 +26,10 @@ dnl This is necessary because the target type in autoconf does not + dnl describe such a system very well. + dnl + dnl The current strategy is to use variables with no prefix (such as +-dnl CC, CFLAGS, etc.) for the host type as well as the build type, +-dnl because GRUB does not need to use those variables for the build +-dnl type, so there is no conflict. Variables with the prefix "TARGET_" +-dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target +-dnl type. ++dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_" ++dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables ++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]) + +@@ -39,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux]) + # We don't want -g -O2 by default in CFLAGS + : ${CFLAGS=""} + +-# Checks for host and target systems. ++# Checks for build, host and target systems. ++AC_CANONICAL_BUILD + AC_CANONICAL_HOST + save_program_prefix="${program_prefix}" + AC_CANONICAL_TARGET +@@ -78,30 +78,27 @@ fi + + # Default HOST_CPPFLAGS + HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" +-HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" + HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" + + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" +-TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" +-TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" + + case "$target_cpu" in + i[[3456]]86) target_cpu=i386 ;; + amd64) target_cpu=x86_64 ;; + sparc) target_cpu=sparc64 ;; + mipsel|mips64el) +- target_cpu=mipsel; +- machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; ++ target_cpu=mipsel ++ machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1" + ;; + mips|mips64) +- target_cpu=mips; +- machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; ++ target_cpu=mips ++ machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1" + ;; + arm*) +- target_cpu=arm; ++ target_cpu=arm + ;; + aarch64*) +- target_cpu=arm64; ++ target_cpu=arm64 + ;; + esac + +@@ -119,13 +116,17 @@ 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 ;; + ia64-*) platform=efi ;; + arm-*) platform=uboot ;; + arm64-*) platform=efi ;; +- *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; ++ *) ++ AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities]) ++ platform=none ++ ;; + esac + else + platform="$with_platform" +@@ -135,8 +136,10 @@ case "$target_cpu"-"$platform" in + x86_64-efi) ;; + x86_64-emu) ;; + x86_64-xen) ;; ++ x86_64-none) ;; + 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. +@@ -167,6 +170,7 @@ case "$target_cpu"-"$platform" in + arm-efi) ;; + arm64-efi) ;; + *-emu) ;; ++ *-none) ;; + *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; + esac + +@@ -178,7 +182,7 @@ if test x$platform != xemu ; then + fi + + if test x"$target_cpu-$platform" = xsparc64-emu ; then +- target_m64=1 ; ++ target_m64=1 + fi + + case "$target_os" in +@@ -349,6 +353,9 @@ if test x"$target_cpu-$platform" = xsparc64-emu ; then + HOST_CFLAGS="$HOST_CFLAGS -m64" + fi + ++CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" ++HOST_CPPFLAGS="$HOST_CPPFLAGS -D_FILE_OFFSET_BITS=64" ++ + AC_C_BIGENDIAN + AC_CHECK_SIZEOF(void *) + AC_CHECK_SIZEOF(long) +@@ -361,6 +368,14 @@ case "$host_os" in + ;; + esac + ++case "$host_os" in ++ cygwin | windows* | mingw32* | aros*) ++ ;; ++ *) ++ AC_CHECK_SIZEOF(off_t) ++ test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);; ++esac ++ + if test x$USE_NLS = xno; then + HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext" + fi +@@ -423,6 +438,16 @@ case "$build_os" in + haiku*) BUILD_LIBM= ;; + *) BUILD_LIBM=-lm ;; + esac ++ ++dnl FIXME proper test seems to require too deep dive into Autoconf internals. ++dnl For now just list known platforms that we support. ++ ++case "$build_os" in ++ cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;; ++ *) BUILD_EXEEXT= ;; ++esac ++AC_SUBST(BUILD_EXEEXT) ++ + # For gnulib. + gl_INIT + +@@ -477,6 +502,7 @@ AC_SUBST(HOST_CC) + AC_SUBST(BUILD_CC) + AC_SUBST(BUILD_CFLAGS) + AC_SUBST(BUILD_CPPFLAGS) ++AC_SUBST(BUILD_LDFLAGS) + AC_SUBST(TARGET_CC) + AC_SUBST(TARGET_NM) + AC_SUBST(TARGET_RANLIB) +@@ -525,7 +551,7 @@ int main (void); + + TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags" + +-AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang] ++AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang], + [ + CFLAGS="$TARGET_CFLAGS" + AC_COMPILE_IFELSE( +@@ -536,35 +562,77 @@ AC_COMPILE_IFELSE( + ]])], + [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])]) + +-# on x86 clang doesn't support .code16 +-# on arm clang doesn't support .arch directive +-# on mips clang doesn't support privilegied instructions, doubleword store/load +-# and crashes with hand-written assembly +-if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \ +- || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \ +- || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then +- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" ++if test x$target_cpu = xpowerpc; then ++ AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_target_cc_big_endian, [ ++ grub_cv_target_cc_big_endian=no ++ for cand in "-target powerpc -Wl,-EB" "-target powerpc" \ ++ "-target powerpc-linux-gnu -Wl,-EB" "-target powerpc-linux-gnu" \ ++ "-mbig-endian"; do ++ if test x"$grub_cv_target_cc_big_endian" != xno ; then ++ break ++ fi ++ CFLAGS="$TARGET_CFLAGS $cand -Werror" ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ != __BYTE_ORDER__) ++#error still little endian ++#endif ++asm (".globl start; start:"); ++void __main (void); ++void __main (void) {} ++int main (void); ++]], [[]])], ++ [grub_cv_target_cc_big_endian="$cand"], []) ++ done ++ ]) ++ ++ if test x"$grub_cv_target_cc_big_endian" = xno ; then ++ AC_MSG_ERROR([could not force big-endian]) ++ fi ++ ++ skip_linkflags="$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-EB@@')" ++ ++ TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags" ++ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags" ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags" ++ TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian" + fi + +-if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then +-AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame] +-[ +-CFLAGS="$TARGET_CFLAGS" +-AC_COMPILE_IFELSE( +-[AC_LANG_PROGRAM([], [[ +- unsigned int a = 0, b = 0; +- asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b)); +- if (a) +- return 1; +-]])], +-[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])]) +- # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly +- # used by gcrypt +- if test x$grub_cv_cc_target_clang_ame = xno ; then +- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" +- TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as" +- fi ++AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ ++test_program= ++case "x$target_cpu-$platform" in ++ xmips-* | xmipsel-*) ++ test_program=mips ++ ;; ++ xi386-pc) ++ test_program=i386-pc ++ ;; ++ xi386-* | xx86_64-*) ++ test_program=i386 ++ ;; ++ xpowerpc-* | xsparc64-* | xarm-*) ++ test_program=$target_cpu ++ ;; ++esac ++if test x"$test_program" = x ; then ++ grub_cv_cc_target_asm_compile= ++else ++ found=no ++ for arg in "" "-no-integrated-as"; do ++ cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S" ++ echo "Running $cmdline" >&AS_MESSAGE_LOG_FD ++ if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then ++ grub_cv_cc_target_asm_compile="$arg" ++ found=yes ++ break ++ fi ++ done ++ if test x"$found" = xno ; then ++ AC_MSG_ERROR([could not compile assembly]) ++ fi + fi ++]) ++ ++TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_cc_target_asm_compile" + + if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then + TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" +@@ -647,6 +715,102 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" + fi + ++# GRUB doesn't use float or doubles at all. Yet some toolchains may decide ++# that floats are a good fit to run instead of what's written in the code. ++# Given that floating point unit is disabled (if present to begin with) ++# when GRUB is running which may result in various hard crashes. ++if test x"$platform" != xemu ; then ++ AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ ++ grub_cv_target_cc_soft_float=no ++ if test "x$target_cpu" = xarm64; then ++ CFLAGS="$TARGET_CFLAGS -mgeneral-regs-only -Werror" ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_target_cc_soft_float="-mgeneral-regs-only"], []) ++ fi ++ if test "x$target_cpu" = xia64; then ++ CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror" ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], []) ++ fi ++ for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \ ++ "-Xclang -msoft-float -Xclang -no-implicit-float" \ ++ "-Xclang -msoft-float" "-msoft-float"; do ++ if test x"$grub_cv_target_cc_soft_float" != xno ; then ++ break ++ fi ++ CFLAGS="$TARGET_CFLAGS $cand -Werror" ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_target_cc_soft_float="$cand"], []) ++ done ++ ]) ++ ++ if test x"$grub_cv_target_cc_soft_float" = xno ; then ++ AC_MSG_ERROR([could not force soft-float]) ++ fi ++ ++ case x"$grub_cv_target_cc_soft_float" in ++ x*"-Xclang"*) ++ # A trick so that clang doesn't see it on link stаge ++ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float" ++ ;; ++ *) ++ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float" ++ ;; ++ esac ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" ++ ++fi ++ ++if test x"$target_cpu" = xsparc64 ; then ++ AC_CACHE_CHECK([for options to reserve application registers], grub_cv_target_cc_mno_app_regs, [ ++ grub_cv_target_cc_mno_app_regs=no ++ for cand in "-mllvm -sparc-reserve-app-registers" \ ++ "-mno-app-regs"; do ++ if test x"$grub_cv_target_cc_mno_app_regs" != xno ; then ++ break ++ fi ++ CFLAGS="$TARGET_CFLAGS $cand -Werror" ++ CPPFLAGS="$TARGET_CPPFLAGS" ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_target_cc_mno_app_regs="$cand"], []) ++ done ++ ]) ++ ++ if test x"$grub_cv_target_cc_mno_app_regs" = xno ; then ++ AC_MSG_ERROR([could not reserve application registers]) ++ fi ++ if test x"$grub_cv_target_cc_mno_app_regs" = x"-mllvm -sparc-reserve-app-registers" ; then ++ # A trick so that clang doesn't see it on link stаge ++ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_app_regs" ++ else ++ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_app_regs" ++ fi ++ ++ AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [ ++ grub_cv_target_cc_mno_relax=no ++ for cand in "-mno-relax" "-Wl,--no-relax"; do ++ if test x"$grub_cv_target_cc_mno_relax" != xno ; then ++ break ++ fi ++ LDFLAGS="$TARGET_LDFLAGS $cand -nostdlib -static" ++ CFLAGS="$TARGET_CFLAGS -Werror" ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ asm (".globl start; start:"); ++ void __main (void); ++ void __main (void) {} ++ int main (void); ++ ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], []) ++ done ++ ]) ++ LDFLAGS="$TARGET_LDFLAGS" ++ CFLAGS="$TARGET_CFLAGS" ++ ++ if test x"$grub_cv_target_cc_mno_relax" = xno ; then ++ AC_MSG_ERROR([could not find no-relax options]) ++ fi ++ TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" ++fi ++ + # By default, GCC 4.4 generates .eh_frame sections containing unwind + # information in some cases where it previously did not. GRUB doesn't need + # these and they just use up vital space. Restore the old compiler +@@ -731,7 +895,7 @@ if test x"$efiemu_excuse" = x ; then + ]], [[]])], [flag=1], [flag=0]) + if test x"$flag" = x1; then + grub_cv_target_cc_efiemu64_link_format="$format" +- break; ++ break + fi + done]) + if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then +@@ -764,12 +928,12 @@ if test x"$platform" = xemu ; then + ;; + *windows* | *cygwin* | *mingw*) + if test x${target_cpu} = xi386 ; then +- grub_cv_target_cc_link_format=-mi386pe; +- TARGET_OBJ2ELF='./build-grub-pe2elf'; ++ grub_cv_target_cc_link_format=-mi386pe ++ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' + fi + if test x${target_cpu} = xx86_64 ; then +- grub_cv_target_cc_link_format=-mi386pep; +- TARGET_OBJ2ELF='./build-grub-pep2elf'; ++ grub_cv_target_cc_link_format=-mi386pep ++ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' + fi + TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" + ;; +@@ -795,7 +959,7 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then + ]], [[]])], [flag=1], [flag=0]) + if test x"$flag" = x1; then + grub_cv_target_cc_link_format="$format" +- break; ++ break + fi + done]) + if test x"$grub_cv_target_cc_link_format" = xunknown; then +@@ -803,10 +967,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then + fi + TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" + if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then +- TARGET_OBJ2ELF='./build-grub-pe2elf'; ++ TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' + fi + if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then +- TARGET_OBJ2ELF='./build-grub-pep2elf'; ++ TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' + fi + fi + +@@ -848,17 +1012,17 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) + + LDFLAGS="$TARGET_LDFLAGS" + +-if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then ++if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then + # Use large model to support 4G memory + AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ +- CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large" ++ CFLAGS="$TARGET_CFLAGS -mcmodel=large" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mcmodel=yes], + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" +- elif test "$target_cpu-$platform" = sparc64-emu; then ++ elif test "$target_cpu" = sparc64; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" + fi + fi +@@ -866,7 +1030,7 @@ fi + if test "$target_cpu"-"$platform" = x86_64-efi; then + # EFI writes to stack below %rsp, we must not use the red zone + AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ +- CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone" ++ CFLAGS="$TARGET_CFLAGS -mno-red-zone" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_no_red_zone=yes], + [grub_cv_cc_no_red_zone=no]) +@@ -896,20 +1060,9 @@ if test "x$target_cpu" = xarm; then + ]) + if test "x$grub_cv_cc_mthumb_interwork" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork" ++ # Clang defaults to thumb interworking + elif test "x$grub_cv_cc_target_clang" = xno ; then + AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork]) +- else +- CFLAGS="$TARGET_CFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +-#if defined (__thumb__) && !defined (__thumb2__) +-#error thumb without interworking +-#endif +-]])], +- [no_interwork_ok=yes], +- [no_interwork_ok=no]) +- if test x$no_interwork_ok = xno ; then +- AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork]) +- fi + fi + fi + +@@ -984,7 +1137,7 @@ if test "$target_cpu" = arm; then + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) + if test x"$flag" = x1; then + grub_cv_target_cc_strict_align="$arg" +- break; ++ break + fi + done]) + +@@ -1007,22 +1160,17 @@ fi + + # Set them to their new values for the tests below. + CC="$TARGET_CC" +-if test "x$TARGET_APPLE_LINKER" = x1 ; then ++if test x"$platform" = xemu ; then ++CFLAGS="$TARGET_CFLAGS -Wno-error" ++elif test "x$TARGET_APPLE_LINKER" = x1 ; then + CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error" + 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 +-TARGET_LIBGCC= +-else +-TARGET_LIBGCC=-lgcc +-fi +- +-LIBS="$TARGET_LIBGCC" + + grub_ASM_USCORE +-if test "x$TARGET_APPLE_LINKER" = x0 ; then ++if test "x$TARGET_APPLE_LINKER" = x0 && test x"$platform" != xemu; then + if test x$grub_cv_asm_uscore = xyes; then + DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main" + else +@@ -1032,7 +1180,9 @@ CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM" + fi + + # Check for libgcc symbols +-AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x) ++if test x"$platform" = xemu; then ++AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) ++fi + + if test "x$TARGET_APPLE_LINKER" = x1 ; then + CFLAGS="$TARGET_CFLAGS -nostdlib -static" +@@ -1057,8 +1207,6 @@ if test "x$target_cpu" = xi386; then + grub_CHECK_END_SYMBOL + fi + CFLAGS="$TARGET_CFLAGS" +- grub_I386_ASM_PREFIX_REQUIREMENT +- grub_I386_ASM_ADDR32 + fi + + grub_PROG_NM_WORKS +@@ -1136,10 +1284,6 @@ else + fi + AC_SUBST([BOOT_TIME_STATS]) + +-AC_ARG_ENABLE([grub-emu-usb], +- [AS_HELP_STRING([--enable-grub-emu-usb], +- [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) +- + AC_ARG_ENABLE([grub-emu-sdl], + [AS_HELP_STRING([--enable-grub-emu-sdl], + [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) +@@ -1150,34 +1294,6 @@ AC_ARG_ENABLE([grub-emu-pci], + + if test "$platform" = emu; then + +-if test x"$enable_grub_emu_usb" != xyes ; then +- grub_emu_usb_excuse="not enabled" +-fi +- +-if test x"$enable_grub_emu_pci" = xyes ; then +- grub_emu_usb_excuse="conflicts with PCI support" +-fi +- +-[if [ x"$grub_emu_usb_excuse" = x ]; then +- # Check for libusb libraries.] +-AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], +- [grub_emu_usb_excuse=["need libusb library"]]) +- AC_SUBST([LIBUSB]) +-[fi] +-[if [ x"$grub_emu_usb_excuse" = x ]; then +- # Check for headers.] +- AC_CHECK_HEADERS([usb.h], [], +- [grub_emu_usb_excuse=["need libusb headers"]]) +-[fi] +-if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then +- AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)]) +-fi +-if test x"$grub_emu_usb_excuse" = x ; then +-enable_grub_emu_usb=yes +-else +-enable_grub_emu_usb=no +-fi +- + if test x"$enable_grub_emu_sdl" = xno ; then + grub_emu_sdl_excuse="explicitly disabled" + fi +@@ -1207,10 +1323,6 @@ if test x"$enable_grub_emu_pci" != xyes ; then + grub_emu_pci_excuse="not enabled" + fi + +-if test x"$enable_grub_emu_usb" = xyes ; then +- grub_emu_pci_excuse="conflicts with USB support" +-fi +- + [if [ x"$grub_emu_pci_excuse" = x ]; then + # Check for libpci libraries.] + AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], +@@ -1219,7 +1331,7 @@ fi + [fi] + [if [ x"$grub_emu_pci_excuse" = x ]; then + # Check for headers.] +- AC_CHECK_HEADERS([pci/pci.h], [], ++ AC_CHECK_HEADERS([pciaccess.h], [], + [grub_emu_pci_excuse=["need libpciaccess headers"]]) + [fi] + +@@ -1231,14 +1343,12 @@ enable_grub_emu_pci=no + fi + + AC_SUBST([enable_grub_emu_sdl]) +-AC_SUBST([enable_grub_emu_usb]) + AC_SUBST([enable_grub_emu_pci]) + + else + + # Ignore --enable-emu-* if platform is not emu + enable_grub_emu_sdl=no +-enable_grub_emu_usb=no + enable_grub_emu_pci=no + fi + +@@ -1290,10 +1400,12 @@ SAVED_CC="$CC" + SAVED_CPP="$CPP" + SAVED_CFLAGS="$CFLAGS" + SAVED_CPPFLAGS="$CPPFLAGS" ++SAVED_LDFLAGS="$LDFLAGS" + CC="$BUILD_CC" + CPP="$BUILD_CPP" + CFLAGS="$BUILD_CFLAGS" + CPPFLAGS="$BUILD_CPPFLAGS" ++LDFLAGS="$BUILD_LDFAGS" + + unset ac_cv_c_bigendian + unset ac_cv_header_ft2build_h +@@ -1356,6 +1468,7 @@ CC="$SAVED_CC" + CPP="$SAVED_CPP" + CFLAGS="$SAVED_CFLAGS" + CPPFLAGS="$SAVED_CPPFLAGS" ++LDFLAGS="$SAVED_LDFLAGS" + + + DJVU_FONT_SOURCE= +@@ -1375,7 +1488,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 +@@ -1402,7 +1515,7 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do + md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')" + # PCF and BDF from version 6.3 isn't hanled properly by libfreetype. + if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then +- continue; ++ continue + fi + FONT_SOURCE="$dir/unifont.$ext" + break 2 +@@ -1444,7 +1557,7 @@ fi + if test x"$grub_mount_excuse" = x ; then + # Check for fuse headers. + SAVED_CPPFLAGS="$CPPFLAGS" +- CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" ++ CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26" + AC_CHECK_HEADERS([fuse/fuse.h], [], + [grub_mount_excuse=["need FUSE headers"]]) + CPPFLAGS="$SAVED_CPPFLAGS" +@@ -1487,7 +1600,7 @@ if test x"$device_mapper_excuse" = x ; then + fi + + if test x"$device_mapper_excuse" = x ; then +- LIBDEVMAPPER="-ldevmapper"; ++ LIBDEVMAPPER="-ldevmapper" + AC_DEFINE([HAVE_DEVICE_MAPPER], [1], + [Define to 1 if you have the devmapper library.]) + fi +@@ -1579,8 +1692,6 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], + [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) + + AC_SUBST(HAVE_ASM_USCORE) +-AC_SUBST(ADDR32) +-AC_SUBST(DATA32) + AC_SUBST(BSS_START_SYMBOL) + AC_SUBST(END_SYMBOL) + AC_SUBST(PACKAGE) +@@ -1594,15 +1705,15 @@ if test x"$enable_werror" != xno ; then + HOST_CFLAGS="$HOST_CFLAGS -Werror" + fi + +-if test "x$grub_cv_cc_target_clang" = xno; then +- TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc" +-else +- TARGET_LDFLAGS_STATIC_LIBGCC= +-fi +- + TARGET_CPP="$TARGET_CC -E" + TARGET_CCAS=$TARGET_CC + ++# Includes which include make-time substitutions. They must come last ++# as to avoid executing top_builddir in shell. ++HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" ++TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" ++TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" ++ + GRUB_TARGET_CPU="${target_cpu}" + GRUB_PLATFORM="${platform}" + +@@ -1610,8 +1721,6 @@ AC_SUBST(GRUB_TARGET_CPU) + AC_SUBST(GRUB_PLATFORM) + + AC_SUBST(TARGET_OBJCONV) +-AC_SUBST(TARGET_LIBGCC) +-AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC) + AC_SUBST(TARGET_CPP) + AC_SUBST(TARGET_CCAS) + AC_SUBST(TARGET_OBJ2ELF) +@@ -1639,8 +1748,8 @@ AC_SUBST(BUILD_LIBM) + # Automake conditionals + # + ++AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) + AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) +-AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes]) + AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) + AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) + AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) +@@ -1675,7 +1784,6 @@ AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu]) + AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos]) + + AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) +-AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) + AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) + AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) + AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) +@@ -1712,24 +1820,30 @@ AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir]) + + + # Output files. +-cpudir="${target_cpu}" +-if test x${cpudir} = xmipsel; then +- cpudir=mips; +-fi +-grub_CHECK_LINK_DIR +-if test x"$link_dir" = xyes ; then +- AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) +- if test "$platform" != emu ; then +- AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) ++if test "$platform" != none; then ++ cpudir="${target_cpu}" ++ if test x${cpudir} = xmipsel; then ++ cpudir=mips; + fi +-else +- mkdir -p include/grub 2>/dev/null +- rm -rf include/grub/cpu +- cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null +- if test "$platform" != emu ; then +- rm -rf include/grub/machine +- cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null ++ grub_CHECK_LINK_DIR ++ if test x"$link_dir" = xyes ; then ++ AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) ++ if test "$platform" != emu ; then ++ AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) ++ fi ++ else ++ mkdir -p include/grub 2>/dev/null ++ rm -rf include/grub/cpu ++ cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null ++ if test "$platform" != emu ; then ++ rm -rf include/grub/machine ++ cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null ++ fi + fi ++else ++ # Just enough to stop the compiler failing with -I$(srcdir)/include. ++ mkdir -p include 2>/dev/null ++ rm -rf include/grub/cpu include/grub/machine + fi + + AC_CONFIG_FILES([Makefile]) +@@ -1747,11 +1861,6 @@ echo "*******************************************************" + echo GRUB2 will be compiled with following components: + echo Platform: "$target_cpu"-"$platform" + if [ x"$platform" = xemu ]; then +-if [ x"$grub_emu_usb_excuse" = x ]; then +-echo USB support for grub-emu: Yes +-else +-echo USB support for grub-emu: No "($grub_emu_usb_excuse)" +-fi + if [ x"$grub_emu_sdl_excuse" = x ]; then + echo SDL support for grub-emu: Yes + else +@@ -1802,6 +1911,7 @@ echo grub-mount: No "($grub_mount_excuse)" + fi + if [ x"$starfield_excuse" = x ]; then + echo starfield theme: Yes ++echo With DejaVuSans font from $DJVU_FONT_SOURCE + else + echo starfield theme: No "($starfield_excuse)" + fi +diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi +index c796850..a9f4de6 100644 +--- a/docs/grub-dev.texi ++++ b/docs/grub-dev.texi +@@ -108,16 +108,16 @@ The branches available are: + + @table @samp + @item master +- Main developpement branch. ++ Main development branch. + @item grub-legacy + GRUB 0.97 codebase. Kept for reference and legal reasons + @item multiboot + Multiboot specfication + @item multiboot2 + Multiboot2 specfication +-@item developper branches +- Prefixed with developper name. Every developper of a team manages his own branches. +- Developper branches do not need changelog entries. ++@item developer branches ++ Prefixed with developer name. Every developer of a team manages his own branches. ++ Developer branches do not need changelog entries. + @end table + + Once you have used @kbd{git clone} to fetch an initial copy of a branch, you +@@ -228,12 +228,12 @@ The opening @samp{/*} and closing @samp{*/} should be placed together on a line + Here is a brief map of the GRUB code base. + + GRUB uses Autoconf and Automake, with most of the Automake input generated +-by AutoGen. The top-level build rules are in @file{configure.ac}, ++by a Python script. The top-level build rules are in @file{configure.ac}, + @file{grub-core/Makefile.core.def}, and @file{Makefile.util.def}. Each + block in a @file{*.def} file represents a build target, and specifies the + source files used to build it on various platforms. The @file{*.def} files +-are processed into AutoGen input by @file{gentpl.py} (which you only need to +-look at if you are extending the build system). If you are adding a new ++are processed into Automake input by @file{gentpl.py} (which you only need ++to look at if you are extending the build system). If you are adding a new + module which follows an existing pattern, such as a new command or a new + filesystem implementation, it is usually easiest to grep + @file{grub-core/Makefile.core.def} and @file{Makefile.util.def} for an +diff --git a/docs/grub.texi b/docs/grub.texi +index 46b9e7f..b9f41a7 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -5162,8 +5162,10 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}). + Perform configuration of @var{card} using DHCP protocol. If no card name + is specified, try to configure all existing cards. If configuration was + successful, interface with name @var{card}@samp{:dhcp} and configured +-address is added to @var{card}. If server provided gateway information in +-DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. Additionally the following DHCP options are recognized and processed: ++address is added to @var{card}. ++@comment If server provided gateway information in ++@comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. ++Additionally the following DHCP options are recognized and processed: + + @table @samp + @item 1 (Subnet Mask) +@@ -5426,10 +5428,12 @@ In order to enable authentication support, the @samp{superusers} environment + variable must be set to a list of usernames, separated by any of spaces, + commas, semicolons, pipes, or ampersands. Superusers are permitted to use + the GRUB command line, edit menu entries, and execute any menu entry. If +-@samp{superusers} is set, then use of the command line is automatically +-restricted to superusers. ++@samp{superusers} is set, then use of the command line and editing of menu ++entries are automatically restricted to superusers. Setting @samp{superusers} ++to empty string effectively disables both access to CLI and editing of menu ++entries. + +-Other users may be given access to specific menu entries by giving a list of ++Other users may be allowed to execute specific menu entries by giving a list of + usernames (as above) using the @option{--users} option to the + @samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted} + option is used for a menu entry, then that entry is unrestricted. +@@ -5848,7 +5852,7 @@ Following variables must be defined: + + @multitable @columnfractions .30 .65 + @item GRUB_PAYLOADS_DIR @tab directory containing the required kernels +-@item GRUB_CBFSTOOL @tab cbfstoll from Coreboot package (for coreboot platform only) ++@item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only) + @item GRUB_COREBOOT_ROM @tab empty Coreboot ROM + @item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU + @end multitable +diff --git a/gentpl.py b/gentpl.py +index bdcae1a..37b1f45 100644 +--- a/gentpl.py ++++ b/gentpl.py +@@ -76,7 +76,13 @@ for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i) + # Flattened Device Trees (FDT) + GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi" ] + +-# Miscelaneous groups schedulded to disappear in future ++# Needs software helpers for division ++# Must match GRUB_DIVISION_IN_SOFTWARE in misc.h ++GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"] ++GROUPS["no_softdiv"] = GRUB_PLATFORMS[:] ++for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i) ++ ++# Miscellaneous groups scheduled to disappear in future + GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"] + GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") + +@@ -600,7 +606,7 @@ def foreach_enabled_platform(defn, closure): + # enable = emu; + # enable = i386; + # enable = mips_loongson; +-# emu_condition = COND_GRUB_EMU_USB; ++# emu_condition = COND_GRUB_EMU_SDL; + # }; + # + def under_platform_specific_conditionals(defn, platform, closure): +@@ -753,7 +759,7 @@ def image(defn, platform): + if test x$(TARGET_APPLE_LINKER) = x1; then \ + $(MACHO2IMG) $< $@; \ + else \ +- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ ++ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ + fi + """) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 1b3142d..af0c7f4 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin + CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) + CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) + +-build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ ++build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ ++CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT) + +-build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ ++build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ ++CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT) + + # gentrigtables +-gentrigtables: gentrigtables.c +- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM) +-CLEANFILES += gentrigtables ++gentrigtables$(BUILD_EXEEXT): gentrigtables.c ++ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) ++CLEANFILES += gentrigtables$(BUILD_EXEEXT) + + # trigtables.c +-trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac +- ./gentrigtables > $@ ++trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac ++ ./gentrigtables$(BUILD_EXEEXT) > $@ + CLEANFILES += trigtables.c + + # XXX Use Automake's LEX & YACC support +@@ -74,6 +76,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h ++if COND_emu ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h ++else ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h ++endif + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h +@@ -81,9 +88,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h + 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 +-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +-endif + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h + + if COND_i386_pc +@@ -246,9 +250,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h + if COND_GRUB_EMU_SDL + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h + endif +-if COND_GRUB_EMU_USB +-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h +-endif + if COND_GRUB_EMU_PCI + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h + endif +@@ -292,12 +293,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h + kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h + grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h + +-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES) +- rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@ ++grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES) ++ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@ + CLEANFILES += grub_emu_init.h + +-grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) +- rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@ ++grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES) ++ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@ + CLEANFILES += grub_emu_init.c + endif + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index c916246..a6101de 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'; +@@ -83,8 +83,6 @@ kernel = { + x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; + x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; + +- ldadd = '$(LDADD_KERNEL)'; +- + mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; + powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; + sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; +@@ -132,6 +130,7 @@ kernel = { + common = kern/rescue_reader.c; + common = kern/term.c; + ++ noemu = kern/compiler-rt.c; + noemu = kern/mm.c; + noemu = kern/time.c; + noemu = kern/generic/millisleep.c; +@@ -159,6 +158,8 @@ kernel = { + terminfoinkernel = commands/extcmd.c; + terminfoinkernel = lib/arg.c; + ++ softdiv = lib/division.c; ++ + i386 = kern/i386/dl.c; + i386_xen = kern/i386/dl.c; + +@@ -252,6 +253,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; +@@ -263,7 +265,7 @@ kernel = { + arm = kern/arm/cache_armv7.S; + extra_dist = kern/arm/cache.S; + arm = kern/arm/cache.c; +- arm = kern/arm/misc.S; ++ arm = kern/arm/compiler-rt.S; + + arm64 = kern/arm64/cache.c; + arm64 = kern/arm64/cache_flush.S; +@@ -441,13 +443,13 @@ image = { + common = lib/xzembed/xz_dec_bcj.c; + common = lib/xzembed/xz_dec_lzma2.c; + common = lib/xzembed/xz_dec_stream.c; ++ common = kern/compiler-rt.c; + + cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1'; + + objcopyflags = '-O binary'; +- mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; +- ldadd = '$(TARGET_LIBGCC)'; +- cflags = '-Wno-unreachable-code $(TARGET_LDFLAGS_STATIC_LIBGCC)'; ++ mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; ++ cflags = '-Wno-unreachable-code'; + enable = mips; + }; + +@@ -459,9 +461,7 @@ image = { + cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1'; + + objcopyflags = '-O binary'; +- mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; +- ldadd = '$(TARGET_LIBGCC)'; +- cflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC)'; ++ mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; + enable = mips; + }; + +@@ -479,7 +479,7 @@ image = { + name = fwstart; + mips_loongson = boot/mips/loongson/fwstart.S; + objcopyflags = '-O binary'; +- ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; ++ ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; + enable = mips_loongson; + }; + +@@ -487,7 +487,7 @@ image = { + name = fwstart_fuloong2f; + mips_loongson = boot/mips/loongson/fuloong2f.S; + objcopyflags = '-O binary'; +- ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; ++ ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic'; + enable = mips_loongson; + }; + +@@ -510,13 +510,6 @@ module = { + }; + + module = { +- name = libusb; +- emu = bus/usb/emu/usb.c; +- enable = emu; +- condition = COND_GRUB_EMU_USB; +-}; +- +-module = { + name = lsspd; + mips_loongson = commands/mips/loongson/lsspd.c; + enable = mips_loongson; +@@ -531,13 +524,6 @@ module = { + }; + + module = { +- name = emuusb; +- common = bus/usb/usb.c; +- enable = emu; +- condition = COND_GRUB_EMU_USB; +-}; +- +-module = { + name = usbserial_common; + common = bus/usb/serial/common.c; + enable = usb; +@@ -1970,11 +1956,42 @@ module = { + }; + + module = { ++ name = div; ++ common = lib/division.c; ++ enable = no_softdiv; ++}; ++ ++module = { + name = div_test; + common = tests/div_test.c; + }; + + module = { ++ name = mul_test; ++ common = tests/mul_test.c; ++}; ++ ++module = { ++ name = shift_test; ++ common = tests/shift_test.c; ++}; ++ ++module = { ++ name = cmp_test; ++ common = tests/cmp_test.c; ++}; ++ ++module = { ++ name = ctz_test; ++ common = tests/ctz_test.c; ++}; ++ ++module = { ++ name = bswap_test; ++ common = tests/bswap_test.c; ++}; ++ ++module = { + name = videotest_checksum; + common = tests/videotest_checksum.c; + }; +diff --git a/grub-core/boot/decompressor/minilib.c b/grub-core/boot/decompressor/minilib.c +index 94edfd5..fc46ee0 100644 +--- a/grub-core/boot/decompressor/minilib.c ++++ b/grub-core/boot/decompressor/minilib.c +@@ -21,7 +21,7 @@ + #include + + void * +-memset (void *s, int c, grub_size_t len) ++grub_memset (void *s, int c, grub_size_t len) + { + grub_uint8_t *ptr; + for (ptr = s; len; ptr++, len--) +@@ -68,15 +68,6 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n) + return 0; + } + +-int memcmp (const void *s1, const void *s2, grub_size_t n) +- __attribute__ ((alias ("grub_memcmp"))); +- +-void *memmove (void *dest, const void *src, grub_size_t n) +- __attribute__ ((alias ("grub_memmove"))); +- +-void *memcpy (void *dest, const void *src, grub_size_t n) +- __attribute__ ((alias ("grub_memmove"))); +- + void *grub_decompressor_scratch; + + void +diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S +index b4975e2..2bd0b2d 100644 +--- a/grub-core/boot/i386/pc/boot.S ++++ b/grub-core/boot/i386/pc/boot.S +@@ -165,8 +165,8 @@ start: + * this area. + */ + +- . = _start + GRUB_BOOT_MACHINE_BPB_START +- . = _start + 4 ++ .org GRUB_BOOT_MACHINE_BPB_START ++ .org 4 + #endif + #ifdef HYBRID_BOOT + floppy +@@ -174,23 +174,23 @@ start: + scratch + #endif + +- . = _start + GRUB_BOOT_MACHINE_BPB_END ++ .org GRUB_BOOT_MACHINE_BPB_END + /* + * End of BIOS parameter block. + */ + +-kernel_address: ++LOCAL(kernel_address): + .word GRUB_BOOT_MACHINE_KERNEL_ADDR + + #ifndef HYBRID_BOOT +- . = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR +-kernel_sector: ++ .org GRUB_BOOT_MACHINE_KERNEL_SECTOR ++LOCAL(kernel_sector): + .long 1 +-kernel_sector_high: ++LOCAL(kernel_sector_high): + .long 0 + #endif + +- . = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE ++ .org GRUB_BOOT_MACHINE_BOOT_DRIVE + boot_drive: + .byte 0xff /* the disk to load kernel from */ + /* 0xff means use the boot drive */ +@@ -208,7 +208,7 @@ LOCAL(after_BPB): + * possible boot drive. If GRUB is installed into a floppy, + * this does nothing (only jump). + */ +- . = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK ++ .org GRUB_BOOT_MACHINE_DRIVE_CHECK + boot_drive_check: + jmp 3f /* grub-setup may overwrite this jump */ + testb $0x80, %dl +@@ -275,7 +275,7 @@ real_start: + andw $1, %cx + jz LOCAL(chs_mode) + +-lba_mode: ++LOCAL(lba_mode): + xorw %ax, %ax + movw %ax, 4(%si) + +@@ -290,9 +290,9 @@ lba_mode: + movw $0x0010, (%si) + + /* the absolute address */ +- movl kernel_sector, %ebx ++ movl LOCAL(kernel_sector), %ebx + movl %ebx, 8(%si) +- movl kernel_sector_high, %ebx ++ movl LOCAL(kernel_sector_high), %ebx + movl %ebx, 12(%si) + + /* the segment of buffer address */ +@@ -361,13 +361,13 @@ LOCAL(final_init): + + setup_sectors: + /* load logical sector start (top half) */ +- movl kernel_sector_high, %eax ++ movl LOCAL(kernel_sector_high), %eax + + orl %eax, %eax + jnz LOCAL(geometry_error) + + /* load logical sector start (bottom half) */ +- movl kernel_sector, %eax ++ movl LOCAL(kernel_sector), %eax + + /* zero %edx */ + xorl %edx, %edx +@@ -452,7 +452,7 @@ LOCAL(copy_buffer): + popa + + /* boot kernel */ +- jmp *(kernel_address) ++ jmp *(LOCAL(kernel_address)) + + /* END OF MAIN LOOP */ + +@@ -511,13 +511,13 @@ LOCAL(message): + */ + + #ifdef HYBRID_BOOT +- . = _start + 0x1b0 +-kernel_sector: ++ .org 0x1b0 ++LOCAL(kernel_sector): + .long 1 +-kernel_sector_high: ++LOCAL(kernel_sector_high): + .long 0 + #endif +- . = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC ++ .org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC + nt_magic: + .long 0 + .word 0 +@@ -528,7 +528,7 @@ nt_magic: + * sneaky, huh? + */ + +- . = _start + GRUB_BOOT_MACHINE_PART_START ++ .org GRUB_BOOT_MACHINE_PART_START + + #ifndef HYBRID_BOOT + floppy +@@ -536,7 +536,7 @@ nt_magic: + scratch + #endif + +- . = _start + GRUB_BOOT_MACHINE_PART_END ++ .org GRUB_BOOT_MACHINE_PART_END + + /* the last 2 bytes in the sector 0 contain the signature */ + .word GRUB_BOOT_MACHINE_SIGNATURE +diff --git a/grub-core/boot/i386/pc/cdboot.S b/grub-core/boot/i386/pc/cdboot.S +index 92df7c7..de4f809 100644 +--- a/grub-core/boot/i386/pc/cdboot.S ++++ b/grub-core/boot/i386/pc/cdboot.S +@@ -43,7 +43,7 @@ _start: + LOCAL(next): + jmp 1f + +- . = start + 8 ++ .org 8 + + bi_pvd: + .long 0 /* LBA of primary volume descriptor. */ +@@ -168,6 +168,6 @@ err_noboot_msg: + err_cdfail_msg: + .ascii "cdrom read fails\0" + +- . = start + 0x7FF ++ .org 0x7FF + + .byte 0 +diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S +index d030a14..1ee4cf5 100644 +--- a/grub-core/boot/i386/pc/diskboot.S ++++ b/grub-core/boot/i386/pc/diskboot.S +@@ -362,7 +362,7 @@ LOCAL(message): + .word 0 + .word 0 + +- . = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE ++ .org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE + LOCAL(firstlist): /* this label has to be before the first list entry!!! */ + /* fill the first data listing with the default */ + blocklist_default_start: +diff --git a/grub-core/boot/i386/pc/lnxboot.S b/grub-core/boot/i386/pc/lnxboot.S +index 87e56a2..2dda0e0 100644 +--- a/grub-core/boot/i386/pc/lnxboot.S ++++ b/grub-core/boot/i386/pc/lnxboot.S +@@ -41,7 +41,7 @@ data_start: + xorl %ebp, %ebp + jmp LOCAL(linux_next) + +- . = data_start + 0x1F1 ++ .org 0x1F1 + + setup_sects: + .byte CODE_SECTORS +@@ -292,4 +292,4 @@ LOCAL(fail): + err_int15_msg: + .ascii "move memory fails\0" + +- . = _start + CODE_SECTORS * 512 ++ .org (CODE_SECTORS * 512 + 512) +diff --git a/grub-core/boot/i386/pc/pxeboot.S b/grub-core/boot/i386/pc/pxeboot.S +index 446bfc7..b695b24 100644 +--- a/grub-core/boot/i386/pc/pxeboot.S ++++ b/grub-core/boot/i386/pc/pxeboot.S +@@ -38,5 +38,5 @@ start: + /* This region is a junk. Do you say that this is wasteful? + But I like that the memory layout of the body is consistent + among different kernels rather than scamping just for 1.5KB. */ +- . = _start + 0x8200 - 0x7C00 - 0x200 - 1 ++ .org 0x8200 - 0x7C00 - 0x200 - 1 + .byte 0 +diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S +index 2796740..8bce798 100644 +--- a/grub-core/boot/i386/pc/startup_raw.S ++++ b/grub-core/boot/i386/pc/startup_raw.S +@@ -50,23 +50,23 @@ LOCAL (base): + * This is a special data area. + */ + +- . = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE ++ .org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE + LOCAL(compressed_size): + .long 0 +- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE ++ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE + LOCAL(uncompressed_size): + .long 0 + +- . = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY ++ .org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY + reed_solomon_redundancy: + .long 0 +- . = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH ++ .org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH + .short (LOCAL(reed_solomon_part) - _start) + + /* + * This is the area for all of the special variables. + */ +- . = _start + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE ++ .org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE + LOCAL(boot_dev): + .byte 0xFF, 0xFF, 0xFF + LOCAL(boot_drive): +@@ -89,13 +89,13 @@ LOCAL (codestart): + sti /* we're safe again */ + + /* save the boot drive */ +- ADDR32 movb %dl, LOCAL(boot_drive) ++ movb %dl, LOCAL(boot_drive) + + /* reset disk system (%ah = 0) */ + int $0x13 + + /* transition to protected mode */ +- DATA32 call real_to_prot ++ calll real_to_prot + + /* The ".code32" directive takes GAS out of 16-bit mode. */ + .code32 +@@ -149,7 +149,7 @@ gate_a20_try_bios: + movw $0x2401, %ax + int $0x15 + +- DATA32 call real_to_prot ++ calll real_to_prot + .code32 + + popl %ebp +diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S +index bdd68c7..8c3a1db 100644 +--- a/grub-core/boot/i386/qemu/boot.S ++++ b/grub-core/boot/i386/qemu/boot.S +@@ -31,7 +31,7 @@ _start: + + jmp 1f + +- . = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR ++ .org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR + VARIABLE(grub_core_entry_addr) + .long 0 + 1: +@@ -48,8 +48,9 @@ VARIABLE(grub_core_entry_addr) + /* Transition to protected mode. We use pushl to force generation + of a flat return address. */ + pushl $1f +- DATA32 jmp real_to_prot ++ jmp real_to_prot + .code32 ++1: + /* Ensure A20 is enabled. We're in qemu, so control port A works + and there is no need to wait since there is no real logic, it's + all emulated. */ +@@ -57,7 +58,6 @@ VARIABLE(grub_core_entry_addr) + andb $(~0x03), %al + orb $0x02, %al + outb $0x92 +-1: + movl EXT_C(grub_core_entry_addr), %edx + jmp *%edx + +@@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr) + /* Intel, in its infinite wisdom, decided to put the i8086 entry point + *right here* and this is why we need this kludge. */ + +- . = GRUB_BOOT_MACHINE_SIZE - 16 ++ .org GRUB_BOOT_MACHINE_SIZE - 16 + + .code16 + + jmp _start +- . = GRUB_BOOT_MACHINE_SIZE ++ .org GRUB_BOOT_MACHINE_SIZE +diff --git a/grub-core/boot/mips/loongson/fwstart.S b/grub-core/boot/mips/loongson/fwstart.S +index 6ae3269..71bab6d 100644 +--- a/grub-core/boot/mips/loongson/fwstart.S ++++ b/grub-core/boot/mips/loongson/fwstart.S +@@ -162,7 +162,7 @@ retry_cs5536: + + b continue + +- . = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START ++ .org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START + tlb_refill: + mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC + mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR +@@ -196,13 +196,13 @@ tlb_refill: + b fatal + addiu $a0, $a0, %lo(unhandled_tlb_refill) + +- . = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START ++ .org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START + cache_error: + lui $a0, %hi(unhandled_cache_error) + b fatal + addiu $a0, $a0, %lo(unhandled_cache_error) + +- . = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START ++ .org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START + other_exception: + mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE + mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC +diff --git a/grub-core/boot/mips/startup_raw.S b/grub-core/boot/mips/startup_raw.S +index 29e93c1..fd95c31 100644 +--- a/grub-core/boot/mips/startup_raw.S ++++ b/grub-core/boot/mips/startup_raw.S +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + + #define BASE_ADDR 8 +@@ -32,6 +33,7 @@ + .globl __start, _start, start + .set noreorder + .set nomacro ++ mips_attributes + __start: + _start: + start: +@@ -39,13 +41,13 @@ start: + bal codestart + nop + base: +- . = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE ++ .org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE + compressed_size: + .long 0 +- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE ++ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE + uncompressed_size: + .long 0 +- . = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR ++ .org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR + uncompressed_addr: + .long 0 + codestart: +@@ -150,18 +152,18 @@ digcont: + 1: + jr $ra + nop +-busclockstr: .asciiz "busclock=" +-cpuclockstr: .asciiz "cpuclock=" +-memsizestr: .asciiz "memsize=" +-highmemsizestr: .asciiz "highmemsize=" +-machtype_yeeloong_str1: .asciiz "machtype=8.9" +-machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-" +-machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f" +-machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e" +-pmon_yeeloong_str: .asciiz "PMON_VER=LM8" +-pmon_fuloong2f_str: .asciiz "PMON_VER=LM6" +-pmon_yeeloong_verstr: .asciiz "Version=LM8" +-pmon_fuloong2f_verstr: .asciiz "Version=LM6" ++busclockstr: .asciz "busclock=" ++cpuclockstr: .asciz "cpuclock=" ++memsizestr: .asciz "memsize=" ++highmemsizestr: .asciz "highmemsize=" ++machtype_yeeloong_str1: .asciz "machtype=8.9" ++machtype_yeeloong_str2: .asciz "machtype=lemote-yeeloong-" ++machtype_fuloong2f_str: .asciz "machtype=lemote-fuloong-2f" ++machtype_fuloong2e_str: .asciz "machtype=lemote-fuloong-2e" ++pmon_yeeloong_str: .asciz "PMON_VER=LM8" ++pmon_fuloong2f_str: .asciz "PMON_VER=LM6" ++pmon_yeeloong_verstr: .asciz "Version=LM8" ++pmon_fuloong2f_verstr: .asciz "Version=LM6" + .p2align 2 + + argdone: +diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S +index 5073677..586efb4 100644 +--- a/grub-core/boot/sparc64/ieee1275/boot.S ++++ b/grub-core/boot/sparc64/ieee1275/boot.S +@@ -41,9 +41,9 @@ pic_base: + * After loading in that block we will execute it by jumping to the + * load address plus the size of the prepended A.OUT header (32 bytes). + */ +- . = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH ++ .org GRUB_BOOT_MACHINE_BOOT_DEVPATH + boot_path: +- . = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE ++ .org GRUB_BOOT_MACHINE_KERNEL_BYTE + boot_path_end: + kernel_byte: .xword (2 << 9) + kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR +@@ -52,7 +52,7 @@ kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR + #define boot_path_end (_start + 1024) + #include + +- . = _start + 8 ++ .org 8 + kernel_byte: .xword (2 << 9) + kernel_size: .word 512 + kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS +@@ -224,7 +224,7 @@ bootpath_known: + #else + nop + #endif +- . = _start + GRUB_BOOT_MACHINE_CODE_END ++ .org GRUB_BOOT_MACHINE_CODE_END + + /* the last 4 bytes in the sector 0 contain the signature */ + .word GRUB_BOOT_MACHINE_SIGNATURE +diff --git a/grub-core/boot/sparc64/ieee1275/diskboot.S b/grub-core/boot/sparc64/ieee1275/diskboot.S +index e020f62..35e02c1 100644 +--- a/grub-core/boot/sparc64/ieee1275/diskboot.S ++++ b/grub-core/boot/sparc64/ieee1275/diskboot.S +@@ -136,7 +136,7 @@ lastlist: + .word 0 + .word 0 + +- . = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE) ++ .org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE) + blocklist_default_start: + .word 0 + .word 2 +diff --git a/grub-core/bus/emu/pci.c b/grub-core/bus/emu/pci.c +index 9d32963..267f262 100644 +--- a/grub-core/bus/emu/pci.c ++++ b/grub-core/bus/emu/pci.c +@@ -55,7 +55,8 @@ grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base, + int err; + err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr); + if (err) +- grub_util_error ("mapping 0x%x failed (error %d)\n", base, err); ++ grub_util_error ("mapping 0x%llx failed (error %d)", ++ (unsigned long long) base, err); + return addr; + } + +@@ -66,12 +67,12 @@ grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem, + pci_device_unmap_range (dev, mem, size); + } + +-GRUB_MOD_INIT (pci) ++GRUB_MOD_INIT (emupci) + { + pci_system_init (); + } + +-GRUB_MOD_FINI (pci) ++GRUB_MOD_FINI (emupci) + { + pci_system_cleanup (); + } +diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c +index c0feefa..8ece400 100644 +--- a/grub-core/bus/usb/ehci.c ++++ b/grub-core/bus/usb/ehci.c +@@ -670,23 +670,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++) + { + e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td); +- e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); +- e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); ++ e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + } + e->td_virt[GRUB_EHCI_N_TD - 1].next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + e->tdfree_virt = e->td_virt; + /* Set Terminate in first QH, which is used in framelist */ +- e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH); +- e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH); ++ e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + e->qh_virt[0].td_overlay.alt_next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + /* Also set Halted bit in token */ +- e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); ++ e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); + /* Set the H bit in first QH used for AL */ +- e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H); ++ e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H); + /* Set Terminate into TD in rest of QHs and set horizontal link + * pointer to itself - these QHs will be used for asynchronous + * schedule and they should have valid value in horiz. link */ +@@ -697,12 +697,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + e->qh_chunk) & + GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH); + e->qh_virt[i].td_overlay.next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + e->qh_virt[i].td_overlay.alt_next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + /* Also set Halted bit in token */ + e->qh_virt[i].td_overlay.token = +- grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); + } + + /* Note: QH 0 and QH 1 are reserved and must not be used anywhere. +@@ -991,7 +991,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer) + target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) | + transfer->devaddr) & GRUB_EHCI_TARGET_MASK; + target = grub_cpu_to_le32 (target); +- mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK); ++ mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK); + + /* low speed interrupt transfers are linked to the periodic */ + /* schedule, everything else to the asynchronous schedule */ +@@ -1200,7 +1200,7 @@ grub_ehci_transaction (struct grub_ehci *e, + grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td)); + + /* Don't point to any TD yet, just terminate. */ +- td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + /* Set alternate pointer. When short packet occurs, alternate TD + * will not be really fetched because it is not active. But don't + * forget, EHCI will try to fetch alternate TD every scan of AL +@@ -1325,9 +1325,9 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, + /* Fill whole alternate TD by zeros (= inactive) and set + * Terminate bits and Halt bit */ + grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td)); +- cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); +- cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); +- cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED); ++ cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); ++ cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); ++ cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED); + + /* Allocate appropriate number of TDs and set */ + for (i = 0; i < transfer->transcnt; i++) +@@ -1364,7 +1364,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, + cdata->td_last_virt = td; + cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk); + /* Last TD should not have set alternate TD */ +- cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + + grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n", + cdata,cdata->qh_virt); +@@ -1377,14 +1377,14 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, + /* Start transfer: */ + /* Unlink possible alternate pointer in QH */ + cdata->qh_virt->td_overlay.alt_next_td = +- grub_cpu_to_le32 (GRUB_EHCI_TERMINATE); ++ grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE); + /* Link new TDs with QH via next_td */ + cdata->qh_virt->td_overlay.next_td = + grub_cpu_to_le32 (grub_dma_virt2phys + (cdata->td_first_virt, e->td_chunk)); + /* Reset Active and Halted bits in QH to activate Advance Queue, + * i.e. reset token */ +- cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0); ++ cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0); + + /* Finito */ + transfer->controller_data = cdata; +@@ -1408,9 +1408,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer) + * safely manipulate with QH TD part. */ + cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token + | +- grub_cpu_to_le32 ++ grub_cpu_to_le32_compile_time + (GRUB_EHCI_STATUS_HALTED)) & +- grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE); ++ grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE); + + /* Print debug data here if necessary */ + +diff --git a/grub-core/bus/usb/emu/usb.c b/grub-core/bus/usb/emu/usb.c +deleted file mode 100644 +index 3ad2fc3..0000000 +--- a/grub-core/bus/usb/emu/usb.c ++++ /dev/null +@@ -1,203 +0,0 @@ +-/* usb.c -- libusb USB support for GRUB. */ +-/* +- * 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 +- +-GRUB_MOD_LICENSE ("GPLv3+"); +- +- +-static struct grub_usb_controller_dev usb_controller = +-{ +- .name = "libusb" +-}; +- +-static struct grub_usb_device *grub_usb_devs[128]; +- +-struct usb_bus *busses; +- +-static grub_err_t +-grub_libusb_devices (void) +- +-{ +- struct usb_bus *bus; +- int last = 0; +- +- busses = usb_get_busses(); +- +- for (bus = busses; bus; bus = bus->next) +- { +- struct usb_device *usbdev; +- struct grub_usb_device *dev; +- +- for (usbdev = bus->devices; usbdev; usbdev = usbdev->next) +- { +- struct usb_device_descriptor *desc = &usbdev->descriptor; +- grub_err_t err; +- +- if (! desc->bcdUSB) +- continue; +- +- dev = grub_malloc (sizeof (*dev)); +- if (! dev) +- return grub_errno; +- +- dev->data = usbdev; +- +- /* Fill in all descriptors. */ +- err = grub_usb_device_initialize (dev); +- if (err) +- { +- grub_errno = GRUB_ERR_NONE; +- continue; +- } +- +- /* Register the device. */ +- grub_usb_devs[last++] = dev; +- } +- } +- +- return GRUB_USB_ERR_NONE; +-} +- +-void +-grub_usb_poll_devices (void) +-{ +- /* TODO: recheck grub_usb_devs */ +-} +- +- +-int +-grub_usb_iterate (grub_usb_iterate_hook_t hook, void *hook_data) +-{ +- int i; +- +- for (i = 0; i < 128; i++) +- { +- if (grub_usb_devs[i]) +- { +- if (hook (grub_usb_devs[i], hook_data)) +- return 1; +- } +- } +- +- return 0; +-} +- +-grub_usb_err_t +-grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused))) +-{ +- return GRUB_USB_ERR_NONE; +-} +- +-grub_usb_err_t +-grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype, +- grub_uint8_t request, grub_uint16_t value, +- grub_uint16_t idx, grub_size_t size, char *data) +-{ +- usb_dev_handle *devh; +- struct usb_device *d = dev->data; +- +- devh = usb_open (d); +- if (usb_control_msg (devh, reqtype, request, +- value, idx, data, size, 20) < 0) +- { +- usb_close (devh); +- return GRUB_USB_ERR_STALL; +- } +- +- usb_close (devh); +- +- return GRUB_USB_ERR_NONE; +-} +- +-grub_usb_err_t +-grub_usb_bulk_read (grub_usb_device_t dev, +- int endpoint, grub_size_t size, char *data) +-{ +- usb_dev_handle *devh; +- struct usb_device *d = dev->data; +- +- devh = usb_open (d); +- if (usb_claim_interface (devh, 0) < 1) +- { +- usb_close (devh); +- return GRUB_USB_ERR_STALL; +- } +- +- if (usb_bulk_read (devh, endpoint, data, size, 20) < 1) +- { +- usb_close (devh); +- return GRUB_USB_ERR_STALL; +- } +- +- usb_release_interface (devh, 0); +- usb_close (devh); +- +- return GRUB_USB_ERR_NONE; +-} +- +-grub_usb_err_t +-grub_usb_bulk_write (grub_usb_device_t dev, +- int endpoint, grub_size_t size, char *data) +-{ +- usb_dev_handle *devh; +- struct usb_device *d = dev->data; +- +- devh = usb_open (d); +- if (usb_claim_interface (devh, 0) < 0) +- goto fail; +- +- if (usb_bulk_write (devh, endpoint, data, size, 20) < 0) +- goto fail; +- +- if (usb_release_interface (devh, 0) < 0) +- goto fail; +- +- usb_close (devh); +- +- return GRUB_USB_ERR_NONE; +- +- fail: +- usb_close (devh); +- return GRUB_USB_ERR_STALL; +-} +- +-GRUB_MOD_INIT (libusb) +-{ +- usb_init(); +- usb_find_busses(); +- usb_find_devices(); +- +- if (grub_libusb_devices ()) +- return; +- +- grub_usb_controller_dev_register (&usb_controller); +- +- return; +-} +- +-GRUB_MOD_FINI (libusb) +-{ +- return; +-} +diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c +index 946a4ed..f0be533 100644 +--- a/grub-core/bus/usb/ohci.c ++++ b/grub-core/bus/usb/ohci.c +@@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed) + * GRUB_OHCI_CTRL_EDS); + for (j=0; j < GRUB_OHCI_CTRL_EDS; j++) +- o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */ ++ o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */ + + grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n", + o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr); +@@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + /* Preset EDs */ + grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS); + for (j=0; j < GRUB_OHCI_BULK_EDS; j++) +- o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */ ++ o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */ + + grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n", + o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr); +@@ -750,7 +750,10 @@ grub_ohci_setup_transfer (grub_usb_controller_t dev, + { + cdata->td_head_virt = grub_ohci_alloc_td (o); + if (!cdata->td_head_virt) +- return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */ ++ { ++ grub_free (cdata); ++ return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */ ++ } + /* We can set td_head only when ED is not active, i.e. + * when it is newly allocated. */ + cdata->ed_virt->td_head +@@ -1349,10 +1352,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused))) + /* Set skip in all EDs */ + if (o->ed_bulk) + for (i=0; i < GRUB_OHCI_BULK_EDS; i++) +- o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */ ++ o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */ + if (o->ed_ctrl) + for (i=0; i < GRUB_OHCI_CTRL_EDS; i++) +- o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */ ++ o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */ + + /* We should wait for next SOF to be sure that all EDs are + * unaccessed by OHCI. But OHCI can be non-functional, so +diff --git a/grub-core/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c +index a95fdfe..7c5811f 100644 +--- a/grub-core/bus/usb/uhci.c ++++ b/grub-core/bus/usb/uhci.c +@@ -625,9 +625,7 @@ grub_uhci_check_transfer (grub_usb_controller_t dev, + return GRUB_USB_ERR_NONE; + } + +- grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status); +- +- if (!(errtd->ctrl_status & (1 << 23))) ++ if (errtd && !(errtd->ctrl_status & (1 << 23))) + { + grub_usb_err_t err = GRUB_USB_ERR_NONE; + +diff --git a/grub-core/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c +index 557e71c..ee86808 100644 +--- a/grub-core/bus/usb/usbtrans.c ++++ b/grub-core/bus/usb/usbtrans.c +@@ -31,7 +31,7 @@ grub_usb_bulk_maxpacket (grub_usb_device_t dev, + struct grub_usb_desc_endp *endpoint) + { + /* Use the maximum packet size given in the endpoint descriptor. */ +- if (dev->initialized && endpoint) ++ if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket) + return endpoint->maxpacket; + + return 64; +@@ -311,8 +311,8 @@ grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer) + transfer->size + 1); + + grub_free (transfer->transactions); +- grub_free (transfer); + grub_dma_free (transfer->data_chunk); ++ grub_free (transfer); + } + + static grub_usb_err_t +diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c +index 97c2cf2..c3861f5 100644 +--- a/grub-core/commands/acpi.c ++++ b/grub-core/commands/acpi.c +@@ -131,6 +131,8 @@ grub_acpi_get_rsdpv1 (void) + return grub_machine_acpi_get_rsdpv1 (); + } + ++#if defined (__i386__) || defined (__x86_64__) ++ + static inline int + iszero (grub_uint8_t *reg, int size) + { +@@ -141,7 +143,6 @@ iszero (grub_uint8_t *reg, int size) + return 1; + } + +-#if defined (__i386__) || defined (__x86_64__) + /* Context for grub_acpi_create_ebda. */ + struct grub_acpi_create_ebda_ctx { + int ebda_len; +@@ -179,8 +180,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; +@@ -227,7 +230,7 @@ grub_acpi_create_ebda (void) + grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target); + v2inebda = target; + target += v2->length; +- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); ++ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); + v2 = 0; + break; + } +@@ -246,7 +249,7 @@ grub_acpi_create_ebda (void) + grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target); + v1inebda = target; + target += sizeof (struct grub_acpi_rsdp_v10); +- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); ++ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); + v1 = 0; + break; + } +@@ -265,7 +268,7 @@ grub_acpi_create_ebda (void) + grub_memcpy (target, v2, v2->length); + v2inebda = target; + target += v2->length; +- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); ++ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); + v2 = 0; + break; + } +@@ -282,7 +285,7 @@ grub_acpi_create_ebda (void) + grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10)); + v1inebda = target; + target += sizeof (struct grub_acpi_rsdp_v10); +- target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1); ++ target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); + v1 = 0; + break; + } +@@ -494,6 +497,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) + if (! rsdp) + rsdp = grub_machine_acpi_get_rsdpv1 (); + ++ grub_dprintf ("acpi", "RSDP @%p\n", rsdp); ++ + if (rsdp) + { + grub_uint32_t *entry_ptr; +diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c +index 09421a6..da68b5b 100644 +--- a/grub-core/commands/acpihalt.c ++++ b/grub-core/commands/acpihalt.c +@@ -136,6 +136,49 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end) + } + + static inline grub_uint32_t ++skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end) ++{ ++ grub_uint32_t add; ++ const grub_uint8_t *ptr0 = ptr; ++ ++ switch(*ptr) ++ { ++ case GRUB_ACPI_OPCODE_ADD: ++ case GRUB_ACPI_OPCODE_AND: ++ case GRUB_ACPI_OPCODE_CONCAT: ++ case GRUB_ACPI_OPCODE_CONCATRES: ++ case GRUB_ACPI_OPCODE_DIVIDE: ++ case GRUB_ACPI_OPCODE_INDEX: ++ case GRUB_ACPI_OPCODE_LSHIFT: ++ case GRUB_ACPI_OPCODE_MOD: ++ case GRUB_ACPI_OPCODE_MULTIPLY: ++ case GRUB_ACPI_OPCODE_NAND: ++ case GRUB_ACPI_OPCODE_NOR: ++ case GRUB_ACPI_OPCODE_OR: ++ case GRUB_ACPI_OPCODE_RSHIFT: ++ case GRUB_ACPI_OPCODE_SUBTRACT: ++ case GRUB_ACPI_OPCODE_TOSTRING: ++ case GRUB_ACPI_OPCODE_XOR: ++ /* ++ * Parameters for these opcodes: TermArg, TermArg Target, see ACPI ++ * spec r5.0, page 828f. ++ */ ++ ptr++; ++ ptr += add = skip_term (ptr, end); ++ if (!add) ++ return 0; ++ ptr += add = skip_term (ptr, end); ++ if (!add) ++ return 0; ++ ptr += skip_name_string (ptr, end); ++ break; ++ default: ++ return skip_data_ref_object (ptr, end); ++ } ++ return ptr - ptr0; ++} ++ ++static inline grub_uint32_t + skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) + { + const grub_uint8_t *ptr0 = ptr; +@@ -156,10 +199,10 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) + ptr++; + ptr += skip_name_string (ptr, end); + ptr++; +- ptr += add = skip_data_ref_object (ptr, end); ++ ptr += add = skip_term (ptr, end); + if (!add) + return 0; +- ptr += add = skip_data_ref_object (ptr, end); ++ ptr += add = skip_term (ptr, end); + if (!add) + return 0; + break; +@@ -180,6 +223,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) + return ptr - ptr0; + } + ++ + static int + get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, + grub_uint8_t *scope, int scope_len) +@@ -214,8 +258,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, + } + case GRUB_ACPI_OPCODE_NAME: + ptr++; +- if ((!scope || memcmp (scope, "\\", scope_len) == 0) && +- (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)) ++ if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) && ++ (grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0)) + { + int ll; + grub_uint8_t *ptr2 = ptr; +@@ -250,6 +294,17 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, + if (!add) + return -1; + break; ++ case GRUB_ACPI_OPCODE_ALIAS: ++ ptr++; ++ /* We need to skip two name strings */ ++ ptr += add = skip_name_string (ptr, end); ++ if (!add) ++ return -1; ++ ptr += add = skip_name_string (ptr, end); ++ if (!add) ++ return -1; ++ break; ++ + case GRUB_ACPI_OPCODE_SCOPE: + { + int scope_sleep_type; +diff --git a/grub-core/commands/cacheinfo.c b/grub-core/commands/cacheinfo.c +index ead6ff8..d34a346 100644 +--- a/grub-core/commands/cacheinfo.c ++++ b/grub-core/commands/cacheinfo.c +@@ -23,6 +23,8 @@ + #include + #include + ++GRUB_MOD_LICENSE ("GPLv3+"); ++ + static grub_err_t + grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), +diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c +index eda8c5f..8717db9 100644 +--- a/grub-core/commands/efi/lsefisystab.c ++++ b/grub-core/commands/efi/lsefisystab.c +@@ -52,6 +52,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)), + grub_efi_configuration_table_t *t; + unsigned int i; + ++ grub_printf ("Address: %p\n", st); + grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n", + st->hdr.signature, st->hdr.revision); + { +diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c +index 42d62d4..12fba99 100644 +--- a/grub-core/commands/file.c ++++ b/grub-core/commands/file.c +@@ -476,8 +476,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) + be at least 12 bytes and aligned on a 4-byte boundary. */ + for (header = buffer; + ((char *) header <= +- (char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12)) +- || (header = 0); header += step) ++ (char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12)); ++ header += step) + { + if (header[0] == magic + && !(grub_le_to_cpu32 (header[0]) +@@ -485,11 +485,12 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) + + grub_le_to_cpu32 (header[2]) + + (type == IS_MULTIBOOT2 + ? grub_le_to_cpu32 (header[3]) : 0))) +- break; ++ { ++ ret = 1; ++ break; ++ } + } + +- if (header != 0) +- ret = 1; + grub_free (buffer); + break; + } +diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c +index c9857ff..c17d26c 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" + +@@ -39,10 +40,10 @@ grub_file_check_netbsdXX (grub_elf_t elf) + return 0; + + if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1) +- return 0; ++ goto fail; + + if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize) +- return 0; ++ goto fail; + + s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize); + stroff = s->sh_offset; +@@ -53,18 +54,21 @@ grub_file_check_netbsdXX (grub_elf_t elf) + char name[sizeof(".note.netbsd.ident")]; + grub_memset (name, 0, sizeof (name)); + if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1) +- return grub_errno; ++ goto fail; + + if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) + { + if (grub_errno) +- return grub_errno; ++ goto fail; + continue; + } + if (grub_memcmp (name, ".note.netbsd.ident", + sizeof(".note.netbsd.ident")) != 0) + continue; ++ grub_free (s0); + return 1; + } ++ fail: ++ grub_free (s0); + return 0; + } +diff --git a/grub-core/commands/gptsync.c b/grub-core/commands/gptsync.c +index 3db6288..444e248 100644 +--- a/grub-core/commands/gptsync.c ++++ b/grub-core/commands/gptsync.c +@@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), + } + + /* Check if it is valid. */ +- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) ++ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) + { + grub_device_close (dev); + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); +@@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), + first_sector--; + mbr.entries[0].flag = 0; + mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK; +- mbr.entries[0].start = grub_cpu_to_le32 (1); ++ mbr.entries[0].start = grub_cpu_to_le32_compile_time (1); + lba_to_chs (1, + &(mbr.entries[0].start_sector), + &(mbr.entries[0].start_cylinder), +@@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), + &(mbr.entries[0].end_head)); + mbr.entries[0].length = grub_cpu_to_le32 (first_sector); + +- mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE); ++ mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE); + + if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr)) + { +@@ -235,6 +235,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + } + ++ grub_device_close (dev); ++ + grub_printf_ (N_("New MBR is written to `%s'\n"), args[0]); + + return GRUB_ERR_NONE; +diff --git a/grub-core/commands/hdparm.c b/grub-core/commands/hdparm.c +index 3fb0891..f6b178e 100644 +--- a/grub-core/commands/hdparm.c ++++ b/grub-core/commands/hdparm.c +@@ -329,6 +329,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) + break; + } + default: ++ grub_disk_close (disk); + return grub_error (GRUB_ERR_IO, "not an ATA device"); + } + +diff --git a/grub-core/commands/i386/coreboot/cb_timestamps.c b/grub-core/commands/i386/coreboot/cb_timestamps.c +index 07fbb02..e72f38d 100644 +--- a/grub-core/commands/i386/coreboot/cb_timestamps.c ++++ b/grub-core/commands/i386/coreboot/cb_timestamps.c +@@ -39,9 +39,17 @@ static const char *descs[] = { + [2] = "before RAM init", + [3] = "after RAM init", + [4] = "end of romstage", ++ [5] = "start of verified boot", ++ [6] = "end of verified boot", + [8] = "start of RAM copy", + [9] = "end of RAM copy", + [10] = "start of ramstage", ++ [11] = "start of bootblock", ++ [12] = "end of bootblock", ++ [13] = "starting to load romstage", ++ [14] = "finished loading romstage", ++ [15] = "starting LZMA decompress (ignore for x86)", ++ [16] = "finished LZMA decompress (ignore for x86)", + [30] = "device enumerate", + [40] = "device configure", + [50] = "device enable", +diff --git a/grub-core/commands/i386/pc/acpi.c b/grub-core/commands/i386/pc/acpi.c +index d415d23..297f5d0 100644 +--- a/grub-core/commands/i386/pc/acpi.c ++++ b/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/grub-core/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c +index 40798c9..7712e2a 100644 +--- a/grub-core/commands/i386/pc/play.c ++++ b/grub-core/commands/i386/pc/play.c +@@ -107,6 +107,14 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + } + ++ if (!tempo) ++ { ++ grub_file_close (file); ++ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), ++ args[0]); ++ return grub_errno; ++ } ++ + tempo = grub_le_to_cpu32 (tempo); + grub_dprintf ("play","tempo = %d\n", tempo); + +@@ -131,6 +139,13 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), + + tempo = grub_strtoul (args[0], &end, 0); + ++ if (!tempo) ++ { ++ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), ++ args[0]); ++ return grub_errno; ++ } ++ + if (*end) + /* Was not a number either, assume it was supposed to be a file name. */ + return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]); +diff --git a/grub-core/commands/i386/pc/sendkey.c b/grub-core/commands/i386/pc/sendkey.c +index d985cb3..26d9acd 100644 +--- a/grub-core/commands/i386/pc/sendkey.c ++++ b/grub-core/commands/i386/pc/sendkey.c +@@ -292,7 +292,7 @@ find_key_code (char *key) + { + unsigned i; + +- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) ++ for (i = 0; i < ARRAY_SIZE(keysym_table); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) +@@ -311,7 +311,7 @@ find_ascii_code (char *key) + { + unsigned i; + +- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) ++ for (i = 0; i < ARRAY_SIZE(keysym_table); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) +@@ -352,15 +352,13 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args) + + { + unsigned i; +- for (i = 0; i < sizeof (simple_flag_offsets) +- / sizeof (simple_flag_offsets[0]); i++) ++ for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++) + grub_sendkey_set_simple_flag (simple_flag_offsets[i], + grub_sendkey_parse_op(state[i])); + } + + /* Set noled. */ +- noled = (state[sizeof (simple_flag_offsets) +- / sizeof (simple_flag_offsets[0])].set); ++ noled = (state[ARRAY_SIZE(simple_flag_offsets)].set); + + return GRUB_ERR_NONE; + } +diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c +index da04389..f4b7730 100644 +--- a/grub-core/commands/keylayouts.c ++++ b/grub-core/commands/keylayouts.c +@@ -173,8 +173,10 @@ grub_term_map_key (grub_keyboard_key_t code, int status) + + key = map_key_core (code, status, &alt_gr_consumed); + +- if (key == 0 || key == GRUB_TERM_SHIFT) ++ if (key == 0 || key == GRUB_TERM_SHIFT) { + grub_printf ("Unknown key 0x%x detected\n", code); ++ return GRUB_TERM_NO_KEY; ++ } + + if (status & GRUB_TERM_STATUS_CAPS) + { +diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c +index e42a9d8..d42d777 100644 +--- a/grub-core/commands/legacycfg.c ++++ b/grub-core/commands/legacycfg.c +@@ -57,14 +57,20 @@ legacy_file (const char *filename) + + file = grub_file_open (filename); + if (! file) +- return grub_errno; ++ { ++ grub_free (suffix); ++ return grub_errno; ++ } + + menu = grub_env_get_menu (); + if (! menu) + { + menu = grub_zalloc (sizeof (*menu)); + if (! menu) +- return grub_errno; ++ { ++ grub_free (suffix); ++ return grub_errno; ++ } + + grub_env_set_menu (menu); + } +@@ -77,6 +83,7 @@ legacy_file (const char *filename) + if (!buf && grub_errno) + { + grub_file_close (file); ++ grub_free (suffix); + return grub_errno; + } + +@@ -173,6 +180,8 @@ legacy_file (const char *filename) + if (!args) + { + grub_file_close (file); ++ grub_free (suffix); ++ grub_free (entrysrc); + return grub_errno; + } + args[0] = entryname; +@@ -376,6 +385,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), + if (part && grub_strcmp (part->partmap->name, "msdos") == 0) + bsd_slice = part->number; + } ++ if (dev) ++ grub_device_close (dev); + } + + /* k*BSD didn't really work well with grub-legacy. */ +@@ -580,7 +591,7 @@ check_password_md5_real (const char *entered, + GRUB_MD_MD5->write (ctx, entered, enteredlen); + digest = GRUB_MD_MD5->read (ctx); + GRUB_MD_MD5->final (ctx); +- memcpy (alt_result, digest, MD5_HASHLEN); ++ grub_memcpy (alt_result, digest, MD5_HASHLEN); + + GRUB_MD_MD5->init (ctx); + GRUB_MD_MD5->write (ctx, entered, enteredlen); +@@ -596,7 +607,7 @@ check_password_md5_real (const char *entered, + + for (i = 0; i < 1000; i++) + { +- memcpy (alt_result, digest, 16); ++ grub_memcpy (alt_result, digest, 16); + + GRUB_MD_MD5->init (ctx); + if ((i & 1) != 0) +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 --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c +index c521083..18efa1a 100644 +--- a/grub-core/commands/macbless.c ++++ b/grub-core/commands/macbless.c +@@ -37,7 +37,7 @@ struct find_node_context + grub_uint64_t inode_found; + char *dirname; + enum +- { NONE, FILE, DIR } found; ++ { FOUND_NONE, FOUND_FILE, FOUND_DIR } found; + }; + + static int +@@ -53,7 +53,7 @@ find_inode (const char *filename, + && grub_strcasecmp (ctx->dirname, filename) == 0))) + { + ctx->inode_found = info->inode; +- ctx->found = info->dir ? DIR : FILE; ++ ctx->found = info->dir ? FOUND_DIR : FOUND_FILE; + } + return 0; + } +@@ -106,7 +106,7 @@ grub_mac_bless_inode (grub_device_t dev, grub_uint32_t inode, int is_dir, + ablk_size = grub_be_to_cpu32 (volheader.hfs.blksz); + ablk_start = grub_be_to_cpu16 (volheader.hfs.first_block); + embedded_offset = (ablk_start +- + extent_start ++ + ((grub_uint64_t) extent_start) + * (ablk_size >> GRUB_DISK_SECTOR_BITS)); + + err = +@@ -175,7 +175,7 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel) + grub_free (path); + + return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found, +- (ctx.found == DIR), intel); ++ (ctx.found == FOUND_DIR), intel); + } + + static grub_err_t +@@ -183,7 +183,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) + { + char *device_name; + char *path = 0; +- grub_device_t dev; ++ grub_device_t dev = 0; + grub_err_t err; + + if (argc != 1) +@@ -197,13 +197,12 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) + else + path = path + 1; + +- if (!path || *path == 0 || !device_name) ++ if (!path || *path == 0 || !dev) + { + if (dev) + grub_device_close (dev); + + grub_free (device_name); +- grub_free (path); + + return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); + } +diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c +index 33b6b99..b3bc463 100644 +--- a/grub-core/commands/nativedisk.c ++++ b/grub-core/commands/nativedisk.c +@@ -57,6 +57,7 @@ get_uuid (const char *name, char **uuid, int getnative) + if (!dev->disk) + { + grub_dprintf ("nativedisk", "Skipping non-disk\n"); ++ grub_device_close (dev); + return 0; + } + +@@ -90,6 +91,7 @@ get_uuid (const char *name, char **uuid, int getnative) + case GRUB_DISK_DEVICE_MEMDISK_ID: + grub_dprintf ("nativedisk", "Skipping native disk %s\n", + dev->disk->name); ++ grub_device_close (dev); + return 0; + + /* FIXME: those probably need special handling. */ +diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c +index a47ff07..42c590e 100644 +--- a/grub-core/commands/parttool.c ++++ b/grub-core/commands/parttool.c +@@ -243,11 +243,19 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), + } + + if (argc == 1) +- return show_help (dev); ++ { ++ err = show_help (dev); ++ grub_device_close (dev); ++ return err; ++ } + + for (i = 1; i < argc; i++) + if (grub_strcmp (args[i], "help") == 0) +- return show_help (dev); ++ { ++ err = show_help (dev); ++ grub_device_close (dev); ++ return err; ++ } + + parsed = (int *) grub_zalloc (argc * sizeof (int)); + +@@ -274,8 +282,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), + break; + } + if (! cur) +- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), ++ { ++ grub_device_close (dev); ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), + args[i]); ++ } + ptool = cur; + pargs = (struct grub_parttool_args *) + grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args)); +diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c +index 0dd1aef..c6a77c8 100644 +--- a/grub-core/commands/password_pbkdf2.c ++++ b/grub-core/commands/password_pbkdf2.c +@@ -104,7 +104,10 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)), + + pass->c = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) +- return grub_errno; ++ { ++ grub_free (pass); ++ return grub_errno; ++ } + if (*ptr != '.') + { + grub_free (pass); +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 16143a3..440303a 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -210,10 +210,10 @@ try (struct search_ctx *ctx) + /* Cache entry was outdated. Remove it. */ + if (!ctx->count) + { ++ *prev = cache_ent->next; + grub_free (cache_ent->key); + grub_free (cache_ent->value); + grub_free (cache_ent); +- *prev = cache_ent->next; + } + } + +diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c +index 3f75fec..d7fd26b 100644 +--- a/grub-core/commands/search_wrap.c ++++ b/grub-core/commands/search_wrap.c +@@ -175,7 +175,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + var = "root"; + } + else +- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); ++ { ++ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); ++ goto out; ++ } + + if (state[SEARCH_LABEL].set) + grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set, +@@ -187,8 +190,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, + hints, nhints); + else +- return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); ++ grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); + ++out: ++ grub_free (hints); + return grub_errno; + } + +diff --git a/grub-core/commands/syslinuxcfg.c b/grub-core/commands/syslinuxcfg.c +index a4bfc40..7be28fa 100644 +--- a/grub-core/commands/syslinuxcfg.c ++++ b/grub-core/commands/syslinuxcfg.c +@@ -50,7 +50,7 @@ static const struct grub_arg_option options[] = + N_("root directory of the syslinux disk [default=/]."), + N_("DIR"), ARG_TYPE_STRING}, + {"cwd", 'c', 0, +- N_("current directory of the syslinux [default is parent directory of input file]."), ++ N_("current directory of syslinux [default is parent directory of input file]."), + N_("DIR"), ARG_TYPE_STRING}, + {"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0}, + {"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0}, +@@ -119,7 +119,10 @@ syslinux_file (grub_extcmd_context_t ctxt, const char *filename) + { + menu = grub_zalloc (sizeof (*menu)); + if (! menu) +- return grub_errno; ++ { ++ grub_free (result); ++ return grub_errno; ++ } + + grub_env_set_menu (menu); + } +diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c +index c98c13d..5f06642 100644 +--- a/grub-core/commands/test.c ++++ b/grub-core/commands/test.c +@@ -332,7 +332,7 @@ test_parse (char **args, int *argn, int argc) + get_fileinfo (args[*argn + 1], &ctx); + update_val (ctx.file_exists && ctx.file_info.dir, &ctx); + (*argn) += 2; +- return ctx.or || ctx.and; ++ continue; + } + + if (grub_strcmp (args[*argn], "-e") == 0) +@@ -340,7 +340,7 @@ test_parse (char **args, int *argn, int argc) + get_fileinfo (args[*argn + 1], &ctx); + update_val (ctx.file_exists, &ctx); + (*argn) += 2; +- return ctx.or || ctx.and; ++ continue; + } + + if (grub_strcmp (args[*argn], "-f") == 0) +@@ -349,7 +349,7 @@ test_parse (char **args, int *argn, int argc) + /* FIXME: check for other types. */ + update_val (ctx.file_exists && ! ctx.file_info.dir, &ctx); + (*argn) += 2; +- return ctx.or || ctx.and; ++ continue; + } + + if (grub_strcmp (args[*argn], "-s") == 0) +@@ -362,7 +362,7 @@ test_parse (char **args, int *argn, int argc) + grub_file_close (file); + grub_errno = GRUB_ERR_NONE; + (*argn) += 2; +- return ctx.or || ctx.and; ++ continue; + } + + /* String tests. */ +diff --git a/grub-core/commands/tr.c b/grub-core/commands/tr.c +index 84ad6ff..ef72841 100644 +--- a/grub-core/commands/tr.c ++++ b/grub-core/commands/tr.c +@@ -80,7 +80,7 @@ grub_cmd_tr (grub_extcmd_context_t ctxt, int argc, char **args) + } else if (argc > 3) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters"); + +- if (argc <= 0 && (!s1 || !s2 || !input)) ++ if (!s1 || !s2 || !input) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing parameters"); + + if (grub_strlen (s1) != grub_strlen (s2)) +diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c +index a9dfd88..9620a3b 100644 +--- a/grub-core/commands/verify.c ++++ b/grub-core/commands/verify.c +@@ -33,6 +33,13 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + ++struct grub_verified ++{ ++ grub_file_t file; ++ void *buf; ++}; ++typedef struct grub_verified *grub_verified_t; ++ + enum + { + OPTION_SKIP_SIG = 0 +@@ -301,7 +308,7 @@ grub_load_public_key (grub_file_t f) + if (!sk) + goto fail; + +- grub_memset (fingerprint_context, 0, sizeof (fingerprint_context)); ++ grub_memset (fingerprint_context, 0, GRUB_MD_SHA1->contextsize); + GRUB_MD_SHA1->init (fingerprint_context); + GRUB_MD_SHA1->write (fingerprint_context, "\x99", 1); + len_be = grub_cpu_to_be16 (len); +@@ -447,7 +454,7 @@ grub_verify_signature_real (char *buf, grub_size_t size, + grub_err_t err; + grub_size_t i; + gcry_mpi_t mpis[10]; +- grub_uint8_t type; ++ grub_uint8_t type = 0; + + err = read_packet_header (sig, &type, &len); + if (err) +@@ -802,19 +809,39 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt, + + static int sec = 0; + ++static void ++verified_free (grub_verified_t verified) ++{ ++ if (verified) ++ { ++ grub_free (verified->buf); ++ grub_free (verified); ++ } ++} ++ + static grub_ssize_t + verified_read (struct grub_file *file, char *buf, grub_size_t len) + { +- grub_memcpy (buf, (char *) file->data + file->offset, len); ++ grub_verified_t verified = file->data; ++ ++ grub_memcpy (buf, (char *) verified->buf + file->offset, len); + return len; + } + + static grub_err_t + verified_close (struct grub_file *file) + { +- grub_free (file->data); ++ grub_verified_t verified = file->data; ++ ++ grub_file_close (verified->file); ++ verified_free (verified); + file->data = 0; +- return GRUB_ERR_NONE; ++ ++ /* device and name are freed by parent */ ++ file->device = 0; ++ file->name = 0; ++ ++ return grub_errno; + } + + struct grub_fs verified_fs = +@@ -832,10 +859,13 @@ grub_pubkey_open (grub_file_t io, const char *filename) + grub_err_t err; + grub_file_filter_t curfilt[GRUB_FILE_FILTER_MAX]; + grub_file_t ret; ++ grub_verified_t verified; + + if (!sec) + return io; +- if (io->device->disk && io->device->disk->id == GRUB_DISK_DEVICE_MEMDISK_ID) ++ if (io->device->disk && ++ (io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID ++ || io->device->disk->dev->id == GRUB_DISK_DEVICE_PROCFS_ID)) + return io; + fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig")); + if (!fsuf) +@@ -855,7 +885,10 @@ grub_pubkey_open (grub_file_t io, const char *filename) + + ret = grub_malloc (sizeof (*ret)); + if (!ret) +- return NULL; ++ { ++ grub_file_close (sig); ++ return NULL; ++ } + *ret = *io; + + ret->fs = &verified_fs; +@@ -864,29 +897,46 @@ grub_pubkey_open (grub_file_t io, const char *filename) + { + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "big file signature isn't implemented yet"); ++ grub_file_close (sig); ++ grub_free (ret); + return NULL; + } +- ret->data = grub_malloc (ret->size); +- if (!ret->data) ++ verified = grub_malloc (sizeof (*verified)); ++ if (!verified) + { ++ grub_file_close (sig); + grub_free (ret); + return NULL; + } +- if (grub_file_read (io, ret->data, ret->size) != (grub_ssize_t) ret->size) ++ verified->buf = grub_malloc (ret->size); ++ if (!verified->buf) ++ { ++ grub_file_close (sig); ++ grub_free (verified); ++ grub_free (ret); ++ return NULL; ++ } ++ if (grub_file_read (io, verified->buf, ret->size) != (grub_ssize_t) ret->size) + { + if (!grub_errno) + grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"), + filename); ++ grub_file_close (sig); ++ verified_free (verified); ++ grub_free (ret); + return NULL; + } + +- err = grub_verify_signature_real (ret->data, ret->size, 0, sig, NULL); ++ err = grub_verify_signature_real (verified->buf, ret->size, 0, sig, NULL); + grub_file_close (sig); + if (err) +- return NULL; +- io->device = 0; +- io->name = 0; +- grub_file_close (io); ++ { ++ verified_free (verified); ++ grub_free (ret); ++ return NULL; ++ } ++ verified->file = io; ++ ret->data = verified; + return ret; + } + +diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c +index 2807f80..9b4e727 100644 +--- a/grub-core/commands/wildcard.c ++++ b/grub-core/commands/wildcard.c +@@ -245,7 +245,10 @@ match_devices_iter (const char *name, void *data) + + t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2)); + if (! t) +- return 1; ++ { ++ grub_free (buffer); ++ return 1; ++ } + + ctx->devs = t; + ctx->devs[ctx->ndev++] = buffer; +@@ -290,7 +293,8 @@ struct match_files_ctx + + /* Helper for match_files. */ + static int +-match_files_iter (const char *name, const struct grub_dirhook_info *info, ++match_files_iter (const char *name, ++ const struct grub_dirhook_info *info __attribute__((unused)), + void *data) + { + struct match_files_ctx *ctx = data; +diff --git a/grub-core/disk/AFSplitter.c b/grub-core/disk/AFSplitter.c +index d76a1c4..f5a8ddc 100644 +--- a/grub-core/disk/AFSplitter.c ++++ b/grub-core/disk/AFSplitter.c +@@ -72,13 +72,13 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst, + grub_size_t i; + grub_uint8_t *bufblock; + ++ if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0) ++ return GPG_ERR_INV_ARG; ++ + bufblock = grub_zalloc (blocksize); + if (bufblock == NULL) + return GPG_ERR_OUT_OF_MEMORY; + +- if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN) +- return GPG_ERR_INV_ARG; +- + grub_memset (bufblock, 0, blocksize); + for (i = 0; i < blocknumbers - 1; i++) + { +diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c +index 0b13fb8..f4725e8 100644 +--- a/grub-core/disk/ahci.c ++++ b/grub-core/disk/ahci.c +@@ -194,13 +194,11 @@ grub_ahci_pciinit (grub_pci_device_t dev, + return 0; + + addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); +- grub_pci_write_word (addr, grub_pci_read_word (addr) | +- GRUB_PCI_COMMAND_IO_ENABLED +- | GRUB_PCI_COMMAND_MEM_ENABLED +- | GRUB_PCI_COMMAND_BUS_MASTER); ++ grub_pci_write_word (addr, grub_pci_read_word (addr) ++ | GRUB_PCI_COMMAND_MEM_ENABLED); + + hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK, +- sizeof (hba)); ++ sizeof (*hba)); + grub_dprintf ("ahci", "dev: %x:%x.%x\n", dev.bus, dev.device, dev.function); + + grub_dprintf ("ahci", "tfd[0]: %x\n", +@@ -324,7 +322,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + +- nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; ++ nports = (GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; + + grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports, + hba->ports_implemented); +@@ -357,10 +355,10 @@ grub_ahci_pciinit (grub_pci_device_t dev, + if (adevs[i]) + { + adevs[i]->hba->ports[adevs[i]->port].sata_error = adevs[i]->hba->ports[adevs[i]->port].sata_error; +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + +- adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head)); ++ adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32); + if (!adevs[i]->command_list_chunk) + { + adevs[i] = 0; +@@ -378,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev, + + adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk); + adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk); ++ ++ grub_memset ((void *) adevs[i]->command_list, 0, ++ sizeof (struct grub_ahci_cmd_table)); ++ grub_memset ((void *) adevs[i]->command_table, 0, ++ sizeof (struct grub_ahci_cmd_head) * 32); ++ + adevs[i]->command_list->command_table_base + = grub_dma_get_phys (adevs[i]->command_table_chunk); + +@@ -436,7 +440,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, + adevs[i]->hba->ports[adevs[i]->port].intstatus = ~0; + // adevs[i]->hba->ports[adevs[i]->port].fbs = 0; + +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->rfis = grub_memalign_dma32 (4096, +@@ -450,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, + adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis); + adevs[i]->hba->ports[adevs[i]->port].command_list_base + = grub_dma_get_phys (adevs[i]->command_list_chunk); ++ adevs[i]->hba->ports[adevs[i]->port].command_issue = 0; + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE; + } + +@@ -475,7 +480,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, + for (i = 0; i < nports; i++) + if (adevs[i]) + { +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + fr_running |= (1 << i); + +@@ -483,7 +488,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; + adevs[i]->hba->ports[adevs[i]->port].command |= 1 << 28; + +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + } + +@@ -510,26 +515,26 @@ grub_ahci_pciinit (grub_pci_device_t dev, + for (i = 0; i < nports; i++) + if (adevs[i]) + { +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_SPIN_UP; + +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].sata_error = ~0; +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + +- grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", ++ grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port, + (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba), + adevs[i]->hba->ports[adevs[i]->port].task_file_data, + adevs[i]->hba->ports[adevs[i]->port].command); + +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + } + +@@ -537,17 +542,19 @@ grub_ahci_pciinit (grub_pci_device_t dev, + for (i = 0; i < nports; i++) + if (adevs[i]) + { +- grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", ++ grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port, + (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba), + adevs[i]->hba->ports[adevs[i]->port].task_file_data, + adevs[i]->hba->ports[adevs[i]->port].command); + +- grub_dprintf ("ahci", "err: %x\n", ++ grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port, + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].command +- = (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) | 2 | 4; ++ = (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) ++ | GRUB_AHCI_HBA_PORT_CMD_SPIN_UP ++ | GRUB_AHCI_HBA_PORT_CMD_POWER_ON; + + /* struct grub_disk_ata_pass_through_parms parms2; + grub_memset (&parms2, 0, sizeof (parms2)); +@@ -560,14 +567,14 @@ grub_ahci_pciinit (grub_pci_device_t dev, + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) +- if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) ++ if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ))) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) +- if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) ++ if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ))) + { + grub_dprintf ("ahci", "port %d is busy\n", i); + failed_adevs[i] = adevs[i]; +@@ -596,6 +603,9 @@ grub_ahci_pciinit (grub_pci_device_t dev, + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } ++ ++ grub_dprintf ("ahci", "cleaning up failed devs\n"); ++ + for (i = 0; i < nports; i++) + if (failed_adevs[i] && (fr_running & (1 << i))) + failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; +@@ -621,6 +631,10 @@ grub_ahci_pciinit (grub_pci_device_t dev, + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14) + adevs[i]->atapi = 1; + ++ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); ++ grub_pci_write_word (addr, grub_pci_read_word (addr) ++ | GRUB_PCI_COMMAND_BUS_MASTER); ++ + for (i = 0; i < nports; i++) + if (adevs[i]) + { +@@ -847,6 +861,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force) + { + struct grub_disk_ata_pass_through_parms parms2; + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; ++ dev->hba->ports[dev->port].command_issue = 0; ++ dev->command_list[0].config = 0; ++ dev->command_table[0].prdt[0].unused = 0; ++ dev->command_table[0].prdt[0].size = 0; ++ dev->command_table[0].prdt[0].data_base = 0; ++ + endtime = grub_get_time_ms () + 1000; + while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + if (grub_get_time_ms () > endtime) +@@ -914,7 +934,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, + if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH) + return grub_error (GRUB_ERR_BUG, "too big data buffer"); + +- bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1)); ++ if (parms->size) ++ bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1)); ++ else ++ bufc = grub_memalign_dma32 (1024, 512); + + grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n", + dev->hba->ports[dev->port].task_file_data, +@@ -924,7 +947,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, + = (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT) + // | GRUB_AHCI_CONFIG_CLEAR_R_OK + | (0 << GRUB_AHCI_CONFIG_PMP_SHIFT) +- | (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT) ++ | ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT) + | (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0) + | (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ) + | (parms->taskfile.cmd == 8 ? (1 << 8) : 0); +@@ -981,7 +1004,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, + if (parms->write) + grub_memcpy ((char *) grub_dma_get_virt (bufc), parms->buffer, parms->size); + +- grub_dprintf ("ahci", "AHCI command schedulded\n"); ++ grub_dprintf ("ahci", "AHCI command scheduled\n"); + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + grub_dprintf ("ahci", "AHCI inten = %x\n", +@@ -1001,7 +1024,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + +- endtime = grub_get_time_ms () + (spinup ? 10000 : 5000); ++ endtime = grub_get_time_ms () + (spinup ? 20000 : 20000); + while ((dev->hba->ports[dev->port].command_issue & 1)) + if (grub_get_time_ms () > endtime) + { +diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c +index 2b98849..8ba4e5c 100644 +--- a/grub-core/disk/ata.c ++++ b/grub-core/disk/ata.c +@@ -216,6 +216,12 @@ grub_ata_setaddress (struct grub_ata *dev, + unsigned int head; + unsigned int sect; + ++ if (dev->sectors_per_track == 0 ++ || dev->heads == 0) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "sector %d cannot be addressed " ++ "using CHS addressing", sector); ++ + /* Calculate the sector, cylinder and head to use. */ + sect = ((grub_uint32_t) sector % dev->sectors_per_track) + 1; + cylinder = (((grub_uint32_t) sector / dev->sectors_per_track) +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 75c6e1f..82a3dcb 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -110,20 +110,23 @@ grub_crypto_pcbc_decrypt (grub_crypto_cipher_handle_t cipher, + { + grub_uint8_t *inptr, *outptr, *end; + grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; +- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) +- return GPG_ERR_INV_ARG; ++ grub_size_t blocksize; + if (!cipher->cipher->decrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) ++ return GPG_ERR_INV_ARG; ++ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) + return GPG_ERR_INV_ARG; + end = (grub_uint8_t *) in + size; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + { +- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); ++ grub_memcpy (ivt, inptr, blocksize); + cipher->cipher->decrypt (cipher->ctx, outptr, inptr); +- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); +- grub_crypto_xor (iv, ivt, outptr, cipher->cipher->blocksize); ++ grub_crypto_xor (outptr, outptr, iv, blocksize); ++ grub_crypto_xor (iv, ivt, outptr, blocksize); + } + return GPG_ERR_NO_ERROR; + } +@@ -135,20 +138,23 @@ grub_crypto_pcbc_encrypt (grub_crypto_cipher_handle_t cipher, + { + grub_uint8_t *inptr, *outptr, *end; + grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; +- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) +- return GPG_ERR_INV_ARG; +- if (!cipher->cipher->decrypt) ++ grub_size_t blocksize; ++ if (!cipher->cipher->encrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) ++ return GPG_ERR_INV_ARG; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) + return GPG_ERR_INV_ARG; + end = (grub_uint8_t *) in + size; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + { +- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); +- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); ++ grub_memcpy (ivt, inptr, blocksize); ++ grub_crypto_xor (outptr, outptr, iv, blocksize); + cipher->cipher->encrypt (cipher->ctx, outptr, inptr); +- grub_crypto_xor (iv, ivt, outptr, cipher->cipher->blocksize); ++ grub_crypto_xor (iv, ivt, outptr, blocksize); + } + return GPG_ERR_NO_ERROR; + } +@@ -372,11 +378,13 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev, + break; + case GRUB_CRYPTODISK_MODE_ECB: + if (do_encrypt) +- grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i, +- (1U << dev->log_sector_size)); ++ err = grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i, ++ (1U << dev->log_sector_size)); + else +- grub_crypto_ecb_decrypt (dev->cipher, data + i, data + i, +- (1U << dev->log_sector_size)); ++ err = grub_crypto_ecb_decrypt (dev->cipher, data + i, data + i, ++ (1U << dev->log_sector_size)); ++ if (err) ++ return err; + break; + default: + return GPG_ERR_NOT_IMPLEMENTED; +@@ -762,25 +770,26 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name, + + void + grub_util_cryptodisk_get_abstraction (grub_disk_t disk, +- void (*cb) (const char *val)) ++ void (*cb) (const char *val, void *data), ++ void *data) + { + grub_cryptodisk_t dev = (grub_cryptodisk_t) disk->data; + +- cb ("cryptodisk"); +- cb (dev->modname); ++ cb ("cryptodisk", data); ++ cb (dev->modname, data); + + if (dev->cipher) +- cb (dev->cipher->cipher->modname); ++ cb (dev->cipher->cipher->modname, data); + if (dev->secondary_cipher) +- cb (dev->secondary_cipher->cipher->modname); ++ cb (dev->secondary_cipher->cipher->modname, data); + if (dev->essiv_cipher) +- cb (dev->essiv_cipher->cipher->modname); ++ cb (dev->essiv_cipher->cipher->modname, data); + if (dev->hash) +- cb (dev->hash->modname); ++ cb (dev->hash->modname, data); + if (dev->essiv_hash) +- cb (dev->essiv_hash->modname); ++ cb (dev->essiv_hash->modname, data); + if (dev->iv_hash) +- cb (dev->iv_hash->modname); ++ cb (dev->iv_hash->modname, data); + } + + const char * +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 28b70c6..c4f6678 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -71,10 +71,12 @@ is_lv_readable (struct grub_diskfilter_lv *lv, int easily) + case GRUB_DISKFILTER_RAID6: + if (!easily) + need--; ++ /* Fallthrough. */ + case GRUB_DISKFILTER_RAID4: + case GRUB_DISKFILTER_RAID5: + if (!easily) + need--; ++ /* Fallthrough. */ + case GRUB_DISKFILTER_STRIPED: + break; + +@@ -354,7 +356,8 @@ grub_diskfilter_memberlist (grub_disk_t disk) + + void + grub_diskfilter_get_partmap (grub_disk_t disk, +- void (*cb) (const char *pm)) ++ void (*cb) (const char *pm, void *data), ++ void *data) + { + struct grub_diskfilter_lv *lv = disk->data; + struct grub_diskfilter_pv *pv; +@@ -376,7 +379,7 @@ grub_diskfilter_get_partmap (grub_disk_t disk, + continue; + } + for (s = 0; pv->partmaps[s]; s++) +- cb (pv->partmaps[s]); ++ cb (pv->partmaps[s], data); + } + } + +@@ -482,6 +485,96 @@ grub_diskfilter_read_node (const struct grub_diskfilter_node *node, + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name); + } + ++ ++static grub_err_t ++validate_segment (struct grub_diskfilter_segment *seg); ++ ++static grub_err_t ++validate_lv (struct grub_diskfilter_lv *lv) ++{ ++ unsigned int i; ++ if (!lv) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume"); ++ ++ if (!lv->vg || lv->vg->extent_size == 0) ++ return grub_error (GRUB_ERR_READ_ERROR, "invalid volume"); ++ ++ for (i = 0; i < lv->segment_count; i++) ++ { ++ grub_err_t err; ++ err = validate_segment (&lv->segments[i]); ++ if (err) ++ return err; ++ } ++ return GRUB_ERR_NONE; ++} ++ ++ ++static grub_err_t ++validate_node (const struct grub_diskfilter_node *node) ++{ ++ /* Check whether we actually know the physical volume we want to ++ read from. */ ++ if (node->pv) ++ return GRUB_ERR_NONE; ++ if (node->lv) ++ return validate_lv (node->lv); ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name); ++} ++ ++static grub_err_t ++validate_segment (struct grub_diskfilter_segment *seg) ++{ ++ grub_err_t err; ++ ++ if (seg->stripe_size == 0 || seg->node_count == 0) ++ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); ++ ++ switch (seg->type) ++ { ++ case GRUB_DISKFILTER_RAID10: ++ { ++ grub_uint8_t near, far; ++ near = seg->layout & 0xFF; ++ far = (seg->layout >> 8) & 0xFF; ++ if ((seg->layout >> 16) == 0 && far == 0) ++ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); ++ if (near > seg->node_count) ++ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); ++ break; ++ } ++ ++ case GRUB_DISKFILTER_STRIPED: ++ case GRUB_DISKFILTER_MIRROR: ++ break; ++ ++ case GRUB_DISKFILTER_RAID4: ++ case GRUB_DISKFILTER_RAID5: ++ if (seg->node_count <= 1) ++ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); ++ break; ++ ++ case GRUB_DISKFILTER_RAID6: ++ if (seg->node_count <= 2) ++ return grub_error(GRUB_ERR_BAD_FS, "invalid segment"); ++ break; ++ ++ default: ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "unsupported RAID level %d", seg->type); ++ } ++ ++ unsigned i; ++ for (i = 0; i < seg->node_count; i++) ++ { ++ err = validate_node (&seg->nodes[i]); ++ if (err) ++ return err; ++ } ++ return GRUB_ERR_NONE; ++ ++} ++ + static grub_err_t + read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector, + grub_size_t size, char *buf) +@@ -493,6 +586,7 @@ read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector, + if (seg->node_count == 1) + return grub_diskfilter_read_node (&seg->nodes[0], + sector, size, buf); ++ /* Fallthrough. */ + case GRUB_DISKFILTER_MIRROR: + case GRUB_DISKFILTER_RAID10: + { +@@ -847,6 +941,23 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) + + for (lv = vg->lvs; lv; lv = lv->next) + { ++ grub_err_t err; ++ ++ /* RAID 1 and single-disk RAID 0 don't use a chunksize but code ++ assumes one so set one. */ ++ for (i = 0; i < lv->segment_count; i++) ++ { ++ if (lv->segments[i].type == 1) ++ lv->segments[i].stripe_size = 64; ++ if (lv->segments[i].type == GRUB_DISKFILTER_STRIPED ++ && lv->segments[i].node_count == 1 ++ && lv->segments[i].stripe_size == 0) ++ lv->segments[i].stripe_size = 64; ++ } ++ ++ err = validate_lv(lv); ++ if (err) ++ return err; + lv->number = lv_num++; + + if (lv->fullname) +@@ -887,12 +998,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) + lv->fullname = tmp; + } + } +- /* RAID 1 doesn't use a chunksize but code assumes one so set +- one. */ +- for (i = 0; i < lv->segment_count; i++) +- if (lv->segments[i].type == 1) +- lv->segments[i].stripe_size = 64; +- lv->vg = vg; + } + /* Add our new array to the list. */ + vg->next = array_list; +@@ -925,6 +1030,11 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + n = layout & 0xFF; + if (n == 1) + n = (layout >> 8) & 0xFF; ++ if (n == 0) ++ { ++ grub_free (uuid); ++ return NULL; ++ } + + totsize = grub_divmod64 (nmemb * disk_size, n, 0); + } +@@ -938,6 +1048,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + break; + + default: ++ grub_free (uuid); + return NULL; + } + +@@ -951,7 +1062,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + array->lvs->segments->extent_count = totsize; + } + +- if (array->lvs->segments ++ if (array->lvs && array->lvs->segments + && array->lvs->segments->raid_member_size > disk_size) + array->lvs->segments->raid_member_size = disk_size; + +@@ -960,7 +1071,10 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + } + array = grub_zalloc (sizeof (*array)); + if (!array) +- return NULL; ++ { ++ grub_free (uuid); ++ return NULL; ++ } + array->uuid = uuid; + array->uuid_len = uuidlen; + if (name) +@@ -982,8 +1096,16 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + goto fail; + array->lvs->segment_count = 1; + array->lvs->visible = 1; +- array->lvs->name = array->name; +- array->lvs->fullname = array->name; ++ if (array->name) ++ { ++ array->lvs->name = grub_strdup (array->name); ++ if (!array->lvs->name) ++ goto fail; ++ array->lvs->fullname = grub_strdup (array->name); ++ if (!array->lvs->fullname) ++ goto fail; ++ } ++ array->lvs->vg = array; + + array->lvs->idname = grub_malloc (sizeof ("mduuid/") + 2 * uuidlen); + if (!array->lvs->idname) +@@ -1033,13 +1155,26 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + return array; + + fail: +- grub_free (array->lvs); ++ if (array->lvs) ++ { ++ grub_free (array->lvs->name); ++ grub_free (array->lvs->fullname); ++ grub_free (array->lvs->idname); ++ if (array->lvs->segments) ++ { ++ grub_free (array->lvs->segments->nodes); ++ grub_free (array->lvs->segments); ++ } ++ grub_free (array->lvs); ++ } + while (array->pvs) + { + pv = array->pvs->next; + grub_free (array->pvs); + array->pvs = pv; + } ++ grub_free (array->name); ++ grub_free (array->uuid); + grub_free (array); + return NULL; + } +@@ -1142,10 +1277,9 @@ free_array (void) + { + unsigned i; + vg->lvs = lv->next; +- if (lv->name != lv->fullname) +- grub_free (lv->fullname); +- if (lv->name != vg->name) +- grub_free (lv->name); ++ grub_free (lv->fullname); ++ grub_free (lv->name); ++ grub_free (lv->idname); + for (i = 0; i < lv->segment_count; i++) + grub_free (lv->segments[i].nodes); + grub_free (lv->segments); +diff --git a/grub-core/disk/dmraid_nvidia.c b/grub-core/disk/dmraid_nvidia.c +index 6e64055..0602791 100644 +--- a/grub-core/disk/dmraid_nvidia.c ++++ b/grub-core/disk/dmraid_nvidia.c +@@ -99,6 +99,8 @@ grub_dmraid_nv_detect (grub_disk_t disk, + struct grub_nv_super sb; + int level; + grub_uint64_t disk_size; ++ grub_uint32_t capacity; ++ grub_uint8_t total_volumes; + char *uuid; + + if (disk->partition) +@@ -124,11 +126,17 @@ grub_dmraid_nv_detect (grub_disk_t disk, + return NULL; + } + ++ capacity = grub_le_to_cpu32 (sb.capacity); ++ total_volumes = sb.array.total_volumes; ++ + switch (sb.array.raid_level) + { + case NV_LEVEL_0: + level = 0; +- disk_size = sb.capacity / sb.array.total_volumes; ++ if (total_volumes == 0) ++ /* Not RAID. */ ++ return NULL; ++ disk_size = capacity / total_volumes; + break; + + case NV_LEVEL_1: +@@ -138,7 +146,10 @@ grub_dmraid_nv_detect (grub_disk_t disk, + + case NV_LEVEL_5: + level = 5; +- disk_size = sb.capacity / (sb.array.total_volumes - 1); ++ if (total_volumes == 0 || total_volumes == 1) ++ /* Not RAID. */ ++ return NULL; ++ disk_size = capacity / (total_volumes - 1); + break; + + default: +@@ -161,7 +172,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, + + return grub_diskfilter_make_raid (sizeof (sb.array.signature), + uuid, sb.array.total_volumes, +- NULL, disk_size, ++ "nv", disk_size, + sb.array.stripe_block_size, + GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC, + level); +diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c +index 3b12c34..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; + +@@ -803,7 +762,6 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) + && (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE + || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)) + { +- int is_cdrom = 0; + struct grub_efidisk_get_device_name_ctx ctx; + char *dev_name; + grub_efi_device_path_t *dup_dp; +@@ -811,22 +769,19 @@ 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))) + break; + +- if (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE) +- is_cdrom = 1; +- + 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); +@@ -861,10 +816,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) + + if (! ctx.partition_name) + { ++ /* No partition found. In most cases partition is embed in ++ the root path anyway, so this is not critical. ++ This happens only if partition is on partmap that GRUB ++ doesn't need to access root. ++ */ + grub_disk_close (parent); +- if (is_cdrom) +- return grub_strdup (device_name); +- return 0; ++ return grub_strdup (device_name); + } + + dev_name = grub_xasprintf ("%s,%s", parent->name, +diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c +index 9025c9d..e9d2329 100644 +--- a/grub-core/disk/geli.c ++++ b/grub-core/disk/geli.c +@@ -212,7 +212,8 @@ grub_util_get_geli_uuid (const char *dev) + + s = grub_util_get_fd_size (fd, dev, &log_secsize); + s >>= log_secsize; +- grub_util_fd_seek (fd, (s << log_secsize) - 512); ++ if (grub_util_fd_seek (fd, (s << log_secsize) - 512) < 0) ++ grub_util_error ("%s", _("couldn't read ELI metadata")); + + uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1); + if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0) +@@ -225,13 +226,16 @@ grub_util_get_geli_uuid (const char *dev) + + /* Look for GELI magic sequence. */ + if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC)) +- || grub_le_to_cpu32 (header->version) > 5 ++ || grub_le_to_cpu32 (header->version) > 7 + || grub_le_to_cpu32 (header->version) < 1) + grub_util_error ("%s", _("wrong ELI magic or version")); + + err = make_uuid ((void *) &hdr, uuid); + if (err) +- return NULL; ++ { ++ grub_free (uuid); ++ return NULL; ++ } + + return uuid; + } +@@ -265,7 +269,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + + /* Look for GELI magic sequence. */ + if (grub_memcmp (header.magic, GELI_MAGIC, sizeof (GELI_MAGIC)) +- || grub_le_to_cpu32 (header.version) > 5 ++ || grub_le_to_cpu32 (header.version) > 7 + || grub_le_to_cpu32 (header.version) < 1) + { + grub_dprintf ("geli", "wrong magic %02x\n", header.magic[0]); +@@ -332,19 +336,29 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + { + secondary_cipher = grub_crypto_cipher_open (ciph); + if (!secondary_cipher) +- return NULL; ++ { ++ grub_crypto_cipher_close (cipher); ++ return NULL; ++ } ++ + } + + if (grub_le_to_cpu16 (header.keylen) > 1024) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d", + grub_le_to_cpu16 (header.keylen)); ++ grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); + return NULL; + } + + newdev = grub_zalloc (sizeof (struct grub_cryptodisk)); + if (!newdev) +- return NULL; ++ { ++ grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); ++ return NULL; ++ } + newdev->cipher = cipher; + newdev->secondary_cipher = secondary_cipher; + newdev->offset = 0; +@@ -391,6 +405,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) + grub_uint8_t geomkey[GRUB_CRYPTO_MAX_MDLEN]; + grub_uint8_t verify_key[GRUB_CRYPTO_MAX_MDLEN]; + grub_uint8_t zero[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; ++ grub_uint8_t geli_cipher_key[64]; + char passphrase[MAX_PASSPHRASE] = ""; + unsigned i; + gcry_err_code_t gcry_err; +@@ -514,6 +529,19 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) + continue; + grub_printf_ (N_("Slot %d opened\n"), i); + ++ if (grub_le_to_cpu32 (header.version) >= 7) ++ { ++ /* GELI >=7 uses the cipher_key */ ++ grub_memcpy (geli_cipher_key, candidate_key.cipher_key, ++ sizeof (candidate_key.cipher_key)); ++ } ++ else ++ { ++ /* GELI <=6 uses the iv_key */ ++ grub_memcpy (geli_cipher_key, candidate_key.iv_key, ++ sizeof (candidate_key.iv_key)); ++ } ++ + /* Set the master key. */ + if (!dev->rekey) + { +@@ -530,13 +558,13 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev) + grub_size_t real_keysize = keysize; + if (grub_le_to_cpu16 (header.alg) == 0x16) + real_keysize *= 2; +- /* For a reason I don't know, the IV key is used in rekeying. */ +- grub_memcpy (dev->rekey_key, candidate_key.iv_key, +- sizeof (candidate_key.iv_key)); ++ ++ grub_memcpy (dev->rekey_key, geli_cipher_key, ++ sizeof (geli_cipher_key)); + dev->rekey_derived_size = real_keysize; + dev->last_rekey = -1; + COMPILE_TIME_ASSERT (sizeof (dev->rekey_key) +- >= sizeof (candidate_key.iv_key)); ++ >= sizeof (geli_cipher_key)); + } + + dev->iv_prefix_len = sizeof (candidate_key.iv_key); +diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c +index 1689539..f0aadd1 100644 +--- a/grub-core/disk/i386/pc/biosdisk.c ++++ b/grub-core/disk/i386/pc/biosdisk.c +@@ -382,7 +382,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) + /* Some buggy BIOSes doesn't return the total sectors + correctly but returns zero. So if it is zero, compute + it by C/H/S returned by the LBA BIOS call. */ +- total_sectors = drp->cylinders * drp->heads * drp->sectors; ++ total_sectors = ((grub_uint64_t) drp->cylinders) ++ * drp->heads * drp->sectors; + if (drp->bytes_per_sector + && !(drp->bytes_per_sector & (drp->bytes_per_sector - 1)) + && drp->bytes_per_sector >= 512 +@@ -419,8 +420,14 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) + } + } + ++ if (data->sectors == 0) ++ data->sectors = 63; ++ if (data->heads == 0) ++ data->heads = 255; ++ + if (! total_sectors) +- total_sectors = data->cylinders * data->heads * data->sectors; ++ total_sectors = ((grub_uint64_t) data->cylinders) ++ * data->heads * data->sectors; + } + + disk->total_sectors = total_sectors; +@@ -455,6 +462,14 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, + { + struct grub_biosdisk_data *data = disk->data; + ++ /* VirtualBox fails with sectors above 2T on CDs. ++ Since even BD-ROMS are never that big anyway, return error. */ ++ if ((data->flags & GRUB_BIOSDISK_FLAG_CDROM) ++ && (sector >> 32)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, ++ N_("attempt to read or write outside of disk `%s'"), ++ disk->name); ++ + if (data->flags & GRUB_BIOSDISK_FLAG_LBA) + { + struct grub_biosdisk_dap *dap; +diff --git a/grub-core/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c +index 576e9cc..feffa8c 100644 +--- a/grub-core/disk/ieee1275/nand.c ++++ b/grub-core/disk/ieee1275/nand.c +@@ -113,6 +113,11 @@ grub_nand_open (const char *name, grub_disk_t disk) + } + + data->block_size = (args.size1 >> GRUB_DISK_SECTOR_BITS); ++ if (!data->block_size) ++ { ++ grub_error (GRUB_ERR_UNKNOWN_DEVICE, "invalid block size"); ++ goto fail; ++ } + + INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3); + args.method = (grub_ieee1275_cell_t) "size"; +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 6870b39..331769b 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -34,7 +34,8 @@ struct ofdisk_hash_ent + char *open_path; + char *grub_devpath; + int is_boot; +- int is_cdrom; ++ int is_removable; ++ int block_size_fails; + /* Pointer to shortest available name on nodes representing canonical names, + otherwise NULL. */ + const char *shortest; +@@ -42,6 +43,10 @@ struct ofdisk_hash_ent + struct ofdisk_hash_ent *next; + }; + ++static grub_err_t ++grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, ++ struct ofdisk_hash_ent *op); ++ + #define OFDISK_HASH_SZ 8 + static struct ofdisk_hash_ent *ofdisk_hash[OFDISK_HASH_SZ]; + +@@ -123,7 +128,7 @@ ofdisk_hash_add_real (char *devpath) + } + + static int +-check_string_cdrom (const char *str) ++check_string_removable (const char *str) + { + const char *ptr = grub_strrchr (str, '/'); + +@@ -131,7 +136,7 @@ check_string_cdrom (const char *str) + ptr++; + else + ptr = str; +- return (grub_strncmp (ptr, "cdrom", 5) == 0); ++ return (grub_strncmp (ptr, "cdrom", 5) == 0 || grub_strncmp (ptr, "fd", 2) == 0); + } + + static struct ofdisk_hash_ent * +@@ -147,8 +152,8 @@ ofdisk_hash_add (char *devpath, char *curcan) + { + p->shortest = p->devpath; + p->grub_shortest = p->grub_devpath; +- if (check_string_cdrom (devpath)) +- p->is_cdrom = 1; ++ if (check_string_removable (devpath)) ++ p->is_removable = 1; + return p; + } + +@@ -158,8 +163,8 @@ ofdisk_hash_add (char *devpath, char *curcan) + else + grub_free (curcan); + +- if (check_string_cdrom (devpath) || check_string_cdrom (curcan)) +- pcan->is_cdrom = 1; ++ if (check_string_removable (devpath) || check_string_removable (curcan)) ++ pcan->is_removable = 1; + + if (!pcan) + grub_errno = GRUB_ERR_NONE; +@@ -330,7 +335,7 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, + } + } + +- if (!ent->is_boot && ent->is_cdrom) ++ if (!ent->is_boot && ent->is_removable) + continue; + + if (hook (ent->grub_shortest, hook_data)) +@@ -375,6 +380,8 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + /* XXX: This should be large enough for any possible case. */ + char prop[64]; + grub_ssize_t actual; ++ grub_uint32_t block_size = 0; ++ grub_err_t err; + + if (grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) != 0) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, +@@ -405,14 +412,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device"); + } + +- grub_uint32_t block_size = 0; +- if (grub_ofdisk_get_block_size (devpath, &block_size) == 0) +- { +- for (disk->log_sector_size = 0; +- (1U << disk->log_sector_size) < block_size; +- disk->log_sector_size++); +- } +- + /* XXX: There is no property to read the number of blocks. There + should be a property `#blocks', but it is not there. Perhaps it + is possible to use seek for this. */ +@@ -429,6 +428,18 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + return grub_errno; + disk->id = (unsigned long) op; + disk->data = op->open_path; ++ ++ err = grub_ofdisk_get_block_size (devpath, &block_size, op); ++ if (err) ++ return err; ++ if (block_size != 0) ++ { ++ for (disk->log_sector_size = 0; ++ (1U << disk->log_sector_size) < block_size; ++ disk->log_sector_size++); ++ } ++ else ++ disk->log_sector_size = 9; + } + + return 0; +@@ -589,8 +600,9 @@ grub_ofdisk_init (void) + grub_disk_dev_register (&grub_ofdisk_dev); + } + +-grub_err_t +-grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size) ++static grub_err_t ++grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, ++ struct ofdisk_hash_ent *op) + { + struct size_args_ieee1275 + { +@@ -612,20 +624,34 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size) + if (! last_ihandle) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); + ++ *block_size = 0; ++ ++ if (op->block_size_fails >= 2) ++ return GRUB_ERR_NONE; ++ + INIT_IEEE1275_COMMON (&args_ieee1275.common, "call-method", 2, 2); + args_ieee1275.method = (grub_ieee1275_cell_t) "block-size"; + args_ieee1275.ihandle = last_ihandle; + args_ieee1275.result = 1; + +- *block_size = GRUB_DISK_SECTOR_SIZE; +- +- if ((IEEE1275_CALL_ENTRY_FN (&args_ieee1275) == -1) || (args_ieee1275.result)) +- grub_dprintf ("disk", "can't get block size\n"); +- else +- if (args_ieee1275.size1 +- && !(args_ieee1275.size1 & (args_ieee1275.size1 - 1)) +- && args_ieee1275.size1 >= 512 && args_ieee1275.size1 <= 16384) ++ if (IEEE1275_CALL_ENTRY_FN (&args_ieee1275) == -1) ++ { ++ grub_dprintf ("disk", "can't get block size: failed call-method\n"); ++ op->block_size_fails++; ++ } ++ else if (args_ieee1275.result) ++ { ++ grub_dprintf ("disk", "can't get block size: %lld\n", ++ (long long) args_ieee1275.result); ++ op->block_size_fails++; ++ } ++ else if (args_ieee1275.size1 ++ && !(args_ieee1275.size1 & (args_ieee1275.size1 - 1)) ++ && args_ieee1275.size1 >= 512 && args_ieee1275.size1 <= 16384) ++ { ++ op->block_size_fails = 0; + *block_size = args_ieee1275.size1; ++ } + + return 0; + } +diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c +index 2502029..86c50c6 100644 +--- a/grub-core/disk/luks.c ++++ b/grub-core/disk/luks.c +@@ -143,6 +143,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d", + grub_be_to_cpu32 (header.keyBytes)); ++ grub_crypto_cipher_close (cipher); + return NULL; + } + +@@ -181,9 +182,10 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + } + if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) + { +- grub_crypto_cipher_close (cipher); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", + cipher->cipher->blocksize); ++ grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); + return NULL; + } + if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) +@@ -191,6 +193,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + grub_crypto_cipher_close (cipher); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", + secondary_cipher->cipher->blocksize); ++ grub_crypto_cipher_close (secondary_cipher); + return NULL; + } + } +@@ -200,9 +203,9 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + cipheriv = ciphermode + sizeof ("lrw-") - 1; + if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) + { +- grub_crypto_cipher_close (cipher); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d", + cipher->cipher->blocksize); ++ grub_crypto_cipher_close (cipher); + return NULL; + } + } +@@ -225,6 +228,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + || cipher->cipher->blocksize == 0) + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported benbi blocksize: %d", + cipher->cipher->blocksize); ++ /* FIXME should we return an error here? */ + for (benbi_log = 0; + (cipher->cipher->blocksize << benbi_log) < GRUB_DISK_SECTOR_SIZE; + benbi_log++); +@@ -243,6 +247,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + if (!essiv_hash) + { + grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); + grub_error (GRUB_ERR_FILE_NOT_FOUND, + "Couldn't load %s hash", hash_str); + return NULL; +@@ -251,12 +256,14 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + if (!essiv_cipher) + { + grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); + return NULL; + } + } + else + { + grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (secondary_cipher); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown IV mode: %s", + cipheriv); + return NULL; +@@ -276,7 +283,12 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, + + newdev = grub_zalloc (sizeof (struct grub_cryptodisk)); + if (!newdev) +- return NULL; ++ { ++ grub_crypto_cipher_close (cipher); ++ grub_crypto_cipher_close (essiv_cipher); ++ grub_crypto_cipher_close (secondary_cipher); ++ return NULL; ++ } + newdev->cipher = cipher; + newdev->offset = grub_be_to_cpu32 (header.payloadOffset); + newdev->source_disk = NULL; +@@ -451,6 +463,7 @@ luks_recover_key (grub_disk_t source, + return GRUB_ERR_NONE; + } + ++ grub_free (split_key); + return GRUB_ACCESS_DENIED; + } + +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index 483c17e..7b265c7 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -160,7 +160,7 @@ grub_lvm_detect (grub_disk_t disk, + "we don't support multiple LVM data areas"); + + #ifdef GRUB_UTIL +- grub_util_info ("we don't support multiple LVM data areas\n"); ++ grub_util_info ("we don't support multiple LVM data areas"); + #endif + goto fail; + } +@@ -189,7 +189,7 @@ grub_lvm_detect (grub_disk_t disk, + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "unknown LVM metadata header"); + #ifdef GRUB_UTIL +- grub_util_info ("unknown LVM metadata header\n"); ++ grub_util_info ("unknown LVM metadata header"); + #endif + goto fail2; + } +@@ -213,7 +213,7 @@ grub_lvm_detect (grub_disk_t disk, + if (q == metadatabuf + mda_size) + { + #ifdef GRUB_UTIL +- grub_util_info ("error parsing metadata\n"); ++ grub_util_info ("error parsing metadata"); + #endif + goto fail2; + } +@@ -230,7 +230,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("couldn't find ID\n"); ++ grub_util_info ("couldn't find ID"); + #endif + goto fail3; + } +@@ -258,7 +258,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown extent size\n"); ++ grub_util_info ("unknown extent size"); + #endif + goto fail4; + } +@@ -306,7 +306,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown pe_start\n"); ++ grub_util_info ("unknown pe_start"); + #endif + goto pvs_fail; + } +@@ -315,7 +315,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("error parsing pe_start\n"); ++ grub_util_info ("error parsing pe_start"); + #endif + goto pvs_fail; + } +@@ -333,10 +333,10 @@ grub_lvm_detect (grub_disk_t disk, + } + } + +- p = grub_strstr (p, "logical_volumes"); ++ p = grub_strstr (p, "logical_volumes {"); + if (p) + { +- p += sizeof ("logical_volumes = ") - 1; ++ p += sizeof ("logical_volumes {") - 1; + + /* And add all the lvs to the volume group. */ + while (1) +@@ -402,7 +402,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("couldn't find ID\n"); ++ grub_util_info ("couldn't find ID"); + #endif + goto lvs_fail; + } +@@ -422,11 +422,11 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown segment_count\n"); ++ grub_util_info ("unknown segment_count"); + #endif + goto lvs_fail; + } +- lv->segments = grub_malloc (sizeof (*seg) * lv->segment_count); ++ lv->segments = grub_zalloc (sizeof (*seg) * lv->segment_count); + seg = lv->segments; + + for (i = 0; i < lv->segment_count; i++) +@@ -436,7 +436,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown segment\n"); ++ grub_util_info ("unknown segment"); + #endif + goto lvs_segment_fail; + } +@@ -445,7 +445,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown start_extent\n"); ++ grub_util_info ("unknown start_extent"); + #endif + goto lvs_segment_fail; + } +@@ -453,7 +453,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown extent_count\n"); ++ grub_util_info ("unknown extent_count"); + #endif + goto lvs_segment_fail; + } +@@ -475,7 +475,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown stripe_count\n"); ++ grub_util_info ("unknown stripe_count"); + #endif + goto lvs_segment_fail; + } +@@ -491,7 +491,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown stripes\n"); ++ grub_util_info ("unknown stripes"); + #endif + goto lvs_segment_fail2; + } +@@ -533,7 +533,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown mirror_count\n"); ++ grub_util_info ("unknown mirror_count"); + #endif + goto lvs_segment_fail; + } +@@ -545,7 +545,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown mirrors\n"); ++ grub_util_info ("unknown mirrors"); + #endif + goto lvs_segment_fail2; + } +@@ -577,13 +577,17 @@ grub_lvm_detect (grub_disk_t disk, + if (is_pvmove) + seg->node_count = 1; + } +- else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) +- == 0 && (p[sizeof ("raid") - 1] >= '4' +- && p[sizeof ("raid") - 1] <= '6') ++ else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) == 0 ++ && ((p[sizeof ("raid") - 1] >= '4' ++ && p[sizeof ("raid") - 1] <= '6') ++ || p[sizeof ("raid") - 1] == '1') + && p[sizeof ("raidX") - 1] == '"') + { + switch (p[sizeof ("raid") - 1]) + { ++ case '1': ++ seg->type = GRUB_DISKFILTER_MIRROR; ++ break; + case '4': + seg->type = GRUB_DISKFILTER_RAID4; + seg->layout = GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC; +@@ -603,21 +607,23 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown device_count\n"); ++ grub_util_info ("unknown device_count"); + #endif + goto lvs_segment_fail; + } + +- seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); +- if (p == NULL) ++ if (seg->type != GRUB_DISKFILTER_MIRROR) + { ++ seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); ++ if (p == NULL) ++ { + #ifdef GRUB_UTIL +- grub_util_info ("unknown stripe_size\n"); ++ grub_util_info ("unknown stripe_size"); + #endif +- goto lvs_segment_fail; ++ goto lvs_segment_fail; ++ } + } + +- + seg->nodes = grub_zalloc (sizeof (seg->nodes[0]) + * seg->node_count); + +@@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk, + if (p == NULL) + { + #ifdef GRUB_UTIL +- grub_util_info ("unknown mirrors\n"); ++ grub_util_info ("unknown raids"); + #endif + goto lvs_segment_fail2; + } +@@ -672,7 +678,7 @@ grub_lvm_detect (grub_disk_t disk, + p2 = grub_strchr (p, '"'); + if (p2) + *p2 = 0; +- grub_util_info ("unknown LVM type %s\n", p); ++ grub_util_info ("unknown LVM type %s", p); + if (p2) + *p2 ='"'; + #endif +diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c +index 4aa5882..11024ae 100644 +--- a/grub-core/disk/mdraid_linux.c ++++ b/grub-core/disk/mdraid_linux.c +@@ -33,16 +33,16 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define grub_md_to_cpu64 grub_be_to_cpu64 + #define grub_md_to_cpu32 grub_be_to_cpu32 + #define grub_md_to_cpu16 grub_be_to_cpu16 +-#define grub_cpu_to_md64_compile_time grub_cpu_to_be64 +-#define grub_cpu_to_md32_compile_time grub_cpu_to_be32 +-#define grub_cpu_to_md16_compile_time grub_cpu_to_be16 ++#define grub_cpu_to_md64_compile_time grub_cpu_to_be64_compile_time ++#define grub_cpu_to_md32_compile_time grub_cpu_to_be32_compile_time ++#define grub_cpu_to_md16_compile_time grub_cpu_to_be16_compile_time + #else + #define grub_md_to_cpu64 grub_le_to_cpu64 + #define grub_md_to_cpu32 grub_le_to_cpu32 + #define grub_md_to_cpu16 grub_le_to_cpu16 +-#define grub_cpu_to_md64_compile_time grub_cpu_to_le64 +-#define grub_cpu_to_md32_compile_time grub_cpu_to_le32 +-#define grub_cpu_to_md16_compile_time grub_cpu_to_le16 ++#define grub_cpu_to_md64_compile_time grub_cpu_to_le64_compile_time ++#define grub_cpu_to_md32_compile_time grub_cpu_to_le32_compile_time ++#define grub_cpu_to_md16_compile_time grub_cpu_to_le16_compile_time + #endif + + #define RESERVED_BYTES (64 * 1024) +diff --git a/grub-core/disk/raid6_recover.c b/grub-core/disk/raid6_recover.c +index f9ec632..aa674f6 100644 +--- a/grub-core/disk/raid6_recover.c ++++ b/grub-core/disk/raid6_recover.c +@@ -63,6 +63,16 @@ grub_raid6_init_table (void) + } + } + ++static unsigned ++mod_255 (unsigned x) ++{ ++ while (x > 0xff) ++ x = (x >> 8) + (x & 0xff); ++ if (x == 0xff) ++ return 0; ++ return x; ++} ++ + static grub_err_t + grub_raid6_recover (struct grub_diskfilter_segment *array, int disknr, int p, + char *buf, grub_disk_addr_t sector, grub_size_t size) +@@ -162,11 +172,11 @@ grub_raid6_recover (struct grub_diskfilter_segment *array, int disknr, int p, + + grub_crypto_xor (qbuf, qbuf, buf, size); + +- c = ((255 ^ bad1) +- + (255 ^ powx_inv[(powx[bad2 + (bad1 ^ 255)] ^ 1)])) % 255; ++ c = mod_255((255 ^ bad1) ++ + (255 ^ powx_inv[(powx[bad2 + (bad1 ^ 255)] ^ 1)])); + grub_raid_block_mulx (c, qbuf, size); + +- c = ((unsigned) bad2 + c) % 255; ++ c = mod_255((unsigned) bad2 + c); + grub_raid_block_mulx (c, pbuf, size); + + grub_crypto_xor (pbuf, pbuf, qbuf, size); +diff --git a/grub-core/disk/scsi.c b/grub-core/disk/scsi.c +index b6cb2f4..4c6923f 100644 +--- a/grub-core/disk/scsi.c ++++ b/grub-core/disk/scsi.c +@@ -201,7 +201,7 @@ grub_scsi_read_capacity16 (grub_scsi_t scsi) + rc.opcode = grub_scsi_cmd_read_capacity16; + rc.lun = (scsi->lun << GRUB_SCSI_LUN_SHIFT) | 0x10; + rc.logical_block_addr = 0; +- rc.alloc_len = grub_cpu_to_be32 (sizeof (rcd)); ++ rc.alloc_len = grub_cpu_to_be32_compile_time (sizeof (rcd)); + rc.PMI = 0; + rc.control = 0; + +@@ -615,9 +615,10 @@ grub_scsi_open (const char *name, grub_disk_t disk) + + if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize) + { ++ grub_error (GRUB_ERR_IO, "invalid sector size %d", ++ scsi->blocksize); + grub_free (scsi); +- return grub_error (GRUB_ERR_IO, "invalid sector size %d", +- scsi->blocksize); ++ return grub_errno; + } + for (disk->log_sector_size = 0; + (1U << disk->log_sector_size) < scsi->blocksize; +diff --git a/grub-core/disk/usbms.c b/grub-core/disk/usbms.c +index 2b769bd..380ca4c 100644 +--- a/grub-core/disk/usbms.c ++++ b/grub-core/disk/usbms.c +@@ -307,7 +307,7 @@ grub_usbms_transfer_bo (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd, + + /* Setup the request. */ + grub_memset (&cbw, 0, sizeof (cbw)); +- cbw.signature = grub_cpu_to_le32 (0x43425355); ++ cbw.signature = grub_cpu_to_le32_compile_time (0x43425355); + cbw.tag = tag; + cbw.transfer_length = grub_cpu_to_le32 (size); + cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT; +@@ -414,7 +414,7 @@ CheckCSW: + + /* If phase error or not valid signature, do bulk-only reset device. */ + if ((status.status == 2) || +- (status.signature != grub_cpu_to_le32(0x53425355))) ++ (status.signature != grub_cpu_to_le32_compile_time(0x53425355))) + { /* Bulk-only reset device. */ + grub_dprintf ("usb", "Bulk-only reset device - bad status\n"); + grub_usbms_reset (dev); +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/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/font/font.c b/grub-core/font/font.c +index 14b93e1..53d76a6 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -777,6 +777,7 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + if (grub_file_read (font->file, glyph->bitmap, len) != len) + { + remove_font (font); ++ grub_free (glyph); + return 0; + } + } +@@ -1285,7 +1286,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + - grub_font_get_xheight (combining_glyphs[i]->font) - 1; + if (space <= 0) + space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; +- ++ /* Fallthrough. */ + case GRUB_UNICODE_STACK_ATTACHED_ABOVE: + do_blit (combining_glyphs[i], targetx, + -(ctx.bounds.height + ctx.bounds.y + space +@@ -1326,6 +1327,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + + combining_glyphs[i]->height); + if (space <= 0) + space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; ++ /* Fallthrough. */ + + case GRUB_UNICODE_STACK_ATTACHED_BELOW: + do_blit (combining_glyphs[i], targetx, -(ctx.bounds.y - space), +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 89666b6..9cffa91 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -680,6 +680,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + grub_uint64_t stripen; + grub_uint64_t stripe_offset; + grub_uint64_t off = addr - grub_le_to_cpu64 (key->offset); ++ grub_uint64_t chunk_stripe_length; ++ grub_uint16_t nstripes; + unsigned redundancy = 1; + unsigned i, j; + +@@ -690,15 +692,17 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + "couldn't find the chunk descriptor"); + } + ++ nstripes = grub_le_to_cpu16 (chunk->nstripes) ? : 1; ++ chunk_stripe_length = grub_le_to_cpu64 (chunk->stripe_length) ? : 512; + grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T + "+0x%" PRIxGRUB_UINT64_T + " (%d stripes (%d substripes) of %" + PRIxGRUB_UINT64_T ")\n", + grub_le_to_cpu64 (key->offset), + grub_le_to_cpu64 (chunk->size), +- grub_le_to_cpu16 (chunk->nstripes), ++ nstripes, + grub_le_to_cpu16 (chunk->nsubstripes), +- grub_le_to_cpu64 (chunk->stripe_length)); ++ chunk_stripe_length); + + switch (grub_le_to_cpu64 (chunk->type) + & ~GRUB_BTRFS_CHUNK_TYPE_BITS_DONTCARE) +@@ -708,8 +712,10 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + grub_uint64_t stripe_length; + grub_dprintf ("btrfs", "single\n"); + stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size), +- grub_le_to_cpu16 (chunk->nstripes), ++ nstripes, + NULL); ++ if (stripe_length == 0) ++ stripe_length = 512; + stripen = grub_divmod64 (off, stripe_length, &stripe_offset); + csize = (stripen + 1) * stripe_length - off; + break; +@@ -730,33 +736,34 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + grub_uint64_t low; + grub_dprintf ("btrfs", "RAID0\n"); + middle = grub_divmod64 (off, +- grub_le_to_cpu64 (chunk->stripe_length), ++ chunk_stripe_length, + &low); + +- high = grub_divmod64 (middle, grub_le_to_cpu16 (chunk->nstripes), ++ high = grub_divmod64 (middle, nstripes, + &stripen); + stripe_offset = +- low + grub_le_to_cpu64 (chunk->stripe_length) * high; +- csize = grub_le_to_cpu64 (chunk->stripe_length) - low; ++ low + chunk_stripe_length * high; ++ csize = chunk_stripe_length - low; + break; + } + case GRUB_BTRFS_CHUNK_TYPE_RAID10: + { + grub_uint64_t middle, high; + grub_uint64_t low; ++ grub_uint16_t nsubstripes; ++ nsubstripes = grub_le_to_cpu16 (chunk->nsubstripes) ? : 1; + middle = grub_divmod64 (off, +- grub_le_to_cpu64 (chunk->stripe_length), ++ chunk_stripe_length, + &low); + + high = grub_divmod64 (middle, +- grub_le_to_cpu16 (chunk->nstripes) +- / grub_le_to_cpu16 (chunk->nsubstripes), ++ nstripes / nsubstripes ? : 1, + &stripen); +- stripen *= grub_le_to_cpu16 (chunk->nsubstripes); +- redundancy = grub_le_to_cpu16 (chunk->nsubstripes); +- stripe_offset = low + grub_le_to_cpu64 (chunk->stripe_length) ++ stripen *= nsubstripes; ++ redundancy = nsubstripes; ++ stripe_offset = low + chunk_stripe_length + * high; +- csize = grub_le_to_cpu64 (chunk->stripe_length) - low; ++ csize = chunk_stripe_length - low; + break; + } + default: +@@ -1051,7 +1058,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data, + + 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); +@@ -1201,7 +1208,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, +diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c +index 7ad1483..a34eb88 100644 +--- a/grub-core/fs/cbfs.c ++++ b/grub-core/fs/cbfs.c +@@ -74,8 +74,7 @@ grub_cbfs_find_file (struct grub_archelp_data *data, char **name, + (void) mtime; + offset = grub_be_to_cpu32 (hd.offset); + +- if (mode) +- *mode = GRUB_ARCHELP_ATTR_FILE | GRUB_ARCHELP_ATTR_NOTIME; ++ *mode = GRUB_ARCHELP_ATTR_FILE | GRUB_ARCHELP_ATTR_NOTIME; + + namesize = offset; + if (namesize >= sizeof (hd)) +@@ -144,11 +143,14 @@ static struct grub_archelp_data * + grub_cbfs_mount (grub_disk_t disk) + { + struct cbfs_file hd; +- struct grub_archelp_data *data; ++ struct grub_archelp_data *data = NULL; + grub_uint32_t ptr; + grub_off_t header_off; + struct cbfs_header head; + ++ if (grub_disk_get_size (disk) == GRUB_DISK_SIZE_UNKNOWN) ++ goto fail; ++ + if (grub_disk_read (disk, grub_disk_get_size (disk) - 1, + GRUB_DISK_SECTOR_SIZE - sizeof (ptr), + sizeof (ptr), &ptr)) +@@ -193,6 +195,7 @@ grub_cbfs_mount (grub_disk_t disk) + return data; + + fail: ++ grub_free (data); + grub_error (GRUB_ERR_BAD_FS, "not a cbfs filesystem"); + return 0; + } +diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c +index b0ae9f4..50fea47 100644 +--- a/grub-core/fs/cpio_common.c ++++ b/grub-core/fs/cpio_common.c +@@ -61,8 +61,15 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); + namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); + +- if (mode) +- *mode = modeval; ++ /* Don't allow negative numbers. */ ++ if (namesize >= 0x80000000) ++ { ++ /* Probably a corruption, don't attempt to recover. */ ++ *mode = GRUB_ARCHELP_ATTR_END; ++ return GRUB_ERR_NONE; ++ } ++ ++ *mode = modeval; + + *name = grub_malloc (namesize + 1); + if (*name == NULL) +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index 5f7a2b9..cdce63b 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -100,6 +100,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 + #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* Extents used */ + #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 ++#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 + #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 + + /* The set of back-incompatible features this driver DOES support. Add (OR) +@@ -107,6 +108,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT2_DRIVER_SUPPORTED_INCOMPAT ( EXT2_FEATURE_INCOMPAT_FILETYPE \ + | EXT4_FEATURE_INCOMPAT_EXTENTS \ + | EXT4_FEATURE_INCOMPAT_FLEX_BG \ ++ | EXT2_FEATURE_INCOMPAT_META_BG \ + | EXT4_FEATURE_INCOMPAT_64BIT) + /* List of rationales for the ignored "incompatible" features: + * needs_recovery: Not really back-incompatible - was added as such to forbid +@@ -114,8 +116,13 @@ GRUB_MOD_LICENSE ("GPLv3+"); + * journal because they will ignore the journal, but the next + * ext3 driver to mount the volume will find the journal and + * replay it, potentially corrupting the metadata written by +- * the ext2 drivers. Safe to ignore for this RO driver. */ +-#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER ) ++ * the ext2 drivers. Safe to ignore for this RO driver. ++ * mmp: Not really back-incompatible - was added as such to ++ * avoid multiple read-write mounts. Safe to ignore for this ++ * RO driver. ++ */ ++#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ ++ | EXT4_FEATURE_INCOMPAT_MMP) + + + #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U +@@ -331,16 +338,68 @@ static grub_dl_t my_mod; + + + ++/* Check is a = b^x for some x. */ ++static inline int ++is_power_of (grub_uint64_t a, grub_uint32_t b) ++{ ++ grub_uint64_t c; ++ /* Prevent overflow assuming b < 8. */ ++ if (a >= (1LL << 60)) ++ return 0; ++ for (c = 1; c <= a; c *= b); ++ return (c == a); ++} ++ ++ ++static inline int ++group_has_super_block (struct grub_ext2_data *data, grub_uint64_t group) ++{ ++ if (!(data->sblock.feature_ro_compat ++ & grub_cpu_to_le32_compile_time(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))) ++ return 1; ++ /* Algorithm looked up in Linux source. */ ++ if (group <= 1) ++ return 1; ++ /* Even number is never a power of odd number. */ ++ if (!(group & 1)) ++ return 0; ++ return (is_power_of(group, 7) || is_power_of(group, 5) || ++ is_power_of(group, 3)); ++} ++ + /* Read into BLKGRP the blockgroup descriptor of blockgroup GROUP of + the mounted filesystem DATA. */ + inline static grub_err_t +-grub_ext2_blockgroup (struct grub_ext2_data *data, int group, ++grub_ext2_blockgroup (struct grub_ext2_data *data, grub_uint64_t group, + struct grub_ext2_block_group *blkgrp) + { ++ grub_uint64_t full_offset = (group << data->log_group_desc_size); ++ grub_uint64_t block, offset; ++ block = (full_offset >> LOG2_BLOCK_SIZE (data)); ++ offset = (full_offset & ((1 << LOG2_BLOCK_SIZE (data)) - 1)); ++ if ((data->sblock.feature_incompat ++ & grub_cpu_to_le32_compile_time (EXT2_FEATURE_INCOMPAT_META_BG)) ++ && block >= grub_le_to_cpu32(data->sblock.first_meta_bg)) ++ { ++ grub_uint64_t first_block_group; ++ /* Find the first block group for which a descriptor ++ is stored in given block. */ ++ first_block_group = (block << (LOG2_BLOCK_SIZE (data) ++ - data->log_group_desc_size)); ++ ++ block = (first_block_group ++ * grub_le_to_cpu32(data->sblock.blocks_per_group)); ++ ++ if (group_has_super_block (data, first_block_group)) ++ block++; ++ } ++ else ++ /* Superblock. */ ++ block++; + return grub_disk_read (data->disk, +- ((grub_le_to_cpu32 (data->sblock.first_data_block) + 1) +- << LOG2_EXT2_BLOCK_SIZE (data)), +- group << data->log_group_desc_size, ++ ((grub_le_to_cpu32 (data->sblock.first_data_block) ++ + block) ++ << LOG2_EXT2_BLOCK_SIZE (data)), offset, + sizeof (struct grub_ext2_block_group), blkgrp); + } + +@@ -479,11 +538,16 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + shift = 2; + goto indirect; + } +- return grub_error (GRUB_ERR_BAD_FS, +- "ext2fs doesn't support quadruple indirect blocks"); ++ grub_error (GRUB_ERR_BAD_FS, ++ "ext2fs doesn't support quadruple indirect blocks"); ++ return -1; + + indirect: + do { ++ /* If the indirect block is zero, all child blocks are absent ++ (i.e. filled with zeros.) */ ++ if (indir == 0) ++ return 0; + if (grub_disk_read (data->disk, + ((grub_disk_addr_t) grub_le_to_cpu32 (indir)) + << log2_blksz, +@@ -491,7 +555,7 @@ indirect: + & ((1 << log_perblock) - 1)) + * sizeof (indir), + sizeof (indir), &indir)) +- return grub_errno; ++ return -1; + } while (shift--); + + return grub_le_to_cpu32 (indir); +@@ -573,7 +637,12 @@ grub_ext2_mount (grub_disk_t disk) + + /* Make sure this is an ext2 filesystem. */ + if (data->sblock.magic != grub_cpu_to_le16_compile_time (EXT2_MAGIC) +- || grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16) ++ || grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16 ++ || data->sblock.inodes_per_group == 0 ++ /* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */ ++ || grub_le_to_cpu32 (data->sblock.log2_block_size) > 20 ++ || EXT2_INODE_SIZE (data) == 0 ++ || EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data) == 0) + { + grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem"); + goto fail; +diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c +index 79fe864..827708c 100644 +--- a/grub-core/fs/fat.c ++++ b/grub-core/fs/fat.c +@@ -829,7 +829,9 @@ grub_fat_iterate_dir_next (grub_disk_t disk, struct grub_fat_data *data, + i--; + } + +- *filep++ = '.'; ++ /* XXX should we check that dir position is 0 or 1? */ ++ if (i > 2 || filep[0] != '.' || (i == 2 && filep[1] != '.')) ++ *filep++ = '.'; + + for (i = 8; i < 11 && ctxt->dir.name[i]; i++) + *filep++ = grub_tolower (ctxt->dir.name[i]); +@@ -871,9 +873,31 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, + return 0; + } + +- /* Extract a directory name. */ +- while (*path == '/') +- path++; ++ do ++ { ++ /* Extract a directory name. */ ++ while (*path == '/') ++ path++; ++ ++ /* Emulate special "." and ".." entries in root directory */ ++ if (data->file_cluster == data->root_cluster) ++ { ++ if (*path != '.') ++ break; ++ if (!path[1] || path[1] == '/') ++ { ++ path++; ++ continue; ++ } ++ if (path[1] == '.' && (!path[2] || path[2] == '/')) ++ { ++ path += 2; ++ continue; ++ } ++ } ++ break; ++ } ++ while (1); + + dirp = grub_strchr (path, '/'); + if (dirp) +@@ -935,6 +959,9 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, + data->file_size = grub_le_to_cpu32 (ctxt.dir.file_size); + data->file_cluster = ((grub_le_to_cpu16 (ctxt.dir.first_cluster_high) << 16) + | grub_le_to_cpu16 (ctxt.dir.first_cluster_low)); ++ /* If directory points to root, starting cluster is 0 */ ++ if (!data->file_cluster) ++ data->file_cluster = data->root_cluster; + #endif + data->cur_cluster_num = ~0U; + +@@ -1136,7 +1163,7 @@ grub_fat_label (grub_device_t device, char **label) + if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) + { + grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); +- return 0; ++ goto fail; + } + + err = grub_fat_iterate_init (&ctxt); +diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c +index 42bd542..b899bed 100644 +--- a/grub-core/fs/fshelp.c ++++ b/grub-core/fs/fshelp.c +@@ -252,6 +252,13 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node, + grub_disk_addr_t i, blockcnt; + int blocksize = 1 << (log2blocksize + GRUB_DISK_SECTOR_BITS); + ++ if (pos > filesize) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ N_("attempt to read past the end of file")); ++ return -1; ++ } ++ + /* Adjust LEN so it we can't read past the end of the file. */ + if (pos + len > filesize) + len = filesize - pos; +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index 1e59305..06cf0c7 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -330,6 +330,7 @@ grub_hfs_mount (grub_disk_t disk) + + /* Check if this is a HFS filesystem. */ + if (grub_be_to_cpu16 (data->sblock.magic) != GRUB_HFS_MAGIC ++ || data->sblock.blksz == 0 + || (data->sblock.blksz & grub_cpu_to_be32_compile_time (0xc00001ff))) + { + grub_error (GRUB_ERR_BAD_FS, "not an HFS filesystem"); +@@ -367,9 +368,14 @@ grub_hfs_mount (grub_disk_t disk) + data->cat_root = grub_be_to_cpu32 (treehead.head.root_node); + data->cat_size = grub_be_to_cpu16 (treehead.head.node_size); + ++ if (data->cat_size == 0 ++ || data->blksz < data->cat_size ++ || data->blksz < data->ext_size) ++ goto fail; ++ + /* Lookup the root directory node in the catalog tree using the + volume name. */ +- key.parent_dir = grub_cpu_to_be32 (1); ++ key.parent_dir = grub_cpu_to_be32_compile_time (1); + key.strlen = data->sblock.volname[0]; + grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); + +@@ -686,6 +692,7 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, + int i; + struct grub_hfs_extent *dat; + int blk; ++ grub_uint16_t reccnt; + + dat = (struct grub_hfs_extent *) (type == 0 + ? (&data->sblock.catalog_recs) +@@ -704,8 +711,12 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, + return grub_errno; + } + ++ reccnt = grub_be_to_cpu16 (node->node.reccnt); ++ if (reccnt > (nodesize >> 1)) ++ reccnt = (nodesize >> 1); ++ + /* Iterate over all records in this node. */ +- for (i = 0; i < grub_be_to_cpu16 (node->node.reccnt); i++) ++ for (i = 0; i < reccnt; i++) + { + int pos = (nodesize >> 1) - 1 - i; + struct pointer +@@ -713,16 +724,19 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, + grub_uint8_t keylen; + grub_uint8_t key; + } GRUB_PACKED *pnt; +- pnt = (struct pointer *) (grub_be_to_cpu16 (node->offsets[pos]) +- + node->rawnode); ++ grub_uint16_t off = grub_be_to_cpu16 (node->offsets[pos]); ++ if (off > nodesize - sizeof(*pnt)) ++ continue; ++ pnt = (struct pointer *) (off + node->rawnode); ++ if (nodesize < (grub_size_t) off + pnt->keylen + 1) ++ continue; + + struct grub_hfs_record rec = + { + &pnt->key, + pnt->keylen, + &pnt->key + pnt->keylen +(pnt->keylen + 1) % 2, +- nodesize - grub_be_to_cpu16 (node->offsets[pos]) +- - pnt->keylen - 1 ++ nodesize - off - pnt->keylen - 1 + }; + + if (node_hook (&node->node, &rec, hook_arg)) +@@ -1300,6 +1314,12 @@ grub_hfs_open (struct grub_file *file, const char *name) + + data = grub_hfs_mount (file->device->disk); + ++ if (!data) ++ { ++ grub_dl_unref (my_mod); ++ return grub_errno; ++ } ++ + if (grub_hfs_find_dir (data, name, &frec, 0)) + { + grub_free (data); +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index 950d8a1..21159e8 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -336,6 +336,9 @@ grub_hfsplus_mount (grub_disk_t disk) + data->case_sensitive = ((magic == GRUB_HFSPLUSX_MAGIC) && + (header.key_compare == GRUB_HFSPLUSX_BINARYCOMPARE)); + ++ if (data->catalog_tree.nodesize < 2) ++ goto fail; ++ + if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0, + sizeof (struct grub_hfsplus_btnode), + sizeof (header), (char *) &header) <= 0) +@@ -350,6 +353,9 @@ grub_hfsplus_mount (grub_disk_t disk) + data->extoverflow_tree.root = grub_be_to_cpu32 (header.root); + data->extoverflow_tree.nodesize = grub_be_to_cpu16 (header.nodesize); + ++ if (data->extoverflow_tree.nodesize < 2) ++ goto fail; ++ + if (grub_hfsplus_read_file (&data->attr_tree.file, 0, 0, + sizeof (struct grub_hfsplus_btnode), + sizeof (header), (char *) &header) <= 0) +@@ -723,7 +729,10 @@ list_nodes (void *record, void *hook_arg) + + /* If the name is obviously invalid, skip this node. */ + if (catkey->name[i] == 0) +- return 0; ++ { ++ grub_free (filename); ++ return 0; ++ } + } + + *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, +@@ -745,7 +754,10 @@ list_nodes (void *record, void *hook_arg) + callback function. */ + node = grub_malloc (sizeof (*node)); + if (!node) +- return 1; ++ { ++ grub_free (filename); ++ return 1; ++ } + node->data = ctx->dir->data; + node->compressed = 0; + node->cbuf = 0; +@@ -780,8 +792,8 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, + }; + + struct grub_hfsplus_key_internal intern; +- struct grub_hfsplus_btnode *node; +- grub_disk_addr_t ptr; ++ struct grub_hfsplus_btnode *node = NULL; ++ grub_disk_addr_t ptr = 0; + + { + struct grub_fshelp_node *fsnode; +@@ -964,8 +976,8 @@ grub_hfsplus_label (grub_device_t device, char **label) + struct grub_hfsplus_catkey *catkey; + int i, label_len; + struct grub_hfsplus_key_internal intern; +- struct grub_hfsplus_btnode *node; +- grub_disk_addr_t ptr; ++ struct grub_hfsplus_btnode *node = NULL; ++ grub_disk_addr_t ptr = 0; + + *label = 0; + +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 6a66773..67a67cf 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -959,14 +959,15 @@ grub_iso9660_read (grub_file_t file, char *buf, grub_size_t len) + { + struct grub_iso9660_data *data = + (struct grub_iso9660_data *) file->data; ++ grub_err_t err; + + /* XXX: The file is stored in as a single extent. */ + data->disk->read_hook = file->read_hook; + data->disk->read_hook_data = file->read_hook_data; +- read_node (data->node, file->offset, len, buf); ++ err = read_node (data->node, file->offset, len, buf); + data->disk->read_hook = NULL; + +- if (grub_errno) ++ if (err || grub_errno) + return -1; + + return len; +diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c +index 98e1b71..d451b34 100644 +--- a/grub-core/fs/minix.c ++++ b/grub-core/fs/minix.c +@@ -65,7 +65,6 @@ typedef grub_uint16_t grub_minix_uintn_t; + #define grub_minix_to_cpu_n grub_minix_to_cpu16 + #endif + +-#define GRUB_MINIX_INODE_BLKSZ(data) sizeof (grub_minix_uintn_t) + #ifdef MODE_MINIX3 + typedef grub_uint32_t grub_minix_ino_t; + #define grub_minix_to_cpu_ino grub_minix_to_cpu32 +@@ -83,19 +82,6 @@ typedef grub_uint16_t grub_minix_ino_t; + #define GRUB_MINIX_INODE_DINDIR_ZONE(data) (grub_minix_to_cpu_n \ + (data->inode.double_indir_zone)) + +-#ifndef MODE_MINIX3 +-#define GRUB_MINIX_LOG2_ZONESZ (GRUB_MINIX_LOG2_BSIZE \ +- + grub_minix_to_cpu16 (data->sblock.log2_zone_size)) +-#endif +-#define GRUB_MINIX_ZONESZ ((grub_uint64_t) data->block_size << \ +- (GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size))) +- +-#ifdef MODE_MINIX3 +-#define GRUB_MINIX_ZONE2SECT(zone) ((zone) * data->block_size) +-#else +-#define GRUB_MINIX_ZONE2SECT(zone) ((zone) << GRUB_MINIX_LOG2_ZONESZ) +-#endif +- + + #ifdef MODE_MINIX3 + struct grub_minix_sblock +@@ -172,6 +158,7 @@ struct grub_minix_data + { + struct grub_minix_sblock sblock; + struct grub_minix_inode inode; ++ grub_uint32_t block_per_zone; + grub_minix_ino_t ino; + int linknest; + grub_disk_t disk; +@@ -184,15 +171,32 @@ static grub_dl_t my_mod; + static grub_err_t grub_minix_find_file (struct grub_minix_data *data, + const char *path); + ++#ifdef MODE_MINIX3 ++static inline grub_disk_addr_t ++grub_minix_zone2sect (struct grub_minix_data *data, grub_minix_uintn_t zone) ++{ ++ return ((grub_disk_addr_t) zone) * data->block_size; ++} ++#else ++static inline grub_disk_addr_t ++grub_minix_zone2sect (struct grub_minix_data *data, grub_minix_uintn_t zone) ++{ ++ int log2_zonesz = (GRUB_MINIX_LOG2_BSIZE ++ + grub_minix_to_cpu16 (data->sblock.log2_zone_size)); ++ return (((grub_disk_addr_t) zone) << log2_zonesz); ++} ++#endif ++ ++ + /* Read the block pointer in ZONE, on the offset NUM. */ + static grub_minix_uintn_t +-grub_get_indir (struct grub_minix_data *data, ++grub_get_indir (struct grub_minix_data *data, + grub_minix_uintn_t zone, + grub_minix_uintn_t num) + { + grub_minix_uintn_t indirn; + grub_disk_read (data->disk, +- GRUB_MINIX_ZONE2SECT(zone), ++ grub_minix_zone2sect(data, zone), + sizeof (grub_minix_uintn_t) * num, + sizeof (grub_minix_uintn_t), (char *) &indirn); + return grub_minix_to_cpu_n (indirn); +@@ -202,8 +206,6 @@ static grub_minix_uintn_t + grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk) + { + grub_minix_uintn_t indir; +- const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ +- / GRUB_MINIX_INODE_BLKSZ (data)); + + /* Direct block. */ + if (blk < GRUB_MINIX_INODE_DIR_BLOCKS) +@@ -211,33 +213,33 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk) + + /* Indirect block. */ + blk -= GRUB_MINIX_INODE_DIR_BLOCKS; +- if (blk < block_per_zone) ++ if (blk < data->block_per_zone) + { + indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk); + return indir; + } + + /* Double indirect block. */ +- blk -= block_per_zone; +- if (blk < block_per_zone * block_per_zone) ++ blk -= data->block_per_zone; ++ if (blk < (grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone) + { + indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data), +- blk / block_per_zone); ++ blk / data->block_per_zone); + +- indir = grub_get_indir (data, indir, blk % block_per_zone); ++ indir = grub_get_indir (data, indir, blk % data->block_per_zone); + + return indir; + } + + #if defined (MODE_MINIX3) || defined (MODE_MINIX2) +- blk -= block_per_zone * block_per_zone; +- if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone +- * (grub_uint64_t) block_per_zone)) ++ blk -= data->block_per_zone * data->block_per_zone; ++ if (blk < ((grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone ++ * (grub_uint64_t) data->block_per_zone)) + { + indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone), +- (blk / block_per_zone) / block_per_zone); +- indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone); +- indir = grub_get_indir (data, indir, blk % block_per_zone); ++ (blk / data->block_per_zone) / data->block_per_zone); ++ indir = grub_get_indir (data, indir, (blk / data->block_per_zone) % data->block_per_zone); ++ indir = grub_get_indir (data, indir, blk % data->block_per_zone); + + return indir; + } +@@ -262,6 +264,13 @@ grub_minix_read_file (struct grub_minix_data *data, + grub_uint32_t posblock; + grub_uint32_t blockoff; + ++ if (pos > GRUB_MINIX_INODE_SIZE (data)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ N_("attempt to read past the end of file")); ++ return -1; ++ } ++ + /* Adjust len so it we can't read past the end of the file. */ + if (len + pos > GRUB_MINIX_INODE_SIZE (data)) + len = GRUB_MINIX_INODE_SIZE (data) - pos; +@@ -278,7 +287,7 @@ grub_minix_read_file (struct grub_minix_data *data, + + for (i = posblock; i < blockcnt; i++) + { +- grub_disk_addr_t blknr; ++ grub_minix_uintn_t blknr; + grub_uint64_t blockend = data->block_size << GRUB_DISK_SECTOR_BITS; + grub_off_t skipfirst = 0; + +@@ -307,7 +316,7 @@ grub_minix_read_file (struct grub_minix_data *data, + data->disk->read_hook = read_hook; + data->disk->read_hook_data = read_hook_data; + grub_disk_read (data->disk, +- GRUB_MINIX_ZONE2SECT(blknr), ++ grub_minix_zone2sect(data, blknr), + skipfirst, blockend, buf); + data->disk->read_hook = 0; + if (grub_errno) +@@ -333,7 +342,8 @@ grub_minix_read_inode (struct grub_minix_data *data, grub_minix_ino_t ino) + + /* The first inode in minix is inode 1. */ + ino--; +- block = GRUB_MINIX_ZONE2SECT (2 + grub_minix_to_cpu16 (sblock->inode_bmap_size) ++ block = grub_minix_zone2sect (data, ++ 2 + grub_minix_to_cpu16 (sblock->inode_bmap_size) + + grub_minix_to_cpu16 (sblock->zone_bmap_size)); + block += ino / (GRUB_DISK_SECTOR_SIZE / sizeof (struct grub_minix_inode)); + int offs = (ino % (GRUB_DISK_SECTOR_SIZE +@@ -508,6 +518,12 @@ grub_minix_mount (grub_disk_t disk) + data->block_size = 2; + #endif + ++ data->block_per_zone = (((grub_uint64_t) data->block_size << \ ++ (GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size))) ++ / sizeof (grub_minix_uintn_t)); ++ if (!data->block_per_zone) ++ goto fail; ++ + return data; + + fail: +diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c +index 388ee18..598a2a5 100644 +--- a/grub-core/fs/nilfs2.c ++++ b/grub-core/fs/nilfs2.c +@@ -724,6 +724,10 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp) + if (grub_le_to_cpu32 (sbp->s_rev_level) != NILFS_SUPORT_REV) + return 0; + ++ /* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */ ++ if (grub_le_to_cpu32 (sbp->s_log_block_size) > 20) ++ return 0; ++ + return 1; + } + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index d3a91f5..6f84688 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -618,7 +618,10 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, + + ustr = get_utf8 (np, ns); + if (ustr == NULL) +- return 0; ++ { ++ grub_free (fdiro); ++ return 0; ++ } + if (namespace) + type |= GRUB_FSHELP_CASE_INSENSITIVE; + +@@ -917,12 +920,16 @@ grub_ntfs_mount (grub_disk_t disk) + + if (bpb.clusters_per_mft > 0) + data->mft_size = ((grub_disk_addr_t) bpb.clusters_per_mft) << data->log_spc; ++ else if (-bpb.clusters_per_mft < GRUB_NTFS_BLK_SHR || -bpb.clusters_per_mft >= 31) ++ goto fail; + else + data->mft_size = 1ULL << (-bpb.clusters_per_mft - GRUB_NTFS_BLK_SHR); + + if (bpb.clusters_per_index > 0) + data->idx_size = (((grub_disk_addr_t) bpb.clusters_per_index) + << data->log_spc); ++ else if (-bpb.clusters_per_index < GRUB_NTFS_BLK_SHR || -bpb.clusters_per_index >= 31) ++ goto fail; + else + data->idx_size = 1ULL << (-bpb.clusters_per_index - GRUB_NTFS_BLK_SHR); + +diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c +index ac65054..b781665 100644 +--- a/grub-core/fs/reiserfs.c ++++ b/grub-core/fs/reiserfs.c +@@ -365,7 +365,7 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key, + key->u.v1.offset = grub_cpu_to_le32 (value); + else + key->u.v2.offset_type \ +- = ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60)) ++ = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (15ULL << 60)) + | grub_cpu_to_le64 (value & (~0ULL >> 4))); + } + +@@ -412,7 +412,7 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key, + key->u.v1.type = grub_cpu_to_le32 (type); + else + key->u.v2.offset_type +- = ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4)) ++ = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (~0ULL >> 4)) + | grub_cpu_to_le64 ((grub_uint64_t) type << 60)); + + assert (grub_reiserfs_get_key_type (key) == grub_type); +@@ -997,8 +997,8 @@ grub_reiserfs_open (struct grub_file *file, const char *name) + data = grub_reiserfs_mount (file->device->disk); + if (! data) + goto fail; +- key.directory_id = grub_cpu_to_le32 (1); +- key.object_id = grub_cpu_to_le32 (2); ++ key.directory_id = grub_cpu_to_le32_compile_time (1); ++ key.object_id = grub_cpu_to_le32_compile_time (2); + key.u.v2.offset_type = 0; + grub_reiserfs_set_key_type (&key, GRUB_REISERFS_DIRECTORY, 2); + grub_reiserfs_set_key_offset (&key, 1); +@@ -1090,7 +1090,7 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + switch (found.type) + { + case GRUB_REISERFS_DIRECT: +- block = found.block_number * (block_size >> GRUB_DISK_SECTOR_BITS); ++ block = ((grub_disk_addr_t) found.block_number) * (block_size >> GRUB_DISK_SECTOR_BITS); + grub_dprintf ("reiserfs_blocktype", "D: %u\n", (unsigned) block); + if (initial_position < current_position + item_size) + { +@@ -1289,8 +1289,8 @@ grub_reiserfs_dir (grub_device_t device, const char *path, + data = grub_reiserfs_mount (device->disk); + if (! data) + goto fail; +- root_key.directory_id = grub_cpu_to_le32 (1); +- root_key.object_id = grub_cpu_to_le32 (2); ++ root_key.directory_id = grub_cpu_to_le32_compile_time (1); ++ root_key.object_id = grub_cpu_to_le32_compile_time (2); + root_key.u.v2.offset_type = 0; + grub_reiserfs_set_key_type (&root_key, GRUB_REISERFS_DIRECTORY, 2); + grub_reiserfs_set_key_offset (&root_key, 1); +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index 6c82150..57b8d8d 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -173,10 +173,11 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block, + struct grub_sfs_btree *tree; + int i; + grub_uint32_t next; ++ grub_size_t blocksize = GRUB_DISK_SECTOR_SIZE << data->log_blocksize; + +- treeblock = grub_malloc (GRUB_DISK_SECTOR_SIZE << data->log_blocksize); +- if (!block) +- return 0; ++ treeblock = grub_malloc (blocksize); ++ if (!treeblock) ++ return grub_errno; + + next = grub_be_to_cpu32 (data->rblock.btree); + tree = (struct grub_sfs_btree *) treeblock; +@@ -184,17 +185,21 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block, + /* Handle this level in the btree. */ + do + { ++ grub_uint16_t nnodes; + grub_disk_read (data->disk, + ((grub_disk_addr_t) next) << data->log_blocksize, +- 0, GRUB_DISK_SECTOR_SIZE << data->log_blocksize, +- treeblock); ++ 0, blocksize, treeblock); + if (grub_errno) + { + grub_free (treeblock); + return grub_errno; + } + +- for (i = grub_be_to_cpu16 (tree->nodes) - 1; i >= 0; i--) ++ nnodes = grub_be_to_cpu16 (tree->nodes); ++ if (nnodes * (grub_uint32_t) (tree)->nodesize > blocksize) ++ break; ++ ++ for (i = (int) nnodes - 1; i >= 0; i--) + { + + #define EXTNODE(tree, index) \ +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index fd41283..839bff8 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -986,6 +986,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + case 1: + if (ptr[1]) + goto fail; ++ /* Fallthrough. */ + case 2: + /* in 4 bytes. out: 1 byte. */ + optr = out; +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index 4a2161c..0619d6e 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -465,7 +465,13 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino) + && INODE_SIZE (data) <= sizeof (data->inode.symlink)) + grub_strcpy (symlink, (char *) data->inode.symlink); + else +- grub_ufs_read_file (data, 0, 0, 0, sz, symlink); ++ { ++ if (grub_ufs_read_file (data, 0, 0, 0, sz, symlink) < 0) ++ { ++ grub_free(symlink); ++ return grub_errno; ++ } ++ } + symlink[sz] = '\0'; + + /* The symlink is an absolute path, go back to the root inode. */ +@@ -604,7 +610,8 @@ grub_ufs_mount (grub_disk_t disk) + endiannesses. */ + if (data->sblock.magic == grub_cpu_to_ufs32_compile_time (GRUB_UFS_MAGIC) + && data->sblock.bsize != 0 +- && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0)) ++ && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0) ++ && data->sblock.ino_per_group != 0) + { + for (data->log2_blksz = 0; + (1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize); +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 16ffd3f..46de6af 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -34,6 +34,50 @@ 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_ATTRBIT 0x0010 ++#define XFS_SB_VERSION_NLINKBIT 0x0020 ++#define XFS_SB_VERSION_QUOTABIT 0x0040 ++#define XFS_SB_VERSION_ALIGNBIT 0x0080 ++#define XFS_SB_VERSION_DALIGNBIT 0x0100 ++#define XFS_SB_VERSION_LOGV2BIT 0x0400 ++#define XFS_SB_VERSION_SECTORBIT 0x0800 ++#define XFS_SB_VERSION_EXTFLGBIT 0x1000 ++#define XFS_SB_VERSION_DIRV2BIT 0x2000 ++#define XFS_SB_VERSION_MOREBITSBIT 0x8000 ++#define XFS_SB_VERSION_BITS_SUPPORTED \ ++ (XFS_SB_VERSION_NUMBITS | \ ++ XFS_SB_VERSION_ATTRBIT | \ ++ XFS_SB_VERSION_NLINKBIT | \ ++ XFS_SB_VERSION_QUOTABIT | \ ++ XFS_SB_VERSION_ALIGNBIT | \ ++ XFS_SB_VERSION_DALIGNBIT | \ ++ XFS_SB_VERSION_LOGV2BIT | \ ++ XFS_SB_VERSION_SECTORBIT | \ ++ XFS_SB_VERSION_EXTFLGBIT | \ ++ XFS_SB_VERSION_DIRV2BIT | \ ++ XFS_SB_VERSION_MOREBITSBIT) ++ ++/* Recognized xfs format versions */ ++#define XFS_SB_VERSION_4 4 /* Good old XFS filesystem */ ++#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */ ++ ++/* features2 field flags */ ++#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ ++#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */ ++#define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32-bit project ids */ ++#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */ ++#define XFS_SB_VERSION2_BITS_SUPPORTED \ ++ (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ ++ XFS_SB_VERSION2_ATTR2BIT | \ ++ XFS_SB_VERSION2_PROJID32BIT | \ ++ XFS_SB_VERSION2_FTYPE) ++ ++/* incompat feature flags */ ++#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ ++#define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ ++ (XFS_SB_FEAT_INCOMPAT_FTYPE) + + struct grub_xfs_sblock + { +@@ -45,7 +89,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 +100,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,21 +120,29 @@ 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; + grub_uint8_t len; + } GRUB_PACKED; + +-typedef grub_uint32_t grub_xfs_extent[4]; ++struct grub_xfs_extent ++{ ++ /* This should be a bitfield but bietfields are unportable, so just have ++ a raw array and functions extracting useful info from it. ++ */ ++ grub_uint32_t raw[4]; ++} GRUB_PACKED; + + struct grub_xfs_btree_node + { +@@ -90,21 +151,22 @@ struct grub_xfs_btree_node + grub_uint16_t numrecs; + grub_uint64_t left; + grub_uint64_t right; +- grub_uint64_t keys[1]; +-} GRUB_PACKED; ++ /* In V5 here follow crc, uuid, etc. */ ++ /* Then follow keys and block pointers */ ++} GRUB_PACKED; + + struct grub_xfs_btree_root + { + grub_uint16_t level; + grub_uint16_t numrecs; + grub_uint64_t keys[1]; +-} GRUB_PACKED; ++} GRUB_PACKED; + + struct grub_xfs_time + { + grub_uint32_t sec; + grub_uint32_t nanosec; +-} GRUB_PACKED; ++} GRUB_PACKED; + + struct grub_xfs_inode + { +@@ -123,19 +185,11 @@ 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; + ++#define XFS_V2_INODE_SIZE sizeof(struct grub_xfs_inode) ++#define XFS_V3_INODE_SIZE (XFS_V2_INODE_SIZE + 76) ++ + struct grub_xfs_dirblock_tail + { + grub_uint32_t leaf_count; +@@ -157,6 +211,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 +220,71 @@ static grub_dl_t my_mod; + + + ++static int grub_xfs_sb_hascrc(struct grub_xfs_data *data) ++{ ++ return (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == ++ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5); ++} ++ ++static int grub_xfs_sb_hasftype(struct grub_xfs_data *data) ++{ ++ if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == ++ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5) && ++ data->sblock.sb_features_incompat & grub_cpu_to_be32_compile_time(XFS_SB_FEAT_INCOMPAT_FTYPE)) ++ return 1; ++ if (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_MOREBITSBIT) && ++ data->sblock.features2 & grub_cpu_to_be32_compile_time(XFS_SB_VERSION2_FTYPE)) ++ return 1; ++ return 0; ++} ++ ++static int grub_xfs_sb_valid(struct grub_xfs_data *data) ++{ ++ grub_dprintf("xfs", "Validating superblock\n"); ++ if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4) ++ || data->sblock.log2_bsize < GRUB_DISK_SECTOR_BITS ++ || ((int) data->sblock.log2_bsize ++ + (int) data->sblock.log2_dirblk) >= 27) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem"); ++ return 0; ++ } ++ if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == ++ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_5)) ++ { ++ grub_dprintf("xfs", "XFS v5 superblock detected\n"); ++ if (data->sblock.sb_features_incompat & ++ grub_cpu_to_be32_compile_time(~XFS_SB_FEAT_INCOMPAT_SUPPORTED)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem has unsupported " ++ "incompatible features"); ++ return 0; ++ } ++ return 1; ++ } ++ else if ((data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == ++ grub_cpu_to_be16_compile_time(XFS_SB_VERSION_4)) ++ { ++ grub_dprintf("xfs", "XFS v4 superblock detected\n"); ++ if (!(data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_DIRV2BIT))) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem without V2 directories " ++ "is unsupported"); ++ return 0; ++ } ++ if (data->sblock.version & grub_cpu_to_be16_compile_time(~XFS_SB_VERSION_BITS_SUPPORTED) || ++ (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_MOREBITSBIT) && ++ data->sblock.features2 & grub_cpu_to_be16_compile_time(~XFS_SB_VERSION2_BITS_SUPPORTED))) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "XFS filesystem has unsupported version " ++ "bits"); ++ return 0; ++ } ++ return 1; ++ } ++ return 0; ++} ++ + /* Filetype information as used in inodes. */ + #define FILETYPE_INO_MASK 0170000 + #define FILETYPE_INO_REG 0100000 +@@ -180,14 +301,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 +@@ -198,37 +319,25 @@ GRUB_XFS_FSB_TO_BLOCK (struct grub_xfs_data *data, grub_disk_addr_t fsb) + } + + static inline grub_uint64_t +-GRUB_XFS_EXTENT_OFFSET (grub_xfs_extent *exts, int ex) ++GRUB_XFS_EXTENT_OFFSET (struct grub_xfs_extent *exts, int ex) + { +- return ((grub_be_to_cpu32 (exts[ex][0]) & ~(1 << 31)) << 23 +- | grub_be_to_cpu32 (exts[ex][1]) >> 9); ++ return ((grub_be_to_cpu32 (exts[ex].raw[0]) & ~(1 << 31)) << 23 ++ | grub_be_to_cpu32 (exts[ex].raw[1]) >> 9); + } + + static inline grub_uint64_t +-GRUB_XFS_EXTENT_BLOCK (grub_xfs_extent *exts, int ex) ++GRUB_XFS_EXTENT_BLOCK (struct grub_xfs_extent *exts, int ex) + { +- return ((grub_uint64_t) (grub_be_to_cpu32 (exts[ex][1]) ++ return ((grub_uint64_t) (grub_be_to_cpu32 (exts[ex].raw[1]) + & (0x1ff)) << 43 +- | (grub_uint64_t) grub_be_to_cpu32 (exts[ex][2]) << 11 +- | grub_be_to_cpu32 (exts[ex][3]) >> 21); ++ | (grub_uint64_t) grub_be_to_cpu32 (exts[ex].raw[2]) << 11 ++ | grub_be_to_cpu32 (exts[ex].raw[3]) >> 21); + } + + static inline grub_uint64_t +-GRUB_XFS_EXTENT_SIZE (grub_xfs_extent *exts, int ex) ++GRUB_XFS_EXTENT_SIZE (struct grub_xfs_extent *exts, int ex) + { +- 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); ++ return (grub_be_to_cpu32 (exts[ex].raw[3]) & ((1 << 21) - 1)); + } + + +@@ -255,6 +364,109 @@ grub_xfs_inode_offset (struct grub_xfs_data *data, + data->sblock.log2_inode); + } + ++static inline grub_size_t ++grub_xfs_inode_size(struct grub_xfs_data *data) ++{ ++ return (grub_size_t)1 << data->sblock.log2_inode; ++} ++ ++/* ++ * Returns size occupied by XFS inode stored in memory - we store struct ++ * grub_fshelp_node there but on disk inode size may be actually larger than ++ * struct grub_xfs_inode so we need to account for that so that we can read ++ * from disk directly into in-memory structure. ++ */ ++static inline grub_size_t ++grub_xfs_fshelp_size(struct grub_xfs_data *data) ++{ ++ return sizeof (struct grub_fshelp_node) - sizeof (struct grub_xfs_inode) ++ + grub_xfs_inode_size(data); ++} ++ ++/* This should return void * but XFS code is error-prone with alignment, so ++ return char to retain cast-align. ++ */ ++static char * ++grub_xfs_inode_data(struct grub_xfs_inode *inode) ++{ ++ if (inode->version <= 2) ++ return ((char *)inode) + XFS_V2_INODE_SIZE; ++ return ((char *)inode) + XFS_V3_INODE_SIZE; ++} ++ ++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 (struct grub_xfs_dir_entry *) ++ (((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 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) + ALIGN_UP(size, 8)); ++} ++ ++/* This should return void * but XFS code is error-prone with alignment, so ++ return char to retain cast-align. ++ */ ++static char * ++grub_xfs_btree_keys(struct grub_xfs_data *data, ++ struct grub_xfs_btree_node *leaf) ++{ ++ char *keys = (char *)(leaf + 1); ++ ++ if (data->hascrc) ++ keys += 48; /* skip crc, uuid, ... */ ++ return keys; ++} + + static grub_err_t + grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, +@@ -263,9 +475,11 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, + grub_uint64_t block = grub_xfs_inode_block (data, ino); + int offset = grub_xfs_inode_offset (data, ino); + ++ grub_dprintf("xfs", "Reading inode (%"PRIuGRUB_UINT64_T") - %"PRIuGRUB_UINT64_T", %d\n", ++ ino, block, offset); + /* 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)) +@@ -274,40 +488,47 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino, + return 0; + } + ++static grub_uint64_t ++get_fsb (const void *keys, int idx) ++{ ++ const char *p = (const char *) keys + sizeof(grub_uint64_t) * idx; ++ return grub_be_to_cpu64 (grub_get_unaligned64 (p)); ++} + + static grub_disk_addr_t + grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + { + struct grub_xfs_btree_node *leaf = 0; + int ex, nrec; +- grub_xfs_extent *exts; ++ struct grub_xfs_extent *exts; + grub_uint64_t ret = 0; + + if (node->inode.format == XFS_INODE_FORMAT_BTREE) + { +- const grub_uint64_t *keys; ++ struct grub_xfs_btree_root *root; ++ const char *keys; + int recoffset; + + leaf = grub_malloc (node->data->bsize); + if (leaf == 0) + return 0; + +- nrec = grub_be_to_cpu16 (node->inode.data.btree.numrecs); +- keys = &node->inode.data.btree.keys[0]; ++ root = (struct grub_xfs_btree_root *) grub_xfs_inode_data(&node->inode); ++ nrec = grub_be_to_cpu16 (root->numrecs); ++ keys = (char *) &root->keys[0]; + if (node->inode.fork_offset) + recoffset = (node->inode.fork_offset - 1) / 2; + else +- recoffset = ((1 << node->data->sblock.log2_inode) +- - ((char *) &node->inode.data.btree.keys +- - (char *) &node->inode)) +- / (2 * sizeof (grub_uint64_t)); ++ recoffset = (grub_xfs_inode_size(node->data) ++ - ((char *) keys - (char *) &node->inode)) ++ / (2 * sizeof (grub_uint64_t)); + do + { + int i; + + for (i = 0; i < nrec; i++) + { +- if (fileblock < grub_be_to_cpu64 (keys[i])) ++ if (fileblock < get_fsb(keys, i)) + break; + } + +@@ -317,12 +538,16 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + grub_free (leaf); + return 0; + } ++ + if (grub_disk_read (node->data->disk, +- GRUB_XFS_FSB_TO_BLOCK (node->data, grub_be_to_cpu64 (keys[i - 1 + recoffset])) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS), ++ GRUB_XFS_FSB_TO_BLOCK (node->data, get_fsb (keys, i - 1 + recoffset)) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS), + 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"); +@@ -330,18 +555,18 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + } + + 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))); + } + while (leaf->level); +- exts = (grub_xfs_extent *) keys; ++ exts = (struct grub_xfs_extent *) keys; + } + else if (node->inode.format == XFS_INODE_FORMAT_EXT) + { + nrec = grub_be_to_cpu32 (node->inode.nextents); +- exts = &node->inode.data.extents[0]; ++ exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode); + } + else + { +@@ -399,7 +624,7 @@ grub_xfs_read_symlink (grub_fshelp_node_t 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: + { +@@ -456,9 +681,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, + struct grub_fshelp_node *fdiro; + grub_err_t err; + +- fdiro = grub_malloc (sizeof (struct grub_fshelp_node) +- - sizeof (struct grub_xfs_inode) +- + (1 << ctx->diro->data->sblock.log2_inode) + 1); ++ fdiro = grub_malloc (grub_xfs_fshelp_size(ctx->diro->data) + 1); + if (!fdiro) + { + grub_print_error (); +@@ -496,24 +719,18 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + { + 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 = (struct grub_xfs_dir_header *) 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); +- parent = grub_cpu_to_be64 (parent); +- /* 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 = 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)) +@@ -522,12 +739,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + 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. */ +@@ -545,7 +760,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'; +@@ -553,10 +767,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + 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; + } +@@ -583,15 +794,11 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + >> 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, +@@ -603,14 +810,11 @@ 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 ((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) +@@ -618,17 +822,20 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + 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 (direntry->inode, filename, &ctx)) ++ if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), ++ filename, &ctx)) + { + grub_free (dirblock); + return 1; +@@ -641,8 +848,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + 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); +@@ -667,36 +873,35 @@ 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)) + goto fail; + +- if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4) +- || data->sblock.log2_bsize < GRUB_DISK_SECTOR_BITS +- || ((int) data->sblock.log2_bsize +- + (int) data->sblock.log2_dirblk) >= 27) +- { +- grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem"); +- goto fail; +- } ++ if (!grub_xfs_sb_valid(data)) ++ goto fail; + + 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; + + 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); ++ 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 %"PRIuGRUB_UINT64_T"\n", ++ grub_cpu_to_be64(data->sblock.rootino)); + + grub_xfs_read_inode (data, data->diropen.ino, &data->diropen.inode); + +@@ -799,10 +1004,7 @@ grub_xfs_open (struct grub_file *file, const char *name) + + if (fdiro != &data->diropen) + { +- grub_memcpy (&data->diropen, fdiro, +- sizeof (struct grub_fshelp_node) +- - sizeof (struct grub_xfs_inode) +- + (1 << data->sblock.log2_inode)); ++ grub_memcpy (&data->diropen, fdiro, grub_xfs_fshelp_size(data)); + grub_free (fdiro); + } + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index cfb25c0..c4ead29 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -252,7 +252,6 @@ struct grub_zfs_data + + uberblock_t current_uberblock; + +- int mounted; + grub_uint64_t guid; + }; + +@@ -281,12 +280,17 @@ grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key + */ + #define MAX_SUPPORTED_FEATURE_STRLEN 50 + static const char *spa_feature_names[] = { +- "org.illumos:lz4_compress",NULL ++ "org.illumos:lz4_compress", ++ "com.delphix:hole_birth", ++ "com.delphix:embedded_data", ++ "com.delphix:extensible_dataset", ++ "org.open-zfs:large_blocks", ++ NULL + }; + + static int + check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx); +-static int ++static grub_err_t + check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ); + + static grub_err_t +@@ -957,7 +961,7 @@ nvpair_value (const char *nvp,char **val, + static grub_err_t + check_pool_label (struct grub_zfs_data *data, + struct grub_zfs_device_desc *diskdesc, +- int *inserted) ++ int *inserted, int original) + { + grub_uint64_t pool_state, txg = 0; + char *nvlist,*features; +@@ -1081,11 +1085,12 @@ check_pool_label (struct grub_zfs_data *data, + + grub_dprintf ("zfs", "check 11 passed\n"); + +- if (data->mounted && data->guid != poolguid) +- return grub_error (GRUB_ERR_BAD_FS, "another zpool"); +- else ++ if (original) + data->guid = poolguid; + ++ if (data->guid != poolguid) ++ return grub_error (GRUB_ERR_BAD_FS, "another zpool"); ++ + { + char *nv; + nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE); +@@ -1186,7 +1191,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, + } + grub_dprintf ("zfs", "label ok %d\n", label); + +- err = check_pool_label (data, &desc, inserted); ++ err = check_pool_label (data, &desc, inserted, original); + if (err || !*inserted) + { + grub_errno = GRUB_ERR_NONE; +@@ -1501,6 +1506,9 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "raidz%d is not supported", desc->nparity); + ++ if (desc->n_children <= desc->nparity || desc->n_children < 1) ++ return grub_error(GRUB_ERR_BAD_FS, "too little devices for given parity"); ++ + orig_s = (((len + (1 << desc->ashift) - 1) >> desc->ashift) + + (desc->n_children - desc->nparity) - 1); + s = orig_s; +@@ -1748,7 +1756,7 @@ zio_read_gang (blkptr_t * bp, grub_zfs_endian_t endian, dva_t * dva, void *buf, + + for (i = 0; i < SPA_GBH_NBLKPTRS; i++) + { +- if (zio_gb->zg_blkptr[i].blk_birth == 0) ++ if (BP_IS_HOLE(&zio_gb->zg_blkptr[i])) + continue; + + err = zio_read_data (&zio_gb->zg_blkptr[i], endian, buf, data); +@@ -1798,6 +1806,39 @@ zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, + } + + /* ++ * buf must be at least BPE_GET_PSIZE(bp) bytes long (which will never be ++ * more than BPE_PAYLOAD_SIZE bytes). ++ */ ++static grub_err_t ++decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) ++{ ++ grub_size_t psize, i; ++ grub_uint8_t *buf8 = buf; ++ grub_uint64_t w = 0; ++ const grub_uint64_t *bp64 = (const grub_uint64_t *)bp; ++ ++ psize = BPE_GET_PSIZE(bp); ++ ++ /* ++ * Decode the words of the block pointer into the byte array. ++ * Low bits of first word are the first byte (little endian). ++ */ ++ for (i = 0; i < psize; i++) ++ { ++ if (i % sizeof (w) == 0) ++ { ++ /* beginning of a word */ ++ w = *bp64; ++ bp64++; ++ if (!BPE_IS_PAYLOADWORD(bp, bp64)) ++ bp64++; ++ } ++ buf8[i] = BF64_GET(w, (i % sizeof (w)) * 8, 8); ++ } ++ return GRUB_ERR_NONE; ++} ++ ++/* + * Read in a block of data, verify its checksum, decompress if needed, + * and put the uncompressed data in buf. + */ +@@ -1815,12 +1856,26 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + *buf = NULL; + + checksum = (grub_zfs_to_cpu64((bp)->blk_prop, endian) >> 40) & 0xff; +- comp = (grub_zfs_to_cpu64((bp)->blk_prop, endian)>>32) & 0xff; ++ comp = (grub_zfs_to_cpu64((bp)->blk_prop, endian)>>32) & 0x7f; + encrypted = ((grub_zfs_to_cpu64((bp)->blk_prop, endian) >> 60) & 3); +- lsize = (BP_IS_HOLE(bp) ? 0 : +- (((grub_zfs_to_cpu64 ((bp)->blk_prop, endian) & 0xffff) + 1) +- << SPA_MINBLOCKSHIFT)); +- psize = get_psize (bp, endian); ++ if (BP_IS_EMBEDDED(bp)) ++ { ++ if (BPE_GET_ETYPE(bp) != BP_EMBEDDED_TYPE_DATA) ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "unsupported embedded BP (type=%u)\n", ++ BPE_GET_ETYPE(bp)); ++ lsize = BPE_GET_LSIZE(bp); ++ psize = BF64_GET_SB(grub_zfs_to_cpu64 ((bp)->blk_prop, endian), 25, 7, 0, 1); ++ } ++ else ++ { ++ lsize = (BP_IS_HOLE(bp) ? 0 : ++ (((grub_zfs_to_cpu64 ((bp)->blk_prop, endian) & 0xffff) + 1) ++ << SPA_MINBLOCKSHIFT)); ++ psize = get_psize (bp, endian); ++ } ++ grub_dprintf("zfs", "zio_read: E %d: size %" PRIdGRUB_SSIZE "/%" ++ PRIdGRUB_SSIZE "\n", (int)BP_IS_EMBEDDED(bp), lsize, psize); + + if (size) + *size = lsize; +@@ -1834,33 +1889,41 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + "compression algorithm %s not supported\n", decomp_table[comp].name); + + if (comp != ZIO_COMPRESS_OFF) +- { +- /* It's not really necessary to align to 16, just for safety. */ +- compbuf = grub_malloc (ALIGN_UP (psize, 16)); +- if (! compbuf) +- return grub_errno; +- } ++ /* It's not really necessary to align to 16, just for safety. */ ++ compbuf = grub_malloc (ALIGN_UP (psize, 16)); + else + compbuf = *buf = grub_malloc (lsize); ++ if (! compbuf) ++ return grub_errno; + + grub_dprintf ("zfs", "endian = %d\n", endian); +- err = zio_read_data (bp, endian, compbuf, data); ++ if (BP_IS_EMBEDDED(bp)) ++ err = decode_embedded_bp_compressed(bp, compbuf); ++ else ++ { ++ err = zio_read_data (bp, endian, compbuf, data); ++ /* FIXME is it really necessary? */ ++ if (comp != ZIO_COMPRESS_OFF) ++ grub_memset (compbuf + psize, 0, ALIGN_UP (psize, 16) - psize); ++ } + if (err) + { + grub_free (compbuf); + *buf = NULL; + return err; + } +- grub_memset (compbuf, 0, ALIGN_UP (psize, 16) - psize); + +- err = zio_checksum_verify (zc, checksum, endian, +- compbuf, psize); +- if (err) ++ if (!BP_IS_EMBEDDED(bp)) + { +- grub_dprintf ("zfs", "incorrect checksum\n"); +- grub_free (compbuf); +- *buf = NULL; +- return err; ++ err = zio_checksum_verify (zc, checksum, endian, ++ compbuf, psize); ++ if (err) ++ { ++ grub_dprintf ("zfs", "incorrect checksum\n"); ++ grub_free (compbuf); ++ *buf = NULL; ++ return err; ++ } + } + + if (encrypted) +@@ -1972,7 +2035,7 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, + dn->endian) + << SPA_MINBLOCKSHIFT; + *buf = grub_malloc (size); +- if (*buf) ++ if (!*buf) + { + err = grub_errno; + break; +@@ -2010,12 +2073,14 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, + */ + static grub_err_t + mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian, +- int objsize, const char *name, grub_uint64_t * value, ++ grub_uint32_t objsize, const char *name, grub_uint64_t * value, + int case_insensitive) + { +- int i, chunks; ++ grub_uint32_t i, chunks; + mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; + ++ if (objsize < MZAP_ENT_LEN) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name); + chunks = objsize / MZAP_ENT_LEN - 1; + for (i = 0; i < chunks; i++) + { +@@ -2423,7 +2488,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, + struct grub_zfs_data *data, int case_insensitive) + { + grub_uint64_t block_type; +- int size; ++ grub_uint32_t size; + void *zapbuf; + grub_err_t err; + grub_zfs_endian_t endian; +@@ -2431,7 +2496,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, + grub_dprintf ("zfs", "looking for '%s'\n", name); + + /* Read in the first block of the zap object data. */ +- size = grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, ++ size = (grub_uint32_t) grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, + zap_dnode->endian) << SPA_MINBLOCKSHIFT; + err = dmu_read (zap_dnode, 0, &zapbuf, &endian, data); + if (err) +@@ -2804,6 +2869,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + dnode_path->dn.endian) + << SPA_MINBLOCKSHIFT); + ++ if (blksz == 0) ++ return grub_error(GRUB_ERR_BAD_FS, "0-sized block"); ++ + sym_value = grub_malloc (sym_sz); + if (!sym_value) + return grub_errno; +@@ -2814,7 +2882,10 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + + err = dmu_read (&(dnode_path->dn), block, &t, 0, data); + if (err) +- return err; ++ { ++ grub_free (sym_value); ++ return err; ++ } + + movesize = sym_sz - block * blksz; + if (movesize > blksz) +@@ -2829,6 +2900,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + if (!path_buf) + { + grub_free (oldpathbuf); ++ if (free_symval) ++ grub_free (sym_value); + return grub_errno; + } + grub_memcpy (path, sym_value, sym_sz); +@@ -3012,7 +3085,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, + + grub_dprintf ("zfs", "alive\n"); + +- err = dnode_get (mosmdn, objnum, DMU_OT_DSL_DIR, mdn, data); ++ err = dnode_get (mosmdn, objnum, 0, mdn, data); + if (err) + return err; + +@@ -3045,7 +3118,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, + if (err) + return err; + +- err = dnode_get (mosmdn, objnum, DMU_OT_DSL_DIR, mdn, data); ++ err = dnode_get (mosmdn, objnum, 0, mdn, data); + if (err) + return err; + +@@ -3200,8 +3273,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + + grub_dprintf ("zfs", "endian = %d\n", subvol->mdn.endian); + +- err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &subvol->mdn, +- data); ++ err = dnode_get (&(data->mos), headobj, 0, &subvol->mdn, data); + if (err) + { + grub_free (fsname); +@@ -3597,8 +3669,13 @@ zfs_mount (grub_device_t dev) + if (ub->ub_version >= SPA_VERSION_FEATURES && + check_mos_features(&((objset_phys_t *) osp)->os_meta_dnode,ub_endian, + data) != 0) +- return NULL; +- ++ { ++ grub_error (GRUB_ERR_BAD_FS, "Unsupported features in pool"); ++ grub_free (osp); ++ zfs_unmount (data); ++ return NULL; ++ } ++ + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove (&(data->mos.dn), &((objset_phys_t *) osp)->os_meta_dnode, + DNODE_SIZE); +@@ -3606,8 +3683,6 @@ zfs_mount (grub_device_t dev) + ub_endian) >> 63) & 1; + grub_free (osp); + +- data->mounted = 1; +- + return data; + } + +@@ -3798,6 +3873,12 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len) + blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, + data->dnode.endian) << SPA_MINBLOCKSHIFT; + ++ if (blksz == 0) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "0-sized block"); ++ return -1; ++ } ++ + /* + * Entire Dnode is too big to fit into the space available. We + * will need to read it in chunks. This could be optimized to +@@ -3891,7 +3972,7 @@ fill_fs_info (struct grub_dirhook_info *info, + { + headobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&mdn.dn))->dd_head_dataset_obj, mdn.endian); + +- err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &mdn, data); ++ err = dnode_get (&(data->mos), headobj, 0, &mdn, data); + if (err) + { + grub_dprintf ("zfs", "failed here\n"); +@@ -3969,7 +4050,12 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) + dnode_end_t dn; + grub_memset (&info, 0, sizeof (info)); + +- dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data); ++ err = dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data); ++ if (err) ++ { ++ grub_print_error (); ++ return 0; ++ } + + if (dn.dn.dn_bonustype == DMU_OT_SA) + { +@@ -4190,11 +4276,11 @@ check_feature (const char *name, grub_uint64_t val, + * errnum: Failure. + */ + +-static int ++static grub_err_t + check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ) + { + grub_uint64_t objnum; +- grub_uint8_t errnum = 0; ++ grub_err_t errnum = 0; + dnode_end_t dn,mosmdn; + mzap_phys_t* mzp; + grub_zfs_endian_t endianzap; +diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c +index 88dae72..87eef62 100644 +--- a/grub-core/fs/zfs/zfscrypt.c ++++ b/grub-core/fs/zfs/zfscrypt.c +@@ -238,7 +238,7 @@ grub_gcm_decrypt (grub_crypto_cipher_handle_t cipher, + grub_crypto_xor (out + 16 * i, in + 16 * i, mul, csize); + } + for (j = 0; j < 8; j++) +- mac[15 - j] ^= ((psize * 8) >> (8 * j)); ++ mac[15 - j] ^= ((((grub_uint64_t) psize) * 8) >> (8 * j)); + grub_gcm_mul (mac, h); + + if (mac_out) +@@ -354,6 +354,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + if (err) + { + grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (cipher); + continue; + } + +@@ -362,6 +363,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + if (err) + { + grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (cipher); + continue; + } + +@@ -372,6 +374,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + { + grub_dprintf ("zfs", "key loading failed\n"); + grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (cipher); + continue; + } + +@@ -381,21 +384,25 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + { + grub_dprintf ("zfs", "key loading failed\n"); + grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (cipher); + continue; + } + ret = grub_crypto_cipher_open (GRUB_CIPHER_AES); + if (!ret) + { + grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (cipher); + continue; + } + err = grub_crypto_cipher_set_key (ret, decrypted, keylen); + if (err) + { +- grub_errno = GRUB_ERR_NONE; +- grub_crypto_cipher_close (ret); +- continue; +- } ++ grub_errno = GRUB_ERR_NONE; ++ grub_crypto_cipher_close (ret); ++ grub_crypto_cipher_close (cipher); ++ continue; ++ } ++ grub_crypto_cipher_close (cipher); + return ret; + } + return NULL; +diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c +index c96bf21..c8a28ac 100644 +--- a/grub-core/fs/zfs/zfsinfo.c ++++ b/grub-core/fs/zfs/zfsinfo.c +@@ -130,10 +130,12 @@ print_vdev_info (char *nvlist, int tab) + grub_free (bootpath); + grub_free (devid); + grub_free (path); ++ grub_free (type); + return GRUB_ERR_NONE; + } + char is_mirror=(grub_strcmp(type,VDEV_TYPE_MIRROR) == 0); + char is_raidz=(grub_strcmp(type,VDEV_TYPE_RAIDZ) == 0); ++ grub_free (type); + + if (is_mirror || is_raidz) + { +diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh +index 45c15ec..8c6bb1c 100644 +--- a/grub-core/genemuinit.sh ++++ b/grub-core/genemuinit.sh +@@ -47,7 +47,7 @@ EOF + read mods + for line in $mods; do + if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then +- echo "grub_${line}_init ();" | sed 's,\.mod,,g;' ++ echo "grub_${line%%.*}_init ();" + fi + done + +@@ -63,7 +63,7 @@ EOF + + for line in $mods; do + if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then +- echo "grub_${line}_fini ();" | sed 's,\.mod,,g;' ++ echo "grub_${line%%.*}_fini ();" + fi + done + +diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh +index 6b83f59..a99a15d 100644 +--- a/grub-core/genemuinitheader.sh ++++ b/grub-core/genemuinitheader.sh +@@ -44,9 +44,9 @@ EOF + read mods + for line in $mods; do + if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then +- echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;' ++ echo "void grub_${line%%.*}_init (void);" + fi + if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then +- echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;' ++ echo "void grub_${line%%.*}_fini (void);" + fi + done +diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c +index 04f68b8..354dd7b 100644 +--- a/grub-core/gfxmenu/gui_circular_progress.c ++++ b/grub-core/gfxmenu/gui_circular_progress.c +@@ -138,51 +138,53 @@ circprog_paint (void *vself, const grub_video_rect_t *region) + (height - center_height) / 2, 0, 0, + center_width, center_height); + +- int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1; +- unsigned nticks; +- unsigned tick_begin; +- unsigned tick_end; +- if (self->end <= self->start +- || self->value <= self->start) +- nticks = 0; +- else +- nticks = ((unsigned) (self->num_ticks +- * (self->value - self->start))) +- / ((unsigned) (self->end - self->start)); +- /* Do ticks appear or disappear as the value approached the end? */ +- if (self->ticks_disappear) ++ if (self->num_ticks) + { +- tick_begin = nticks; +- tick_end = self->num_ticks; +- } +- else +- { +- tick_begin = 0; +- tick_end = nticks; +- } +- +- unsigned i; +- for (i = tick_begin; i < tick_end; i++) +- { +- int x; +- int y; +- int angle; +- +- /* Calculate the location of the tick. */ +- angle = self->start_angle +- + i * GRUB_TRIG_ANGLE_MAX / self->num_ticks; +- x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE); +- y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE); +- +- /* Adjust (x,y) so the tick is centered. */ +- x -= tick_width / 2; +- y -= tick_height / 2; +- +- /* Draw the tick. */ +- grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND, +- x, y, 0, 0, tick_width, tick_height); ++ int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1; ++ unsigned nticks; ++ unsigned tick_begin; ++ unsigned tick_end; ++ if (self->end <= self->start ++ || self->value <= self->start) ++ nticks = 0; ++ else ++ nticks = ((unsigned) (self->num_ticks ++ * (self->value - self->start))) ++ / ((unsigned) (self->end - self->start)); ++ /* Do ticks appear or disappear as the value approached the end? */ ++ if (self->ticks_disappear) ++ { ++ tick_begin = nticks; ++ tick_end = self->num_ticks; ++ } ++ else ++ { ++ tick_begin = 0; ++ tick_end = nticks; ++ } ++ ++ unsigned i; ++ for (i = tick_begin; i < tick_end; i++) ++ { ++ int x; ++ int y; ++ int angle; ++ ++ /* Calculate the location of the tick. */ ++ angle = self->start_angle ++ + i * GRUB_TRIG_ANGLE_MAX / self->num_ticks; ++ x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE); ++ y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE); ++ ++ /* Adjust (x,y) so the tick is centered. */ ++ x -= tick_width / 2; ++ y -= tick_height / 2; ++ ++ /* Draw the tick. */ ++ grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND, ++ x, y, 0, 0, tick_width, tick_height); ++ } + } +- + grub_gui_restore_viewport (&vpsave); + } + +diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c +index 5d26811..01477cd 100644 +--- a/grub-core/gfxmenu/gui_list.c ++++ b/grub-core/gfxmenu/gui_list.c +@@ -131,6 +131,9 @@ get_num_shown_items (list_impl_t self) + int max_top_pad = grub_max (item_top_pad, sel_top_pad); + int max_bottom_pad = grub_max (item_bottom_pad, sel_bottom_pad); + ++ if (item_height + item_vspace <= 0) ++ return 1; ++ + return (self->bounds.height + item_vspace - 2 * boxpad + - max_top_pad - max_bottom_pad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); +diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c +index 3501b01..b128f08 100644 +--- a/grub-core/gfxmenu/gui_progress_bar.c ++++ b/grub-core/gfxmenu/gui_progress_bar.c +@@ -118,9 +118,15 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self) + f.width + 2, f.height + 2); + + /* Bar background. */ +- int barwidth = (f.width +- * (self->value - self->start) +- / (self->end - self->start)); ++ unsigned barwidth; ++ ++ if (self->end <= self->start ++ || self->value <= self->start) ++ barwidth = 0; ++ else ++ barwidth = (f.width ++ * (self->value - self->start) ++ / (self->end - self->start)); + grub_video_fill_rect (grub_video_map_rgba_color (self->bg_color), + f.x + barwidth, f.y, + f.width - barwidth, f.height); +diff --git a/grub-core/gfxmenu/icon_manager.c b/grub-core/gfxmenu/icon_manager.c +index ff49ab0..1894682 100644 +--- a/grub-core/gfxmenu/icon_manager.c ++++ b/grub-core/gfxmenu/icon_manager.c +@@ -106,8 +106,10 @@ grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr, + const char *path) + { + /* Clear the cache if the theme path has changed. */ +- if (((mgr->theme_path == 0) != (path == 0)) +- || (grub_strcmp (mgr->theme_path, path) != 0)) ++ if (mgr->theme_path == 0 && path == 0) ++ return; ++ if (mgr->theme_path == 0 || path == 0 ++ || grub_strcmp (mgr->theme_path, path) != 0) + grub_gfxmenu_icon_manager_clear_cache (mgr); + + grub_free (mgr->theme_path); +diff --git a/grub-core/gfxmenu/theme_loader.c b/grub-core/gfxmenu/theme_loader.c +index 8a79458..1a6ed1d 100644 +--- a/grub-core/gfxmenu/theme_loader.c ++++ b/grub-core/gfxmenu/theme_loader.c +@@ -774,6 +774,8 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path) + view->canvas->component.ops->destroy (view->canvas); + + view->canvas = grub_gui_canvas_new (); ++ if (!view->canvas) ++ goto fail; + ((grub_gui_component_t) view->canvas) + ->ops->set_bounds ((grub_gui_component_t) view->canvas, + &view->screen); +diff --git a/grub-core/gmodule.pl.in b/grub-core/gmodule.pl.in +index 6739a6f..78aa1e6 100644 +--- a/grub-core/gmodule.pl.in ++++ b/grub-core/gmodule.pl.in +@@ -23,7 +23,7 @@ while (<>) { + } + + print " -s $2 $sections{$1}" +- if ($sections{$1} ne '0x0'); ++ if ($sections{$1} ne '0x0' and $sections{$1} ne ''); + }; + close (READELF); + print "\n"; +diff --git a/grub-core/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c +index 2914f47..b9be63f 100644 +--- a/grub-core/gnulib/argp-help.c ++++ b/grub-core/gnulib/argp-help.c +@@ -1,5 +1,5 @@ + /* Hierarchical argument parsing help output +- Copyright (C) 1995-2005, 2007, 2009-2013 Free Software Foundation, Inc. ++ Copyright (C) 1995-2005, 2007, 2009-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +@@ -650,7 +650,7 @@ hol_find_entry (struct hol *hol, const char *name) + return 0; + } + +-/* If an entry with the long option NAME occurs in HOL, set it's special ++/* If an entry with the long option NAME occurs in HOL, set its special + sort position to GROUP. */ + static void + hol_set_group (struct hol *hol, const char *name, int group) +@@ -1507,11 +1507,15 @@ argp_doc (const struct argp *argp, const struct argp_state *state, + if (vt) + { + if (post) +- inp_text = vt + 1; ++ { ++ inp_text = vt + 1; ++ if (! *inp_text) ++ inp_text = 0; ++ } + else + { + inp_text_len = vt - argp->doc; +- inp_text = __strndup (argp->doc, inp_text_len); ++ inp_text = inp_text_len ? __strndup (argp->doc, inp_text_len) : 0; + } + } + else +diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c +index 129209e..0f2ea6b 100644 +--- a/grub-core/io/gzio.c ++++ b/grub-core/io/gzio.c +@@ -1161,6 +1161,19 @@ grub_gzio_open (grub_file_t io, const char *name __attribute__ ((unused))) + return file; + } + ++static grub_uint8_t ++mod_31 (grub_uint16_t v) ++{ ++ /* At most 2 iterations for any number that ++ we can get here. ++ In any case faster than real division. */ ++ while (v > 0x1f) ++ v = (v & 0x1f) + (v >> 5); ++ if (v == 0x1f) ++ return 0; ++ return v; ++} ++ + static int + test_zlib_header (grub_gzio_t gzio) + { +@@ -1178,7 +1191,10 @@ test_zlib_header (grub_gzio_t gzio) + return 0; + } + +- if ((cmf * 256U + flg) % 31U) ++ /* Usually it would be: (cmf * 256 + flg) % 31 != 0. */ ++ /* But 256 == 8 (31). */ ++ /* By multiplying by 4 and using 32 == 1 (31). We get our formula. */ ++ if (mod_31 (cmf + flg * 4) != 0) + { + grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, N_("unsupported gzip format")); + return 0; +diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c +index de2ea67..7559c6c 100644 +--- a/grub-core/io/lzopio.c ++++ b/grub-core/io/lzopio.c +@@ -403,8 +403,6 @@ test_header (grub_file_t file) + return 1; + + CORRUPTED: +- grub_free(name); +- + return 0; + } + +diff --git a/grub-core/kern/arm/cache_armv6.S b/grub-core/kern/arm/cache_armv6.S +index 39da1df..dfaded0 100644 +--- a/grub-core/kern/arm/cache_armv6.S ++++ b/grub-core/kern/arm/cache_armv6.S +@@ -22,7 +22,6 @@ + .text + .syntax unified + .arm +- .arch armv6 + + # define DMB mcr p15, 0, r0, c7, c10, 5 + # define DSB mcr p15, 0, r0, c7, c10, 4 +diff --git a/grub-core/kern/arm/misc.S b/grub-core/kern/arm/compiler-rt.S +similarity index 79% +rename from grub-core/kern/arm/misc.S +rename to grub-core/kern/arm/compiler-rt.S +index 8943cc3..645b42f 100644 +--- a/grub-core/kern/arm/misc.S ++++ b/grub-core/kern/arm/compiler-rt.S +@@ -58,25 +58,22 @@ FUNCTION(__aeabi_lmul) + ldmfd sp!, {r4, fp} + bx lr + +- .macro division parent ++ .macro division32 parent + +- stmfd sp!, {lr} +- sub sp, sp, #12 +- mov r2, r1 +- add r1, sp, #4 +- str r1, [sp, #0] +- mov r1, #0 +- mov r3, #0 ++ sub sp, sp, #8 @ Allocate naturally aligned 64-bit space ++ stmfd sp!, {r3,lr} @ Dummy r3 to maintain stack alignment ++ add r2, sp, #8 @ Set r2 to address of 64-bit space + bl \parent +- ldr r1, [sp, #4] +- add sp, sp, #12 +- ldmfd sp!, {lr} ++ ldr r1, [sp, #8] @ Extract remainder ++ ldmfd sp!, {r3,lr} @ Pop into an unused arg/scratch register ++ add sp, sp, #8 + bx lr + .endm + + FUNCTION(__aeabi_uidivmod) +- division grub_divmod64 +- ++ division32 grub_divmod32 ++FUNCTION(__aeabi_idivmod) ++ division32 grub_divmod32s + + /* + * Null divide-by-zero handler +diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c +index 57cac2e..24364e1 100644 +--- a/grub-core/kern/arm/dl.c ++++ b/grub-core/kern/arm/dl.c +@@ -78,9 +78,9 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, + const Elf_Rel *rel, *max; + + for (rel = (const Elf_Rel *) ((grub_addr_t) e + s->sh_offset), +- max = rel + s->sh_size / s->sh_entsize; +- rel < max; +- rel++) ++ max = (const Elf_Rel *) ((grub_addr_t) rel + s->sh_size); ++ rel + 1 <= max; ++ rel = (const Elf_Rel *) ((grub_addr_t) rel + s->sh_entsize)) + switch (ELF_R_TYPE (rel->r_info)) + { + case R_ARM_CALL: +@@ -205,6 +205,21 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + */ + case R_ARM_V4BX: + break; ++ case R_ARM_THM_MOVW_ABS_NC: ++ case R_ARM_THM_MOVT_ABS: ++ { ++ grub_uint32_t offset; ++ offset = grub_arm_thm_movw_movt_get_value((grub_uint16_t *) target); ++ offset += sym_addr; ++ ++ if (ELF_R_TYPE (rel->r_info) == R_ARM_THM_MOVT_ABS) ++ offset >>= 16; ++ else ++ offset &= 0xffff; ++ ++ grub_arm_thm_movw_movt_set_value((grub_uint16_t *) target, offset); ++ } ++ break; + case R_ARM_THM_JUMP19: + { + /* Thumb instructions can be 16-bit aligned */ +diff --git a/grub-core/kern/arm/dl_helper.c b/grub-core/kern/arm/dl_helper.c +index 5721939..21d77f7 100644 +--- a/grub-core/kern/arm/dl_helper.c ++++ b/grub-core/kern/arm/dl_helper.c +@@ -25,6 +25,20 @@ + #include + #include + ++static inline grub_uint32_t ++thumb_get_instruction_word (grub_uint16_t *target) ++{ ++ /* Extract instruction word in alignment-safe manner */ ++ return grub_le_to_cpu16 ((*target)) << 16 | grub_le_to_cpu16 (*(target + 1)); ++} ++ ++static inline void ++thumb_set_instruction_word (grub_uint16_t *target, grub_uint32_t insword) ++{ ++ *target = grub_cpu_to_le16 (insword >> 16); ++ *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); ++} ++ + /* + * R_ARM_ABS32 + * +@@ -56,9 +70,7 @@ grub_arm_thm_call_get_offset (grub_uint16_t *target) + grub_uint32_t insword; + grub_int32_t offset; + +- /* Extract instruction word in alignment-safe manner */ +- insword = (grub_le_to_cpu16 (*target) << 16) +- | (grub_le_to_cpu16(*(target + 1))); ++ insword = thumb_get_instruction_word (target); + + /* Extract bitfields from instruction words */ + sign = (insword >> 26) & 1; +@@ -83,9 +95,7 @@ grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset) + grub_uint32_t insword; + int is_blx; + +- /* Extract instruction word in alignment-safe manner */ +- insword = (grub_le_to_cpu16 (*target) << 16) +- | (grub_le_to_cpu16(*(target + 1))); ++ insword = thumb_get_instruction_word (target); + + if (((insword >> 12) & 0xd) == 0xc) + is_blx = 1; +@@ -108,9 +118,7 @@ grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset) + (((offset >> 12) & 0x03ff) << 16) | + (j1 << 13) | (j2 << 11) | ((offset >> 1) & 0x07ff); + +- /* Write instruction word back in alignment-safe manner */ +- *target = grub_cpu_to_le16 ((insword >> 16) & 0xffff); +- *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); ++ thumb_set_instruction_word (target, insword); + + grub_dprintf ("dl", " *insword = 0x%08x", insword); + +@@ -123,9 +131,7 @@ grub_arm_thm_jump19_get_offset (grub_uint16_t *target) + grub_int32_t offset; + grub_uint32_t insword; + +- /* Extract instruction word in alignment-safe manner */ +- insword = (grub_le_to_cpu16 (*target) << 16) +- | (grub_le_to_cpu16(*(target + 1))); ++ insword = thumb_get_instruction_word (target); + + /* Extract and sign extend offset */ + offset = ((insword >> 26) & 1) << 19 +@@ -149,9 +155,7 @@ grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset) + offset >>= 1; + offset &= 0xfffff; + +- /* Extract instruction word in alignment-safe manner */ +- insword = grub_le_to_cpu16 ((*target)) << 16 +- | grub_le_to_cpu16 (*(target + 1)); ++ insword = thumb_get_instruction_word (target); + + /* Reassemble instruction word and write back */ + insword &= insmask; +@@ -160,8 +164,7 @@ grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset) + | ((offset >> 17) & 1) << 13 + | ((offset >> 11) & 0x3f) << 16 + | (offset & 0x7ff); +- *target = grub_cpu_to_le16 (insword >> 16); +- *(target + 1) = grub_cpu_to_le16 (insword & 0xffff); ++ thumb_set_instruction_word (target, insword); + } + + int +@@ -172,6 +175,32 @@ grub_arm_thm_jump19_check_offset (grub_int32_t offset) + return 1; + } + ++grub_uint16_t ++grub_arm_thm_movw_movt_get_value (grub_uint16_t *target) ++{ ++ grub_uint32_t insword; ++ ++ insword = thumb_get_instruction_word (target); ++ ++ return ((insword & 0xf0000) >> 4) | ((insword & 0x04000000) >> 15) | \ ++ ((insword & 0x7000) >> 4) | (insword & 0xff); ++} ++ ++void ++grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value) ++{ ++ grub_uint32_t insword; ++ const grub_uint32_t insmask = 0xfbf08f00; ++ ++ insword = thumb_get_instruction_word (target); ++ insword &= insmask; ++ ++ insword |= ((value & 0xf000) << 4) | ((value & 0x0800) << 15) | \ ++ ((value & 0x0700) << 4) | (value & 0xff); ++ ++ thumb_set_instruction_word (target, insword); ++} ++ + + /*********************************************************** + * ARM (A32) relocations: * +diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c +index a6ae034..2572ca8 100644 +--- a/grub-core/kern/arm/efi/init.c ++++ b/grub-core/kern/arm/efi/init.c +@@ -67,7 +67,7 @@ grub_machine_fini (int flags) + + b = grub_efi_system_table->boot_services; + +- efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0); ++ efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0); + efi_call_1 (b->close_event, tmr_evt); + + grub_efi_fini (); +diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-rt.c +new file mode 100644 +index 0000000..d4cc155 +--- /dev/null ++++ b/grub-core/kern/compiler-rt.c +@@ -0,0 +1,404 @@ ++/* compiler-rt.c - compiler helpers. */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 1999,2000,2001,2002,2003,2004,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 . ++ */ ++ ++#include ++#include ++ ++#ifndef GRUB_EMBED_DECOMPRESSOR ++void * GRUB_BUILTIN_ATTR ++memcpy (void *dest, const void *src, grub_size_t n) ++{ ++ return grub_memmove (dest, src, n); ++} ++void * GRUB_BUILTIN_ATTR ++memmove (void *dest, const void *src, grub_size_t n) ++{ ++ return grub_memmove (dest, src, n); ++} ++int GRUB_BUILTIN_ATTR ++memcmp (const void *s1, const void *s2, grub_size_t n) ++{ ++ return grub_memcmp (s1, s2, n); ++} ++void * GRUB_BUILTIN_ATTR ++memset (void *s, int c, grub_size_t n) ++{ ++ return grub_memset (s, c, n); ++} ++ ++#ifdef __APPLE__ ++ ++void GRUB_BUILTIN_ATTR ++__bzero (void *s, grub_size_t n) ++{ ++ grub_memset (s, 0, n); ++} ++ ++#endif ++ ++#if GRUB_DIVISION_IN_SOFTWARE ++ ++grub_uint32_t ++__udivsi3 (grub_uint32_t a, grub_uint32_t b) ++{ ++ return grub_divmod64 (a, b, 0); ++} ++ ++grub_int32_t ++__divsi3 (grub_int32_t a, grub_int32_t b) ++{ ++ return grub_divmod64s (a, b, 0); ++} ++ ++grub_uint32_t ++__umodsi3 (grub_uint32_t a, grub_uint32_t b) ++{ ++ grub_uint64_t ret; ++ grub_divmod64 (a, b, &ret); ++ return ret; ++} ++ ++grub_int32_t ++__modsi3 (grub_int32_t a, grub_int32_t b) ++{ ++ grub_int64_t ret; ++ grub_divmod64s (a, b, &ret); ++ return ret; ++} ++ ++grub_uint64_t ++__udivdi3 (grub_uint64_t a, grub_uint64_t b) ++{ ++ return grub_divmod64 (a, b, 0); ++} ++ ++grub_uint64_t ++__umoddi3 (grub_uint64_t a, grub_uint64_t b) ++{ ++ grub_uint64_t ret; ++ grub_divmod64 (a, b, &ret); ++ return ret; ++} ++ ++grub_int64_t ++__divdi3 (grub_int64_t a, grub_int64_t b) ++{ ++ return grub_divmod64s (a, b, 0); ++} ++ ++grub_int64_t ++__moddi3 (grub_int64_t a, grub_int64_t b) ++{ ++ grub_int64_t ret; ++ grub_divmod64s (a, b, &ret); ++ return ret; ++} ++ ++#endif ++ ++#endif ++ ++#ifdef NEED_CTZDI2 ++ ++unsigned ++__ctzdi2 (grub_uint64_t x) ++{ ++ unsigned ret = 0; ++ if (!x) ++ return 64; ++ if (!(x & 0xffffffff)) ++ { ++ x >>= 32; ++ ret |= 32; ++ } ++ if (!(x & 0xffff)) ++ { ++ x >>= 16; ++ ret |= 16; ++ } ++ if (!(x & 0xff)) ++ { ++ x >>= 8; ++ ret |= 8; ++ } ++ if (!(x & 0xf)) ++ { ++ x >>= 4; ++ ret |= 4; ++ } ++ if (!(x & 0x3)) ++ { ++ x >>= 2; ++ ret |= 2; ++ } ++ if (!(x & 0x1)) ++ { ++ x >>= 1; ++ ret |= 1; ++ } ++ return ret; ++} ++#endif ++ ++#ifdef NEED_CTZSI2 ++unsigned ++__ctzsi2 (grub_uint32_t x) ++{ ++ unsigned ret = 0; ++ if (!x) ++ return 32; ++ ++ if (!(x & 0xffff)) ++ { ++ x >>= 16; ++ ret |= 16; ++ } ++ if (!(x & 0xff)) ++ { ++ x >>= 8; ++ ret |= 8; ++ } ++ if (!(x & 0xf)) ++ { ++ x >>= 4; ++ ret |= 4; ++ } ++ if (!(x & 0x3)) ++ { ++ x >>= 2; ++ ret |= 2; ++ } ++ if (!(x & 0x1)) ++ { ++ x >>= 1; ++ ret |= 1; ++ } ++ return ret; ++} ++ ++#endif ++ ++ ++#if defined (__clang__) && !defined(GRUB_EMBED_DECOMPRESSOR) ++/* clang emits references to abort(). */ ++void __attribute__ ((noreturn)) ++abort (void) ++{ ++ grub_fatal ("compiler abort"); ++} ++#endif ++ ++#if (defined (__MINGW32__) || defined (__CYGWIN__)) ++void __register_frame_info (void) ++{ ++} ++ ++void __deregister_frame_info (void) ++{ ++} ++ ++void ___chkstk_ms (void) ++{ ++} ++ ++void __chkstk_ms (void) ++{ ++} ++#endif ++ ++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__) || defined (__arm__) || defined(__mips__) ++ ++/* 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 = ((grub_int32_t) uu.high) >> (32 - 1); ++ w.low = ((grub_int32_t) uu.high) >> -bm; ++ } ++ else ++ { ++ const grub_uint32_t carries = ((grub_uint32_t) uu.high) << bm; ++ ++ w.high = ((grub_int32_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 ++__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; ++} ++ ++/* 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; ++} ++ ++#endif ++ ++#if defined (__powerpc__) || defined(__mips__) || defined(__sparc__) || defined(__arm__) ++ ++/* Based on libgcc2.c from gcc suite. */ ++grub_uint32_t ++__bswapsi2 (grub_uint32_t u) ++{ ++ return ((((u) & 0xff000000) >> 24) ++ | (((u) & 0x00ff0000) >> 8) ++ | (((u) & 0x0000ff00) << 8) ++ | (((u) & 0x000000ff) << 24)); ++} ++ ++/* Based on libgcc2.c from gcc suite. */ ++grub_uint64_t ++__bswapdi2 (grub_uint64_t u) ++{ ++ return ((((u) & 0xff00000000000000ull) >> 56) ++ | (((u) & 0x00ff000000000000ull) >> 40) ++ | (((u) & 0x0000ff0000000000ull) >> 24) ++ | (((u) & 0x000000ff00000000ull) >> 8) ++ | (((u) & 0x00000000ff000000ull) << 8) ++ | (((u) & 0x0000000000ff0000ull) << 24) ++ | (((u) & 0x000000000000ff00ull) << 40) ++ | (((u) & 0x00000000000000ffull) << 56)); ++} ++ ++ ++#endif ++ ++#ifdef __arm__ ++grub_uint32_t ++__aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) ++ __attribute__ ((alias ("__udivsi3"))); ++grub_int32_t ++__aeabi_idiv (grub_int32_t a, grub_int32_t b) ++ __attribute__ ((alias ("__divsi3"))); ++void *__aeabi_memcpy (void *dest, const void *src, grub_size_t n) ++ __attribute__ ((alias ("grub_memcpy"))); ++void *__aeabi_memset (void *s, int c, grub_size_t n) ++ __attribute__ ((alias ("memset"))); ++ ++int ++__aeabi_ulcmp (grub_uint64_t a, grub_uint64_t b) ++{ ++ return __ucmpdi2 (a, b) - 1; ++} ++ ++grub_uint64_t ++__aeabi_lasr (grub_uint64_t u, int b) ++ __attribute__ ((alias ("__ashrdi3"))); ++grub_uint64_t ++__aeabi_llsr (grub_uint64_t u, int b) ++ __attribute__ ((alias ("__lshrdi3"))); ++ ++grub_uint64_t ++__aeabi_llsl (grub_uint64_t u, int b) ++ __attribute__ ((alias ("__ashldi3"))); ++ ++#endif +diff --git a/grub-core/kern/disk_common.c b/grub-core/kern/disk_common.c +index fb19778..2ca12b5 100644 +--- a/grub-core/kern/disk_common.c ++++ b/grub-core/kern/disk_common.c +@@ -7,6 +7,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, + grub_off_t *offset, grub_size_t size) + { + grub_partition_t part; ++ grub_disk_addr_t total_sectors; ++ + *sector += *offset >> GRUB_DISK_SECTOR_BITS; + *offset &= GRUB_DISK_SECTOR_SIZE - 1; + +@@ -27,12 +29,20 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, + *sector += start; + } + +- if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN +- && ((disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) <= *sector +- || ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) +- >> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors +- << (disk->log_sector_size +- - GRUB_DISK_SECTOR_BITS)) - *sector)) ++ /* Transform total_sectors to number of 512B blocks. */ ++ total_sectors = disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); ++ ++ /* Some drivers have problems with disks above reasonable. ++ Treat unknown as 1EiB disk. While on it, clamp the size to 1EiB. ++ Just one condition is enough since GRUB_DISK_UNKNOWN_SIZE << ls is always ++ above 9EiB. ++ */ ++ if (total_sectors > (1ULL << 51)) ++ total_sectors = (1ULL << 51); ++ ++ if ((total_sectors <= *sector ++ || ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) ++ >> GRUB_DISK_SECTOR_BITS) > total_sectors - *sector)) + return grub_error (GRUB_ERR_OUT_OF_RANGE, + N_("attempt to read or write outside of disk `%s'"), disk->name); + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 6850e04..3a438e9 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -340,7 +340,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) + mod->symtab = grub_malloc (s->sh_size); + if (!mod->symtab) + return grub_errno; +- memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size); ++ grub_memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size); + #else + mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset); + #endif +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index b253141..2e77834 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + /* The handle of GRUB itself. Filled in by the startup code. */ + grub_efi_handle_t grub_efi_image_handle; +@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) + void + grub_exit (void) + { +- grub_efi_fini (); ++ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); + efi_call_4 (grub_efi_system_table->boot_services->exit, + grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0); + for (;;) ; +@@ -309,7 +310,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 +329,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 +357,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 +371,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; + } +@@ -385,6 +395,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/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index 942ab02..e9c85de 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -63,10 +63,13 @@ grub_machine_get_bootlocation (char **device, char **path) + if (!*device && grub_efi_net_config) + grub_efi_net_config (image->device_handle, device, path); + +- /* Get the directory. */ +- p = grub_strrchr (*path, '/'); +- if (p) +- *p = '\0'; ++ if (*path) ++ { ++ /* Get the directory. */ ++ p = grub_strrchr (*path, '/'); ++ if (p) ++ *p = '\0'; ++ } + } + + void +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index be37afd..20a47aa 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -230,6 +230,7 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size, + grub_efi_boot_services_t *b; + grub_efi_uintn_t key; + grub_efi_uint32_t version; ++ grub_efi_uintn_t size; + + if (grub_efi_is_finished) + { +@@ -259,10 +260,14 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size, + map_key = &key; + if (! descriptor_version) + descriptor_version = &version; ++ if (! descriptor_size) ++ descriptor_size = &size; + + b = grub_efi_system_table->boot_services; + status = efi_call_5 (b->get_memory_map, memory_map_size, memory_map, map_key, + descriptor_size, descriptor_version); ++ if (*descriptor_size == 0) ++ *descriptor_size = sizeof (grub_efi_memory_descriptor_t); + if (status == GRUB_EFI_SUCCESS) + return 1; + else if (status == GRUB_EFI_BUFFER_TOO_SMALL) +diff --git a/grub-core/kern/emu/cache.c b/grub-core/kern/emu/cache.c +index 07be675..6f89e87 100644 +--- a/grub-core/kern/emu/cache.c ++++ b/grub-core/kern/emu/cache.c +@@ -8,7 +8,7 @@ + #include "../ia64/cache.c" + #elif defined (__arm__) || defined (__aarch64__) + +-void __clear_cache (char *beg, char *end); ++void __clear_cache (void *beg, void *end); + + void + grub_arch_sync_caches (void *address, grub_size_t len) +diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c +index 44b0fcb..610518d 100644 +--- a/grub-core/kern/emu/hostdisk.c ++++ b/grub-core/kern/emu/hostdisk.c +@@ -99,7 +99,7 @@ find_free_slot (void) + { + unsigned int i; + +- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) ++ for (i = 0; i < ARRAY_SIZE (map); i++) + if (! map[i].drive) + return i; + +@@ -115,7 +115,7 @@ grub_util_biosdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, + if (pull != GRUB_DISK_PULL_NONE) + return 0; + +- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) ++ for (i = 0; i < ARRAY_SIZE (map); i++) + if (map[i].drive && hook (map[i].drive, hook_data)) + return 1; + +@@ -184,7 +184,7 @@ grub_hostdisk_os_dev_to_grub_drive (const char *os_disk, int add) + unsigned int i; + char *canon; + +- canon = canonicalize_file_name (os_disk); ++ canon = grub_canonicalize_file_name (os_disk); + if (!canon) + canon = xstrdup (os_disk); + +@@ -422,7 +422,7 @@ read_device_map (const char *dev_map) + char buf[1024]; /* XXX */ + int lineno = 0; + +- if (dev_map[0] == '\0') ++ if (!dev_map || dev_map[0] == '\0') + { + grub_util_info ("no device.map"); + return; +@@ -535,7 +535,7 @@ read_device_map (const char *dev_map) + /* On Linux, the devfs uses symbolic links horribly, and that + confuses the interface very much, so use realpath to expand + symbolic links. */ +- map[drive].device = canonicalize_file_name (p); ++ map[drive].device = grub_canonicalize_file_name (p); + if (! map[drive].device) + map[drive].device = xstrdup (p); + +@@ -581,7 +581,7 @@ grub_util_biosdisk_fini (void) + { + unsigned i; + +- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) ++ for (i = 0; i < ARRAY_SIZE(map); i++) + { + if (map[i].drive) + free (map[i].drive); +diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c +index 7e725f6..7b28c00 100644 +--- a/grub-core/kern/emu/hostfs.c ++++ b/grub-core/kern/emu/hostfs.c +@@ -19,7 +19,6 @@ + + #include + +-#define _BSD_SOURCE + #include + #include + #include +diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c +index 43471b4..bb606da 100644 +--- a/grub-core/kern/emu/misc.c ++++ b/grub-core/kern/emu/misc.c +@@ -20,7 +20,6 @@ + #include + + #include +-#include + #include + #include + #include +diff --git a/grub-core/kern/generic/rtc_get_time_ms.c b/grub-core/kern/generic/rtc_get_time_ms.c +index 49f2aca..3e39c8f 100644 +--- a/grub-core/kern/generic/rtc_get_time_ms.c ++++ b/grub-core/kern/generic/rtc_get_time_ms.c +@@ -34,5 +34,5 @@ grub_rtc_get_time_ms (void) + 1 s 1 T rtc ticks + */ + grub_uint64_t ticks_ms_per_sec = ((grub_uint64_t) 1000) * grub_get_rtc (); +- return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND, 0); ++ return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND ? : 1000, 0); + } +diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c +index e3bb7b2..1669bc0 100644 +--- a/grub-core/kern/i386/coreboot/cbtable.c ++++ b/grub-core/kern/i386/coreboot/cbtable.c +@@ -55,7 +55,7 @@ grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, + if (check_signature (table_header)) + goto signature_found; + +- grub_fatal ("Could not find coreboot table\n"); ++ return 0; + + signature_found: + +diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c +index 6b150b4..3314f02 100644 +--- a/grub-core/kern/i386/coreboot/init.c ++++ b/grub-core/kern/i386/coreboot/init.c +@@ -51,6 +51,7 @@ grub_exit (void) + + grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; + static grub_uint64_t modend; ++static int have_memory = 0; + + /* Helper for grub_machine_init. */ + static int +@@ -82,6 +83,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + + grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin)); + ++ have_memory = 1; ++ + return 0; + } + +@@ -97,6 +100,8 @@ grub_machine_init (void) + grub_vga_text_init (); + + grub_machine_mmap_iterate (heap_init, NULL); ++ if (!have_memory) ++ grub_fatal ("No memory found"); + + grub_video_coreboot_fb_late_init (); + +diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c +index 1197975..4d29f6b 100644 +--- a/grub-core/kern/i386/coreboot/mmap.c ++++ b/grub-core/kern/i386/coreboot/mmap.c +@@ -44,18 +44,44 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + mem_region = + (mem_region_t) ((long) table_item + + sizeof (struct grub_linuxbios_table_item)); +- while ((long) mem_region < (long) table_item + (long) table_item->size) ++ for (; (long) mem_region < (long) table_item + (long) table_item->size; ++ mem_region++) + { +- if (ctx->hook (mem_region->addr, mem_region->size, ++ grub_uint64_t start = mem_region->addr; ++ grub_uint64_t end = mem_region->addr + mem_region->size; ++ /* Mark region 0xa0000 - 0x100000 as reserved. */ ++ if (start < 0x100000 && end >= 0xa0000 ++ && mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE) ++ { ++ if (start < 0xa0000 ++ && ctx->hook (start, 0xa0000 - start, ++ /* Multiboot mmaps match with the coreboot mmap ++ definition. Therefore, we can just pass type ++ through. */ ++ mem_region->type, ++ ctx->hook_data)) ++ return 1; ++ if (start < 0xa0000) ++ start = 0xa0000; ++ if (start >= end) ++ continue; ++ ++ if (ctx->hook (start, (end > 0x100000 ? 0x100000 : end) - start, ++ GRUB_MEMORY_RESERVED, ++ ctx->hook_data)) ++ return 1; ++ start = 0x100000; ++ ++ if (end <= start) ++ continue; ++ } ++ if (ctx->hook (start, end - start, + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- (((mem_region->type <= GRUB_MACHINE_MEMORY_BADRAM) && (mem_region->type >= GRUB_MACHINE_MEMORY_AVAILABLE)) +- || mem_region->type == GRUB_MEMORY_COREBOOT_TABLES) ? mem_region->type : GRUB_MEMORY_RESERVED, ++ mem_region->type, + ctx->hook_data)) + return 1; +- +- mem_region++; + } + + return 0; +diff --git a/grub-core/kern/i386/coreboot/startup.S b/grub-core/kern/i386/coreboot/startup.S +index 8c32838..c848654 100644 +--- a/grub-core/kern/i386/coreboot/startup.S ++++ b/grub-core/kern/i386/coreboot/startup.S +@@ -61,8 +61,3 @@ multiboot_header: + /* checksum */ + .long -0x1BADB002 - MULTIBOOT_MEMORY_INFO + +-/* +- * prot_to_real and associated structures (but NOT real_to_prot, that is +- * only needed for BIOS gates). +- */ +-#include "../realmode.S" +diff --git a/grub-core/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c +index 8009e83..c0c3c35 100644 +--- a/grub-core/kern/i386/pc/mmap.c ++++ b/grub-core/kern/i386/pc/mmap.c +@@ -141,33 +141,35 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry, + grub_err_t + grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) + { +- grub_uint32_t cont; ++ grub_uint32_t cont = 0; + struct grub_machine_mmap_entry *entry + = (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; ++ int e820_works = 0; + +- grub_memset (entry, 0, sizeof (entry)); ++ while (1) ++ { ++ grub_memset (entry, 0, sizeof (*entry)); + +- /* Check if grub_get_mmap_entry works. */ +- cont = grub_get_mmap_entry (entry, 0); ++ cont = grub_get_mmap_entry (entry, cont); + +- if (entry->size) +- do +- { +- if (hook (entry->addr, entry->len, +- /* GRUB mmaps have been defined to match with the E820 definition. +- Therefore, we can just pass type through. */ +- entry->type, hook_data)) +- break; ++ if (!entry->size) ++ break; + +- if (! cont) +- break; ++ if (entry->len) ++ e820_works = 1; ++ if (entry->len ++ && hook (entry->addr, entry->len, ++ /* GRUB mmaps have been defined to match with ++ the E820 definition. ++ Therefore, we can just pass type through. */ ++ entry->type, hook_data)) ++ break; + +- grub_memset (entry, 0, sizeof (entry)); ++ if (! cont) ++ break; ++ } + +- cont = grub_get_mmap_entry (entry, cont); +- } +- while (entry->size); +- else ++ if (!e820_works) + { + grub_uint32_t eisa_mmap = grub_get_eisa_mmap (); + +diff --git a/grub-core/kern/i386/pc/startup.S b/grub-core/kern/i386/pc/startup.S +index 6bb36c6..b8a9b33 100644 +--- a/grub-core/kern/i386/pc/startup.S ++++ b/grub-core/kern/i386/pc/startup.S +@@ -135,7 +135,7 @@ LOCAL(prot_to_real_addr): + + .macro REAL_TO_PROT + movl LOCAL(real_to_prot_addr), %eax +- DATA32 call *%ax ++ calll *%eax + .endm + + /* +diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S +index 3d47d1e..0d89858 100644 +--- a/grub-core/kern/i386/qemu/startup.S ++++ b/grub-core/kern/i386/qemu/startup.S +@@ -28,7 +28,7 @@ + _start: + jmp codestart + +- . = _start + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR ++ .org GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR + VARIABLE(grub_core_entry_addr) + .long 0 + +@@ -73,5 +73,3 @@ codestart: + 1: + hlt + jmp 1b +- +-#include "../realmode.S" +diff --git a/grub-core/kern/i386/realmode.S b/grub-core/kern/i386/realmode.S +index 541cedc..998fdc7 100644 +--- a/grub-core/kern/i386/realmode.S ++++ b/grub-core/kern/i386/realmode.S +@@ -54,7 +54,7 @@ protstack: + .endm + + .macro REAL_TO_PROT +- DATA32 call real_to_prot ++ calll real_to_prot + .endm + + /* +@@ -137,7 +137,22 @@ real_to_prot: + /* load the GDT register */ + xorw %ax, %ax + movw %ax, %ds +- DATA32 ADDR32 lgdt gdtdesc ++#ifdef GRUB_MACHINE_QEMU ++ /* ++ qemu is special: gdtdesc is in ROM. ++ %cs = 0xf000 ++ _start + GRUB_BOOT_MACHINE_SIZE = 0x100000 ++ So ++ _start + GRUB_BOOT_MACHINE_SIZE - 0x10000 points to the same point ++ as %cs. ++ gdtdesc - (_start + GRUB_BOOT_MACHINE_SIZE - 0x10000) ++ = gdtdesc - _start - GRUB_BOOT_MACHINE_SIZE + 0x10000 ++ but the later can be computed by assembly. ++ */ ++ lgdtl %cs:(gdtdesc - _start - GRUB_BOOT_MACHINE_SIZE + 0x10000) ++#else ++ lgdtl gdtdesc ++#endif + + /* turn on protected mode */ + movl %cr0, %eax +@@ -145,7 +160,7 @@ real_to_prot: + movl %eax, %cr0 + + /* jump to relocation, flush prefetch queue, and reload %cs */ +- DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg ++ ljmpl $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg + + .code32 + protcseg: +@@ -178,6 +193,9 @@ protcseg: + + /* return on the old (or initialized) stack! */ + ret ++ /* prot_to_real assumes that this code is under 64K which is not ++ true for qemu. */ ++#ifndef GRUB_MACHINE_QEMU + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2009,2010 Free Software Foundation, Inc. +@@ -237,7 +255,7 @@ tmpcseg: + movl %eax, %cr0 + + /* flush prefetch queue, reload %cs */ +- DATA32 ljmp $0, $realcseg ++ ljmpl $0, $realcseg + + realcseg: + /* we are in real mode now +@@ -258,6 +276,6 @@ realcseg: + #endif + + /* return on new stack! */ +- DATA32 ret +- ++ retl ++#endif + .code32 +diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c +index 3a4cae6..bc441d0 100644 +--- a/grub-core/kern/i386/tsc.c ++++ b/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) + { +@@ -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/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); +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/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c +index b4f50e4..3834a14 100644 +--- a/grub-core/kern/mips/arc/init.c ++++ b/grub-core/kern/mips/arc/init.c +@@ -360,7 +360,7 @@ grub_machine_get_bootlocation (char **device, char **path) + char *loaddev = boot_location; + char *pptr, *partptr; + char *dname; +- grub_disk_addr_t poff = -1, pend; ++ grub_disk_addr_t poff = -1, pend = -1; + struct get_device_name_ctx ctx; + grub_disk_t parent = 0; + unsigned i; +diff --git a/grub-core/kern/mips/cache.S b/grub-core/kern/mips/cache.S +index 78e40bc..e83960f 100644 +--- a/grub-core/kern/mips/cache.S ++++ b/grub-core/kern/mips/cache.S +@@ -1,8 +1,10 @@ + + #include ++#include + + .set noreorder + .set nomacro ++ mips_attributes + + FUNCTION (grub_arch_sync_caches) + #include "cache_flush.S" +@@ -65,4 +67,4 @@ FUNCTION (grub_arch_sync_dma_caches) + #endif + sync_op + +- jr $ra +\ No newline at end of file ++ jr $ra +diff --git a/grub-core/kern/mips/startup.S b/grub-core/kern/mips/startup.S +index 709a91a..337aca9 100644 +--- a/grub-core/kern/mips/startup.S ++++ b/grub-core/kern/mips/startup.S +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + + #define BASE_ADDR 8 +@@ -28,6 +29,7 @@ + .globl __start, _start, start + .set noreorder + .set nomacro ++ mips_attributes + __start: + _start: + start: +@@ -36,7 +38,7 @@ start: + bal cont + nop + +- . = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE ++ .org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE + VARIABLE(grub_total_modules_size) + .long 0 + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 54db2e1..906d2c2 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -95,25 +95,6 @@ grub_memmove (void *dest, const void *src, grub_size_t n) + return dest; + } + +-#ifndef __APPLE__ +-void *memmove (void *dest, const void *src, grub_size_t n) +- __attribute__ ((alias ("grub_memmove"))); +-/* GCC emits references to memcpy() for struct copies etc. */ +-void *memcpy (void *dest, const void *src, grub_size_t n) +- __attribute__ ((alias ("grub_memmove"))); +-#else +-void * GRUB_BUILTIN_ATTR +-memcpy (void *dest, const void *src, grub_size_t n) +-{ +- return grub_memmove (dest, src, n); +-} +-void * GRUB_BUILTIN_ATTR +-memmove (void *dest, const void *src, grub_size_t n) +-{ +- return grub_memmove (dest, src, n); +-} +-#endif +- + char * + grub_strcpy (char *dest, const char *src) + { +@@ -253,16 +234,6 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n) + + return 0; + } +-#ifndef __APPLE__ +-int memcmp (const void *s1, const void *s2, grub_size_t n) +- __attribute__ ((alias ("grub_memcmp"))); +-#else +-int GRUB_BUILTIN_ATTR +-memcmp (const void *s1, const void *s2, grub_size_t n) +-{ +- return grub_memcmp (s1, s2, n); +-} +-#endif + + int + grub_strcmp (const char *s1, const char *s2) +@@ -532,23 +503,6 @@ grub_memset (void *s, int c, grub_size_t len) + + return s; + } +-#ifndef __APPLE__ +-void *memset (void *s, int c, grub_size_t n) +- __attribute__ ((alias ("grub_memset"))); +-#else +-void * GRUB_BUILTIN_ATTR +-memset (void *s, int c, grub_size_t n) +-{ +- return grub_memset (s, c, n); +-} +- +-void GRUB_BUILTIN_ATTR +-__bzero (void *s, grub_size_t n) +-{ +- grub_memset (s, 0, n); +-} +- +-#endif + + grub_size_t + grub_strlen (const char *s) +@@ -591,10 +545,10 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) + grub_uint64_t m = 0; + + /* ARM and IA64 don't have a fast 32-bit division. +- Using that code would just make us use libgcc routines, calling +- them twice (once for modulo and once for quotient. ++ Using that code would just make us use software division routines, calling ++ ourselves indirectly and hence getting infinite recursion. + */ +-#if !defined (__arm__) && !defined (__ia64__) ++#if !GRUB_DIVISION_IN_SOFTWARE + /* Skip the slow computation if 32-bit arithmetic is possible. */ + if (n < 0xffffffff && d < 0xffffffff) + { +@@ -628,132 +582,6 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) + return q; + } + +-#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) +- +-#if defined (__arm__) +- +-grub_uint32_t +-__udivsi3 (grub_uint32_t a, grub_uint32_t b) +-{ +- return grub_divmod64 (a, b, 0); +-} +- +-grub_uint32_t +-__umodsi3 (grub_uint32_t a, grub_uint32_t b) +-{ +- grub_uint64_t ret; +- grub_divmod64 (a, b, &ret); +- return ret; +-} +- +-#endif +- +-#ifdef NEED_CTZDI2 +- +-unsigned +-__ctzdi2 (grub_uint64_t x) +-{ +- unsigned ret = 0; +- if (!x) +- return 64; +- if (!(x & 0xffffffff)) +- { +- x >>= 32; +- ret |= 32; +- } +- if (!(x & 0xffff)) +- { +- x >>= 16; +- ret |= 16; +- } +- if (!(x & 0xff)) +- { +- x >>= 8; +- ret |= 8; +- } +- if (!(x & 0xf)) +- { +- x >>= 4; +- ret |= 4; +- } +- if (!(x & 0x3)) +- { +- x >>= 2; +- ret |= 2; +- } +- if (!(x & 0x1)) +- { +- x >>= 1; +- ret |= 1; +- } +- return ret; +-} +-#endif +- +-#ifdef NEED_CTZSI2 +-unsigned +-__ctzsi2 (grub_uint32_t x) +-{ +- unsigned ret = 0; +- if (!x) +- return 32; +- +- if (!(x & 0xffff)) +- { +- x >>= 16; +- ret |= 16; +- } +- if (!(x & 0xff)) +- { +- x >>= 8; +- ret |= 8; +- } +- if (!(x & 0xf)) +- { +- x >>= 4; +- ret |= 4; +- } +- if (!(x & 0x3)) +- { +- x >>= 2; +- ret |= 2; +- } +- if (!(x & 0x1)) +- { +- x >>= 1; +- ret |= 1; +- } +- return ret; +-} +- +-#endif +- +-#ifdef __arm__ +-grub_uint32_t +-__aeabi_uidiv (grub_uint32_t a, grub_uint32_t b) +- __attribute__ ((alias ("__udivsi3"))); +-#endif +- +-#if defined (__ia64__) +- +-grub_uint64_t +-__udivdi3 (grub_uint64_t a, grub_uint64_t b) +-{ +- return grub_divmod64 (a, b, 0); +-} +- +-grub_uint64_t +-__umoddi3 (grub_uint64_t a, grub_uint64_t b) +-{ +- grub_uint64_t ret; +- grub_divmod64 (a, b, &ret); +- return ret; +-} +- +-#endif +- +-#endif /* GRUB_UTIL */ +- + /* Convert a long long value to a string. This function avoids 64-bit + modular arithmetic or divisions. */ + static inline char * +@@ -1262,15 +1090,6 @@ grub_abort (void) + grub_exit (); + } + +-#if defined (__clang__) && !defined (GRUB_UTIL) +-/* clang emits references to abort(). */ +-void __attribute__ ((noreturn)) +-abort (void) +-{ +- grub_abort (); +-} +-#endif +- + void + grub_fatal (const char *fmt, ...) + { +@@ -1283,23 +1102,6 @@ grub_fatal (const char *fmt, ...) + grub_abort (); + } + +-#if (defined (__MINGW32__) || defined (__CYGWIN__)) && !defined(GRUB_UTIL) +-void __register_frame_info (void) +-{ +-} +- +-void __deregister_frame_info (void) +-{ +-} +-void ___chkstk_ms (void) +-{ +-} +- +-void __chkstk_ms (void) +-{ +-} +-#endif +- + #if BOOT_TIME_STATS + + #include +diff --git a/grub-core/kern/powerpc/compiler-rt.S b/grub-core/kern/powerpc/compiler-rt.S +new file mode 100644 +index 0000000..b3b912d +--- /dev/null ++++ b/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 +diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S +index 79b6bb3..03b916f 100644 +--- a/grub-core/kern/sparc64/ieee1275/crt0.S ++++ b/grub-core/kern/sparc64/ieee1275/crt0.S +@@ -27,7 +27,7 @@ _start: + ba codestart + mov %o4, %o0 + +- . = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE ++ .org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE + + VARIABLE(grub_total_module_size) + .word 0 +diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c +index 6cb88bf..4406906 100644 +--- a/grub-core/kern/x86_64/dl.c ++++ b/grub-core/kern/x86_64/dl.c +@@ -73,7 +73,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + { + grub_int64_t value; + value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - +- (Elf64_Xword) seg->addr - rel->r_offset; ++ (Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset; + if (value != (grub_int32_t) value) + return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range"); + *addr32 = value; +@@ -83,7 +83,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + case R_X86_64_PC64: + { + *addr64 += rel->r_addend + sym->st_value - +- (Elf64_Xword) seg->addr - rel->r_offset; ++ (Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset; + } + break; + +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 --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c +index 8e8426c..010e550 100644 +--- a/grub-core/lib/crypto.c ++++ b/grub-core/lib/crypto.c +@@ -205,13 +205,16 @@ grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher, + { + const grub_uint8_t *inptr, *end; + grub_uint8_t *outptr; ++ grub_size_t blocksize; + if (!cipher->cipher->decrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) + return GPG_ERR_INV_ARG; + end = (const grub_uint8_t *) in + size; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + cipher->cipher->decrypt (cipher->ctx, outptr, inptr); + return GPG_ERR_NO_ERROR; + } +@@ -222,13 +225,16 @@ grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher, + { + const grub_uint8_t *inptr, *end; + grub_uint8_t *outptr; ++ grub_size_t blocksize; + if (!cipher->cipher->encrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) + return GPG_ERR_INV_ARG; + end = (const grub_uint8_t *) in + size; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + cipher->cipher->encrypt (cipher->ctx, outptr, inptr); + return GPG_ERR_NO_ERROR; + } +@@ -241,20 +247,23 @@ grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher, + grub_uint8_t *outptr; + const grub_uint8_t *inptr, *end; + void *iv; +- if (!cipher->cipher->decrypt) ++ grub_size_t blocksize; ++ if (!cipher->cipher->encrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) + return GPG_ERR_INV_ARG; + end = (const grub_uint8_t *) in + size; + iv = iv_in; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + { +- grub_crypto_xor (outptr, inptr, iv, cipher->cipher->blocksize); ++ grub_crypto_xor (outptr, inptr, iv, blocksize); + cipher->cipher->encrypt (cipher->ctx, outptr, outptr); + iv = outptr; + } +- grub_memcpy (iv_in, iv, cipher->cipher->blocksize); ++ grub_memcpy (iv_in, iv, blocksize); + return GPG_ERR_NO_ERROR; + } + +@@ -266,20 +275,23 @@ grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher, + const grub_uint8_t *inptr, *end; + grub_uint8_t *outptr; + grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; ++ grub_size_t blocksize; + if (!cipher->cipher->decrypt) + return GPG_ERR_NOT_SUPPORTED; +- if (size % cipher->cipher->blocksize != 0) ++ blocksize = cipher->cipher->blocksize; ++ if (blocksize == 0 || (((blocksize - 1) & blocksize) != 0) ++ || ((size & (blocksize - 1)) != 0)) + return GPG_ERR_INV_ARG; +- if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) ++ if (blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) + return GPG_ERR_INV_ARG; + end = (const grub_uint8_t *) in + size; + for (inptr = in, outptr = out; inptr < end; +- inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) ++ inptr += blocksize, outptr += blocksize) + { +- grub_memcpy (ivt, inptr, cipher->cipher->blocksize); ++ grub_memcpy (ivt, inptr, blocksize); + cipher->cipher->decrypt (cipher->ctx, outptr, inptr); +- grub_crypto_xor (outptr, outptr, iv, cipher->cipher->blocksize); +- grub_memcpy (iv, ivt, cipher->cipher->blocksize); ++ grub_crypto_xor (outptr, outptr, iv, blocksize); ++ grub_memcpy (iv, ivt, blocksize); + } + return GPG_ERR_NO_ERROR; + } +diff --git a/grub-core/lib/division.c b/grub-core/lib/division.c +new file mode 100644 +index 0000000..35606fe +--- /dev/null ++++ b/grub-core/lib/division.c +@@ -0,0 +1,74 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2015 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_uint64_t ++abs64(grub_int64_t a) ++{ ++ return a > 0 ? a : -a; ++} ++ ++grub_int64_t ++grub_divmod64s (grub_int64_t n, ++ grub_int64_t d, ++ grub_int64_t *ro) ++{ ++ grub_uint64_t ru; ++ grub_int64_t q, r; ++ q = grub_divmod64 (abs64(n), abs64(d), &ru); ++ r = ru; ++ /* Now: |n| = |d| * q + r */ ++ if (n < 0) ++ { ++ /* -|n| = |d| * (-q) + (-r) */ ++ q = -q; ++ r = -r; ++ } ++ /* Now: n = |d| * q + r */ ++ if (d < 0) ++ { ++ /* n = (-|d|) * (-q) + r */ ++ q = -q; ++ } ++ /* Now: n = d * q + r */ ++ if (ro) ++ *ro = r; ++ return q; ++} ++ ++grub_uint32_t ++grub_divmod32 (grub_uint32_t n, grub_uint32_t d, grub_uint32_t *ro) ++{ ++ grub_uint64_t q, r; ++ q = grub_divmod64 (n, d, &r); ++ *ro = r; ++ return q; ++} ++ ++grub_int32_t ++grub_divmod32s (grub_int32_t n, grub_int32_t d, grub_int32_t *ro) ++{ ++ grub_int64_t q, r; ++ q = grub_divmod64s (n, d, &r); ++ *ro = r; ++ return q; ++} +diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c +index 907a7bf..7e76dc0 100644 +--- a/grub-core/lib/fdt.c ++++ b/grub-core/lib/fdt.c +@@ -164,10 +164,10 @@ static int add_subnode (void *fdt, int parentoffset, const char *name) + insert: + grub_memmove (token + entry_size / sizeof(*token), token, + (grub_addr_t) end - (grub_addr_t) token); +- *token = grub_cpu_to_be32(FDT_BEGIN_NODE); ++ *token = grub_cpu_to_be32_compile_time(FDT_BEGIN_NODE); + token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */ + grub_strcpy((char *) (token + 1), name); +- token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE); ++ token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32_compile_time(FDT_END_NODE); + grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size); + return ((grub_addr_t) token - (grub_addr_t) fdt + - grub_fdt_get_off_dt_struct(fdt)); +@@ -377,7 +377,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, + + prop_name_present = 1; + for (i = 0; i < prop_len / sizeof(grub_uint32_t); i++) +- *(prop + 3 + i) = grub_cpu_to_be32 (FDT_NOP); ++ *(prop + 3 + i) = grub_cpu_to_be32_compile_time (FDT_NOP); + if (len > ALIGN_UP(prop_len, sizeof(grub_uint32_t))) + { + /* Length of new property value is greater than the space allocated +@@ -385,7 +385,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, + nameoff field of the current entry and replace the current entry + with NOP tokens. */ + nameoff = grub_be_to_cpu32 (*(prop + 2)); +- *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32 (FDT_NOP); ++ *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32_compile_time (FDT_NOP); + prop = NULL; + } + } +@@ -419,7 +419,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, + struct_end(fdt) - (grub_addr_t) prop); + grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt) + + prop_entry_size(len)); +- *prop = grub_cpu_to_be32 (FDT_PROP); ++ *prop = grub_cpu_to_be32_compile_time (FDT_PROP); + *(prop + 2) = grub_cpu_to_be32 (nameoff); + } + *(prop + 1) = grub_cpu_to_be32 (len); +@@ -447,7 +447,7 @@ grub_fdt_create_empty_tree (void *fdt, unsigned int size) + et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE); + et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE); + ((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap = +- grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8)); ++ grub_cpu_to_be32_compile_time (ALIGN_UP (sizeof (grub_fdt_header_t), 8)); + + grub_fdt_set_off_dt_strings (fdt, sizeof (*et)); + grub_fdt_set_off_dt_struct (fdt, +diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c +index d2a1b27..71dd4f0 100644 +--- a/grub-core/lib/i386/relocator.c ++++ b/grub-core/lib/i386/relocator.c +@@ -64,7 +64,6 @@ extern grub_uint64_t grub_relocator64_rbx; + extern grub_uint64_t grub_relocator64_rcx; + extern grub_uint64_t grub_relocator64_rdx; + extern grub_uint64_t grub_relocator64_rip; +-extern grub_uint64_t grub_relocator64_rip_addr; + extern grub_uint64_t grub_relocator64_rsp; + extern grub_uint64_t grub_relocator64_rsi; + extern grub_addr_t grub_relocator64_cr3; +@@ -81,10 +80,13 @@ grub_relocator32_boot (struct grub_relocator *rel, + void *relst; + grub_relocator_chunk_t ch; + +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, +- (0xffffffff - RELOCATOR_SIZEOF (32)) +- + 1, RELOCATOR_SIZEOF (32), 16, +- GRUB_RELOCATOR_PREFERENCE_NONE, ++ /* Specific memory range due to Global Descriptor Table for use by payload ++ that we will store in returned chunk. The address range and preference ++ are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */ ++ err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000, ++ 0x9a000 - RELOCATOR_SIZEOF (32), ++ RELOCATOR_SIZEOF (32), 16, ++ GRUB_RELOCATOR_PREFERENCE_LOW, + avoid_efi_bootservices); + if (err) + return err; +diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c +index 61266d9..ef56150 100644 +--- a/grub-core/lib/legacy_parse.c ++++ b/grub-core/lib/legacy_parse.c +@@ -664,6 +664,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix) + { + case TYPE_FILE_NO_CONSUME: + hold_arg = 1; ++ /* Fallthrough. */ + case TYPE_PARTITION: + case TYPE_FILE: + args[i] = adjust_file (curarg, curarglen); +diff --git a/grub-core/lib/mips/relocator_asm.S b/grub-core/lib/mips/relocator_asm.S +index 1d142a4..959893c 100644 +--- a/grub-core/lib/mips/relocator_asm.S ++++ b/grub-core/lib/mips/relocator_asm.S +@@ -17,11 +17,13 @@ + */ + + #include ++#include + + .p2align 4 /* force 16-byte alignment */ + + .set noreorder + .set nomacro ++ mips_attributes + + VARIABLE (grub_relocator_forward_start) + move $a0, $9 +diff --git a/grub-core/lib/pbkdf2.c b/grub-core/lib/pbkdf2.c +index 2fbaa95..01cee39 100644 +--- a/grub-core/lib/pbkdf2.c ++++ b/grub-core/lib/pbkdf2.c +@@ -52,7 +52,7 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md, + grub_uint8_t *tmp; + grub_size_t tmplen = Slen + 4; + +- if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN) ++ if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN || md->mdlen == 0) + return GPG_ERR_INV_ARG; + + if (c == 0) +diff --git a/grub-core/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h +index c4b9bf0..7ae6eee 100644 +--- a/grub-core/lib/posix_wrap/string.h ++++ b/grub-core/lib/posix_wrap/string.h +@@ -42,21 +42,6 @@ strcasecmp (const char *s1, const char *s2) + return grub_strcasecmp (s1, s2); + } + +-#ifdef GRUB_UTIL +-static inline void * +-memcpy (void *dest, const void *src, grub_size_t n) +-{ +- return grub_memcpy (dest, src, n); +-} +- +-static inline int +-memcmp (const void *s1, const void *s2, grub_size_t n) +-{ +- return grub_memcmp (s1, s2, n); +-} +- +-#endif +- + static inline void + bcopy (const void *src, void *dest, grub_size_t n) + { +@@ -99,4 +84,9 @@ memchr (const void *s, int c, grub_size_t n) + return grub_memchr (s, c, n); + } + ++#define memcmp grub_memcmp ++#define memcpy grub_memcpy ++#define memmove grub_memmove ++#define memset grub_memset ++ + #endif +diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c +index 7263cbc..ee9fa7b 100644 +--- a/grub-core/lib/reed_solomon.c ++++ b/grub-core/lib/reed_solomon.c +@@ -362,7 +362,7 @@ grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size, + + /* Nothing to do. */ + if (!rs) +- return; ++ goto exit; + + init_powx (); + +@@ -388,6 +388,7 @@ grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size, + #ifndef TEST + assert (grub_memcmp (tmp, buffer, data_size) == 0); + #endif ++exit: + free (tmp); + } + #endif +diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c +index 9f9770b..f759c7f 100644 +--- a/grub-core/lib/relocator.c ++++ b/grub-core/lib/relocator.c +@@ -652,7 +652,7 @@ malloc_in_range (struct grub_relocator *rel, + for (i = 0; i < (BITS_IN_BYTE * sizeof (grub_addr_t) / DIGITSORT_BITS); + i++) + { +- memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0])); ++ grub_memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0])); + for (j = 0; j < N; j++) + counter[((events[j].pos >> (DIGITSORT_BITS * i)) + & DIGITSORT_MASK) + 1]++; +@@ -865,6 +865,8 @@ malloc_in_range (struct grub_relocator *rel, + % GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT; + struct grub_relocator_fw_leftover *lo + = events[last_lo].leftover; ++ if (offend == 0 && alloc_end != alloc_start) ++ offend = GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT; + lo->freebytes[offstart / 8] + &= ((1 << (8 - (start % 8))) - 1); + grub_memset (lo->freebytes + (offstart + 7) / 8, 0, +diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c +index 21fa175..28ba3ae 100644 +--- a/grub-core/lib/syslinux_parse.c ++++ b/grub-core/lib/syslinux_parse.c +@@ -649,6 +649,8 @@ helptext (const char *line, grub_file_t file, struct syslinux_menu *menu) + grub_size_t helplen, alloclen = 0; + + help = grub_strdup (line); ++ if (!help) ++ return grub_errno; + helplen = grub_strlen (line); + while ((grub_free (buf), buf = grub_file_getline (file))) + { +@@ -682,6 +684,7 @@ helptext (const char *line, grub_file_t file, struct syslinux_menu *menu) + } + + grub_free (buf); ++ grub_free (help); + return grub_errno; + } + +@@ -717,7 +720,7 @@ syslinux_parse_real (struct syslinux_menu *menu) + for (ptr3 = ptr2; grub_isspace (*ptr3) && *ptr3; ptr3++); + for (ptr4 = ptr3; !grub_isspace (*ptr4) && *ptr4; ptr4++); + for (ptr5 = ptr4; grub_isspace (*ptr5) && *ptr5; ptr5++); +- for (i = 0; i < sizeof (commands) / sizeof (commands[0]); i++) ++ for (i = 0; i < ARRAY_SIZE(commands); i++) + if (grub_strlen (commands[i].name1) == (grub_size_t) (ptr2 - ptr1) + && grub_strncasecmp (commands[i].name1, ptr1, ptr2 - ptr1) == 0 + && (commands[i].name2 == NULL +@@ -726,7 +729,7 @@ syslinux_parse_real (struct syslinux_menu *menu) + && grub_strncasecmp (commands[i].name2, ptr3, ptr4 - ptr3) + == 0))) + break; +- if (i == sizeof (commands) / sizeof (commands[0])) ++ if (i == ARRAY_SIZE(commands)) + { + if (sizeof ("text") - 1 == ptr2 - ptr1 + && grub_strncasecmp ("text", ptr1, ptr2 - ptr1) == 0 +@@ -769,7 +772,7 @@ print_escaped (struct output_buffer *outbuf, + if (err) + return err; + outbuf->buf[outbuf->ptr++] = '\''; +- for (ptr = from; *ptr; ptr++) ++ for (ptr = from; *ptr && ptr < to; ptr++) + { + if (*ptr == '\'') + { +@@ -837,13 +840,96 @@ simplify_filename (char *str) + } + + static grub_err_t ++print_config (struct output_buffer *outbuf, ++ struct syslinux_menu *menu, ++ const char *filename, const char *basedir) ++{ ++ struct syslinux_menu *menuptr; ++ grub_err_t err = GRUB_ERR_NONE; ++ char *new_cwd = NULL; ++ char *new_target_cwd = NULL; ++ char *newname = NULL; ++ int depth = 0; ++ ++ new_cwd = get_read_filename (menu, basedir); ++ if (!new_cwd) ++ { ++ err = grub_errno; ++ goto out; ++ } ++ new_target_cwd = get_target_filename (menu, basedir); ++ if (!new_target_cwd) ++ { ++ err = grub_errno; ++ goto out; ++ } ++ newname = get_read_filename (menu, filename); ++ if (!newname) ++ { ++ err = grub_errno; ++ goto out; ++ } ++ simplify_filename (newname); ++ ++ print_string ("#"); ++ print_file (outbuf, menu, filename, NULL); ++ print_string (" "); ++ err = print (outbuf, newname, grub_strlen (newname)); ++ if (err) ++ return err; ++ print_string (":\n"); ++ ++ for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++) ++ if (grub_strcmp (menuptr->filename, newname) == 0 ++ || depth > 20) ++ break; ++ if (menuptr) ++ { ++ print_string (" syslinux_configfile -r "); ++ print_file (outbuf, menu, "/", NULL); ++ print_string (" -c "); ++ print_file (outbuf, menu, basedir, NULL); ++ print_string (" "); ++ print_file (outbuf, menu, filename, NULL); ++ print_string ("\n"); ++ } ++ else ++ { ++ err = config_file (outbuf, menu->root_read_directory, ++ menu->root_target_directory, new_cwd, new_target_cwd, ++ newname, menu, menu->flavour); ++ if (err == GRUB_ERR_FILE_NOT_FOUND ++ || err == GRUB_ERR_BAD_FILENAME) ++ { ++ grub_errno = err = GRUB_ERR_NONE; ++ print_string ("# File "); ++ err = print (outbuf, newname, grub_strlen (newname)); ++ if (err) ++ goto out; ++ print_string (" not found\n"); ++ } ++ } ++ ++ out: ++ grub_free (newname); ++ grub_free (new_cwd); ++ grub_free (new_target_cwd); ++ return err; ++} ++ ++static grub_err_t + write_entry (struct output_buffer *outbuf, + struct syslinux_menu *menu, + struct syslinux_menuentry *curentry) + { + grub_err_t err; + if (curentry->comments) +- print (outbuf, curentry->comments, grub_strlen (curentry->comments)); ++ { ++ err = print (outbuf, curentry->comments, ++ grub_strlen (curentry->comments)); ++ if (err) ++ return err; ++ } + { + struct syslinux_say *say; + for (say = curentry->say; say && say->next; say = say->next); +@@ -860,9 +946,8 @@ write_entry (struct output_buffer *outbuf, + { + case KERNEL_LINUX: + { +- char *ptr; +- char *cmdline; +- char *initrd = NULL; ++ const char *ptr; ++ const char *initrd = NULL, *initrde= NULL; + for (ptr = curentry->append; ptr && *ptr; ptr++) + if ((ptr == curentry->append || grub_isspace (ptr[-1])) + && grub_strncasecmp (ptr, "initrd=", sizeof ("initrd=") - 1) +@@ -870,32 +955,20 @@ write_entry (struct output_buffer *outbuf, + break; + if (ptr && *ptr) + { +- char *ptr2; +- grub_size_t totlen = grub_strlen (curentry->append); + initrd = ptr + sizeof ("initrd=") - 1; +- for (ptr2 = ptr; *ptr2 && !grub_isspace (*ptr2); ptr2++); +- if (*ptr2) +- { +- *ptr2 = 0; +- ptr2++; +- } +- cmdline = grub_malloc (totlen + 1 - (ptr2 - ptr)); +- if (!cmdline) +- return grub_errno; +- grub_memcpy (cmdline, curentry->append, ptr - curentry->append); +- grub_memcpy (cmdline + (ptr - curentry->append), +- ptr2, totlen - (ptr2 - curentry->append)); +- *(cmdline + totlen - (ptr2 - ptr)) = 0; ++ for (initrde = initrd; *initrde && !grub_isspace (*initrde); initrde++); + } +- else +- cmdline = curentry->append; + print_string (" if test x$grub_platform = xpc; then " + "linux_suffix=16; else linux_suffix= ; fi\n"); + print_string (" linux$linux_suffix "); + print_file (outbuf, menu, curentry->kernel_file, NULL); + print_string (" "); +- if (cmdline) +- print (outbuf, cmdline, grub_strlen (cmdline)); ++ if (curentry->append) ++ { ++ err = print (outbuf, curentry->append, grub_strlen (curentry->append)); ++ if (err) ++ return err; ++ } + print_string ("\n"); + if (initrd || curentry->initrds) + { +@@ -903,7 +976,7 @@ write_entry (struct output_buffer *outbuf, + print_string (" initrd$linux_suffix "); + if (initrd) + { +- print_file (outbuf, menu, initrd, NULL); ++ print_file (outbuf, menu, initrd, initrde); + print_string (" "); + } + for (lst = curentry->initrds; lst; lst = lst->next) +@@ -949,6 +1022,7 @@ write_entry (struct output_buffer *outbuf, + break; + } + print_string (" # UNSUPPORTED localboot type "); ++ print_string ("\ntrue;\n"); + if (print_num (outbuf, n)) + return grub_errno; + print_string ("\n"); +@@ -1124,8 +1198,7 @@ write_entry (struct output_buffer *outbuf, + ptr++; + i386e = ptr; + } +- if (lme) +- *lme = '\0'; ++ *lme = '\0'; + if (paee) + *paee = '\0'; + if (i386e) +@@ -1230,6 +1303,36 @@ write_entry (struct output_buffer *outbuf, + break; + } + ++ if (grub_strcasecmp (basename, "menu.c32") == 0 || ++ grub_strcasecmp (basename, "vesamenu.c32") == 0) ++ { ++ char *ptr; ++ char *end; ++ ++ ptr = curentry->append; ++ if (!ptr) ++ return grub_errno; ++ ++ while (*ptr) ++ { ++ end = ptr; ++ for (end = ptr; *end && !grub_isspace (*end); end++); ++ if (*end) ++ *end++ = '\0'; ++ ++ /* "~" is supposed to be current file, so let's skip it */ ++ if (grub_strcmp (ptr, "~") != 0) ++ { ++ err = print_config (outbuf, menu, ptr, ""); ++ if (err != GRUB_ERR_NONE) ++ break; ++ } ++ for (ptr = end; *ptr && grub_isspace (*ptr); ptr++); ++ } ++ err = GRUB_ERR_NONE; ++ break; ++ } ++ + /* FIXME: gdb, GFXBoot, Hdt, Ifcpu, Ifplop, Kbdmap, + FIXME: Linux, Lua, Meminfo, rosh, Sanbboot */ + +@@ -1242,70 +1345,13 @@ write_entry (struct output_buffer *outbuf, + } + case KERNEL_CONFIG: + { +- char *new_cwd, *new_target_cwd; + const char *ap; + ap = curentry->append; + if (!ap) + ap = curentry->argument; + if (!ap) + ap = ""; +- new_cwd = get_read_filename (menu, ap); +- if (!new_cwd) +- return grub_errno; +- new_target_cwd = get_target_filename (menu, ap); +- if (!new_target_cwd) +- return grub_errno; +- +- struct syslinux_menu *menuptr; +- char *newname; +- int depth = 0; +- +- newname = get_read_filename (menu, curentry->kernel_file); +- if (!newname) +- return grub_errno; +- simplify_filename (newname); +- +- print_string ("#"); +- print_file (outbuf, menu, curentry->kernel_file, NULL); +- print_string (" "); +- print (outbuf, newname, grub_strlen (newname)); +- print_string (":\n"); +- +- for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++) +- if (grub_strcmp (menuptr->filename, newname) == 0 +- || depth > 20) +- break; +- if (menuptr) +- { +- print_string (" syslinux_configfile -r "); +- print_file (outbuf, menu, "/", NULL); +- print_string (" -c "); +- print_file (outbuf, menu, ap, NULL); +- print_string (" "); +- print_file (outbuf, menu, curentry->kernel_file, NULL); +- print_string ("\n"); +- } +- else +- { +- err = config_file (outbuf, menu->root_read_directory, +- menu->root_target_directory, new_cwd, new_target_cwd, +- newname, menu, menu->flavour); +- if (err == GRUB_ERR_FILE_NOT_FOUND +- || err == GRUB_ERR_BAD_FILENAME) +- { +- grub_errno = err = GRUB_ERR_NONE; +- print_string ("# File "); +- err = print (outbuf, newname, grub_strlen (newname)); +- if (err) +- return err; +- print_string (" not found\n"); +- } +- if (err) +- return err; +- } +- grub_free (newname); +- grub_free (new_cwd); +- grub_free (new_target_cwd); ++ print_config (outbuf, menu, curentry->kernel_file, ap); + } + break; + case KERNEL_NO_KERNEL: +@@ -1351,7 +1397,6 @@ free_menu (struct syslinux_menu *menu) + for (say = menu->say; say ; say = nsay) + { + nsay = say->next; +- grub_free (say->msg); + grub_free (say); + } + +@@ -1421,6 +1466,13 @@ config_file (struct output_buffer *outbuf, + print_string ("\n"); + } + ++ if (menu.comments) ++ { ++ err = print (outbuf, menu.comments, grub_strlen (menu.comments)); ++ if (err) ++ return err; ++ } ++ + if (menu.timeout == 0 && menu.entries && menu.def) + { + err = print_entry (outbuf, &menu, menu.def); +@@ -1432,17 +1484,11 @@ config_file (struct output_buffer *outbuf, + for (curentry = menu.entries; curentry->next; curentry = curentry->next); + lentry = curentry; + +- print_string ("set timeout='"); ++ print_string ("set timeout="); + err = print_num (outbuf, (menu.timeout + 9) / 10); + if (err) + return err; + print_string ("\n"); +- if (menu.comments) +- { +- err = print (outbuf, menu.comments, grub_strlen (menu.comments)); +- if (err) +- return err; +- } + + if (menu.def) + { +diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c +index e6770d9..5b39f02 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, 0, 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 9d15aad..987f5b9 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -33,12 +33,6 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-#define GRUB_EFI_PAGE_SHIFT 12 +-#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) +-#define GRUB_EFI_PE_MAGIC 0x5A4D +- +-static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; +- + static grub_dl_t my_mod; + static int loaded; + +@@ -58,6 +52,7 @@ 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; + +@@ -68,15 +63,15 @@ get_firmware_fdt (void) + 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 @ 0x%p\n", firmware_fdt); ++ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt); + break; + } + + return firmware_fdt; + } + +-static void +-get_fdt (void) ++void * ++grub_linux_get_fdt (void) + { + void *raw_fdt; + grub_size_t size; +@@ -99,7 +94,7 @@ get_fdt (void) + grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size); + fdt = grub_efi_allocate_pages (0, BYTES_TO_PAGES (size)); + if (!fdt) +- return; ++ return NULL; + + if (raw_fdt) + { +@@ -110,17 +105,18 @@ get_fdt (void) + { + grub_fdt_create_empty_tree (fdt, size); + } ++ return fdt; + } + +-static grub_err_t +-check_kernel (struct grub_arm64_linux_kernel_header *lh) ++grub_err_t ++grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh) + { + if (lh->magic != GRUB_ARM64_LINUX_MAGIC) + return grub_error(GRUB_ERR_BAD_OS, "invalid magic number"); + + if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC) + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, +- N_("plain Image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); ++ N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); + + grub_dprintf ("linux", "UEFI stub kernel:\n"); + grub_dprintf ("linux", "text_offset = 0x%012llx\n", +@@ -131,14 +127,14 @@ check_kernel (struct grub_arm64_linux_kernel_header *lh) + } + + static grub_err_t +-finalize_params (void) ++finalize_params_linux (void) + { + grub_efi_boot_services_t *b; ++ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; + grub_efi_status_t status; + int node, retval; + +- get_fdt (); +- if (!fdt) ++ if (!grub_linux_get_fdt ()) + goto failure; + + node = grub_fdt_find_subnode (fdt, 0, "chosen"); +@@ -240,21 +236,16 @@ out: + return grub_errno; + } + +-static grub_err_t +-grub_linux_boot (void) ++grub_err_t ++grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) + { + grub_efi_memory_mapped_device_path_t *mempath; + grub_efi_handle_t image_handle; + grub_efi_boot_services_t *b; + grub_efi_status_t status; +- grub_err_t retval; + grub_efi_loaded_image_t *loaded_image; + int len; + +- retval = finalize_params(); +- if (retval != GRUB_ERR_NONE) +- return retval; +- + mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t)); + if (!mempath) + return grub_errno; +@@ -263,26 +254,26 @@ grub_linux_boot (void) + mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE; + mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath)); + mempath[0].memory_type = GRUB_EFI_LOADER_DATA; +- mempath[0].start_address = (grub_addr_t) kernel_addr; +- mempath[0].end_address = (grub_addr_t) kernel_addr + kernel_size; ++ mempath[0].start_address = addr; ++ mempath[0].end_address = addr + size; + + 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, + (grub_efi_device_path_t *) mempath, +- kernel_addr, kernel_size, &image_handle); ++ (void *) addr, size, &image_handle); + if (status != GRUB_EFI_SUCCESS) + return grub_error (GRUB_ERR_BAD_OS, "cannot load image"); + +- grub_dprintf ("linux", "linux command line: '%s'\n", linux_args); ++ grub_dprintf ("linux", "linux command line: '%s'\n", args); + + /* Convert command line to UCS-2 */ + loaded_image = grub_efi_get_loaded_image (image_handle); + loaded_image->load_options_size = len = +- (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t); ++ (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t); + loaded_image->load_options = + grub_efi_allocate_pages (0, + BYTES_TO_PAGES (loaded_image->load_options_size)); +@@ -291,9 +282,9 @@ grub_linux_boot (void) + + loaded_image->load_options_size = + 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, +- (grub_uint8_t *) linux_args, len, NULL); ++ (grub_uint8_t *) args, len, NULL); + +- grub_dprintf("linux", "starting image %p\n", image_handle); ++ grub_dprintf ("linux", "starting image %p\n", image_handle); + status = b->start_image (image_handle, 0, NULL); + + /* When successful, not reached */ +@@ -305,6 +296,16 @@ grub_linux_boot (void) + } + + static grub_err_t ++grub_linux_boot (void) ++{ ++ if (finalize_params_linux () != GRUB_ERR_NONE) ++ return grub_errno; ++ ++ return (grub_arm64_uefi_boot_image((grub_addr_t)kernel_addr, ++ kernel_size, linux_args)); ++} ++ ++static grub_err_t + grub_linux_unload (void) + { + grub_dl_unref (my_mod); +@@ -328,7 +329,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, 0, 0 }; + int initrd_size, initrd_pages; + void *initrd_mem = NULL; + +@@ -400,7 +401,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) + return grub_errno; + +- if (check_kernel (&lh) != GRUB_ERR_NONE) ++ if (grub_arm64_uefi_check_image (&lh) != GRUB_ERR_NONE) + goto fail; + + grub_loader_unset(); +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 2332370..522a716 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -350,8 +350,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + } + loaded_image->device_handle = dev_handle; + +- grub_file_close (file); +- + if (argc > 1) + { + int i, len; +@@ -381,6 +379,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + loaded_image->load_options_size = len; + } + ++ grub_file_close (file); ++ grub_device_close (dev); ++ + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); + return 0; + +diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c +index ea0edfa..bc377b3 100644 +--- a/grub-core/loader/i386/bsd.c ++++ b/grub-core/loader/i386/bsd.c +@@ -234,7 +234,8 @@ grub_bsd_add_meta_ptr (grub_uint32_t type, void **ptr, grub_uint32_t len) + { + struct bsd_tag *p; + for (p = tags; +- p->type != (FREEBSD_MODINFO_METADATA | FREEBSD_MODINFOMD_KERNEND); ++ p && p->type != (FREEBSD_MODINFO_METADATA ++ | FREEBSD_MODINFOMD_KERNEND); + p = p->next); + + if (p) +@@ -1082,7 +1083,7 @@ grub_netbsd_add_boot_disk_and_wedge (void) + + grub_crypto_hash (GRUB_MD_MD5, hash, + buf.raw, GRUB_DISK_SECTOR_SIZE); +- memcpy (biw.matchhash, hash, 16); ++ grub_memcpy (biw.matchhash, hash, 16); + + grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw)); + } +@@ -1100,7 +1101,7 @@ grub_netbsd_add_boot_disk_and_wedge (void) + bid.labelsector = partmapsector; + bid.label.type = buf.label.type; + bid.label.checksum = buf.label.checksum; +- memcpy (bid.label.packname, buf.label.packname, 16); ++ grub_memcpy (bid.label.packname, buf.label.packname, 16); + } + else + { +@@ -1145,6 +1146,14 @@ grub_netbsd_boot (void) + if (err) + return err; + ++#ifdef GRUB_MACHINE_EFI ++ err = grub_bsd_add_meta (NETBSD_BTINFO_EFI, ++ &grub_efi_system_table, ++ sizeof (grub_efi_system_table)); ++ if (err) ++ return err; ++#endif ++ + { + struct bsd_tag *tag; + tag_buf_len = 0; +@@ -1646,6 +1655,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) + + serial.device = (GRUB_OPENBSD_COM_MAJOR << 8) | port; + serial.speed = speed; ++ serial.addr = grub_ns8250_hw_get_port (port); + + grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial)); + bootflags |= OPENBSD_RB_SERCONS; +@@ -1656,6 +1666,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) + + grub_memset (&serial, 0, sizeof (serial)); + serial.device = (GRUB_OPENBSD_VGA_MAJOR << 8); ++ serial.addr = 0xffffffff; + grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial)); + bootflags &= ~OPENBSD_RB_SERCONS; + } +diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c +index 9e36cd4..9f57cfa 100644 +--- a/grub-core/loader/i386/bsdXX.c ++++ b/grub-core/loader/i386/bsdXX.c +@@ -84,11 +84,11 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator, + grub_size_t chunk_size = 0; + void *chunk_src; + ++ curload = module = ALIGN_PAGE (*kern_end); ++ + err = read_headers (file, argv[0], &e, &shdr); + if (err) +- return err; +- +- curload = module = ALIGN_PAGE (*kern_end); ++ goto out; + + for (s = (Elf_Shdr *) shdr; s < (Elf_Shdr *) ((char *) shdr + + e.e_shnum * e.e_shentsize); +@@ -109,7 +109,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator, + err = grub_relocator_alloc_chunk_addr (relocator, &ch, + module, chunk_size); + if (err) +- return err; ++ goto out; + chunk_src = get_virtual_current_address (ch); + } + +@@ -135,7 +135,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator, + err = load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, + s->sh_offset, s->sh_size); + if (err) +- return err; ++ goto out; + break; + case SHT_NOBITS: + grub_memset ((grub_uint8_t *) chunk_src + curload - *kern_end, 0, +@@ -159,6 +159,8 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator, + | FREEBSD_MODINFOMD_SHDR, + shdr, e.e_shnum * e.e_shentsize); + ++out: ++ grub_free (shdr); + return err; + } + +@@ -177,11 +179,11 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator, + grub_size_t chunk_size = 0; + void *chunk_src; + ++ curload = module = ALIGN_PAGE (*kern_end); ++ + err = read_headers (file, argv[0], &e, &shdr); + if (err) +- return err; +- +- curload = module = ALIGN_PAGE (*kern_end); ++ goto out; + + for (s = (Elf_Shdr *) shdr; s < (Elf_Shdr *) ((char *) shdr + + e.e_shnum * e.e_shentsize); +@@ -207,7 +209,7 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator, + err = grub_relocator_alloc_chunk_addr (relocator, &ch, + module, chunk_size); + if (err) +- return err; ++ goto out; + + chunk_src = get_virtual_current_address (ch); + } +@@ -235,7 +237,7 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator, + + s->sh_addr - *kern_end, + s->sh_offset, s->sh_size); + if (err) +- return err; ++ goto out; + break; + case SHT_NOBITS: + grub_memset ((grub_uint8_t *) chunk_src + module +@@ -265,6 +267,10 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator, + grub_freebsd_add_meta_module (argv[0], FREEBSD_MODTYPE_ELF_MODULE, + argc - 1, argv + 1, module, + curload - module); ++out: ++ grub_free (shdr); ++ if (err) ++ return err; + return SUFFIX (grub_freebsd_load_elf_meta) (relocator, file, argv[0], kern_end); + } + +@@ -292,13 +298,13 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator, + + err = read_headers (file, filename, &e, &shdr); + if (err) +- return err; ++ goto out; + + err = grub_bsd_add_meta (FREEBSD_MODINFO_METADATA | + FREEBSD_MODINFOMD_ELFHDR, &e, + sizeof (e)); + if (err) +- return err; ++ goto out; + + for (s = (Elf_Shdr *) shdr; s < (Elf_Shdr *) (shdr + + e.e_shnum * e.e_shentsize); +@@ -307,7 +313,10 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator, + break; + if (s >= (Elf_Shdr *) ((char *) shdr + + e.e_shnum * e.e_shentsize)) +- return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table")); ++ { ++ err = grub_error (GRUB_ERR_BAD_OS, N_("no symbol table")); ++ goto out; ++ } + symoff = s->sh_offset; + symsize = s->sh_size; + symentsize = s->sh_entsize; +@@ -325,7 +334,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator, + err = grub_relocator_alloc_chunk_addr (relocator, &ch, + symtarget, chunk_size); + if (err) +- return err; ++ goto out; + sym_chunk = get_virtual_current_address (ch); + } + +@@ -337,28 +346,38 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator, + curload += sizeof (grub_freebsd_addr_t); + + if (grub_file_seek (file, symoff) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto out; ++ } + sym = (Elf_Sym *) curload; + if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize) + { + if (! grub_errno) +- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), +- filename); +- return grub_errno; ++ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), ++ filename); ++ else ++ err = grub_errno; ++ goto out; + } + curload += symsize; + + *((grub_freebsd_addr_t *) curload) = strsize; + curload += sizeof (grub_freebsd_addr_t); + if (grub_file_seek (file, stroff) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto out; ++ } + str = (char *) curload; + if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize) + { + if (! grub_errno) +- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), +- filename); +- return grub_errno; ++ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), ++ filename); ++ else ++ err = grub_errno; ++ goto out; + } + + for (i = 0; +@@ -378,18 +397,20 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator, + FREEBSD_MODINFOMD_DYNAMIC, &dynamic, + sizeof (dynamic)); + if (err) +- return err; ++ goto out; + } + + err = grub_bsd_add_meta (FREEBSD_MODINFO_METADATA | + FREEBSD_MODINFOMD_SSYM, &symstart, + sizeof (symstart)); + if (err) +- return err; ++ goto out; + + err = grub_bsd_add_meta (FREEBSD_MODINFO_METADATA | + FREEBSD_MODINFOMD_ESYM, &symend, + sizeof (symend)); ++out: ++ grub_free (shdr); + if (err) + return err; + +@@ -417,7 +438,10 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator, + + err = read_headers (file, filename, &e, &shdr); + if (err) +- return err; ++ { ++ grub_free (shdr); ++ return grub_errno; ++ } + + for (s = (Elf_Shdr *) shdr; s < (Elf_Shdr *) (shdr + + e.e_shnum * e.e_shentsize); +@@ -426,7 +450,10 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator, + break; + if (s >= (Elf_Shdr *) ((char *) shdr + + e.e_shnum * e.e_shentsize)) +- return GRUB_ERR_NONE; ++ { ++ grub_free (shdr); ++ return GRUB_ERR_NONE; ++ } + symsize = s->sh_size; + symsh = s; + s = (Elf_Shdr *) (shdr + e.e_shentsize * s->sh_link); +@@ -443,7 +470,7 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator, + err = grub_relocator_alloc_chunk_addr (relocator, &ch, + symtarget, chunk_size); + if (err) +- return err; ++ goto out; + sym_chunk = get_virtual_current_address (ch); + } + +@@ -482,29 +509,41 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator, + } + + if (grub_file_seek (file, symsh->sh_offset) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto out; ++ } + if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize) + { + if (! grub_errno) +- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), +- filename); +- return grub_errno; ++ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), ++ filename); ++ else ++ err = grub_errno; ++ goto out; + } + curload += ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t)); + + if (grub_file_seek (file, strsh->sh_offset) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto out; ++ } + if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize) + { + if (! grub_errno) +- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), +- filename); +- return grub_errno; ++ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), ++ filename); ++ else ++ err = grub_errno; ++ goto out; + } + + err = grub_bsd_add_meta (NETBSD_BTINFO_SYMTAB, + &symtab, + sizeof (symtab)); ++out: ++ grub_free (shdr); + if (err) + return err; + +@@ -530,7 +569,10 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file, + + err = read_headers (file, filename, &e, &shdr); + if (err) +- return err; ++ { ++ grub_free (shdr); ++ return err; ++ } + + for (s = (Elf_Shdr *) shdr; s < (Elf_Shdr *) (shdr + + e.e_shnum * e.e_shentsize); +@@ -583,7 +625,11 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file, + } + + if (grub_file_seek (file, stroff) == (grub_off_t) -1) +- return grub_errno; ++ { ++ grub_free (syms); ++ grub_free (strs); ++ return grub_errno; ++ } + if (grub_file_read (file, strs, strsize) != (grub_ssize_t) strsize) + { + grub_free (syms); +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 31fb91e..fddcc46 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -69,7 +69,6 @@ static grub_addr_t prot_mode_target; + static void *initrd_mem; + static grub_addr_t initrd_mem_target; + static grub_size_t prot_init_space; +-static grub_uint32_t initrd_pages; + static struct grub_relocator *relocator = NULL; + static void *efi_mmap_buf; + static grub_size_t maximal_cmdline_size; +@@ -722,7 +721,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and + still not support 32-bit boot. */ +- if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) ++ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + || grub_le_to_cpu16 (lh.version) < 0x0203) + { + grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot" +@@ -1046,11 +1045,11 @@ static grub_err_t + grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + int argc, char *argv[]) + { +- grub_size_t size = 0; ++ grub_size_t size = 0, aligned_size = 0; + 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, 0, 0 }; + + if (argc == 0) + { +@@ -1068,8 +1067,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + goto fail; + + size = grub_get_initrd_size (&initrd_ctx); +- +- initrd_pages = (page_align (size) >> 12); ++ aligned_size = ALIGN_UP (size, 4096); + + /* Get the highest address available for the initrd. */ + if (grub_le_to_cpu16 (linux_params.version) >= 0x0203) +@@ -1097,7 +1095,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + addr_min = (grub_addr_t) prot_mode_target + prot_init_space; + + /* Put the initrd as high as possible, 4KiB aligned. */ +- addr = (addr_max - size) & ~0xFFF; ++ addr = (addr_max - aligned_size) & ~0xFFF; + + if (addr < addr_min) + { +@@ -1108,7 +1106,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + { + grub_relocator_chunk_t ch; + err = grub_relocator_alloc_chunk_align (relocator, &ch, +- addr_min, addr, size, 0x1000, ++ addr_min, addr, aligned_size, ++ 0x1000, + GRUB_RELOCATOR_PREFERENCE_HIGH, + 1); + if (err) +diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c +index 7431aa4..956d0e3 100644 +--- a/grub-core/loader/i386/multiboot_mbi.c ++++ b/grub-core/loader/i386/multiboot_mbi.c +@@ -121,6 +121,24 @@ load_kernel (grub_file_t file, const char *filename, + return grub_multiboot_load_elf (file, filename, buffer); + } + ++static struct multiboot_header * ++find_header (char *buffer, grub_ssize_t len) ++{ ++ struct multiboot_header *header; ++ ++ /* Look for the multiboot header in the buffer. The header should ++ be at least 12 bytes and aligned on a 4-byte boundary. */ ++ for (header = (struct multiboot_header *) buffer; ++ ((char *) header <= buffer + len - 12); ++ header = (struct multiboot_header *) ((char *) header + MULTIBOOT_HEADER_ALIGN)) ++ { ++ if (header->magic == MULTIBOOT_HEADER_MAGIC ++ && !(header->magic + header->flags + header->checksum)) ++ return header; ++ } ++ return NULL; ++} ++ + grub_err_t + grub_multiboot_load (grub_file_t file, const char *filename) + { +@@ -143,16 +161,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) + return grub_errno; + } + +- /* Look for the multiboot header in the buffer. The header should +- be at least 12 bytes and aligned on a 4-byte boundary. */ +- for (header = (struct multiboot_header *) buffer; +- ((char *) header <= buffer + len - 12) || (header = 0); +- header = (struct multiboot_header *) ((char *) header + MULTIBOOT_HEADER_ALIGN)) +- { +- if (header->magic == MULTIBOOT_HEADER_MAGIC +- && !(header->magic + header->flags + header->checksum)) +- break; +- } ++ header = find_header (buffer, len); + + if (header == 0) + { +@@ -446,7 +455,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target) + bufsize = grub_multiboot_get_mbi_size (); + + err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, +- 0x10000, 0x100000 - bufsize, ++ 0x10000, 0xa0000 - bufsize, + bufsize, 4, + GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) +diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c +index 672c013..a293b17 100644 +--- a/grub-core/loader/i386/pc/linux.c ++++ b/grub-core/loader/i386/pc/linux.c +@@ -151,7 +151,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)) ++ if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) + { + grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); + goto fail; +@@ -169,7 +169,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + maximal_cmdline_size = 256; + +- if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) ++ if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + && grub_le_to_cpu16 (lh.version) >= 0x0200) + { + grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL); +@@ -188,7 +188,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + if (grub_le_to_cpu16 (lh.version) >= 0x0201) + { +- lh.heap_end_ptr = grub_cpu_to_le16 (GRUB_LINUX_HEAP_END_OFFSET); ++ lh.heap_end_ptr = grub_cpu_to_le16_compile_time (GRUB_LINUX_HEAP_END_OFFSET); + lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; + } + +@@ -196,17 +196,17 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + lh.cmd_line_ptr = grub_linux_real_target + GRUB_LINUX_CL_OFFSET; + else + { +- lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); +- lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); +- lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET ++ lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC); ++ lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET); ++ lh.setup_move_size = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET + + maximal_cmdline_size); + } + } + else + { + /* Your kernel is quite old... */ +- lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); +- lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); ++ lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC); ++ lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET); + + setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; + +@@ -280,10 +280,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + { + case 'g': + shift += 10; ++ /* Fallthrough. */ + case 'm': + shift += 10; ++ /* Fallthrough. */ + case 'k': + shift += 10; ++ /* Fallthrough. */ + default: + break; + } +@@ -319,7 +322,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) ++ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + || grub_le_to_cpu16 (lh.version) < 0x0200) + /* Clear the heap space. */ + grub_memset (grub_linux_real_chunk +@@ -388,7 +391,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, 0, 0 }; + + if (argc == 0) + { +@@ -404,7 +407,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + + lh = (struct linux_kernel_header *) grub_linux_real_chunk; + +- if (!(lh->header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) ++ if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + && grub_le_to_cpu16 (lh->version) >= 0x0200)) + { + grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd"); +diff --git a/grub-core/loader/i386/pc/plan9.c b/grub-core/loader/i386/pc/plan9.c +index 0d10b1c..814a49d 100644 +--- a/grub-core/loader/i386/pc/plan9.c ++++ b/grub-core/loader/i386/pc/plan9.c +@@ -342,6 +342,7 @@ fill_disk (const char *name, void *data) + if (!plan9name) + { + grub_print_error (); ++ grub_device_close (dev); + return 0; + } + if (grub_extend_alloc (fill_ctx->pmapptr + grub_strlen (plan9name) +@@ -349,6 +350,7 @@ fill_disk (const char *name, void *data) + &fill_ctx->pmap)) + { + grub_free (plan9name); ++ grub_device_close (dev); + return 1; + } + grub_strcpy (fill_ctx->pmap + fill_ctx->pmapptr, plan9name); +@@ -366,12 +368,19 @@ fill_disk (const char *name, void *data) + fill_ctx->noslash = 1; + grub_memset (fill_ctx->prefixescnt, 0, sizeof (fill_ctx->prefixescnt)); + if (grub_partition_iterate (dev->disk, fill_partition, fill_ctx)) +- return 1; ++ { ++ grub_device_close (dev); ++ return 1; ++ } + if (grub_extend_alloc (fill_ctx->pmapptr + 1, &fill_ctx->pmapalloc, + &fill_ctx->pmap)) +- return 1; ++ { ++ grub_device_close (dev); ++ return 1; ++ } + fill_ctx->pmap[fill_ctx->pmapptr++] = '\n'; + ++ grub_device_close (dev); + return 0; + } + +diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c +index c16b4b2..c4d9689 100644 +--- a/grub-core/loader/i386/xen.c ++++ b/grub-core/loader/i386/xen.c +@@ -521,7 +521,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + { + grub_size_t size = 0; + grub_err_t err; +- struct grub_linux_initrd_context initrd_ctx; ++ struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 }; + grub_relocator_chunk_t ch; + + if (argc == 0) +diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c +index ebbf6aa..5836218 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) +@@ -37,8 +38,8 @@ grub_xen_file (grub_file_t file) + if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) + goto fail; + +- if (lh.boot_flag != grub_cpu_to_le16 (0xaa55) +- || lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) ++ if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55) ++ || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + || grub_le_to_cpu16 (lh.version) < 0x0208) + { + grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot"); +diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c +index 6df0015..1ba5649 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, +@@ -310,14 +311,19 @@ grub_xen_get_infoXX (grub_elf_t elf, struct grub_xen_file_info *xi) + return grub_errno; + + if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto cleanup; ++ } + + if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize) + { + if (grub_errno) +- return grub_errno; +- return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), ++ err = grub_errno; ++ else ++ err = grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), + elf->file->name); ++ goto cleanup; + } + + s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize); +@@ -329,18 +335,29 @@ grub_xen_get_infoXX (grub_elf_t elf, struct grub_xen_file_info *xi) + char name[sizeof("__xen_guest")]; + grub_memset (name, 0, sizeof (name)); + if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto cleanup; ++ } + + if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) + { + if (grub_errno) +- return grub_errno; ++ { ++ err = grub_errno; ++ goto cleanup; ++ } + continue; + } + if (grub_memcmp (name, "__xen_guest", + sizeof("__xen_guest")) != 0) + continue; +- return parse_xen_guest (elf, xi, s->sh_offset, s->sh_size); ++ err = parse_xen_guest (elf, xi, s->sh_offset, s->sh_size); ++ goto cleanup; + } +- return grub_error (GRUB_ERR_BAD_OS, "no XEN note found"); ++ err = grub_error (GRUB_ERR_BAD_OS, "no XEN note found"); ++ ++cleanup: ++ grub_free (s0); ++ return err; + } +diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c +index e83e1e9..2fe1fdc 100644 +--- a/grub-core/loader/i386/xnu.c ++++ b/grub-core/loader/i386/xnu.c +@@ -126,7 +126,7 @@ guessfsb (void) + { + const grub_uint64_t sane_value = 100000000; + grub_uint32_t manufacturer[3], max_cpuid, capabilities, msrlow; +- grub_uint32_t a, b, d; ++ grub_uint32_t a, b, d, divisor; + + if (! grub_cpu_is_cpuid_supported ()) + return sane_value; +@@ -166,8 +166,10 @@ guessfsb (void) + r = (2000ULL << 32) - v * grub_tsc_rate; + v += r / grub_tsc_rate; + +- return grub_divmod64 (v, ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1), +- 0); ++ divisor = ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1); ++ if (divisor == 0) ++ return sane_value; ++ return grub_divmod64 (v, divisor, 0); + } + + struct property_descriptor +@@ -267,9 +269,9 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev, + prop->data = grub_malloc (prop->length); + if (!prop->data) + { +- grub_free (prop); + grub_free (prop->name); + grub_free (prop->name16); ++ grub_free (prop); + return grub_errno; + } + grub_memcpy (prop->data, data, prop->length); +@@ -741,10 +743,10 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out) + *((grub_uint64_t *) curval->data) = (grub_addr_t) ptr; + + /* Create alias. */ +- for (j = 0; j < sizeof (table_aliases) / sizeof (table_aliases[0]); j++) ++ for (j = 0; j < ARRAY_SIZE(table_aliases); j++) + if (grub_memcmp (&table_aliases[j].guid, &guid, sizeof (guid)) == 0) + break; +- if (j != sizeof (table_aliases) / sizeof (table_aliases[0])) ++ if (j != ARRAY_SIZE(table_aliases)) + { + curval = grub_xnu_create_value (&(curkey->first_child), "alias"); + if (!curval) +diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c +index 87ac49f..efaa42c 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, 0, 0 }; + + if (argc == 0) + { +diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c +index 117232f..be6fa0f 100644 +--- a/grub-core/loader/linux.c ++++ b/grub-core/loader/linux.c +@@ -161,6 +161,9 @@ grub_initrd_init (int argc, char *argv[], + for (i = 0; i < argc; i++) + { + const char *fname = argv[i]; ++ ++ initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); ++ + if (grub_memcmp (argv[i], "newc:", 5) == 0) + { + const char *ptr, *eptr; +@@ -205,11 +208,12 @@ grub_initrd_init (int argc, char *argv[], + initrd_ctx->nfiles++; + initrd_ctx->components[i].size + = grub_file_size (initrd_ctx->components[i].file); +- initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); ++ initrd_ctx->size += initrd_ctx->components[i].size; + } + + if (newc) + { ++ initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); + initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) + + sizeof ("TRAILER!!!") - 1, 4); + free_dir (root); +@@ -248,10 +252,12 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, + int i; + int newc = 0; + struct dir *root = 0; ++ grub_ssize_t cursize = 0; + + for (i = 0; i < initrd_ctx->nfiles; i++) + { +- grub_ssize_t cursize; ++ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); ++ ptr += ALIGN_UP_OVERHEAD (cursize, 4); + + if (initrd_ctx->components[i].newc_name) + { +@@ -283,11 +289,13 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, + return grub_errno; + } + ptr += cursize; ++ } ++ if (newc) ++ { + grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); + ptr += ALIGN_UP_OVERHEAD (cursize, 4); ++ ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0); + } +- if (newc) +- ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0); + free_dir (root); + root = 0; + return GRUB_ERR_NONE; +diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c +index ef64a5b..5f383be 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, 0, 0 }; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c +index 4b71f33..fd8f28e 100644 +--- a/grub-core/loader/multiboot.c ++++ b/grub-core/loader/multiboot.c +@@ -333,6 +333,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + + #ifndef GRUB_USE_MULTIBOOT2 ++ lowest_addr = 0x100000; + if (grub_multiboot_quirks & GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL) + lowest_addr = ALIGN_UP (highest_load + 1048576, 4096); + #endif +diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c +index 9dc21a1..6a220bd 100644 +--- a/grub-core/loader/multiboot_elfxx.c ++++ b/grub-core/loader/multiboot_elfxx.c +@@ -169,7 +169,10 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, voi + return grub_errno; + + if (grub_file_seek (file, ehdr->e_shoff) == (grub_off_t) -1) +- return grub_errno; ++ { ++ grub_free (shdr); ++ return grub_errno; ++ } + + if (grub_file_read (file, shdr, ehdr->e_shnum * ehdr->e_shentsize) + != (grub_ssize_t) ehdr->e_shnum * ehdr->e_shentsize) +diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c +index 83e8919..d7c19bc 100644 +--- a/grub-core/loader/multiboot_mbi2.c ++++ b/grub-core/loader/multiboot_mbi2.c +@@ -79,6 +79,25 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize, + elf_sections = data; + } + ++static struct multiboot_header * ++find_header (grub_properly_aligned_t *buffer, grub_ssize_t len) ++{ ++ struct multiboot_header *header; ++ /* Look for the multiboot header in the buffer. The header should ++ be at least 12 bytes and aligned on a 4-byte boundary. */ ++ for (header = (struct multiboot_header *) buffer; ++ ((char *) header <= (char *) buffer + len - 12); ++ header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4)) ++ { ++ if (header->magic == MULTIBOOT_HEADER_MAGIC ++ && !(header->magic + header->architecture ++ + header->header_length + header->checksum) ++ && header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT) ++ return header; ++ } ++ return NULL; ++} ++ + grub_err_t + grub_multiboot_load (grub_file_t file, const char *filename) + { +@@ -107,18 +126,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) + + COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0); + +- /* Look for the multiboot header in the buffer. The header should +- be at least 12 bytes and aligned on a 4-byte boundary. */ +- for (header = (struct multiboot_header *) buffer; +- ((char *) header <= (char *) buffer + len - 12) || (header = 0); +- header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4)) +- { +- if (header->magic == MULTIBOOT_HEADER_MAGIC +- && !(header->magic + header->architecture +- + header->header_length + header->checksum) +- && header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT) +- break; +- } ++ header = find_header (buffer, len); + + if (header == 0) + { +@@ -142,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) + = (struct multiboot_header_tag_information_request *) tag; + if (request_tag->flags & MULTIBOOT_HEADER_TAG_OPTIONAL) + break; +- for (i = 0; i < (request_tag->size - sizeof (request_tag)) ++ for (i = 0; i < (request_tag->size - sizeof (*request_tag)) + / sizeof (request_tag->requests[0]); i++) + switch (request_tag->requests[i]) + { +diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c +index 4a14f66..6e81464 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, 0, 0 }; + + if (argc == 0) + { +diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c +index de6ee2f..63d6a1f 100644 +--- a/grub-core/loader/sparc64/ieee1275/linux.c ++++ b/grub-core/loader/sparc64/ieee1275/linux.c +@@ -110,7 +110,7 @@ grub_linux_boot (void) + int len = grub_strlen (linux_args) + 1; + if (bp->len < len) + len = bp->len; +- memcpy(bp->buf, linux_args, len); ++ grub_memcpy(bp->buf, linux_args, len); + bp->buf[len-1] = '\0'; + bp->valid = 1; + } +@@ -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, 0, 0 }; + + if (argc == 0) + { +diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c +index cdd9715..c9885b1 100644 +--- a/grub-core/loader/xnu.c ++++ b/grub-core/loader/xnu.c +@@ -689,10 +689,10 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, + /* Allocate the space. */ + err = grub_xnu_align_heap (GRUB_XNU_PAGESIZE); + if (err) +- return err; ++ goto fail; + err = grub_xnu_heap_malloc (neededspace, &buf0, &buf_target); + if (err) +- return err; ++ goto fail; + buf = buf0; + + exthead = (struct grub_xnu_extheader *) buf; +@@ -709,10 +709,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, + else + err = grub_macho_readfile32 (macho, filename, buf); + if (err) +- { +- grub_macho_close (macho); +- return err; +- } ++ goto fail; + grub_macho_close (macho); + buf += machosize; + } +@@ -747,6 +744,10 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, + /* Announce to kernel */ + return grub_xnu_register_memory ("Driver-", &driversnum, buf_target, + neededspace); ++fail: ++ if (macho) ++ grub_macho_close (macho); ++ return err; + } + + /* Load mkext. */ +@@ -1378,6 +1379,8 @@ grub_xnu_fill_devicetree (void) + name[len] = 0; + + curvalue = grub_xnu_create_value (curkey, name); ++ if (!curvalue) ++ return grub_errno; + grub_free (name); + + data = grub_malloc (grub_strlen (var->value) + 1); +diff --git a/grub-core/mmap/i386/uppermem.c b/grub-core/mmap/i386/uppermem.c +index bd8b429..a6be989 100644 +--- a/grub-core/mmap/i386/uppermem.c ++++ b/grub-core/mmap/i386/uppermem.c +@@ -31,8 +31,12 @@ lower_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + + if (type != GRUB_MEMORY_AVAILABLE) + return 0; ++#ifdef GRUB_MACHINE_COREBOOT ++ if (addr <= 0x1000) ++#else + if (addr == 0) +- *lower = size; ++#endif ++ *lower = size + addr; + return 0; + } + +diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in +index 69d8334..faf0ad3 100644 +--- a/grub-core/modinfo.sh.in ++++ b/grub-core/modinfo.sh.in +@@ -9,8 +9,6 @@ grub_have_font_source=@HAVE_FONT_SOURCE@ + + # Autodetected config + grub_have_asm_uscore=@HAVE_ASM_USCORE@ +-grub_i8086_addr32="@ADDR32@" +-grub_i8086_data32="@DATA32@" + grub_bss_start_symbol="@BSS_START_SYMBOL@" + grub_end_symbol="@END_SYMBOL@" + +@@ -21,11 +19,17 @@ grub_target_cflags='@TARGET_CFLAGS@' + grub_target_cppflags='@TARGET_CPPFLAGS@' + grub_target_ccasflags='@TARGET_CCASFLAGS@' + grub_target_ldflags='@TARGET_LDFLAGS@' ++grub_cflags='@CFLAGS@' ++grub_cppflags='@CPPFLAGS@' ++grub_ccasflags='@CCASFLAGS@' ++grub_ldflags='@LDFLAGS@' + grub_target_strip='@TARGET_STRIP@' + grub_target_nm='@TARGET_NM@' + grub_target_ranlib='@TARGET_RANLIB@' + grub_target_objconf='@TARGET_OBJCONV@' + grub_target_obj2elf='@TARGET_OBJ2ELF@' ++grub_target_img_base_ldopt='@TARGET_IMG_BASE_LDOPT@' ++grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@' + + # Version + grub_version="@VERSION@" +diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c +index e92c7e7..4b68c41 100644 +--- a/grub-core/net/arp.c ++++ b/grub-core/net/arp.c +@@ -37,12 +37,16 @@ enum + GRUB_NET_ARPHRD_ETHERNET = 1 + }; + +-struct arphdr { ++struct arppkt { + grub_uint16_t hrd; + grub_uint16_t pro; + grub_uint8_t hln; + grub_uint8_t pln; + grub_uint16_t op; ++ grub_uint8_t sender_mac[6]; ++ grub_uint32_t sender_ip; ++ grub_uint8_t recv_mac[6]; ++ grub_uint32_t recv_ip; + } GRUB_PACKED; + + static int have_pending; +@@ -53,21 +57,14 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, + const grub_net_network_level_address_t *proto_addr) + { + struct grub_net_buff nb; +- struct arphdr *arp_header; +- grub_net_link_level_address_t target_hw_addr; +- grub_uint8_t *aux, arp_data[128]; ++ struct arppkt *arp_packet; ++ grub_net_link_level_address_t target_mac_addr; + grub_err_t err; + int i; +- grub_size_t addrlen; +- grub_uint16_t etherpro; + grub_uint8_t *nbd; ++ grub_uint8_t arp_data[128]; + +- if (proto_addr->type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4) +- { +- addrlen = 4; +- etherpro = GRUB_NET_ETHERTYPE_IP; +- } +- else ++ if (proto_addr->type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4) + return grub_error (GRUB_ERR_BUG, "unsupported address family"); + + /* Build a request packet. */ +@@ -76,45 +73,38 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, + grub_netbuff_clear (&nb); + grub_netbuff_reserve (&nb, 128); + +- err = grub_netbuff_push (&nb, sizeof (*arp_header) + 2 * (6 + addrlen)); ++ err = grub_netbuff_push (&nb, sizeof (*arp_packet)); + if (err) + return err; + +- arp_header = (struct arphdr *) nb.data; +- arp_header->hrd = grub_cpu_to_be16 (GRUB_NET_ARPHRD_ETHERNET); +- arp_header->hln = 6; +- arp_header->pro = grub_cpu_to_be16 (etherpro); +- arp_header->pln = addrlen; +- arp_header->op = grub_cpu_to_be16 (ARP_REQUEST); +- aux = (grub_uint8_t *) arp_header + sizeof (*arp_header); ++ arp_packet = (struct arppkt *) nb.data; ++ arp_packet->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); ++ arp_packet->hln = 6; ++ arp_packet->pro = grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP); ++ arp_packet->pln = 4; ++ arp_packet->op = grub_cpu_to_be16_compile_time (ARP_REQUEST); + /* Sender hardware address. */ +- grub_memcpy (aux, &inf->hwaddress.mac, 6); +- +- aux += 6; +- /* Sender protocol address */ +- grub_memcpy (aux, &inf->address.ipv4, 4); +- aux += addrlen; +- /* Target hardware address */ +- for (i = 0; i < 6; i++) +- aux[i] = 0x00; +- aux += 6; ++ grub_memcpy (arp_packet->sender_mac, &inf->hwaddress.mac, 6); ++ arp_packet->sender_ip = inf->address.ipv4; ++ grub_memset (arp_packet->recv_mac, 0, 6); ++ arp_packet->recv_ip = proto_addr->ipv4; + /* Target protocol address */ +- grub_memcpy (aux, &proto_addr->ipv4, 4); +- grub_memset (&target_hw_addr.mac, 0xff, 6); ++ grub_memset (&target_mac_addr.mac, 0xff, 6); + + nbd = nb.data; +- send_ethernet_packet (inf, &nb, target_hw_addr, GRUB_NET_ETHERTYPE_ARP); ++ send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); + for (i = 0; i < GRUB_NET_TRIES; i++) + { + if (grub_net_link_layer_resolve_check (inf, proto_addr)) + 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; +- send_ethernet_packet (inf, &nb, target_hw_addr, GRUB_NET_ETHERTYPE_ARP); ++ send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); + } + + return GRUB_ERR_NONE; +@@ -124,63 +114,67 @@ grub_err_t + grub_net_arp_receive (struct grub_net_buff *nb, + struct grub_net_card *card) + { +- struct arphdr *arp_header = (struct arphdr *) nb->data; +- grub_uint8_t *sender_hardware_address; +- grub_uint8_t *target_hardware_address; ++ struct arppkt *arp_packet = (struct arppkt *) nb->data; + grub_net_network_level_address_t sender_addr, target_addr; +- grub_net_link_level_address_t sender_hw_addr; ++ grub_net_link_level_address_t sender_mac_addr; + struct grub_net_network_level_interface *inf; +- grub_uint8_t *sender_protocol_address, *target_protocol_address; +- +- sender_hardware_address = +- (grub_uint8_t *) arp_header + sizeof (*arp_header); +- sender_protocol_address = sender_hardware_address + arp_header->hln; +- target_hardware_address = sender_protocol_address + arp_header->pln; +- target_protocol_address = target_hardware_address + arp_header->hln; +- if (grub_be_to_cpu16 (arp_header->pro) == GRUB_NET_ETHERTYPE_IP +- && arp_header->pln == 4) +- { +- sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; +- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; +- grub_memcpy (&sender_addr.ipv4, sender_protocol_address, 4); +- grub_memcpy (&target_addr.ipv4, target_protocol_address, 4); +- if (grub_memcmp (sender_protocol_address, &pending_req, 4) == 0) +- have_pending = 1; +- } +- else ++ ++ if (arp_packet->pro != grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP) ++ || arp_packet->pln != 4 || arp_packet->hln != 6 ++ || nb->tail - nb->data < (int) sizeof (*arp_packet)) + return GRUB_ERR_NONE; + +- sender_hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; +- grub_memcpy (sender_hw_addr.mac, sender_hardware_address, +- sizeof (sender_hw_addr.mac)); +- grub_net_link_layer_add_address (card, &sender_addr, &sender_hw_addr, 1); ++ sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; ++ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; ++ sender_addr.ipv4 = arp_packet->sender_ip; ++ target_addr.ipv4 = arp_packet->recv_ip; ++ if (arp_packet->sender_ip == pending_req) ++ have_pending = 1; ++ ++ sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; ++ grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac, ++ sizeof (sender_mac_addr.mac)); ++ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); + + FOR_NET_NETWORK_LEVEL_INTERFACES (inf) + { + /* 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) ++ && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) + { + grub_net_link_level_address_t target; +- /* We've already checked that pln is either 4 or 16. */ +- char tmp[16]; +- grub_size_t pln = arp_header->pln; +- +- if (pln > 16) +- pln = 16; ++ struct grub_net_buff nb_reply; ++ struct arppkt *arp_reply; ++ grub_uint8_t arp_data[128]; ++ grub_err_t err; ++ ++ nb_reply.head = arp_data; ++ nb_reply.end = arp_data + sizeof (arp_data); ++ grub_netbuff_clear (&nb_reply); ++ grub_netbuff_reserve (&nb_reply, 128); ++ ++ err = grub_netbuff_push (&nb_reply, sizeof (*arp_packet)); ++ if (err) ++ return err; ++ ++ arp_reply = (struct arppkt *) nb_reply.data; ++ ++ arp_reply->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET); ++ arp_reply->pro = grub_cpu_to_be16_compile_time (GRUB_NET_ETHERTYPE_IP); ++ arp_reply->pln = 4; ++ arp_reply->hln = 6; ++ arp_reply->op = grub_cpu_to_be16_compile_time (ARP_REPLY); ++ arp_reply->sender_ip = arp_packet->recv_ip; ++ arp_reply->recv_ip = arp_packet->sender_ip; ++ arp_reply->hln = 6; + + target.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; +- grub_memcpy (target.mac, sender_hardware_address, 6); +- grub_memcpy (target_hardware_address, target.mac, 6); +- grub_memcpy (sender_hardware_address, inf->hwaddress.mac, 6); +- +- grub_memcpy (tmp, sender_protocol_address, pln); +- grub_memcpy (sender_protocol_address, target_protocol_address, pln); +- grub_memcpy (target_protocol_address, tmp, pln); ++ grub_memcpy (target.mac, arp_packet->sender_mac, 6); ++ grub_memcpy (arp_reply->sender_mac, inf->hwaddress.mac, 6); ++ grub_memcpy (arp_reply->recv_mac, arp_packet->sender_mac, 6); + + /* Change operation to REPLY and send packet */ +- arp_header->op = grub_be_to_cpu16 (ARP_REPLY); +- send_ethernet_packet (inf, nb, target, GRUB_NET_ETHERTYPE_ARP); ++ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); + } + } + return GRUB_ERR_NONE; +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index c14e9de..4fdeac3 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. */ +@@ -188,6 +157,12 @@ grub_net_configure_by_dhcp_ack (const char *name, + hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; + + inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags); ++#if 0 ++ /* This is likely based on misunderstanding. gateway_ip refers to ++ address of BOOTP relay and should not be used after BOOTP transaction ++ is complete. ++ See RFC1542, 3.4 Interpretation of the 'giaddr' field ++ */ + if (bp->gateway_ip) + { + grub_net_network_level_netaddress_t target; +@@ -209,10 +184,11 @@ grub_net_configure_by_dhcp_ack (const char *name, + target.ipv4.masksize = 32; + grub_net_add_route (name, target, inter); + } ++#endif + + 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 +219,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); +@@ -553,8 +529,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), + grub_netbuff_push (nb, sizeof (*udph)); + + udph = (struct udphdr *) nb->data; +- udph->src = grub_cpu_to_be16 (68); +- udph->dst = grub_cpu_to_be16 (67); ++ udph->src = grub_cpu_to_be16_compile_time (68); ++ udph->dst = grub_cpu_to_be16_compile_time (67); + udph->chksum = 0; + udph->len = grub_cpu_to_be16 (nb->tail - nb->data); + target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 0b771fb..9d0c8fc 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -262,7 +262,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + grub_netbuff_free (nb); + return GRUB_ERR_NONE; + } +- for (i = 0; i < grub_cpu_to_be16 (head->qdcount); i++) ++ for (i = 0; i < grub_be_to_cpu16 (head->qdcount); i++) + { + if (ptr >= nb->tail) + { +@@ -277,7 +277,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + ptr += 4; + } + *data->addresses = grub_malloc (sizeof ((*data->addresses)[0]) +- * grub_cpu_to_be16 (head->ancount)); ++ * grub_be_to_cpu16 (head->ancount)); + if (!*data->addresses) + { + grub_errno = GRUB_ERR_NONE; +@@ -286,7 +286,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + } + reparse_ptr = ptr; + reparse: +- for (i = 0, ptr = reparse_ptr; i < grub_cpu_to_be16 (head->ancount); i++) ++ for (i = 0, ptr = reparse_ptr; i < grub_be_to_cpu16 (head->ancount); i++) + { + int ignored = 0; + grub_uint8_t class; +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 2b344d6..70b26af 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; + } + +@@ -130,9 +142,80 @@ 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); ++ ++ /* 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); ++ 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_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); ++} ++ + static struct grub_net_card_driver efidriver = + { + .name = "efinet", ++ .open = open_card, ++ .close = close_card, + .send = send_card_buffer, + .recv = get_card_packet + }; +@@ -162,6 +245,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); +@@ -239,7 +345,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 --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c +index 7c977cd..b194920 100644 +--- a/grub-core/net/drivers/emu/emunet.c ++++ b/grub-core/net/drivers/emu/emunet.c +@@ -98,7 +98,7 @@ static int registered = 0; + + GRUB_MOD_INIT(emunet) + { +- if (grub_emunet_create (&emucard.mtu)) ++ if (!grub_emunet_create (&emucard.mtu)) + { + grub_net_card_register (&emucard); + registered = 1; +diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c +index e8c0b22..3f4152d 100644 +--- a/grub-core/net/drivers/i386/pc/pxe.c ++++ b/grub-core/net/drivers/i386/pc/pxe.c +@@ -218,8 +218,7 @@ grub_pxe_recv (struct grub_net_card *dev __attribute__ ((unused))) + return NULL; + /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible + by 4. So that IP header is aligned on 4 bytes. */ +- grub_netbuff_reserve (buf, 2); +- if (!buf) ++ if (grub_netbuff_reserve (buf, 2)) + { + grub_netbuff_free (buf); + return NULL; +diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c +index 4483c91..eea8e71 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_bootpath (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_bootpath (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/icmp.c b/grub-core/net/icmp.c +index 28d825b..b1eef11 100644 +--- a/grub-core/net/icmp.c ++++ b/grub-core/net/icmp.c +@@ -85,22 +85,13 @@ grub_net_recv_icmp_packet (struct grub_net_buff *nb, + struct icmp_header *icmphr; + if (icmph->code) + break; +- nb_reply = grub_netbuff_alloc (nb->tail - nb->data + 512); ++ nb_reply = grub_netbuff_make_pkt (nb->tail - nb->data + sizeof (*icmphr)); + if (!nb_reply) + { + grub_netbuff_free (nb); + return grub_errno; + } +- err = grub_netbuff_reserve (nb_reply, nb->tail - nb->data + 512); +- if (err) +- goto ping_fail; +- err = grub_netbuff_push (nb_reply, nb->tail - nb->data); +- if (err) +- goto ping_fail; +- grub_memcpy (nb_reply->data, nb->data, nb->tail - nb->data); +- err = grub_netbuff_push (nb_reply, sizeof (*icmphr)); +- if (err) +- goto ping_fail; ++ grub_memcpy (nb_reply->data + sizeof (*icmphr), nb->data, nb->tail - nb->data); + icmphr = (struct icmp_header *) nb_reply->data; + icmphr->type = ICMP_ECHO_REPLY; + icmphr->code = 0; +@@ -110,7 +101,6 @@ grub_net_recv_icmp_packet (struct grub_net_buff *nb, + err = grub_net_send_ip_packet (inf, src, ll_src, + nb_reply, GRUB_NET_IP_ICMP); + +- ping_fail: + grub_netbuff_free (nb); + grub_netbuff_free (nb_reply); + return err; +diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c +index 2741e6f..7953e68 100644 +--- a/grub-core/net/icmp6.c ++++ b/grub-core/net/icmp6.c +@@ -72,6 +72,11 @@ struct neighbour_advertise + grub_uint64_t target[2]; + } GRUB_PACKED; + ++struct router_solicit ++{ ++ grub_uint32_t reserved; ++} GRUB_PACKED; ++ + enum + { + FLAG_SLAAC = 0x40 +@@ -81,6 +86,7 @@ enum + { + ICMP6_ECHO = 128, + ICMP6_ECHO_REPLY = 129, ++ ICMP6_ROUTER_SOLICIT = 133, + ICMP6_ROUTER_ADVERTISE = 134, + ICMP6_NEIGHBOUR_SOLICIT = 135, + ICMP6_NEIGHBOUR_ADVERTISE = 136, +@@ -205,7 +211,7 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, + if (ttl != 0xff) + break; + nbh = (struct neighbour_solicit *) nb->data; +- err = grub_netbuff_pull (nb, sizeof (struct router_adv)); ++ err = grub_netbuff_pull (nb, sizeof (*nbh)); + if (err) + { + grub_netbuff_free (nb); +@@ -518,7 +524,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; +@@ -532,3 +539,80 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf, + grub_netbuff_free (nb); + return err; + } ++ ++grub_err_t ++grub_net_icmp6_send_router_solicit (struct grub_net_network_level_interface *inf) ++{ ++ struct grub_net_buff *nb; ++ grub_err_t err = GRUB_ERR_NONE; ++ grub_net_network_level_address_t multicast; ++ grub_net_link_level_address_t ll_multicast; ++ struct option_header *ohdr; ++ struct router_solicit *sol; ++ struct icmp_header *icmphr; ++ ++ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); ++ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x02ULL); ++ ++ err = grub_net_link_layer_resolve (inf, &multicast, &ll_multicast); ++ if (err) ++ return err; ++ ++ nb = grub_netbuff_alloc (sizeof (struct router_solicit) ++ + sizeof (struct option_header) ++ + 6 ++ + sizeof (struct icmp_header) ++ + GRUB_NET_OUR_IPV6_HEADER_SIZE ++ + GRUB_NET_MAX_LINK_HEADER_SIZE); ++ if (!nb) ++ return grub_errno; ++ err = grub_netbuff_reserve (nb, ++ sizeof (struct router_solicit) ++ + sizeof (struct option_header) ++ + 6 ++ + sizeof (struct icmp_header) ++ + GRUB_NET_OUR_IPV6_HEADER_SIZE ++ + GRUB_NET_MAX_LINK_HEADER_SIZE); ++ if (err) ++ goto fail; ++ ++ err = grub_netbuff_push (nb, 6); ++ if (err) ++ goto fail; ++ ++ grub_memcpy (nb->data, inf->hwaddress.mac, 6); ++ ++ err = grub_netbuff_push (nb, sizeof (*ohdr)); ++ if (err) ++ goto fail; ++ ++ ohdr = (struct option_header *) nb->data; ++ ohdr->type = OPTION_SOURCE_LINK_LAYER_ADDRESS; ++ ohdr->len = 1; ++ ++ err = grub_netbuff_push (nb, sizeof (*sol)); ++ if (err) ++ goto fail; ++ ++ sol = (struct router_solicit *) nb->data; ++ sol->reserved = 0; ++ ++ err = grub_netbuff_push (nb, sizeof (*icmphr)); ++ if (err) ++ goto fail; ++ ++ icmphr = (struct icmp_header *) nb->data; ++ icmphr->type = ICMP6_ROUTER_SOLICIT; ++ icmphr->code = 0; ++ icmphr->checksum = 0; ++ icmphr->checksum = grub_net_ip_transport_checksum (nb, ++ GRUB_NET_IP_ICMPV6, ++ &inf->address, ++ &multicast); ++ err = grub_net_send_ip_packet (inf, &multicast, &ll_multicast, nb, ++ GRUB_NET_IP_ICMPV6); ++ fail: ++ grub_netbuff_free (nb); ++ return err; ++} +diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c +index c6971f9..8c56baa 100644 +--- a/grub-core/net/ip.c ++++ b/grub-core/net/ip.c +@@ -191,15 +191,18 @@ grub_net_send_ip4_packet (struct grub_net_network_level_interface *inf, + grub_net_ip_protocol_t proto) + { + struct iphdr *iph; ++ grub_err_t err; + + COMPILE_TIME_ASSERT (GRUB_NET_OUR_IPV4_HEADER_SIZE == sizeof (*iph)); + + if (nb->tail - nb->data + sizeof (struct iphdr) > inf->card->mtu) + return send_fragmented (inf, target, nb, proto, *ll_target_addr); + +- grub_netbuff_push (nb, sizeof (*iph)); +- iph = (struct iphdr *) nb->data; ++ err = grub_netbuff_push (nb, sizeof (*iph)); ++ if (err) ++ return err; + ++ iph = (struct iphdr *) nb->data; + iph->verhdrlen = ((4 << 4) | 5); + iph->service = 0; + iph->len = grub_cpu_to_be16 (nb->tail - nb->data); +@@ -602,16 +605,19 @@ grub_net_send_ip6_packet (struct grub_net_network_level_interface *inf, + grub_net_ip_protocol_t proto) + { + struct ip6hdr *iph; ++ grub_err_t err; + + COMPILE_TIME_ASSERT (GRUB_NET_OUR_IPV6_HEADER_SIZE == sizeof (*iph)); + + if (nb->tail - nb->data + sizeof (struct iphdr) > inf->card->mtu) + return grub_error (GRUB_ERR_NET_PACKET_TOO_BIG, "packet too big"); + +- grub_netbuff_push (nb, sizeof (*iph)); +- iph = (struct ip6hdr *) nb->data; ++ err = grub_netbuff_push (nb, sizeof (*iph)); ++ if (err) ++ return err; + +- iph->version_class_flow = grub_cpu_to_be32 ((6 << 28)); ++ iph = (struct ip6hdr *) nb->data; ++ iph->version_class_flow = grub_cpu_to_be32_compile_time ((6 << 28)); + iph->len = grub_cpu_to_be16 (nb->tail - nb->data - sizeof (*iph)); + iph->protocol = proto; + iph->ttl = 0xff; +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 0e57e93..21a4e94 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -306,7 +306,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card, + return NULL; + + addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; +- addr.ipv6[0] = grub_cpu_to_be64 (0xfe80ULL << 48); ++ addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48); + addr.ipv6[1] = grub_net_ipv6_get_id (hwaddr); + + FOR_NET_NETWORK_LEVEL_INTERFACES (inf) +@@ -380,12 +380,14 @@ grub_cmd_ipv6_autoconf (struct grub_command *cmd __attribute__ ((unused)), + + for (interval = 200; interval < 10000; interval *= 2) + { +- /* FIXME: send router solicitation. */ + int done = 1; + for (j = 0; j < ncards; j++) + { + if (slaacs[j]->slaac_counter) + continue; ++ err = grub_net_icmp6_send_router_solicit (ifaces[j]); ++ if (err) ++ err = GRUB_ERR_NONE; + done = 0; + } + if (done) +@@ -1453,7 +1455,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. */ +@@ -1480,6 +1482,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) + { +@@ -1558,8 +1598,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/netbuff.c b/grub-core/net/netbuff.c +index e97ecd2..dbeeefe 100644 +--- a/grub-core/net/netbuff.c ++++ b/grub-core/net/netbuff.c +@@ -97,6 +97,26 @@ grub_netbuff_alloc (grub_size_t len) + return nb; + } + ++struct grub_net_buff * ++grub_netbuff_make_pkt (grub_size_t len) ++{ ++ struct grub_net_buff *nb; ++ grub_err_t err; ++ nb = grub_netbuff_alloc (len + 512); ++ if (!nb) ++ return NULL; ++ err = grub_netbuff_reserve (nb, len + 512); ++ if (err) ++ goto fail; ++ err = grub_netbuff_push (nb, len); ++ if (err) ++ goto fail; ++ return nb; ++ fail: ++ grub_netbuff_free (nb); ++ return NULL; ++} ++ + void + grub_netbuff_free (struct grub_net_buff *nb) + { +diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c +index 2077f55..1d90f1e 100644 +--- a/grub-core/net/tcp.c ++++ b/grub-core/net/tcp.c +@@ -918,7 +918,7 @@ grub_net_recv_tcp_packet (struct grub_net_buff *nb, + do_ack = 1; + } + else +- grub_netbuff_free (nb); ++ grub_netbuff_free (nb_top); + } + if (do_ack) + ack (sock); +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 9c489f1..1319671 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -149,7 +149,7 @@ ack (tftp_data_t data, grub_uint64_t block) + return err; + + tftph_ack = (struct tftphdr *) nb_ack.data; +- tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK); ++ tftph_ack->opcode = grub_cpu_to_be16_compile_time (TFTP_ACK); + tftph_ack->u.ack.block = grub_cpu_to_be16 (block); + + err = grub_net_send_udp_packet (data->sock, &nb_ack); +@@ -333,7 +333,7 @@ tftp_open (struct grub_file *file, const char *filename) + rrq = (char *) tftph->u.rrq; + rrqlen = 0; + +- tftph->opcode = grub_cpu_to_be16 (TFTP_RRQ); ++ tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ); + grub_strcpy (rrq, filename); + rrqlen += grub_strlen (filename) + 1; + rrq += grub_strlen (filename) + 1; +@@ -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; + } +@@ -442,8 +443,8 @@ tftp_close (struct grub_file *file) + if (!err) + { + tftph = (struct tftphdr *) nb_err.data; +- tftph->opcode = grub_cpu_to_be16 (TFTP_ERROR); +- tftph->u.err.errcode = grub_cpu_to_be16 (TFTP_EUNDEF); ++ tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_ERROR); ++ tftph->u.err.errcode = grub_cpu_to_be16_compile_time (TFTP_EUNDEF); + grub_memcpy (tftph->u.err.errmsg, "closed", sizeof ("closed")); + + err = grub_net_send_udp_packet (data->sock, &nb_err); +diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c +index 3e4c337..eeb7ec1 100644 +--- a/grub-core/normal/charset.c ++++ b/grub-core/normal/charset.c +@@ -929,6 +929,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, + case GRUB_BIDI_TYPE_R: + case GRUB_BIDI_TYPE_AL: + bidi_needed = 1; ++ /* Fallthrough. */ + default: + { + if (join_state == JOIN_FORCE) +diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c +index 204d15a..a36180d 100644 +--- a/grub-core/normal/cmdline.c ++++ b/grub-core/normal/cmdline.c +@@ -389,6 +389,7 @@ grub_cmdline_get (const char *prompt_translated) + if (!unicode_msg) + { + grub_free (buf); ++ grub_free (cl_terms); + return 0; + } + msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len - 1, +diff --git a/grub-core/normal/color.c b/grub-core/normal/color.c +index c265423..d22cf90 100644 +--- a/grub-core/normal/color.c ++++ b/grub-core/normal/color.c +@@ -47,7 +47,7 @@ static int + parse_color_name (grub_uint8_t *ret, char *name) + { + grub_uint8_t i; +- for (i = 0; i < sizeof (color_list) / sizeof (*color_list); i++) ++ for (i = 0; i < ARRAY_SIZE(color_list); i++) + if (! grub_strcmp (name, color_list[i])) + { + *ret = i; +diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c +index 7e0a696..ee53d4a 100644 +--- a/grub-core/normal/context.c ++++ b/grub-core/normal/context.c +@@ -64,7 +64,10 @@ grub_env_new_context (int export_all) + return grub_errno; + menu = grub_zalloc (sizeof (*menu)); + if (! menu) +- return grub_errno; ++ { ++ grub_free (context); ++ return grub_errno; ++ } + + context->prev = grub_current_context; + grub_current_context = context; +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index c36663f..78a70a8 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)), + static grub_menu_t + read_config_file (const char *config) + { +- grub_file_t file; ++ grub_file_t rawfile, file; + char *old_file = 0, *old_dir = 0; + char *config_dir, *ptr = 0; + const char *ctmp; +@@ -122,10 +123,17 @@ read_config_file (const char *config) + } + + /* Try to open the config file. */ +- file = grub_file_open (config); +- if (! file) ++ rawfile = grub_file_open (config); ++ if (! rawfile) + return 0; + ++ file = grub_bufio_open (rawfile, 0); ++ if (! file) ++ { ++ grub_file_close (rawfile); ++ return 0; ++ } ++ + ctmp = grub_env_get ("config_file"); + if (ctmp) + old_file = grub_strdup (ctmp); +@@ -294,7 +302,7 @@ grub_enter_normal_mode (const char *config) + nested_level++; + grub_normal_execute (config, 0, 0); + grub_boot_time ("Entering shell"); +- grub_cmdline_run (0); ++ grub_cmdline_run (0, 1); + nested_level--; + if (grub_normal_exit_level) + grub_normal_exit_level--; +@@ -416,11 +424,15 @@ grub_normal_read_line (char **line, int cont, + } + + void +-grub_cmdline_run (int nested) ++grub_cmdline_run (int nested, int force_auth) + { + grub_err_t err = GRUB_ERR_NONE; + +- err = grub_auth_check_authentication (NULL); ++ do ++ { ++ err = grub_auth_check_authentication (NULL); ++ } ++ while (err && force_auth); + + if (err) + { +@@ -433,7 +445,7 @@ grub_cmdline_run (int nested) + + while (1) + { +- char *line; ++ char *line = NULL; + + if (grub_normal_exit_level) + break; +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index b47991a..719e2fb 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -773,7 +773,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + + case 'c': + menu_fini (); +- grub_cmdline_run (1); ++ grub_cmdline_run (1, 0); + goto refresh; + + case 'e': +diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c +index b485df8..62c7e16 100644 +--- a/grub-core/normal/menu_entry.c ++++ b/grub-core/normal/menu_entry.c +@@ -1396,7 +1396,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) + + case GRUB_TERM_CTRL | 'c': + case GRUB_TERM_KEY_F2: +- grub_cmdline_run (1); ++ grub_cmdline_run (1, 0); + goto refresh; + + case GRUB_TERM_CTRL | 'x': +diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c +index 2ff2941..e22bb91 100644 +--- a/grub-core/normal/menu_text.c ++++ b/grub-core/normal/menu_text.c +@@ -369,6 +369,9 @@ grub_menu_init_page (int nested, int edit, + geo->border = 0; + } + ++ if (geo->entry_width <= 0) ++ geo->entry_width = 1; ++ + if (geo->num_entries - msg_num_lines < 3 + && geo->timeout_lines == 2) + { +diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c +index 34d505e..38f91b9 100644 +--- a/grub-core/normal/misc.c ++++ b/grub-core/normal/misc.c +@@ -184,10 +184,11 @@ grub_normal_print_device_info (const char *name) + /* TRANSLATORS: Replace dot with appropriate decimal separator for + your language. */ + (grub_disk_get_size (dev->disk) & 1) ? _(".5") : ""); +- +- grub_device_close (dev); + } + ++ if (dev) ++ grub_device_close (dev); ++ + grub_xputs ("\n"); + return grub_errno; + } +diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c +index e1eeea7..7d99b54 100644 +--- a/grub-core/osdep/aros/hostdisk.c ++++ b/grub-core/osdep/aros/hostdisk.c +@@ -61,7 +61,7 @@ + static ULONG *bounce; + + char * +-canonicalize_file_name (const char *path) ++grub_canonicalize_file_name (const char *path) + { + char *ret; + BPTR lck; +diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c +index d02386b..0a77a04 100644 +--- a/grub-core/osdep/devmapper/getroot.c ++++ b/grub-core/osdep/devmapper/getroot.c +@@ -160,7 +160,10 @@ grub_util_pull_devmapper (const char *os_dev) + uuid = get_dm_uuid (os_dev); + + if (!grub_util_open_dm (os_dev, &tree, &node)) +- return; ++ { ++ grub_free (uuid); ++ return; ++ } + + while ((child = dm_tree_next_child (&handle, node, 0))) + { +@@ -192,6 +195,7 @@ grub_util_pull_devmapper (const char *os_dev) + } + else + dm_tree_free (tree); ++ grub_free (uuid); + } + + char * +@@ -253,6 +257,7 @@ grub_util_get_devmapper_grub_dev (const char *os_dev) + grub_free (uuid); + return grub_dev; + } ++ grub_free (uuid); + return NULL; + } + +@@ -279,6 +284,7 @@ grub_util_get_vg_uuid (const char *os_dev) + } + optr--; + *optr = '\0'; ++ grub_free (uuid); + return vgid; + } + +diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c +index bd5fddb..6145d07 100644 +--- a/grub-core/osdep/freebsd/hostdisk.c ++++ b/grub-core/osdep/freebsd/hostdisk.c +@@ -102,13 +102,20 @@ grub_util_fd_open (const char *os_dev, int flags) + if (! (sysctl_oldflags & 0x10) + && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, sysctl_size)) + { +- grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags"); +- return GRUB_UTIL_FD_INVALID; ++ if (errno == EPERM) ++ /* Running as an unprivileged user; don't worry about restoring ++ flags, although if we try to write to anything interesting such ++ as the MBR then we may fail later. */ ++ sysctl_oldflags = 0x10; ++ else ++ { ++ grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags"); ++ return GRUB_UTIL_FD_INVALID; ++ } + } + + ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); + +-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + if (! (sysctl_oldflags & 0x10) + && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_oldflags, sysctl_size)) + { +@@ -116,7 +123,6 @@ grub_util_fd_open (const char *os_dev, int flags) + close (ret); + return GRUB_UTIL_FD_INVALID; + } +-#endif + + return ret; + } +diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c +index 0852c5e..4e123c0 100644 +--- a/grub-core/osdep/haiku/getroot.c ++++ b/grub-core/osdep/haiku/getroot.c +@@ -65,7 +65,7 @@ grub_util_find_partition_start_os (const char *dev) + device_geometry geo; + if (ioctl (fd, B_GET_GEOMETRY, &geo, sizeof (geo)) < 0) + return 0; +- ret /= geo.bytes_per_sector; ++ ret /= geo.bytes_per_sector ? : 512; + close (fd); + return ret; + } +diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c +index f33a7d5..c77d608 100644 +--- a/grub-core/osdep/linux/blocklist.c ++++ b/grub-core/osdep/linux/blocklist.c +@@ -82,6 +82,8 @@ grub_install_get_blocklist (grub_device_t root_dev, + strerror (errno)); + if (bsize & (GRUB_DISK_SECTOR_SIZE - 1)) + grub_util_error ("%s", _("blocksize is not divisible by 512")); ++ if (!bsize) ++ grub_util_error ("%s", _("invalid zero blocksize")); + mul = bsize >> GRUB_DISK_SECTOR_BITS; + nblocks = (core_size + bsize - 1) / bsize; + if (mul == 0 || nblocks == 0) +@@ -128,6 +130,7 @@ grub_install_get_blocklist (grub_device_t root_dev, + & (GRUB_DISK_SECTOR_SIZE - 1), + fie2->fm_extents[i].fe_length, hook_data); + } ++ free (fie2); + } + close (fd); + } +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 772de0a..3978c71 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -226,7 +226,7 @@ grub_find_root_devices_from_btrfs (const char *dir) + char **ret; + + fd = open (dir, 0); +- if (!fd) ++ if (fd < 0) + return NULL; + + if (ioctl (fd, BTRFS_IOC_FS_INFO, &fsi) < 0) +@@ -274,11 +274,11 @@ get_btrfs_fs_prefix (const char *mount_path) + args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; + + if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) +- return NULL; ++ goto fail; + tree_id = args.treeid; + + if (fstat (fd, &st) < 0) +- return NULL; ++ goto fail; + inode_id = st.st_ino; + + while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID +@@ -309,16 +309,16 @@ get_btrfs_fs_prefix (const char *mount_path) + sargs.key.nr_items = 1; + + if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) +- return NULL; ++ goto fail; + + if (sargs.key.nr_items == 0) +- return NULL; +- ++ goto fail; ++ + 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 + { +@@ -336,16 +336,16 @@ get_btrfs_fs_prefix (const char *mount_path) + sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_INODE_REF; + + if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) +- return NULL; ++ goto fail; + + if (sargs.key.nr_items == 0) +- return NULL; ++ goto fail; + + inode_id = sargs.buf[2]; + + 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); +@@ -360,8 +360,14 @@ get_btrfs_fs_prefix (const char *mount_path) + ret[1+namelen] = '\0'; + } + if (!ret) +- return xstrdup ("/"); ++ ret = xstrdup ("/"); ++ close (fd); + return ret; ++ ++ fail: ++ free (ret); ++ close (fd); ++ return NULL; + } + + +@@ -688,7 +694,7 @@ char * + grub_util_part_to_disk (const char *os_dev, struct stat *st, + int *is_part) + { +- char *path = xmalloc (PATH_MAX); ++ char *path; + + if (! S_ISBLK (st->st_mode)) + { +@@ -696,6 +702,8 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, + return xstrdup (os_dev); + } + ++ path = xmalloc (PATH_MAX); ++ + if (! realpath (os_dev, path)) + return NULL; + +@@ -883,6 +891,36 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, + *pp = '\0'; + return path; + } ++ ++ /* If this is a loop device */ ++ if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') ++ { ++ char *pp = p + 4; ++ while (*pp >= '0' && *pp <= '9') ++ pp++; ++ if (*pp == 'p') ++ *is_part = 1; ++ /* /dev/loop[0-9]+p[0-9]* */ ++ *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/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c +index c96427a..06179fc 100644 +--- a/grub-core/osdep/linux/hostdisk.c ++++ b/grub-core/osdep/linux/hostdisk.c +@@ -376,7 +376,8 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f + + part_start = grub_partition_get_start (disk->partition); + +- strcpy (dev, grub_util_biosdisk_get_osdev (disk)); ++ strncpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev) - 1); ++ dev[sizeof(dev) - 1] = '\0'; + if (disk->partition + && strncmp (dev, "/dev/", 5) == 0) + { +@@ -439,7 +440,8 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f + if (*max == 0) + *max = ~0ULL; + is_partition = 0; +- strcpy (dev, grub_util_biosdisk_get_osdev (disk)); ++ strncpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev) - 1); ++ dev[sizeof(dev) - 1] = '\0'; + goto reopen; + } + sector -= part_start; +diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c +index 8f24bc9..a79682a 100644 +--- a/grub-core/osdep/linux/ofpath.c ++++ b/grub-core/osdep/linux/ofpath.c +@@ -122,12 +122,16 @@ find_obppath (const char *sysfs_path_orig) + 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); + } + + if (fd < 0 || fstat (fd, &st) < 0) + { ++ if (fd >= 0) ++ close (fd); + kill_trailing_dir(sysfs_path); + if (!strcmp(sysfs_path, "/sys")) + { +@@ -147,6 +151,9 @@ find_obppath (const char *sysfs_path_orig) + { + grub_util_info (_("cannot read `%s': %s"), path, strerror (errno)); + close(fd); ++ free (path); ++ free (of_path); ++ free (sysfs_path); + return NULL; + } + close(fd); +@@ -329,7 +336,7 @@ vendor_is_ATA(const char *path) + } + + static void +-check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address) ++check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address) + { + char *ed = strstr (sysfs_path, "end_device"); + char *p, *q, *path; +@@ -341,8 +348,10 @@ check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address) + return; + + /* SAS devices are identified using disk@$PHY_ID */ +- p = strdup (sysfs_path); ++ p = xstrdup (sysfs_path); + ed = strstr(p, "end_device"); ++ if (!ed) ++ return; + + q = ed; + while (*q && *q != '/') +@@ -480,6 +489,7 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev + snprintf(disk, sizeof (disk), + "/sas/%s@%lx,%lu:%c", disk_name, sas_address, longlun, 'a' + (part - 1)); + } ++ free (lunstr); + } + } + strcat(of_path, disk); +@@ -529,8 +539,8 @@ grub_util_devname_to_ofpath (const char *sys_devname) + ofpath = xstrdup ("floppy"); + else + { +- grub_util_warn (_("unknown device type %s\n"), device); +- return NULL; ++ grub_util_warn (_("unknown device type %s"), device); ++ ofpath = NULL; + } + + free (devnode); +diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c +index 4b9f6ef..775b6c0 100644 +--- a/grub-core/osdep/linux/platform.c ++++ b/grub-core/osdep/linux/platform.c +@@ -60,6 +60,43 @@ 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) >= 3) /* 2 digits plus newline */ ++ { ++ 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) + { +@@ -77,7 +114,7 @@ grub_install_get_default_x86_platform (void) + if (is_not_empty_directory ("/sys/firmware/efi")) + { + grub_util_info ("...found"); +- if (is_64_kernel ()) ++ if (read_platform_size() == 64) + return "x86_64-efi"; + else + return "i386-efi"; +diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c +index f4b0bb4..65effa9 100644 +--- a/grub-core/osdep/unix/config.c ++++ b/grub-core/osdep/unix/config.c +@@ -105,8 +105,8 @@ grub_util_load_config (struct grub_util_config *cfg) + *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\""); + + argv[2] = script; + argv[3] = '\0'; +diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c +index 47e3abc..cff359a 100644 +--- a/grub-core/osdep/unix/cputime.c ++++ b/grub-core/osdep/unix/cputime.c +@@ -9,7 +9,14 @@ grub_uint64_t + grub_util_get_cpu_time_ms (void) + { + struct tms tm; ++ static long sc_clk_tck; ++ if (!sc_clk_tck) ++ { ++ sc_clk_tck = sysconf(_SC_CLK_TCK); ++ if (sc_clk_tck <= 0) ++ sc_clk_tck = 1000; ++ } + + times (&tm); +- return (tm.tms_utime * 1000ULL) / sysconf(_SC_CLK_TCK); ++ return (tm.tms_utime * 1000ULL) / sc_clk_tck; + } +diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c +index e3887cb..14d483f 100644 +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -57,6 +57,9 @@ + #endif + + #include ++#if defined(HAVE_SYS_MKDEV_H) ++#include ++#endif + + #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + # include +@@ -491,7 +494,7 @@ grub_guess_root_devices (const char *dir_in) + char **os_dev = NULL; + struct stat st; + dev_t dev; +- char *dir = canonicalize_file_name (dir_in); ++ char *dir = grub_canonicalize_file_name (dir_in); + + if (!dir) + grub_util_error (_("failed to get canonical path of `%s'"), dir_in); +@@ -516,7 +519,7 @@ grub_guess_root_devices (const char *dir_in) + *cur = tmp; + else + { +- *cur = canonicalize_file_name (tmp); ++ *cur = grub_canonicalize_file_name (tmp); + if (*cur == NULL) + grub_util_error (_("failed to get canonical path of `%s'"), tmp); + free (tmp); +@@ -541,6 +544,7 @@ grub_guess_root_devices (const char *dir_in) + + if (stat (dir, &st) < 0) + grub_util_error (_("cannot stat `%s': %s"), dir, strerror (errno)); ++ free (dir); + + dev = st.st_dev; + +@@ -621,7 +625,10 @@ grub_util_pull_lvm_by_command (const char *os_dev) + free (vgname); + + if (!pid) +- return; ++ { ++ free (vgid); ++ return; ++ } + + /* Parent. Read vgs' output. */ + vgs = fdopen (fd, "r"); +@@ -653,6 +660,7 @@ out: + close (fd); + waitpid (pid, NULL, 0); + free (buf); ++ free (vgid); + } + + /* ZFS has similar problems to those of btrfs (see above). */ +diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c +index 43b56ff..2a8c588 100644 +--- a/grub-core/osdep/unix/hostdisk.c ++++ b/grub-core/osdep/unix/hostdisk.c +@@ -48,11 +48,6 @@ + #ifdef __linux__ + # include /* ioctl */ + # include +-# if !defined(__GLIBC__) || \ +- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) +-/* Maybe libc doesn't have large file support. */ +-# include /* _llseek */ +-# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ + #endif /* __linux__ */ + + grub_uint64_t +@@ -79,24 +74,6 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz + return st.st_size; + } + +-#if defined(__linux__) && (!defined(__GLIBC__) || \ +- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) +- /* Maybe libc doesn't have large file support. */ +-int +-grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) +-{ +- loff_t offset, result; +- static int _llseek (uint filedes, ulong hi, ulong lo, +- loff_t *res, uint wh); +- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, +- loff_t *, res, uint, wh); +- +- offset = (loff_t) off; +- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) +- return -1; +- return GRUB_ERR_NONE; +-} +-#else + int + grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) + { +@@ -107,7 +84,6 @@ grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) + + return 0; + } +-#endif + + + /* Read LEN bytes from FD in BUF. Return less than or equal to zero if an +@@ -222,7 +198,7 @@ grub_util_fd_close (grub_util_fd_t fd) + } + + char * +-canonicalize_file_name (const char *path) ++grub_canonicalize_file_name (const char *path) + { + #if defined (PATH_MAX) + char *ret; +diff --git a/grub-core/osdep/unix/password.c b/grub-core/osdep/unix/password.c +index 470a6ea..4b9507b 100644 +--- a/grub-core/osdep/unix/password.c ++++ b/grub-core/osdep/unix/password.c +@@ -53,7 +53,10 @@ grub_password_get (char buf[], unsigned buf_size) + 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_password_get (char buf[], unsigned buf_size) + grub_xputs ("\n"); + grub_refresh (); + ++ fclose (in); ++ + return 1; + } +diff --git a/grub-core/osdep/unix/relpath.c b/grub-core/osdep/unix/relpath.c +index 71c19d8..f719950 100644 +--- a/grub-core/osdep/unix/relpath.c ++++ b/grub-core/osdep/unix/relpath.c +@@ -44,14 +44,17 @@ grub_make_system_path_relative_to_its_root (const char *path) + char *poolfs = NULL; + + /* canonicalize. */ +- p = canonicalize_file_name (path); ++ p = grub_canonicalize_file_name (path); + if (p == NULL) + grub_util_error (_("failed to get canonical path of `%s'"), path); + + #ifdef __linux__ + ret = grub_make_system_path_relative_to_its_root_os (p); + if (ret) +- return ret; ++ { ++ free (p); ++ return ret; ++ } + #endif + + /* For ZFS sub-pool filesystems. */ +diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c +index d390b25..85507af 100644 +--- a/grub-core/osdep/windows/hostdisk.c ++++ b/grub-core/osdep/windows/hostdisk.c +@@ -328,7 +328,7 @@ grub_util_fd_strerror (void) + } + + char * +-canonicalize_file_name (const char *path) ++grub_canonicalize_file_name (const char *path) + { + char *ret; + LPTSTR windows_path; +diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c +index 98c325c..e8ffd62 100644 +--- a/grub-core/osdep/windows/init.c ++++ b/grub-core/osdep/windows/init.c +@@ -170,7 +170,7 @@ grub_util_host_init (int *argc __attribute__ ((unused)), + #error "Unsupported TCHAR size" + #endif + +- grub_util_base_directory = canonicalize_file_name ((*argv)[0]); ++ grub_util_base_directory = grub_canonicalize_file_name ((*argv)[0]); + if (!grub_util_base_directory) + grub_util_base_directory = xstrdup ((*argv)[0]); + for (ptr = grub_util_base_directory + strlen (grub_util_base_directory) - 1; +diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c +index f2b9d71..d217efe 100644 +--- a/grub-core/osdep/windows/platform.c ++++ b/grub-core/osdep/windows/platform.c +@@ -100,7 +100,7 @@ get_platform (void) + + if (!func_GetFirmwareEnvironmentVariableW (L"BootOrder", GRUB_EFI_GLOBAL_VARIABLE_GUID_WINDOWS_STR, + buffer, sizeof (buffer)) +- && GetLastError () != ERROR_INVALID_FUNCTION) ++ && GetLastError () == ERROR_INVALID_FUNCTION) + { + platform = PLAT_BIOS; + return; +diff --git a/grub-core/partmap/acorn.c b/grub-core/partmap/acorn.c +index 7bb93d9..c022c61 100644 +--- a/grub-core/partmap/acorn.c ++++ b/grub-core/partmap/acorn.c +@@ -25,8 +25,8 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-#define LINUX_NATIVE_MAGIC grub_cpu_to_le32 (0xdeafa1de) +-#define LINUX_SWAP_MAGIC grub_cpu_to_le32 (0xdeafab1e) ++#define LINUX_NATIVE_MAGIC grub_cpu_to_le32_compile_time (0xdeafa1de) ++#define LINUX_SWAP_MAGIC grub_cpu_to_le32_compile_time (0xdeafab1e) + #define LINUX_MAP_ENTRIES (512 / 12) + + #define NONADFS_PARTITION_TYPE_LINUX 9 +diff --git a/grub-core/partmap/bsdlabel.c b/grub-core/partmap/bsdlabel.c +index cf0f967..1d78590 100644 +--- a/grub-core/partmap/bsdlabel.c ++++ b/grub-core/partmap/bsdlabel.c +@@ -53,7 +53,7 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd, + return grub_errno; + + /* Check if it is valid. */ +- if (label.magic != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC)) ++ if (label.magic != grub_cpu_to_le32_compile_time (GRUB_PC_PARTITION_BSD_LABEL_MAGIC)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); + + /* A kludge to determine a base of be.offset. */ +diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c +index 38df7b3..83bcba7 100644 +--- a/grub-core/partmap/gpt.c ++++ b/grub-core/partmap/gpt.c +@@ -65,7 +65,7 @@ grub_gpt_partition_map_iterate (grub_disk_t disk, + return grub_errno; + + /* Check if it is valid. */ +- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) ++ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); + + /* Make sure the MBR is a protective MBR and not a normal MBR. */ +diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c +index 1d81a53..46c406b 100644 +--- a/grub-core/partmap/msdos.c ++++ b/grub-core/partmap/msdos.c +@@ -162,7 +162,7 @@ grub_partition_msdos_iterate (grub_disk_t disk, + lastaddr = p.offset; + + /* Check if it is valid. */ +- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) ++ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); + + for (i = 0; i < 4; i++) +@@ -280,7 +280,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, + lastaddr = offset; + + /* Check if it is valid. */ +- if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE)) ++ if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); + + for (i = 0; i < 4; i++) +diff --git a/grub-core/partmap/sun.c b/grub-core/partmap/sun.c +index dae3602..aac30a3 100644 +--- a/grub-core/partmap/sun.c ++++ b/grub-core/partmap/sun.c +@@ -91,7 +91,7 @@ sun_partition_map_iterate (grub_disk_t disk, + struct grub_partition p; + union + { +- struct grub_sun_block sun; ++ struct grub_sun_block sun_block; + grub_uint16_t raw[0]; + } block; + int partnum; +@@ -103,7 +103,7 @@ sun_partition_map_iterate (grub_disk_t disk, + if (err) + return err; + +- if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sun.magic)) ++ if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.sun_block.magic)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table"); + + if (! grub_sun_is_valid (block.raw)) +@@ -115,14 +115,14 @@ sun_partition_map_iterate (grub_disk_t disk, + { + struct grub_sun_partition_descriptor *desc; + +- if (block.sun.infos[partnum].id == 0 +- || block.sun.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID) ++ if (block.sun_block.infos[partnum].id == 0 ++ || block.sun_block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID) + continue; + +- desc = &block.sun.partitions[partnum]; ++ desc = &block.sun_block.partitions[partnum]; + p.start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder) +- * grub_be_to_cpu16 (block.sun.ntrks) +- * grub_be_to_cpu16 (block.sun.nsect)); ++ * grub_be_to_cpu16 (block.sun_block.ntrks) ++ * grub_be_to_cpu16 (block.sun_block.nsect)); + p.len = grub_be_to_cpu32 (desc->num_sectors); + p.number = p.index = partnum; + if (p.len) +diff --git a/grub-core/partmap/sunpc.c b/grub-core/partmap/sunpc.c +index 442763e..73a430c 100644 +--- a/grub-core/partmap/sunpc.c ++++ b/grub-core/partmap/sunpc.c +@@ -74,7 +74,7 @@ sun_pc_partition_map_iterate (grub_disk_t disk, + grub_partition_t p; + union + { +- struct grub_sun_pc_block sun; ++ struct grub_sun_pc_block sun_block; + grub_uint16_t raw[0]; + } block; + int partnum; +@@ -92,7 +92,7 @@ sun_pc_partition_map_iterate (grub_disk_t disk, + return err; + } + +- if (GRUB_PARTMAP_SUN_PC_MAGIC != grub_le_to_cpu16 (block.sun.magic)) ++ if (GRUB_PARTMAP_SUN_PC_MAGIC != grub_le_to_cpu16 (block.sun_block.magic)) + { + grub_free (p); + return grub_error (GRUB_ERR_BAD_PART_TABLE, +@@ -111,12 +111,12 @@ sun_pc_partition_map_iterate (grub_disk_t disk, + { + struct grub_sun_pc_partition_descriptor *desc; + +- if (block.sun.partitions[partnum].id == 0 +- || block.sun.partitions[partnum].id ++ if (block.sun_block.partitions[partnum].id == 0 ++ || block.sun_block.partitions[partnum].id + == GRUB_PARTMAP_SUN_PC_WHOLE_DISK_ID) + continue; + +- desc = &block.sun.partitions[partnum]; ++ desc = &block.sun_block.partitions[partnum]; + p->start = grub_le_to_cpu32 (desc->start_sector); + p->len = grub_le_to_cpu32 (desc->num_sectors); + p->number = partnum; +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index afd5513..bb70ebf 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -635,57 +635,77 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist, + { + case GRUB_SCRIPT_ARG_TYPE_VAR: + case GRUB_SCRIPT_ARG_TYPE_DQVAR: +- values = grub_script_env_get (arg->str, arg->type); +- for (i = 0; values && values[i]; i++) +- { +- if (i != 0 && grub_script_argv_next (&result)) +- goto fail; ++ { ++ int need_cleanup = 0; + +- if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR) +- { +- int len; +- char ch; +- char *p; +- char *op; +- const char *s = values[i]; +- +- len = grub_strlen (values[i]); +- /* \? -> \\\? */ +- /* \* -> \\\* */ +- /* \ -> \\ */ +- p = grub_malloc (len * 2 + 1); +- if (! p) +- goto fail; +- +- op = p; +- while ((ch = *s++)) +- { +- if (ch == '\\') +- { +- *op++ = '\\'; +- if (*s == '?' || *s == '*') +- *op++ = '\\'; +- } +- *op++ = ch; +- } +- *op = '\0'; +- +- if (grub_script_argv_append (&result, p, op - p)) +- { +- grub_free (p); +- goto fail; +- } +- } +- else +- { +- if (append (&result, values[i], 1)) +- goto fail; +- } +- +- grub_free (values[i]); +- } +- grub_free (values); +- break; ++ values = grub_script_env_get (arg->str, arg->type); ++ for (i = 0; values && values[i]; i++) ++ { ++ if (!need_cleanup) ++ { ++ if (i != 0 && grub_script_argv_next (&result)) ++ { ++ need_cleanup = 1; ++ goto cleanup; ++ } ++ ++ if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR) ++ { ++ int len; ++ char ch; ++ char *p; ++ char *op; ++ const char *s = values[i]; ++ ++ len = grub_strlen (values[i]); ++ /* \? -> \\\? */ ++ /* \* -> \\\* */ ++ /* \ -> \\ */ ++ p = grub_malloc (len * 2 + 1); ++ if (! p) ++ { ++ need_cleanup = 1; ++ goto cleanup; ++ } ++ ++ op = p; ++ while ((ch = *s++)) ++ { ++ if (ch == '\\') ++ { ++ *op++ = '\\'; ++ if (*s == '?' || *s == '*') ++ *op++ = '\\'; ++ } ++ *op++ = ch; ++ } ++ *op = '\0'; ++ ++ if (grub_script_argv_append (&result, p, op - p)) ++ { ++ grub_free (p); ++ need_cleanup = 1; ++ /* Fall through to cleanup */ ++ } ++ } ++ else ++ { ++ if (append (&result, values[i], 1)) ++ need_cleanup = 1; ++ /* Fall through to cleanup */ ++ } ++ } ++ ++cleanup: ++ grub_free (values[i]); ++ } ++ grub_free (values); ++ ++ if (need_cleanup) ++ goto fail; ++ ++ break; ++ } + + case GRUB_SCRIPT_ARG_TYPE_BLOCK: + { +diff --git a/grub-core/script/lexer.c b/grub-core/script/lexer.c +index 128d238..89cf677 100644 +--- a/grub-core/script/lexer.c ++++ b/grub-core/script/lexer.c +@@ -164,6 +164,7 @@ grub_script_lexer_yywrap (struct grub_parser_param *parserstate, + { + grub_free (line); + line = grub_strdup ("\n"); ++ len = 1; + } + else if (len && line[len - 1] != '\n') + { +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index f5071ce..c234e92 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -226,7 +226,7 @@ static const struct + {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, + }; + +-static int alive = 0, ping_sent; ++static int ping_sent; + + static void + keyboard_controller_wait_until_ready (void) +@@ -373,7 +373,7 @@ set_scancodes (void) + grub_dprintf ("atkeyb", "returned set %d\n", current_set); + if (current_set == 1) + return; +- grub_printf ("No supported scancode set found\n"); ++ grub_dprintf ("atkeyb", "no supported scancode set found\n"); + #endif + } + +@@ -396,6 +396,9 @@ fetch_key (int *is_break) + if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) + return -1; + at_key = grub_inb (KEYBOARD_REG_DATA); ++ /* May happen if no keyboard is connected. Just ignore this. */ ++ if (at_key == 0xff) ++ return -1; + if (at_key == 0xe0) + { + e0_received = 1; +@@ -540,7 +543,7 @@ grub_keyboard_getkey (void) + int + grub_at_keyboard_is_alive (void) + { +- if (alive) ++ if (current_set != 0) + return 1; + if (ping_sent + && KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)) +@@ -608,7 +611,6 @@ static void + grub_keyboard_controller_init (void) + { + at_keyboard_status = 0; +- alive = 1; + /* Drain input buffer. */ + while (1) + { +@@ -636,7 +638,7 @@ grub_keyboard_controller_init (void) + static grub_err_t + grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) + { +- if (!alive) ++ if (current_set == 0) + return GRUB_ERR_NONE; + if (grub_keyboard_orig_set) + write_mode (grub_keyboard_orig_set); +@@ -653,7 +655,7 @@ grub_at_fini_hw (int noreturn __attribute__ ((unused))) + static grub_err_t + grub_at_restore_hw (void) + { +- if (!alive) ++ if (current_set == 0) + return GRUB_ERR_NONE; + + /* Drain input buffer. */ +diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c +index c0911ad..4c94723 100644 +--- a/grub-core/term/efi/serial.c ++++ b/grub-core/term/efi/serial.c +@@ -173,7 +173,10 @@ grub_efiserial_init (void) + + port->name = grub_malloc (sizeof ("efiXXXXXXXXXXXXXXXXXXXX")); + if (!port->name) +- return; ++ { ++ grub_free (port); ++ return; ++ } + grub_snprintf (port->name, sizeof ("efiXXXXXXXXXXXXXXXXXXXX"), + "efi%d", num_serial++); + +diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c +index dc0669b..70f10f1 100644 +--- a/grub-core/term/gfxterm.c ++++ b/grub-core/term/gfxterm.c +@@ -221,6 +221,8 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, + calculate_normal_character_width (virtual_screen.font); + virtual_screen.normal_char_height = + grub_font_get_max_char_height (virtual_screen.font); ++ if (virtual_screen.normal_char_height == 0) ++ virtual_screen.normal_char_height = 16; + virtual_screen.cursor_x = 0; + virtual_screen.cursor_y = 0; + virtual_screen.cursor_state = 1; +diff --git a/grub-core/term/ns8250.c b/grub-core/term/ns8250.c +index 2959632..39809d0 100644 +--- a/grub-core/term/ns8250.c ++++ b/grub-core/term/ns8250.c +@@ -57,6 +57,8 @@ serial_get_divisor (const struct grub_serial_port *port __attribute__ ((unused)) + base_clock = config->base_clock ? (config->base_clock >> 4) : DEFAULT_BASE_CLOCK; + + divisor = (base_clock + (config->speed / 2)) / config->speed; ++ if (config->speed == 0) ++ return 0; + if (divisor > 0xffff || divisor == 0) + return 0; + actual_speed = base_clock / divisor; +diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c +index b581a76..db80b3b 100644 +--- a/grub-core/term/serial.c ++++ b/grub-core/term/serial.c +@@ -220,8 +220,12 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) + + config = port->config; + +- if (state[OPTION_SPEED].set) ++ if (state[OPTION_SPEED].set) { + config.speed = grub_strtoul (state[OPTION_SPEED].arg, 0, 0); ++ if (config.speed == 0) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("unsupported serial port parity")); ++ } + + if (state[OPTION_WORD].set) + config.word_len = grub_strtoul (state[OPTION_WORD].arg, 0, 0); +@@ -241,9 +245,9 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) + + if (state[OPTION_RTSCTS].set) + { +- if (grub_strcmp (state[OPTION_PARITY].arg, "on") == 0) ++ if (grub_strcmp (state[OPTION_RTSCTS].arg, "on") == 0) + config.rtscts = 1; +- if (grub_strcmp (state[OPTION_PARITY].arg, "off") == 0) ++ else if (grub_strcmp (state[OPTION_RTSCTS].arg, "off") == 0) + config.rtscts = 0; + else + return grub_error (GRUB_ERR_BAD_ARGUMENT, +@@ -275,6 +279,9 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) + config.base_clock *= 1000; + } + ++ if (config.speed == 0) ++ config.speed = 9600; ++ + /* Initialize with new settings. */ + err = port->driver->configure (port, &config); + if (err) +@@ -338,23 +345,23 @@ grub_serial_register (struct grub_serial_port *port) + grub_free (indata); + return grub_errno; + } +- +- out = grub_malloc (sizeof (*out)); ++ ++ out = grub_zalloc (sizeof (*out)); + if (!out) + { +- grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); ++ grub_free (in); + return grub_errno; + } + + outdata = grub_malloc (sizeof (*outdata)); + if (!outdata) + { +- grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); + grub_free (out); ++ grub_free (in); + return grub_errno; + } + +diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c +index 3d48b19..f0d3e3d 100644 +--- a/grub-core/term/terminfo.c ++++ b/grub-core/term/terminfo.c +@@ -460,28 +460,31 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + {'@', GRUB_TERM_KEY_INSERT}, + }; + +- static struct +- { +- char key; +- unsigned ascii; +- } +- four_code_table[] = ++ static unsigned four_code_table[] = + { +- {'1', GRUB_TERM_KEY_HOME}, +- {'3', GRUB_TERM_KEY_DC}, +- {'5', GRUB_TERM_KEY_PPAGE}, +- {'6', GRUB_TERM_KEY_NPAGE}, +- {'7', GRUB_TERM_KEY_HOME}, +- {'8', GRUB_TERM_KEY_END} ++ [1] = GRUB_TERM_KEY_HOME, ++ [3] = GRUB_TERM_KEY_DC, ++ [5] = GRUB_TERM_KEY_PPAGE, ++ [6] = GRUB_TERM_KEY_NPAGE, ++ [7] = GRUB_TERM_KEY_HOME, ++ [8] = GRUB_TERM_KEY_END, ++ [17] = GRUB_TERM_KEY_F6, ++ [18] = GRUB_TERM_KEY_F7, ++ [19] = GRUB_TERM_KEY_F8, ++ [20] = GRUB_TERM_KEY_F9, ++ [21] = GRUB_TERM_KEY_F10, ++ [23] = GRUB_TERM_KEY_F11, ++ [24] = GRUB_TERM_KEY_F12, + }; + char fx_key[] = + { 'P', 'Q', 'w', 'x', 't', 'u', +- 'q', 'r', 'p', 'M', 'A', 'B' }; ++ 'q', 'r', 'p', 'M', 'A', 'B', 'H', 'F' }; + unsigned fx_code[] = + { GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, + GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6, + GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9, +- GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12 }; ++ GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, ++ GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_END }; + unsigned i; + + if (c == '\e') +@@ -492,19 +495,13 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + { + CONTINUE_READ; + +- switch (c) +- { +- case 'H': +- keys[0] = GRUB_TERM_KEY_HOME; +- *len = 1; +- return; +- case 'F': +- keys[0] = GRUB_TERM_KEY_END; +- *len = 1; +- return; +- default: +- return; +- } ++ for (i = 0; i < ARRAY_SIZE (fx_key); i++) ++ if (fx_key[i] == c) ++ { ++ keys[0] = fx_code[i]; ++ *len = 1; ++ return; ++ } + } + + if (c != '[') +@@ -523,6 +520,15 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + + switch (c) + { ++ case '[': ++ CONTINUE_READ; ++ if (c >= 'A' && c <= 'E') ++ { ++ keys[0] = GRUB_TERM_KEY_F1 + c - 'A'; ++ *len = 1; ++ return; ++ } ++ return; + case 'O': + CONTINUE_READ; + for (i = 0; i < ARRAY_SIZE (fx_key); i++) +@@ -555,18 +561,26 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + return; + } + +- default: +- for (i = 0; i < ARRAY_SIZE (four_code_table); i++) +- if (four_code_table[i].key == c) ++ case '1' ... '9': ++ { ++ unsigned val = c - '0'; ++ CONTINUE_READ; ++ if (c >= '0' && c <= '9') + { ++ val = val * 10 + (c - '0'); + CONTINUE_READ; +- if (c != '~') +- return; +- keys[0] = four_code_table[i].ascii; +- *len = 1; +- return; + } +- return; ++ if (c != '~') ++ return; ++ if (val >= ARRAY_SIZE (four_code_table) ++ || four_code_table[val] == 0) ++ return; ++ keys[0] = four_code_table[val]; ++ *len = 1; ++ return; ++ } ++ default: ++ return; + } + } + #undef CONTINUE_READ +diff --git a/grub-core/tests/boot/kernel-8086.S b/grub-core/tests/boot/kernel-8086.S +index 510897c..5ec5368 100644 +--- a/grub-core/tests/boot/kernel-8086.S ++++ b/grub-core/tests/boot/kernel-8086.S +@@ -46,5 +46,5 @@ message: + .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" + .byte 0 + +- . = base + 510 +- .short 0xaa55 +\ No newline at end of file ++ .org 510 ++ .short 0xaa55 +diff --git a/grub-core/tests/bswap_test.c b/grub-core/tests/bswap_test.c +new file mode 100644 +index 0000000..4eb3a98 +--- /dev/null ++++ b/grub-core/tests/bswap_test.c +@@ -0,0 +1,121 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2015 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_uint64_t vectors[] = { ++ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL ++}; ++ ++static void ++test16 (grub_uint16_t a) ++{ ++ grub_uint16_t b, c; ++ grub_uint8_t *ap, *bp; ++ int i; ++ b = grub_swap_bytes16 (a); ++ c = grub_swap_bytes16 (b); ++ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", ++ (long long) a, (long long) b, (long long) c); ++ ap = (grub_uint8_t *) &a; ++ bp = (grub_uint8_t *) &b; ++ for (i = 0; i < 2; i++) ++ { ++ grub_test_assert (ap[i] == bp[1 - i], ++ "bswap bytes wrong: 0x%llx, 0x%llx", ++ (long long) a, (long long) b); ++ } ++} ++ ++static void ++test32 (grub_uint32_t a) ++{ ++ grub_uint32_t b, c; ++ grub_uint8_t *ap, *bp; ++ int i; ++ b = grub_swap_bytes32 (a); ++ c = grub_swap_bytes32 (b); ++ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", ++ (long long) a, (long long) b, (long long) c); ++ ap = (grub_uint8_t *) &a; ++ bp = (grub_uint8_t *) &b; ++ for (i = 0; i < 4; i++) ++ { ++ grub_test_assert (ap[i] == bp[3 - i], ++ "bswap bytes wrong: 0x%llx, 0x%llx", ++ (long long) a, (long long) b); ++ } ++} ++ ++static void ++test64 (grub_uint64_t a) ++{ ++ grub_uint64_t b, c; ++ grub_uint8_t *ap, *bp; ++ int i; ++ b = grub_swap_bytes64 (a); ++ c = grub_swap_bytes64 (b); ++ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx", ++ (long long) a, (long long) b, (long long) c); ++ ap = (grub_uint8_t *) &a; ++ bp = (grub_uint8_t *) &b; ++ for (i = 0; i < 4; i++) ++ { ++ grub_test_assert (ap[i] == bp[7 - i], ++ "bswap bytes wrong: 0x%llx, 0x%llx", ++ (long long) a, (long long) b); ++ } ++} ++ ++static void ++test_all(grub_uint64_t a) ++{ ++ test64 (a); ++ test32 (a); ++ test16 (a); ++} ++ ++static void ++bswap_test (void) ++{ ++ grub_uint64_t a = 404, b = 7; ++ grub_size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE (vectors); i++) ++ { ++ test_all (vectors[i]); ++ } ++ for (i = 0; i < 40000; i++) ++ { ++ a = 17 * a + 13 * b; ++ b = 23 * a + 29 * b; ++ if (b == 0) ++ b = 1; ++ if (a == 0) ++ a = 1; ++ test_all (a); ++ test_all (b); ++ } ++} ++ ++/* Register example_test method as a functional test. */ ++GRUB_FUNCTIONAL_TEST (bswap_test, bswap_test); +diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c +index c3de5c4..f1e2143 100644 +--- a/grub-core/tests/cmdline_cat_test.c ++++ b/grub-core/tests/cmdline_cat_test.c +@@ -109,7 +109,7 @@ cmdline_cat_test (void) + grub_video_checksum ("cmdline_cat"); + + if (!grub_test_use_gfxterm ()) +- grub_cmdline_run (1); ++ grub_cmdline_run (1, 0); + + grub_test_use_gfxterm_end (); + +diff --git a/grub-core/tests/cmp_test.c b/grub-core/tests/cmp_test.c +new file mode 100644 +index 0000000..af5b395 +--- /dev/null ++++ b/grub-core/tests/cmp_test.c +@@ -0,0 +1,190 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2015 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_uint64_t vectors[][2] = { ++ { 0xffffffffffffffffULL, 1}, ++ { 1, 0xffffffffffffffffULL}, ++ { 0xffffffffffffffffULL, 0xffffffffffffffffULL}, ++ { 1, 1 }, ++ { 2, 1 } ++}; ++ ++/* Don't change those to use shift as shift may call to compile rt ++ functions and we're not testing them now. ++ */ ++static int ++leading_bit64 (grub_uint64_t a) ++{ ++ return !!(a & 0x8000000000000000LL); ++} ++ ++static int ++leading_bit32 (grub_uint32_t a) ++{ ++ return !!(a & 0x80000000); ++} ++ ++/* Computes (a < b) without involving comparison operator. */ ++static int ++is_less32 (grub_uint32_t a, grub_uint32_t b) ++{ ++ if (leading_bit32(a) && !leading_bit32(b)) ++ return 0; ++ if (!leading_bit32(a) && leading_bit32(b)) ++ return 1; ++ return leading_bit32(a - b); ++} ++ ++static void ++test32 (grub_uint32_t a, grub_uint32_t b) ++{ ++ grub_test_assert ((a < b) == is_less32(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((a > b) == is_less32(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b < a) == is_less32(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b > a) == is_less32(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert (!(is_less32(a, b) && is_less32(b, a)), "comparison inconsistent: %lld, %lld", ++ (long long) a, (long long) b); ++} ++ ++/* Computes (a > b) without involving comparison operator. */ ++static int ++is_less32s (grub_int32_t a, grub_int32_t b) ++{ ++ if (leading_bit32(a) && !leading_bit32(b)) ++ return 1; /* a < 0 && b >= 0. */ ++ if (!leading_bit32(a) && leading_bit32(b)) ++ return 0; /* b < 0 && a >= 0. */ ++ return leading_bit32(a - b); ++} ++ ++static void ++test32s (grub_int32_t a, grub_int32_t b) ++{ ++ grub_test_assert ((a < b) == is_less32s(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((a > b) == is_less32s(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b < a) == is_less32s(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b > a) == is_less32s(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert (!(is_less32s(a, b) && is_less32s(b, a)), "comparison inconsistent: %lld, %lld", ++ (long long) a, (long long) b); ++} ++ ++/* Computes (a > b) without involving comparison operator. */ ++static int ++is_less64 (grub_uint64_t a, grub_uint64_t b) ++{ ++ if (leading_bit64(a) && !leading_bit64(b)) ++ return 0; ++ if (!leading_bit64(a) && leading_bit64(b)) ++ return 1; ++ return leading_bit64(a - b); ++} ++ ++static void ++test64 (grub_uint64_t a, grub_uint64_t b) ++{ ++ grub_test_assert ((a < b) == is_less64(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((a > b) == is_less64(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b < a) == is_less64(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b > a) == is_less64(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert (!(is_less64(a, b) && is_less64(b, a)), "comparison inconsistent: %lld, %lld", ++ (long long) a, (long long) b); ++} ++ ++/* Computes (a > b) without involving comparison operator. */ ++static int ++is_less64s (grub_int64_t a, grub_int64_t b) ++{ ++ if (leading_bit64(a) && !leading_bit64(b)) ++ return 1; /* a < 0 && b >= 0. */ ++ if (!leading_bit64(a) && leading_bit64(b)) ++ return 0; /* b < 0 && a >= 0. */ ++ return leading_bit64(a - b); ++} ++ ++static void ++test64s (grub_int64_t a, grub_int64_t b) ++{ ++ grub_test_assert ((a < b) == is_less64s(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((a > b) == is_less64s(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b < a) == is_less64s(b, a), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert ((b > a) == is_less64s(a, b), "comparison result mismatch: %lld, %lld", ++ (long long) a, (long long) b); ++ grub_test_assert (!(is_less64s(a, b) && is_less64s(b, a)), "comparison inconsistent: %lld, %lld", ++ (long long) a, (long long) b); ++} ++ ++static void ++test_all(grub_uint64_t a, grub_uint64_t b) ++{ ++ test64 (a, b); ++ test32 (a, b); ++ test64s (a, b); ++ test32s (a, b); ++ test64s (a, -b); ++ test32s (a, -b); ++ test64s (-a, b); ++ test32s (-a, b); ++ test64s (-a, -b); ++ test32s (-a, -b); ++} ++ ++static void ++cmp_test (void) ++{ ++ grub_uint64_t a = 404, b = 7; ++ grub_size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE (vectors); i++) ++ { ++ test_all (vectors[i][0], vectors[i][1]); ++ } ++ for (i = 0; i < 40000; i++) ++ { ++ a = 17 * a + 13 * b; ++ b = 23 * a + 29 * b; ++ if (b == 0) ++ b = 1; ++ if (a == 0) ++ a = 1; ++ test_all (a, b); ++ } ++} ++ ++/* Register example_test method as a functional test. */ ++GRUB_FUNCTIONAL_TEST (cmp_test, cmp_test); +diff --git a/grub-core/tests/ctz_test.c b/grub-core/tests/ctz_test.c +new file mode 100644 +index 0000000..eb7a1df +--- /dev/null ++++ b/grub-core/tests/ctz_test.c +@@ -0,0 +1,111 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++/* ull version is not used on i386 other than in this test. ++ Avoid requiring extra function. ++ */ ++#if defined (__i386__) ++#define SKIP_ULL 1 ++#endif ++ ++static grub_uint64_t vectors[] = { ++ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL ++}; ++ ++static void ++test_ui (unsigned int a) ++{ ++ int i; ++ a |= 1; ++ for (i = 0; i < (int) (8 * sizeof (a)); i++) ++ { ++ grub_test_assert (__builtin_ctz(a << i) == i, ++ "ctz mismatch: ctz(0x%llx) != 0x%x", ++ (long long) (a << i), __builtin_ctz(a << i)); ++ } ++} ++ ++static void ++test_ul (unsigned long a) ++{ ++ int i; ++ a |= 1; ++ for (i = 0; i < (int) (8 * sizeof (a)); i++) ++ { ++ grub_test_assert (__builtin_ctzl(a << i) == i, ++ "ctzl mismatch: ctzl(0x%llx) != 0x%x", ++ (long long) (a << i), __builtin_ctz(a << i)); ++ } ++} ++ ++#ifndef SKIP_ULL ++static void ++test_ull (unsigned long long a) ++{ ++ int i; ++ a |= 1; ++ for (i = 0; i < (int) (8 * sizeof (a)); i++) ++ { ++ grub_test_assert (__builtin_ctzll(a << i) == i, ++ "ctzll mismatch: ctzll(0x%llx) != 0x%x", ++ (long long) (a << i), __builtin_ctz(a << i)); ++ } ++} ++#endif ++ ++static void ++test_all(grub_uint64_t a) ++{ ++ test_ui (a); ++ test_ul (a); ++#ifndef SKIP_ULL ++ test_ull (a); ++#endif ++} ++ ++static void ++ctz_test (void) ++{ ++ grub_uint64_t a = 404, b = 7; ++ grub_size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE (vectors); i++) ++ { ++ test_all (vectors[i]); ++ } ++ for (i = 0; i < 40000; i++) ++ { ++ a = 17 * a + 13 * b; ++ b = 23 * a + 29 * b; ++ if (b == 0) ++ b = 1; ++ if (a == 0) ++ a = 1; ++ test_all (a); ++ test_all (b); ++ } ++} ++ ++/* Register example_test method as a functional test. */ ++GRUB_FUNCTIONAL_TEST (ctz_test, ctz_test); +diff --git a/grub-core/tests/div_test.c b/grub-core/tests/div_test.c +index 1928f85..9abc6d5 100644 +--- a/grub-core/tests/div_test.c ++++ b/grub-core/tests/div_test.c +@@ -34,6 +34,8 @@ static void + test32 (grub_uint32_t a, grub_uint32_t b) + { + grub_uint64_t q, r; ++ if (b == 0) ++ return; + q = grub_divmod64 (a, b, &r); + grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx", + (long long) a, (long long) b, (long long) r); +@@ -95,6 +97,72 @@ test64 (grub_uint64_t a, grub_uint64_t b) + #endif + } + ++static grub_int64_t ++abs64(grub_int64_t a) ++{ ++ return a > 0 ? a : -a; ++} ++ ++static void ++test32s (grub_int32_t a, grub_int32_t b) ++{ ++ grub_int64_t q, r; ++ if (b == 0) ++ return; ++ ++ q = grub_divmod64s (a, b, &r); ++ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld", ++ (long long) a, (long long) b, (long long) r); ++ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld", ++ (long long) a, (long long) b, (long long) q); ++ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld", ++ (long long) a, (long long) b, (long long) r); ++ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: %lld * %lld + %lld != %lld", (long long) q, (long long) b, (long long) r, ++ (long long) a); ++ if (0) { grub_test_assert (q == (a / b), ++ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b); ++ grub_test_assert (r == (a % b), ++ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b); ++ } ++} ++ ++static void ++test64s (grub_int64_t a, grub_int64_t b) ++{ ++ grub_int64_t q, r; ++ q = grub_divmod64s (a, b, &r); ++ ++ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld", ++ (long long) a, (long long) b, (long long) r); ++ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld", ++ (long long) a, (long long) b, (long long) q); ++ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld", ++ (long long) a, (long long) b, (long long) r); ++ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: 0x%llx * 0x%llx + 0x%llx != 0x%llx", (long long) q, (long long) b, (long long) r, ++ (long long) a); ++#if GRUB_TARGET_SIZEOF_VOID_P == 8 ++ grub_test_assert (q == (a / b), ++ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b); ++ grub_test_assert (r == (a % b), ++ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b); ++#endif ++} ++ ++static void ++test_all(grub_uint64_t a, grub_uint64_t b) ++{ ++ test64 (a, b); ++ test32 (a, b); ++ test64s (a, b); ++ test32s (a, b); ++ test64s (a, -b); ++ test32s (a, -b); ++ test64s (-a, b); ++ test32s (-a, b); ++ test64s (-a, -b); ++ test32s (-a, -b); ++} ++ + static void + div_test (void) + { +@@ -103,8 +171,7 @@ div_test (void) + + for (i = 0; i < ARRAY_SIZE (vectors); i++) + { +- test64 (vectors[i][0], vectors[i][1]); +- test32 (vectors[i][0], vectors[i][1]); ++ test_all (vectors[i][0], vectors[i][1]); + } + for (i = 0; i < 40000; i++) + { +@@ -114,9 +181,7 @@ div_test (void) + b = 1; + if (a == 0) + a = 1; +- test64 (a, b); +- test32 (a, b); +- ++ test_all (a, b); + } + } + +diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c +index 5be7a58..d4822a1 100644 +--- a/grub-core/tests/lib/functional_test.c ++++ b/grub-core/tests/lib/functional_test.c +@@ -65,6 +65,11 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), + grub_dl_load ("pbkdf2_test"); + grub_dl_load ("signature_test"); + grub_dl_load ("sleep_test"); ++ grub_dl_load ("bswap_test"); ++ grub_dl_load ("ctz_test"); ++ grub_dl_load ("cmp_test"); ++ grub_dl_load ("mul_test"); ++ grub_dl_load ("shift_test"); + + FOR_LIST_ELEMENTS (test, grub_test_list) + ok = !grub_test_run (test) && ok; +diff --git a/grub-core/tests/mul_test.c b/grub-core/tests/mul_test.c +new file mode 100644 +index 0000000..cd64231 +--- /dev/null ++++ b/grub-core/tests/mul_test.c +@@ -0,0 +1,73 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_uint64_t vectors[][2] = { ++ { 0xffffffffffffffffULL, 1}, ++ { 1, 0xffffffffffffffffULL}, ++ { 0xffffffffffffffffULL, 0xffffffffffffffffULL}, ++ { 1, 1 }, ++ { 2, 1 } ++}; ++ ++static void ++test64(grub_uint64_t a, grub_uint64_t b) ++{ ++ grub_uint64_t r1 = a * b, r2 = 0, r3; ++ int i; ++ for (i = 0; i < 64; i++) ++ if ((a & (1LL << i))) ++ r2 += b << i; ++ r3 = ((grub_int64_t) a) * ((grub_int64_t) b); ++ grub_test_assert (r1 == r2, ++ "multiplication mismatch (u): 0x%llx x 0x%llx = 0x%llx != 0x%llx", ++ (long long) a, (long long) b, (long long) r2, (long long) r1); ++ grub_test_assert (r3 == r2, ++ "multiplication mismatch (s): 0x%llx x 0x%llx = 0x%llx != 0x%llx", ++ (long long) a, (long long) b, (long long) r2, (long long) r3); ++} ++ ++static void ++mul_test (void) ++{ ++ grub_uint64_t a = 404, b = 7; ++ grub_size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE (vectors); i++) ++ { ++ test64 (vectors[i][0], vectors[i][1]); ++ } ++ for (i = 0; i < 40000; i++) ++ { ++ a = 17 * a + 13 * b; ++ b = 23 * a + 29 * b; ++ if (b == 0) ++ b = 1; ++ if (a == 0) ++ a = 1; ++ test64 (a, b); ++ } ++} ++ ++/* Register example_test method as a functional test. */ ++GRUB_FUNCTIONAL_TEST (mul_test, mul_test); +diff --git a/grub-core/tests/shift_test.c b/grub-core/tests/shift_test.c +new file mode 100644 +index 0000000..4120f52 +--- /dev/null ++++ b/grub-core/tests/shift_test.c +@@ -0,0 +1,157 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2015 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 ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_uint64_t vectors[] = { ++ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL ++}; ++ ++/* We're testing shifts, don't replace access to this with a shift. */ ++static const grub_uint8_t bitmask[] = ++ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; ++ ++typedef union { ++ grub_uint64_t v64; ++ grub_uint8_t v8[8]; ++} grub_raw_u64_t; ++ ++static int ++get_bit64 (grub_uint64_t v, int b) ++{ ++ grub_raw_u64_t vr = { .v64 = v }; ++ grub_uint8_t *p = vr.v8; ++ if (b >= 64) ++ return 0; ++#ifdef GRUB_CPU_WORDS_BIGENDIAN ++ p += 7 - b / 8; ++#else ++ p += b / 8; ++#endif ++ return !!(*p & bitmask[b % 8]); ++} ++ ++static grub_uint64_t ++set_bit64 (grub_uint64_t v, int b) ++{ ++ grub_raw_u64_t vr = { .v64 = v }; ++ grub_uint8_t *p = vr.v8; ++ if (b >= 64) ++ return v; ++#ifdef GRUB_CPU_WORDS_BIGENDIAN ++ p += 7 - b / 8; ++#else ++ p += b / 8; ++#endif ++ *p |= bitmask[b % 8]; ++ return vr.v64; ++} ++ ++static grub_uint64_t ++left_shift64 (grub_uint64_t v, int s) ++{ ++ grub_uint64_t r = 0; ++ int i; ++ for (i = 0; i + s < 64; i++) ++ if (get_bit64 (v, i)) ++ r = set_bit64 (r, i + s); ++ return r; ++} ++ ++static grub_uint64_t ++right_shift64 (grub_uint64_t v, int s) ++{ ++ grub_uint64_t r = 0; ++ int i; ++ for (i = s; i < 64; i++) ++ if (get_bit64 (v, i)) ++ r = set_bit64 (r, i - s); ++ return r; ++} ++ ++static grub_uint64_t ++arithmetic_right_shift64 (grub_uint64_t v, int s) ++{ ++ grub_uint64_t r = 0; ++ int i; ++ for (i = s; i < 64; i++) ++ if (get_bit64 (v, i)) ++ r = set_bit64 (r, i - s); ++ if (get_bit64 (v, 63)) ++ for (i -= s; i < 64; i++) ++ r = set_bit64 (r, i); ++ ++ return r; ++} ++ ++static void ++test64 (grub_uint64_t v) ++{ ++ int i; ++ for (i = 0; i < 64; i++) ++ { ++ grub_test_assert ((v << i) == left_shift64 (v, i), ++ "lshift wrong: 0x%llx << %d: 0x%llx, 0x%llx", ++ (long long) v, i, ++ (long long) (v << i), (long long) left_shift64 (v, i)); ++ grub_test_assert ((v >> i) == right_shift64 (v, i), ++ "rshift wrong: 0x%llx >> %d: 0x%llx, 0x%llx", ++ (long long) v, i, ++ (long long) (v >> i), (long long) right_shift64 (v, i)); ++ grub_test_assert ((((grub_int64_t) v) >> i) == (grub_int64_t) arithmetic_right_shift64 (v, i), ++ "arithmetic rshift wrong: ((grub_int64_t) 0x%llx) >> %d: 0x%llx, 0x%llx", ++ (long long) v, i, ++ (long long) (((grub_int64_t) v) >> i), (long long) arithmetic_right_shift64 (v, i)); ++ } ++} ++ ++static void ++test_all(grub_uint64_t a) ++{ ++ test64 (a); ++} ++ ++static void ++shift_test (void) ++{ ++ grub_uint64_t a = 404, b = 7; ++ grub_size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE (vectors); i++) ++ { ++ test_all (vectors[i]); ++ } ++ for (i = 0; i < 4000; i++) ++ { ++ a = 17 * a + 13 * b; ++ b = 23 * a + 29 * b; ++ if (b == 0) ++ b = 1; ++ if (a == 0) ++ a = 1; ++ test_all (a); ++ test_all (b); ++ } ++} ++ ++/* Register example_test method as a functional test. */ ++GRUB_FUNCTIONAL_TEST (shift_test, shift_test); +diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c +index 491bc55..74d5b65 100644 +--- a/grub-core/tests/video_checksum.c ++++ b/grub-core/tests/video_checksum.c +@@ -288,16 +288,16 @@ grub_video_capture_write_bmp (const char *fname, + if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB) + { + head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3); +- head.bmp_off = grub_cpu_to_le32 (sizeof (head)); ++ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head)); + head.bpp = grub_cpu_to_le16_compile_time (24); + } + else + { + head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height); +- head.bmp_off = grub_cpu_to_le32 (sizeof (head) + 3 * 256); ++ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head) + 3 * 256); + head.bpp = grub_cpu_to_le16_compile_time (8); + } +- head.head_size = grub_cpu_to_le32 (sizeof (head) - 14); ++ head.head_size = grub_cpu_to_le32_compile_time (sizeof (head) - 14); + head.width = grub_cpu_to_le16 (mode_info->width); + head.height = grub_cpu_to_le16 (mode_info->height); + head.planes = grub_cpu_to_le16_compile_time (1); +diff --git a/grub-core/video/bitmap_scale.c b/grub-core/video/bitmap_scale.c +index 0b93d02..70c32f0 100644 +--- a/grub-core/video/bitmap_scale.c ++++ b/grub-core/video/bitmap_scale.c +@@ -361,35 +361,46 @@ scale_nn (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) + unsigned dh = dst->mode_info.height; + unsigned sw = src->mode_info.width; + unsigned sh = src->mode_info.height; +- unsigned dstride = dst->mode_info.pitch; +- unsigned sstride = src->mode_info.pitch; ++ int dstride = dst->mode_info.pitch; ++ int sstride = src->mode_info.pitch; + /* bytes_per_pixel is the same for both src and dst. */ +- unsigned bytes_per_pixel = dst->mode_info.bytes_per_pixel; ++ int bytes_per_pixel = dst->mode_info.bytes_per_pixel; ++ unsigned dy, sy, ystep, yfrac, yover; ++ unsigned sx, xstep, xfrac, xover; ++ grub_uint8_t *dptr, *dline_end, *sline; + +- unsigned dy; +- for (dy = 0; dy < dh; dy++) ++ xstep = sw / dw; ++ xover = sw % dw; ++ ystep = sh / dh; ++ yover = sh % dh; ++ ++ for (dy = 0, sy = 0, yfrac = 0; dy < dh; dy++, sy += ystep, yfrac += yover) + { +- unsigned dx; +- for (dx = 0; dx < dw; dx++) ++ if (yfrac >= dh) ++ { ++ yfrac -= dh; ++ sy++; ++ } ++ dptr = ddata + dy * dstride; ++ dline_end = dptr + dw * bytes_per_pixel; ++ sline = sdata + sy * sstride; ++ for (sx = 0, xfrac = 0; dptr < dline_end; sx += xstep, xfrac += xover, dptr += bytes_per_pixel) + { +- grub_uint8_t *dptr; + grub_uint8_t *sptr; +- unsigned sx; +- unsigned sy; +- unsigned comp; ++ int comp; + +- /* Compute the source coordinate that the destination coordinate +- maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */ +- sx = sw * dx / dw; +- sy = sh * dy / dh; ++ if (xfrac >= dw) ++ { ++ xfrac -= dw; ++ sx++; ++ } + + /* Get the address of the pixels in src and dst. */ +- dptr = ddata + dy * dstride + dx * bytes_per_pixel; +- sptr = sdata + sy * sstride + sx * bytes_per_pixel; ++ sptr = sline + sx * bytes_per_pixel; + +- /* Copy the pixel color value. */ +- for (comp = 0; comp < bytes_per_pixel; comp++) +- dptr[comp] = sptr[comp]; ++ /* Copy the pixel color value. */ ++ for (comp = 0; comp < bytes_per_pixel; comp++) ++ dptr[comp] = sptr[comp]; + } + } + return GRUB_ERR_NONE; +@@ -422,27 +433,40 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) + int sstride = src->mode_info.pitch; + /* bytes_per_pixel is the same for both src and dst. */ + int bytes_per_pixel = dst->mode_info.bytes_per_pixel; ++ unsigned dy, syf, sy, ystep, yfrac, yover; ++ unsigned sxf, sx, xstep, xfrac, xover; ++ grub_uint8_t *dptr, *dline_end, *sline; ++ ++ xstep = (sw << 8) / dw; ++ xover = (sw << 8) % dw; ++ ystep = (sh << 8) / dh; ++ yover = (sh << 8) % dh; + +- unsigned dy; +- for (dy = 0; dy < dh; dy++) ++ for (dy = 0, syf = 0, yfrac = 0; dy < dh; dy++, syf += ystep, yfrac += yover) + { +- unsigned dx; +- for (dx = 0; dx < dw; dx++) ++ if (yfrac >= dh) ++ { ++ yfrac -= dh; ++ syf++; ++ } ++ sy = syf >> 8; ++ dptr = ddata + dy * dstride; ++ dline_end = dptr + dw * bytes_per_pixel; ++ sline = sdata + sy * sstride; ++ for (sxf = 0, xfrac = 0; dptr < dline_end; sxf += xstep, xfrac += xover, dptr += bytes_per_pixel) + { +- grub_uint8_t *dptr; + grub_uint8_t *sptr; +- unsigned sx; +- unsigned sy; + int comp; + +- /* Compute the source coordinate that the destination coordinate +- maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */ +- sx = sw * dx / dw; +- sy = sh * dy / dh; ++ if (xfrac >= dw) ++ { ++ xfrac -= dw; ++ sxf++; ++ } + + /* Get the address of the pixels in src and dst. */ +- dptr = ddata + dy * dstride + dx * bytes_per_pixel; +- sptr = sdata + sy * sstride + sx * bytes_per_pixel; ++ sx = sxf >> 8; ++ sptr = sline + sx * bytes_per_pixel; + + /* If we have enough space to do so, use bilinear interpolation. + Otherwise, fall back to nearest neighbor for this pixel. */ +@@ -453,27 +477,27 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src) + /* Fixed-point .8 numbers representing the fraction of the + distance in the x (u) and y (v) direction within the + box of 4 pixels in the source. */ +- int u = (256 * sw * dx / dw) - (sx * 256); +- int v = (256 * sh * dy / dh) - (sy * 256); ++ unsigned u = sxf & 0xff; ++ unsigned v = syf & 0xff; + + for (comp = 0; comp < bytes_per_pixel; comp++) + { + /* Get the component's values for the + four source corner pixels. */ +- int f00 = sptr[comp]; +- int f10 = sptr[comp + bytes_per_pixel]; +- int f01 = sptr[comp + sstride]; +- int f11 = sptr[comp + sstride + bytes_per_pixel]; ++ unsigned f00 = sptr[comp]; ++ unsigned f10 = sptr[comp + bytes_per_pixel]; ++ unsigned f01 = sptr[comp + sstride]; ++ unsigned f11 = sptr[comp + sstride + bytes_per_pixel]; + + /* Count coeffecients. */ +- int c00 = (256 - u) * (256 - v); +- int c10 = u * (256 - v); +- int c01 = (256 - u) * v; +- int c11 = u * v; ++ unsigned c00 = (256 - u) * (256 - v); ++ unsigned c10 = u * (256 - v); ++ unsigned c01 = (256 - u) * v; ++ unsigned c11 = u * v; + + /* Interpolate. */ +- int fxy = c00 * f00 + c01 * f01 + c10 * f10 + c11 * f11; +- fxy = fxy / (256 * 256); ++ unsigned fxy = c00 * f00 + c01 * f01 + c10 * f10 + c11 * f11; ++ fxy = fxy >> 16; + + dptr[comp] = fxy; + } +diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c +index 9098f90..3bcfa53 100644 +--- a/grub-core/video/bochs.c ++++ b/grub-core/video/bochs.c +@@ -359,6 +359,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height, + case 32: + framebuffer.mode_info.reserved_mask_size = 8; + framebuffer.mode_info.reserved_field_pos = 24; ++ /* Fallthrough. */ + + case 24: + framebuffer.mode_info.red_mask_size = 8; +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/grub-core/video/cirrus.c b/grub-core/video/cirrus.c +index 4913084..e2149e8 100644 +--- a/grub-core/video/cirrus.c ++++ b/grub-core/video/cirrus.c +@@ -440,6 +440,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, + case 32: + framebuffer.mode_info.reserved_mask_size = 8; + framebuffer.mode_info.reserved_field_pos = 24; ++ /* Fallthrough. */ + + case 24: + framebuffer.mode_info.red_mask_size = 8; +diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c +index 3a073ce..d559248 100644 +--- a/grub-core/video/fb/fbblit.c ++++ b/grub-core/video/fb/fbblit.c +@@ -1145,6 +1145,20 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst, + } + } + ++static inline grub_uint8_t ++alpha_dilute (grub_uint8_t bg, grub_uint8_t fg, grub_uint8_t alpha) ++{ ++ grub_uint16_t s; ++ grub_uint16_t h, l; ++ s = (fg * alpha) + (bg * (255 ^ alpha)); ++ /* Optimised division by 255. */ ++ h = s >> 8; ++ l = s & 0xff; ++ if (h + l >= 255) ++ h++; ++ return h; ++} ++ + /* Generic blending blitter. Works for every supported format. */ + static void + grub_video_fbblit_blend (struct grub_video_fbblit_info *dst, +@@ -1190,12 +1204,9 @@ grub_video_fbblit_blend (struct grub_video_fbblit_info *dst, + grub_video_fb_unmap_color_int (dst, dst_color, &dst_red, + &dst_green, &dst_blue, &dst_alpha); + +- dst_red = (((src_red * src_alpha) +- + (dst_red * (255 ^ src_alpha))) / 255U); +- dst_green = (((src_green * src_alpha) +- + (dst_green * (255 ^ src_alpha))) / 255U); +- dst_blue = (((src_blue * src_alpha) +- + (dst_blue * (255 ^ src_alpha))) / 255U); ++ dst_red = alpha_dilute (dst_red, src_red, src_alpha); ++ dst_green = alpha_dilute (dst_green, src_green, src_alpha); ++ dst_blue = alpha_dilute (dst_blue, src_blue, src_alpha); + + dst_alpha = src_alpha; + dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue, +@@ -1270,11 +1281,11 @@ grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst, + color = *dstptr; + + dr = (color >> 16) & 0xFF; +- dr = (dr * (255 ^ a) + sr * a) / 255U; ++ dr = alpha_dilute (dr, sr, a); + dg = (color >> 8) & 0xFF; +- dg = (dg * (255 ^ a) + sg * a) / 255U; ++ dg = alpha_dilute (dg, sg, a); + db = (color >> 0) & 0xFF; +- db = (db * (255 ^ a) + sb * a) / 255U; ++ db = alpha_dilute (db, sb, a); + } + + color = (a << 24) | (dr << 16) | (dg << 8) | db; +@@ -1360,9 +1371,9 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst, + db = dstptr[2]; + #endif + +- db = (db * (255 ^ a) + sb * a) / 255U; +- dg = (dg * (255 ^ a) + sg * a) / 255U; +- dr = (dr * (255 ^ a) + sr * a) / 255U; ++ db = alpha_dilute (db, sb, a); ++ dg = alpha_dilute (dg, sg, a); ++ dr = alpha_dilute (dr, sr, a); + } + + #ifndef GRUB_CPU_WORDS_BIGENDIAN +@@ -1440,9 +1451,9 @@ grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst, + dg = (color >> 8) & 0xFF; + db = (color >> 16) & 0xFF; + +- dr = (dr * (255 ^ a) + sr * a) / 255U; +- dg = (dg * (255 ^ a) + sg * a) / 255U; +- db = (db * (255 ^ a) + sb * a) / 255U; ++ dr = alpha_dilute (dr, sr, a); ++ dg = alpha_dilute (dg, sg, a); ++ db = alpha_dilute (db, sb, a); + + color = (a << 24) | (db << 16) | (dg << 8) | dr; + +@@ -1525,9 +1536,9 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst, + dr = dstptr[2]; + #endif + +- dr = (dr * (255 ^ a) + sr * a) / 255U; +- dg = (dg * (255 ^ a) + sg * a) / 255U; +- db = (db * (255 ^ a) + sb * a) / 255U; ++ dr = alpha_dilute (dr, sr, a); ++ dg = alpha_dilute (dg, sg, a); ++ db = alpha_dilute (db, sb, a); + + #ifndef GRUB_CPU_WORDS_BIGENDIAN + *dstptr++ = dr; +@@ -1601,9 +1612,9 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst, + + grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da); + +- dr = (dr * (255 ^ a) + sr * a) / 255U; +- dg = (dg * (255 ^ a) + sg * a) / 255U; +- db = (db * (255 ^ a) + sb * a) / 255U; ++ dr = alpha_dilute (dr, sr, a); ++ dg = alpha_dilute (dg, sg, a); ++ db = alpha_dilute (db, sb, a); + + color = grub_video_fb_map_rgb(dr, dg, db); + +@@ -1683,9 +1694,9 @@ grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst, + grub_uint8_t d2 = (*dstptr >> 8) & 0xFF; + grub_uint8_t d3 = (*dstptr >> 16) & 0xFF; + +- d1 = (d1 * (255 ^ a) + s1 * a) / 255U; +- d2 = (d2 * (255 ^ a) + s2 * a) / 255U; +- d3 = (d3 * (255 ^ a) + s3 * a) / 255U; ++ d1 = alpha_dilute (d1, s1, a); ++ d2 = alpha_dilute (d2, s2, a); ++ d3 = alpha_dilute (d3, s3, a); + + *dstptr = (a << 24) | (d3 << 16) | (d2 << 8) | d1; + } +@@ -1791,9 +1802,9 @@ grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst, + grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF; + grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF; + +- ((grub_uint8_t *) dstptr)[0] = (d1 * (255 ^ a) + s1 * a) / 255U; +- ((grub_uint8_t *) dstptr)[1] = (d2 * (255 ^ a) + s2 * a) / 255U; +- ((grub_uint8_t *) dstptr)[2] = (d3 * (255 ^ a) + s3 * a) / 255U; ++ ((grub_uint8_t *) dstptr)[0] = alpha_dilute (d1, s1, a); ++ ((grub_uint8_t *) dstptr)[1] = alpha_dilute (d2, s2, a); ++ ((grub_uint8_t *) dstptr)[2] = alpha_dilute (d3, s3, a); + } + + srcmask >>= 1; +@@ -1887,9 +1898,9 @@ grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst, + grub_uint8_t d2 = (*dstptr >> 5) & 0x3F; + grub_uint8_t d3 = (*dstptr >> 11) & 0x1F; + +- d1 = (d1 * (255 ^ a) + s1 * a) / 255U; +- d2 = (d2 * (255 ^ a) + s2 * a) / 255U; +- d3 = (d3 * (255 ^ a) + s3 * a) / 255U; ++ d1 = alpha_dilute (d1, s1, a); ++ d2 = alpha_dilute (d2, s2, a); ++ d3 = alpha_dilute (d3, s3, a); + + *dstptr = (d1 & 0x1f) | ((d2 & 0x3f) << 5) | ((d3 & 0x1f) << 11); + } +diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c +index 62b5c22..b7f9119 100644 +--- a/grub-core/video/i386/pc/vbe.c ++++ b/grub-core/video/i386/pc/vbe.c +@@ -304,8 +304,7 @@ grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size) + struct grub_bios_int_registers regs; + + regs.eax = 0x4f08; +- regs.ebx = (*dac_mask_size & 0xff) >> 8; +- regs.ebx = set ? 1 : 0; ++ regs.ebx = ((*dac_mask_size & 0xff) << 8) | (set ? 1 : 0); + regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; + grub_bios_interrupt (0x10, ®s); + *dac_mask_size = (regs.ebx >> 8) & 0xff; +@@ -875,6 +874,7 @@ vbe2videoinfo (grub_uint32_t mode, + /* CGA is basically 4-bit packed pixel. */ + case GRUB_VBE_MEMORY_MODEL_CGA: + mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA; ++ /* Fallthrough. */ + case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL: + mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + break; +@@ -887,6 +887,7 @@ vbe2videoinfo (grub_uint32_t mode, + /* Non chain 4 is a special case of planar. */ + case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256: + mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4; ++ /* Fallthrough. */ + case GRUB_VBE_MEMORY_MODEL_PLANAR: + mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR + | GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index 2dc2ee1..c3e0df2 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -94,7 +94,7 @@ struct grub_jpeg_data + jpeg_data_unit_t crdu; + jpeg_data_unit_t cbdu; + +- unsigned vs, hs; ++ unsigned log_vs, log_hs; + int dri; + unsigned r1; + +@@ -315,11 +315,14 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) + ss = grub_jpeg_get_byte (data); /* Sampling factor. */ + if (!id) + { +- data->vs = ss & 0xF; /* Vertical sampling. */ +- data->hs = ss >> 4; /* Horizontal sampling. */ +- if ((data->vs > 2) || (data->hs > 2)) ++ grub_uint8_t vs, hs; ++ vs = ss & 0xF; /* Vertical sampling. */ ++ hs = ss >> 4; /* Horizontal sampling. */ ++ if ((vs > 2) || (hs > 2) || (vs == 0) || (hs == 0)) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: sampling method not supported"); ++ data->log_vs = (vs == 2); ++ data->log_hs = (hs == 2); + } + else if (ss != JPEG_SAMPLING_1x1) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, +@@ -616,10 +619,10 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + unsigned c1, vb, hb, nr1, nc1; + int rst = data->dri; + +- vb = data->vs * 8; +- hb = data->hs * 8; +- nr1 = (data->image_height + vb - 1) / vb; +- nc1 = (data->image_width + hb - 1) / hb; ++ vb = 8 << data->log_vs; ++ hb = 8 << data->log_hs; ++ nr1 = (data->image_height + vb - 1) >> (3 + data->log_vs); ++ nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs); + + for (; data->r1 < nr1 && (!data->dri || rst); + data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) +@@ -629,8 +632,8 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + unsigned r2, c2, nr2, nc2; + grub_uint8_t *ptr2; + +- for (r2 = 0; r2 < data->vs; r2++) +- for (c2 = 0; c2 < data->hs; c2++) ++ for (r2 = 0; r2 < (1U << data->log_vs); r2++) ++ for (c2 = 0; c2 < (1U << data->log_hs); c2++) + grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); + + if (data->color_components >= 3) +@@ -652,7 +655,7 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + unsigned i0; + int yy; + +- i0 = (r2 / data->vs) * 8 + (c2 / data->hs); ++ i0 = (r2 >> data->log_vs) * 8 + (c2 >> data->log_hs); + yy = data->ydu[(r2 / 8) * 2 + (c2 / 8)][(r2 % 8) * 8 + (c2 % 8)]; + + if (data->color_components >= 3) +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 1f03f88..e1a01e9 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -227,7 +227,7 @@ grub_png_decode_image_palette (struct grub_png_data *data, + { + unsigned i = 0, j; + +- if (len == 0 || len % 3 != 0) ++ if (len == 0) + return GRUB_ERR_NONE; + + for (i = 0; 3 * i < len && i < 256; i++) +@@ -851,15 +851,26 @@ grub_png_convert_image (struct grub_png_data *data) + int mask = (1 << data->color_bits) - 1; + unsigned j; + if (data->is_gray) +- for (i = 0; i < (1U << data->color_bits); i++) +- { +- grub_uint8_t col = (0xff * i) / ((1U << data->color_bits) - 1); +- palette[i][0] = col; +- palette[i][1] = col; +- palette[i][2] = col; +- } ++ { ++ /* Generic formula is ++ (0xff * i) / ((1U << data->color_bits) - 1) ++ but for allowed bit depth of 1, 2 and for it's ++ equivalent to ++ (0xff / ((1U << data->color_bits) - 1)) * i ++ Precompute the multipliers to avoid division. ++ */ ++ ++ const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 }; ++ for (i = 0; i < (1U << data->color_bits); i++) ++ { ++ grub_uint8_t col = multipliers[data->color_bits] * i; ++ palette[i][0] = col; ++ palette[i][1] = col; ++ palette[i][2] = col; ++ } ++ } + else +- grub_memcpy (palette, data->palette, 16 * 3); ++ grub_memcpy (palette, data->palette, 3 << data->color_bits); + d1c = d1; + d2c = d2; + for (j = 0; j < data->image_height; j++, d1c += data->image_width * 3, +diff --git a/include/grub/acpi.h b/include/grub/acpi.h +index 2ac2bd6..f6e6a11 100644 +--- a/include/grub/acpi.h ++++ b/include/grub/acpi.h +@@ -191,7 +191,8 @@ void grub_acpi_halt (void); + enum + { + GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1, +- GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a, ++ GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_ALIAS = 0x06, ++ GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a, + GRUB_ACPI_OPCODE_WORD_CONST = 0x0b, + GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c, + GRUB_ACPI_OPCODE_STRING_CONST = 0x0d, +@@ -199,6 +200,22 @@ enum + GRUB_ACPI_OPCODE_BUFFER = 0x11, + GRUB_ACPI_OPCODE_PACKAGE = 0x12, + GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b, ++ GRUB_ACPI_OPCODE_ADD = 0x72, ++ GRUB_ACPI_OPCODE_CONCAT = 0x73, ++ GRUB_ACPI_OPCODE_SUBTRACT = 0x74, ++ GRUB_ACPI_OPCODE_MULTIPLY = 0x77, ++ GRUB_ACPI_OPCODE_DIVIDE = 0x78, ++ GRUB_ACPI_OPCODE_LSHIFT = 0x79, ++ GRUB_ACPI_OPCODE_RSHIFT = 0x7a, ++ GRUB_ACPI_OPCODE_AND = 0x7b, ++ GRUB_ACPI_OPCODE_NAND = 0x7c, ++ GRUB_ACPI_OPCODE_OR = 0x7d, ++ GRUB_ACPI_OPCODE_NOR = 0x7e, ++ GRUB_ACPI_OPCODE_XOR = 0x7f, ++ GRUB_ACPI_OPCODE_CONCATRES = 0x84, ++ GRUB_ACPI_OPCODE_MOD = 0x85, ++ GRUB_ACPI_OPCODE_INDEX = 0x88, ++ GRUB_ACPI_OPCODE_TOSTRING = 0x9c, + GRUB_ACPI_OPCODE_CREATE_WORD_FIELD = 0x8b, + GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD = 0x8c, + GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff +diff --git a/include/grub/arm/reloc.h b/include/grub/arm/reloc.h +index b938037..ae92e21 100644 +--- a/include/grub/arm/reloc.h ++++ b/include/grub/arm/reloc.h +@@ -43,4 +43,9 @@ void + grub_arm_jump24_set_offset (grub_uint32_t *target, + grub_int32_t offset); + ++grub_uint16_t ++grub_arm_thm_movw_movt_get_value (grub_uint16_t *target); ++void ++grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value); ++ + #endif +diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h +index 864e5dc..65796d9 100644 +--- a/include/grub/arm64/linux.h ++++ b/include/grub/arm64/linux.h +@@ -23,6 +23,10 @@ + + #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */ + ++#define GRUB_EFI_PAGE_SHIFT 12 ++#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) ++#define GRUB_EFI_PE_MAGIC 0x5A4D ++ + /* From linux/Documentation/arm64/booting.txt */ + struct grub_arm64_linux_kernel_header + { +@@ -38,4 +42,11 @@ struct grub_arm64_linux_kernel_header + grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ + }; + ++/* Declare the functions for getting dtb and checking/booting image */ ++void *grub_linux_get_fdt (void); ++grub_err_t grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header ++ *lh); ++grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, ++ char *args); ++ + #endif /* ! GRUB_LINUX_CPU_HEADER */ +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-rt-emu.h b/include/grub/compiler-rt-emu.h +new file mode 100644 +index 0000000..edc8299 +--- /dev/null ++++ b/include/grub/compiler-rt-emu.h +@@ -0,0 +1,235 @@ ++/* compiler-rt-emu.h - prototypes for compiler helpers. */ ++/* ++ * 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_RT_HEADER ++#define GRUB_COMPILER_RT_HEADER 1 ++ ++#include ++#include ++#include ++ ++#ifdef HAVE___UDIVSI3 ++grub_uint32_t ++EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); ++#endif ++ ++#ifdef HAVE___UMODSI3 ++grub_uint32_t ++EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); ++#endif ++ ++#ifdef HAVE___DIVSI3 ++grub_int32_t ++EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); ++#endif ++ ++#ifdef HAVE___MODSI3 ++grub_int32_t ++EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); ++#endif ++ ++#ifdef HAVE___DIVDI3 ++grub_int64_t ++EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); ++#endif ++ ++#ifdef HAVE___MODDI3 ++grub_int64_t ++EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); ++#endif ++ ++#ifdef HAVE___UDIVDI3 ++grub_uint64_t ++EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++#ifdef HAVE___UMODDI3 ++grub_uint64_t ++EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++#ifdef HAVE___CTZDI2 ++unsigned ++EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); ++#endif ++ ++#ifdef HAVE___CTZSI2 ++unsigned ++EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); ++#endif ++ ++#ifdef HAVE___AEABI_UIDIV ++grub_uint32_t ++EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); ++#endif ++ ++#ifdef HAVE___AEABI_UIDIVMOD ++grub_uint32_t ++EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); ++#endif ++ ++#ifdef HAVE___AEABI_IDIV ++grub_int32_t ++EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); ++#endif ++ ++#ifdef HAVE___AEABI_IDIVMOD ++grub_int32_t ++EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); ++#endif ++ ++#ifdef HAVE___AEABI_ULCMP ++int ++EXPORT_FUNC (__aeabi_ulcmp) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++/* Needed for allowing modules to be compiled as thumb. */ ++#ifdef HAVE___MULDI3 ++grub_uint64_t ++EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++#ifdef HAVE___AEABI_LMUL ++grub_uint64_t ++EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++#ifdef HAVE___AEABI_MEMCPY ++void * ++EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); ++#endif ++ ++#ifdef HAVE___AEABI_MEMSET ++void * ++EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); ++#endif ++ ++#ifdef HAVE___AEABI_LASR ++grub_uint64_t ++EXPORT_FUNC (__aeabi_lasr) (grub_uint64_t u, int b); ++#endif ++ ++#ifdef HAVE___AEABI_LLSL ++grub_uint64_t ++EXPORT_FUNC (__aeabi_llsl) (grub_uint64_t u, int b); ++#endif ++ ++#ifdef HAVE___AEABI_LLSR ++grub_uint64_t ++EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b); ++#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 ++ ++#ifdef HAVE___UCMPDI2 ++int ++EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b); ++#endif ++ ++#ifdef HAVE___ASHLDI3 ++grub_uint64_t ++EXPORT_FUNC(__ashldi3) (grub_uint64_t u, int b); ++#endif ++ ++#ifdef HAVE___ASHRDI3 ++grub_uint64_t ++EXPORT_FUNC(__ashrdi3) (grub_uint64_t u, int b); ++#endif ++ ++#ifdef HAVE___LSHRDI3 ++grub_uint64_t ++EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b); ++#endif ++ ++#ifdef HAVE___BSWAPSI2 ++grub_uint32_t ++EXPORT_FUNC(__bswapsi2) (grub_uint32_t u); ++#endif ++ ++#ifdef HAVE___BSWAPDI2 ++grub_uint64_t ++EXPORT_FUNC(__bswapdi2) (grub_uint64_t u); ++#endif ++ ++int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); ++void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); ++void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); ++void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); ++ ++#ifdef HAVE___BZERO ++void EXPORT_FUNC (__bzero) (void *s, grub_size_t n); ++#endif ++ ++#ifdef HAVE___REGISTER_FRAME_INFO ++void EXPORT_FUNC (__register_frame_info) (void); ++#endif ++ ++#ifdef HAVE___DEREGISTER_FRAME_INFO ++void EXPORT_FUNC (__deregister_frame_info) (void); ++#endif ++#ifdef HAVE____CHKSTK_MS ++void EXPORT_FUNC (___chkstk_ms) (void); ++#endif ++ ++#ifdef HAVE___CHKSTK_MS ++void EXPORT_FUNC (__chkstk_ms) (void); ++#endif ++ ++#endif ++ +diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h +new file mode 100644 +index 0000000..9265c7e +--- /dev/null ++++ b/include/grub/compiler-rt.h +@@ -0,0 +1,193 @@ ++/* compiler-rt.h - prototypes for compiler helpers. */ ++/* ++ * 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_RT_HEADER ++#define GRUB_COMPILER_RT_HEADER 1 ++ ++#include ++#include ++#include ++#include ++ ++#if defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE ++ ++grub_uint32_t ++EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); ++ ++grub_uint32_t ++EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); ++ ++grub_int32_t ++EXPORT_FUNC (__divsi3) (grub_int32_t a, grub_int32_t b); ++ ++grub_int32_t ++EXPORT_FUNC (__modsi3) (grub_int32_t a, grub_int32_t b); ++ ++grub_int64_t ++EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b); ++ ++grub_int64_t ++EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b); ++ ++grub_uint64_t ++EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); ++ ++grub_uint64_t ++EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); ++ ++#endif ++ ++#if defined (__sparc__) || defined (__powerpc__) || defined (__mips__) || defined (__arm__) ++unsigned ++EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); ++#define NEED_CTZDI2 1 ++#endif ++ ++#if defined (__mips__) || defined (__arm__) ++unsigned ++EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); ++#define NEED_CTZSI2 1 ++#endif ++ ++#ifdef __arm__ ++grub_uint32_t ++EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); ++grub_uint32_t ++EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); ++ ++grub_int32_t ++EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b); ++grub_int32_t ++EXPORT_FUNC (__aeabi_idivmod) (grub_int32_t a, grub_int32_t b); ++ ++int ++EXPORT_FUNC (__aeabi_ulcmp) (grub_uint64_t a, grub_uint64_t b); ++ ++/* Needed for allowing modules to be compiled as thumb. */ ++grub_uint64_t ++EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); ++grub_uint64_t ++EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); ++ ++void * ++EXPORT_FUNC (__aeabi_memcpy) (void *dest, const void *src, grub_size_t n); ++void * ++EXPORT_FUNC(__aeabi_memset) (void *s, int c, grub_size_t n); ++ ++grub_uint64_t ++EXPORT_FUNC (__aeabi_lasr) (grub_uint64_t u, int b); ++ ++grub_uint64_t ++EXPORT_FUNC (__aeabi_llsl) (grub_uint64_t u, int b); ++ ++grub_uint64_t ++EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b); ++ ++#endif ++ ++ ++#if defined (__powerpc__) ++ ++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 (__powerpc__) || defined(__mips__) || defined (__arm__) ++ ++int ++EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b); ++ ++grub_uint64_t ++EXPORT_FUNC(__ashldi3) (grub_uint64_t u, int b); ++ ++grub_uint64_t ++EXPORT_FUNC(__ashrdi3) (grub_uint64_t u, int b); ++ ++grub_uint64_t ++EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b); ++#endif ++ ++#if defined (__powerpc__) || defined(__mips__) || defined(__sparc__) || defined (__arm__) ++grub_uint32_t ++EXPORT_FUNC(__bswapsi2) (grub_uint32_t u); ++ ++grub_uint64_t ++EXPORT_FUNC(__bswapdi2) (grub_uint64_t u); ++#endif ++ ++#if defined (__APPLE__) && defined(__i386__) ++#define GRUB_BUILTIN_ATTR __attribute__ ((regparm(0))) ++#else ++#define GRUB_BUILTIN_ATTR ++#endif ++ ++/* Prototypes for aliases. */ ++int GRUB_BUILTIN_ATTR EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); ++void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); ++void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); ++void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); ++ ++#ifdef __APPLE__ ++void GRUB_BUILTIN_ATTR EXPORT_FUNC (__bzero) (void *s, grub_size_t n); ++#endif ++ ++#if defined (__MINGW32__) || defined (__CYGWIN__) ++void EXPORT_FUNC (__register_frame_info) (void); ++void EXPORT_FUNC (__deregister_frame_info) (void); ++void EXPORT_FUNC (___chkstk_ms) (void); ++void EXPORT_FUNC (__chkstk_ms) (void); ++#endif ++ ++#endif ++ +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/crypto.h b/include/grub/crypto.h +index ec1b980..a24e89d 100644 +--- a/include/grub/crypto.h ++++ b/include/grub/crypto.h +@@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char *file, int line, + const char *func) __attribute__ ((noreturn)); + + void _gcry_burn_stack (int bytes); +-void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); ++void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (__printf__, 1, 2))); + + + #ifdef GRUB_UTIL +diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h +index 66f3e1e..f2ad2a7 100644 +--- a/include/grub/cryptodisk.h ++++ b/include/grub/cryptodisk.h +@@ -145,7 +145,8 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name, + grub_disk_t source, const char *cheat); + void + grub_util_cryptodisk_get_abstraction (grub_disk_t disk, +- void (*cb) (const char *val)); ++ void (*cb) (const char *val, void *data), ++ void *data); + + char * + grub_util_get_geli_uuid (const char *dev); +diff --git a/include/grub/diskfilter.h b/include/grub/diskfilter.h +index 042fe04..1aedcd3 100644 +--- a/include/grub/diskfilter.h ++++ b/include/grub/diskfilter.h +@@ -202,7 +202,8 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk, + struct grub_diskfilter_vg **vg); + void + grub_diskfilter_get_partmap (grub_disk_t disk, +- void (*cb) (const char *val)); ++ void (*cb) (const char *val, void *data), ++ void *data); + #endif + + #endif /* ! GRUB_RAID_H */ +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/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 --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, +diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h +index dde48c1..df6085b 100644 +--- a/include/grub/emu/misc.h ++++ b/include/grub/emu/misc.h +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + extern int verbosity; + extern const char *program_name; +@@ -53,16 +54,14 @@ grub_util_device_is_mapped (const char *dev); + void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT; + void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT; + char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT; +-char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT; ++char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))) WARN_UNUSED_RESULT; + +-void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +-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_warn) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); ++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_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); + +-extern char * canonicalize_file_name (const char *path); +- + #ifdef HAVE_DEVICE_MAPPER + int grub_device_mapper_supported (void); + #endif +diff --git a/include/grub/err.h b/include/grub/err.h +index 9896fcc..1590c68 100644 +--- a/include/grub/err.h ++++ b/include/grub/err.h +@@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void); + void EXPORT_FUNC(grub_print_error) (void); + extern int EXPORT_VAR(grub_err_printed_errors); + int grub_err_printf (const char *fmt, ...) +- __attribute__ ((format (printf, 1, 2))); ++ __attribute__ ((format (__printf__, 1, 2))); + + #endif /* ! GRUB_ERR_HEADER */ +diff --git a/include/grub/fdt.h b/include/grub/fdt.h +index 3016998..fdfca75 100644 +--- a/include/grub/fdt.h ++++ b/include/grub/fdt.h +@@ -117,4 +117,16 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, + grub_fdt_set_prop ((fdt), (nodeoffset), (name), &_val, 8); \ + }) + ++/* Setup "reg" property for ++ * #address-cells = <0x2> ++ * #size-cells = <0x2> ++ */ ++#define grub_fdt_set_reg64(fdt, nodeoffset, addr, size) \ ++({ \ ++ grub_uint64_t reg_64[2]; \ ++ reg_64[0] = grub_cpu_to_be64(addr); \ ++ reg_64[1] = grub_cpu_to_be64(size); \ ++ grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ ++}) ++ + #endif /* ! GRUB_FDT_HEADER */ +diff --git a/include/grub/hfsplus.h b/include/grub/hfsplus.h +index 8ba8f32..117740a 100644 +--- a/include/grub/hfsplus.h ++++ b/include/grub/hfsplus.h +@@ -171,7 +171,7 @@ struct grub_hfsplus_catkey + grub_uint16_t keylen; + grub_uint32_t parent; + grub_uint16_t namelen; +- grub_uint16_t name[30]; ++ grub_uint16_t name[0]; + } GRUB_PACKED; + + /* The on disk layout of an extent overflow file key. */ +@@ -207,12 +207,14 @@ struct grub_hfsplus_btnode + + /* Return the offset of the record with the index INDEX, in the node + NODE which is part of the B+ tree BTREE. */ +-static inline grub_off_t ++static inline grub_uint16_t + grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, +- struct grub_hfsplus_btnode *node, int index) ++ struct grub_hfsplus_btnode *node, unsigned index) + { + char *cnode = (char *) node; + void *recptr; ++ if (btree->nodesize < index * sizeof (grub_uint16_t) + 2) ++ index = 0; + recptr = (&cnode[btree->nodesize - index * sizeof (grub_uint16_t) - 2]); + return grub_be_to_cpu16 (grub_get_unaligned16 (recptr)); + } +@@ -221,11 +223,13 @@ grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, + NODE which is part of the B+ tree BTREE. */ + static inline struct grub_hfsplus_key * + grub_hfsplus_btree_recptr (struct grub_hfsplus_btree *btree, +- struct grub_hfsplus_btnode *node, int index) ++ struct grub_hfsplus_btnode *node, unsigned index) + { + char *cnode = (char *) node; +- grub_off_t offset; ++ grub_uint16_t offset; + offset = grub_hfsplus_btree_recoffset (btree, node, index); ++ if (offset > btree->nodesize - sizeof (struct grub_hfsplus_key)) ++ offset = 0; + return (struct grub_hfsplus_key *) &cnode[offset]; + } + +diff --git a/include/grub/i386/netbsd_bootinfo.h b/include/grub/i386/netbsd_bootinfo.h +index e48c19b..9b4f460 100644 +--- a/include/grub/i386/netbsd_bootinfo.h ++++ b/include/grub/i386/netbsd_bootinfo.h +@@ -58,6 +58,8 @@ + #define NETBSD_BTINFO_BOOTWEDGE 10 + #define NETBSD_BTINFO_MODULES 11 + #define NETBSD_BTINFO_FRAMEBUF 12 ++#define NETBSD_BTINFO_USERCONFCOMMANDS 13 ++#define NETBSD_BTINFO_EFI 14 + + struct grub_netbsd_bootinfo + { +@@ -146,4 +148,9 @@ struct grub_netbsd_btinfo_framebuf + + #define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16 + ++struct grub_netbsd_btinfo_efi ++{ ++ void *pa_systbl; /* Physical address of the EFI System Table */ ++}; ++ + #endif +diff --git a/include/grub/i386/openbsd_bootarg.h b/include/grub/i386/openbsd_bootarg.h +index 01ca486..9ebe6b4 100644 +--- a/include/grub/i386/openbsd_bootarg.h ++++ b/include/grub/i386/openbsd_bootarg.h +@@ -75,6 +75,8 @@ struct grub_openbsd_bootarg_console + { + grub_uint32_t device; + grub_uint32_t speed; ++ grub_uint32_t addr; ++ grub_uint32_t frequency; + }; + + struct grub_openbsd_bootarg_pcibios +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index dc54bea..8e42513 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -70,8 +70,9 @@ struct grub_ieee1275_devalias + }; + + extern void (*EXPORT_VAR(grub_ieee1275_net_config)) (const char *dev, +- char **device, +- char **path); ++ char **device, ++ 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/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h +index 3f58317..2f69e3f 100644 +--- a/include/grub/ieee1275/ofdisk.h ++++ b/include/grub/ieee1275/ofdisk.h +@@ -22,7 +22,4 @@ + extern void grub_ofdisk_init (void); + extern void grub_ofdisk_fini (void); + +-extern grub_err_t grub_ofdisk_get_block_size (const char *device, +- grub_uint32_t *block_size); +- + #endif /* ! GRUB_INIT_HEADER */ +diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h +deleted file mode 100644 +index fdc6611..0000000 +--- a/include/grub/libgcc.h ++++ /dev/null +@@ -1,97 +0,0 @@ +-/* +- * GRUB -- GRand Unified Bootloader +- * Copyright (C) 2004,2007,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 . +- */ +- +-/* 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); +-void EXPORT_FUNC (__aeabi_llsr) (void); +-void EXPORT_FUNC (__aeabi_ulcmp) (void); +-#endif +diff --git a/include/grub/libusb.h b/include/grub/libusb.h +deleted file mode 100644 +index 26548bc..0000000 +--- a/include/grub/libusb.h ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* +- * GRUB -- GRand Unified Bootloader +- * Copyright (C) 2010 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 . +- */ +- +-void EXPORT_FUNC (usb_bulk_write) (void); +-void EXPORT_FUNC (usb_find_busses) (void); +-void EXPORT_FUNC (usb_init) (void); +-void EXPORT_FUNC (usb_find_devices) (void); +-void EXPORT_FUNC (usb_open) (void); +-void EXPORT_FUNC (usb_get_busses) (void); +-void EXPORT_FUNC (usb_control_msg) (void); +-void EXPORT_FUNC (usb_release_interface) (void); +-void EXPORT_FUNC (usb_close) (void); +-void EXPORT_FUNC (usb_bulk_read) (void); +-void EXPORT_FUNC (usb_claim_interface) (void); +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/mips/kernel.h b/include/grub/mips/kernel.h +index 07b0884..d0e09dd 100644 +--- a/include/grub/mips/kernel.h ++++ b/include/grub/mips/kernel.h +@@ -21,4 +21,8 @@ + + #include + ++#ifdef ASM_FILE ++#define mips_attributes .gnu_attribute 4, 3 ++#endif ++ + #endif /* ! GRUB_KERNEL_MACHINE_HEADER */ +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 2cf74b5..2a9f87c 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)) +@@ -98,12 +71,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t n) + return grub_memmove (dest, src, n); + } + +-#if defined (__APPLE__) && defined(__i386__) && !defined (GRUB_UTIL) +-#define GRUB_BUILTIN_ATTR __attribute__ ((regparm(0))) +-#else +-#define GRUB_BUILTIN_ATTR +-#endif +- + #if defined(__x86_64__) && !defined (GRUB_UTIL) + #if defined (__MINGW32__) || defined (__CYGWIN__) || defined (__MINGW64__) + #define GRUB_ASM_ATTR __attribute__ ((sysv_abi)) +@@ -112,19 +79,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t n) + #endif + #endif + +-/* Prototypes for aliases. */ +-#ifndef GRUB_UTIL +-int GRUB_BUILTIN_ATTR EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); +-void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); +-void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); +-void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); +- +-#ifdef __APPLE__ +-void GRUB_BUILTIN_ATTR EXPORT_FUNC (__bzero) (void *s, grub_size_t n); +-#endif +- +-#endif +- + int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); + int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2); + int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); +@@ -385,13 +339,37 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, + grub_uint64_t d, + grub_uint64_t *r); + +-#if (defined (__MINGW32__) || defined (__CYGWIN__)) && !defined(GRUB_UTIL) +-void EXPORT_FUNC (__register_frame_info) (void); +-void EXPORT_FUNC (__deregister_frame_info) (void); +-void EXPORT_FUNC (___chkstk_ms) (void); +-void EXPORT_FUNC (__chkstk_ms) (void); ++/* Must match softdiv group in gentpl.py. */ ++#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__ia64__)) ++#define GRUB_DIVISION_IN_SOFTWARE 1 ++#else ++#define GRUB_DIVISION_IN_SOFTWARE 0 ++#endif ++ ++/* Some division functions need to be in kernel if compiler generates calls ++ to them. Otherwise we still need them for consistent tests but they go ++ into a separate module. */ ++#if GRUB_DIVISION_IN_SOFTWARE ++#define EXPORT_FUNC_IF_SOFTDIV EXPORT_FUNC ++#else ++#define EXPORT_FUNC_IF_SOFTDIV(x) x + #endif + ++grub_int64_t ++EXPORT_FUNC_IF_SOFTDIV(grub_divmod64s) (grub_int64_t n, ++ grub_int64_t d, ++ grub_int64_t *r); ++ ++grub_uint32_t ++EXPORT_FUNC_IF_SOFTDIV (grub_divmod32) (grub_uint32_t n, ++ grub_uint32_t d, ++ grub_uint32_t *r); ++ ++grub_int32_t ++EXPORT_FUNC_IF_SOFTDIV (grub_divmod32s) (grub_int32_t n, ++ grub_int32_t d, ++ grub_int32_t *r); ++ + /* Inline functions. */ + + static inline char * +@@ -417,13 +395,6 @@ grub_abs (int x) + return (unsigned int) x; + } + +-/* Rounded-up division */ +-static inline unsigned int +-grub_div_roundup (unsigned int x, unsigned int y) +-{ +- return (x + y - 1) / y; +-} +- + /* Reboot the machine. */ + #if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) + void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn)); +@@ -467,57 +438,6 @@ grub_error_load (const struct grub_error_saved *save) + grub_errno = save->grub_errno; + } + +-#ifndef GRUB_UTIL +- +-#if defined (__arm__) +- +-grub_uint32_t +-EXPORT_FUNC (__udivsi3) (grub_uint32_t a, grub_uint32_t b); +- +-grub_uint32_t +-EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); +- +-#endif +- +-#if defined (__sparc__) || defined (__powerpc__) +-unsigned +-EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); +-#define NEED_CTZDI2 1 +-#endif +- +-#if defined (__mips__) || defined (__arm__) +-unsigned +-EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); +-#define NEED_CTZSI2 1 +-#endif +- +-#ifdef __arm__ +-grub_uint32_t +-EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); +-grub_uint32_t +-EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b); +- +-/* Needed for allowing modules to be compiled as thumb. */ +-grub_uint64_t +-EXPORT_FUNC (__muldi3) (grub_uint64_t a, grub_uint64_t b); +-grub_uint64_t +-EXPORT_FUNC (__aeabi_lmul) (grub_uint64_t a, grub_uint64_t b); +- +-#endif +- +-#if defined (__ia64__) +- +-grub_uint64_t +-EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b); +- +-grub_uint64_t +-EXPORT_FUNC (__umoddi3) (grub_uint64_t a, grub_uint64_t b); +- +-#endif +- +-#endif /* GRUB_UTIL */ +- +- + #if BOOT_TIME_STATS + struct grub_boot_time + { +diff --git a/include/grub/net.h b/include/grub/net.h +index de6259e..538baa3 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); + +@@ -532,5 +536,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 --git a/include/grub/net/ip.h b/include/grub/net/ip.h +index 7a8e614..dcceaa5 100644 +--- a/include/grub/net/ip.h ++++ b/include/grub/net/ip.h +@@ -92,4 +92,6 @@ grub_err_t + grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf, + const grub_net_network_level_address_t *proto_addr); + ++grub_err_t ++grub_net_icmp6_send_router_solicit (struct grub_net_network_level_interface *inf); + #endif +diff --git a/include/grub/net/netbuff.h b/include/grub/net/netbuff.h +index 9ac168c..1177c12 100644 +--- a/include/grub/net/netbuff.h ++++ b/include/grub/net/netbuff.h +@@ -25,6 +25,7 @@ grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff, grub_size_t len); + grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff, grub_size_t len); + grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff); + struct grub_net_buff * grub_netbuff_alloc (grub_size_t len); ++struct grub_net_buff * grub_netbuff_make_pkt (grub_size_t len); + void grub_netbuff_free (struct grub_net_buff *net_buff); + + #endif +diff --git a/include/grub/normal.h b/include/grub/normal.h +index c4ab193..218cbab 100644 +--- a/include/grub/normal.h ++++ b/include/grub/normal.h +@@ -66,7 +66,7 @@ void grub_menu_init_page (int nested, int edit, + struct grub_term_output *term); + void grub_normal_init_page (struct grub_term_output *term, int y); + char *grub_file_getline (grub_file_t file); +-void grub_cmdline_run (int nested); ++void grub_cmdline_run (int nested, int force_auth); + + /* Defined in `cmdline.c'. */ + char *grub_cmdline_get (const char *prompt); +diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h +index 36615b2..bf6451b 100644 +--- a/include/grub/osdep/hostfile_windows.h ++++ b/include/grub/osdep/hostfile_windows.h +@@ -69,8 +69,11 @@ enum grub_util_fd_open_flags_t + + #if defined (__MINGW32__) && !defined (__MINGW64__) + ++/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */ ++#ifndef _W64 + #define fseeko fseeko64 + #define ftello ftello64 ++#endif + + #endif + +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 + { +diff --git a/include/grub/term.h b/include/grub/term.h +index 98c68a5..5ffb38f 100644 +--- a/include/grub/term.h ++++ b/include/grub/term.h +@@ -334,12 +334,12 @@ void grub_term_restore_pos (struct grub_term_coordinate *pos); + + static inline unsigned grub_term_width (struct grub_term_output *term) + { +- return term->getwh(term).x; ++ return term->getwh(term).x ? : 80; + } + + static inline unsigned grub_term_height (struct grub_term_output *term) + { +- return term->getwh(term).y; ++ return term->getwh(term).y ? : 24; + } + + static inline struct grub_term_coordinate +diff --git a/include/grub/time.h b/include/grub/time.h +index 64ac99a..c919c1f 100644 +--- a/include/grub/time.h ++++ b/include/grub/time.h +@@ -21,7 +21,7 @@ + + #include + #include +-#ifndef GRUB_MACHINE_EMU ++#if !defined(GRUB_MACHINE_EMU) && !defined(GRUB_UTIL) + #include + #else + static inline void +diff --git a/include/grub/types.h b/include/grub/types.h +index 79f765c..e732efb 100644 +--- a/include/grub/types.h ++++ b/include/grub/types.h +@@ -179,7 +179,7 @@ static inline grub_uint16_t grub_swap_bytes16(grub_uint16_t _x) + | (_x >> 56)); \ + }) + +-#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3) ++#if (defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)) || defined(__clang__) + static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x) + { + return __builtin_bswap32(x); +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index bc987aa..aedcd29 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -138,6 +138,8 @@ grub_install_get_platform_cpu (enum grub_install_plat platid); + const char * + grub_install_get_platform_platform (enum grub_install_plat platid); + ++char * ++grub_install_get_platforms_string (void); + + typedef enum { + GRUB_COMPRESSION_AUTO, +diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h +index 192874d..e9e0a67 100644 +--- a/include/grub/util/misc.h ++++ b/include/grub/util/misc.h +@@ -41,7 +41,7 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset, + + char *make_system_path_relative_to_its_root (const char *path); + +-char *canonicalize_file_name (const char *path); ++char *grub_canonicalize_file_name (const char *path); + + void grub_util_init_nls (void); + +diff --git a/include/grub/x86_64/types.h b/include/grub/x86_64/types.h +index fec9109..0bbdc6d 100644 +--- a/include/grub/x86_64/types.h ++++ b/include/grub/x86_64/types.h +@@ -20,10 +20,14 @@ + #define GRUB_TYPES_CPU_HEADER 1 + + /* The size of void *. */ ++#ifdef __ILP32__ ++#define GRUB_TARGET_SIZEOF_VOID_P 4 ++#else + #define GRUB_TARGET_SIZEOF_VOID_P 8 ++#endif + + /* The size of long. */ +-#ifdef __MINGW32__ ++#if defined(__MINGW32__) || defined(__ILP32__) + #define GRUB_TARGET_SIZEOF_LONG 4 + #else + #define GRUB_TARGET_SIZEOF_LONG 8 +diff --git a/include/grub/xen.h b/include/grub/xen.h +index 6035d1a..9ba3b8e 100644 +--- a/include/grub/xen.h ++++ b/include/grub/xen.h +@@ -21,6 +21,8 @@ + + #define __XEN_INTERFACE_VERSION__ 0x0003020a + ++#define memset grub_memset ++ + #ifdef ASM_FILE + #define __ASSEMBLY__ + #include +diff --git a/include/grub/zfs/spa.h b/include/grub/zfs/spa.h +index 7edb8ab..8dd1fa8 100644 +--- a/include/grub/zfs/spa.h ++++ b/include/grub/zfs/spa.h +@@ -126,7 +126,7 @@ typedef struct zio_cksum { + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 5 |G| offset3 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ +- * 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE | ++ * 6 |BDX|lvl| type | cksum |E| comp| PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ +@@ -160,7 +160,8 @@ typedef struct zio_cksum { + * G gang block indicator + * B byteorder (endianness) + * D dedup +- * X unused ++ * X encryption ++ * E blkptr_t contains embedded data + * lvl level of indirection + * type DMU object type + * phys birth txg of block allocation; zero if same as logical birth txg +@@ -203,8 +204,8 @@ typedef struct blkptr { + #define BP_SET_LSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + +-#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) +-#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) ++#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7) ++#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x) + + #define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) + #define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) +@@ -215,6 +216,8 @@ typedef struct blkptr { + #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) + #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) + ++#define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) ++ + #define BP_GET_PROP_BIT_61(bp) BF64_GET((bp)->blk_prop, 61, 1) + #define BP_SET_PROP_BIT_61(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x) + +@@ -277,9 +280,27 @@ typedef struct blkptr { + (zcp)->zc_word[3] = w3; \ + } + ++#define BPE_GET_ETYPE(bp) BP_GET_CHECKSUM(bp) ++#define BPE_GET_LSIZE(bp) \ ++ BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1) ++#define BPE_GET_PSIZE(bp) \ ++ BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1) ++ ++typedef enum bp_embedded_type { ++ BP_EMBEDDED_TYPE_DATA, ++ NUM_BP_EMBEDDED_TYPES ++} bp_embedded_type_t; ++ ++#define BPE_NUM_WORDS 14 ++#define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof(grub_uint64_t)) ++#define BPE_IS_PAYLOADWORD(bp, wp) \ ++ ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth) ++ + #define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) + #define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +-#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) ++#define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \ ++ (dva)->dva_word[1] == 0ULL) ++#define BP_IS_HOLE(bp) DVA_IS_EMPTY(BP_IDENTITY(bp)) + + /* BP_IS_RAIDZ(bp) assumes no block compression */ + #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \ +diff --git a/include/multiboot2.h b/include/multiboot2.h +index 3ccff15..9d48627 100644 +--- a/include/multiboot2.h ++++ b/include/multiboot2.h +@@ -156,9 +156,6 @@ struct multiboot_header_tag_module_align + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; +- multiboot_uint32_t width; +- multiboot_uint32_t height; +- multiboot_uint32_t depth; + }; + + struct multiboot_color +diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 +index 0152f29..e74339a 100644 +--- a/m4/extern-inline.m4 ++++ b/m4/extern-inline.m4 +@@ -1,6 +1,6 @@ + dnl 'extern inline' a la ISO C99. + +-dnl Copyright 2012-2013 Free Software Foundation, Inc. ++dnl Copyright 2012-2015 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -8,42 +8,77 @@ dnl with or without modifications, as long as this notice is preserved. + AC_DEFUN([gl_EXTERN_INLINE], + [ + AH_VERBATIM([extern_inline], +-[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. +- _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. +- _GL_INLINE_HEADER_BEGIN contains useful stuff to put +- in an include file, before uses of _GL_INLINE. +- It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, +- when FOO is an inline function in the header; see +- . +- _GL_INLINE_HEADER_END contains useful stuff to put +- in the same include file, after uses of _GL_INLINE. ++[/* Please see the Gnulib manual for how to use these macros. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + . + +- Suppress the use of extern inline on Apple's platforms, +- as Libc-825.25 (2012-09-19) is incompatible with it; see +- . +- Perhaps Apple will fix this some day. */ ++ Suppress extern inline with Sun C in standards-conformance mode, as it ++ mishandles inline functions that call each other. E.g., for 'inline void f ++ (void) { } inline void g (void) { f (); }', c99 incorrectly complains ++ 'reference to static identifier "f" in extern inline function'. ++ This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. ++ ++ Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) ++ on configurations that mistakenly use 'static inline' to implement ++ functions or macros in standard C headers like . For example, ++ if isdigit is mistakenly implemented via a static inline function, ++ a program containing an extern inline function that calls isdigit ++ may not work since the C standard prohibits extern inline functions ++ from calling static functions. This bug is known to occur on: ++ ++ OS X 10.8 and earlier; see: ++ http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html ++ ++ DragonFly; see ++ http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log ++ ++ FreeBSD; see: ++ http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html ++ ++ OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and ++ for clang but remains for g++; see . ++ Assume DragonFly and FreeBSD will be similar. */ ++#if (((defined __APPLE__ && defined __MACH__) \ ++ || defined __DragonFly__ || defined __FreeBSD__) \ ++ && (defined __header_inline \ ++ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ ++ && ! defined __clang__) \ ++ : ((! defined _DONT_USE_CTYPE_INLINE_ \ ++ && (defined __GNUC__ || defined __cplusplus)) \ ++ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ ++ && defined __GNUC__ && ! defined __cplusplus)))) ++# define _GL_EXTERN_INLINE_STDHEADER_BUG ++#endif + #if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ +- : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \ +- && !defined __APPLE__) ++ : (199901L <= __STDC_VERSION__ \ ++ && !defined __HP_cc \ ++ && !(defined __SUNPRO_C && __STDC__))) \ ++ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) + # define _GL_INLINE inline + # define _GL_EXTERN_INLINE extern inline +-#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__ +-# if __GNUC_GNU_INLINE__ ++# define _GL_EXTERN_INLINE_IN_USE ++#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ ++ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) ++# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ + # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) + # else + # define _GL_INLINE extern inline + # endif + # define _GL_EXTERN_INLINE extern ++# define _GL_EXTERN_INLINE_IN_USE + #else + # define _GL_INLINE static _GL_UNUSED + # define _GL_EXTERN_INLINE static _GL_UNUSED + #endif + ++/* In GCC, suppress bogus "no previous prototype for 'FOO'" ++ and "no previous declaration for 'FOO'" diagnostics, ++ when FOO is an inline function in the header; see ++ and ++ . */ + #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) + # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ + # define _GL_INLINE_HEADER_CONST_PRAGMA +diff --git a/po/exclude.pot b/po/exclude.pot +index 1659eb01be12241d310869cf77c11d62011a0c3f..ab52e99905363232a840cf86e09563b5f8dba229 100644 +GIT binary patch +delta 2879 +zcmaJ@e{2&~9M9VZc4fjgwiQ=?ymniM2Djc_+iM9!Is=4+r5c3Ds42JhD3xokySvQ} +z5;74*(J1f;4-!FC5@TZ6ra_WLU|bXbRQH#OiBbOXFB3KKKb`U2b$$0bW0$qP`@Zk{ +ze7@h$`+nbhpM2nY@U?4p?+hy5S@p&AOyEttAqo!N{X7a>p1Xe~z-JFo>eIDo_Hg?; +zffL+$J)6rwf3g&dA?`>oR#Kn^|C9oolw@f)Pt4I|X*dp(rDw@YT!7($V9@V|_Mg9M +z=E(4#WGNaVzXEX!P52<|WC2-&aq_XBf3TWigV^ZuDw; +zOGKH>7bQ)X2h!UkBFt(NV^615O&-kT^b>>ZV62)89D+xzsoR)QjtkeB%kctwIN7n? +zq2lUtabmDaM#LL}Nx#L{!}9TB)k7{Ba=}RHxsx&+LgQz=2u`lv%}|AedZC3PRiNVW +zDLt2#l+>iEOyp%9p0ZdW%PNMbvz*cmNi!VE9)>bT#ZuHPgNYWOw8INHzI>3cV%GZV +z4s?`p=OcBp;T>5>bjC!LZ(|KWmG98L1N(;e+hx$rWXXU$cW5Mm;y-S*B<*D}qE!rC +z&gL!o)9OTl5yQ(kI|^5v(Zw9>W%j++SR4}w$QO;EAv?jMGU0vPwSt-;mCf-=Rc!d}()McdFir>is +z#p)z31ZnG3fJmWL8hSI6x**WN^EpjZwg2WO2sEOK%gWrCkc4osUPxi8WCe+a#O^VI +zSZ|LJ#E7-WgdG`#x~nHdX)kLM9=`$XB7cINPJ_~8gd!Po298a^aq@!ZGG6?14_M_@$bOj1 +z$SNUo)_c%4Vc##HRQ#PdrafP&vY-kMPc +zj&J8eT(#Fx>#PSa{0TbSxFFSWIFWcE9>@Ru4xVb`IDuwool6ql{5J66UB3c%6UU1o +z{M!#;3z)(eFMvQ>m_m@#%t&R6*moKPIwE0O?6y6xXH-0Q3IrM>5dklL12*8qJHWGE +zbcD41q+$^tJq!9{#E(g}KUaEQsb}U4Tb$!PB7kA#TKb +zDcTGKEUgBeO{BG|CVY7wbTug%#}FR{U2CiZ_gGFbWNq1TOS4sXVNFgi8{GKO3DAk& +zkGX(l*@PEPgXRW~Fx)5e^<*Jg=(E4^^N*2oCKr^rq~!>0i!4#& +z6{ht^$s|Ql)1=B^QIXOzJf>=JWaJ<;2%Y?Y)cq_d&(TeZPSi;b1zE#0M?qgtturkN +znh}|WA4$LmYaMA%Sg5u$j=v1HUOMb*VeW7yl1BTS3!G5?$h>OK!}1yPWBb}>J$+by +z&pcax&Adf!XplIZHE)sc^X41&^L6V&fiArAn0*gxGUv_vc9*x-bb0yQxMlUXujugc +z@;M~k2%vYbb+$O&T|RSVge-RJLK7-3tiiJhuzq#YyP0I`Io#|TVcl*t^ +q_Kzl#1@hFL#E-54FWR-ks`tfhpvyz*uuq5fzu)S3a@0V--~BI6U(>4q + +delta 133 +zcmdmgjAQwHjt%bXr=L(_5@YG~iSnPUxJ!QW`wgs{1J^5d@SB@(4PhMx+_IG2b-2<@V59W*l +l+fSG?a)?jAt;od5`q#WFB5HEuLAl8`2e`K%^JCn$9{@2UGMoSa + +diff --git a/tests/ext234_test.in b/tests/ext234_test.in +index 8910b71..c986960 100644 +--- a/tests/ext234_test.in ++++ b/tests/ext234_test.in +@@ -29,3 +29,4 @@ fi + "@builddir@/grub-fs-tester" ext2 + "@builddir@/grub-fs-tester" ext3 + "@builddir@/grub-fs-tester" ext4 ++"@builddir@/grub-fs-tester" ext4_metabg +diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in +index a05eb3e..a59645b 100644 +--- a/tests/fddboot_test.in ++++ b/tests/fddboot_test.in +@@ -46,6 +46,6 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + exit 0;; + esac + +-if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes=")" != "Hello World" ]; then ++if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad")" != "Hello World" ]; then + exit 1 + fi +diff --git a/tests/file_filter/file b/tests/file_filter/file +new file mode 100644 +index 0000000..64650ac +--- /dev/null ++++ b/tests/file_filter/file +@@ -0,0 +1 @@ ++Hello, user! +diff --git a/tests/file_filter/file.gz b/tests/file_filter/file.gz +new file mode 100644 +index 0000000000000000000000000000000000000000..a07ffcbe0cbad415ea51ec72bbe7b54094284d3d +GIT binary patch +literal 33 +pcmb2|=3qFtrZI$p`LoB_lP9kSYUuju20dY7FxvO)Cocm70|4R_48H&X + +literal 0 +HcmV?d00001 + +diff --git a/tests/file_filter/file.gz.sig b/tests/file_filter/file.gz.sig +new file mode 100644 +index 0000000000000000000000000000000000000000..602e6187e22d7fc288a52ac572f38cc1066083cb +GIT binary patch +literal 96 +zcmV-m0H6PeUIYLU2ml5J0#t#n2LK8Q5M~MT@8nv<3h9^t|7f?gmaE1LNh!Sm;mO#P +zdLo*tTpkl+s!TB^f%Fh1{Q&^Tlz2`!Q4Giq +Ct|zAe + +literal 0 +HcmV?d00001 + +diff --git a/tests/file_filter/file.lzop b/tests/file_filter/file.lzop +new file mode 100644 +index 0000000000000000000000000000000000000000..5f5a97171821de55168fcbdc9b1b335316d295b9 +GIT binary patch +literal 67 +zcmeD5iSlRQ<&xqOFi>dVbYNsjC(Bu@f@NKNp%ec7JvFb-Lz3O)* +CVl0pV + +literal 0 +HcmV?d00001 + +diff --git a/tests/file_filter/file.xz b/tests/file_filter/file.xz +new file mode 100644 +index 0000000000000000000000000000000000000000..151a98029033dd0947d54f8ddad670da85a45185 +GIT binary patch +literal 72 +zcmexsUKJ6=z`*kC+7>q^21Q0O1_p)_{ill=8F)NWb8_-^6iSOzixjzl!VG^@7(cF= +Z)UCz9sLER?d1RaXw$HVUAPJVpC;$*f6z~85 + +literal 0 +HcmV?d00001 + +diff --git a/tests/file_filter/file.xz.sig b/tests/file_filter/file.xz.sig +new file mode 100644 +index 0000000000000000000000000000000000000000..57569242e4742cdfb929307ec19440cf91f49e9a +GIT binary patch +literal 96 +zcmV-m0H6PeUIYLU2ml5J0#t#n3jhiU5M~MT@8nv<3OS$v{x;4Uj6+!wt^-rP*&N$| +z+5zKQ7vOO`?M~+y=au4FasdGNRgV;Q;4TNc&v05)-JLjLl54~a(Q}0wbmOZ2ne0%w +Ci77V# + +literal 0 +HcmV?d00001 + +diff --git a/tests/file_filter/keys b/tests/file_filter/keys +new file mode 100644 +index 0000000000000000000000000000000000000000..1afa71382364060d08bb0c28e36a1ff98d585fe8 +GIT binary patch +literal 994 +zcmV<810DRC11@ew%2nM8awI88}g~WvBj*BJPpr^(@>)pd~ex-<$MMPxbNPGZV|BH +zWj8IQR4B@uXKc3uaPJ1=^^Zq^DT +zGR)3)y_E}*oM=>(9mHp}SKbH+oTA=g$}Y_>Yo72Jn4N$d^(*k!0WN3*`c`xB4p;&y +zxUni$jurte*DGtmax;-CBK;ReR-(#??6SOFAtnGFD6+^8CX~5LD{yPt|2mUMt +zwJE)m>0ZFNaB_Tkn{@&~ymmqz6=oI&zK^|yp26yNF-zSkq2MW>GyFClY9q{@=2rys +zhJs5IhyReW6c9&Zrk@1~&dA`O!?SH6dN^nA@=cwz&`Ezpv7R;6gk|My_?I8#%?Z*v +z0G=T3S|-k)ND-11n=+U)J=DUmZ`*NlWO1qRl1d|e3jZ@ioyPN?bxzIto0ltfBGhMj +z*HF^AUdvgzSm>LzM75fVG>0caAHZcq9dkq@E1ccwLg7IkAD-Uj9eRWey-8OeDLZtP +zFGWnyh(8GDLvyN?Wb=5U*>gB4;O4Q~QA&IhlL~dxCca=f>yhv4IlbS9*wP37G*l-7 +z68Nu9XH0V?#8Mlr_|4bivnV+Xw +zydOTU@TyjupFl11F8p`)R&210tm6Y4QE*AG%aIRbg##g$XGEjNV}o~RH4hXtsdF}8 +zgc#a=4BiAs$WhG?LV$*t4U}ex(o2%HHKsbzt@0q@tiFkDvxZ4j5EO=^&d${9btru+ +zAB}{L36Q;49P;3xdCKCi1x(1w?GNPIz7@+G3MU121``j|n!I&1(;|JmS_t_VuMTgP +z(dkfWGS@ew%2nM8awI88}g~WvBj*BJPpr^(@>)pd~ex-<$MMPxbNPGZV|BH +zWj8IQR4B@uXKc3uaPJ1=^^Zq^DT +zGR)3)y_E}*oM=>(9mHp}SKbH+oTA=g$}Y_>Yo72Jn4N$d^(*k!0WN3*`c`xB4p;&y +zxUni$jurte*DGtmax;-CBK;ReR-(#??6SOFAtnGFD6+^8CX~5LD{yPt|2mUMt +zwJE)m>0ZFNaB_Tkn{@&~ymmqz6=oI&zK^|yp26yNF-zSkq2MW>GyFClY9q{@=2rys +zhJs5IhyReW6c9&Zrk@1~&dA`O!?SH6dN^nA@=cwz&`Ezpv7R;6gk|My_?I8#%?Z*v +z0G=T3S|-k)ND-11n=+U)J=DUmZ`*NlWO1qRl1d|e3jZ@ioyPN?bxzIto0ltfBGhMj +z*HF^AUdvgzSm>LzM75fVG>0caAHZcq9dkq@E1ccwLg7IkAD-Uj9eRWey-8OeDLZtP +zFGWnyh(8GDLvyN?Wb=5U*>gB4;O4Q~QA&IhlL~dxCca=f>yhv4IlbS9*wP37G*l-7 +z68Nu9XH0V?#8Mlr_|4bivnV+Xw +zydOTU@TyjupFl11F8p`)R&210tm6Y4QE*AG%aIRbg##g$XGEjNV}o~RH4hXtsdF}8 +zgc#a=4BiAs$WhG?LV$*t4U}ex(o2%HHKsbzt@0q@tiFkDvxZ4j5EO=^&d${9btru+ +zAB}{L36Q;49P;3xdCKCi1x(1w?GNPIz7@+G3MU121``j|n!I&1(;|JmS_t_VuMTgP +z(dkfWGS. ++ ++set -e ++grubshell=@builddir@/grub-shell ++ ++. "@builddir@/grub-core/modinfo.sh" ++ ++filters="gzio xzio lzopio verify" ++modules="cat mpi" ++ ++for mod in $(cut -d ' ' -f 2 "@builddir@/grub-core/crypto.lst" | sort -u); do ++ modules="$modules $mod" ++done ++ ++for file in file.gz file.xz file.lzop file.gz.sig file.xz.sig file.lzop.sig keys.pub; do ++ files="$files /$file=@srcdir@/tests/file_filter/$file" ++done ++ ++# GRUB cat command adds extra newline after file ++result="Hello, user! ++ ++Hello, user! ++ ++Hello, user!" ++ ++out="$("${grubshell}" --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")" ++if [ "$out" != "$result" ]; then ++ echo LOCAL FAIL ++ echo "$out" ++ exit 1 ++fi ++ ++# Taken from netboot_test ++case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in ++ # PLATFORM: emu is different ++ *-emu) ++ exit 0;; ++ # PLATFORM: Flash targets ++ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) ++ exit 0;; ++ # FIXME: currently grub-shell uses only -kernel for loongson ++ mipsel-loongson) ++ exit 0;; ++ # FIXME: no rtl8139 support ++ i386-multiboot) ++ exit 0;; ++ # FIXME: We don't fully support netboot on ARC ++ *-arc) ++ exit 0;; ++ # FIXME: Many QEMU firmware have no netboot capability ++ *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275) ++ exit 0;; ++esac ++ ++out="$("${grubshell}" --boot=net --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")" ++if [ "$out" != "$result" ]; then ++ echo NET FAIL ++ echo "$out" ++ exit 1 ++fi ++ ++exit 0 +diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in +new file mode 100644 +index 0000000..6269891 +--- /dev/null ++++ b/tests/grub_cmd_test.in +@@ -0,0 +1,67 @@ ++#! /bin/bash ++ ++# create a randome file ++empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 ++non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 ++cat >$non_empty <$outfile < /dev/null 2>&1; then ++ echo "GRUB test command file tests failed." ++ cat "$outfile" ++ exit 1 ++else ++ rm -f "${outfile}" ++ exit 0 ++fi +diff --git a/tests/ntfs_test.in b/tests/ntfs_test.in +index 6bf09e6..e25c638 100644 +--- a/tests/ntfs_test.in ++++ b/tests/ntfs_test.in +@@ -15,5 +15,10 @@ if ! which mkfs.ntfs >/dev/null 2>&1; then + exit 77 + fi + ++if ! which setfattr >/dev/null 2>&1; then ++ echo "setfattr not installed; cannot test ntfs." ++ exit 77 ++fi ++ + "@builddir@/grub-fs-tester" ntfs +-"@builddir@/grub-fs-tester" ntfscomp +\ No newline at end of file ++"@builddir@/grub-fs-tester" ntfscomp +diff --git a/tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg b/tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg +new file mode 100644 +index 0000000..e69de29 +diff --git a/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg b/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg +new file mode 100644 +index 0000000..2e107fa +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg +@@ -0,0 +1,52 @@ ++menu hshift 9 ++menu width 58 ++ ++menu begin desktop ++ include stdmenu.cfg ++ menu hshift 13 ++ menu width 49 ++ menu label Alternative desktop environments ++ menu title Desktop environment menu ++ label mainmenu-kde ++ menu label ^Back.. ++ text help ++ Higher level options install the GNOME desktop environment ++ endtext ++ menu exit ++ menu begin kde-desktop ++ include stdmenu.cfg ++ menu label ^KDE ++ menu title KDE desktop boot menu ++ text help ++ Select the 'K Desktop Environment' for the Desktop task ++ endtext ++ label mainmenu-kde ++ menu label ^Back.. ++ menu exit ++ include kde/menu.cfg ++ menu end ++ menu begin lxde-desktop ++ include stdmenu.cfg ++ menu label ^LXDE ++ menu title LXDE desktop boot menu ++ text help ++ Select the 'Lightweight X11 Desktop Environment' for the Desktop task ++ endtext ++ label mainmenu-lxde ++ menu label ^Back.. ++ menu exit ++ include lxde/menu.cfg ++ menu end ++ menu begin xfce-desktop ++ include stdmenu.cfg ++ menu label ^Xfce ++ menu title Xfce desktop boot menu ++ text help ++ Select the 'Xfce lightweight desktop environment' for the Desktop task ++ endtext ++ label mainmenu-xfce ++ menu label ^Back.. ++ menu exit ++ include xfce/menu.cfg ++ menu end ++menu end +diff --git a/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg b/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg +new file mode 100644 +index 0000000..3119e65 +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg +@@ -0,0 +1,3 @@ ++label menu ++ kernel vesamenu.c32 ++ config isolinux.cfg +diff --git a/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg b/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg +new file mode 100644 +index 0000000..b799cb5 +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg +@@ -0,0 +1,12 @@ ++foreground=0xFFFFFF ++background=0x958490 ++screen-colour=0x270A1E ++hidden-timeout=2 ++label normal=Normal ++append normal= ++label driverupdates=Use driver update disc ++append driverupdates=debian-installer/driver-update=true ++applies driverupdates=live live-install ++label oem=OEM install (for manufacturers) ++append oem=oem-config/enable=true ++applies oem=live live-install install +diff --git a/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg b/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg +new file mode 100644 +index 0000000..fd9c333 +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg +@@ -0,0 +1,6 @@ ++# D-I config version 2.0 ++include menu.cfg ++default vesamenu.c32 ++prompt 0 ++timeout 50 ++ui gfxboot bootlogo +diff --git a/tests/syslinux/ubuntu10.04/isolinux/menu.cfg b/tests/syslinux/ubuntu10.04/isolinux/menu.cfg +new file mode 100644 +index 0000000..9f5607d +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/menu.cfg +@@ -0,0 +1,23 @@ ++menu hshift 13 ++menu width 49 ++menu margin 8 ++ ++menu title Installer boot menu ++include stdmenu.cfg ++include txt.cfg ++include gtk.cfg ++menu begin advanced ++ menu title Advanced options ++ include stdmenu.cfg ++ label mainmenu ++ menu label ^Back.. ++ menu exit ++ include adtxt.cfg ++ include adgtk.cfg ++menu end ++label help ++ menu label ^Help ++ text help ++ Display help screens; type 'menu' at boot prompt to return to this menu ++ endtext ++ config prompt.cfg +diff --git a/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg b/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg +new file mode 100644 +index 0000000..75f6788 +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/po4a.cfg +@@ -0,0 +1,3 @@ ++[po4a_langs] ar bn ca cs da de es eu fi fr gl hu id it ja ka ko ku lv nb nl pl pt pt_BR ru sk sv ta tr vi zh_CN zh_TW ++[po4a_paths] po/help.pot $lang:po/$lang.po ++[type:docbook] help.xml +diff --git a/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg b/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg +new file mode 100644 +index 0000000..f9984ae +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg +@@ -0,0 +1,16 @@ ++prompt 1 ++display f1.txt ++timeout 50 ++include menu.cfg ++include exithelp.cfg ++ ++f1 f1.txt ++f2 f2.txt ++f3 f3.txt ++f4 f4.txt ++f5 f5.txt ++f6 f6.txt ++f7 f7.txt ++f8 f8.txt ++f9 f9.txt ++f0 f10.txt +diff --git a/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg b/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg +new file mode 100644 +index 0000000..bdf6231 +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg +@@ -0,0 +1,4 @@ ++label rescue ++ menu label ^Rescue mode ++ kernel /install/vmlinuz ++ append vga=788 initrd=/install/initrd.gz rescue/enable=true -- quiet +diff --git a/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg b/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg +new file mode 100644 +index 0000000..671b16f +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg +@@ -0,0 +1,15 @@ ++menu background splash.png ++menu color title * #FFFFFFFF * ++menu color border * #00000000 #00000000 none ++menu color sel * #ffffffff #76a1d0ff * ++menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff * ++menu color tabmsg * #ffffffff #00000000 * ++menu color help 37;40 #ffdddd00 #00000000 none ++menu vshift 12 ++menu rows 10 ++menu helpmsgrow 15 ++# The command line must be at least one line from the bottom. ++menu cmdlinerow 16 ++menu timeoutrow 16 ++menu tabmsgrow 18 ++menu tabmsg Press ENTER to boot or TAB to edit a menu entry +diff --git a/tests/syslinux/ubuntu10.04/isolinux/txt.cfg b/tests/syslinux/ubuntu10.04/isolinux/txt.cfg +new file mode 100644 +index 0000000..860daad +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04/isolinux/txt.cfg +@@ -0,0 +1,19 @@ ++default live ++label live ++ menu label ^Try Ubuntu without installing ++ kernel /casper/vmlinuz ++ append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- ++label live-install ++ menu label ^Install Ubuntu ++ kernel /casper/vmlinuz ++ append file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- ++label check ++ menu label ^Check disc for defects ++ kernel /casper/vmlinuz ++ append boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- ++label memtest ++ menu label Test ^memory ++ kernel /install/mt86plus ++label hd ++ menu label ^Boot from first hard disk ++ localboot 0x80 +diff --git a/tests/syslinux/ubuntu10.04_grub.cfg.in b/tests/syslinux/ubuntu10.04_grub.cfg.in +new file mode 100644 +index 0000000..846e4ac +--- /dev/null ++++ b/tests/syslinux/ubuntu10.04_grub.cfg.in +@@ -0,0 +1,236 @@ ++ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'splash.png' ++# D-I config version 2.0 ++ # UNSUPPORTED command 'menu hshift 13' ++ # UNSUPPORTED command 'menu width 49' ++ # UNSUPPORTED command 'menu margin 8' ++ ++ # UNSUPPORTED command 'menu title Installer boot menu' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++set timeout=5 ++ default='vesamenu.c32' ++menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Test memory' --hotkey 'm' --id 'memtest' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/install/mt86plus' ++} ++menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/gtk.cfg not found ++ # UNSUPPORTED command 'menu begin advanced' ++ # UNSUPPORTED command 'menu title Advanced options' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++ root=hd0; ++ chainloader +1; ++} ++menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { ++ # UNSUPPORTED command 'menu exit' ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/adgtk.cfg not found ++ # UNSUPPORTED command 'menu end' ++ # UNSUPPORTED entry type 0 ++true; ++} ++menuentry 'Help' --hotkey 'h' --id 'help' { ++ # UNSUPPORTED command 'ui gfxboot bootlogo' ++#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: ++ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'splash.png' ++ # UNSUPPORTED command 'display f1.txt' ++ # UNSUPPORTED command 'menu hshift 13' ++ # UNSUPPORTED command 'menu width 49' ++ # UNSUPPORTED command 'menu margin 8' ++ ++ # UNSUPPORTED command 'menu title Installer boot menu' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++set timeout=5 ++ default='live' ++menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Test memory' --hotkey 'm' --id 'memtest' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/install/mt86plus' ++} ++menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//gtk.cfg not found ++ # UNSUPPORTED command 'menu begin advanced' ++ # UNSUPPORTED command 'menu title Advanced options' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++ root=hd0; ++ chainloader +1; ++} ++menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { ++ # UNSUPPORTED command 'menu exit' ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//adgtk.cfg not found ++ # UNSUPPORTED command 'menu end' ++ # UNSUPPORTED entry type 0 ++true; ++} ++menuentry 'Help' --hotkey 'h' --id 'help' { ++#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: ++ syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' ++} ++menuentry 'menu' --id 'menu' { ++ # UNSUPPORTED command 'f1 f1.txt' ++ # UNSUPPORTED command 'f2 f2.txt' ++ # UNSUPPORTED command 'f3 f3.txt' ++ # UNSUPPORTED command 'f4 f4.txt' ++ # UNSUPPORTED command 'f5 f5.txt' ++ # UNSUPPORTED command 'f6 f6.txt' ++ # UNSUPPORTED command 'f7 f7.txt' ++ # UNSUPPORTED command 'f8 f8.txt' ++ # UNSUPPORTED command 'f9 f9.txt' ++ # UNSUPPORTED command 'f0 f10.txt' ++#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg: ++ background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'splash.png' ++# D-I config version 2.0 ++ # UNSUPPORTED command 'menu hshift 13' ++ # UNSUPPORTED command 'menu width 49' ++ # UNSUPPORTED command 'menu margin 8' ++ ++ # UNSUPPORTED command 'menu title Installer boot menu' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++set timeout=5 ++ default='vesamenu.c32' ++menuentry 'Try Ubuntu without installing' --hotkey 't' --id 'live' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Install Ubuntu' --hotkey 'i' --id 'live-install' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Check disc for defects' --hotkey 'c' --id 'check' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/casper/vmlinuz' boot=casper integrity-check initrd=/casper/initrd.lz quiet splash -- ++ initrd$linux_suffix '/'/'/casper/initrd.lz' ++} ++menuentry 'Test memory' --hotkey 'm' --id 'memtest' { ++ if test x$grub_platform = xpc; then linux_suffix=16; else linux_suffix= ; fi ++ linux$linux_suffix '/'/'/install/mt86plus' ++} ++menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' { ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///gtk.cfg not found ++ # UNSUPPORTED command 'menu begin advanced' ++ # UNSUPPORTED command 'menu title Advanced options' ++ # UNSUPPORTED command 'menu color title * #FFFFFFFF *' ++ # UNSUPPORTED command 'menu color border * #00000000 #00000000 none' ++ # UNSUPPORTED command 'menu color sel * #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *' ++ # UNSUPPORTED command 'menu color tabmsg * #ffffffff #00000000 *' ++ # UNSUPPORTED command 'menu color help 37;40 #ffdddd00 #00000000 none' ++ # UNSUPPORTED command 'menu vshift 12' ++ # UNSUPPORTED command 'menu rows 10' ++ # UNSUPPORTED command 'menu helpmsgrow 15' ++# The command line must be at least one line from the bottom. ++ # UNSUPPORTED command 'menu cmdlinerow 16' ++ # UNSUPPORTED command 'menu timeoutrow 16' ++ # UNSUPPORTED command 'menu tabmsgrow 18' ++ # UNSUPPORTED command 'menu tabmsg Press ENTER to boot or TAB to edit a menu entry' ++ root=hd0; ++ chainloader +1; ++} ++menuentry 'Back..' --hotkey 'b' --id 'mainmenu' { ++ # UNSUPPORTED command 'menu exit' ++# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///adgtk.cfg not found ++ # UNSUPPORTED command 'menu end' ++ # UNSUPPORTED entry type 0 ++true; ++} ++menuentry 'Help' --hotkey 'h' --id 'help' { ++ # UNSUPPORTED command 'ui gfxboot bootlogo' ++#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg: ++ syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' ++} ++} ++} +diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in +new file mode 100644 +index 0000000..fc4edd8 +--- /dev/null ++++ b/tests/syslinux_test.in +@@ -0,0 +1,16 @@ ++#!/bin/sh ++ ++set -e ++ ++outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 ++ ++"@builddir@/grub-syslinux2cfg" -r "@abs_top_srcdir@/tests/syslinux/ubuntu10.04" "@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile" ++ ++echo "$outfile" ++ ++if ! diff -u "$outfile" "@builddir@/tests/syslinux/ubuntu10.04_grub.cfg"; then ++ echo "Mismatch in ubuntu10.04" ++ exit 1; ++fi ++ ++exit 0 +diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in +index 524c1d1..d5ef7f9 100644 +--- a/tests/test_sha512sum.in ++++ b/tests/test_sha512sum.in +@@ -1,7 +1,7 @@ + #! /bin/bash + + # create a randome file +-file=`mktemp` ++file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + cat >$file <$outfile1 <$outfile2 + + SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ ` +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index 669527a..5107ca1 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -102,7 +102,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + # OS LIMITATION: Linux oopses with >=32768K + MAXBLKSIZE=$((16384*1024)) + ;; +- x"lvm_raid4" | x"lvm_raid5" | x"lvm_raid6") ++ x"lvm_raid1"* | x"lvm_raid4" | x"lvm_raid5" | x"lvm_raid6") + # OS LIMITATION: Linux crashes with less than 16384 + MINBLKSIZE=16384 + # Could go further but what's the point? +@@ -166,7 +166,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + x"zfs_raidz" | x"zfs_stripe" | x"zfs_mirror" | xbtrfs_raid0 \ + | xbtrfs_raid1 | x"mdraid"*"_raid4" | x"mdraid"*"_raid5" \ + | x"mdraid"*"_linear" \ +- | x"mdraid"*"_raid10" | xlvm_mirror1 | xlvm_mirrorall) ++ | x"mdraid"*"_raid10" | xlvm_raid1* | xlvm_mirror1 | xlvm_mirrorall) + MINDEVICES=2 + MAXDEVICES=7 + ;; +@@ -199,7 +199,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + + case x$fs in + # RAID 1 has to work with even one device of the set. +- xzfs_mirror | x"mdraid"*"_raid1" | xlvm_mirrorall) ++ xzfs_mirror | x"mdraid"*"_raid1" | xlvm_mirrorall | xlvm_raid1all) + NEED_IMAGES_N=1;; + # Degrade raidz by removing 3 devices + xzfs_raidz3) +@@ -210,7 +210,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + # Degrade raidz and btrfs RAID1 by removing one device + xbtrfs_raid1 | xbtrfs_raid10 | xzfs_raidz | x"mdraid"*"_raid4" \ + | x"mdraid"*"_raid5" | x"mdraid"*"_raid10" | xlvm_mirror1 \ +- | x"lvm_raid4" | x"lvm_raid5") ++ | x"lvm_raid1" | x"lvm_raid4" | x"lvm_raid5") + NEED_IMAGES_N=$((NDEVICES-1));; + *) + NEED_IMAGES_N=$NDEVICES;; +@@ -281,7 +281,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + #FSLABEL="g;/_é莭ð¯¦ðŸ˜ÐºÐ¸Ñ‚ u" + ;; + # FS LIMITATION: reiserfs, extN and jfs label is at most 16 UTF-8 characters +- x"reiserfs_old" | x"reiserfs" | x"ext2" | xext2_old | x"ext3" | x"ext4" | x"lvm"* | x"mdraid"* | x"jfs" | x"jfs_caseins") ++ x"reiserfs_old" | x"reiserfs" | x"ext"* | x"lvm"* | x"mdraid"* | x"jfs" | x"jfs_caseins") + FSLABEL="g;/éт 莭ðŸ˜";; + # FS LIMITATION: No underscore, space, semicolon, slash or international characters in UFS* in label. Limited to 32 UTF-8 characters + x"ufs1" | x"ufs1_sun" | x"ufs2") +@@ -728,10 +728,15 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + lvcreate -l "$((NDEVICES*7*LVMBLKMUL))" -n testvol grub_test + elif [ x$fs = xlvm_stripe ] ; then + lvcreate -l "$((NDEVICES*7*LVMBLKMUL))" -i "$NDEVICES" -n testvol grub_test +- elif [ x$fs = xlvm_mirror1 ] ; then +- lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" -n testvol grub_test ++ elif [ x$fs = xlvm_mirror1 ] || [ x$fs = xlvm_raid1 ] ; then ++ lvcreate -m 1 -l "$((NDEVICES*2*LVMBLKMUL))" --type "${fs/lvm_/}" -n testvol grub_test + elif [ x$fs = xlvm_mirrorall ] ; then +- lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL))" -n testvol grub_test ++ lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL))" --type mirror -n testvol grub_test ++ elif [ x$fs = xlvm_raid1all ] ; then ++ # Until version 2.02.103 LVM counts metadata segments ++ # twice when checking available space. Reduce segment ++ # count to work around it. ++ lvcreate -m "$((NDEVICES-1))" -l "$((6*LVMBLKMUL - 1))" --type raid1 -n testvol grub_test + elif [ x$fs = xlvm_raid4 ] || [ x$fs = xlvm_raid5 ]; then + lvcreate -l "$(((NDEVICES-1) * 5*LVMBLKMUL))" -i "$((NDEVICES-1))" --type "${fs/lvm_/}" -n testvol grub_test + elif [ x$fs = xlvm_raid6 ]; then +@@ -746,6 +751,10 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext2" -r 0 -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" + MOUNTFS=ext2 + ;; ++ xext4_metabg) ++ MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O meta_bg,^resize_inode -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" ++ MOUNTFS=ext4 ++ ;; + xext*) + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.$fs" -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" ;; + xxfs) +@@ -989,6 +998,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + fi + sleep 1; + done ++ UMOUNT_TIME=$(date -u "+%Y-%m-%d %H:%M:%S") + sleep 1 + vgchange -a n grub_test + ;; +@@ -1000,6 +1010,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + fi + sleep 1; + done ++ UMOUNT_TIME=$(date -u "+%Y-%m-%d %H:%M:%S") + sleep 1 + mdadm --stop /dev/md/"${fs}_$NDEVICES" + ;; +@@ -1065,6 +1076,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + : + else + echo NLIST FAIL ++ echo "$LSROUT" + TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" + exit 1 + fi +@@ -1082,6 +1094,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + : + else + echo LONG LIST FAIL ++ echo "$LSROUT" + TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + exit 1 + fi +@@ -1110,6 +1123,36 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + + case x"$fs" in + x"zfs"*) ++ LSROUT=$(run_grubfstest ls -- -la "($GRUBDEVICE)/grub fs@/.");; ++ *) ++ LSROUT=$(run_grubfstest ls -- -la "($GRUBDEVICE)/.");; ++ esac ++ if echo "$LSROUT" | grep -F " $BASEFILE" | grep "$BLOCKCNT" > /dev/null; then ++ : ++ else ++ echo DOT IN ROOTDIR FAIL ++ echo "$LSROUT" ++ TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ exit 1 ++ fi ++ ++ case x"$fs" in ++ x"zfs"*) ++ LSROUT=$(run_grubfstest ls -- -la "($GRUBDEVICE)/grub fs@/..");; ++ *) ++ LSROUT=$(run_grubfstest ls -- -la "($GRUBDEVICE)/..");; ++ esac ++ if echo "$LSROUT" | grep -F " $BASEFILE" | grep "$BLOCKCNT" > /dev/null; then ++ : ++ else ++ echo DOTDOT IN ROOTDIR FAIL ++ echo "$LSROUT" ++ TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ exit 1 ++ fi ++ ++ case x"$fs" in ++ x"zfs"*) + LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/grub fs@/////sdir");; + *) + LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/////sdir");; +@@ -1138,6 +1181,36 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + exit 1 + fi + ++ case x"$fs" in ++ x"zfs"*) ++ LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/grub fs@/sdir/.");; ++ *) ++ LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/sdir/.");; ++ esac ++ if echo "$LSROUT" | grep -F " 2.img" | grep $BLOCKCNT > /dev/null; then ++ : ++ else ++ echo DOT IN SUBDIR FAIL ++ echo "$LSROUT" ++ TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/sdir" ++ exit 1 ++ fi ++ ++ case x"$fs" in ++ x"zfs"*) ++ LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/grub fs@/sdir/../sdir");; ++ *) ++ LSROUT=$(run_grubfstest ls -- -l "($GRUBDEVICE)/sdir/../sdir");; ++ esac ++ if echo "$LSROUT" | grep -F " 2.img" | grep $BLOCKCNT > /dev/null; then ++ : ++ else ++ echo DOTDOT IN SUBDIR FAIL ++ echo "$LSROUT" ++ TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/ssdir" ++ exit 1 ++ fi ++ + LSOUT=`run_grubfstest ls -- -l "($GRUBDEVICE)"` + if [ x"$NOFSLABEL" = xy ]; then + : +@@ -1208,10 +1281,15 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + case x$fs in + xiso9660 | xziso9660 | xrockridge | xjoliet | xrockridge_joliet | xiso9660_1999 | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) + FSTIME="$(date -d "$(echo ${FSUUID} | awk -F - '{ print $1"-"$2"-"$3" "$4":"$5":"$6 ;}')" '+%Y-%m-%d %H:%M:%S')";; ++ xlvm*|xmdraid*) ++ # With some abstractions like mdraid flushing to disk ++ # may be delayed for a long time. ++ FSTIME="$UMOUNT_TIME";; + *) + FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGES[0]}"|awk '{print $6; }'|sed 's,_, ,g')";; + esac +- # With some abstractions like mdraid it may take up to 2 seconds for the data to reach the disks after it was flushed by FS in these tests. ++ # With some abstractions like mdraid computing of UMOUNT_TIME ++ # is not precise. Account for small difference here. + FSTIMEM1="$(date -d "$FSTIME UTC -1 second" -u "+%Y-%m-%d %H:%M:%S")" + FSTIMEM2="$(date -d "$FSTIME UTC -2 second" -u "+%Y-%m-%d %H:%M:%S")" + +diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in +index d9a5253..6d2b132 100644 +--- a/tests/util/grub-shell.in ++++ b/tests/util/grub-shell.in +@@ -349,6 +349,7 @@ fi + if [ x$boot != xnet ] && [ x$boot != xemu ]; then + pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ + --rom-directory="${rom_directory}" \ ++ --locale-directory="@srcdir@/po" \ + --themes-directory="@srcdir@/themes" \ + $mkimage_extra_arg ${mkrescue_args} \ + "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ +@@ -422,11 +423,28 @@ do_trim () + fi + } + ++copy_extra_files() { ++ _destdir="$1" ++ shift ++ ++ # FIXME support '=' in file names ++ for _file in "$@"; do ++ _target="${_file%=*}" ++ _source="${_file#*=}" ++ [ -n "$_source" ] || _source="$_target" ++ _target="$_destdir/$_target" ++ _targetdir="$(dirname "$_target")" ++ [ -d "$_targetdir" ] || mkdir -p "$_targetdir" ++ cp "$_source" "$_target" ++ done ++} ++ + if [ x$boot = xnet ]; then + netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 + pkgdatadir="@builddir@" "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null + cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" + cp "${source}" "$netdir/boot/grub/testcase.cfg" ++ [ -z "$files" ] || copy_extra_files "$netdir" $files + timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim + elif [ x$boot = xemu ]; then + grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" +diff --git a/util/getroot.c b/util/getroot.c +index 3958105..36f1730 100644 +--- a/util/getroot.c ++++ b/util/getroot.c +@@ -107,6 +107,7 @@ grub_util_pull_device (const char *os_dev) + default: + if (grub_util_pull_device_os (os_dev, ab)) + return; ++ /* Fallthrough. */ + case GRUB_DEV_ABSTRACTION_NONE: + free (grub_util_biosdisk_get_grub_dev (os_dev)); + return; +@@ -405,7 +406,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) + os_dev); + grub_errno = GRUB_ERR_NONE; + +- canon = canonicalize_file_name (os_dev); ++ canon = grub_canonicalize_file_name (os_dev); + drive = grub_hostdisk_os_dev_to_grub_drive (canon ? : os_dev, 1); + if (canon) + free (canon); +@@ -417,7 +418,10 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) + + name = grub_util_get_ldm (disk, ctx.start); + if (name) +- return name; ++ { ++ grub_disk_close (disk); ++ return name; ++ } + + ctx.partname = NULL; + +diff --git a/util/grub-file.c b/util/grub-file.c +index 9989dfe..50c18b6 100644 +--- a/util/grub-file.c ++++ b/util/grub-file.c +@@ -77,7 +77,7 @@ main (int argc, char *argv[]) + } + if (had_file) + grub_util_error ("one argument expected"); +- argv2[i - 1] = canonicalize_file_name (argv[i]); ++ argv2[i - 1] = grub_canonicalize_file_name (argv[i]); + if (!argv2[i - 1]) + { + grub_util_error (_("cannot open `%s': %s"), argv[i], +diff --git a/util/grub-fstest.c b/util/grub-fstest.c +index 31af2a7..a358ae4 100644 +--- a/util/grub-fstest.c ++++ b/util/grub-fstest.c +@@ -570,12 +570,12 @@ argp_parser (int key, char *arg, struct argp_state *state) + 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); +@@ -651,7 +651,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + { + if (args_count == 0) + images = xmalloc (num_disks * sizeof (images[0])); +- images[args_count] = canonicalize_file_name (arg); ++ images[args_count] = grub_canonicalize_file_name (arg); + args_count++; + return 0; + } +diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c +index e01447a..e35dcb7 100644 +--- a/util/grub-gen-asciih.c ++++ b/util/grub-gen-asciih.c +@@ -81,14 +81,14 @@ add_glyph (FT_UInt glyph_idx, FT_Face face, + err = FT_Load_Glyph (face, glyph_idx, flag); + if (err) + { +- printf ("Freetype Error %d loading glyph 0x%x for U+0x%x", ++ fprintf (stderr, "Freetype Error %d loading glyph 0x%x for U+0x%x", + err, glyph_idx, char_code); + + if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs)) +- printf (": %s\n", ft_errmsgs[err]); ++ fprintf (stderr, ": %s\n", ft_errmsgs[err]); + else +- printf ("\n"); +- return; ++ fprintf (stderr, "\n"); ++ exit (1); + } + + glyph = face->glyph; +@@ -128,7 +128,6 @@ add_glyph (FT_UInt glyph_idx, FT_Face face, + static void + write_font_ascii_bitmap (FILE *file, FT_Face face) + { +- struct grub_glyph_info glyph; + int char_code; + + fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n"); +@@ -138,10 +137,14 @@ write_font_ascii_bitmap (FILE *file, FT_Face face) + for (char_code = 0; char_code <= 0x7f; char_code++) + { + FT_UInt glyph_idx; +- ++ struct grub_glyph_info glyph; ++ + glyph_idx = FT_Get_Char_Index (face, char_code); + if (!glyph_idx) + return; ++ ++ memset (&glyph, 0, sizeof(glyph)); ++ + add_glyph (glyph_idx, face, char_code, &glyph); + + if (glyph.width == 8 && glyph.height == 16 +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index 6ea0a8e..2598308 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -238,7 +238,7 @@ grub_install_push_module (const char *val) + if (modules.n_alloc < 16) + modules.n_alloc = 16; + modules.entries = xrealloc (modules.entries, +- modules.n_alloc * sizeof (modules.entries)); ++ modules.n_alloc * sizeof (*modules.entries)); + } + modules.entries[modules.n_entries++] = xstrdup (val); + modules.entries[modules.n_entries] = NULL; +@@ -490,10 +490,11 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + dir, prefix, + outname, mkimage_target, + compnames[compression], note ? "--note" : "", s); ++ free (s); + + tgt = grub_install_get_image_target (mkimage_target); + if (!tgt) +- grub_util_error (_("unknown target format %s\n"), mkimage_target); ++ grub_util_error (_("unknown target format %s"), mkimage_target); + + grub_install_generate_image (dir, prefix, fp, outname, + modules.entries, memdisk_path, +@@ -668,6 +669,36 @@ static struct + }; + + char * ++grub_install_get_platforms_string (void) ++{ ++ char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (platforms)); ++ int platform_strins_len = 0; ++ char *platforms_string; ++ char *ptr; ++ unsigned i; ++ for (i = 0; i < ARRAY_SIZE (platforms); i++) ++ { ++ arr[i] = xasprintf ("%s-%s", platforms[i].cpu, ++ platforms[i].platform); ++ platform_strins_len += strlen (arr[i]) + 2; ++ } ++ ptr = platforms_string = xmalloc (platform_strins_len); ++ qsort (arr, ARRAY_SIZE (platforms), sizeof (char *), grub_qsort_strcmp); ++ for (i = 0; i < ARRAY_SIZE (platforms); i++) ++ { ++ strcpy (ptr, arr[i]); ++ ptr += strlen (arr[i]); ++ *ptr++ = ','; ++ *ptr++ = ' '; ++ free (arr[i]); ++ } ++ ptr[-2] = 0; ++ free (arr); ++ ++ return platforms_string; ++} ++ ++char * + grub_install_get_platform_name (enum grub_install_plat platid) + { + return xasprintf ("%s-%s", platforms[platid].cpu, +@@ -871,8 +902,8 @@ grub_install_get_target (const char *src) + { + char *fn; + grub_util_fd_t f; +- char buf[2048]; +- size_t r; ++ char buf[8192]; ++ ssize_t r; + char *c, *pl, *p; + size_t i; + fn = grub_util_path_concat (2, src, "modinfo.sh"); +@@ -881,6 +912,8 @@ grub_install_get_target (const char *src) + grub_util_error (_("%s doesn't exist. Please specify --target or --directory"), + fn); + r = grub_util_fd_read (f, buf, sizeof (buf) - 1); ++ if (r < 0) ++ grub_util_error (_("cannot read `%s': %s"), fn, strerror (errno)); + grub_util_fd_close (f); + buf[r] = '\0'; + c = strstr (buf, "grub_modinfo_target_cpu="); +diff --git a/util/grub-install.c b/util/grub-install.c +index 8cfe0ea..5662726 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -94,7 +94,6 @@ enum + OPTION_RECHECK, + OPTION_FORCE, + OPTION_FORCE_FILE_ID, +- OPTION_MODULE, + OPTION_NO_NVRAM, + OPTION_REMOVABLE, + OPTION_BOOTLOADER_ID, +@@ -256,7 +255,7 @@ static struct argp_option options[] = { + OPTION_HIDDEN, 0, 2}, + {"target", OPTION_TARGET, N_("TARGET"), + /* TRANSLATORS: "TARGET" as in "target platform". */ +- 0, N_("install GRUB for TARGET platform [default=%s]"), 2}, ++ 0, N_("install GRUB for TARGET platform [default=%s]; available targets: %s"), 2}, + {"grub-setup", OPTION_SETUP, "FILE", OPTION_HIDDEN, 0, 2}, + {"grub-mkrelpath", OPTION_MKRELPATH, "FILE", OPTION_HIDDEN, 0, 2}, + {"grub-mkdevicemap", OPTION_MKDEVICEMAP, "FILE", OPTION_HIDDEN, 0, 2}, +@@ -273,7 +272,7 @@ static struct argp_option options[] = { + N_("install even if problems are detected"), 2}, + {"force-file-id", OPTION_FORCE_FILE_ID, 0, 0, + N_("use identifier file even if UUID is available"), 2}, +- {"disk-module", OPTION_MODULE, N_("MODULE"), 0, ++ {"disk-module", OPTION_DISK_MODULE, N_("MODULE"), 0, + N_("disk module to use (biosdisk or native). " + "This option is only available on BIOS target."), 2}, + {"no-nvram", OPTION_NO_NVRAM, 0, 0, +@@ -340,7 +339,13 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) + case OPTION_BOOT_DIRECTORY: + return xasprintf (text, GRUB_DIR_NAME, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME); + case OPTION_TARGET: +- return xasprintf (text, get_default_platform ()); ++ { ++ char *plats = grub_install_get_platforms_string (); ++ char *ret; ++ ret = xasprintf (text, get_default_platform (), plats); ++ free (plats); ++ return ret; ++ } + case ARGP_KEY_HELP_POST_DOC: + return xasprintf (text, program_name, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME); + default: +@@ -381,7 +386,7 @@ probe_raid_level (grub_disk_t disk) + } + + static void +-push_partmap_module (const char *map) ++push_partmap_module (const char *map, void *data __attribute__ ((unused))) + { + char buf[50]; + +@@ -396,6 +401,12 @@ push_partmap_module (const char *map) + } + + static void ++push_cryptodisk_module (const char *mod, void *data __attribute__ ((unused))) ++{ ++ grub_install_push_module (mod); ++} ++ ++static void + probe_mods (grub_disk_t disk) + { + grub_partition_t part; +@@ -406,11 +417,11 @@ probe_mods (grub_disk_t disk) + grub_util_info ("no partition map found for %s", disk->name); + + for (part = disk->partition; part; part = part->parent) +- push_partmap_module (part->partmap->name); ++ push_partmap_module (part->partmap->name, NULL); + + if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) + { +- grub_diskfilter_get_partmap (disk, push_partmap_module); ++ grub_diskfilter_get_partmap (disk, push_partmap_module, NULL); + have_abstractions = 1; + } + +@@ -426,7 +437,7 @@ probe_mods (grub_disk_t disk) + if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) + { + grub_util_cryptodisk_get_abstraction (disk, +- grub_install_push_module); ++ push_cryptodisk_module, NULL); + have_abstractions = 1; + have_cryptodisk = 1; + } +@@ -604,8 +615,6 @@ device_map_check_duplicates (const char *dev_map) + char **d; + size_t i; + +- d = xmalloc (alloced * sizeof (d[0])); +- + if (dev_map[0] == '\0') + return; + +@@ -613,6 +622,8 @@ device_map_check_duplicates (const char *dev_map) + if (! fp) + return; + ++ d = xmalloc (alloced * sizeof (d[0])); ++ + while (fgets (buf, sizeof (buf), fp)) + { + char *p = buf; +@@ -675,6 +686,7 @@ write_to_disk (grub_device_t dev, const char *fn) + + core_img = grub_util_read_image (fn); + ++ grub_util_info ("writing `%s' to `%s'", fn, dev->disk->name); + err = grub_disk_write (dev->disk, 0, 0, + core_size, core_img); + free (core_img); +@@ -761,7 +773,7 @@ bless (grub_device_t dev, const char *path, int x86) + err = grub_mac_bless_inode (dev, st.st_ino, S_ISDIR (st.st_mode), x86); + if (err) + grub_util_error ("%s", grub_errmsg); +- grub_util_info ("blessed\n"); ++ grub_util_info ("blessed"); + } + + static void +@@ -955,7 +967,7 @@ main (int argc, char *argv[]) + { + char * t = grub_util_path_concat (2, bootdir, GRUB_DIR_NAME); + grub_install_mkdir_p (t); +- grubdir = canonicalize_file_name (t); ++ grubdir = grub_canonicalize_file_name (t); + if (!grubdir) + grub_util_error (_("failed to get canonical path of `%s'"), t); + free (t); +@@ -1058,7 +1070,7 @@ main (int argc, char *argv[]) + efidir_is_mac = 1; + + if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0) +- grub_util_error (_("%s doesn't look like an EFI partition.\n"), efidir); ++ grub_util_error (_("%s doesn't look like an EFI partition"), efidir); + + /* The EFI specification requires that an EFI System Partition must + contain an "EFI" subdirectory, and that OS loaders are stored in +@@ -1091,7 +1103,7 @@ main (int argc, char *argv[]) + efi_file = "BOOTARM.EFI"; + break; + case GRUB_INSTALL_PLATFORM_ARM64_EFI: +- efi_file = "BOOTAARCH64.EFI"; ++ efi_file = "BOOTAA64.EFI"; + break; + default: + grub_util_error ("%s", _("You've found a bug")); +@@ -1118,7 +1130,7 @@ main (int argc, char *argv[]) + efi_file = "grubarm.efi"; + break; + case GRUB_INSTALL_PLATFORM_ARM64_EFI: +- efi_file = "grubarm64.efi"; ++ efi_file = "grubaa64.efi"; + break; + default: + efi_file = "grub.efi"; +@@ -1259,7 +1271,7 @@ main (int argc, char *argv[]) + + if (!config.is_cryptodisk_enabled && have_cryptodisk) + grub_util_error (_("attempt to install to encrypted disk without cryptodisk enabled. " +- "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=1", ++ "Set `%s' in file `%s'"), "GRUB_ENABLE_CRYPTODISK=y", + grub_util_get_config_filename ()); + + if (disk_module && grub_strcmp (disk_module, "ata") == 0) +@@ -1287,7 +1299,7 @@ main (int argc, char *argv[]) + { + char *t = grub_util_path_concat (2, grubdir, + platname); +- platdir = canonicalize_file_name (t); ++ platdir = grub_canonicalize_file_name (t); + if (!platdir) + grub_util_error (_("failed to get canonical path of `%s'"), + t); +@@ -1797,7 +1809,7 @@ main (int argc, char *argv[]) + grub_install_copy_file (imgfile, dst, 1); + free (dst); + } +- ++ /* Fallthrough. */ + case GRUB_INSTALL_PLATFORM_X86_64_EFI: + if (efidir_is_mac) + { +diff --git a/util/grub-macbless.c b/util/grub-macbless.c +index 742353a..e9b15a0 100644 +--- a/util/grub-macbless.c ++++ b/util/grub-macbless.c +@@ -64,7 +64,7 @@ bless (const char *path, int x86) + grub_err_t err; + struct stat st; + +- grub_path = canonicalize_file_name (path); ++ grub_path = grub_canonicalize_file_name (path); + + if (stat (grub_path, &st) < 0) + grub_util_error (N_("cannot stat `%s': %s"), +@@ -92,6 +92,8 @@ bless (const char *path, int x86) + free (filebuf_via_grub); + free (filebuf_via_sys); + free (drive_name); ++ free (devices); ++ grub_device_close (dev); + } + + static struct argp_option options[] = { +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index ca040dd..3183744 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -33,6 +33,9 @@ datadir="@datadir@" + if [ "x$pkgdatadir" = x ]; then + pkgdatadir="${datadir}/@PACKAGE@" + fi ++# export it for scripts ++export pkgdatadir ++ + grub_cfg="" + grub_mkconfig_dir="${sysconfdir}"/grub.d + +@@ -124,7 +127,7 @@ set $grub_probe dummy + if test -f "$1"; then + : + else +- gettext_print "%s: Not found.\n" "$1" 1>&2 ++ gettext_printf "%s: Not found.\n" "$1" 1>&2 + exit 1 + fi + +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 14fadbc..60b31ca 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -145,7 +145,7 @@ prepare_grub_to_access_device () + done + + if [ x$GRUB_ENABLE_CRYPTODISK = xy ]; then +- for uuid in "`"${grub_probe}" --device $@ --target=cryptodisk_uuid`"; do ++ for uuid in `"${grub_probe}" --device $@ --target=cryptodisk_uuid`; do + echo "cryptomount -u $uuid" + done + fi +@@ -246,8 +246,8 @@ version_test_gt () + fi + case "$version_test_gt_a:$version_test_gt_b" in + *.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 ;; + esac + version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" + return "$?" +diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c +index 3cb02ad..a0cab3a 100644 +--- a/util/grub-mkfont.c ++++ b/util/grub-mkfont.c +@@ -33,7 +33,11 @@ + + #ifndef GRUB_BUILD + #define _GNU_SOURCE 1 ++#pragma GCC diagnostic ignored "-Wmissing-prototypes" ++#pragma GCC diagnostic ignored "-Wmissing-declarations" + #include ++#pragma GCC diagnostic error "-Wmissing-prototypes" ++#pragma GCC diagnostic error "-Wmissing-declarations" + #endif + #include + +@@ -516,8 +520,8 @@ process_cursive (struct gsub_feature *feature, + } + if (grub_be_to_cpu16 (lookup->flag) & ~GSUB_RTL_CHAR) + { +- printf (_("Unsupported substitution flag: 0x%x\n"), +- grub_be_to_cpu16 (lookup->flag)); ++ grub_util_info ("unsupported substitution flag: 0x%x", ++ grub_be_to_cpu16 (lookup->flag)); + } + switch (feattag) + { +@@ -577,7 +581,8 @@ process_cursive (struct gsub_feature *feature, + There are 2 coverage specifications: list and range. + This warning is thrown when another coverage specification + is detected. */ +- printf (_("Unsupported coverage specification: %d\n"), covertype); ++ fprintf (stderr, ++ _("Unsupported coverage specification: %d\n"), covertype); + } + } + } +@@ -616,7 +621,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut) + grub_uint32_t feattag + = grub_be_to_cpu32 (features->features[i].feature_tag); + if (feature->params) +- printf (_("WARNING: unsupported font feature parameters: %x\n"), ++ fprintf (stderr, ++ _("WARNING: unsupported font feature parameters: %x\n"), + grub_be_to_cpu16 (feature->params)); + switch (feattag) + { +@@ -647,8 +653,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut) + if (!grub_isgraph (str[j])) + str[j] = '?'; + /* TRANSLATORS: It's gsub feature, not gsub font. */ +- printf (_("Unknown gsub font feature 0x%x (%s)\n"), +- feattag, str); ++ grub_util_info ("Unknown gsub font feature 0x%x (%s)", ++ feattag, str); + } + } + } +@@ -698,7 +704,7 @@ write_be16_section (const char *name, grub_uint16_t data, int* offset, + { + grub_uint32_t leng; + +- leng = grub_cpu_to_be32 (2); ++ leng = grub_cpu_to_be32_compile_time (2); + data = grub_cpu_to_be16 (data); + grub_util_write_image (name, 4, file, filename); + grub_util_write_image ((char *) &leng, 4, file, filename); +@@ -795,7 +801,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file) + + offset = 0; + +- leng = grub_cpu_to_be32 (4); ++ leng = grub_cpu_to_be32_compile_time (4); + grub_util_write_image (FONT_FORMAT_SECTION_NAMES_FILE, + sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1, file, + output_file); +diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c +index a2bd4c1..1e0bcf1 100644 +--- a/util/grub-mkimage.c ++++ b/util/grub-mkimage.c +@@ -64,7 +64,7 @@ static struct argp_option options[] = { + {"directory", 'd', N_("DIR"), 0, + /* TRANSLATORS: platform here isn't identifier. It can be translated. */ + N_("use images and modules under DIR [default=%s/]"), 0}, +- {"prefix", 'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0}, ++ {"prefix", 'p', N_("DIR"), 0, N_("set prefix directory"), 0}, + {"memdisk", 'm', N_("FILE"), 0, + /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated. + "embed" is a verb (command description). "*/ +@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) + { + case 'd': + return xasprintf (text, grub_util_get_pkglibdir ()); +- case 'p': +- return xasprintf (text, DEFAULT_DIRECTORY); + case 'O': + { + char *formats = grub_install_get_image_targets_string (), *ret; +@@ -268,6 +266,15 @@ main (int argc, char *argv[]) + exit(1); + } + ++ if (!arguments.prefix) ++ { ++ char *program = xstrdup(program_name); ++ printf ("%s\n", _("Prefix not specified (use the -p option).")); ++ argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program); ++ free (program); ++ exit(1); ++ } ++ + if (arguments.output) + { + fp = grub_util_fopen (arguments.output, "wb"); +@@ -287,8 +294,7 @@ main (int argc, char *argv[]) + strcpy (ptr, dn); + } + +- grub_install_generate_image (arguments.dir, +- arguments.prefix ? : DEFAULT_DIRECTORY, fp, ++ grub_install_generate_image (arguments.dir, arguments.prefix, fp, + arguments.output, arguments.modules, + arguments.memdisk, arguments.pubkeys, + arguments.npubkeys, arguments.config, +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 0a1ac9e..3c76d07 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -1539,6 +1539,8 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size, + symtab_section = s; + break; + } ++ if (! symtab_section) ++ grub_util_error ("%s", _("no symbol table")); + + #ifdef MKIMAGE_ELF32 + if (image_target->elf_target == EM_ARM) +@@ -1577,8 +1579,6 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size, + } + #endif + +- if (! symtab_section) +- grub_util_error ("%s", _("no symbol table")); + } + else + { +diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c +index 692f881..1a4f1b4 100644 +--- a/util/grub-mklayout.c ++++ b/util/grub-mklayout.c +@@ -329,7 +329,7 @@ write_file (FILE *out, const char *fname, struct grub_keyboard_layout *layout) + grub_uint32_t version; + unsigned i; + +- version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION); ++ version = grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION); + + for (i = 0; i < ARRAY_SIZE (layout->keyboard_map); i++) + layout->keyboard_map[i] = grub_cpu_to_le32(layout->keyboard_map[i]); +diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c +index 8366a11..3813e8b 100644 +--- a/util/grub-mknetdir.c ++++ b/util/grub-mknetdir.c +@@ -140,7 +140,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) + + prefix = xasprintf ("/%s", subdir); + if (!targets[platform].mkimage_target) +- grub_util_error (_("unsupported platform %s\n"), platsub); ++ grub_util_error (_("unsupported platform %s"), platsub); + + grub_cfg = grub_util_path_concat (2, grubdir, "grub.cfg"); + cfg = grub_util_fopen (grub_cfg, "wb"); +diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c +index 317879d..4511826 100644 +--- a/util/grub-mkrescue.c ++++ b/util/grub-mkrescue.c +@@ -25,7 +25,11 @@ + #include + #include + #include ++#pragma GCC diagnostic ignored "-Wmissing-prototypes" ++#pragma GCC diagnostic ignored "-Wmissing-declarations" + #include ++#pragma GCC diagnostic error "-Wmissing-prototypes" ++#pragma GCC diagnostic error "-Wmissing-declarations" + + #include + #include +@@ -40,9 +44,6 @@ static char *label_color; + static char *label_bgcolor; + static char *product_name; + static char *product_version; +-static int xorriso_tail_argc; +-static int xorriso_tail_arg_alloc; +-static char **xorriso_tail_argv; + static char *output_image; + static char *xorriso; + static char *boot_grub; +@@ -211,16 +212,6 @@ argp_parser (int key, char *arg, struct argp_state *state) + xorriso = xstrdup (arg); + return 0; + +- case ARGP_KEY_ARG: +- if (xorriso_tail_arg_alloc <= xorriso_tail_argc) +- { +- xorriso_tail_arg_alloc = 2 * (4 + xorriso_tail_argc); +- xorriso_tail_argv = xrealloc (xorriso_tail_argv, +- sizeof (xorriso_tail_argv[0]) +- * xorriso_tail_arg_alloc); +- } +- xorriso_tail_argv[xorriso_tail_argc++] = xstrdup (arg); +- return 0; + default: + return ARGP_ERR_UNKNOWN; + } +@@ -370,12 +361,70 @@ make_image_fwdisk (enum grub_install_plat plat, + free (out); + } + ++static int ++option_is_end (const struct argp_option *opt) ++{ ++ return !opt->key && !opt->name && !opt->doc && !opt->group; ++} ++ ++ ++static int ++args_to_eat (const char *arg) ++{ ++ int j; ++ ++ if (arg[0] != '-') ++ return 0; ++ ++ if (arg[1] == '-') ++ { ++ for (j = 0; !option_is_end(&options[j]); j++) ++ { ++ size_t len = strlen (options[j].name); ++ if (strncmp (arg + 2, options[j].name, len) == 0) ++ { ++ if (arg[2 + len] == '=') ++ return 1; ++ if (arg[2 + len] == '\0' && options[j].arg) ++ return 2; ++ if (arg[2 + len] == '\0') ++ return 1; ++ } ++ } ++ if (strcmp (arg, "--help") == 0) ++ return 1; ++ if (strcmp (arg, "--usage") == 0) ++ return 1; ++ if (strcmp (arg, "--version") == 0) ++ return 1; ++ return 0; ++ } ++ if (arg[2] && arg[3]) ++ return 0; ++ for (j = 0; !option_is_end(&options[j]); j++) ++ { ++ if (options[j].key > 0 && options[j].key < 128 && arg[1] == options[j].key) ++ { ++ if (options[j].arg) ++ return 2; ++ return 1; ++ } ++ if (arg[1] == '?') ++ return 1; ++ } ++ return 0; ++} ++ + int + main (int argc, char *argv[]) + { + char *romdir; + char *sysarea_img = NULL; + const char *pkgdatadir; ++ int argp_argc; ++ char **argp_argv; ++ int xorriso_tail_argc; ++ char **xorriso_tail_argv; + + grub_util_host_init (&argc, &argv); + grub_util_disable_fd_syncs (); +@@ -387,7 +436,43 @@ main (int argc, char *argv[]) + xorriso = xstrdup ("xorriso"); + label_font = grub_util_path_concat (2, pkgdatadir, "unicode.pf2"); + +- argp_parse (&argp, argc, argv, 0, 0, 0); ++ argp_argv = xmalloc (sizeof (argp_argv[0]) * argc); ++ xorriso_tail_argv = xmalloc (sizeof (argp_argv[0]) * argc); ++ ++ xorriso_tail_argc = 0; ++ /* Program name */ ++ argp_argv[0] = argv[0]; ++ argp_argc = 1; ++ ++ /* argp doesn't allow us to catch unknwon arguments, ++ so catch them before passing to argp ++ */ ++ { ++ int i; ++ for (i = 1; i < argc; i++) ++ { ++ if (strcmp (argv[i], "-output") == 0) { ++ argp_argv[argp_argc++] = (char *) "--output"; ++ i++; ++ argp_argv[argp_argc++] = argv[i]; ++ continue; ++ } ++ switch (args_to_eat (argv[i])) ++ { ++ case 2: ++ argp_argv[argp_argc++] = argv[i++]; ++ /* Fallthrough */ ++ case 1: ++ argp_argv[argp_argc++] = argv[i]; ++ break; ++ case 0: ++ xorriso_tail_argv[xorriso_tail_argc++] = argv[i]; ++ break; ++ } ++ } ++ } ++ ++ argp_parse (&argp, argp_argc, argp_argv, 0, 0, 0); + + if (!output_image) + grub_util_error ("%s", _("output file must be specified")); +@@ -649,21 +734,28 @@ main (int argc, char *argv[]) + char *efiimgfat; + grub_install_mkdir_p (efidir_efi_boot); + ++ grub_install_push_module ("part_gpt"); ++ grub_install_push_module ("part_msdos"); ++ + imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname); + free (imgname); + ++ grub_install_push_module ("part_apple"); + img64 = grub_util_path_concat (2, efidir_efi_boot, "bootx64.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64-efi", img64); ++ grub_install_pop_module (); + ++ grub_install_push_module ("part_apple"); + img32 = grub_util_path_concat (2, efidir_efi_boot, "bootia32.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_I386_EFI, "i386-efi", img32); ++ grub_install_pop_module (); + + imgname = grub_util_path_concat (2, efidir_efi_boot, "bootarm.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname); + free (imgname); + +- imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaarch64.efi"); ++ imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaa64.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM64_EFI, "arm64-efi", + imgname); + free (imgname); +@@ -705,9 +797,13 @@ main (int argc, char *argv[]) + free (efiimgfat); + free (efidir_efi); + free (efidir); ++ grub_install_pop_module (); ++ grub_install_pop_module (); + } + ++ grub_install_push_module ("part_apple"); + make_image_fwdisk (GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275, "powerpc-ieee1275", "powerpc-ieee1275/core.elf"); ++ grub_install_pop_module (); + + if (source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275]) + { +diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c +index 8e2a2b8..4907d44 100644 +--- a/util/grub-mkstandalone.c ++++ b/util/grub-mkstandalone.c +@@ -236,7 +236,7 @@ add_tar_file (const char *from, + set_tar_value (hd.size, optr - tcn, 12); + set_tar_value (hd.mtime, mtime, 12); + hd.typeflag = 'L'; +- memcpy (hd.magic, "ustar ", 7); ++ memcpy (hd.magic, MAGIC, sizeof (hd.magic)); + memcpy (hd.uname, "grub", 4); + memcpy (hd.gname, "grub", 4); + +@@ -266,7 +266,7 @@ add_tar_file (const char *from, + set_tar_value (hd.size, size, 12); + set_tar_value (hd.mtime, mtime, 12); + hd.typeflag = '0'; +- memcpy (hd.magic, "ustar ", 7); ++ memcpy (hd.magic, MAGIC, sizeof (hd.magic)); + memcpy (hd.uname, "grub", 4); + memcpy (hd.gname, "grub", 4); + +@@ -284,6 +284,7 @@ add_tar_file (const char *from, + grub_util_fd_close (in); + + write_pad (size); ++ free (tcn); + } + + int +diff --git a/util/grub-mount.c b/util/grub-mount.c +index 118881e..0d0fea5 100644 +--- a/util/grub-mount.c ++++ b/util/grub-mount.c +@@ -41,8 +41,13 @@ + #include + #include + ++#pragma GCC diagnostic ignored "-Wmissing-prototypes" ++#pragma GCC diagnostic ignored "-Wmissing-declarations" ++#include ++#pragma GCC diagnostic error "-Wmissing-prototypes" ++#pragma GCC diagnostic error "-Wmissing-declarations" ++ + #include "progname.h" +-#include "argp.h" + + static const char *root = NULL; + grub_device_t dev = NULL; +@@ -511,6 +516,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + return 0; + } + grub_zfs_add_key (buf, real_size, 0); ++ fclose (f); + } + return 0; + +@@ -541,7 +547,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + } + + images = xrealloc (images, (num_disks + 1) * sizeof (images[0])); +- images[num_disks] = canonicalize_file_name (arg); ++ images[num_disks] = grub_canonicalize_file_name (arg); + num_disks++; + + return 0; +diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c +index f4abf70..0d4084a 100644 +--- a/util/grub-pe2elf.c ++++ b/util/grub-pe2elf.c +@@ -279,7 +279,7 @@ write_reloc_section (FILE* fp, const char *name, char *image, + break; + #endif + default: +- grub_util_error ("unknown pe relocation type %d\n", pe_rel->type); ++ grub_util_error ("unknown pe relocation type %d", pe_rel->type); + } + + if (type == +diff --git a/util/grub-probe.c b/util/grub-probe.c +index 1f3b59f..b1f5336 100644 +--- a/util/grub-probe.c ++++ b/util/grub-probe.c +@@ -130,13 +130,14 @@ get_targets_string (void) + } + + static void +-do_print (const char *x) ++do_print (const char *x, void *data) + { +- grub_printf ("%s ", x); ++ char delim = *(const char *) data; ++ grub_printf ("%s%c", x, delim); + } + + static void +-probe_partmap (grub_disk_t disk) ++probe_partmap (grub_disk_t disk, char delim) + { + grub_partition_t part; + grub_disk_memberlist_t list = NULL, tmp; +@@ -147,10 +148,10 @@ probe_partmap (grub_disk_t disk) + } + + for (part = disk->partition; part; part = part->parent) +- printf ("%s ", part->partmap->name); ++ printf ("%s%c", part->partmap->name, delim); + + if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) +- grub_diskfilter_get_partmap (disk, do_print); ++ grub_diskfilter_get_partmap (disk, do_print, &delim); + + /* In case of LVM/RAID, check the member devices as well. */ + if (disk->dev->memberlist) +@@ -159,7 +160,7 @@ probe_partmap (grub_disk_t disk) + } + while (list) + { +- probe_partmap (list->disk); ++ probe_partmap (list->disk, delim); + tmp = list->next; + free (list); + list = tmp; +@@ -167,7 +168,7 @@ probe_partmap (grub_disk_t disk) + } + + static void +-probe_cryptodisk_uuid (grub_disk_t disk) ++probe_cryptodisk_uuid (grub_disk_t disk, char delim) + { + grub_disk_memberlist_t list = NULL, tmp; + +@@ -178,7 +179,7 @@ probe_cryptodisk_uuid (grub_disk_t disk) + } + while (list) + { +- probe_cryptodisk_uuid (list->disk); ++ probe_cryptodisk_uuid (list->disk, delim); + tmp = list->next; + free (list); + list = tmp; +@@ -186,7 +187,7 @@ probe_cryptodisk_uuid (grub_disk_t disk) + if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) + { + const char *uu = grub_util_cryptodisk_get_uuid (disk); +- grub_printf ("%s ", uu); ++ grub_printf ("%s%c", uu, delim); + } + } + +@@ -210,7 +211,7 @@ probe_raid_level (grub_disk_t disk) + } + + static void +-probe_abstraction (grub_disk_t disk) ++probe_abstraction (grub_disk_t disk, char delim) + { + grub_disk_memberlist_t list = NULL, tmp; + int raid_level; +@@ -219,7 +220,7 @@ probe_abstraction (grub_disk_t disk) + list = disk->dev->memberlist (disk); + while (list) + { +- probe_abstraction (list->disk); ++ probe_abstraction (list->disk, delim); + + tmp = list->next; + free (list); +@@ -229,26 +230,26 @@ probe_abstraction (grub_disk_t disk) + if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID + && (grub_memcmp (disk->name, "lvm/", sizeof ("lvm/") - 1) == 0 || + grub_memcmp (disk->name, "lvmid/", sizeof ("lvmid/") - 1) == 0)) +- printf ("lvm "); ++ printf ("lvm%c", delim); + + if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID + && grub_memcmp (disk->name, "ldm/", sizeof ("ldm/") - 1) == 0) +- printf ("ldm "); ++ printf ("ldm%c", delim); + + if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) +- grub_util_cryptodisk_get_abstraction (disk, do_print); ++ grub_util_cryptodisk_get_abstraction (disk, do_print, &delim); + + raid_level = probe_raid_level (disk); + if (raid_level >= 0) + { +- printf ("diskfilter "); ++ printf ("diskfilter%c", delim); + if (disk->dev->raidname) +- printf ("%s ", disk->dev->raidname (disk)); ++ printf ("%s%c", disk->dev->raidname (disk), delim); + } + if (raid_level == 5) +- printf ("raid5rec "); ++ printf ("raid5rec%c", delim); + if (raid_level == 6) +- printf ("raid6rec "); ++ printf ("raid6rec%c", delim); + } + + static void +@@ -261,7 +262,7 @@ probe (const char *path, char **device_names, char delim) + + if (path != NULL) + { +- grub_path = canonicalize_file_name (path); ++ grub_path = grub_canonicalize_file_name (path); + if (! grub_path) + grub_util_error (_("failed to get canonical path of `%s'"), path); + device_names = grub_guess_root_devices (grub_path); +@@ -294,6 +295,7 @@ probe (const char *path, char **device_names, char delim) + } + printf ("%s", disk); + putchar (delim); ++ free (disk); + } + return; + } +@@ -427,7 +429,7 @@ probe (const char *path, char **device_names, char delim) + if (print == PRINT_HINT_STR) + { + const char *osdev = grub_util_biosdisk_get_osdev (dev->disk); +- const char *ofpath = osdev ? grub_util_devname_to_ofpath (osdev) : 0; ++ char *ofpath = osdev ? grub_util_devname_to_ofpath (osdev) : 0; + char *biosname, *bare, *efi; + const char *map; + +@@ -441,6 +443,7 @@ probe (const char *path, char **device_names, char delim) + grub_util_fprint_full_disk_name (stdout, tmp, dev); + printf ("' "); + free (tmp); ++ free (ofpath); + } + + biosname = grub_util_guess_bios_drive (*curdev); +@@ -483,22 +486,18 @@ probe (const char *path, char **device_names, char delim) + printf (" "); + else + printf ("\n"); +- +- grub_device_close (dev); +- continue; + } + +- if ((print == PRINT_COMPATIBILITY_HINT || print == PRINT_BIOS_HINT ++ else if ((print == PRINT_COMPATIBILITY_HINT || print == PRINT_BIOS_HINT + || print == PRINT_IEEE1275_HINT || print == PRINT_BAREMETAL_HINT + || print == PRINT_EFI_HINT || print == PRINT_ARC_HINT) + && dev->disk->dev->id != GRUB_DISK_DEVICE_HOSTDISK_ID) + { + grub_util_fprint_full_disk_name (stdout, dev->disk->name, dev); + putchar (delim); +- continue; + } + +- if (print == PRINT_COMPATIBILITY_HINT) ++ else if (print == PRINT_COMPATIBILITY_HINT) + { + const char *map; + char *biosname; +@@ -516,16 +515,14 @@ probe (const char *path, char **device_names, char delim) + { + grub_util_fprint_full_disk_name (stdout, biosname, dev); + putchar (delim); ++ free (biosname); ++ /* Compatibility hint is one device only. */ ++ grub_device_close (dev); ++ break; + } +- free (biosname); +- grub_device_close (dev); +- /* Compatibility hint is one device only. */ +- if (biosname) +- break; +- continue; + } + +- if (print == PRINT_BIOS_HINT) ++ else if (print == PRINT_BIOS_HINT) + { + char *biosname; + biosname = grub_util_guess_bios_drive (*curdev); +@@ -533,15 +530,13 @@ probe (const char *path, char **device_names, char delim) + { + grub_util_fprint_full_disk_name (stdout, biosname, dev); + putchar (delim); ++ free (biosname); + } +- free (biosname); +- grub_device_close (dev); +- continue; + } +- if (print == PRINT_IEEE1275_HINT) ++ else if (print == PRINT_IEEE1275_HINT) + { + const char *osdev = grub_util_biosdisk_get_osdev (dev->disk); +- const char *ofpath = grub_util_devname_to_ofpath (osdev); ++ char *ofpath = grub_util_devname_to_ofpath (osdev); + const char *map; + + map = grub_util_biosdisk_get_compatibility_hint (dev->disk); +@@ -559,13 +554,11 @@ probe (const char *path, char **device_names, char delim) + strcpy (p, ofpath); + grub_util_fprint_full_disk_name (stdout, tmp, dev); + free (tmp); ++ free (ofpath); + putchar (delim); + } +- +- grub_device_close (dev); +- continue; + } +- if (print == PRINT_EFI_HINT) ++ else if (print == PRINT_EFI_HINT) + { + char *biosname; + const char *map; +@@ -581,14 +574,11 @@ probe (const char *path, char **device_names, char delim) + { + grub_util_fprint_full_disk_name (stdout, biosname, dev); + putchar (delim); ++ free (biosname); + } +- +- free (biosname); +- grub_device_close (dev); +- continue; + } + +- if (print == PRINT_BAREMETAL_HINT) ++ else if (print == PRINT_BAREMETAL_HINT) + { + char *biosname; + const char *map; +@@ -605,14 +595,11 @@ probe (const char *path, char **device_names, char delim) + { + grub_util_fprint_full_disk_name (stdout, biosname, dev); + putchar (delim); ++ free (biosname); + } +- +- free (biosname); +- grub_device_close (dev); +- continue; + } + +- if (print == PRINT_ARC_HINT) ++ else if (print == PRINT_ARC_HINT) + { + const char *map; + +@@ -622,49 +609,28 @@ probe (const char *path, char **device_names, char delim) + grub_util_fprint_full_disk_name (stdout, map, dev); + putchar (delim); + } +- +- /* FIXME */ +- grub_device_close (dev); +- continue; + } + +- if (print == PRINT_ABSTRACTION) +- { +- probe_abstraction (dev->disk); +- putchar (delim); +- grub_device_close (dev); +- continue; +- } ++ else if (print == PRINT_ABSTRACTION) ++ probe_abstraction (dev->disk, delim); + +- if (print == PRINT_CRYPTODISK_UUID) +- { +- probe_cryptodisk_uuid (dev->disk); +- putchar (delim); +- grub_device_close (dev); +- continue; +- } ++ else if (print == PRINT_CRYPTODISK_UUID) ++ probe_cryptodisk_uuid (dev->disk, delim); + +- if (print == PRINT_PARTMAP) +- { +- /* Check if dev->disk itself is contained in a partmap. */ +- probe_partmap (dev->disk); +- putchar (delim); +- grub_device_close (dev); +- continue; +- } ++ else if (print == PRINT_PARTMAP) ++ /* Check if dev->disk itself is contained in a partmap. */ ++ probe_partmap (dev->disk, delim); + +- if (print == PRINT_MSDOS_PARTTYPE) ++ else if (print == PRINT_MSDOS_PARTTYPE) + { + if (dev->disk->partition + && strcmp(dev->disk->partition->partmap->name, "msdos") == 0) + printf ("%02x", dev->disk->partition->msdostype); + + putchar (delim); +- grub_device_close (dev); +- continue; + } + +- if (print == PRINT_GPT_PARTTYPE) ++ else if (print == PRINT_GPT_PARTTYPE) + { + if (dev->disk->partition + && strcmp (dev->disk->partition->partmap->name, "gpt") == 0) +@@ -693,9 +659,9 @@ probe (const char *path, char **device_names, char delim) + dev->disk->partition = p; + } + putchar (delim); +- grub_device_close (dev); +- continue; + } ++ ++ grub_device_close (dev); + } + + end: +@@ -711,6 +677,7 @@ static struct argp_option options[] = { + N_("use FILE as the device map [default=%s]"), 0}, + {"target", 't', N_("TARGET"), 0, 0, 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, ++ {0, '0', 0, 0, N_("separate items in output using ASCII NUL characters"), 0}, + { 0, 0, 0, 0, 0, 0 } + }; + +@@ -726,11 +693,14 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused))) + + case 't': + { +- char *ret, *t = get_targets_string (); ++ char *ret, *t = get_targets_string (), *def; ++ ++ def = xasprintf (_("[default=%s]"), targets[print]); + +- ret = xasprintf ("%s\n%s %s [default=%s]", _("print TARGET"), +- _("available targets:"), t, targets[print]); ++ ret = xasprintf ("%s\n%s %s %s", _("print TARGET"), ++ _("available targets:"), t, def); + free (t); ++ free (def); + return ret; + } + +@@ -884,11 +854,7 @@ main (int argc, char *argv[]) + else + probe (arguments.devices[0], NULL, delim); + +- if (!arguments.zero_delim && (print == PRINT_BIOS_HINT +- || print == PRINT_IEEE1275_HINT +- || print == PRINT_BAREMETAL_HINT +- || print == PRINT_EFI_HINT +- || print == PRINT_ARC_HINT)) ++ if (delim == ' ') + putchar ('\n'); + + /* Free resources. */ +diff --git a/util/grub-syslinux2cfg.c b/util/grub-syslinux2cfg.c +index 5e944c2..85fa0da 100644 +--- a/util/grub-syslinux2cfg.c ++++ b/util/grub-syslinux2cfg.c +@@ -66,10 +66,10 @@ static struct argp_option options[] = { + N_("root directory of the syslinux disk [default=/]."), 0}, + {"target-cwd", 'T', N_("DIR"), 0, + N_( +- "current directory of the syslinux as it will be seen on runtime [default is parent directory of input file]." ++ "current directory of syslinux as it will be seen on runtime [default is parent directory of input file]." + ), 0}, + {"cwd", 'c', N_("DIR"), 0, +- N_("current directory of the syslinux [default is parent directory of input file]."), 0}, ++ N_("current directory of syslinux [default is parent directory of input file]."), 0}, + + {"output", 'o', N_("FILE"), 0, N_("write output to FILE [default=stdout]."), 0}, + {"isolinux", 'i', 0, 0, N_("assume input is an isolinux configuration file."), 0}, +@@ -175,7 +175,7 @@ main (int argc, char *argv[]) + grub_host_init (); + + char *t, *inpfull, *rootfull, *res; +- t = canonicalize_file_name (arguments.input); ++ t = grub_canonicalize_file_name (arguments.input); + if (!t) + { + grub_util_error (_("cannot open `%s': %s"), arguments.input, +@@ -185,7 +185,7 @@ main (int argc, char *argv[]) + inpfull = xasprintf ("(host)/%s", t); + free (t); + +- t = canonicalize_file_name (arguments.root ? : "/"); ++ t = grub_canonicalize_file_name (arguments.root ? : "/"); + if (!t) + { + grub_util_error (_("cannot open `%s': %s"), arguments.root, +@@ -206,7 +206,7 @@ main (int argc, char *argv[]) + cwd = xstrdup ("."); + } + +- t = canonicalize_file_name (arguments.cwd ? : cwd); ++ t = grub_canonicalize_file_name (arguments.cwd ? : cwd); + if (!t) + { + grub_util_error (_("cannot open `%s': %s"), arguments.root, +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 0c82f23..93a9023 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -25,7 +25,7 @@ grub_lang=`echo $LANG | cut -d . -f 1` + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + # Do this as early as possible, since other commands might depend on it. + # (e.g. the `loadfont' command might need lvm or raid modules) +@@ -285,7 +285,7 @@ make_timeout () + if [ "x${3}" != "x" ] ; then + timeout="${2}" + style="${3}" +- elif [ "x${1}" != "x" -a "x${1}" != "x0" ] ; then ++ elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then + # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme. + timeout="${1}" + if [ "x${2}" != "x0" ] ; then +diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in +index 82dfe19..59a9a48 100644 +--- a/util/grub.d/10_hurd.in ++++ b/util/grub.d/10_hurd.in +@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + CLASS="--class gnu --class os" + +@@ -168,7 +168,7 @@ while [ "x$kernels" != "x" ] ; do + hurd_entry "$kernel" advanced + hurd_entry "$kernel" recovery + +- kernels=`echo $kernels | tr ' ' '\n' | grep -vx $kernel | tr '\n' ' '` ++ kernels=`echo $kernels | tr ' ' '\n' | fgrep -vx "$kernel" | tr '\n' ' '` + done + + # If at least one kernel was found, then we need to +diff --git a/util/grub.d/10_illumos.in b/util/grub.d/10_illumos.in +index 0de616e..a133e1b 100644 +--- a/util/grub.d/10_illumos.in ++++ b/util/grub.d/10_illumos.in +@@ -20,7 +20,7 @@ set -e + prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in +index a524762..9d8e8fd 100644 +--- a/util/grub.d/10_kfreebsd.in ++++ b/util/grub.d/10_kfreebsd.in +@@ -20,7 +20,7 @@ set -e + prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +@@ -143,9 +143,12 @@ EOF + EOF + } + +-list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do +- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi +- done` ++list= ++for i in /boot/kfreebsd-* /boot/kernel/kernel ; do ++ if grub_file_is_not_garbage "$i" ; then ++ list="$list $i" ++ fi ++done + prepare_boot_cache= + boot_device_id= + title_correction_code= +@@ -228,7 +231,7 @@ while [ "x$list" != "x" ] ; do + kfreebsd_entry "${OS}" "${version}" recovery "-s" + fi + +- list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '` ++ list=`echo $list | tr ' ' '\n' | fgrep -vx "$kfreebsd" | tr '\n' ' '` + done + + # If at least one kernel was found, then we need to +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 00d1931..859b608 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -21,7 +21,7 @@ prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +@@ -147,13 +147,15 @@ EOF + machine=`uname -m` + 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` ;; ++ 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 ;; + esac + + case "$machine" in +@@ -241,7 +243,7 @@ while [ "x$list" != "x" ] ; do + "single ${GRUB_CMDLINE_LINUX}" + fi + +- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` ++ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` + done + + # If at least one kernel was found, then we need to +diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in +index 29a0e41..874f599 100644 +--- a/util/grub.d/10_netbsd.in ++++ b/util/grub.d/10_netbsd.in +@@ -20,7 +20,7 @@ set -e + prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +@@ -69,7 +69,7 @@ netbsd_load_fs_module () + kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }') + kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod" + +- if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then ++ if test -z "$karch" || test -z "$kversion" || test ! -f "${kmodule}"; then + return + fi + +diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in +index 9025914..554c561 100644 +--- a/util/grub.d/10_windows.in ++++ b/util/grub.d/10_windows.in +@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + case "`uname 2>/dev/null`" in + CYGWIN*) ;; +@@ -66,11 +66,11 @@ for drv in $drives ; do + osid= + + # Check for Vista bootmgr. +- if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then ++ if [ -f "$dir"/bootmgr ] && [ -f "$dir"/boot/bcd ] ; then + OS="$(gettext "Windows Vista/7 (loader)")" + osid=bootmgr + # Check for NTLDR. +- elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then ++ elif [ -f "$dir"/ntldr ] && [ -f "$dir"/ntdetect.com ] && [ -f "$dir"/boot.ini ] ; then + OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext "Windows NT/2000/XP (loader)")" + osid=ntldr + needmap=t +diff --git a/util/grub.d/10_xnu.in b/util/grub.d/10_xnu.in +index 4270385..51ee2f4 100644 +--- a/util/grub.d/10_xnu.in ++++ b/util/grub.d/10_xnu.in +@@ -24,7 +24,7 @@ datarootdir="@datarootdir@" + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + osx_entry() { + if [ x$2 = x32 ]; then +diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in +index a608435..f532fb9 100644 +--- a/util/grub.d/20_linux_xen.in ++++ b/util/grub.d/20_linux_xen.in +@@ -21,7 +21,7 @@ prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +@@ -137,7 +137,8 @@ EOF + EOF + } + +-linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do ++linux_list= ++for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do + if grub_file_is_not_garbage "$i"; then + basename=$(basename $i) + version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") +@@ -149,9 +150,9 @@ linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do + break + fi + done +- if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi ++ if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi + fi +- done` ++done + if [ "x${linux_list}" = "x" ] ; then + exit 0 + fi +@@ -165,9 +166,10 @@ file_is_not_sym () { + esac + } + +-xen_list=`for i in /boot/xen*; do +- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi +- done` ++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 + prepare_boot_cache= + boot_device_id= + +@@ -255,12 +257,12 @@ while [ "x${xen_list}" != "x" ] ; do + "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" + fi + +- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` ++ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` + done + 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/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index 0470e66..5fc4f0c 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -24,13 +24,13 @@ datarootdir="@datarootdir@" + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +-. "@datadir@/@PACKAGE@/grub-mkconfig_lib" ++. "$pkgdatadir/grub-mkconfig_lib" + + if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then + exit 0 + fi + +-if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then ++if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then + # missing os-prober and/or linux-boot-prober + exit 0 + fi +@@ -112,16 +112,17 @@ for OS in ${OSPROBED} ; do + LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" + LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" + BOOT="`echo ${OS} | cut -d ':' -f 4`" +- UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`" +- EXPUUID="$UUID" ++ if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then ++ EXPUUID="$UUID" + +- if [ x"${DEVICE#*@}" != x ] ; then ++ if [ x"${DEVICE#*@}" != x ] ; then + EXPUUID="${EXPUUID}@${DEVICE#*@}" +- fi ++ fi + +- if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then +- echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 +- continue ++ if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then ++ echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 ++ continue ++ fi + fi + + BTRFS="`echo ${OS} | cut -d ':' -f 5`" +@@ -277,9 +278,11 @@ EOF + echo "$title_correction_code" + ;; + macosx) +- OSXUUID="${UUID}" +- osx_entry xnu_kernel 32 +- osx_entry xnu_kernel64 64 ++ if [ "${UUID}" ]; then ++ OSXUUID="${UUID}" ++ osx_entry xnu_kernel 32 ++ osx_entry xnu_kernel64 64 ++ fi + ;; + hurd) + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" +@@ -319,9 +322,8 @@ EOF + EOF + ;; + *) +- echo -n " " + # TRANSLATORS: %s is replaced by OS name. +- gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2 ++ gettext_printf "%s is not yet supported by grub-mkconfig.\n" " ${LONGNAME}" >&2 + ;; + esac + done +diff --git a/util/import_gcry.py b/util/import_gcry.py +index 63ebb90..2b3322d 100644 +--- a/util/import_gcry.py ++++ b/util/import_gcry.py +@@ -534,6 +534,12 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))): + fw.close () + continue + ++ if src == "g10lib.h": ++ fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)")) ++ f.close () ++ fw.close () ++ continue ++ + fw.write (f.read ()) + f.close () + fw.close () +diff --git a/util/misc.c b/util/misc.c +index b0e023e..b8ec691 100644 +--- a/util/misc.c ++++ b/util/misc.c +@@ -89,6 +89,8 @@ grub_util_get_image_size (const char *path) + fseeko (f, 0, SEEK_END); + + sz = ftello (f); ++ if (sz < 0) ++ grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); + if (sz != (size_t) sz) + grub_util_error (_("file `%s' is too big"), path); + ret = (size_t) sz; +diff --git a/util/mkimage.c b/util/mkimage.c +index 26d9816..35df998 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -55,6 +55,9 @@ + + #define TARGET_NO_FIELD 0xffffffff + ++/* use 2015-01-01T00:00:00+0000 as a stock timestamp */ ++#define STABLE_EMBEDDING_TIMESTAMP 1420070400 ++ + struct grub_install_image_target_desc + { + const char *dirname; +@@ -820,7 +823,7 @@ compress_kernel (const struct grub_install_image_target_desc *image_target, char + + if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS + && (comp != GRUB_COMPRESSION_NONE)) +- grub_util_error (_("unknown compression %d\n"), comp); ++ grub_util_error (_("unknown compression %d"), comp); + + *core_img = xmalloc (kernel_size); + memcpy (*core_img, kernel_img, kernel_size); +@@ -937,8 +940,8 @@ grub_install_get_image_target (const char *arg) + { + unsigned i, j; + for (i = 0; i < ARRAY_SIZE (image_targets); i++) +- for (j = 0; image_targets[i].names[j] +- && j < ARRAY_SIZE (image_targets[i].names); j++) ++ for (j = 0; j < ARRAY_SIZE (image_targets[i].names) && ++ image_targets[i].names[j]; j++) + if (strcmp (arg, image_targets[i].names[j]) == 0) + return &image_targets[i]; + return NULL; +@@ -1231,7 +1234,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + name = "none_decompress.img"; + break; + default: +- grub_util_error (_("unknown compression %d\n"), comp); ++ grub_util_error (_("unknown compression %d"), comp); + } + + decompress_path = grub_util_get_path (dir, name); +@@ -1278,6 +1281,8 @@ grub_install_generate_image (const char *dir, const char *prefix, + free (core_img); + core_img = full_img; + core_size = full_size; ++ free (decompress_img); ++ free (decompress_path); + } + + switch (image_target->id) +@@ -1437,7 +1442,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + c->machine = grub_host_to_target16 (image_target->pe_target); + + c->num_sections = grub_host_to_target16 (4); +- c->time = grub_host_to_target32 (time (0)); ++ c->time = grub_host_to_target32 (STABLE_EMBEDDING_TIMESTAMP); + c->characteristics = grub_host_to_target16 (GRUB_PE32_EXECUTABLE_IMAGE + | GRUB_PE32_LINE_NUMS_STRIPPED + | ((image_target->voidp_sizeof == 4) +@@ -1528,9 +1533,10 @@ grub_install_generate_image (const char *dir, const char *prefix, + text_section->virtual_address = grub_cpu_to_le32 (header_size); + text_section->raw_data_size = grub_cpu_to_le32 (exec_size); + text_section->raw_data_offset = grub_cpu_to_le32 (header_size); +- text_section->characteristics = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_CODE +- | GRUB_PE32_SCN_MEM_EXECUTE +- | GRUB_PE32_SCN_MEM_READ); ++ text_section->characteristics = grub_cpu_to_le32_compile_time ( ++ GRUB_PE32_SCN_CNT_CODE ++ | GRUB_PE32_SCN_MEM_EXECUTE ++ | GRUB_PE32_SCN_MEM_READ); + + data_section = text_section + 1; + strcpy (data_section->name, ".data"); +@@ -1539,7 +1545,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + data_section->raw_data_size = grub_cpu_to_le32 (kernel_size - exec_size); + data_section->raw_data_offset = grub_cpu_to_le32 (header_size + exec_size); + data_section->characteristics +- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA ++ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_READ + | GRUB_PE32_SCN_MEM_WRITE); + +@@ -1551,7 +1557,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + bss_section->raw_data_size = 0; + bss_section->raw_data_offset = 0; + bss_section->characteristics +- = grub_cpu_to_le32 (GRUB_PE32_SCN_MEM_READ ++ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_MEM_READ + | GRUB_PE32_SCN_MEM_WRITE + | GRUB_PE32_SCN_ALIGN_64BYTES + | GRUB_PE32_SCN_CNT_INITIALIZED_DATA +@@ -1565,7 +1571,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + mods_section->raw_data_size = grub_cpu_to_le32 (reloc_addr - kernel_size - header_size); + mods_section->raw_data_offset = grub_cpu_to_le32 (header_size + kernel_size); + mods_section->characteristics +- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA ++ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_READ + | GRUB_PE32_SCN_MEM_WRITE); + +@@ -1576,7 +1582,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + reloc_section->raw_data_size = grub_cpu_to_le32 (reloc_size); + reloc_section->raw_data_offset = grub_cpu_to_le32 (reloc_addr); + reloc_section->characteristics +- = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA ++ = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA + | GRUB_PE32_SCN_MEM_DISCARDABLE + | GRUB_PE32_SCN_MEM_READ); + free (core_img); +@@ -1743,6 +1749,8 @@ grub_install_generate_image (const char *dir, const char *prefix, + free (core_img); + core_img = rom_img; + core_size = rom_size; ++ free (boot_img); ++ free (boot_path); + } + break; + case IMAGE_QEMU_MIPS_FLASH: +@@ -1777,7 +1785,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + + memset (hdr, 0, sizeof (*hdr)); + hdr->ih_magic = grub_cpu_to_be32_compile_time (GRUB_UBOOT_IH_MAGIC); +- hdr->ih_time = grub_cpu_to_be32 (time (0)); ++ hdr->ih_time = grub_cpu_to_be32 (STABLE_EMBEDDING_TIMESTAMP); + hdr->ih_size = grub_cpu_to_be32 (core_size); + hdr->ih_load = grub_cpu_to_be32 (image_target->link_addr); + hdr->ih_ep = grub_cpu_to_be32 (image_target->link_addr); +diff --git a/util/probe.c b/util/probe.c +index c389f5d..fa7ca34 100644 +--- a/util/probe.c ++++ b/util/probe.c +@@ -73,7 +73,7 @@ grub_util_guess_bios_drive (const char *orig_path) + { + char *canon; + char *ptr; +- canon = canonicalize_file_name (orig_path); ++ canon = grub_canonicalize_file_name (orig_path); + if (!canon) + return NULL; + ptr = strrchr (orig_path, '/'); +@@ -102,7 +102,7 @@ grub_util_guess_efi_drive (const char *orig_path) + { + char *canon; + char *ptr; +- canon = canonicalize_file_name (orig_path); ++ canon = grub_canonicalize_file_name (orig_path); + if (!canon) + return NULL; + ptr = strrchr (orig_path, '/'); +@@ -131,7 +131,7 @@ grub_util_guess_baremetal_drive (const char *orig_path) + { + char *canon; + char *ptr; +- canon = canonicalize_file_name (orig_path); ++ canon = grub_canonicalize_file_name (orig_path); + if (!canon) + return NULL; + ptr = strrchr (orig_path, '/'); +diff --git a/util/render-label.c b/util/render-label.c +index 39663a8..91c080c 100644 +--- a/util/render-label.c ++++ b/util/render-label.c +@@ -157,7 +157,7 @@ grub_util_render_label (const char *label_font, + ieee1275_palette[cptr].a = 0xff; + + char * t; +- t = canonicalize_file_name (label_font); ++ t = grub_canonicalize_file_name (label_font); + if (!t) + { + grub_util_error (_("cannot open `%s': %s"), label_font, +diff --git a/util/setup.c b/util/setup.c +index 9fb91a8..8f20e99 100644 +--- a/util/setup.c ++++ b/util/setup.c +@@ -322,7 +322,10 @@ SETUP (const char *dir, + continue; + try_dev = grub_device_open (drive); + if (! try_dev) +- continue; ++ { ++ free (drive); ++ continue; ++ } + if (!found && try_dev->disk->id == dest_dev->disk->id + && try_dev->disk->dev->id == dest_dev->disk->dev->id) + { +@@ -526,7 +529,7 @@ SETUP (const char *dir, + bl.block = bl.first_block; + while (bl.block->len) + { +- grub_memset (bl.block, 0, sizeof (bl.block)); ++ grub_memset (bl.block, 0, sizeof (*bl.block)); + + bl.block--; + +@@ -667,15 +670,17 @@ unable_to_embed: + if (dest_dev->disk->id != root_dev->disk->id + || dest_dev->disk->dev->id != root_dev->disk->dev->id) + { +- const char *dest_ofpath; ++ char *dest_ofpath; + dest_ofpath + = grub_util_devname_to_ofpath (grub_util_biosdisk_get_osdev (root_dev->disk)); ++ /* FIXME handle NULL result */ + grub_util_info ("dest_ofpath is `%s'", dest_ofpath); + strncpy (boot_devpath, dest_ofpath, + GRUB_BOOT_MACHINE_BOOT_DEVPATH_END + - GRUB_BOOT_MACHINE_BOOT_DEVPATH - 1); + boot_devpath[GRUB_BOOT_MACHINE_BOOT_DEVPATH_END + - GRUB_BOOT_MACHINE_BOOT_DEVPATH - 1] = 0; ++ free (dest_ofpath); + } + else + { diff --git a/grub2.spec b/grub2.spec index 9c298c6..03b572e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -58,512 +58,97 @@ Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz Source5: theme.tar.bz2 Source6: gitignore -Patch0001: 0001-fix-EFI-detection-on-Windows.patch -Patch0002: 0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch -Patch0003: 0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch -Patch0004: 0004-NEWS-First-draft-of-2.02-entry.patch -Patch0005: 0005-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch -Patch0006: 0006-remove-unused-error.h-from-kern-emu-misc.c.patch -Patch0007: 0007-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch -Patch0008: 0008-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch -Patch0009: 0009-strip-.eh_frame-section-from-arm64-efi-kernel.patch -Patch0010: 0010-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch -Patch0011: 0011-fix-32-bit-compilation-on-MinGW-w64.patch -Patch0012: 0012-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch -Patch0013: 0013-arm64-set-correct-length-of-device-path-end-entry.patch -Patch0014: 0014-Makefile.util.def-grub-macbless-Change-mansection-to.patch -Patch0015: 0015-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch -Patch0016: 0016-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch -Patch0017: 0017-Prefer-more-portable-test-1-constructs.patch -Patch0018: 0018-NEWS-Add-few-missing-entries.patch -Patch0019: 0019-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch -Patch0020: 0020-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch -Patch0021: 0021-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch -Patch0022: 0022-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch -Patch0023: 0023-Fix-ChangeLog-date.patch -Patch0024: 0024-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch -Patch0025: 0025-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch -Patch0026: 0026-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch -Patch0027: 0027-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch -Patch0028: 0028-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch -Patch0029: 0029-Makefile.am-default_payload.elf-Add-modules.patch -Patch0030: 0030-fix-removal-of-cpu-machine-links-on-mingw-msys.patch -Patch0031: 0031-grub-core-normal-main.c-read_config_file-Buffer-conf.patch -Patch0032: 0032-util-grub-install.c-Fix-a-typo.patch -Patch0033: 0033-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch -Patch0034: 0034-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch -Patch0035: 0035-change-stop-condition-to-avoid-infinite-loops.patch -Patch0036: 0036-increase-network-try-interval-gradually.patch -Patch0037: 0037-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch -Patch0038: 0038-Show-detected-path-to-DejaVuSans-in-configure-summar.patch -Patch0039: 0039-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch -Patch0040: 0040-util-grub-install.c-write_to_disk-Add-an-info-messag.patch -Patch0041: 0041-util-grub-install.c-List-available-targets.patch -Patch0042: 0042-Fix-several-translatable-strings.patch -Patch0043: 0043-do-not-set-default-prefix-in-grub-mkimage.patch -Patch0044: 0044-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch -Patch0045: 0045-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch -Patch0046: 0046-grub-install-support-for-partitioned-partx-loop-devi.patch -Patch0047: 0047-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch -Patch0048: 0048-.gitignore-add-missing-files-and-.exe-variants.patch -Patch0049: 0049-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch -Patch0050: 0050-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch -Patch0051: 0051-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch -Patch0052: 0052-grub-core-disk-ahci.c-Add-safety-cleanups.patch -Patch0053: 0053-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch -Patch0054: 0054-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch -Patch0055: 0055-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch -Patch0056: 0056-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch -Patch0057: 0057-add-grub_env_set_net_property-function.patch -Patch0058: 0058-add-bootpath-parser-for-open-firmware.patch -Patch0059: 0059-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch -Patch0060: 0060-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch -Patch0061: 0061-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch -Patch0062: 0062-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch -Patch0063: 0063-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch -Patch0064: 0064-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch -Patch0065: 0065-ieee1275-check-for-IBM-pseries-emulated-machine.patch -Patch0066: 0066-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch -Patch0067: 0067-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch -Patch0068: 0068-Fix-grub-probe-0-option.patch -Patch0069: 0069-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch -Patch0070: 0070-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch -Patch0071: 0071-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch -Patch0072: 0072-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch -Patch0073: 0073-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch -Patch0074: 0074-Add-missing-endif.patch -Patch0075: 0075-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch -Patch0076: 0076-Improve-LVM-logical_volumes-string-matching.patch -Patch0077: 0077-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch -Patch0078: 0078-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch -Patch0079: 0079-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch -Patch0080: 0080-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch -Patch0081: 0081-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch -Patch0082: 0082-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch -Patch0083: 0083-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch -Patch0084: 0084-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch -Patch0085: 0085-util-grub-install.c-Fix-handling-of-disk-module.patch -Patch0086: 0086-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch -Patch0087: 0087-docs-grub-dev.texi-Finding-your-way-around-The-build.patch -Patch0088: 0088-Fix-an-infinite-loop-in-grub-mkconfig.patch -Patch0089: 0089-grub-core-fs-cbfs.c-Don-t-probe-disks-of-unknow-size.patch -Patch0090: 0090-Fix-Changelog.patch -Patch0091: 0091-grub-core-disk-i386-pc-biosdisk.c-grub_biosdisk_rw-A.patch -Patch0092: 0092-grub-core-kern-disk_common.c-Clump-disk-size-to-1EiB.patch -Patch0093: 0093-grub-core-term-at_keyboard.c-Retry-probing-keyboard-.patch -Patch0094: 0094-Fix-typo-gettext_print-instead-of-gettext_printf.patch -Patch0095: 0095-grub-core-kern-mips-arc-init.c-grub_machine_get_boot.patch -Patch0096: 0096-configure.ac-Remove-several-unnecessary-semicolons.patch -Patch0097: 0097-Support-grub-emu-on-x32-ILP32-but-with-x86-64-instru.patch -Patch0098: 0098-Fix-incorrect-address-reference-in-btrfs.patch -Patch0099: 0099-Fix-build-with-glibc-2.20.patch -Patch0100: 0100-Tidy-up-ChangeLog-formatting.patch -Patch0101: 0101-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch -Patch0102: 0102-grub-core-osdep-unix-config.c-Remove-extraneous-comm.patch -Patch0103: 0103-Fix-wrong-commit.patch -Patch0104: 0104-grub-core-gmodule.pl.in-Accept-newer-binutils-which-.patch -Patch0105: 0105-grub-core-commands-keylayouts.c-Ignore-unknown-keys.patch -Patch0106: 0106-grub-core-normal-main.c-Don-t-drop-to-rescue-console.patch -Patch0107: 0107-ACPIhalt-Add-more-ACPI-opcodes.patch -Patch0108: 0108-Revert-Use-Wl-no-relax-rather-than-mno-relax-for-uni.patch -Patch0109: 0109-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch -Patch0110: 0110-Add-a-new-none-platform-that-only-builds-utilities.patch -Patch0111: 0111-Fix-in-tree-platform-none.patch -Patch0112: 0112-Use-full-initializer-for-initrd_ctx-to-avoid-fatal-w.patch -Patch0113: 0113-icmp6-fix-no-respond-to-neighbor-solicit-message.patch -Patch0114: 0114-efi-check-path-non-null-before-grub_strrchr.patch -Patch0115: 0115-Fix-date-in-last-ChangeLog-entry.patch -Patch0116: 0116-grub-fs-tester-consistently-print-output-of-grub-ls-.patch -Patch0117: 0117-send-router-solicitation-for-ipv6-address-autoconf-v.patch -Patch0118: 0118-grub-mkstandalone-out-of-bound-access-to-tar-header-.patch -Patch0119: 0119-grub-install-common-avoid-out-of-bound-access-when-r.patch -Patch0120: 0120-grub-core-disk-luks.c-fix-use-after-free-and-memory-.patch -Patch0121: 0121-Use-ssize_t-for-grub_util_fd_read-result.patch -Patch0122: 0122-grub-core-disk-geli.c-fix-memory-leaks-in-error-path.patch -Patch0123: 0123-Fix-ChangeLog.patch -Patch0124: 0124-grub-core-disk-lzopio.c-fix-double-free-in-error-pat.patch -Patch0125: 0125-grub-core-lib-syslinux_parse.c-do-not-free-array.patch -Patch0126: 0126-grub-core-fs-zfs-zfsinfo.c-memory-leak-in-print_vdev.patch -Patch0127: 0127-grub-core-loader-i386-xen_fileXX.c-memory-leak-in-gr.patch -Patch0128: 0128-grub-shell-support-files-also-for-net-boot.patch -Patch0129: 0129-add-file-filters-tests.patch -Patch0130: 0130-fix-memory-corruption-in-pubkey-filter-over-network.patch -Patch0131: 0131-fix-double-free-in-grub_net_recv_tcp_packet.patch -Patch0132: 0132-Avoid-use-of-non-portable-echo-n-in-grub-mkconfig.patch -Patch0133: 0133-grub-core-fs-ext2.c-grub_ext2_read_block-Support-lar.patch -Patch0134: 0134-grub-core-kern-arm-misc.S-fix-unaligned-grub_uint64_.patch -Patch0135: 0135-Fix-serial-rtscts-option-processing.patch -Patch0136: 0136-Support-GELI-v6-and-v7.patch -Patch0137: 0137-Replace-explicit-sizeof-divisions-by-ARRAY_SIZE.patch -Patch0138: 0138-grub_script_lexer_yywrap-Update-len-synchronously-wi.patch -Patch0139: 0139-grub_fshelp_read_file-Don-t-attempt-to-read-past-the.patch -Patch0140: 0140-grub-core-fs-minix.c-grub_minix_read_file-Avoid-read.patch -Patch0141: 0141-grub_cmd_play-Avoid-division-by-zero.patch -Patch0142: 0142-grub-core-disk-AFSplitter.c-AF_merge-Check-that-mdle.patch -Patch0143: 0143-grub_ata_setaddress-Check-that-geometry-is-sane-when.patch -Patch0144: 0144-Reject-NILFS2-superblocks-with-over-1GiB-blocks.patch -Patch0145: 0145-grub_ufs_mount-Check-that-sblock.ino_per_group-is-no.patch -Patch0146: 0146-grub-core-fs-ext2.c-grub_ext2_mount-Additional-check.patch -Patch0147: 0147-grub-core-fs-minix.c-Additional-filesystem-sanity-ch.patch -Patch0148: 0148-grub-core-fs-hfs.c-grub_hfs_mount-Additional-filesys.patch -Patch0149: 0149-grub_dmraid_nv_detect-Do-not-divide-by-zero.patch -Patch0150: 0150-grub-core-disk-ieee1275-nand.c-grub_nand_open-Check-.patch -Patch0151: 0151-grub-core-disk-i386-pc-biosdisk.c-Check-disk-size-sa.patch -Patch0152: 0152-osdep-linux-blocklist.c-grub_install_get_blocklist-C.patch -Patch0153: 0153-grub-core-lib-pbkdf2.c-grub_crypto_pbkdf2-Check-that.patch -Patch0154: 0154-grub-core-fs-btrfs.c-Avoid-divisions-by-zero.patch -Patch0155: 0155-grub-core-fs-zfs.c-Avoid-divisions-by-zero.patch -Patch0156: 0156-term.h-Avoid-returining-0-sized-terminal-as-it-may-l.patch -Patch0157: 0157-grub-core-disk-diskfilter.c-Validate-volumes-to-avoi.patch -Patch0158: 0158-grub-core-video-readers-jpeg.c-Avoid-division-by-zer.patch -Patch0159: 0159-Avoid-division-by-zero-in-serial.patch -Patch0160: 0160-grub-core-term-gfxterm.c-Avoid-division-by-zero.patch -Patch0161: 0161-include-grub-misc.h-grub_div_roundup-Remove-as-it-s-.patch -Patch0162: 0162-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch -Patch0163: 0163-grub-core-loader-i386-xnu.c-guessfsb-Avoid-division-.patch -Patch0164: 0164-rtc_get_time_ms.c-grub_rtc_get_time_ms-Avoid-divisio.patch -Patch0165: 0165-haiku-getroot.c-grub_util_find_partition_start_os-Av.patch -Patch0166: 0166-grub-core-kern-efi-mm.c-grub_efi_get_memory_map-Neve.patch -Patch0167: 0167-unix-cputime.c-Cache-sc_clk_tck-and-check-it-for-san.patch -Patch0168: 0168-grub_menu_init_page-Avoid-returning-0-geometry-to-av.patch -Patch0169: 0169-Remove-potential-division-by-0-in-gfxmenu.patch -Patch0170: 0170-Remove-direct-_llseek-code-and-require-long-filesyst.patch -Patch0171: 0171-accept-also-hdX-as-alias-to-native-Xen-disk-name.patch -Patch0172: 0172-Mention-platform-none-in-NEWS.patch -Patch0173: 0173-tests-file_filter-file-Really-add-missing-file.patch -Patch0174: 0174-Autogenerate-ChangeLog-from-git-changelog.patch -Patch0175: 0175-conf-Makefile.common-Remove-unused-LD-C-FLAGS_CPU.patch -Patch0176: 0176-util-grub-mkrescue.c-Always-include-part_msdos-and-p.patch -Patch0177: 0177-efidisk-Return-the-determined-root-disk-even-if-part.patch -Patch0178: 0178-Makefile.am-Fix-Changelog-cutoff-address.patch -Patch0179: 0179-Generate-empty-ChangeLog-if-no-.git-is-available.patch -Patch0180: 0180-Always-add-msoft-float-to-avoid-compiler-generating-.patch -Patch0181: 0181-uhci-Fix-null-pointer-dereference.patch -Patch0182: 0182-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch -Patch0183: 0183-commands-file-Change-the-confusing-loop-stop-conditi.patch -Patch0184: 0184-commands-fileXX-Fix-memory-leak.patch -Patch0185: 0185-gptsync-Add-missing-device_close.patch -Patch0186: 0186-commands-hdparm-Add-missing-grub_disk_close.patch -Patch0187: 0187-zfs-Fix-disk-matching-logic.patch -Patch0188: 0188-commands-legacycfg-Fix-resource-leaks.patch -Patch0189: 0189-commands-macbless-Remove-incorrect-grub_free.patch -Patch0190: 0190-commands-macbless-Fix-potential-overflow.patch -Patch0191: 0191-commands-macbless-Handle-device-opening-errors-corre.patch -Patch0192: 0192-commands-nativedisk-Add-missing-device_close.patch -Patch0193: 0193-commands-parttool-Add-missing-device-close.patch -Patch0194: 0194-commands-syslinux-Add-missing-free.patch -Patch0195: 0195-commands-tr-Simplify-and-fix-missing-parameter-test.patch -Patch0196: 0196-commands-verify-Fix-sha1-context-zeroing-out.patch -Patch0197: 0197-commands-wildcard-Add-missing-free.patch -Patch0198: 0198-disk-AFsplitter-check-argument-validity-before-doing.patch -Patch0199: 0199-disk-ahci-Fix-device_map_range-argument.patch -Patch0200: 0200-disk-cryptodisk-Add-missing-error-check.patch -Patch0201: 0201-disk-diskfilter-Add-missing-lv-presence-check.patch -Patch0202: 0202-disk-geli-Add-missing-seek-success-check.patch -Patch0203: 0203-disk-geli-Add-missing-free.patch -Patch0204: 0204-biosdisk-Add-missing-cast.patch -Patch0205: 0205-font-Add-missing-free.patch -Patch0206: 0206-fs-cbfs-Add-missing-free.patch -Patch0207: 0207-fs-cpio_common-Add-a-sanity-check-on-namesize.patch -Patch0208: 0208-fs-fat-Fix-codepath-to-properly-free-on-error.patch -Patch0209: 0209-fs-hfs-hfs_open-Check-that-mount-succeeded.patch -Patch0210: 0210-fs-hfs-Add-pointer-sanity-checks.patch -Patch0211: 0211-commands-fileXX-Fix-remaining-memory-leak.patch -Patch0212: 0212-grub_iso9660_read-Explicitly-check-read_node-return-.patch -Patch0213: 0213-fs-minix-Fix-sector-promotion-to-64-bit.patch -Patch0214: 0214-fs-ntfs-Add-missing-free.patch -Patch0215: 0215-fs-ntfs-Add-sizes-sanity-checks.patch -Patch0216: 0216-fs-reiserfs-Fix-sector-count-overflow.patch -Patch0217: 0217-fs-sfs-Fix-error-check-and-add-sanity-check.patch -Patch0218: 0218-configure.ac-Always-add-D_FILE_OFFSET_BITS-64.patch -Patch0219: 0219-fs-ufs-Add-missing-error-check.patch -Patch0220: 0220-gfxmenu-icon_manager-Fix-null-pointer-dereference.patch -Patch0221: 0221-gfxmenu-theme_loader-Add-missing-allos-error-check.patch -Patch0222: 0222-i386-pc-mmap-Fix-memset-size.patch -Patch0223: 0223-lib-syslinux_parse-Add-missing-alloc-check.patch -Patch0224: 0224-lib-syslinux_parse-Fix-memory-leak.patch -Patch0225: 0225-lib-syslinux_parse-Add-missing-error-check.patch -Patch0226: 0226-bsd-Add-missing-null-pointer-check.patch -Patch0227: 0227-multiboot-Simplify-to-avoid-confusing-assignment.patch -Patch0228: 0228-plan9-Add-missing-grub_device_close.patch -Patch0229: 0229-xnu-Add-missing-error-check.patch -Patch0230: 0230-normal-main-Fix-error-handling.patch -Patch0231: 0231-normal-misc-Close-device-on-all-pathes.patch -Patch0232: 0232-devmapper-getroot-Fix-memory-leak.patch -Patch0233: 0233-linux-blocklist-Fix-memory-leak.patch -Patch0234: 0234-linux-getroot-Fix-error-handling.patch -Patch0235: 0235-unix-password-Fix-file-descriptor-leak.patch -Patch0236: 0236-vbe-Fix-incorrect-register-usage.patch -Patch0237: 0237-util-getroot-Add-missing-grub_disk_close.patch -Patch0238: 0238-grub-install-common-Fix-sizeof-usage.patch -Patch0239: 0239-grub-install-Fix-memory-leak.patch -Patch0240: 0240-grub-macbless-Fix-resource-leak.patch -Patch0241: 0241-util-misc.c-Check-ftello-return-value.patch -Patch0242: 0242-linux-getroot-fix-descriptor-leak.patch -Patch0243: 0243-linux-ofpath-fix-various-memory-leaks.patch -Patch0244: 0244-util-setup-fix-memory-leak.patch -Patch0245: 0245-util-install-fix-memory-leak.patch -Patch0246: 0246-linux-getroot-fix-memory-leak.patch -Patch0247: 0247-util-grub-install-rearrange-code-to-avoid-memory-lea.patch -Patch0248: 0248-util-grub-mkstandalone-fix-memory-leak.patch -Patch0249: 0249-util-grub-mount-fix-descriptor-leak.patch -Patch0250: 0250-util-mkimage-fix-memory-leaks.patch -Patch0251: 0251-util-setup-fix-memory-leak.patch -Patch0252: 0252-commands-acpi-Use-ALIGN_UP-rather-than-manual-expres.patch -Patch0253: 0253-fs-cbfs-cpio-Remove-useless-check-if-mode-is-NULL.patch -Patch0254: 0254-fs-zfs-Fix-error-handling.patch -Patch0255: 0255-fs-zfscrypt-Add-missing-explicit-cast.patch -Patch0256: 0256-linux-hostdisk-Limit-strcpy-size-to-buffer-size.patch -Patch0257: 0257-linux-ofpath-Fix-error-handling.patch -Patch0258: 0258-Document-intentional-fallthroughs.patch -Patch0259: 0259-linux-hostdisk-use-strncpy-instead-of-strlcpy.patch -Patch0260: 0260-linux-ofpath-fix-descriptor-leak.patch -Patch0261: 0261-fs-zfs-zfs.c-fix-memory-leak.patch -Patch0262: 0262-commands-parttool-fix-memory-leak.patch -Patch0263: 0263-fs-zfs-zfscrypt.c-fix-memory-leaks.patch -Patch0264: 0264-fs-zfs-zfscrypt.c-fix-indentation.patch -Patch0265: 0265-fs-hfsplus-fix-memory-leak.patch -Patch0266: 0266-util-grub-probe-fix-memory-leaks.patch -Patch0267: 0267-loader-xnu-fix-memory-leak.patch -Patch0268: 0268-Change-quotes-to-match-overall-style-in-NEWS.patch -Patch0269: 0269-syslinux_parse-fix-memory-leak.patch -Patch0270: 0270-script-execute.c-fix-memory-leak.patch -Patch0271: 0271-configure.ac-don-t-use-msoft-float-for-arm64.patch -Patch0272: 0272-test-do-not-stop-after-first-file-test-or-closing-br.patch -Patch0273: 0273-test-fix-previous-commit-we-need-to-return-from-sube.patch -Patch0274: 0274-test-consistently-use-TMPDIR-and-same-name-pattern-f.patch -Patch0275: 0275-tests-add-test-command-file-tests.patch -Patch0276: 0276-net-ip-check-result-of-grub_netbuff_push.patch -Patch0277: 0277-grub-mkimage-fix-potential-NULL-pointer-dereference.patch -Patch0278: 0278-net-pxe-fix-error-condition.patch -Patch0279: 0279-grub-fstest-fix-descriptor-leak.patch -Patch0280: 0280-setup-fix-blocklist-size-calculation.patch -Patch0281: 0281-arm-implement-additional-relocations-generated-by-gc.patch -Patch0282: 0282-util-mkimage-fix-gcc5-build-failure.patch -Patch0283: 0283-diskfilter-fix-crash-in-validate_lv-for-mdraid-array.patch -Patch0284: 0284-diskfilter-fix-double-free-of-lv-names-for-mdraid.patch -Patch0285: 0285-multiboot2-Fix-information-request-tag-size-calculat.patch -Patch0286: 0286-disk-lvm-Use-zalloc-to-ensure-that-segments-are-init.patch -Patch0287: 0287-diskfilter_make_raid-more-memory-leaks-in-failure-pa.patch -Patch0288: 0288-syslinux_parse-Always-output-comments-even-if-no-ent.patch -Patch0289: 0289-Don-t-remove-initrd-parameter.patch -Patch0290: 0290-Add-test-for-syslinux-converter.patch -Patch0291: 0291-build-sys-add-syslinux-test-files-to-tarball.patch -Patch0292: 0292-tests-remove-hardcoded-paths-from-syslinux_test.patch -Patch0293: 0293-ext2-Support-META_BG.patch -Patch0294: 0294-ext2-Ignore-INCOMPAT_MMP.patch -Patch0295: 0295-configure-Add-missing-comma.patch -Patch0296: 0296-configure-Move-adding-of-include-options-to-the-very.patch -Patch0297: 0297-Strip-.MIPS.abiflags-which-causes-compile-failure.patch -Patch0298: 0298-INSTALL-Fix-names-of-host-flags-to-match-actual-beha.patch -Patch0299: 0299-div_test-Don-t-try-to-divide-by-zero.patch -Patch0300: 0300-Provide-__aeabi_mem-cpy-set.patch -Patch0301: 0301-mips-startup_raw-Use-more-portable-.asciz.patch -Patch0302: 0302-configure-Add-msoft-float-to-CCASFLAGS.patch -Patch0303: 0303-ofdisk-Exclude-floppies-from-scanning.patch -Patch0304: 0304-wildcard-Mark-unused-argument-as-such.patch -Patch0305: 0305-zfs-mzap_lookup-Fix-argument-types.patch -Patch0306: 0306-INSTALL-clarify-that-clang-support-is-experimental.patch -Patch0307: 0307-Test-which-flags-make-our-asm-compile.patch -Patch0308: 0308-i386-Move-from-explicit-ADDR32-DATA32-prefixes-to-in.patch -Patch0309: 0309-Change-dot-assignmnet-to-more-portable-.org.patch -Patch0310: 0310-i386-pc-boot-Explicitly-mark-kernel_address-_high-as.patch -Patch0311: 0311-i386-Remove-needless-ADDR32-prefixes-when-address-is.patch -Patch0312: 0312-Remove-obsolete-ADDR32-and-DATA32-checks.patch -Patch0313: 0313-Remove-realmode.S-from-coreboot-and-qemu.patch -Patch0314: 0314-qemu-Fix-compilation.patch -Patch0315: 0315-qemu-Fix-GateA20-enabling.patch -Patch0316: 0316-qemu-Switch-to-more-portable-.org.patch -Patch0317: 0317-Relax-requirements-on-asm-for-non-BIOS-i386-platform.patch -Patch0318: 0318-kernel-8086-Switch-to-more-portable-.org.patch -Patch0319: 0319-sparc64-Switch-to-more-portable-.org.patch -Patch0320: 0320-mips-Switch-to-more-portable-.org.patch -Patch0321: 0321-Discover-which-option-provides-soft-float-on-configu.patch -Patch0322: 0322-Experimental-support-for-clang-for-sparc64.patch -Patch0323: 0323-i386-tsc-Fix-unused-function-warning-on-xen.patch -Patch0324: 0324-configure.ac-Add-ia64-specific-way-to-disable-floats.patch -Patch0325: 0325-acpi-Fix-unused-function-warning.patch -Patch0326: 0326-Supply-signed-division-to-fix-ARM-compilation.patch -Patch0327: 0327-arm64-Fix-compilation-failure.patch -Patch0328: 0328-Allow-clang-compilation-for-thumb-with-mthumb-interw.patch -Patch0329: 0329-Add-missing-grub_-prefix-in-memcpy-invocation.patch -Patch0330: 0330-mips-Fix-soft-float-handling.patch -Patch0331: 0331-minilzo-Skip-parts-tha-we-don-t-need.patch -Patch0332: 0332-bitmap_scale-Optimize-by-moving-division-out-of-the-.patch -Patch0333: 0333-fbblit-Optimize-by-replacing-division-with-additions.patch -Patch0334: 0334-Add-missing-lib-division.c.patch -Patch0335: 0335-png-Optimize-by-avoiding-divisions.patch -Patch0336: 0336-jpeg-Optimise-by-replacing-division-with-shifts.patch -Patch0337: 0337-crypto-restrict-cipher-block-size-to-power-of-2.patch -Patch0338: 0338-dmraid_nvidia-Fix-division-by-0-and-missing-byte-swa.patch -Patch0339: 0339-raid6-Optimize-by-removing-division.patch -Patch0340: 0340-gzio-Optimize-by-removing-division.patch -Patch0341: 0341-arm-dl-Fix-handling-of-nonstandard-relocation-sizes.patch -Patch0342: 0342-emu-cache-Change-declaration-of-__clear_cache-to-mat.patch -Patch0343: 0343-ntfs_test-Skip-is-setfattr-is-unavailable.patch -Patch0344: 0344-grub-shell-Add-missing-locale-directory.patch -Patch0345: 0345-grub-probe-Mark-a-default-for-translation.patch -Patch0346: 0346-exclude.pot-Add-new-technical-strings.patch -Patch0347: 0347-grub-probe-free-temporary-variable.patch -Patch0348: 0348-Don-t-continue-to-query-block-size-if-disk-doesn-t-h.patch -Patch0349: 0349-configure.ac-Set-CPPFLAGS-when-checking-for-no_app_r.patch -Patch0350: 0350-types.h-Use-__builtin_bswap-with-clang.patch -Patch0351: 0351-Remove-libgcc-dependency.patch -Patch0352: 0352-configure.ac-Remove-unused-COND_clang.patch -Patch0353: 0353-Remove-emu-libusb-support.patch -Patch0354: 0354-Fix-canonicalize_file_name-clash.patch -Patch0355: 0355-configure.ac-Fix-the-name-of-pciaccess-header.patch -Patch0356: 0356-syslinux_parse-Fix-the-case-of-unknown-localboot.patch -Patch0357: 0357-update-m4-extern-inline.m4-to-upstream-version-to-fi.patch -Patch0358: 0358-update-gnulib-argp-help.c-to-fix-garbage-in-grub-mkn.patch -Patch0359: 0359-autogen.sh-Allow-overriding-the-python-to-be-used-by.patch -Patch0360: 0360-hfsplus-Fix-potential-access-to-uninited-memory-on-i.patch -Patch0361: 0361-grub-fs-tester-better-estimation-of-filesystem-time-.patch -Patch0362: 0362-grub-fs-tester-explicitly-set-segment-type-for-LVM-m.patch -Patch0363: 0363-core-add-LVM-RAID1-support.patch -Patch0364: 0364-grub-fs-tester-add-LVM-RAID1-support.patch -Patch0365: 0365-cacheinfo-Add-missing-license-information.patch -Patch0366: 0366-grub-mkrescue-pass-all-unrecognized-options-unchange.patch -Patch0367: 0367-fddboot_test-Add-no-pad-to-xorriso.patch -Patch0368: 0368-emunet-Fix-init-error-checking.patch -Patch0369: 0369-compiler-rt-emu-Add-missing-file.patch -Patch0370: 0370-hostfs-Drop-unnecessary-feature-test-macros.patch -Patch0371: 0371-arp-icmp-Fix-handling-in-case-of-oversized-or-invali.patch -Patch0372: 0372-Makefile.core.def-Remove-obsolete-LDADD_KERNEL.patch -Patch0373: 0373-modinfo.sh.in-Add-missing-config-variables.patch -Patch0374: 0374-util-mkimage-Use-stable-timestamp-when-generating-bi.patch -Patch0375: 0375-Make-Makefile.util.def-independent-of-platform.patch -Patch0376: 0376-efinet-Check-for-immediate-completition.patch -Patch0377: 0377-dl_helper-Cleanup.patch -Patch0378: 0378-Add-missing-initializers-to-silence-suprious-warning.patch -Patch0379: 0379-Recognize-EFI-platform-even-in-case-of-mismatch-betw.patch -Patch0380: 0380-syslinux-Support-vesa-menu.c32.patch -Patch0381: 0381-net-trivial-grub_cpu_to_XX_compile_time-cleanup.patch -Patch0382: 0382-grub-core-loader-i386-xen.c-Initialized-initrd_ctx-s.patch -Patch0383: 0383-do-not-emit-cryptomount-without-crypto-UUID.patch -Patch0384: 0384-core-avoid-NULL-derefrence-in-grub_divmod64s.patch -Patch0385: 0385-docs-grub.texi-Fix-spelling-of-cbfstool.patch -Patch0386: 0386-core-partmap-rename-sun-to-avoid-clash-with-predefin.patch -Patch0387: 0387-getroot-include-sys-mkdev.h-for-makedev.patch -Patch0388: 0388-Remove-V-in-grub-mkrescue.c.patch -Patch0389: 0389-grub-mkconfig-use-pkgdatadir-in-scripts.patch -Patch0390: 0390-zfs-com.delphix-hole_birth-feature-support.patch -Patch0391: 0391-zfs-com.delphix-embedded_data-feature-support.patch -Patch0392: 0392-zfs-add-missing-NULL-check-and-fix-incorrect-buffer-.patch -Patch0393: 0393-efinet-memory-leak-on-module-removal.patch -Patch0394: 0394-efinet-cannot-free-const-char-pointer.patch -Patch0395: 0395-Revert-efinet-memory-leak-on-module-removal.patch -Patch0396: 0396-arm64-Export-useful-functions-from-linux.c.patch -Patch0397: 0397-fdt.h-Add-grub_fdt_set_reg64-macro.patch -Patch0398: 0398-Revert-parts-accidentally-committed-2-commits-ago.patch -Patch0399: 0399-linux.c-Ensure-that-initrd-is-page-aligned.patch -Patch0400: 0400-grub-mkrescue-Recognize-output-as-an-alias-of-output.patch -Patch0401: 0401-grub-install-common-Increase-buf-size-to-8192-as-mod.patch -Patch0402: 0402-i386-relocator-Remove-unused-extern-grub_relocator64.patch -Patch0403: 0403-loader-linux-do-not-pad-initrd-with-zeroes-at-the-en.patch -Patch0404: 0404-convert-to-not-from-CPU-byte-order-in-DNS-receive-fu.patch -Patch0405: 0405-efidisk-move-device-path-helpers-in-core-for-efinet.patch -Patch0406: 0406-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch -Patch0407: 0407-efinet-open-Simple-Network-Protocol-exclusively.patch -Patch0408: 0408-util-grub-mkrescue-Fix-compilation.patch -Patch0409: 0409-Add-asm-tests-to-tarball.patch -Patch0410: 0410-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch -Patch0411: 0411-xfs-Fix-termination-loop-for-directory-iteration.patch -Patch0412: 0412-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch -Patch0413: 0413-remove-extra-newlines-in-grub_util_-strings.patch -Patch0414: 0414-zfs-fix-integer-truncation-in-zap_lookup.patch -Patch0415: 0415-hostdisk-fix-crash-with-NULL-device.map.patch -Patch0416: 0416-bootp-ignore-gateway_ip-relay-field.patch -Patch0417: 0417-cb_timestamps.c-Add-new-time-stamp-descriptions.patch -Patch0418: 0418-disk-ahci-Use-defines-GRUB_ATA_STATUS_BUSY-and-GRUB_.patch -Patch0419: 0419-multiboot1-never-place-modules-in-low-memory.patch -Patch0420: 0420-zfs-extensible_dataset-and-large_blocks-feature-supp.patch -Patch0421: 0421-Correct-spelling-of-scheduled.patch -Patch0422: 0422-Clarify-use-of-superusers-variable-and-menu-entry-ac.patch -Patch0423: 0423-disk-ahci.c-Add-port-number-to-port-debug-messages.patch -Patch0424: 0424-arm64-setjmp-Add-missing-license-macro.patch -Patch0425: 0425-configure.ac-clean-up-arm64-soft-float-handling.patch -Patch0426: 0426-multiboot_header_tag_module_align-fix-to-confirm-mul.patch -Patch0427: 0427-xfs-Add-helpers-for-inode-size.patch -Patch0428: 0428-xfs-V5-filesystem-format-support.patch -Patch0429: 0429-NEWS-XFS-v5-support.patch -Patch0430: 0430-disk-ahci.c-Use-defines-GRUB_AHCI_HBA_PORT_CMD_SPIN_.patch -Patch0431: 0431-Fix-exit-to-EFI-firmware.patch -Patch0432: 0432-Migrate-PPC-from-Yaboot-to-Grub2.patch -Patch0433: 0433-Add-fw_path-variable-revised.patch -Patch0434: 0434-Add-support-for-linuxefi.patch -Patch0435: 0435-Use-linuxefi-and-initrdefi-where-appropriate.patch -Patch0436: 0436-Don-t-allow-insmod-when-secure-boot-is-enabled.patch -Patch0437: 0437-Pass-x-hex-hex-straight-through-unmolested.patch -Patch0438: 0438-Fix-crash-on-http.patch -Patch0439: 0439-IBM-client-architecture-CAS-reboot-support.patch -Patch0440: 0440-Add-vlan-tag-support.patch -Patch0441: 0441-Add-X-option-to-printf-functions.patch -Patch0442: 0442-DHCP-client-ID-and-UUID-options-added.patch -Patch0443: 0443-Search-for-specific-config-file-for-netboot.patch -Patch0444: 0444-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch -Patch0445: 0445-Move-bash-completion-script-922997.patch -Patch0446: 0446-for-ppc-reset-console-display-attr-when-clear-screen.patch -Patch0447: 0447-Don-t-write-messages-to-the-screen.patch -Patch0448: 0448-Don-t-print-GNU-GRUB-header.patch -Patch0449: 0449-Don-t-add-to-highlighted-row.patch -Patch0450: 0450-Message-string-cleanups.patch -Patch0451: 0451-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch -Patch0452: 0452-Use-the-correct-indentation-for-the-term-help-text.patch -Patch0453: 0453-Indent-menu-entries.patch -Patch0454: 0454-Fix-margins.patch -Patch0455: 0455-Add-support-for-UEFI-operating-systems-returned-by-o.patch -Patch0456: 0456-Disable-GRUB-video-support-for-IBM-power-machines.patch -Patch0457: 0457-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch -Patch0458: 0458-Use-linux16-when-appropriate-880840.patch -Patch0459: 0459-Enable-pager-by-default.-985860.patch -Patch0460: 0460-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch -Patch0461: 0461-Don-t-say-GNU-Linux-in-generated-menus.patch -Patch0462: 0462-Don-t-draw-a-border-around-the-menu.patch -Patch0463: 0463-Use-the-standard-margin-for-the-timeout-string.patch -Patch0464: 0464-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch -Patch0465: 0465-Add-.eh_frame-to-list-of-relocations-stripped.patch -Patch0466: 0466-Make-10_linux-work-with-our-changes-for-linux16-and-.patch -Patch0467: 0467-Don-t-print-during-fdt-loading-method.patch -Patch0468: 0468-Honor-a-symlink-when-generating-configuration-by-gru.patch -Patch0469: 0469-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch -Patch0470: 0470-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0471: 0471-Don-t-emit-Booting-.-message.patch -Patch0472: 0472-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch -Patch0473: 0473-May-as-well-try-it.patch -Patch0474: 0474-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0475: 0475-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0476: 0476-trim-arp-packets-with-abnormal-size.patch -Patch0477: 0477-Fix-convert-function-to-support-NVMe-devices.patch -Patch0478: 0478-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch -Patch0479: 0479-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch -Patch0480: 0480-Use-the-default-device-tree-from-the-grub-default-fi.patch -Patch0481: 0481-reopen-SNP-protocol-for-exclusive-use-by-grub.patch -Patch0482: 0482-Reduce-timer-event-frequency-by-10.patch -Patch0483: 0483-always-return-error-to-UEFI.patch -Patch0484: 0484-Add-powerpc-little-endian-ppc64le-flags.patch -Patch0485: 0485-Files-reorganization-and-include-some-libgcc-fuction.patch -Patch0486: 0486-Suport-for-bi-endianess-in-elf-file.patch -Patch0487: 0487-Add-grub_util_readlink.patch -Patch0488: 0488-Make-editenv-chase-symlinks-including-those-across-d.patch -Patch0489: 0489-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0490: 0490-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch -Patch0491: 0491-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0492: 0492-Add-GRUB_DISABLE_UUID.patch -Patch0493: 0493-Allow-fallback-to-include-entries-by-title-not-just-.patch -Patch0494: 0494-Load-arm-with-SB-enabled.patch -Patch0495: 0495-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0496: 0496-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch -Patch0497: 0497-Update-to-minilzo-2.08.patch -Patch0498: 0498-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0499: 0499-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch -Patch0500: 0500-Make-.gitignore-suck-way-less.patch -Patch0501: 0501-Update-info-with-grub.cfg-netboot-selection-order-11.patch -Patch0502: 0502-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch -Patch0503: 0503-Add-friendly-grub2-password-config-tool-985962.patch -Patch0504: 0504-Make-exit-take-a-return-code.patch -Patch0505: 0505-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch -Patch0506: 0506-Fix-race-in-EFI-validation.patch +# generate with: +# git diff grub-2.02-beta2..origin/master +Patch0000: grub-2.02-beta2-to-origin-master.patch + +# generate all the patches after this with: +# git format-patch origin/master..fedora-23 +Patch0001: 0001-Migrate-PPC-from-Yaboot-to-Grub2.patch +Patch0002: 0002-Add-fw_path-variable-revised.patch +Patch0003: 0003-Add-support-for-linuxefi.patch +Patch0004: 0004-Use-linuxefi-and-initrdefi-where-appropriate.patch +Patch0005: 0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch +Patch0006: 0006-Pass-x-hex-hex-straight-through-unmolested.patch +Patch0007: 0007-Fix-crash-on-http.patch +Patch0008: 0008-IBM-client-architecture-CAS-reboot-support.patch +Patch0009: 0009-Add-vlan-tag-support.patch +Patch0010: 0010-Add-X-option-to-printf-functions.patch +Patch0011: 0011-DHCP-client-ID-and-UUID-options-added.patch +Patch0012: 0012-Search-for-specific-config-file-for-netboot.patch +Patch0013: 0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +Patch0014: 0014-Move-bash-completion-script-922997.patch +Patch0015: 0015-for-ppc-reset-console-display-attr-when-clear-screen.patch +Patch0016: 0016-Don-t-write-messages-to-the-screen.patch +Patch0017: 0017-Don-t-print-GNU-GRUB-header.patch +Patch0018: 0018-Don-t-add-to-highlighted-row.patch +Patch0019: 0019-Message-string-cleanups.patch +Patch0020: 0020-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +Patch0021: 0021-Use-the-correct-indentation-for-the-term-help-text.patch +Patch0022: 0022-Indent-menu-entries.patch +Patch0023: 0023-Fix-margins.patch +Patch0024: 0024-Add-support-for-UEFI-operating-systems-returned-by-o.patch +Patch0025: 0025-Disable-GRUB-video-support-for-IBM-power-machines.patch +Patch0026: 0026-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +Patch0027: 0027-Use-linux16-when-appropriate-880840.patch +Patch0028: 0028-Enable-pager-by-default.-985860.patch +Patch0029: 0029-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +Patch0030: 0030-Don-t-say-GNU-Linux-in-generated-menus.patch +Patch0031: 0031-Don-t-draw-a-border-around-the-menu.patch +Patch0032: 0032-Use-the-standard-margin-for-the-timeout-string.patch +Patch0033: 0033-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch +Patch0034: 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch +Patch0035: 0035-Make-10_linux-work-with-our-changes-for-linux16-and-.patch +Patch0036: 0036-Don-t-print-during-fdt-loading-method.patch +Patch0037: 0037-Honor-a-symlink-when-generating-configuration-by-gru.patch +Patch0038: 0038-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +Patch0039: 0039-Don-t-require-a-password-to-boot-entries-generated-b.patch +Patch0040: 0040-Don-t-emit-Booting-.-message.patch +Patch0041: 0041-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch +Patch0042: 0042-May-as-well-try-it.patch +Patch0043: 0043-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0044: 0044-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0045: 0045-trim-arp-packets-with-abnormal-size.patch +Patch0046: 0046-Fix-convert-function-to-support-NVMe-devices.patch +Patch0047: 0047-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +Patch0048: 0048-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch +Patch0049: 0049-Use-the-default-device-tree-from-the-grub-default-fi.patch +Patch0050: 0050-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +Patch0051: 0051-Reduce-timer-event-frequency-by-10.patch +Patch0052: 0052-always-return-error-to-UEFI.patch +Patch0053: 0053-Suport-for-bi-endianess-in-elf-file.patch +Patch0054: 0054-Add-grub_util_readlink.patch +Patch0055: 0055-Make-editenv-chase-symlinks-including-those-across-d.patch +Patch0056: 0056-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0057: 0057-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch +Patch0058: 0058-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0059: 0059-Add-GRUB_DISABLE_UUID.patch +Patch0060: 0060-Allow-fallback-to-include-entries-by-title-not-just-.patch +Patch0061: 0061-Load-arm-with-SB-enabled.patch +Patch0062: 0062-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0063: 0063-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch +Patch0064: 0064-Update-to-minilzo-2.08.patch +Patch0065: 0065-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0066: 0066-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch +Patch0067: 0067-Make-.gitignore-suck-way-less.patch +Patch0068: 0068-Update-info-with-grub.cfg-netboot-selection-order-11.patch +Patch0069: 0069-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +Patch0070: 0070-Add-friendly-grub2-password-config-tool-985962.patch +Patch0071: 0071-Make-exit-take-a-return-code.patch +Patch0072: 0072-Add-some-__unused__-where-gcc-5.x-is-more-picky-abou.patch +Patch0073: 0073-Fix-race-in-EFI-validation.patch +Patch0074: 0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch + + +# And these are: +# git checkout debuginfo +# git format-patch fedora-23.. +Patch10001: 10001-Put-the-correct-.file-directives-in-our-.S-files.patch +Patch10002: 10002-Make-efi-machines-load-an-env-block-from-a-variable.patch +Patch10003: 10003-Make-it-possible-to-enabled-build-id-sha1.patch +Patch10004: 10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch +Patch10005: 10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch10006: 10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch BuildRequires: flex bison binutils python BuildRequires: ncurses-devel xz-devel bzip2-devel @@ -957,7 +542,9 @@ fi %{_sbindir}/%{name}-ofpathname %{_sbindir}/%{name}-probe %{_sbindir}/%{name}-reboot +%{_sbindir}/%{name}-rpm-sort %{_sbindir}/%{name}-set-default +%{_sbindir}/%{name}-setpassword %{_sbindir}/%{name}-sparc64-setup %{_bindir}/%{name}-editenv %{_bindir}/%{name}-file @@ -1006,8 +593,10 @@ fi %{_datarootdir}/grub/themes/starfield %changelog -* Sun Jul 19 2015 Peter Robinson 2.02-0.17 -- Don't build hardened (fixes FTBFS) +* Wed Jul 22 2015 Peter Jones - 2.02-0.17 +- Don't build hardened (fixes FTBFS) (pbrobinson) +- Reconcile with the current upstream +- Fixes for gcc 5 * Tue Apr 28 2015 Peter Jones - 2.02-0.16 - Make grub2-mkconfig produce the kernel titles we actually want.