Browse Source

add grub2 package

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 7 years ago
parent
commit
9e9c2c0278
  1. 43
      SOURCES/0001-fix-EFI-detection-on-Windows.patch
  2. 43
      SOURCES/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch
  3. 88
      SOURCES/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch
  4. 154
      SOURCES/0004-NEWS-First-draft-of-2.02-entry.patch
  5. 43
      SOURCES/0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch
  6. 41
      SOURCES/0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
  7. 39
      SOURCES/0007-remove-unused-error.h-from-kern-emu-misc.c.patch
  8. 70
      SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch
  9. 121
      SOURCES/0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch
  10. 39
      SOURCES/0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch
  11. 37
      SOURCES/0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch
  12. 45
      SOURCES/0012-fix-32-bit-compilation-on-MinGW-w64.patch
  13. 44
      SOURCES/0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch
  14. 43
      SOURCES/0014-arm64-set-correct-length-of-device-path-end-entry.patch
  15. 39
      SOURCES/0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch
  16. 48
      SOURCES/0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch
  17. 48
      SOURCES/0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch
  18. 109
      SOURCES/0018-Prefer-more-portable-test-1-constructs.patch
  19. 100
      SOURCES/0019-NEWS-Add-few-missing-entries.patch
  20. 90
      SOURCES/0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch
  21. 47
      SOURCES/0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch
  22. 153
      SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch
  23. 154
      SOURCES/0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch
  24. 25
      SOURCES/0024-Fix-ChangeLog-date.patch
  25. 47
      SOURCES/0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch
  26. 174
      SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch
  27. 281
      SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch
  28. 61
      SOURCES/0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch
  29. 39
      SOURCES/0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch
  30. 42
      SOURCES/0030-Makefile.am-default_payload.elf-Add-modules-multiboo.patch
  31. 55
      SOURCES/0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch
  32. 68
      SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch
  33. 40
      SOURCES/0033-util-grub-install.c-Fix-a-typo.patch
  34. 91
      SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch
  35. 58
      SOURCES/0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch
  36. 52
      SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch
  37. 111
      SOURCES/0037-increase-network-try-interval-gradually.patch
  38. 39
      SOURCES/0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch
  39. 37
      SOURCES/0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch
  40. 62
      SOURCES/0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch
  41. 38
      SOURCES/0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch
  42. 109
      SOURCES/0042-util-grub-install.c-List-available-targets.patch
  43. 78
      SOURCES/0043-Fix-several-translatable-strings.patch
  44. 75
      SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch
  45. 108
      SOURCES/0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch
  46. 60
      SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch
  47. 55
      SOURCES/0047-grub-install-support-for-partitioned-partx-loop-devi.patch
  48. 40
      SOURCES/0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch
  49. 73
      SOURCES/0049-.gitignore-add-missing-files-and-.exe-variants.patch
  50. 77
      SOURCES/0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch
  51. 57
      SOURCES/0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch
  52. 55
      SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch
  53. 62
      SOURCES/0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch
  54. 54
      SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch
  55. 42
      SOURCES/0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch
  56. 42
      SOURCES/0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch
  57. 44
      SOURCES/0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch
  58. 199
      SOURCES/0058-add-grub_env_set_net_property-function.patch
  59. 211
      SOURCES/0059-add-bootpath-parser-for-open-firmware.patch
  60. 40
      SOURCES/0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch
  61. 82
      SOURCES/0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch
  62. 42
      SOURCES/0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch
  63. 47
      SOURCES/0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch
  64. 88
      SOURCES/0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch
  65. 70
      SOURCES/0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch
  66. 33
      SOURCES/0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch
  67. 39
      SOURCES/0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch
  68. 39
      SOURCES/0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch
  69. 55
      SOURCES/0069-Fix-grub-probe-0-option.patch
  70. 366
      SOURCES/0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch
  71. 44
      SOURCES/0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch
  72. 55
      SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch
  73. 102
      SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch
  74. 47
      SOURCES/0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch
  75. 24
      SOURCES/0075-Add-missing-endif.patch
  76. 39
      SOURCES/0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch
  77. 45
      SOURCES/0077-Improve-LVM-logical_volumes-string-matching.patch
  78. 83
      SOURCES/0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch
  79. 49
      SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch
  80. 43
      SOURCES/0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch
  81. 40
      SOURCES/0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch
  82. 43
      SOURCES/0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch
  83. 73
      SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch
  84. 39
      SOURCES/0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch
  85. 72
      SOURCES/0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch
  86. 46
      SOURCES/0086-util-grub-install.c-Fix-handling-of-disk-module.patch
  87. 58
      SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch
  88. 26
      SOURCES/0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
  89. 154
      SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch
  90. 81
      SOURCES/0090-Add-fw_path-variable-revised.patch
  91. 482
      SOURCES/0091-Add-support-for-linuxefi.patch
  92. 50
      SOURCES/0092-Use-linuxefi-and-initrdefi-where-appropriate.patch
  93. 117
      SOURCES/0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
  94. 183
      SOURCES/0094-Pass-x-hex-hex-straight-through-unmolested.patch
  95. 28
      SOURCES/0095-Fix-crash-on-http.patch
  96. 174
      SOURCES/0096-IBM-client-architecture-CAS-reboot-support.patch
  97. 186
      SOURCES/0097-Add-vlan-tag-support.patch
  98. 58
      SOURCES/0098-Add-X-option-to-printf-functions.patch
  99. 145
      SOURCES/0099-DHCP-client-ID-and-UUID-options-added.patch
  100. 203
      SOURCES/0100-Search-for-specific-config-file-for-netboot.patch
  101. Some files were not shown because too many files have changed in this diff Show More

43
SOURCES/0001-fix-EFI-detection-on-Windows.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From ba80a1fbdd780c9731067d83a68f50232a721614 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Wed, 25 Dec 2013 22:36:28 +0400
Subject: [PATCH 001/237] 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 <arvidjaar@gmail.com>
+
+ * grub-core/osdep/windows/platform.c (get_platform): Fix EFI
+ detection.
+
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

43
SOURCES/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From 7f8c6d27243d44c2c9ab30be8deb723a1889ed96 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 25 Dec 2013 23:31:42 +0100
Subject: [PATCH 002/237] * 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 <phcoder@gmail.com>
+
+ * 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 <arvidjaar@gmail.com>
* 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.9.3

88
SOURCES/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch

@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
From 37e5556489575b6a15c1367929596bb3636f03f4 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 27 Dec 2013 03:03:32 +0000
Subject: [PATCH 003/237] * 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 153bc43..bbb0f31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-27 Colin Watson <cjwatson@ubuntu.com>
+
+ * INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes.
+ * docs/grub.texi (Getting the source code): Likewise.
+
2013-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
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.9.3

154
SOURCES/0004-NEWS-First-draft-of-2.02-entry.patch

@ -0,0 +1,154 @@ @@ -0,0 +1,154 @@
From 990b8a55e4adbf26763df3c42320e7891cbd599e Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 27 Dec 2013 03:05:38 +0000
Subject: [PATCH 004/237] * NEWS: First draft of 2.02 entry.

---
ChangeLog | 4 +++
NEWS | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index bbb0f31..82dc61d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-12-27 Colin Watson <cjwatson@ubuntu.com>
+ * NEWS: First draft of 2.02 entry.
+
+2013-12-27 Colin Watson <cjwatson@ubuntu.com>
+
* 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.9.3

43
SOURCES/0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From ac95c6068056617c16ae940855bd48803e4aa651 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 27 Dec 2013 11:20:37 +0100
Subject: [PATCH 005/237] Merge branch 'master' of git.sv.gnu.org:/srv/git/grub

Conflicts:
ChangeLog
---
ChangeLog | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 82dc61d..da3c2df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-27 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * 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 <cjwatson@ubuntu.com>
* NEWS: First draft of 2.02 entry.
@@ -7,13 +14,6 @@
* INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes.
* docs/grub.texi (Getting the source code): Likewise.
-2013-12-25 Vladimir Serbinenko <phcoder@gmail.com>
-
- * 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 <arvidjaar@gmail.com>
* grub-core/osdep/windows/platform.c (get_platform): Fix EFI
--
2.9.3

41
SOURCES/0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
From 5e5536c1c547f3d9969d87f345a93fb454086992 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sat, 28 Dec 2013 02:20:27 +0000
Subject: [PATCH 006/237] * 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 <cjwatson@ubuntu.com>
+
+ * NEWS: The cmosclean command in fact dates back to 1.99. Remove
+ mention of it from 2.02.
+
2013-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

39
SOURCES/0007-remove-unused-error.h-from-kern-emu-misc.c.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From ccf0094aefd14d170c84209d3508f4dc6c97ff74 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 28 Dec 2013 09:01:20 +0400
Subject: [PATCH 007/237] 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 <arvidjaar@gmail.com>
+
+ * grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation
+ on mingw.
+
2013-12-28 Colin Watson <cjwatson@ubuntu.com>
* 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 <config.h>
#include <errno.h>
-#include <error.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
--
2.9.3

70
SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
From 05a567228906c64062e4cbaa66245e15aea1b39d Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 28 Dec 2013 17:25:14 +0100
Subject: [PATCH 008/237] 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 <phcoder@gmail.com>
+
+ Don't abort() on unavailable coreboot tables if not running on coreboot.
+
2013-12-28 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

121
SOURCES/0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch

@ -0,0 +1,121 @@ @@ -0,0 +1,121 @@
From 7563f6fec775dbe32e99ff38788e1ff56dc1a61f Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 30 Dec 2013 06:49:15 +0100
Subject: [PATCH 009/237] * 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 <phcoder@gmail.com>
+
+ * NEWS: Add few missing entries. Correct existing ones.
+
2013-12-28 Vladimir Serbinenko <phcoder@gmail.com>
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.9.3

39
SOURCES/0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 5274da98cb155276f8b692340ec6cc4e26beb9b4 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Mon, 30 Dec 2013 12:56:19 +0000
Subject: [PATCH 010/237] 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 <arvidjaar@gmail.com>
+
+ * grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi.
+
2013-12-30 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

37
SOURCES/0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
From e4a3de3ef6a122504b5fb47de1f4a1bd6295d49a Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 7 Jan 2014 10:38:54 +0400
Subject: [PATCH 011/237] 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.9.3

45
SOURCES/0012-fix-32-bit-compilation-on-MinGW-w64.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
From 5978975d49a71ec60608f91bebbfe7410b5d6b19 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 7 Jan 2014 18:43:02 +0400
Subject: [PATCH 012/237] 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 <arvidjaar@gmail.com>
+
+ * include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello
+ on MinGW-64 when compiling for 32 bits.
+
2013-12-30 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

44
SOURCES/0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From 637ab9f9d8415bb29cafbbec51d32916b3975061 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 7 Jan 2014 20:34:25 +0400
Subject: [PATCH 013/237] 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 <arvidjaar@gmail.com>
+ * 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 <arvidjaar@gmail.com>
+
* 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.9.3

