Compare commits

..

27 commits

Author SHA1 Message Date
Nicolas Frayer
6dd575bf56 cmd/search: Rework of CVE-2023-4001 fix
Related: #2224951
Resolved: #2263369
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-05-22 22:59:03 +02:00
Nicolas Frayer
a25b6d7a50 fs/xfs: Handle non-continuous data blocks in directory extents
Related: #2254370
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-04-16 17:13:01 +02:00
Nicolas Frayer
4b81c6f969 GRUB2 NTFS driver vulnerabilities
(CVE-2023-4692)
(CVE-2023-4693)

Resolves: #2236613
Resolves: #2241978
Resolves: #2241976
Resolves: #2238343
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-03-12 14:57:26 +01:00
Nicolas Frayer
de8e46a702 fs/xfs: Re-apply the XFS directory extent parsing patch
Resolves: #2259266
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-02-27 13:01:52 +01:00
Nicolas Frayer
700a33cd9b grub-set-bootflag: Fix for CVE-2024-1048
(CVE-2024-1048)

Resolves: #2256678
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-02-07 11:35:31 +01:00
Nicolas Frayer
111a2e2ad7 grub-core/commands: add flag to only search root dev
Resolves: #2223437
Resolves: #2224951
Resolves: #2258096
Resolves: CVE-2023-4001
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-01-18 16:33:14 +01:00
Hector Martin
4afdc36e08 Switch memdisk compression to lzop
xz decompression is very slow and slows down boot by around 5 seconds on
aarch64/Apple M1 when using the default font. Switch to lzop, which
takes less than one second to uncompress.

This increases EFI core image size by around 11%.

Signed-off-by: Hector Martin <marcan@marcan.st>
2024-01-16 10:51:59 +01:00
Daan De Meyer
ba91402910 Drop grub2-tools obsoletes for grub2-tools-minimal
When installing grub2-tools grub2-tools-minimal is pulled in which
obsoletes grub2-tools causing grub2-tools to not get installed.
Remove the obsoletes so that grub2-tools can be installed again.

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
2024-01-16 10:49:48 +01:00
Nicolas Frayer
b601fadc13 xfs: Remove directory extent parsing patch
Some bios systems with /boot partition created with
xfsprog < 6.5.0 can't boot with one of the xfs upstream patches

Resolves: #2254370
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-01-11 18:46:39 +01:00
Nicolas Frayer
d32334821b normal: fix prefix when loading modules
Resolves: #2209435
Resolves: #2173015
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2024-01-09 15:47:39 +01:00
Leo Sandoval
463f18634f chainloader: remove device path debug message
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
2023-12-14 10:37:00 -06:00
Nicolas Frayer
6b9f32bc1e fs/xfs: Add several fixes/improvements to xfs fs from upstream
Resolves: #2247926
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-12-01 11:22:36 +01:00
Nicolas Frayer
c27e33d757 Linker: added --no-warn-rwx-segments linker option
added --no-warn-rwx-segments as build will fail after
ld.bfd default options have been changed.

Please refer:
https://fedoraproject.org/wiki/Changes/Linker_Error_On_Security_Issues

Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-11-15 17:06:33 +01:00
Nicolas Frayer
b02f48fd74 Remove [Install] section from aux systemd units
Related: #2247635
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-11-15 12:20:21 +01:00
Hans de Goede
c88723f778 spec: Fix enablement of grub services and timer
Fix enablement of grub services and timer:
- Switch back to static enablement for grub services in tools package
- Add %%triggerpostun to apply grub-boot-success.timer preset
  when upgrading from older versions where this was not a preset

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2247635
Signed-off-by: Christian Glombek <cglombek@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-11-15 12:07:06 +01:00
Nicolas Frayer
1ea248daea util: grub-install on EFI if forced
Resolves: #1917213
Resolves: #2240994
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-11-13 16:05:48 +01:00
Nicolas Frayer
64d211d94f kern/ieee1275/init: ppc64: Restrict high memory in presence
of fadump

Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-10-20 18:40:02 +02:00
Janne Grunau
43a488b920 20-grub.install: Copy device-tree directory recursively
8800efcb0b replaced '-a' with '--preserve=timestamps' to avoid
preserving ownership information on non vfat file systems. This breaks
copying of the 'dtb' directory on aarch64 systems since '-a' implies
'-r'. Add '-r' to the single place where 'dtb/' is copied to /boot.

Resolves: #2243060
Fixes: 8800efcb0b ("Do not preserve ownership or xattrs on copied files")
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-10-11 12:44:36 +02:00
Vitaly Kuznetsov
eb2de6793d Don't run 20-grub.install for UKIs
When kernel-install is called for a UKI, 20-grub.install copies it to /boot
which is totally unneeded, UKIs are now handled by the standard systemd's
90-uki-copy.install (systemd-253+) correctly which places them to the ESP.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2023-10-03 18:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
801601daab Let ln and cp remove the destination files
No functional change, but makes the script a bit shorter.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-10-03 18:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
46c50c4f60 Do not preserve ownership or xattrs on copied files
As noticed in https://bugzilla.redhat.com/show_bug.cgi?id=2239008#c16, when
compiling a kernel as a user and doing 'sudo make install', and when using a
non-vfat fs for the install destination, the file would end up owned by the
user. This is not useful at all, so let's only preserve the timestamps on the
copied file, no other attributes.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-10-03 18:28:53 +02:00
Zbigniew Jędrzejewski-Szmek
767345ab81 Rename installed kernel to match name used in boot entry
The mkbls() function would write 'linux /vmlinuz-${kernelver}' into the boot
loader entry. But the code that actually copies the file would use the original
file name with a version suffix ('cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}"').
In case of a local kernel build calling /sbin/installkernel this file name was
e.g. 'bzImage', so we would end up with '/bzImage-${KERNEL_VERSION}', which of
course doesn't match '/vmlinuz-*'. The script would later call 'grub2-mkrel'
on the name taken from the boot entry which would fail because the file does not
exist. Rename the argument to "vmlinuz", so that both parts match.

Tested by doing a local kernel build with 'sudo make install' at the end.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-10-03 18:28:53 +02:00
Nicolas Frayer
fa21cb1524 ofdisk: Fix missing #include in ofdisk.c
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-10-03 18:28:53 +02:00
Christian Glombek
851dea6ca0 spec: Fix grub2-systemd-integration.service name
Signed-off-by: Christian Glombek <cglombek@redhat.com>
2023-09-28 19:08:33 +02:00
Nicolas Frayer
c4218f0de9 arm64: Use proper memory type for kernel allocation
Resolves: #2149020
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-09-15 12:49:37 +02:00
Nicolas Frayer
84d684cdeb spec: Use systemd presets and macros for units in tools package
Resolves: #2230575

Signed-off-by: Christian Glombek <cglombek@redhat.com>
2023-09-15 12:49:29 +02:00
Nicolas Frayer
dc857889be spec: Modified posttrans to harden grub config detection
Resolves: #2235692
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
2023-09-01 11:09:33 +02:00
547 changed files with 17693 additions and 19942 deletions

View file

@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 656301eaf22..376ca47efe4 100644
index 5984e92d29..9462248128 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n

View file

@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925.
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 32c480daeb2..7516a015be0 100644
index f8cbb8d7a2..d3e879b8e5 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2
@ -31,7 +31,7 @@ index 32c480daeb2..7516a015be0 100644
GRUB_FS \
GRUB_FONT \
GRUB_PRELOAD_MODULES \
@@ -250,6 +246,7 @@ export GRUB_DEFAULT \
@@ -246,6 +242,7 @@ export GRUB_DEFAULT \
GRUB_BACKGROUND \
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
@ -40,7 +40,7 @@ index 32c480daeb2..7516a015be0 100644
GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 376ca47efe4..30f27f15b83 100644
index 9462248128..80685b15f4 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -10,10 +10,10 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666.
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index a225f9a88d2..974bc0ddb07 100644
index f8b4b3b21a..69f08d289f 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1552,13 +1552,10 @@ boot sequence. If you have problems, set this option to @samp{text} and
@@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and
GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER
@ -31,7 +31,7 @@ index a225f9a88d2..974bc0ddb07 100644
@item GRUB_OS_PROBER_SKIP_LIST
List of space-separated FS UUIDs of filesystems to be ignored from os-prober
@@ -1889,9 +1886,10 @@ than zero; otherwise 0.
@@ -1853,9 +1850,10 @@ than zero; otherwise 0.
@section Multi-boot manual config
Currently autogenerating config files for multi-boot environments depends on
@ -46,7 +46,7 @@ index a225f9a88d2..974bc0ddb07 100644
First create a separate GRUB partition, big enough to hold GRUB. Some of the
following entries show how to load OS installer images from this same partition,
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 30f27f15b83..f300e46fc6a 100644
index 80685b15f4..1b91c102f3 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Mon, 1 Apr 2024 13:20:18 -0600
Date: Tue, 10 Jul 2012 11:58:52 -0400
Subject: [PATCH] Add support for Linux EFI stub loading.
Also:
@ -26,25 +26,32 @@ grub-2.00-no-insmod-on-sb.patch), but this should be more correct. It
moves the check into grub_dl_load_file.
---
grub-core/Makefile.core.def | 16 +-
grub-core/kern/dl.c | 22 +++
grub-core/kern/dl.c | 21 +++
grub-core/kern/efi/efi.c | 28 ++++
grub-core/kern/efi/mm.c | 32 ++++
grub-core/loader/efi/linux.c | 47 ++++++
grub-core/loader/arm64/linux.c | 118 +++++++-------
grub-core/loader/arm64/xen_boot.c | 1 -
grub-core/loader/efi/linux.c | 70 ++++++++
grub-core/loader/i386/efi/linux.c | 335 ++++++++++++++++++++++++++++++++++++++
grub-core/loader/i386/pc/linux.c | 10 +-
include/grub/efi/efi.h | 3 +
include/grub/arm/linux.h | 9 +
include/grub/arm64/linux.h | 9 +
include/grub/efi/efi.h | 7 +-
include/grub/efi/linux.h | 31 ++++
8 files changed, 485 insertions(+), 11 deletions(-)
13 files changed, 618 insertions(+), 69 deletions(-)
create mode 100644 grub-core/loader/efi/linux.c
create mode 100644 grub-core/loader/i386/efi/linux.c
create mode 100644 include/grub/efi/linux.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index a5a3ee31800..3f6e944d6a5 100644
index 8022e1c0a7..45d3edaa4d 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1831,12 +1831,6 @@ module = {
@@ -1734,13 +1734,6 @@ module = {
enable = i386_pc;
};
-
-module = {
- name = linux16;
- common = loader/i386/pc/linux.c;
@ -54,47 +61,37 @@ index a5a3ee31800..3f6e944d6a5 100644
module = {
name = ntldr;
i386_pc = loader/i386/pc/ntldr.c;
@@ -1892,10 +1886,9 @@ module = {
@@ -1796,7 +1789,9 @@ module = {
module = {
name = linux;
- x86 = loader/i386/linux.c;
+ i386_pc = loader/i386/pc/linux.c;
+ x86_64_efi = loader/i386/efi/linux.c;
+ i386_efi = loader/i386/efi/linux.c;
i386_xen_pvh = loader/i386/linux.c;
xen = loader/i386/xen.c;
- i386_pc = lib/i386/pc/vesa_modes_table.c;
+ i386_pc = loader/i386/pc/linux.c;
i386_xen_pvh = lib/i386/pc/vesa_modes_table.c;
mips = loader/mips/linux.c;
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
@@ -1908,11 +1901,14 @@ module = {
loongarch64 = loader/efi/linux.c;
riscv32 = loader/efi/linux.c;
riscv64 = loader/efi/linux.c;
- i386_efi = loader/efi/linux.c;
- x86_64_efi = loader/efi/linux.c;
+ i386_efi = loader/i386/efi/linux.c;
+ x86_64_efi = loader/i386/efi/linux.c;
emu = loader/emu/linux.c;
i386_pc = lib/i386/pc/vesa_modes_table.c;
@@ -1811,9 +1806,14 @@ module = {
arm64 = loader/arm64/linux.c;
riscv32 = loader/riscv/linux.c;
riscv64 = loader/riscv/linux.c;
+ emu = loader/emu/linux.c;
+ fdt = lib/fdt.c;
+
common = loader/linux.c;
common = lib/cmdline.c;
enable = noemu;
+
+ efi = loader/efi/linux.c;
+ efi = loader/i386/linux.c;
};
module = {
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index c55f0ecf931..d48d4131ba7 100644
index 48f8a79073..b714937095 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -32,12 +32,21 @@
#include <grub/env.h>
#include <grub/cache.h>
#include <grub/i18n.h>
+#include <grub/efi/sb.h>
/* Platforms where modules are in a readonly area of memory. */
#if defined(GRUB_MACHINE_QEMU)
@@ -38,6 +38,14 @@
#define GRUB_MODULES_MACHINE_READONLY
#endif
@ -109,12 +106,12 @@ index c55f0ecf931..d48d4131ba7 100644
#pragma GCC diagnostic ignored "-Wcast-align"
@@ -861,6 +870,19 @@ grub_dl_load_file (const char *filename)
@@ -695,6 +703,19 @@ grub_dl_load_file (const char *filename)
void *core = 0;
grub_dl_t mod = 0;
+#ifdef GRUB_MACHINE_EFI
+ if (grub_efi_get_secureboot ())
+ if (grub_efi_secure_boot ())
+ {
+#if 0
+ /* This is an error, but grub2-mkconfig still generates a pile of
@ -129,11 +126,50 @@ index c55f0ecf931..d48d4131ba7 100644
grub_boot_time ("Loading module %s", filename);
file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE);
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 8cff7be028..35b8f67060 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
}
+grub_efi_boolean_t
+grub_efi_secure_boot (void)
+{
+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+ grub_size_t datasize;
+ char *secure_boot = NULL;
+ char *setup_mode = NULL;
+ grub_efi_boolean_t ret = 0;
+
+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
+
+ if (datasize != 1 || !secure_boot)
+ goto out;
+
+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
+
+ if (datasize != 1 || !setup_mode)
+ goto out;
+
+ if (*secure_boot && !*setup_mode)
+ ret = 1;
+
+ out:
+ grub_free (secure_boot);
+ grub_free (setup_mode);
+ return ret;
+}
+
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index df443f434d4..fb9dbf52528 100644
index 9838fb2f50..f6aef0ef64 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -112,6 +112,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
@@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
}
}
@ -150,7 +186,7 @@ index df443f434d4..fb9dbf52528 100644
+ return 0;
+
+ b = grub_efi_system_table->boot_services;
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
@ -160,7 +196,7 @@ index df443f434d4..fb9dbf52528 100644
+ /* Uggh, the address 0 was allocated... This is too annoying,
+ so reallocate another one. */
+ address = max;
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
+ grub_efi_free_pages (0, pages);
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
@ -172,27 +208,231 @@ index df443f434d4..fb9dbf52528 100644
/* Allocate pages. Return the pointer to the first of allocated pages. */
void *
grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index bfbd95aeef0..925394d1767 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -25,10 +25,12 @@
#include <grub/loader.h>
#include <grub/mm.h>
#include <grub/types.h>
+#include <grub/cpu/linux.h>
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index ef3e9f9444..a312c66868 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -29,6 +29,7 @@
#include <grub/efi/efi.h>
#include <grub/efi/fdtload.h>
#include <grub/efi/memory.h>
#include <grub/efi/pe32.h>
+#include <grub/efi/linux.h>
#include <grub/efi/sb.h>
#include <grub/efi/pe32.h>
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
@@ -87,6 +89,51 @@ static grub_efi_load_file2_t initrd_lf2 = {
grub_efi_initrd_load_file2
};
@@ -41,6 +42,7 @@ static int loaded;
static void *kernel_addr;
static grub_uint64_t kernel_size;
+static grub_uint32_t handover_offset;
static char *linux_args;
static grub_uint32_t cmdline_size;
@@ -67,7 +69,8 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
static grub_err_t
finalize_params_linux (void)
{
- int node, retval;
+ grub_efi_loaded_image_t *loaded_image = NULL;
+ int node, retval, len;
void *fdt;
@@ -102,79 +105,70 @@ finalize_params_linux (void)
if (grub_fdt_install() != GRUB_ERR_NONE)
goto failure;
- return GRUB_ERR_NONE;
-
-failure:
- grub_fdt_unload();
- return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
-}
-
-grub_err_t
-grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
-{
- grub_efi_memory_mapped_device_path_t *mempath;
- grub_efi_handle_t image_handle;
- grub_efi_boot_services_t *b;
- grub_efi_status_t status;
- grub_efi_loaded_image_t *loaded_image;
- int len;
-
- mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t));
- if (!mempath)
- return grub_errno;
-
- mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE;
- mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE;
- mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath));
- mempath[0].memory_type = GRUB_EFI_LOADER_DATA;
- mempath[0].start_address = addr;
- mempath[0].end_address = addr + size;
-
- mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
- mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
- mempath[1].header.length = sizeof (grub_efi_device_path_t);
-
- b = grub_efi_system_table->boot_services;
- status = b->load_image (0, grub_efi_image_handle,
- (grub_efi_device_path_t *) mempath,
- (void *) addr, size, &image_handle);
- if (status != GRUB_EFI_SUCCESS)
- return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
-
- grub_dprintf ("linux", "linux command line: '%s'\n", args);
+ grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n",
+ fdt);
/* Convert command line to UCS-2 */
- loaded_image = grub_efi_get_loaded_image (image_handle);
+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
+ if (!loaded_image)
+ goto failure;
+
loaded_image->load_options_size = len =
- (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
+ (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t);
loaded_image->load_options =
grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
if (!loaded_image->load_options)
- return grub_errno;
+ return grub_error(GRUB_ERR_BAD_OS, "failed to create kernel parameters");
loaded_image->load_options_size =
2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
- (grub_uint8_t *) args, len, NULL);
+ (grub_uint8_t *) linux_args, len, NULL);
- grub_dprintf ("linux", "starting image %p\n", image_handle);
- status = b->start_image (image_handle, 0, NULL);
+ return GRUB_ERR_NONE;
- /* When successful, not reached */
- b->unload_image (image_handle);
- grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
- GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
+failure:
+ grub_fdt_unload();
+ return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
+}
- return grub_errno;
+static void
+free_params (void)
+{
+ grub_efi_loaded_image_t *loaded_image = NULL;
+
+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
+ if (loaded_image)
+ {
+ if (loaded_image->load_options)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options,
+ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
+ loaded_image->load_options = NULL;
+ loaded_image->load_options_size = 0;
+ }
+}
+
+grub_err_t
+grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args)
+{
+ grub_err_t retval;
+
+ retval = finalize_params_linux ();
+ if (retval != GRUB_ERR_NONE)
+ return grub_errno;
+
+ grub_dprintf ("linux", "linux command line: '%s'\n", args);
+
+ retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr);
+
+ /* Never reached... */
+ free_params();
+ return retval;
}
static grub_err_t
grub_linux_boot (void)
{
- if (finalize_params_linux () != GRUB_ERR_NONE)
- return grub_errno;
-
- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
- kernel_size, linux_args));
+ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args));
}
static grub_err_t
@@ -288,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
grub_file_t file = 0;
struct linux_arch_kernel_header lh;
+ struct grub_armxx_linux_pe_header *pe;
grub_err_t err;
grub_dl_ref (my_mod);
@@ -333,6 +328,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
+ if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size))
+ {
+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
+ goto fail;
+ }
+
+ pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset);
+ handover_offset = pe->opt.entry_addr;
+
cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE);
linux_args = grub_malloc (cmdline_size);
if (!linux_args)
diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
index 22cc25eccd..d9b7a9ba40 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -266,7 +266,6 @@ xen_boot (void)
return err;
return grub_arch_efi_linux_boot_image (xen_hypervisor->start,
- xen_hypervisor->size,
xen_hypervisor->cmdline);
}
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
new file mode 100644
index 0000000000..c24202a5dd
--- /dev/null
+++ b/grub-core/loader/efi/linux.c
@@ -0,0 +1,70 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2014 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/err.h>
+#include <grub/mm.h>
+#include <grub/types.h>
+#include <grub/cpu/linux.h>
+#include <grub/efi/efi.h>
+#include <grub/efi/pe32.h>
+#include <grub/efi/linux.h>
+
+#define SHIM_LOCK_GUID \
+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
+
@ -205,7 +445,7 @@ index bfbd95aeef0..925394d1767 100644
+grub_efi_boolean_t
+grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
+{
+ grub_guid_t guid = SHIM_LOCK_GUID;
+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
+ grub_efi_shim_lock_t *shim_lock;
+
+ shim_lock = grub_efi_locate_protocol(&guid, NULL);
@ -225,25 +465,21 @@ index bfbd95aeef0..925394d1767 100644
+typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *);
+
+grub_err_t
+grub_efi_linux_boot (void *kernel_address, grub_off_t offset,
+grub_efi_linux_boot (void *kernel_addr, grub_off_t offset,
+ void *kernel_params)
+{
+ handover_func hf;
+
+ hf = (handover_func)((char *)kernel_address + offset);
+ hf = (handover_func)((char *)kernel_addr + offset);
+ hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
+
+ return GRUB_ERR_BUG;
+}
+
+#pragma GCC diagnostic pop
+
grub_err_t
grub_arch_efi_linux_load_image_header (grub_file_t file,
struct linux_arch_kernel_header * lh)
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
new file mode 100644
index 00000000000..9bfb4ab9e3e
index 0000000000..bb2616a809
--- /dev/null
+++ b/grub-core/loader/i386/efi/linux.c
@@ -0,0 +1,335 @@
@ -301,7 +537,7 @@ index 00000000000..9bfb4ab9e3e
+ asm volatile ("cli");
+
+ return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset,
+ params);
+ params);
+}
+
+static grub_err_t
@ -311,17 +547,17 @@ index 00000000000..9bfb4ab9e3e
+ loaded = 0;
+ if (initrd_mem)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem,
+ BYTES_TO_PAGES(params->ramdisk_size));
+ BYTES_TO_PAGES(params->ramdisk_size));
+ if (linux_cmdline)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
+ linux_cmdline,
+ BYTES_TO_PAGES(params->cmdline_size + 1));
+ linux_cmdline,
+ BYTES_TO_PAGES(params->cmdline_size + 1));
+ if (kernel_mem)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
+ BYTES_TO_PAGES(kernel_size));
+ BYTES_TO_PAGES(kernel_size));
+ if (params)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params,
+ BYTES_TO_PAGES(16384));
+ BYTES_TO_PAGES(16384));
+ return GRUB_ERR_NONE;
+}
+
@ -395,14 +631,14 @@ index 00000000000..9bfb4ab9e3e
+
+ if (initrd_mem && grub_errno)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem,
+ BYTES_TO_PAGES(size));
+ BYTES_TO_PAGES(size));
+
+ return grub_errno;
+}
+
+static grub_err_t
+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ int argc, char *argv[])
+ int argc, char *argv[])
+{
+ grub_file_t file = 0;
+ struct linux_i386_kernel_header lh;
@ -440,7 +676,7 @@ index 00000000000..9bfb4ab9e3e
+ if (! grub_linuxefi_secure_validate (kernel, filelen))
+ {
+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"),
+ argv[0]);
+ argv[0]);
+ goto fail;
+ }
+
@ -482,7 +718,7 @@ index 00000000000..9bfb4ab9e3e
+
+ grub_dprintf ("linux", "setting up cmdline\n");
+ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
+
+ if (!linux_cmdline)
+ {
@ -493,8 +729,8 @@ index 00000000000..9bfb4ab9e3e
+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
+ grub_create_loader_cmdline (argc, argv,
+ linux_cmdline + sizeof (LINUX_IMAGE) - 1,
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ GRUB_VERIFY_KERNEL_CMDLINE);
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ GRUB_VERIFY_KERNEL_CMDLINE);
+
+ lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
+
@ -504,11 +740,11 @@ index 00000000000..9bfb4ab9e3e
+ len = grub_file_size(file) - start;
+
+ kernel_mem = grub_efi_allocate_pages_max(lh.pref_address,
+ BYTES_TO_PAGES(lh.init_size));
+ BYTES_TO_PAGES(lh.init_size));
+
+ if (!kernel_mem)
+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
+ BYTES_TO_PAGES(lh.init_size));
+ BYTES_TO_PAGES(lh.init_size));
+
+ if (!kernel_mem)
+ {
@ -541,16 +777,16 @@ index 00000000000..9bfb4ab9e3e
+
+ if (linux_cmdline && !loaded)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
+ linux_cmdline,
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
+ linux_cmdline,
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
+
+ if (kernel_mem && !loaded)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
+ BYTES_TO_PAGES(kernel_size));
+ BYTES_TO_PAGES(kernel_size));
+
+ if (params && !loaded)
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params,
+ BYTES_TO_PAGES(16384));
+ BYTES_TO_PAGES(16384));
+
+ return grub_errno;
+}
@ -583,10 +819,10 @@ index 00000000000..9bfb4ab9e3e
+ grub_unregister_command (cmd_initrdefi);
+}
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index 600530a742b..8593d74737f 100644
index 2a29952016..8be4c3b3f4 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -483,14 +483,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
@@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
@ -608,7 +844,7 @@ index 600530a742b..8593d74737f 100644
grub_register_command ("initrd16", grub_cmd_initrd,
0, N_("Load initrd."));
my_mod = mod;
@@ -499,5 +505,7 @@ GRUB_MOD_INIT(linux16)
@@ -490,5 +496,7 @@ GRUB_MOD_INIT(linux16)
GRUB_MOD_FINI(linux16)
{
grub_unregister_command (cmd_linux);
@ -616,11 +852,71 @@ index 600530a742b..8593d74737f 100644
grub_unregister_command (cmd_initrd);
+ grub_unregister_command (cmd_initrd16);
}
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index bcd5a7eb18..b582f67f66 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -20,6 +20,7 @@
#ifndef GRUB_ARM_LINUX_HEADER
#define GRUB_ARM_LINUX_HEADER 1
+#include <grub/efi/pe32.h>
#include "system.h"
#define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818
@@ -34,9 +35,17 @@ struct linux_arm_kernel_header {
grub_uint32_t hdr_offset;
};
+struct grub_arm_linux_pe_header
+{
+ grub_uint32_t magic;
+ struct grub_pe32_coff_header coff;
+ struct grub_pe32_optional_header opt;
+};
+
#if defined(__arm__)
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
# define linux_arch_kernel_header linux_arm_kernel_header
+# define grub_armxx_linux_pe_header grub_arm_linux_pe_header
#endif
#if defined GRUB_MACHINE_UBOOT
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
index 7e22b4ab69..ea030312df 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -19,6 +19,7 @@
#ifndef GRUB_ARM64_LINUX_HEADER
#define GRUB_ARM64_LINUX_HEADER 1
+#include <grub/efi/pe32.h>
#include <grub/types.h>
#define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */
@@ -38,9 +39,17 @@ struct linux_arm64_kernel_header
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
};
+struct grub_arm64_linux_pe_header
+{
+ grub_uint32_t magic;
+ struct grub_pe32_coff_header coff;
+ struct grub_pe64_optional_header opt;
+};
+
#if defined(__aarch64__)
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
# define linux_arch_kernel_header linux_arm64_kernel_header
+# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header
#endif
#endif /* ! GRUB_ARM64_LINUX_HEADER */
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 3670eddc52b..83ddbe26e57 100644
index 83d958f994..6295df85f3 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -75,6 +75,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
@@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
void *
EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
@ -630,9 +926,27 @@ index 3670eddc52b..83ddbe26e57 100644
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
@@ -88,6 +91,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
const grub_efi_guid_t *guid,
void *data,
grub_size_t datasize);
+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
int
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
const grub_efi_device_path_t *dp2);
@@ -101,8 +105,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
#include <grub/cpu/linux.h>
grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
-grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
- char *args);
+grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args);
#endif
grub_addr_t grub_efi_modules_addr (void);
diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h
new file mode 100644
index 00000000000..d224daafa4f
index 0000000000..d9ede36773
--- /dev/null
+++ b/include/grub/efi/linux.h
@@ -0,0 +1,31 @@
@ -664,6 +978,6 @@ index 00000000000..d224daafa4f
+EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size);
+grub_err_t
+EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset,
+ void *kernel_param);
+ void *kernel_param);
+
+#endif /* ! GRUB_EFI_LINUX_HEADER */

View file

