diff --git a/0001-Bump-version-to-2.03.patch b/0001-Bump-version-to-2.03.patch index 4b4d7a3..9d1bec8 100644 --- a/0001-Bump-version-to-2.03.patch +++ b/0001-Bump-version-to-2.03.patch @@ -1,7 +1,7 @@ From b0bad6fd9449d3333fe1ab58953c0e6c1ce12c0d Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 3 May 2017 11:55:52 +0200 -Subject: [PATCH 001/238] Bump version to 2.03 +Subject: [PATCH 001/250] Bump version to 2.03 --- configure.ac | 2 +- @@ -226,5 +226,5 @@ index 68d8ce7c775..921e57ff48d 100644 { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, }, 5 }, { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, }, 5 }, -- -2.17.0 +2.14.3 diff --git a/0002-Remove-bashisms-from-tests.patch b/0002-Remove-bashisms-from-tests.patch index b9dbafd..7443bd7 100644 --- a/0002-Remove-bashisms-from-tests.patch +++ b/0002-Remove-bashisms-from-tests.patch @@ -1,7 +1,7 @@ From 5a0c548ba388b343b0bb6d2a38888e7eac5bbb96 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 03:47:13 +0300 -Subject: [PATCH 002/238] Remove bashisms from tests. +Subject: [PATCH 002/250] Remove bashisms from tests. Those tests don't actually need bash. Just use common shebang. --- @@ -129,5 +129,5 @@ index d5ef7f9ea62..80ebdc59fd5 100644 # create a randome file file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 -- -2.17.0 +2.14.3 diff --git a/0003-fs-tester-make-sh-compatible.patch b/0003-fs-tester-make-sh-compatible.patch index a3474d8..662b6c2 100644 --- a/0003-fs-tester-make-sh-compatible.patch +++ b/0003-fs-tester-make-sh-compatible.patch @@ -1,7 +1,7 @@ From 37865c2c4ad26cd5e947b08abf1fde8145699919 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 14:35:59 +0300 -Subject: [PATCH 003/238] fs-tester: make sh-compatible +Subject: [PATCH 003/250] fs-tester: make sh-compatible --- tests/util/grub-fs-tester.in | 306 ++++++++++++++++++++++++------------------- @@ -742,5 +742,5 @@ index 2337771a1b9..4515d165e6e 100644 if [ x"$fs" = x"zfs" ]; then rmdir "$MNTPOINTRW"/"grub fs" || true -- -2.17.0 +2.14.3 diff --git a/0004-support-busybox-date.patch b/0004-support-busybox-date.patch index 570bed5..cc94101 100644 --- a/0004-support-busybox-date.patch +++ b/0004-support-busybox-date.patch @@ -1,7 +1,7 @@ From b43b8cacc813c2c15347de1e35cc88d9aa912d22 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 14:31:36 +0300 -Subject: [PATCH 004/238] support busybox date. +Subject: [PATCH 004/250] support busybox date. Busybox date doesn't understand weekdays in -d input, so strip them beforehand. @@ -39,5 +39,5 @@ index 05b8f6b73fa..ac51d42098e 100644 # Ignore QEMU bug if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then -- -2.17.0 +2.14.3 diff --git a/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch b/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch index 20ad6a8..4a93660 100644 --- a/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch +++ b/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch @@ -1,7 +1,7 @@ From 6dec3a26b37e128ded5d912e08abc5cee1592499 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 21:24:05 +0300 -Subject: [PATCH 005/238] Don't retrieve fstime when it's not useful. +Subject: [PATCH 005/250] Don't retrieve fstime when it's not useful. --- tests/util/grub-fs-tester.in | 48 ++++++++++++++++++++++---------------------- @@ -68,5 +68,5 @@ index 4515d165e6e..bf47305f3e8 100644 if [ x$NOHARDLINK != xy ]; then -- -2.17.0 +2.14.3 diff --git a/0006-Support-lseek64.patch b/0006-Support-lseek64.patch index 4a8c843..51c42c7 100644 --- a/0006-Support-lseek64.patch +++ b/0006-Support-lseek64.patch @@ -1,7 +1,7 @@ From 608bec51128008afb81c9e3f297283e9f830a146 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 20:21:05 +0300 -Subject: [PATCH 006/238] Support lseek64. +Subject: [PATCH 006/250] Support lseek64. Android doesn't have 64-bit off_t, so use off64_t instead. --- @@ -50,5 +50,5 @@ index 2a8c5882e3d..5450cf4166e 100644 } -- -2.17.0 +2.14.3 diff --git a/0007-Use-SHELL-rather-than-bin-sh.patch b/0007-Use-SHELL-rather-than-bin-sh.patch index 2b9c58d..e657d47 100644 --- a/0007-Use-SHELL-rather-than-bin-sh.patch +++ b/0007-Use-SHELL-rather-than-bin-sh.patch @@ -1,7 +1,7 @@ From c2ea443446b7feea868e54f94a87781f69820375 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 00:55:30 +0300 -Subject: [PATCH 007/238] Use $(SHELL) rather than /bin/sh. +Subject: [PATCH 007/250] Use $(SHELL) rather than /bin/sh. /bin/sh doesn't exist under termux. --- @@ -22,5 +22,5 @@ index 04e9395fd94..809a8aa26bf 100644 CLEANFILES += symlist.c BUILT_SOURCES += symlist.c -- -2.17.0 +2.14.3 diff --git a/0008-po-Use-SHELL-rather-than-bin-sh.patch b/0008-po-Use-SHELL-rather-than-bin-sh.patch index 424b221..ef7abc9 100644 --- a/0008-po-Use-SHELL-rather-than-bin-sh.patch +++ b/0008-po-Use-SHELL-rather-than-bin-sh.patch @@ -1,7 +1,7 @@ From 4341f82af0b61d3dfbe675670d4105dc759c0df3 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 14:54:03 +0300 -Subject: [PATCH 008/238] po: Use @SHELL@ rather than /bin/sh. +Subject: [PATCH 008/250] po: Use @SHELL@ rather than /bin/sh. /bin/sh might not exist. --- @@ -22,5 +22,5 @@ index 3619458e85f..e68e9da843d 100644 srcdir = @srcdir@ -- -2.17.0 +2.14.3 diff --git a/0009-Add-termux-path-to-dict.patch b/0009-Add-termux-path-to-dict.patch index 42fcb8d..2ae9613 100644 --- a/0009-Add-termux-path-to-dict.patch +++ b/0009-Add-termux-path-to-dict.patch @@ -1,7 +1,7 @@ From 1073ddb12078f3c8edbdb74bb8f5afc674983f40 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 14:52:48 +0300 -Subject: [PATCH 009/238] Add termux path to dict. +Subject: [PATCH 009/250] Add termux path to dict. --- tests/util/grub-fs-tester.in | 2 +- @@ -21,5 +21,5 @@ index bf47305f3e8..468d9e7856d 100644 CFILESRC="$cand" break -- -2.17.0 +2.14.3 diff --git a/0010-Fix-shebang-for-termux.patch b/0010-Fix-shebang-for-termux.patch index ffb31c6..910d471 100644 --- a/0010-Fix-shebang-for-termux.patch +++ b/0010-Fix-shebang-for-termux.patch @@ -1,7 +1,7 @@ From a827807a1330d5ad619faa103bc7f12d89fc8bee Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 22 Jan 2017 20:22:34 +0300 -Subject: [PATCH 010/238] Fix shebang for termux. +Subject: [PATCH 010/250] Fix shebang for termux. Termux doesn't have a /bin/sh. So we needto use $SHELL. Keep /bin/sh as much as possible. @@ -680,5 +680,5 @@ index 047120e47a0..eee62c10d70 100644 set -e -- -2.17.0 +2.14.3 diff --git a/0011-Add-strtoull-test.patch b/0011-Add-strtoull-test.patch index ec67376..9e1d419 100644 --- a/0011-Add-strtoull-test.patch +++ b/0011-Add-strtoull-test.patch @@ -1,7 +1,7 @@ From ede6c9689395499f98a4c14d76b97151b4de5f54 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 3 May 2017 12:58:15 +0200 -Subject: [PATCH 011/238] Add strtoull test. +Subject: [PATCH 011/250] Add strtoull test. --- grub-core/Makefile.core.def | 5 +++++ @@ -24,5 +24,5 @@ index 2dfa22a9271..8dcd0e5a998 100644 name = setjmp_test; common = tests/setjmp_test.c; -- -2.17.0 +2.14.3 diff --git a/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch b/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch index 9311131..2f3c3aa 100644 --- a/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch +++ b/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch @@ -1,7 +1,7 @@ From dc6e1b5af83eb1c4290baf97c2d221c0865127be Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 10 Aug 2016 17:49:42 +0200 -Subject: [PATCH 012/238] strtoull: Fix behaviour on chars between '9' and 'a'. +Subject: [PATCH 012/250] strtoull: Fix behaviour on chars between '9' and 'a'. Reported by: Aaron Miller --- @@ -64,5 +64,5 @@ index d4822a12456..96781fb39b5 100644 ok = ok && !grub_test_run (test); grub_errno = 0; -- -2.17.0 +2.14.3 diff --git a/0013-Add-Virtual-LAN-support.patch b/0013-Add-Virtual-LAN-support.patch index 56a6614..cce0a37 100644 --- a/0013-Add-Virtual-LAN-support.patch +++ b/0013-Add-Virtual-LAN-support.patch @@ -1,7 +1,7 @@ From d9f7de0ae3c0c09cff7257c55418450261f3e082 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Mon, 23 Dec 2013 12:32:02 -0200 -Subject: [PATCH 013/238] Add Virtual LAN support. +Subject: [PATCH 013/250] Add Virtual LAN support. This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows multiple VLANs in a bridged network to share the same physical network link @@ -345,5 +345,5 @@ index dcceaa56894..ab9d68f9825 100644 grub_err_t grub_net_send_ip_packet (struct grub_net_network_level_interface *inf, -- -2.17.0 +2.14.3 diff --git a/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch b/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch index f6fac8f..c589e5e 100644 --- a/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch +++ b/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch @@ -1,7 +1,7 @@ From a35ac854308b0af7c86c2c7b199f6abdfa2110b0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 17:32:15 +0200 -Subject: [PATCH 014/238] mkimage: Pass layout to mkimage_generate_elfXX rather +Subject: [PATCH 014/250] mkimage: Pass layout to mkimage_generate_elfXX rather than some fields. This allows easier extension of this function without having too long of @@ -164,5 +164,5 @@ index 1a18708a89c..b3a5ca132bc 100644 struct grub_install_image_target_desc { -- -2.17.0 +2.14.3 diff --git a/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch b/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch index 5340b53..17fd000 100644 --- a/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch +++ b/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch @@ -1,7 +1,7 @@ From d08c9685149e7788001ac9a209baa1d84c3628e0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 17:47:57 +0200 -Subject: [PATCH 015/238] Refactor arm-uboot code to make it genereic. +Subject: [PATCH 015/250] Refactor arm-uboot code to make it genereic. arm-coreboot startup code can be very similar to arm-uboot but current code has U-Boot specific references. So split U-Boot part from generic part. @@ -401,5 +401,5 @@ index 00000000000..d128775f19e + + END -- -2.17.0 +2.14.3 diff --git a/0016-coreboot-Split-parts-that-are-platform-independent.patch b/0016-coreboot-Split-parts-that-are-platform-independent.patch index c2103a9..2aca120 100644 --- a/0016-coreboot-Split-parts-that-are-platform-independent.patch +++ b/0016-coreboot-Split-parts-that-are-platform-independent.patch @@ -1,7 +1,7 @@ From 461bfab7b7e47fd0a76bf6076a438af1b7e2184a Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 19:06:22 +0200 -Subject: [PATCH 016/238] coreboot: Split parts that are platform-independent. +Subject: [PATCH 016/250] coreboot: Split parts that are platform-independent. We currently assume that coreboot is always i386, it's no longer the case, so split i386-coreboot parts from generic coreboot code. @@ -340,5 +340,5 @@ index 809a8aa26bf..781d0ffbf75 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h -- -2.17.0 +2.14.3 diff --git a/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch b/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch index caefe76..90b37e1 100644 --- a/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch +++ b/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch @@ -1,7 +1,7 @@ From 1daa716c7017f1858de117a20a31da66815435c5 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 19:31:55 +0200 -Subject: [PATCH 017/238] Rename uboot/halt.c to dummy/halt.c. +Subject: [PATCH 017/250] Rename uboot/halt.c to dummy/halt.c. It's not U-Boot specific and it's a stub. --- @@ -28,5 +28,5 @@ similarity index 100% rename from grub-core/lib/uboot/halt.c rename to grub-core/lib/dummy/halt.c -- -2.17.0 +2.14.3 diff --git a/0018-Rename-uboot-datetime-to-dummy-datetime.patch b/0018-Rename-uboot-datetime-to-dummy-datetime.patch index 58aece1..e738443 100644 --- a/0018-Rename-uboot-datetime-to-dummy-datetime.patch +++ b/0018-Rename-uboot-datetime-to-dummy-datetime.patch @@ -1,7 +1,7 @@ From 9808c3ef956c6472a96790b60cf74f4eaa742010 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 19:37:29 +0200 -Subject: [PATCH 018/238] Rename uboot/datetime to dummy/datetime. +Subject: [PATCH 018/250] Rename uboot/datetime to dummy/datetime. It's just a stub and is not UBoot-specific. --- @@ -54,5 +54,5 @@ index 4be716928a5..cf693fc6b62 100644 + "can\'t set datetime on this machine"); } -- -2.17.0 +2.14.3 diff --git a/0019-arm-coreboot-Start-new-port.patch b/0019-arm-coreboot-Start-new-port.patch index 41228e2..f467e91 100644 --- a/0019-arm-coreboot-Start-new-port.patch +++ b/0019-arm-coreboot-Start-new-port.patch @@ -1,7 +1,7 @@ From 24e37a885269bdec9b27babf1da0bba3692d55c0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 20:53:28 +0200 -Subject: [PATCH 019/238] arm-coreboot: Start new port. +Subject: [PATCH 019/250] arm-coreboot: Start new port. --- configure.ac | 2 + @@ -823,5 +823,5 @@ index 781d0ffbf75..bec0585549a 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h -- -2.17.0 +2.14.3 diff --git a/0020-Add-support-for-device-tree-based-drivers.patch b/0020-Add-support-for-device-tree-based-drivers.patch index ddacbc7..9d75d63 100644 --- a/0020-Add-support-for-device-tree-based-drivers.patch +++ b/0020-Add-support-for-device-tree-based-drivers.patch @@ -1,7 +1,7 @@ From fcbb723d4b1f7ad4687191562621dd0eb25f4d9e Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:19:59 +0200 -Subject: [PATCH 020/238] Add support for device-tree-based drivers. +Subject: [PATCH 020/250] Add support for device-tree-based drivers. --- grub-core/Makefile.core.def | 2 + @@ -852,5 +852,5 @@ index bec0585549a..fc6ca305147 100644 (for pp in $^; do \ b=`basename $$pp .marker`; \ -- -2.17.0 +2.14.3 diff --git a/0021-arm-coreboot-Support-for-vexpress-timer.patch b/0021-arm-coreboot-Support-for-vexpress-timer.patch index 0a18670..8716273 100644 --- a/0021-arm-coreboot-Support-for-vexpress-timer.patch +++ b/0021-arm-coreboot-Support-for-vexpress-timer.patch @@ -1,7 +1,7 @@ From 5a865b37866ee8cd64c080bc6fb1e537f8e2b3c6 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:26:36 +0200 -Subject: [PATCH 021/238] arm-coreboot: Support for vexpress timer. +Subject: [PATCH 021/250] arm-coreboot: Support for vexpress timer. --- grub-core/kern/arm/coreboot/timer.c | 36 ++++++++++++++++++++++++++++++++++++ @@ -69,5 +69,5 @@ index ebefb99d58f..d97b844f848 100644 try_generic_timer (); if (!have_timer) -- -2.17.0 +2.14.3 diff --git a/0022-arm-coreboot-Export-FDT-routines.patch b/0022-arm-coreboot-Export-FDT-routines.patch index 59413d4..6a49882 100644 --- a/0022-arm-coreboot-Export-FDT-routines.patch +++ b/0022-arm-coreboot-Export-FDT-routines.patch @@ -1,7 +1,7 @@ From ac6b41b89fbb82a3ba843a7ed19115d81432b604 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:29:48 +0200 -Subject: [PATCH 022/238] arm-coreboot: Export FDT routines. +Subject: [PATCH 022/250] arm-coreboot: Export FDT routines. We need to use them from modules as well. --- @@ -23,5 +23,5 @@ index fc6ca305147..147e6959c97 100644 if COND_arm_efi -- -2.17.0 +2.14.3 diff --git a/0023-at_keyboard-Split-protocol-from-controller-code.patch b/0023-at_keyboard-Split-protocol-from-controller-code.patch index 6c6e9b5..3895cf2 100644 --- a/0023-at_keyboard-Split-protocol-from-controller-code.patch +++ b/0023-at_keyboard-Split-protocol-from-controller-code.patch @@ -1,7 +1,7 @@ From 216950a4eea1a1ead1c28eaca94e34ea2ef2ad19 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:41:22 +0200 -Subject: [PATCH 023/238] at_keyboard: Split protocol from controller code. +Subject: [PATCH 023/250] at_keyboard: Split protocol from controller code. On vexpress controller is different but protocol is the same, so reuse the code. @@ -1024,5 +1024,5 @@ index 00000000000..4f2e527e497 + +#endif -- -2.17.0 +2.14.3 diff --git a/0024-arm_coreboot-Support-keyboard-for-vexpress.patch b/0024-arm_coreboot-Support-keyboard-for-vexpress.patch index 8fdc7ee..d1dcc17 100644 --- a/0024-arm_coreboot-Support-keyboard-for-vexpress.patch +++ b/0024-arm_coreboot-Support-keyboard-for-vexpress.patch @@ -1,7 +1,7 @@ From 848bed9d92cf20e9f25db4c69a20efad23996ca0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:42:37 +0200 -Subject: [PATCH 024/238] arm_coreboot: Support keyboard for vexpress. +Subject: [PATCH 024/250] arm_coreboot: Support keyboard for vexpress. --- grub-core/Makefile.core.def | 3 + @@ -245,5 +245,5 @@ index 147e6959c97..a2aaf9f54b0 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h -- -2.17.0 +2.14.3 diff --git a/0025-arm_coreboot-Support-grub-mkstandalone.patch b/0025-arm_coreboot-Support-grub-mkstandalone.patch index 46a4f2f..eb345d6 100644 --- a/0025-arm_coreboot-Support-grub-mkstandalone.patch +++ b/0025-arm_coreboot-Support-grub-mkstandalone.patch @@ -1,7 +1,7 @@ From 3edabad8fefb112cc4b2d43be6e97d43c909ceee Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 21:59:48 +0200 -Subject: [PATCH 025/238] arm_coreboot: Support grub-mkstandalone. +Subject: [PATCH 025/250] arm_coreboot: Support grub-mkstandalone. --- util/grub-install-common.c | 12 ++++++++++-- @@ -154,5 +154,5 @@ index 6abd288c313..5910b0c09bc 100644 extern char *grub_install_source_directory; -- -2.17.0 +2.14.3 diff --git a/0026-arm_coreboot-Support-loading-linux-images.patch b/0026-arm_coreboot-Support-loading-linux-images.patch index 22cfd8a..aed74ff 100644 --- a/0026-arm_coreboot-Support-loading-linux-images.patch +++ b/0026-arm_coreboot-Support-loading-linux-images.patch @@ -1,7 +1,7 @@ From 656c3b0d7fbe23f0e1ab561c8faa4ac4a37364d1 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 22:00:06 +0200 -Subject: [PATCH 026/238] arm_coreboot: Support loading linux images. +Subject: [PATCH 026/250] arm_coreboot: Support loading linux images. --- grub-core/loader/arm/linux.c | 132 ++++++++++++++++++++++--------------------- @@ -298,5 +298,5 @@ index a66caad13db..f217f8281ad 100644 #define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 -- -2.17.0 +2.14.3 diff --git a/0027-arm_coreboot-Support-DMA.patch b/0027-arm_coreboot-Support-DMA.patch index a2d583a..d2af6b8 100644 --- a/0027-arm_coreboot-Support-DMA.patch +++ b/0027-arm_coreboot-Support-DMA.patch @@ -1,7 +1,7 @@ From 265292f2b0da0eb414c409871ba0f94a99ec33c1 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 22:06:04 +0200 -Subject: [PATCH 027/238] arm_coreboot: Support DMA. +Subject: [PATCH 027/250] arm_coreboot: Support DMA. This is needed to support USB and some other busses. --- @@ -288,5 +288,5 @@ index a2aaf9f54b0..10451384720 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h endif -- -2.17.0 +2.14.3 diff --git a/0028-ehci-Split-core-code-from-PCI-part.patch b/0028-ehci-Split-core-code-from-PCI-part.patch index 97e9458..8860c1f 100644 --- a/0028-ehci-Split-core-code-from-PCI-part.patch +++ b/0028-ehci-Split-core-code-from-PCI-part.patch @@ -1,7 +1,7 @@ From 058df7b5a9cc7aaa9872eaa916b715544a8f9840 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 22:10:26 +0200 -Subject: [PATCH 028/238] ehci: Split core code from PCI part. +Subject: [PATCH 028/250] ehci: Split core code from PCI part. On ARM often EHCI is present without PCI and just declared in device tree. So splitcore from PCI part. @@ -567,5 +567,5 @@ index 5f4297bb21e..c772e76546e 100644 grub_usb_controller_dev_register (&usb_controller); grub_boot_time ("EHCI driver registered"); -- -2.17.0 +2.14.3 diff --git a/0029-arm_coreboot-Support-EHCI.patch b/0029-arm_coreboot-Support-EHCI.patch index c9b8247..e2c07ca 100644 --- a/0029-arm_coreboot-Support-EHCI.patch +++ b/0029-arm_coreboot-Support-EHCI.patch @@ -1,7 +1,7 @@ From d11ced1e1fb93676942e51618eb53c140f541890 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 May 2017 22:14:28 +0200 -Subject: [PATCH 029/238] arm_coreboot: Support EHCI. +Subject: [PATCH 029/250] arm_coreboot: Support EHCI. --- grub-core/Makefile.core.def | 2 ++ @@ -119,5 +119,5 @@ index ed268178b4d..da67965a41a 100644 # If gfxterm is main output console integrate it into kernel GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot", "arm_coreboot" ] -- -2.17.0 +2.14.3 diff --git a/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch b/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch index 90e9346..9347b21 100644 --- a/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch +++ b/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch @@ -1,7 +1,7 @@ From 4f8471532d454b2db96434c28bf7105ed69e0f4d Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 08:39:40 +0200 -Subject: [PATCH 030/238] Fix bug on FDT nodes with compatible property +Subject: [PATCH 030/250] Fix bug on FDT nodes with compatible property --- grub-core/bus/fdt.c | 2 ++ @@ -21,5 +21,5 @@ index 6fb077000a5..34d53545732 100644 while (compatible < compatible_end) { -- -2.17.0 +2.14.3 diff --git a/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch b/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch index 555b3cc..ef62f2c 100644 --- a/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch +++ b/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch @@ -1,7 +1,7 @@ From c4313c812dc14e82a774b580b5e34d40e7f3fae6 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 08:40:29 +0200 -Subject: [PATCH 031/238] fdtbus: Add ability to send/receive messages on +Subject: [PATCH 031/250] fdtbus: Add ability to send/receive messages on parent busses. --- @@ -130,5 +130,5 @@ index 985837e55f6..f519c40ec35 100644 /* dtb is assumed to be unfreeable and must remain valid for lifetime of GRUB. -- -2.17.0 +2.14.3 diff --git a/0032-rk3288_spi-Add-SPI-driver.patch b/0032-rk3288_spi-Add-SPI-driver.patch index cbc83ed..e97cda6 100644 --- a/0032-rk3288_spi-Add-SPI-driver.patch +++ b/0032-rk3288_spi-Add-SPI-driver.patch @@ -1,7 +1,7 @@ From b0b1b81a11f8bae8ab9e8edd87ac3f4f7949d03b Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 08:42:14 +0200 -Subject: [PATCH 032/238] rk3288_spi: Add SPI driver +Subject: [PATCH 032/250] rk3288_spi: Add SPI driver --- grub-core/Makefile.core.def | 1 + @@ -161,5 +161,5 @@ index 09cd7fe328c..26950534270 100644 #endif /* ! ASM_FILE */ -- -2.17.0 +2.14.3 diff --git a/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch b/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch index 822c177..452fb64 100644 --- a/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch +++ b/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch @@ -1,7 +1,7 @@ From 5c3fd1b135bd73c8e3467b9b635b25ca4d360a19 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 08:47:34 +0200 -Subject: [PATCH 033/238] arm_coreboot: Add Chromebook keyboard driver. +Subject: [PATCH 033/250] arm_coreboot: Add Chromebook keyboard driver. --- grub-core/term/arm/cros.c | 125 +++++++++++++++++++++++ @@ -415,5 +415,5 @@ index 00000000000..45a372572a5 + +#endif -- -2.17.0 +2.14.3 diff --git a/0034-Missing-parts-of-previous-commit.patch b/0034-Missing-parts-of-previous-commit.patch index 7e13152..69020a0 100644 --- a/0034-Missing-parts-of-previous-commit.patch +++ b/0034-Missing-parts-of-previous-commit.patch @@ -1,7 +1,7 @@ From c6eaa982d12e3cfc5465dda5ea372774188b6b81 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 09:02:15 +0200 -Subject: [PATCH 034/238] Missing parts of previous commit +Subject: [PATCH 034/250] Missing parts of previous commit --- grub-core/Makefile.core.def | 2 ++ @@ -34,5 +34,5 @@ index 0126ff6381a..8d8c5b8291e 100644 } -- -2.17.0 +2.14.3 diff --git a/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch b/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch index 811a365..7380fa4 100644 --- a/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch +++ b/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch @@ -1,7 +1,7 @@ From 70b555a52a065b2beb91e6fc97a6b358c931b303 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 9 May 2017 09:03:02 +0200 -Subject: [PATCH 035/238] coreboot: Changed cbmemc to support updated console +Subject: [PATCH 035/250] coreboot: Changed cbmemc to support updated console format from coreboot. --- @@ -94,5 +94,5 @@ index 129248c7f47..cea9b84315b 100644 } -- -2.17.0 +2.14.3 diff --git a/0036-at_keyboard-Fix-falco-chromebook-case.patch b/0036-at_keyboard-Fix-falco-chromebook-case.patch index 817acba..f3f37de 100644 --- a/0036-at_keyboard-Fix-falco-chromebook-case.patch +++ b/0036-at_keyboard-Fix-falco-chromebook-case.patch @@ -1,7 +1,7 @@ From c4b8bec5fee4e30a165fd14a188cf3ab8eccd095 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 9 May 2017 14:27:52 +0200 -Subject: [PATCH 036/238] at_keyboard: Fix falco chromebook case. +Subject: [PATCH 036/250] at_keyboard: Fix falco chromebook case. EC is slow, so we need few delays for it to toggle the bits correctly. @@ -85,5 +85,5 @@ index b031523eb7d..bcb4d9ba78f 100644 #define KEYBOARD_ISMAKE(x) !((x) & 0x80) #define KEYBOARD_ISREADY(x) ((x) & 0x01) -- -2.17.0 +2.14.3 diff --git a/0037-sparc64-Close-cdboot-ihandle.patch b/0037-sparc64-Close-cdboot-ihandle.patch index 5409e3b..6cd29db 100644 --- a/0037-sparc64-Close-cdboot-ihandle.patch +++ b/0037-sparc64-Close-cdboot-ihandle.patch @@ -1,7 +1,7 @@ From bd4e40aadded7093908d786d03b4acf60b7b1707 Mon Sep 17 00:00:00 2001 From: Eric Snowberg Date: Thu, 11 May 2017 18:42:23 -0700 -Subject: [PATCH 037/238] sparc64: Close cdboot ihandle +Subject: [PATCH 037/250] sparc64: Close cdboot ihandle The ihandle is left open with a cd-core image. This will cause a delay booting grub from a virtual cdrom in a LDOM. It will also cause problems @@ -44,5 +44,5 @@ index 586efb4014e..9ea9b4e0662 100644 mov 512, %o3 #endif -- -2.17.0 +2.14.3 diff --git a/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch b/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch index 4cc826f..97bf380 100644 --- a/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch +++ b/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch @@ -1,7 +1,7 @@ From ae5817f1dcbf0b99f7a849f56afe442165317840 Mon Sep 17 00:00:00 2001 From: Julien Grall Date: Fri, 19 Feb 2016 16:28:52 +0000 -Subject: [PATCH 038/238] arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64 +Subject: [PATCH 038/250] arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64 Xen is currently crashing because of malformed compatible property for the boot module. This is because the property string is not @@ -28,5 +28,5 @@ index a914eb8e2df..8ae43d7e894 100644 return grub_error (GRUB_ERR_IO, "failed to update FDT"); -- -2.17.0 +2.14.3 diff --git a/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch b/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch index 6f48184..b1aff5a 100644 --- a/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch +++ b/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch @@ -1,7 +1,7 @@ From 8eed7be8a61c295df700e918744a984162378ca9 Mon Sep 17 00:00:00 2001 From: Fu Wei Date: Sun, 14 May 2017 15:43:45 +0800 -Subject: [PATCH 039/238] arm64: Add "--nounzip" option support in xen_module +Subject: [PATCH 039/250] arm64: Add "--nounzip" option support in xen_module command This patch adds "--nounzip" option support in order to @@ -52,5 +52,5 @@ index 8ae43d7e894..27ede46cac5 100644 if (!file) goto fail; -- -2.17.0 +2.14.3 diff --git a/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch b/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch index d95f391..a3263db 100644 --- a/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch +++ b/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch @@ -1,7 +1,7 @@ From d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe Mon Sep 17 00:00:00 2001 From: Fu Wei Date: Sun, 14 May 2017 15:43:46 +0800 -Subject: [PATCH 040/238] util/grub.d/20_linux_xen.in: Add xen_boot command +Subject: [PATCH 040/250] util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 This patch adds the support of xen_boot command for aarch64: @@ -59,5 +59,5 @@ index c48af948d6e..c002fc9f946 100644 linux=`version_find_latest $list` gettext_printf "Found linux image: %s\n" "$linux" >&2 -- -2.17.0 +2.14.3 diff --git a/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch b/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch index e0e968f..ba04db1 100644 --- a/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch +++ b/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch @@ -1,7 +1,7 @@ From 26c2f306fd425d2c0348023b8dcb7eb40a01851a Mon Sep 17 00:00:00 2001 From: Fu Wei Date: Sun, 14 May 2017 15:43:47 +0800 -Subject: [PATCH 041/238] arm64: Update the introduction of Xen boot commands +Subject: [PATCH 041/250] arm64: Update the introduction of Xen boot commands in docs/grub.texi delete: xen_linux, xen_initrd, xen_xsm @@ -89,5 +89,5 @@ index e935af33ea5..a0c4b9e4e8e 100644 @section The list of networking commands -- -2.17.0 +2.14.3 diff --git a/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch b/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch index fe5dcd1..a73dab9 100644 --- a/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch +++ b/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch @@ -1,7 +1,7 @@ From f8679cedff703b437171f4708d46adbfcff80a65 Mon Sep 17 00:00:00 2001 From: Eric Snowberg Date: Thu, 18 May 2017 17:10:22 -0600 -Subject: [PATCH 042/238] sparc64: Don't use devspec to determine the OBP path +Subject: [PATCH 042/250] sparc64: Don't use devspec to determine the OBP path Don't use devspec to determine the OBP path on SPARC hardware. Within all versions of Linux on SPARC, the devspec returns one of three values: @@ -49,5 +49,5 @@ index a79682a5e31..dce4e59d081 100644 if (fd < 0 || fstat (fd, &st) < 0) { -- -2.17.0 +2.14.3 diff --git a/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch b/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch index 7f52cd8..4f8be9b 100644 --- a/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch +++ b/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch @@ -1,7 +1,7 @@ From 734668238fcc0ef691a080839e04f33854fa133a Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 29 Jun 2017 13:27:49 +0000 -Subject: [PATCH 043/238] Allow GRUB to mount ext2/3/4 filesystems that have +Subject: [PATCH 043/250] Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature. On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set. @@ -136,5 +136,5 @@ index 88cbe7365e9..fd7e0f14b68 100644 MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.$fs" -b $BLKSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; xxfs) -- -2.17.0 +2.14.3 diff --git a/0044-ehci-Fix-compilation-for-amd64.patch b/0044-ehci-Fix-compilation-for-amd64.patch index 58c5205..3f99f1d 100644 --- a/0044-ehci-Fix-compilation-for-amd64.patch +++ b/0044-ehci-Fix-compilation-for-amd64.patch @@ -1,7 +1,7 @@ From edb37fb30bbc8a3b6bec67911c7200e4eb071127 Mon Sep 17 00:00:00 2001 From: phcoder Date: Sun, 9 Jul 2017 20:58:31 +0200 -Subject: [PATCH 044/238] ehci: Fix compilation for amd64 +Subject: [PATCH 044/250] ehci: Fix compilation for amd64 --- grub-core/bus/usb/ehci.c | 8 ++++---- @@ -34,5 +34,5 @@ index c772e76546e..7b7061f5335 100644 grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", -- -2.17.0 +2.14.3 diff --git a/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch b/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch index 5c097de..95e056b 100644 --- a/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch +++ b/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch @@ -1,7 +1,7 @@ From d8901e3ba115d705c9c08ecedd201aca8b4867b8 Mon Sep 17 00:00:00 2001 From: phcoder Date: Sun, 9 Jul 2017 20:59:15 +0200 -Subject: [PATCH 045/238] cache: Fix compilation for ppc, sparc and arm64 +Subject: [PATCH 045/250] cache: Fix compilation for ppc, sparc and arm64 --- include/grub/cache.h | 4 +++- @@ -23,5 +23,5 @@ index 1c98ce270b6..ccfa717e669 100644 grub_arch_sync_dma_caches (volatile void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) -- -2.17.0 +2.14.3 diff --git a/0046-ehci-Fix-compilation-on-i386.patch b/0046-ehci-Fix-compilation-on-i386.patch index a8b8f71..c67e812 100644 --- a/0046-ehci-Fix-compilation-on-i386.patch +++ b/0046-ehci-Fix-compilation-on-i386.patch @@ -1,7 +1,7 @@ From 284afab081ef7ed7db2c59151853aa3c92d988f2 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 9 Jul 2017 21:31:19 +0200 -Subject: [PATCH 046/238] ehci: Fix compilation on i386 +Subject: [PATCH 046/250] ehci: Fix compilation on i386 --- grub-core/bus/usb/ehci.c | 4 ++-- @@ -30,5 +30,5 @@ index 7b7061f5335..d966fc21002 100644 grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", -- -2.17.0 +2.14.3 diff --git a/0047-crypto-Fix-use-after-free.patch b/0047-crypto-Fix-use-after-free.patch index 8b8e953..8903e29 100644 --- a/0047-crypto-Fix-use-after-free.patch +++ b/0047-crypto-Fix-use-after-free.patch @@ -1,7 +1,7 @@ From a0fe0c26aa8a1c0ad66d9527611bd726b849c623 Mon Sep 17 00:00:00 2001 From: AppChecker Date: Sun, 9 Jul 2017 21:57:35 +0200 -Subject: [PATCH 047/238] crypto: Fix use after free. +Subject: [PATCH 047/250] crypto: Fix use after free. Reported by: AppChecker Transformed to patch by: Satish Govindarajan @@ -24,5 +24,5 @@ index 2bfd67c8ef3..e6d345f3345 100644 } cur->next = crypto_specs; -- -2.17.0 +2.14.3 diff --git a/0048-arm-efi-Fix-compilation.patch b/0048-arm-efi-Fix-compilation.patch index 40701e5..dcf9e0a 100644 --- a/0048-arm-efi-Fix-compilation.patch +++ b/0048-arm-efi-Fix-compilation.patch @@ -1,7 +1,7 @@ From cb8b7e4e36bf32dccbbba8252aa44ad3ada4fbc1 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 9 Jul 2017 21:48:37 +0000 -Subject: [PATCH 048/238] arm-efi: Fix compilation +Subject: [PATCH 048/250] arm-efi: Fix compilation --- grub-core/loader/arm/linux.c | 8 ++++---- @@ -37,5 +37,5 @@ index 260cbf06861..e64c79a9577 100644 } -- -2.17.0 +2.14.3 diff --git a/0049-fdt-silence-clang-warning.patch b/0049-fdt-silence-clang-warning.patch index f967094..ad39c24 100644 --- a/0049-fdt-silence-clang-warning.patch +++ b/0049-fdt-silence-clang-warning.patch @@ -1,7 +1,7 @@ From 68d54b55f49249c5e0517bf189f0f3df7ee6a36f Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 10 Jul 2017 01:34:22 +0000 -Subject: [PATCH 049/238] fdt: silence clang warning. +Subject: [PATCH 049/250] fdt: silence clang warning. --- grub-core/lib/fdt.c | 3 ++- @@ -22,5 +22,5 @@ index bdc6302448d..2705f2629b9 100644 return 0; return token; -- -2.17.0 +2.14.3 diff --git a/0050-Fix-a-segfault-in-lsefi.patch b/0050-Fix-a-segfault-in-lsefi.patch index 0348702..ae69ebe 100644 --- a/0050-Fix-a-segfault-in-lsefi.patch +++ b/0050-Fix-a-segfault-in-lsefi.patch @@ -1,7 +1,7 @@ From e8ab5a1a9e2889eb59d1fa494ba441a53698dcd2 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 19 Jul 2017 15:47:41 -0400 -Subject: [PATCH 050/238] Fix a segfault in lsefi +Subject: [PATCH 050/250] Fix a segfault in lsefi when protocols_per_handle returns error, we can't use the pointers we passed to it, and that includes trusting num_protocols. @@ -29,5 +29,5 @@ index d901c389263..d1ce99af438 100644 { for (k = 0; k < ARRAY_SIZE (known_protocols); k++) -- -2.17.0 +2.14.3 diff --git a/0051-zfs-remove-size_t-typedef-and-use-grub_size_t-instea.patch b/0051-zfs-remove-size_t-typedef-and-use-grub_size_t-instea.patch index 8524ed4..7386444 100644 --- a/0051-zfs-remove-size_t-typedef-and-use-grub_size_t-instea.patch +++ b/0051-zfs-remove-size_t-typedef-and-use-grub_size_t-instea.patch @@ -1,7 +1,7 @@ From fa42786264cef98c56e972b3bb6b8448000e1c70 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 3 Aug 2017 15:46:15 +0100 -Subject: [PATCH 051/238] zfs: remove size_t typedef and use grub_size_t +Subject: [PATCH 051/250] zfs: remove size_t typedef and use grub_size_t instead * Prevents some toolchains from issuing a warning on size_t redef. @@ -55,5 +55,5 @@ index 2f73449f0d4..5453822d025 100644 const int dec2 = 0; #endif -- -2.17.0 +2.14.3 diff --git a/0052-udf-Fix-reading-label-lvd.ident-is-dstring.patch b/0052-udf-Fix-reading-label-lvd.ident-is-dstring.patch index f6157f1..a9ffcc1 100644 --- a/0052-udf-Fix-reading-label-lvd.ident-is-dstring.patch +++ b/0052-udf-Fix-reading-label-lvd.ident-is-dstring.patch @@ -1,7 +1,7 @@ From 76188809d5ca40c5285b0ab202b5edea7be3f04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 22 Jun 2017 14:33:17 +0200 -Subject: [PATCH 052/238] udf: Fix reading label, lvd.ident is dstring +Subject: [PATCH 052/250] udf: Fix reading label, lvd.ident is dstring UDF dstring has stored length in the last byte of buffer. Therefore last byte is not part of recorded characters. And empty string in dstring is @@ -50,5 +50,5 @@ index 839bff88963..2587456336e 100644 } else -- -2.17.0 +2.14.3 diff --git a/0053-grub-core-fs-udf.c-Add-support-for-UUID.patch b/0053-grub-core-fs-udf.c-Add-support-for-UUID.patch index fe1e4d9..1825e84 100644 --- a/0053-grub-core-fs-udf.c-Add-support-for-UUID.patch +++ b/0053-grub-core-fs-udf.c-Add-support-for-UUID.patch @@ -1,7 +1,7 @@ From 435fa75e01ef40917239c7f775e505e86f70d202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 22 Jun 2017 14:42:16 +0200 -Subject: [PATCH 053/238] * grub-core/fs/udf.c: Add support for UUID +Subject: [PATCH 053/250] * grub-core/fs/udf.c: Add support for UUID Use same algorithm as in libblkid from util-linux v2.30. @@ -187,5 +187,5 @@ index 2587456336e..00a16098b47 100644 .reserved_first_sector = 1, .blocklist_install = 1, -- -2.17.0 +2.14.3 diff --git a/0054-mkrescue-Check-xorriso-presence-before-doing-anythin.patch b/0054-mkrescue-Check-xorriso-presence-before-doing-anythin.patch index 4e07de3..e089c8e 100644 --- a/0054-mkrescue-Check-xorriso-presence-before-doing-anythin.patch +++ b/0054-mkrescue-Check-xorriso-presence-before-doing-anythin.patch @@ -1,7 +1,7 @@ From 9e962fd3c42081e2eef1f99a0eaab38fd04d2620 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 7 Aug 2017 18:05:17 +0200 -Subject: [PATCH 054/238] mkrescue: Check xorriso presence before doing +Subject: [PATCH 054/250] mkrescue: Check xorriso presence before doing anything else. mkrescue can't do anything useful without xorriso, so abort early if it's @@ -46,5 +46,5 @@ index 238d4840e2f..38f1543974e 100644 grub_hostfs_init (); grub_host_init (); -- -2.17.0 +2.14.3 diff --git a/0055-Fail-if-xorriso-failed.patch b/0055-Fail-if-xorriso-failed.patch index 62c0e80..2109ce9 100644 --- a/0055-Fail-if-xorriso-failed.patch +++ b/0055-Fail-if-xorriso-failed.patch @@ -1,7 +1,7 @@ From e66dc5d71ebfc9763420a76c274e6980d54641c3 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 7 Aug 2017 18:08:39 +0200 -Subject: [PATCH 055/238] Fail if xorriso failed. +Subject: [PATCH 055/250] Fail if xorriso failed. If xorriso failed most likely we didn't generate a meaningful image. --- @@ -40,5 +40,5 @@ index 38f1543974e..9545945d8f3 100644 grub_util_unlink_recursive (iso9660_dir); -- -2.17.0 +2.14.3 diff --git a/0056-efi-refactor-grub_efi_allocate_pages.patch b/0056-efi-refactor-grub_efi_allocate_pages.patch index d2c40cd..dafcf7d 100644 --- a/0056-efi-refactor-grub_efi_allocate_pages.patch +++ b/0056-efi-refactor-grub_efi_allocate_pages.patch @@ -1,7 +1,7 @@ From dd5fde2df83c5c03b7ba04d2cc5b7be96de8da7b Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 11:04:23 +0100 -Subject: [PATCH 056/238] efi: refactor grub_efi_allocate_pages +Subject: [PATCH 056/250] efi: refactor grub_efi_allocate_pages Expose a new function, grub_efi_allocate_pages_real(), making it possible to specify allocation type and memory type as supported by the UEFI @@ -116,5 +116,5 @@ index e9c601f3410..b4cbebf3828 100644 grub_efi_uintn_t pages); void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, -- -2.17.0 +2.14.3 diff --git a/0057-Remove-grub_efi_allocate_pages.patch b/0057-Remove-grub_efi_allocate_pages.patch index 279e191..d0a9cc5 100644 --- a/0057-Remove-grub_efi_allocate_pages.patch +++ b/0057-Remove-grub_efi_allocate_pages.patch @@ -1,7 +1,7 @@ From 4bc909bf89f5b4ff86c9e4e609d4fe0c11a66b0c Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 7 Aug 2017 18:33:29 +0200 -Subject: [PATCH 057/238] Remove grub_efi_allocate_pages. +Subject: [PATCH 057/250] Remove grub_efi_allocate_pages. grub_efi_allocate_pages Essentially does 2 unrelated things: * Allocate at fixed address. @@ -248,5 +248,5 @@ index b4cbebf3828..3fa082816ca 100644 grub_efi_uintn_t pages); int -- -2.17.0 +2.14.3 diff --git a/0058-efi-move-fdt-helper-library.patch b/0058-efi-move-fdt-helper-library.patch index d570d98..19ab095 100644 --- a/0058-efi-move-fdt-helper-library.patch +++ b/0058-efi-move-fdt-helper-library.patch @@ -1,7 +1,7 @@ From 8c9465fac901caac6802d6872a1374518b001517 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 11:04:24 +0100 -Subject: [PATCH 058/238] efi: move fdt helper library +Subject: [PATCH 058/250] efi: move fdt helper library There is nothing ARM64 (or even ARM) specific about the efi fdt helper library, which is used for locating or overriding a firmware-provided @@ -89,5 +89,5 @@ similarity index 100% rename from include/grub/arm64/fdtload.h rename to include/grub/efi/fdtload.h -- -2.17.0 +2.14.3 diff --git a/0059-efi-Add-GRUB_PE32_MAGIC-definition.patch b/0059-efi-Add-GRUB_PE32_MAGIC-definition.patch index 2554c5d..e955466 100644 --- a/0059-efi-Add-GRUB_PE32_MAGIC-definition.patch +++ b/0059-efi-Add-GRUB_PE32_MAGIC-definition.patch @@ -1,7 +1,7 @@ From c5841ba7f0d14c193f20854e7e55b4f7ce9207d5 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 11:04:25 +0100 -Subject: [PATCH 059/238] efi: Add GRUB_PE32_MAGIC definition +Subject: [PATCH 059/250] efi: Add GRUB_PE32_MAGIC definition Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete the existing one in arm64/linux.h. @@ -55,5 +55,5 @@ index f79c36c026e..7d44732d2c3 100644 But some examples (such as EFI drivers in the Intel Sample Implementation) use 32 bytes (0x20) instead, and it seems -- -2.17.0 +2.14.3 diff --git a/0060-arm64-linux-loader-improve-type-portability.patch b/0060-arm64-linux-loader-improve-type-portability.patch index c7a2dda..600a9d9 100644 --- a/0060-arm64-linux-loader-improve-type-portability.patch +++ b/0060-arm64-linux-loader-improve-type-portability.patch @@ -1,7 +1,7 @@ From 91212e0aa07e704a61e4540c18a27f149f5e51c3 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 11:04:26 +0100 -Subject: [PATCH 060/238] arm64 linux loader: improve type portability +Subject: [PATCH 060/250] arm64 linux loader: improve type portability In preparation for turning this into a common loader for 32-bit and 64-bit platforms, ensure the code will compile cleanly for either. @@ -111,5 +111,5 @@ index 091e9ddf43d..17212c38d0b 100644 fdt = NULL; } -- -2.17.0 +2.14.3 diff --git a/0061-efi-change-heap-allocation-type-to-GRUB_EFI_LOADER_C.patch b/0061-efi-change-heap-allocation-type-to-GRUB_EFI_LOADER_C.patch index 197ce13..e1fac89 100644 --- a/0061-efi-change-heap-allocation-type-to-GRUB_EFI_LOADER_C.patch +++ b/0061-efi-change-heap-allocation-type-to-GRUB_EFI_LOADER_C.patch @@ -1,7 +1,7 @@ From f826330683675f0deb55b58fd229afd7d65fb053 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 11:04:32 +0100 -Subject: [PATCH 061/238] efi: change heap allocation type to +Subject: [PATCH 061/250] efi: change heap allocation type to GRUB_EFI_LOADER_CODE With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may @@ -32,5 +32,5 @@ index b97b05fe825..ac2a4c556b8 100644 grub_fatal ("cannot allocate conventional memory %p with %u pages", (void *) ((grub_addr_t) start), -- -2.17.0 +2.14.3 diff --git a/0062-core-use-GRUB_TERM_-definitions-when-handling-term-c.patch b/0062-core-use-GRUB_TERM_-definitions-when-handling-term-c.patch index 8d03411..0eff148 100644 --- a/0062-core-use-GRUB_TERM_-definitions-when-handling-term-c.patch +++ b/0062-core-use-GRUB_TERM_-definitions-when-handling-term-c.patch @@ -1,7 +1,7 @@ From bdd89d239cd9b4089630bfb5ec862aab8086dca2 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 7 Aug 2017 16:20:30 +0100 -Subject: [PATCH 062/238] core: use GRUB_TERM_ definitions when handling term +Subject: [PATCH 062/250] core: use GRUB_TERM_ definitions when handling term characters * Also use hex value for GRUB_TERM_ESC as '\e' is not in the C standard and is not understood by some compilers @@ -261,5 +261,5 @@ index 5ffb38f69aa..8117e2a24da 100644 #define GRUB_TERM_BACKSPACE '\b' -- -2.17.0 +2.14.3 diff --git a/0063-io-add-a-GRUB_GZ-prefix-to-gzio-specific-defines.patch b/0063-io-add-a-GRUB_GZ-prefix-to-gzio-specific-defines.patch index 086cfb8..1777cb6 100644 --- a/0063-io-add-a-GRUB_GZ-prefix-to-gzio-specific-defines.patch +++ b/0063-io-add-a-GRUB_GZ-prefix-to-gzio-specific-defines.patch @@ -1,7 +1,7 @@ From 1deebd85ef87cc581e995ce0a51dc0802ac9c367 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 7 Aug 2017 16:23:12 +0100 -Subject: [PATCH 063/238] io: add a GRUB_GZ prefix to gzio specific defines +Subject: [PATCH 063/250] io: add a GRUB_GZ prefix to gzio specific defines * This is done to avoid a conflict with a PACKED define in the EDK2 --- @@ -81,5 +81,5 @@ index 0f2ea6bd845..a8e33033bf8 100644 /* TRANSLATORS: It's about given file having some strange format, not complete lack of gzip support. */ -- -2.17.0 +2.14.3 diff --git a/0064-re-write-.gitignore.patch b/0064-re-write-.gitignore.patch index 7cf3263..720f0f1 100644 --- a/0064-re-write-.gitignore.patch +++ b/0064-re-write-.gitignore.patch @@ -1,7 +1,7 @@ From 38bfcd3054c28aa40234840c12d900f1d18a217d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 8 Aug 2017 12:48:04 -0400 -Subject: [PATCH 064/238] re-write .gitignore +Subject: [PATCH 064/250] re-write .gitignore --- .gitignore | 352 ++++++++++++-------------------------- @@ -496,5 +496,5 @@ index 00000000000..b7e1eb12428 @@ -0,0 +1 @@ +grub -- -2.17.0 +2.14.3 diff --git a/0065-IBM-client-architecture-CAS-reboot-support.patch b/0065-IBM-client-architecture-CAS-reboot-support.patch index 750b54d..d231eda 100644 --- a/0065-IBM-client-architecture-CAS-reboot-support.patch +++ b/0065-IBM-client-architecture-CAS-reboot-support.patch @@ -1,7 +1,7 @@ From bf1fd830091fff49e26f39027e0db8fd4b688624 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Thu, 20 Sep 2012 18:07:39 -0300 -Subject: [PATCH 065/238] IBM client architecture (CAS) reboot support +Subject: [PATCH 065/250] IBM client architecture (CAS) reboot support This is an implementation of IBM client architecture (CAS) reboot for GRUB. @@ -170,5 +170,5 @@ index 8e425130327..9f26c69a2df 100644 #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) -- -2.17.0 +2.14.3 diff --git a/0066-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0066-for-ppc-reset-console-display-attr-when-clear-screen.patch index 422e16a..331b54c 100644 --- a/0066-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0066-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -1,7 +1,7 @@ From 8b30fab3c07a9fc8549e404c411b747b960c57b2 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 24 Apr 2013 10:51:48 -0300 -Subject: [PATCH 066/238] for ppc, reset console display attr when clear screen +Subject: [PATCH 066/250] for ppc, reset console display attr when clear screen v2: Also use \x0c instead of a literal ^L to make future patches less awkward. @@ -28,5 +28,5 @@ index d317efa368d..29df35e6d20 100644 data->reverse_video_off = grub_strdup ("\e[m"); if (grub_strcmp ("ieee1275", str) == 0) -- -2.17.0 +2.14.3 diff --git a/0067-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0067-Disable-GRUB-video-support-for-IBM-power-machines.patch index 7feef6f..bba60e4 100644 --- a/0067-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0067-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -1,7 +1,7 @@ From 45322cbc9402639a431fc0f33bd76e387e6f02bf Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 11 Jun 2013 15:14:05 -0300 -Subject: [PATCH 067/238] Disable GRUB video support for IBM power machines +Subject: [PATCH 067/250] Disable GRUB video support for IBM power machines Should fix the problem in bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=973205 @@ -61,5 +61,5 @@ index 9f26c69a2df..ab4f284c341 100644 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); -- -2.17.0 +2.14.3 diff --git a/0068-Honor-a-symlink-when-generating-configuration-by-gru.patch b/0068-Honor-a-symlink-when-generating-configuration-by-gru.patch index cb3aac9..d62fed6 100644 --- a/0068-Honor-a-symlink-when-generating-configuration-by-gru.patch +++ b/0068-Honor-a-symlink-when-generating-configuration-by-gru.patch @@ -1,7 +1,7 @@ From c29e260c9f41f4f802fa852b6c46fb2e5d912cb6 Mon Sep 17 00:00:00 2001 From: Marcel Kolaja Date: Tue, 21 Jan 2014 10:57:08 -0500 -Subject: [PATCH 068/238] Honor a symlink when generating configuration by +Subject: [PATCH 068/250] Honor a symlink when generating configuration by grub2-mkconfig Honor a symlink when generating configuration by grub2-mkconfig, so that @@ -25,5 +25,5 @@ index f8496d28bdf..3b070fd7632 100644 fi -- -2.17.0 +2.14.3 diff --git a/0069-Move-bash-completion-script-922997.patch b/0069-Move-bash-completion-script-922997.patch index 6365c57..60a1d46 100644 --- a/0069-Move-bash-completion-script-922997.patch +++ b/0069-Move-bash-completion-script-922997.patch @@ -1,7 +1,7 @@ From 8eaf2f497a6bcffc5554509533940ac2b764b981 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Apr 2013 14:35:34 -0400 -Subject: [PATCH 069/238] Move bash completion script (#922997) +Subject: [PATCH 069/250] Move bash completion script (#922997) Apparently these go in a new place now. --- @@ -51,5 +51,5 @@ index 136287cf1bf..61108f05429 100644 $(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status -- -2.17.0 +2.14.3 diff --git a/0070-Update-to-minilzo-2.08.patch b/0070-Update-to-minilzo-2.08.patch index b316b85..3f4692f 100644 --- a/0070-Update-to-minilzo-2.08.patch +++ b/0070-Update-to-minilzo-2.08.patch @@ -1,7 +1,7 @@ From 9a1e99c5628bafa9e3970a5317b721da704bec6a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Dec 2014 15:36:09 -0500 -Subject: [PATCH 070/238] Update to minilzo-2.08 +Subject: [PATCH 070/250] Update to minilzo-2.08 This fixes CVE-2014-4607 - lzo: lzo1x_decompress_safe() integer overflow @@ -8508,5 +8508,5 @@ index 74fefa9fe20..79374546748 100644 -- -2.17.0 +2.14.3 diff --git a/0071-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0071-Allow-fallback-to-include-entries-by-title-not-just-.patch index d8ee4f7..3868901 100644 --- a/0071-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0071-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -1,7 +1,7 @@ From 27845fb323de35e9dcaad8c738eb1a2a2bc316f8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 5 Sep 2014 10:07:04 -0400 -Subject: [PATCH 071/238] Allow "fallback" to include entries by title, not +Subject: [PATCH 071/250] Allow "fallback" to include entries by title, not just number. Resolves: rhbz#1026084 @@ -140,5 +140,5 @@ index e7a83c2d6e2..d2f64b05e0a 100644 static int get_entry_number (grub_menu_t menu, const char *name) -- -2.17.0 +2.14.3 diff --git a/0072-Add-GRUB_DISABLE_UUID.patch b/0072-Add-GRUB_DISABLE_UUID.patch index 3853e2b..81f5cac 100644 --- a/0072-Add-GRUB_DISABLE_UUID.patch +++ b/0072-Add-GRUB_DISABLE_UUID.patch @@ -1,7 +1,7 @@ From 7f7429e93fa791ac2c002beaafab9b9d9bd86b89 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 16:49:25 -0400 -Subject: [PATCH 072/238] Add GRUB_DISABLE_UUID. +Subject: [PATCH 072/250] Add GRUB_DISABLE_UUID. This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name @@ -95,5 +95,5 @@ index 60b31caddeb..cf35e417470 100644 else echo $device |sed 's, ,_,g' -- -2.17.0 +2.14.3 diff --git a/0073-Make-exit-take-a-return-code.patch b/0073-Make-exit-take-a-return-code.patch index 7e719c5..7abd7a5 100644 --- a/0073-Make-exit-take-a-return-code.patch +++ b/0073-Make-exit-take-a-return-code.patch @@ -1,7 +1,7 @@ From 384ccb1b44fc23514a59529f58f984dcc4a75cc9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 26 Feb 2014 21:49:12 -0500 -Subject: [PATCH 073/238] Make "exit" take a return code. +Subject: [PATCH 073/250] Make "exit" take a return code. This adds "exit" with a return code. With this patch, any "exit" command /may/ include a return code, and on platforms that support @@ -255,5 +255,5 @@ index 2a9f87cc255..06208143779 100644 grub_uint64_t d, grub_uint64_t *r); -- -2.17.0 +2.14.3 diff --git a/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch b/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch index 31ff557..5260850 100644 --- a/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch +++ b/0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch @@ -1,7 +1,7 @@ From 939f3dfcfacde13bd7ebfe411c0dceee9e5ed0ae Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 22 Jul 2015 11:21:01 -0400 -Subject: [PATCH 074/238] Mark po/exclude.pot as binary so git won't try to +Subject: [PATCH 074/250] Mark po/exclude.pot as binary so git won't try to diff nonprintables. Signed-off-by: Peter Jones @@ -18,5 +18,5 @@ index 00000000000..33ffaa40460 @@ -0,0 +1 @@ +po/exclude.pot binary -- -2.17.0 +2.14.3 diff --git a/0075-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0075-Make-efi-machines-load-an-env-block-from-a-variable.patch index 9a52994..3b93e0f 100644 --- a/0075-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0075-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -1,7 +1,7 @@ From 805220eb48a8cabcc83628d90aa40f3204b21a71 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 7 Dec 2015 14:20:49 -0500 -Subject: [PATCH 075/238] Make efi machines load an env block from a variable +Subject: [PATCH 075/250] Make efi machines load an env block from a variable Signed-off-by: Peter Jones --- @@ -80,5 +80,5 @@ index 2c31847bf6d..f7782b6e114 100644 char **path); -- -2.17.0 +2.14.3 diff --git a/0076-DHCP-client-ID-and-UUID-options-added.patch b/0076-DHCP-client-ID-and-UUID-options-added.patch index 56b9a6b..ab7ef0f 100644 --- a/0076-DHCP-client-ID-and-UUID-options-added.patch +++ b/0076-DHCP-client-ID-and-UUID-options-added.patch @@ -1,7 +1,7 @@ From cefc164d655fb7709efbc37a317952ff3ec4aeb3 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:18:53 -0200 -Subject: [PATCH 076/238] DHCP client ID and UUID options added. +Subject: [PATCH 076/250] DHCP client ID and UUID options added. --- grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----- @@ -141,5 +141,5 @@ index 1096b24322e..e266bae23f4 100644 }; -- -2.17.0 +2.14.3 diff --git a/0077-trim-arp-packets-with-abnormal-size.patch b/0077-trim-arp-packets-with-abnormal-size.patch index a6b002b..1e67bae 100644 --- a/0077-trim-arp-packets-with-abnormal-size.patch +++ b/0077-trim-arp-packets-with-abnormal-size.patch @@ -1,7 +1,7 @@ From 571a6cce3b0d4c8abf11efc320e2de6ff9188d60 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 5 Feb 2014 09:42:42 -0200 -Subject: [PATCH 077/238] trim arp packets with abnormal size +Subject: [PATCH 077/250] trim arp packets with abnormal size GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it. @@ -27,5 +27,5 @@ index 54306e3b16d..d1c69ed2b55 100644 struct grub_net_buff nb_reply; struct arppkt *arp_reply; -- -2.17.0 +2.14.3 diff --git a/0078-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/0078-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch index 3143e40..c04fa99 100644 --- a/0078-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +++ b/0078-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch @@ -1,7 +1,7 @@ From 6cd959a64f588e256f0ba17e31bf2720b9cdec88 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Wed, 12 Mar 2014 10:58:16 -0400 -Subject: [PATCH 078/238] Fix bad test on GRUB_DISABLE_SUBMENU. +Subject: [PATCH 078/250] Fix bad test on GRUB_DISABLE_SUBMENU. The file /etc/grub.d/10_linux does @@ -37,5 +37,5 @@ index de9044c7f28..cf6331f2a51 100644 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -- -2.17.0 +2.14.3 diff --git a/0079-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/0079-Add-support-for-UEFI-operating-systems-returned-by-o.patch index c6f923c..4b63408 100644 --- a/0079-Add-support-for-UEFI-operating-systems-returned-by-o.patch +++ b/0079-Add-support-for-UEFI-operating-systems-returned-by-o.patch @@ -1,7 +1,7 @@ From 0254265409f80b369c35fb474c7371feb6f9ae1d Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 12 Jun 2013 11:51:49 -0400 -Subject: [PATCH 079/238] Add support for UEFI operating systems returned by +Subject: [PATCH 079/250] Add support for UEFI operating systems returned by os-prober os-prober returns UEFI operating systems in the form: @@ -46,5 +46,5 @@ index 515a68c7aa0..9b8f5968e2d 100644 esac done -- -2.17.0 +2.14.3 diff --git a/0080-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0080-Migrate-PPC-from-Yaboot-to-Grub2.patch index c5c318e..ac1cbba 100644 --- a/0080-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0080-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -1,7 +1,7 @@ From f2b4c105e3657cc32ed0f7aefa713f161cdf64f1 Mon Sep 17 00:00:00 2001 From: Mark Hamzy Date: Wed, 28 Mar 2012 14:46:41 -0500 -Subject: [PATCH 080/238] Migrate PPC from Yaboot to Grub2 +Subject: [PATCH 080/250] 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. @@ -150,5 +150,5 @@ index 00000000000..10d66586820 + terminfo -g ${X}x${Y} ${TERMINAL} +EOF -- -2.17.0 +2.14.3 diff --git a/0081-Add-fw_path-variable-revised.patch b/0081-Add-fw_path-variable-revised.patch index 623d031..3f49910 100644 --- a/0081-Add-fw_path-variable-revised.patch +++ b/0081-Add-fw_path-variable-revised.patch @@ -1,7 +1,7 @@ From 7f021a05a5ed7c97432abbc1762f40e36a4915e3 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 19 Sep 2012 21:22:55 -0300 -Subject: [PATCH 081/238] Add fw_path variable (revised) +Subject: [PATCH 081/250] 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 @@ -77,5 +77,5 @@ index 249e19bc788..759c475c4d9 100644 prefix = grub_env_get ("prefix"); if (prefix) -- -2.17.0 +2.14.3 diff --git a/0082-Add-support-for-linuxefi.patch b/0082-Add-support-for-linuxefi.patch index eea05a2..f797e04 100644 --- a/0082-Add-support-for-linuxefi.patch +++ b/0082-Add-support-for-linuxefi.patch @@ -1,7 +1,7 @@ From 778385965798ac2711f0d07d5cf521a6e999ca8b Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 10 Jul 2012 11:58:52 -0400 -Subject: [PATCH 082/238] Add support for linuxefi +Subject: [PATCH 082/250] Add support for linuxefi --- grub-core/Makefile.core.def | 8 + @@ -478,5 +478,5 @@ index da0ca3b83cd..fc36bdaf367 100644 /* Boot parameters for Linux based on 2.6.12. This is used by the setup -- -2.17.0 +2.14.3 diff --git a/0083-Use-linuxefi-and-initrdefi-where-appropriate.patch b/0083-Use-linuxefi-and-initrdefi-where-appropriate.patch index e0b39df..5e6dcab 100644 --- a/0083-Use-linuxefi-and-initrdefi-where-appropriate.patch +++ b/0083-Use-linuxefi-and-initrdefi-where-appropriate.patch @@ -1,7 +1,7 @@ From 793d4270384ef3373bc0b3c956cab8a8cdb75bcf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 16 Jul 2012 18:57:11 -0400 -Subject: [PATCH 083/238] Use "linuxefi" and "initrdefi" where appropriate. +Subject: [PATCH 083/250] Use "linuxefi" and "initrdefi" where appropriate. --- util/grub.d/10_linux.in | 18 ++++++++++++++++-- @@ -46,5 +46,5 @@ index cf6331f2a51..8ccf012f747 100644 sed "s/^/$submenu_indentation/" << EOF } -- -2.17.0 +2.14.3 diff --git a/0084-Don-t-allow-insmod-when-secure-boot-is-enabled.patch b/0084-Don-t-allow-insmod-when-secure-boot-is-enabled.patch index 574987a..ecfc5ae 100644 --- a/0084-Don-t-allow-insmod-when-secure-boot-is-enabled.patch +++ b/0084-Don-t-allow-insmod-when-secure-boot-is-enabled.patch @@ -1,7 +1,7 @@ From eb8fd62e887e624f5c6e7c2ee8512981e8b5be97 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 23 Oct 2012 10:40:49 -0400 -Subject: [PATCH 084/238] Don't allow insmod when secure boot is enabled. +Subject: [PATCH 084/250] Don't allow insmod when secure boot is enabled. Hi, @@ -120,5 +120,5 @@ index 91e29ce66f1..bb3ab7dfdeb 100644 EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, const grub_efi_device_path_t *dp2); -- -2.17.0 +2.14.3 diff --git a/0085-Pass-x-hex-hex-straight-through-unmolested.patch b/0085-Pass-x-hex-hex-straight-through-unmolested.patch index 3160fca..3c196da 100644 --- a/0085-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0085-Pass-x-hex-hex-straight-through-unmolested.patch @@ -1,7 +1,7 @@ From 0d54ed89090fc1bdcb75de474024b2b81dbf644f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 1 Oct 2012 13:24:37 -0400 -Subject: [PATCH 085/238] Pass "\x[[:hex:]][[:hex:]]" straight through +Subject: [PATCH 085/250] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. --- @@ -179,5 +179,5 @@ index ab78ca87f90..cf6cd6601d6 100644 case '$': if (escaped) -- -2.17.0 +2.14.3 diff --git a/0086-Add-X-option-to-printf-functions.patch b/0086-Add-X-option-to-printf-functions.patch index dc1ce19..93468f5 100644 --- a/0086-Add-X-option-to-printf-functions.patch +++ b/0086-Add-X-option-to-printf-functions.patch @@ -1,7 +1,7 @@ From 6237b1688124d6a72250b296e758ef2d59fde26f Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 16:58:39 -0200 -Subject: [PATCH 086/238] Add %X option to printf functions. +Subject: [PATCH 086/250] Add %X option to printf functions. --- grub-core/kern/misc.c | 7 +++++-- @@ -54,5 +54,5 @@ index 952411d5dc6..8344526be7f 100644 case 'd': { -- -2.17.0 +2.14.3 diff --git a/0087-Search-for-specific-config-file-for-netboot.patch b/0087-Search-for-specific-config-file-for-netboot.patch index 03de788..1768829 100644 --- a/0087-Search-for-specific-config-file-for-netboot.patch +++ b/0087-Search-for-specific-config-file-for-netboot.patch @@ -1,7 +1,7 @@ From 9491cbfdab951e38f096bd9705a76b382f54c9be Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:22:07 -0200 -Subject: [PATCH 087/238] Search for specific config file for netboot +Subject: [PATCH 087/250] 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: @@ -199,5 +199,5 @@ index e266bae23f4..50d62ab0c8c 100644 + #endif /* ! GRUB_NET_HEADER */ -- -2.17.0 +2.14.3 diff --git a/0088-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0088-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index 864cd4d..80f0267 100644 --- a/0088-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0088-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -1,7 +1,7 @@ From 5fcdebdc36cc84c772754b7f5bdb87aed2b42853 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Tue, 22 Jan 2013 06:31:38 +0100 -Subject: [PATCH 088/238] blscfg: add blscfg module to parse Boot Loader +Subject: [PATCH 088/250] blscfg: add blscfg module to parse Boot Loader Specification snippets http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec @@ -247,5 +247,5 @@ index 00000000000..4274aca5a9d + grub_unregister_extcmd (cmd); +} -- -2.17.0 +2.14.3 diff --git a/0089-Don-t-write-messages-to-the-screen.patch b/0089-Don-t-write-messages-to-the-screen.patch index e2b94f2..5fcc8fa 100644 --- a/0089-Don-t-write-messages-to-the-screen.patch +++ b/0089-Don-t-write-messages-to-the-screen.patch @@ -1,7 +1,7 @@ From fc390be631e93744c6a3a2f42849c9edf2614a36 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:30:20 -0400 -Subject: [PATCH 089/238] Don't write messages to the screen +Subject: [PATCH 089/250] Don't write messages to the screen Writing messages to the screen before the menus or boot splash happens so quickly it looks like something is wrong and isn't @@ -177,5 +177,5 @@ index 8ccf012f747..a3d9711d607 100644 EOF fi -- -2.17.0 +2.14.3 diff --git a/0090-Don-t-print-GNU-GRUB-header.patch b/0090-Don-t-print-GNU-GRUB-header.patch index a60440d..8521093 100644 --- a/0090-Don-t-print-GNU-GRUB-header.patch +++ b/0090-Don-t-print-GNU-GRUB-header.patch @@ -1,7 +1,7 @@ From 806c26ae73bc86e305c39c955d86480fad8985df Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:53:48 -0400 -Subject: [PATCH 090/238] Don't print GNU GRUB header +Subject: [PATCH 090/250] Don't print GNU GRUB header No one cares. --- @@ -41,5 +41,5 @@ index b2654ef62e8..f57b7508a76 100644 static void -- -2.17.0 +2.14.3 diff --git a/0091-Don-t-add-to-highlighted-row.patch b/0091-Don-t-add-to-highlighted-row.patch index 4c4b16b..5b18552 100644 --- a/0091-Don-t-add-to-highlighted-row.patch +++ b/0091-Don-t-add-to-highlighted-row.patch @@ -1,7 +1,7 @@ From 5ae2484f263365351a2891be6c056eeb96b3924b Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 17:49:45 -0400 -Subject: [PATCH 091/238] Don't add '*' to highlighted row +Subject: [PATCH 091/250] Don't add '*' to highlighted row It is already highlighted. --- @@ -22,5 +22,5 @@ index e22bb91f6e8..a3d1f23f68f 100644 grub_print_ucs4_menu (unicode_title, unicode_title + len, -- -2.17.0 +2.14.3 diff --git a/0092-Message-string-cleanups.patch b/0092-Message-string-cleanups.patch index f0cc749..66b70b2 100644 --- a/0092-Message-string-cleanups.patch +++ b/0092-Message-string-cleanups.patch @@ -1,7 +1,7 @@ From 622b238ecb927d331dc38083584a7323013b5f21 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 11:09:04 -0400 -Subject: [PATCH 092/238] Message string cleanups +Subject: [PATCH 092/250] Message string cleanups Make use of terminology consistent. Remove jargon. --- @@ -67,5 +67,5 @@ index a3d1f23f68f..64a83862f66 100644 { grub_print_error (); -- -2.17.0 +2.14.3 diff --git a/0093-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0093-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch index b8652d7..15efb90 100644 --- a/0093-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +++ b/0093-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch @@ -1,7 +1,7 @@ From c7dac08ab344638afabf579e03bedfac729e1944 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:23 -0400 -Subject: [PATCH 093/238] Fix border spacing now that we aren't displaying it +Subject: [PATCH 093/250] Fix border spacing now that we aren't displaying it --- grub-core/normal/menu_text.c | 6 +++--- @@ -28,5 +28,5 @@ index 64a83862f66..1062d64ee29 100644 geo->timeout_lines = 2; -- -2.17.0 +2.14.3 diff --git a/0094-Use-the-correct-indentation-for-the-term-help-text.patch b/0094-Use-the-correct-indentation-for-the-term-help-text.patch index 05921fd..956553b 100644 --- a/0094-Use-the-correct-indentation-for-the-term-help-text.patch +++ b/0094-Use-the-correct-indentation-for-the-term-help-text.patch @@ -1,7 +1,7 @@ From 8a59d6c44d946eac70ecbb7a9418c5d6801add8b Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:49 -0400 -Subject: [PATCH 094/238] Use the correct indentation for the term help text +Subject: [PATCH 094/250] Use the correct indentation for the term help text That is consistent with the menu help text --- @@ -24,5 +24,5 @@ index f57b7508a76..0ce59fdc3f0 100644 grub_print_message_indented (msg_formatted, 0, 0, term); grub_putcode ('\n', term); -- -2.17.0 +2.14.3 diff --git a/0095-Indent-menu-entries.patch b/0095-Indent-menu-entries.patch index bf91f14..2542d04 100644 --- a/0095-Indent-menu-entries.patch +++ b/0095-Indent-menu-entries.patch @@ -1,7 +1,7 @@ From 018439ecfda2bc5049ccbfb0d6ab7fa047411a3b Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:30:55 -0400 -Subject: [PATCH 095/238] Indent menu entries +Subject: [PATCH 095/250] Indent menu entries --- grub-core/normal/menu_text.c | 3 ++- @@ -22,5 +22,5 @@ index 1062d64ee29..ecc60f99fc3 100644 grub_print_ucs4_menu (unicode_title, unicode_title + len, -- -2.17.0 +2.14.3 diff --git a/0096-Fix-margins.patch b/0096-Fix-margins.patch index 6a7833c..ca9b45d 100644 --- a/0096-Fix-margins.patch +++ b/0096-Fix-margins.patch @@ -1,7 +1,7 @@ From 33481aa0e7897465ffd386101d6f3eda6e3bbac0 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:59:36 -0400 -Subject: [PATCH 096/238] Fix margins +Subject: [PATCH 096/250] Fix margins --- grub-core/normal/menu_text.c | 8 +++----- @@ -33,5 +33,5 @@ index ecc60f99fc3..0e43f2c10cc 100644 - geo->timeout_lines /* timeout */ - 1 /* empty final line */; -- -2.17.0 +2.14.3 diff --git a/0097-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0097-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch index b2c25a5..a35b947 100644 --- a/0097-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +++ b/0097-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch @@ -1,7 +1,7 @@ From ea032bd4a6cb66929da61477b1759e136c975189 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 21 Jun 2013 14:44:08 -0400 -Subject: [PATCH 097/238] Use -2 instead of -1 for our right-hand margin, so +Subject: [PATCH 097/250] Use -2 instead of -1 for our right-hand margin, so linewrapping works (#976643). Signed-off-by: Peter Jones @@ -23,5 +23,5 @@ index 0e43f2c10cc..537d4bf86ff 100644 geo->first_entry_y = 3; /* three empty lines*/ -- -2.17.0 +2.14.3 diff --git a/0098-Use-linux16-when-appropriate-880840.patch b/0098-Use-linux16-when-appropriate-880840.patch index 8427939..d562a39 100644 --- a/0098-Use-linux16-when-appropriate-880840.patch +++ b/0098-Use-linux16-when-appropriate-880840.patch @@ -1,7 +1,7 @@ From 8e1957d59e7e72850cbac7e779ddf22ca23c250d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:05:07 -0400 -Subject: [PATCH 098/238] Use linux16 when appropriate (#880840) +Subject: [PATCH 098/250] Use linux16 when appropriate (#880840) The kernel group really would prefer that we use the 16 bit entry point on x86 bios machines. @@ -48,5 +48,5 @@ index a3d9711d607..f3bf6acd856 100644 fi fi -- -2.17.0 +2.14.3 diff --git a/0099-Enable-pager-by-default.-985860.patch b/0099-Enable-pager-by-default.-985860.patch index 77997f6..d52f5fa 100644 --- a/0099-Enable-pager-by-default.-985860.patch +++ b/0099-Enable-pager-by-default.-985860.patch @@ -1,7 +1,7 @@ From 7466f51a0012ebdd8be07cfc0e63d50e0e79560d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:09:27 -0400 -Subject: [PATCH 099/238] Enable pager by default. (#985860) +Subject: [PATCH 099/250] Enable pager by default. (#985860) Signed-off-by: Peter Jones --- @@ -22,5 +22,5 @@ index 93a90233ead..858b526c925 100644 load_env fi -- -2.17.0 +2.14.3 diff --git a/0100-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0100-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch index a719361..604af31 100644 --- a/0100-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +++ b/0100-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch @@ -1,7 +1,7 @@ From 7a97d9621a145cbd04111970fea04c34433f900c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:13:27 -0400 -Subject: [PATCH 100/238] F10 doesn't work on serial, so don't tell the user to +Subject: [PATCH 100/250] F10 doesn't work on serial, so don't tell the user to hit it (#987443) Signed-off-by: Peter Jones @@ -23,5 +23,5 @@ index 537d4bf86ff..452d55bf9ff 100644 STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); -- -2.17.0 +2.14.3 diff --git a/0101-Don-t-say-GNU-Linux-in-generated-menus.patch b/0101-Don-t-say-GNU-Linux-in-generated-menus.patch index aaf22c4..608c8b8 100644 --- a/0101-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0101-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -1,7 +1,7 @@ From 45877a77f50eecd0b7fd3ba1aec0d4398a3b6a20 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 14 Mar 2011 14:27:42 -0400 -Subject: [PATCH 101/238] Don't say "GNU/Linux" in generated menus. +Subject: [PATCH 101/250] Don't say "GNU/Linux" in generated menus. --- util/grub.d/10_linux.in | 4 ++-- @@ -41,5 +41,5 @@ index c002fc9f946..54f1ec8a2fd 100644 fi -- -2.17.0 +2.14.3 diff --git a/0102-Don-t-draw-a-border-around-the-menu.patch b/0102-Don-t-draw-a-border-around-the-menu.patch index 6bde118..fd4db40 100644 --- a/0102-Don-t-draw-a-border-around-the-menu.patch +++ b/0102-Don-t-draw-a-border-around-the-menu.patch @@ -1,7 +1,7 @@ From c28a3053e96859000df5ff1d48c9a560d47c0470 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 16:47:33 -0400 -Subject: [PATCH 102/238] Don't draw a border around the menu +Subject: [PATCH 102/250] Don't draw a border around the menu It looks cleaner without it. --- @@ -70,5 +70,5 @@ index 452d55bf9ff..1ed2bd92cf8 100644 grub_term_highlight_color = old_color_highlight; geo->timeout_y = geo->first_entry_y + geo->num_entries -- -2.17.0 +2.14.3 diff --git a/0103-Use-the-standard-margin-for-the-timeout-string.patch b/0103-Use-the-standard-margin-for-the-timeout-string.patch index 44ef479..ac54bbb 100644 --- a/0103-Use-the-standard-margin-for-the-timeout-string.patch +++ b/0103-Use-the-standard-margin-for-the-timeout-string.patch @@ -1,7 +1,7 @@ From 93018f5d1727eb58dead129f150a36080c22530a Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 10:52:32 -0400 -Subject: [PATCH 103/238] Use the standard margin for the timeout string +Subject: [PATCH 103/250] Use the standard margin for the timeout string So that it aligns with the other messages --- @@ -39,5 +39,5 @@ index 1ed2bd92cf8..7681f7d2893 100644 } -- -2.17.0 +2.14.3 diff --git a/0104-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0104-Add-.eh_frame-to-list-of-relocations-stripped.patch index de0a2fc..757b028 100644 --- a/0104-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0104-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -1,7 +1,7 @@ From c626121f38adf6fcd39a5f69249c650b4b52c10d Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 13 Jan 2014 21:50:59 -0500 -Subject: [PATCH 104/238] Add .eh_frame to list of relocations stripped +Subject: [PATCH 104/250] Add .eh_frame to list of relocations stripped --- conf/Makefile.common | 2 +- @@ -21,5 +21,5 @@ index 311da61c6c5..044ab3abe88 100644 CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d -- -2.17.0 +2.14.3 diff --git a/0105-Make-10_linux-work-with-our-changes-for-linux16-and-.patch b/0105-Make-10_linux-work-with-our-changes-for-linux16-and-.patch index 3c4fb2f..83993b9 100644 --- a/0105-Make-10_linux-work-with-our-changes-for-linux16-and-.patch +++ b/0105-Make-10_linux-work-with-our-changes-for-linux16-and-.patch @@ -1,7 +1,7 @@ From 59275c83e7a303c63379d37ba21aa39a3c3b7203 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 13:12:23 -0500 -Subject: [PATCH 105/238] Make 10_linux work with our changes for linux16 and +Subject: [PATCH 105/250] Make 10_linux work with our changes for linux16 and linuxefi on aarch64 Signed-off-by: Peter Jones @@ -81,5 +81,5 @@ index ef52cf3dbbb..191aebe80bb 100644 for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do if test -e "${i}" ; then -- -2.17.0 +2.14.3 diff --git a/0106-Don-t-print-during-fdt-loading-method.patch b/0106-Don-t-print-during-fdt-loading-method.patch index d8777ea..16d5fc1 100644 --- a/0106-Don-t-print-during-fdt-loading-method.patch +++ b/0106-Don-t-print-during-fdt-loading-method.patch @@ -1,7 +1,7 @@ From aedf2aceb354ab7bf28bbf70d0a4b505c0adcfdf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 16:15:46 -0500 -Subject: [PATCH 106/238] Don't print during fdt loading method. +Subject: [PATCH 106/250] Don't print during fdt loading method. Signed-off-by: Peter Jones --- @@ -23,5 +23,5 @@ index 191aebe80bb..452a9f69d28 100644 EOF fi -- -2.17.0 +2.14.3 diff --git a/0107-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/0107-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch index 2ed85e9..827881e 100644 --- a/0107-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +++ b/0107-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch @@ -1,7 +1,7 @@ From f2790b1f7c8efcd5589c8fcdaca51b548ab9825c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 30 Jun 2014 14:16:46 -0400 -Subject: [PATCH 107/238] Don't munge raw spaces when we're doing our cmdline +Subject: [PATCH 107/250] Don't munge raw spaces when we're doing our cmdline escaping (#923374) Signed-off-by: Peter Jones @@ -32,5 +32,5 @@ index 0a5b2afb94b..970ea868c14 100644 { *buf++ = *c++; -- -2.17.0 +2.14.3 diff --git a/0108-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0108-Don-t-require-a-password-to-boot-entries-generated-b.patch index 14d965c..2907ff2 100644 --- a/0108-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0108-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -1,7 +1,7 @@ From 205a7844bea4d849dc24f24b5fc96f6040d5e2b9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 11 Feb 2014 11:14:50 -0500 -Subject: [PATCH 108/238] Don't require a password to boot entries generated by +Subject: [PATCH 108/250] Don't require a password to boot entries generated by grub-mkconfig. When we set a password, we just want that to mean you can't /edit/ an entry. @@ -27,5 +27,5 @@ index 452a9f69d28..79a747ebd4d 100644 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS="$(sed 's, release .*$,,g' /etc/system-release)" -- -2.17.0 +2.14.3 diff --git a/0109-Don-t-emit-Booting-.-message.patch b/0109-Don-t-emit-Booting-.-message.patch index f9919aa..162d2ea 100644 --- a/0109-Don-t-emit-Booting-.-message.patch +++ b/0109-Don-t-emit-Booting-.-message.patch @@ -1,7 +1,7 @@ From c986c38f790881be0b9c5b0acd8d3b106412a5f1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 09:37:49 -0500 -Subject: [PATCH 109/238] Don't emit "Booting ..." message. +Subject: [PATCH 109/250] Don't emit "Booting ..." message. UI team still hates this stuff, so we're disabling it for RHEL 7. @@ -48,5 +48,5 @@ index cdf3590a364..5785f67ee1c 100644 errs_before = grub_err_printed_errors; -- -2.17.0 +2.14.3 diff --git a/0110-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0110-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index ad55973..1458381 100644 --- a/0110-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0110-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -1,7 +1,7 @@ From dcf3b9c590f00e33f773de68ac4ebd55ca4f6e90 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 4 Mar 2014 11:00:23 -0500 -Subject: [PATCH 110/238] Replace a lot of man pages with slightly nicer ones. +Subject: [PATCH 110/250] Replace a lot of man pages with slightly nicer ones. Replace a bunch of machine generated ones with ones that look nicer. --- @@ -1959,5 +1959,5 @@ index 00000000000..37ea2dd5eaa +.SH SEE ALSO +.BR "info grub" -- -2.17.0 +2.14.3 diff --git a/0111-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0111-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index b94bca0..0c606d9 100644 --- a/0111-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0111-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -1,7 +1,7 @@ From 24865a88781aef2a6a54433b5b383219108f54fa Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 19 Feb 2014 15:58:43 -0500 -Subject: [PATCH 111/238] use fw_path prefix when fallback searching for grub +Subject: [PATCH 111/250] use fw_path prefix when fallback searching for grub config When PXE booting via UEFI firmware, grub was searching for grub.cfg @@ -41,5 +41,5 @@ index 0ce59fdc3f0..a3713efcd90 100644 { grub_size_t config_len; -- -2.17.0 +2.14.3 diff --git a/0112-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0112-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 15362f3..467e537 100644 --- a/0112-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0112-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -1,7 +1,7 @@ From d4cd9aa8695ab9448da41f756553beb75bffee46 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 6 Mar 2014 11:51:33 -0500 -Subject: [PATCH 112/238] Try mac/guid/etc before grub.cfg on tftp config +Subject: [PATCH 112/250] Try mac/guid/etc before grub.cfg on tftp config files. Signed-off-by: Peter Jones @@ -111,5 +111,5 @@ index a3713efcd90..7d9c4f09b9b 100644 else grub_enter_normal_mode (argv[0]); -- -2.17.0 +2.14.3 diff --git a/0113-Fix-convert-function-to-support-NVMe-devices.patch b/0113-Fix-convert-function-to-support-NVMe-devices.patch index 68d49cf..d9b3039 100644 --- a/0113-Fix-convert-function-to-support-NVMe-devices.patch +++ b/0113-Fix-convert-function-to-support-NVMe-devices.patch @@ -1,7 +1,7 @@ From 397f179c26aeddf3fe452c62aa404459889835fc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 11:34:00 -0500 -Subject: [PATCH 113/238] Fix convert function to support NVMe devices +Subject: [PATCH 113/250] Fix convert function to support NVMe devices This is adapted from the patch at https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against @@ -55,5 +55,5 @@ index 847406fbab0..fa3460d6cd8 100644 return grub_util_devmapper_part_to_disk (&st, is_part, os_dev); -- -2.17.0 +2.14.3 diff --git a/0114-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch b/0114-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch index 58f3179..fec7673 100644 --- a/0114-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch +++ b/0114-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch @@ -1,7 +1,7 @@ From 4291f418c3304f0f379467e87ce5892853cc16c7 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 10 Feb 2014 16:13:10 -0500 -Subject: [PATCH 114/238] Switch to use APM Mustang device tree, for hardware +Subject: [PATCH 114/250] Switch to use APM Mustang device tree, for hardware testing. Signed-off-by: David A. Marlin @@ -25,5 +25,5 @@ index 79a747ebd4d..462b461ff49 100644 fi done -- -2.17.0 +2.14.3 diff --git a/0115-Use-the-default-device-tree-from-the-grub-default-fi.patch b/0115-Use-the-default-device-tree-from-the-grub-default-fi.patch index d883bde..5cea59b 100644 --- a/0115-Use-the-default-device-tree-from-the-grub-default-fi.patch +++ b/0115-Use-the-default-device-tree-from-the-grub-default-fi.patch @@ -1,7 +1,7 @@ From 5111bdda0d0a21ab02f6c9aa441a32cd02c6bc3f Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 12 Feb 2014 14:54:04 -0500 -Subject: [PATCH 115/238] Use the default device tree from the grub default +Subject: [PATCH 115/250] Use the default device tree from the grub default file instead of hardcoding a value. @@ -42,5 +42,5 @@ index 462b461ff49..a9692a0c2a2 100644 fi done -- -2.17.0 +2.14.3 diff --git a/0116-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0116-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index b85d9a1..04cfc57 100644 --- a/0116-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0116-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,7 +1,7 @@ From 0ff5bf3deefdb17dbadb51a11acc50b96e2ed797 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Sat, 15 Feb 2014 15:10:22 -0500 -Subject: [PATCH 116/238] reopen SNP protocol for exclusive use by grub +Subject: [PATCH 116/250] reopen SNP protocol for exclusive use by grub --- grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++ @@ -42,5 +42,5 @@ index 5388f952ba9..ea0e0ca360e 100644 } } -- -2.17.0 +2.14.3 diff --git a/0117-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0117-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index befbc8b..4dca0ad 100644 --- a/0117-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0117-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,7 +1,7 @@ From 58fba65b7e339d4c7279e4ca88937d9501275169 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Mar 2016 15:13:59 -0500 -Subject: [PATCH 117/238] Revert "reopen SNP protocol for exclusive use by +Subject: [PATCH 117/250] Revert "reopen SNP protocol for exclusive use by grub" This reverts commit a3f2c756ce34c9666bddef35e3b3b85ccecdcffc , which is @@ -51,5 +51,5 @@ index ea0e0ca360e..5388f952ba9 100644 } } -- -2.17.0 +2.14.3 diff --git a/0118-Add-grub_util_readlink.patch b/0118-Add-grub_util_readlink.patch index ebf3407..f2068b9 100644 --- a/0118-Add-grub_util_readlink.patch +++ b/0118-Add-grub_util_readlink.patch @@ -1,7 +1,7 @@ From 76baa996f73eea47f7bdc41461efeee204626e2d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:01:03 -0400 -Subject: [PATCH 118/238] Add grub_util_readlink() +Subject: [PATCH 118/250] Add grub_util_readlink() Add grub_util_readlink(). This requires pulling in stat and readlink from gnulib, which pulls in stat and related headers, but after that the @@ -3730,5 +3730,5 @@ index 00000000000..9852778f9a5 + REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) +]) -- -2.17.0 +2.14.3 diff --git a/0119-Make-editenv-chase-symlinks-including-those-across-d.patch b/0119-Make-editenv-chase-symlinks-including-those-across-d.patch index 8dab5ed..3feb8a9 100644 --- a/0119-Make-editenv-chase-symlinks-including-those-across-d.patch +++ b/0119-Make-editenv-chase-symlinks-including-those-across-d.patch @@ -1,7 +1,7 @@ From fd1a89c8bef603ec33937f122ae25013a724601a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:38:00 -0400 -Subject: [PATCH 119/238] Make editenv chase symlinks including those across +Subject: [PATCH 119/250] Make editenv chase symlinks including those across devices. This lets us make /boot/grub2/grubenv a symlink to @@ -102,5 +102,5 @@ index c6f8d2298c3..d8d1dad6ab9 100644 + free (rename_target); } -- -2.17.0 +2.14.3 diff --git a/0120-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0120-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index d52f79b..7715d55 100644 --- a/0120-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0120-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -1,7 +1,7 @@ From c8d93b9e27e9cbf51e91f6cc99abbcb7b68189ce Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 14:23:23 -0400 -Subject: [PATCH 120/238] Generate OS and CLASS in 10_linux from +Subject: [PATCH 120/250] Generate OS and CLASS in 10_linux from /etc/os-release This makes us use pretty names in the titles we generate in @@ -29,5 +29,5 @@ index a9692a0c2a2..c6627268cca 100644 OS="${GRUB_DISTRIBUTOR}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -- -2.17.0 +2.14.3 diff --git a/0121-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0121-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index 32a52a7..470193a 100644 --- a/0121-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0121-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -1,7 +1,7 @@ From 974241c42b03f3ccb6a5d0eb453283e370da9848 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 15:52:08 -0400 -Subject: [PATCH 121/238] Minimize the sort ordering for .debug and -rescue- +Subject: [PATCH 121/250] Minimize the sort ordering for .debug and -rescue- kernels. Resolves: rhbz#1065360 @@ -30,5 +30,5 @@ index cf35e417470..10fabee5e14 100644 version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" return "$?" -- -2.17.0 +2.14.3 diff --git a/0122-Load-arm-with-SB-enabled.patch b/0122-Load-arm-with-SB-enabled.patch index f8f21a9..bc6b903 100644 --- a/0122-Load-arm-with-SB-enabled.patch +++ b/0122-Load-arm-with-SB-enabled.patch @@ -1,7 +1,7 @@ From edfc2b0952b1eacf95188e53167cc038e5ea0129 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 18 Sep 2014 11:26:14 -0400 -Subject: [PATCH 122/238] Load arm with SB enabled. +Subject: [PATCH 122/250] Load arm with SB enabled. Make sure we actually try to validate secure boot on this platform (even though we're not shipping it enabled by default.) @@ -425,5 +425,5 @@ index 00000000000..d9ede36773b + +#endif /* ! GRUB_EFI_LINUX_HEADER */ -- -2.17.0 +2.14.3 diff --git a/0123-Try-prefix-if-fw_path-doesn-t-work.patch b/0123-Try-prefix-if-fw_path-doesn-t-work.patch index 37b8d86..890b3d2 100644 --- a/0123-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0123-Try-prefix-if-fw_path-doesn-t-work.patch @@ -1,7 +1,7 @@ From 3846b040f1050f246e1e975ee88f22c687ae04bf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 3 Oct 2014 11:08:03 -0400 -Subject: [PATCH 123/238] Try $prefix if $fw_path doesn't work. +Subject: [PATCH 123/250] Try $prefix if $fw_path doesn't work. Related: rhbz#1148652 @@ -207,5 +207,5 @@ index 7d9c4f09b9b..b69f9e738fa 100644 } -- -2.17.0 +2.14.3 diff --git a/0124-Update-info-with-grub.cfg-netboot-selection-order-11.patch b/0124-Update-info-with-grub.cfg-netboot-selection-order-11.patch index a236d0c..3d383d3 100644 --- a/0124-Update-info-with-grub.cfg-netboot-selection-order-11.patch +++ b/0124-Update-info-with-grub.cfg-netboot-selection-order-11.patch @@ -1,7 +1,7 @@ From d4b4184078610a3639fa1e0e463679c424496c3b Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 16:34:51 -0400 -Subject: [PATCH 124/238] Update info with grub.cfg netboot selection order +Subject: [PATCH 124/250] Update info with grub.cfg netboot selection order (#1148650) Added documentation to the grub info page that specifies the order @@ -66,5 +66,5 @@ index 6fdd2a041f7..15a90b26e4d 100644 @samp{(tftp)} device. -- -2.17.0 +2.14.3 diff --git a/0125-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0125-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index d8974b1..7735a49 100644 --- a/0125-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0125-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -1,7 +1,7 @@ From ce125cafc1e94bf70f2a3dbb545960bd8dd23a2f Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH 125/238] Use Distribution Package Sort for grub2-mkconfig +Subject: [PATCH 125/250] Use Distribution Package Sort for grub2-mkconfig (#1124074) Users reported that newly installed kernels on their systems installed @@ -447,5 +447,5 @@ index 00000000000..8ce21488448 +.SH SEE ALSO +.BR "info grub" -- -2.17.0 +2.14.3 diff --git a/0126-Handle-rssd-storage-devices.patch b/0126-Handle-rssd-storage-devices.patch index 0e870b6..34f7da2 100644 --- a/0126-Handle-rssd-storage-devices.patch +++ b/0126-Handle-rssd-storage-devices.patch @@ -1,7 +1,7 @@ From 1956a2192ac0a8421ee83bf77fdf223f2be0bdfb Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 30 Jun 2015 15:50:41 -0400 -Subject: [PATCH 126/238] Handle rssd storage devices. +Subject: [PATCH 126/250] Handle rssd storage devices. Resolves: rhbz#1087962 @@ -35,5 +35,5 @@ index 90d92d3ad5c..6d9f4e5faa2 100644 if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') { -- -2.17.0 +2.14.3 diff --git a/0127-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch b/0127-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch index ff9359b..b0eafb8 100644 --- a/0127-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch +++ b/0127-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch @@ -1,7 +1,7 @@ From 5f89c77c7cff17c931f1ea52af0c39df8ab28ac9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 27 Oct 2014 09:22:55 -0400 -Subject: [PATCH 127/238] Try to emit linux16/initrd16 and linuxefi/initrdefi +Subject: [PATCH 127/250] Try to emit linux16/initrd16 and linuxefi/initrdefi in 30-os_prober. Resolves: rhbz#1108296 @@ -73,5 +73,5 @@ index 9b8f5968e2d..dc98eace934 100644 fi cat << EOF -- -2.17.0 +2.14.3 diff --git a/0128-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0128-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index d4fc416..de75077 100644 --- a/0128-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0128-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -1,7 +1,7 @@ From c7ae420d095ccec20481c25b14773ab2fce658b5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 28 Apr 2015 11:15:03 -0400 -Subject: [PATCH 128/238] Make grub2-mkconfig construct titles that look like +Subject: [PATCH 128/250] Make grub2-mkconfig construct titles that look like the ones we want elsewhere. Resolves: rhbz#1215839 @@ -50,5 +50,5 @@ index c6627268cca..1215241859b 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else -- -2.17.0 +2.14.3 diff --git a/0129-Add-friendly-grub2-password-config-tool-985962.patch b/0129-Add-friendly-grub2-password-config-tool-985962.patch index 73e8841..725011c 100644 --- a/0129-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0129-Add-friendly-grub2-password-config-tool-985962.patch @@ -1,7 +1,7 @@ From 68f21f5ebebc23a6d8512631f2a1d474afcccd43 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Thu, 25 Jun 2015 11:13:11 -0400 -Subject: [PATCH 129/238] Add friendly grub2 password config tool (#985962) +Subject: [PATCH 129/250] Add friendly grub2 password config tool (#985962) Provided a tool for users to reset the grub2 root user password without having to alter the grub.cfg. The hashed password now @@ -271,5 +271,5 @@ index 00000000000..db2f44bfb78 +fi +EOF -- -2.17.0 +2.14.3 diff --git a/0130-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0130-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 920d8f3..80670fe 100644 --- a/0130-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0130-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -1,7 +1,7 @@ From 7a7644507e4d953ea8f8d1d7133622a72a2168f5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 28 Apr 2015 11:15:03 -0400 -Subject: [PATCH 130/238] Make grub2-mkconfig construct titles that look like +Subject: [PATCH 130/250] Make grub2-mkconfig construct titles that look like the ones we want elsewhere. Resolves: rhbz#1215839 @@ -63,5 +63,5 @@ index 1215241859b..584ad1f4639 100644 replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" -- -2.17.0 +2.14.3 diff --git a/0131-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch b/0131-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch index 2d13ea9..66100ec 100644 --- a/0131-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch +++ b/0131-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch @@ -1,7 +1,7 @@ From 6f892038567f1706fdde819f5f226ec4cacbea47 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 3 Aug 2015 11:46:42 -0400 -Subject: [PATCH 131/238] Try to make sure configure.ac and grub-rpm-sort play +Subject: [PATCH 131/250] Try to make sure configure.ac and grub-rpm-sort play nice. Apparently the test for whether to use grub-rpm-sort and also the @@ -57,5 +57,5 @@ index 954844d2d95..9c410eae493 100644 version_test_numeric () -- -2.17.0 +2.14.3 diff --git a/0132-tcp-add-window-scaling-support.patch b/0132-tcp-add-window-scaling-support.patch index 5bf9a50..c76bc02 100644 --- a/0132-tcp-add-window-scaling-support.patch +++ b/0132-tcp-add-window-scaling-support.patch @@ -1,7 +1,7 @@ From 71e31c279c07f9f51f2a482b70b40b7deed69a69 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 12 Aug 2015 08:57:55 -0700 -Subject: [PATCH 132/238] tcp: add window scaling support +Subject: [PATCH 132/250] tcp: add window scaling support Sometimes we have to provision boxes across regions, such as California to Sweden. The http server has a 10 minute timeout, so if we can't get our 250mb @@ -86,5 +86,5 @@ index e8ad34b84d4..7d4b822626d 100644 tcp_socket_register (socket); -- -2.17.0 +2.14.3 diff --git a/0133-efinet-retransmit-if-our-device-is-busy.patch b/0133-efinet-retransmit-if-our-device-is-busy.patch index bbd003e..4abd286 100644 --- a/0133-efinet-retransmit-if-our-device-is-busy.patch +++ b/0133-efinet-retransmit-if-our-device-is-busy.patch @@ -1,7 +1,7 @@ From d09f32622f6fc247dd88f731c34be10395785d8d Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Mon, 31 Aug 2015 13:34:35 -0400 -Subject: [PATCH 133/238] efinet: retransmit if our device is busy +Subject: [PATCH 133/250] efinet: retransmit if our device is busy When I fixed the txbuf handling I ripped out the retransmission code since it was flooding our network when we had the buggy behavior. Turns out this was too @@ -44,5 +44,5 @@ index 5388f952ba9..3f112438a93 100644 return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet")); -- -2.17.0 +2.14.3 diff --git a/0134-Be-more-aggro-about-actually-using-the-configured-ne.patch b/0134-Be-more-aggro-about-actually-using-the-configured-ne.patch index 275e50e..d2ecca3 100644 --- a/0134-Be-more-aggro-about-actually-using-the-configured-ne.patch +++ b/0134-Be-more-aggro-about-actually-using-the-configured-ne.patch @@ -1,7 +1,7 @@ From 8ece44c2c8f88f531ac9a679f65a263e7b6d2dba Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 11 Sep 2015 17:30:49 -0400 -Subject: [PATCH 134/238] Be more aggro about actually using the *configured* +Subject: [PATCH 134/250] Be more aggro about actually using the *configured* network device. Right now we use any SNP device with the same mac+IP block, but when @@ -220,5 +220,5 @@ index c7c9f0e1db1..97b9aa7a4d7 100644 #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length) -- -2.17.0 +2.14.3 diff --git a/0135-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch b/0135-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch index c81137c..a11df9e 100644 --- a/0135-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch +++ b/0135-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch @@ -1,7 +1,7 @@ From 82b9fdcbbc339c36842c625203fc2b1f22a86c9e Mon Sep 17 00:00:00 2001 From: RHEL Ninjas Date: Fri, 25 Sep 2015 16:24:23 +0900 -Subject: [PATCH 135/238] efinet: add filter for the first exclusive reopen of +Subject: [PATCH 135/250] efinet: add filter for the first exclusive reopen of SNP --- @@ -59,5 +59,5 @@ index a3ce4c67cce..b870d3f1938 100644 } } -- -2.17.0 +2.14.3 diff --git a/0136-Fix-security-issue-when-reading-username-and-passwor.patch b/0136-Fix-security-issue-when-reading-username-and-passwor.patch index 6dda9cd..706f242 100644 --- a/0136-Fix-security-issue-when-reading-username-and-passwor.patch +++ b/0136-Fix-security-issue-when-reading-username-and-passwor.patch @@ -1,7 +1,7 @@ From 9961e63642244617b697d93bbc49379e23b6839d Mon Sep 17 00:00:00 2001 From: Hector Marco-Gisbert Date: Fri, 13 Nov 2015 16:21:09 +0100 -Subject: [PATCH 136/238] Fix security issue when reading username and password +Subject: [PATCH 136/250] Fix security issue when reading username and password This patch fixes two integer underflows at: * grub-core/lib/crypto.c @@ -43,5 +43,5 @@ index 6be678c0de1..c35ce972473 100644 if (cur_len) { -- -2.17.0 +2.14.3 diff --git a/0137-Warn-if-grub-password-will-not-be-read-1290803.patch b/0137-Warn-if-grub-password-will-not-be-read-1290803.patch index f58e9b7..0a4b001 100644 --- a/0137-Warn-if-grub-password-will-not-be-read-1290803.patch +++ b/0137-Warn-if-grub-password-will-not-be-read-1290803.patch @@ -1,7 +1,7 @@ From 056a956aea898f9d3ee34ecad9660addc3f3108c Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 22 Feb 2016 15:30:05 -0500 -Subject: [PATCH 137/238] Warn if grub password will not be read (#1290803) +Subject: [PATCH 137/250] Warn if grub password will not be read (#1290803) It is possible for a system to have never run grub-mkconfig and add the section that reads the user.cfg file which contains a user set GRUB @@ -27,5 +27,5 @@ index dd76f00fc0e..fb9d3a3b6f9 100644 + echo "Update your configuration with @grub_mkconfig@ to support this feature." +fi -- -2.17.0 +2.14.3 diff --git a/0138-Clean-up-grub-setpassword-documentation-1290799.patch b/0138-Clean-up-grub-setpassword-documentation-1290799.patch index 35f7064..d16c948 100644 --- a/0138-Clean-up-grub-setpassword-documentation-1290799.patch +++ b/0138-Clean-up-grub-setpassword-documentation-1290799.patch @@ -1,7 +1,7 @@ From 92af2b24adb7371d8234c0b32ae716adf0b80d42 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Tue, 26 Jan 2016 10:28:35 -0500 -Subject: [PATCH 138/238] Clean up grub-setpassword documentation (#1290799) +Subject: [PATCH 138/250] Clean up grub-setpassword documentation (#1290799) The output for --help had some errors. Corrected those and polished the text to be a little easier to follow. Carried verbage over to man page @@ -54,5 +54,5 @@ index fb9d3a3b6f9..c8c0fa4199d 100644 Report bugs at https://bugzilla.redhat.com. EOF -- -2.17.0 +2.14.3 diff --git a/0139-Fix-locale-issue-in-grub-setpassword-1294243.patch b/0139-Fix-locale-issue-in-grub-setpassword-1294243.patch index ad97458..899b005 100644 --- a/0139-Fix-locale-issue-in-grub-setpassword-1294243.patch +++ b/0139-Fix-locale-issue-in-grub-setpassword-1294243.patch @@ -1,7 +1,7 @@ From 373adc50cf9f09015e40ffd1bf79ab9f291f4fc2 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Fri, 29 Jan 2016 16:56:11 -0500 -Subject: [PATCH 139/238] Fix locale issue in grub-setpassword (#1294243) +Subject: [PATCH 139/250] Fix locale issue in grub-setpassword (#1294243) A shell substitution was expecting non-translated output to grab the hashed password and put it in the user.cfg file. Modified code to force @@ -26,5 +26,5 @@ index c8c0fa4199d..d7924af5192 100644 sed -e "s/PBKDF2 hash of your password is //" } -- -2.17.0 +2.14.3 diff --git a/0140-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch b/0140-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch index 384c447..7d9563f 100644 --- a/0140-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch +++ b/0140-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch @@ -1,7 +1,7 @@ From eab0520310030376f6295e0338e874bce10b0d5f Mon Sep 17 00:00:00 2001 From: Robert Elliott Date: Fri, 22 Jan 2016 13:32:30 +0100 -Subject: [PATCH 140/238] efiemu: Handle persistent RAM and unknown possible +Subject: [PATCH 140/250] efiemu: Handle persistent RAM and unknown possible future additions. (cherry picked from commit ae3b83a4d4df75a01198a2fed7542391e7c449e0) @@ -27,5 +27,5 @@ index 52a032f7b2e..92e7df7e501 100644 GRUB_EFI_PERSISTENT_MEMORY); default: -- -2.17.0 +2.14.3 diff --git a/0141-efiemu-Fix-compilation-failure.patch b/0141-efiemu-Fix-compilation-failure.patch index 1013755..8d65436 100644 --- a/0141-efiemu-Fix-compilation-failure.patch +++ b/0141-efiemu-Fix-compilation-failure.patch @@ -1,7 +1,7 @@ From 68bdf29eb6e376a3b4a817bbe7481efd12b8f9de Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 22 Jan 2016 14:10:30 +0100 -Subject: [PATCH 141/238] efiemu: Fix compilation failure +Subject: [PATCH 141/250] efiemu: Fix compilation failure (cherry picked from commit b6a03dfd327489d53ee07c6d7d593b99c7b7cb62) @@ -26,5 +26,5 @@ index 92e7df7e501..52a032f7b2e 100644 GRUB_EFI_PERSISTENT_MEMORY); default: -- -2.17.0 +2.14.3 diff --git a/0142-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0142-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index c1d1d7f..2d28835 100644 --- a/0142-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0142-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,7 +1,7 @@ From df19c5ff9c9e716df0383e39992466304053c99d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 7 Apr 2016 10:58:06 -0400 -Subject: [PATCH 142/238] Revert "reopen SNP protocol for exclusive use by +Subject: [PATCH 142/250] Revert "reopen SNP protocol for exclusive use by grub" I *think* this should have been replaced by upstream's @@ -65,5 +65,5 @@ index b870d3f1938..a3ce4c67cce 100644 } } -- -2.17.0 +2.14.3 diff --git a/0143-Add-a-url-parser.patch b/0143-Add-a-url-parser.patch index eba0b98..e5358ee 100644 --- a/0143-Add-a-url-parser.patch +++ b/0143-Add-a-url-parser.patch @@ -1,7 +1,7 @@ From 2f84b2e097ad9f6f7f06013f749251743eb32c2e Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jun 2016 16:18:44 -0400 -Subject: [PATCH 143/238] Add a url parser. +Subject: [PATCH 143/250] Add a url parser. This patch adds a url parser that can parse http, https, tftp, and tftps urls, and is easily extensible to handle more types. @@ -1020,5 +1020,5 @@ index 00000000000..a215fa27d0a + +#endif /* GRUB_URL_HEADER */ -- -2.17.0 +2.14.3 diff --git a/0144-efinet-and-bootp-add-support-for-dhcpv6.patch b/0144-efinet-and-bootp-add-support-for-dhcpv6.patch index 3798006..83ec89e 100644 --- a/0144-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0144-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -1,7 +1,7 @@ From 48768b0295ad4d908cefd8e8fbee96a4dc2765f5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 8 Jun 2016 21:03:37 -0400 -Subject: [PATCH 144/238] efinet and bootp: add support for dhcpv6 +Subject: [PATCH 144/250] efinet and bootp: add support for dhcpv6 Signed-off-by: Peter Jones --- @@ -663,5 +663,5 @@ index 50d62ab0c8c..f8f3ec13acc 100644 grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf, int mask); -- -2.17.0 +2.14.3 diff --git a/0145-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0145-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index da9a34a..de903a7 100644 --- a/0145-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0145-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -1,7 +1,7 @@ From 764506b89942103c3a511d7933edef351fb594b8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 23 Jun 2016 11:01:39 -0400 -Subject: [PATCH 145/238] Add grub-get-kernel-settings and use it in 10_linux +Subject: [PATCH 145/250] Add grub-get-kernel-settings and use it in 10_linux This patch adds grub-get-kernel-settings, which reads the system kernel installation configuration from /etc/sysconfig/kernel, and outputs @@ -299,5 +299,5 @@ index 584ad1f4639..c9bf223f273 100644 fi -- -2.17.0 +2.14.3 diff --git a/0146-Normalize-slashes-in-tftp-paths.patch b/0146-Normalize-slashes-in-tftp-paths.patch index c053b52..447805b 100644 --- a/0146-Normalize-slashes-in-tftp-paths.patch +++ b/0146-Normalize-slashes-in-tftp-paths.patch @@ -1,7 +1,7 @@ From 406402dfaecc62ede346793c9c7a0568dc71c131 Mon Sep 17 00:00:00 2001 From: Lenny Szubowicz Date: Mon, 29 Aug 2016 11:04:48 -0400 -Subject: [PATCH 146/238] Normalize slashes in tftp paths. +Subject: [PATCH 146/250] Normalize slashes in tftp paths. Some tftp servers do not handle multiple consecutive slashes correctly; this patch avoids sending tftp requests with non-normalized paths. @@ -54,5 +54,5 @@ index 1157524fc50..5ca0a96a6f6 100644 rrq += grub_strlen (filename) + 1; -- -2.17.0 +2.14.3 diff --git a/0147-Fix-malformed-tftp-packets.patch b/0147-Fix-malformed-tftp-packets.patch index a4b89f1..86dc7e1 100644 --- a/0147-Fix-malformed-tftp-packets.patch +++ b/0147-Fix-malformed-tftp-packets.patch @@ -1,7 +1,7 @@ From 7d05a8298e6a54bfae0038841462443f21da3535 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Tue, 7 Mar 2017 18:26:17 -0500 -Subject: [PATCH 147/238] Fix malformed tftp packets +Subject: [PATCH 147/250] Fix malformed tftp packets 0088-Normalize-slashes-in-tftp-paths.patch collapses multiple contiguous slashes in a filename into one slash in the tftp packet filename field. @@ -31,5 +31,5 @@ index 5ca0a96a6f6..dcd82494309 100644 grub_strcpy (rrq, "octet"); rrqlen += grub_strlen ("octet") + 1; -- -2.17.0 +2.14.3 diff --git a/0148-Fix-race-in-EFI-validation.patch b/0148-Fix-race-in-EFI-validation.patch index 94b543c..0f97f28 100644 --- a/0148-Fix-race-in-EFI-validation.patch +++ b/0148-Fix-race-in-EFI-validation.patch @@ -1,7 +1,7 @@ From bf59d76ca82eb4eaa20a747f5890d09632ba93d0 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 14 Jul 2015 16:58:51 -0700 -Subject: [PATCH 148/238] Fix race in EFI validation +Subject: [PATCH 148/250] Fix race in EFI validation --- grub-core/loader/i386/efi/linux.c | 44 ++++++++++----------------------------- @@ -93,5 +93,5 @@ index e5b778577f9..7ccf32d9d45 100644 { grub_dl_unref (my_mod); -- -2.17.0 +2.14.3 diff --git a/0149-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0149-bz1374141-fix-incorrect-mask-for-ppc64.patch index aad281d..6b66186 100644 --- a/0149-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ b/0149-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -1,7 +1,7 @@ From 84a5f535949f590a8976c64c3d1fde08fe0f7464 Mon Sep 17 00:00:00 2001 From: Masahiro Matsuya Date: Sat, 29 Oct 2016 08:35:26 +0900 -Subject: [PATCH 149/238] bz1374141 fix incorrect mask for ppc64 +Subject: [PATCH 149/250] bz1374141 fix incorrect mask for ppc64 The netmask configured in firmware is not respected on ppc64 (big endian). When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath(). @@ -44,5 +44,5 @@ index 002446be1c3..3df75357a70 100644 if (gateway_addr.ipv4 != 0) -- -2.17.0 +2.14.3 diff --git a/0150-Use-device-part-of-chainloader-target-if-present.patch b/0150-Use-device-part-of-chainloader-target-if-present.patch index 5f1c8ae..49bc16d 100644 --- a/0150-Use-device-part-of-chainloader-target-if-present.patch +++ b/0150-Use-device-part-of-chainloader-target-if-present.patch @@ -1,7 +1,7 @@ From d426e20f8b41ebf114075dc4ffbcaf438ceb4b95 Mon Sep 17 00:00:00 2001 From: Raymund Will Date: Fri, 10 Apr 2015 01:45:02 -0400 -Subject: [PATCH 150/238] Use device part of chainloader target, if present. +Subject: [PATCH 150/250] Use device part of chainloader target, if present. Otherwise chainloading is restricted to '$root', which might not even be readable by EFI! @@ -33,5 +33,5 @@ index adc85636633..14ce6ddd7ad 100644 goto fail; -- -2.17.0 +2.14.3 diff --git a/0151-Add-secureboot-support-on-efi-chainloader.patch b/0151-Add-secureboot-support-on-efi-chainloader.patch index e9a9d3d..0f54ab8 100644 --- a/0151-Add-secureboot-support-on-efi-chainloader.patch +++ b/0151-Add-secureboot-support-on-efi-chainloader.patch @@ -1,7 +1,7 @@ From bbf98517303e438cea398bb74306b6553c880ac3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 6 Oct 2015 13:04:37 -0400 -Subject: [PATCH 151/238] Add secureboot support on efi chainloader +Subject: [PATCH 151/250] Add secureboot support on efi chainloader Expand the chainloader to be able to verify the image by means of shim lock protocol. The PE/COFF image is loaded and relocated by the @@ -796,5 +796,5 @@ index 7d44732d2c3..6e24dae2cb6 100644 { grub_uint32_t page_rva; -- -2.17.0 +2.14.3 diff --git a/0152-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0152-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 240ccf6..a1b6532 100644 --- a/0152-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0152-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -1,7 +1,7 @@ From 25ea5be888dcc92cd0b3cb7d34b381f5005f1e30 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 6 Oct 2015 16:09:25 -0400 -Subject: [PATCH 152/238] Make any of the loaders that link in efi mode honor +Subject: [PATCH 152/250] Make any of the loaders that link in efi mode honor secure boot. And in this case "honor" means "even if somebody does link this in, they @@ -490,5 +490,5 @@ index 10451384720..f7b4d29b0b3 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h -- -2.17.0 +2.14.3 diff --git a/0153-Make-grub_fatal-also-backtrace.patch b/0153-Make-grub_fatal-also-backtrace.patch index ccbad8e..b72e6a1 100644 --- a/0153-Make-grub_fatal-also-backtrace.patch +++ b/0153-Make-grub_fatal-also-backtrace.patch @@ -1,7 +1,7 @@ From eb1a27144476324a22561383a0a2e61aa327d2f5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 27 Jan 2016 09:22:42 -0500 -Subject: [PATCH 153/238] Make grub_fatal() also backtrace. +Subject: [PATCH 153/250] Make grub_fatal() also backtrace. --- grub-core/Makefile.core.def | 3 ++ @@ -171,5 +171,5 @@ index c3e03c7275c..c67273db3ae 100644 #include #include -- -2.17.0 +2.14.3 diff --git a/0154-Rework-linux-command.patch b/0154-Rework-linux-command.patch index 792f9f5..34995ed 100644 --- a/0154-Rework-linux-command.patch +++ b/0154-Rework-linux-command.patch @@ -1,7 +1,7 @@ From 12312bfe1727a2992042436cb0f8c8ba1c69ee2f Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:12:39 -0700 -Subject: [PATCH 154/238] Rework linux command +Subject: [PATCH 154/250] Rework linux command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel into it @@ -103,5 +103,5 @@ index b2438547dd0..e4b8342f5d0 100644 grub_file_close (file); -- -2.17.0 +2.14.3 diff --git a/0155-Rework-linux16-command.patch b/0155-Rework-linux16-command.patch index 8355cfe..67c4857 100644 --- a/0155-Rework-linux16-command.patch +++ b/0155-Rework-linux16-command.patch @@ -1,7 +1,7 @@ From 24250bbb84f8817462426c46b255d875de627bf1 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:20:58 -0700 -Subject: [PATCH 155/238] Rework linux16 command +Subject: [PATCH 155/250] Rework linux16 command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel int it @@ -97,5 +97,5 @@ index 91283157e30..b864e540333 100644 grub_file_close (file); -- -2.17.0 +2.14.3 diff --git a/0156-Make-grub-editenv-build-again.patch b/0156-Make-grub-editenv-build-again.patch index 227119d..bd10ba0 100644 --- a/0156-Make-grub-editenv-build-again.patch +++ b/0156-Make-grub-editenv-build-again.patch @@ -1,7 +1,7 @@ From ebe69b2682b5b3029d8ea503f12134ee81c4b2ce Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Mar 2016 16:29:13 -0500 -Subject: [PATCH 156/238] Make grub-editenv build again. +Subject: [PATCH 156/250] Make grub-editenv build again. 36212460d3565b18439a3a8130b28e6c97702c6a split how some of the mkimage utility functions are defined, and they wind up being linked into @@ -26,5 +26,5 @@ index ed27351eb47..38cdf4ccc09 100644 common = util/config.c; common = util/resolve.c; -- -2.17.0 +2.14.3 diff --git a/0157-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0157-Fix-up-some-man-pages-rpmdiff-noticed.patch index 9eb0471..929f361 100644 --- a/0157-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0157-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -1,7 +1,7 @@ From c71e6152ea8e4e525a853441bb5f08808bae3afd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 23 Sep 2014 09:58:49 -0400 -Subject: [PATCH 157/238] Fix up some man pages rpmdiff noticed. +Subject: [PATCH 157/250] Fix up some man pages rpmdiff noticed. --- configure.ac | 2 ++ @@ -149,5 +149,5 @@ index 00000000000..85309482718 +.SH SEE ALSO +.BR "info grub" -- -2.17.0 +2.14.3 diff --git a/0158-Re-work-some-intricacies-of-PE-loading.patch b/0158-Re-work-some-intricacies-of-PE-loading.patch index cd8491c..0b26ace 100644 --- a/0158-Re-work-some-intricacies-of-PE-loading.patch +++ b/0158-Re-work-some-intricacies-of-PE-loading.patch @@ -1,7 +1,7 @@ From 145214ee7c411c7d600016f011dc11b213bce0b2 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 9 Jun 2016 12:22:29 -0400 -Subject: [PATCH 158/238] Re-work some intricacies of PE loading. +Subject: [PATCH 158/250] Re-work some intricacies of PE loading. The PE spec is not a well written document, and awesomely every place where there's an ambiguous way to read something, Windows' bootmgfw.efi @@ -349,5 +349,5 @@ index 6e24dae2cb6..c03cc599f63 100644 struct grub_pe32_header -- -2.17.0 +2.14.3 diff --git a/0159-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch b/0159-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch index 2eee4b6..145a43d 100644 --- a/0159-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch +++ b/0159-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch @@ -1,7 +1,7 @@ From ef24bc601e11b96eefe06f477b5da1199d761b3d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 10 Jun 2016 14:06:15 -0400 -Subject: [PATCH 159/238] Rework even more of efi chainload so non-sb cases +Subject: [PATCH 159/250] Rework even more of efi chainload so non-sb cases work right. This ensures that if shim protocol is not loaded, or is loaded but shim @@ -412,5 +412,5 @@ index d9ede36773b..0033d9305a9 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, -- -2.17.0 +2.14.3 diff --git a/0160-linuxefi-fix-double-free-on-verification-failure.patch b/0160-linuxefi-fix-double-free-on-verification-failure.patch index 18489ad..b8bf0a1 100644 --- a/0160-linuxefi-fix-double-free-on-verification-failure.patch +++ b/0160-linuxefi-fix-double-free-on-verification-failure.patch @@ -1,7 +1,7 @@ From 5ef3f00e6be3033092453a66f456b8dac8cd4f7c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jun 2016 09:50:25 -0400 -Subject: [PATCH 160/238] linuxefi: fix double free on verification failure. +Subject: [PATCH 160/250] linuxefi: fix double free on verification failure. Signed-off-by: Peter Jones --- @@ -21,5 +21,5 @@ index 82f75b7f3ab..010bf982d80 100644 } -- -2.17.0 +2.14.3 diff --git a/0161-fix-machine-type-test-in-30_os-prober.in.patch b/0161-fix-machine-type-test-in-30_os-prober.in.patch index c9c7d72..c341acb 100644 --- a/0161-fix-machine-type-test-in-30_os-prober.in.patch +++ b/0161-fix-machine-type-test-in-30_os-prober.in.patch @@ -1,7 +1,7 @@ From 4139fdfdb64fd248a0d5f200b27c583159dbb190 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 11 Jul 2016 13:36:45 -0400 -Subject: [PATCH 161/238] fix machine type test in 30_os-prober.in +Subject: [PATCH 161/250] fix machine type test in 30_os-prober.in Signed-off-by: Peter Jones --- @@ -21,5 +21,5 @@ index dc98eace934..e40274fc0f4 100644 i?86|x86_64) sixteenbit="16" -- -2.17.0 +2.14.3 diff --git a/0162-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch b/0162-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch index d3738d0..9aa9382 100644 --- a/0162-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch +++ b/0162-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch @@ -1,7 +1,7 @@ From 671699a76fa6510a62c3a94acd698a31686cb8fa Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 21 Nov 2016 15:34:00 +0100 -Subject: [PATCH 162/238] efi/chainloader: fix wrong sanity check in +Subject: [PATCH 162/250] efi/chainloader: fix wrong sanity check in relocate_coff() In relocate_coff(), the relocation entries are parsed from the original @@ -35,5 +35,5 @@ index b977c7b5573..d5ab21d09c3 100644 grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc entry %d overflows binary", n); -- -2.17.0 +2.14.3 diff --git a/0163-efi-chainloader-truncate-overlong-relocation-section.patch b/0163-efi-chainloader-truncate-overlong-relocation-section.patch index 9440dc9..cea43ce 100644 --- a/0163-efi-chainloader-truncate-overlong-relocation-section.patch +++ b/0163-efi-chainloader-truncate-overlong-relocation-section.patch @@ -1,7 +1,7 @@ From d081bd5f47235e3bfd256fd262a6f98fe8b0d0ff Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 23 Nov 2016 06:27:09 +0100 -Subject: [PATCH 163/238] efi/chainloader: truncate overlong relocation section +Subject: [PATCH 163/250] efi/chainloader: truncate overlong relocation section The UEFI Windows 7 boot loader ("EFI/Microsoft/Boot/bootmgfw.efi", SHA1 31b410e029bba87d2068c65a80b88882f9f8ea25) has inconsistent headers. @@ -109,5 +109,5 @@ index d5ab21d09c3..7826e794ad9 100644 grub_dprintf ("chain", " section is not reloc section?\n"); grub_dprintf ("chain", " rds: 0x%08x, vs: %08x\n", -- -2.17.0 +2.14.3 diff --git a/0164-linuxefi-minor-cleanups.patch b/0164-linuxefi-minor-cleanups.patch index aad3137..f53f943 100644 --- a/0164-linuxefi-minor-cleanups.patch +++ b/0164-linuxefi-minor-cleanups.patch @@ -1,7 +1,7 @@ From 8dc21ff37f62f3d10fb3d708ffd33b7d723a23cf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Feb 2017 16:31:52 -0500 -Subject: [PATCH 164/238] linuxefi: minor cleanups +Subject: [PATCH 164/250] linuxefi: minor cleanups Signed-off-by: Peter Jones --- @@ -85,5 +85,5 @@ index 010bf982d80..8b5a817b9d1 100644 return grub_errno; } -- -2.17.0 +2.14.3 diff --git a/0165-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0165-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index 1576b67..9a372cd 100644 --- a/0165-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0165-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -1,7 +1,7 @@ From 10d6d333de0aa7e390a22ebc4b308f7ad937d5bc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Feb 2017 16:18:54 -0500 -Subject: [PATCH 165/238] Handle multi-arch (64-on-32) boot in linuxefi loader. +Subject: [PATCH 165/250] Handle multi-arch (64-on-32) boot in linuxefi loader. Allow booting 64-bit kernels on 32-bit EFI on x86. @@ -272,5 +272,5 @@ index fc36bdaf367..110ecf806fb 100644 grub_uint32_t hardware_subarch; grub_uint64_t hardware_subarch_data; -- -2.17.0 +2.14.3 diff --git a/0166-Fix-up-linux-params-usage.patch b/0166-Fix-up-linux-params-usage.patch index 02e22ab..c5901ba 100644 --- a/0166-Fix-up-linux-params-usage.patch +++ b/0166-Fix-up-linux-params-usage.patch @@ -1,7 +1,7 @@ From 93be95c27b0ddb63c2e3a287a3ed92c0a5de93e5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 30 May 2017 14:16:07 -0400 -Subject: [PATCH 166/238] Fix up linux params usage... +Subject: [PATCH 166/250] Fix up linux params usage... Signed-off-by: Peter Jones --- @@ -39,5 +39,5 @@ index e4b8342f5d0..c9e89310bdd 100644 linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; -- -2.17.0 +2.14.3 diff --git a/0167-Make-exit-take-a-return-code.patch b/0167-Make-exit-take-a-return-code.patch index 54460d4..3046012 100644 --- a/0167-Make-exit-take-a-return-code.patch +++ b/0167-Make-exit-take-a-return-code.patch @@ -1,7 +1,7 @@ From 6b67d46c1764c86611939dc01267f9c70f413184 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 26 Feb 2014 21:49:12 -0500 -Subject: [PATCH 167/238] Make "exit" take a return code. +Subject: [PATCH 167/250] Make "exit" take a return code. This adds "exit" with a return code. With this patch, any "exit" command /may/ include a return code, and on platforms that support @@ -52,5 +52,5 @@ index 5ce89a40c68..04371ac49f2 100644 grub_fatal (const char *fmt, ...) { -- -2.17.0 +2.14.3 diff --git a/0168-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch b/0168-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch index 42e2347..738c762 100644 --- a/0168-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch +++ b/0168-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch @@ -1,7 +1,7 @@ From e48a4c0b9e475b16366ff6c375de5186432eb1f7 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Mon, 17 Apr 2017 08:44:29 -0400 -Subject: [PATCH 168/238] arm64: make sure fdt has #address-cells and +Subject: [PATCH 168/250] arm64: make sure fdt has #address-cells and #size-cells properties Recent upstream changes to kexec-tools relies on #address-cells @@ -41,5 +41,5 @@ index ad39a301527..59ff9cc05b4 100644 if (node < 1) goto failure; -- -2.17.0 +2.14.3 diff --git a/0169-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch b/0169-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch index caab158..b961aac 100644 --- a/0169-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch +++ b/0169-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch @@ -1,7 +1,7 @@ From 755fa5ccf0834abdb7e50a1cb06fad618f6c9af6 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 9 May 2016 14:15:17 -0400 -Subject: [PATCH 169/238] Add some grub_dprintf() in the secure boot verify +Subject: [PATCH 169/250] Add some grub_dprintf() in the secure boot verify code. Signed-off-by: Peter Jones @@ -40,5 +40,5 @@ index 2a7024134da..7fe7201a388 100644 return -1; } -- -2.17.0 +2.14.3 diff --git a/0170-Make-our-info-pages-say-grub2-where-appropriate.patch b/0170-Make-our-info-pages-say-grub2-where-appropriate.patch index d2274fd..7124a13 100644 --- a/0170-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0170-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -1,7 +1,7 @@ From 15c340acd845056ba259b9fffd6c7d083874cb82 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 6 May 2016 18:43:08 -0400 -Subject: [PATCH 170/238] Make our info pages say "grub2" where appropriate. +Subject: [PATCH 170/250] Make our info pages say "grub2" where appropriate. This needs to be hooked up to --program-transform=, but I haven't had time. @@ -1012,5 +1012,5 @@ index 15a90b26e4d..f28c4cd5247 100644 @table @option @item --help -- -2.17.0 +2.14.3 diff --git a/0171-print-more-debug-info-in-our-module-loader.patch b/0171-print-more-debug-info-in-our-module-loader.patch index e207936..0cd0586 100644 --- a/0171-print-more-debug-info-in-our-module-loader.patch +++ b/0171-print-more-debug-info-in-our-module-loader.patch @@ -1,7 +1,7 @@ From 0d0a7ebbed42b97fca63cbcaf85a469b77c76fda Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 1 May 2017 11:19:40 -0400 -Subject: [PATCH 171/238] print more debug info in our module loader. +Subject: [PATCH 171/250] print more debug info in our module loader. Signed-off-by: Peter Jones --- @@ -40,5 +40,5 @@ index 684ca93f8f4..866fc20e162 100644 } -- -2.17.0 +2.14.3 diff --git a/0172-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0172-macos-just-build-chainloader-entries-don-t-try-any-x.patch index c694e2e..37de0bf 100644 --- a/0172-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0172-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -1,7 +1,7 @@ From 4cb6b65d74966dfbe6e8463ee1e88d99ca7de5b1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 24 May 2017 12:42:32 -0400 -Subject: [PATCH 172/238] macos: just build chainloader entries, don't try any +Subject: [PATCH 172/250] macos: just build chainloader entries, don't try any xnu xnu. Since our bugs tell us that the xnu boot entries really just don't work @@ -124,5 +124,5 @@ index e40274fc0f4..d979de1982a 100644 hurd) onstr="$(gettext_printf "(on %s)" "${DEVICE}")" -- -2.17.0 +2.14.3 diff --git a/0173-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0173-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index 2824324..3ee77ba 100644 --- a/0173-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0173-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -1,7 +1,7 @@ From 396001716b7f8c7a6aee17f33fdb9e5d47424cbc Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 18 Dec 2013 09:57:04 +0000 -Subject: [PATCH 173/238] grub2/btrfs: Add ability to boot from subvolumes +Subject: [PATCH 173/250] grub2/btrfs: Add ability to boot from subvolumes This patch adds the ability to specify a different root on a btrfs filesystem too boot from other than the default one. @@ -702,5 +702,5 @@ index 9d93fb6c182..234ad976771 100644 }; -- -2.17.0 +2.14.3 diff --git a/0174-export-btrfs_subvol-and-btrfs_subvolid.patch b/0174-export-btrfs_subvol-and-btrfs_subvolid.patch index c60fdc8..aba1c5f 100644 --- a/0174-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0174-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -1,7 +1,7 @@ From 35c1015fc1a4313be34757eebb195547336e0edf Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 18 Dec 2013 09:57:04 +0000 -Subject: [PATCH 174/238] export btrfs_subvol and btrfs_subvolid +Subject: [PATCH 174/250] export btrfs_subvol and btrfs_subvolid We should export btrfs_subvol and btrfs_subvolid to have both visible to subsidiary configuration files loaded using configfile. @@ -25,5 +25,5 @@ index 38facf3cb8b..3962961666e 100644 GRUB_MOD_FINI (btrfs) -- -2.17.0 +2.14.3 diff --git a/0175-grub2-btrfs-03-follow_default.patch b/0175-grub2-btrfs-03-follow_default.patch index e4f0c8b..fd88474 100644 --- a/0175-grub2-btrfs-03-follow_default.patch +++ b/0175-grub2-btrfs-03-follow_default.patch @@ -1,7 +1,7 @@ From 476a0251e8ca2850da7c383baf7fdbd810bc789f Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Thu, 21 Aug 2014 03:39:11 +0000 -Subject: [PATCH 175/238] grub2-btrfs-03-follow_default +Subject: [PATCH 175/250] grub2-btrfs-03-follow_default --- grub-core/fs/btrfs.c | 107 ++++++++++++++++++++++++++++++++++++--------------- @@ -195,5 +195,5 @@ index 3962961666e..2c462584e91 100644 GRUB_MOD_FINI (btrfs) -- -2.17.0 +2.14.3 diff --git a/0176-grub2-btrfs-04-grub2-install.patch b/0176-grub2-btrfs-04-grub2-install.patch index 5fd9af3..ac0b82b 100644 --- a/0176-grub2-btrfs-04-grub2-install.patch +++ b/0176-grub2-btrfs-04-grub2-install.patch @@ -1,7 +1,7 @@ From e03dd83cc804d70af0716d0a429715afbcdc7eae Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Thu, 21 Aug 2014 03:39:11 +0000 -Subject: [PATCH 176/238] grub2-btrfs-04-grub2-install +Subject: [PATCH 176/250] grub2-btrfs-04-grub2-install --- grub-core/osdep/linux/getroot.c | 7 +++++++ @@ -173,5 +173,5 @@ index 875d5896ce1..c9a7e5f4ade 100644 void -- -2.17.0 +2.14.3 diff --git a/0177-grub2-btrfs-05-grub2-mkconfig.patch b/0177-grub2-btrfs-05-grub2-mkconfig.patch index b6e0553..05f8939 100644 --- a/0177-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0177-grub2-btrfs-05-grub2-mkconfig.patch @@ -1,7 +1,7 @@ From cb43e7a6c96127e72d6787c6063de8911284fe18 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Thu, 21 Aug 2014 03:39:11 +0000 -Subject: [PATCH 177/238] grub2-btrfs-05-grub2-mkconfig +Subject: [PATCH 177/250] grub2-btrfs-05-grub2-mkconfig --- util/grub-mkconfig.in | 3 ++- @@ -126,5 +126,5 @@ index 54f1ec8a2fd..462f8e1f819 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` -- -2.17.0 +2.14.3 diff --git a/0178-grub2-btrfs-06-subvol-mount.patch b/0178-grub2-btrfs-06-subvol-mount.patch index 09c87b9..fdd7008 100644 --- a/0178-grub2-btrfs-06-subvol-mount.patch +++ b/0178-grub2-btrfs-06-subvol-mount.patch @@ -1,7 +1,7 @@ From 84d6a482c2c8d0677141bb888512a6a89daf9d8b Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Fri, 22 May 2015 11:45:25 +0000 -Subject: [PATCH 178/238] grub2-btrfs-06-subvol-mount +Subject: [PATCH 178/250] grub2-btrfs-06-subvol-mount --- grub-core/fs/btrfs.c | 195 +++++++++++++++++++++++++++++++++++++++- @@ -536,5 +536,5 @@ index 73fa2d34abb..9c642ae3fe3 100644 void grub_util_pull_devmapper (const char *os_dev); -- -2.17.0 +2.14.3 diff --git a/0179-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch b/0179-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch index ed59886..e68794b 100644 --- a/0179-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch +++ b/0179-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch @@ -1,7 +1,7 @@ From 741c0651cd54970c08e9c19a82f5805aafbfda23 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Sat, 18 Jul 2015 15:38:08 +0000 -Subject: [PATCH 179/238] No more "Bootable Snapshot" submenu in grub.cfg. +Subject: [PATCH 179/250] No more "Bootable Snapshot" submenu in grub.cfg. This breaks grubby (run on kernel upgrades) because grubby just does a search for "menuentry". @@ -30,5 +30,5 @@ index e2a53300126..8a16fea347e 100644 -EOF -fi -- -2.17.0 +2.14.3 diff --git a/0180-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0180-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index 806a2e8..dd53e25 100644 --- a/0180-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0180-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -1,7 +1,7 @@ From ab8e0d4bf544b708f5afa4cc56e6bd16789f2f1e Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Tue, 21 Jun 2016 16:44:17 +0000 -Subject: [PATCH 180/238] Fallback to old subvol name scheme to support old +Subject: [PATCH 180/250] Fallback to old subvol name scheme to support old snapshot config Ref: bsc#953538 @@ -57,5 +57,5 @@ index d111147e836..a5c000805a7 100644 if (btrfs_default_subvolid) return lookup_root_by_id(data, btrfs_default_subvolid); -- -2.17.0 +2.14.3 diff --git a/0181-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0181-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index 4569f0c..1acaf3b 100644 --- a/0181-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0181-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -1,7 +1,7 @@ From eb8535428a42c7099666ddb58ac900bb8ee745ba Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Thu, 11 May 2017 08:56:57 +0000 -Subject: [PATCH 181/238] Grub not working correctly with btrfs snapshots +Subject: [PATCH 181/250] Grub not working correctly with btrfs snapshots (bsc#1026511) --- @@ -272,5 +272,5 @@ index a5c000805a7..3cd9472197c 100644 subvol_set_env); grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, -- -2.17.0 +2.14.3 diff --git a/0182-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0182-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index 4ce87f3..7e39425 100644 --- a/0182-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0182-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -1,7 +1,7 @@ From 2a6e1d2491b7334985ad25315faa22d26354d8b7 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 1 Jun 2017 09:59:56 -0400 -Subject: [PATCH 182/238] Add grub_efi_allocate_pool() and grub_efi_free_pool() +Subject: [PATCH 182/250] Add grub_efi_allocate_pool() and grub_efi_free_pool() wrappers. Signed-off-by: Peter Jones @@ -71,5 +71,5 @@ index 91e29ce66f1..68326d96f5a 100644 struct grub_net_card; -- -2.17.0 +2.14.3 diff --git a/0183-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0183-Use-grub_efi_.-memory-helpers-where-reasonable.patch index dadfe4f..1a977bf 100644 --- a/0183-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0183-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -1,7 +1,7 @@ From 6ea13cdb3f33da45d7a8042d85ad87e2a18fc946 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 1 Jun 2017 10:06:38 -0400 -Subject: [PATCH 183/238] Use grub_efi_...() memory helpers where reasonable. +Subject: [PATCH 183/250] Use grub_efi_...() memory helpers where reasonable. This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we @@ -105,5 +105,5 @@ index 7826e794ad9..d2557b38dce 100644 if (cmdline) grub_free (cmdline); -- -2.17.0 +2.14.3 diff --git a/0184-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0184-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index 493cc69..c07ef17 100644 --- a/0184-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0184-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -1,7 +1,7 @@ From eae94a16a8ae350cdeab8b7742f9227d92001272 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 1 Jun 2017 10:07:50 -0400 -Subject: [PATCH 184/238] Add PRIxGRUB_EFI_STATUS and use it. +Subject: [PATCH 184/250] Add PRIxGRUB_EFI_STATUS and use it. This avoids syntax checkers getting confused about if it's llx or lx. @@ -45,5 +45,5 @@ index 02488ec35ae..ddc5ecfb03d 100644 #define GRUB_EFI_ERROR_CODE(value) \ ((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) -- -2.17.0 +2.14.3 diff --git a/0185-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch b/0185-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch index eadaf04..af81922 100644 --- a/0185-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch +++ b/0185-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch @@ -1,7 +1,7 @@ From 41a50aa2c275076caa2f9fe7a747eeb054abed16 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 26 Jun 2017 12:42:57 -0400 -Subject: [PATCH 185/238] Don't use dynamic sized arrays since we don't build +Subject: [PATCH 185/250] Don't use dynamic sized arrays since we don't build with -std=c99 --- @@ -42,5 +42,5 @@ index 4be228d9576..fa3e2912643 100644 { grub_strcpy (suffix, client_uuid); -- -2.17.0 +2.14.3 diff --git a/0186-don-t-ignore-const.patch b/0186-don-t-ignore-const.patch index 5ff0ee4..b1d2a0d 100644 --- a/0186-don-t-ignore-const.patch +++ b/0186-don-t-ignore-const.patch @@ -1,7 +1,7 @@ From d06e2578107f217d2bc8beee7fd0dc7f2645873d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 26 Jun 2017 12:43:22 -0400 -Subject: [PATCH 186/238] don't ignore const +Subject: [PATCH 186/250] don't ignore const --- grub-core/net/tftp.c | 2 +- @@ -21,5 +21,5 @@ index dcd82494309..f90071353ad 100644 while (*src != '\0') { -- -2.17.0 +2.14.3 diff --git a/0187-don-t-use-int-for-efi-status.patch b/0187-don-t-use-int-for-efi-status.patch index 1b57a96..b5345d5 100644 --- a/0187-don-t-use-int-for-efi-status.patch +++ b/0187-don-t-use-int-for-efi-status.patch @@ -1,7 +1,7 @@ From 6d86c59c24e12c8e8471cdd2affca574fdee160d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 26 Jun 2017 12:44:59 -0400 -Subject: [PATCH 187/238] don't use int for efi status +Subject: [PATCH 187/250] don't use int for efi status --- grub-core/kern/efi/efi.c | 2 +- @@ -21,5 +21,5 @@ index 866fc20e162..91f75fdb89a 100644 if (retval == 0) rc = GRUB_EFI_SUCCESS; -- -2.17.0 +2.14.3 diff --git a/0188-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0188-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index 8de6fc0..69d7c36 100644 --- a/0188-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0188-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -1,7 +1,7 @@ From ba6828d073bbda85eba59a9ce9220eada51a540b Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 26 Jun 2017 12:46:23 -0400 -Subject: [PATCH 188/238] make GRUB_MOD_INIT() declare its function prototypes. +Subject: [PATCH 188/250] make GRUB_MOD_INIT() declare its function prototypes. --- include/grub/dl.h | 2 ++ @@ -28,5 +28,5 @@ index 2bca56ce0e8..b1ed3c33317 100644 grub_##name##_fini (void) { grub_mod_fini (); } \ static void \ -- -2.17.0 +2.14.3 diff --git a/0189-Clean-up-some-errors-in-the-linuxefi-loader.patch b/0189-Clean-up-some-errors-in-the-linuxefi-loader.patch index 10eed2c..6cb714e 100644 --- a/0189-Clean-up-some-errors-in-the-linuxefi-loader.patch +++ b/0189-Clean-up-some-errors-in-the-linuxefi-loader.patch @@ -1,7 +1,7 @@ From 8bdc0c77919ddb9bd588ac45e96c96497683f76c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 24 May 2017 15:58:18 -0400 -Subject: [PATCH 189/238] Clean up some errors in the linuxefi loader +Subject: [PATCH 189/250] Clean up some errors in the linuxefi loader Signed-off-by: Peter Jones --- @@ -65,5 +65,5 @@ index bed5919cab3..6db5d0bf3a0 100644 linux_cmdline, BYTES_TO_PAGES(lh->cmdline_size + 1)); -- -2.17.0 +2.14.3 diff --git a/0190-editenv-handle-relative-symlinks.patch b/0190-editenv-handle-relative-symlinks.patch index 373b2d2..49c538f 100644 --- a/0190-editenv-handle-relative-symlinks.patch +++ b/0190-editenv-handle-relative-symlinks.patch @@ -1,7 +1,7 @@ From 098987b7b5fcc15a5ba3600fa132fcec36095c5a Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 14 Aug 2017 14:37:20 -0400 -Subject: [PATCH 190/238] editenv: handle relative symlinks +Subject: [PATCH 190/250] editenv: handle relative symlinks Handle symlinks with targets relative to the containing dir. This ensures that the rename operation does not depend on the cwd. @@ -49,5 +49,5 @@ index d8d1dad6ab9..41bc7cb1c9a 100644 int rc = grub_util_rename (namenew, rename_target); -- -2.17.0 +2.14.3 diff --git a/0191-Make-libgrub.pp-depend-on-config-util.h.patch b/0191-Make-libgrub.pp-depend-on-config-util.h.patch index 45a41c4..74339b8 100644 --- a/0191-Make-libgrub.pp-depend-on-config-util.h.patch +++ b/0191-Make-libgrub.pp-depend-on-config-util.h.patch @@ -1,7 +1,7 @@ From c86299049c2cc0503728deee280d9f6bf50886f4 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 23 Aug 2017 10:37:27 -0400 -Subject: [PATCH 191/238] Make libgrub.pp depend on config-util.h +Subject: [PATCH 191/250] Make libgrub.pp depend on config-util.h If you build with "make -j48" a lot, sometimes you see: @@ -44,5 +44,5 @@ index 7795baeb654..c7b0e6a9c46 100644 -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) CLEANFILES += libgrub.pp -- -2.17.0 +2.14.3 diff --git a/0192-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0192-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index a673304..103216a 100644 --- a/0192-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0192-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -1,7 +1,7 @@ From 351799d9310a4bec23ed4074444780c2a35435fd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 20 Apr 2017 13:29:06 -0400 -Subject: [PATCH 192/238] Don't guess /boot/efi/ as HFS+ on ppc machines in +Subject: [PATCH 192/250] Don't guess /boot/efi/ as HFS+ on ppc machines in grub-install This should never be trying this, and since we've consolidated the @@ -40,5 +40,5 @@ index cd84a72b97b..48f2abc3ea5 100644 { free (d); -- -2.17.0 +2.14.3 diff --git a/0193-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch b/0193-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch index 355c8f1..f34f1e4 100644 --- a/0193-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch +++ b/0193-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch @@ -1,7 +1,7 @@ From cba0322cd88baf136ac693f5ec1826f3314daeff Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 28 Aug 2017 13:51:14 -0400 -Subject: [PATCH 193/238] Fix util/grub.d/20_linux_xen.in: Add xen_boot command +Subject: [PATCH 193/250] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Commit d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe introduced @@ -58,5 +58,5 @@ index 462f8e1f819..9b1bd716965 100644 while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` -- -2.17.0 +2.14.3 diff --git a/0194-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch b/0194-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch index c4bb1d5..93064b9 100644 --- a/0194-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch +++ b/0194-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch @@ -1,7 +1,7 @@ From 87c089b6f1945ebcc690697d279c74284f1b4072 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 28 Aug 2017 13:59:12 -0400 -Subject: [PATCH 194/238] Use grub-file to figure out whether multiboot2 should +Subject: [PATCH 194/250] Use grub-file to figure out whether multiboot2 should be used for Xen.gz The multiboot2 is much more preferable than multiboot. Especiall @@ -29,5 +29,5 @@ index 9b1bd716965..fae1ffe9494 100644 while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` -- -2.17.0 +2.14.3 diff --git a/0195-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0195-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index 3b7ecb8..f18d68b 100644 --- a/0195-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0195-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -1,7 +1,7 @@ From 92d3db585076d022521ab94a2ceed03eb05013fc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 19 Oct 2017 11:29:11 -0400 -Subject: [PATCH 195/238] 20_linux_xen: load xen or multiboot{,2} modules as +Subject: [PATCH 195/250] 20_linux_xen: load xen or multiboot{,2} modules as needed. Signed-off-by: Peter Jones @@ -31,5 +31,5 @@ index fae1ffe9494..fc53bd54231 100644 EOF fi -- -2.17.0 +2.14.3 diff --git a/0196-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch b/0196-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch index 598bce1..c838622 100644 --- a/0196-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch +++ b/0196-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch @@ -1,7 +1,7 @@ From 2e5b957292d3f313d48bded25e8ca83468326c5b Mon Sep 17 00:00:00 2001 From: "David E. Box" Date: Fri, 15 Sep 2017 15:37:05 -0700 -Subject: [PATCH 196/238] tsc: Change default tsc calibration method to pmtimer +Subject: [PATCH 196/250] tsc: Change default tsc calibration method to pmtimer on EFI systems On efi systems, make pmtimer based tsc calibration the default over the @@ -28,5 +28,5 @@ index 2e85289d848..f266eb13185 100644 (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode()); #else -- -2.17.0 +2.14.3 diff --git a/0197-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0197-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch index 975f52c..6350cf1 100644 --- a/0197-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +++ b/0197-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch @@ -1,7 +1,7 @@ From 0b158c30810db86f549cabd6e6021ab15962370d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 7 Nov 2017 17:12:17 -0500 -Subject: [PATCH 197/238] Make pmtimer tsc calibration not take 51 seconds to +Subject: [PATCH 197/250] Make pmtimer tsc calibration not take 51 seconds to fail. On my laptop running at 2.4GHz, if I run a VM where tsc calibration @@ -211,5 +211,5 @@ index c9c36169978..ca15c3aacd7 100644 if (tsc_diff == 0) return 0; -- -2.17.0 +2.14.3 diff --git a/0198-align-struct-efi_variable-better.patch b/0198-align-struct-efi_variable-better.patch index 3a48b40..8ce8bdc 100644 --- a/0198-align-struct-efi_variable-better.patch +++ b/0198-align-struct-efi_variable-better.patch @@ -1,7 +1,7 @@ From 2485633ada06c11c07a34a696a92b14e58f1e846 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 27 Feb 2018 13:55:35 -0500 -Subject: [PATCH 198/238] align struct efi_variable better... +Subject: [PATCH 198/250] align struct efi_variable better... --- include/grub/efiemu/runtime.h | 2 +- @@ -32,5 +32,5 @@ index b93e4820194..f6a9723971d 100644 #ifdef GRUB_BUILD # define GRUB_CPU_SIZEOF_VOID_P BUILD_SIZEOF_VOID_P -- -2.17.0 +2.14.3 diff --git a/0199-Add-quicksort-implementation.patch b/0199-Add-quicksort-implementation.patch index b7f3665..6f0e50e 100644 --- a/0199-Add-quicksort-implementation.patch +++ b/0199-Add-quicksort-implementation.patch @@ -1,7 +1,7 @@ From a2cd100d71711b950beaf60ea7ddca4c77a70d59 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 9 Dec 2016 15:39:47 -0500 -Subject: [PATCH 199/238] Add quicksort implementation +Subject: [PATCH 199/250] Add quicksort implementation This will be used to sort the boot menu entries that are read from the BootLoaderSpec config files. @@ -321,5 +321,5 @@ index 4737da1eaa9..3d55bafd64e 100644 + #endif /* ! GRUB_MISC_HEADER */ -- -2.17.0 +2.14.3 diff --git a/0200-Add-blscfg-command-support-to-parse-BootLoaderSpec-c.patch b/0200-Add-blscfg-command-support-to-parse-BootLoaderSpec-c.patch index 145f621..3bd5dab 100644 --- a/0200-Add-blscfg-command-support-to-parse-BootLoaderSpec-c.patch +++ b/0200-Add-blscfg-command-support-to-parse-BootLoaderSpec-c.patch @@ -1,7 +1,7 @@ From ed595feeea2f7b7fd0158d42fa2fd39420eea683 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 9 Dec 2016 15:40:58 -0500 -Subject: [PATCH 200/238] Add blscfg command support to parse BootLoaderSpec +Subject: [PATCH 200/250] Add blscfg command support to parse BootLoaderSpec config fragments The BootLoaderSpec (BLS) defines a scheme where different bootloaders can @@ -1138,5 +1138,5 @@ index c9e1d7a73dc..9859ff4cc79 100644 + #endif /* ! GRUB_COMPILER_HEADER */ -- -2.17.0 +2.14.3 diff --git a/0201-Add-BLS-support-to-grub-mkconfig.patch b/0201-Add-BLS-support-to-grub-mkconfig.patch index b576a0d..3de6cf8 100644 --- a/0201-Add-BLS-support-to-grub-mkconfig.patch +++ b/0201-Add-BLS-support-to-grub-mkconfig.patch @@ -1,7 +1,7 @@ From d847a4806bb7a4f3b457d0074d712e500fbd5e97 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 9 Dec 2016 15:40:29 -0500 -Subject: [PATCH 201/238] Add BLS support to grub-mkconfig +Subject: [PATCH 201/250] Add BLS support to grub-mkconfig GRUB now has BootLoaderSpec support, the user can choose to use this by setting GRUB_ENABLE_BLSCFG to true in /etc/default/grub. On this setup, @@ -166,5 +166,5 @@ index 7e78ad33636..f5daefb9d24 100644 # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's # no initrd or builtin initramfs, it can't work here. -- -2.17.0 +2.14.3 diff --git a/0202-Remove-duplicated-grub_exit-definition-for-grub-emu-.patch b/0202-Remove-duplicated-grub_exit-definition-for-grub-emu-.patch index c94b0c5..8a4f100 100644 --- a/0202-Remove-duplicated-grub_exit-definition-for-grub-emu-.patch +++ b/0202-Remove-duplicated-grub_exit-definition-for-grub-emu-.patch @@ -1,7 +1,7 @@ From 2d7dabdbf322e8f679eeaefd48cb26b083cdeb1c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 6 Feb 2018 11:02:09 +0100 -Subject: [PATCH 202/238] Remove duplicated grub_exit() definition for grub-emu +Subject: [PATCH 202/250] Remove duplicated grub_exit() definition for grub-emu platform The grub_exit() function signature was changed on all platforms to take a @@ -32,5 +32,5 @@ index 7e47ec81263..55ea5a11ccd 100644 grub_machine_init (void) { -- -2.17.0 +2.14.3 diff --git a/0203-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0203-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch index 652c8cf..b757dac 100644 --- a/0203-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +++ b/0203-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch @@ -1,7 +1,7 @@ From f45946a92377c83ffcad8dbc3298fc26072567d9 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 6 Feb 2018 11:16:28 +0100 -Subject: [PATCH 203/238] Don't attempt to backtrace on grub_abort() for +Subject: [PATCH 203/250] Don't attempt to backtrace on grub_abort() for grub-emu The emu platform doesn't have a grub_backtrace() implementation, so this @@ -26,5 +26,5 @@ index 04371ac49f2..636f97e1ba1 100644 #endif #endif -- -2.17.0 +2.14.3 diff --git a/0204-Enable-blscfg-command-for-the-emu-platform.patch b/0204-Enable-blscfg-command-for-the-emu-platform.patch index 89e2f46..7bdf2c8 100644 --- a/0204-Enable-blscfg-command-for-the-emu-platform.patch +++ b/0204-Enable-blscfg-command-for-the-emu-platform.patch @@ -1,7 +1,7 @@ From 39bb86c661911f06ff40caa842a9babf18f27c8b Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 2 Feb 2018 11:36:29 +0100 -Subject: [PATCH 204/238] Enable blscfg command for the emu platform +Subject: [PATCH 204/250] Enable blscfg command for the emu platform Allow grub-emu to call a blscfg command. This may be useful for platforms that don't support GRUB, so grub-emu can be used to parse the BLS configs @@ -163,5 +163,5 @@ index 9ab45631465..e5617c3bc6c 100644 grub_unregister_extcmd (cmd); } -- -2.17.0 +2.14.3 diff --git a/0205-Add-linux-and-initrd-commands-for-grub-emu.patch b/0205-Add-linux-and-initrd-commands-for-grub-emu.patch index a75d782..935450b 100644 --- a/0205-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0205-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -1,7 +1,7 @@ From 49c719a6f6e223b95733e18720a48993ab6e5317 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 6 Feb 2018 09:09:00 +0100 -Subject: [PATCH 205/238] Add linux and initrd commands for grub-emu +Subject: [PATCH 205/250] Add linux and initrd commands for grub-emu When using grub-emu, the linux and initrd commands are used as arguments to the kexec command line tool, to allow booting the selected menu entry. @@ -350,5 +350,5 @@ index f7b4d29b0b3..75e8715e631 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h endif -- -2.17.0 +2.14.3 diff --git a/0206-Fix-the-efidir-in-grub-setpassword.patch b/0206-Fix-the-efidir-in-grub-setpassword.patch index fcf7d24..d6135d3 100644 --- a/0206-Fix-the-efidir-in-grub-setpassword.patch +++ b/0206-Fix-the-efidir-in-grub-setpassword.patch @@ -1,7 +1,7 @@ From c7c6cb4380f5bd85a2cbe747433657fdce89a802 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 15 Mar 2018 14:12:54 -0400 -Subject: [PATCH 206/238] Fix the efidir in grub-setpassword +Subject: [PATCH 206/250] Fix the efidir in grub-setpassword Signed-off-by: Peter Jones --- @@ -23,5 +23,5 @@ index d7924af5192..cf70257eed6 100644 grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` fi -- -2.17.0 +2.14.3 diff --git a/0207-Add-grub2-switch-to-blscfg.patch b/0207-Add-grub2-switch-to-blscfg.patch index fe7ac60..65f60ff 100644 --- a/0207-Add-grub2-switch-to-blscfg.patch +++ b/0207-Add-grub2-switch-to-blscfg.patch @@ -1,7 +1,7 @@ From 89b3a570de8b5e7ad19769983a87f6e10024f0ec Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 15 Mar 2018 14:12:40 -0400 -Subject: [PATCH 207/238] Add grub2-switch-to-blscfg +Subject: [PATCH 207/250] Add grub2-switch-to-blscfg Signed-off-by: Peter Jones --- @@ -344,5 +344,5 @@ index 00000000000..3ae5e4ea8d0 +# Bye. +exit 0 -- -2.17.0 +2.14.3 diff --git a/0208-Add-grub_debug_enabled.patch b/0208-Add-grub_debug_enabled.patch index 9c832f7..5fb1b45 100644 --- a/0208-Add-grub_debug_enabled.patch +++ b/0208-Add-grub_debug_enabled.patch @@ -1,7 +1,7 @@ From 6776773c89828c9b69c1552760ba6a4d9cd5589f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 30 Nov 2017 15:11:39 -0500 -Subject: [PATCH 208/238] Add grub_debug_enabled() +Subject: [PATCH 208/250] Add grub_debug_enabled() --- grub-core/kern/misc.c | 21 ++++++++++++++++----- @@ -59,5 +59,5 @@ index 3d55bafd64e..493e328d968 100644 const int line, const char *condition, -- -2.17.0 +2.14.3 diff --git a/0209-make-better-backtraces.patch b/0209-make-better-backtraces.patch index 8788cee..2accc06 100644 --- a/0209-make-better-backtraces.patch +++ b/0209-make-better-backtraces.patch @@ -1,7 +1,7 @@ From 318ee04aadcda40b779b2a5314dd23ead165f896 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 6 Nov 2017 18:31:56 -0500 -Subject: [PATCH 209/238] make better backtraces +Subject: [PATCH 209/250] make better backtraces Signed-off-by: Peter Jones --- @@ -883,5 +883,5 @@ index 75e8715e631..5c7a2c8f808 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h -- -2.17.0 +2.14.3 diff --git a/0210-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0210-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index 2dacff7..2b29c3d 100644 --- a/0210-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0210-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -1,7 +1,7 @@ From 81d0e079ea5aa6f43daf12f7a8698d0bcd1a36f8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 9 Nov 2017 15:58:52 -0500 -Subject: [PATCH 210/238] normal: don't draw our startup message if debug is +Subject: [PATCH 210/250] normal: don't draw our startup message if debug is set --- @@ -23,5 +23,5 @@ index b69f9e738fa..04ae9ed02f6 100644 "the first word, TAB lists possible command completions. Anywhere " "else TAB lists possible device or file completions. %s"), -- -2.17.0 +2.14.3 diff --git a/0211-Work-around-some-minor-include-path-weirdnesses.patch b/0211-Work-around-some-minor-include-path-weirdnesses.patch index 41ee9c5..9abddb2 100644 --- a/0211-Work-around-some-minor-include-path-weirdnesses.patch +++ b/0211-Work-around-some-minor-include-path-weirdnesses.patch @@ -1,7 +1,7 @@ From e2bba0f7ee8e56c68e425853a21a8fdd766add70 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 16 Mar 2018 13:28:57 -0400 -Subject: [PATCH 211/238] Work around some minor include path weirdnesses +Subject: [PATCH 211/250] Work around some minor include path weirdnesses Signed-off-by: Peter Jones --- @@ -136,5 +136,5 @@ index 00000000000..dba9d8678d0 + +#endif /* ! GRUB_X86_64_EFI_CONSOLE_H */ -- -2.17.0 +2.14.3 diff --git a/0212-Make-it-possible-to-enabled-build-id-sha1.patch b/0212-Make-it-possible-to-enabled-build-id-sha1.patch index 92cb9d1..50e486e 100644 --- a/0212-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0212-Make-it-possible-to-enabled-build-id-sha1.patch @@ -1,7 +1,7 @@ From 8521929bcf671b465d6450b969d11617b6aec608 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 25 Jun 2015 15:41:06 -0400 -Subject: [PATCH 212/238] Make it possible to enabled --build-id=sha1 +Subject: [PATCH 212/250] Make it possible to enabled --build-id=sha1 Signed-off-by: Peter Jones --- @@ -60,5 +60,5 @@ index 78cdf6e1d01..242e829ff23 100644 AC_DEFUN([grub_PROG_NM_WORKS], [AC_MSG_CHECKING([whether nm works]) -- -2.17.0 +2.14.3 diff --git a/0213-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0213-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index f8dcce4..f85d9e2 100644 --- a/0213-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0213-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -1,7 +1,7 @@ From 8c4b2eaa204f0ea0377ca4592d2be6029fdb9be7 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Sun, 28 Jun 2015 13:09:58 -0400 -Subject: [PATCH 213/238] Add grub_qdprintf() - grub_dprintf() without the +Subject: [PATCH 213/250] Add grub_qdprintf() - grub_dprintf() without the file+line number. This just makes copy+paste of our debug loading info easier. @@ -55,5 +55,5 @@ index 493e328d968..4607e8defa9 100644 int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 3, 4))); -- -2.17.0 +2.14.3 diff --git a/0214-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0214-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index 9da9f5c..948793b 100644 --- a/0214-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/0214-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -1,7 +1,7 @@ From 030095a01a205aba04a0849ac0c0329ac429a9ed Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 25 Jun 2015 15:11:36 -0400 -Subject: [PATCH 214/238] Make a "gdb" dprintf that tells us load addresses. +Subject: [PATCH 214/250] Make a "gdb" dprintf that tells us load addresses. This makes a grub_dprintf() call during platform init and during module loading that tells us the virtual addresses of the .text and .data @@ -177,5 +177,5 @@ index 68326d96f5a..6702b312040 100644 void grub_efi_mm_init (void); void grub_efi_mm_fini (void); -- -2.17.0 +2.14.3 diff --git a/0215-Only-attempt-to-scan-different-BLS-directories-on-EF.patch b/0215-Only-attempt-to-scan-different-BLS-directories-on-EF.patch index 33f3971..41be879 100644 --- a/0215-Only-attempt-to-scan-different-BLS-directories-on-EF.patch +++ b/0215-Only-attempt-to-scan-different-BLS-directories-on-EF.patch @@ -1,7 +1,7 @@ From 5f0417c63a4dd2252a5a801568f4369ac74a47e6 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 3 Apr 2018 15:42:47 +0200 -Subject: [PATCH 215/238] Only attempt to scan different BLS directories on EFI +Subject: [PATCH 215/250] Only attempt to scan different BLS directories on EFI machines Current BLS support attempted to scan for BLS directories, but this only @@ -45,5 +45,5 @@ index e5617c3bc6c..c0973ff83ea 100644 finish: -- -2.17.0 +2.14.3 diff --git a/0216-Core-TPM-support.patch b/0216-Core-TPM-support.patch index a369dbe..498db76 100644 --- a/0216-Core-TPM-support.patch +++ b/0216-Core-TPM-support.patch @@ -1,7 +1,7 @@ From 65be94a64a5608209561ba0914d29445d81bf4b2 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 14 Jul 2015 17:06:35 -0700 -Subject: [PATCH 216/238] Core TPM support +Subject: [PATCH 216/250] Core TPM support Add support for performing basic TPM measurements. Right now this only supports extending PCRs statically and only on UEFI and BIOS systems, but @@ -785,5 +785,5 @@ index 5c7a2c8f808..84b076962d8 100644 if COND_i386_pc -- -2.17.0 +2.14.3 diff --git a/0217-Measure-kernel-initrd.patch b/0217-Measure-kernel-initrd.patch index fab77dc..cbeb72d 100644 --- a/0217-Measure-kernel-initrd.patch +++ b/0217-Measure-kernel-initrd.patch @@ -1,7 +1,7 @@ From ffd305d09def6610ef96f928c0df8303c5529d63 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Thu, 16 Jul 2015 15:22:34 -0700 -Subject: [PATCH 217/238] Measure kernel + initrd +Subject: [PATCH 217/250] Measure kernel + initrd Measure the kernel and initrd when loaded on UEFI systems --- @@ -38,5 +38,5 @@ index 6db5d0bf3a0..48febdc8100 100644 if (rc < 0) { -- -2.17.0 +2.14.3 diff --git a/0218-Add-BIOS-boot-measurement.patch b/0218-Add-BIOS-boot-measurement.patch index 2dcc461..7ad0443 100644 --- a/0218-Add-BIOS-boot-measurement.patch +++ b/0218-Add-BIOS-boot-measurement.patch @@ -1,7 +1,7 @@ From d8870587d46f8aa8d4f8db2cdcddecc829993447 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 15:48:51 -0700 -Subject: [PATCH 218/238] Add BIOS boot measurement +Subject: [PATCH 218/250] Add BIOS boot measurement Measure the on-disk grub core on BIOS systems - unlike UEFI, the firmware can't do this stage for us. @@ -175,5 +175,5 @@ index c8b87ed293c..05dd7fa701c 100644 * message: write the string pointed to by %si * -- -2.17.0 +2.14.3 diff --git a/0219-Measure-kernel-and-initrd-on-BIOS-systems.patch b/0219-Measure-kernel-and-initrd-on-BIOS-systems.patch index 3b809df..068ccd6 100644 --- a/0219-Measure-kernel-and-initrd-on-BIOS-systems.patch +++ b/0219-Measure-kernel-and-initrd-on-BIOS-systems.patch @@ -1,7 +1,7 @@ From 5aee2444093cfc8006865766f89e5a775a940ab1 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:28:29 -0700 -Subject: [PATCH 219/238] Measure kernel and initrd on BIOS systems +Subject: [PATCH 219/250] Measure kernel and initrd on BIOS systems Measure the kernel and initrd when loaded on BIOS systems --- @@ -83,5 +83,5 @@ index be6fa0f4d45..3005c0d19c9 100644 } if (newc) -- -2.17.0 +2.14.3 diff --git a/0220-Measure-the-kernel-commandline.patch b/0220-Measure-the-kernel-commandline.patch index af7d6ee..7a5cd6e 100644 --- a/0220-Measure-the-kernel-commandline.patch +++ b/0220-Measure-the-kernel-commandline.patch @@ -1,7 +1,7 @@ From c1694574d6eb287e6e181dd018fe54b718a613b3 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:32:29 -0700 -Subject: [PATCH 220/238] Measure the kernel commandline +Subject: [PATCH 220/250] Measure the kernel commandline Measure the kernel commandline to ensure that it hasn't been modified --- @@ -39,5 +39,5 @@ index 970ea868c14..6b56304d4a7 100644 return i; } -- -2.17.0 +2.14.3 diff --git a/0221-Measure-commands.patch b/0221-Measure-commands.patch index 89c0b36..b15765d 100644 --- a/0221-Measure-commands.patch +++ b/0221-Measure-commands.patch @@ -1,7 +1,7 @@ From c93a27f2e6a323a4985e6fe902eb5c6447fca572 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Mon, 10 Aug 2015 15:27:12 -0700 -Subject: [PATCH 221/238] Measure commands +Subject: [PATCH 221/250] Measure commands Measure each command executed by grub, which includes script execution. --- @@ -72,5 +72,5 @@ index 40d3cf65ba6..7fc9d77d277 100644 #define TPM_TAG_RQU_COMMAND 0x00C1 #define TPM_ORD_Extend 0x14 -- -2.17.0 +2.14.3 diff --git a/0222-Measure-multiboot-images-and-modules.patch b/0222-Measure-multiboot-images-and-modules.patch index 37ffe67..0f5bd31 100644 --- a/0222-Measure-multiboot-images-and-modules.patch +++ b/0222-Measure-multiboot-images-and-modules.patch @@ -1,7 +1,7 @@ From b164ec560cd6373c0c5d8a189d70baeca2c3ef13 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 1 Sep 2015 16:02:55 -0700 -Subject: [PATCH 222/238] Measure multiboot images and modules +Subject: [PATCH 222/250] Measure multiboot images and modules --- grub-core/loader/i386/multiboot_mbi.c | 3 +++ @@ -74,5 +74,5 @@ index b0679a9f6c9..a7b4a57ec4f 100644 { grub_free (mld.buffer); -- -2.17.0 +2.14.3 diff --git a/0223-Fix-boot-when-there-s-no-TPM.patch b/0223-Fix-boot-when-there-s-no-TPM.patch index 30e0176..30570d1 100644 --- a/0223-Fix-boot-when-there-s-no-TPM.patch +++ b/0223-Fix-boot-when-there-s-no-TPM.patch @@ -1,7 +1,7 @@ From 33fb6113d65a819496d0b67b8db071fedad845a7 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 23 Mar 2016 16:49:42 -0700 -Subject: [PATCH 223/238] Fix boot when there's no TPM +Subject: [PATCH 223/250] Fix boot when there's no TPM If the firmware has TPM support but has no TPM, we're jumping to core.img without popping the registers back onto the stack. Fix that. @@ -28,5 +28,5 @@ index c1df86dec0b..acab37369ae 100644 jmp *(LOCAL(kernel_address)) -- -2.17.0 +2.14.3 diff --git a/0224-Rework-TPM-measurements.patch b/0224-Rework-TPM-measurements.patch index 9871e81..5bc18b7 100644 --- a/0224-Rework-TPM-measurements.patch +++ b/0224-Rework-TPM-measurements.patch @@ -1,7 +1,7 @@ From 415072bbda8b4de133c6dc6add230e41ee6d9579 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 23 Mar 2016 17:03:43 -0700 -Subject: [PATCH 224/238] Rework TPM measurements +Subject: [PATCH 224/250] Rework TPM measurements Rework TPM measurements to use fewer PCRs. After discussion with upstream, it's preferable to avoid using so many PCRs. Instead, measure into PCRs 8 @@ -215,5 +215,5 @@ index 7fc9d77d277..ecb2d09ff5d 100644 #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -- -2.17.0 +2.14.3 diff --git a/0225-Fix-event-log-prefix.patch b/0225-Fix-event-log-prefix.patch index e3e35c5..6c70fad 100644 --- a/0225-Fix-event-log-prefix.patch +++ b/0225-Fix-event-log-prefix.patch @@ -1,7 +1,7 @@ From 0816621235226952a5bd0cfd027eb97ff84df547 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 29 Mar 2016 15:36:49 -0700 -Subject: [PATCH 225/238] Fix event log prefix +Subject: [PATCH 225/250] Fix event log prefix We're not passing the prefixed version of the description to the event log. Fix that. @@ -25,5 +25,5 @@ index cb5a812035d..e5e8fced624 100644 return ret; } -- -2.17.0 +2.14.3 diff --git a/0226-Set-the-first-boot-menu-entry-as-default-when-using-.patch b/0226-Set-the-first-boot-menu-entry-as-default-when-using-.patch index c76ba91..975fa0c 100644 --- a/0226-Set-the-first-boot-menu-entry-as-default-when-using-.patch +++ b/0226-Set-the-first-boot-menu-entry-as-default-when-using-.patch @@ -1,7 +1,7 @@ From 8278e40fdc4a4db0865fc632cbe2dcf7c124ba7a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 6 Apr 2018 14:08:36 +0200 -Subject: [PATCH 226/238] Set the first boot menu entry as default when using +Subject: [PATCH 226/250] Set the first boot menu entry as default when using BLS fragments When BootLoaderSpec configuration files are used, the default boot menu @@ -26,5 +26,5 @@ index f5daefb9d24..b24bb410dc0 100644 exit 0 -- -2.17.0 +2.14.3 diff --git a/0227-tpm-fix-warnings-when-compiling-for-platforms-other-.patch b/0227-tpm-fix-warnings-when-compiling-for-platforms-other-.patch index bfbd1b8..8821be4 100644 --- a/0227-tpm-fix-warnings-when-compiling-for-platforms-other-.patch +++ b/0227-tpm-fix-warnings-when-compiling-for-platforms-other-.patch @@ -1,7 +1,7 @@ From 4c53f61b1a889c0f55e76a763b05b6686ec613b8 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 21 Aug 2016 18:24:58 -0700 -Subject: [PATCH 227/238] tpm: fix warnings when compiling for platforms other +Subject: [PATCH 227/250] tpm: fix warnings when compiling for platforms other than pc and efi --- @@ -37,5 +37,5 @@ index ecb2d09ff5d..972a5edc836 100644 return 0; }; -- -2.17.0 +2.14.3 diff --git a/0228-Make-TPM-errors-less-fatal.patch b/0228-Make-TPM-errors-less-fatal.patch index c27d64b..69c6ed0 100644 --- a/0228-Make-TPM-errors-less-fatal.patch +++ b/0228-Make-TPM-errors-less-fatal.patch @@ -1,7 +1,7 @@ From 406f7dda0cc2689170f102341a546c87072d1ce5 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Thu, 13 Oct 2016 13:55:26 -0700 -Subject: [PATCH 228/238] Make TPM errors less fatal +Subject: [PATCH 228/250] Make TPM errors less fatal Handle TPM errors, and stop trying to use the TPM once we hit one. --- @@ -207,5 +207,5 @@ index 976643c47b0..93965777138 100644 invert = 0; argc = argv.argc - 1; -- -2.17.0 +2.14.3 diff --git a/0229-blscfg-handle-multiple-initramfs-images.patch b/0229-blscfg-handle-multiple-initramfs-images.patch index 2140ec7..362f642 100644 --- a/0229-blscfg-handle-multiple-initramfs-images.patch +++ b/0229-blscfg-handle-multiple-initramfs-images.patch @@ -1,7 +1,7 @@ From a230ec5c31d818c2f046acf3592a5492d3e2ea69 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 11 Apr 2018 13:44:29 -0400 -Subject: [PATCH 229/238] blscfg: handle multiple initramfs images. +Subject: [PATCH 229/250] blscfg: handle multiple initramfs images. Signed-off-by: Peter Jones --- @@ -103,5 +103,5 @@ index c0973ff83ea..1e5972422d6 100644 struct find_entry_info { -- -2.17.0 +2.14.3 diff --git a/0230-BLS-Fix-grub2-switch-to-blscfg-on-non-EFI-machines.patch b/0230-BLS-Fix-grub2-switch-to-blscfg-on-non-EFI-machines.patch index 454eed2..8d44083 100644 --- a/0230-BLS-Fix-grub2-switch-to-blscfg-on-non-EFI-machines.patch +++ b/0230-BLS-Fix-grub2-switch-to-blscfg-on-non-EFI-machines.patch @@ -1,7 +1,7 @@ From f006df881d1b2b3ca7320ecfcd33181295ec1018 Mon Sep 17 00:00:00 2001 From: Jan Hlavac Date: Tue, 10 Apr 2018 16:07:36 +0200 -Subject: [PATCH 230/238] BLS: Fix grub2-switch-to-blscfg on non-EFI machines +Subject: [PATCH 230/250] BLS: Fix grub2-switch-to-blscfg on non-EFI machines On the non-EFI machines the grub2-switch-to-blscfg script places the BLS snippets into the /boot directory. But the right location is @@ -24,5 +24,5 @@ index 3ae5e4ea8d0..f740b8f4d03 100644 backupsuffix=.bak -- -2.17.0 +2.14.3 diff --git a/0231-BLS-Use-etcdefaultgrub-instead-of-etc.patch b/0231-BLS-Use-etcdefaultgrub-instead-of-etc.patch index df995c2..4e436b3 100644 --- a/0231-BLS-Use-etcdefaultgrub-instead-of-etc.patch +++ b/0231-BLS-Use-etcdefaultgrub-instead-of-etc.patch @@ -1,7 +1,7 @@ From 29b79fde633a43223ead7874ffd373603f129832 Mon Sep 17 00:00:00 2001 From: Jan Hlavac Date: Tue, 10 Apr 2018 16:56:28 +0200 -Subject: [PATCH 231/238] BLS: Use ${etcdefaultgrub} instead of /etc/... +Subject: [PATCH 231/250] BLS: Use ${etcdefaultgrub} instead of /etc/... Inside the grub-switch-to-blscfg script the ${etcdefaultgrub} variable is used. So replace the hardcoded /etc/default/grub with it. @@ -23,5 +23,5 @@ index f740b8f4d03..eae3c379e4a 100644 exit 1 fi -- -2.17.0 +2.14.3 diff --git a/0232-Add-missing-options-to-grub2-switch-to-blscfg-man-pa.patch b/0232-Add-missing-options-to-grub2-switch-to-blscfg-man-pa.patch index 59a9a1f..8a29582 100644 --- a/0232-Add-missing-options-to-grub2-switch-to-blscfg-man-pa.patch +++ b/0232-Add-missing-options-to-grub2-switch-to-blscfg-man-pa.patch @@ -1,7 +1,7 @@ From c3a05672a450fd9e95de5df2b0c27c24fe04cd83 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 11 Apr 2018 11:36:43 +0200 -Subject: [PATCH 232/238] Add missing options to grub2-switch-to-blscfg man +Subject: [PATCH 232/250] Add missing options to grub2-switch-to-blscfg man page The script --bls-directory and --backup-suffix options were not documented @@ -31,5 +31,5 @@ index 134dfc62a7b..7d99de2d2f9 100644 .SH SEE ALSO .BR "info grub" -- -2.17.0 +2.14.3 diff --git a/0233-Make-grub2-switch-to-blscfg-to-generate-debug-BLS-wh.patch b/0233-Make-grub2-switch-to-blscfg-to-generate-debug-BLS-wh.patch index c45082a..8ed4ada 100644 --- a/0233-Make-grub2-switch-to-blscfg-to-generate-debug-BLS-wh.patch +++ b/0233-Make-grub2-switch-to-blscfg-to-generate-debug-BLS-wh.patch @@ -1,7 +1,7 @@ From 55b00d518e029a563653401c6908489924c07238 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 11 Apr 2018 11:49:24 +0200 -Subject: [PATCH 233/238] Make grub2-switch-to-blscfg to generate debug BLS +Subject: [PATCH 233/250] Make grub2-switch-to-blscfg to generate debug BLS when MAKEDEBUG is set If MAKEDEBUG=yes in /etc/sysconfig/kernel, then a debug menu entry should @@ -57,5 +57,5 @@ index eae3c379e4a..c59299ffa6a 100644 GENERATE=0 -- -2.17.0 +2.14.3 diff --git a/0234-Make-grub2-switch-to-blscfg-to-generate-BLS-fragment.patch b/0234-Make-grub2-switch-to-blscfg-to-generate-BLS-fragment.patch index 37665bb..cc14430 100644 --- a/0234-Make-grub2-switch-to-blscfg-to-generate-BLS-fragment.patch +++ b/0234-Make-grub2-switch-to-blscfg-to-generate-BLS-fragment.patch @@ -1,7 +1,7 @@ From 60bddbc714c96ca05821d52bdd7dbad7eabd6dd5 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 11 Apr 2018 12:39:59 +0200 -Subject: [PATCH 234/238] Make grub2-switch-to-blscfg to generate BLS fragment +Subject: [PATCH 234/250] Make grub2-switch-to-blscfg to generate BLS fragment for rescue kernel If a rescue image is available, it should have a BootLoaderSpec fragment. @@ -27,5 +27,5 @@ index c59299ffa6a..bc28053cd30 100644 if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \ | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then -- -2.17.0 +2.14.3 diff --git a/0235-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch b/0235-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch index 8402334..aa0a389 100644 --- a/0235-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch +++ b/0235-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch @@ -1,7 +1,7 @@ From 8afe59812e83e78564697ef8241ed4f1b3527423 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 24 Apr 2018 02:16:38 +0200 -Subject: [PATCH 235/238] Only attempt to query dev mounted in /boot/efi as +Subject: [PATCH 235/250] Only attempt to query dev mounted in /boot/efi as boot dev on EFI machines The 10_linux script calls grub2-probe to probe the information for the dev @@ -39,5 +39,5 @@ index b24bb410dc0..c2ffc77398f 100644 cat << EOF insmod blscfg -- -2.17.0 +2.14.3 diff --git a/0236-Include-OSTree-path-when-searching-kernels-images-if.patch b/0236-Include-OSTree-path-when-searching-kernels-images-if.patch index 39642cd..d2cadb1 100644 --- a/0236-Include-OSTree-path-when-searching-kernels-images-if.patch +++ b/0236-Include-OSTree-path-when-searching-kernels-images-if.patch @@ -1,7 +1,7 @@ From 459eaeacbb40116dcb501cf165c7816e70c66fb3 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 24 Apr 2018 02:28:04 +0200 -Subject: [PATCH 236/238] Include OSTree path when searching kernels images if +Subject: [PATCH 236/250] Include OSTree path when searching kernels images if BLS config is enabled The OSTree based distros (i.e: Fedora Atomic) don't install kernel images @@ -37,5 +37,5 @@ index c2ffc77398f..15ba8eff8a6 100644 i?86) GENKERNEL_ARCH="x86" ;; mips|mips64) GENKERNEL_ARCH="mips" ;; -- -2.17.0 +2.14.3 diff --git a/0237-Use-BLS-version-field-to-compare-entries-if-id-field.patch b/0237-Use-BLS-version-field-to-compare-entries-if-id-field.patch index d7fba4d..24e32dc 100644 --- a/0237-Use-BLS-version-field-to-compare-entries-if-id-field.patch +++ b/0237-Use-BLS-version-field-to-compare-entries-if-id-field.patch @@ -1,7 +1,7 @@ From 689a48c76bee8049a50f962852f43f108c815450 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 27 Apr 2018 17:53:41 +0200 -Subject: [PATCH 237/238] Use BLS version field to compare entries if id field +Subject: [PATCH 237/250] Use BLS version field to compare entries if id field isn't defined The BootLoaderSpec fragments generated by OSTree don't have the id field, @@ -28,5 +28,5 @@ index 1e5972422d6..72ee497ea2d 100644 rc = bls_keyval_cmp (e0, e1, "title"); -- -2.17.0 +2.14.3 diff --git a/0238-Add-version-field-to-BLS-generated-by-grub2-switch-t.patch b/0238-Add-version-field-to-BLS-generated-by-grub2-switch-t.patch index 37069a4..bc7d3c8 100644 --- a/0238-Add-version-field-to-BLS-generated-by-grub2-switch-t.patch +++ b/0238-Add-version-field-to-BLS-generated-by-grub2-switch-t.patch @@ -1,7 +1,7 @@ From 0994be8d655420685d900a08443b4fd53f639e72 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 10 May 2018 10:52:11 +0200 -Subject: [PATCH 238/238] Add version field to BLS generated by +Subject: [PATCH 238/250] Add version field to BLS generated by grub2-switch-to-blscfg The version field is present in the BLS fragments that are shipped in the @@ -41,5 +41,5 @@ index bc28053cd30..89487ad611c 100644 initrd /initramfs-${kernelver}.img options \$kernelopts -- -2.17.0 +2.14.3 diff --git a/0239-Fixup-for-newer-compiler.patch b/0239-Fixup-for-newer-compiler.patch new file mode 100644 index 0000000..ee21a22 --- /dev/null +++ b/0239-Fixup-for-newer-compiler.patch @@ -0,0 +1,53 @@ +From 0724038a6f554f688cfcd6e05d52329c384d8a6d Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 10 May 2018 13:40:19 -0400 +Subject: [PATCH 239/250] Fixup for newer compiler + +--- + grub-core/fs/btrfs.c | 2 +- + include/grub/gpt_partition.h | 2 +- + conf/Makefile.common | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 3cd9472197c..8d3f644e124 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -198,7 +198,7 @@ struct grub_btrfs_inode + grub_uint64_t size; + grub_uint8_t dummy2[0x70]; + struct grub_btrfs_time mtime; +-} GRUB_PACKED; ++} GRUB_PACKED __attribute__ ((aligned(8))); + + struct grub_btrfs_extent_data + { +diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h +index 1b32f6725a4..8cddf997efc 100644 +--- a/include/grub/gpt_partition.h ++++ b/include/grub/gpt_partition.h +@@ -76,7 +76,7 @@ struct grub_gpt_partentry + grub_uint64_t end; + grub_uint64_t attrib; + char name[72]; +-} GRUB_PACKED; ++} GRUB_PACKED __attribute__ ((aligned(8))); + + grub_err_t + grub_gpt_partition_map_iterate (grub_disk_t disk, +diff --git a/conf/Makefile.common b/conf/Makefile.common +index 044ab3abe88..c75848f5c06 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding + LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) + CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 + CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +-STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx ++STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes + + CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding + LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d +-- +2.14.3 + diff --git a/0240-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0240-net-read-bracketed-ipv6-addrs-and-port-numbers.patch new file mode 100644 index 0000000..201768d --- /dev/null +++ b/0240-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -0,0 +1,249 @@ +From 360588a02da16caf45c639dde159ae55dbdf651e Mon Sep 17 00:00:00 2001 +From: Aaron Miller +Date: Fri, 29 Jul 2016 17:41:38 +0800 +Subject: [PATCH 240/250] net: read bracketed ipv6 addrs and port numbers + +Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses +to be recognized with brackets around them, which is required to specify a port +number +--- + grub-core/net/http.c | 21 ++++++++++--- + grub-core/net/net.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++--- + grub-core/net/tftp.c | 6 +++- + include/grub/net.h | 1 + + 4 files changed, 104 insertions(+), 10 deletions(-) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index 5aa4ad3befc..f182d7b871d 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -312,12 +312,14 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + int i; + struct grub_net_buff *nb; + grub_err_t err; ++ char* server = file->device->net->server; ++ int port = file->device->net->port; + + nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE + + sizeof ("GET ") - 1 + + grub_strlen (data->filename) + + sizeof (" HTTP/1.1\r\nHost: ") - 1 +- + grub_strlen (file->device->net->server) ++ + grub_strlen (server) + sizeof (":XXXXXXXXXX") + + sizeof ("\r\nUser-Agent: " PACKAGE_STRING + "\r\n") - 1 + + sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX" +@@ -356,7 +358,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + sizeof (" HTTP/1.1\r\nHost: ") - 1); + + ptr = nb->tail; +- err = grub_netbuff_put (nb, grub_strlen (file->device->net->server)); ++ err = grub_netbuff_put (nb, grub_strlen (server)); + if (err) + { + grub_netbuff_free (nb); +@@ -365,6 +367,15 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + grub_memcpy (ptr, file->device->net->server, + grub_strlen (file->device->net->server)); + ++ if (port) ++ { ++ ptr = nb->tail; ++ grub_snprintf ((char *) ptr, ++ sizeof (":XXXXXXXXXX"), ++ ":%d", ++ port); ++ } ++ + ptr = nb->tail; + err = grub_netbuff_put (nb, + sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n") +@@ -390,8 +401,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + grub_netbuff_put (nb, 2); + grub_memcpy (ptr, "\r\n", 2); + +- data->sock = grub_net_tcp_open (file->device->net->server, +- HTTP_PORT, http_receive, ++ grub_dprintf ("http", "opening path %s on host %s TCP port %d\n", ++ data->filename, server, port ? port : HTTP_PORT); ++ data->sock = grub_net_tcp_open (server, ++ port ? port : HTTP_PORT, http_receive, + http_err, http_err, + file); + if (!data->sock) +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index fa3e2912643..c84b435e8a5 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -437,6 +437,12 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) + grub_uint16_t newip[8]; + const char *ptr = val; + int word, quaddot = -1; ++ int bracketed = 0; ++ ++ if (ptr[0] == '[') { ++ bracketed = 1; ++ ptr++; ++ } + + if (ptr[0] == ':' && ptr[1] != ':') + return 0; +@@ -475,6 +481,9 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) + grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); + } + grub_memcpy (ip, newip, 16); ++ if (bracketed && *ptr == ']') { ++ ptr++; ++ } + if (rest) + *rest = ptr; + return 1; +@@ -1332,8 +1341,10 @@ grub_net_open_real (const char *name) + { + grub_net_app_level_t proto; + const char *protname, *server; ++ char *host; + grub_size_t protnamelen; + int try; ++ int port = 0; + + if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) + { +@@ -1371,6 +1382,72 @@ grub_net_open_real (const char *name) + return NULL; + } + ++ char* port_start; ++ /* ipv6 or port specified? */ ++ if ((port_start = grub_strchr (server, ':'))) ++ { ++ char* ipv6_begin; ++ if((ipv6_begin = grub_strchr (server, '['))) ++ { ++ char* ipv6_end = grub_strchr (server, ']'); ++ if(!ipv6_end) ++ { ++ grub_error (GRUB_ERR_NET_BAD_ADDRESS, ++ N_("mismatched [ in address")); ++ return NULL; ++ } ++ /* port number after bracketed ipv6 addr */ ++ if(ipv6_end[1] == ':') ++ { ++ port = grub_strtoul (ipv6_end + 2, NULL, 10); ++ if(port > 65535) ++ { ++ grub_error (GRUB_ERR_NET_BAD_ADDRESS, ++ N_("bad port number")); ++ return NULL; ++ } ++ } ++ host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1); ++ } ++ else ++ { ++ if (grub_strchr (port_start + 1, ':')) ++ { ++ int iplen = grub_strlen (server); ++ /* bracket bare ipv6 addrs */ ++ host = grub_malloc (iplen + 3); ++ if(!host) ++ { ++ return NULL; ++ } ++ host[0] = '['; ++ grub_memcpy (host + 1, server, iplen); ++ host[iplen + 1] = ']'; ++ host[iplen + 2] = '\0'; ++ } ++ else ++ { ++ /* hostname:port or ipv4:port */ ++ port = grub_strtol (port_start + 1, NULL, 10); ++ if(port > 65535) ++ { ++ grub_error (GRUB_ERR_NET_BAD_ADDRESS, ++ N_("bad port number")); ++ return NULL; ++ } ++ host = grub_strndup (server, port_start - server); ++ } ++ } ++ } ++ else ++ { ++ host = grub_strdup (server); ++ } ++ if (!host) ++ { ++ return NULL; ++ } ++ + for (try = 0; try < 2; try++) + { + FOR_NET_APP_LEVEL (proto) +@@ -1380,14 +1457,13 @@ grub_net_open_real (const char *name) + { + grub_net_t ret = grub_zalloc (sizeof (*ret)); + if (!ret) +- return NULL; +- ret->protocol = proto; +- ret->server = grub_strdup (server); +- if (!ret->server) + { +- grub_free (ret); ++ grub_free (host); + return NULL; + } ++ ret->protocol = proto; ++ ret->port = port; ++ ret->server = host; + ret->fs = &grub_net_fs; + return ret; + } +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index f90071353ad..4fd7d24dbed 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -333,6 +333,7 @@ tftp_open (struct grub_file *file, const char *filename) + grub_err_t err; + grub_uint8_t *nbd; + grub_net_network_level_address_t addr; ++ int port = file->device->net->port; + + data = grub_zalloc (sizeof (*data)); + if (!data) +@@ -406,6 +407,9 @@ tftp_open (struct grub_file *file, const char *filename) + if (err) + { + grub_dprintf("tftp", "Address resolution failed: %d\n", err); ++ grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", ++ (unsigned long long)data->file_size, ++ (unsigned long long)data->block_size); + destroy_pq (data); + grub_free (data); + return err; +@@ -413,7 +417,7 @@ tftp_open (struct grub_file *file, const char *filename) + + grub_dprintf("tftp", "opening connection\n"); + data->sock = grub_net_udp_open (addr, +- TFTP_SERVER_PORT, tftp_receive, ++ port ? port : TFTP_SERVER_PORT, tftp_receive, + file); + if (!data->sock) + { +diff --git a/include/grub/net.h b/include/grub/net.h +index f8f3ec13acc..24232ec71fc 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -270,6 +270,7 @@ typedef struct grub_net + { + char *server; + char *name; ++ int port; + grub_net_app_level_t protocol; + grub_net_packets_t packs; + grub_off_t offset; +-- +2.14.3 + diff --git a/0241-New-net_bootp6-command-and-UEFI-IPv6-PXE-support.patch b/0241-New-net_bootp6-command-and-UEFI-IPv6-PXE-support.patch new file mode 100644 index 0000000..c2fede7 --- /dev/null +++ b/0241-New-net_bootp6-command-and-UEFI-IPv6-PXE-support.patch @@ -0,0 +1,1354 @@ +From 77e75c900368ef656c00d4c485eff7b1d66d58eb Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Sun, 10 Jul 2016 23:46:06 +0800 +Subject: [PATCH 241/250] New net_bootp6 command and UEFI IPv6 PXE support + +When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is +cached in firmware buffer which can be obtained by PXE Base Code protocol. The +network interface can be setup through the parameters in that obtained packet. + +Implement new net_bootp6 command for IPv6 network auto configuration via the +DHCPv6 protocol (RFC3315). + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + grub-core/net/bootp.c | 1047 ++++++++++++++++++++++++++++++------ + grub-core/net/drivers/efi/efinet.c | 20 +- + grub-core/net/ip.c | 39 ++ + include/grub/efi/api.h | 2 +- + include/grub/net.h | 80 +-- + 5 files changed, 988 insertions(+), 200 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index da3e454466b..6995f986744 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -25,6 +25,98 @@ + #include + #include + #include ++#include ++#include ++ ++static int ++dissect_url (const char *url, char **proto, char **host, char **path) ++{ ++ const char *p, *ps; ++ grub_size_t l; ++ ++ *proto = *host = *path = NULL; ++ ps = p = url; ++ ++ while ((p = grub_strchr (p, ':'))) ++ { ++ if (grub_strlen (p) < sizeof ("://") - 1) ++ break; ++ if (grub_memcmp (p, "://", sizeof ("://") - 1) == 0) ++ { ++ l = p - ps; ++ *proto = grub_malloc (l + 1); ++ if (!*proto) ++ { ++ grub_print_error (); ++ return 0; ++ } ++ ++ grub_memcpy (*proto, ps, l); ++ (*proto)[l] = '\0'; ++ p += sizeof ("://") - 1; ++ break; ++ } ++ ++p; ++ } ++ ++ if (!*proto) ++ { ++ grub_dprintf ("bootp", "url: %s is not valid, protocol not found\n", url); ++ return 0; ++ } ++ ++ ps = p; ++ p = grub_strchr (p, '/'); ++ ++ if (!p) ++ { ++ grub_dprintf ("bootp", "url: %s is not valid, host/path not found\n", url); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ ++ l = p - ps; ++ ++ if (l > 2 && ps[0] == '[' && ps[l - 1] == ']') ++ { ++ *host = grub_malloc (l - 1); ++ if (!*host) ++ { ++ grub_print_error (); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ grub_memcpy (*host, ps + 1, l - 2); ++ (*host)[l - 2] = 0; ++ } ++ else ++ { ++ *host = grub_malloc (l + 1); ++ if (!*host) ++ { ++ grub_print_error (); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ grub_memcpy (*host, ps, l); ++ (*host)[l] = 0; ++ } ++ ++ *path = grub_strdup (p); ++ if (!*path) ++ { ++ grub_print_error (); ++ grub_free (*host); ++ grub_free (*proto); ++ *host = NULL; ++ *proto = NULL; ++ return 0; ++ } ++ return 1; ++} + + static char * + grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), +@@ -350,178 +442,577 @@ grub_net_configure_by_dhcp_ack (const char *name, + return inter; + } + +-struct grub_net_network_level_interface * +-grub_net_configure_by_dhcpv6_ack (const char *name, +- struct grub_net_card *card, +- grub_net_interface_flags_t flags +- __attribute__((__unused__)), +- const grub_net_link_level_address_t *hwaddr, +- const struct grub_net_dhcpv6_packet *packet, +- int is_def, char **device, char **path) +-{ +- struct grub_net_network_level_interface *inter = NULL; +- struct grub_net_network_level_address addr; +- int mask = -1; +- +- if (!device || !path) ++/* The default netbuff size for sending DHCPv6 packets which should be ++ large enough to hold the information */ ++#define GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE 512 ++ ++struct grub_dhcp6_options ++{ ++ grub_uint8_t *client_duid; ++ grub_uint16_t client_duid_len; ++ grub_uint8_t *server_duid; ++ grub_uint16_t server_duid_len; ++ grub_uint32_t iaid; ++ grub_uint32_t t1; ++ grub_uint32_t t2; ++ grub_net_network_level_address_t *ia_addr; ++ grub_uint32_t preferred_lifetime; ++ grub_uint32_t valid_lifetime; ++ grub_net_network_level_address_t *dns_server_addrs; ++ grub_uint16_t num_dns_server; ++ char *boot_file_proto; ++ char *boot_file_server_ip; ++ char *boot_file_path; ++}; ++ ++typedef struct grub_dhcp6_options *grub_dhcp6_options_t; ++ ++struct grub_dhcp6_session ++{ ++ struct grub_dhcp6_session *next; ++ struct grub_dhcp6_session **prev; ++ grub_uint32_t iaid; ++ grub_uint32_t transaction_id:24; ++ grub_uint64_t start_time; ++ struct grub_net_dhcp6_option_duid_ll duid; ++ struct grub_net_network_level_interface *iface; ++ ++ /* The associated dhcpv6 options */ ++ grub_dhcp6_options_t adv; ++ grub_dhcp6_options_t reply; ++}; ++ ++typedef struct grub_dhcp6_session *grub_dhcp6_session_t; ++ ++typedef void (*dhcp6_option_hook_fn) (const struct grub_net_dhcp6_option *opt, void *data); ++ ++static void ++foreach_dhcp6_option (const struct grub_net_dhcp6_option *opt, grub_size_t size, ++ dhcp6_option_hook_fn hook, void *hook_data); ++ ++static void ++parse_dhcp6_iaaddr (const struct grub_net_dhcp6_option *opt, void *data) ++{ ++ grub_dhcp6_options_t dhcp6 = (grub_dhcp6_options_t )data; ++ ++ grub_uint16_t code = grub_be_to_cpu16 (opt->code); ++ grub_uint16_t len = grub_be_to_cpu16 (opt->len); ++ ++ if (code == GRUB_NET_DHCP6_OPTION_IAADDR) ++ { ++ const struct grub_net_dhcp6_option_iaaddr *iaaddr; ++ iaaddr = (const struct grub_net_dhcp6_option_iaaddr *)opt->data; ++ ++ if (len < sizeof (*iaaddr)) ++ { ++ grub_dprintf ("bootp", "DHCPv6: code %u with insufficient length %u\n", code, len); ++ return; ++ } ++ if (!dhcp6->ia_addr) ++ { ++ dhcp6->ia_addr = grub_malloc (sizeof(*dhcp6->ia_addr)); ++ dhcp6->ia_addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ dhcp6->ia_addr->ipv6[0] = grub_get_unaligned64 (iaaddr->addr); ++ dhcp6->ia_addr->ipv6[1] = grub_get_unaligned64 (iaaddr->addr + 8); ++ dhcp6->preferred_lifetime = grub_be_to_cpu32 (iaaddr->preferred_lifetime); ++ dhcp6->valid_lifetime = grub_be_to_cpu32 (iaaddr->valid_lifetime); ++ } ++ } ++} ++ ++static void ++parse_dhcp6_option (const struct grub_net_dhcp6_option *opt, void *data) ++{ ++ grub_dhcp6_options_t dhcp6 = (grub_dhcp6_options_t)data; ++ grub_uint16_t code = grub_be_to_cpu16 (opt->code); ++ grub_uint16_t len = grub_be_to_cpu16 (opt->len); ++ ++ switch (code) ++ { ++ case GRUB_NET_DHCP6_OPTION_CLIENTID: ++ ++ if (dhcp6->client_duid || !len) ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 CLIENTID with length %u\n", len); ++ break; ++ } ++ dhcp6->client_duid = grub_malloc (len); ++ grub_memcpy (dhcp6->client_duid, opt->data, len); ++ dhcp6->client_duid_len = len; ++ break; ++ ++ case GRUB_NET_DHCP6_OPTION_SERVERID: ++ ++ if (dhcp6->server_duid || !len) ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 SERVERID with length %u\n", len); ++ break; ++ } ++ dhcp6->server_duid = grub_malloc (len); ++ grub_memcpy (dhcp6->server_duid, opt->data, len); ++ dhcp6->server_duid_len = len; ++ break; ++ ++ case GRUB_NET_DHCP6_OPTION_IA_NA: ++ { ++ const struct grub_net_dhcp6_option_iana *ia_na; ++ grub_uint16_t data_len; ++ ++ if (dhcp6->iaid || len < sizeof (*ia_na)) ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 IA_NA with length %u\n", len); ++ break; ++ } ++ ia_na = (const struct grub_net_dhcp6_option_iana *)opt->data; ++ dhcp6->iaid = grub_be_to_cpu32 (ia_na->iaid); ++ dhcp6->t1 = grub_be_to_cpu32 (ia_na->t1); ++ dhcp6->t2 = grub_be_to_cpu32 (ia_na->t2); ++ ++ data_len = len - sizeof (*ia_na); ++ if (data_len) ++ foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)ia_na->data, data_len, parse_dhcp6_iaaddr, dhcp6); ++ } ++ break; ++ ++ case GRUB_NET_DHCP6_OPTION_DNS_SERVERS: ++ { ++ const grub_uint8_t *po; ++ grub_uint16_t ln; ++ grub_net_network_level_address_t *la; ++ ++ if (!len || len & 0xf) ++ { ++ grub_dprintf ("bootp", "Skip invalid length DHCPv6 DNS_SERVERS \n"); ++ break; ++ } ++ dhcp6->num_dns_server = ln = len >> 4; ++ dhcp6->dns_server_addrs = la = grub_zalloc (ln * sizeof (*la)); ++ ++ for (po = opt->data; ln > 0; po += 0x10, la++, ln--) ++ { ++ la->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ la->ipv6[0] = grub_get_unaligned64 (po); ++ la->ipv6[1] = grub_get_unaligned64 (po + 8); ++ la->option = DNS_OPTION_PREFER_IPV6; ++ } ++ } ++ break; ++ ++ case GRUB_NET_DHCP6_OPTION_BOOTFILE_URL: ++ dissect_url ((const char *)opt->data, ++ &dhcp6->boot_file_proto, ++ &dhcp6->boot_file_server_ip, ++ &dhcp6->boot_file_path); ++ break; ++ ++ default: ++ break; ++ } ++} ++ ++static void ++foreach_dhcp6_option (const struct grub_net_dhcp6_option *opt, grub_size_t size, dhcp6_option_hook_fn hook, void *hook_data) ++{ ++ while (size) ++ { ++ grub_uint16_t code, len; ++ ++ if (size < sizeof (*opt)) ++ { ++ grub_dprintf ("bootp", "DHCPv6: Options stopped with remaining size %" PRIxGRUB_SIZE "\n", size); ++ break; ++ } ++ size -= sizeof (*opt); ++ len = grub_be_to_cpu16 (opt->len); ++ code = grub_be_to_cpu16 (opt->code); ++ if (size < len) ++ { ++ grub_dprintf ("bootp", "DHCPv6: Options stopped at out of bound length %u for option %u\n", len, code); ++ break; ++ } ++ if (!len) ++ { ++ grub_dprintf ("bootp", "DHCPv6: Options stopped at zero length option %u\n", code); ++ break; ++ } ++ else ++ { ++ if (hook) ++ hook (opt, hook_data); ++ size -= len; ++ opt = (const struct grub_net_dhcp6_option *)((grub_uint8_t *)opt + len + sizeof (*opt)); ++ } ++ } ++} ++ ++static grub_dhcp6_options_t ++grub_dhcp6_options_get (const struct grub_net_dhcp6_packet *v6h, ++ grub_size_t size) ++{ ++ grub_dhcp6_options_t options; ++ ++ if (size < sizeof (*v6h)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("DHCPv6 packet size too small")); ++ return NULL; ++ } ++ ++ options = grub_zalloc (sizeof(*options)); ++ if (!options) + return NULL; + +- *device = 0; +- *path = 0; +- +- grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n", +- hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2], +- hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]); +- +- if (is_def) +- grub_net_default_server = 0; +- +- if (is_def && !grub_net_default_server && packet) ++ foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)v6h->dhcp_options, ++ size - sizeof (*v6h), parse_dhcp6_option, options); ++ ++ return options; ++} ++ ++static void ++grub_dhcp6_options_free (grub_dhcp6_options_t options) ++{ ++ if (options->client_duid) ++ grub_free (options->client_duid); ++ if (options->server_duid) ++ grub_free (options->server_duid); ++ if (options->ia_addr) ++ grub_free (options->ia_addr); ++ if (options->dns_server_addrs) ++ grub_free (options->dns_server_addrs); ++ if (options->boot_file_proto) ++ grub_free (options->boot_file_proto); ++ if (options->boot_file_server_ip) ++ grub_free (options->boot_file_server_ip); ++ if (options->boot_file_path) ++ grub_free (options->boot_file_path); ++ ++ grub_free (options); ++} ++ ++static grub_dhcp6_session_t grub_dhcp6_sessions; ++#define FOR_DHCP6_SESSIONS(var) FOR_LIST_ELEMENTS (var, grub_dhcp6_sessions) ++ ++static void ++grub_net_configure_by_dhcp6_info (const char *name, ++ struct grub_net_card *card, ++ grub_dhcp6_options_t dhcp6, ++ int is_def, ++ int flags, ++ struct grub_net_network_level_interface **ret_inf) ++{ ++ grub_net_network_level_netaddress_t netaddr; ++ struct grub_net_network_level_interface *inf; ++ ++ if (dhcp6->ia_addr) + { +- const grub_uint8_t *options = packet->dhcp_options; +- unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet); +- unsigned int i; +- +- for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); ) +- { +- grub_uint16_t num, len; +- grub_net_dhcpv6_option_t *opt = +- (grub_net_dhcpv6_option_t *)(options + i); +- +- num = grub_be_to_cpu16(opt->option_num); +- len = grub_be_to_cpu16(opt->option_len); +- +- grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len); +- +- if (len == 0) +- break; +- +- if (len + i > 1024) +- break; +- +- if (num == GRUB_NET_DHCP6_BOOTFILE_URL) +- { +- char *scheme, *userinfo, *host, *file; +- char *tmp; +- int hostlen; +- int port; +- int rc = extract_url_info ((const char *)opt->option_data, +- (grub_size_t)len, +- &scheme, &userinfo, &host, &port, +- &file); +- if (rc < 0) +- continue; +- +- /* right now this only handles tftp. */ +- if (grub_strcmp("tftp", scheme)) +- { +- grub_free (scheme); +- grub_free (userinfo); +- grub_free (host); +- grub_free (file); +- continue; +- } +- grub_free (userinfo); +- +- hostlen = grub_strlen (host); +- if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']') +- { +- tmp = host+1; +- host[hostlen-1] = '\0'; +- } +- else +- tmp = host; ++ inf = grub_net_add_addr (name, card, dhcp6->ia_addr, &card->default_address, flags); + +- *device = grub_xasprintf ("%s,%s", scheme, tmp); +- grub_free (scheme); +- grub_free (host); ++ netaddr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ netaddr.ipv6.base[0] = dhcp6->ia_addr->ipv6[0]; ++ netaddr.ipv6.base[1] = 0; ++ netaddr.ipv6.masksize = 64; ++ grub_net_add_route (name, netaddr, inf); + +- if (file && *file) +- { +- tmp = grub_strrchr (file, '/'); +- if (tmp) +- *(tmp+1) = '\0'; +- else +- file[0] = '\0'; +- } +- else if (!file) +- file = grub_strdup (""); +- +- if (file[0] == '/') +- { +- *path = grub_strdup (file+1); +- grub_free (file); +- } +- else +- *path = file; +- } +- else if (num == GRUB_NET_DHCP6_IA_NA) +- { +- const grub_net_dhcpv6_option_t *ia_na_opt; +- const grub_net_dhcpv6_opt_ia_na_t *ia_na = +- (const grub_net_dhcpv6_opt_ia_na_t *)opt; +- unsigned int left = len - OFFSET_OF (options, ia_na); +- unsigned int j; +- +- if ((grub_uint8_t *)ia_na + left > +- (grub_uint8_t *)options + option_max) +- left -= ((grub_uint8_t *)ia_na + left) +- - ((grub_uint8_t *)options + option_max); +- +- if (len < OFFSET_OF (option_data, opt) +- + sizeof (grub_net_dhcpv6_option_t)) +- { +- grub_dprintf ("net", +- "found dhcpv6 ia_na option with no address\n"); +- continue; +- } +- +- for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); ) +- { +- ia_na_opt = (const grub_net_dhcpv6_option_t *) +- (ia_na->options + j); +- grub_uint16_t ia_na_opt_num, ia_na_opt_len; +- +- ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num); +- ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len); +- if (ia_na_opt_len == 0) +- break; +- if (j + ia_na_opt_len > left) +- break; +- if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS) +- { +- const grub_net_dhcpv6_opt_ia_address_t *ia_addr; +- +- ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *) +- ia_na_opt; +- addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; +- grub_memcpy(addr.ipv6, ia_addr->ipv6_address, +- sizeof (ia_addr->ipv6_address)); +- inter = grub_net_add_addr (name, card, &addr, hwaddr, 0); +- } +- +- j += ia_na_opt_len; +- left -= ia_na_opt_len; +- } +- } ++ if (ret_inf) ++ *ret_inf = inf; ++ } + +- i += len + 4; +- } ++ if (dhcp6->dns_server_addrs) ++ { ++ grub_uint16_t i; + +- grub_print_error (); ++ for (i = 0; i < dhcp6->num_dns_server; ++i) ++ grub_net_add_dns_server (dhcp6->dns_server_addrs + i); + } + +- if (is_def) ++ if (dhcp6->boot_file_path) ++ grub_env_set_net_property (name, "boot_file", dhcp6->boot_file_path, ++ grub_strlen (dhcp6->boot_file_path)); ++ ++ if (is_def && dhcp6->boot_file_server_ip) + { ++ grub_net_default_server = grub_strdup (dhcp6->boot_file_server_ip); + grub_env_set ("net_default_interface", name); + grub_env_export ("net_default_interface"); + } ++} ++ ++static void ++grub_dhcp6_session_add (struct grub_net_network_level_interface *iface, ++ grub_uint32_t iaid) ++{ ++ grub_dhcp6_session_t se; ++ struct grub_datetime date; ++ grub_err_t err; ++ grub_int32_t t = 0; ++ ++ se = grub_malloc (sizeof (*se)); ++ ++ err = grub_get_datetime (&date); ++ if (err || !grub_datetime2unixtime (&date, &t)) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ t = 0; ++ } ++ ++ se->iface = iface; ++ se->iaid = iaid; ++ se->transaction_id = t; ++ se->start_time = grub_get_time_ms (); ++ se->duid.type = grub_cpu_to_be16_compile_time (3) ; ++ se->duid.hw_type = grub_cpu_to_be16_compile_time (1); ++ grub_memcpy (&se->duid.hwaddr, &iface->hwaddress.mac, sizeof (se->duid.hwaddr)); ++ se->adv = NULL; ++ se->reply = NULL; ++ grub_list_push (GRUB_AS_LIST_P (&grub_dhcp6_sessions), GRUB_AS_LIST (se)); ++} ++ ++static void ++grub_dhcp6_session_remove (grub_dhcp6_session_t se) ++{ ++ grub_list_remove (GRUB_AS_LIST (se)); ++ if (se->adv) ++ grub_dhcp6_options_free (se->adv); ++ if (se->reply) ++ grub_dhcp6_options_free (se->reply); ++ grub_free (se); ++} ++ ++static void ++grub_dhcp6_session_remove_all (void) ++{ ++ grub_dhcp6_session_t se; ++ ++ FOR_DHCP6_SESSIONS (se) ++ { ++ grub_dhcp6_session_remove (se); ++ se = grub_dhcp6_sessions; ++ } ++} ++ ++static grub_err_t ++grub_dhcp6_session_configure_network (grub_dhcp6_session_t se) ++{ ++ char *name; + +- if (inter) +- grub_net_add_ipv6_local (inter, mask); +- return inter; ++ name = grub_xasprintf ("%s:dhcp6", se->iface->card->name); ++ if (!name) ++ return grub_errno; ++ ++ grub_net_configure_by_dhcp6_info (name, se->iface->card, se->reply, 1, 0, 0); ++ grub_free (name); ++ ++ return GRUB_ERR_NONE; + } + ++static grub_err_t ++grub_dhcp6_session_send_request (grub_dhcp6_session_t se) ++{ ++ struct grub_net_buff *nb; ++ struct grub_net_dhcp6_option *opt; ++ struct grub_net_dhcp6_packet *v6h; ++ struct grub_net_dhcp6_option_iana *ia_na; ++ struct grub_net_dhcp6_option_iaaddr *iaaddr; ++ struct udphdr *udph; ++ grub_net_network_level_address_t multicast; ++ grub_net_link_level_address_t ll_multicast; ++ grub_uint64_t elapsed; ++ struct grub_net_network_level_interface *inf = se->iface; ++ grub_dhcp6_options_t dhcp6 = se->adv; ++ grub_err_t err = GRUB_ERR_NONE; ++ ++ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); ++ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); ++ ++ err = grub_net_link_layer_resolve (inf, &multicast, &ll_multicast); ++ if (err) ++ return err; ++ ++ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ ++ if (!nb) ++ return grub_errno; ++ ++ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ err = grub_netbuff_push (nb, dhcp6->client_duid_len + sizeof (*opt)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); ++ opt->len = grub_cpu_to_be16 (dhcp6->client_duid_len); ++ grub_memcpy (opt->data, dhcp6->client_duid , dhcp6->client_duid_len); ++ ++ err = grub_netbuff_push (nb, dhcp6->server_duid_len + sizeof (*opt)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_SERVERID); ++ opt->len = grub_cpu_to_be16 (dhcp6->server_duid_len); ++ grub_memcpy (opt->data, dhcp6->server_duid , dhcp6->server_duid_len); ++ ++ err = grub_netbuff_push (nb, sizeof (*ia_na) + sizeof (*opt)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ if (dhcp6->ia_addr) ++ { ++ err = grub_netbuff_push (nb, sizeof(*iaaddr) + sizeof (*opt)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ } ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); ++ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); ++ if (dhcp6->ia_addr) ++ opt->len += grub_cpu_to_be16 (sizeof(*iaaddr) + sizeof (*opt)); ++ ++ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; ++ ia_na->iaid = grub_cpu_to_be32 (dhcp6->iaid); ++ ++ ia_na->t1 = grub_cpu_to_be32 (dhcp6->t1); ++ ia_na->t2 = grub_cpu_to_be32 (dhcp6->t2); ++ ++ if (dhcp6->ia_addr) ++ { ++ opt = (struct grub_net_dhcp6_option *)ia_na->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IAADDR); ++ opt->len = grub_cpu_to_be16 (sizeof (*iaaddr)); ++ iaaddr = (struct grub_net_dhcp6_option_iaaddr *)opt->data; ++ grub_set_unaligned64 (iaaddr->addr, dhcp6->ia_addr->ipv6[0]); ++ grub_set_unaligned64 (iaaddr->addr + 8, dhcp6->ia_addr->ipv6[1]); ++ ++ iaaddr->preferred_lifetime = grub_cpu_to_be32 (dhcp6->preferred_lifetime); ++ iaaddr->valid_lifetime = grub_cpu_to_be32 (dhcp6->valid_lifetime); ++ } ++ ++ err = grub_netbuff_push (nb, sizeof (*opt) + 2 * sizeof (grub_uint16_t)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ opt = (struct grub_net_dhcp6_option*) nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ORO); ++ opt->len = grub_cpu_to_be16_compile_time (2 * sizeof (grub_uint16_t)); ++ grub_set_unaligned16 (opt->data, grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_BOOTFILE_URL)); ++ grub_set_unaligned16 (opt->data + 2, grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_DNS_SERVERS)); ++ ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ opt = (struct grub_net_dhcp6_option*) nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); ++ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); ++ ++ /* the time is expressed in hundredths of a second */ ++ elapsed = grub_divmod64 (grub_get_time_ms () - se->start_time, 10, 0); ++ ++ if (elapsed > 0xffff) ++ elapsed = 0xffff; ++ ++ grub_set_unaligned16 (opt->data, grub_cpu_to_be16 ((grub_uint16_t)elapsed)); ++ ++ err = grub_netbuff_push (nb, sizeof (*v6h)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ v6h = (struct grub_net_dhcp6_packet *) nb->data; ++ v6h->message_type = GRUB_NET_DHCP6_REQUEST; ++ v6h->transaction_id = se->transaction_id; ++ ++ err = grub_netbuff_push (nb, sizeof (*udph)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ udph = (struct udphdr *) nb->data; ++ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); ++ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); ++ udph->chksum = 0; ++ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); ++ ++ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, ++ &inf->address, ++ &multicast); ++ err = grub_net_send_ip_packet (inf, &multicast, &ll_multicast, nb, ++ GRUB_NET_IP_UDP); ++ ++ grub_netbuff_free (nb); ++ ++ return err; ++} ++ ++struct grub_net_network_level_interface * ++grub_net_configure_by_dhcpv6_reply (const char *name, ++ struct grub_net_card *card, ++ grub_net_interface_flags_t flags, ++ const struct grub_net_dhcp6_packet *v6h, ++ grub_size_t size, ++ int is_def, ++ char **device, char **path) ++{ ++ struct grub_net_network_level_interface *inf; ++ grub_dhcp6_options_t dhcp6; ++ ++ dhcp6 = grub_dhcp6_options_get (v6h, size); ++ if (!dhcp6) ++ { ++ grub_print_error (); ++ return NULL; ++ } ++ ++ grub_net_configure_by_dhcp6_info (name, card, dhcp6, is_def, flags, &inf); ++ ++ if (device && dhcp6->boot_file_proto && dhcp6->boot_file_server_ip) ++ { ++ *device = grub_xasprintf ("%s,%s", dhcp6->boot_file_proto, dhcp6->boot_file_server_ip); ++ grub_print_error (); ++ } ++ if (path && dhcp6->boot_file_path) ++ { ++ *path = grub_strdup (dhcp6->boot_file_path); ++ grub_print_error (); ++ if (*path) ++ { ++ char *slash; ++ slash = grub_strrchr (*path, '/'); ++ if (slash) ++ *slash = 0; ++ else ++ **path = 0; ++ } ++ } ++ ++ grub_dhcp6_options_free (dhcp6); ++ return inf; ++} + + void + grub_net_process_dhcp (struct grub_net_buff *nb, +@@ -555,6 +1046,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, + } + } + ++grub_err_t ++grub_net_process_dhcp6 (struct grub_net_buff *nb, ++ struct grub_net_card *card __attribute__ ((unused))) ++{ ++ const struct grub_net_dhcp6_packet *v6h; ++ grub_dhcp6_session_t se; ++ grub_size_t size; ++ grub_dhcp6_options_t options; ++ ++ v6h = (const struct grub_net_dhcp6_packet *) nb->data; ++ size = nb->tail - nb->data; ++ ++ options = grub_dhcp6_options_get (v6h, size); ++ if (!options) ++ return grub_errno; ++ ++ if (!options->client_duid || !options->server_duid || !options->ia_addr) ++ { ++ grub_dhcp6_options_free (options); ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Bad DHCPv6 Packet"); ++ } ++ ++ FOR_DHCP6_SESSIONS (se) ++ { ++ if (se->transaction_id == v6h->transaction_id && ++ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 && ++ se->iaid == options->iaid) ++ break; ++ } ++ ++ if (!se) ++ { ++ grub_dprintf ("bootp", "DHCPv6 session not found\n"); ++ grub_dhcp6_options_free (options); ++ return GRUB_ERR_NONE; ++ } ++ ++ if (v6h->message_type == GRUB_NET_DHCP6_ADVERTISE) ++ { ++ if (se->adv) ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n"); ++ grub_dhcp6_options_free (options); ++ return GRUB_ERR_NONE; ++ } ++ ++ se->adv = options; ++ return grub_dhcp6_session_send_request (se); ++ } ++ else if (v6h->message_type == GRUB_NET_DHCP6_REPLY) ++ { ++ if (!se->adv) ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n"); ++ grub_dhcp6_options_free (options); ++ return GRUB_ERR_NONE; ++ } ++ ++ se->reply = options; ++ grub_dhcp6_session_configure_network (se); ++ grub_dhcp6_session_remove (se); ++ return GRUB_ERR_NONE; ++ } ++ else ++ { ++ grub_dhcp6_options_free (options); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ + static grub_err_t + grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), + int argc, char **args) +@@ -827,7 +1389,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), + return err; + } + +-static grub_command_t cmd_getdhcp, cmd_bootp; ++static grub_err_t ++grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)), ++ int argc, char **args) ++{ ++ struct grub_net_card *card; ++ grub_uint32_t iaid = 0; ++ int interval; ++ grub_err_t err; ++ grub_dhcp6_session_t se; ++ ++ err = GRUB_ERR_NONE; ++ ++ FOR_NET_CARDS (card) ++ { ++ struct grub_net_network_level_interface *iface; ++ ++ if (argc > 0 && grub_strcmp (card->name, args[0]) != 0) ++ continue; ++ ++ iface = grub_net_ipv6_get_link_local (card, &card->default_address); ++ if (!iface) ++ { ++ grub_dhcp6_session_remove_all (); ++ return grub_errno; ++ } ++ ++ grub_dhcp6_session_add (iface, iaid++); ++ } ++ ++ for (interval = 200; interval < 10000; interval *= 2) ++ { ++ int done = 1; ++ ++ FOR_DHCP6_SESSIONS (se) ++ { ++ struct grub_net_buff *nb; ++ struct grub_net_dhcp6_option *opt; ++ struct grub_net_dhcp6_packet *v6h; ++ struct grub_net_dhcp6_option_duid_ll *duid; ++ struct grub_net_dhcp6_option_iana *ia_na; ++ grub_net_network_level_address_t multicast; ++ grub_net_link_level_address_t ll_multicast; ++ struct udphdr *udph; ++ ++ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); ++ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); ++ ++ err = grub_net_link_layer_resolve (se->iface, ++ &multicast, &ll_multicast); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ return err; ++ } ++ ++ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ ++ if (!nb) ++ { ++ grub_dhcp6_session_remove_all (); ++ return grub_errno; ++ } ++ ++ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); ++ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); ++ grub_set_unaligned16 (opt->data, 0); ++ ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); ++ opt->len = grub_cpu_to_be16 (sizeof (*duid)); ++ ++ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data; ++ grub_memcpy (duid, &se->duid, sizeof (*duid)); ++ ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); ++ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); ++ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; ++ ia_na->iaid = grub_cpu_to_be32 (se->iaid); ++ ia_na->t1 = 0; ++ ia_na->t2 = 0; ++ ++ err = grub_netbuff_push (nb, sizeof (*v6h)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ v6h = (struct grub_net_dhcp6_packet *)nb->data; ++ v6h->message_type = GRUB_NET_DHCP6_SOLICIT; ++ v6h->transaction_id = se->transaction_id; ++ ++ grub_netbuff_push (nb, sizeof (*udph)); ++ ++ udph = (struct udphdr *) nb->data; ++ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); ++ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); ++ udph->chksum = 0; ++ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); ++ ++ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, ++ &se->iface->address, &multicast); ++ ++ err = grub_net_send_ip_packet (se->iface, &multicast, ++ &ll_multicast, nb, GRUB_NET_IP_UDP); ++ done = 0; ++ grub_netbuff_free (nb); ++ ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ return err; ++ } ++ } ++ if (!done) ++ grub_net_poll_cards (interval, 0); ++ } ++ ++ FOR_DHCP6_SESSIONS (se) ++ { ++ grub_error_push (); ++ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, ++ N_("couldn't autoconfigure %s"), ++ se->iface->card->name); ++ } ++ ++ grub_dhcp6_session_remove_all (); ++ ++ return err; ++} ++ ++static grub_command_t cmd_getdhcp, cmd_bootp, cmd_bootp6; + + void + grub_bootp_init (void) +@@ -838,6 +1567,9 @@ grub_bootp_init (void) + cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, + N_("VAR INTERFACE NUMBER DESCRIPTION"), + N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); ++ cmd_bootp6 = grub_register_command ("net_bootp6", grub_cmd_bootp6, ++ N_("[CARD]"), ++ N_("perform a DHCPv6 autoconfiguration")); + } + + void +@@ -845,4 +1577,5 @@ grub_bootp_fini (void) + { + grub_unregister_command (cmd_getdhcp); + grub_unregister_command (cmd_bootp); ++ grub_unregister_command (cmd_bootp6); + } +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 329024b6f2c..6cc139fb8fc 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -473,9 +473,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + pxe_mode = pxe->mode; + if (pxe_mode->using_ipv6) + { +- grub_net_link_level_address_t hwaddr; +- struct grub_net_network_level_interface *intf; +- + grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); + grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", + pxe_mode->dhcp_ack_received ? "yes" : "no", +@@ -483,15 +480,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + if (!pxe_mode->dhcp_ack_received) + continue; + +- hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; +- grub_memcpy (hwaddr.mac, +- card->efi_net->mode->current_address, +- sizeof (hwaddr.mac)); +- +- intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, +- (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6, +- 1, device, path); +- if (intf && device && path) ++ grub_net_configure_by_dhcpv6_reply (card->name, card, 0, ++ (struct grub_net_dhcp6_packet *) ++ &pxe_mode->dhcp_ack, ++ sizeof (pxe_mode->dhcp_ack), ++ 1, device, path); ++ if (grub_errno) ++ grub_print_error (); ++ if (device && path) + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + } + else +diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c +index 7c95cc7464a..fd641b2410d 100644 +--- a/grub-core/net/ip.c ++++ b/grub-core/net/ip.c +@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, + { + struct udphdr *udph; + udph = (struct udphdr *) nb->data; ++ ++ if (proto == GRUB_NET_IP_UDP && udph->dst == grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT)) ++ { ++ if (udph->chksum) ++ { ++ grub_uint16_t chk, expected; ++ chk = udph->chksum; ++ udph->chksum = 0; ++ expected = grub_net_ip_transport_checksum (nb, ++ GRUB_NET_IP_UDP, ++ source, ++ dest); ++ if (expected != chk) ++ { ++ grub_dprintf ("net", "Invalid UDP checksum. " ++ "Expected %x, got %x\n", ++ grub_be_to_cpu16 (expected), ++ grub_be_to_cpu16 (chk)); ++ grub_netbuff_free (nb); ++ return GRUB_ERR_NONE; ++ } ++ udph->chksum = chk; ++ } ++ ++ err = grub_netbuff_pull (nb, sizeof (*udph)); ++ if (err) ++ { ++ grub_netbuff_free (nb); ++ return err; ++ } ++ ++ err = grub_net_process_dhcp6 (nb, card); ++ if (err) ++ grub_print_error (); ++ ++ grub_netbuff_free (nb); ++ return GRUB_ERR_NONE; ++ } ++ + if (proto == GRUB_NET_IP_UDP && grub_be_to_cpu16 (udph->dst) == 68) + { + const struct grub_net_bootp_packet *bootp; +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index ddc5ecfb03d..6a545cc6d5d 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -1511,7 +1511,7 @@ typedef struct grub_efi_pxe_ip_filter + { + grub_efi_uint8_t filters; + grub_efi_uint8_t ip_count; +- grub_efi_uint8_t reserved; ++ grub_efi_uint16_t reserved; + grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_MAX_IPCNT]; + } grub_efi_pxe_ip_filter_t; + +diff --git a/include/grub/net.h b/include/grub/net.h +index 24232ec71fc..373ad1080cf 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -445,46 +445,62 @@ struct grub_net_bootp_packet + + enum + { +- GRUB_NET_DHCP6_IA_NA = 3, +- GRUB_NET_DHCP6_IA_ADDRESS = 5, +- GRUB_NET_DHCP6_BOOTFILE_URL = 59, ++ GRUB_NET_DHCP6_OPTION_CLIENTID = 1, ++ GRUB_NET_DHCP6_OPTION_SERVERID = 2, ++ GRUB_NET_DHCP6_OPTION_IA_NA = 3, ++ GRUB_NET_DHCP6_OPTION_IAADDR = 5, ++ GRUB_NET_DHCP6_OPTION_ORO = 6, ++ GRUB_NET_DHCP6_OPTION_ELAPSED_TIME = 8, ++ GRUB_NET_DHCP6_OPTION_DNS_SERVERS = 23, ++ GRUB_NET_DHCP6_OPTION_BOOTFILE_URL = 59 + }; + +-struct grub_net_dhcpv6_option +-{ +- grub_uint16_t option_num; +- grub_uint16_t option_len; +- grub_uint8_t option_data[]; ++struct grub_net_dhcp6_option { ++ grub_uint16_t code; ++ grub_uint16_t len; ++ grub_uint8_t data[0]; + } GRUB_PACKED; +-typedef struct grub_net_dhcpv6_option grub_net_dhcpv6_option_t; + +-struct grub_net_dhcpv6_opt_ia_na +-{ +- grub_uint16_t option_num; +- grub_uint16_t option_len; ++struct grub_net_dhcp6_option_iana { + grub_uint32_t iaid; + grub_uint32_t t1; + grub_uint32_t t2; +- grub_uint8_t options[]; ++ grub_uint8_t data[0]; + } GRUB_PACKED; +-typedef struct grub_net_dhcpv6_opt_ia_na grub_net_dhcpv6_opt_ia_na_t; + +-struct grub_net_dhcpv6_opt_ia_address +-{ +- grub_uint16_t option_num; +- grub_uint16_t option_len; +- grub_uint64_t ipv6_address[2]; ++struct grub_net_dhcp6_option_iaaddr { ++ grub_uint8_t addr[16]; + grub_uint32_t preferred_lifetime; + grub_uint32_t valid_lifetime; +- grub_uint8_t options[]; ++ grub_uint8_t data[0]; + } GRUB_PACKED; +-typedef struct grub_net_dhcpv6_opt_ia_address grub_net_dhcpv6_opt_ia_address_t; + +-struct grub_net_dhcpv6_packet ++struct grub_net_dhcp6_option_duid_ll ++{ ++ grub_uint16_t type; ++ grub_uint16_t hw_type; ++ grub_uint8_t hwaddr[6]; ++} GRUB_PACKED; ++ ++enum ++ { ++ GRUB_NET_DHCP6_SOLICIT = 1, ++ GRUB_NET_DHCP6_ADVERTISE = 2, ++ GRUB_NET_DHCP6_REQUEST = 3, ++ GRUB_NET_DHCP6_REPLY = 7 ++ }; ++ ++enum ++ { ++ DHCP6_CLIENT_PORT = 546, ++ DHCP6_SERVER_PORT = 547 ++ }; ++ ++struct grub_net_dhcp6_packet + { + grub_uint32_t message_type:8; + grub_uint32_t transaction_id:24; +- grub_uint8_t dhcp_options[1024]; ++ grub_uint8_t dhcp_options[0]; + } GRUB_PACKED; + typedef struct grub_net_dhcpv6_packet grub_net_dhcpv6_packet_t; + +@@ -517,12 +533,12 @@ grub_net_configure_by_dhcp_ack (const char *name, + int is_def, char **device, char **path); + + struct grub_net_network_level_interface * +-grub_net_configure_by_dhcpv6_ack (const char *name, +- struct grub_net_card *card, +- grub_net_interface_flags_t flags, +- const grub_net_link_level_address_t *hwaddr, +- const struct grub_net_dhcpv6_packet *packet, +- int is_def, char **device, char **path); ++grub_net_configure_by_dhcpv6_reply (const char *name, ++ struct grub_net_card *card, ++ grub_net_interface_flags_t flags, ++ const struct grub_net_dhcp6_packet *v6, ++ grub_size_t size, ++ int is_def, char **device, char **path); + + int + grub_ipv6_get_masksize(grub_uint16_t *mask); +@@ -539,6 +555,10 @@ void + grub_net_process_dhcp (struct grub_net_buff *nb, + struct grub_net_card *card); + ++grub_err_t ++grub_net_process_dhcp6 (struct grub_net_buff *nb, ++ struct grub_net_card *card); ++ + int + grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, + const grub_net_link_level_address_t *b); +-- +2.14.3 + diff --git a/0242-grub.texi-Add-net_bootp6-doument.patch b/0242-grub.texi-Add-net_bootp6-doument.patch new file mode 100644 index 0000000..46361a0 --- /dev/null +++ b/0242-grub.texi-Add-net_bootp6-doument.patch @@ -0,0 +1,51 @@ +From a0c969d3c591c21eeeb0ba032ec8ea1257efb898 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Tue, 5 May 2015 14:19:24 +0800 +Subject: [PATCH 242/250] grub.texi: Add net_bootp6 doument + +Update grub documentation for net_bootp6 command. + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + docs/grub.texi | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/docs/grub.texi b/docs/grub.texi +index f28c4cd5247..0e14a78ceaa 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -5224,6 +5224,7 @@ This command is only available on AArch64 systems. + * net_add_dns:: Add a DNS server + * net_add_route:: Add routing entry + * net_bootp:: Perform a bootp autoconfiguration ++* net_bootp6:: Perform a DHCPv6 autoconfiguration + * net_del_addr:: Remove IP address from interface + * net_del_dns:: Remove a DNS server + * net_del_route:: Remove a route entry +@@ -5305,6 +5306,22 @@ Sets environment variable @samp{net_}@var{}@samp{_dhcp_extensionspath} + + @end deffn + ++@node net_bootp6 ++@subsection net_bootp6 ++ ++@deffn Command net_bootp6 [@var{card}] ++Perform configuration of @var{card} using DHCPv6 protocol. If no card name is ++specified, try to configure all existing cards. If configuration was ++successful, interface with name @var{card}@samp{:dhcp6} and configured address ++is added to @var{card}. ++ ++@table @samp ++@item 1 (Domain Name Server) ++Adds all servers from option value to the list of servers used during name ++resolution. ++@end table ++ ++@end deffn + + @node net_del_addr + @subsection net_del_addr +-- +2.14.3 + diff --git a/0243-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0243-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch new file mode 100644 index 0000000..cbb05d4 --- /dev/null +++ b/0243-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -0,0 +1,130 @@ +From 7b6d6e50bea268456d55806cb21d49cbc01c10d1 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 14 Jul 2016 18:45:14 +0800 +Subject: [PATCH 243/250] bootp: Add processing DHCPACK packet from HTTP Boot + +The vendor class identifier with the string "HTTPClient" is used to denote the +packet as responding to HTTP boot request. In DHCP4 config, the filename for +HTTP boot is the URL of the boot file while for PXE boot it is the path to the +boot file. As a consequence, the next-server becomes obseleted because the HTTP +URL already contains the server address for the boot file. For DHCP6 config, +there's no difference definition in existing config as dhcp6.bootfile-url can +be used to specify URL for both HTTP and PXE boot file. + +This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK +packet by treating it as HTTP format, not as the PXE format. + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + grub-core/net/bootp.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++-- + include/grub/net.h | 1 + + 2 files changed, 66 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 6995f986744..902e5a60154 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -254,6 +254,11 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) + taglength); + break; + ++ case GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER: ++ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) ptr, ++ taglength); ++ break; ++ + case GRUB_NET_BOOTP_EXTENSIONS_PATH: + grub_env_set_net_property (name, "extensionspath", (const char *) ptr, + taglength); +@@ -362,6 +367,66 @@ grub_net_configure_by_dhcp_ack (const char *name, + } + #endif + ++ if (size > OFFSET_OF (vendor, bp)) ++ { ++ char *cidvar; ++ const char *cid; ++ ++ parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); ++ cidvar = grub_xasprintf ("net_%s_%s", name, "vendor_class_identifier"); ++ cid = grub_env_get (cidvar); ++ grub_free (cidvar); ++ ++ if (cid && grub_strcmp (cid, "HTTPClient") == 0) ++ { ++ char *proto, *ip, *pa; ++ ++ if (!dissect_url (bp->boot_file, &proto, &ip, &pa)) ++ return inter; ++ ++ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa)); ++ if (is_def) ++ { ++ grub_net_default_server = grub_strdup (ip); ++ grub_env_set ("net_default_interface", name); ++ grub_env_export ("net_default_interface"); ++ } ++ if (device && !*device) ++ { ++ *device = grub_xasprintf ("%s,%s", proto, ip); ++ grub_print_error (); ++ } ++ if (path) ++ { ++ *path = grub_strdup (pa); ++ grub_print_error (); ++ if (*path) ++ { ++ char *slash; ++ slash = grub_strrchr (*path, '/'); ++ if (slash) ++ *slash = 0; ++ else ++ **path = 0; ++ } ++ } ++ grub_net_add_ipv4_local (inter, mask); ++ inter->dhcp_ack = grub_malloc (size); ++ if (inter->dhcp_ack) ++ { ++ grub_memcpy (inter->dhcp_ack, bp, size); ++ inter->dhcp_acklen = size; ++ } ++ else ++ grub_errno = GRUB_ERR_NONE; ++ ++ grub_free (proto); ++ grub_free (ip); ++ grub_free (pa); ++ return inter; ++ } ++ } ++ + if (size > OFFSET_OF (boot_file, bp)) + grub_env_set_net_property (name, "boot_file", bp->boot_file, + sizeof (bp->boot_file)); +@@ -426,8 +491,6 @@ grub_net_configure_by_dhcp_ack (const char *name, + **path = 0; + } + } +- if (size > OFFSET_OF (vendor, bp)) +- parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); + grub_net_add_ipv4_local (inter, mask); + + inter->dhcp_ack = grub_malloc (size); +diff --git a/include/grub/net.h b/include/grub/net.h +index 373ad1080cf..1c7c3ecb6ab 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -519,6 +519,7 @@ enum + GRUB_NET_BOOTP_DOMAIN = 0x0f, + GRUB_NET_BOOTP_ROOT_PATH = 0x11, + GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, ++ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C, + GRUB_NET_BOOTP_CLIENT_ID = 0x3d, + GRUB_NET_BOOTP_CLIENT_UUID = 0x61, + GRUB_NET_BOOTP_END = 0xff +-- +2.14.3 + diff --git a/0244-efinet-Setting-network-from-UEFI-device-path.patch b/0244-efinet-Setting-network-from-UEFI-device-path.patch new file mode 100644 index 0000000..4547a53 --- /dev/null +++ b/0244-efinet-Setting-network-from-UEFI-device-path.patch @@ -0,0 +1,402 @@ +From da2f323f72641219714b2ae448c62db6a7f64898 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Sun, 10 Jul 2016 23:46:31 +0800 +Subject: [PATCH 244/250] efinet: Setting network from UEFI device path + +The PXE Base Code protocol used to obtain cached PXE DHCPACK packet is no +longer provided for HTTP Boot. Instead, we have to get the HTTP boot +information from the device path nodes defined in following UEFI Specification +sections. + + 9.3.5.12 IPv4 Device Path + 9.3.5.13 IPv6 Device Path + 9.3.5.23 Uniform Resource Identifiers (URI) Device Path + +This patch basically does: + +include/grub/efi/api.h: +Add new structure of Uniform Resource Identifiers (URI) Device Path + +grub-core/net/drivers/efi/efinet.c: +Check if PXE Base Code is available, if not it will try to obtain the netboot +information from the device path where the image booted from. The DHCPACK +packet is recoverd from the information in device patch and feed into the same +DHCP packet processing functions to ensure the network interface is setting up +the same way it used to be. + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + grub-core/net/drivers/efi/efinet.c | 278 +++++++++++++++++++++++++++++++++++-- + include/grub/efi/api.h | 11 ++ + 2 files changed, 274 insertions(+), 15 deletions(-) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 6cc139fb8fc..2890e72e87a 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -408,6 +409,221 @@ grub_efinet_findcards (void) + } + } + ++static struct grub_net_buff * ++grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) ++{ ++ grub_efi_uint16_t uri_len; ++ grub_efi_device_path_t *ldp, *ddp; ++ grub_efi_uri_device_path_t *uri_dp; ++ struct grub_net_buff *nb; ++ grub_err_t err; ++ ++ ddp = grub_efi_duplicate_device_path (dp); ++ ldp = grub_efi_find_last_device_path (ddp); ++ ++ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE) ++ { ++ grub_free (ddp); ++ return NULL; ++ } ++ ++ uri_len = GRUB_EFI_DEVICE_PATH_LENGTH (ldp) > 4 ? GRUB_EFI_DEVICE_PATH_LENGTH (ldp) - 4 : 0; ++ ++ if (!uri_len) ++ { ++ grub_free (ddp); ++ return NULL; ++ } ++ ++ uri_dp = (grub_efi_uri_device_path_t *) ldp; ++ ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ ++ ldp = grub_efi_find_last_device_path (ddp); ++ ++ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) ++ { ++ grub_free (ddp); ++ return NULL; ++ } ++ ++ nb = grub_netbuff_alloc (512); ++ if (!nb) ++ return NULL; ++ ++ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE) ++ { ++ grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; ++ struct grub_net_bootp_packet *bp; ++ grub_uint8_t *ptr; ++ ++ bp = (struct grub_net_bootp_packet *) nb->tail; ++ err = grub_netbuff_put (nb, sizeof (*bp) + 4); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ ++ if (sizeof(bp->boot_file) < uri_len) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ grub_memcpy (bp->boot_file, uri_dp->uri, uri_len); ++ grub_memcpy (&bp->your_ip, ipv4->local_ip_address, sizeof (bp->your_ip)); ++ grub_memcpy (&bp->server_ip, ipv4->remote_ip_address, sizeof (bp->server_ip)); ++ ++ bp->vendor[0] = GRUB_NET_BOOTP_RFC1048_MAGIC_0; ++ bp->vendor[1] = GRUB_NET_BOOTP_RFC1048_MAGIC_1; ++ bp->vendor[2] = GRUB_NET_BOOTP_RFC1048_MAGIC_2; ++ bp->vendor[3] = GRUB_NET_BOOTP_RFC1048_MAGIC_3; ++ ++ ptr = nb->tail; ++ err = grub_netbuff_put (nb, sizeof (ipv4->subnet_mask) + 2); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ *ptr++ = GRUB_NET_BOOTP_NETMASK; ++ *ptr++ = sizeof (ipv4->subnet_mask); ++ grub_memcpy (ptr, ipv4->subnet_mask, sizeof (ipv4->subnet_mask)); ++ ++ ptr = nb->tail; ++ err = grub_netbuff_put (nb, sizeof (ipv4->gateway_ip_address) + 2); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ *ptr++ = GRUB_NET_BOOTP_ROUTER; ++ *ptr++ = sizeof (ipv4->gateway_ip_address); ++ grub_memcpy (ptr, ipv4->gateway_ip_address, sizeof (ipv4->gateway_ip_address)); ++ ++ ptr = nb->tail; ++ err = grub_netbuff_put (nb, sizeof ("HTTPClient") + 1); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ *ptr++ = GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER; ++ *ptr++ = sizeof ("HTTPClient") - 1; ++ grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); ++ ++ ptr = nb->tail; ++ err = grub_netbuff_put (nb, 1); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ *ptr = GRUB_NET_BOOTP_END; ++ *use_ipv6 = 0; ++ ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ ldp = grub_efi_find_last_device_path (ddp); ++ ++ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE) ++ { ++ grub_efi_mac_address_device_path_t *mac = (grub_efi_mac_address_device_path_t *) ldp; ++ bp->hw_type = mac->if_type; ++ bp->hw_len = sizeof (bp->mac_addr); ++ grub_memcpy (bp->mac_addr, mac->mac_address, bp->hw_len); ++ } ++ } ++ else ++ { ++ grub_efi_ipv6_device_path_t *ipv6 = (grub_efi_ipv6_device_path_t *) ldp; ++ ++ struct grub_net_dhcp6_packet *d6p; ++ struct grub_net_dhcp6_option *opt; ++ struct grub_net_dhcp6_option_iana *iana; ++ struct grub_net_dhcp6_option_iaaddr *iaaddr; ++ ++ d6p = (struct grub_net_dhcp6_packet *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*d6p)); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ d6p->message_type = GRUB_NET_DHCP6_REPLY; ++ ++ opt = (struct grub_net_dhcp6_option *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*opt)); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); ++ opt->len = grub_cpu_to_be16_compile_time (sizeof(*iana) + sizeof(*opt) + sizeof(*iaaddr)); ++ ++ err = grub_netbuff_put (nb, sizeof(*iana)); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ ++ opt = (struct grub_net_dhcp6_option *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*opt)); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IAADDR); ++ opt->len = grub_cpu_to_be16_compile_time (sizeof (*iaaddr)); ++ ++ iaaddr = (struct grub_net_dhcp6_option_iaaddr *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*iaaddr)); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ grub_memcpy (iaaddr->addr, ipv6->local_ip_address, sizeof(ipv6->local_ip_address)); ++ ++ opt = (struct grub_net_dhcp6_option *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*opt) + uri_len); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_BOOTFILE_URL); ++ opt->len = grub_cpu_to_be16 (uri_len); ++ grub_memcpy (opt->data, uri_dp->uri, uri_len); ++ ++ *use_ipv6 = 1; ++ } ++ ++ grub_free (ddp); ++ return nb; ++} ++ + static void + grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + char **path) +@@ -423,7 +639,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + { + grub_efi_device_path_t *cdp; + struct grub_efi_pxe *pxe; +- struct grub_efi_pxe_mode *pxe_mode; ++ struct grub_efi_pxe_mode *pxe_mode = NULL; ++ grub_uint8_t *packet_buf; ++ grub_size_t packet_bufsz ; ++ int ipv6; ++ struct grub_net_buff *nb = NULL; + + if (card->driver != &efidriver) + continue; +@@ -450,11 +670,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + */ + if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE +- && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) + continue; + dup_dp = grub_efi_duplicate_device_path (dp); + if (!dup_dp) + continue; ++ ++ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_URI_DEVICE_PATH_SUBTYPE) ++ { ++ dup_ldp = grub_efi_find_last_device_path (dup_dp); ++ dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ dup_ldp->length = sizeof (*dup_ldp); ++ } ++ + dup_ldp = grub_efi_find_last_device_path (dup_dp); + dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; + dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; +@@ -467,23 +697,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + + pxe = grub_efi_open_protocol (hnd, &pxe_io_guid, + GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); +- if (! pxe) +- continue; ++ if (!pxe) ++ { ++ nb = grub_efinet_create_dhcp_ack_from_device_path (dp, &ipv6); ++ if (!nb) ++ { ++ grub_print_error (); ++ continue; ++ } ++ packet_buf = nb->head; ++ packet_bufsz = nb->tail - nb->head; ++ } ++ else ++ { ++ pxe_mode = pxe->mode; ++ packet_buf = (grub_uint8_t *) &pxe_mode->dhcp_ack; ++ packet_bufsz = sizeof (pxe_mode->dhcp_ack); ++ ipv6 = pxe_mode->using_ipv6; ++ } + +- pxe_mode = pxe->mode; +- if (pxe_mode->using_ipv6) ++ if (ipv6) + { + grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); +- grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", +- pxe_mode->dhcp_ack_received ? "yes" : "no", +- pxe_mode->dhcp_ack_received ? "" : " cannot continue"); +- if (!pxe_mode->dhcp_ack_received) +- continue; ++ if (pxe_mode) ++ grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", ++ pxe_mode->dhcp_ack_received ? "yes" : "no", ++ pxe_mode->dhcp_ack_received ? "" : " cannot continue"); + + grub_net_configure_by_dhcpv6_reply (card->name, card, 0, + (struct grub_net_dhcp6_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), ++ packet_buf, ++ packet_bufsz, + 1, device, path); + if (grub_errno) + grub_print_error (); +@@ -495,11 +739,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + grub_dprintf ("efinet", "using ipv4 and dhcp\n"); + grub_net_configure_by_dhcp_ack (card->name, card, 0, + (struct grub_net_bootp_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), ++ packet_buf, ++ packet_bufsz, + 1, device, path); + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + } ++ ++ if (nb) ++ grub_netbuff_free (nb); ++ + return; + } + } +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 6a545cc6d5d..eba987de00a 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -843,6 +843,8 @@ struct grub_efi_ipv4_device_path + grub_efi_uint16_t remote_port; + grub_efi_uint16_t protocol; + grub_efi_uint8_t static_ip_address; ++ grub_efi_ipv4_address_t gateway_ip_address; ++ grub_efi_ipv4_address_t subnet_mask; + } GRUB_PACKED; + typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; + +@@ -897,6 +899,15 @@ struct grub_efi_sata_device_path + } GRUB_PACKED; + typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t; + ++#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24 ++ ++struct grub_efi_uri_device_path ++{ ++ grub_efi_device_path_t header; ++ grub_efi_uint8_t uri[0]; ++} GRUB_PACKED; ++typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; ++ + #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 + + /* Media Device Path. */ +-- +2.14.3 + diff --git a/0245-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0245-efinet-Setting-DNS-server-from-UEFI-protocol.patch new file mode 100644 index 0000000..4b8d030 --- /dev/null +++ b/0245-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -0,0 +1,340 @@ +From bb5acb2cc50c1fbd6e214ca66268e04733a906eb Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 14 Jul 2016 17:48:45 +0800 +Subject: [PATCH 245/250] efinet: Setting DNS server from UEFI protocol + +In the URI device path node, any name rahter than address can be used for +looking up the resources so that DNS service become needed to get answer of the +name's address. Unfortunately the DNS is not defined in any of the device path +nodes so that we use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL +to obtain it. + +These two protcols are defined the sections of UEFI specification. + + 27.5 EFI IPv4 Configuration II Protocol + 27.7 EFI IPv6 Configuration Protocol + +include/grub/efi/api.h: +Add new structure and protocol UUID of EFI_IP4_CONFIG2_PROTOCOL and +EFI_IP6_CONFIG_PROTOCOL. + +grub-core/net/drivers/efi/efinet.c: +Use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL to obtain the list +of DNS server address for IPv4 and IPv6 respectively. The address of DNS +servers is structured into DHCPACK packet and feed into the same DHCP packet +processing functions to ensure the network interface is setting up the same way +it used to be. + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++ + include/grub/efi/api.h | 76 +++++++++++++++++ + 2 files changed, 239 insertions(+) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 2890e72e87a..64d3019af67 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -34,6 +34,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + /* GUID. */ + static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; + static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; ++static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; ++static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; + + static grub_err_t + send_card_buffer (struct grub_net_card *dev, +@@ -409,6 +411,125 @@ grub_efinet_findcards (void) + } + } + ++static grub_efi_handle_t ++grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path, ++ grub_efi_device_path_t **r_device_path) ++{ ++ grub_efi_handle_t handle; ++ grub_efi_status_t status; ++ ++ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path, ++ protocol, &device_path, &handle); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ ++ if (r_device_path) ++ *r_device_path = device_path; ++ ++ return handle; ++} ++ ++static grub_efi_ipv4_address_t * ++grub_dns_server_ip4_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns) ++{ ++ grub_efi_handle_t hnd; ++ grub_efi_status_t status; ++ grub_efi_ip4_config2_protocol_t *conf; ++ grub_efi_ipv4_address_t *addrs; ++ grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv4_address_t); ++ ++ hnd = grub_efi_locate_device_path (&ip4_config_guid, dp, NULL); ++ ++ if (!hnd) ++ return 0; ++ ++ conf = grub_efi_open_protocol (hnd, &ip4_config_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ ++ if (!conf) ++ return 0; ++ ++ addrs = grub_malloc (data_size); ++ if (!addrs) ++ return 0; ++ ++ status = efi_call_4 (conf->get_data, conf, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL) ++ { ++ grub_free (addrs); ++ addrs = grub_malloc (data_size); ++ if (!addrs) ++ return 0; ++ ++ status = efi_call_4 (conf->get_data, conf, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (addrs); ++ return 0; ++ } ++ ++ *num_dns = data_size / sizeof (grub_efi_ipv4_address_t); ++ return addrs; ++} ++ ++static grub_efi_ipv6_address_t * ++grub_dns_server_ip6_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns) ++{ ++ grub_efi_handle_t hnd; ++ grub_efi_status_t status; ++ grub_efi_ip6_config_protocol_t *conf; ++ grub_efi_ipv6_address_t *addrs; ++ grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv6_address_t); ++ ++ hnd = grub_efi_locate_device_path (&ip6_config_guid, dp, NULL); ++ ++ if (!hnd) ++ return 0; ++ ++ conf = grub_efi_open_protocol (hnd, &ip6_config_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ ++ if (!conf) ++ return 0; ++ ++ addrs = grub_malloc (data_size); ++ if (!addrs) ++ return 0; ++ ++ status = efi_call_4 (conf->get_data, conf, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL) ++ { ++ grub_free (addrs); ++ addrs = grub_malloc (data_size); ++ if (!addrs) ++ return 0; ++ ++ status = efi_call_4 (conf->get_data, conf, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (addrs); ++ return 0; ++ } ++ ++ *num_dns = data_size / sizeof (grub_efi_ipv6_address_t); ++ return addrs; ++} ++ + static struct grub_net_buff * + grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) + { +@@ -461,6 +582,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; + struct grub_net_bootp_packet *bp; + grub_uint8_t *ptr; ++ grub_efi_ipv4_address_t *dns; ++ grub_efi_uintn_t num_dns; + + bp = (struct grub_net_bootp_packet *) nb->tail; + err = grub_netbuff_put (nb, sizeof (*bp) + 4); +@@ -522,6 +645,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + *ptr++ = sizeof ("HTTPClient") - 1; + grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); + ++ dns = grub_dns_server_ip4_address (dp, &num_dns); ++ if (dns) ++ { ++ grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns; ++ ++ ptr = nb->tail; ++ err = grub_netbuff_put (nb, size_dns + 2); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ *ptr++ = GRUB_NET_BOOTP_DNS; ++ *ptr++ = size_dns; ++ grub_memcpy (ptr, dns, size_dns); ++ grub_free (dns); ++ } ++ + ptr = nb->tail; + err = grub_netbuff_put (nb, 1); + if (err) +@@ -554,6 +696,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + struct grub_net_dhcp6_option *opt; + struct grub_net_dhcp6_option_iana *iana; + struct grub_net_dhcp6_option_iaaddr *iaaddr; ++ grub_efi_ipv6_address_t *dns; ++ grub_efi_uintn_t num_dns; + + d6p = (struct grub_net_dhcp6_packet *)nb->tail; + err = grub_netbuff_put (nb, sizeof(*d6p)); +@@ -617,6 +761,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + opt->len = grub_cpu_to_be16 (uri_len); + grub_memcpy (opt->data, uri_dp->uri, uri_len); + ++ dns = grub_dns_server_ip6_address (dp, &num_dns); ++ if (dns) ++ { ++ grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns; ++ ++ opt = (struct grub_net_dhcp6_option *)nb->tail; ++ err = grub_netbuff_put (nb, sizeof(*opt) + size_dns); ++ if (err) ++ { ++ grub_free (ddp); ++ grub_netbuff_free (nb); ++ return NULL; ++ } ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_DNS_SERVERS); ++ opt->len = grub_cpu_to_be16 (size_dns); ++ grub_memcpy (opt->data, dns, size_dns); ++ grub_free (dns); ++ } ++ + *use_ipv6 = 1; + } + +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index eba987de00a..48302449170 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -334,6 +334,16 @@ + { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ + } + ++#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \ ++ { 0x5b446ed1, 0xe30b, 0x4faa, \ ++ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ ++ } ++ ++#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \ ++ { 0x937fe521, 0x95ae, 0x4d1a, \ ++ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ ++ } ++ + struct grub_efi_sal_system_table + { + grub_uint32_t signature; +@@ -1825,6 +1835,72 @@ struct grub_efi_block_io + }; + typedef struct grub_efi_block_io grub_efi_block_io_t; + ++enum grub_efi_ip4_config2_data_type { ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MAXIMUM ++}; ++typedef enum grub_efi_ip4_config2_data_type grub_efi_ip4_config2_data_type_t; ++ ++struct grub_efi_ip4_config2_protocol ++{ ++ grub_efi_status_t (*set_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_ip4_config2_data_type_t data_type, ++ grub_efi_uintn_t data_size, ++ void *data); ++ ++ grub_efi_status_t (*get_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_ip4_config2_data_type_t data_type, ++ grub_efi_uintn_t *data_size, ++ void *data); ++ ++ grub_efi_status_t (*register_data_notify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_ip4_config2_data_type_t data_type, ++ grub_efi_event_t event); ++ ++ grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_ip4_config2_data_type_t data_type, ++ grub_efi_event_t event); ++}; ++typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; ++ ++enum grub_efi_ip6_config_data_type { ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DUP_ADDR_DETECT_TRANSMITS, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MAXIMUM ++}; ++typedef enum grub_efi_ip6_config_data_type grub_efi_ip6_config_data_type_t; ++ ++struct grub_efi_ip6_config_protocol ++{ ++ grub_efi_status_t (*set_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_ip6_config_data_type_t data_type, ++ grub_efi_uintn_t data_size, ++ void *data); ++ ++ grub_efi_status_t (*get_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_ip6_config_data_type_t data_type, ++ grub_efi_uintn_t *data_size, ++ void *data); ++ ++ grub_efi_status_t (*register_data_notify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_ip6_config_data_type_t data_type, ++ grub_efi_event_t event); ++ ++ grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_ip6_config_data_type_t data_type, ++ grub_efi_event_t event); ++}; ++typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; ++ + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) + +-- +2.14.3 + diff --git a/0246-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch b/0246-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch new file mode 100644 index 0000000..df4a819 --- /dev/null +++ b/0246-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch @@ -0,0 +1,60 @@ +From f332a348642ef45df2445c4ec04a629a234e04fd Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Wed, 1 Feb 2017 23:10:45 +0100 +Subject: [PATCH 246/250] grub-core/video/efi_gop.c: Add support for BLT_ONLY + adapters + +EFI GOP has support for multiple different bitness types of frame buffers +and for a special "BLT only" type which is always defined to be RGBx. + +Because grub2 doesn't ever directly access the frame buffer but instead +only renders graphics via the BLT interface anyway, we can easily support +these adapters. + +The reason this has come up now is the emerging support for virtio-gpu +in OVMF. That adapter does not have the notion of a memory mapped frame +buffer and thus is BLT only. + +Signed-off-by: Alexander Graf +--- + grub-core/video/efi_gop.c | 2 ++ + include/grub/efi/graphics_output.h | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c +index 7f9d1c2dfa1..c9e40e8d4e9 100644 +--- a/grub-core/video/efi_gop.c ++++ b/grub-core/video/efi_gop.c +@@ -121,6 +121,7 @@ grub_video_gop_get_bpp (struct grub_efi_gop_mode_info *in) + { + case GRUB_EFI_GOT_BGRA8: + case GRUB_EFI_GOT_RGBA8: ++ case GRUB_EFI_GOT_BLT_ONLY: + return 32; + + case GRUB_EFI_GOT_BITMASK: +@@ -187,6 +188,7 @@ grub_video_gop_fill_real_mode_info (unsigned mode, + switch (in->pixel_format) + { + case GRUB_EFI_GOT_RGBA8: ++ case GRUB_EFI_GOT_BLT_ONLY: + out->red_mask_size = 8; + out->red_field_pos = 0; + out->green_mask_size = 8; +diff --git a/include/grub/efi/graphics_output.h b/include/grub/efi/graphics_output.h +index 12977741192..e4388127c66 100644 +--- a/include/grub/efi/graphics_output.h ++++ b/include/grub/efi/graphics_output.h +@@ -28,7 +28,8 @@ typedef enum + { + GRUB_EFI_GOT_RGBA8, + GRUB_EFI_GOT_BGRA8, +- GRUB_EFI_GOT_BITMASK ++ GRUB_EFI_GOT_BITMASK, ++ GRUB_EFI_GOT_BLT_ONLY, + } + grub_efi_gop_pixel_format_t; + +-- +2.14.3 + diff --git a/0247-Support-UEFI-networking-protocols.patch b/0247-Support-UEFI-networking-protocols.patch new file mode 100644 index 0000000..962c154 --- /dev/null +++ b/0247-Support-UEFI-networking-protocols.patch @@ -0,0 +1,5043 @@ +From 2ba7c6d3c99c669ce20d26fdc9ed7851fc10b6b4 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Wed, 22 Feb 2017 14:27:50 +0800 +Subject: [PATCH 247/250] Support UEFI networking protocols + +References: fate#320130, bsc#1015589, bsc#1076132 +Patch-Mainline: no + +V1: + * Add preliminary support of UEFI networking protocols + * Support UEFI HTTPS Boot + +V2: + * Workaround http data access in firmware + * Fix DNS device path parsing for efinet device + * Relaxed UEFI Protocol requirement + * Support Intel OPA (Omni-Path Architecture) PXE Boot + +V3: + * Fix bufio in calculating address of next_buf + * Check HTTP respond code + * Use HEAD request method to test before GET + * Finish HTTP transaction in one go + * Fix bsc#1076132 +--- + grub-core/Makefile.core.def | 18 + + grub-core/io/bufio.c | 2 +- + grub-core/kern/efi/efi.c | 96 ++- + grub-core/net/drivers/efi/efinet.c | 27 + + grub-core/net/efi/dhcp.c | 397 ++++++++++ + grub-core/net/efi/efi_netfs.c | 57 ++ + grub-core/net/efi/http.c | 419 +++++++++++ + grub-core/net/efi/ip4_config.c | 398 ++++++++++ + grub-core/net/efi/ip6_config.c | 422 +++++++++++ + grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++ + grub-core/net/efi/pxe.c | 424 +++++++++++ + grub-core/net/net.c | 74 ++ + util/grub-mknetdir.c | 23 +- + include/grub/efi/api.h | 161 +++- + include/grub/efi/dhcp.h | 343 +++++++++ + include/grub/efi/http.h | 215 ++++++ + include/grub/net/efi.h | 144 ++++ + 17 files changed, 4621 insertions(+), 27 deletions(-) + create mode 100644 grub-core/net/efi/dhcp.c + create mode 100644 grub-core/net/efi/efi_netfs.c + create mode 100644 grub-core/net/efi/http.c + create mode 100644 grub-core/net/efi/ip4_config.c + create mode 100644 grub-core/net/efi/ip6_config.c + create mode 100644 grub-core/net/efi/net.c + create mode 100644 grub-core/net/efi/pxe.c + create mode 100644 include/grub/efi/dhcp.h + create mode 100644 include/grub/efi/http.h + create mode 100644 include/grub/net/efi.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 51f07279d83..95f17b9e310 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2197,6 +2197,18 @@ module = { + common = hook/datehook.c; + }; + ++module = { ++ name = efi_netfs; ++ common = net/efi/efi_netfs.c; ++ common = net/efi/net.c; ++ common = net/efi/http.c; ++ common = net/efi/pxe.c; ++ common = net/efi/ip4_config.c; ++ common = net/efi/ip6_config.c; ++ common = net/efi/dhcp.c; ++ enable = efi; ++}; ++ + module = { + name = net; + common = net/net.c; +@@ -2211,6 +2223,12 @@ module = { + common = net/arp.c; + common = net/netbuff.c; + common = net/url.c; ++ efi = net/efi/net.c; ++ efi = net/efi/http.c; ++ efi = net/efi/pxe.c; ++ efi = net/efi/ip4_config.c; ++ efi = net/efi/ip6_config.c; ++ efi = net/efi/dhcp.c; + }; + + module = { +diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c +index 22438277d74..d0b0f71b6ed 100644 +--- a/grub-core/io/bufio.c ++++ b/grub-core/io/bufio.c +@@ -132,7 +132,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) + return res; + + /* Need to read some more. */ +- next_buf = (file->offset + res + len - 1) & ~((grub_off_t) bufio->block_size - 1); ++ next_buf = (grub_divmod64 (file->offset + res + len - 1, bufio->block_size, NULL)) * bufio->block_size; + /* Now read between file->offset + res and bufio->buffer_at. */ + if (file->offset + res < next_buf) + { +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 621251242e1..d765b5881b9 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -687,7 +687,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) + { + grub_efi_ipv4_device_path_t *ipv4 + = (grub_efi_ipv4_device_path_t *) dp; +- grub_printf ("/IPv4(%u.%u.%u.%u,%u.%u.%u.%u,%u,%u,%x,%x)", ++ grub_printf ("/IPv4(%u.%u.%u.%u,%u.%u.%u.%u,%u,%u,%x,%x", + (unsigned) ipv4->local_ip_address[0], + (unsigned) ipv4->local_ip_address[1], + (unsigned) ipv4->local_ip_address[2], +@@ -700,33 +700,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) + (unsigned) ipv4->remote_port, + (unsigned) ipv4->protocol, + (unsigned) ipv4->static_ip_address); ++ if (len == sizeof (*ipv4)) ++ { ++ grub_printf (",%u.%u.%u.%u,%u.%u.%u.%u", ++ (unsigned) ipv4->gateway_ip_address[0], ++ (unsigned) ipv4->gateway_ip_address[1], ++ (unsigned) ipv4->gateway_ip_address[2], ++ (unsigned) ipv4->gateway_ip_address[3], ++ (unsigned) ipv4->subnet_mask[0], ++ (unsigned) ipv4->subnet_mask[1], ++ (unsigned) ipv4->subnet_mask[2], ++ (unsigned) ipv4->subnet_mask[3]); ++ } ++ grub_printf (")"); + } + break; + case GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE: + { + grub_efi_ipv6_device_path_t *ipv6 + = (grub_efi_ipv6_device_path_t *) dp; +- grub_printf ("/IPv6(%x:%x:%x:%x:%x:%x:%x:%x,%x:%x:%x:%x:%x:%x:%x:%x,%u,%u,%x,%x)", +- (unsigned) ipv6->local_ip_address[0], +- (unsigned) ipv6->local_ip_address[1], +- (unsigned) ipv6->local_ip_address[2], +- (unsigned) ipv6->local_ip_address[3], +- (unsigned) ipv6->local_ip_address[4], +- (unsigned) ipv6->local_ip_address[5], +- (unsigned) ipv6->local_ip_address[6], +- (unsigned) ipv6->local_ip_address[7], +- (unsigned) ipv6->remote_ip_address[0], +- (unsigned) ipv6->remote_ip_address[1], +- (unsigned) ipv6->remote_ip_address[2], +- (unsigned) ipv6->remote_ip_address[3], +- (unsigned) ipv6->remote_ip_address[4], +- (unsigned) ipv6->remote_ip_address[5], +- (unsigned) ipv6->remote_ip_address[6], +- (unsigned) ipv6->remote_ip_address[7], ++ grub_printf ("/IPv6(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x,%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x,%u,%u,%x,%x", ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[0]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[1]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[2]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[3]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[4]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[5]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[6]), ++ (unsigned) grub_be_to_cpu16 (ipv6->local_ip_address[7]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[0]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[1]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[2]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[3]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[4]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[5]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[6]), ++ (unsigned) grub_be_to_cpu16 (ipv6->remote_ip_address[7]), + (unsigned) ipv6->local_port, + (unsigned) ipv6->remote_port, + (unsigned) ipv6->protocol, + (unsigned) ipv6->static_ip_address); ++ if (len == sizeof (*ipv6)) ++ { ++ grub_printf (",%u,%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", ++ (unsigned) ipv6->prefix_length, ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[0]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[1]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[2]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[3]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[4]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[5]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[6]), ++ (unsigned) grub_be_to_cpu16 (ipv6->gateway_ip_address[7])); ++ } ++ grub_printf (")"); + } + break; + case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: +@@ -766,6 +793,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) + dump_vendor_path ("Messaging", + (grub_efi_vendor_device_path_t *) dp); + break; ++ case GRUB_EFI_URI_DEVICE_PATH_SUBTYPE: ++ { ++ grub_efi_uri_device_path_t *uri ++ = (grub_efi_uri_device_path_t *) dp; ++ grub_printf ("/URI(%s)", uri->uri); ++ } ++ break; ++ case GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE: ++ { ++ grub_efi_dns_device_path_t *dns ++ = (grub_efi_dns_device_path_t *) dp; ++ if (dns->is_ipv6) ++ { ++ grub_printf ("/DNS(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x)", ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[0]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[0])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[1]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[1])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[2]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[2])), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[3]) >> 16), ++ (grub_uint16_t)(grub_be_to_cpu32(dns->dns_server_ip[0].v4[3]))); ++ } ++ else ++ { ++ grub_printf ("/DNS(%d.%d.%d.%d)", ++ dns->dns_server_ip[0].v4[0], ++ dns->dns_server_ip[0].v4[1], ++ dns->dns_server_ip[0].v4[2], ++ dns->dns_server_ip[0].v4[3]); ++ } ++ } ++ break; + default: + grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); + break; +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 64d3019af67..eed6f587ae3 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -565,6 +566,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u + + ldp = grub_efi_find_last_device_path (ddp); + ++ /* Skip the DNS Device */ ++ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE) ++ { ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ ++ ldp = grub_efi_find_last_device_path (ddp); ++ } ++ + if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) +@@ -834,6 +846,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE ++ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) + continue; + dup_dp = grub_efi_duplicate_device_path (dp); +@@ -848,6 +861,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + dup_ldp->length = sizeof (*dup_ldp); + } + ++ dup_ldp = grub_efi_find_last_device_path (dup_dp); ++ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE) ++ { ++ dup_ldp = grub_efi_find_last_device_path (dup_dp); ++ dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ dup_ldp->length = sizeof (*dup_ldp); ++ } ++ + dup_ldp = grub_efi_find_last_device_path (dup_dp); + dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; + dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; +@@ -917,6 +939,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + + GRUB_MOD_INIT(efinet) + { ++ if (grub_efi_net_config) ++ return; ++ + grub_efinet_findcards (); + grub_efi_net_config = grub_efi_net_config_real; + } +@@ -928,5 +953,7 @@ GRUB_MOD_FINI(efinet) + FOR_NET_CARDS_SAFE (card, next) + if (card->driver == &efidriver) + grub_net_card_unregister (card); ++ ++ grub_efi_net_config = NULL; + } + +diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c +new file mode 100644 +index 00000000000..dbef63d8c08 +--- /dev/null ++++ b/grub-core/net/efi/dhcp.c +@@ -0,0 +1,397 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef GRUB_EFI_NET_DEBUG ++static void ++dhcp4_mode_print (grub_efi_dhcp4_mode_data_t *mode) ++{ ++ switch (mode->state) ++ { ++ case GRUB_EFI_DHCP4_STOPPED: ++ grub_printf ("STATE: STOPPED\n"); ++ break; ++ case GRUB_EFI_DHCP4_INIT: ++ grub_printf ("STATE: INIT\n"); ++ break; ++ case GRUB_EFI_DHCP4_SELECTING: ++ grub_printf ("STATE: SELECTING\n"); ++ break; ++ case GRUB_EFI_DHCP4_REQUESTING: ++ grub_printf ("STATE: REQUESTING\n"); ++ break; ++ case GRUB_EFI_DHCP4_BOUND: ++ grub_printf ("STATE: BOUND\n"); ++ break; ++ case GRUB_EFI_DHCP4_RENEWING: ++ grub_printf ("STATE: RENEWING\n"); ++ break; ++ case GRUB_EFI_DHCP4_REBINDING: ++ grub_printf ("STATE: REBINDING\n"); ++ break; ++ case GRUB_EFI_DHCP4_INIT_REBOOT: ++ grub_printf ("STATE: INIT_REBOOT\n"); ++ break; ++ case GRUB_EFI_DHCP4_REBOOTING: ++ grub_printf ("STATE: REBOOTING\n"); ++ break; ++ default: ++ grub_printf ("STATE: UNKNOWN\n"); ++ break; ++ } ++ ++ grub_printf ("CLIENT_ADDRESS: %u.%u.%u.%u\n", ++ mode->client_address[0], ++ mode->client_address[1], ++ mode->client_address[2], ++ mode->client_address[3]); ++ grub_printf ("SERVER_ADDRESS: %u.%u.%u.%u\n", ++ mode->server_address[0], ++ mode->server_address[1], ++ mode->server_address[2], ++ mode->server_address[3]); ++ grub_printf ("SUBNET_MASK: %u.%u.%u.%u\n", ++ mode->subnet_mask[0], ++ mode->subnet_mask[1], ++ mode->subnet_mask[2], ++ mode->subnet_mask[3]); ++ grub_printf ("ROUTER_ADDRESS: %u.%u.%u.%u\n", ++ mode->router_address[0], ++ mode->router_address[1], ++ mode->router_address[2], ++ mode->router_address[3]); ++} ++#endif ++ ++static grub_efi_ipv4_address_t * ++grub_efi_dhcp4_parse_dns (grub_efi_dhcp4_protocol_t *dhcp4, grub_efi_dhcp4_packet_t *reply_packet) ++{ ++ grub_efi_dhcp4_packet_option_t **option_list; ++ grub_efi_status_t status; ++ grub_efi_uint32_t option_count = 0; ++ grub_efi_uint32_t i; ++ ++ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL); ++ ++ if (status != GRUB_EFI_BUFFER_TOO_SMALL) ++ return NULL; ++ ++ option_list = grub_malloc (option_count * sizeof(*option_list)); ++ if (!option_list) ++ return NULL; ++ ++ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (option_list); ++ return NULL; ++ } ++ ++ for (i = 0; i < option_count; ++i) ++ { ++ if (option_list[i]->op_code == 6) ++ { ++ grub_efi_ipv4_address_t *dns_address; ++ ++ if (((option_list[i]->length & 0x3) != 0) || (option_list[i]->length == 0)) ++ continue; ++ ++ /* We only contact primary dns */ ++ dns_address = grub_malloc (sizeof (*dns_address)); ++ if (!dns_address) ++ { ++ grub_free (option_list); ++ return NULL; ++ } ++ grub_memcpy (dns_address, option_list[i]->data, sizeof (dns_address)); ++ grub_free (option_list); ++ return dns_address; ++ } ++ } ++ ++ grub_free (option_list); ++ return NULL; ++} ++ ++#if 0 ++/* Somehow this doesn't work ... */ ++static grub_err_t ++grub_cmd_efi_bootp (struct grub_command *cmd __attribute__ ((unused)), ++ int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ struct grub_efi_net_device *dev; ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ grub_efi_pxe_t *pxe = dev->ip4_pxe; ++ grub_efi_pxe_mode_t *mode = pxe->mode; ++ grub_efi_status_t status; ++ ++ if (!mode->started) ++ { ++ status = efi_call_2 (pxe->start, pxe, 0); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ grub_printf ("Couldn't start PXE\n"); ++ } ++ ++ status = efi_call_2 (pxe->dhcp, pxe, 0); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp4 configure failed, %d\n", (int)status); ++ continue; ++ } ++ ++ dev->prefer_ip6 = 0; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++#endif ++ ++static grub_err_t ++grub_cmd_efi_bootp (struct grub_command *cmd __attribute__ ((unused)), ++ int argc, ++ char **args) ++{ ++ struct grub_efi_net_device *netdev; ++ ++ for (netdev = net_devices; netdev; netdev = netdev->next) ++ { ++ grub_efi_status_t status; ++ grub_efi_dhcp4_mode_data_t mode; ++ grub_efi_dhcp4_config_data_t config; ++ grub_efi_dhcp4_packet_option_t *options; ++ grub_efi_ipv4_address_t *dns_address; ++ grub_efi_net_ip_manual_address_t net_ip; ++ grub_efi_net_ip_address_t ip_addr; ++ grub_efi_net_interface_t *inf = NULL; ++ ++ if (argc > 0 && grub_strcmp (netdev->card_name, args[0]) != 0) ++ continue; ++ ++ grub_memset (&config, 0, sizeof(config)); ++ ++ config.option_count = 1; ++ options = grub_malloc (sizeof(*options) + 2); ++ /* Parameter request list */ ++ options->op_code = 55; ++ options->length = 3; ++ /* subnet mask */ ++ options->data[0] = 1; ++ /* router */ ++ options->data[1] = 3; ++ /* DNS */ ++ options->data[2] = 6; ++ config.option_list = &options; ++ ++ /* FIXME: What if the dhcp has bounded */ ++ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config); ++ grub_free (options); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp4 configure failed, %d\n", (int)status); ++ continue; ++ } ++ ++ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp4 start failed, %d\n", (int)status); ++ continue; ++ } ++ ++ status = efi_call_2 (netdev->dhcp4->get_mode_data, netdev->dhcp4, &mode); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp4 get mode failed, %d\n", (int)status); ++ continue; ++ } ++ ++#ifdef GRUB_EFI_NET_DEBUG ++ dhcp4_mode_print (&mode); ++#endif ++ ++ for (inf = netdev->net_interfaces; inf; inf = inf->next) ++ if (inf->prefer_ip6 == 0) ++ break; ++ ++ grub_memcpy (net_ip.ip4.address, mode.client_address, sizeof (net_ip.ip4.address)); ++ grub_memcpy (net_ip.ip4.subnet_mask, mode.subnet_mask, sizeof (net_ip.ip4.subnet_mask)); ++ ++ if (!inf) ++ { ++ char *name = grub_xasprintf ("%s:dhcp", netdev->card_name); ++ ++ net_ip.is_ip6 = 0; ++ inf = grub_efi_net_create_interface (netdev, ++ name, ++ &net_ip, ++ 1); ++ grub_free (name); ++ } ++ else ++ { ++ efi_net_interface_set_address (inf, &net_ip, 1); ++ } ++ ++ grub_memcpy (ip_addr.ip4, mode.router_address, sizeof (ip_addr.ip4)); ++ efi_net_interface_set_gateway (inf, &ip_addr); ++ ++ dns_address = grub_efi_dhcp4_parse_dns (netdev->dhcp4, mode.reply_packet); ++ if (dns_address) ++ efi_net_interface_set_dns (inf, (grub_efi_net_ip_address_t *)&dns_address); ++ ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++ ++static grub_err_t ++grub_cmd_efi_bootp6 (struct grub_command *cmd __attribute__ ((unused)), ++ int argc, ++ char **args) ++{ ++ struct grub_efi_net_device *dev; ++ grub_efi_uint32_t ia_id; ++ ++ for (dev = net_devices, ia_id = 0; dev; dev = dev->next, ia_id++) ++ { ++ grub_efi_dhcp6_config_data_t config; ++ grub_efi_dhcp6_packet_option_t *option_list[1]; ++ grub_efi_dhcp6_packet_option_t *opt; ++ grub_efi_status_t status; ++ grub_efi_dhcp6_mode_data_t mode; ++ grub_efi_dhcp6_retransmission_t retrans; ++ grub_efi_net_ip_manual_address_t net_ip; ++ grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; ++ grub_efi_net_interface_t *inf = NULL; ++ ++ if (argc > 0 && grub_strcmp (dev->card_name, args[0]) != 0) ++ continue; ++ ++ opt = grub_malloc (sizeof(*opt) + 2 * sizeof (grub_efi_uint16_t)); ++ ++#define GRUB_EFI_DHCP6_OPT_ORO 6 ++ ++ opt->op_code = grub_cpu_to_be16_compile_time (GRUB_EFI_DHCP6_OPT_ORO); ++ opt->op_len = grub_cpu_to_be16_compile_time (2 * sizeof (grub_efi_uint16_t)); ++ ++#define GRUB_EFI_DHCP6_OPT_BOOT_FILE_URL 59 ++#define GRUB_EFI_DHCP6_OPT_DNS_SERVERS 23 ++ ++ grub_set_unaligned16 (opt->data, grub_cpu_to_be16_compile_time(GRUB_EFI_DHCP6_OPT_BOOT_FILE_URL)); ++ grub_set_unaligned16 (opt->data + 1 * sizeof (grub_efi_uint16_t), ++ grub_cpu_to_be16_compile_time(GRUB_EFI_DHCP6_OPT_DNS_SERVERS)); ++ ++ option_list[0] = opt; ++ retrans.irt = 4; ++ retrans.mrc = 4; ++ retrans.mrt = 32; ++ retrans.mrd = 60; ++ ++ config.dhcp6_callback = NULL; ++ config.callback_context = NULL; ++ config.option_count = 1; ++ config.option_list = option_list; ++ config.ia_descriptor.ia_id = ia_id; ++ config.ia_descriptor.type = GRUB_EFI_DHCP6_IA_TYPE_NA; ++ config.ia_info_event = NULL; ++ config.reconfigure_accept = 0; ++ config.rapid_commit = 0; ++ config.solicit_retransmission = &retrans; ++ ++ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config); ++ grub_free (opt); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp6 configure failed, %d\n", (int)status); ++ continue; ++ } ++ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp6 start failed, %d\n", (int)status); ++ continue; ++ } ++ ++ status = efi_call_3 (dev->dhcp6->get_mode_data, dev->dhcp6, &mode, NULL); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("dhcp4 get mode failed, %d\n", (int)status); ++ continue; ++ } ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (inf->prefer_ip6 == 1) ++ break; ++ ++ grub_memcpy (net_ip.ip6.address, mode.ia->ia_address[0].ip_address, sizeof (net_ip.ip6.address)); ++ net_ip.ip6.prefix_length = 64; ++ net_ip.ip6.is_anycast = 0; ++ net_ip.is_ip6 = 1; ++ ++ if (!inf) ++ { ++ char *name = grub_xasprintf ("%s:dhcp", dev->card_name); ++ ++ inf = grub_efi_net_create_interface (dev, ++ name, ++ &net_ip, ++ 1); ++ grub_free (name); ++ } ++ else ++ { ++ efi_net_interface_set_address (inf, &net_ip, 1); ++ } ++ ++ { ++ grub_efi_uint32_t count = 0; ++ grub_efi_dhcp6_packet_option_t **options = NULL; ++ grub_efi_uint32_t i; ++ ++ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, NULL); ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL && count) ++ { ++ options = grub_malloc (count * sizeof(*options)); ++ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ if (options) ++ grub_free (options); ++ continue; ++ } ++ ++ for (i = 0; i < count; ++i) ++ { ++ if (options[i]->op_code == grub_cpu_to_be16_compile_time(GRUB_EFI_DHCP6_OPT_DNS_SERVERS)) ++ { ++ grub_efi_net_ip_address_t dns; ++ grub_memcpy (dns.ip6, options[i]->data, sizeof(net_ip.ip6)); ++ efi_net_interface_set_dns (inf, &dns); ++ break; ++ } ++ } ++ ++ if (options) ++ grub_free (options); ++ } ++ ++ efi_call_1 (b->free_pool, mode.client_id); ++ efi_call_1 (b->free_pool, mode.ia); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++grub_command_func_t grub_efi_net_bootp = grub_cmd_efi_bootp; ++grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; +diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c +new file mode 100644 +index 00000000000..ef371d885ea +--- /dev/null ++++ b/grub-core/net/efi/efi_netfs.c +@@ -0,0 +1,57 @@ ++#include ++#include ++#define EFI_NET_CMD_PREFIX "net_efi" ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_command_t cmd_efi_lsroutes; ++static grub_command_t cmd_efi_lscards; ++static grub_command_t cmd_efi_lsaddrs; ++static grub_command_t cmd_efi_addaddr; ++static grub_command_t cmd_efi_bootp; ++static grub_command_t cmd_efi_bootp6; ++ ++static int initialized; ++ ++GRUB_MOD_INIT(efi_netfs) ++{ ++ if (grub_net_open) ++ return; ++ ++ if (grub_efi_net_fs_init ()) ++ { ++ cmd_efi_lsroutes = grub_register_command ("net_efi_ls_routes", grub_efi_net_list_routes, ++ "", N_("list network routes")); ++ cmd_efi_lscards = grub_register_command ("net_efi_ls_cards", grub_efi_net_list_cards, ++ "", N_("list network cards")); ++ cmd_efi_lsaddrs = grub_register_command ("net_efi_ls_addr", grub_efi_net_list_addrs, ++ "", N_("list network addresses")); ++ cmd_efi_addaddr = grub_register_command ("net_efi_add_addr", grub_efi_net_add_addr, ++ N_("SHORTNAME CARD ADDRESS [HWADDRESS]"), ++ N_("Add a network address.")); ++ cmd_efi_bootp = grub_register_command ("net_efi_bootp", grub_efi_net_bootp, ++ N_("[CARD]"), ++ N_("perform a bootp autoconfiguration")); ++ cmd_efi_bootp6 = grub_register_command ("net_efi_bootp6", grub_efi_net_bootp6, ++ N_("[CARD]"), ++ N_("perform a bootp autoconfiguration")); ++ initialized = 1; ++ } ++} ++ ++GRUB_MOD_FINI(efi_netfs) ++{ ++ if (initialized) ++ { ++ grub_unregister_command (cmd_efi_lsroutes); ++ grub_unregister_command (cmd_efi_lscards); ++ grub_unregister_command (cmd_efi_lsaddrs); ++ grub_unregister_command (cmd_efi_addaddr); ++ grub_unregister_command (cmd_efi_bootp); ++ grub_unregister_command (cmd_efi_bootp6); ++ grub_efi_net_fs_fini (); ++ initialized = 0; ++ return; ++ } ++} +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +new file mode 100644 +index 00000000000..3f61fd2fa5b +--- /dev/null ++++ b/grub-core/net/efi/http.c +@@ -0,0 +1,419 @@ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static void ++http_configure (struct grub_efi_net_device *dev, int prefer_ip6) ++{ ++ grub_efi_http_config_data_t http_config; ++ grub_efi_httpv4_access_point_t httpv4_node; ++ grub_efi_httpv6_access_point_t httpv6_node; ++ grub_efi_status_t status; ++ ++ grub_efi_http_t *http = dev->http; ++ ++ grub_memset (&http_config, 0, sizeof(http_config)); ++ http_config.http_version = GRUB_EFI_HTTPVERSION11; ++ http_config.timeout_millisec = 5000; ++ ++ if (prefer_ip6) ++ { ++ grub_efi_uintn_t sz; ++ grub_efi_ip6_config_manual_address_t manual_address; ++ ++ http_config.local_address_is_ipv6 = 1; ++ sz = sizeof (manual_address); ++ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, &manual_address); ++ ++ if (status == GRUB_EFI_NOT_FOUND) ++ { ++ grub_printf ("The MANUAL ADDRESS is not found\n"); ++ } ++ ++ /* FIXME: The manual interface would return BUFFER TOO SMALL !!! */ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_printf ("??? %d\n",(int) status); ++ return; ++ } ++ ++ grub_memcpy (httpv6_node.local_address, manual_address.address, sizeof (httpv6_node.local_address)); ++ httpv6_node.local_port = 0; ++ http_config.access_point.ipv6_node = &httpv6_node; ++ } ++ else ++ { ++ http_config.local_address_is_ipv6 = 0; ++ grub_memset (&httpv4_node, 0, sizeof(httpv4_node)); ++ httpv4_node.use_default_address = 1; ++ ++ /* Use random port here */ ++ /* See TcpBind() in edk2/NetworkPkg/TcpDxe/TcpDispatcher.c */ ++ httpv4_node.local_port = 0; ++ http_config.access_point.ipv4_node = &httpv4_node; ++ } ++ ++ status = efi_call_2 (http->configure, http, &http_config); ++ ++ if (status == GRUB_EFI_ALREADY_STARTED) ++ { ++ /* XXX: This hangs HTTPS boot */ ++#if 0 ++ if (efi_call_2 (http->configure, http, NULL) != GRUB_EFI_SUCCESS) ++ { ++ grub_error (GRUB_ERR_IO, N_("couldn't reset http instance")); ++ grub_print_error (); ++ return; ++ } ++ status = efi_call_2 (http->configure, http, &http_config); ++#endif ++ return; ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_error (GRUB_ERR_IO, N_("couldn't configure http protocol, reason: %d"), (int)status); ++ grub_print_error (); ++ return ; ++ } ++} ++ ++static grub_efi_boolean_t request_callback_done; ++static grub_efi_boolean_t response_callback_done; ++ ++static void ++grub_efi_http_request_callback (grub_efi_event_t event __attribute__ ((unused)), ++ void *context __attribute__ ((unused))) ++{ ++ request_callback_done = 1; ++} ++ ++static void ++grub_efi_http_response_callback (grub_efi_event_t event __attribute__ ((unused)), ++ void *context __attribute__ ((unused))) ++{ ++ response_callback_done = 1; ++} ++ ++static grub_err_t ++efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, int headeronly, grub_off_t *file_size) ++{ ++ grub_efi_http_request_data_t request_data; ++ grub_efi_http_message_t request_message; ++ grub_efi_http_token_t request_token; ++ grub_efi_http_response_data_t response_data; ++ grub_efi_http_message_t response_message; ++ grub_efi_http_token_t response_token; ++ grub_efi_http_header_t request_headers[3]; ++ ++ grub_efi_status_t status; ++ grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; ++ char *url = NULL; ++ ++ request_headers[0].field_name = (grub_efi_char8_t *)"Host"; ++ request_headers[0].field_value = (grub_efi_char8_t *)server; ++ request_headers[1].field_name = (grub_efi_char8_t *)"Accept"; ++ request_headers[1].field_value = (grub_efi_char8_t *)"*/*"; ++ request_headers[2].field_name = (grub_efi_char8_t *)"User-Agent"; ++ request_headers[2].field_value = (grub_efi_char8_t *)"UefiHttpBoot/1.0"; ++ ++ { ++ grub_efi_ipv6_address_t address; ++ const char *rest; ++ grub_efi_char16_t *ucs2_url; ++ grub_size_t url_len, ucs2_url_len; ++ const char *protocol = (use_https == 1) ? "https" : "http"; ++ ++ if (grub_efi_string_to_ip6_address (server, &address, &rest) && *rest == 0) ++ url = grub_xasprintf ("%s://[%s]%s", protocol, server, name); ++ else ++ url = grub_xasprintf ("%s://%s%s", protocol, server, name); ++ ++ if (!url) ++ { ++ return grub_errno; ++ } ++ ++ url_len = grub_strlen (url); ++ ucs2_url_len = url_len * GRUB_MAX_UTF16_PER_UTF8; ++ ucs2_url = grub_malloc ((ucs2_url_len + 1) * sizeof (ucs2_url[0])); ++ ++ if (!ucs2_url) ++ { ++ grub_free (url); ++ return grub_errno; ++ } ++ ++ ucs2_url_len = grub_utf8_to_utf16 (ucs2_url, ucs2_url_len, (grub_uint8_t *)url, url_len, NULL); /* convert string format from ascii to usc2 */ ++ ucs2_url[ucs2_url_len] = 0; ++ grub_free (url); ++ request_data.url = ucs2_url; ++ } ++ ++ request_data.method = (headeronly > 0) ? GRUB_EFI_HTTPMETHODHEAD : GRUB_EFI_HTTPMETHODGET; ++ ++ request_message.data.request = &request_data; ++ request_message.header_count = 3; ++ request_message.headers = request_headers; ++ request_message.body_length = 0; ++ request_message.body = NULL; ++ ++ /* request token */ ++ request_token.event = NULL; ++ request_token.status = GRUB_EFI_NOT_READY; ++ request_token.message = &request_message; ++ ++ request_callback_done = 0; ++ status = efi_call_5 (b->create_event, ++ GRUB_EFI_EVT_NOTIFY_SIGNAL, ++ GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_request_callback, ++ NULL, ++ &request_token.event); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (request_data.url); ++ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); ++ } ++ ++ status = efi_call_2 (http->request, http, &request_token); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ efi_call_1 (b->close_event, request_token.event); ++ grub_free (request_data.url); ++ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); ++ } ++ /* TODO: Add Timeout */ ++ while (!request_callback_done) ++ efi_call_1(http->poll, http); ++ ++ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS; ++ response_message.data.response = &response_data; ++ /* herader_count will be updated by the HTTP driver on response */ ++ response_message.header_count = 0; ++ /* headers will be populated by the driver on response */ ++ response_message.headers = NULL; ++ /* use zero BodyLength to only receive the response headers */ ++ response_message.body_length = 0; ++ response_message.body = NULL; ++ response_token.event = NULL; ++ ++ status = efi_call_5 (b->create_event, ++ GRUB_EFI_EVT_NOTIFY_SIGNAL, ++ GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_response_callback, ++ NULL, ++ &response_token.event); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ efi_call_1 (b->close_event, request_token.event); ++ grub_free (request_data.url); ++ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); ++ } ++ ++ response_token.status = GRUB_EFI_SUCCESS; ++ response_token.message = &response_message; ++ ++ /* wait for HTTP response */ ++ response_callback_done = 0; ++ status = efi_call_2 (http->response, http, &response_token); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ efi_call_1 (b->close_event, response_token.event); ++ efi_call_1 (b->close_event, request_token.event); ++ grub_free (request_data.url); ++ return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status); ++ } ++ ++ /* TODO: Add Timeout */ ++ while (!response_callback_done) ++ efi_call_1 (http->poll, http); ++ ++ if (response_message.data.response->status_code != GRUB_EFI_HTTP_STATUS_200_OK) ++ { ++ grub_efi_http_status_code_t status_code = response_message.data.response->status_code; ++ ++ if (response_message.headers) ++ efi_call_1 (b->free_pool, response_message.headers); ++ efi_call_1 (b->close_event, response_token.event); ++ efi_call_1 (b->close_event, request_token.event); ++ grub_free (request_data.url); ++ if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND) ++ { ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, _("file `%s' not found"), name); ++ } ++ else ++ { ++ return grub_error (GRUB_ERR_NET_UNKNOWN_ERROR, ++ _("unsupported uefi http status code 0x%x"), status_code); ++ } ++ } ++ ++ if (file_size) ++ { ++ int i; ++ /* parse the length of the file from the ContentLength header */ ++ for (*file_size = 0, i = 0; i < (int)response_message.header_count; ++i) ++ { ++ if (!grub_strcmp((const char*)response_message.headers[i].field_name, "Content-Length")) ++ { ++ *file_size = grub_strtoul((const char*)response_message.headers[i].field_value, 0, 10); ++ break; ++ } ++ } ++ } ++ ++ if (response_message.headers) ++ efi_call_1 (b->free_pool, response_message.headers); ++ efi_call_1 (b->close_event, response_token.event); ++ efi_call_1 (b->close_event, request_token.event); ++ grub_free (request_data.url); ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_ssize_t ++efihttp_read (struct grub_efi_net_device *dev, ++ char *buf, ++ grub_size_t len) ++{ ++ grub_efi_http_message_t response_message; ++ grub_efi_http_token_t response_token; ++ ++ grub_efi_status_t status; ++ grub_size_t sum = 0; ++ grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; ++ grub_efi_http_t *http = dev->http; ++ ++ if (!len) ++ { ++ grub_error (GRUB_ERR_BUG, "Invalid arguments to EFI HTTP Read"); ++ return -1; ++ } ++ ++ efi_call_5 (b->create_event, ++ GRUB_EFI_EVT_NOTIFY_SIGNAL, ++ GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_response_callback, ++ NULL, ++ &response_token.event); ++ ++ while (len) ++ { ++ response_message.data.response = NULL; ++ response_message.header_count = 0; ++ response_message.headers = NULL; ++ response_message.body_length = len; ++ response_message.body = buf; ++ ++ response_token.message = &response_message; ++ response_token.status = GRUB_EFI_NOT_READY; ++ ++ response_callback_done = 0; ++ ++ status = efi_call_2 (http->response, http, &response_token); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ efi_call_1 (b->close_event, response_token.event); ++ grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status); ++ return -1; ++ } ++ ++ while (!response_callback_done) ++ efi_call_1(http->poll, http); ++ ++ sum += response_message.body_length; ++ buf += response_message.body_length; ++ len -= response_message.body_length; ++ } ++ ++ efi_call_1 (b->close_event, response_token.event); ++ ++ return sum; ++} ++ ++static grub_err_t ++grub_efihttp_open (struct grub_efi_net_device *dev, ++ int prefer_ip6 __attribute__ ((unused)), ++ grub_file_t file, ++ const char *filename __attribute__ ((unused)), ++ int type) ++{ ++ grub_err_t err; ++ grub_off_t size; ++ char *buf; ++ ++ err = efihttp_request (dev->http, file->device->net->server, file->device->net->name, type, 1, 0); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ ++ err = efihttp_request (dev->http, file->device->net->server, file->device->net->name, type, 0, &size); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ ++ buf = grub_malloc (size); ++ efihttp_read (dev, buf, size); ++ ++ file->size = size; ++ file->data = buf; ++ file->not_easily_seekable = 0; ++ file->device->net->offset = 0; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_efihttp_close (struct grub_efi_net_device *dev __attribute__ ((unused)), ++ int prefer_ip6 __attribute__ ((unused)), ++ grub_file_t file) ++{ ++ if (file->data) ++ grub_free (file->data); ++ ++ file->data = 0; ++ file->offset = 0; ++ file->size = 0; ++ file->device->net->offset = 0; ++ return GRUB_ERR_NONE; ++} ++ ++static grub_ssize_t ++grub_efihttp_read (struct grub_efi_net_device *dev __attribute__((unused)), ++ int prefer_ip6 __attribute__((unused)), ++ grub_file_t file, ++ char *buf, ++ grub_size_t len) ++{ ++ grub_size_t r = len; ++ ++ if (!file->data || !buf || !len) ++ return 0; ++ ++ if ((file->device->net->offset + len) > file->size) ++ r = file->size - file->device->net->offset; ++ ++ if (r) ++ { ++ grub_memcpy (buf, (char *)file->data + file->device->net->offset, r); ++ file->device->net->offset += r; ++ } ++ ++ return r; ++} ++ ++struct grub_efi_net_io io_http = ++ { ++ .configure = http_configure, ++ .open = grub_efihttp_open, ++ .read = grub_efihttp_read, ++ .close = grub_efihttp_close ++ }; +diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c +new file mode 100644 +index 00000000000..b711a5d9457 +--- /dev/null ++++ b/grub-core/net/efi/ip4_config.c +@@ -0,0 +1,398 @@ ++ ++#include ++#include ++#include ++#include ++#include ++ ++char * ++grub_efi_hw_address_to_string (grub_efi_uint32_t hw_address_size, grub_efi_mac_address_t hw_address) ++{ ++ char *hw_addr, *p; ++ int sz, s; ++ int i; ++ ++ sz = (int)hw_address_size * (sizeof ("XX:") - 1) + 1; ++ ++ hw_addr = grub_malloc (sz); ++ if (!hw_addr) ++ return NULL; ++ ++ p = hw_addr; ++ s = sz; ++ for (i = 0; i < (int)hw_address_size; i++) ++ { ++ grub_snprintf (p, sz, "%02x:", hw_address[i]); ++ p += sizeof ("XX:") - 1; ++ s -= sizeof ("XX:") - 1; ++ } ++ ++ hw_addr[sz - 2] = '\0'; ++ return hw_addr; ++} ++ ++char * ++grub_efi_ip4_address_to_string (grub_efi_ipv4_address_t *address) ++{ ++ char *addr; ++ ++ addr = grub_malloc (sizeof ("XXX.XXX.XXX.XXX")); ++ if (!addr) ++ return NULL; ++ ++ /* FIXME: Use grub_xasprintf ? */ ++ grub_snprintf (addr, ++ sizeof ("XXX.XXX.XXX.XXX"), ++ "%u.%u.%u.%u", ++ (*address)[0], ++ (*address)[1], ++ (*address)[2], ++ (*address)[3]); ++ ++ return addr; ++} ++ ++int ++grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *address, const char **rest) ++{ ++ grub_uint32_t newip = 0; ++ int i; ++ const char *ptr = val; ++ ++ for (i = 0; i < 4; i++) ++ { ++ unsigned long t; ++ t = grub_strtoul (ptr, (char **) &ptr, 0); ++ if (grub_errno) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ if (*ptr != '.' && i == 0) ++ { ++ /* XXX: t is in host byte order */ ++ newip = t; ++ break; ++ } ++ if (t & ~0xff) ++ return 0; ++ newip <<= 8; ++ newip |= t; ++ if (i != 3 && *ptr != '.') ++ return 0; ++ ptr++; ++ } ++ ++ newip = grub_cpu_to_be32 (newip); ++ ++ grub_memcpy (address, &newip, sizeof(*address)); ++ ++ if (rest) ++ *rest = (ptr - 1); ++ return 1; ++} ++ ++static grub_efi_ip4_config2_interface_info_t * ++efi_ip4_config_interface_info (grub_efi_ip4_config2_protocol_t *ip4_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip4_config2_interface_info_t *interface_info; ++ ++ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table); ++ interface_info = grub_malloc (sz); ++ if (!interface_info) ++ return NULL; ++ ++ status = efi_call_4 (ip4_config->get_data, ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL) ++ { ++ grub_free (interface_info); ++ interface_info = grub_malloc (sz); ++ status = efi_call_4 (ip4_config->get_data, ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (interface_info); ++ return NULL; ++ } ++ ++ return interface_info; ++} ++ ++static grub_efi_ip4_config2_manual_address_t * ++efi_ip4_config_manual_address (grub_efi_ip4_config2_protocol_t *ip4_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip4_config2_manual_address_t *manual_address; ++ ++ sz = sizeof (*manual_address); ++ manual_address = grub_malloc (sz); ++ if (!manual_address) ++ return NULL; ++ ++ status = efi_call_4 (ip4_config->get_data, ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, manual_address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (manual_address); ++ return NULL; ++ } ++ ++ return manual_address; ++} ++ ++char * ++grub_efi_ip4_interface_name (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip4_config2_interface_info_t *interface_info; ++ char *name; ++ ++ interface_info = efi_ip4_config_interface_info (dev->ip4_config); ++ ++ if (!interface_info) ++ return NULL; ++ ++ name = grub_malloc (GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE ++ * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ *grub_utf16_to_utf8 ((grub_uint8_t *)name, interface_info->name, ++ GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE) = 0; ++ grub_free (interface_info); ++ return name; ++} ++ ++static char * ++grub_efi_ip4_interface_hw_address (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip4_config2_interface_info_t *interface_info; ++ char *hw_addr; ++ ++ interface_info = efi_ip4_config_interface_info (dev->ip4_config); ++ ++ if (!interface_info) ++ return NULL; ++ ++ hw_addr = grub_efi_hw_address_to_string (interface_info->hw_address_size, interface_info->hw_address); ++ grub_free (interface_info); ++ ++ return hw_addr; ++} ++ ++static char * ++grub_efi_ip4_interface_address (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip4_config2_manual_address_t *manual_address; ++ char *addr; ++ ++ manual_address = efi_ip4_config_manual_address (dev->ip4_config); ++ ++ if (!manual_address) ++ return NULL; ++ ++ addr = grub_efi_ip4_address_to_string (&manual_address->address); ++ grub_free (manual_address); ++ return addr; ++} ++ ++ ++static int ++address_mask_size (grub_efi_ipv4_address_t *address) ++{ ++ grub_uint8_t i; ++ grub_uint32_t u32_addr = grub_be_to_cpu32 (grub_get_unaligned32 (address)); ++ ++ if (u32_addr == 0) ++ return 0; ++ ++ for (i = 0; i < 32 ; ++i) ++ { ++ if (u32_addr == ((0xffffffff >> i) << i)) ++ return (32 - i); ++ } ++ ++ return -1; ++} ++ ++static char ** ++grub_efi_ip4_interface_route_table (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip4_config2_interface_info_t *interface_info; ++ char **ret; ++ int i, id; ++ ++ interface_info = efi_ip4_config_interface_info (dev->ip4_config); ++ if (!interface_info) ++ return NULL; ++ ++ ret = grub_malloc (sizeof (*ret) * (interface_info->route_table_size + 1)); ++ ++ if (!ret) ++ { ++ grub_free (interface_info); ++ return NULL; ++ } ++ ++ id = 0; ++ for (i = 0; i < (int)interface_info->route_table_size; i++) ++ { ++ char *subnet, *gateway, *mask; ++ grub_uint32_t u32_subnet, u32_gateway; ++ int mask_size; ++ grub_efi_ip4_route_table_t *route_table = interface_info->route_table + i; ++ grub_efi_net_interface_t *inf; ++ char *interface_name = NULL; ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (!inf->prefer_ip6) ++ interface_name = inf->name; ++ ++ u32_gateway = grub_get_unaligned32 (&route_table->gateway_address); ++ gateway = grub_efi_ip4_address_to_string (&route_table->gateway_address); ++ u32_subnet = grub_get_unaligned32 (&route_table->subnet_address); ++ subnet = grub_efi_ip4_address_to_string (&route_table->subnet_address); ++ mask_size = address_mask_size (&route_table->subnet_mask); ++ mask = grub_efi_ip4_address_to_string (&route_table->subnet_mask); ++ if (u32_subnet && !u32_gateway && interface_name) ++ ret[id++] = grub_xasprintf ("%s:local %s/%d %s", dev->card_name, subnet, mask_size, interface_name); ++ else if (u32_subnet && u32_gateway) ++ ret[id++] = grub_xasprintf ("%s:gw %s/%d gw %s", dev->card_name, subnet, mask_size, gateway); ++ else if (!u32_subnet && u32_gateway) ++ ret[id++] = grub_xasprintf ("%s:default %s/%d gw %s", dev->card_name, subnet, mask_size, gateway); ++ grub_free (subnet); ++ grub_free (gateway); ++ grub_free (mask); ++ } ++ ++ ret[id] = NULL; ++ grub_free (interface_info); ++ return ret; ++} ++ ++static grub_efi_net_interface_t * ++grub_efi_ip4_interface_match (struct grub_efi_net_device *dev, grub_efi_net_ip_address_t *ip_address) ++{ ++ grub_efi_ip4_config2_interface_info_t *interface_info; ++ grub_efi_net_interface_t *inf; ++ int i; ++ grub_efi_ipv4_address_t *address = &ip_address->ip4; ++ ++ interface_info = efi_ip4_config_interface_info (dev->ip4_config); ++ if (!interface_info) ++ return NULL; ++ ++ for (i = 0; i < (int)interface_info->route_table_size; i++) ++ { ++ grub_efi_ip4_route_table_t *route_table = interface_info->route_table + i; ++ grub_uint32_t u32_address, u32_mask, u32_subnet; ++ ++ u32_address = grub_get_unaligned32 (address); ++ u32_subnet = grub_get_unaligned32 (route_table->subnet_address); ++ u32_mask = grub_get_unaligned32 (route_table->subnet_mask); ++ ++ /* SKIP Default GATEWAY */ ++ if (!u32_subnet && !u32_mask) ++ continue; ++ ++ if ((u32_address & u32_mask) == u32_subnet) ++ { ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (!inf->prefer_ip6) ++ { ++ grub_free (interface_info); ++ return inf; ++ } ++ } ++ } ++ ++ grub_free (interface_info); ++ return NULL; ++} ++ ++static int ++grub_efi_ip4_interface_set_manual_address (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_manual_address_t *net_ip, ++ int with_subnet) ++{ ++ grub_efi_status_t status; ++ grub_efi_ip4_config2_manual_address_t *address = &net_ip->ip4; ++ ++ if (!with_subnet) ++ { ++ grub_efi_ip4_config2_manual_address_t *manual_address = ++ efi_ip4_config_manual_address (dev->ip4_config); ++ ++ if (manual_address) ++ { ++ grub_memcpy (address->subnet_mask, manual_address->subnet_mask, sizeof(address->subnet_mask)); ++ grub_free (manual_address); ++ } ++ else ++ { ++ /* XXX: */ ++ address->subnet_mask[0] = 0xff; ++ address->subnet_mask[1] = 0xff; ++ address->subnet_mask[2] = 0xff; ++ address->subnet_mask[3] = 0; ++ } ++ } ++ ++ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, ++ sizeof(*address), address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ ++ return 1; ++} ++ ++static int ++grub_efi_ip4_interface_set_gateway (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_address_t *address) ++{ ++ grub_efi_status_t status; ++ ++ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY, ++ sizeof (address->ip4), &address->ip4); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ return 1; ++} ++ ++/* FIXME: Multiple DNS */ ++static int ++grub_efi_ip4_interface_set_dns (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_address_t *address) ++{ ++ grub_efi_status_t status; ++ ++ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ sizeof (address->ip4), &address->ip4); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ return 1; ++} ++ ++grub_efi_net_ip_config_t *efi_net_ip4_config = &(grub_efi_net_ip_config_t) ++ { ++ .get_hw_address = grub_efi_ip4_interface_hw_address, ++ .get_address = grub_efi_ip4_interface_address, ++ .get_route_table = grub_efi_ip4_interface_route_table, ++ .best_interface = grub_efi_ip4_interface_match, ++ .set_address = grub_efi_ip4_interface_set_manual_address, ++ .set_gateway = grub_efi_ip4_interface_set_gateway, ++ .set_dns = grub_efi_ip4_interface_set_dns ++ }; +diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c +new file mode 100644 +index 00000000000..c0d920fa44c +--- /dev/null ++++ b/grub-core/net/efi/ip6_config.c +@@ -0,0 +1,422 @@ ++#include ++#include ++#include ++#include ++#include ++ ++char * ++grub_efi_ip6_address_to_string (grub_efi_pxe_ipv6_address_t *address) ++{ ++ char *str = grub_malloc (sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")); ++ char *p; ++ int i; ++ int squash; ++ ++ if (!str) ++ return NULL; ++ ++ p = str; ++ squash = 0; ++ for (i = 0; i < 8; ++i) ++ { ++ grub_uint16_t addr; ++ ++ if (i == 7) ++ squash = 2; ++ ++ addr = grub_get_unaligned16 (address + i * 2); ++ ++ if (grub_be_to_cpu16 (addr)) ++ { ++ char buf[sizeof ("XXXX")]; ++ if (i > 0) ++ *p++ = ':'; ++ grub_snprintf (buf, sizeof (buf), "%x", grub_be_to_cpu16 (addr)); ++ grub_strcpy (p, buf); ++ p += grub_strlen (buf); ++ ++ if (squash == 1) ++ squash = 2; ++ } ++ else ++ { ++ if (squash == 0) ++ { ++ *p++ = ':'; ++ squash = 1; ++ } ++ else if (squash == 2) ++ { ++ *p++ = ':'; ++ *p++ = '0'; ++ } ++ } ++ } ++ *p = '\0'; ++ return str; ++} ++ ++int ++grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *address, const char **rest) ++{ ++ grub_uint16_t newip[8]; ++ const char *ptr = val; ++ int word, quaddot = -1; ++ int bracketed = 0; ++ ++ if (ptr[0] == '[') { ++ bracketed = 1; ++ ptr++; ++ } ++ ++ if (ptr[0] == ':' && ptr[1] != ':') ++ return 0; ++ if (ptr[0] == ':') ++ ptr++; ++ ++ for (word = 0; word < 8; word++) ++ { ++ unsigned long t; ++ if (*ptr == ':') ++ { ++ quaddot = word; ++ word--; ++ ptr++; ++ continue; ++ } ++ t = grub_strtoul (ptr, (char **) &ptr, 16); ++ if (grub_errno) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ break; ++ } ++ if (t & ~0xffff) ++ return 0; ++ newip[word] = grub_cpu_to_be16 (t); ++ if (*ptr != ':') ++ break; ++ ptr++; ++ } ++ if (quaddot == -1 && word < 7) ++ return 0; ++ if (quaddot != -1) ++ { ++ grub_memmove (&newip[quaddot + 7 - word], &newip[quaddot], ++ (word - quaddot + 1) * sizeof (newip[0])); ++ grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); ++ } ++ grub_memcpy (address, newip, 16); ++ if (bracketed && *ptr == ']') { ++ ptr++; ++ } ++ if (rest) ++ *rest = ptr; ++ return 1; ++} ++ ++static grub_efi_ip6_config_interface_info_t * ++efi_ip6_config_interface_info (grub_efi_ip6_config_protocol_t *ip6_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip6_config_interface_info_t *interface_info; ++ ++ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table); ++ interface_info = grub_malloc (sz); ++ ++ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL) ++ { ++ grub_free (interface_info); ++ interface_info = grub_malloc (sz); ++ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (interface_info); ++ return NULL; ++ } ++ ++ return interface_info; ++} ++ ++static grub_efi_ip6_config_manual_address_t * ++efi_ip6_config_manual_address (grub_efi_ip6_config_protocol_t *ip6_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip6_config_manual_address_t *manual_address; ++ ++ sz = sizeof (*manual_address); ++ manual_address = grub_malloc (sz); ++ if (!manual_address) ++ return NULL; ++ ++ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, manual_address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (manual_address); ++ return NULL; ++ } ++ ++ return manual_address; ++} ++ ++char * ++grub_efi_ip6_interface_name (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip6_config_interface_info_t *interface_info; ++ char *name; ++ ++ interface_info = efi_ip6_config_interface_info (dev->ip6_config); ++ ++ if (!interface_info) ++ return NULL; ++ ++ name = grub_malloc (GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE ++ * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ *grub_utf16_to_utf8 ((grub_uint8_t *)name, interface_info->name, ++ GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE) = 0; ++ grub_free (interface_info); ++ return name; ++} ++ ++static char * ++grub_efi_ip6_interface_hw_address (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip6_config_interface_info_t *interface_info; ++ char *hw_addr; ++ ++ interface_info = efi_ip6_config_interface_info (dev->ip6_config); ++ ++ if (!interface_info) ++ return NULL; ++ ++ hw_addr = grub_efi_hw_address_to_string (interface_info->hw_address_size, interface_info->hw_address); ++ grub_free (interface_info); ++ ++ return hw_addr; ++} ++ ++static char * ++grub_efi_ip6_interface_address (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip6_config_manual_address_t *manual_address; ++ char *addr; ++ ++ manual_address = efi_ip6_config_manual_address (dev->ip6_config); ++ ++ if (!manual_address) ++ return NULL; ++ ++ addr = grub_efi_ip6_address_to_string ((grub_efi_pxe_ipv6_address_t *)&manual_address->address); ++ grub_free (manual_address); ++ return addr; ++} ++ ++static char ** ++grub_efi_ip6_interface_route_table (struct grub_efi_net_device *dev) ++{ ++ grub_efi_ip6_config_interface_info_t *interface_info; ++ char **ret; ++ int i, id; ++ ++ interface_info = efi_ip6_config_interface_info (dev->ip6_config); ++ if (!interface_info) ++ return NULL; ++ ++ ret = grub_malloc (sizeof (*ret) * (interface_info->route_count + 1)); ++ ++ if (!ret) ++ { ++ grub_free (interface_info); ++ return NULL; ++ } ++ ++ id = 0; ++ for (i = 0; i < (int)interface_info->route_count ; i++) ++ { ++ char *gateway, *destination; ++ grub_uint64_t u64_gateway[2]; ++ grub_uint64_t u64_destination[2]; ++ grub_efi_ip6_route_table_t *route_table = interface_info->route_table + i; ++ grub_efi_net_interface_t *inf; ++ char *interface_name = NULL; ++ ++ gateway = grub_efi_ip6_address_to_string (&route_table->gateway); ++ destination = grub_efi_ip6_address_to_string (&route_table->destination); ++ ++ u64_gateway[0] = grub_get_unaligned64 (route_table->gateway); ++ u64_gateway[1] = grub_get_unaligned64 (route_table->gateway + 8); ++ u64_destination[0] = grub_get_unaligned64 (route_table->destination); ++ u64_destination[1] = grub_get_unaligned64 (route_table->destination + 8); ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (inf->prefer_ip6) ++ interface_name = inf->name; ++ ++ if ((!u64_gateway[0] && !u64_gateway[1]) ++ && (u64_destination[0] || u64_destination[1])) ++ { ++ if (interface_name) ++ { ++ if ((grub_be_to_cpu64 (u64_destination[0]) == 0xfe80000000000000ULL) ++ && (!u64_destination[1]) ++ && (route_table->prefix_length == 64)) ++ ret[id++] = grub_xasprintf ("%s:link %s/%d %s", dev->card_name, destination, route_table->prefix_length, interface_name); ++ else ++ ret[id++] = grub_xasprintf ("%s:local %s/%d %s", dev->card_name, destination, route_table->prefix_length, interface_name); ++ } ++ } ++ else if ((u64_gateway[0] || u64_gateway[1]) ++ && (u64_destination[0] || u64_destination[1])) ++ ret[id++] = grub_xasprintf ("%s:gw %s/%d gw %s", dev->card_name, destination, route_table->prefix_length, gateway); ++ else if ((u64_gateway[0] || u64_gateway[1]) ++ && (!u64_destination[0] && !u64_destination[1])) ++ ret[id++] = grub_xasprintf ("%s:default %s/%d gw %s", dev->card_name, destination, route_table->prefix_length, gateway); ++ ++ grub_free (gateway); ++ grub_free (destination); ++ } ++ ++ ret[id] = NULL; ++ grub_free (interface_info); ++ return ret; ++} ++ ++static grub_efi_net_interface_t * ++grub_efi_ip6_interface_match (struct grub_efi_net_device *dev, grub_efi_net_ip_address_t *ip_address) ++{ ++ grub_efi_ip6_config_interface_info_t *interface_info; ++ grub_efi_net_interface_t *inf; ++ int i; ++ grub_efi_ipv6_address_t *address = &ip_address->ip6; ++ ++ interface_info = efi_ip6_config_interface_info (dev->ip6_config); ++ if (!interface_info) ++ return NULL; ++ ++ for (i = 0; i < (int)interface_info->route_count ; i++) ++ { ++ grub_uint64_t u64_addr[2]; ++ grub_uint64_t u64_subnet[2]; ++ grub_uint64_t u64_mask[2]; ++ ++ grub_efi_ip6_route_table_t *route_table = interface_info->route_table + i; ++ ++ /* SKIP Default GATEWAY */ ++ if (route_table->prefix_length == 0) ++ continue; ++ ++ u64_addr[0] = grub_get_unaligned64 (address); ++ u64_addr[1] = grub_get_unaligned64 (address + 4); ++ u64_subnet[0] = grub_get_unaligned64 (route_table->destination); ++ u64_subnet[1] = grub_get_unaligned64 (route_table->destination + 8); ++ u64_mask[0] = (route_table->prefix_length <= 64) ? ++ 0xffffffffffffffffULL << (64 - route_table->prefix_length) : ++ 0xffffffffffffffffULL; ++ u64_mask[1] = (route_table->prefix_length <= 64) ? ++ 0 : ++ 0xffffffffffffffffULL << (128 - route_table->prefix_length); ++ ++ if (((u64_addr[0] & u64_mask[0]) == u64_subnet[0]) ++ && ((u64_addr[1] & u64_mask[1]) == u64_subnet[1])) ++ { ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (inf->prefer_ip6) ++ { ++ grub_free (interface_info); ++ return inf; ++ } ++ } ++ } ++ ++ grub_free (interface_info); ++ return NULL; ++} ++ ++static int ++grub_efi_ip6_interface_set_manual_address (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_manual_address_t *net_ip, ++ int with_subnet) ++{ ++ grub_efi_status_t status; ++ grub_efi_ip6_config_manual_address_t *address = &net_ip->ip6; ++ ++ if (!with_subnet) ++ { ++ grub_efi_ip6_config_manual_address_t *manual_address = ++ efi_ip6_config_manual_address (dev->ip6_config); ++ ++ if (manual_address) ++ { ++ address->prefix_length = manual_address->prefix_length; ++ grub_free (manual_address); ++ } ++ else ++ { ++ /* XXX: */ ++ address->prefix_length = 64; ++ } ++ } ++ ++ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ sizeof(*address), address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ ++ return 1; ++} ++ ++static int ++grub_efi_ip6_interface_set_gateway (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_address_t *address) ++{ ++ grub_efi_status_t status; ++ ++ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY, ++ sizeof (address->ip6), &address->ip6); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ return 1; ++} ++ ++static int ++grub_efi_ip6_interface_set_dns (struct grub_efi_net_device *dev, ++ grub_efi_net_ip_address_t *address) ++{ ++ ++ grub_efi_status_t status; ++ ++ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ sizeof (address->ip6), &address->ip6); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ return 1; ++} ++ ++grub_efi_net_ip_config_t *efi_net_ip6_config = &(grub_efi_net_ip_config_t) ++ { ++ .get_hw_address = grub_efi_ip6_interface_hw_address, ++ .get_address = grub_efi_ip6_interface_address, ++ .get_route_table = grub_efi_ip6_interface_route_table, ++ .best_interface = grub_efi_ip6_interface_match, ++ .set_address = grub_efi_ip6_interface_set_manual_address, ++ .set_gateway = grub_efi_ip6_interface_set_gateway, ++ .set_dns = grub_efi_ip6_interface_set_dns ++ }; +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +new file mode 100644 +index 00000000000..9e0078ac1c6 +--- /dev/null ++++ b/grub-core/net/efi/net.c +@@ -0,0 +1,1428 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++#define GRUB_EFI_IP6_PREFIX_LENGTH 64 ++ ++static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; ++static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; ++static grub_efi_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_efi_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID; ++static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; ++static grub_efi_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_efi_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID; ++static grub_efi_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_efi_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID; ++ ++struct grub_efi_net_device *net_devices; ++ ++static char *default_server; ++static grub_efi_net_interface_t *net_interface; ++static grub_efi_net_interface_t *net_default_interface; ++ ++#define efi_net_interface_configure(inf) inf->io->configure (inf->dev, inf->prefer_ip6) ++#define efi_net_interface_open(inf, file, name) inf->io->open (inf->dev, inf->prefer_ip6, file, name, inf->io_type) ++#define efi_net_interface_read(inf, file, buf, sz) inf->io->read (inf->dev, inf->prefer_ip6, file, buf, sz) ++#define efi_net_interface_close(inf, file) inf->io->close (inf->dev, inf->prefer_ip6, file) ++#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__) ++ ++static grub_efi_handle_t ++grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path, ++ grub_efi_device_path_t **r_device_path) ++{ ++ grub_efi_handle_t handle; ++ grub_efi_status_t status; ++ ++ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path, ++ protocol, &device_path, &handle); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return 0; ++ ++ if (r_device_path) ++ *r_device_path = device_path; ++ ++ return handle; ++} ++ ++static int ++url_parse_fields (const char *url, char **proto, char **host, char **path) ++{ ++ const char *p, *ps; ++ grub_size_t l; ++ ++ *proto = *host = *path = NULL; ++ ps = p = url; ++ ++ while ((p = grub_strchr (p, ':'))) ++ { ++ if (grub_strlen (p) < sizeof ("://") - 1) ++ break; ++ if (grub_memcmp (p, "://", sizeof ("://") - 1) == 0) ++ { ++ l = p - ps; ++ *proto = grub_malloc (l + 1); ++ if (!*proto) ++ { ++ grub_print_error (); ++ return 0; ++ } ++ ++ grub_memcpy (*proto, ps, l); ++ (*proto)[l] = '\0'; ++ p += sizeof ("://") - 1; ++ break; ++ } ++ ++p; ++ } ++ ++ if (!*proto) ++ { ++ grub_dprintf ("bootp", "url: %s is not valid, protocol not found\n", url); ++ return 0; ++ } ++ ++ ps = p; ++ p = grub_strchr (p, '/'); ++ ++ if (!p) ++ { ++ grub_dprintf ("bootp", "url: %s is not valid, host/path not found\n", url); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ ++ l = p - ps; ++ ++ if (l > 2 && ps[0] == '[' && ps[l - 1] == ']') ++ { ++ *host = grub_malloc (l - 1); ++ if (!*host) ++ { ++ grub_print_error (); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ grub_memcpy (*host, ps + 1, l - 2); ++ (*host)[l - 2] = 0; ++ } ++ else ++ { ++ *host = grub_malloc (l + 1); ++ if (!*host) ++ { ++ grub_print_error (); ++ grub_free (*proto); ++ *proto = NULL; ++ return 0; ++ } ++ grub_memcpy (*host, ps, l); ++ (*host)[l] = 0; ++ } ++ ++ *path = grub_strdup (p); ++ if (!*path) ++ { ++ grub_print_error (); ++ grub_free (*host); ++ grub_free (*proto); ++ *host = NULL; ++ *proto = NULL; ++ return 0; ++ } ++ return 1; ++} ++ ++static void ++url_get_boot_location (const char *url, char **device, char **path, int is_default) ++{ ++ char *protocol, *server, *file; ++ char *slash; ++ ++ if (!url_parse_fields (url, &protocol, &server, &file)) ++ return; ++ ++ if ((slash = grub_strrchr (file, '/'))) ++ *slash = 0; ++ else ++ *file = 0; ++ ++ *device = grub_xasprintf ("%s,%s", protocol, server); ++ *path = grub_strdup(file); ++ ++ if (is_default) ++ default_server = server; ++ else ++ grub_free (server); ++ ++ grub_free (protocol); ++ grub_free (file); ++} ++ ++static void ++pxe_get_boot_location (const struct grub_net_bootp_packet *bp, ++ char **device, ++ char **path, ++ int is_default) ++{ ++ char *server = grub_xasprintf ("%d.%d.%d.%d", ++ ((grub_uint8_t *) &bp->server_ip)[0], ++ ((grub_uint8_t *) &bp->server_ip)[1], ++ ((grub_uint8_t *) &bp->server_ip)[2], ++ ((grub_uint8_t *) &bp->server_ip)[3]); ++ ++ *device = grub_xasprintf ("tftp,%s", server); ++ ++ *path = grub_strndup (bp->boot_file, sizeof (bp->boot_file)); ++ ++ if (*path) ++ { ++ char *slash; ++ slash = grub_strrchr (*path, '/'); ++ if (slash) ++ *slash = 0; ++ else ++ **path = 0; ++ } ++ ++ if (is_default) ++ default_server = server; ++ else ++ grub_free (server); ++} ++ ++static void ++pxe_get_boot_location_v6 (const struct grub_net_dhcp6_packet *dp, ++ grub_size_t dhcp_size, ++ char **device, ++ char **path) ++{ ++ ++ struct grub_net_dhcp6_option *dhcp_opt; ++ grub_size_t dhcp_remain_size; ++ *device = *path = 0; ++ ++ if (dhcp_size < sizeof (*dp)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("DHCPv6 packet size too small")); ++ return; ++ } ++ ++ dhcp_remain_size = dhcp_size - sizeof (*dp); ++ dhcp_opt = (struct grub_net_dhcp6_option *)dp->dhcp_options; ++ ++ while (dhcp_remain_size) ++ { ++ grub_uint16_t code = grub_be_to_cpu16 (dhcp_opt->code); ++ grub_uint16_t len = grub_be_to_cpu16 (dhcp_opt->len); ++ grub_uint16_t option_size = sizeof (*dhcp_opt) + len; ++ ++ if (dhcp_remain_size < option_size || code == 0) ++ break; ++ ++ if (code == GRUB_NET_DHCP6_OPTION_BOOTFILE_URL) ++ { ++ char *url = grub_malloc (len + 1); ++ ++ grub_memcpy (url, dhcp_opt->data, len); ++ url[len] = 0; ++ ++ url_get_boot_location ((const char *)url, device, path, 1); ++ grub_free (url); ++ break; ++ } ++ ++ dhcp_remain_size -= option_size; ++ dhcp_opt = (struct grub_net_dhcp6_option *)((grub_uint8_t *)dhcp_opt + option_size); ++ } ++} ++ ++static grub_efi_net_interface_t * ++grub_efi_net_config_from_device_path (grub_efi_device_path_t *dp, ++ struct grub_efi_net_device *netdev, ++ char **device, ++ char **path) ++{ ++ grub_efi_net_interface_t *inf = NULL; ++ ++ while (1) ++ { ++ grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); ++ grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); ++ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ ++ if (type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) ++ { ++ if (subtype == GRUB_EFI_URI_DEVICE_PATH_SUBTYPE) ++ { ++ grub_efi_uri_device_path_t *uri_dp; ++ uri_dp = (grub_efi_uri_device_path_t *) dp; ++ /* Beware that uri_dp->uri may not be null terminated */ ++ url_get_boot_location ((const char *)uri_dp->uri, device, path, 1); ++ } ++ else if (subtype == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE) ++ { ++ grub_efi_net_ip_manual_address_t net_ip; ++ grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; ++ ++ if (inf) ++ continue; ++ grub_memcpy (net_ip.ip4.address, ipv4->local_ip_address, sizeof (net_ip.ip4.address)); ++ grub_memcpy (net_ip.ip4.subnet_mask, ipv4->subnet_mask, sizeof (net_ip.ip4.subnet_mask)); ++ net_ip.is_ip6 = 0; ++ inf = grub_efi_net_create_interface (netdev, ++ netdev->card_name, ++ &net_ip, ++ 1); ++ } ++ else if (subtype == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) ++ { ++ grub_efi_net_ip_manual_address_t net_ip; ++ grub_efi_ipv6_device_path_t *ipv6 = (grub_efi_ipv6_device_path_t *) dp; ++ ++ if (inf) ++ continue; ++ grub_memcpy (net_ip.ip6.address, ipv6->local_ip_address, sizeof (net_ip.ip6.address)); ++ net_ip.ip6.prefix_length = GRUB_EFI_IP6_PREFIX_LENGTH; ++ net_ip.ip6.is_anycast = 0; ++ net_ip.is_ip6 = 1; ++ inf = grub_efi_net_create_interface (netdev, ++ netdev->card_name, ++ &net_ip, ++ 1); ++ } ++ } ++ ++ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) ++ break; ++ dp = (grub_efi_device_path_t *) ((char *) dp + len); ++ } ++ ++ return inf; ++} ++ ++static grub_efi_net_interface_t * ++grub_efi_net_config_from_handle (grub_efi_handle_t *hnd, ++ struct grub_efi_net_device *netdev, ++ char **device, ++ char **path) ++{ ++ grub_efi_pxe_t *pxe = NULL; ++ ++ if (hnd == netdev->ip4_pxe_handle) ++ pxe = netdev->ip4_pxe; ++ else if (hnd == netdev->ip6_pxe_handle) ++ pxe = netdev->ip6_pxe; ++ ++ if (!pxe) ++ return (grub_efi_net_config_from_device_path ( ++ grub_efi_get_device_path (hnd), ++ netdev, ++ device, ++ path)); ++ ++ if (pxe->mode->using_ipv6) ++ { ++ grub_efi_net_ip_manual_address_t net_ip; ++ ++ pxe_get_boot_location_v6 ( ++ (const struct grub_net_dhcp6_packet *) &pxe->mode->dhcp_ack, ++ sizeof (pxe->mode->dhcp_ack), ++ device, ++ path); ++ ++ grub_memcpy (net_ip.ip6.address, pxe->mode->station_ip.v6, sizeof(net_ip.ip6.address)); ++ net_ip.ip6.prefix_length = GRUB_EFI_IP6_PREFIX_LENGTH; ++ net_ip.ip6.is_anycast = 0; ++ net_ip.is_ip6 = 1; ++ return (grub_efi_net_create_interface (netdev, ++ netdev->card_name, ++ &net_ip, ++ 1)); ++ } ++ else ++ { ++ grub_efi_net_ip_manual_address_t net_ip; ++ ++ pxe_get_boot_location ( ++ (const struct grub_net_bootp_packet *) &pxe->mode->dhcp_ack, ++ device, ++ path, ++ 1); ++ ++ grub_memcpy (net_ip.ip4.address, pxe->mode->station_ip.v4, sizeof (net_ip.ip4.address)); ++ grub_memcpy (net_ip.ip4.subnet_mask, pxe->mode->subnet_mask.v4, sizeof (net_ip.ip4.subnet_mask)); ++ net_ip.is_ip6 = 0; ++ return (grub_efi_net_create_interface (netdev, ++ netdev->card_name, ++ &net_ip, ++ 1)); ++ } ++} ++ ++static const char * ++grub_efi_net_var_get_address (struct grub_env_var *var, ++ const char *val __attribute__ ((unused))) ++{ ++ struct grub_efi_net_device *dev; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ grub_efi_net_interface_t *inf; ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ { ++ char *var_name; ++ ++ var_name = grub_xasprintf ("net_%s_ip", inf->name); ++ if (grub_strcmp (var_name, var->name) == 0) ++ return efi_net_interface_get_address (inf); ++ grub_free (var_name); ++ var_name = grub_xasprintf ("net_%s_mac", inf->name); ++ if (grub_strcmp (var_name, var->name) == 0) ++ return efi_net_interface_get_hw_address (inf); ++ grub_free (var_name); ++ } ++ } ++ ++ return NULL; ++} ++ ++static char * ++grub_efi_net_var_set_interface (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val) ++{ ++ struct grub_efi_net_device *dev; ++ grub_efi_net_interface_t *inf; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ if (grub_strcmp (inf->name, val) == 0) ++ { ++ net_default_interface = inf; ++ return grub_strdup (val); ++ } ++ ++ return NULL; ++} ++ ++static char * ++grub_efi_net_var_set_server (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val) ++{ ++ grub_free (default_server); ++ default_server = grub_strdup (val); ++ return grub_strdup (val); ++} ++ ++static const char * ++grub_efi_net_var_get_server (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ return default_server ? : ""; ++} ++ ++static const char * ++grub_efi_net_var_get_ip (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ const char *intf = grub_env_get ("net_default_interface"); ++ const char *ret = NULL; ++ if (intf) ++ { ++ char *buf = grub_xasprintf ("net_%s_ip", intf); ++ if (buf) ++ ret = grub_env_get (buf); ++ grub_free (buf); ++ } ++ return ret; ++} ++ ++static const char * ++grub_efi_net_var_get_mac (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ const char *intf = grub_env_get ("net_default_interface"); ++ const char *ret = NULL; ++ if (intf) ++ { ++ char *buf = grub_xasprintf ("net_%s_mac", intf); ++ if (buf) ++ ret = grub_env_get (buf); ++ grub_free (buf); ++ } ++ return ret; ++} ++ ++static void ++grub_efi_net_export_interface_vars (void) ++{ ++ struct grub_efi_net_device *dev; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ grub_efi_net_interface_t *inf; ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ { ++ char *var; ++ ++ var = grub_xasprintf ("net_%s_ip", inf->name); ++ grub_register_variable_hook (var, grub_efi_net_var_get_address, 0); ++ grub_env_export (var); ++ grub_free (var); ++ var = grub_xasprintf ("net_%s_mac", inf->name); ++ grub_register_variable_hook (var, grub_efi_net_var_get_address, 0); ++ grub_env_export (var); ++ grub_free (var); ++ } ++ } ++} ++ ++static void ++grub_efi_net_unset_interface_vars (void) ++{ ++ struct grub_efi_net_device *dev; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ grub_efi_net_interface_t *inf; ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ { ++ char *var; ++ ++ var = grub_xasprintf ("net_%s_ip", inf->name); ++ grub_register_variable_hook (var, 0, 0); ++ grub_env_unset (var); ++ grub_free (var); ++ var = grub_xasprintf ("net_%s_mac", inf->name); ++ grub_register_variable_hook (var, 0, 0); ++ grub_env_unset (var); ++ grub_free (var); ++ } ++ } ++} ++ ++grub_efi_net_interface_t * ++grub_efi_net_create_interface (struct grub_efi_net_device *dev, ++ const char *interface_name, ++ grub_efi_net_ip_manual_address_t *net_ip, ++ int has_subnet) ++{ ++ grub_efi_net_interface_t *inf; ++ ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ { ++ if (inf->prefer_ip6 == net_ip->is_ip6) ++ break; ++ } ++ ++ if (!inf) ++ { ++ inf = grub_malloc (sizeof(*inf)); ++ inf->name = grub_strdup (interface_name); ++ inf->prefer_ip6 = net_ip->is_ip6; ++ inf->dev = dev; ++ inf->next = dev->net_interfaces; ++ inf->ip_config = (net_ip->is_ip6) ? efi_net_ip6_config : efi_net_ip4_config ; ++ dev->net_interfaces = inf; ++ } ++ else ++ { ++ grub_free (inf->name); ++ inf->name = grub_strdup (interface_name); ++ } ++ ++ if (!efi_net_interface_set_address (inf, net_ip, has_subnet)) ++ { ++ grub_error (GRUB_ERR_BUG, N_("Set Address Failed")); ++ return NULL; ++ } ++ ++ return inf; ++} ++ ++static void ++grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, ++ char **path) ++{ ++ grub_efi_handle_t config_hnd; ++ ++ struct grub_efi_net_device *netdev; ++ grub_efi_net_interface_t *inf; ++ ++ config_hnd = grub_efi_locate_device_path (&ip4_config_guid, grub_efi_get_device_path (hnd), NULL); ++ ++ if (!config_hnd) ++ return; ++ ++ for (netdev = net_devices; netdev; netdev = netdev->next) ++ if (netdev->handle == config_hnd) ++ break; ++ ++ if (!netdev) ++ return; ++ ++ if (!(inf = grub_efi_net_config_from_handle (hnd, netdev, device, path))) ++ return; ++ ++ grub_env_set ("net_default_interface", inf->name); ++ grub_efi_net_export_interface_vars (); ++} ++ ++static grub_err_t ++grub_efi_netfs_dir (grub_device_t device, const char *path __attribute__ ((unused)), ++ grub_fs_dir_hook_t hook __attribute__ ((unused)), ++ void *hook_data __attribute__ ((unused))) ++{ ++ if (!device->net) ++ return grub_error (GRUB_ERR_BUG, "invalid net device"); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_efi_netfs_open (struct grub_file *file_out __attribute__ ((unused)), ++ const char *name __attribute__ ((unused))) ++{ ++ struct grub_file *file, *bufio; ++ ++ file = grub_malloc (sizeof (*file)); ++ if (!file) ++ return grub_errno; ++ ++ grub_memcpy (file, file_out, sizeof (struct grub_file)); ++ file->device->net->name = grub_strdup (name); ++ ++ if (!file->device->net->name) ++ { ++ grub_free (file); ++ return grub_errno; ++ } ++ ++ efi_net_interface(open, file, name); ++ grub_print_error (); ++ ++ bufio = grub_bufio_open (file, 32768); ++ if (!bufio) ++ { ++ grub_free (file->device->net->name); ++ grub_free (file); ++ return grub_errno; ++ } ++ grub_memcpy (file_out, bufio, sizeof (struct grub_file)); ++ grub_free (bufio); ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_ssize_t ++grub_efihttp_chunk_read (grub_file_t file, char *buf, ++ grub_size_t len, grub_size_t chunk_size) ++{ ++ char *chunk = grub_malloc (chunk_size); ++ grub_size_t sum = 0; ++ ++ while (len) ++ { ++ grub_ssize_t rd; ++ grub_size_t sz = (len > chunk_size) ? chunk_size : len; ++ ++ rd = efi_net_interface (read, file, chunk, sz); ++ ++ if (rd <= 0) ++ return rd; ++ ++ if (buf) ++ { ++ grub_memcpy (buf, chunk, rd); ++ buf += rd; ++ } ++ sum += rd; ++ len -= rd; ++ } ++ ++ grub_free (chunk); ++ return sum; ++} ++ ++static grub_ssize_t ++grub_efi_netfs_read (grub_file_t file __attribute__ ((unused)), ++ char *buf __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) ++{ ++ if (file->offset > file->device->net->offset) ++ { ++ grub_efihttp_chunk_read (file, NULL, file->offset - file->device->net->offset, 10240); ++ } ++ else if (file->offset < file->device->net->offset) ++ { ++ efi_net_interface (close, file); ++ efi_net_interface (open, file, file->device->net->name); ++ if (file->offset) ++ grub_efihttp_chunk_read (file, NULL, file->offset, 10240); ++ } ++ ++ return efi_net_interface (read, file, buf, len); ++} ++ ++static grub_err_t ++grub_efi_netfs_close (grub_file_t file) ++{ ++ efi_net_interface (close, file); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_efi_handle_t ++grub_efi_service_binding (grub_efi_handle_t dev, grub_efi_guid_t *service_binding_guid) ++{ ++ grub_efi_service_binding_t *service; ++ grub_efi_status_t status; ++ grub_efi_handle_t child_dev = NULL; ++ ++ service = grub_efi_open_protocol (dev, service_binding_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ if (!service) ++ { ++ grub_error (GRUB_ERR_IO, N_("couldn't open efi service binding protocol")); ++ return NULL; ++ } ++ ++ status = efi_call_2 (service->create_child, service, &child_dev); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status); ++ return NULL; ++ } ++ ++ return child_dev; ++} ++ ++static grub_err_t ++grub_efi_net_parse_address (const char *address, ++ grub_efi_ip4_config2_manual_address_t *ip4, ++ grub_efi_ip6_config_manual_address_t *ip6, ++ int *is_ip6, ++ int *has_cidr) ++{ ++ const char *rest; ++ ++ if (grub_efi_string_to_ip4_address (address, &ip4->address, &rest)) ++ { ++ *is_ip6 = 0; ++ if (*rest == '/') ++ { ++ grub_uint32_t subnet_mask_size; ++ ++ subnet_mask_size = grub_strtoul (rest + 1, (char **) &rest, 0); ++ ++ if (!grub_errno && subnet_mask_size <= 32 && *rest == 0) ++ { ++ grub_uint32_t subnet_mask; ++ ++ subnet_mask = grub_cpu_to_be32 ((0xffffffffU << (32 - subnet_mask_size))); ++ grub_memcpy (ip4->subnet_mask, &subnet_mask, sizeof (ip4->subnet_mask)); ++ if (has_cidr) ++ *has_cidr = 1; ++ return GRUB_ERR_NONE; ++ } ++ } ++ else if (*rest == 0) ++ { ++ grub_uint32_t subnet_mask = 0xffffffffU; ++ grub_memcpy (ip4->subnet_mask, &subnet_mask, sizeof (ip4->subnet_mask)); ++ if (has_cidr) ++ *has_cidr = 0; ++ return GRUB_ERR_NONE; ++ } ++ } ++ else if (grub_efi_string_to_ip6_address (address, &ip6->address, &rest)) ++ { ++ *is_ip6 = 1; ++ if (*rest == '/') ++ { ++ grub_efi_uint8_t prefix_length; ++ ++ prefix_length = grub_strtoul (rest + 1, (char **) &rest, 0); ++ if (!grub_errno && prefix_length <= 128 && *rest == 0) ++ { ++ ip6->prefix_length = prefix_length; ++ ip6->is_anycast = 0; ++ if (has_cidr) ++ *has_cidr = 1; ++ return GRUB_ERR_NONE; ++ } ++ } ++ else if (*rest == 0) ++ { ++ ip6->prefix_length = 128; ++ ip6->is_anycast = 0; ++ if (has_cidr) ++ *has_cidr = 0; ++ return GRUB_ERR_NONE; ++ } ++ } ++ ++ return grub_error (GRUB_ERR_NET_BAD_ADDRESS, ++ N_("unrecognised network address `%s'"), ++ address); ++} ++ ++static grub_efi_net_interface_t * ++match_route (const char *server) ++{ ++ grub_err_t err; ++ grub_efi_ip4_config2_manual_address_t ip4; ++ grub_efi_ip6_config_manual_address_t ip6; ++ grub_efi_net_interface_t *inf; ++ int is_ip6 = 0; ++ ++ err = grub_efi_net_parse_address (server, &ip4, &ip6, &is_ip6, 0); ++ ++ if (err) ++ { ++ grub_print_error (); ++ return NULL; ++ } ++ ++ if (is_ip6) ++ { ++ struct grub_efi_net_device *dev; ++ grub_efi_net_ip_address_t addr; ++ ++ grub_memcpy (addr.ip6, ip6.address, sizeof(ip6.address)); ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ if ((inf = efi_net_ip6_config->best_interface (dev, &addr))) ++ return inf; ++ } ++ else ++ { ++ struct grub_efi_net_device *dev; ++ grub_efi_net_ip_address_t addr; ++ ++ grub_memcpy (addr.ip4, ip4.address, sizeof(ip4.address)); ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ if ((inf = efi_net_ip4_config->best_interface (dev, &addr))) ++ return inf; ++ } ++ ++ return 0; ++} ++ ++static void ++grub_efi_net_add_pxebc_to_cards (void) ++{ ++ grub_efi_uintn_t num_handles; ++ grub_efi_handle_t *handles; ++ grub_efi_handle_t *handle; ++ ++ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &pxe_io_guid, ++ 0, &num_handles); ++ if (!handles) ++ return; ++ ++ for (handle = handles; num_handles--; handle++) ++ { ++ grub_efi_device_path_t *dp, *ddp, *ldp; ++ grub_efi_pxe_t *pxe; ++ struct grub_efi_net_device *d; ++ int is_ip6 = 0; ++ ++ dp = grub_efi_get_device_path (*handle); ++ if (!dp) ++ continue; ++ ++ ddp = grub_efi_duplicate_device_path (dp); ++ ldp = grub_efi_find_last_device_path (ddp); ++ ++ if (ldp->type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ && ldp->subtype == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE) ++ { ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ } ++ else if (ldp->type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE ++ && ldp->subtype == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) ++ { ++ is_ip6 = 1; ++ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ ldp->length = sizeof (*ldp); ++ } ++ ++ for (d = net_devices; d; d = d->next) ++ if (grub_efi_compare_device_paths (ddp, grub_efi_get_device_path (d->handle)) == 0) ++ break; ++ ++ if (!d) ++ { ++ grub_free (ddp); ++ continue; ++ } ++ ++ pxe = grub_efi_open_protocol (*handle, &pxe_io_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ ++ if (!pxe) ++ { ++ grub_free (ddp); ++ continue; ++ } ++ ++ if (is_ip6) ++ { ++ d->ip6_pxe_handle = *handle; ++ d->ip6_pxe = pxe; ++ } ++ else ++ { ++ d->ip4_pxe_handle = *handle; ++ d->ip4_pxe = pxe; ++ } ++ ++ grub_free (ddp); ++ } ++ ++ grub_free (handles); ++} ++ ++static void ++set_ip_policy_to_static (void) ++{ ++ struct grub_efi_net_device *dev; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC; ++ ++ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY, ++ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS) ++ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name); ++ ++ if (dev->ip6_config) ++ { ++ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL; ++ ++ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY, ++ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS) ++ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name); ++ } ++ } ++} ++ ++/* FIXME: Do not fail if the card did not support any of the protocol (Eg http) */ ++static void ++grub_efi_net_find_cards (void) ++{ ++ grub_efi_uintn_t num_handles; ++ grub_efi_handle_t *handles; ++ grub_efi_handle_t *handle; ++ int id; ++ ++ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &ip4_config_guid, ++ 0, &num_handles); ++ if (!handles) ++ return; ++ ++ for (id = 0, handle = handles; num_handles--; handle++, id++) ++ { ++ grub_efi_device_path_t *dp; ++ grub_efi_ip4_config2_protocol_t *ip4_config; ++ grub_efi_ip6_config_protocol_t *ip6_config; ++ grub_efi_handle_t http_handle; ++ grub_efi_http_t *http; ++ grub_efi_handle_t dhcp4_handle; ++ grub_efi_dhcp4_protocol_t *dhcp4; ++ grub_efi_handle_t dhcp6_handle; ++ grub_efi_dhcp6_protocol_t *dhcp6; ++ ++ struct grub_efi_net_device *d; ++ ++ dp = grub_efi_get_device_path (*handle); ++ if (!dp) ++ continue; ++ ++ ip4_config = grub_efi_open_protocol (*handle, &ip4_config_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ if (!ip4_config) ++ continue; ++ ++ ip6_config = grub_efi_open_protocol (*handle, &ip6_config_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ ++ http_handle = grub_efi_service_binding (*handle, &http_service_binding_guid); ++ grub_errno = GRUB_ERR_NONE; ++ http = (http_handle) ++ ? grub_efi_open_protocol (http_handle, &http_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; ++ ++ dhcp4_handle = grub_efi_service_binding (*handle, &dhcp4_service_binding_guid); ++ grub_errno = GRUB_ERR_NONE; ++ dhcp4 = (dhcp4_handle) ++ ? grub_efi_open_protocol (dhcp4_handle, &dhcp4_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; ++ ++ ++ dhcp6_handle = grub_efi_service_binding (*handle, &dhcp6_service_binding_guid); ++ grub_errno = GRUB_ERR_NONE; ++ dhcp6 = (dhcp6_handle) ++ ? grub_efi_open_protocol (dhcp6_handle, &dhcp6_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL) ++ : NULL; ++ ++ d = grub_malloc (sizeof (*d)); ++ if (!d) ++ { ++ grub_free (handles); ++ while (net_devices) ++ { ++ d = net_devices->next; ++ grub_free (net_devices); ++ net_devices = d; ++ } ++ return; ++ } ++ d->handle = *handle; ++ d->ip4_config = ip4_config; ++ d->ip6_config = ip6_config; ++ d->http_handle = http_handle; ++ d->http = http; ++ d->dhcp4_handle = dhcp4_handle; ++ d->dhcp4 = dhcp4; ++ d->dhcp6_handle = dhcp6_handle; ++ d->dhcp6 = dhcp6; ++ d->next = net_devices; ++ d->card_name = grub_xasprintf ("efinet%d", id); ++ d->net_interfaces = NULL; ++ net_devices = d; ++ } ++ ++ grub_efi_net_add_pxebc_to_cards (); ++ grub_free (handles); ++ set_ip_policy_to_static (); ++} ++ ++static void ++listroutes_ip4 (struct grub_efi_net_device *netdev) ++{ ++ char **routes; ++ ++ routes = NULL; ++ ++ if ((routes = efi_net_ip4_config->get_route_table (netdev))) ++ { ++ char **r; ++ ++ for (r = routes; *r; ++r) ++ grub_printf ("%s\n", *r); ++ } ++ ++ if (routes) ++ { ++ char **r; ++ ++ for (r = routes; *r; ++r) ++ grub_free (*r); ++ grub_free (routes); ++ } ++} ++ ++static void ++listroutes_ip6 (struct grub_efi_net_device *netdev) ++{ ++ char **routes; ++ ++ routes = NULL; ++ ++ if ((routes = efi_net_ip6_config->get_route_table (netdev))) ++ { ++ char **r; ++ ++ for (r = routes; *r; ++r) ++ grub_printf ("%s\n", *r); ++ } ++ ++ if (routes) ++ { ++ char **r; ++ ++ for (r = routes; *r; ++r) ++ grub_free (*r); ++ grub_free (routes); ++ } ++} ++ ++static grub_err_t ++grub_cmd_efi_listroutes (struct grub_command *cmd __attribute__ ((unused)), ++ int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ struct grub_efi_net_device *netdev; ++ ++ for (netdev = net_devices; netdev; netdev = netdev->next) ++ { ++ listroutes_ip4 (netdev); ++ listroutes_ip6 (netdev); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++static grub_err_t ++grub_cmd_efi_listcards (struct grub_command *cmd __attribute__ ((unused)), ++ int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ struct grub_efi_net_device *dev; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ char *hw_addr; ++ ++ hw_addr = efi_net_ip4_config->get_hw_address (dev); ++ ++ if (hw_addr) ++ { ++ grub_printf ("%s %s\n", dev->card_name, hw_addr); ++ grub_free (hw_addr); ++ } ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_efi_listaddrs (struct grub_command *cmd __attribute__ ((unused)), ++ int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ struct grub_efi_net_device *dev; ++ grub_efi_net_interface_t *inf; ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ for (inf = dev->net_interfaces; inf; inf = inf->next) ++ { ++ char *hw_addr = NULL; ++ char *addr = NULL; ++ ++ if ((hw_addr = efi_net_interface_get_hw_address (inf)) ++ && (addr = efi_net_interface_get_address (inf))) ++ grub_printf ("%s %s %s\n", inf->name, hw_addr, addr); ++ ++ if (hw_addr) ++ grub_free (hw_addr); ++ if (addr) ++ grub_free (addr); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++/* FIXME: support MAC specifying. */ ++static grub_err_t ++grub_cmd_efi_addaddr (struct grub_command *cmd __attribute__ ((unused)), ++ int argc, char **args) ++{ ++ struct grub_efi_net_device *dev; ++ grub_err_t err; ++ grub_efi_ip4_config2_manual_address_t ip4; ++ grub_efi_ip6_config_manual_address_t ip6; ++ grub_efi_net_ip_manual_address_t net_ip; ++ int is_ip6 = 0; ++ int cidr = 0; ++ ++ if (argc != 3) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("three arguments expected")); ++ ++ for (dev = net_devices; dev; dev = dev->next) ++ { ++ if (grub_strcmp (dev->card_name, args[1]) == 0) ++ break; ++ } ++ ++ if (!dev) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("card not found")); ++ ++ err = grub_efi_net_parse_address (args[2], &ip4, &ip6, &is_ip6, &cidr); ++ ++ if (err) ++ return err; ++ ++ net_ip.is_ip6 = is_ip6; ++ if (is_ip6) ++ grub_memcpy (&net_ip.ip6, &ip6, sizeof(net_ip.ip6)); ++ else ++ grub_memcpy (&net_ip.ip4, &ip4, sizeof(net_ip.ip4)); ++ ++ if (!grub_efi_net_create_interface (dev, ++ args[0], ++ &net_ip, ++ cidr)) ++ return grub_errno; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static struct grub_fs grub_efi_netfs; ++ ++static grub_net_t ++grub_net_open_real (const char *name __attribute__ ((unused))) ++{ ++ grub_size_t protnamelen; ++ const char *protname, *server; ++ grub_net_t ret; ++ ++ net_interface = NULL; ++ ++ if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) ++ { ++ protname = "tftp"; ++ protnamelen = sizeof ("tftp") - 1; ++ server = name + sizeof ("pxe:") - 1; ++ } ++ else if (grub_strcmp (name, "pxe") == 0) ++ { ++ protname = "tftp"; ++ protnamelen = sizeof ("tftp") - 1; ++ server = default_server; ++ } ++ else ++ { ++ const char *comma; ++ ++ comma = grub_strchr (name, ','); ++ if (comma) ++ { ++ protnamelen = comma - name; ++ server = comma + 1; ++ protname = name; ++ } ++ else ++ { ++ protnamelen = grub_strlen (name); ++ server = default_server; ++ protname = name; ++ } ++ } ++ ++ if (!server) ++ { ++ grub_error (GRUB_ERR_NET_BAD_ADDRESS, ++ N_("no server is specified")); ++ return NULL; ++ } ++ ++ /*FIXME: Use DNS translate name to address */ ++ net_interface = match_route (server); ++ ++ /*XXX: should we check device with default gateway ? */ ++ if (!net_interface && !(net_interface = net_default_interface)) ++ { ++ grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' no route found"), ++ name); ++ return NULL; ++ } ++ ++ if ((protnamelen == (sizeof ("https") - 1) ++ && grub_memcmp ("https", protname, protnamelen) == 0)) ++ { ++ net_interface->io = &io_http; ++ net_interface->io_type = 1; ++ } ++ else if ((protnamelen == (sizeof ("http") - 1) ++ && grub_memcmp ("http", protname, protnamelen) == 0)) ++ { ++ net_interface->io = &io_http; ++ net_interface->io_type = 0; ++ } ++ else if (protnamelen == (sizeof ("tftp") - 1) ++ && grub_memcmp ("tftp", protname, protnamelen) == 0) ++ { ++ net_interface->io = &io_pxe; ++ net_interface->io_type = 0; ++ } ++ else ++ { ++ grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"), ++ name); ++ return NULL; ++ } ++ ++ /*XXX: Should we try to avoid doing excess "reconfigure" here ??? */ ++ efi_net_interface (configure); ++ ++ ret = grub_zalloc (sizeof (*ret)); ++ if (!ret) ++ return NULL; ++ ++ ret->server = grub_strdup (server); ++ if (!ret->server) ++ { ++ grub_free (ret); ++ return NULL; ++ } ++ ++ ret->fs = &grub_efi_netfs; ++ return ret; ++} ++#if 0 ++static grub_command_t cmd_efi_lsaddr; ++static grub_command_t cmd_efi_lscards; ++static grub_command_t cmd_efi_lsroutes; ++static grub_command_t cmd_efi_addaddr; ++#endif ++ ++static struct grub_fs grub_efi_netfs = ++ { ++ .name = "efi netfs", ++ .dir = grub_efi_netfs_dir, ++ .open = grub_efi_netfs_open, ++ .read = grub_efi_netfs_read, ++ .close = grub_efi_netfs_close, ++ .label = NULL, ++ .uuid = NULL, ++ .mtime = NULL, ++ }; ++ ++int ++grub_efi_net_boot_from_https (void) ++{ ++ grub_efi_loaded_image_t *image = NULL; ++ grub_efi_device_path_t *dp; ++ ++ image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ if (!image) ++ return 0; ++ ++ dp = grub_efi_get_device_path (image->device_handle); ++ ++ while (1) ++ { ++ grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); ++ grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); ++ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ ++ if ((type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) ++ && (subtype == GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) ++ { ++ grub_efi_uri_device_path_t *uri_dp = (grub_efi_uri_device_path_t *) dp; ++ return (grub_strncmp ((const char*)uri_dp->uri, "https://", sizeof ("https://") - 1) == 0) ? 1 : 0; ++ } ++ ++ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) ++ break; ++ dp = (grub_efi_device_path_t *) ((char *) dp + len); ++ } ++ ++ return 0; ++} ++ ++int ++grub_efi_net_boot_from_opa (void) ++{ ++ grub_efi_loaded_image_t *image = NULL; ++ grub_efi_device_path_t *dp; ++ ++ image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ if (!image) ++ return 0; ++ ++ dp = grub_efi_get_device_path (image->device_handle); ++ ++ while (1) ++ { ++ grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); ++ grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); ++ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ ++ if ((type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) ++ && (subtype == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)) ++ { ++ grub_efi_mac_address_device_path_t *mac_dp = (grub_efi_mac_address_device_path_t *)dp; ++ return (mac_dp->if_type == 0xC7) ? 1 : 0; ++ } ++ ++ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) ++ break; ++ dp = (grub_efi_device_path_t *) ((char *) dp + len); ++ } ++ ++ return 0; ++} ++ ++static char * ++grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ return NULL; ++} ++ ++grub_command_func_t grub_efi_net_list_routes = grub_cmd_efi_listroutes; ++grub_command_func_t grub_efi_net_list_cards = grub_cmd_efi_listcards; ++grub_command_func_t grub_efi_net_list_addrs = grub_cmd_efi_listaddrs; ++grub_command_func_t grub_efi_net_add_addr = grub_cmd_efi_addaddr; ++ ++int ++grub_efi_net_fs_init () ++{ ++ grub_efi_net_find_cards (); ++ grub_efi_net_config = grub_efi_net_config_real; ++ grub_net_open = grub_net_open_real; ++ grub_register_variable_hook ("net_default_server", grub_efi_net_var_get_server, ++ grub_efi_net_var_set_server); ++ grub_env_export ("net_default_server"); ++ grub_register_variable_hook ("pxe_default_server", grub_efi_net_var_get_server, ++ grub_efi_net_var_set_server); ++ grub_env_export ("pxe_default_server"); ++ grub_register_variable_hook ("net_default_interface", 0, ++ grub_efi_net_var_set_interface); ++ grub_env_export ("net_default_interface"); ++ grub_register_variable_hook ("net_default_ip", grub_efi_net_var_get_ip, ++ 0); ++ grub_env_export ("net_default_ip"); ++ grub_register_variable_hook ("net_default_mac", grub_efi_net_var_get_mac, ++ 0); ++ grub_env_export ("net_default_mac"); ++ ++ grub_env_set ("grub_netfs_type", "efi"); ++ grub_register_variable_hook ("grub_netfs_type", 0, grub_env_write_readonly); ++ grub_env_export ("grub_netfs_type"); ++ ++ return 1; ++} ++ ++void ++grub_efi_net_fs_fini (void) ++{ ++ grub_env_unset ("grub_netfs_type"); ++ grub_efi_net_unset_interface_vars (); ++ grub_register_variable_hook ("net_default_server", 0, 0); ++ grub_env_unset ("net_default_server"); ++ grub_register_variable_hook ("net_default_interface", 0, 0); ++ grub_env_unset ("net_default_interface"); ++ grub_register_variable_hook ("pxe_default_server", 0, 0); ++ grub_env_unset ("pxe_default_server"); ++ grub_register_variable_hook ("net_default_ip", 0, 0); ++ grub_env_unset ("net_default_ip"); ++ grub_register_variable_hook ("net_default_mac", 0, 0); ++ grub_env_unset ("net_default_mac"); ++ grub_efi_net_config = NULL; ++ grub_net_open = NULL; ++ grub_fs_unregister (&grub_efi_netfs); ++} +diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c +new file mode 100644 +index 00000000000..d9febf12e5b +--- /dev/null ++++ b/grub-core/net/efi/pxe.c +@@ -0,0 +1,424 @@ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static grub_efi_ip6_config_manual_address_t * ++efi_ip6_config_manual_address (grub_efi_ip6_config_protocol_t *ip6_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip6_config_manual_address_t *manual_address; ++ ++ sz = sizeof (*manual_address); ++ manual_address = grub_malloc (sz); ++ if (!manual_address) ++ return NULL; ++ ++ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, manual_address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (manual_address); ++ return NULL; ++ } ++ ++ return manual_address; ++} ++ ++static grub_efi_ip4_config2_manual_address_t * ++efi_ip4_config_manual_address (grub_efi_ip4_config2_protocol_t *ip4_config) ++{ ++ grub_efi_uintn_t sz; ++ grub_efi_status_t status; ++ grub_efi_ip4_config2_manual_address_t *manual_address; ++ ++ sz = sizeof (*manual_address); ++ manual_address = grub_malloc (sz); ++ if (!manual_address) ++ return NULL; ++ ++ status = efi_call_4 (ip4_config->get_data, ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, manual_address); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_free (manual_address); ++ return NULL; ++ } ++ ++ return manual_address; ++} ++ ++static void ++pxe_configure (struct grub_efi_net_device *dev, int prefer_ip6) ++{ ++ grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe; ++ ++ grub_efi_pxe_mode_t *mode = pxe->mode; ++ ++ if (!mode->started) ++ { ++ grub_efi_status_t status; ++ status = efi_call_2 (pxe->start, pxe, prefer_ip6); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ grub_printf ("Couldn't start PXE\n"); ++ } ++ ++#if 0 ++ grub_printf ("PXE STARTED: %u\n", mode->started); ++ grub_printf ("PXE USING IPV6: %u\n", mode->using_ipv6); ++#endif ++ ++ if (mode->using_ipv6) ++ { ++ grub_efi_ip6_config_manual_address_t *manual_address; ++ manual_address = efi_ip6_config_manual_address (dev->ip6_config); ++ ++ if (manual_address && ++ grub_memcmp (manual_address->address, mode->station_ip.v6, sizeof (manual_address->address)) != 0) ++ { ++ grub_efi_status_t status; ++ grub_efi_pxe_ip_address_t station_ip; ++ ++ grub_memcpy (station_ip.v6, manual_address->address, sizeof (station_ip.v6)); ++ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, NULL); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ grub_printf ("Couldn't set station ip\n"); ++ ++ grub_free (manual_address); ++ } ++ } ++ else ++ { ++ grub_efi_ip4_config2_manual_address_t *manual_address; ++ manual_address = efi_ip4_config_manual_address (dev->ip4_config); ++ ++ if (manual_address && ++ grub_memcmp (manual_address->address, mode->station_ip.v4, sizeof (manual_address->address)) != 0) ++ { ++ grub_efi_status_t status; ++ grub_efi_pxe_ip_address_t station_ip; ++ grub_efi_pxe_ip_address_t subnet_mask; ++ ++ grub_memcpy (station_ip.v4, manual_address->address, sizeof (station_ip.v4)); ++ grub_memcpy (subnet_mask.v4, manual_address->subnet_mask, sizeof (subnet_mask.v4)); ++ ++ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, &subnet_mask); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ grub_printf ("Couldn't set station ip\n"); ++ ++ grub_free (manual_address); ++ } ++ } ++ ++#if 0 ++ if (mode->using_ipv6) ++ { ++ grub_printf ("PXE STATION IP: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", ++ mode->station_ip.v6[0], ++ mode->station_ip.v6[1], ++ mode->station_ip.v6[2], ++ mode->station_ip.v6[3], ++ mode->station_ip.v6[4], ++ mode->station_ip.v6[5], ++ mode->station_ip.v6[6], ++ mode->station_ip.v6[7], ++ mode->station_ip.v6[8], ++ mode->station_ip.v6[9], ++ mode->station_ip.v6[10], ++ mode->station_ip.v6[11], ++ mode->station_ip.v6[12], ++ mode->station_ip.v6[13], ++ mode->station_ip.v6[14], ++ mode->station_ip.v6[15]); ++ } ++ else ++ { ++ grub_printf ("PXE STATION IP: %d.%d.%d.%d\n", ++ mode->station_ip.v4[0], ++ mode->station_ip.v4[1], ++ mode->station_ip.v4[2], ++ mode->station_ip.v4[3]); ++ grub_printf ("PXE SUBNET MASK: %d.%d.%d.%d\n", ++ mode->subnet_mask.v4[0], ++ mode->subnet_mask.v4[1], ++ mode->subnet_mask.v4[2], ++ mode->subnet_mask.v4[3]); ++ } ++#endif ++ ++ /* TODO: Set The Station IP to the IP2 Config */ ++} ++ ++static int ++parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) ++{ ++ grub_uint16_t newip[8]; ++ const char *ptr = val; ++ int word, quaddot = -1; ++ int bracketed = 0; ++ ++ if (ptr[0] == '[') { ++ bracketed = 1; ++ ptr++; ++ } ++ ++ if (ptr[0] == ':' && ptr[1] != ':') ++ return 0; ++ if (ptr[0] == ':') ++ ptr++; ++ ++ for (word = 0; word < 8; word++) ++ { ++ unsigned long t; ++ if (*ptr == ':') ++ { ++ quaddot = word; ++ word--; ++ ptr++; ++ continue; ++ } ++ t = grub_strtoul (ptr, (char **) &ptr, 16); ++ if (grub_errno) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ break; ++ } ++ if (t & ~0xffff) ++ return 0; ++ newip[word] = grub_cpu_to_be16 (t); ++ if (*ptr != ':') ++ break; ++ ptr++; ++ } ++ if (quaddot == -1 && word < 7) ++ return 0; ++ if (quaddot != -1) ++ { ++ grub_memmove (&newip[quaddot + 7 - word], &newip[quaddot], ++ (word - quaddot + 1) * sizeof (newip[0])); ++ grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); ++ } ++ grub_memcpy (ip, newip, 16); ++ if (bracketed && *ptr == ']') { ++ ptr++; ++ } ++ if (rest) ++ *rest = ptr; ++ return 1; ++} ++ ++static grub_err_t ++pxe_open (struct grub_efi_net_device *dev, ++ int prefer_ip6, ++ grub_file_t file, ++ const char *filename, ++ int type __attribute__((unused))) ++{ ++ int i; ++ char *p; ++ grub_efi_status_t status; ++ grub_efi_pxe_ip_address_t server_ip; ++ grub_efi_uint64_t file_size = 0; ++ grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe; ++ ++ if (pxe->mode->using_ipv6) ++ { ++ const char *rest; ++ grub_uint64_t ip6[2]; ++ if (parse_ip6 (file->device->net->server, ip6, &rest) && *rest == 0) ++ grub_memcpy (server_ip.v6, ip6, sizeof (server_ip.v6)); ++ /* TODO: ERROR Handling Here */ ++#if 0 ++ grub_printf ("PXE SERVER IP: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", ++ server_ip.v6[0], ++ server_ip.v6[1], ++ server_ip.v6[2], ++ server_ip.v6[3], ++ server_ip.v6[4], ++ server_ip.v6[5], ++ server_ip.v6[6], ++ server_ip.v6[7], ++ server_ip.v6[8], ++ server_ip.v6[9], ++ server_ip.v6[10], ++ server_ip.v6[11], ++ server_ip.v6[12], ++ server_ip.v6[13], ++ server_ip.v6[14], ++ server_ip.v6[15]); ++#endif ++ } ++ else ++ { ++ for (i = 0, p = file->device->net->server; i < 4; ++i, ++p) ++ server_ip.v4[i] = grub_strtoul (p, &p, 10); ++ } ++ ++ status = efi_call_10 (pxe->mtftp, ++ pxe, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, ++ NULL, ++ 0, ++ &file_size, ++ NULL, ++ &server_ip, ++ (grub_efi_char8_t *)filename, ++ NULL, ++ 0); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ return grub_error (GRUB_ERR_IO, "Couldn't get file size"); ++ ++ file->size = (grub_off_t)file_size; ++ file->not_easily_seekable = 0; ++ file->data = 0; ++ file->device->net->offset = 0; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++pxe_close (struct grub_efi_net_device *dev __attribute__((unused)), ++ int prefer_ip6 __attribute__((unused)), ++ grub_file_t file __attribute__((unused))) ++{ ++ file->offset = 0; ++ file->size = 0; ++ file->device->net->offset = 0; ++ ++ if (file->data) ++ { ++ grub_free (file->data); ++ file->data = NULL; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_ssize_t ++pxe_read (struct grub_efi_net_device *dev, ++ int prefer_ip6, ++ grub_file_t file, ++ char *buf, ++ grub_size_t len) ++{ ++ int i; ++ char *p; ++ grub_efi_status_t status; ++ grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe; ++ grub_efi_uint64_t bufsz = len; ++ grub_efi_pxe_ip_address_t server_ip; ++ char *buf2 = NULL; ++ ++ if (file->data) ++ { ++ /* TODO: RANGE Check for offset and file size */ ++ grub_memcpy (buf, (char*)file->data + file->device->net->offset, len); ++ file->device->net->offset += len; ++ return len; ++ } ++ ++ if (file->device->net->offset) ++ { ++ grub_error (GRUB_ERR_BUG, "No Offet Read Possible"); ++ grub_print_error (); ++ return 0; ++ } ++ ++ if (pxe->mode->using_ipv6) ++ { ++ const char *rest; ++ grub_uint64_t ip6[2]; ++ if (parse_ip6 (file->device->net->server, ip6, &rest) && *rest == 0) ++ grub_memcpy (server_ip.v6, ip6, sizeof (server_ip.v6)); ++ /* TODO: ERROR Handling Here */ ++ } ++ else ++ { ++ for (i = 0, p = file->device->net->server; i < 4; ++i, ++p) ++ server_ip.v4[i] = grub_strtoul (p, &p, 10); ++ } ++ ++ status = efi_call_10 (pxe->mtftp, ++ pxe, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, ++ buf, ++ 0, ++ &bufsz, ++ NULL, ++ &server_ip, ++ (grub_efi_char8_t *)file->device->net->name, ++ NULL, ++ 0); ++ ++ if (bufsz != file->size) ++ { ++ grub_error (GRUB_ERR_BUG, "Short read should not happen here"); ++ grub_print_error (); ++ return 0; ++ } ++ ++ if (status == GRUB_EFI_BUFFER_TOO_SMALL) ++ { ++ ++ buf2 = grub_malloc (bufsz); ++ ++ if (!buf2) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, "ERROR OUT OF MEMORY"); ++ grub_print_error (); ++ return 0; ++ } ++ ++ status = efi_call_10 (pxe->mtftp, ++ pxe, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, ++ buf2, ++ 0, ++ &bufsz, ++ NULL, ++ &server_ip, ++ (grub_efi_char8_t *)file->device->net->name, ++ NULL, ++ 0); ++ } ++ ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ if (buf2) ++ grub_free (buf2); ++ ++ grub_error (GRUB_ERR_IO, "Failed to Read File"); ++ grub_print_error (); ++ return 0; ++ } ++ ++ if (buf2) ++ grub_memcpy (buf, buf2, len); ++ ++ file->device->net->offset = len; ++ ++ if (buf2) ++ file->data = buf2; ++ ++ return len; ++} ++ ++struct grub_efi_net_io io_pxe = ++ { ++ .configure = pxe_configure, ++ .open = pxe_open, ++ .read = pxe_read, ++ .close = pxe_close ++ }; ++ +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index c84b435e8a5..ca51ae1bd94 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -32,6 +32,9 @@ + #include + #include + #include ++#ifdef GRUB_MACHINE_EFI ++#include ++#endif + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -2018,8 +2021,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; + static grub_command_t cmd_lsroutes, cmd_lscards; + static grub_command_t cmd_lsaddr, cmd_slaac; + ++#ifdef GRUB_MACHINE_EFI ++ ++static enum { ++ INIT_MODE_NONE, ++ INIT_MODE_GRUB, ++ INIT_MODE_EFI ++} init_mode; ++ ++static grub_command_t cmd_bootp, cmd_bootp6; ++ ++#endif ++ + GRUB_MOD_INIT(net) + { ++#ifdef GRUB_MACHINE_EFI ++ if (grub_net_open) ++ return; ++ ++ if ((grub_efi_net_boot_from_https () || grub_efi_net_boot_from_opa ()) ++ && grub_efi_net_fs_init ()) ++ { ++ cmd_lsroutes = grub_register_command ("net_ls_routes", grub_efi_net_list_routes, ++ "", N_("list network routes")); ++ cmd_lscards = grub_register_command ("net_ls_cards", grub_efi_net_list_cards, ++ "", N_("list network cards")); ++ cmd_lsaddr = grub_register_command ("net_ls_addr", grub_efi_net_list_addrs, ++ "", N_("list network addresses")); ++ cmd_addaddr = grub_register_command ("net_add_addr", grub_efi_net_add_addr, ++ /* TRANSLATORS: HWADDRESS stands for ++ "hardware address". */ ++ N_("SHORTNAME CARD ADDRESS [HWADDRESS]"), ++ N_("Add a network address.")); ++ cmd_bootp = grub_register_command ("net_bootp", grub_efi_net_bootp, ++ N_("[CARD]"), ++ N_("perform a bootp autoconfiguration")); ++ cmd_bootp6 = grub_register_command ("net_bootp6", grub_efi_net_bootp6, ++ N_("[CARD]"), ++ N_("perform a bootp autoconfiguration")); ++ init_mode = INIT_MODE_EFI; ++ return; ++ } ++#endif ++ + grub_register_variable_hook ("net_default_server", defserver_get_env, + defserver_set_env); + grub_env_export ("net_default_server"); +@@ -2067,10 +2111,37 @@ GRUB_MOD_INIT(net) + grub_net_restore_hw, + GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK); + grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; ++ ++#ifdef GRUB_MACHINE_EFI ++ grub_env_set ("grub_netfs_type", "grub"); ++ grub_register_variable_hook ("grub_netfs_type", 0, grub_env_write_readonly); ++ grub_env_export ("grub_netfs_type"); ++ init_mode = INIT_MODE_GRUB; ++#endif ++ + } + + GRUB_MOD_FINI(net) + { ++ ++#ifdef GRUB_MACHINE_EFI ++ if (init_mode == INIT_MODE_NONE) ++ return; ++ ++ if (init_mode == INIT_MODE_EFI) ++ { ++ grub_unregister_command (cmd_lsroutes); ++ grub_unregister_command (cmd_lscards); ++ grub_unregister_command (cmd_lsaddr); ++ grub_unregister_command (cmd_addaddr); ++ grub_unregister_command (cmd_bootp); ++ grub_unregister_command (cmd_bootp6); ++ grub_efi_net_fs_fini (); ++ init_mode = INIT_MODE_NONE; ++ return; ++ } ++#endif ++ + grub_register_variable_hook ("net_default_server", 0, 0); + grub_register_variable_hook ("pxe_default_server", 0, 0); + +@@ -2089,4 +2160,7 @@ GRUB_MOD_FINI(net) + grub_net_fini_hw (0); + grub_loader_unregister_preboot_hook (fini_hnd); + grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; ++#ifdef GRUB_MACHINE_EFI ++ init_mode = INIT_MODE_NONE; ++#endif + } +diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c +index 82073d5cc94..ae31271bbc0 100644 +--- a/util/grub-mknetdir.c ++++ b/util/grub-mknetdir.c +@@ -32,13 +32,15 @@ + + static char *rootdir = NULL, *subdir = NULL; + static char *debug_image = NULL; ++static char efi_netfs = 0; + + enum + { + OPTION_NET_DIRECTORY = 0x301, + OPTION_SUBDIR, + OPTION_DEBUG, +- OPTION_DEBUG_IMAGE ++ OPTION_DEBUG_IMAGE, ++ OPTION_DEBUG_EFI_NETFS + }; + + static struct argp_option options[] = { +@@ -49,6 +51,7 @@ static struct argp_option options[] = { + 0, N_("relative subdirectory on network server"), 2}, + {"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2}, + {"debug-image", OPTION_DEBUG_IMAGE, N_("STRING"), OPTION_HIDDEN, 0, 2}, ++ {"debug-efi-netfs", OPTION_DEBUG_EFI_NETFS, 0, OPTION_HIDDEN, 0, 2}, + {0, 0, 0, 0, 0, 0} + }; + +@@ -67,6 +70,9 @@ argp_parser (int key, char *arg, struct argp_state *state) + free (subdir); + subdir = xstrdup (arg); + return 0; ++ case OPTION_DEBUG_EFI_NETFS: ++ efi_netfs = 1; ++ return 0; + /* This is an undocumented feature... */ + case OPTION_DEBUG: + verbosity++; +@@ -82,7 +88,6 @@ argp_parser (int key, char *arg, struct argp_state *state) + } + } + +- + struct argp argp = { + options, argp_parser, NULL, + "\v"N_("Prepares GRUB network boot images at net_directory/subdir " +@@ -92,7 +97,7 @@ struct argp argp = { + + static char *base; + +-static const struct ++static struct + { + const char *mkimage_target; + const char *netmodule; +@@ -154,6 +159,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) + grub_install_push_module (targets[platform].netmodule); + + output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); ++ + grub_install_make_image_wrap (input_dir, prefix, output, + 0, load_cfg, + targets[platform].mkimage_target, 0); +@@ -190,7 +196,16 @@ main (int argc, char *argv[]) + + grub_install_mkdir_p (base); + +- grub_install_push_module ("tftp"); ++ if (!efi_netfs) ++ { ++ grub_install_push_module ("tftp"); ++ grub_install_push_module ("http"); ++ } ++ else ++ { ++ targets[GRUB_INSTALL_PLATFORM_I386_EFI].netmodule = "efi_netfs"; ++ targets[GRUB_INSTALL_PLATFORM_X86_64_EFI].netmodule = "efi_netfs"; ++ } + + if (!grub_install_source_directory) + { +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 48302449170..2af2ae9873d 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -593,6 +593,11 @@ typedef grub_efi_uintn_t grub_efi_tpl_t; + typedef grub_efi_uint8_t grub_efi_mac_address_t[32]; + typedef grub_efi_uint8_t grub_efi_ipv4_address_t[4]; + typedef grub_efi_uint8_t grub_efi_ipv6_address_t[16]; ++ ++typedef grub_efi_mac_address_t grub_efi_pxe_mac_address_t; ++typedef grub_efi_ipv4_address_t grub_efi_pxe_ipv4_address_t; ++typedef grub_efi_ipv6_address_t grub_efi_pxe_ipv6_address_t; ++ + typedef union + { + grub_efi_uint32_t addr[4]; +@@ -600,6 +605,8 @@ typedef union + grub_efi_ipv6_address_t v6; + } grub_efi_ip_address_t __attribute__ ((aligned(4))); + ++typedef grub_efi_ip_address_t grub_efi_pxe_ip_address_t; ++ + typedef grub_efi_uint64_t grub_efi_physical_address_t; + typedef grub_efi_uint64_t grub_efi_virtual_address_t; + +@@ -869,6 +876,8 @@ struct grub_efi_ipv6_device_path + grub_efi_uint16_t remote_port; + grub_efi_uint16_t protocol; + grub_efi_uint8_t static_ip_address; ++ grub_efi_uint8_t prefix_length; ++ grub_efi_ipv6_address_t gateway_ip_address; + } GRUB_PACKED; + typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; + +@@ -918,6 +927,15 @@ struct grub_efi_uri_device_path + } GRUB_PACKED; + typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; + ++#define GRUB_EFI_DNS_DEVICE_PATH_SUBTYPE 31 ++struct grub_efi_dns_device_path ++{ ++ grub_efi_device_path_t header; ++ grub_efi_uint8_t is_ipv6; ++ grub_efi_pxe_ip_address_t dns_server_ip[0]; ++} GRUB_PACKED; ++typedef struct grub_efi_dns_device_path grub_efi_dns_device_path_t; ++ + #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 + + /* Media Device Path. */ +@@ -1000,6 +1018,23 @@ struct grub_efi_bios_device_path + } GRUB_PACKED; + typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; + ++/* Service Binding definitions */ ++struct grub_efi_service_binding; ++ ++typedef grub_efi_status_t ++(*grub_efi_service_binding_create_child) (struct grub_efi_service_binding *this, ++ grub_efi_handle_t *child_handle); ++ ++typedef grub_efi_status_t ++(*grub_efi_service_binding_destroy_child) (struct grub_efi_service_binding *this, ++ grub_efi_handle_t *child_handle); ++ ++typedef struct grub_efi_service_binding ++{ ++ grub_efi_service_binding_create_child create_child; ++ grub_efi_service_binding_destroy_child destroy_child; ++} grub_efi_service_binding_t; ++ + struct grub_efi_open_protocol_information_entry + { + grub_efi_handle_t agent_handle; +@@ -1542,6 +1577,29 @@ typedef struct grub_efi_pxe_arp_entry + grub_efi_mac_address_t mac_addr; + } grub_efi_pxe_arp_entry_t; + ++typedef grub_efi_uint16_t grub_efi_pxe_base_code_udp_port_t; ++ ++typedef enum { ++ GRUB_EFI_PXE_BASE_CODE_TFTP_FIRST, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, ++ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY, ++ GRUB_EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE, ++ GRUB_EFI_PXE_BASE_CODE_MTFTP_READ_FILE, ++ GRUB_EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, ++ GRUB_EFI_PXE_BASE_CODE_MTFTP_LAST ++} grub_efi_pxe_base_code_tftp_opcode_t; ++ ++ ++typedef struct { ++ grub_efi_ip_address_t mcast_ip; ++ grub_efi_pxe_base_code_udp_port_t c_port; ++ grub_efi_pxe_base_code_udp_port_t s_port; ++ grub_efi_uint16_t listen_timeout; ++ grub_efi_uint16_t transmit_timeout; ++} grub_efi_pxe_base_code_mtftp_info_t; ++ + typedef struct grub_efi_pxe_route_entry + { + grub_efi_ip_address_t ip_addr; +@@ -1615,17 +1673,31 @@ typedef struct grub_efi_pxe_mode + typedef struct grub_efi_pxe + { + grub_uint64_t rev; +- void (*start) (void); ++ grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); + void (*stop) (void); +- void (*dhcp) (void); ++ grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this, ++ grub_efi_boolean_t sort_offers); + void (*discover) (void); +- void (*mftp) (void); ++ grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this, ++ grub_efi_pxe_base_code_tftp_opcode_t operation, ++ void *buffer_ptr, ++ grub_efi_boolean_t overwrite, ++ grub_efi_uint64_t *buffer_size, ++ grub_efi_uintn_t *block_size, ++ grub_efi_pxe_ip_address_t *server_ip, ++ //grub_efi_ip_address_t *server_ip, ++ grub_efi_char8_t *filename, ++ grub_efi_pxe_base_code_mtftp_info_t *info, ++ grub_efi_boolean_t dont_use_buffer); + void (*udpwrite) (void); + void (*udpread) (void); + void (*setipfilter) (void); + void (*arp) (void); + void (*setparams) (void); +- void (*setstationip) (void); ++ grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this, ++ grub_efi_pxe_ip_address_t *new_station_ip, ++ grub_efi_pxe_ip_address_t *new_subnet_mask); ++ //void (*setstationip) (void); + void (*setpackets) (void); + struct grub_efi_pxe_mode *mode; + } grub_efi_pxe_t; +@@ -1867,6 +1939,44 @@ struct grub_efi_ip4_config2_protocol + }; + typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; + ++struct grub_efi_ip4_route_table { ++ grub_efi_ipv4_address_t subnet_address; ++ grub_efi_ipv4_address_t subnet_mask; ++ grub_efi_ipv4_address_t gateway_address; ++}; ++ ++typedef struct grub_efi_ip4_route_table grub_efi_ip4_route_table_t; ++ ++#define GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32 ++ ++struct grub_efi_ip4_config2_interface_info { ++ grub_efi_char16_t name[GRUB_EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]; ++ grub_efi_uint8_t if_type; ++ grub_efi_uint32_t hw_address_size; ++ grub_efi_mac_address_t hw_address; ++ grub_efi_ipv4_address_t station_address; ++ grub_efi_ipv4_address_t subnet_mask; ++ grub_efi_uint32_t route_table_size; ++ grub_efi_ip4_route_table_t *route_table; ++}; ++ ++typedef struct grub_efi_ip4_config2_interface_info grub_efi_ip4_config2_interface_info_t; ++ ++enum grub_efi_ip4_config2_policy { ++ GRUB_EFI_IP4_CONFIG2_POLICY_STATIC, ++ GRUB_EFI_IP4_CONFIG2_POLICY_DHCP, ++ GRUB_EFI_IP4_CONFIG2_POLICY_MAX ++}; ++ ++typedef enum grub_efi_ip4_config2_policy grub_efi_ip4_config2_policy_t; ++ ++struct grub_efi_ip4_config2_manual_address { ++ grub_efi_ipv4_address_t address; ++ grub_efi_ipv4_address_t subnet_mask; ++}; ++ ++typedef struct grub_efi_ip4_config2_manual_address grub_efi_ip4_config2_manual_address_t; ++ + enum grub_efi_ip6_config_data_type { + GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, +@@ -1901,6 +2011,49 @@ struct grub_efi_ip6_config_protocol + }; + typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; + ++enum grub_efi_ip6_config_policy { ++ GRUB_EFI_IP6_CONFIG_POLICY_MANUAL, ++ GRUB_EFI_IP6_CONFIG_POLICY_AUTOMATIC ++}; ++typedef enum grub_efi_ip6_config_policy grub_efi_ip6_config_policy_t; ++ ++struct grub_efi_ip6_address_info { ++ grub_efi_ipv6_address_t address; ++ grub_efi_uint8_t prefix_length; ++}; ++typedef struct grub_efi_ip6_address_info grub_efi_ip6_address_info_t; ++ ++struct grub_efi_ip6_route_table { ++ grub_efi_pxe_ipv6_address_t gateway; ++ grub_efi_pxe_ipv6_address_t destination; ++ grub_efi_uint8_t prefix_length; ++}; ++typedef struct grub_efi_ip6_route_table grub_efi_ip6_route_table_t; ++ ++struct grub_efi_ip6_config_interface_info { ++ grub_efi_char16_t name[32]; ++ grub_efi_uint8_t if_type; ++ grub_efi_uint32_t hw_address_size; ++ grub_efi_mac_address_t hw_address; ++ grub_efi_uint32_t address_info_count; ++ grub_efi_ip6_address_info_t *address_info; ++ grub_efi_uint32_t route_count; ++ grub_efi_ip6_route_table_t *route_table; ++}; ++typedef struct grub_efi_ip6_config_interface_info grub_efi_ip6_config_interface_info_t; ++ ++struct grub_efi_ip6_config_dup_addr_detect_transmits { ++ grub_efi_uint32_t dup_addr_detect_transmits; ++}; ++typedef struct grub_efi_ip6_config_dup_addr_detect_transmits grub_efi_ip6_config_dup_addr_detect_transmits_t; ++ ++struct grub_efi_ip6_config_manual_address { ++ grub_efi_ipv6_address_t address; ++ grub_efi_boolean_t is_anycast; ++ grub_efi_uint8_t prefix_length; ++}; ++typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; ++ + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) + +diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h +new file mode 100644 +index 00000000000..fdb88eb810e +--- /dev/null ++++ b/include/grub/efi/dhcp.h +@@ -0,0 +1,343 @@ ++#ifndef GRUB_EFI_DHCP_HEADER ++#define GRUB_EFI_DHCP_HEADER 1 ++ ++#define GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \ ++ { 0x9d9a39d8, 0xbd42, 0x4a73, \ ++ { 0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \ ++ } ++ ++#define GRUB_EFI_DHCP4_PROTOCOL_GUID \ ++ { 0x8a219718, 0x4ef5, 0x4761, \ ++ { 0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \ ++ } ++ ++#define GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \ ++ { 0x9fb9a8a1, 0x2f4a, 0x43a6, \ ++ { 0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4 ,0x7a, 0xd5 } \ ++ } ++ ++#define GRUB_EFI_DHCP6_PROTOCOL_GUID \ ++ { 0x87c8bad7, 0x595, 0x4053, \ ++ { 0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b } \ ++ } ++ ++typedef struct grub_efi_dhcp4_protocol grub_efi_dhcp4_protocol_t; ++ ++enum grub_efi_dhcp4_state { ++ GRUB_EFI_DHCP4_STOPPED, ++ GRUB_EFI_DHCP4_INIT, ++ GRUB_EFI_DHCP4_SELECTING, ++ GRUB_EFI_DHCP4_REQUESTING, ++ GRUB_EFI_DHCP4_BOUND, ++ GRUB_EFI_DHCP4_RENEWING, ++ GRUB_EFI_DHCP4_REBINDING, ++ GRUB_EFI_DHCP4_INIT_REBOOT, ++ GRUB_EFI_DHCP4_REBOOTING ++}; ++ ++typedef enum grub_efi_dhcp4_state grub_efi_dhcp4_state_t; ++ ++struct grub_efi_dhcp4_header { ++ grub_efi_uint8_t op_code; ++ grub_efi_uint8_t hw_type; ++ grub_efi_uint8_t hw_addr_len; ++ grub_efi_uint8_t hops; ++ grub_efi_uint32_t xid; ++ grub_efi_uint16_t seconds; ++ grub_efi_uint16_t reserved; ++ grub_efi_ipv4_address_t client_addr; ++ grub_efi_ipv4_address_t your_addr; ++ grub_efi_ipv4_address_t server_addr; ++ grub_efi_ipv4_address_t gateway_addr; ++ grub_efi_uint8_t client_hw_addr[16]; ++ grub_efi_char8_t server_name[64]; ++ grub_efi_char8_t boot_file_name[128]; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp4_header grub_efi_dhcp4_header_t; ++ ++struct grub_efi_dhcp4_packet { ++ grub_efi_uint32_t size; ++ grub_efi_uint32_t length; ++ struct { ++ grub_efi_dhcp4_header_t header; ++ grub_efi_uint32_t magik; ++ grub_efi_uint8_t option[1]; ++ } dhcp4; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp4_packet grub_efi_dhcp4_packet_t; ++ ++struct grub_efi_dhcp4_listen_point { ++ grub_efi_ipv4_address_t listen_address; ++ grub_efi_ipv4_address_t subnet_mask; ++ grub_efi_uint16_t listen_port; ++}; ++ ++typedef struct grub_efi_dhcp4_listen_point grub_efi_dhcp4_listen_point_t; ++ ++struct grub_efi_dhcp4_transmit_receive_token { ++ grub_efi_status_t status; ++ grub_efi_event_t completion_event; ++ grub_efi_ipv4_address_t remote_address; ++ grub_efi_uint16_t remote_port; ++ grub_efi_ipv4_address_t gateway_address; ++ grub_efi_uint32_t listen_point_count; ++ grub_efi_dhcp4_listen_point_t *listen_points; ++ grub_efi_uint32_t timeout_value; ++ grub_efi_dhcp4_packet_t *packet; ++ grub_efi_uint32_t response_count; ++ grub_efi_dhcp4_packet_t *response_list; ++}; ++ ++typedef struct grub_efi_dhcp4_transmit_receive_token grub_efi_dhcp4_transmit_receive_token_t; ++ ++enum grub_efi_dhcp4_event { ++ GRUB_EFI_DHCP4_SEND_DISCOVER = 0X01, ++ GRUB_EFI_DHCP4_RCVD_OFFER, ++ GRUB_EFI_DHCP4_SELECT_OFFER, ++ GRUB_EFI_DHCP4_SEND_REQUEST, ++ GRUB_EFI_DHCP4_RCVD_ACK, ++ GRUB_EFI_DHCP4_RCVD_NAK, ++ GRUB_EFI_DHCP4_SEND_DECLINE, ++ GRUB_EFI_DHCP4_BOUND_COMPLETED, ++ GRUB_EFI_DHCP4_ENTER_RENEWING, ++ GRUB_EFI_DHCP4_ENTER_REBINDING, ++ GRUB_EFI_DHCP4_ADDRESS_LOST, ++ GRUB_EFI_DHCP4_FAIL ++}; ++ ++typedef enum grub_efi_dhcp4_event grub_efi_dhcp4_event_t; ++ ++struct grub_efi_dhcp4_packet_option { ++ grub_efi_uint8_t op_code; ++ grub_efi_uint8_t length; ++ grub_efi_uint8_t data[1]; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp4_packet_option grub_efi_dhcp4_packet_option_t; ++ ++struct grub_efi_dhcp4_config_data { ++ grub_efi_uint32_t discover_try_count; ++ grub_efi_uint32_t *discover_timeout; ++ grub_efi_uint32_t request_try_count; ++ grub_efi_uint32_t *request_timeout; ++ grub_efi_ipv4_address_t client_address; ++ grub_efi_status_t (*dhcp4_callback) ( ++ grub_efi_dhcp4_protocol_t *this, ++ void *context, ++ grub_efi_dhcp4_state_t current_state, ++ grub_efi_dhcp4_event_t dhcp4_event, ++ grub_efi_dhcp4_packet_t *packet, ++ grub_efi_dhcp4_packet_t **new_packet ++ ); ++ void *callback_context; ++ grub_efi_uint32_t option_count; ++ grub_efi_dhcp4_packet_option_t **option_list; ++}; ++ ++typedef struct grub_efi_dhcp4_config_data grub_efi_dhcp4_config_data_t; ++ ++struct grub_efi_dhcp4_mode_data { ++ grub_efi_dhcp4_state_t state; ++ grub_efi_dhcp4_config_data_t config_data; ++ grub_efi_ipv4_address_t client_address; ++ grub_efi_mac_address_t client_mac_address; ++ grub_efi_ipv4_address_t server_address; ++ grub_efi_ipv4_address_t router_address; ++ grub_efi_ipv4_address_t subnet_mask; ++ grub_efi_uint32_t lease_time; ++ grub_efi_dhcp4_packet_t *reply_packet; ++}; ++ ++typedef struct grub_efi_dhcp4_mode_data grub_efi_dhcp4_mode_data_t; ++ ++struct grub_efi_dhcp4_protocol { ++ grub_efi_status_t (*get_mode_data) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_dhcp4_mode_data_t *dhcp4_mode_data); ++ grub_efi_status_t (*configure) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_dhcp4_config_data_t *dhcp4_cfg_data); ++ grub_efi_status_t (*start) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_event_t completion_event); ++ grub_efi_status_t (*renew_rebind) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_boolean_t rebind_request, ++ grub_efi_event_t completion_event); ++ grub_efi_status_t (*release) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (*stop) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (*build) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_dhcp4_packet_t *seed_packet, ++ grub_efi_uint32_t delete_count, ++ grub_efi_uint8_t *delete_list, ++ grub_efi_uint32_t append_count, ++ grub_efi_dhcp4_packet_option_t *append_list[], ++ grub_efi_dhcp4_packet_t **new_packet); ++ grub_efi_status_t (*transmit_receive) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_dhcp4_transmit_receive_token_t *token); ++ grub_efi_status_t (*parse) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_dhcp4_packet_t *packet, ++ grub_efi_uint32_t *option_count, ++ grub_efi_dhcp4_packet_option_t *packet_option_list[]); ++}; ++ ++typedef struct grub_efi_dhcp6_protocol grub_efi_dhcp6_protocol_t; ++ ++struct grub_efi_dhcp6_retransmission { ++ grub_efi_uint32_t irt; ++ grub_efi_uint32_t mrc; ++ grub_efi_uint32_t mrt; ++ grub_efi_uint32_t mrd; ++}; ++ ++typedef struct grub_efi_dhcp6_retransmission grub_efi_dhcp6_retransmission_t; ++ ++enum grub_efi_dhcp6_event { ++ GRUB_EFI_DHCP6_SEND_SOLICIT, ++ GRUB_EFI_DHCP6_RCVD_ADVERTISE, ++ GRUB_EFI_DHCP6_SELECT_ADVERTISE, ++ GRUB_EFI_DHCP6_SEND_REQUEST, ++ GRUB_EFI_DHCP6_RCVD_REPLY, ++ GRUB_EFI_DHCP6_RCVD_RECONFIGURE, ++ GRUB_EFI_DHCP6_SEND_DECLINE, ++ GRUB_EFI_DHCP6_SEND_CONFIRM, ++ GRUB_EFI_DHCP6_SEND_RELEASE, ++ GRUB_EFI_DHCP6_SEND_RENEW, ++ GRUB_EFI_DHCP6_SEND_REBIND ++}; ++ ++typedef enum grub_efi_dhcp6_event grub_efi_dhcp6_event_t; ++ ++struct grub_efi_dhcp6_packet_option { ++ grub_efi_uint16_t op_code; ++ grub_efi_uint16_t op_len; ++ grub_efi_uint8_t data[1]; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp6_packet_option grub_efi_dhcp6_packet_option_t; ++ ++struct grub_efi_dhcp6_header { ++ grub_efi_uint32_t transaction_id:24; ++ grub_efi_uint32_t message_type:8; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp6_header grub_efi_dhcp6_header_t; ++ ++struct grub_efi_dhcp6_packet { ++ grub_efi_uint32_t size; ++ grub_efi_uint32_t length; ++ struct { ++ grub_efi_dhcp6_header_t header; ++ grub_efi_uint8_t option[1]; ++ } dhcp6; ++} GRUB_PACKED; ++ ++typedef struct grub_efi_dhcp6_packet grub_efi_dhcp6_packet_t; ++ ++struct grub_efi_dhcp6_ia_address { ++ grub_efi_ipv6_address_t ip_address; ++ grub_efi_uint32_t preferred_lifetime; ++ grub_efi_uint32_t valid_lifetime; ++}; ++ ++typedef struct grub_efi_dhcp6_ia_address grub_efi_dhcp6_ia_address_t; ++ ++enum grub_efi_dhcp6_state { ++ GRUB_EFI_DHCP6_INIT, ++ GRUB_EFI_DHCP6_SELECTING, ++ GRUB_EFI_DHCP6_REQUESTING, ++ GRUB_EFI_DHCP6_DECLINING, ++ GRUB_EFI_DHCP6_CONFIRMING, ++ GRUB_EFI_DHCP6_RELEASING, ++ GRUB_EFI_DHCP6_BOUND, ++ GRUB_EFI_DHCP6_RENEWING, ++ GRUB_EFI_DHCP6_REBINDING ++}; ++ ++typedef enum grub_efi_dhcp6_state grub_efi_dhcp6_state_t; ++ ++#define GRUB_EFI_DHCP6_IA_TYPE_NA 3 ++#define GRUB_EFI_DHCP6_IA_TYPE_TA 4 ++ ++struct grub_efi_dhcp6_ia_descriptor { ++ grub_efi_uint16_t type; ++ grub_efi_uint32_t ia_id; ++}; ++ ++typedef struct grub_efi_dhcp6_ia_descriptor grub_efi_dhcp6_ia_descriptor_t; ++ ++struct grub_efi_dhcp6_ia { ++ grub_efi_dhcp6_ia_descriptor_t descriptor; ++ grub_efi_dhcp6_state_t state; ++ grub_efi_dhcp6_packet_t *reply_packet; ++ grub_efi_uint32_t ia_address_count; ++ grub_efi_dhcp6_ia_address_t ia_address[1]; ++}; ++ ++typedef struct grub_efi_dhcp6_ia grub_efi_dhcp6_ia_t; ++ ++struct grub_efi_dhcp6_duid { ++ grub_efi_uint16_t length; ++ grub_efi_uint8_t duid[1]; ++}; ++ ++typedef struct grub_efi_dhcp6_duid grub_efi_dhcp6_duid_t; ++ ++struct grub_efi_dhcp6_mode_data { ++ grub_efi_dhcp6_duid_t *client_id; ++ grub_efi_dhcp6_ia_t *ia; ++}; ++ ++typedef struct grub_efi_dhcp6_mode_data grub_efi_dhcp6_mode_data_t; ++ ++struct grub_efi_dhcp6_config_data { ++ grub_efi_status_t (*dhcp6_callback) (grub_efi_dhcp6_protocol_t this, ++ void *context, ++ grub_efi_dhcp6_state_t current_state, ++ grub_efi_dhcp6_event_t dhcp6_event, ++ grub_efi_dhcp6_packet_t *packet, ++ grub_efi_dhcp6_packet_t **new_packet); ++ void *callback_context; ++ grub_efi_uint32_t option_count; ++ grub_efi_dhcp6_packet_option_t **option_list; ++ grub_efi_dhcp6_ia_descriptor_t ia_descriptor; ++ grub_efi_event_t ia_info_event; ++ grub_efi_boolean_t reconfigure_accept; ++ grub_efi_boolean_t rapid_commit; ++ grub_efi_dhcp6_retransmission_t *solicit_retransmission; ++}; ++ ++typedef struct grub_efi_dhcp6_config_data grub_efi_dhcp6_config_data_t; ++ ++struct grub_efi_dhcp6_protocol { ++ grub_efi_status_t (*get_mode_data) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_dhcp6_mode_data_t *dhcp6_mode_data, ++ grub_efi_dhcp6_config_data_t *dhcp6_config_data); ++ grub_efi_status_t (*configure) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_dhcp6_config_data_t *dhcp6_cfg_data); ++ grub_efi_status_t (*start) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (*info_request) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_boolean_t send_client_id, ++ grub_efi_dhcp6_packet_option_t *option_request, ++ grub_efi_uint32_t option_count, ++ grub_efi_dhcp6_packet_option_t *option_list[], ++ grub_efi_dhcp6_retransmission_t *retransmission, ++ grub_efi_event_t timeout_event, ++ grub_efi_status_t (*reply_callback) (grub_efi_dhcp6_protocol_t *this, ++ void *context, ++ grub_efi_dhcp6_packet_t *packet), ++ void *callback_context); ++ grub_efi_status_t (*renew_rebind) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_boolean_t rebind_request); ++ grub_efi_status_t (*decline) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_uint32_t address_count, ++ grub_efi_ipv6_address_t *addresses); ++ grub_efi_status_t (*release) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_uint32_t address_count, ++ grub_efi_ipv6_address_t *addresses); ++ grub_efi_status_t (*stop) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (*parse) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_dhcp6_packet_t *packet, ++ grub_efi_uint32_t *option_count, ++ grub_efi_dhcp6_packet_option_t *packet_option_list[]); ++}; ++ ++#endif /* ! GRUB_EFI_DHCP_HEADER */ +diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h +new file mode 100644 +index 00000000000..c5e9a89f505 +--- /dev/null ++++ b/include/grub/efi/http.h +@@ -0,0 +1,215 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#ifndef GRUB_EFI_HTTP_HEADER ++#define GRUB_EFI_HTTP_HEADER 1 ++ ++#include ++#include ++#include ++ ++#define GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \ ++ { 0xbdc8e6af, 0xd9bc, 0x4379, \ ++ { 0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \ ++ } ++ ++#define GRUB_EFI_HTTP_PROTOCOL_GUID \ ++ { 0x7A59B29B, 0x910B, 0x4171, \ ++ { 0x82, 0x42, 0xA8, 0x5A, 0x0D, 0xF2, 0x5B, 0x5B } \ ++ } ++ ++#define EFIHTTP_WAIT_TIME 10000 // 10000ms = 10s ++#define EFIHTTP_RX_BUF_LEN 10240 ++ ++//****************************************** ++// Protocol Interface Structure ++//****************************************** ++struct grub_efi_http; ++ ++//****************************************** ++// EFI_HTTP_VERSION ++//****************************************** ++typedef enum { ++ GRUB_EFI_HTTPVERSION10, ++ GRUB_EFI_HTTPVERSION11, ++ GRUB_EFI_HTTPVERSIONUNSUPPORTED ++} grub_efi_http_version_t; ++ ++//****************************************** ++// EFI_HTTPv4_ACCESS_POINT ++//****************************************** ++typedef struct { ++ grub_efi_boolean_t use_default_address; ++ grub_efi_ipv4_address_t local_address; ++ grub_efi_ipv4_address_t local_subnet; ++ grub_efi_uint16_t local_port; ++} grub_efi_httpv4_access_point_t; ++ ++//****************************************** ++// EFI_HTTPv6_ACCESS_POINT ++//****************************************** ++typedef struct { ++ grub_efi_ipv6_address_t local_address; ++ grub_efi_uint16_t local_port; ++} grub_efi_httpv6_access_point_t; ++ ++//****************************************** ++// EFI_HTTP_CONFIG_DATA ++//****************************************** ++typedef struct { ++ grub_efi_http_version_t http_version; ++ grub_efi_uint32_t timeout_millisec; ++ grub_efi_boolean_t local_address_is_ipv6; ++ union { ++ grub_efi_httpv4_access_point_t *ipv4_node; ++ grub_efi_httpv6_access_point_t *ipv6_node; ++ } access_point; ++} grub_efi_http_config_data_t; ++ ++//****************************************** ++// EFI_HTTP_METHOD ++//****************************************** ++typedef enum { ++ GRUB_EFI_HTTPMETHODGET, ++ GRUB_EFI_HTTPMETHODPOST, ++ GRUB_EFI_HTTPMETHODPATCH, ++ GRUB_EFI_HTTPMETHODOPTIONS, ++ GRUB_EFI_HTTPMETHODCONNECT, ++ GRUB_EFI_HTTPMETHODHEAD, ++ GRUB_EFI_HTTPMETHODPUT, ++ GRUB_EFI_HTTPMETHODDELETE, ++ GRUB_EFI_HTTPMETHODTRACE, ++} grub_efi_http_method_t; ++ ++//****************************************** ++// EFI_HTTP_REQUEST_DATA ++//****************************************** ++typedef struct { ++ grub_efi_http_method_t method; ++ grub_efi_char16_t *url; ++} grub_efi_http_request_data_t; ++ ++typedef enum { ++ GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS = 0, ++ GRUB_EFI_HTTP_STATUS_100_CONTINUE, ++ GRUB_EFI_HTTP_STATUS_101_SWITCHING_PROTOCOLS, ++ GRUB_EFI_HTTP_STATUS_200_OK, ++ GRUB_EFI_HTTP_STATUS_201_CREATED, ++ GRUB_EFI_HTTP_STATUS_202_ACCEPTED, ++ GRUB_EFI_HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION, ++ GRUB_EFI_HTTP_STATUS_204_NO_CONTENT, ++ GRUB_EFI_HTTP_STATUS_205_RESET_CONTENT, ++ GRUB_EFI_HTTP_STATUS_206_PARTIAL_CONTENT, ++ GRUB_EFI_HTTP_STATUS_300_MULTIPLE_CHIOCES, ++ GRUB_EFI_HTTP_STATUS_301_MOVED_PERMANENTLY, ++ GRUB_EFI_HTTP_STATUS_302_FOUND, ++ GRUB_EFI_HTTP_STATUS_303_SEE_OTHER, ++ GRUB_EFI_HTTP_STATUS_304_NOT_MODIFIED, ++ GRUB_EFI_HTTP_STATUS_305_USE_PROXY, ++ GRUB_EFI_HTTP_STATUS_307_TEMPORARY_REDIRECT, ++ GRUB_EFI_HTTP_STATUS_400_BAD_REQUEST, ++ GRUB_EFI_HTTP_STATUS_401_UNAUTHORIZED, ++ GRUB_EFI_HTTP_STATUS_402_PAYMENT_REQUIRED, ++ GRUB_EFI_HTTP_STATUS_403_FORBIDDEN, ++ GRUB_EFI_HTTP_STATUS_404_NOT_FOUND, ++ GRUB_EFI_HTTP_STATUS_405_METHOD_NOT_ALLOWED, ++ GRUB_EFI_HTTP_STATUS_406_NOT_ACCEPTABLE, ++ GRUB_EFI_HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED, ++ GRUB_EFI_HTTP_STATUS_408_REQUEST_TIME_OUT, ++ GRUB_EFI_HTTP_STATUS_409_CONFLICT, ++ GRUB_EFI_HTTP_STATUS_410_GONE, ++ GRUB_EFI_HTTP_STATUS_411_LENGTH_REQUIRED, ++ GRUB_EFI_HTTP_STATUS_412_PRECONDITION_FAILED, ++ GRUB_EFI_HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE, ++ GRUB_EFI_HTTP_STATUS_414_REQUEST_URI_TOO_LARGE, ++ GRUB_EFI_HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE, ++ GRUB_EFI_HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED, ++ GRUB_EFI_HTTP_STATUS_417_EXPECTATION_FAILED, ++ GRUB_EFI_HTTP_STATUS_500_INTERNAL_SERVER_ERROR, ++ GRUB_EFI_HTTP_STATUS_501_NOT_IMPLEMENTED, ++ GRUB_EFI_HTTP_STATUS_502_BAD_GATEWAY, ++ GRUB_EFI_HTTP_STATUS_503_SERVICE_UNAVAILABLE, ++ GRUB_EFI_HTTP_STATUS_504_GATEWAY_TIME_OUT, ++ GRUB_EFI_HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED ++} grub_efi_http_status_code_t; ++ ++//****************************************** ++// EFI_HTTP_RESPONSE_DATA ++//****************************************** ++typedef struct { ++ grub_efi_http_status_code_t status_code; ++} grub_efi_http_response_data_t; ++ ++//****************************************** ++// EFI_HTTP_HEADER ++//****************************************** ++typedef struct { ++ grub_efi_char8_t *field_name; ++ grub_efi_char8_t *field_value; ++} grub_efi_http_header_t; ++ ++//****************************************** ++// EFI_HTTP_MESSAGE ++//****************************************** ++typedef struct { ++ union { ++ grub_efi_http_request_data_t *request; ++ grub_efi_http_response_data_t *response; ++ } data; ++ grub_efi_uint32_t header_count; ++ grub_efi_http_header_t *headers; ++ grub_efi_uint32_t body_length; ++ void *body; ++} grub_efi_http_message_t; ++ ++//****************************************** ++// EFI_HTTP_TOKEN ++//****************************************** ++typedef struct { ++ grub_efi_event_t event; ++ grub_efi_status_t status; ++ grub_efi_http_message_t *message; ++} grub_efi_http_token_t; ++ ++struct grub_efi_http { ++ grub_efi_status_t ++ (*get_mode_data) (struct grub_efi_http *this, ++ grub_efi_http_config_data_t *http_config_data); ++ ++ grub_efi_status_t ++ (*configure) (struct grub_efi_http *this, ++ grub_efi_http_config_data_t *http_config_data); ++ ++ grub_efi_status_t ++ (*request) (struct grub_efi_http *this, ++ grub_efi_http_token_t *token); ++ ++ grub_efi_status_t ++ (*cancel) (struct grub_efi_http *this, ++ grub_efi_http_token_t *token); ++ ++ grub_efi_status_t ++ (*response) (struct grub_efi_http *this, ++ grub_efi_http_token_t *token); ++ ++ grub_efi_status_t ++ (*poll) (struct grub_efi_http *this); ++}; ++typedef struct grub_efi_http grub_efi_http_t; ++ ++#endif /* !GRUB_EFI_HTTP_HEADER */ +diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h +new file mode 100644 +index 00000000000..de90d223e8e +--- /dev/null ++++ b/include/grub/net/efi.h +@@ -0,0 +1,144 @@ ++#ifndef GRUB_NET_EFI_HEADER ++#define GRUB_NET_EFI_HEADER 1 ++ ++#include ++#include ++#include ++#include ++ ++typedef struct grub_efi_net_interface grub_efi_net_interface_t; ++typedef struct grub_efi_net_ip_config grub_efi_net_ip_config_t; ++typedef union grub_efi_net_ip_address grub_efi_net_ip_address_t; ++typedef struct grub_efi_net_ip_manual_address grub_efi_net_ip_manual_address_t; ++ ++struct grub_efi_net_interface ++{ ++ char *name; ++ int prefer_ip6; ++ struct grub_efi_net_device *dev; ++ struct grub_efi_net_io *io; ++ grub_efi_net_ip_config_t *ip_config; ++ int io_type; ++ struct grub_efi_net_interface *next; ++}; ++ ++#define efi_net_interface_get_hw_address(inf) inf->ip_config->get_hw_address (inf->dev) ++#define efi_net_interface_get_address(inf) inf->ip_config->get_address (inf->dev) ++#define efi_net_interface_get_route_table(inf) inf->ip_config->get_route_table (inf->dev) ++#define efi_net_interface_set_address(inf, addr, with_subnet) inf->ip_config->set_address (inf->dev, addr, with_subnet) ++#define efi_net_interface_set_gateway(inf, addr) inf->ip_config->set_gateway (inf->dev, addr) ++#define efi_net_interface_set_dns(inf, addr) inf->ip_config->set_dns (inf->dev, addr) ++ ++struct grub_efi_net_ip_config ++{ ++ char * (*get_hw_address) (struct grub_efi_net_device *dev); ++ char * (*get_address) (struct grub_efi_net_device *dev); ++ char ** (*get_route_table) (struct grub_efi_net_device *dev); ++ grub_efi_net_interface_t * (*best_interface) (struct grub_efi_net_device *dev, grub_efi_net_ip_address_t *address); ++ int (*set_address) (struct grub_efi_net_device *dev, grub_efi_net_ip_manual_address_t *net_ip, int with_subnet); ++ int (*set_gateway) (struct grub_efi_net_device *dev, grub_efi_net_ip_address_t *address); ++ int (*set_dns) (struct grub_efi_net_device *dev, grub_efi_net_ip_address_t *dns); ++}; ++ ++union grub_efi_net_ip_address ++{ ++ grub_efi_ipv4_address_t ip4; ++ grub_efi_ipv6_address_t ip6; ++}; ++ ++struct grub_efi_net_ip_manual_address ++{ ++ int is_ip6; ++ union ++ { ++ grub_efi_ip4_config2_manual_address_t ip4; ++ grub_efi_ip6_config_manual_address_t ip6; ++ }; ++}; ++ ++struct grub_efi_net_device ++{ ++ grub_efi_handle_t handle; ++ grub_efi_ip4_config2_protocol_t *ip4_config; ++ grub_efi_ip6_config_protocol_t *ip6_config; ++ grub_efi_handle_t http_handle; ++ grub_efi_http_t *http; ++ grub_efi_handle_t ip4_pxe_handle; ++ grub_efi_pxe_t *ip4_pxe; ++ grub_efi_handle_t ip6_pxe_handle; ++ grub_efi_pxe_t *ip6_pxe; ++ grub_efi_handle_t dhcp4_handle; ++ grub_efi_dhcp4_protocol_t *dhcp4; ++ grub_efi_handle_t dhcp6_handle; ++ grub_efi_dhcp6_protocol_t *dhcp6; ++ char *card_name; ++ grub_efi_net_interface_t *net_interfaces; ++ struct grub_efi_net_device *next; ++}; ++ ++struct grub_efi_net_io ++{ ++ void (*configure) (struct grub_efi_net_device *dev, int prefer_ip6); ++ grub_err_t (*open) (struct grub_efi_net_device *dev, ++ int prefer_ip6, ++ grub_file_t file, ++ const char *filename, ++ int type); ++ grub_ssize_t (*read) (struct grub_efi_net_device *dev, ++ int prefer_ip6, ++ grub_file_t file, ++ char *buf, ++ grub_size_t len); ++ grub_err_t (*close) (struct grub_efi_net_device *dev, ++ int prefer_ip6, ++ grub_file_t file); ++}; ++ ++extern struct grub_efi_net_device *net_devices; ++ ++extern struct grub_efi_net_io io_http; ++extern struct grub_efi_net_io io_pxe; ++ ++extern grub_efi_net_ip_config_t *efi_net_ip4_config; ++extern grub_efi_net_ip_config_t *efi_net_ip6_config; ++ ++char * ++grub_efi_ip4_address_to_string (grub_efi_ipv4_address_t *address); ++ ++char * ++grub_efi_ip6_address_to_string (grub_efi_pxe_ipv6_address_t *address); ++ ++char * ++grub_efi_hw_address_to_string (grub_efi_uint32_t hw_address_size, grub_efi_mac_address_t hw_address); ++ ++int ++grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *address, const char **rest); ++ ++int ++grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *address, const char **rest); ++ ++char * ++grub_efi_ip6_interface_name (struct grub_efi_net_device *dev); ++ ++char * ++grub_efi_ip4_interface_name (struct grub_efi_net_device *dev); ++ ++grub_efi_net_interface_t * ++grub_efi_net_create_interface (struct grub_efi_net_device *dev, ++ const char *interface_name, ++ grub_efi_net_ip_manual_address_t *net_ip, ++ int has_subnet); ++ ++int grub_efi_net_fs_init (void); ++void grub_efi_net_fs_fini (void); ++int grub_efi_net_boot_from_https (void); ++int grub_efi_net_boot_from_opa (void); ++ ++extern grub_command_func_t grub_efi_net_list_routes; ++extern grub_command_func_t grub_efi_net_list_cards; ++extern grub_command_func_t grub_efi_net_list_addrs; ++extern grub_command_func_t grub_efi_net_add_addr; ++extern grub_command_func_t grub_efi_net_bootp; ++extern grub_command_func_t grub_efi_net_bootp6; ++ ++#endif /* ! GRUB_NET_EFI_HEADER */ +-- +2.14.3 + diff --git a/0248-AUDIT-0-http-boot-tracker-bug.patch b/0248-AUDIT-0-http-boot-tracker-bug.patch new file mode 100644 index 0000000..5c4dd4e --- /dev/null +++ b/0248-AUDIT-0-http-boot-tracker-bug.patch @@ -0,0 +1,65 @@ +From d7e857c8a02ae15a940faacc6e8b688cc590c4d7 Mon Sep 17 00:00:00 2001 +From: Sebastian Krahmer +Date: Tue, 28 Nov 2017 17:24:38 +0800 +Subject: [PATCH 248/250] AUDIT-0: http boot tracker bug + +Fixing a memory leak in case of error, and a integer overflow, leading to a +heap overflow due to overly large chunk sizes. + +We need to check against some maximum value, otherwise values like 0xffffffff +will eventually lead in the allocation functions to small sized buffers, since +the len is rounded up to the next reasonable alignment. The following memcpy +will then smash the heap, leading to RCE. + +This is no big issue for pure http boot, since its going to execute an +untrusted kernel anyway, but it will break trusted boot scenarios, where only +signed code is allowed to be executed. + +Signed-off-by: Michael Chang +--- + grub-core/net/efi/net.c | 4 +++- + grub-core/net/http.c | 5 ++++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +index 9e0078ac1c6..2bf15447fd5 100644 +--- a/grub-core/net/efi/net.c ++++ b/grub-core/net/efi/net.c +@@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, + + rd = efi_net_interface (read, file, chunk, sz); + +- if (rd <= 0) ++ if (rd <= 0) { ++ grub_free (chunk); + return rd; ++ } + + if (buf) + { +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index f182d7b871d..5004ecfee42 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + enum + { +- HTTP_PORT = 80 ++ HTTP_PORT = 80, ++ HTTP_MAX_CHUNK_SIZE = 0x80000000 + }; + + +@@ -78,6 +79,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) + if (data->in_chunk_len == 2) + { + data->chunk_rem = grub_strtoul (ptr, 0, 16); ++ if (data->chunk_rem > HTTP_MAX_CHUNK_SIZE) ++ return GRUB_ERR_NET_PACKET_TOO_BIG; + grub_errno = GRUB_ERR_NONE; + if (data->chunk_rem == 0) + { +-- +2.14.3 + diff --git a/0249-linuxefi-honor-the-linux-and-initrd-names-of-command.patch b/0249-linuxefi-honor-the-linux-and-initrd-names-of-command.patch new file mode 100644 index 0000000..99d221d --- /dev/null +++ b/0249-linuxefi-honor-the-linux-and-initrd-names-of-command.patch @@ -0,0 +1,98 @@ +From d621b18f82c4fe2a903432c3fb811fb9281b0273 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 11 May 2018 10:58:34 -0400 +Subject: [PATCH 249/250] linuxefi: honor the "linux" and "initrd" names of + commands. + +Signed-off-by: Peter Jones +--- + grub-core/commands/blscfg.c | 14 +++----------- + grub-core/loader/i386/efi/linux.c | 14 +++++++++++--- + 2 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 72ee497ea2d..f1f18fefbf2 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -43,14 +43,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define GRUB_BOOT_DEVICE "($root)" + #endif + +-#ifdef GRUB_MACHINE_EFI +-#define GRUB_LINUX_CMD "linuxefi" +-#define GRUB_INITRD_CMD "initrdefi" +-#else +-#define GRUB_LINUX_CMD "linux" +-#define GRUB_INITRD_CMD "initrd" +-#endif +- + enum + { + PLATFORM_EFI, +@@ -631,7 +623,7 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile) + grub_dprintf ("blscfg", "adding menu entry for \"%s\"\n", title); + if (initrds) + { +- int initrd_size = sizeof (GRUB_INITRD_CMD); ++ int initrd_size = sizeof ("linux"); + char *tmp; + + for (i = 0; initrds != NULL && initrds[i] != NULL; i++) +@@ -647,7 +639,7 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile) + } + + +- tmp = grub_stpcpy(initrd, GRUB_INITRD_CMD); ++ tmp = grub_stpcpy(initrd, "linux"); + for (i = 0; initrds != NULL && initrds[i] != NULL; i++) + { + grub_dprintf ("blscfg", "adding initrd %s\n", initrds[i]); +@@ -660,7 +652,7 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile) + src = grub_xasprintf ("load_video\n" + "set gfx_payload=keep\n" + "insmod gzio\n" +- GRUB_LINUX_CMD " %s%s%s%s\n" ++ "linux %s%s%s%s\n" + "%s", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", + initrd ? initrd : ""); +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 6c9268f2ff5..2cdfa8f671c 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -365,16 +365,22 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + } + +-static grub_command_t cmd_linux, cmd_initrd; ++static grub_command_t cmd_linux, cmd_initrd, cmd_linuxefi, cmd_initrdefi; + + GRUB_MOD_INIT(linuxefi) + { +- cmd_linux = ++ cmd_linuxefi = + grub_register_command ("linuxefi", grub_cmd_linux, + 0, N_("Load Linux.")); +- cmd_initrd = ++ cmd_initrdefi = + grub_register_command ("initrdefi", grub_cmd_initrd, + 0, N_("Load initrd.")); ++ cmd_linux = ++ grub_register_command ("linux", grub_cmd_linux, ++ 0, N_("Load Linux.")); ++ cmd_initrd = ++ grub_register_command ("initrd", grub_cmd_initrd, ++ 0, N_("Load initrd.")); + my_mod = mod; + } + +@@ -382,4 +388,6 @@ GRUB_MOD_FINI(linuxefi) + { + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); ++ grub_unregister_command (cmd_linuxefi); ++ grub_unregister_command (cmd_initrdefi); + } +-- +2.14.3 + diff --git a/0250-xfs-accept-filesystem-with-sparse-inodes.patch b/0250-xfs-accept-filesystem-with-sparse-inodes.patch new file mode 100644 index 0000000..bd508e9 --- /dev/null +++ b/0250-xfs-accept-filesystem-with-sparse-inodes.patch @@ -0,0 +1,58 @@ +From d0a896275ec2969f507e6b60c75a4b24c7fd5bd5 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Tue, 15 May 2018 14:55:55 -0500 +Subject: [PATCH 250/250] xfs: accept filesystem with sparse inodes + +The sparse inode metadata format became a mkfs.xfs default in +xfsprogs-4.16.0, and such filesystems are now rejected by grub as +containing an incompatible feature. + +In essence, this feature allows xfs to allocate inodes into fragmented +freespace. (Without this feature, if xfs could not allocate contiguous +space for 64 new inodes, inode creation would fail.) + +In practice, the disk format change is restricted to the inode btree, +which as far as I can tell is not used by grub. If all you're doing +today is parsing a directory, reading an inode number, and converting +that inode number to a disk location, then ignoring this feature +should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED + +I did some brief testing of this patch by hacking up the regression +tests to completely fragment freespace on the test xfs filesystem, and +then write a large-ish number of inodes to consume any existing +contiguous 64-inode chunk. This way any files the grub tests add and +traverse would be in such a fragmented inode allocation. Tests passed, +but I'm not sure how to cleanly integrate that into the test harness. + +Signed-off-by: Eric Sandeen +--- + grub-core/fs/xfs.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 9f66dd6e4c6..d7222b529f5 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ + #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ + +-/* We do not currently verify metadata UUID so it is safe to read such filesystem */ ++/* ++ * Directory entries with ftype are explicitly handled by grub code. ++ * ++ * We do not currently verify metadata UUID, so it is safe to read filesystems ++ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature. ++ * ++ * We do not currently read the inode btrees, so it is safe to read filesystems ++ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature. ++ */ + #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ + (XFS_SB_FEAT_INCOMPAT_FTYPE | \ ++ XFS_SB_FEAT_INCOMPAT_SPINODES | \ + XFS_SB_FEAT_INCOMPAT_META_UUID) + + struct grub_xfs_sblock +-- +2.14.3 + diff --git a/grub.patches b/grub.patches index c1288ff..605f2c6 100644 --- a/grub.patches +++ b/grub.patches @@ -236,3 +236,15 @@ Patch0235: 0235-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch Patch0236: 0236-Include-OSTree-path-when-searching-kernels-images-if.patch Patch0237: 0237-Use-BLS-version-field-to-compare-entries-if-id-field.patch Patch0238: 0238-Add-version-field-to-BLS-generated-by-grub2-switch-t.patch +Patch0239: 0239-Fixup-for-newer-compiler.patch +Patch0240: 0240-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0241: 0241-New-net_bootp6-command-and-UEFI-IPv6-PXE-support.patch +Patch0242: 0242-grub.texi-Add-net_bootp6-doument.patch +Patch0243: 0243-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0244: 0244-efinet-Setting-network-from-UEFI-device-path.patch +Patch0245: 0245-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0246: 0246-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch +Patch0247: 0247-Support-UEFI-networking-protocols.patch +Patch0248: 0248-AUDIT-0-http-boot-tracker-bug.patch +Patch0249: 0249-linuxefi-honor-the-linux-and-initrd-names-of-command.patch +Patch0250: 0250-xfs-accept-filesystem-with-sparse-inodes.patch diff --git a/grub2.spec b/grub2.spec index 0132b5a..8678510 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base License: GPLv3+ @@ -453,6 +453,12 @@ fi %endif %changelog +* Wed May 16 2018 Peter Jones - 2.02-37 +- Fixups to work with gcc 8 +- Experimental https boot support on UEFI +- XFS fixes for sparse inode support + Resolves: rhbz#1575797 + * Thu May 10 2018 Javier Martinez Canillas - 2.02-36 - Use version field to sort BLS entries if id field isn't defined - Add version field to BLS fragments generated by 20-grub.install