43
SOURCES/0014-arm64-set-correct-length-of-device-path-end-entry.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From dc589e298bf6aa12be88ef88ca95e90dee3a729a Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Tue, 7 Jan 2014 17:52:50 +0000
Subject: [PATCH 014/237] 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 <leif.lindholm@linaro.org>
+
+ * grub-core/loader/arm64/linux.c: correctly set device path end length.
+
2014-01-07 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

39
SOURCES/0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 8dcec304d484c978c8cee9bada8bd0bfc8e73a79 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 8 Jan 2014 11:05:20 +0000
Subject: [PATCH 015/237] * 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 <cjwatson@ubuntu.com>
+
+ * Makefile.util.def (grub-macbless): Change mansection to 8.
+
2014-01-07 Leif Lindholm <leif.lindholm@linaro.org>
* 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.9.3

48
SOURCES/0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
From 12cbfd02ce0d0dc29dfd11350478371243257f47 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sun, 12 Jan 2014 15:29:21 +0400
Subject: [PATCH 016/237] 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.9.3

48
SOURCES/0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
From 43f8e295a66a74093a967fb974f2b2b818c8a6ce Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 17 Jan 2014 02:30:52 +0000
Subject: [PATCH 017/237] 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 <cjwatson@debian.org>
+
+ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
+ redundant preprocessor conditional.
+
2014-01-08 Colin Watson <cjwatson@ubuntu.com>
* 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.9.3

109
SOURCES/0018-Prefer-more-portable-test-1-constructs.patch

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
From 14ef7cf251a04dc21aaf27cc4c0b6bc5e965262e Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 17 Jan 2014 15:24:50 +0000
Subject: [PATCH 018/237] 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 <cjwatson@debian.org>
+2014-01-17 Colin Watson <cjwatson@ubuntu.com>
+
+ * 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 <cjwatson@ubuntu.com>
* 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.9.3

100
SOURCES/0019-NEWS-Add-few-missing-entries.patch

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
From 0d79deaca0a3fb60d9343ae282b34381b04bb471 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 16:31:10 +0100
Subject: [PATCH 019/237] * 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 <phcoder@gmail.com>
+
+ * NEWS: Add few missing entries.
+
2014-01-17 Colin Watson <cjwatson@ubuntu.com>
* 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.9.3

90
SOURCES/0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch

@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
From a990af656571a24156a183dd8a09765e788c3b22 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 16:41:47 +0100
Subject: [PATCH 020/237] * 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 <phcoder@gmail.com>
+ * grub-core/kern/efi/efi.c: Ensure that the result starts with /
+ and has no //.
+
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
+
* NEWS: Add few missing entries.
2014-01-17 Colin Watson <cjwatson@ubuntu.com>
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.9.3

47
SOURCES/0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
From 762b39fcff62416481f12d2002abf7cdb76adbf3 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 16:43:29 +0100
Subject: [PATCH 021/237] * 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 <phcoder@gmail.com>
+ * util/grub-mount.c: Extend GCC warning workaround to grub-mount.
+
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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 <string.h>
#include <stdlib.h>
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
+#include <argp.h>
+#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.9.3

153
SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch

@ -0,0 +1,153 @@ @@ -0,0 +1,153 @@
From a8fb484206d0cc509ba27b8214bdb512ba258702 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 19:50:54 +0400
Subject: [PATCH 022/237] 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 <arvidjaar@gmail.com>
+
+ * 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 <phcoder@gmail.com>
* 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.9.3

154
SOURCES/0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch

@ -0,0 +1,154 @@ @@ -0,0 +1,154 @@
From 59a8ad9fb81ae9dc665a153242a580e51c2fc9b1 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 16:57:35 +0100
Subject: [PATCH 023/237] * 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 <phcoder@gmail.com>
+
+ * grub-core/term/terminfo.c: Recognize keys F1-F12.
+
2014-01-07 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

25
SOURCES/0024-Fix-ChangeLog-date.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From 5e0b14595aa213e38740d5908493999cbe4206af Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 20:01:16 +0400
Subject: [PATCH 024/237] 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 <arvidjaar@gmail.com>
+2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* configure.ac: Add support for BUILD_LDFLAGS.
* Makefile.am: Use BUILD_LDFLAGS for build time programs here ...
--
2.9.3

47
SOURCES/0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
From d52c3c475935ab1b1da008f9523c297422145297 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 20:04:11 +0400
Subject: [PATCH 025/237] 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 <arvidjaar@gmail.com>
+
+ * 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 <phcoder@gmail.com>
* 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.9.3

174
SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch

@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
From 6ae39452bb18fc5004f9d2bd8041a706e2532916 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 20:41:24 +0400
Subject: [PATCH 026/237] 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 <arvidjaar@gmail.com>
+ * 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 <arvidjaar@gmail.com>
+
* 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.9.3

281
SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch

@ -0,0 +1,281 @@ @@ -0,0 +1,281 @@
From 903a7b030c82d7e23acf89e2cd25ecd2138397bd Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 21:22:57 +0400
Subject: [PATCH 027/237] 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 <arvidjaar@gmail.com>
+ * include/grub/misc.h: Move macros for compiler features to ...
+ * include/grub/compiler.h: ... new file.
+ * include/grub/list.h: Include <grub/compiler.h> instead of <grub/misc.h>.
+ * grub-core/commands/fileXX.c: Include <grub/misc.h>.
+ * grub-core/efiemu/prepare.c: Include <grub/misc.h>.
+ * grub-core/loader/i386/xen_file.c: Include <grub/misc.h>.
+ * grub-core/loader/i386/xen_fileXX.c: Include <grub/misc.h>.
+ * grub-core/video/capture.c: Include <grub/misc.h>.
+ * include/grub/command.h: Include <grub/misc.h>.
+ * include/grub/dl.h: Include <grub/misc.h>.
+ * include/grub/procfs.h: Include <grub/misc.h>.
+
+2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
+
* 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 <grub/fileid.h>
#include <grub/elfload.h>
+#include <grub/misc.h>
#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 <grub/err.h>
#include <grub/mm.h>
#include <grub/types.h>
+#include <grub/misc.h>
#include <grub/efiemu/efiemu.h>
#include <grub/crypto.h>
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 <grub/xen_file.h>
#include <grub/i386/linux.h>
+#include <grub/misc.h>
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 <grub/xen_file.h>
+#include <grub/misc.h>
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 <grub/video.h>
#include <grub/video_fb.h>
#include <grub/mm.h>
+#include <grub/misc.h>
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 <grub/symbol.h>
#include <grub/err.h>
#include <grub/list.h>
+#include <grub/misc.h>
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 <http://www.gnu.org/licenses/>.
+ */
+
+#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 <grub/types.h>
#include <grub/elf.h>
#include <grub/list.h>
+#include <grub/misc.h>
#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 <grub/symbol.h>
-#include <grub/types.h>
-#include <grub/misc.h>
+#include <grub/err.h>
+#include <grub/compiler.h>
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 <grub/symbol.h>
#include <grub/err.h>
#include <grub/i18n.h>
-
-/* 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 <grub/compiler.h>
#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 <grub/list.h>
+#include <grub/types.h>
struct grub_procfs_entry
{
--
2.9.3

61
SOURCES/0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
From c611b3a4ec67d3fd3886b9bb93ccc41a40de1955 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 19:26:40 +0100
Subject: [PATCH 028/237] * 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 <phcoder@gmail.com>
+
+ * grub-core/commands/macbless.c: Rename FILE and DIR to avoid
+ conflicts.
+
+ Reported by: Andrey Borzenkov.
+
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

39
SOURCES/0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 0e1f799b78a8311319638e6a06a29385b3da0a82 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sat, 18 Jan 2014 19:41:15 +0100
Subject: [PATCH 029/237] * 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 <floppym@gentoo.org>
+
+ * Makefile.util.def: Link grub-ofpathname with zfs libs.
+
2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

42
SOURCES/0030-Makefile.am-default_payload.elf-Add-modules-multiboo.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 62d74eb68cebd48250469a1bfd4a042267fb04c9 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 19:43:19 +0100
Subject: [PATCH 030/237] * 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 <floppym@gentoo.org>
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * Makefile.am (default_payload.elf): Add modules
+ multiboot cbmemc linux16 gzio echo help.
+
+2014-01-18 Mike Gilbert <floppym@gentoo.org>
* 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.9.3

55
SOURCES/0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
From d173f8fd3046732a13ecefec5ada5129b828db20 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 22:48:04 +0400
Subject: [PATCH 031/237] 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 <arvidjaar@gmail.com>
+
+ * 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 <phcoder@gmail.com>
* 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.9.3

68
SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
From 8a7b98011d7a26e4e73b8b772921e011e4da3aa1 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 19:54:09 +0100
Subject: [PATCH 032/237] * 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 <phcoder@gmail.com>
+
+ * grub-core/normal/main.c (read_config_file): Buffer config file.
+ Reduces boot time.
+
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* 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 <grub/i18n.h>
#include <grub/charset.h>
#include <grub/script_sh.h>
+#include <grub/bufio.h>
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.9.3

40
SOURCES/0033-util-grub-install.c-Fix-a-typo.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
From bd7b390604d6122afda2763345406fa880fa4fd7 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 20:02:51 +0100
Subject: [PATCH 033/237] * 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 <phcoder@gmail.com>
+ * util/grub-install.c: Fix a typo.
+
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

91
SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
From de25a0fc647100d8d6639676d233c80149056070 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 18 Jan 2014 23:15:40 +0400
Subject: [PATCH 034/237] 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 <arvidjaar@gmail.com>
+
+ * 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 <phcoder@gmail.com>
* 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.9.3

58
SOURCES/0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
From 82366b73d1430f2ff2086401e09c88be1f170bd5 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 17 Jan 2014 02:28:46 +0000
Subject: [PATCH 035/237] 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 <cjwatson@ubuntu.com>
+
+ * 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 <arvidjaar@gmail.com>
* 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.9.3

52
SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
From d294c5d19587897546b91c4c75b2b64f42d7f391 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 21 Jan 2014 10:49:39 -0200
Subject: [PATCH 036/237] 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 <pfsmorigo@br.ibm.com>
+
+ * 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 <cjwatson@ubuntu.com>
* 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.9.3

111
SOURCES/0037-increase-network-try-interval-gradually.patch

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
From 734177c57499142bbdad947e8671cf1fbf4285ad Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 21 Jan 2014 11:03:51 -0200
Subject: [PATCH 037/237] 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 <pfsmorigo@br.ibm.com>
+ * 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 <pfsmorigo@br.ibm.com>
+
* 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.9.3

39
SOURCES/0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From c972993cfa2c96a61e59f4729190e3b68a7651e0 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 21 Jan 2014 19:29:33 +0400
Subject: [PATCH 038/237] 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 <arvidjaar@gmail.com>
+
+ * configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype.
+
2014-01-21 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* 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.9.3

37
SOURCES/0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
From 4342ee0cb790901801df4965b854fcd39cf1548c Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 21 Jan 2014 19:41:11 +0400
Subject: [PATCH 039/237] 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 <arvidjaar@gmail.com>
* configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype.
+ Show detected font path in summary.
2014-01-21 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
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.9.3

62
SOURCES/0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
From 290dac0294fcf7a441e80f10a59ffdea61a1c422 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Tue, 21 Jan 2014 20:54:09 +0400
Subject: [PATCH 040/237] 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 <arvidjaar@gmail.com>
+ * Makefile.am: Allow adding extra files to generated Windows ZIP
+ archive by setting GRUB_WINDOWS_EXTRA_DIST.
+
+2014-01-21 Andrey Borzenkov <arvidjaar@gmail.com>
+
* 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.9.3

38
SOURCES/0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
From 2e763a9ee4ff7ec25c113b15cb41c11a5998505c Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Thu, 23 Jan 2014 12:05:36 +0000
Subject: [PATCH 041/237] * 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 <cjwatson@ubuntu.com>
+
+ * util/grub-install.c (write_to_disk): Add an info message.
+
2014-01-21 Andrey Borzenkov <arvidjaar@gmail.com>
* 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.9.3

109
SOURCES/0042-util-grub-install.c-List-available-targets.patch

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
From 535107794dc13438bd2cd0c298667a0eb430c839 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 24 Jan 2014 18:09:25 +0100
Subject: [PATCH 042/237] * 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 <phcoder@gmail.com>
+
+ * util/grub-install.c: List available targets.
+
2014-01-23 Colin Watson <cjwatson@ubuntu.com>
* 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.9.3

78
SOURCES/0043-Fix-several-translatable-strings.patch

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
From f39c9cfa5cb967d6176ee0d1988c2f1d754e7fec Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 24 Jan 2014 18:20:27 +0100
Subject: [PATCH 043/237] 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 <phcoder@gmail.com>
+ Fix several translatable strings.
+
+ Suggested by: D. Prévot.
+
+2014-01-24 Vladimir Serbinenko <phcoder@gmail.com>
+
* util/grub-install.c: List available targets.
2014-01-23 Colin Watson <cjwatson@ubuntu.com>
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.9.3

75
SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
From d98c0be0194a7c0d618b87293f5fc926c09ee611 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 25 Jan 2014 19:54:51 +0400
Subject: [PATCH 044/237] 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 <arvidjaar@gmail.com>
+
+ * util/grub-mkimage.c: Make prefix argument mandatory.
+
2014-01-24 Vladimir Serbinenko <phcoder@gmail.com>
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/<platform>]"), 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.9.3

108
SOURCES/0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
From 93dbdbb99181cfb0dc87955ddced6e05f18dee92 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sat, 25 Jan 2014 21:49:41 +0400
Subject: [PATCH 045/237] 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 <arvidjaar@gmail.com>
+
+ * 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 <arvidjaar@gmail.com>
* 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.9.3

60
SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
From db5ae694f5e18c847b0e0dbe9a3d2c95239a7d33 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 26 Jan 2014 02:36:05 +0100
Subject: [PATCH 046/237] * 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 <phcoder@gmail.com>
+
+ * 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 <arvidjaar@gmail.com>
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.9.3

55
SOURCES/0047-grub-install-support-for-partitioned-partx-loop-devi.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
From 5fc42eeb85e2971ea777fbe2c95e2b0d384bb86d Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sun, 26 Jan 2014 02:56:04 +0100
Subject: [PATCH 047/237] 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 <floppym@gentoo.org>
+
+ 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 <phcoder@gmail.com>
* 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.9.3

40
SOURCES/0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
From c10ca57b760978f32d1d34d78cda9fd57e1e0bfa Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 26 Jan 2014 03:31:10 +0100
Subject: [PATCH 048/237] * 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 <phcoder@gmail.com>
+
+ * grub-core/term/at_keyboard.c: Tolerate missing keyboard.
+
2014-01-26 Mike Gilbert <floppym@gentoo.org>
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.9.3

73
SOURCES/0049-.gitignore-add-missing-files-and-.exe-variants.patch

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
From 74b69fc18796030dc99ef0a8e55aa8560e431001 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 29 Jan 2014 13:26:00 -0200
Subject: [PATCH 049/237] .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 d37d4a6..a49f5f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-29 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+
+ * .gitignore: add missing files and .exe variants.
+
2014-01-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/at_keyboard.c: Tolerate missing keyboard.
@@ -1113,7 +1117,7 @@
2013-12-14 Vladimir Serbinenko <phcoder@gmail.com>
- * .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 <phcoder@gmail.com>
--
2.9.3

77
SOURCES/0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
From 84dc1cb8eccdebe6529cf9e60f830fb6c57c7706 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:41:48 +0100
Subject: [PATCH 050/237] * util/grub-mkfont.c: Downgrade warnings about
unhandled features to debug.

---
ChangeLog | 9 +++++++++
util/grub-mkfont.c | 14 ++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a49f5f1..9837c7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub-mkfont.c: Downgrade warnings about unhandled features
+ to debug.
+
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/term/at_keyboard.c: Tolerate missing keyboard.
+
2014-01-29 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* .gitignore: add missing files and .exe variants.
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.9.3

57
SOURCES/0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
From 6ff67fe45fcb69a278f5aaeeb5eebff3b7bb6dc2 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:43:25 +0100
Subject: [PATCH 051/237] * 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 9837c7f..51eba95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/ahci.c: Do not enable I/O decoding and keep
+ enabling busmaster for the end.
+
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

55
SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
From d8b18f6b814a830dd1279669e10fb5f714e2138f Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:45:18 +0100
Subject: [PATCH 052/237] * 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 51eba95..9bb1817 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * 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 <phcoder@gmail.com>
+
* 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.9.3

62
SOURCES/0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
From cbe41438563125a6f5aa4225c987b70abda81753 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:46:17 +0100
Subject: [PATCH 053/237] * 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 9bb1817..15300b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/ahci.c: Add safety cleanups.
+
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

54
SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
From d0c3c16e995308838d724775cd8624a69907046e Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:49:51 +0100
Subject: [PATCH 054/237] * 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 15300b0..bc1ab23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/ahci.c: Properly handle transactions with no
+ transferred data.
+
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/ahci.c: Add safety cleanups.
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
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.9.3

42
SOURCES/0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 729607c36706453f0a035aa3261f1c2ff8ee8253 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 29 Jan 2014 23:50:49 +0100
Subject: [PATCH 055/237] * 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 bc1ab23..1a822f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * 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 <phcoder@gmail.com>
+
* 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.9.3

42
SOURCES/0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 1e22128933aa895e18593039c5a70ecb4e081491 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 3 Feb 2014 14:34:27 +0100
Subject: [PATCH 056/237] * 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 1a822f3..f2bba84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-03 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub-mkfont.c: Build fix for argp.h with older gcc.
+
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <argp.h>
+#pragma GCC diagnostic error "-Wmissing-prototypes"
+#pragma GCC diagnostic error "-Wmissing-declarations"
#endif
#include <assert.h>
--
2.9.3

44
SOURCES/0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From 5d3c633229d54d0e3825fe0a9775858a93a664a7 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 3 Feb 2014 14:35:51 +0100
Subject: [PATCH 057/237] * 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 f2bba84..f4a4721 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-02-03 Vladimir Serbinenko <phcoder@gmail.com>
+ * util/grub-mkrescue.c: Build fix for argp.h with older gcc.
+
+2014-02-03 Vladimir Serbinenko <phcoder@gmail.com>
+
* util/grub-mkfont.c: Build fix for argp.h with older gcc.
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
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 <grub/emu/exec.h>
#include <grub/emu/config.h>
#include <grub/emu/hostdisk.h>
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
+#pragma GCC diagnostic error "-Wmissing-prototypes"
+#pragma GCC diagnostic error "-Wmissing-declarations"
#include <sys/types.h>
#include <sys/wait.h>
--
2.9.3

199
SOURCES/0058-add-grub_env_set_net_property-function.patch

@ -0,0 +1,199 @@ @@ -0,0 +1,199 @@
From dfbcd97b4207c2684fdf3cfe4292e0c96c65eed2 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 4 Feb 2014 18:41:38 -0200
Subject: [PATCH 058/237] 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 f4a4721..63f5aa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-04 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+
+ 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 <phcoder@gmail.com>
* 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 <grub/net/udp.h>
#include <grub/datetime.h>
-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.9.3

211
SOURCES/0059-add-bootpath-parser-for-open-firmware.patch

@ -0,0 +1,211 @@ @@ -0,0 +1,211 @@
From f44c6a2cdb0e1c211fd5effb78c70c12e6da2006 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 4 Feb 2014 19:00:55 -0200
Subject: [PATCH 059/237] 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 63f5aa3..5237631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2014-02-04 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+ 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 <pfsmorigo@br.ibm.com>
+
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.9.3

40
SOURCES/0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
From d92788a92466b22fb10c2d3f6c9c68d0002227b3 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Thu, 20 Feb 2014 10:11:43 +0100
Subject: [PATCH 060/237] * 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 5237631..be41aa5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-20 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI
+ exclusively.
+
2014-02-04 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
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.9.3

82
SOURCES/0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
From 22a8b7bb4c77ba1ef1833e0dae052c108180250f Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 28 Feb 2014 09:47:57 +0100
Subject: [PATCH 061/237] * 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 be41aa5..4f6f6d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000
+ region.
+
2014-02-20 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

42
SOURCES/0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 2e42389be6fe6bb026a41fddae4bbce70658fdc9 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 28 Feb 2014 09:48:57 +0100
Subject: [PATCH 062/237] * 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 4f6f6d6..bbaed26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit
+ location to 640K.
+
+2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

47
SOURCES/0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
From 623002084c7550214ae9740547a557ffb31c3658 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 28 Feb 2014 09:50:47 +0100
Subject: [PATCH 063/237] * 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 bbaed26..6ed6cf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low
+ tables for low memory calculations.
+
+2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

88
SOURCES/0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch

@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
From dd0a4f1120118f08a4d760ceec511238321779f8 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 28 Feb 2014 10:07:11 +0100
Subject: [PATCH 064/237] * 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 6ed6cf4..97cf57e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
+ if E820 failed to return any regions.
+
+2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

70
SOURCES/0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
From 738e0c73073b27de660696d32c2030bc683de2a2 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 28 Feb 2014 10:50:05 +0100
Subject: [PATCH 065/237] * 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 97cf57e..f571f66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
+ * 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 <phcoder@gmail.com>
+
* 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.9.3

33
SOURCES/0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
From 735117103884aaa27fe4875ef556b2d17cfe107e Mon Sep 17 00:00:00 2001
From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Date: Thu, 20 Mar 2014 16:57:12 +0530
Subject: [PATCH 066/237] 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 <nikunj@linux.vnet.ibm.com>
---
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.9.3

39
SOURCES/0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 234e316455c92875f3cc7d35f11da7f7a4d3cb6b Mon Sep 17 00:00:00 2001
From: Fu Wei <fu.wei@linaro.org>
Date: Wed, 26 Mar 2014 08:13:07 +0100
Subject: [PATCH 067/237] * 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 f571f66..091535b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-26 Fu Wei <fu.wei@linaro.org>
+
+ * grub-core/loader/arm64/linux.c: Remove redundant "0x".
+
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

39
SOURCES/0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From aadd7669d805fcd510687ba5d0ca9e78c2d88a93 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 26 Mar 2014 08:48:30 +0100
Subject: [PATCH 068/237] * 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 091535b..9404eda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-26 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/lib/relocator.c: Fix the case when end of leftover is used.
+
2014-03-26 Fu Wei <fu.wei@linaro.org>
* 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.9.3

55
SOURCES/0069-Fix-grub-probe-0-option.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
From cf7c88c63e219f906d058b71f889264ac8e3bc3b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 31 Mar 2014 13:51:17 +0100
Subject: [PATCH 069/237] 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 9404eda..efbed8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-31 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/grub-probe,c (options): Make -0 work again (broken by
+ conversion to argp).
+ (main): Simplify logic.
+
2014-03-26 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

366
SOURCES/0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch

@ -0,0 +1,366 @@ @@ -0,0 +1,366 @@
From 0ec41b585c1cc4dfa79f880d3a62c72bc5f24d22 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 31 Mar 2014 14:48:33 +0100
Subject: [PATCH 070/237] 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 efbed8c..1cb3b68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,30 @@
2014-03-31 Colin Watson <cjwatson@ubuntu.com>
+ 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 <cjwatson@ubuntu.com>
+
* 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.9.3

44
SOURCES/0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From a1fee7dd97762ecc39a9b74c7c0fcc97df0fcca7 Mon Sep 17 00:00:00 2001
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Mon, 31 Mar 2014 15:32:30 +0100
Subject: [PATCH 071/237] 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 1cb3b68..accffad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-31 Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
+
+ 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 <cjwatson@ubuntu.com>
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.9.3

55
SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
From 07122fa30773a0668180fd187989477421235afa Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Apr 2014 21:31:12 +0200
Subject: [PATCH 072/237] * 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 accffad..4a48409 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-03 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
+ device names.
+
2014-03-31 Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
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.9.3

102
SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch

@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
From b9f76056507285b672cb5b3ec7317cae24863e6a Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 4 Apr 2014 07:58:42 +0200
Subject: [PATCH 073/237] 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 4a48409..f18cdba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-04 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Replace few instances of memcmp/memcpy in the code that should be
+ grub_memcmp/grub_memcpy.
+
2014-04-03 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

47
SOURCES/0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
From c47197b3425d1629d6633ffff8fd1e81f8321119 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 4 Apr 2014 08:02:38 +0200
Subject: [PATCH 074/237] * 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 f18cdba..90e41bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-04-04 Vladimir Serbinenko <phcoder@gmail.com>
+ * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer
+ pulled from libgcc.
+
+2014-04-04 Vladimir Serbinenko <phcoder@gmail.com>
+
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.9.3

24
SOURCES/0075-Add-missing-endif.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
From df0d554f4b8fc76de44f34aaa6ed47b3501e5fc4 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 4 Apr 2014 08:11:15 +0200
Subject: [PATCH 075/237] 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.9.3

39
SOURCES/0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From d47063b3fdf1acb1028893751ca98f764a0ac39b Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 6 Apr 2014 00:44:44 +0200
Subject: [PATCH 076/237] * 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 90e41bd..50d9291 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-06 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/lib/syslinux_parse.c: Fix timeout quoting.
+
2014-04-04 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

45
SOURCES/0077-Improve-LVM-logical_volumes-string-matching.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
From 6539eeb60268e646ca9f99a6ba8967c8fcb55807 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Thu, 10 Apr 2014 14:42:41 +0100
Subject: [PATCH 077/237] 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 50d9291..7f0c57d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-10 Colin Watson <cjwatson@ubuntu.com>
+
+ * grub-core/disk/lvm.c (grub_lvm_detect): Search for
+ "logical_volumes" block a little more accurately.
+
2014-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

83
SOURCES/0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
From 6eb6afd8f913c6e2da737d42c6561aacc3873c84 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Thu, 10 Apr 2014 16:54:33 +0100
Subject: [PATCH 078/237] 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 7f0c57d..3556468 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2014-04-10 Colin Watson <cjwatson@ubuntu.com>
+ * 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 <cjwatson@ubuntu.com>
+
* 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.9.3

49
SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
From 9889cf801bb7e8b70a249873a9c8254ac6ef8a39 Mon Sep 17 00:00:00 2001
From: Piotr Krysiuk <piotras@gmail.com>
Date: Sun, 20 Apr 2014 15:58:45 +0200
Subject: [PATCH 079/237] 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 3556468..73a8928 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-20 Piotr Krysiuk <piotras@gmail.com>
+
+ * grub-core/lib/i386/relocator.c: Allow loading old kernels by placing
+ GDT in conventional memory.
+
2014-04-10 Colin Watson <cjwatson@ubuntu.com>
* 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.9.3

43
SOURCES/0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From ad3da599d5735859d141ecb8cb9a31f126cd6aa5 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 20 Apr 2014 16:12:41 +0200
Subject: [PATCH 080/237] * grub-core/kern/misc.c (__bzero): Don't compile in
GRUB_UTIL.

Reported by: Yves Blusseau <blusseau@zetam.org>.
---
ChangeLog | 6 ++++++
grub-core/kern/misc.c | 3 +++
2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 73a8928..3b61c0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-20 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL.
+
+ Reported by: Yves Blusseau <blusseau@zetam.org>.
+
2014-04-20 Piotr Krysiuk <piotras@gmail.com>
* 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.9.3

40
SOURCES/0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
From 650ec2a7667e0a06ab4af1030d1a4e3832ac48c6 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 12 May 2014 10:01:48 +0200
Subject: [PATCH 081/237] * 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 3b61c0a..d0896d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-21 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk
+ check.
+
2014-04-20 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

43
SOURCES/0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From 34115409b23070d7f50ef990498af89d067d34e1 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Thu, 15 May 2014 14:36:48 +0200
Subject: [PATCH 082/237] * 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 d0896d8..2a94ad9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-06-21 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/commands/verify.c (grub_pubkey_open): Trust procfs.
+
+2014-06-21 Vladimir Serbinenko <phcoder@gmail.com>
+
* 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.9.3

73
SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
From 002c7908388cea822217b6a907de419676d6e4b8 Mon Sep 17 00:00:00 2001
From: Trevor Woerner <trevor.woerner@linaro.org>
Date: Sat, 21 Jun 2014 20:26:47 +0200
Subject: [PATCH 083/237] * 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 2a94ad9..b552113 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-21 Trevor Woerner <trevor.woerner@linaro.org>
+
+ * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable.
+
2014-06-21 Vladimir Serbinenko <phcoder@gmail.com>
* 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.9.3

39
SOURCES/0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 4dec12a88ad4473d82a851eadb9eb88c6aa7419a Mon Sep 17 00:00:00 2001
From: Stephane Rochoy <sheda>
Date: Sun, 22 Jun 2014 01:34:57 +0200
Subject: [PATCH 084/237] * 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 b552113..abf8f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-21 Stephane Rochoy <sheda>
+
+ * grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show
+ EFI system table physical address.
+
2014-06-21 Trevor Woerner <trevor.woerner@linaro.org>
* 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.9.3

72
SOURCES/0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
From 0df1a50e41fb12fbeb6709575e5f12d64ed73b66 Mon Sep 17 00:00:00 2001
From: Stephane Rochoy <sheda>
Date: Sun, 22 Jun 2014 01:35:52 +0200
Subject: [PATCH 085/237] * 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 abf8f4b..0cdd095 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-06-21 Stephane Rochoy <sheda>
+ * grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to
+ EFI system table.
+
+2014-06-21 Stephane Rochoy <sheda>
+
* 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.9.3

46
SOURCES/0086-util-grub-install.c-Fix-handling-of-disk-module.patch

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
From c4640480f1a6a5eefcfcb8f82fbc8680c2f2989b Mon Sep 17 00:00:00 2001
From: Glenn Washburn <development@efficientek.com>
Date: Sun, 22 Jun 2014 01:45:11 +0200
Subject: [PATCH 086/237] * 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 0cdd095..4ce6643 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-21 Glenn Washburn <development@efficientek.com>
+
+ * util/grub-install.c: Fix handling of --disk-module.
+
2014-06-21 Stephane Rochoy <sheda>
* 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.9.3

58
SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
From 4895a5f05df22facb04bb1363fc63feff06a6ee0 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?= <roman_pekhov>
Date: Sun, 22 Jun 2014 03:51:50 +0400
Subject: [PATCH 087/237] * 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 4ce6643..a2da974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-21 Роман Пехов <roman_pekhov>
+
+ * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.
+
2014-06-21 Glenn Washburn <development@efficientek.com>
* 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.9.3

26
SOURCES/0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
From 3030e71cb8687cd628d8f03a80fb4aa4a601bec1 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sat, 28 Dec 2013 02:20:27 +0000
Subject: [PATCH 088/237] * NEWS: The cmosclean command in fact dates back to
1.99. Remove mention of it from 2.02.

---
NEWS | 2 ++
1 file changed, 2 insertions(+)

diff --git a/NEWS b/NEWS
index a61df94..f621c65 100644
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,8 @@ New in 2.02:
* New `efifwsetup' and `lsefi' commands on EFI platforms.
* New `cmosdump' and `cmosset' commands on platforms with CMOS support.
* New command `pcidump' for PCI platforms.
+ * 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.
--
2.9.3

154
SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch

@ -0,0 +1,154 @@ @@ -0,0 +1,154 @@
From 8cb1eca9733253479c1ee24b34c03fee596b716e Mon Sep 17 00:00:00 2001
From: Mark Hamzy <hamzy@us.ibm.com>
Date: Wed, 28 Mar 2012 14:46:41 -0500
Subject: [PATCH 089/237] 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.
---
Makefile.util.def | 7 +++
util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+)
create mode 100644 util/grub.d/20_ppc_terminfo.in

diff --git a/Makefile.util.def b/Makefile.util.def
index a286a89..8f40e78 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -485,6 +485,13 @@ script = {
};
script = {
+ name = '20_ppc_terminfo';
+ common = util/grub.d/20_ppc_terminfo.in;
+ installdir = grubconf;
+ condition = COND_HOST_LINUX;
+};
+
+script = {
name = '30_os-prober';
common = util/grub.d/30_os-prober.in;
installdir = grubconf;
diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
new file mode 100644
index 0000000..10d6658
--- /dev/null
+++ b/util/grub.d/20_ppc_terminfo.in
@@ -0,0 +1,114 @@
+#! /bin/sh
+set -e
+
+# grub-mkconfig helper script.
+# Copyright (C) 2006,2007,2008,2009,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 <http://www.gnu.org/licenses/>.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libdir=@libdir@
+. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
+
+export TEXTDOMAIN=@PACKAGE@
+export TEXTDOMAINDIR=@localedir@
+
+X=80
+Y=24
+TERMINAL=ofconsole
+
+argument () {
+ opt=$1
+ shift
+
+ if test $# -eq 0; then
+ echo "$0: option requires an argument -- '$opt'" 1>&2
+ exit 1
+ fi
+ echo $1
+}
+
+check_terminfo () {
+
+ while test $# -gt 0
+ do
+ option=$1
+ shift
+
+ case "$option" in
+ terminfo | TERMINFO)
+ ;;
+
+ -g)
+ NEWXY=`argument $option "$@"`
+ NEWX=`echo $NEWXY | cut -d x -f 1`
+ NEWY=`echo $NEWXY | cut -d x -f 2`
+
+ if [ ${NEWX} -ge 80 ] ; then
+ X=${NEWX}
+ else
+ echo "Warning: ${NEWX} is less than the minimum size of 80"
+ fi
+
+ if [ ${NEWY} -ge 24 ] ; then
+ Y=${NEWY}
+ else
+ echo "Warning: ${NEWY} is less than the minimum size of 24"
+ fi
+
+ shift
+ ;;
+
+ *)
+# # accept console or ofconsole
+# if [ "$option" != "console" -a "$option" != "ofconsole" ] ; then
+# echo "Error: GRUB_TERMINFO unknown console: $option"
+# exit 1
+# fi
+# # perfer console
+# TERMINAL=console
+ # accept ofconsole
+ if [ "$option" != "ofconsole" ] ; then
+ echo "Error: GRUB_TERMINFO unknown console: $option"
+ exit 1
+ fi
+ # perfer console
+ TERMINAL=ofconsole
+ ;;
+ esac
+
+ done
+
+}
+
+if ! uname -m | grep -q ppc ; then
+ exit 0
+fi
+
+if [ "x${GRUB_TERMINFO}" != "x" ] ; then
+ F1=`echo ${GRUB_TERMINFO} | cut -d " " -f 1`
+
+ if [ "${F1}" != "terminfo" ] ; then
+ echo "Error: GRUB_TERMINFO is set to \"${GRUB_TERMINFO}\" The first word should be terminfo."
+ exit 1
+ fi
+
+ check_terminfo ${GRUB_TERMINFO}
+fi
+
+cat << EOF
+ terminfo -g ${X}x${Y} ${TERMINAL}
+EOF
--
2.9.3

81
SOURCES/0090-Add-fw_path-variable-revised.patch

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
From 622dd3cf5628440c92f4da46c40f39639d7e98e8 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 19 Sep 2012 21:22:55 -0300
Subject: [PATCH 090/237] 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
"No modules are loaded on grub2 network boot" issue:

https://bugzilla.redhat.com/show_bug.cgi?id=857936
---
grub-core/kern/main.c | 13 ++++++-------
grub-core/normal/main.c | 25 ++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 9cad0c4..8ab7794 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -127,16 +127,15 @@ grub_set_prefix_and_root (void)
grub_machine_get_bootlocation (&fwdevice, &fwpath);
- if (fwdevice)
+ if (fwdevice && fwpath)
{
- char *cmdpath;
+ char *fw_path;
- cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
- if (cmdpath)
+ fw_path = grub_xasprintf ("(%s)/%s", fwdevice, fwpath);
+ if (fw_path)
{
- grub_env_set ("cmdpath", cmdpath);
- grub_env_export ("cmdpath");
- grub_free (cmdpath);
+ grub_env_set ("fw_path", fw_path);
+ grub_free (fw_path);
}
}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 3a926fc..6f4970f 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -319,7 +319,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
/* Guess the config filename. It is necessary to make CONFIG static,
so that it won't get broken by longjmp. */
char *config;
- const char *prefix;
+ const char *prefix, *fw_path;
+
+ fw_path = grub_env_get ("fw_path");
+ if (fw_path)
+ {
+ config = grub_xasprintf ("%s/grub.cfg", fw_path);
+ if (config)
+ {
+ grub_file_t file;
+
+ file = grub_file_open (config);
+ if (file)
+ {
+ grub_file_close (file);
+ grub_enter_normal_mode (config);
+ }
+ else
+ {
+ /* Ignore all errors. */
+ grub_errno = 0;
+ }
+ grub_free (config);
+ }
+ }
prefix = grub_env_get ("prefix");
if (prefix)
--
2.9.3