@ -13,10 +13,10 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 977757f2cc9..10f967f2563 100644
index 9f74a96b19..dccf3bb300 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -661,13 +661,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
grub_file_t file = 0;
struct linux_i386_kernel_header lh;
@ -33,7 +33,7 @@ index 977757f2cc9..10f967f2563 100644
grub_dl_ref (my_mod);
@@ -681,7 +683,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -669,7 +671,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (! file)
goto fail;
@ -50,7 +50,7 @@ index 977757f2cc9..10f967f2563 100644
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -689,6 +699,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -677,6 +687,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -60,7 +60,7 @@ index 977757f2cc9..10f967f2563 100644
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
{
grub_error (GRUB_ERR_BAD_OS, "invalid magic number");
@@ -796,13 +809,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -784,13 +797,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* We've already read lh so there is no need to read it second time. */
len -= sizeof(lh);
@ -78,7 +78,7 @@ index 977757f2cc9..10f967f2563 100644
}
linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR;
@@ -865,7 +876,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -853,7 +864,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* The other parameters are filled when booting. */
@ -87,7 +87,7 @@ index 977757f2cc9..10f967f2563 100644
grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
(unsigned) real_size, (unsigned) prot_size);
@@ -1019,9 +1030,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -1007,9 +1018,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
len = prot_file_size;
@ -98,7 +98,7 @@ index 977757f2cc9..10f967f2563 100644
if (grub_errno == GRUB_ERR_NONE)
{
@@ -1032,6 +1041,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -1020,6 +1029,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fail:

View file

@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index 4adeee9ae00..600530a742b 100644
index 8be4c3b3f4..4b1750e360 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Raymund Will <rw@suse.com>
Date: Tue, 2 Apr 2024 16:39:53 -0600
Date: Mon, 8 Jul 2019 11:55:18 +0200
Subject: [PATCH] Add secureboot support on efi chainloader
Expand the chainloader to be able to verify the image by means of shim
@ -180,77 +180,103 @@ supported yet. This patch might need a new revision once that's the case.
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
---
grub-core/loader/efi/chainloader.c | 849 +++++++++++++++++++++++++++++++++----
grub-core/kern/efi/efi.c | 14 +-
grub-core/loader/arm64/linux.c | 4 +-
grub-core/loader/efi/chainloader.c | 820 +++++++++++++++++++++++++++++++++----
grub-core/loader/efi/linux.c | 25 +-
grub-core/loader/i386/efi/linux.c | 17 +-
include/grub/efi/linux.h | 2 +-
include/grub/efi/pe32.h | 51 ++-
5 files changed, 848 insertions(+), 96 deletions(-)
include/grub/efi/pe32.h | 52 ++-
7 files changed, 844 insertions(+), 90 deletions(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 35b8f67060..4a2259aa1c 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -296,14 +296,20 @@ grub_efi_secure_boot (void)
grub_efi_boolean_t ret = 0;
secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
-
if (datasize != 1 || !secure_boot)
- goto out;
+ {
+ grub_dprintf ("secureboot", "No SecureBoot variable\n");
+ goto out;
+ }
+ grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot);
setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
-
if (datasize != 1 || !setup_mode)
- goto out;
+ {
+ grub_dprintf ("secureboot", "No SetupMode variable\n");
+ goto out;
+ }
+ grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode);
if (*secure_boot && !*setup_mode)
ret = 1;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index a312c66868..04994d5c67 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
struct linux_arch_kernel_header lh;
struct grub_armxx_linux_pe_header *pe;
grub_err_t err;
+ int rc;
grub_dl_ref (my_mod);
@@ -328,7 +329,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
- if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size))
+ rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size);
+ if (rc < 0)
{
grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
goto fail;
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 2036924504b..e4ac39c87b4 100644
index 2bd80f4db3..e6a8d4ad0e 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -32,6 +32,9 @@
@@ -32,6 +32,8 @@
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/efi/disk.h>
+#include <grub/efi/pe32.h>
+#include <grub/efi/sb.h>
+#include <grub/efi/linux.h>
#include <grub/efi/memory.h>
#include <grub/command.h>
#include <grub/i18n.h>
@@ -45,13 +48,24 @@ GRUB_MOD_LICENSE ("GPLv3+");
#include <grub/net.h>
@@ -46,9 +48,14 @@ static grub_dl_t my_mod;
static grub_dl_t my_mod;
+static grub_efi_physical_address_t address;
+static grub_efi_uintn_t pages;
static grub_efi_physical_address_t address;
static grub_efi_uintn_t pages;
+static grub_ssize_t fsize;
+static grub_efi_device_path_t *file_path;
+static grub_efi_handle_t image_handle;
+static grub_efi_char16_t *cmdline;
static grub_efi_device_path_t *file_path;
static grub_efi_handle_t image_handle;
static grub_efi_char16_t *cmdline;
+static grub_ssize_t cmdline_len;
+static grub_efi_handle_t dev_handle;
+
+static grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table);
+
+static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table);
static grub_err_t
grub_chainloader_unload (void *context)
{
- grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
grub_efi_loaded_image_t *loaded_image;
grub_efi_boot_services_t *b;
grub_chainloader_unload (void)
@@ -63,6 +70,7 @@ grub_chainloader_unload (void)
grub_free (cmdline);
cmdline = 0;
file_path = 0;
+ dev_handle = 0;
+ image_handle = (grub_efi_handle_t) context;
loaded_image = grub_efi_get_loaded_image (image_handle);
if (loaded_image != NULL)
grub_free (loaded_image->load_options);
@@ -66,12 +80,12 @@ grub_chainloader_unload (void *context)
static grub_err_t
grub_chainloader_boot (void *context)
{
- grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
grub_efi_boot_services_t *b;
grub_efi_status_t status;
grub_efi_uintn_t exit_data_size;
grub_efi_char16_t *exit_data = NULL;
+ image_handle = (grub_efi_handle_t) context;
b = grub_efi_system_table->boot_services;
status = b->start_image (image_handle, &exit_data_size, &exit_data);
if (status != GRUB_EFI_SUCCESS)
@@ -136,7 +150,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
char *dir_start;
char *dir_end;
grub_size_t size;
- grub_efi_device_path_t *d, *file_path;
+ grub_efi_device_path_t *d;
dir_start = grub_strchr (filename, ')');
if (! dir_start)
@@ -209,24 +223,701 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@@ -213,20 +221,694 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
return file_path;
}
@ -301,7 +327,7 @@ index 2036924504b..e4ac39c87b4 100644
+read_header (void *data, grub_efi_uint32_t size,
+ pe_coff_loader_image_context_t *context)
+{
+ grub_guid_t guid = SHIM_LOCK_GUID;
+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
+ grub_efi_shim_lock_t *shim_lock;
+ grub_efi_status_t status;
+
@ -614,8 +640,8 @@ index 2036924504b..e4ac39c87b4 100644
+ grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n",
+ context.image_size, datasize);
+
+ efi_status = b->allocate_pool (GRUB_EFI_LOADER_DATA,
+ buffer_size, (void**)&buffer);
+ efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
+ buffer_size, &buffer);
+
+ if (efi_status != GRUB_EFI_SUCCESS)
+ {
@ -842,19 +868,19 @@ index 2036924504b..e4ac39c87b4 100644
+ }
+
+ grub_dprintf ("chain", "booting via entry point\n");
+ efi_status = entry_point (grub_efi_image_handle,
+ grub_efi_system_table);
+ efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
+ grub_efi_system_table);
+
+ grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
+ grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
+ efi_status = b->free_pool (buffer);
+ efi_status = efi_call_1 (b->free_pool, buffer);
+
+ return 1;
+
+error_exit:
+ grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno);
+ if (buffer)
+ b->free_pool (buffer);
+ efi_call_1 (b->free_pool, buffer);
+
+ return 0;
+}
@ -865,7 +891,7 @@ index 2036924504b..e4ac39c87b4 100644
+ grub_efi_boot_services_t *b;
+
+ b = grub_efi_system_table->boot_services;
+ b->free_pages (address, pages);
+ efi_call_2 (b->free_pages, address, pages);
+ grub_free (file_path);
+ grub_free (cmdline);
+ cmdline = 0;
@ -885,8 +911,8 @@ index 2036924504b..e4ac39c87b4 100644
+
+ b = grub_efi_system_table->boot_services;
+
+ status = b->load_image (0, grub_efi_image_handle, file_path,
+ boot_image, fsize, &image_handle);
+ status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
+ boot_image, fsize, &image_handle);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ if (status == GRUB_EFI_OUT_OF_RESOURCES)
@ -939,28 +965,20 @@ index 2036924504b..e4ac39c87b4 100644
grub_efi_status_t status;
grub_efi_boot_services_t *b;
grub_device_t dev = 0;
- grub_efi_device_path_t *dp = NULL, *file_path = NULL;
grub_efi_device_path_t *dp = 0;
- grub_efi_loaded_image_t *loaded_image;
+ grub_efi_device_path_t *dp = NULL;
char *filename;
void *boot_image = 0;
- grub_efi_handle_t dev_handle = 0;
- grub_efi_physical_address_t address = 0;
- grub_efi_uintn_t pages = 0;
- grub_efi_char16_t *cmdline = NULL;
- grub_efi_handle_t image_handle = NULL;
+ int rc;
+
+ file_path = NULL;
+ address = 0;
+ pages = 0;
+ cmdline = NULL;
+ image_handle = NULL;
+ dev_handle = 0;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@@ -236,12 +927,42 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -238,15 +920,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
address = 0;
image_handle = 0;
file_path = 0;
+ dev_handle = 0;
b = grub_efi_system_table->boot_services;
@ -989,7 +1007,6 @@ index 2036924504b..e4ac39c87b4 100644
+ }
+ *(--p16) = 0;
+ }
+
+
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
if (! file)
@ -1002,18 +1019,16 @@ index 2036924504b..e4ac39c87b4 100644
+ dev = grub_device_open (devname);
+ if (devname)
+ grub_free (devname);
if (dev == NULL)
;
else if (dev->disk)
@@ -272,19 +993,16 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
file_path = make_file_path (dp, filename);
if (file_path == NULL)
goto fail;
-
- grub_printf ("file path: ");
- grub_efi_print_device_path (file_path);
}
if (! dev)
goto fail;
@@ -283,17 +995,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (! file_path)
goto fail;
- grub_printf ("file path: ");
- grub_efi_print_device_path (file_path);
-
- size = grub_file_size (file);
- if (!size)
+ fsize = grub_file_size (file);
@ -1023,12 +1038,12 @@ index 2036924504b..e4ac39c87b4 100644
filename);
goto fail;
}
- pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (size);
+ pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (fsize);
- pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12);
+ pages = (((grub_efi_uintn_t) fsize + ((1 << 12) - 1)) >> 12);
status = b->allocate_pages (GRUB_EFI_ALLOCATE_ANY_PAGES,
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
GRUB_EFI_LOADER_CODE,
@@ -298,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -307,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
boot_image = (void *) ((grub_addr_t) address);
@ -1037,7 +1052,7 @@ index 2036924504b..e4ac39c87b4 100644
{
if (grub_errno == GRUB_ERR_NONE)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -308,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -317,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
#if defined (__i386__) || defined (__x86_64__)
@ -1046,7 +1061,7 @@ index 2036924504b..e4ac39c87b4 100644
{
struct grub_macho_fat_header *head = boot_image;
if (head->magic
@@ -317,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -326,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_uint32_t i;
struct grub_macho_fat_arch *archs
= (struct grub_macho_fat_arch *) (head + 1);
@ -1061,7 +1076,7 @@ index 2036924504b..e4ac39c87b4 100644
for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++)
{
if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype))
@@ -331,83 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -340,79 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
> ~grub_cpu_to_le32 (archs[i].size)
|| grub_cpu_to_le32 (archs[i].offset)
+ grub_cpu_to_le32 (archs[i].size)
@ -1079,9 +1094,9 @@ index 2036924504b..e4ac39c87b4 100644
}
#endif
- status = b->load_image (0, grub_efi_image_handle, file_path,
- boot_image, size,
- &image_handle);
- status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
- boot_image, size,
- &image_handle);
- if (status != GRUB_EFI_SUCCESS)
+ rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize);
+ grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc);
@ -1112,7 +1127,6 @@ index 2036924504b..e4ac39c87b4 100644
- }
- loaded_image->device_handle = dev_handle;
-
- /* Build load options with arguments from chainloader command line. */
- if (argc > 1)
- {
- int i, len;
@ -1128,7 +1142,7 @@ index 2036924504b..e4ac39c87b4 100644
+ grub_load_and_start_image(boot_image);
+ grub_file_close (file);
+ grub_device_close (dev);
+ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
+ grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
- for (i = 1; i < argc; i++)
- {
@ -1150,33 +1164,30 @@ index 2036924504b..e4ac39c87b4 100644
- grub_file_close (file);
- grub_device_close (dev);
-
- /* We're finished with the source image buffer and file path now. */
- b->free_pages (address, pages);
- grub_free (file_path);
-
- grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
- return 0;
-
- fail:
-
+fail:
if (dev)
grub_device_close (dev);
@@ -421,6 +1103,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -424,6 +1101,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (address)
grub_efi_free_pages (address, pages);
efi_call_2 (b->free_pages, address, pages);
+ if (cmdline)
+ grub_free (cmdline);
+
if (image_handle != NULL)
b->unload_image (image_handle);
grub_dl_unref (my_mod);
return grub_errno;
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index 925394d1767..0a7f8208022 100644
index c24202a5dd..c8ecce6dfd 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -98,21 +98,36 @@ struct grub_efi_shim_lock
@@ -33,21 +33,34 @@ struct grub_efi_shim_lock
};
typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
@ -1184,12 +1195,12 @@ index 925394d1767..0a7f8208022 100644
+int
grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
{
grub_guid_t guid = SHIM_LOCK_GUID;
grub_efi_guid_t guid = SHIM_LOCK_GUID;
grub_efi_shim_lock_t *shim_lock;
+ grub_efi_status_t status;
shim_lock = grub_efi_locate_protocol(&guid, NULL);
-
+ grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock);
if (!shim_lock)
- return 1;
@ -1208,18 +1219,17 @@ index 925394d1767..0a7f8208022 100644
+ grub_dprintf ("secureboot", "Kernel signature verification passed\n");
+ return 1;
+ }
+
- return 0;
+ grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n",
+ (unsigned long) status);
+
+ return -1;
- return 0;
}
#pragma GCC diagnostic push
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index 9bfb4ab9e3e..b59d125286d 100644
index bb2616a809..6b24cbb948 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
@ -1245,7 +1255,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
{
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"),
+ argv[0]);
+ argv[0]);
goto fail;
}
@ -1254,7 +1264,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
+ if (rc < 0)
{
grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"),
argv[0]);
argv[0]);
@@ -203,6 +208,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -1269,7 +1279,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
}
+ grub_dprintf ("linux", "linux_cmdline = %lx\n",
+ (unsigned long)linux_cmdline);
+ (unsigned long)linux_cmdline);
+
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
grub_create_loader_cmdline (argc, argv,
@ -1279,7 +1289,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
params->type_of_loader = 0x21;
+ grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n",
+ kernel_mem, handover_offset);
+ kernel_mem, handover_offset);
fail:
-
@ -1287,7 +1297,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
grub_file_close (file);
diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h
index d224daafa4f..b2cfd8c1f44 100644
index d9ede36773..0033d9305a 100644
--- a/include/grub/efi/linux.h
+++ b/include/grub/efi/linux.h
@@ -22,7 +22,7 @@
@ -1300,10 +1310,10 @@ index d224daafa4f..b2cfd8c1f44 100644
grub_err_t
EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset,
diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
index 9887e14b278..a39743396dc 100644
index 0ed8781f03..a43adf2746 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -238,7 +238,11 @@ struct grub_pe64_optional_header
@@ -223,7 +223,11 @@ struct grub_pe64_optional_header
struct grub_pe32_section_table
{
char name[8];
@ -1316,7 +1326,7 @@ index 9887e14b278..a39743396dc 100644
grub_uint32_t virtual_address;
grub_uint32_t raw_data_size;
grub_uint32_t raw_data_offset;
@@ -249,12 +253,18 @@ struct grub_pe32_section_table
@@ -234,12 +238,18 @@ struct grub_pe32_section_table
grub_uint32_t characteristics;
};
@ -1339,7 +1349,7 @@ index 9887e14b278..a39743396dc 100644
#define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000
#define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000
@@ -263,10 +273,26 @@ struct grub_pe32_section_table
@@ -248,10 +258,28 @@ struct grub_pe32_section_table
#define GRUB_PE32_SCN_ALIGN_16BYTES 0x00500000
#define GRUB_PE32_SCN_ALIGN_32BYTES 0x00600000
#define GRUB_PE32_SCN_ALIGN_64BYTES 0x00700000
@ -1362,11 +1372,13 @@ index 9887e14b278..a39743396dc 100644
+#define GRUB_PE32_SCN_MEM_EXECUTE 0x20000000
+#define GRUB_PE32_SCN_MEM_READ 0x40000000
+#define GRUB_PE32_SCN_MEM_WRITE 0x80000000
+
+
+
#define GRUB_PE32_SIGNATURE_SIZE 4
#if GRUB_TARGET_SIZEOF_VOID_P == 8
@@ -292,6 +318,21 @@ struct grub_pe_image_header
struct grub_pe32_header
@@ -274,6 +302,20 @@ struct grub_pe32_header
#endif
};
@ -1383,7 +1395,6 @@ index 9887e14b278..a39743396dc 100644
+ struct grub_pe32_coff_header coff_header;
+ struct grub_pe64_optional_header optional_header;
+};
+
+
struct grub_pe32_fixup_block
{

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 13 Feb 2024 16:30:24 -0600
Date: Tue, 6 Oct 2015 16:09:25 -0400
Subject: [PATCH] Make any of the loaders that link in efi mode honor secure
boot.
@ -9,27 +9,30 @@ won't register commands if SB is enabled."
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/commands/iorw.c | 7 +++++++
grub-core/commands/memrw.c | 7 +++++++
grub-core/kern/dl.c | 4 ++--
grub-core/loader/efi/appleloader.c | 7 +++++++
grub-core/loader/i386/bsd.c | 7 +++++++
grub-core/loader/i386/linux.c | 7 +++++++
grub-core/loader/i386/pc/linux.c | 7 +++++++
grub-core/loader/multiboot.c | 7 +++++++
grub-core/loader/xnu.c | 7 +++++++
include/grub/ia64/linux.h | 0
include/grub/mips/linux.h | 0
include/grub/powerpc/linux.h | 0
include/grub/sparc64/linux.h | 0
13 files changed, 58 insertions(+), 2 deletions(-)
grub-core/commands/iorw.c | 7 +++++++
grub-core/commands/memrw.c | 7 +++++++
grub-core/kern/dl.c | 3 ++-
grub-core/kern/efi/efi.c | 34 ----------------------------------
grub-core/loader/efi/appleloader.c | 7 +++++++
grub-core/loader/efi/chainloader.c | 1 +
grub-core/loader/i386/bsd.c | 7 +++++++
grub-core/loader/i386/linux.c | 7 +++++++
grub-core/loader/i386/pc/linux.c | 7 +++++++
grub-core/loader/multiboot.c | 7 +++++++
grub-core/loader/xnu.c | 7 +++++++
include/grub/efi/efi.h | 1 -
include/grub/ia64/linux.h | 0
include/grub/mips/linux.h | 0
include/grub/powerpc/linux.h | 0
include/grub/sparc64/linux.h | 0
16 files changed, 59 insertions(+), 36 deletions(-)
create mode 100644 include/grub/ia64/linux.h
create mode 100644 include/grub/mips/linux.h
create mode 100644 include/grub/powerpc/linux.h
create mode 100644 include/grub/sparc64/linux.h
diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c
index 584baec8f91..7b2999b14b5 100644
index 584baec8f9..7b2999b14b 100644
--- a/grub-core/commands/iorw.c
+++ b/grub-core/commands/iorw.c
@@ -24,6 +24,7 @@
@ -61,7 +64,7 @@ index 584baec8f91..7b2999b14b5 100644
grub_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword);
diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c
index d401a6db0ef..39cf3a06dbd 100644
index d401a6db0e..39cf3a06db 100644
--- a/grub-core/commands/memrw.c
+++ b/grub-core/commands/memrw.c
@@ -23,6 +23,7 @@
@ -93,27 +96,73 @@ index d401a6db0ef..39cf3a06dbd 100644
grub_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword);
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index d48d4131ba7..2a9ae9fc894 100644
index b714937095..7afb9e6f72 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -871,13 +871,13 @@ grub_dl_load_file (const char *filename)
@@ -32,6 +32,7 @@
#include <grub/env.h>
#include <grub/cache.h>
#include <grub/i18n.h>
+#include <grub/efi/sb.h>
/* Platforms where modules are in a readonly area of memory. */
#if defined(GRUB_MACHINE_QEMU)
@@ -704,7 +705,7 @@ grub_dl_load_file (const char *filename)
grub_dl_t mod = 0;
#ifdef GRUB_MACHINE_EFI
- if (grub_efi_get_secureboot ())
- if (grub_efi_secure_boot ())
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
{
#if 0
/* This is an error, but grub2-mkconfig still generates a pile of
* insmod commands, so emitting it would be mostly just obnoxious. */
grub_error (GRUB_ERR_ACCESS_DENIED,
- "Secure Boot forbids loading module from %s", filename);
+ "Secure Boot forbids loading module from %s", filename);
#endif
return 0;
}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 4a2259aa1c..8cff7be028 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
}
-grub_efi_boolean_t
-grub_efi_secure_boot (void)
-{
- grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
- grub_size_t datasize;
- char *secure_boot = NULL;
- char *setup_mode = NULL;
- grub_efi_boolean_t ret = 0;
-
- secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
- if (datasize != 1 || !secure_boot)
- {
- grub_dprintf ("secureboot", "No SecureBoot variable\n");
- goto out;
- }
- grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot);
-
- setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
- if (datasize != 1 || !setup_mode)
- {
- grub_dprintf ("secureboot", "No SetupMode variable\n");
- goto out;
- }
- grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode);
-
- if (*secure_boot && !*setup_mode)
- ret = 1;
-
- out:
- grub_free (secure_boot);
- grub_free (setup_mode);
- return ret;
-}
-
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c
index a0b61a240b7..35d53c5f85d 100644
index 74888c463b..585f2b5738 100644
--- a/grub-core/loader/efi/appleloader.c
+++ b/grub-core/loader/efi/appleloader.c
@@ -24,6 +24,7 @@
@ -143,8 +192,20 @@ index a0b61a240b7..35d53c5f85d 100644
+
grub_unregister_command (cmd);
}
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index e6a8d4ad0e..07c4937898 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -34,6 +34,7 @@
#include <grub/efi/disk.h>
#include <grub/efi/pe32.h>
#include <grub/efi/linux.h>
+#include <grub/efi/sb.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub/net.h>
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
index 1f9128f6f20..8075ac9b06a 100644
index 5f3290ce17..54befc2662 100644
--- a/grub-core/loader/i386/bsd.c
+++ b/grub-core/loader/i386/bsd.c
@@ -40,6 +40,7 @@
@ -176,7 +237,7 @@ index 1f9128f6f20..8075ac9b06a 100644
grub_unregister_extcmd (cmd_openbsd);
grub_unregister_extcmd (cmd_netbsd);
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 10f967f2563..5a257552234 100644
index dccf3bb300..4aeb0e4b9a 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -37,6 +37,7 @@
@ -187,7 +248,7 @@ index 10f967f2563..5a257552234 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -1164,6 +1165,9 @@ static grub_command_t cmd_linux, cmd_initrd;
@@ -1138,6 +1139,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
@ -197,7 +258,7 @@ index 10f967f2563..5a257552234 100644
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, N_("Load Linux."));
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
@@ -1173,6 +1177,9 @@ GRUB_MOD_INIT(linux)
@@ -1147,6 +1151,9 @@ GRUB_MOD_INIT(linux)
GRUB_MOD_FINI(linux)
{
@ -208,7 +269,7 @@ index 10f967f2563..5a257552234 100644
grub_unregister_command (cmd_initrd);
}
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index 8593d74737f..54a76504a79 100644
index 4b1750e360..e3fa1221e8 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -36,6 +36,7 @@
@ -240,7 +301,7 @@ index 8593d74737f..54a76504a79 100644
grub_unregister_command (cmd_linux16);
grub_unregister_command (cmd_initrd);
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
index 94be512c4d0..94c112a29d4 100644
index facb13f3d3..47e481f457 100644
--- a/grub-core/loader/multiboot.c
+++ b/grub-core/loader/multiboot.c
@@ -50,6 +50,7 @@
@ -272,7 +333,7 @@ index 94be512c4d0..94c112a29d4 100644
grub_unregister_command (cmd_module);
}
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
index 4cca55df92d..f76f511ac2d 100644
index 1c0cf6a430..baa54e652a 100644
--- a/grub-core/loader/xnu.c
+++ b/grub-core/loader/xnu.c
@@ -35,6 +35,7 @@
@ -303,15 +364,27 @@ index 4cca55df92d..f76f511ac2d 100644
#ifndef GRUB_MACHINE_EMU
grub_unregister_command (cmd_resume);
#endif
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 6295df85f3..585fa6662b 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
const grub_efi_guid_t *guid,
void *data,
grub_size_t datasize);
-grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
int
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
const grub_efi_device_path_t *dp2);
diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h
new file mode 100644
index 00000000000..e69de29bb2d
index 0000000000..e69de29bb2
diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h
new file mode 100644
index 00000000000..e69de29bb2d
index 0000000000..e69de29bb2
diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h
new file mode 100644
index 00000000000..e69de29bb2d
index 0000000000..e69de29bb2
diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h
new file mode 100644
index 00000000000..e69de29bb2d
index 0000000000..e69de29bb2

View file

@ -7,40 +7,40 @@ Allow booting 64-bit kernels on 32-bit EFI on x86.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/linux.c | 9 ++-
grub-core/loader/i386/efi/linux.c | 116 ++++++++++++++++++++++++++------------
include/grub/i386/linux.h | 5 ++
3 files changed, 91 insertions(+), 39 deletions(-)
grub-core/loader/efi/linux.c | 9 +++-
grub-core/loader/i386/efi/linux.c | 110 ++++++++++++++++++++++++++------------
include/grub/i386/linux.h | 7 ++-
3 files changed, 89 insertions(+), 37 deletions(-)
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index 0a7f8208022..742e8e9af35 100644
index c8ecce6dfd..0622dfa48d 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -136,12 +136,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
@@ -69,12 +69,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *);
grub_err_t
-grub_efi_linux_boot (void *kernel_address, grub_off_t offset,
+grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset,
-grub_efi_linux_boot (void *kernel_addr, grub_off_t offset,
+grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset,
void *kernel_params)
{
handover_func hf;
+ int offset = 0;
- hf = (handover_func)((char *)kernel_address + offset);
- hf = (handover_func)((char *)kernel_addr + offset);
+#ifdef __x86_64__
+ offset = 512;
+#endif
+
+ hf = (handover_func)((char *)kernel_address + handover_offset + offset);
+ hf = (handover_func)((char *)kernel_addr + handover_offset + offset);
hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
return GRUB_ERR_BUG;
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index b59d125286d..3c2e30f8751 100644
index 6b24cbb948..3017d0f3e5 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -44,15 +44,11 @@ static char *linux_cmdline;
@@ -44,14 +44,10 @@ static char *linux_cmdline;
static grub_err_t
grub_linuxefi_boot (void)
{
@ -52,13 +52,11 @@ index b59d125286d..3c2e30f8751 100644
asm volatile ("cli");
- return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset,
- params);
+ return grub_efi_linux_boot ((char *)kernel_mem,
+ handover_offset,
+ params);
params);
}
static grub_err_t
@@ -153,14 +149,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
@ -70,7 +68,7 @@ index b59d125286d..3c2e30f8751 100644
+
static grub_err_t
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
int argc, char *argv[])
{
grub_file_t file = 0;
- struct linux_i386_kernel_header lh;
@ -168,7 +166,7 @@ index b59d125286d..3c2e30f8751 100644
+
grub_dprintf ("linux", "setting up cmdline\n");
linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
- BYTES_TO_PAGES(lh.cmdline_size + 1));
- BYTES_TO_PAGES(lh.cmdline_size + 1));
-
+ BYTES_TO_PAGES(lh->cmdline_size + 1));
if (!linux_cmdline)
@ -178,10 +176,9 @@ index b59d125286d..3c2e30f8751 100644
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
grub_create_loader_cmdline (argc, argv,
linux_cmdline + sizeof (LINUX_IMAGE) - 1,
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
- GRUB_VERIFY_KERNEL_CMDLINE);
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ GRUB_VERIFY_KERNEL_CMDLINE);
GRUB_VERIFY_KERNEL_CMDLINE);
- lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
+ grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline);
@ -197,13 +194,13 @@ index b59d125286d..3c2e30f8751 100644
+ start = (lh->setup_sects + 1) * 512;
- kernel_mem = grub_efi_allocate_pages_max(lh.pref_address,
- BYTES_TO_PAGES(lh.init_size));
- BYTES_TO_PAGES(lh.init_size));
+ kernel_mem = grub_efi_allocate_pages_max(lh->pref_address,
+ BYTES_TO_PAGES(lh->init_size));
if (!kernel_mem)
kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
- BYTES_TO_PAGES(lh.init_size));
- BYTES_TO_PAGES(lh.init_size));
+ BYTES_TO_PAGES(lh->init_size));
if (!kernel_mem)
@ -232,7 +229,7 @@ index b59d125286d..3c2e30f8751 100644
+ params->ext_loader_type = 0;
+ params->ext_loader_ver = 2;
grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n",
kernel_mem, handover_offset);
kernel_mem, handover_offset);
@@ -301,10 +343,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
loaded = 0;
@ -241,26 +238,27 @@ index b59d125286d..3c2e30f8751 100644
- if (linux_cmdline && !loaded)
+ if (linux_cmdline && lh && !loaded)
grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
- linux_cmdline,
- BYTES_TO_PAGES(lh.cmdline_size + 1));
+ linux_cmdline,
linux_cmdline,
- BYTES_TO_PAGES(lh.cmdline_size + 1));
+ BYTES_TO_PAGES(lh->cmdline_size + 1));
if (kernel_mem && !loaded)
grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
index d4b55086953..4ccd9d7d9f2 100644
index eddf9251d9..25ef52c04e 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -148,6 +148,11 @@ struct linux_i386_kernel_header
@@ -138,7 +138,12 @@ struct linux_i386_kernel_header
grub_uint32_t kernel_alignment;
grub_uint8_t relocatable;
grub_uint8_t min_alignment;
- grub_uint8_t pad[2];
+#define LINUX_XLF_KERNEL_64 (1<<0)
+#define LINUX_XLF_CAN_BE_LOADED_ABOVE_4G (1<<1)
+#define LINUX_XLF_EFI_HANDOVER_32 (1<<2)
+#define LINUX_XLF_EFI_HANDOVER_64 (1<<3)
+#define LINUX_XLF_EFI_KEXEC (1<<4)
grub_uint16_t xloadflags;
+ grub_uint16_t xloadflags;
grub_uint32_t cmdline_size;
grub_uint32_t hardware_subarch;
grub_uint64_t hardware_subarch_data;

View file

@ -20,10 +20,10 @@ Subject: [PATCH] re-write .gitignore
create mode 100644 util/bash-completion.d/.gitignore
diff --git a/.gitignore b/.gitignore
index 4d0dfb700e4..a18787dcfe6 100644
index f6a1bd0517..208d1d2325 100644
--- a/.gitignore
+++ b/.gitignore
@@ -279,3 +279,153 @@ widthspec.bin
@@ -275,3 +275,153 @@ widthspec.bin
/xfs_test
/xzcompress_test
/zfs_test
@ -179,7 +179,7 @@ index 4d0dfb700e4..a18787dcfe6 100644
+/widthspec.h
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 00000000000..e1d849ef95b
index 0000000000..e1d849ef95
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,5 @@
@ -190,7 +190,7 @@ index 00000000000..e1d849ef95b
+/version*.texi
diff --git a/grub-core/.gitignore b/grub-core/.gitignore
new file mode 100644
index 00000000000..2acce281159
index 0000000000..2acce28115
--- /dev/null
+++ b/grub-core/.gitignore
@@ -0,0 +1,16 @@
@ -212,14 +212,14 @@ index 00000000000..2acce281159
+/trigtables.c
diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore
new file mode 100644
index 00000000000..68154591404
index 0000000000..6815459140
--- /dev/null
+++ b/grub-core/lib/.gitignore
@@ -0,0 +1 @@
+/libgcrypt-grub/
diff --git a/include/grub/gcrypt/.gitignore b/include/grub/gcrypt/.gitignore
new file mode 100644
index 00000000000..8fbf5646246
index 0000000000..8fbf564624
--- /dev/null
+++ b/include/grub/gcrypt/.gitignore
@@ -0,0 +1,2 @@
@ -227,7 +227,7 @@ index 00000000000..8fbf5646246
+gcrypt.h
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 00000000000..f507e7741e3
index 0000000000..f507e7741e
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,5 @@
@ -238,7 +238,7 @@ index 00000000000..f507e7741e3
+/stamp-po
diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore
new file mode 100644
index 00000000000..6813a527ad3
index 0000000000..6813a527ad
--- /dev/null
+++ b/util/bash-completion.d/.gitignore
@@ -0,0 +1,2 @@

View file

@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 91 insertions(+)
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 11b2beb2ff2..e2ecc65d2d8 100644
index 4d493ab766..3a6689abb1 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)
@ -100,7 +100,7 @@ index 11b2beb2ff2..e2ecc65d2d8 100644
+ return 0;
+}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index bd44310005d..d3f53d93d87 100644
index c4ebe9e22a..70614de156 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -34,6 +34,9 @@
@ -137,7 +137,7 @@ index bd44310005d..d3f53d93d87 100644
grub_errno = GRUB_ERR_NONE;
}
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index 14ff09094f0..dab8fd2aeb0 100644
index 25158407dd..ad80399246 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -28,6 +28,9 @@
@ -162,10 +162,10 @@ index 14ff09094f0..dab8fd2aeb0 100644
{
char *line;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index dddb385149e..4f6e6aaa098 100644
index 73e2f46447..0a599607f3 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -251,6 +251,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
@@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias);

View file

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
index 4e534c683eb..3dbe88e8933 100644
index 85ecf06b4d..05c88dcf49 100644
--- a/grub-core/term/terminfo.c
+++ b/grub-core/term/terminfo.c
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,

View file