482
SOURCES/0091-Add-support-for-linuxefi.patch

@ -0,0 +1,482 @@ @@ -0,0 +1,482 @@
From cb8ffd0f744e6ed0f5ba50d5bb7c7b2795ce9a8f Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Tue, 10 Jul 2012 11:58:52 -0400
Subject: [PATCH 091/237] Add support for linuxefi

---
grub-core/Makefile.core.def | 8 +
grub-core/kern/efi/mm.c | 32 ++++
grub-core/loader/i386/efi/linux.c | 371 ++++++++++++++++++++++++++++++++++++++
include/grub/efi/efi.h | 3 +
include/grub/i386/linux.h | 1 +
5 files changed, 415 insertions(+)
create mode 100644 grub-core/loader/i386/efi/linux.c

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 42443bc..ec46506 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1706,6 +1706,14 @@ module = {
};
module = {
+ name = linuxefi;
+ efi = loader/i386/efi/linux.c;
+ efi = lib/cmdline.c;
+ enable = i386_efi;
+ enable = x86_64_efi;
+};
+
+module = {
name = chain;
efi = loader/efi/chainloader.c;
i386_pc = loader/i386/pc/chainloader.c;
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index be37afd..ddeca60 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size;
static grub_efi_uint32_t finish_desc_version;
int grub_efi_is_finished = 0;
+/* Allocate pages below a specified address */
+void *
+grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
+ grub_efi_uintn_t pages)
+{
+ grub_efi_status_t status;
+ grub_efi_boot_services_t *b;
+ grub_efi_physical_address_t address = max;
+
+ if (max > 0xffffffff)
+ return 0;
+
+ b = grub_efi_system_table->boot_services;
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
+
+ if (address == 0)
+ {
+ /* Uggh, the address 0 was allocated... This is too annoying,
+ so reallocate another one. */
+ address = max;
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+ grub_efi_free_pages (0, pages);
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
+ }
+
+ return (void *) ((grub_addr_t) address);
+}
+
/* Allocate pages. Return the pointer to the first of allocated pages. */
void *
grub_efi_allocate_pages (grub_efi_physical_address_t address,
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
new file mode 100644
index 0000000..b79e632
--- /dev/null
+++ b/grub-core/loader/i386/efi/linux.c
@@ -0,0 +1,371 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2012 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/loader.h>
+#include <grub/file.h>
+#include <grub/err.h>
+#include <grub/types.h>
+#include <grub/mm.h>
+#include <grub/cpu/linux.h>
+#include <grub/command.h>
+#include <grub/i18n.h>
+#include <grub/lib/cmdline.h>
+#include <grub/efi/efi.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_dl_t my_mod;
+static int loaded;
+static void *kernel_mem;
+static grub_uint64_t kernel_size;
+static grub_uint8_t *initrd_mem;
+static grub_uint32_t handover_offset;
+struct linux_kernel_params *params;
+static char *linux_cmdline;
+
+#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
+
+#define SHIM_LOCK_GUID \
+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
+
+struct grub_efi_shim_lock
+{
+ grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
+};
+typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
+
+static grub_efi_boolean_t
+grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
+{
+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
+ grub_efi_shim_lock_t *shim_lock;
+
+ shim_lock = grub_efi_locate_protocol(&guid, NULL);
+
+ if (!shim_lock)
+ return 1;
+
+ if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
+ return 1;
+
+ return 0;
+}
+
+typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
+
+static grub_err_t
+grub_linuxefi_boot (void)
+{
+ handover_func hf;
+ int offset = 0;
+
+#ifdef __x86_64__
+ offset = 512;
+#endif
+
+ hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
+
+ asm volatile ("cli");
+
+ hf (grub_efi_image_handle, grub_efi_system_table, params);
+
+ /* Not reached */
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_linuxefi_unload (void)
+{
+ grub_dl_unref (my_mod);
+ loaded = 0;
+ if (initrd_mem)
+ grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size));
+ if (linux_cmdline)
+ grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1));
+ if (kernel_mem)
+ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
+ if (params)
+ grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ int argc, char *argv[])
+{
+ grub_file_t *files = 0;
+ int i, nfiles = 0;
+ grub_size_t size = 0;
+ grub_uint8_t *ptr;
+
+ if (argc == 0)
+ {
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+ goto fail;
+ }
+
+ if (!loaded)
+ {
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
+ goto fail;
+ }
+
+ files = grub_zalloc (argc * sizeof (files[0]));
+ if (!files)
+ goto fail;
+
+ for (i = 0; i < argc; i++)
+ {
+ grub_file_filter_disable_compression ();
+ files[i] = grub_file_open (argv[i]);
+ if (! files[i])
+ goto fail;
+ nfiles++;
+ size += ALIGN_UP (grub_file_size (files[i]), 4);
+ }
+
+ initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
+
+ if (!initrd_mem)
+ {
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
+ goto fail;
+ }
+
+ params->ramdisk_size = size;
+ params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem;
+
+ ptr = initrd_mem;
+
+ for (i = 0; i < nfiles; i++)
+ {
+ grub_ssize_t cursize = grub_file_size (files[i]);
+ if (grub_file_read (files[i], ptr, cursize) != cursize)
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ argv[i]);
+ goto fail;
+ }
+ ptr += cursize;
+ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
+ ptr += ALIGN_UP_OVERHEAD (cursize, 4);
+ }
+
+ params->ramdisk_size = size;
+
+ fail:
+ for (i = 0; i < nfiles; i++)
+ grub_file_close (files[i]);
+ grub_free (files);
+
+ if (initrd_mem && grub_errno)
+ grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(size));
+
+ return grub_errno;
+}
+
+static grub_err_t
+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ int argc, char *argv[])
+{
+ grub_file_t file = 0;
+ struct linux_kernel_header lh;
+ grub_ssize_t len, start, filelen;
+ void *kernel;
+
+ grub_dl_ref (my_mod);
+
+ if (argc == 0)
+ {
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+ goto fail;
+ }
+
+ file = grub_file_open (argv[0]);
+ if (! file)
+ goto fail;
+
+ filelen = grub_file_size (file);
+
+ kernel = grub_malloc(filelen);
+
+ if (!kernel)
+ {
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
+ goto fail;
+ }
+
+ if (grub_file_read (file, kernel, filelen) != filelen)
+ {
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
+ goto fail;
+ }
+
+ if (! grub_linuxefi_secure_validate (kernel, filelen))
+ {
+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
+ grub_free (kernel);
+ goto fail;
+ }
+
+ grub_file_seek (file, 0);
+
+ grub_free(kernel);
+
+ params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384));
+
+ if (! params)
+ {
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
+ goto fail;
+ }
+
+ memset (params, 0, 16384);
+
+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ goto fail;
+ }
+
+ if (lh.boot_flag != grub_cpu_to_le16 (0xaa55))
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number"));
+ goto fail;
+ }
+
+ if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors"));
+ goto fail;
+ }
+
+ if (lh.version < grub_cpu_to_le16 (0x020b))
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("kernel too old"));
+ goto fail;
+ }
+
+ if (!lh.handover_offset)
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover"));
+ goto fail;
+ }
+
+ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
+
+ if (!linux_cmdline)
+ {
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
+ goto fail;
+ }
+
+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
+ grub_create_loader_cmdline (argc, argv,
+ linux_cmdline + sizeof (LINUX_IMAGE) - 1,
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
+
+ lh.cmd_line_ptr = (grub_uint32_t)(grub_uint64_t)linux_cmdline;
+
+ handover_offset = lh.handover_offset;
+
+ start = (lh.setup_sects + 1) * 512;
+ len = grub_file_size(file) - start;
+
+ kernel_mem = grub_efi_allocate_pages(lh.pref_address,
+ BYTES_TO_PAGES(lh.init_size));
+
+ if (!kernel_mem)
+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
+ BYTES_TO_PAGES(lh.init_size));
+
+ if (!kernel_mem)
+ {
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
+ goto fail;
+ }
+
+ if (grub_file_seek (file, start) == (grub_off_t) -1)
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ goto fail;
+ }
+
+ if (grub_file_read (file, kernel_mem, len) != len && !grub_errno)
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ }
+
+ if (grub_errno == GRUB_ERR_NONE)
+ {
+ grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0);
+ loaded = 1;
+ lh.code32_start = (grub_uint32_t)(grub_uint64_t) kernel_mem;
+ }
+
+ memcpy(params, &lh, 2 * 512);
+
+ params->type_of_loader = 0x21;
+
+ fail:
+
+ if (file)
+ grub_file_close (file);
+
+ if (grub_errno != GRUB_ERR_NONE)
+ {
+ grub_dl_unref (my_mod);
+ loaded = 0;
+ }
+
+ if (linux_cmdline && !loaded)
+ grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1));
+
+ if (kernel_mem && !loaded)
+ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
+
+ if (params && !loaded)
+ grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
+
+ return grub_errno;
+}
+
+static grub_command_t cmd_linux, cmd_initrd;
+
+GRUB_MOD_INIT(linuxefi)
+{
+ cmd_linux =
+ grub_register_command ("linuxefi", grub_cmd_linux,
+ 0, N_("Load Linux."));
+ cmd_initrd =
+ grub_register_command ("initrdefi", grub_cmd_initrd,
+ 0, N_("Load initrd."));
+ my_mod = mod;
+}
+
+GRUB_MOD_FINI(linuxefi)
+{
+ grub_unregister_command (cmd_linux);
+ grub_unregister_command (cmd_initrd);
+}
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 489cf9e..9370fd5 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
void *
EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
+void *
+EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max,
+ grub_efi_uintn_t pages);
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
int
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
index da0ca3b..fc36bda 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -139,6 +139,7 @@ struct linux_kernel_header
grub_uint64_t setup_data;
grub_uint64_t pref_address;
grub_uint32_t init_size;
+ grub_uint32_t handover_offset;
} GRUB_PACKED;
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
--
2.9.3