@ -15,10 +15,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index e74de32483f..810a089a934 100644
index 20cbbd761e..04df9d2c66 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -89,7 +89,10 @@ grub_ieee1275_find_options (void)
@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void)
}
if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
@ -31,10 +31,10 @@ index e74de32483f..810a089a934 100644
/* Old Macs have no key repeat, newer ones have fully working one.
The ones inbetween when repeated key generates an escaoe sequence
diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c
index ca3d3c3b2c8..5592e4bb7c9 100644
index 17a3dbbb57..b8e4b3feb3 100644
--- a/grub-core/video/ieee1275.c
+++ b/grub-core/video/ieee1275.c
@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
GRUB_MOD_INIT(ieee1275_fb)
{
@ -51,14 +51,14 @@ index ca3d3c3b2c8..5592e4bb7c9 100644
GRUB_MOD_FINI(ieee1275_fb)
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 4f6e6aaa098..db0ec5f4c68 100644
index 0a599607f3..b5a1d49bbc 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -145,6 +145,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_POWER_VM,
@@ -148,6 +148,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
GRUB_IEEE1275_FLAG_POWER_KVM,
+
GRUB_IEEE1275_FLAG_RAW_DEVNAMES,
+
+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
};

View file

@ -10,10 +10,10 @@ Apparently these go in a new place now.
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index cd667a2eb75..ae3a49321ad 100644
index 7517fc49d9..8331f95b64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,6 +319,14 @@ AC_SUBST(grubdirname)
@@ -314,6 +314,14 @@ AC_SUBST(grubdirname)
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
[Default grub directory name])
@ -28,7 +28,7 @@ index cd667a2eb75..ae3a49321ad 100644
#
# Checks for build programs.
#
@@ -534,6 +542,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
@@ -525,6 +533,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
# Check for target programs.
#
@ -39,7 +39,7 @@ index cd667a2eb75..ae3a49321ad 100644
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
tmp_ac_tool_prefix="$ac_tool_prefix"
diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am
index 136287cf1bf..61108f05429 100644
index 136287cf1b..61108f0542 100644
--- a/util/bash-completion.d/Makefile.am
+++ b/util/bash-completion.d/Makefile.am
@@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source)

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 58 insertions(+), 27 deletions(-)
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index 6a90e091f22..6444ee6f969 100644
index 8397886fa0..d7a222e681 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout)

View file

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/commands/minicmd.c | 20 ++++++++++++++++----
grub-core/kern/efi/efi.c | 9 +++++++--
grub-core/kern/emu/main.c | 2 +-
grub-core/kern/emu/misc.c | 9 +++++----
grub-core/kern/emu/misc.c | 5 +++--
grub-core/kern/i386/coreboot/init.c | 2 +-
grub-core/kern/i386/qemu/init.c | 2 +-
grub-core/kern/ieee1275/init.c | 2 +-
@ -24,10 +24,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/uboot/init.c | 6 +++---
grub-core/kern/xen/init.c | 2 +-
include/grub/misc.h | 2 +-
14 files changed, 50 insertions(+), 23 deletions(-)
14 files changed, 48 insertions(+), 21 deletions(-)
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
index fa498931ed2..2bd3ac76f2d 100644
index fa498931ed..2bd3ac76f2 100644
--- a/grub-core/commands/minicmd.c
+++ b/grub-core/commands/minicmd.c
@@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
@ -60,10 +60,10 @@ index fa498931ed2..2bd3ac76f2d 100644
}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index b93ae3aba12..885d7c6420e 100644
index 8cff7be028..05d8237a9b 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -175,11 +175,16 @@ grub_reboot (void)
@@ -165,11 +165,16 @@ grub_reboot (void)
}
void
@ -76,14 +76,14 @@ index b93ae3aba12..885d7c6420e 100644
+ rc = GRUB_EFI_SUCCESS;
+
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
grub_efi_system_table->boot_services->exit (grub_efi_image_handle,
- GRUB_EFI_SUCCESS, 0, 0);
+ rc, 0, 0);
efi_call_4 (grub_efi_system_table->boot_services->exit,
- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
+ grub_efi_image_handle, rc, 0, 0);
for (;;) ;
}
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
index 855b11c3dec..38c1576a2ef 100644
index 425bb96034..55ea5a11cc 100644
--- a/grub-core/kern/emu/main.c
+++ b/grub-core/kern/emu/main.c
@@ -67,7 +67,7 @@ grub_reboot (void)
@ -96,19 +96,10 @@ index 855b11c3dec..38c1576a2ef 100644
grub_reboot ();
}
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index 521220b49d2..16c79bc9488 100644
index dfd8a8ec48..0ff13bcaf8 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -83,7 +83,7 @@ grub_util_error (const char *fmt, ...)
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
- grub_exit ();
+ grub_exit (1);
}
void *
@@ -152,12 +152,13 @@ xasprintf (const char *fmt, ...)
@@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...)
#if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
void
@ -116,17 +107,13 @@ index 521220b49d2..16c79bc9488 100644
+__attribute__ ((noreturn))
+grub_exit (int rc)
{
-#if defined (GRUB_KERNEL)
+#if defined (GRUB_KERNEL) && !defined (GRUB_MACHINE_EFI)
grub_reboot ();
#endif
- exit (1);
+ exit (rc < 0 ? 1 : rc);
}
#endif
diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c
index 4fae8b571f1..feaf9295e30 100644
index 3314f027fe..36f9134b7b 100644
--- a/grub-core/kern/i386/coreboot/init.c
+++ b/grub-core/kern/i386/coreboot/init.c
@@ -41,7 +41,7 @@ extern grub_uint8_t _end[];
@ -139,7 +126,7 @@ index 4fae8b571f1..feaf9295e30 100644
/* We can't use grub_fatal() in this function. This would create an infinite
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c
index 08f81d25e68..604fc94b5a0 100644
index 271b6fbfab..9fafe98f01 100644
--- a/grub-core/kern/i386/qemu/init.c
+++ b/grub-core/kern/i386/qemu/init.c
@@ -42,7 +42,7 @@ extern grub_uint8_t _end[];
@ -152,11 +139,11 @@ index 08f81d25e68..604fc94b5a0 100644
/* We can't use grub_fatal() in this function. This would create an infinite
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index fb7d1a3bacf..50c65b2f6e5 100644
index d483e35eed..e71d158416 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack;
#define BYTE22 (DY_MEM_V2 | DRC_INFO)
@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack;
#endif
void
-grub_exit (void)
@ -165,7 +152,7 @@ index fb7d1a3bacf..50c65b2f6e5 100644
grub_ieee1275_exit ();
}
diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c
index 2ed3ff3191e..5c40c34078d 100644
index 2ed3ff3191..5c40c34078 100644
--- a/grub-core/kern/mips/arc/init.c
+++ b/grub-core/kern/mips/arc/init.c
@@ -276,7 +276,7 @@ grub_halt (void)
@ -178,7 +165,7 @@ index 2ed3ff3191e..5c40c34078d 100644
GRUB_ARC_FIRMWARE_VECTOR->exit ();
diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c
index 5bd721260f6..97b09b0eeea 100644
index 7b96531b98..dff598ca7b 100644
--- a/grub-core/kern/mips/loongson/init.c
+++ b/grub-core/kern/mips/loongson/init.c
@@ -304,7 +304,7 @@ grub_halt (void)
@ -191,7 +178,7 @@ index 5bd721260f6..97b09b0eeea 100644
grub_halt ();
}
diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c
index b5477b87ffa..69488a34e7c 100644
index be88b77d22..8b6c55ffc0 100644
--- a/grub-core/kern/mips/qemu_mips/init.c
+++ b/grub-core/kern/mips/qemu_mips/init.c
@@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused)))
@ -204,10 +191,10 @@ index b5477b87ffa..69488a34e7c 100644
grub_halt ();
}
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 7cee5d75c3c..11037dc0227 100644
index 3af336ee22..63b586d09c 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1311,9 +1311,18 @@ grub_abort (void)
@@ -1209,9 +1209,18 @@ grub_abort (void)
grub_getkey ();
}
@ -228,7 +215,7 @@ index 7cee5d75c3c..11037dc0227 100644
grub_fatal (const char *fmt, ...)
{
diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c
index 3e338645c57..be2a5be1d07 100644
index 3e338645c5..be2a5be1d0 100644
--- a/grub-core/kern/uboot/init.c
+++ b/grub-core/kern/uboot/init.c
@@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size;
@ -253,7 +240,7 @@ index 3e338645c57..be2a5be1d07 100644
else if (ver > API_SIG_VERSION)
{
diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
index 782ca72952a..708b060f324 100644
index 782ca72952..708b060f32 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -584,7 +584,7 @@ grub_machine_init (void)
@ -266,15 +253,15 @@ index 782ca72952a..708b060f324 100644
struct sched_shutdown arg;
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 1b35a167fde..72aff15750d 100644
index 7d2b551969..fd18e6320b 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
@@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT;
-void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
+void EXPORT_FUNC(grub_exit) (int rc) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint64_t d,
grub_uint64_t *r);

View file

@ -6,14 +6,14 @@ Subject: [PATCH] Make efi machines load an env block from a variable
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 1 +
grub-core/kern/efi/init.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
grub-core/kern/efi/init.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 1571421d7e8..0bffbfea917 100644
index 45d3edaa4d..c865a08b02 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -219,6 +219,7 @@ kernel = {
@@ -207,6 +207,7 @@ kernel = {
efi = kern/efi/acpi.c;
efi = kern/efi/sb.c;
efi = kern/lockdown.c;
@ -22,10 +22,10 @@ index 1571421d7e8..0bffbfea917 100644
i386_multiboot = kern/i386/pc/acpi.c;
i386_coreboot = kern/acpi.c;
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index 6c54af6e79e..b5201974a76 100644
index 7facacf09c..6d39bd3ad2 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -28,8 +28,11 @@
@@ -27,8 +27,11 @@
#include <grub/env.h>
#include <grub/mm.h>
#include <grub/kernel.h>
@ -36,8 +36,8 @@ index 6c54af6e79e..b5201974a76 100644
+
#ifdef GRUB_STACK_PROTECTOR
static grub_efi_char16_t stack_chk_fail_msg[] =
@@ -103,6 +106,36 @@ stack_protector_init (void)
static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
@@ -82,6 +85,36 @@ stack_protector_init (void)
grub_addr_t grub_modbase;
@ -58,7 +58,7 @@ index 6c54af6e79e..b5201974a76 100644
+static void
+grub_efi_env_init (void)
+{
+ grub_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
+ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
+ struct grub_envblk envblk_s = { NULL, 0 };
+ grub_envblk_t envblk = &envblk_s;
+
@ -71,14 +71,19 @@ index 6c54af6e79e..b5201974a76 100644
+ grub_free (envblk_s.buf);
+}
+
__attribute__ ((__optimize__ ("-fno-stack-protector"))) void
void
grub_efi_init (void)
{
@@ -128,6 +161,7 @@ grub_efi_init (void)
grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL);
@@ -108,10 +141,11 @@ grub_efi_init (void)
efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
0, 0, 0, NULL);
+ grub_efi_env_init ();
grub_efidisk_init ();
}
-void (*grub_efi_net_config) (grub_efi_handle_t hnd,
+void (*grub_efi_net_config) (grub_efi_handle_t hnd,
char **device,
char **path);
grub_efi_register_debug_commands ();

View file

@ -15,11 +15,11 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub.d/20_ppc_terminfo.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 9432365a9df..09bfcadd976 100644
index f8b356cc1f..2c9b283a23 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -517,6 +517,13 @@ script = {
installdir = grubconf;
@@ -508,6 +508,13 @@ script = {
condition = COND_HOST_LINUX;
};
+script = {
@ -34,7 +34,7 @@ index 9432365a9df..09bfcadd976 100644
common = util/grub.d/30_os-prober.in;
diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
new file mode 100644
index 00000000000..10d66586820
index 0000000000..10d6658682
--- /dev/null
+++ b/util/grub.d/20_ppc_terminfo.in
@@ -0,0 +1,114 @@

View file

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 731c07c2901..463dafdba02 100644
index 73967e2f5b..d1de9fa687 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)
@ -44,7 +44,7 @@ index 731c07c2901..463dafdba02 100644
}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index d3f53d93d87..08f48c71df1 100644
index 70614de156..62571e6dfc 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
index ed65865050a..5455242c352 100644
index cc3290311f..8f67a4be7f 100644
--- a/grub-core/commands/wildcard.c
+++ b/grub-core/commands/wildcard.c
@@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename)
@ -47,7 +47,7 @@ index ed65865050a..5455242c352 100644
*optr++ = iptr[1];
iptr += 2;
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index ed0b149dca5..8e2294d8ff6 100644
index ed0b149dca..8e2294d8ff 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -20,6 +20,12 @@
@ -97,7 +97,7 @@ index ed0b149dca5..8e2294d8ff6 100644
*buf++ = *c;
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index dab8fd2aeb0..c19b4bf700e 100644
index ad80399246..0c6dd9c520 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0;

View file

@ -28,10 +28,10 @@ Signed-off-by: Will Thompson <wjt@endlessm.com>
create mode 100644 grub-core/commands/loadenv.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 0bffbfea917..47c0fc755a2 100644
index c865a08b02..c15e91943b 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -842,6 +842,16 @@ module = {
@@ -814,6 +814,16 @@ module = {
common = commands/blocklist.c;
};
@ -48,7 +48,7 @@ index 0bffbfea917..47c0fc755a2 100644
module = {
name = boot;
common = commands/boot.c;
@@ -1009,6 +1019,7 @@ module = {
@@ -980,6 +990,7 @@ module = {
module = {
name = loadenv;
common = commands/loadenv.c;
@ -58,7 +58,7 @@ index 0bffbfea917..47c0fc755a2 100644
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
new file mode 100644
index 00000000000..e907a6a5d28
index 0000000000..e907a6a5d2
--- /dev/null
+++ b/grub-core/commands/blscfg.c
@@ -0,0 +1,1177 @@
@ -1240,7 +1240,7 @@ index 00000000000..e907a6a5d28
+ grub_unregister_extcmd (oldcmd);
+}
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
index e9e9d94eff5..2c5d1a0ef9a 100644
index cc5971f4db..782761c31a 100644
--- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c
@@ -143,7 +143,7 @@ legacy_file (const char *filename)
@ -1263,7 +1263,7 @@ index e9e9d94eff5..2c5d1a0ef9a 100644
}
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
index 16644584978..dfcb19e0ff8 100644
index 3fd664aac3..163b9a0904 100644
--- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c
@@ -28,6 +28,8 @@
@ -1358,7 +1358,7 @@ index 16644584978..dfcb19e0ff8 100644
grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args)
{
diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c
index 720e6d8ea3b..b194123eb67 100644
index 720e6d8ea3..b194123eb6 100644
--- a/grub-core/commands/menuentry.c
+++ b/grub-core/commands/menuentry.c
@@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
@ -1430,7 +1430,7 @@ index 720e6d8ea3b..b194123eb67 100644
src[len - 1] = ch;
args[argc - 1] = src;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 08f48c71df1..1317279c081 100644
index 62571e6dfc..7ca2e5400b 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -21,6 +21,7 @@
@ -1455,7 +1455,7 @@ index 08f48c71df1..1317279c081 100644
grub_free ((void *) entry->title);
diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h
new file mode 100644
index 00000000000..952f46121bd
index 0000000000..952f46121b
--- /dev/null
+++ b/grub-core/commands/loadenv.h
@@ -0,0 +1,93 @@
@ -1553,7 +1553,7 @@ index 00000000000..952f46121bd
+ return 0;
+}
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
index 0c5519387b2..441a9eca07c 100644
index 8f3be3ae70..ebafec6895 100644
--- a/include/grub/compiler.h
+++ b/include/grub/compiler.h
@@ -56,4 +56,6 @@
@ -1564,7 +1564,7 @@ index 0c5519387b2..441a9eca07c 100644
+
#endif /* ! GRUB_COMPILER_HEADER */
diff --git a/include/grub/menu.h b/include/grub/menu.h
index ee2b5e91045..0acdc2aa6bf 100644
index ee2b5e9104..0acdc2aa6b 100644
--- a/include/grub/menu.h
+++ b/include/grub/menu.h
@@ -20,6 +20,16 @@
@ -1595,7 +1595,7 @@ index ee2b5e91045..0acdc2aa6bf 100644
typedef struct grub_menu_entry *grub_menu_entry_t;
diff --git a/include/grub/normal.h b/include/grub/normal.h
index 218cbabccaf..8839ad85a19 100644
index 218cbabcca..8839ad85a1 100644
--- a/include/grub/normal.h
+++ b/include/grub/normal.h
@@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes,

View file

@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin <dmarlin@redhat.com>
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 7516a015be0..7b355115dd4 100644
index d3e879b8e5..8ea2315ebc 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -252,7 +252,8 @@ export GRUB_DEFAULT \
@@ -248,7 +248,8 @@ export GRUB_DEFAULT \
GRUB_ENABLE_CRYPTODISK \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
@ -34,10 +34,10 @@ index 7516a015be0..7b355115dd4 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index cc393be7eda..00d4b220ccb 100644
index e8b01c0d0c..dc75a1c30b 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -155,6 +155,13 @@ EOF
@@ -153,6 +153,13 @@ EOF
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
initrd $(echo $initrd_path)
@ -51,7 +51,7 @@ index cc393be7eda..00d4b220ccb 100644
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
@@ -250,6 +257,14 @@ for linux in ${reverse_sorted_list}; do
@@ -236,6 +243,14 @@ while [ "x$list" != "x" ] ; do
gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
fi

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 6a316a5ba77..c2d8b093762 100644
index 93a90233ea..858b526c92 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_

View file

@ -13,20 +13,20 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 1317279c081..568c2adfa16 100644
index 7ca2e5400b..98372217ad 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term,
grub_term_cls (term);
- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
+ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted)
return;
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
index 8a87109b152..9a4319d4f4f 100644
index 8a87109b15..9a4319d4f4 100644
--- a/tests/util/grub-shell-tester.in
+++ b/tests/util/grub-shell-tester.in
@@ -56,7 +56,7 @@ for option in "$@"; do
@ -39,10 +39,10 @@ index 8a87109b152..9a4319d4f4f 100644
--modules=*)
ms=`echo "$option" | sed -e 's/--modules=//'`
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 496e1bab33c..e0570c88e15 100644
index 93e9f51484..ec1182bf93 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -243,7 +243,7 @@ for option in "$@"; do
@@ -209,7 +209,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
@ -50,9 +50,9 @@ index 496e1bab33c..e0570c88e15 100644
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--trim)
trim=1 ;;
trim=1
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 00d4b220ccb..901745707f1 100644
index dc75a1c30b..4a499c53a6 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
@ -68,7 +68,7 @@ index 00d4b220ccb..901745707f1 100644
fi
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 94dd8be1342..98ee5bc58dc 100644
index 3b1f470492..ada20775a1 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -3,21 +3,20 @@ From: Fedora Ninjas <grub2-owner@fedoraproject.org>
Date: Mon, 13 Jan 2014 21:50:59 -0500
Subject: [PATCH] Add .eh_frame to list of relocations stripped
Signed-off-by: Peter Jones <pjones@redhat.com>
---
conf/Makefile.common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index b8f216f6cd3..ece9ed8a1bf 100644
index 2a1a886f6d..191b1a70c6 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
@@ -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 .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
if !COND_emu
if COND_HAVE_ASM_USCORE
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d

View file

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 901745707f1..9c31a94decb 100644
index 4a499c53a6..cf8d118698 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"

View file

@ -17,7 +17,7 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 568c2adfa16..0b2bbee19c3 100644
index 98372217ad..bf24e65713 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 51 insertions(+), 46 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 0b2bbee19c3..4c89892fa70 100644
index bf24e65713..0a99768f75 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 9c31a94decb..b7809091b36 100644
index cf8d118698..5f6d3c8d52 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 8 insertions(+)
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index c2e107b41ab..4eadcba4b85 100644
index 301d1ac229..0f6505bf3b 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -299,6 +299,14 @@ version_test_gt ()
@@ -253,6 +253,14 @@ version_test_gt ()
*.old:*.old) ;;
*.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
*:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;

View file

@ -7,26 +7,38 @@ Related: rhbz#1148652
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/ieee1275/init.c | 34 ++++++-----
grub-core/kern/ieee1275/init.c | 28 +++++----
grub-core/net/net.c | 2 +-
grub-core/normal/main.c | 134 ++++++++++++++++++++---------------------
3 files changed, 85 insertions(+), 85 deletions(-)
3 files changed, 82 insertions(+), 82 deletions(-)
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 50c65b2f6e5..51c1e1c9d9f 100644
index e71d158416..0cd2a62723 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -170,23 +170,25 @@ grub_machine_get_bootlocation (char **device, char **path)
@@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path)
grub_free (canon);
}
else
- *device = grub_ieee1275_encode_devname (bootpath);
+ {
- grub_free (type);
-
- filename = grub_ieee1275_get_filename (bootpath);
- if (filename)
{
- char *lastslash = grub_strrchr (filename, '\\');
-
- /* Truncate at last directory. */
- if (lastslash)
+ filename = grub_ieee1275_get_filename (bootpath);
+ if (filename)
+ {
{
- *lastslash = '\0';
- grub_translate_ieee1275_path (filename);
+ char *lastslash = grub_strrchr (filename, '\\');
+
- *path = filename;
- }
+ /* Truncate at last directory. */
+ if (lastslash)
+ {
@ -37,32 +49,17 @@ index 50c65b2f6e5..51c1e1c9d9f 100644
+ }
+ }
+ *device = grub_ieee1275_encode_devname (bootpath);
+ }
}
+
grub_free (type);
-
- filename = grub_ieee1275_get_filename (bootpath);
- if (filename)
- {
- char *lastslash = grub_strrchr (filename, '\\');
-
- /* Truncate at last directory. */
- if (lastslash)
- {
- *lastslash = '\0';
- grub_translate_ieee1275_path (filename);
-
- *path = filename;
- }
- }
+ grub_free (type);
grub_free (bootpath);
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 8cad4fb6d4d..54451cea2a7 100644
index 4d3eb5c1a5..0ef148f4ad 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -2005,7 +2005,7 @@ grub_net_search_config_file (char *config)
@@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config)
/* Remove the remaining minus sign at the end. */
config[config_len] = '\0';
@ -72,7 +69,7 @@ index 8cad4fb6d4d..54451cea2a7 100644
static struct grub_preboot *fini_hnd;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 4c89892fa70..3463f444f74 100644
index 0a99768f75..55558cc0b9 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config)

View file

@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index b7809091b36..993c53ad92e 100644
index 5f6d3c8d52..786dbabb4a 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -80,6 +80,32 @@ case x"$GRUB_FS" in
@@ -78,6 +78,32 @@ case x"$GRUB_FS" in
;;
esac
@ -48,7 +48,7 @@ index b7809091b36..993c53ad92e 100644
title_correction_code=
linux_entry ()
@@ -93,17 +119,11 @@ linux_entry ()
@@ -91,17 +117,11 @@ linux_entry ()
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ x$type != xsimple ] ; then

View file

@ -29,10 +29,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub.d/01_users.in
diff --git a/configure.ac b/configure.ac
index ae3a49321ad..493e336ec6c 100644
index 8331f95b64..7f59ad788f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,7 @@ grub_TRANSFORM([grub-mkrelpath])
@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
@ -41,10 +41,10 @@ index ae3a49321ad..493e336ec6c 100644
grub_TRANSFORM([grub-set-default])
grub_TRANSFORM([grub-sparc64-setup])
diff --git a/Makefile.util.def b/Makefile.util.def
index 09bfcadd976..95884956a68 100644
index 2c9b283a23..4ee22c5daa 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -455,6 +455,12 @@ script = {
@@ -452,6 +452,12 @@ script = {
installdir = grubconf;
};
@ -57,7 +57,7 @@ index 09bfcadd976..95884956a68 100644
script = {
name = '10_windows';
common = util/grub.d/10_windows.in;
@@ -733,6 +739,13 @@ script = {
@@ -724,6 +730,13 @@ script = {
installdir = sbin;
};
@ -73,17 +73,17 @@ index 09bfcadd976..95884956a68 100644
common = util/grub-mkconfig_lib.in;
diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m
new file mode 100644
index 00000000000..10ee82f4d52
index 0000000000..10ee82f4d5
--- /dev/null
+++ b/docs/man/grub-set-password.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 7b355115dd4..5f2824d4f58 100644
index 8ea2315ebc..ba14cf6261 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -280,6 +280,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
@@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
*~) ;;
# emacsen autosave files. FIXME: support other editors
*/\#*\#) ;;
@ -94,7 +94,7 @@ index 7b355115dd4..5f2824d4f58 100644
echo
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
new file mode 100644
index 00000000000..5ebf50576d6
index 0000000000..5ebf50576d
--- /dev/null
+++ b/util/grub-set-password.in
@@ -0,0 +1,128 @@
@ -228,7 +228,7 @@ index 00000000000..5ebf50576d6
+fi
diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in
new file mode 100644
index 00000000000..db2f44bfb78
index 0000000000..db2f44bfb7
--- /dev/null
+++ b/util/grub.d/01_users.in
@@ -0,0 +1,11 @@

View file

@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik <jbacik@fb.com>
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c
index 93dee0caa1b..902ab7e8ae6 100644
index e8ad34b84d..7d4b822626 100644
--- a/grub-core/net/tcp.c
+++ b/grub-core/net/tcp.c
@@ -106,6 +106,18 @@ struct tcphdr
@ -39,7 +39,7 @@ index 93dee0caa1b..902ab7e8ae6 100644
struct tcp_pseudohdr
{
grub_uint32_t src;
@@ -571,7 +583,7 @@ grub_net_tcp_open (char *server,
@@ -566,7 +578,7 @@ grub_net_tcp_open (char *server,
grub_net_tcp_socket_t socket;
static grub_uint16_t in_port = 21550;
struct grub_net_buff *nb;
@ -48,7 +48,7 @@ index 93dee0caa1b..902ab7e8ae6 100644
int i;
grub_uint8_t *nbd;
grub_net_link_level_address_t ll_target_addr;
@@ -640,20 +652,24 @@ grub_net_tcp_open (char *server,
@@ -635,20 +647,24 @@ grub_net_tcp_open (char *server,
}
tcph = (void *) nb->data;

View file

@ -6,18 +6,18 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++
grub-core/net/drivers/efi/efinet.c | 84 +++++++++++++-----
grub-core/net/drivers/efi/efinet.c | 53 ++++++++++--
grub-core/net/net.c | 72 +++++++++++++++
grub-core/net/tftp.c | 3 +
grub-core/net/tftp.c | 4 +
include/grub/efi/api.h | 129 +++++++++++++++++++++++++--
include/grub/net.h | 60 +++++++++++++
6 files changed, 491 insertions(+), 30 deletions(-)
6 files changed, 477 insertions(+), 14 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index abe45ef7bf6..02d2c2614cb 100644
index 6fb5627025..e28fb6a09f 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -905,6 +905,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
@@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
@ -198,7 +198,7 @@ index abe45ef7bf6..02d2c2614cb 100644
grub_bootp_init (void)
{
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 3ea25cf9894..2af8742f904 100644
index 5388f952ba..173fb63153 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -18,11 +18,14 @@
@ -216,16 +216,16 @@ index 3ea25cf9894..2af8742f904 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -346,7 +349,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -329,7 +332,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path)
{
struct grub_net_card *card;
- grub_efi_device_path_t *dp;
+ grub_efi_device_path_t *dp, *ldp = NULL;
struct grub_net_network_level_interface *inter;
grub_efi_device_path_t *vlan_dp;
grub_efi_uint16_t vlan_dp_len;
@@ -361,14 +364,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
dp = grub_efi_get_device_path (hnd);
if (! dp)
@@ -340,14 +343,19 @@ 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;
@ -246,7 +246,7 @@ index 3ea25cf9894..2af8742f904 100644
int match;
/* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6
@@ -377,7 +385,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -356,7 +364,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
devices. We skip them when enumerating cards, so here we need to
find matching MAC device.
*/
@ -254,7 +254,7 @@ index 3ea25cf9894..2af8742f904 100644
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))
@@ -394,41 +401,70 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -373,16 +380,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (!match)
continue;
}
@ -265,6 +265,11 @@ index 3ea25cf9894..2af8742f904 100644
continue;
+
pxe_mode = pxe->mode;
- grub_net_configure_by_dhcp_ack (card->name, card, 0,
- (struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
- 1, device, path);
+ if (pxe_mode->using_ipv6)
+ {
+ grub_net_link_level_address_t hwaddr;
@ -276,86 +281,41 @@ index 3ea25cf9894..2af8742f904 100644
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
+ if (!pxe_mode->dhcp_ack_received)
+ continue;
- inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
- (struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
- 1, device, path);
+
+ hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ grub_memcpy (hwaddr.mac,
+ card->efi_net->mode->current_address,
+ sizeof (hwaddr.mac));
- if (inter != NULL)
+ inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
+
+ 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 (inter && device && path)
+ if (intf && device && path)
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ }
+ else
{
- /*
- * Search the device path for any VLAN subtype and use it
- * to configure the interface.
- */
- vlan_dp = dp;
+ {
+ grub_dprintf ("efinet", "using ipv4 and dhcp\n");
+ inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
+ (struct grub_net_bootp_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
+ grub_net_configure_by_dhcp_ack (card->name, card, 0,
+ (struct grub_net_bootp_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ if (inter != NULL)
{
- if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
- GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
+ /*
+ * Search the device path for any VLAN subtype and use it
+ * to configure the interface.
+ */
+ vlan_dp = dp;
+
+ while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
{
- vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
- inter->vlantag = vlan->vlan_id;
- break;
+ if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
+ GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
+ {
+ vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
+ inter->vlantag = vlan->vlan_id;
+ break;
+ }
+
+ vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
+ vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
-
- vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
- vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
+ return;
}
- return;
+ }
return;
}
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 54451cea2a7..20c55257647 100644
index 0ef148f4ad..22f2689aae 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -984,6 +984,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
@@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
grub_net_network_level_interfaces = inter;
}
+int
+grub_ipv6_get_masksize (grub_uint16_t *be_mask)
+grub_ipv6_get_masksize (grub_uint16_t be_mask[8])
+{
+ grub_uint8_t *mask;
+ grub_uint16_t mask16[8];
@ -430,10 +390,10 @@ index 54451cea2a7..20c55257647 100644
grub_err_t
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter,
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 409b1d09bcd..f300a9d4007 100644
index 7f44b30f52..4ab2f5c735 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -359,6 +359,7 @@ tftp_open (struct grub_file *file, const char *filename)
@@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename)
file->not_easily_seekable = 1;
file->data = data;
@ -441,13 +401,14 @@ index 409b1d09bcd..f300a9d4007 100644
err = grub_net_resolve_address (file->device->net->server, &addr);
if (err)
{
@@ -369,11 +370,13 @@ tftp_open (struct grub_file *file, const char *filename)
+ grub_dprintf("tftp", "Address resolution failed: %d\n", err);
grub_free (data);
return err;
}
+ grub_dprintf("tftp", "opening connection\n");
data->sock = grub_net_udp_open (addr,
port ? port : TFTP_SERVER_PORT, tftp_receive,
TFTP_SERVER_PORT, tftp_receive,
file);
if (!data->sock)
{
@ -456,10 +417,10 @@ index 409b1d09bcd..f300a9d4007 100644
return grub_errno;
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index d44d00ad7d5..c6d702831f7 100644
index f1a52210c0..117469450d 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -637,10 +637,16 @@ typedef void *grub_efi_handle_t;
@@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t;
typedef void *grub_efi_event_t;
typedef grub_efi_uint64_t grub_efi_lba_t;
typedef grub_efi_uintn_t grub_efi_tpl_t;
@ -480,7 +441,7 @@ index d44d00ad7d5..c6d702831f7 100644
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@@ -1521,16 +1527,127 @@ struct grub_efi_simple_text_output_interface
@@ -1474,16 +1480,127 @@ struct grub_efi_simple_text_output_interface
};
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
@ -611,10 +572,10 @@ index d44d00ad7d5..c6d702831f7 100644
typedef struct grub_efi_pxe
diff --git a/include/grub/net.h b/include/grub/net.h
index 844e501c128..bf8430a6364 100644
index 7ae4b6bd80..8a05ec4fe7 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -450,6 +450,51 @@ struct grub_net_bootp_packet
@@ -447,6 +447,51 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -666,7 +627,7 @@ index 844e501c128..bf8430a6364 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
@@ -485,6 +530,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -482,6 +527,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
grub_size_t size,
int is_def, char **device, char **path);

View file

@ -24,10 +24,10 @@ Resolves: rhbz#1226325
create mode 100644 util/grub-get-kernel-settings.in
diff --git a/configure.ac b/configure.ac
index 493e336ec6c..3602b4ab62b 100644
index 7f59ad788f..0d0e6782a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,7 @@ grub_TRANSFORM([grub-install])
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install])
grub_TRANSFORM([grub-mkconfig])
grub_TRANSFORM([grub-mkfont])
grub_TRANSFORM([grub-mkimage])
@ -36,10 +36,10 @@ index 493e336ec6c..3602b4ab62b 100644
grub_TRANSFORM([grub-mklayout])
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
diff --git a/Makefile.util.def b/Makefile.util.def
index 95884956a68..84a17ef5cfa 100644
index 4ee22c5daa..18a9242776 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -725,6 +725,13 @@ script = {
@@ -716,6 +716,13 @@ script = {
installdir = sbin;
};
@ -55,17 +55,17 @@ index 95884956a68..84a17ef5cfa 100644
common = util/grub-set-default.in;
diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m
new file mode 100644
index 00000000000..b8051f01f3a
index 0000000000..b8051f01f3
--- /dev/null
+++ b/docs/man/grub-get-kernel-settings.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 213ce1e57cf..da7fca5efac 100644
index 44bf135b9f..5c4acd496d 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -275,6 +275,28 @@ have ${__grub_sparc64_setup_program} && \
@@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \
unset __grub_sparc64_setup_program
@ -96,7 +96,7 @@ index 213ce1e57cf..da7fca5efac 100644
#
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
new file mode 100644
index 00000000000..7e87dfccc0e
index 0000000000..7e87dfccc0
--- /dev/null
+++ b/util/grub-get-kernel-settings.in
@@ -0,0 +1,88 @@
@ -189,7 +189,7 @@ index 00000000000..7e87dfccc0e
+ echo export GRUB_UPDATE_DEFAULT_KERNEL
+fi
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 5f2824d4f58..28e92515795 100644
index ba14cf6261..005f093809 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@"
@ -210,10 +210,10 @@ index 5f2824d4f58..28e92515795 100644
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
GRUB_DISABLE_LINUX_UUID="true"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 993c53ad92e..e8ab4082f87 100644
index 786dbabb4a..292e333324 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -113,7 +113,8 @@ linux_entry ()
@@ -111,7 +111,8 @@ linux_entry ()
os="$1"
version="$2"
type="$3"
@ -223,7 +223,7 @@ index 993c53ad92e..e8ab4082f87 100644
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
@@ -125,6 +126,9 @@ linux_entry ()
@@ -123,6 +124,9 @@ linux_entry ()
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
fi
@ -233,7 +233,7 @@ index 993c53ad92e..e8ab4082f87 100644
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
@@ -320,11 +324,15 @@ for linux in ${reverse_sorted_list}; do
@@ -306,11 +310,15 @@ while [ "x$list" != "x" ] ; do
fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
@ -251,7 +251,7 @@ index 993c53ad92e..e8ab4082f87 100644
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
@@ -333,10 +341,15 @@ for linux in ${reverse_sorted_list}; do
@@ -319,10 +327,15 @@ while [ "x$list" != "x" ] ; do
is_top_level=false
fi
@ -266,6 +266,6 @@ index 993c53ad92e..e8ab4082f87 100644
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
- linux_entry "${OS}" "${version}" recovery \
+ linux_entry "${OS}" "${version}" recovery standard \
"${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
"single ${GRUB_CMDLINE_LINUX}"
fi
done

View file

@ -1,40 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 8 Jan 2024 15:41:52 -0500
Subject: [PATCH] btrfs: fix a bad null check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
current gcc complains:
grub-core/fs/btrfs.c: In function grub_cmd_btrfs_info:
grub-core/fs/btrfs.c:2745:7: error: the comparison will always evaluate as true for the address of label will never be NULL [-Werror=address]
2745 | if (data->sblock.label)
| ^~~~
grub-core/fs/btrfs.c:92:8: note: label declared here
92 | char label[0x100];
| ^~~~~
cc1: all warnings being treated as errors
Obviously this check should be on the first data byte instead of the
symbol itself.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/fs/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index f14fe9c1bda..8e2b1e9f7bc 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2625,7 +2625,7 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs");
}
- if (data->sblock.label)
+ if (data->sblock.label[0])
grub_printf("Label: '%s' ", data->sblock.label);
else
grub_printf("Label: none ");

View file

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Masahiro Matsuya <mmatsuya@redhat.com>
Date: Sat, 29 Oct 2016 08:35:26 +0900
Subject: [PATCH] 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().
/vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512
The netmask in this bootpath is no problem, since it's a value specified in firmware. But,
The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22).
As a result, 16 was used for netmask wrongly.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4)
And, the count of zero with __builtin_ctz can be 16.
This patch changes it as below.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit)
Signed-off-by: Masahiro Matsuya <mmatsuya@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/net/drivers/ieee1275/ofnet.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index ac4e62a95c..3860b6f78d 100644
--- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
@@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
flags);
inter->vlantag = vlantag;
grub_net_add_ipv4_local (inter,
- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
-
+ __builtin_clz (~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))));
}
if (gateway_addr.ipv4 != 0)

View file

@ -5,18 +5,18 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
---
grub-core/Makefile.core.def | 3 ++
grub-core/kern/misc.c | 6 ++++
grub-core/kern/misc.c | 8 +++++-
grub-core/lib/arm64/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++
grub-core/lib/backtrace.c | 2 ++
grub-core/lib/i386/backtrace.c | 14 +++++++++-
5 files changed, 86 insertions(+), 1 deletion(-)
5 files changed, 87 insertions(+), 2 deletions(-)
create mode 100644 grub-core/lib/arm64/backtrace.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 47c0fc755a2..63f053b3add 100644
index c15e91943b..058c88ac3a 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -199,6 +199,9 @@ kernel = {
@@ -188,6 +188,9 @@ kernel = {
softdiv = lib/division.c;
@ -27,19 +27,19 @@ index 47c0fc755a2..63f053b3add 100644
i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c;
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 11037dc0227..465a8e74ea7 100644
index 63b586d09c..a3e215155b 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -26,6 +26,7 @@
@@ -24,6 +24,7 @@
#include <grub/term.h>
#include <grub/env.h>
#include <grub/i18n.h>
#include <grub/types.h>
#include <grub/charset.h>
+#include <grub/backtrace.h>
union printf_arg
{
@@ -1301,6 +1302,11 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
void __attribute__ ((noreturn))
@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
static void __attribute__ ((noreturn))
grub_abort (void)
{
+#ifndef GRUB_UTIL
@ -48,11 +48,14 @@ index 11037dc0227..465a8e74ea7 100644
+#endif
+#endif
grub_printf ("\nAborted.");
-
+
#ifndef GRUB_UTIL
if (grub_term_inputs)
#endif
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
new file mode 100644
index 00000000000..1079b5380e1
index 0000000000..1079b5380e
--- /dev/null
+++ b/grub-core/lib/arm64/backtrace.c
@@ -0,0 +1,62 @@
@ -119,7 +122,7 @@ index 00000000000..1079b5380e1
+}
+
diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c
index 825a8800e25..c0ad6ab8be1 100644
index 825a8800e2..c0ad6ab8be 100644
--- a/grub-core/lib/backtrace.c
+++ b/grub-core/lib/backtrace.c
@@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
@ -139,7 +142,7 @@ index 825a8800e25..c0ad6ab8be1 100644
}
diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c
index c3e03c7275c..c67273db3ae 100644
index c3e03c7275..c67273db3a 100644
--- a/grub-core/lib/i386/backtrace.c
+++ b/grub-core/lib/i386/backtrace.c
@@ -15,11 +15,23 @@

View file

@ -9,11 +9,11 @@ time.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
docs/grub-dev.texi | 4 +-
docs/grub.texi | 357 ++++++++++++++++++++++++++++-------------------------
2 files changed, 189 insertions(+), 172 deletions(-)
docs/grub.texi | 321 ++++++++++++++++++++++++++++-------------------------
2 files changed, 171 insertions(+), 154 deletions(-)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index 1276c59302a..04c6678cb6b 100644
index 6c629a23e2..19f708ee66 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -1,7 +1,7 @@
@ -35,7 +35,7 @@ index 1276c59302a..04c6678cb6b 100644
@setchapternewpage odd
diff --git a/docs/grub.texi b/docs/grub.texi
index 974bc0ddb07..c30701b4e1f 100644
index 69f08d289f..0615d0ed97 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1,7 +1,7 @@
@ -72,7 +72,31 @@ index 974bc0ddb07..c30701b4e1f 100644
@end direntry
@setchapternewpage odd
@@ -223,7 +223,7 @@ surprising.
@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}.
* Platform-specific operations:: Platform-specific operations
* Supported kernels:: The list of supported kernels
* Troubleshooting:: Error messages produced by GRUB
-* Invoking grub-install:: How to use the GRUB installer
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
-* Invoking grub-mkpasswd-pbkdf2::
+* Invoking grub2-install:: How to use the GRUB installer
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
+* Invoking grub2-mkpasswd-pbkdf2::
Generate GRUB password hashes
-* Invoking grub-mkrelpath:: Make system path relative to its root
-* Invoking grub-mkrescue:: Make a GRUB rescue image
-* Invoking grub-mount:: Mount a file system using GRUB
-* Invoking grub-probe:: Probe device information for GRUB
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
+* Invoking grub2-mkrelpath:: Make system path relative to its root
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
+* Invoking grub2-mount:: Mount a file system using GRUB
+* Invoking grub2-probe:: Probe device information for GRUB
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
* Obtaining and Building GRUB:: How to obtain and build GRUB
* Reporting bugs:: Where you should send a bug report
* Future:: Some future plans on GRUB
@@ -230,7 +230,7 @@ surprising.
@item
@file{grub.cfg} is typically automatically generated by
@ -81,7 +105,7 @@ index 974bc0ddb07..c30701b4e1f 100644
easier to handle versioned kernel upgrades.
@item
@@ -237,7 +237,7 @@ scripting language: variables, conditionals, and loops are available.
@@ -244,7 +244,7 @@ scripting language: variables, conditionals, and loops are available.
@item
A small amount of persistent storage is available across reboots, using the
@command{save_env} and @command{load_env} commands in GRUB and the
@ -90,7 +114,7 @@ index 974bc0ddb07..c30701b4e1f 100644
(@pxref{Environment block}).
@item
@@ -542,7 +542,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
@@ -549,7 +549,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
OS name. E.g. for GNU/Linux:
@example
@ -99,7 +123,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
On AROS we use another syntax. For volumes:
@@ -565,7 +565,7 @@ For disks we use syntax:
@@ -572,7 +572,7 @@ For disks we use syntax:
E.g.
@example
@ -108,7 +132,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
On Windows we use UNC path. For volumes it's typically
@@ -592,7 +592,7 @@ For disks it's
@@ -599,7 +599,7 @@ For disks it's
E.g.
@example
@ -117,7 +141,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
Beware that you may need to further escape the backslashes depending on your
@@ -602,7 +602,7 @@ When compiled with cygwin support then cygwin drive names are automatically
@@ -609,7 +609,7 @@ When compiled with cygwin support then cygwin drive names are automatically
when needed. E.g.
@example
@ -126,7 +150,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
@node Installation
@@ -615,7 +615,7 @@ from the source tarball, or as a package for your OS.
@@ -622,7 +622,7 @@ from the source tarball, or as a package for your OS.
After you have done that, you need to install the boot loader on a
drive (floppy or hard disk) by using the utility
@ -135,7 +159,7 @@ index 974bc0ddb07..c30701b4e1f 100644
GRUB comes with boot images, which are normally put in the directory
@file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
@@ -626,22 +626,22 @@ loader needs to find them (usually @file{/boot}) will be called
@@ -633,22 +633,22 @@ loader needs to find them (usually @file{/boot}) will be called
the @dfn{boot directory}.
@menu
@ -163,7 +187,7 @@ index 974bc0ddb07..c30701b4e1f 100644
The usage is basically very simple. You only need to specify one
argument to the program, namely, where to install the boot loader. The
@@ -650,13 +650,13 @@ For example, under Linux the following will install GRUB into the MBR
@@ -657,13 +657,13 @@ For example, under Linux the following will install GRUB into the MBR
of the first IDE disk:
@example
@ -179,7 +203,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
But all the above examples assume that GRUB should put images under
@@ -670,7 +670,7 @@ boot floppy with a filesystem. Here is an example:
@@ -677,7 +677,7 @@ boot floppy with a filesystem. Here is an example:
# @kbd{mke2fs /dev/fd0}
# @kbd{mount -t ext2 /dev/fd0 /mnt}
# @kbd{mkdir /mnt/boot}
@ -188,7 +212,7 @@ index 974bc0ddb07..c30701b4e1f 100644
# @kbd{umount /mnt}
@end group
@end example
@@ -682,30 +682,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
@@ -689,30 +689,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
@example
# @kbd{losetup /dev/loop0 /dev/sdb1}
# @kbd{mount /dev/loop0 /mnt/usb}
@ -230,7 +254,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
@node Making a GRUB bootable CD-ROM
@@ -725,10 +732,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
@@ -732,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
other GRUB modules.
To make a simple generic GRUB rescue CD, you can use the
@ -243,7 +267,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
You will often need to include other files in your image. To do this, first
@@ -751,7 +758,7 @@ directory @file{iso/}.
@@ -758,7 +765,7 @@ directory @file{iso/}.
Finally, make the image:
@example
@ -252,7 +276,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
This produces a file named @file{grub.iso}, which then can be burned
@@ -767,7 +774,7 @@ storage devices.
@@ -774,7 +781,7 @@ storage devices.
@node Device map
@section The map between BIOS drives and OS devices
@ -261,7 +285,7 @@ index 974bc0ddb07..c30701b4e1f 100644
etc.) read it to map BIOS drives to OS devices. This file consists of lines
like this:
@@ -1269,23 +1276,23 @@ need to write the whole thing by hand.
@@ -1254,23 +1261,23 @@ need to write the whole thing by hand.
@node Simple configuration
@section Simple configuration handling
@ -290,7 +314,7 @@ index 974bc0ddb07..c30701b4e1f 100644
valid POSIX shell input; normally, it will just be a sequence of
@samp{KEY=value} lines, but if the value contains spaces or other special
characters then it must be quoted. For example:
@@ -1323,7 +1330,7 @@ works it's not recommended since titles often contain unstable device names
@@ -1308,7 +1315,7 @@ works it's not recommended since titles often contain unstable device names
and may be translated
If you set this to @samp{saved}, then the default menu entry will be that
@ -299,7 +323,7 @@ index 974bc0ddb07..c30701b4e1f 100644
the environment block, which may not be available in all situations
(@pxref{Environment block}).
@@ -1334,7 +1341,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
@@ -1319,7 +1326,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
it as a new default entry for use by future runs of GRUB. This is only
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
@ -308,7 +332,7 @@ index 974bc0ddb07..c30701b4e1f 100644
This option relies on the environment block, which may not be available in
all situations (@pxref{Environment block}).
@@ -1481,15 +1488,15 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
@@ -1449,7 +1456,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
@end example
@item GRUB_DISABLE_LINUX_UUID
@ -317,17 +341,7 @@ index 974bc0ddb07..c30701b4e1f 100644
universally-unique identifiers (UUIDs) to identify the root filesystem to
the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
usually more reliable, but in some cases it may not be appropriate. To
disable the use of UUIDs, set this option to @samp{true}.
@item GRUB_DISABLE_LINUX_PARTUUID
-If @command{grub-mkconfig} cannot identify the root filesystem via its
-universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID
+If @command{grub2-mkconfig} cannot identify the root filesystem via its
+universally-unique indentifier (UUID), @command{grub2-mkconfig} can use the UUID
of the partition containing the filesystem to identify the root filesystem to
the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not
as reliable as using the filesystem UUID, but is more reliable than using the
@@ -1503,7 +1510,7 @@ If this option is set to @samp{true}, disable the generation of recovery
@@ -1471,7 +1478,7 @@ If this option is set to @samp{true}, disable the generation of recovery
mode menu entries.
@item GRUB_DISABLE_UUID
@ -336,7 +350,7 @@ index 974bc0ddb07..c30701b4e1f 100644
universally-unique identifiers (UUIDs) to identify various filesystems to
search for files. This is usually more reliable, but in some cases it may
not be appropriate. To disable this use of UUIDs, set this option to
@@ -1514,12 +1521,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
@@ -1482,12 +1489,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
@item GRUB_VIDEO_BACKEND
If graphical video support is required, either because the @samp{gfxterm}
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
@ -352,7 +366,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@item GRUB_GFXMODE
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
@@ -1552,7 +1559,7 @@ boot sequence. If you have problems, set this option to @samp{text} and
@@ -1519,7 +1526,7 @@ boot sequence. If you have problems, set this option to @samp{text} and
GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER
@ -361,7 +375,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@command{os-prober} program, if installed, to discover other operating
systems installed on the same system and generate appropriate menu entries
for them. Set this option to @samp{true} to disable this.
@@ -1562,7 +1569,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober
@@ -1529,7 +1536,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober
output. For efi chainloaders it's <UUID>@@<EFI FILE>
@item GRUB_DISABLE_SUBMENU
@ -370,7 +384,7 @@ index 974bc0ddb07..c30701b4e1f 100644
the kernel with highest version number and put all other found kernels
or alternative menu entries for recovery mode in submenu. For entries returned
by @command{os-prober} first entry will be put on top level and all others
@@ -1570,11 +1577,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
@@ -1537,11 +1544,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
on top level will be generated instead. Changing this option will require
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
and @samp{default} (@pxref{default}) environment variables as well as saved
@ -385,7 +399,7 @@ index 974bc0ddb07..c30701b4e1f 100644
check for encrypted disks and generate additional commands needed to access
them during boot. Note that in this case unattended boot is not possible
because GRUB will wait for passphrase to unlock encrypted container.
@@ -1633,7 +1640,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
@@ -1600,7 +1607,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
@end table
@ -394,48 +408,7 @@ index 974bc0ddb07..c30701b4e1f 100644
edit the scripts in @file{/etc/grub.d} directly.
@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
menu entries; simply type the menu entries you want to add at the end of
@@ -1641,14 +1648,14 @@ that file, making sure to leave at least the first two lines intact.
@node Root Identifcation Heuristics
@section Root Identifcation Heuristics
-If the target operating system uses the Linux kernel, @command{grub-mkconfig}
+If the target operating system uses the Linux kernel, @command{grub2-mkconfig}
attempts to identify the root file system via a heuristic algoirthm. This
algorithm selects the identification method of the root file system by
considering three factors. The first is if an initrd for the target operating
system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
system via the UUID of its enclosing partition. If the variables are assigned
any other value, that value is considered equivalent to @samp{false}. The
variables are also considered to be set to @samp{false} if they are not set.
@@ -1658,18 +1665,18 @@ filesystem to the initrd. Most initrd images determine the root file system by
checking the Linux kernel's command-line for the @samp{root} key and use its
value as the identification method of the root file system. To improve the
reliability of booting, most initrd images also allow the root file system to be
-identified by its UUID. Because of this behavior, the @command{grub-mkconfig}
+identified by its UUID. Because of this behavior, the @command{grub2-mkconfig}
command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with
the filesystem UUID of the root file system.
If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true}
-then @command{grub-command} will identify the root filesystem by setting the
+then @command{grub2-command} will identify the root filesystem by setting the
kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true},
-@command{grub-command} will identify by its Linux device name.
+@command{grub2-command} will identify by its Linux device name.
-The following table summarizes the behavior of the @command{grub-mkconfig}
+The following table summarizes the behavior of the @command{grub2-mkconfig}
command.
@multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root}
@@ -1898,7 +1905,7 @@ images as well.
@@ -1862,7 +1869,7 @@ images as well.
Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
install self-compiled latest GRUB with:
@ -444,7 +417,7 @@ index 974bc0ddb07..c30701b4e1f 100644
In all the OSes install GRUB tools but disable installing GRUB in bootsector,
so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
@@ -1908,20 +1915,20 @@ use by setting:
@@ -1872,20 +1879,20 @@ use by setting:
in /etc/default/grub
@ -468,7 +441,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@}
menuentry "Windows XP" @{
@@ -1984,15 +1991,15 @@ GRUB supports embedding a configuration file directly into the core image,
@@ -1948,15 +1955,15 @@ GRUB supports embedding a configuration file directly into the core image,
so that it is loaded before entering normal mode. This is useful, for
example, when it is not straightforward to find the real configuration file,
or when you need to debug problems with loading that file.
@ -487,7 +460,7 @@ index 974bc0ddb07..c30701b4e1f 100644
After the embedded configuration file (if any) is executed, GRUB will load
the @samp{normal} module (@pxref{normal}), which will then read the real
@@ -2027,13 +2034,13 @@ included in the core image:
@@ -1991,13 +1998,13 @@ included in the core image:
@example
@group
search.fs_label grub root
@ -505,7 +478,7 @@ index 974bc0ddb07..c30701b4e1f 100644
else
echo "Could not find an example configuration file!"
fi
@@ -2557,7 +2564,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
@@ -2521,7 +2528,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
@end group
@end example
@ -514,7 +487,7 @@ index 974bc0ddb07..c30701b4e1f 100644
server.
The grub.cfg file is placed in the same directory as the path output by
@@ -2760,7 +2767,7 @@ team are:
@@ -2715,7 +2722,7 @@ team are:
@end table
To take full advantage of this function, install GRUB into the MBR
@ -523,7 +496,7 @@ index 974bc0ddb07..c30701b4e1f 100644
If you have a laptop which has a similar feature and not in the above list
could you figure your address and contribute?
@@ -2821,7 +2828,7 @@ bytes.
@@ -2776,7 +2783,7 @@ bytes.
The sole function of @file{boot.img} is to read the first sector of the core
image from a local disk and jump to it. Because of the size restriction,
@file{boot.img} cannot understand any file system structure, so
@ -532,7 +505,7 @@ index 974bc0ddb07..c30701b4e1f 100644
core image into @file{boot.img} when installing GRUB.
@item diskboot.img
@@ -2851,7 +2858,7 @@ images.
@@ -2806,7 +2813,7 @@ images.
@item core.img
This is the core image of GRUB. It is built dynamically from the kernel
@ -541,7 +514,7 @@ index 974bc0ddb07..c30701b4e1f 100644
program. Usually, it contains enough modules to access @file{/boot/grub},
and loads everything else (including menu handling, the ability to load
target operating systems, and so on) from the file system at run-time. The
@@ -2903,7 +2910,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
@@ -2858,7 +2865,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
In GRUB 2, images for booting from CD-ROM drives are now constructed using
@file{cdboot.img} and @file{core.img}, making sure that the core image
contains the @samp{iso9660} module. It is usually best to use the
@ -550,7 +523,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@item nbgrub
There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
@@ -3071,8 +3078,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
@@ -3014,8 +3021,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
An absolute file name resembles a Unix absolute file name, using
@samp{/} for the directory separator (not @samp{\} as in DOS). One
@ -561,7 +534,7 @@ index 974bc0ddb07..c30701b4e1f 100644
disk. If you omit the device name in an absolute file name, GRUB uses
GRUB's @dfn{root device} implicitly. So if you set the root device to,
say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
@@ -3080,8 +3087,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
@@ -3023,8 +3030,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
On ZFS filesystem the first path component must be
@var{volume}@samp{@@}[@var{snapshot}].
@ -572,7 +545,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
snapshot name is omitted.
@@ -3500,7 +3507,7 @@ The more recent release of Minix would then be identified as
@@ -3427,7 +3434,7 @@ The more recent release of Minix would then be identified as
@samp{other>minix>minix-3.4.0}.
This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
@ -581,7 +554,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@node fallback
@@ -3590,7 +3597,7 @@ If this variable is set, it names the language code that the
@@ -3517,7 +3524,7 @@ If this variable is set, it names the language code that the
example, French would be named as @samp{fr}, and Simplified Chinese as
@samp{zh_CN}.
@ -590,7 +563,7 @@ index 974bc0ddb07..c30701b4e1f 100644
reasonable default for this variable based on the system locale.
@@ -3598,10 +3605,10 @@ reasonable default for this variable based on the system locale.
@@ -3525,10 +3532,10 @@ reasonable default for this variable based on the system locale.
@subsection locale_dir
If this variable is set, it names the directory where translation files may
@ -603,7 +576,7 @@ index 974bc0ddb07..c30701b4e1f 100644
default for this variable if internationalization is needed and any
translation files are available.
@@ -3738,7 +3745,7 @@ input. The default is not to pause output.
@@ -3646,7 +3653,7 @@ input. The default is not to pause output.
The location of the @samp{/boot/grub} directory as an absolute file name
(@pxref{File name syntax}). This is normally set by GRUB at startup based
@ -612,7 +585,7 @@ index 974bc0ddb07..c30701b4e1f 100644
dynamically loaded from this directory, so it must be set correctly in order
for many parts of GRUB to work.
@@ -3850,17 +3857,17 @@ GRUB provides an ``environment block'' which can be used to save a small
@@ -3737,17 +3744,17 @@ GRUB provides an ``environment block'' which can be used to save a small
amount of state.
The environment block is a preallocated 1024-byte file, which normally lives
@ -632,8 +605,8 @@ index 974bc0ddb07..c30701b4e1f 100644
+@command{grub2-mkconfig} uses this facility to implement
@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
@node Modules
@@ -4922,7 +4929,7 @@ Translate @var{string} into the current language.
@@ -4476,7 +4483,7 @@ Translate @var{string} into the current language.
The current language code is stored in the @samp{lang} variable in GRUB's
environment (@pxref{lang}). Translation files in MO format are read from
@ -642,7 +615,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end deffn
@@ -5274,7 +5281,7 @@ Define a user named @var{user} with password @var{clear-password}.
@@ -4871,7 +4878,7 @@ Define a user named @var{user} with password @var{clear-password}.
@deffn Command password_pbkdf2 user hashed-password
Define a user named @var{user} with password hash @var{hashed-password}.
@ -651,7 +624,7 @@ index 974bc0ddb07..c30701b4e1f 100644
to generate password hashes. @xref{Security}.
@end deffn
@@ -6400,8 +6407,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
@@ -5814,8 +5821,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
which has an associated password. @samp{password} sets the password in
plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
sets the password hashed using the Password-Based Key Derivation Function
@ -662,7 +635,7 @@ index 974bc0ddb07..c30701b4e1f 100644
In order to enable authentication support, the @samp{superusers} environment
variable must be set to a list of usernames, separated by any of spaces,
@@ -6446,7 +6453,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@@ -5860,7 +5867,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@end group
@end example
@ -671,13 +644,11 @@ index 974bc0ddb07..c30701b4e1f 100644
generating configuration files with authentication. You can use
@file{/etc/grub.d/40_custom} to add simple superuser authentication, by
adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
@@ -6472,8 +6479,18 @@ validation fails, then file @file{foo} cannot be opened. This failure
may halt or otherwise impact the boot process.
@@ -5887,7 +5894,17 @@ may halt or otherwise impact the boot process.
An initial trusted public key can be embedded within the GRUB @file{core.img}
-using the @code{--pubkey} option to @command{grub-install}
using the @code{--pubkey} option to @command{grub-install}
-(@pxref{Invoking grub-install}).
+using the @code{--pubkey} option to @command{grub2-install}
+(@pxref{Invoking grub2-install}).
+
+@comment Unfortunately --pubkey is not yet supported by grub2-install,
@ -692,7 +663,7 @@ index 974bc0ddb07..c30701b4e1f 100644
GRUB uses GPG-style detached signatures (meaning that a file
@file{foo.sig} will be produced when file @file{foo} is signed), and
@@ -6493,8 +6510,8 @@ gpg --detach-sign /path/to/file
@@ -5907,8 +5924,8 @@ gpg --detach-sign /path/to/file
For successful validation of all of GRUB's subcomponents and the
loaded OS kernel, they must all be signed. One way to accomplish this
is the following (after having already produced the desired
@ -703,7 +674,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@example
@group
@@ -6516,7 +6533,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
@@ -5930,7 +5947,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
Note that internally signature enforcement is controlled by setting
the environment variable @code{check_signatures} equal to
@code{enforce}. Passing one or more @code{--pubkey} options to
@ -712,16 +683,7 @@ index 974bc0ddb07..c30701b4e1f 100644
equal to @code{enforce} in @file{core.img} prior to processing any
configuration files.
@@ -6564,7 +6581,7 @@ UTF-8 strings as comma-separated values (CSV). See
@uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
To add a data section containing the SBAT information into the binary, the
-@option{--sbat} option of @command{grub-mkimage} command should be used. The content
+@option{--sbat} option of @command{grub2-mkimage} command should be used. The content
of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
the generated EFI binary. The CSV file can be stored anywhere on the file system.
@@ -6975,10 +6992,10 @@ Required files are:
@@ -6388,10 +6405,10 @@ Required files are:
GRUB's normal start-up procedure involves setting the @samp{prefix}
environment variable to a value set in the core image by
@ -734,7 +696,7 @@ index 974bc0ddb07..c30701b4e1f 100644
things GRUB is supposed to do.
If, instead, you only get a rescue shell, this usually means that GRUB
@@ -7004,8 +7021,8 @@ normal
@@ -6417,8 +6434,8 @@ normal
However, any problem that leaves you in the rescue shell probably means that
GRUB was not correctly installed. It may be more useful to try to reinstall
@ -745,7 +707,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@itemize @bullet{}
@item
@@ -7017,7 +7034,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
@@ -6430,7 +6447,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
drive ordering entirely.
@item
@ -754,34 +716,14 @@ index 974bc0ddb07..c30701b4e1f 100644
to a partition but GRUB has already been installed in the master boot
record, then the GRUB installation in the partition will be ignored.
@@ -7052,33 +7069,33 @@ bootability on other machines.
@chapter User-space utilities
@menu
-* Invoking grub-install:: How to use the GRUB installer
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
-* Invoking grub-mkpasswd-pbkdf2::
+* Invoking grub2-install:: How to use the GRUB installer
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
+* Invoking grub2-mkpasswd-pbkdf2::
Generate GRUB password hashes
-* Invoking grub-mkrelpath:: Make system path relative to its root
-* Invoking grub-mkrescue:: Make a GRUB rescue image
-* Invoking grub-mount:: Mount a file system using GRUB
-* Invoking grub-probe:: Probe device information for GRUB
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
+* Invoking grub2-mkrelpath:: Make system path relative to its root
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
+* Invoking grub2-mount:: Mount a file system using GRUB
+* Invoking grub2-probe:: Probe device information for GRUB
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
@end menu
@@ -6461,21 +6478,21 @@ entry which claims partition start at block 0. This change will not hamper
bootability on other machines.
-@node Invoking grub-install
-@section Invoking grub-install
-@chapter Invoking grub-install
+@node Invoking grub2-install
+@section Invoking grub2-install
+@chapter Invoking grub2-install
-The program @command{grub-install} generates a GRUB core image using
-@command{grub-mkimage} and installs it on your system. You must specify the
@ -802,7 +744,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@table @option
@item --help
@@ -7094,13 +7111,13 @@ separate partition or a removable disk.
@@ -6491,13 +6508,13 @@ separate partition or a removable disk.
If this option is not specified then it defaults to @file{/boot}, so
@example
@ -818,7 +760,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@end example
Here is an example in which you have a separate @dfn{boot} partition which is
@@ -7108,16 +7125,16 @@ mounted on
@@ -6505,16 +6522,16 @@ mounted on
@file{/mnt/boot}:
@example
@ -838,14 +780,14 @@ index 974bc0ddb07..c30701b4e1f 100644
extra space in the bootloader embedding area for Reed-Solomon
error-correcting codes. This enables GRUB to still boot successfully
if some blocks are corrupted. The exact amount of protection offered
@@ -7130,17 +7147,17 @@ installation}) where GRUB does not reside in any unpartitioned space
@@ -6527,17 +6544,17 @@ installation}) where GRUB does not reside in any unpartitioned space
outside of the MBR. Disable the Reed-Solomon codes with this option.
@end table
-@node Invoking grub-mkconfig
-@section Invoking grub-mkconfig
-@chapter Invoking grub-mkconfig
+@node Invoking grub2-mkconfig
+@section Invoking grub2-mkconfig
+@chapter Invoking grub2-mkconfig
-The program @command{grub-mkconfig} generates a configuration file for GRUB
+The program @command{grub2-mkconfig} generates a configuration file for GRUB
@ -853,7 +795,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@example
-grub-mkconfig -o /boot/grub/grub.cfg
+grub2-mkconfig -o /boot/grub2/grub.cfg
+grub-mkconfig -o /boot/grub2/grub.cfg
@end example
-@command{grub-mkconfig} accepts the following options:
@ -861,22 +803,21 @@ index 974bc0ddb07..c30701b4e1f 100644
@table @option
@item --help
@@ -7156,17 +7173,17 @@ it to standard output.
@@ -6553,17 +6570,17 @@ it to standard output.
@end table
-@node Invoking grub-mkpasswd-pbkdf2
-@section Invoking grub-mkpasswd-pbkdf2
-@chapter Invoking grub-mkpasswd-pbkdf2
+@node Invoking grub2-mkpasswd-pbkdf2
+@section Invoking grub2-mkpasswd-pbkdf2
+@chapter Invoking grub2-mkpasswd-pbkdf2
-The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
+The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for
GRUB (@pxref{Security}).
@example
-grub-mkpasswd-pbkdf2
+grub2-mkpasswd-pbkdf2
grub-mkpasswd-pbkdf2
@end example
-@command{grub-mkpasswd-pbkdf2} accepts the following options:
@ -884,14 +825,14 @@ index 974bc0ddb07..c30701b4e1f 100644
@table @option
@item -c @var{number}
@@ -7184,23 +7201,23 @@ Length of the salt. Defaults to 64.
@@ -6581,23 +6598,23 @@ Length of the salt. Defaults to 64.
@end table
-@node Invoking grub-mkrelpath
-@section Invoking grub-mkrelpath
-@chapter Invoking grub-mkrelpath
+@node Invoking grub2-mkrelpath
+@section Invoking grub2-mkrelpath
+@chapter Invoking grub2-mkrelpath
-The program @command{grub-mkrelpath} makes a file system path relative to
+The program @command{grub2-mkrelpath} makes a file system path relative to
@ -914,22 +855,21 @@ index 974bc0ddb07..c30701b4e1f 100644
@table @option
@item --help
@@ -7211,17 +7228,17 @@ Print the version number of GRUB and exit.
@@ -6608,17 +6625,17 @@ Print the version number of GRUB and exit.
@end table
-@node Invoking grub-mkrescue
-@section Invoking grub-mkrescue
-@chapter Invoking grub-mkrescue
+@node Invoking grub2-mkrescue
+@section Invoking grub2-mkrescue
+@chapter Invoking grub2-mkrescue
-The program @command{grub-mkrescue} generates a bootable GRUB rescue image
+The program @command{grub2-mkrescue} generates a bootable GRUB rescue image
(@pxref{Making a GRUB bootable CD-ROM}).
@example
-grub-mkrescue -o grub.iso
+grub2-mkrescue -o grub.iso
grub-mkrescue -o grub.iso
@end example
-All arguments not explicitly listed as @command{grub-mkrescue} options are
@ -937,12 +877,8 @@ index 974bc0ddb07..c30701b4e1f 100644
passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
Options passed to @command{xorriso} will normally be interpreted as
@command{mkisofs} options; if the option @samp{--} is used, then anything
@@ -7233,10 +7250,10 @@ commonly used to add extra files to the image:
@example
mkdir -p disk/boot/grub
@r{(add extra files to @file{disk/boot/grub})}
-grub-mkrescue -o grub.iso disk
+grub2-mkrescue -o grub.iso disk
@@ -6633,7 +6650,7 @@ mkdir -p disk/boot/grub
grub-mkrescue -o grub.iso disk
@end example
-@command{grub-mkrescue} accepts the following options:
@ -950,7 +886,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@table @option
@item --help
@@ -7264,15 +7281,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
@@ -6661,15 +6678,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
default.
@item --grub-mkimage=@var{file}
@ -961,16 +897,16 @@ index 974bc0ddb07..c30701b4e1f 100644
-@node Invoking grub-mount
-@section Invoking grub-mount
-@chapter Invoking grub-mount
+@node Invoking grub2-mount
+@section Invoking grub2-mount
+@chapter Invoking grub2-mount
-The program @command{grub-mount} performs a read-only mount of any file
+The program @command{grub2-mount} performs a read-only mount of any file
system or file system image that GRUB understands, using GRUB's file system
drivers via FUSE. (It is only available if FUSE development files were
present when GRUB was built.) This has a number of uses:
@@ -7304,13 +7321,13 @@ even if nobody has yet written a FUSE module specifically for that file
@@ -6701,13 +6718,13 @@ even if nobody has yet written a FUSE module specifically for that file
system type.
@end itemize
@ -978,8 +914,7 @@ index 974bc0ddb07..c30701b4e1f 100644
+Using @command{grub2-mount} is normally as simple as:
@example
-grub-mount /dev/sda1 /mnt
+grub2-mount /dev/sda1 /mnt
grub-mount /dev/sda1 /mnt
@end example
-@command{grub-mount} must be given one or more images and a mount point as
@ -987,7 +922,7 @@ index 974bc0ddb07..c30701b4e1f 100644
non-option arguments (if it is given more than one image, it will treat them
as a RAID set), and also accepts the following options:
@@ -7332,13 +7349,13 @@ Show debugging output for conditions matching @var{string}.
@@ -6729,13 +6746,13 @@ Show debugging output for conditions matching @var{string}.
@item -K prompt|@var{file}
@itemx --zfs-key=prompt|@var{file}
Load a ZFS encryption key. If you use @samp{prompt} as the argument,
@ -1003,33 +938,22 @@ index 974bc0ddb07..c30701b4e1f 100644
root of the supplied file system.
If @var{device} is just a number, then it will be treated as a partition
@@ -7347,7 +7364,7 @@ an entire disk in @file{disk.img}, then you can use this command to mount
its second partition:
@example
-grub-mount -r 2 disk.img mount-point
+grub2-mount -r 2 disk.img mount-point
@end example
@item -v
@@ -7356,18 +7373,18 @@ Print verbose messages.
@@ -6753,10 +6770,10 @@ Print verbose messages.
@end table
-@node Invoking grub-probe
-@section Invoking grub-probe
-@chapter Invoking grub-probe
+@node Invoking grub2-probe
+@section Invoking grub2-probe
+@chapter Invoking grub2-probe
-The program @command{grub-probe} probes device information for a given path
+The program @command{grub2-probe} probes device information for a given path
or device.
@example
-grub-probe --target=fs /boot/grub
-grub-probe --target=drive --device /dev/sda1
+grub2-probe --target=fs /boot/grub
+grub2-probe --target=drive --device /dev/sda1
@@ -6764,7 +6781,7 @@ grub-probe --target=fs /boot/grub
grub-probe --target=drive --device /dev/sda1
@end example
-@command{grub-probe} must be given a path or device as a non-option
@ -1037,7 +961,7 @@ index 974bc0ddb07..c30701b4e1f 100644
argument, and also accepts the following options:
@table @option
@@ -7380,16 +7397,16 @@ Print the version number of GRUB and exit.
@@ -6777,16 +6794,16 @@ Print the version number of GRUB and exit.
@item -d
@itemx --device
If this option is given, then the non-option argument is a system device
@ -1057,14 +981,14 @@ index 974bc0ddb07..c30701b4e1f 100644
@item -t @var{target}
@itemx --target=@var{target}
@@ -7442,19 +7459,19 @@ Print verbose messages.
@@ -6839,19 +6856,19 @@ Print verbose messages.
@end table
-@node Invoking grub-script-check
-@section Invoking grub-script-check
-@chapter Invoking grub-script-check
+@node Invoking grub2-script-check
+@section Invoking grub2-script-check
+@chapter Invoking grub2-script-check
-The program @command{grub-script-check} takes a GRUB script file
+The program @command{grub2-script-check} takes a GRUB script file
@ -1074,7 +998,7 @@ index 974bc0ddb07..c30701b4e1f 100644
@example
-grub-script-check /boot/grub/grub.cfg
+grub2-script-check /boot/grub2/grub.cfg
+grub-script-check /boot/grub2/grub.cfg
@end example
-@command{grub-script-check} accepts the following options:

View file

@ -20,7 +20,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 18 insertions(+), 60 deletions(-)
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index f300e46fc6a..d7d423b2eaf 100644
index 1b91c102f3..4b27bd2015 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then
@ -104,7 +104,7 @@ index f300e46fc6a..d7d423b2eaf 100644
}
EOF
}
@@ -296,11 +253,12 @@ EOF
@@ -292,11 +249,12 @@ EOF
echo "$title_correction_code"
;;
macosx)

View file

@ -19,12 +19,12 @@ variable and loading the config file from the subvolume.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
grub-core/fs/btrfs.c | 558 ++++++++++++++++++++++++++++++++++++++++++++++++---
grub-core/fs/btrfs.c | 552 +++++++++++++++++++++++++++++++++++++++++++++++++--
include/grub/btrfs.h | 1 +
2 files changed, 536 insertions(+), 23 deletions(-)
2 files changed, 533 insertions(+), 20 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index ba0c583526d..f14fe9c1bda 100644
index 63203034df..f1fff7385b 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -38,6 +38,9 @@
@ -89,7 +89,7 @@ index ba0c583526d..f14fe9c1bda 100644
static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2,
256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2
};
@@ -1252,6 +1274,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
@@ -1173,6 +1195,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
return GRUB_ERR_NONE;
}
@ -152,7 +152,7 @@ index ba0c583526d..f14fe9c1bda 100644
static struct grub_btrfs_data *
grub_btrfs_mount (grub_device_t dev)
{
@@ -1287,6 +1365,13 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1208,6 +1286,13 @@ grub_btrfs_mount (grub_device_t dev)
data->devices_attached[0].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -166,7 +166,7 @@ index ba0c583526d..f14fe9c1bda 100644
return data;
}
@@ -1784,6 +1869,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
@@ -1673,6 +1758,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
return GRUB_ERR_NONE;
}
@ -258,7 +258,7 @@ index ba0c583526d..f14fe9c1bda 100644
static grub_err_t
find_path (struct grub_btrfs_data *data,
const char *path, struct grub_btrfs_key *key,
@@ -1802,14 +1972,26 @@ find_path (struct grub_btrfs_data *data,
@@ -1691,14 +1861,26 @@ find_path (struct grub_btrfs_data *data,
char *origpath = NULL;
unsigned symlinks_max = 32;
@ -289,18 +289,15 @@ index ba0c583526d..f14fe9c1bda 100644
while (1)
{
while (path[0] == '/')
@@ -1982,13 +2164,25 @@ find_path (struct grub_btrfs_data *data,
@@ -1871,9 +2053,21 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
- err = get_root (data, key, tree, type);
- if (err)
- return err;
+ if (data->fs_tree)
{
- grub_free (direl);
- grub_free (path_alloc);
- grub_free (origpath);
- return err;
+ {
+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
+ *tree = data->fs_tree;
+ /* This is a tree root, so everything starts at objectid 256 */
@ -312,16 +309,12 @@ index ba0c583526d..f14fe9c1bda 100644
+ {
+ err = get_root (data, key, tree, type);
+ if (err)
+ {
+ grub_free (direl);
+ grub_free (path_alloc);
+ grub_free (origpath);
+ return err;
+ }
}
+ return err;
+ }
}
continue;
@@ -2256,18 +2450,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
}
@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
data->tree, file->offset, buf, len);
}
@ -343,7 +336,7 @@ index ba0c583526d..f14fe9c1bda 100644
grub_be_to_cpu16 (data->sblock.uuid[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]),
@@ -2276,6 +2462,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
@@ -2134,6 +2320,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]),
grub_be_to_cpu16 (data->sblock.uuid[7]));
@ -364,7 +357,7 @@ index ba0c583526d..f14fe9c1bda 100644
grub_btrfs_unmount (data);
@@ -2396,6 +2596,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
@@ -2190,6 +2390,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
}
#endif
@ -607,7 +600,7 @@ index ba0c583526d..f14fe9c1bda 100644
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.fs_dir = grub_btrfs_dir,
@@ -2411,12 +2847,88 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2205,12 +2641,88 @@ static struct grub_fs grub_btrfs_fs = {
#endif
};
@ -697,7 +690,7 @@ index ba0c583526d..f14fe9c1bda 100644
+
+// vim: si et sw=2:
diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h
index 9d93fb6c182..234ad976771 100644
index 9d93fb6c18..234ad97677 100644
--- a/include/grub/btrfs.h
+++ b/include/grub/btrfs.h
@@ -29,6 +29,7 @@ enum

View file

@ -12,10 +12,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
1 file changed, 2 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 8e2b1e9f7bc..14e38a4df02 100644
index f1fff7385b..ad1b56b716 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2920,6 +2920,8 @@ GRUB_MOD_INIT (btrfs)
@@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs)
subvol_set_env);
grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env,
subvolid_set_env);

View file

@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 76 insertions(+), 31 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 14e38a4df02..d47f9ab0352 100644
index ad1b56b716..113c1f746c 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1335,6 +1335,7 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev)
{
struct grub_btrfs_data *data;
grub_err_t err;
@ -21,7 +21,7 @@ index 14e38a4df02..d47f9ab0352 100644
if (!dev->disk)
{
@@ -1365,11 +1366,14 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1286,11 +1287,14 @@ grub_btrfs_mount (grub_device_t dev)
data->devices_attached[0].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -40,7 +40,7 @@ index 14e38a4df02..d47f9ab0352 100644
}
return data;
@@ -1966,24 +1970,39 @@ find_path (struct grub_btrfs_data *data,
@@ -1855,24 +1859,39 @@ find_path (struct grub_btrfs_data *data,
grub_size_t allocated = 0;
struct grub_btrfs_dir_item *direl = NULL;
struct grub_btrfs_key key_out;
@ -87,7 +87,7 @@ index 14e38a4df02..d47f9ab0352 100644
}
else
{
@@ -1994,15 +2013,23 @@ find_path (struct grub_btrfs_data *data,
@@ -1883,15 +1902,23 @@ find_path (struct grub_btrfs_data *data,
while (1)
{
@ -120,7 +120,7 @@ index 14e38a4df02..d47f9ab0352 100644
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
{
@@ -2013,7 +2040,9 @@ find_path (struct grub_btrfs_data *data,
@@ -1902,7 +1929,9 @@ find_path (struct grub_btrfs_data *data,
if (ctokenlen == 1 && ctoken[0] == '.')
{
@ -131,7 +131,7 @@ index 14e38a4df02..d47f9ab0352 100644
continue;
}
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
@@ -2044,8 +2073,9 @@ find_path (struct grub_btrfs_data *data,
@@ -1933,8 +1962,9 @@ find_path (struct grub_btrfs_data *data,
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
key->object_id = key_out.offset;
@ -143,7 +143,7 @@ index 14e38a4df02..d47f9ab0352 100644
continue;
}
@@ -2114,7 +2144,9 @@ find_path (struct grub_btrfs_data *data,
@@ -2003,7 +2033,9 @@ find_path (struct grub_btrfs_data *data,
return err;
}
@ -154,7 +154,7 @@ index 14e38a4df02..d47f9ab0352 100644
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
{
struct grub_btrfs_inode inode;
@@ -2164,14 +2196,26 @@ find_path (struct grub_btrfs_data *data,
@@ -2053,14 +2085,26 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
@ -188,7 +188,7 @@ index 14e38a4df02..d47f9ab0352 100644
}
else
{
@@ -2922,6 +2966,7 @@ GRUB_MOD_INIT (btrfs)
@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs)
subvolid_set_env);
grub_env_export ("btrfs_subvol");
grub_env_export ("btrfs_subvolid");

View file

@ -9,16 +9,16 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
grub-core/osdep/linux/getroot.c | 7 +++++++
grub-core/osdep/unix/config.c | 17 +++++++++++++++--
util/config.c | 10 ++++++++++
util/grub-install.c | 14 ++++++++++++++
util/grub-install.c | 15 +++++++++++++++
util/grub-mkrelpath.c | 6 ++++++
include/grub/emu/config.h | 1 +
6 files changed, 53 insertions(+), 2 deletions(-)
6 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 7dd775d2ad9..7c29b3523b4 100644
index 001b818fe5..caf9b1ccd3 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -373,6 +373,7 @@ get_btrfs_fs_prefix (const char *mount_path)
@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path)
return NULL;
}
@ -26,7 +26,7 @@ index 7dd775d2ad9..7c29b3523b4 100644
char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
@@ -516,6 +517,12 @@ again:
@@ -519,6 +520,12 @@ again:
{
ret = grub_find_root_devices_from_btrfs (dir);
fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path);
@ -40,7 +40,7 @@ index 7dd775d2ad9..7c29b3523b4 100644
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
{
diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c
index 0b1f7618d21..0ce0e309ac0 100644
index 7d6325138c..46a881530c 100644
--- a/grub-core/osdep/unix/config.c
+++ b/grub-core/osdep/unix/config.c
@@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg)
@ -75,7 +75,7 @@ index 0b1f7618d21..0ce0e309ac0 100644
argv[2] = script;
argv[3] = '\0';
diff --git a/util/config.c b/util/config.c
index ebcdd8f5e22..f044a880a76 100644
index ebcdd8f5e2..f044a880a7 100644
--- a/util/config.c
+++ b/util/config.c
@@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple)
@ -96,19 +96,19 @@ index ebcdd8f5e22..f044a880a76 100644
sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0)
{
diff --git a/util/grub-install.c b/util/grub-install.c
index 7dc5657bb67..ec3ed49674b 100644
index 0fbe7f78c6..0f66f36d23 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -843,6 +843,8 @@ try_open (const char *path)
@@ -827,6 +827,8 @@ fill_core_services (const char *core_services)
free (sysv_plist);
}
#endif
+extern int use_relative_path_on_btrfs;
+
int
main (int argc, char *argv[])
{
@@ -876,6 +878,9 @@ main (int argc, char *argv[])
@@ -860,6 +862,9 @@ main (int argc, char *argv[])
grub_util_load_config (&config);
@ -118,10 +118,11 @@ index 7dc5657bb67..ec3ed49674b 100644
if (!bootloader_id && config.grub_distributor)
{
char *ptr;
@@ -1366,6 +1371,15 @@ main (int argc, char *argv[])
relative_grubdir = xstrdup ("/");
@@ -1352,6 +1357,16 @@ main (int argc, char *argv[])
fprintf (load_cfg_f, "set debug='%s'\n",
debug_image);
}
+
+ if (config.is_suse_btrfs_snapshot_enabled
+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0)
+ {
@ -135,7 +136,7 @@ index 7dc5657bb67..ec3ed49674b 100644
char *install_drive = NULL;
diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c
index 47a241a391b..5db7a9a7d97 100644
index 47a241a391..5db7a9a7d9 100644
--- a/util/grub-mkrelpath.c
+++ b/util/grub-mkrelpath.c
@@ -40,9 +40,12 @@ struct arguments
@ -162,7 +163,7 @@ index 47a241a391b..5db7a9a7d97 100644
if (state->arg_num == 0)
arguments->pathname = xstrdup (arg);
diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h
index 875d5896ce1..c9a7e5f4ade 100644
index 875d5896ce..c9a7e5f4ad 100644
--- a/include/grub/emu/config.h
+++ b/include/grub/emu/config.h
@@ -37,6 +37,7 @@ struct grub_util_config

View file

@ -13,10 +13,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 28e92515795..884e4d363ca 100644
index 005f093809..535c0f0249 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -256,7 +256,8 @@ export GRUB_DEFAULT \
@@ -252,7 +252,8 @@ export GRUB_DEFAULT \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
@ -27,7 +27,7 @@ index 28e92515795..884e4d363ca 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 33e1750aebb..0ba0e0e1c65 100644
index 0f6505bf3b..5e96f6cc5d 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -49,7 +49,11 @@ grub_warn ()
@ -43,7 +43,7 @@ index 33e1750aebb..0ba0e0e1c65 100644
is_path_readable_by_grub ()
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index c2d8b093762..3e1b77265db 100644
index 858b526c92..de727e6ee6 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
@ -90,10 +90,10 @@ index c2d8b093762..3e1b77265db 100644
+EOF
+fi
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index e8ab4082f87..48ff32c1da4 100644
index 292e333324..7bb3a211a7 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -68,10 +68,14 @@ fi
@@ -66,10 +66,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)
@ -109,10 +109,10 @@ index e8ab4082f87..48ff32c1da4 100644
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 98ee5bc58dc..efcded0fbb4 100644
index ada20775a1..e9e73b815f 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -75,10 +75,14 @@ fi
@@ -73,10 +73,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:06:38 -0400
Subject: [PATCH] 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
get more reasonable type checking.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 1de98f78313..2036924504b 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -95,7 +95,7 @@ grub_chainloader_boot (void *context)
}
if (exit_data)
- b->free_pool (exit_data);
+ grub_efi_free_pool (exit_data);
grub_loader_unset ();
@@ -419,7 +419,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_free (file_path);
if (address)
- b->free_pages (address, pages);
+ grub_efi_free_pages (address, pages);
if (image_handle != NULL)
b->unload_image (image_handle);

View file

@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 392 insertions(+), 5 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index d47f9ab0352..d44a1c73b8a 100644
index 113c1f746c..d323746ecf 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -41,6 +41,7 @@
@ -37,7 +37,7 @@ index d47f9ab0352..d44a1c73b8a 100644
static grub_err_t
read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb)
@@ -1302,9 +1309,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1223,9 +1230,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
grub_err_t err;
grub_uint64_t tree = 0;
grub_uint8_t type;
@ -64,10 +64,10 @@ index d47f9ab0352..d44a1c73b8a 100644
if (err)
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
@@ -2316,11 +2340,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
@@ -2199,11 +2223,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
int r = 0;
grub_uint64_t tree;
grub_uint8_t type;
grub_size_t est_size = 0;
+ char *new_path = NULL;
if (!data)
@ -86,7 +86,7 @@ index d47f9ab0352..d44a1c73b8a 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -2447,11 +2480,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
@@ -2305,11 +2338,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
struct grub_btrfs_inode inode;
grub_uint8_t type;
struct grub_btrfs_key key_in;
@ -109,7 +109,7 @@ index d47f9ab0352..d44a1c73b8a 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -2686,6 +2729,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
@@ -2480,6 +2523,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
return 0;
}
@ -260,7 +260,7 @@ index d47f9ab0352..d44a1c73b8a 100644
static grub_err_t
get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree,
grub_uint64_t objectid, grub_uint64_t offset,
@@ -2892,6 +3079,7 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2686,6 +2873,7 @@ static struct grub_fs grub_btrfs_fs = {
};
static grub_command_t cmd_info;
@ -268,7 +268,7 @@ index d47f9ab0352..d44a1c73b8a 100644
static grub_extcmd_t cmd_list_subvols;
static char *
@@ -2955,6 +3143,9 @@ GRUB_MOD_INIT (btrfs)
@@ -2749,6 +2937,9 @@ GRUB_MOD_INIT (btrfs)
cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
"DEVICE",
"Print BtrFS info about DEVICE.");
@ -279,10 +279,10 @@ index d47f9ab0352..d44a1c73b8a 100644
grub_cmd_btrfs_list_subvols, 0,
"[-p|-n] [-o var] DEVICE",
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 7c29b3523b4..74a48c03026 100644
index caf9b1ccd3..28790307e0 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -103,6 +103,14 @@ struct btrfs_ioctl_search_key
@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key
grub_uint32_t unused[9];
};
@ -297,7 +297,7 @@ index 7c29b3523b4..74a48c03026 100644
struct btrfs_ioctl_search_args {
struct btrfs_ioctl_search_key key;
grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key))
@@ -375,6 +383,109 @@ get_btrfs_fs_prefix (const char *mount_path)
@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_path)
int use_relative_path_on_btrfs = 0;
@ -407,7 +407,7 @@ index 7c29b3523b4..74a48c03026 100644
char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
{
@@ -516,12 +627,15 @@ again:
@@ -519,12 +630,15 @@ again:
else if (grub_strcmp (entries[i].fstype, "btrfs") == 0)
{
ret = grub_find_root_devices_from_btrfs (dir);
@ -426,7 +426,7 @@ index 7c29b3523b4..74a48c03026 100644
}
}
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
@@ -1147,6 +1261,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
@@ -1150,6 +1264,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
return grub_dev;
}
@ -462,10 +462,10 @@ index 7c29b3523b4..74a48c03026 100644
grub_make_system_path_relative_to_its_root_os (const char *path)
{
diff --git a/util/grub-install.c b/util/grub-install.c
index ec3ed49674b..d3ec2570d1d 100644
index 0f66f36d23..84ed6e88ec 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1615,6 +1615,55 @@ main (int argc, char *argv[])
@@ -1569,6 +1569,55 @@ main (int argc, char *argv[])
prefix_drive = xasprintf ("(%s)", grub_drives[0]);
}
@ -522,7 +522,7 @@ index ec3ed49674b..d3ec2570d1d 100644
const char *core_name = NULL;
diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h
index 73fa2d34abb..9c642ae3fe3 100644
index 73fa2d34ab..9c642ae3fe 100644
--- a/include/grub/emu/getroot.h
+++ b/include/grub/emu/getroot.h
@@ -53,6 +53,11 @@ char **

View file

@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:07:50 -0400
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
This avoids syntax checkers getting confused about if it's llx or lx.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
include/grub/efi/api.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index c1b869db520..daa9268fdaa 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -577,7 +577,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
typedef grub_uint8_t grub_efi_char8_t;
typedef grub_uint16_t grub_efi_char16_t;
+
typedef grub_efi_uintn_t grub_efi_status_t;
+/* Make grub_efi_status_t reasonably printable. */
+#if GRUB_CPU_SIZEOF_VOID_P == 8
+#define PRIxGRUB_EFI_STATUS "lx"
+#define PRIdGRUB_EFI_STATUS "ld"
+#else
+#define PRIxGRUB_EFI_STATUS "llx"
+#define PRIdGRUB_EFI_STATUS "lld"
+#endif
/*
* On x86, the EFI calling convention may deviate from the local one, so

View file

@ -10,10 +10,10 @@ Ref: bsc#953538
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index d44a1c73b8a..dba86d19b1a 100644
index d323746ecf..673ded0352 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1339,11 +1339,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
return GRUB_ERR_NONE;
}

View file

@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 238 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index dba86d19b1a..87e4dd1a07a 100644
index 673ded0352..2b21cbaa67 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -3093,6 +3093,238 @@ out:
@@ -2887,6 +2887,238 @@ out:
return 0;
}
@ -252,7 +252,7 @@ index dba86d19b1a..87e4dd1a07a 100644
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.fs_dir = grub_btrfs_dir,
@@ -3111,6 +3343,7 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2905,6 +3137,7 @@ static struct grub_fs grub_btrfs_fs = {
static grub_command_t cmd_info;
static grub_command_t cmd_mount_subvol;
static grub_extcmd_t cmd_list_subvols;
@ -260,7 +260,7 @@ index dba86d19b1a..87e4dd1a07a 100644
static char *
subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)),
@@ -3181,6 +3414,11 @@ GRUB_MOD_INIT (btrfs)
@@ -2975,6 +3208,11 @@ GRUB_MOD_INIT (btrfs)
"[-p|-n] [-o var] DEVICE",
"Print list of BtrFS subvolumes on "
"DEVICE.", options);

View file

@ -10,21 +10,21 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index a5cd99e5afa..8d98203a784 100644
index 585fa6662b..03f9a9d011 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -36,6 +36,10 @@ struct linux_arch_kernel_header {
struct grub_pe_image_header pe_image_header;
};
@@ -24,6 +24,10 @@
#include <grub/dl.h>
#include <grub/efi/api.h>
+/* Variables. */
+extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
+extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
+
/* Functions. */
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol,
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *registration);
@@ -71,6 +75,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
@@ -60,6 +64,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
void grub_efi_memory_fini (void);
@ -39,7 +39,7 @@ index a5cd99e5afa..8d98203a784 100644
+ grub_efi_status_t status;
+
+ b = grub_efi_system_table->boot_services;
+ status = b->allocate_pool(pool_type, buffer_size, buffer);
+ status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer);
+ return status;
+}
+
@ -51,14 +51,14 @@ index a5cd99e5afa..8d98203a784 100644
+ grub_efi_status_t status;
+
+ b = grub_efi_system_table->boot_services;
+ status = b->free_pool(buffer);
+ status = efi_call_1 (b->free_pool, buffer);
+ return status;
+}
+
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
@@ -140,10 +171,7 @@ void grub_efi_init (void);
@@ -115,10 +146,7 @@ void grub_efi_init (void);
void grub_efi_fini (void);
void grub_efi_set_prefix (void);

View file

@ -0,0 +1,106 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:06:38 -0400
Subject: [PATCH] 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
get more reasonable type checking.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 07c4937898..89ac84cc66 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -65,7 +65,7 @@ grub_chainloader_unload (void)
b = grub_efi_system_table->boot_services;
efi_call_1 (b->unload_image, image_handle);
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
grub_free (file_path);
grub_free (cmdline);
@@ -108,7 +108,7 @@ grub_chainloader_boot (void)
}
if (exit_data)
- efi_call_1 (b->free_pool, exit_data);
+ grub_efi_free_pool (exit_data);
grub_loader_unset ();
@@ -527,10 +527,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp)
static grub_efi_boolean_t
handle_image (void *data, grub_efi_uint32_t datasize)
{
- grub_efi_boot_services_t *b;
grub_efi_loaded_image_t *li, li_bak;
grub_efi_status_t efi_status;
- char *buffer = NULL;
+ void *buffer = NULL;
char *buffer_aligned = NULL;
grub_efi_uint32_t i;
struct grub_pe32_section_table *section;
@@ -541,8 +540,6 @@ handle_image (void *data, grub_efi_uint32_t datasize)
int found_entry_point = 0;
int rc;
- b = grub_efi_system_table->boot_services;
-
rc = read_header (data, datasize, &context);
if (rc < 0)
{
@@ -582,8 +579,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n",
context.image_size, datasize);
- efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
- buffer_size, &buffer);
+ efi_status = grub_efi_allocate_pool (GRUB_EFI_LOADER_DATA, buffer_size,
+ &buffer);
if (efi_status != GRUB_EFI_SUCCESS)
{
@@ -815,14 +812,14 @@ handle_image (void *data, grub_efi_uint32_t datasize)
grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
- efi_status = efi_call_1 (b->free_pool, buffer);
+ efi_status = grub_efi_free_pool (buffer);
return 1;
error_exit:
grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno);
if (buffer)
- efi_call_1 (b->free_pool, buffer);
+ grub_efi_free_pool (buffer);
return 0;
}
@@ -830,10 +827,7 @@ error_exit:
static grub_err_t
grub_secureboot_chainloader_unload (void)
{
- grub_efi_boot_services_t *b;
-
- b = grub_efi_system_table->boot_services;
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
grub_free (file_path);
grub_free (cmdline);
cmdline = 0;
@@ -1100,7 +1094,7 @@ fail:
grub_free (file_path);
if (address)
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
if (cmdline)
grub_free (cmdline);

View file

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:07:50 -0400
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
This avoids syntax checkers getting confused about if it's llx or lx.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 3 ++-
include/grub/efi/api.h | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 89ac84cc66..ac8dfd40c6 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
grub_efi_system_table);
- grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
+ grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n",
+ efi_status);
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
efi_status = grub_efi_free_pool (buffer);
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 117469450d..9962880147 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
typedef grub_uint8_t grub_efi_char8_t;
typedef grub_uint16_t grub_efi_char16_t;
+
typedef grub_efi_uintn_t grub_efi_status_t;
+/* Make grub_efi_status_t reasonably printable. */
+#if GRUB_CPU_SIZEOF_VOID_P == 8
+#define PRIxGRUB_EFI_STATUS "lx"
+#define PRIdGRUB_EFI_STATUS "ld"
+#else
+#define PRIxGRUB_EFI_STATUS "llx"
+#define PRIdGRUB_EFI_STATUS "lld"
+#endif
#define GRUB_EFI_ERROR_CODE(value) \
((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value))

View file