50
SOURCES/0092-Use-linuxefi-and-initrdefi-where-appropriate.patch

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
From 7e496ebf185783ac12c0d85af7a734222ba98a65 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 16 Jul 2012 18:57:11 -0400
Subject: [PATCH 092/237] Use "linuxefi" and "initrdefi" where appropriate.

---
util/grub.d/10_linux.in | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 00d1931..ad34cc0 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -127,17 +127,31 @@ linux_entry ()
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
message="$(gettext_printf "Loading Linux %s ..." ${version})"
- sed "s/^/$submenu_indentation/" << EOF
+ if [ -d /sys/firmware/efi ]; then
+ sed "s/^/$submenu_indentation/" << EOF
+ echo '$(echo "$message" | grub_quote)'
+ linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+EOF
+ else
+ sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
+ fi
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
- sed "s/^/$submenu_indentation/" << EOF
+ if [ -d /sys/firmware/efi ]; then
+ sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
+ initrdefi ${rel_dirname}/${initrd}
+EOF
+ else
+ sed "s/^/$submenu_indentation/" << EOF
+ echo '$message'
initrd ${rel_dirname}/${initrd}
EOF
+ fi
fi
sed "s/^/$submenu_indentation/" << EOF
}
--
2.9.3

117
SOURCES/0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
From a97e6dbf00fa02e1a8fdf178ed4d1081864b9294 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 23 Oct 2012 10:40:49 -0400
Subject: [PATCH 093/237] Don't allow insmod when secure boot is enabled.