@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 885d7c6420e..2bb8a0e7a38 100644
index 05d8237a9b..ae9885edb8 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -177,7 +177,7 @@ grub_reboot (void)
@@ -167,7 +167,7 @@ grub_reboot (void)
void
grub_exit (int retval)
{

View file

@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes.
1 file changed, 2 insertions(+)
diff --git a/include/grub/dl.h b/include/grub/dl.h
index cd1f46c8bad..f2bf50eb98d 100644
index b3753c9ca2..91933b85f2 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -54,6 +54,7 @@ grub_mod_fini (void)

View file

@ -16,10 +16,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index d3ec2570d1d..66ef9494d9d 100644
index 84ed6e88ec..a2bec7446c 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1234,18 +1234,8 @@ main (int argc, char *argv[])
@@ -1190,18 +1190,8 @@ main (int argc, char *argv[])
char *d;
is_guess = 1;

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 5 insertions(+)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index efcded0fbb4..4ecf5deea17 100644
index e9e73b815f..c23b064be6 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -156,6 +156,7 @@ linux_entry_xsm ()
@@ -153,6 +153,7 @@ linux_entry_xsm ()
else
xen_rm_opts="no-real-mode edd=off"
fi
@ -20,15 +20,15 @@ index efcded0fbb4..4ecf5deea17 100644
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
@@ -168,6 +169,7 @@ EOF
initrd_path="${rel_dirname}/${i}"
sed "s/^/$submenu_indentation/" << EOF
@@ -166,6 +167,7 @@ EOF
done
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
+ insmod ${xen_module}
${module_loader} --nounzip $(echo $initrd_path)
EOF
done
@@ -269,13 +271,16 @@ for current_xen in ${reverse_sorted_xen_list}; do
fi
@@ -253,13 +255,16 @@ while [ "x${xen_list}" != "x" ] ; do
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
fi
if ($grub_file --is-arm64-efi $current_xen); then

View file

@ -0,0 +1,211 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 7 Nov 2017 17:12:17 -0500
Subject: [PATCH] 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
using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds
to do so (as measured with the stopwatch on my phone), with a tsc delta
of 0x1cd1c85300, or around 125 billion cycles.
If instead of trying to wait for 5-200ms to show up on the pmtimer, we try
to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka ~2.4
million cycles, or more or less instantly.
Additionally, this reading the pmtimer was returning 0xffffffff anyway,
and that's obviously an invalid return. I've added a check for that and
0 so we don't bother waiting for the test if what we're seeing is dead
pins with no response at all.
If "debug" is includes "pmtimer", you will see one of the following
three outcomes. If pmtimer gives all 0 or all 1 bits, you will see:
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 1
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 2
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 3
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 4
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 5
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 6
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 7
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 8
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 9
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 10
kern/i386/tsc_pmtimer.c:78: timer is broken; giving up.
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and
these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
If pmtimer gives any other bit patterns but is not actually marching
forward fast enough to use for clock calibration, you will see:
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
This outcome was tested using grub compiled with GRUB_PMTIMER_IGNORE_BAD_READS
defined (so as not to trip the bad read test) using qemu+kvm with UEFI
(OVMF) firmware, and these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
If pmtimer actually works, you'll see something like:
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and
these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX
I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel
Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here:
https://firmware.intel.com/sites/default/files/UEFIDevKit_S1200RP_vB8.zip
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/i386/tsc_pmtimer.c | 109 +++++++++++++++++++++++++++++++-------
1 file changed, 89 insertions(+), 20 deletions(-)
diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c
index c9c3616997..ca15c3aacd 100644
--- a/grub-core/kern/i386/tsc_pmtimer.c
+++ b/grub-core/kern/i386/tsc_pmtimer.c
@@ -28,40 +28,101 @@
#include <grub/acpi.h>
#include <grub/cpu/io.h>
+/*
+ * Define GRUB_PMTIMER_IGNORE_BAD_READS if you're trying to test a timer that's
+ * present but doesn't keep time well.
+ */
+// #define GRUB_PMTIMER_IGNORE_BAD_READS
+
grub_uint64_t
grub_pmtimer_wait_count_tsc (grub_port_t pmtimer,
grub_uint16_t num_pm_ticks)
{
grub_uint32_t start;
- grub_uint32_t last;
- grub_uint32_t cur, end;
+ grub_uint64_t cur, end;
grub_uint64_t start_tsc;
grub_uint64_t end_tsc;
- int num_iter = 0;
+ unsigned int num_iter = 0;
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
+ int bad_reads = 0;
+#endif
- start = grub_inl (pmtimer) & 0xffffff;
- last = start;
+ /*
+ * Some timers are 24-bit and some are 32-bit, but it doesn't make much
+ * difference to us. Caring which one we have isn't really worth it since
+ * the low-order digits will give us enough data to calibrate TSC. So just
+ * mask the top-order byte off.
+ */
+ cur = start = grub_inl (pmtimer) & 0xffffffUL;
end = start + num_pm_ticks;
start_tsc = grub_get_tsc ();
while (1)
{
- cur = grub_inl (pmtimer) & 0xffffff;
- if (cur < last)
- cur |= 0x1000000;
- num_iter++;
+ cur &= 0xffffffffff000000ULL;
+ cur |= grub_inl (pmtimer) & 0xffffffUL;
+
+ end_tsc = grub_get_tsc();
+
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
+ /*
+ * If we get 10 reads in a row that are obviously dead pins, there's no
+ * reason to do this thousands of times.
+ */
+ if (cur == 0xffffffUL || cur == 0)
+ {
+ bad_reads++;
+ grub_dprintf ("pmtimer",
+ "pmtimer: 0x%"PRIxGRUB_UINT64_T" bad_reads: %d\n",
+ cur, bad_reads);
+ grub_dprintf ("pmtimer", "timer is broken; giving up.\n");
+
+ if (bad_reads == 10)
+ return 0;
+ }
+#endif
+
+ if (cur < start)
+ cur += 0x1000000;
+
if (cur >= end)
{
- end_tsc = grub_get_tsc ();
+ grub_dprintf ("pmtimer", "pmtimer delta is 0x%"PRIxGRUB_UINT64_T"\n",
+ cur - start);
+ grub_dprintf ("pmtimer", "tsc delta is 0x%"PRIxGRUB_UINT64_T"\n",
+ end_tsc - start_tsc);
return end_tsc - start_tsc;
}
- /* Check for broken PM timer.
- 50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz)
- if after this time we still don't have 1 ms on pmtimer, then
- pmtimer is broken.
+
+ /*
+ * Check for broken PM timer. 1ms at 10GHz should be 1E+7 TSCs; at
+ * 250MHz it should be 2.5E6. So if after 4E+7 TSCs on a 10GHz machine,
+ * we should have seen pmtimer show 4ms of change (i.e. cur =~
+ * start+14320); on a 250MHz machine that should be 16ms (start+57280).
+ * If after this a time we still don't have 1ms on pmtimer, then pmtimer
+ * is broken.
+ *
+ * Likewise, if our code is perfectly efficient and introduces no delays
+ * whatsoever, on a 10GHz system we should see a TSC delta of 3580 in
+ * ~3580 iterations. On a 250MHz machine that should be ~900 iterations.
+ *
+ * With those factors in mind, there are two limits here. There's a hard
+ * limit here at 8x our desired pm timer delta, picked as an arbitrarily
+ * large value that's still not a lot of time to humans, because if we
+ * get that far this is either an implausibly fast machine or the pmtimer
+ * is not running. And there's another limit on 4x our 10GHz tsc delta
+ * without seeing cur converge on our target value.
*/
- if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) {
- return 0;
- }
+ if ((++num_iter > (grub_uint32_t)num_pm_ticks << 3UL) ||
+ end_tsc - start_tsc > 40000000)
+ {
+ grub_dprintf ("pmtimer",
+ "pmtimer delta is 0x%"PRIxGRUB_UINT64_T" (%u iterations)\n",
+ cur - start, num_iter);
+ grub_dprintf ("pmtimer",
+ "tsc delta is implausible: 0x%"PRIxGRUB_UINT64_T"\n",
+ end_tsc - start_tsc);
+ return 0;
+ }
}
}
@@ -74,12 +135,20 @@ grub_tsc_calibrate_from_pmtimer (void)
fadt = grub_acpi_find_fadt ();
if (!fadt)
- return 0;
+ {
+ grub_dprintf ("pmtimer", "No FADT found; not using pmtimer.\n");
+ return 0;
+ }
pmtimer = fadt->pmtimer;
if (!pmtimer)
- return 0;
+ {
+ grub_dprintf ("pmtimer", "FADT does not specify pmtimer; skipping.\n");
+ return 0;
+ }
- /* It's 3.579545 MHz clock. Wait 1 ms. */
+ /*
+ * It's 3.579545 MHz clock. Wait 1 ms.
+ */
tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer, 3580);
if (tsc_diff == 0)
return 0;

View file

@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better...
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 2ff42984545..6363fd522e1 100644
index 36d2dedf47..9d93ba88ba 100644
--- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h
@@ -33,5 +33,5 @@ struct efi_variable
@ -20,10 +20,10 @@ index 2ff42984545..6363fd522e1 100644
+} GRUB_PACKED GRUB_ALIGNED(8);
#endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */
diff --git a/include/grub/types.h b/include/grub/types.h
index 064066e2e18..59e030268c2 100644
index 0a3ff15913..ba446d9904 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -30,6 +30,7 @@
@@ -29,6 +29,7 @@
#else
#define GRUB_PACKED __attribute__ ((packed))
#endif

View file

@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
3 files changed, 243 insertions(+), 6 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 884e4d363ca..bec52e052fc 100644
index 535c0f0249..f55339a3f6 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
@ -63,7 +63,7 @@ index 884e4d363ca..bec52e052fc 100644
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
@@ -257,7 +263,8 @@ export GRUB_DEFAULT \
@@ -253,7 +259,8 @@ export GRUB_DEFAULT \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
GRUB_DEFAULT_DTB \
@ -74,7 +74,7 @@ index 884e4d363ca..bec52e052fc 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 0ba0e0e1c65..c2e107b41ab 100644
index 5e96f6cc5d..301d8a8a1e 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -30,6 +30,9 @@ fi
@ -131,10 +131,10 @@ index 0ba0e0e1c65..c2e107b41ab 100644
fi
IFS="$old_ifs"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 48ff32c1da4..cd9aea0cc01 100644
index 7bb3a211a7..2851952659 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -84,6 +84,218 @@ case x"$GRUB_FS" in
@@ -82,6 +82,218 @@ case x"$GRUB_FS" in
;;
esac
@ -353,7 +353,7 @@ index 48ff32c1da4..cd9aea0cc01 100644
mktitle ()
{
local title_type
@@ -123,6 +335,7 @@ linux_entry ()
@@ -121,6 +333,7 @@ linux_entry ()
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
@ -361,15 +361,15 @@ index 48ff32c1da4..cd9aea0cc01 100644
if [ x$type != xsimple ] ; then
title=$(mktitle "$type" "$version")
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
@@ -243,6 +456,7 @@ fi
is_top_level=true
for linux in ${reverse_sorted_list}; do
@@ -231,6 +444,7 @@ is_top_level=true
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
gettext_printf "Found linux image: %s\n" "$linux" >&2
+
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -283,7 +497,9 @@ for linux in ${reverse_sorted_list}; do
@@ -269,7 +483,9 @@ while [ "x$list" != "x" ] ; do
for i in ${initrd}; do
initrd_display="${initrd_display} ${dirname}/${i}"
done

View file

@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 465a8e74ea7..b1d399d37d7 100644
index a3e215155b..c60601b699 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1303,7 +1303,7 @@ void __attribute__ ((noreturn))
@@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn))
grub_abort (void)
{
#ifndef GRUB_UTIL

View file

@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub-switch-to-blscfg.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 84a17ef5cfa..acbcc8c208c 100644
index 18a9242776..88f55e35c4 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -1387,6 +1387,13 @@ program = {
@@ -1348,6 +1348,13 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -39,14 +39,14 @@ index 84a17ef5cfa..acbcc8c208c 100644
mansection = 1;
diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m
new file mode 100644
index 00000000000..fa341426a50
index 0000000000..fa341426a5
--- /dev/null
+++ b/docs/man/grub-switch-to-blscfg.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-switch-to-blscfg \- switch to using BLS config files
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index 5ebf50576d6..c0b5ebbfdc5 100644
index 5ebf50576d..c0b5ebbfdc 100644
--- a/util/grub-set-password.in
+++ b/util/grub-set-password.in
@@ -1,6 +1,6 @@
@ -59,7 +59,7 @@ index 5ebf50576d6..c0b5ebbfdc5 100644
else
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
new file mode 100644
index 00000000000..a851424beb2
index 0000000000..a851424beb
--- /dev/null
+++ b/util/grub-switch-to-blscfg.in
@@ -0,0 +1,317 @@
@ -129,7 +129,7 @@ index 00000000000..a851424beb2
+# Print the usage.
+usage () {
+ gettext_printf "Usage: %s\n" "$self"
+ gettext "Switch to BLS config files."; echo
+ gettext "Switch to BLS config files.\n"; echo
+ echo
+ print_option_help "-h, --help" "$(gettext "print this message and exit")"
+ print_option_help "-V, --version" "$(gettext "print the version information and exit")"
@ -381,10 +381,10 @@ index 00000000000..a851424beb2
+# Bye.
+exit 0
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index cd9aea0cc01..b8bc37e92aa 100644
index 2851952659..e490e1a43a 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -140,7 +140,7 @@ blsdir="/boot/loader/entries"
@@ -138,7 +138,7 @@ blsdir="/boot/loader/entries"
get_sorted_bls()
{

View file

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2018 13:40:19 -0400
Subject: [PATCH] Fixup for newer compiler
---
grub-core/fs/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 87e4dd1a07a..ad35e75750b 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -218,7 +218,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
{

View file

@ -15,7 +15,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++
grub-core/kern/i386/pc/init.c | 4 +-
grub-core/kern/ieee1275/init.c | 1 -
grub-core/kern/misc.c | 11 +--
grub-core/kern/misc.c | 13 ++--
grub-core/kern/mm.c | 6 +-
grub-core/lib/arm64/backtrace.c | 62 ----------------
grub-core/lib/i386/backtrace.c | 78 --------------------
@ -29,7 +29,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/ia64/efi/startup.S | 3 +-
grub-core/kern/sparc64/ieee1275/crt0.S | 3 +-
grub-core/Makefile.am | 1 +
24 files changed, 413 insertions(+), 166 deletions(-)
24 files changed, 414 insertions(+), 167 deletions(-)
rename grub-core/{lib => commands}/backtrace.c (98%)
create mode 100644 grub-core/kern/arm64/backtrace.c
create mode 100644 grub-core/kern/backtrace.c
@ -38,7 +38,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
delete mode 100644 grub-core/lib/i386/backtrace.c
diff --git a/Makefile.util.def b/Makefile.util.def
index acbcc8c208c..1079add5bbe 100644
index 88f55e35c4..bda9fd1211 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -51,6 +51,12 @@ library = {
@ -55,10 +55,10 @@ index acbcc8c208c..1079add5bbe 100644
library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 63f053b3add..6645fbae34f 100644
index 058c88ac3a..52ec0fafcd 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -153,6 +153,12 @@ kernel = {
@@ -142,6 +142,12 @@ kernel = {
common = kern/rescue_reader.c;
common = kern/term.c;
common = kern/verifiers.c;
@ -71,7 +71,7 @@ index 63f053b3add..6645fbae34f 100644
noemu = kern/compiler-rt.c;
noemu = kern/mm.c;
@@ -199,9 +205,6 @@ kernel = {
@@ -188,9 +194,6 @@ kernel = {
softdiv = lib/division.c;
@ -81,7 +81,7 @@ index 63f053b3add..6645fbae34f 100644
i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c;
@@ -2455,15 +2458,12 @@ module = {
@@ -2399,15 +2402,12 @@ module = {
module = {
name = backtrace;
@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c
similarity index 98%
rename from grub-core/lib/backtrace.c
rename to grub-core/commands/backtrace.c
index c0ad6ab8be1..8b5ec3913b5 100644
index c0ad6ab8be..8b5ec3913b 100644
--- a/grub-core/lib/backtrace.c
+++ b/grub-core/commands/backtrace.c
@@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)),
@ -116,7 +116,7 @@ index c0ad6ab8be1..8b5ec3913b5 100644
}
diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c
index b64acd70fee..99281472d36 100644
index b64acd70fe..99281472d3 100644
--- a/grub-core/gdb/cstub.c
+++ b/grub-core/gdb/cstub.c
@@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no)
@ -129,7 +129,7 @@ index b64acd70fee..99281472d36 100644
diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c
new file mode 100644
index 00000000000..019c6fdfef2
index 0000000000..019c6fdfef
--- /dev/null
+++ b/grub-core/kern/arm64/backtrace.c
@@ -0,0 +1,94 @@
@ -229,7 +229,7 @@ index 00000000000..019c6fdfef2
+}
diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c
new file mode 100644
index 00000000000..4a82e865cc6
index 0000000000..4a82e865cc
--- /dev/null
+++ b/grub-core/kern/backtrace.c
@@ -0,0 +1,97 @@
@ -331,10 +331,10 @@ index 00000000000..4a82e865cc6
+ grub_backtrace (skip + 1);
+}
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 0bf40caa61a..931f6e41442 100644
index 7afb9e6f72..88d2077709 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -115,6 +115,50 @@ grub_dl_resolve_symbol (const char *name)
@@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name)
return 0;
}
@ -385,7 +385,7 @@ index 0bf40caa61a..931f6e41442 100644
/* Register a symbol with the name NAME and the address ADDR. */
grub_err_t
grub_dl_register_symbol (const char *name, void *addr, int isfunc,
@@ -330,6 +374,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
@@ -336,6 +380,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
const char *str;
Elf_Word size, entsize;
@ -395,7 +395,7 @@ index 0bf40caa61a..931f6e41442 100644
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c
new file mode 100644
index 00000000000..2413f9a57db
index 0000000000..2413f9a57d
--- /dev/null
+++ b/grub-core/kern/i386/backtrace.c
@@ -0,0 +1,125 @@
@ -525,7 +525,7 @@ index 00000000000..2413f9a57db
+#endif
+}
diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c
index 326d491c586..fe7ad14d45c 100644
index 27bc68b8a5..b51d0abfa6 100644
--- a/grub-core/kern/i386/pc/init.c
+++ b/grub-core/kern/i386/pc/init.c
@@ -153,7 +153,7 @@ compact_mem_regions (void)
@ -537,7 +537,7 @@ index 326d491c586..fe7ad14d45c 100644
/* Helper for grub_machine_init. */
static int
@@ -226,7 +226,7 @@ grub_machine_init (void)
@@ -217,7 +217,7 @@ grub_machine_init (void)
/* This has to happen before any BIOS calls. */
grub_via_workaround_init ();
@ -547,23 +547,27 @@ index 326d491c586..fe7ad14d45c 100644
/* Initialize the console as early as possible. */
grub_console_init ();
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 51c1e1c9d9f..c4d6962197b 100644
index 0cd2a62723..937c1bc44c 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -70,7 +70,6 @@
*/
#define RUNTIME_MIN_SPACE (128UL * 1024 * 1024)
@@ -63,7 +63,6 @@
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
#endif
-extern char _start[];
extern char _end[];
#ifdef __sparc__
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index b1d399d37d7..779586658cb 100644
index c60601b699..a432a6be54 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1302,12 +1302,12 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
void __attribute__ ((noreturn))
@@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
/* Abort GRUB. This function does not return. */
-static void __attribute__ ((noreturn))
+static inline void __attribute__ ((noreturn))
grub_abort (void)
{
-#ifndef GRUB_UTIL
@ -580,7 +584,7 @@ index b1d399d37d7..779586658cb 100644
#ifndef GRUB_UTIL
if (grub_term_inputs)
@@ -1334,6 +1334,7 @@ grub_fatal (const char *fmt, ...)
@@ -1232,6 +1232,7 @@ grub_fatal (const char *fmt, ...)
{
va_list ap;
@ -589,10 +593,10 @@ index b1d399d37d7..779586658cb 100644
grub_vprintf (_(fmt), ap);
va_end (ap);
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
index 027a25cd1f0..1aeeba9e27e 100644
index c070afc621..d8c8377578 100644
--- a/grub-core/kern/mm.c
+++ b/grub-core/kern/mm.c
@@ -144,13 +144,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
@@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
break;
if (! *r)
@ -611,7 +615,7 @@ index 027a25cd1f0..1aeeba9e27e 100644
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
deleted file mode 100644
index 1079b5380e1..00000000000
index 1079b5380e..0000000000
--- a/grub-core/lib/arm64/backtrace.c
+++ /dev/null
@@ -1,62 +0,0 @@
@ -679,7 +683,7 @@ index 1079b5380e1..00000000000
-
diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c
deleted file mode 100644
index c67273db3ae..00000000000
index c67273db3a..0000000000
--- a/grub-core/lib/i386/backtrace.c
+++ /dev/null
@@ -1,78 +0,0 @@
@ -762,7 +766,7 @@ index c67273db3ae..00000000000
-}
-
diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h
index 395519762f0..275cf85e2d3 100644
index 395519762f..275cf85e2d 100644
--- a/include/grub/backtrace.h
+++ b/include/grub/backtrace.h
@@ -19,8 +19,14 @@
@ -783,10 +787,10 @@ index 395519762f0..275cf85e2d3 100644
#endif
diff --git a/include/grub/dl.h b/include/grub/dl.h
index f2bf50eb98d..8a3d188d1d1 100644
index 91933b85f2..2f76e6b043 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -258,6 +258,8 @@ grub_dl_is_persistent (grub_dl_t mod)
@@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod)
#endif
@ -796,7 +800,7 @@ index f2bf50eb98d..8a3d188d1d1 100644
int isfunc, grub_dl_t mod);
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index abbca5ea335..300a9766cda 100644
index abbca5ea33..300a9766cd 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void);
@ -810,7 +814,7 @@ index abbca5ea335..300a9766cda 100644
void grub_main (void) __attribute__ ((noreturn));
diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S
index 9f8265315a9..f3bc41f9d0f 100644
index 9f8265315a..f3bc41f9d0 100644
--- a/grub-core/kern/arm/efi/startup.S
+++ b/grub-core/kern/arm/efi/startup.S
@@ -23,6 +23,8 @@
@ -823,7 +827,7 @@ index 9f8265315a9..f3bc41f9d0f 100644
/*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0.
diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S
index 3946fe8e183..5679a1d00ad 100644
index 3946fe8e18..5679a1d00a 100644
--- a/grub-core/kern/arm/startup.S
+++ b/grub-core/kern/arm/startup.S
@@ -48,6 +48,8 @@
@ -836,7 +840,7 @@ index 3946fe8e183..5679a1d00ad 100644
b codestart
diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S
index 666a7ee3c92..41676bdb2b8 100644
index 666a7ee3c9..41676bdb2b 100644
--- a/grub-core/kern/arm64/efi/startup.S
+++ b/grub-core/kern/arm64/efi/startup.S
@@ -19,7 +19,9 @@
@ -850,7 +854,7 @@ index 666a7ee3c92..41676bdb2b8 100644
/*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0.
diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S
index 0d89858d9b3..939f182fc74 100644
index 0d89858d9b..939f182fc7 100644
--- a/grub-core/kern/i386/qemu/startup.S
+++ b/grub-core/kern/i386/qemu/startup.S
@@ -24,7 +24,8 @@
@ -864,7 +868,7 @@ index 0d89858d9b3..939f182fc74 100644
jmp codestart
diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S
index d75c6d7cc74..8f2a593e529 100644
index d75c6d7cc7..8f2a593e52 100644
--- a/grub-core/kern/ia64/efi/startup.S
+++ b/grub-core/kern/ia64/efi/startup.S
@@ -24,8 +24,9 @@
@ -879,7 +883,7 @@ index d75c6d7cc74..8f2a593e529 100644
alloc loc0=ar.pfs,2,4,0,0
mov loc1=rp
diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S
index 03b916f0534..701bf63abcf 100644
index 03b916f053..701bf63abc 100644
--- a/grub-core/kern/sparc64/ieee1275/crt0.S
+++ b/grub-core/kern/sparc64/ieee1275/crt0.S
@@ -22,7 +22,8 @@
@ -893,7 +897,7 @@ index 03b916f0534..701bf63abcf 100644
ba codestart
mov %o4, %o0
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f18550c1c98..b7192a3da82 100644
index ee88e44e97..bfd29a3bf0 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h

View file

@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set
1 file changed, 3 insertions(+)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 3463f444f74..b5fa6156549 100644
index 55558cc0b9..af9792c963 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -430,6 +430,9 @@ grub_normal_reader_init (int nested)
@ -20,4 +20,4 @@ index 3463f444f74..b5fa6156549 100644
+
msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere "
"else TAB lists possible device or file completions. To enable "
"else TAB lists possible device or file completions. %s"),

View file

@ -17,7 +17,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h
new file mode 100644
index 00000000000..1592f6f76b5
index 0000000000..1592f6f76b
--- /dev/null
+++ b/include/grub/arm/efi/console.h
@@ -0,0 +1,24 @@
@ -47,7 +47,7 @@ index 00000000000..1592f6f76b5
+#endif /* ! GRUB_ARM_EFI_CONSOLE_H */
diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h
new file mode 100644
index 00000000000..95689339384
index 0000000000..9568933938
--- /dev/null
+++ b/include/grub/arm64/efi/console.h
@@ -0,0 +1,24 @@
@ -77,7 +77,7 @@ index 00000000000..95689339384
+#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */
diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h
new file mode 100644
index 00000000000..9231375cb07
index 0000000000..9231375cb0
--- /dev/null
+++ b/include/grub/i386/efi/console.h
@@ -0,0 +1,24 @@
@ -107,7 +107,7 @@ index 00000000000..9231375cb07
+#endif /* ! GRUB_I386_EFI_CONSOLE_H */
diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/efi/console.h
new file mode 100644
index 00000000000..dba9d8678d0
index 0000000000..dba9d8678d
--- /dev/null
+++ b/include/grub/x86_64/efi/console.h
@@ -0,0 +1,24 @@

View file

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 27 insertions(+)
diff --git a/configure.ac b/configure.ac
index 3602b4ab62b..fcfbcbb664d 100644
index 0d0e6782a1..302300711f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1540,7 +1540,15 @@ grub_PROG_TARGET_CC
@@ -1442,7 +1442,15 @@ grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_LINKER" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi
@ -30,7 +30,7 @@ index 3602b4ab62b..fcfbcbb664d 100644
if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
diff --git a/acinclude.m4 b/acinclude.m4
index fa7840f09af..0231e64e337 100644
index 6e14bb553c..21238fcfd0 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then

View file

@ -13,10 +13,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 20 insertions(+)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 96ab7c96b52..98700423d79 100644
index a432a6be54..9a2fae6398 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -280,6 +280,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
}
}
@ -42,13 +42,13 @@ index 96ab7c96b52..98700423d79 100644
int
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 3e9a00f0a9c..db517acd592 100644
index fd18e6320b..3adc4036e3 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -386,6 +386,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,
const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5)));
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
+void EXPORT_FUNC(grub_qdprintf) (const char *condition,
+ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3)));
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);

View file

@ -0,0 +1,178 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 25 Jun 2015 15:11:36 -0400
Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses.
This makes a grub_dprintf() call during platform init and during module
loading that tells us the virtual addresses of the .text and .data
sections of grub-core/kernel.exec and any modules it loads.
Specifically, it displays them in the gdb "add-symbol-file" syntax, with
the presumption that there's a variable $grubdir that reflects the path
to any such binaries.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/dl.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
grub-core/kern/efi/efi.c | 4 ++--
grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++-
include/grub/efi/efi.h | 2 +-
4 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 88d2077709..9557254035 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name)
return s;
return NULL;
}
+static long
+grub_dl_find_section_index (Elf_Ehdr *e, const char *name)
+{
+ Elf_Shdr *s;
+ const char *str;
+ unsigned i;
+
+ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize);
+ str = (char *) e + s->sh_offset;
+
+ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
+ i < e->e_shnum;
+ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
+ if (grub_strcmp (str + s->sh_name, name) == 0)
+ return (long)i;
+ return -1;
+}
/* Me, Vladimir Serbinenko, hereby I add this module check as per new
GNU module policy. Note that this license check is informative only.
@@ -653,6 +670,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
return GRUB_ERR_NONE;
}
+static void
+grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e)
+{
+ void *text, *data = NULL;
+ long idx;
+
+ idx = grub_dl_find_section_index (e, ".text");
+ if (idx < 0)
+ return;
+
+ text = grub_dl_get_section_addr (mod, idx);
+ if (!text)
+ return;
+
+ idx = grub_dl_find_section_index (e, ".data");
+ if (idx >= 0)
+ data = grub_dl_get_section_addr (mod, idx);
+
+ if (data)
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
+ "\\\n %p -s .data %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
+ mod->name, text, data);
+ else
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
+ "\\\n%p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
+ mod->name, text);
+}
/* Load a module from core memory. */
grub_dl_t
@@ -712,6 +760,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
grub_dprintf ("modules", "module name: %s\n", mod->name);
grub_dprintf ("modules", "init function: %p\n", mod->init);
+ grub_dl_print_gdb_info (mod, e);
+
if (grub_dl_add (mod))
{
grub_dl_unload (mod);
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index ae9885edb8..d6a2fb5778 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
/* Search the mods section from the PE32/PE32+ image. This code uses
a PE32 header, but should work with PE32+ as well. */
grub_addr_t
-grub_efi_modules_addr (void)
+grub_efi_section_addr (const char *section_name)
{
grub_efi_loaded_image_t *image;
struct grub_pe32_header *header;
@@ -321,7 +321,7 @@ grub_efi_modules_addr (void)
i < coff_header->num_sections;
i++, section++)
{
- if (grub_strcmp (section->name, "mods") == 0)
+ if (grub_strcmp (section->name, section_name) == 0)
break;
}
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index 6d39bd3ad2..2d12e6188f 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -115,10 +115,33 @@ grub_efi_env_init (void)
grub_free (envblk_s.buf);
}
+static void
+grub_efi_print_gdb_info (void)
+{
+ grub_addr_t text;
+ grub_addr_t data;
+
+ text = grub_efi_section_addr (".text");
+ if (!text)
+ return;
+
+ data = grub_efi_section_addr (".data");
+ if (data)
+ grub_qdprintf ("gdb",
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
+ "kernel.exec %p -s .data %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data);
+ else
+ grub_qdprintf ("gdb",
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
+ "kernel.exec %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text);
+}
+
void
grub_efi_init (void)
{
- grub_modbase = grub_efi_modules_addr ();
+ grub_modbase = grub_efi_section_addr ("mods");
/* First of all, initialize the console so that GRUB can display
messages. */
grub_console_init ();
@@ -142,6 +165,7 @@ grub_efi_init (void)
0, 0, 0, NULL);
grub_efi_env_init ();
+ grub_efi_print_gdb_info ();
grub_efidisk_init ();
}
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 03f9a9d011..2e0691454b 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args);
#endif
-grub_addr_t grub_efi_modules_addr (void);
+grub_addr_t grub_efi_section_addr (const char *section);
void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);

View file

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2018 13:40:19 -0400
Subject: [PATCH] Fixup for newer compiler
---
grub-core/fs/btrfs.c | 2 +-
include/grub/gpt_partition.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 2b21cbaa67..4cc86e9b79 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -218,7 +218,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 7a93f43291..8212697bf6 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,

View file

@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 2 insertions(+)
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index 300a9766cda..55849777eaa 100644
index 300a9766cd..55849777ea 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void);

View file

@ -8,15 +8,15 @@ Subject: [PATCH] Fixup for newer compiler
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index ece9ed8a1bf..6262f21a772 100644
index 191b1a70c6..5f0ef96985 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
@@ -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
if !COND_emu
if COND_HAVE_ASM_USCORE
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d

View file