Hi,

Fedora's patch to forbid insmod in UEFI Secure Boot environments is fine
as far as it goes. However, the insmod command is not the only way that
modules can be loaded. In particular, the 'normal' command, which
implements the usual GRUB menu and the fully-featured command prompt,
will implicitly load commands not currently loaded into memory. This
permits trivial Secure Boot violations by writing commands implementing
whatever you want to do and pointing $prefix at the malicious code.

I'm currently test-building this patch (replacing your current
grub-2.00-no-insmod-on-sb.patch), but this should be more correct. It
moves the check into grub_dl_load_file.
---
grub-core/kern/dl.c | 21 +++++++++++++++++++++
grub-core/kern/efi/efi.c | 28 ++++++++++++++++++++++++++++
include/grub/efi/efi.h | 1 +
3 files changed, 50 insertions(+)

diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 6850e04..b0b0405 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -38,6 +38,14 @@
#define GRUB_MODULES_MACHINE_READONLY
#endif
+#ifdef GRUB_MACHINE_EMU
+#include <sys/mman.h>
+#endif
+
+#ifdef GRUB_MACHINE_EFI
+#include <grub/efi/efi.h>
+#endif
+
#pragma GCC diagnostic ignored "-Wcast-align"
@@ -680,6 +688,19 @@ grub_dl_load_file (const char *filename)
void *core = 0;
grub_dl_t mod = 0;
+#ifdef GRUB_MACHINE_EFI
+ if (grub_efi_secure_boot ())
+ {
+#if 0
+ /* This is an error, but grub2-mkconfig still generates a pile of
+ * insmod commands, so emitting it would be mostly just obnoxious. */
+ grub_error (GRUB_ERR_ACCESS_DENIED,
+ "Secure Boot forbids loading module from %s", filename);
+#endif
+ return 0;
+ }
+#endif
+
grub_boot_time ("Loading module %s", filename);
file = grub_file_open (filename);
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index b9eb1ab..cd839cc 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -259,6 +259,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
return NULL;
}
+grub_efi_boolean_t
+grub_efi_secure_boot (void)
+{
+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+ grub_size_t datasize;
+ char *secure_boot = NULL;
+ char *setup_mode = NULL;
+ grub_efi_boolean_t ret = 0;
+
+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
+
+ if (datasize != 1 || !secure_boot)
+ goto out;
+
+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
+
+ if (datasize != 1 || !setup_mode)
+ goto out;
+
+ if (*secure_boot && !*setup_mode)
+ ret = 1;
+
+ out:
+ grub_free (secure_boot);
+ grub_free (setup_mode);
+ return ret;
+}
+
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 9370fd5..a000c38 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -72,6 +72,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
const grub_efi_guid_t *guid,
void *data,
grub_size_t datasize);
+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
int
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
const grub_efi_device_path_t *dp2);
--
2.9.3

183
SOURCES/0094-Pass-x-hex-hex-straight-through-unmolested.patch

@ -0,0 +1,183 @@ @@ -0,0 +1,183 @@
From 652311cb4bd9ded7ab15b2c9805988c464fe21c8 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 1 Oct 2012 13:24:37 -0400
Subject: [PATCH 094/237] Pass "\x[[:hex:]][[:hex:]]" straight through
unmolested.

---
grub-core/commands/wildcard.c | 16 +++++++++++++++-
grub-core/lib/cmdline.c | 34 ++++++++++++++++++++++++++++++++--
grub-core/script/execute.c | 43 +++++++++++++++++++++++++++++++++++++------
3 files changed, 84 insertions(+), 9 deletions(-)

diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
index 2807f80..0f40e04 100644
--- a/grub-core/commands/wildcard.c
+++ b/grub-core/commands/wildcard.c
@@ -458,6 +458,12 @@ check_file (const char *dir, const char *basename)
return ctx.found;
}
+static int
+is_hex(char c)
+{
+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
+}
+
static void
unescape (char *out, const char *in, const char *end)
{
@@ -466,7 +472,15 @@ unescape (char *out, const char *in, const char *end)
for (optr = out, iptr = in; iptr < end;)
{
- if (*iptr == '\\' && iptr + 1 < end)
+ if (*iptr == '\\' && iptr + 3 < end && iptr[1] == 'x' && is_hex(iptr[2]) && is_hex(iptr[3]))
+ {
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ continue;
+ }
+ else if (*iptr == '\\' && iptr + 1 < end)
{
*optr++ = iptr[1];
iptr += 2;
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index d5e10ee..0a5b2af 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -20,6 +20,12 @@
#include <grub/lib/cmdline.h>
#include <grub/misc.h>
+static int
+is_hex(char c)
+{
+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
+}
+
static unsigned int check_arg (char *c, int *has_space)
{
int space = 0;
@@ -27,7 +33,13 @@ static unsigned int check_arg (char *c, int *has_space)
while (*c)
{
- if (*c == '\\' || *c == '\'' || *c == '"')
+ if (*c == '\\' && *(c+1) == 'x' && is_hex(*(c+2)) && is_hex(*(c+3)))
+ {
+ size += 4;
+ c += 4;
+ continue;
+ }
+ else if (*c == '\\' || *c == '\'' || *c == '"')
size++;
else if (*c == ' ')
space = 1;
@@ -85,7 +97,25 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
while (*c)
{
- if (*c == '\\' || *c == '\'' || *c == '"')
+ if (*c == ' ')
+ {
+ *buf++ = '\\';
+ *buf++ = 'x';
+ *buf++ = '2';
+ *buf++ = '0';
+ c++;
+ continue;
+ }
+ else if (*c == '\\' && *(c+1) == 'x' &&
+ is_hex(*(c+2)) && is_hex(*(c+3)))
+ {
+ *buf++ = *c++;
+ *buf++ = *c++;
+ *buf++ = *c++;
+ *buf++ = *c++;
+ continue;
+ }
+ else if (*c == '\\' || *c == '\'' || *c == '"')
*buf++ = '\\';
*buf++ = *c;
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index afd5513..8f01c1b 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -52,6 +52,12 @@ static struct grub_script_scope *scope = 0;
/* Wildcard translator for GRUB script. */
struct grub_script_wildcard_translator *grub_wildcard_translator;
+static int
+is_hex(char c)
+{
+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
+}
+
static char*
wildcard_escape (const char *s)
{
@@ -68,7 +74,15 @@ wildcard_escape (const char *s)
i = 0;
while ((ch = *s++))
{
- if (ch == '*' || ch == '\\' || ch == '?')
+ if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
+ {
+ p[i++] = ch;
+ p[i++] = *s++;
+ p[i++] = *s++;
+ p[i++] = *s++;
+ continue;
+ }
+ else if (ch == '*' || ch == '\\' || ch == '?')
p[i++] = '\\';
p[i++] = ch;
}
@@ -92,7 +106,14 @@ wildcard_unescape (const char *s)
i = 0;
while ((ch = *s++))
{
- if (ch == '\\')
+ if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
+ {
+ p[i++] = '\\';
+ p[i++] = *s++;
+ p[i++] = *s++;
+ p[i++] = *s++;
+ }
+ else if (ch == '\\')
p[i++] = *s++;
else
p[i++] = ch;
@@ -394,10 +415,20 @@ parse_string (const char *str,
switch (*ptr)
{
case '\\':
- escaped = !escaped;
- if (!escaped && put)
- *(put++) = '\\';
- ptr++;
+ if (!escaped && put && *(ptr+1) == 'x' && is_hex(*(ptr+2)) && is_hex(*(ptr+3)))
+ {
+ *(put++) = *ptr++;
+ *(put++) = *ptr++;
+ *(put++) = *ptr++;
+ *(put++) = *ptr++;
+ }
+ else
+ {
+ escaped = !escaped;
+ if (!escaped && put)
+ *(put++) = '\\';
+ ptr++;
+ }
break;
case '$':
if (escaped)
--
2.9.3

28
SOURCES/0095-Fix-crash-on-http.patch

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
From b01ecf0925ea952e2febb4a50f84f45c7b60ada3 Mon Sep 17 00:00:00 2001
From: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
Date: Tue, 25 Sep 2012 18:40:55 -0400
Subject: [PATCH 095/237] 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.
https://bugzilla.redhat.com/show_bug.cgi?id=860834
---
grub-core/net/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index 4684f8b..ef9538c 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -393,7 +393,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
data->sock = grub_net_tcp_open (file->device->net->server,
HTTP_PORT, http_receive,
- http_err, http_err,
+ http_err, NULL,
file);
if (!data->sock)
{
--
2.9.3

174
SOURCES/0096-IBM-client-architecture-CAS-reboot-support.patch

@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
From 37c27f14658c4a9c239343397100c187c5eba434 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Thu, 20 Sep 2012 18:07:39 -0300
Subject: [PATCH 096/237] IBM client architecture (CAS) reboot support

This is an implementation of IBM client architecture (CAS) reboot for GRUB.

There are cases where the POWER firmware must reboot in order to support
specific features requested by a kernel. The kernel calls
ibm,client-architecture-support and it may either return or reboot with the new
feature set. eg:

Calling ibm,client-architecture-support.../
Elapsed time since release of system processors: 70959 mins 50 secs
Welcome to GRUB!

Instead of return to the GRUB menu, it will check if the flag for CAS reboot is
set. If so, grub will automatically boot the last booted kernel using the same
parameters
---
grub-core/kern/ieee1275/openfw.c | 62 ++++++++++++++++++++++++++++++++++++++++
grub-core/normal/main.c | 19 ++++++++++++
grub-core/script/execute.c | 7 +++++
include/grub/ieee1275/ieee1275.h | 2 ++
4 files changed, 90 insertions(+)

diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index ddb7783..6db8b98 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -561,3 +561,65 @@ grub_ieee1275_canonicalise_devname (const char *path)
return NULL;
}
+/* Check if it's a CAS reboot. If so, set the script to be executed. */
+int
+grub_ieee1275_cas_reboot (char *script)
+{
+ grub_uint32_t ibm_ca_support_reboot;
+ grub_uint32_t ibm_fw_nbr_reboots;
+ char property_value[10];
+ grub_ssize_t actual;
+ grub_ieee1275_ihandle_t options;
+
+ if (grub_ieee1275_finddevice ("/options", &options) < 0)
+ return -1;
+
+ /* Check two properties, one is enough to get cas reboot value */
+ ibm_ca_support_reboot = 0;
+ if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
+ "ibm,client-architecture-support-reboot",
+ &ibm_ca_support_reboot,
+ sizeof (ibm_ca_support_reboot),
+ &actual) >= 0)
+ grub_dprintf("ieee1275", "ibm,client-architecture-support-reboot: %u\n",
+ ibm_ca_support_reboot);
+
+ ibm_fw_nbr_reboots = 0;
+ if (grub_ieee1275_get_property (options, "ibm,fw-nbr-reboots",
+ property_value, sizeof (property_value),
+ &actual) >= 0)
+ {
+ property_value[sizeof (property_value) - 1] = 0;
+ ibm_fw_nbr_reboots = (grub_uint8_t) grub_strtoul (property_value, 0, 10);
+ grub_dprintf("ieee1275", "ibm,fw-nbr-reboots: %u\n", ibm_fw_nbr_reboots);
+ }
+
+ if (ibm_ca_support_reboot || ibm_fw_nbr_reboots)
+ {
+ if (! grub_ieee1275_get_property_length (options, "boot-last-label", &actual))
+ {
+ if (actual > 1024)
+ script = grub_realloc (script, actual + 1);
+ grub_ieee1275_get_property (options, "boot-last-label", script, actual,
+ &actual);
+ return 0;
+ }
+ }
+
+ grub_ieee1275_set_boot_last_label ("");
+
+ return -1;
+}
+
+int grub_ieee1275_set_boot_last_label (const char *text)
+{
+ grub_ieee1275_ihandle_t options;
+ grub_ssize_t actual;
+
+ grub_dprintf("ieee1275", "set boot_last_label (size: %u)\n", grub_strlen(text));
+ if (! grub_ieee1275_finddevice ("/options", &options) &&
+ options != (grub_ieee1275_ihandle_t) -1)
+ grub_ieee1275_set_property (options, "boot-last-label", text,
+ grub_strlen (text), &actual);
+ return 0;
+}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 6f4970f..f72844c 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -33,6 +33,9 @@
#include <grub/charset.h>
#include <grub/script_sh.h>
#include <grub/bufio.h>
+#ifdef GRUB_MACHINE_IEEE1275
+#include <grub/ieee1275/ieee1275.h>
+#endif
GRUB_MOD_LICENSE ("GPLv3+");
@@ -275,6 +278,22 @@ grub_normal_execute (const char *config, int nested, int batch)
{
menu = read_config_file (config);
+#ifdef GRUB_MACHINE_IEEE1275
+ int boot;
+ boot = 0;
+ char *script;
+ script = grub_malloc (1024);
+ if (! grub_ieee1275_cas_reboot (script))
+ {
+ char *dummy[1] = { NULL };
+ if (! grub_script_execute_sourcecode (script, 0, dummy))
+ boot = 1;
+ }
+ grub_free (script);
+ if (boot)
+ grub_command_execute ("boot", 0, 0);
+#endif
+
/* Ignore any error. */
grub_errno = GRUB_ERR_NONE;
}
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index 8f01c1b..cec9539 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -27,6 +27,9 @@
#include <grub/normal.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
+#ifdef GRUB_MACHINE_IEEE1275
+#include <grub/ieee1275/ieee1275.h>
+#endif
/* Max digits for a char is 3 (0xFF is 255), similarly for an int it
is sizeof (int) * 3, and one extra for a possible -ve sign. */
@@ -892,6 +895,10 @@ grub_script_execute_sourcecode (const char *source)
grub_err_t ret = 0;
struct grub_script *parsed_script;
+#ifdef GRUB_MACHINE_IEEE1275
+ grub_ieee1275_set_boot_last_label (source);
+#endif
+
while (source)
{
char *line;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 8e42513..9f26c69 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -234,6 +234,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias);
+int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
+int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
#define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
--
2.9.3

186
SOURCES/0097-Add-vlan-tag-support.patch

@ -0,0 +1,186 @@ @@ -0,0 +1,186 @@
From 6249aac7ff8e18595ad74e26cb727a0c94461d10 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 30 Oct 2012 15:19:39 -0200
Subject: [PATCH 097/237] 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
maintain isolation:

http://en.wikipedia.org/wiki/IEEE_802.1Q

This patch should fix this bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=871563
---
grub-core/kern/ieee1275/init.c | 1 +
grub-core/kern/ieee1275/openfw.c | 30 ++++++++++++++++++++++++++++
grub-core/net/ethernet.c | 42 +++++++++++++++++++++++++++++++++++++---
include/grub/ieee1275/ieee1275.h | 1 +
include/grub/net.h | 2 ++
5 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index d5bd74d..8191f8c 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -117,6 +117,7 @@ grub_machine_get_bootlocation (char **device, char **path)
char *dev, *canon;
char *ptr;
dev = grub_ieee1275_get_aliasdevname (bootpath);
+ grub_ieee1275_parse_net_options (bootpath);
canon = grub_ieee1275_canonicalise_devname (dev);
ptr = canon + grub_strlen (canon) - 1;
while (ptr > canon && (*ptr == ',' || *ptr == ':'))
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 6db8b98..81276fa 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -23,6 +23,7 @@
#include <grub/mm.h>
#include <grub/ieee1275/ieee1275.h>
#include <grub/net.h>
+#include <grub/env.h>
enum grub_ieee1275_parse_type
{
@@ -451,6 +452,35 @@ fail:
return ret;
}
+int
+grub_ieee1275_parse_net_options (const char *path)
+{
+ char *comma;
+ char *args;
+ char *option = 0;
+
+ args = grub_ieee1275_get_devargs (path);
+ if (!args)
+ /* There is no option. */
+ return -1;
+
+ do
+ {
+ comma = grub_strchr (args, ',');
+ if (! comma)
+ option = grub_strdup (args);
+ else
+ option = grub_strndup (args, (grub_size_t)(comma - args));
+ args = comma + 1;
+
+ if (! grub_strncmp(option, "vtag", 4))
+ grub_env_set ("vlan-tag", option + grub_strlen("vtag="));
+
+ } while (comma);
+
+ return 0;
+}
+
char *
grub_ieee1275_get_device_type (const char *path)
{
diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
index c397b1b..faaca67 100644
--- a/grub-core/net/ethernet.c
+++ b/grub-core/net/ethernet.c
@@ -23,6 +23,7 @@
#include <grub/net/arp.h>
#include <grub/net/netbuff.h>
#include <grub/net.h>
+#include <grub/env.h>
#include <grub/time.h>
#include <grub/net/arp.h>
@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
{
struct etherhdr *eth;
grub_err_t err;
+ grub_uint32_t vlantag = 0;
+ grub_uint8_t etherhdr_size;
- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE);
+ etherhdr_size = sizeof (*eth);
+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE);
- err = grub_netbuff_push (nb, sizeof (*eth));
+ const char *vlantag_text = grub_env_get ("vlan-tag");
+ if (vlantag_text != 0) {
+ etherhdr_size += 4;
+ vlantag = grub_strtoul (vlantag_text, 0, 16);
+ }
+
+ err = grub_netbuff_push (nb, etherhdr_size);
if (err)
return err;
eth = (struct etherhdr *) nb->data;
@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
return err;
inf->card->opened = 1;
}
+
+ /* Check if a vlan-tag is needed. */
+ if (vlantag != 0)
+ {
+ /* Move eth type to the right */
+ grub_memcpy((char *) nb->data + etherhdr_size - 2,
+ (char *) nb->data + etherhdr_size - 6, 2);
+
+ /* Add the tag in the middle */
+ grub_memcpy((char *) nb->data + etherhdr_size - 6,
+ &vlantag, 4);
+ }
+
return inf->card->driver->send (inf->card, nb);
}
@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
grub_net_link_level_address_t hwaddress;
grub_net_link_level_address_t src_hwaddress;
grub_err_t err;
+ grub_uint8_t etherhdr_size = sizeof (*eth);
+
+ grub_uint16_t vlantag_identifier = 0;
+ grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2);
+
+ /* Check if a vlan-tag is present. */
+ if (vlantag_identifier == VLANTAG_IDENTIFIER)
+ {
+ etherhdr_size += 4;
+ /* Move eth type to the original position */
+ grub_memcpy((char *) nb->data + etherhdr_size - 6,
+ (char *) nb->data + etherhdr_size - 2, 2);
+ }
eth = (struct etherhdr *) nb->data;
type = grub_be_to_cpu16 (eth->type);
- err = grub_netbuff_pull (nb, sizeof (*eth));
+ err = grub_netbuff_pull (nb, etherhdr_size);
if (err)
return err;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 9f26c69..6a21f5d 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -236,6 +236,7 @@ void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias);
int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path);
#define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
diff --git a/include/grub/net.h b/include/grub/net.h
index 538baa3..a799e6b 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -538,4 +538,6 @@ extern char *grub_net_default_server;
#define GRUB_NET_INTERVAL 400
#define GRUB_NET_INTERVAL_ADDITION 20
+#define VLANTAG_IDENTIFIER 0x8100
+
#endif /* ! GRUB_NET_HEADER */
--
2.9.3

58
SOURCES/0098-Add-X-option-to-printf-functions.patch

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
From cf0b5ad37f8bdfd77e1d0e81962ddc8db477db65 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 27 Nov 2012 16:58:39 -0200
Subject: [PATCH 098/237] Add %X option to printf functions.

---
grub-core/kern/misc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index c5c815d..a56cfe7 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -762,7 +762,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
static inline char *
grub_lltoa (char *str, int c, unsigned long long n)
{
- unsigned base = (c == 'x') ? 16 : 10;
+ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
char *p;
if ((long long) n < 0 && c == 'd')
@@ -777,7 +777,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
do
{
unsigned d = (unsigned) (n & 0xf);
- *p++ = (d > 9) ? d + 'a' - 10 : d + '0';
+ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
}
while (n >>= 4);
else
@@ -850,6 +850,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
{
case 'p':
case 'x':
+ case 'X':
case 'u':
case 'd':
case 'c':
@@ -930,6 +931,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
switch (c)
{
case 'x':
+ case 'X':
case 'u':
args->ptr[curn].type = UNSIGNED_INT + longfmt;
break;
@@ -1067,6 +1069,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
c = 'x';
/* Fall through. */
case 'x':
+ case 'X':
case 'u':
case 'd':
{
--
2.9.3

145
SOURCES/0099-DHCP-client-ID-and-UUID-options-added.patch

@ -0,0 +1,145 @@ @@ -0,0 +1,145 @@
From 8c1b7c9003d8f00871953e768eebd8d380781b70 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 27 Nov 2012 17:18:53 -0200
Subject: [PATCH 099/237] DHCP client ID and UUID options added.

---
grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++-----
include/grub/net.h | 2 ++
2 files changed, 81 insertions(+), 8 deletions(-)

diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 6310ed4..88f2056 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -25,6 +25,49 @@
#include <grub/net/udp.h>
#include <grub/datetime.h>
+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 char
+hexdigit (grub_uint8_t val)
+{
+ if (val < 10)
+ return val + '0';
+ return val + 'a' - 10;
+}
+
static void
parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
{
@@ -55,6 +98,9 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
taglength = *ptr++;
+ grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n",
+ tagtype, tagtype, taglength);
+
switch (tagtype)
{
case GRUB_NET_BOOTP_NETMASK:
@@ -120,6 +166,39 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
taglength);
break;
+ case GRUB_NET_BOOTP_CLIENT_ID:
+ set_env_limn_ro (name, "clientid", (char *) ptr, taglength);
+ break;
+
+ case GRUB_NET_BOOTP_CLIENT_UUID:
+ {
+ if (taglength != 17)
+ break;
+
+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
+
+ ptr += 1;
+ taglength -= 1;
+
+ char *val = grub_malloc (2 * taglength + 4 + 1);
+ int i = 0;
+ int j = 0;
+ for (i = 0; i < taglength; i++)
+ {
+ val[2 * i + j] = hexdigit (ptr[i] >> 4);
+ val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf);
+
+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
+ {
+ j++;
+ val[2 * i + 1+ j] = '-';
+ }
+ }
+
+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4);
+ }
+ break;
+
/* If you need any other options please contact GRUB
development team. */
}
@@ -288,14 +367,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
}
}
-static char
-hexdigit (grub_uint8_t val)
-{
- if (val < 10)
- return val + '0';
- return val + 'a' - 10;
-}
-
static grub_err_t
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
diff --git a/include/grub/net.h b/include/grub/net.h
index a799e6b..59e5975 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -433,6 +433,8 @@ enum
GRUB_NET_BOOTP_DOMAIN = 0x0f,
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
+ GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
+ GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
GRUB_NET_BOOTP_END = 0xff
};
--
2.9.3

203
SOURCES/0100-Search-for-specific-config-file-for-netboot.patch

@ -0,0 +1,203 @@ @@ -0,0 +1,203 @@
From 66e6d4e742919936d7de18eb06e6f4218596354c Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 27 Nov 2012 17:22:07 -0200
Subject: [PATCH 100/237] 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:
1) DHCP client UUID option.
2) MAC address (in lower case hexadecimal with dash separators);
3) IP (in upper case hexadecimal) or IPv6;
4) The original grub.cfg file.

This procedure is similar to what is used by pxelinux and yaboot:
http://www.syslinux.org/wiki/index.php/PXELINUX#config

This should close the bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=873406
---
grub-core/net/net.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
grub-core/normal/main.c | 18 ++++++--
include/grub/net.h | 3 ++
3 files changed, 135 insertions(+), 4 deletions(-)

diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index f2e723b..578e057 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1702,6 +1702,124 @@ grub_net_restore_hw (void)
return GRUB_ERR_NONE;
}
+grub_err_t
+grub_net_search_configfile (char *config)
+{
+ grub_size_t config_len;
+ char *suffix;
+
+ auto int search_through (grub_size_t num_tries, grub_size_t slice_size);
+ int search_through (grub_size_t num_tries, grub_size_t slice_size)
+ {
+ while (num_tries-- > 0)
+ {
+ grub_dprintf ("net", "probe %s\n", config);
+
+ grub_file_t file;
+ file = grub_file_open (config);
+
+ if (file)
+ {
+ grub_file_close (file);
+ grub_dprintf ("net", "found!\n");
+ return 0;
+ }
+ else
+ {
+ if (grub_errno == GRUB_ERR_IO)
+ grub_errno = GRUB_ERR_NONE;
+ }
+
+ if (grub_strlen (suffix) < slice_size)
+ break;
+
+ config[grub_strlen (config) - slice_size] = '\0';
+ }
+
+ return 1;
+ }
+
+ config_len = grub_strlen (config);
+ config[config_len] = '-';
+ suffix = config + config_len + 1;
+
+ struct grub_net_network_level_interface *inf;
+ FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
+ {
+ /* By the Client UUID. */
+
+ char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) +
+ sizeof ("_clientuuid") + 1];
+ grub_snprintf (client_uuid_var, sizeof (client_uuid_var),
+ "net_%s_clientuuid", inf->name);
+
+ const char *client_uuid;
+ client_uuid = grub_env_get (client_uuid_var);
+
+ if (client_uuid)
+ {
+ grub_strcpy (suffix, client_uuid);
+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
+ }
+
+ /* By the MAC address. */
+
+ /* Add ethernet type */
+ grub_strcpy (suffix, "01-");
+
+ grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3);
+
+ char *ptr;
+ for (ptr = suffix; *ptr; ptr++)
+ if (*ptr == ':')
+ *ptr = '-';
+
+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
+
+ /* By IP address */
+
+ switch ((&inf->address)->type)
+ {
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4:
+ {
+ grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4);
+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \
+ ((n >> 24) & 0xff), ((n >> 16) & 0xff), \
+ ((n >> 8) & 0xff), ((n >> 0) & 0xff));
+
+ if (search_through (8, 1) == 0) return GRUB_ERR_NONE;
+ break;
+ }
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
+ {
+ char buf[GRUB_NET_MAX_STR_ADDR_LEN];
+ struct grub_net_network_level_address base;
+ base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16);
+ grub_net_addr_to_str (&base, buf);
+
+ for (ptr = buf; *ptr; ptr++)
+ if (*ptr == ':')
+ *ptr = '-';
+
+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf);
+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
+ break;
+ }
+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
+ return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
+ default:
+ return grub_error (GRUB_ERR_BUG,
+ "unsupported address type %d", (&inf->address)->type);
+ }
+ }
+
+ /* Remove the remaining minus sign at the end. */
+ config[config_len] = '\0';
+
+ return GRUB_ERR_NONE;
+}
+
static struct grub_preboot *fini_hnd;
static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index f72844c..85d2a28 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -33,6 +33,7 @@
#include <grub/charset.h>
#include <grub/script_sh.h>
#include <grub/bufio.h>
+#include <grub/net.h>
#ifdef GRUB_MACHINE_IEEE1275
#include <grub/ieee1275/ieee1275.h>
#endif
@@ -365,10 +366,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
prefix = grub_env_get ("prefix");
if (prefix)
- {
- config = grub_xasprintf ("%s/grub.cfg", prefix);
- if (! config)
- goto quit;
+ {
+ grub_size_t config_len;
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
+
+ if (! config)
+ goto quit;
+
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+
+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
+ grub_net_search_configfile (config);
grub_enter_normal_mode (config);
grub_free (config);
diff --git a/include/grub/net.h b/include/grub/net.h
index 59e5975..88fc71c 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -542,4 +542,7 @@ extern char *grub_net_default_server;
#define VLANTAG_IDENTIFIER 0x8100
+grub_err_t
+grub_net_search_configfile (char *config);
+
#endif /* ! GRUB_NET_HEADER */
--
2.9.3

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save