@ -23,22 +23,22 @@ Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
[msalter: Fix max string calculation in grub_net_hwaddr_to_str]
Signed-off-by: Mark Salter <msalter@redhat.com>
---
grub-core/net/arp.c | 156 ++++++++++++++++++++++-----------
grub-core/net/arp.c | 155 ++++++++++++++++++++++-----------
grub-core/net/bootp.c | 15 ++--
grub-core/net/drivers/efi/efinet.c | 8 +-
grub-core/net/drivers/emu/emunet.c | 1 +
grub-core/net/drivers/i386/pc/pxe.c | 13 +--
grub-core/net/drivers/ieee1275/ofnet.c | 2 +
grub-core/net/drivers/uboot/ubootnet.c | 1 +
grub-core/net/ethernet.c | 89 +++++++++----------
grub-core/net/ethernet.c | 88 +++++++++----------
grub-core/net/icmp6.c | 15 ++--
grub-core/net/ip.c | 4 +-
grub-core/net/net.c | 50 ++++++-----
include/grub/net.h | 19 ++--
12 files changed, 220 insertions(+), 153 deletions(-)
12 files changed, 219 insertions(+), 152 deletions(-)
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 1d367436cfc..8bf0a06e193 100644
index 54306e3b16..67b409a8ac 100644
--- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c
@@ -31,22 +31,12 @@ enum
@ -137,7 +137,7 @@ index 1d367436cfc..8bf0a06e193 100644
nbd = nb.data;
send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP);
@@ -114,30 +124,56 @@ grub_err_t
@@ -114,28 +124,53 @@ grub_err_t
grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_uint16_t *vlantag)
{
@ -177,36 +177,33 @@ index 1d367436cfc..8bf0a06e193 100644
+
+ /* The source protocol address. */
sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
- sender_addr.ipv4 = arp_packet->sender_ip;
- target_addr.ipv4 = arp_packet->recv_ip;
sender_addr.option = 0;
target_addr.option = 0;
- if (arp_packet->sender_ip == pending_req)
- have_pending = 1;
- sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
- grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac,
- sizeof (sender_mac_addr.mac));
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln);
+ tmp_ptr += pln;
+
grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
+
+ /* The target hardware address. */
+ tmp_ptr += hln;
+
+ /* The target protocol address. */
+ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
- sender_addr.ipv4 = arp_packet->sender_ip;
- target_addr.ipv4 = arp_packet->recv_ip;
- if (arp_packet->sender_ip == pending_req)
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+
+ if (sender_addr.ipv4 == pending_req)
+ have_pending = 1;
+
have_pending = 1;
- sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
- grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac,
- sizeof (sender_mac_addr.mac));
- grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
-
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
{
/* Verify vlantag id */
@@ -150,11 +186,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
@@ -148,11 +183,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
/* Am I the protocol address target? */
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
@ -220,7 +217,7 @@ index 1d367436cfc..8bf0a06e193 100644
grub_uint8_t arp_data[128];
grub_err_t err;
@@ -163,25 +199,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
@@ -161,25 +196,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_netbuff_clear (&nb_reply);
grub_netbuff_reserve (&nb_reply, 128);
@ -274,10 +271,10 @@ index 1d367436cfc..8bf0a06e193 100644
/* Change operation to REPLY and send packet */
send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP);
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index e0aec25233d..76e4c11a46f 100644
index e28fb6a09f..08b6b2b5d6 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -325,7 +325,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
int is_def, char **device, char **path)
{
grub_net_network_level_address_t addr;
@ -285,7 +282,7 @@ index e0aec25233d..76e4c11a46f 100644
struct grub_net_network_level_interface *inter;
int mask = -1;
char server_ip[sizeof ("xxx.xxx.xxx.xxx")];
@@ -343,12 +342,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -250,12 +249,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (path)
*path = 0;
@ -300,7 +297,7 @@ index e0aec25233d..76e4c11a46f 100644
if (!inter)
return 0;
@@ -660,7 +655,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
@@ -567,7 +562,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
grub_memset (pack, 0, sizeof (*pack));
pack->opcode = 1;
pack->hw_type = 1;
@ -311,20 +308,20 @@ index e0aec25233d..76e4c11a46f 100644
err = grub_get_datetime (&date);
if (err || !grub_datetime2unixtime (&date, &t))
{
@@ -673,7 +670,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
@@ -580,7 +577,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
else
pack->ident = iface->xid;
- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6);
+ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len);
err = grub_netbuff_push (nb, sizeof (*udph));
if (err)
grub_netbuff_push (nb, sizeof (*udph));
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 3e2432fb61c..7deb0a32efd 100644
index 173fb63153..a673bea807 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -288,6 +288,9 @@ grub_efinet_findcards (void)
@@ -279,6 +279,9 @@ grub_efinet_findcards (void)
/* This should not happen... Why? */
continue;
@ -332,12 +329,12 @@ index 3e2432fb61c..7deb0a32efd 100644
+ continue;
+
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
&& net->start (net) != GRUB_EFI_SUCCESS)
&& efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
continue;
@@ -332,10 +335,11 @@ grub_efinet_findcards (void)
* such as LoadFile2 for initrd loading.
*/
card->flags = GRUB_NET_CARD_NO_CLOSE_ON_FINI_HW;
@@ -315,10 +318,11 @@ grub_efinet_findcards (void)
card->name = grub_xasprintf ("efinet%d", i++);
card->driver = &efidriver;
card->flags = 0;
- card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ card->default_address.type = net->mode->if_type;
+ card->default_address.len = net->mode->hwaddr_size;
@ -349,7 +346,7 @@ index 3e2432fb61c..7deb0a32efd 100644
card->efi_handle = *handle;
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c
index 5f311d40f49..7461d13bbc2 100644
index b194920861..5b6c5e16a6 100644
--- a/grub-core/net/drivers/emu/emunet.c
+++ b/grub-core/net/drivers/emu/emunet.c
@@ -46,6 +46,7 @@ static struct grub_net_card emucard =
@ -361,7 +358,7 @@ index 5f311d40f49..7461d13bbc2 100644
},
.flags = 0
diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c
index db17186ee7d..816d1d0eeda 100644
index 3f4152d036..9f8fb4b6d2 100644
--- a/grub-core/net/drivers/i386/pc/pxe.c
+++ b/grub-core/net/drivers/i386/pc/pxe.c
@@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe)
@ -393,7 +390,7 @@ index db17186ee7d..816d1d0eeda 100644
grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index 78f03df8e21..c56461ff1ae 100644
index 3860b6f78d..bcb3f9ea02 100644
--- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
@@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
@ -404,7 +401,7 @@ index 78f03df8e21..c56461ff1ae 100644
args = bootpath + grub_strlen (devpath) + 1;
do
@@ -491,6 +492,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
@@ -503,6 +504,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
grub_memcpy (&lla.mac, pprop, 6);
lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
@ -413,7 +410,7 @@ index 78f03df8e21..c56461ff1ae 100644
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c
index b9d5a0cd494..9f3354a1b74 100644
index 056052e40d..22ebcbf211 100644
--- a/grub-core/net/drivers/uboot/ubootnet.c
+++ b/grub-core/net/drivers/uboot/ubootnet.c
@@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet)
@ -425,7 +422,7 @@ index b9d5a0cd494..9f3354a1b74 100644
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
card->txbuf = grub_zalloc (card->txbufsize);
diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
index 707bbb12cb2..1441a1bacff 100644
index 4d7ceed6f9..9aae83a5eb 100644
--- a/grub-core/net/ethernet.c
+++ b/grub-core/net/ethernet.c
@@ -29,13 +29,6 @@
@ -450,7 +447,7 @@ index 707bbb12cb2..1441a1bacff 100644
+ grub_uint8_t *eth;
grub_err_t err;
- grub_uint8_t etherhdr_size;
- grub_uint16_t vlantag_id = grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER);
- grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER;
+ grub_uint32_t vlantag = 0;
+ grub_uint8_t hw_addr_len = inf->card->default_address.len;
+ grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2;
@ -490,7 +487,7 @@ index 707bbb12cb2..1441a1bacff 100644
if (!inf->card->opened)
{
err = GRUB_ERR_NONE;
@@ -85,19 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
@@ -85,18 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
inf->card->opened = 1;
}
@ -502,15 +499,14 @@ index 707bbb12cb2..1441a1bacff 100644
- (char *) nb->data + etherhdr_size - 6, 2);
-
- /* Add the tag in the middle */
- grub_uint16_t vlan = grub_cpu_to_be16 (inf->vlantag);
- grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2);
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, &vlan, 2);
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2);
- }
-
return inf->card->driver->send (inf->card, nb);
}
@@ -105,31 +98,40 @@ grub_err_t
@@ -104,31 +98,40 @@ grub_err_t
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
struct grub_net_card *card)
{
@ -532,7 +528,7 @@ index 707bbb12cb2..1441a1bacff 100644
- /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */
- /* longer than the original one. The vlantag id is extracted and the header */
- /* is reseted to the original size. */
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER))
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER)
+ hwaddress.type = card->default_address.type;
+ hwaddress.len = hw_addr_len;
+ grub_memcpy (hwaddress.mac, eth, hw_addr_len);
@ -546,7 +542,7 @@ index 707bbb12cb2..1441a1bacff 100644
+ type = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
+ if (type == VLANTAG_IDENTIFIER)
{
- vlantag = grub_be_to_cpu16 (grub_get_unaligned16 (nb->data + etherhdr_size));
- vlantag = grub_get_unaligned16 (nb->data + etherhdr_size);
+ /* Skip vlan tag */
+ eth += 2;
+ vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
@ -563,7 +559,7 @@ index 707bbb12cb2..1441a1bacff 100644
err = grub_netbuff_pull (nb, etherhdr_size);
if (err)
return err;
@@ -149,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
@@ -148,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
}
}
@ -576,7 +572,7 @@ index 707bbb12cb2..1441a1bacff 100644
{
/* ARP packet. */
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
index 9a8c4511285..5924fd53aca 100644
index 2cbd95dce2..56a3ec5c8e 100644
--- a/grub-core/net/icmp6.c
+++ b/grub-core/net/icmp6.c
@@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
@ -616,10 +612,10 @@ index 9a8c4511285..5924fd53aca 100644
}
if (ohdr->type == OPTION_PREFIX && ohdr->len == 4)
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index f967618e53f..3c475762cc0 100644
index ea5edf8f1f..a5896f6dc2 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -316,8 +316,8 @@ handle_dgram (struct grub_net_buff *nb,
@@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb,
if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
@ -631,7 +627,7 @@ index f967618e53f..3c475762cc0 100644
grub_net_process_dhcp (nb, inf);
grub_netbuff_free (nb);
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 20c55257647..fa6b6537142 100644
index 22f2689aae..a46f82362e 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
@ -654,7 +650,7 @@ index 20c55257647..fa6b6537142 100644
hw_addr->mac[0] = 0x33;
hw_addr->mac[1] = 0x33;
hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff);
@@ -772,23 +774,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
@@ -762,23 +764,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
void
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
{
@ -692,8 +688,8 @@ index 20c55257647..fa6b6537142 100644
- grub_printf (_("Unsupported hw address type %d\n"), addr->type);
}
void
@@ -813,13 +815,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
int
@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
return -1;
if (a->type > b->type)
return +1;
@ -717,7 +713,7 @@ index 20c55257647..fa6b6537142 100644
int
diff --git a/include/grub/net.h b/include/grub/net.h
index ff901b96e22..1d76fd9a1f5 100644
index 8a05ec4fe7..af0404db7e 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -29,7 +29,8 @@
@ -732,7 +728,7 @@ index ff901b96e22..1d76fd9a1f5 100644
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
@@ -42,15 +43,17 @@ enum
typedef enum grub_link_level_protocol_id
typedef enum grub_link_level_protocol_id
{
- GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
+ /* IANA ARP constant to define hardware type. */
@ -750,7 +746,7 @@ index ff901b96e22..1d76fd9a1f5 100644
};
} grub_net_link_level_address_t;
@@ -588,11 +591,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
@@ -566,11 +569,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")
/*
@ -766,5 +762,5 @@ index ff901b96e22..1d76fd9a1f5 100644
+ "XX:XX:XX:XX:XX:XX:XX:XX:"\
+ "XX:XX:XX:XX:XX:XX:XX:XX"))
/* Max VLAN id = 4094 */
#define GRUB_NET_MAX_STR_VLAN_LEN (sizeof ("vlanXXXX"))
void
grub_net_addr_to_str (const grub_net_network_level_address_t *target,

View file

@ -0,0 +1,270 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aaron Miller <aaronmiller@fb.com>
Date: Fri, 29 Jul 2016 17:41:38 +0800
Subject: [PATCH] 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
Signed-off-by: Aaron Miller <aaronmiller@fb.com>
[pjones: various bug fixes]
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/http.c | 25 ++++++++++++---
grub-core/net/net.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++---
grub-core/net/tftp.c | 8 +++--
include/grub/net.h | 1 +
4 files changed, 109 insertions(+), 12 deletions(-)
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index b616cf40b1..12a2632ea5 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
nb2 = grub_netbuff_alloc (data->chunk_rem);
if (!nb2)
return grub_errno;
- grub_netbuff_put (nb2, data->chunk_rem);
+ err = grub_netbuff_put (nb2, data->chunk_rem);
+ if (err)
+ return grub_errno;
grub_memcpy (nb2->data, nb->data, data->chunk_rem);
if (file->device->net->packs.count >= 20)
{
@@ -312,12 +314,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 +360,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 +369,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 +403,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, NULL,
file);
if (!data->sock)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index a46f82362e..0ce5e675ed 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -444,6 +444,13 @@ 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;
@@ -482,6 +489,8 @@ 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;
@@ -1343,8 +1352,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)
{
@@ -1382,6 +1393,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)
@@ -1391,14 +1468,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;
}
@@ -1473,6 +1549,7 @@ grub_net_open_real (const char *name)
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"),
name);
+ grub_free (host);
return NULL;
}
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 4ab2f5c735..d54b13f09f 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -295,6 +295,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)
@@ -362,14 +363,17 @@ tftp_open (struct grub_file *file, const char *filename)
err = grub_net_resolve_address (file->device->net->server, &addr);
if (err)
{
- grub_dprintf("tftp", "Address resolution failed: %d\n", 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);
grub_free (data);
return err;
}
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 af0404db7e..d55d505a03 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -273,6 +273,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;

View file

@ -12,14 +12,14 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------
grub-core/net/drivers/efi/efinet.c | 18 +-
grub-core/net/drivers/efi/efinet.c | 20 +-
grub-core/net/ip.c | 39 ++
include/grub/efi/api.h | 2 +-
include/grub/net.h | 91 ++--
5 files changed, 1001 insertions(+), 208 deletions(-)
5 files changed, 1002 insertions(+), 209 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 02d2c2614cb..e0aec25233d 100644
index 08b6b2b5d6..fe93b80f1c 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -24,6 +24,98 @@
@ -121,7 +121,7 @@ index 02d2c2614cb..e0aec25233d 100644
struct grub_dhcp_discover_options
{
@@ -610,6 +702,584 @@ out:
@@ -604,6 +696,584 @@ out:
return err;
}
@ -427,7 +427,7 @@ index 02d2c2614cb..e0aec25233d 100644
+ grub_dhcp6_session_t se;
+ struct grub_datetime date;
+ grub_err_t err;
+ grub_int64_t t = 0;
+ grub_int32_t t = 0;
+
+ se = grub_malloc (sizeof (*se));
+
@ -706,7 +706,7 @@ index 02d2c2614cb..e0aec25233d 100644
/*
* This is called directly from net/ip.c:handle_dgram(), because those
* BOOTP/DHCP packets are a bit special due to their improper
@@ -678,6 +1348,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
@@ -672,6 +1342,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
}
}
@ -784,7 +784,7 @@ index 02d2c2614cb..e0aec25233d 100644
static grub_err_t
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
@@ -903,180 +1644,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
@@ -897,180 +1638,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
return err;
}
@ -1119,7 +1119,7 @@ index 02d2c2614cb..e0aec25233d 100644
void
grub_bootp_init (void)
@@ -1090,11 +1825,15 @@ grub_bootp_init (void)
@@ -1084,11 +1819,15 @@ 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."));
@ -1136,10 +1136,10 @@ index 02d2c2614cb..e0aec25233d 100644
grub_unregister_command (cmd_bootp);
grub_unregister_command (cmd_dhcp);
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 2af8742f904..3e2432fb61c 100644
index a673bea807..8e25680db0 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -410,9 +410,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
pxe_mode = pxe->mode;
if (pxe_mode->using_ipv6)
{
@ -1149,7 +1149,7 @@ index 2af8742f904..3e2432fb61c 100644
grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
pxe_mode->dhcp_ack_received ? "yes" : "no",
@@ -420,14 +417,13 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -403,15 +400,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (!pxe_mode->dhcp_ack_received)
continue;
@ -1158,24 +1158,26 @@ index 2af8742f904..3e2432fb61c 100644
- card->efi_net->mode->current_address,
- sizeof (hwaddr.mac));
-
- inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
- 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);
+ inter = 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 (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 (inter && device && path)
+ 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 3c3d0be0e57..f967618e53f 100644
index a5896f6dc2..ce6bdc75c6 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -240,6 +240,45 @@ handle_dgram (struct grub_net_buff *nb,
@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb,
{
struct udphdr *udph;
udph = (struct udphdr *) nb->data;
@ -1222,10 +1224,10 @@ index 3c3d0be0e57..f967618e53f 100644
{
const struct grub_net_bootp_packet *bootp;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index c6d702831f7..c1b869db520 100644
index 9962880147..7614b58dca 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1570,7 +1570,7 @@ typedef struct grub_efi_pxe_ip_filter
@@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter
{
grub_efi_uint8_t filters;
grub_efi_uint8_t ip_count;
@ -1235,10 +1237,10 @@ index c6d702831f7..c1b869db520 100644
} grub_efi_pxe_ip_filter_t;
diff --git a/include/grub/net.h b/include/grub/net.h
index bf8430a6364..ff901b96e22 100644
index d55d505a03..543251f727 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -450,50 +450,65 @@ struct grub_net_bootp_packet
@@ -451,50 +451,65 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -1334,7 +1336,7 @@ index bf8430a6364..ff901b96e22 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
@@ -531,12 +546,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -532,12 +547,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
int is_def, char **device, char **path);
struct grub_net_network_level_interface *
@ -1353,7 +1355,7 @@ index bf8430a6364..ff901b96e22 100644
int
grub_ipv6_get_masksize(grub_uint16_t *mask);
@@ -553,6 +568,10 @@ void
@@ -554,6 +569,10 @@ void
grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_network_level_interface *iface);

View file

@ -15,12 +15,12 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 7deb0a32efd..92bb7444782 100644
index 8e25680db0..014e5bf980 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -430,6 +430,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_print_error ();
if (inter && device && path)
if (device && path)
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ if (grub_errno)
+ grub_print_error ();
@ -28,10 +28,10 @@ index 7deb0a32efd..92bb7444782 100644
else
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index daa9268fdaa..53f5c781ac3 100644
index 7614b58dca..91ab528e4d 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1571,31 +1571,6 @@ typedef union
@@ -1524,31 +1524,6 @@ typedef union
grub_efi_pxe_dhcpv6_packet_t dhcpv6;
} grub_efi_pxe_packet_t;
@ -63,7 +63,7 @@ index daa9268fdaa..53f5c781ac3 100644
typedef struct grub_efi_pxe_icmp_error
{
grub_efi_uint8_t type;
@@ -1621,6 +1596,48 @@ typedef struct grub_efi_pxe_tftp_error
@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error
grub_efi_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t;
@ -112,7 +112,7 @@ index daa9268fdaa..53f5c781ac3 100644
typedef struct grub_efi_pxe_mode
{
grub_efi_boolean_t started;
@@ -1652,9 +1669,9 @@ typedef struct grub_efi_pxe_mode
@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode
grub_efi_pxe_packet_t pxe_bis_reply;
grub_efi_pxe_ip_filter_t ip_filter;
grub_efi_uint32_t arp_cache_entries;

View file

@ -12,10 +12,10 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
1 file changed, 17 insertions(+)
diff --git a/docs/grub.texi b/docs/grub.texi
index c30701b4e1f..44c4e665a0d 100644
index 0615d0ed97..04ed6ac1f0 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -5955,6 +5955,7 @@ Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
@@ -5487,6 +5487,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/DHCP autoconfiguration
@ -23,7 +23,7 @@ index c30701b4e1f..44c4e665a0d 100644
* net_del_addr:: Remove IP address from interface
* net_del_dns:: Remove a DNS server
* net_del_route:: Remove a route entry
@@ -6080,6 +6081,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
@@ -5611,6 +5612,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
@end deffn

View file

@ -22,7 +22,7 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 56 insertions(+)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 76e4c11a46f..f56b293ac72 100644
index fe93b80f1c..8fb8918ae7 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -20,6 +20,7 @@
@ -33,7 +33,7 @@ index 76e4c11a46f..f56b293ac72 100644
#include <grub/net/ip.h>
#include <grub/net/netbuff.h>
#include <grub/net/udp.h>
@@ -501,6 +502,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -500,6 +501,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (opt && opt_len)
grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len);
@ -95,10 +95,10 @@ index 76e4c11a46f..f56b293ac72 100644
if (opt && opt_len)
grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len);
diff --git a/include/grub/net.h b/include/grub/net.h
index 1d76fd9a1f5..868c9a2ef29 100644
index 543251f727..42af7de250 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -533,6 +533,7 @@ enum
@@ -531,6 +531,7 @@ enum
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,

View file

@ -27,12 +27,12 @@ the same way it used to be.
Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/drivers/efi/efinet.c | 286 ++++++++++++++++++++++++++++++++++---
grub-core/net/drivers/efi/efinet.c | 284 +++++++++++++++++++++++++++++++++++--
include/grub/efi/api.h | 11 ++
2 files changed, 281 insertions(+), 16 deletions(-)
2 files changed, 280 insertions(+), 15 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 92bb7444782..eb68de22023 100644
index 014e5bf980..8171ecaa5e 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -26,6 +26,7 @@
@ -43,7 +43,7 @@ index 92bb7444782..eb68de22023 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -348,6 +349,227 @@ grub_efinet_findcards (void)
@@ -331,6 +332,227 @@ grub_efinet_findcards (void)
grub_free (handles);
}
@ -271,7 +271,7 @@ index 92bb7444782..eb68de22023 100644
static void
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path)
@@ -367,7 +589,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -346,7 +568,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
{
grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe;
@ -284,7 +284,7 @@ index 92bb7444782..eb68de22023 100644
if (card->driver != &efidriver)
continue;
@@ -391,11 +617,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -370,11 +596,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
@ -307,7 +307,7 @@ index 92bb7444782..eb68de22023 100644
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;
@@ -408,23 +644,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -387,23 +623,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);
@ -347,45 +347,38 @@ index 92bb7444782..eb68de22023 100644
+ pxe_mode->dhcp_ack_received ? "yes" : "no",
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
inter = 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);
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 ();
@@ -438,8 +688,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -417,11 +667,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_dprintf ("efinet", "using ipv4 and dhcp\n");
inter = 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_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);
@@ -465,8 +715,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
}
- return;
}
+
+ if (nb)
+ grub_netbuff_free (nb);
+
+ return;
return;
}
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 53f5c781ac3..fa528e73a27 100644
index 91ab528e4d..4a51667adb 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -891,6 +891,8 @@ struct grub_efi_ipv4_device_path
@@ -864,6 +864,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;
@ -394,9 +387,9 @@ index 53f5c781ac3..fa528e73a27 100644
} GRUB_PACKED;
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
@@ -954,6 +956,15 @@ struct grub_efi_vlan_device_path
@@ -918,6 +920,15 @@ struct grub_efi_sata_device_path
} GRUB_PACKED;
typedef struct grub_efi_vlan_device_path grub_efi_vlan_device_path_t;
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
+#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24
+

View file

@ -29,34 +29,34 @@ Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++
include/grub/efi/api.h | 76 +++++++++++++++++
2 files changed, 239 insertions(+)
include/grub/efi/api.h | 75 +++++++++++++++++
2 files changed, 238 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index eb68de22023..a91df09ee6d 100644
index 8171ecaa5e..715a6168d7 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
/* GUID. */
static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_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,
@@ -349,6 +351,125 @@ grub_efinet_findcards (void)
@@ -332,6 +334,125 @@ grub_efinet_findcards (void)
grub_free (handles);
}
+static grub_efi_handle_t
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
+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 = grub_efi_system_table->boot_services->locate_device_path(
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
+ protocol, &device_path, &handle);
+
+ if (status != GRUB_EFI_SUCCESS)
@ -92,9 +92,9 @@ index eb68de22023..a91df09ee6d 100644
+ if (!addrs)
+ return 0;
+
+ status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ 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)
+ {
@ -103,9 +103,9 @@ index eb68de22023..a91df09ee6d 100644
+ if (!addrs)
+ return 0;
+
+ status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -142,9 +142,9 @@ index eb68de22023..a91df09ee6d 100644
+ if (!addrs)
+ return 0;
+
+ status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ 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)
+ {
@ -153,9 +153,9 @@ index eb68de22023..a91df09ee6d 100644
+ if (!addrs)
+ return 0;
+
+ status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -171,7 +171,7 @@ index eb68de22023..a91df09ee6d 100644
static struct grub_net_buff *
grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6)
{
@@ -407,6 +528,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -390,6 +511,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;
@ -180,7 +180,7 @@ index eb68de22023..a91df09ee6d 100644
bp = (struct grub_net_bootp_packet *) nb->tail;
err = grub_netbuff_put (nb, sizeof (*bp) + 4);
@@ -468,6 +591,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -451,6 +574,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);
@ -206,7 +206,7 @@ index eb68de22023..a91df09ee6d 100644
ptr = nb->tail;
err = grub_netbuff_put (nb, 1);
if (err)
@@ -500,6 +642,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -483,6 +625,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;
@ -215,7 +215,7 @@ index eb68de22023..a91df09ee6d 100644
d6p = (struct grub_net_dhcp6_packet *)nb->tail;
err = grub_netbuff_put (nb, sizeof(*d6p));
@@ -563,6 +707,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -546,6 +690,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);
@ -242,13 +242,14 @@ index eb68de22023..a91df09ee6d 100644
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index fa528e73a27..248d6a28ff9 100644
index 4a51667adb..0b490195ad 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -369,6 +369,16 @@
@@ -352,6 +352,15 @@
#define GRUB_EFI_RNG_PROTOCOL_GUID \
{ 0x3152bca5, 0xeade, 0x433d, \
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
}
+
+#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \
+ { 0x5b446ed1, 0xe30b, 0x4faa, \
+ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
@ -257,14 +258,12 @@ index fa528e73a27..248d6a28ff9 100644
+#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \
+ { 0x937fe521, 0x95ae, 0x4d1a, \
+ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
+ }
+
#define LINUX_EFI_INITRD_MEDIA_GUID \
{ 0x5568e427, 0x68fc, 0x4f3d, \
{ 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68 } \
@@ -1963,6 +1973,72 @@ struct grub_efi_load_file2
}
struct grub_efi_sal_system_table
@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol
};
typedef struct grub_efi_load_file2 grub_efi_load_file2_t;
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
+enum grub_efi_ip4_config2_data_type {
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
@ -332,6 +331,6 @@ index fa528e73a27..248d6a28ff9 100644
+};
+typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
+
struct initrd_media_device_path {
grub_efi_vendor_media_device_path_t vendor;
grub_efi_device_path_t end;
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)

View file

@ -33,18 +33,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
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 | 410 +++++++++++
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 | 195 ++++-
include/grub/efi/api.h | 180 ++++-
include/grub/efi/dhcp.h | 343 +++++++++
include/grub/efi/http.h | 215 ++++++
include/grub/net/efi.h | 144 ++++
17 files changed, 4618 insertions(+), 49 deletions(-)
17 files changed, 4620 insertions(+), 41 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
@ -57,10 +57,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/net/efi.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 6645fbae34f..56eb6a828e8 100644
index 52ec0fafcd..12797336c9 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2356,6 +2356,12 @@ module = {
@@ -2300,6 +2300,12 @@ module = {
common = hook/datehook.c;
};
@ -73,7 +73,7 @@ index 6645fbae34f..56eb6a828e8 100644
module = {
name = net;
common = net/net.c;
@@ -2369,6 +2375,12 @@ module = {
@@ -2313,6 +2319,12 @@ module = {
common = net/ethernet.c;
common = net/arp.c;
common = net/netbuff.c;
@ -87,7 +87,7 @@ index 6645fbae34f..56eb6a828e8 100644
module = {
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
index a458c3aca78..1637731535e 100644
index a458c3aca7..1637731535 100644
--- a/grub-core/io/bufio.c
+++ b/grub-core/io/bufio.c
@@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len)
@ -100,10 +100,10 @@ index a458c3aca78..1637731535e 100644
if (file->offset + res < next_buf)
{
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 2bb8a0e7a38..bf16c4307bc 100644
index d6a2fb5778..2a446f5031 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -775,7 +775,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -755,7 +755,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;
@ -112,7 +112,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
(unsigned) ipv4->local_ip_address[0],
(unsigned) ipv4->local_ip_address[1],
(unsigned) ipv4->local_ip_address[2],
@@ -788,33 +788,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
(unsigned) ipv4->remote_port,
(unsigned) ipv4->protocol,
(unsigned) ipv4->static_ip_address);
@ -190,7 +190,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
}
break;
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
@@ -861,6 +888,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
break;
@ -231,7 +231,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
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 a91df09ee6d..225dc896da0 100644
index 715a6168d7..e11d759f19 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -27,6 +27,7 @@
@ -242,7 +242,7 @@ index a91df09ee6d..225dc896da0 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -508,6 +509,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -491,6 +492,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);
@ -260,7 +260,7 @@ index a91df09ee6d..225dc896da0 100644
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))
@@ -781,6 +793,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -760,6 +772,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
@ -268,7 +268,7 @@ index a91df09ee6d..225dc896da0 100644
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
continue;
dup_dp = grub_efi_duplicate_device_path (dp);
@@ -795,6 +808,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
dup_ldp->length = sizeof (*dup_ldp);
}
@ -284,7 +284,7 @@ index a91df09ee6d..225dc896da0 100644
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;
@@ -889,6 +911,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
GRUB_MOD_INIT(efinet)
{
@ -294,8 +294,8 @@ index a91df09ee6d..225dc896da0 100644
grub_efinet_findcards ();
grub_efi_net_config = grub_efi_net_config_real;
}
@@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet)
FOR_NET_CARDS_SAFE (card, next)
@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet)
FOR_NET_CARDS_SAFE (card, next)
if (card->driver == &efidriver)
grub_net_card_unregister (card);
+
@ -304,7 +304,7 @@ index a91df09ee6d..225dc896da0 100644
diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c
new file mode 100644
index 00000000000..ca19902441b
index 0000000000..dbef63d8c0
--- /dev/null
+++ b/grub-core/net/efi/dhcp.c
@@ -0,0 +1,397 @@
@ -385,7 +385,7 @@ index 00000000000..ca19902441b
+ grub_efi_uint32_t option_count = 0;
+ grub_efi_uint32_t i;
+
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, NULL);
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL);
+
+ if (status != GRUB_EFI_BUFFER_TOO_SMALL)
+ return NULL;
@ -394,7 +394,7 @@ index 00000000000..ca19902441b
+ if (!option_list)
+ return NULL;
+
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, option_list);
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_free (option_list);
@ -443,13 +443,13 @@ index 00000000000..ca19902441b
+
+ if (!mode->started)
+ {
+ status = pxe->start(pxe, 0);
+ status = efi_call_2 (pxe->start, pxe, 0);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n");
+ }
+
+ status = pxe->dhcp(pxe, 0);
+ status = efi_call_2 (pxe->dhcp, pxe, 0);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp4 configure failed, %d\n", (int)status);
@ -500,7 +500,7 @@ index 00000000000..ca19902441b
+ config.option_list = &options;
+
+ /* FIXME: What if the dhcp has bounded */
+ status = netdev->dhcp4->configure(netdev->dhcp4, &config);
+ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config);
+ grub_free (options);
+ if (status != GRUB_EFI_SUCCESS)
+ {
@ -508,14 +508,14 @@ index 00000000000..ca19902441b
+ continue;
+ }
+
+ status = netdev->dhcp4->start(netdev->dhcp4, NULL);
+ 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 = netdev->dhcp4->get_mode_data(netdev->dhcp4, &mode);
+ 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);
@ -616,21 +616,21 @@ index 00000000000..ca19902441b
+ config.rapid_commit = 0;
+ config.solicit_retransmission = &retrans;
+
+ status = dev->dhcp6->configure(dev->dhcp6, &config);
+ 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 = dev->dhcp6->start(dev->dhcp6);
+ 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 = dev->dhcp6->get_mode_data(dev->dhcp6, &mode, NULL);
+ 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);
@ -666,12 +666,12 @@ index 00000000000..ca19902441b
+ grub_efi_dhcp6_packet_option_t **options = NULL;
+ grub_efi_uint32_t i;
+
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, NULL);
+ 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 = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options);
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -696,8 +696,8 @@ index 00000000000..ca19902441b
+ grub_free (options);
+ }
+
+ b->free_pool(mode.client_id);
+ b->free_pool(mode.ia);
+ efi_call_1 (b->free_pool, mode.client_id);
+ efi_call_1 (b->free_pool, mode.ia);
+ }
+
+ return GRUB_ERR_NONE;
@ -707,7 +707,7 @@ index 00000000000..ca19902441b
+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
index 0000000000..ef371d885e
--- /dev/null
+++ b/grub-core/net/efi/efi_netfs.c
@@ -0,0 +1,57 @@
@ -770,10 +770,10 @@ index 00000000000..ef371d885ea
+}
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
new file mode 100644
index 00000000000..de28badccb0
index 0000000000..3f61fd2fa5
--- /dev/null
+++ b/grub-core/net/efi/http.c
@@ -0,0 +1,410 @@
@@ -0,0 +1,419 @@
+
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
@ -802,9 +802,9 @@ index 00000000000..de28badccb0
+
+ http_config.local_address_is_ipv6 = 1;
+ sz = sizeof (manual_address);
+ status = dev->ip6_config->get_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, &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)
+ {
@ -834,19 +834,19 @@ index 00000000000..de28badccb0
+ http_config.access_point.ipv4_node = &httpv4_node;
+ }
+
+ status = http->configure(http, &http_config);
+ status = efi_call_2 (http->configure, http, &http_config);
+
+ if (status == GRUB_EFI_ALREADY_STARTED)
+ {
+ /* XXX: This hangs HTTPS boot */
+#if 0
+ if (http->configure(http, NULL) != GRUB_EFI_SUCCESS)
+ 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 = http->configure(http, &http_config);
+ status = efi_call_2 (http->configure, http, &http_config);
+#endif
+ return;
+ }
@ -945,9 +945,12 @@ index 00000000000..de28badccb0
+ request_token.message = &request_message;
+
+ request_callback_done = 0;
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_request_callback, NULL,
+ &request_token.event);
+ 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)
+ {
@ -955,17 +958,17 @@ index 00000000000..de28badccb0
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
+ }
+
+ status = http->request(http, &request_token);
+ status = efi_call_2 (http->request, http, &request_token);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ b->close_event(request_token.event);
+ 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)
+ http->poll(http);
+ efi_call_1(http->poll, http);
+
+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS;
+ response_message.data.response = &response_data;
@ -978,13 +981,16 @@ index 00000000000..de28badccb0
+ response_message.body = NULL;
+ response_token.event = NULL;
+
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback, NULL,
+ &response_token.event);
+ 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)
+ {
+ b->close_event(request_token.event);
+ 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);
+ }
@ -994,28 +1000,28 @@ index 00000000000..de28badccb0
+
+ /* wait for HTTP response */
+ response_callback_done = 0;
+ status = http->response(http, &response_token);
+ status = efi_call_2 (http->response, http, &response_token);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ 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)
+ http->poll(http);
+ 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)
+ b->free_pool(response_message.headers);
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ 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)
+ {
@ -1043,9 +1049,9 @@ index 00000000000..de28badccb0
+ }
+
+ if (response_message.headers)
+ b->free_pool(response_message.headers);
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ 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;
@ -1070,9 +1076,12 @@ index 00000000000..de28badccb0
+ return -1;
+ }
+
+ b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback, NULL,
+ &response_token.event);
+ 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)
+ {
@ -1087,23 +1096,23 @@ index 00000000000..de28badccb0
+
+ response_callback_done = 0;
+
+ status = http->response(http, &response_token);
+ status = efi_call_2 (http->response, http, &response_token);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ b->close_event(response_token.event);
+ 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)
+ http->poll(http);
+ efi_call_1(http->poll, http);
+
+ sum += response_message.body_length;
+ buf += response_message.body_length;
+ len -= response_message.body_length;
+ }
+
+ b->close_event(response_token.event);
+ efi_call_1 (b->close_event, response_token.event);
+
+ return sum;
+}
@ -1186,7 +1195,7 @@ index 00000000000..de28badccb0
+ };
diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
new file mode 100644
index 00000000000..1deba25e79e
index 0000000000..b711a5d945
--- /dev/null
+++ b/grub-core/net/efi/ip4_config.c
@@ -0,0 +1,398 @@
@ -1296,17 +1305,17 @@ index 00000000000..1deba25e79e
+ if (!interface_info)
+ return NULL;
+
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ 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 = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ 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)
@ -1330,9 +1339,9 @@ index 00000000000..1deba25e79e
+ if (!manual_address)
+ return NULL;
+
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+ 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)
+ {
@ -1537,7 +1546,7 @@ index 00000000000..1deba25e79e
+ }
+ }
+
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address);
+
@ -1553,9 +1562,9 @@ index 00000000000..1deba25e79e
+{
+ grub_efi_status_t status;
+
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
+ sizeof (address->ip4), &address->ip4);
+ 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;
@ -1569,9 +1578,9 @@ index 00000000000..1deba25e79e
+{
+ grub_efi_status_t status;
+
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip4), &address->ip4);
+ 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;
@ -1590,7 +1599,7 @@ index 00000000000..1deba25e79e
+ };
diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
new file mode 100644
index 00000000000..29a03973265
index 0000000000..017c4d05bc
--- /dev/null
+++ b/grub-core/net/efi/ip6_config.c
@@ -0,0 +1,422 @@
@ -1720,7 +1729,7 @@ index 00000000000..29a03973265
+ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table);
+ interface_info = grub_malloc (sz);
+
+ status = ip6_config->get_data(ip6_config,
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+
@ -1728,7 +1737,7 @@ index 00000000000..29a03973265
+ {
+ grub_free (interface_info);
+ interface_info = grub_malloc (sz);
+ status = ip6_config->get_data(ip6_config,
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ }
@ -1754,7 +1763,7 @@ index 00000000000..29a03973265
+ if (!manual_address)
+ return NULL;
+
+ status = ip6_config->get_data(ip6_config,
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -1965,7 +1974,7 @@ index 00000000000..29a03973265
+ }
+ }
+
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address);
+
@ -1981,7 +1990,7 @@ index 00000000000..29a03973265
+{
+ grub_efi_status_t status;
+
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
+ sizeof (address->ip6), &address->ip6);
+
@ -1997,7 +2006,7 @@ index 00000000000..29a03973265
+
+ grub_efi_status_t status;
+
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip6), &address->ip6);
+
@ -2018,7 +2027,7 @@ index 00000000000..29a03973265
+ };
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
new file mode 100644
index 00000000000..1a19ee27144
index 0000000000..86bce6535d
--- /dev/null
+++ b/grub-core/net/efi/net.c
@@ -0,0 +1,1428 @@
@ -2041,15 +2050,15 @@ index 00000000000..1a19ee27144
+
+#define GRUB_EFI_IP6_PREFIX_LENGTH 64
+
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
+static grub_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
+static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
+static grub_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_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_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;
+
@ -2064,13 +2073,13 @@ index 00000000000..1a19ee27144
+#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__)
+
+static grub_efi_handle_t
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
+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 = grub_efi_system_table->boot_services->locate_device_path(
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
+ protocol, &device_path, &handle);
+
+ if (status != GRUB_EFI_SUCCESS)
@ -2712,7 +2721,7 @@ index 00000000000..1a19ee27144
+}
+
+static grub_efi_handle_t
+grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_guid)
+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;
@ -2725,7 +2734,7 @@ index 00000000000..1a19ee27144
+ return NULL;
+ }
+
+ status = service->create_child(service, &child_dev);
+ 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);
@ -2935,7 +2944,7 @@ index 00000000000..1a19ee27144
+ {
+ grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC;
+
+ if (dev->ip4_config->set_data(dev->ip4_config,
+ 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);
@ -2944,7 +2953,7 @@ index 00000000000..1a19ee27144
+ {
+ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL;
+
+ if (dev->ip6_config->set_data(dev->ip6_config,
+ 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);
@ -3452,7 +3461,7 @@ index 00000000000..1a19ee27144
+}
diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
new file mode 100644
index 00000000000..b84f86ea470
index 0000000000..531949cba5
--- /dev/null
+++ b/grub-core/net/efi/pxe.c
@@ -0,0 +1,424 @@
@ -3475,7 +3484,7 @@ index 00000000000..b84f86ea470
+ if (!manual_address)
+ return NULL;
+
+ status = ip6_config->get_data(ip6_config,
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -3500,7 +3509,7 @@ index 00000000000..b84f86ea470
+ if (!manual_address)
+ return NULL;
+
+ status = ip4_config->get_data(ip4_config,
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -3523,7 +3532,7 @@ index 00000000000..b84f86ea470
+ if (!mode->started)
+ {
+ grub_efi_status_t status;
+ status = pxe->start(pxe, prefer_ip6);
+ status = efi_call_2 (pxe->start, pxe, prefer_ip6);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n");
@ -3546,7 +3555,7 @@ index 00000000000..b84f86ea470
+ grub_efi_pxe_ip_address_t station_ip;
+
+ grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr));
+ status = pxe->set_station_ip(pxe, &station_ip, NULL);
+ 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");
@ -3569,7 +3578,7 @@ index 00000000000..b84f86ea470
+ grub_memcpy (station_ip.v4.addr, manual_address->address, sizeof (station_ip.v4.addr));
+ grub_memcpy (subnet_mask.v4.addr, manual_address->subnet_mask, sizeof (subnet_mask.v4.addr));
+
+ status = pxe->set_station_ip(pxe, &station_ip, &subnet_mask);
+ 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");
@ -3722,7 +3731,7 @@ index 00000000000..b84f86ea470
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ }
+
+ status = pxe->mtftp(
+ status = efi_call_10 (pxe->mtftp,
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
+ NULL,
@ -3807,7 +3816,7 @@ index 00000000000..b84f86ea470
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ }
+
+ status = pxe->mtftp(
+ status = efi_call_10 (pxe->mtftp,
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf,
@ -3838,7 +3847,7 @@ index 00000000000..b84f86ea470
+ return 0;
+ }
+
+ status = pxe->mtftp(
+ status = efi_call_10 (pxe->mtftp,
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf2,
@ -3881,7 +3890,7 @@ index 00000000000..b84f86ea470
+ };
+
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index fa6b6537142..fdec64d55ee 100644
index 0ce5e675ed..55aed92722 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -32,6 +32,9 @@
@ -3894,8 +3903,8 @@ index fa6b6537142..fdec64d55ee 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards;
@@ -2033,8 +2036,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
@ -3944,7 +3953,7 @@ index fa6b6537142..fdec64d55ee 100644
grub_register_variable_hook ("net_default_server", defserver_get_env,
defserver_set_env);
grub_env_export ("net_default_server");
@@ -2144,10 +2188,37 @@ GRUB_MOD_INIT(net)
@@ -2082,10 +2126,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;
@ -3982,16 +3991,16 @@ index fa6b6537142..fdec64d55ee 100644
grub_register_variable_hook ("net_default_server", 0, 0);
grub_register_variable_hook ("pxe_default_server", 0, 0);
@@ -2166,4 +2237,7 @@ GRUB_MOD_FINI(net)
@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net)
grub_net_fini_hw (0);
grub_loader_unregister_preboot_hook (fini_hnd);
grub_net_poll_cards_idle = NULL;
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 46f304c2b47..11c9db11775 100644
index a2461cda1c..77958dd9dd 100644
--- a/util/grub-mknetdir.c
+++ b/util/grub-mknetdir.c
@@ -32,13 +32,15 @@
@ -4046,7 +4055,7 @@ index 46f304c2b47..11c9db11775 100644
{
const char *mkimage_target;
const char *netmodule;
@@ -157,6 +162,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
@@ -156,6 +161,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);
@ -4054,7 +4063,7 @@ index 46f304c2b47..11c9db11775 100644
grub_install_make_image_wrap (input_dir, prefix, output,
0, load_cfg,
targets[platform].mkimage_target, 0);
@@ -196,7 +202,16 @@ main (int argc, char *argv[])
@@ -195,7 +201,16 @@ main (int argc, char *argv[])
grub_install_mkdir_p (base);
@ -4073,10 +4082,10 @@ index 46f304c2b47..11c9db11775 100644
if (!grub_install_source_directory)
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 248d6a28ff9..805a9d7adf9 100644
index 0b490195ad..f431f49973 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -668,6 +668,23 @@ typedef union
@@ -622,6 +622,23 @@ typedef union
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@ -4098,9 +4107,9 @@ index 248d6a28ff9..805a9d7adf9 100644
+ grub_efi_pxe_ipv6_address_t v6;
+} grub_efi_pxe_ip_address_t;
/* XXX although the spec does not specify the padding, this actually
must have the padding! */
@@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path
struct grub_efi_guid
{
@@ -889,6 +906,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;
@ -4109,7 +4118,7 @@ index 248d6a28ff9..805a9d7adf9 100644
} GRUB_PACKED;
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
@@ -975,6 +994,15 @@ struct grub_efi_uri_device_path
@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path
} GRUB_PACKED;
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t;
@ -4125,7 +4134,7 @@ index 248d6a28ff9..805a9d7adf9 100644
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
/* Media Device Path. */
@@ -1057,6 +1085,23 @@ struct grub_efi_bios_device_path
@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path
} GRUB_PACKED;
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
@ -4149,7 +4158,7 @@ index 248d6a28ff9..805a9d7adf9 100644
struct grub_efi_open_protocol_information_entry
{
grub_efi_handle_t agent_handle;
@@ -1617,23 +1662,27 @@ typedef struct grub_efi_pxe_tftp_error
@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error
grub_efi_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t;
@ -4191,27 +4200,18 @@ index 248d6a28ff9..805a9d7adf9 100644
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
typedef struct grub_efi_pxe_ip_filter
@@ -1700,18 +1749,31 @@ typedef struct grub_efi_pxe_mode
@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode
typedef struct grub_efi_pxe
{
grub_uint64_t rev;
- void *start;
- void *stop;
- void *dhcp;
- void *discover;
- void *mftp;
- void *udpwrite;
- void *udpread;
- void *setipfilter;
- void *arp;
- void *setparams;
- void *setstationip;
- void *setpackets;
- void (*start) (void);
+ grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6);
+ void (*stop) (void);
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 (*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,
@ -4223,19 +4223,20 @@ index 248d6a28ff9..805a9d7adf9 100644
+ 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 (*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 (*setpackets) (void);
+ //void (*setstationip) (void);
void (*setpackets) (void);
struct grub_efi_pxe_mode *mode;
} grub_efi_pxe_t;
@@ -2005,6 +2067,44 @@ struct grub_efi_ip4_config2_protocol
@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol
};
typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t;
@ -4280,7 +4281,7 @@ index 248d6a28ff9..805a9d7adf9 100644
enum grub_efi_ip6_config_data_type {
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID,
@@ -2039,6 +2139,49 @@ struct grub_efi_ip6_config_protocol
@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol
};
typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
@ -4327,12 +4328,12 @@ index 248d6a28ff9..805a9d7adf9 100644
+};
+typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
+
struct initrd_media_device_path {
grub_efi_vendor_media_device_path_t vendor;
grub_efi_device_path_t end;
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)
diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h
new file mode 100644
index 00000000000..fdb88eb810e
index 0000000000..fdb88eb810
--- /dev/null
+++ b/include/grub/efi/dhcp.h
@@ -0,0 +1,343 @@
@ -4681,7 +4682,7 @@ index 00000000000..fdb88eb810e
+#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
index 0000000000..c5e9a89f50
--- /dev/null
+++ b/include/grub/efi/http.h
@@ -0,0 +1,215 @@
@ -4902,7 +4903,7 @@ index 00000000000..c5e9a89f505
+#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
index 0000000000..de90d223e8
--- /dev/null
+++ b/include/grub/net/efi.h
@@ -0,0 +1,144 @@

View file

@ -18,11 +18,11 @@ signed code is allowed to be executed.
Signed-off-by: Michael Chang <mchang@suse.com>
---
grub-core/net/efi/net.c | 4 +++-
grub-core/net/http.c | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
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 1a19ee27144..ed04f05ad21 100644
index 86bce6535d..4bb308026c 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,
@ -38,23 +38,20 @@ index 1a19ee27144..ed04f05ad21 100644
if (buf)
{
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index f389bf03d96..af486198399 100644
index 12a2632ea5..b52b558d63 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -29,7 +29,11 @@
@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
GRUB_MOD_LICENSE ("GPLv3+");
-#define HTTP_PORT ((grub_uint16_t) 80)
+enum
+ {
enum
{
- HTTP_PORT = 80
+ HTTP_PORT = 80,
+ HTTP_MAX_CHUNK_SIZE = 0x80000000
+ };
};
typedef struct http_data
{
@@ -82,6 +86,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
@@ -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);

View file

@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 file changed, 50 insertions(+)
diff --git a/util/grub-editenv.c b/util/grub-editenv.c
index db6f187cc63..948eec8a114 100644
index db6f187cc6..948eec8a11 100644
--- a/util/grub-editenv.c
+++ b/util/grub-editenv.c
@@ -53,6 +53,9 @@ static struct argp_option options[] = {

View file

@ -43,10 +43,10 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
create mode 100644 util/grub.d/01_menu_auto_hide.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 1079add5bbe..5b9f85d4869 100644
index bda9fd1211..cb8e3c3270 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -461,6 +461,12 @@ script = {
@@ -458,6 +458,12 @@ script = {
installdir = grubconf;
};
@ -61,7 +61,7 @@ index 1079add5bbe..5b9f85d4869 100644
common = util/grub.d/01_users.in;
diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in
new file mode 100644
index 00000000000..ad175870a54
index 0000000000..ad175870a5
--- /dev/null
+++ b/util/grub.d/01_menu_auto_hide.in
@@ -0,0 +1,48 @@
@ -114,7 +114,7 @@ index 00000000000..ad175870a54
+fi
+EOF
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index d7d423b2eaf..18fe02cefd8 100644
index 4b27bd2015..3c9431cfcf 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then
@ -125,7 +125,7 @@ index d7d423b2eaf..18fe02cefd8 100644
# TRANSLATORS: it refers on the OS residing on device %s
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
hints=""
@@ -106,6 +107,7 @@ for OS in ${OSPROBED} ; do
@@ -102,6 +103,7 @@ for OS in ${OSPROBED} ; do
case ${BOOT} in
chain)
@ -133,7 +133,7 @@ index d7d423b2eaf..18fe02cefd8 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
@@ -136,6 +138,7 @@ EOF
@@ -132,6 +134,7 @@ EOF
EOF
;;
efi)
@ -141,7 +141,7 @@ index d7d423b2eaf..18fe02cefd8 100644
EFIPATH=${DEVICE#*@}
DEVICE=${DEVICE%@*}
@@ -180,6 +183,7 @@ EOF
@@ -176,6 +179,7 @@ EOF
LINITRD="${LINITRD#/boot}"
fi
@ -149,7 +149,7 @@ index d7d423b2eaf..18fe02cefd8 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
recovery_params="$(echo "${LPARAMS}" | grep single)" || true
counter=1
@@ -261,6 +265,7 @@ EOF
@@ -257,6 +261,7 @@ EOF
done
;;
hurd)
@ -157,7 +157,7 @@ index d7d423b2eaf..18fe02cefd8 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
@@ -287,6 +292,7 @@ EOF
@@ -283,6 +288,7 @@ EOF
EOF
;;
minix)
@ -165,7 +165,7 @@ index d7d423b2eaf..18fe02cefd8 100644
cat << EOF
menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" {
EOF
@@ -303,3 +309,15 @@ EOF
@@ -299,3 +305,15 @@ EOF
;;
esac
done

View file

@ -49,10 +49,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 docs/man/grub-set-bootflag.h2m
diff --git a/Makefile.util.def b/Makefile.util.def
index 5b9f85d4869..01096ded815 100644
index cb8e3c3270..d066652e9b 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -1468,3 +1468,10 @@ program = {
@@ -1429,3 +1429,10 @@ program = {
ldadd = grub-core/lib/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -65,7 +65,7 @@ index 5b9f85d4869..01096ded815 100644
+};
diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c
new file mode 100644
index 00000000000..d506f7e75bc
index 0000000000..d506f7e75b
--- /dev/null
+++ b/util/grub-set-bootflag.c
@@ -0,0 +1,172 @@
@ -242,7 +242,7 @@ index 00000000000..d506f7e75bc
+ return 0;
+}
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
index 5e7126f9878..26ac8765e30 100644
index 8f1485d52a..ad235de7fc 100644
--- a/conf/Makefile.extra-dist
+++ b/conf/Makefile.extra-dist
@@ -15,6 +15,9 @@ EXTRA_DIST += docs/man
@ -257,7 +257,7 @@ index 5e7126f9878..26ac8765e30 100644
diff --git a/docs/grub-boot-success.service b/docs/grub-boot-success.service
new file mode 100644
index 00000000000..80e79584c91
index 0000000000..80e79584c9
--- /dev/null
+++ b/docs/grub-boot-success.service
@@ -0,0 +1,6 @@
@ -269,7 +269,7 @@ index 00000000000..80e79584c91
+ExecStart=/usr/sbin/grub2-set-bootflag boot_success
diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer
new file mode 100644
index 00000000000..406f1720056
index 0000000000..406f172005
--- /dev/null
+++ b/docs/grub-boot-success.timer
@@ -0,0 +1,7 @@
@ -282,7 +282,7 @@ index 00000000000..406f1720056
+OnActiveSec=2min
diff --git a/docs/man/grub-set-bootflag.h2m b/docs/man/grub-set-bootflag.h2m
new file mode 100644
index 00000000000..94ec0b92ede
index 0000000000..94ec0b92ed
--- /dev/null
+++ b/docs/man/grub-set-bootflag.h2m
@@ -0,0 +1,2 @@

View file

@ -16,7 +16,7 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service
new file mode 100644
index 00000000000..6c8dcb186b6
index 0000000000..6c8dcb186b
--- /dev/null
+++ b/docs/grub-boot-indeterminate.service
@@ -0,0 +1,11 @@

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/gentpl.py b/gentpl.py
index bfab2113a1d..6cad9b8231f 100644
index c86550d4f9..f3c5f84f85 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -594,11 +594,21 @@ def platform_conditional(platform, closure):
@@ -592,11 +592,21 @@ def platform_conditional(platform, closure):
# };
#
def foreach_enabled_platform(defn, closure):
@ -35,7 +35,7 @@ index bfab2113a1d..6cad9b8231f 100644
for platform in GRUB_PLATFORMS:
platform_conditional(platform, closure)
@@ -657,6 +667,8 @@ def first_time(defn, snippet):
@@ -655,6 +665,8 @@ def first_time(defn, snippet):
def is_platform_independent(defn):
if 'enable' in defn:
return False

View file

@ -9,14 +9,14 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+)
diff --git a/gentpl.py b/gentpl.py
index 6cad9b8231f..597129a2bc4 100644
index f3c5f84f85..f09b336869 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -52,6 +52,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
GROUPS["riscv64"] = [ "riscv64_efi" ]
@@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
GROUPS["riscv64"] = [ "riscv64_efi" ]
# Groups based on firmware
+GROUPS["pc"] = [ "i386_pc" ]
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi",
"loongarch64_efi", "riscv32_efi", "riscv64_efi" ]
"riscv32_efi", "riscv64_efi" ]
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
index ed04f05ad21..1f7e1b63557 100644
index 4bb308026c..6603cd83ed 100644
--- a/grub-core/net/efi/net.c
+++ b/grub-core/net/efi/net.c
@@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void)

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 19 insertions(+)
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
index de28badccb0..b94dbc68eef 100644
index 3f61fd2fa5..243acbaa35 100644
--- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c
@@ -4,6 +4,7 @@
@ -23,7 +23,7 @@ index de28badccb0..b94dbc68eef 100644
static void
http_configure (struct grub_efi_net_device *dev, int prefer_ip6)
@@ -342,6 +343,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
@@ -351,6 +352,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
grub_err_t err;
grub_off_t size;
char *buf;

View file

@ -17,11 +17,11 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index fcfbcbb664d..c17e83acf87 100644
index 302300711f..008f6c273b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -914,11 +914,23 @@ if test "x$target_cpu" = xloongarch64; then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs"
@@ -849,11 +849,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
fi
+# Should grub utils get the host CFLAGS, or the target CFLAGS?
@ -45,7 +45,7 @@ index fcfbcbb664d..c17e83acf87 100644
AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
grub_cv_target_cc_soft_float=no
if test "x$target_cpu" = xarm64; then
@@ -2111,6 +2123,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
@@ -1954,6 +1966,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
@ -88,19 +88,19 @@ index fcfbcbb664d..c17e83acf87 100644
GRUB_PLATFORM="${platform}"
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 6262f21a772..54f0f7f7664 100644
index 5f0ef96985..2ff9b39357 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -50,24 +50,25 @@ else
endif
endif
@@ -40,24 +40,25 @@ 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 -R .note.gnu.property -R .gnu.build.attributes
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
-CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
+CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
@ -129,10 +129,10 @@ index 6262f21a772..54f0f7f7664 100644
# Other variables
diff --git a/gentpl.py b/gentpl.py
index 597129a2bc4..5826a6b14e8 100644
index f09b336869..0e62e14666 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -699,10 +699,10 @@ def module(defn, platform):
@@ -697,10 +697,10 @@ def module(defn, platform):
var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources")
var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))

View file

@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 1 Aug 2018 10:24:52 -0400
Subject: [PATCH] module-verifier: make it possible to run checkers on
grub-module-verifierxx.c
This makes it so you can treat grub-module-verifierxx.c as a file you can
build directly, so syntax checkers like vim's "syntastic" plugin, which uses
"gcc -x c -fsyntax-only" to build it, will work.
One still has to do whatever setup is required to make it pick the right
include dirs, which -W options we use, etc., but this makes it so you can do
the checking on the file you're editing, rather than on a different file.
v2: fix the typo in the #else clause in util/grub-module-verifierXX.c
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub-module-verifier32.c | 2 ++
util/grub-module-verifier64.c | 2 ++
util/grub-module-verifierXX.c | 9 +++++++++
3 files changed, 13 insertions(+)
diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c
index 257229f8f0..ba7d41aafe 100644
--- a/util/grub-module-verifier32.c
+++ b/util/grub-module-verifier32.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF32 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c
index 4db6b4bedd..fc23ef800b 100644
--- a/util/grub-module-verifier64.c
+++ b/util/grub-module-verifier64.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF64 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index ceb24309ae..a98e2f9b1a 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -1,3 +1,12 @@
+#define GRUB_MODULE_VERIFIERXX
+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64)
+#if __SIZEOF_POINTER__ == 8
+#include "grub-module-verifier64.c"
+#else
+#include "grub-module-verifier32.c"
+#endif
+#endif
+
#include <string.h>
#include <grub/elf.h>

View file

@ -17,18 +17,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/Makefile.core.def | 4 ++--
grub-core/Makefile.core.def | 5 ++---
grub-core/lib/fdt.c | 2 --
grub-core/loader/efi/fdt.c | 2 ++
include/grub/fdt.h | 6 ++++++
grub-core/Makefile.am | 1 +
5 files changed, 11 insertions(+), 4 deletions(-)
5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 56eb6a828e8..4629c179e40 100644
index 12797336c9..4e7d90da76 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -188,7 +188,6 @@ kernel = {
@@ -177,7 +177,6 @@ kernel = {
arm_coreboot = kern/arm/coreboot/init.c;
arm_coreboot = kern/arm/coreboot/timer.c;
arm_coreboot = kern/arm/coreboot/coreboot.S;
@ -36,7 +36,7 @@ index 56eb6a828e8..4629c179e40 100644
arm_coreboot = bus/fdt.c;
arm_coreboot = term/ps2.c;
arm_coreboot = term/arm/pl050.c;
@@ -370,6 +369,8 @@ kernel = {
@@ -351,6 +350,8 @@ kernel = {
riscv64 = kern/riscv/cache_flush.S;
riscv64 = kern/riscv/dl.c;
@ -45,7 +45,15 @@ index 56eb6a828e8..4629c179e40 100644
emu = disk/host.c;
emu = kern/emu/cache_s.S;
emu = kern/emu/hostdisk.c;
@@ -1882,7 +1883,6 @@ module = {
@@ -1825,7 +1826,6 @@ module = {
riscv32 = loader/riscv/linux.c;
riscv64 = loader/riscv/linux.c;
emu = loader/emu/linux.c;
- fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1837,7 +1837,6 @@ module = {
module = {
name = fdt;
efi = loader/efi/fdt.c;
@ -54,7 +62,7 @@ index 56eb6a828e8..4629c179e40 100644
};
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
index 73cfa94a2df..fbf749e1d61 100644
index 0d371c5633..37e04bd69e 100644
--- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c
@@ -21,8 +21,6 @@
@ -67,7 +75,7 @@ index 73cfa94a2df..fbf749e1d61 100644
#define FDT_BEGIN_NODE 0x00000001
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index 439964b9ca6..e08d8738afc 100644
index c86f283d75..c572415d38 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -27,6 +27,8 @@
@ -80,7 +88,7 @@ index 439964b9ca6..e08d8738afc 100644
static void *fdt;
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
index e609c7e4111..3514aa4a5b6 100644
index e609c7e411..3514aa4a5b 100644
--- a/include/grub/fdt.h
+++ b/include/grub/fdt.h
@@ -19,6 +19,9 @@
@ -102,7 +110,7 @@ index e609c7e4111..3514aa4a5b6 100644
+
#endif /* ! GRUB_FDT_HEADER */
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index b7192a3da82..7953ba95399 100644
index bfd29a3bf0..c2e8a82bce 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index c17e83acf87..3f3a170ab17 100644
index 008f6c273b..54462e0892 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1346,6 +1346,26 @@ if test "x$target_cpu" = xarm; then
@@ -1260,6 +1260,26 @@ if test "x$target_cpu" = xarm; then
done
])

View file

@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 463dafdba02..7347a8de676 100644
index d1de9fa687..1c540fc8c2 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -131,11 +131,19 @@ grub_set_prefix_and_root (void)
@ -41,7 +41,7 @@ index 463dafdba02..7347a8de676 100644
}
}
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
index b94dbc68eef..5e97f5d5e70 100644
index 243acbaa35..de351b2cd0 100644
--- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c
@@ -9,10 +9,52 @@
@ -97,7 +97,7 @@ index b94dbc68eef..5e97f5d5e70 100644
grub_efi_http_t *http = dev->http;
@@ -343,32 +385,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
@@ -352,32 +394,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
grub_err_t err;
grub_off_t size;
char *buf;

View file

@ -10,7 +10,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
index 53c734de70e..aebfe0cf839 100644
index 53c734de70..aebfe0cf83 100644
--- a/grub-core/kern/err.c
+++ b/grub-core/kern/err.c
@@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
@ -41,10 +41,10 @@ index 53c734de70e..aebfe0cf839 100644
return n;
diff --git a/include/grub/err.h b/include/grub/err.h
index 1c07034cd60..3c587b9b822 100644
index b08d5d0de4..c0f90ef07c 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -86,8 +86,12 @@ struct grub_error_saved
@@ -85,8 +85,12 @@ struct grub_error_saved
extern grub_err_t EXPORT_VAR(grub_errno);
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/grub-core/commands/reboot.c b/grub-core/commands/reboot.c
index 46d364c99a9..f5cc2283636 100644
index 46d364c99a..f5cc228363 100644
--- a/grub-core/commands/reboot.c
+++ b/grub-core/commands/reboot.c
@@ -32,15 +32,18 @@ grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),

View file

@ -19,10 +19,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 grub-core/commands/version.c
diff --git a/configure.ac b/configure.ac
index 3f3a170ab17..2175aa56997 100644
index 54462e0892..7b4e1854d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -289,6 +289,19 @@ AC_SUBST(target_cpu)
@@ -284,6 +284,19 @@ AC_SUBST(target_cpu)
AC_SUBST(platform)
# Define default variables
@ -43,10 +43,10 @@ index 3f3a170ab17..2175aa56997 100644
have_with_bootdir=n
AC_ARG_WITH([bootdir],
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 4629c179e40..f26c689723c 100644
index 4e7d90da76..4f203533f5 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -598,6 +598,11 @@ image = {
@@ -579,6 +579,11 @@ image = {
enable = mips_loongson;
};
@ -60,7 +60,7 @@ index 4629c179e40..f26c689723c 100644
common = lib/disk.c;
diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c
new file mode 100644
index 00000000000..de0acb07ba2
index 0000000000..de0acb07ba
--- /dev/null
+++ b/grub-core/commands/version.c
@@ -0,0 +1,56 @@
@ -121,14 +121,14 @@ index 00000000000..de0acb07ba2
+ grub_unregister_command (cmd);
+}
diff --git a/config.h.in b/config.h.in
index 9b1d3997185..d294d2c653f 100644
index 9e8f9911b1..c7e316f0f1 100644
--- a/config.h.in
+++ b/config.h.in
@@ -63,6 +63,7 @@
@@ -59,6 +59,7 @@
# define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
# define GRUB_PLATFORM "@GRUB_PLATFORM@"
+# define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@"
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
+#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@"
# define GRUB_STACK_PROTECTOR_INIT @GRUB_STACK_PROTECTOR_INIT@
#define RE_ENABLE_I18N 1

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
4 files changed, 10 insertions(+)
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
index 21e2395111a..c35ce8915b2 100644
index 0320115662..7cdffe3ebd 100644
--- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c
@@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter)
@ -24,7 +24,7 @@ index 21e2395111a..c35ce8915b2 100644
if (!accept_diskfilter && is_valid_diskfilter_name (name))
return 0;
@@ -1247,6 +1249,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
@@ -1212,6 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
the same. */
if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
return GRUB_ERR_NONE;
@ -33,10 +33,10 @@ index 21e2395111a..c35ce8915b2 100644
if (!pv->disk)
return grub_errno;
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index 3b5ed569133..822005456eb 100644
index f077b5f553..fe8ba6e6c9 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -865,6 +865,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
@@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
return 0;
}
@ -45,7 +45,7 @@ index 3b5ed569133..822005456eb 100644
grub_free (dup_dp);
diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c
index 670e213cf3c..d019637470d 100644
index 73b8ecc0c0..f58b58c89d 100644
--- a/grub-core/kern/device.c
+++ b/grub-core/kern/device.c
@@ -34,6 +34,7 @@ grub_device_open (const char *name)
@ -57,7 +57,7 @@ index 670e213cf3c..d019637470d 100644
{
name = grub_env_get ("root");
diff --git a/grub-core/script/script.c b/grub-core/script/script.c
index ec4d4337c66..844e8343ca7 100644
index ec4d4337c6..844e8343ca 100644
--- a/grub-core/script/script.c
+++ b/grub-core/script/script.c
@@ -22,6 +22,11 @@

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