Update to grub 2.04

This change updates grub to the 2.04 release. The new release changed how
grub is built, so the bootstrap and bootstrap.conf files have to be added
to the dist-git. Also, the gitignore file changed so it has to be updated.

Since the patches have been forward ported to 2.04, there's no need for a
logic to maintain a patch with the delta between the release and the grub
master branch. So the release-to-master.patch is dropped and no longer is
updated by the do-rebase script.

Also since gnulib isn't part of the grub repository anymore and cloned by
the boostrap tool, a gnulib tarball is included as other source file and
copied before calling the bootstrap tool. That way grub can be built even
in builders that only have access to the sources lookaside cache.

Resolves: rhbz#1727279

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2019-08-15 08:01:31 +02:00
parent c432d1fe96
commit e1531466e1
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
177 changed files with 3634 additions and 24119 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ kojilogs
tmp/
.*.sw?
results_grub2/
/gnulib-*.tar.?z

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Tue, 10 Jul 2012 11:58:52 -0400
Date: Fri, 5 Jul 2019 18:36:44 +0200
Subject: [PATCH] Add support for Linux EFI stub loading.
Also:
@ -38,17 +38,16 @@ moves the check into grub_dl_load_file.
include/grub/arm64/linux.h | 10 ++
include/grub/efi/efi.h | 7 +-
include/grub/efi/linux.h | 31 ++++
include/grub/i386/linux.h | 1 +
14 files changed, 620 insertions(+), 69 deletions(-)
13 files changed, 619 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 9590e87d9c0..0b4b0c2122d 100644
index 474a63e68c5..581d9dfc3b3 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1626,13 +1626,6 @@ module = {
@@ -1709,13 +1709,6 @@ module = {
enable = i386_pc;
};
@ -62,7 +61,7 @@ index 9590e87d9c0..0b4b0c2122d 100644
module = {
name = ntldr;
i386_pc = loader/i386/pc/ntldr.c;
@@ -1685,7 +1678,9 @@ module = {
@@ -1771,7 +1764,9 @@ module = {
module = {
name = linux;
@ -70,13 +69,13 @@ index 9590e87d9c0..0b4b0c2122d 100644
+ 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;
mips = loader/mips/linux.c;
@@ -1696,9 +1691,14 @@ module = {
arm_efi = loader/arm64/linux.c;
arm_uboot = loader/arm/linux.c;
@@ -1786,9 +1781,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;
+
@ -89,7 +88,7 @@ index 9590e87d9c0..0b4b0c2122d 100644
module = {
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index e394cd96f8c..04e804d1668 100644
index 48eb5e7b627..896bebfd57e 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -38,6 +38,14 @@
@ -126,9 +125,9 @@ index e394cd96f8c..04e804d1668 100644
+
grub_boot_time ("Loading module %s", filename);
file = grub_file_open (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 708581fcbde..c8a9d8307c0 100644
index 6e1ceb90516..a0faa40ecf0 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -273,6 +273,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
@ -167,7 +166,7 @@ index 708581fcbde..c8a9d8307c0 100644
/* 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 42ad7c570a5..5cdf6c943f2 100644
index b02fab1b102..a9e37108c6d 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
@ -210,7 +209,7 @@ index 42ad7c570a5..5cdf6c943f2 100644
void *
grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 1f86229f86b..6c00af98dce 100644
index ef3e9f9444c..a312c668685 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -29,6 +29,7 @@
@ -221,7 +220,7 @@ index 1f86229f86b..6c00af98dce 100644
#include <grub/efi/pe32.h>
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
@@ -40,6 +41,7 @@ static int loaded;
@@ -41,6 +42,7 @@ static int loaded;
static void *kernel_addr;
static grub_uint64_t kernel_size;
@ -229,7 +228,7 @@ index 1f86229f86b..6c00af98dce 100644
static char *linux_args;
static grub_uint32_t cmdline_size;
@@ -66,7 +68,8 @@ grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh)
@@ -67,7 +69,8 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
static grub_err_t
finalize_params_linux (void)
{
@ -239,7 +238,7 @@ index 1f86229f86b..6c00af98dce 100644
void *fdt;
@@ -101,79 +104,70 @@ finalize_params_linux (void)
@@ -102,79 +105,70 @@ finalize_params_linux (void)
if (grub_fdt_install() != GRUB_ERR_NONE)
goto failure;
@ -251,7 +250,7 @@ index 1f86229f86b..6c00af98dce 100644
-}
-
-grub_err_t
-grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
-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;
@ -284,7 +283,7 @@ index 1f86229f86b..6c00af98dce 100644
-
- grub_dprintf ("linux", "linux command line: '%s'\n", args);
+ grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n",
+ fdt);
+ fdt);
/* Convert command line to UCS-2 */
- loaded_image = grub_efi_get_loaded_image (image_handle);
@ -304,7 +303,7 @@ index 1f86229f86b..6c00af98dce 100644
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_uint8_t *) linux_args, len, NULL);
- grub_dprintf ("linux", "starting image %p\n", image_handle);
- status = b->start_image (image_handle, 0, NULL);
@ -329,15 +328,15 @@ index 1f86229f86b..6c00af98dce 100644
+ 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));
+ 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_armxx_efi_linux_boot_image (grub_addr_t addr, char *args)
+grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args)
+{
+ grub_err_t retval;
+
@ -360,21 +359,21 @@ index 1f86229f86b..6c00af98dce 100644
- if (finalize_params_linux () != GRUB_ERR_NONE)
- return grub_errno;
-
- return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr,
- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
- kernel_size, linux_args));
+ return grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args);
+ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args));
}
static grub_err_t
@@ -287,6 +281,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -288,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
grub_file_t file = 0;
struct linux_armxx_kernel_header lh;
struct linux_arch_kernel_header lh;
+ struct grub_armxx_linux_pe_header *pe;
grub_err_t err;
grub_dl_ref (my_mod);
@@ -331,6 +326,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -333,6 +328,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
@ -391,13 +390,13 @@ index 1f86229f86b..6c00af98dce 100644
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 1003a0b9997..f35b16caa92 100644
index 22cc25eccd9..d9b7a9ba400 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_armxx_efi_linux_boot_image (xen_hypervisor->start,
return grub_arch_efi_linux_boot_image (xen_hypervisor->start,
- xen_hypervisor->size,
xen_hypervisor->cmdline);
}
@ -480,7 +479,7 @@ index 00000000000..c24202a5dd1
+#pragma GCC diagnostic pop
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
new file mode 100644
index 00000000000..3db82e782df
index 00000000000..bb2616a8092
--- /dev/null
+++ b/grub-core/loader/i386/efi/linux.c
@@ -0,0 +1,335 @@
@ -589,8 +588,7 @@ index 00000000000..3db82e782df
+
+ for (i = 0; i < argc; i++)
+ {
+ grub_file_filter_disable_compression ();
+ files[i] = grub_file_open (argv[i]);
+ files[i] = grub_file_open (argv[i], GRUB_FILE_TYPE_LINUX_INITRD | GRUB_FILE_TYPE_NO_DECOMPRESS);
+ if (! files[i])
+ goto fail;
+ nfiles++;
@ -643,7 +641,7 @@ index 00000000000..3db82e782df
+ int argc, char *argv[])
+{
+ grub_file_t file = 0;
+ struct linux_kernel_header lh;
+ struct linux_i386_kernel_header lh;
+ grub_ssize_t len, start, filelen;
+ void *kernel = NULL;
+
@ -655,7 +653,7 @@ index 00000000000..3db82e782df
+ goto fail;
+ }
+
+ file = grub_file_open (argv[0]);
+ file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
+ if (! file)
+ goto fail;
+
@ -731,7 +729,8 @@ index 00000000000..3db82e782df
+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
+ grub_create_loader_cmdline (argc, argv,
+ linux_cmdline + sizeof (LINUX_IMAGE) - 1,
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ GRUB_VERIFY_KERNEL_CMDLINE);
+
+ lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
+
@ -820,10 +819,10 @@ index 00000000000..3db82e782df
+ grub_unregister_command (cmd_initrdefi);
+}
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index b69cb7a3a7f..a3c87cf2fc2 100644
index 47ea2945e4f..eea25ea39ca 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -468,14 +468,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
@@ -470,14 +470,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
@ -845,7 +844,7 @@ index b69cb7a3a7f..a3c87cf2fc2 100644
grub_register_command ("initrd16", grub_cmd_initrd,
0, N_("Load initrd."));
my_mod = mod;
@@ -484,5 +490,7 @@ GRUB_MOD_INIT(linux16)
@@ -486,5 +492,7 @@ GRUB_MOD_INIT(linux16)
GRUB_MOD_FINI(linux16)
{
grub_unregister_command (cmd_linux);
@ -854,7 +853,7 @@ index b69cb7a3a7f..a3c87cf2fc2 100644
+ grub_unregister_command (cmd_initrd16);
}
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index 712ba17b9ba..5900fc8a40c 100644
index 2e98a668969..775297db869 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -20,6 +20,7 @@
@ -878,13 +877,13 @@ index 712ba17b9ba..5900fc8a40c 100644
+
#if defined(__arm__)
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
# define linux_armxx_kernel_header linux_arm_kernel_header
# 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 8655067e039..7b533b57139 100644
index 4269adc6dae..a3be9dd7003 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -19,6 +19,8 @@
@ -909,13 +908,13 @@ index 8655067e039..7b533b57139 100644
+
#if defined(__aarch64__)
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
# define linux_armxx_kernel_header linux_arm64_kernel_header
# 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 2c6648d46fc..1061aee9726 100644
index e90e00dc431..6840bfee9b7 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
@ -939,10 +938,10 @@ index 2c6648d46fc..1061aee9726 100644
@@ -95,8 +99,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_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh);
-grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
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_armxx_efi_linux_boot_image(grub_addr_t addr, 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);
@ -983,15 +982,3 @@ index 00000000000..d9ede36773b
+ void *kernel_param);
+
+#endif /* ! GRUB_EFI_LINUX_HEADER */
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
index 60c7c3b5e66..bb19dbd5a77 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -142,6 +142,7 @@ struct linux_i386_kernel_header
grub_uint64_t setup_data;
grub_uint64_t pref_address;
grub_uint32_t init_size;
+ grub_uint32_t handover_offset;
} GRUB_PACKED;
/* Boot parameters for Linux based on 2.6.12. This is used by the setup

View File

@ -1,20 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg59@coreos.com>
Date: Sun, 9 Aug 2015 16:12:39 -0700
Date: Fri, 5 Jul 2019 20:54:51 +0200
Subject: [PATCH] Rework linux command
We want a single buffer that contains the entire kernel image in order to
perform a TPM measurement. Allocate one and copy the entire kernel into it
before pulling out the individual blocks later on.
---
grub-core/loader/i386/linux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
grub-core/loader/i386/linux.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 9b53d3168f9..f7186be4002 100644
index d0501e22957..b255c950526 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -685,13 +685,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -641,13 +641,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
grub_file_t file = 0;
struct linux_i386_kernel_header lh;
@ -31,7 +31,7 @@ index 9b53d3168f9..f7186be4002 100644
grub_dl_ref (my_mod);
@@ -705,7 +707,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -661,7 +663,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (! file)
goto fail;
@ -48,7 +48,7 @@ index 9b53d3168f9..f7186be4002 100644
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -713,6 +723,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -669,6 +679,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -58,7 +58,7 @@ index 9b53d3168f9..f7186be4002 100644
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
{
grub_error (GRUB_ERR_BAD_OS, "invalid magic number");
@@ -804,6 +817,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -760,6 +773,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
preferred_address))
goto fail;
@ -66,10 +66,10 @@ index 9b53d3168f9..f7186be4002 100644
grub_memset (&linux_params, 0, sizeof (linux_params));
grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
@@ -812,13 +826,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
linux_params.ps_mouse = linux_params.padding10 = 0;
@@ -782,13 +796,9 @@ 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);
len = sizeof (linux_params) - sizeof (lh);
- if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len)
- {
- if (!grub_errno)
@ -77,14 +77,13 @@ index 9b53d3168f9..f7186be4002 100644
- argv[0]);
- goto fail;
- }
+
+ linux_params_ptr = (void *)&linux_params;
+ grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len);
+ kernel_offset += len;
linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
@@ -877,7 +888,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -847,7 +857,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* The other parameters are filled when booting. */
@ -93,8 +92,8 @@ index 9b53d3168f9..f7186be4002 100644
grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
(unsigned) real_size, (unsigned) prot_size);
@@ -1025,9 +1036,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
- (sizeof (LINUX_IMAGE) - 1));
@@ -1001,9 +1011,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
len = prot_file_size;
- if (grub_file_read (file, prot_mode_mem, len) != len && !grub_errno)
@ -104,7 +103,7 @@ index 9b53d3168f9..f7186be4002 100644
if (grub_errno == GRUB_ERR_NONE)
{
@@ -1038,6 +1047,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -1014,6 +1022,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fail:

View File

@ -1,17 +1,17 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg59@coreos.com>
Date: Sun, 9 Aug 2015 16:20:58 -0700
Date: Fri, 5 Jul 2019 21:12:00 +0200
Subject: [PATCH] Rework linux16 command
We want a single buffer that contains the entire kernel image in order to
perform a TPM measurement. Allocate one and copy the entire kernel int it
before pulling out the individual blocks later on.
---
grub-core/loader/i386/pc/linux.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
grub-core/loader/i386/pc/linux.c | 33 +++++++++++++++++++++------------
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 a3c87cf2fc2..caa76bee8af 100644
index eea25ea39ca..73fb91e0570 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -123,13 +123,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@ -74,12 +74,11 @@ index a3c87cf2fc2..caa76bee8af 100644
if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
|| grub_le_to_cpu16 (lh.version) < 0x0200)
@@ -355,10 +363,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -358,9 +366,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
len = grub_linux16_prot_size;
- if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size)
- != (grub_ssize_t) grub_linux16_prot_size && !grub_errno)
- if (grub_file_read (file, grub_linux_prot_chunk, len) != len && !grub_errno)
- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
- argv[0]);
+ grub_memcpy (grub_linux_prot_chunk, kernel + kernel_offset, len);
@ -87,7 +86,7 @@ index a3c87cf2fc2..caa76bee8af 100644
if (grub_errno == GRUB_ERR_NONE)
{
@@ -368,6 +374,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -370,6 +377,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fail:

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Raymund Will <rw@suse.com>
Date: Fri, 10 Apr 2015 01:45:02 -0400
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
@ -175,7 +175,7 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
7 files changed, 840 insertions(+), 91 deletions(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index c8a9d8307c0..91129e33566 100644
index a0faa40ecf0..3487b0623a4 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -283,14 +283,20 @@ grub_efi_secure_boot (void)
@ -204,18 +204,18 @@ index c8a9d8307c0..91129e33566 100644
if (*secure_boot && !*setup_mode)
ret = 1;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 6c00af98dce..a1ac7a38867 100644
index a312c668685..04994d5c67d 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -282,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_file_t file = 0;
struct linux_armxx_kernel_header lh;
@@ -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);
@@ -326,7 +327,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -328,7 +329,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
@ -226,7 +226,7 @@ index 6c00af98dce..a1ac7a38867 100644
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 adc85636633..af2189619a3 100644
index cd92ea3f24b..ef87b06cf70 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -32,6 +32,8 @@
@ -261,7 +261,7 @@ index adc85636633..af2189619a3 100644
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@@ -173,7 +181,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
@@ -179,7 +187,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
/* Fill the file path for the directory. */
d = (grub_efi_device_path_t *) ((char *) file_path
+ ((char *) d - (char *) dp));
@ -269,7 +269,7 @@ index adc85636633..af2189619a3 100644
copy_file_path ((grub_efi_file_path_device_path_t *) d,
dir_start, dir_end - dir_start);
@@ -191,20 +198,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
@@ -197,20 +204,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
return file_path;
}
@ -963,7 +963,7 @@ index adc85636633..af2189619a3 100644
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@@ -216,15 +893,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -222,15 +899,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
address = 0;
image_handle = 0;
file_path = 0;
@ -997,7 +997,7 @@ index adc85636633..af2189619a3 100644
+ *(--p16) = 0;
+ }
+
file = grub_file_open (filename);
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
if (! file)
goto fail;
@ -1011,7 +1011,7 @@ index adc85636633..af2189619a3 100644
if (! dev)
goto fail;
@@ -261,17 +968,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -267,17 +974,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (! file_path)
goto fail;
@ -1032,7 +1032,7 @@ index adc85636633..af2189619a3 100644
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
GRUB_EFI_LOADER_CODE,
@@ -285,7 +989,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -291,7 +995,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
boot_image = (void *) ((grub_addr_t) address);
@ -1041,7 +1041,7 @@ index adc85636633..af2189619a3 100644
{
if (grub_errno == GRUB_ERR_NONE)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -295,7 +999,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -301,7 +1005,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
#if defined (__i386__) || defined (__x86_64__)
@ -1050,7 +1050,7 @@ index adc85636633..af2189619a3 100644
{
struct grub_macho_fat_header *head = boot_image;
if (head->magic
@@ -304,6 +1008,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -310,6 +1014,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);
@ -1065,7 +1065,7 @@ index adc85636633..af2189619a3 100644
for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++)
{
if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype))
@@ -318,79 +1030,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -324,79 +1036,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)
@ -1162,7 +1162,7 @@ index adc85636633..af2189619a3 100644
if (dev)
grub_device_close (dev);
@@ -402,6 +1074,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
@@ -408,6 +1080,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (address)
efi_call_2 (b->free_pages, address, pages);
@ -1218,10 +1218,10 @@ index c24202a5dd1..c8ecce6dfd0 100644
#pragma GCC diagnostic push
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index 3db82e782df..8db228c5bf5 100644
index bb2616a8092..6b24cbb9483 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -118,6 +118,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
@@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -1230,15 +1230,15 @@ index 3db82e782df..8db228c5bf5 100644
params->ramdisk_size = size;
params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem;
@@ -160,6 +162,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
struct linux_kernel_header lh;
@@ -159,6 +161,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
struct linux_i386_kernel_header lh;
grub_ssize_t len, start, filelen;
void *kernel = NULL;
+ int rc;
grub_dl_ref (my_mod);
@@ -185,11 +188,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -184,11 +187,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (grub_file_read (file, kernel, filelen) != filelen)
{
@ -1254,7 +1254,7 @@ index 3db82e782df..8db228c5bf5 100644
{
grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"),
argv[0]);
@@ -204,6 +209,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -203,6 +208,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -1263,7 +1263,7 @@ index 3db82e782df..8db228c5bf5 100644
grub_memset (params, 0, 16384);
grub_memcpy (&lh, kernel, sizeof (lh));
@@ -242,6 +249,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -241,6 +248,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -1299,10 +1299,10 @@ index d9ede36773b..0033d9305a9 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 7d44732d2c3..c03cc599f63 100644
index 0ed8781f037..a43adf27464 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -214,7 +214,11 @@ struct grub_pe64_optional_header
@@ -223,7 +223,11 @@ struct grub_pe64_optional_header
struct grub_pe32_section_table
{
char name[8];
@ -1315,7 +1315,7 @@ index 7d44732d2c3..c03cc599f63 100644
grub_uint32_t virtual_address;
grub_uint32_t raw_data_size;
grub_uint32_t raw_data_offset;
@@ -225,12 +229,18 @@ struct grub_pe32_section_table
@@ -234,12 +238,18 @@ struct grub_pe32_section_table
grub_uint32_t characteristics;
};
@ -1338,7 +1338,7 @@ index 7d44732d2c3..c03cc599f63 100644
#define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000
#define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000
@@ -239,10 +249,28 @@ 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
@ -1367,7 +1367,7 @@ index 7d44732d2c3..c03cc599f63 100644
#define GRUB_PE32_SIGNATURE_SIZE 4
struct grub_pe32_header
@@ -265,6 +293,20 @@ struct grub_pe32_header
@@ -274,6 +302,20 @@ struct grub_pe32_header
#endif
};

View File

@ -38,10 +38,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/sparc64/linux.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 0b4b0c2122d..e92a7ef322f 100644
index 581d9dfc3b3..eb1088fd654 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -195,6 +195,7 @@ kernel = {
@@ -207,6 +207,7 @@ kernel = {
i386_multiboot = kern/i386/pc/acpi.c;
i386_coreboot = kern/acpi.c;
i386_multiboot = kern/acpi.c;
@ -114,7 +114,7 @@ index 98769eadb34..088cbe9e2bc 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 04e804d1668..621070918d4 100644
index 896bebfd57e..d7718d26abc 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -32,6 +32,7 @@
@ -126,7 +126,7 @@ index 04e804d1668..621070918d4 100644
/* Platforms where modules are in a readonly area of memory. */
#if defined(GRUB_MACHINE_QEMU)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 91129e33566..708581fcbde 100644
index 3487b0623a4..6e1ceb90516 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -273,40 +273,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
@ -272,7 +272,7 @@ index 74888c463ba..69c2a10d351 100644
grub_unregister_command (cmd);
}
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index af2189619a3..5cd9b6e08a8 100644
index ef87b06cf70..5aa3a5dc7dd 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -34,6 +34,7 @@
@ -284,10 +284,10 @@ index af2189619a3..5cd9b6e08a8 100644
#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 7f96515da65..87709aa23e8 100644
index 3730ed38247..5b9b92d6ba5 100644
--- a/grub-core/loader/i386/bsd.c
+++ b/grub-core/loader/i386/bsd.c
@@ -38,6 +38,7 @@
@@ -39,6 +39,7 @@
#ifdef GRUB_MACHINE_PCBIOS
#include <grub/machine/int.h>
#endif
@ -295,7 +295,7 @@ index 7f96515da65..87709aa23e8 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -2124,6 +2125,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk;
@@ -2130,6 +2131,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk;
GRUB_MOD_INIT (bsd)
{
@ -305,7 +305,7 @@ index 7f96515da65..87709aa23e8 100644
/* Net and OpenBSD kernels are often compressed. */
grub_dl_load ("gzio");
@@ -2163,6 +2167,9 @@ GRUB_MOD_INIT (bsd)
@@ -2169,6 +2173,9 @@ GRUB_MOD_INIT (bsd)
GRUB_MOD_FINI (bsd)
{
@ -316,18 +316,18 @@ index 7f96515da65..87709aa23e8 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 f7186be4002..c84747ea857 100644
index b255c950526..376c726928a 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -35,6 +35,7 @@
#include <grub/i18n.h>
@@ -36,6 +36,7 @@
#include <grub/lib/cmdline.h>
#include <grub/linux.h>
#include <grub/machine/kernel.h>
+#include <grub/efi/sb.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -1156,6 +1157,9 @@ static grub_command_t cmd_linux, cmd_initrd;
@@ -1131,6 +1132,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
@ -337,7 +337,7 @@ index f7186be4002..c84747ea857 100644
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, N_("Load Linux."));
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
@@ -1165,6 +1169,9 @@ GRUB_MOD_INIT(linux)
@@ -1140,6 +1144,9 @@ GRUB_MOD_INIT(linux)
GRUB_MOD_FINI(linux)
{
@ -348,7 +348,7 @@ index f7186be4002..c84747ea857 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 caa76bee8af..783a3cd93bc 100644
index 73fb91e0570..fe3e1d41d09 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -35,6 +35,7 @@
@ -359,7 +359,7 @@ index caa76bee8af..783a3cd93bc 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -480,6 +481,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16;
@@ -483,6 +484,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16;
GRUB_MOD_INIT(linux16)
{
@ -369,7 +369,7 @@ index caa76bee8af..783a3cd93bc 100644
cmd_linux =
grub_register_command ("linux", grub_cmd_linux,
0, N_("Load Linux."));
@@ -497,6 +501,9 @@ GRUB_MOD_INIT(linux16)
@@ -500,6 +504,9 @@ GRUB_MOD_INIT(linux16)
GRUB_MOD_FINI(linux16)
{
@ -380,7 +380,7 @@ index caa76bee8af..783a3cd93bc 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 40c67e82489..26df46a4161 100644
index 4a98d708259..3e6ad166dc9 100644
--- a/grub-core/loader/multiboot.c
+++ b/grub-core/loader/multiboot.c
@@ -50,6 +50,7 @@
@ -391,7 +391,7 @@ index 40c67e82489..26df46a4161 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -446,6 +447,9 @@ static grub_command_t cmd_multiboot, cmd_module;
@@ -444,6 +445,9 @@ static grub_command_t cmd_multiboot, cmd_module;
GRUB_MOD_INIT(multiboot)
{
@ -401,7 +401,7 @@ index 40c67e82489..26df46a4161 100644
cmd_multiboot =
#ifdef GRUB_USE_MULTIBOOT2
grub_register_command ("multiboot2", grub_cmd_multiboot,
@@ -466,6 +470,9 @@ GRUB_MOD_INIT(multiboot)
@@ -464,6 +468,9 @@ GRUB_MOD_INIT(multiboot)
GRUB_MOD_FINI(multiboot)
{
@ -412,18 +412,18 @@ index 40c67e82489..26df46a4161 100644
grub_unregister_command (cmd_module);
}
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
index c9885b1bcd7..df8dfdb4ba0 100644
index 7f74d1d6fc9..e0f47e72b06 100644
--- a/grub-core/loader/xnu.c
+++ b/grub-core/loader/xnu.c
@@ -33,6 +33,7 @@
#include <grub/extcmd.h>
@@ -34,6 +34,7 @@
#include <grub/env.h>
#include <grub/i18n.h>
#include <grub/verify.h>
+#include <grub/efi/sb.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -1469,6 +1470,9 @@ static grub_extcmd_t cmd_splash;
@@ -1478,6 +1479,9 @@ static grub_extcmd_t cmd_splash;
GRUB_MOD_INIT(xnu)
{
@ -433,7 +433,7 @@ index c9885b1bcd7..df8dfdb4ba0 100644
cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0,
N_("Load XNU image."));
cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
@@ -1509,6 +1513,9 @@ GRUB_MOD_INIT(xnu)
@@ -1518,6 +1522,9 @@ GRUB_MOD_INIT(xnu)
GRUB_MOD_FINI(xnu)
{
@ -444,7 +444,7 @@ index c9885b1bcd7..df8dfdb4ba0 100644
grub_unregister_command (cmd_resume);
#endif
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 1061aee9726..39480b38674 100644
index 6840bfee9b7..090c8621066 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -85,7 +85,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
@ -503,7 +503,7 @@ diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f4ff62b769a..9c69aa88626 100644
index 3ea8e7ff45f..c6ba5b2d763 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 14 Feb 2017 16:18:54 -0500
Date: Mon, 8 Jul 2019 12:32:37 +0200
Subject: [PATCH] Handle multi-arch (64-on-32) boot in linuxefi loader.
Allow booting 64-bit kernels on 32-bit EFI on x86.
@ -37,7 +37,7 @@ index c8ecce6dfd0..0622dfa48d4 100644
return GRUB_ERR_BUG;
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index 8db228c5bf5..800c3e54022 100644
index 6b24cbb9483..3017d0f3e52 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -44,14 +44,10 @@ static char *linux_cmdline;
@ -57,12 +57,12 @@ index 8db228c5bf5..800c3e54022 100644
params);
}
@@ -154,14 +150,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
@@ -153,14 +149,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
+#define MIN(a, b) \
+ ({ typeof (a) _a = (a); \
+ ({ typeof (a) _a = (a); \
+ typeof (b) _b = (b); \
+ _a < _b ? _a : _b; })
+
@ -71,7 +71,7 @@ index 8db228c5bf5..800c3e54022 100644
int argc, char *argv[])
{
grub_file_t file = 0;
- struct linux_kernel_header lh;
- struct linux_i386_kernel_header lh;
- grub_ssize_t len, start, filelen;
+ struct linux_i386_kernel_header *lh = NULL;
+ grub_ssize_t start, filelen;
@ -80,7 +80,7 @@ index 8db228c5bf5..800c3e54022 100644
int rc;
grub_dl_ref (my_mod);
@@ -201,48 +203,79 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -200,48 +202,79 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -172,12 +172,13 @@ index 8db228c5bf5..800c3e54022 100644
if (!linux_cmdline)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
@@ -255,21 +288,23 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -254,22 +287,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
grub_create_loader_cmdline (argc, argv,
linux_cmdline + sizeof (LINUX_IMAGE) - 1,
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
+ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1));
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1),
GRUB_VERIFY_KERNEL_CMDLINE);
- lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
+ grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline);
@ -244,10 +245,10 @@ index 8db228c5bf5..800c3e54022 100644
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 bb19dbd5a77..8474a857ed2 100644
index ce30e7fb01b..a093679cb80 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -133,7 +133,12 @@ struct linux_i386_kernel_header
@@ -136,7 +136,12 @@ struct linux_i386_kernel_header
grub_uint32_t kernel_alignment;
grub_uint8_t relocatable;
grub_uint8_t min_alignment;

View File

@ -1,33 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 8 Aug 2017 12:48:04 -0400
Date: Mon, 8 Jul 2019 12:55:29 +0200
Subject: [PATCH] re-write .gitignore
---
.gitignore | 357 +++++++++++++-------------------------
build-aux/.gitignore | 9 +
docs/.gitignore | 4 +
grub-core/.gitignore | 15 ++
grub-core/gnulib/.gitignore | 22 +++
.gitignore | 366 +++++++++++++++-----------------------
docs/.gitignore | 5 +
grub-core/.gitignore | 16 ++
grub-core/lib/.gitignore | 1 +
include/grub/gcrypt/.gitignore | 2 +
po/.gitignore | 4 +
util/bash-completion.d/.gitignore | 1 +
9 files changed, 175 insertions(+), 240 deletions(-)
create mode 100644 build-aux/.gitignore
po/.gitignore | 5 +
util/bash-completion.d/.gitignore | 2 +
7 files changed, 171 insertions(+), 226 deletions(-)
create mode 100644 docs/.gitignore
create mode 100644 grub-core/.gitignore
create mode 100644 grub-core/gnulib/.gitignore
create mode 100644 grub-core/lib/.gitignore
create mode 100644 include/grub/gcrypt/.gitignore
create mode 100644 po/.gitignore
create mode 100644 util/bash-completion.d/.gitignore
diff --git a/.gitignore b/.gitignore
index eca17bec9b8..43f04d47277 100644
index 819cd185d44..b45a633f3d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,249 +1,126 @@
@@ -1,237 +1,151 @@
+# things ./autogen.sh will create
+/Makefile.utilgcry.def
+/ABOUT-NLS
+/aclocal.m4
+/autom4te.cache
+/build-aux
+/configure
+/gnulib
+/grub-core/lib/gnulib/
+/Makefile
+
+# things very common editors create that we never want
*~
-00_header
-10_*
-20_linux_xen
@ -36,11 +45,13 @@ index eca17bec9b8..43f04d47277 100644
-41_custom
-*.1
-*.8
-ABOUT-NLS
-aclocal.m4
-ahci_test
-ascii.bitmaps
-ascii.h
-autom4te.cache
-build-aux
-build-grub-gen-asciih
-build-grub-gen-widthspec
-build-grub-mkfont
@ -64,26 +75,18 @@ index eca17bec9b8..43f04d47277 100644
-example_grub_script_test
-example_scripted_test
-example_unit_test
+# things ./autogen.sh will create
+/Makefile.utilgcry.def
+/aclocal.m4
+/autom4te.cache
+/configure
+Makefile
+# we want to enable building in a subdirectory, but we don't want to exclude
+# /build-aux so explicitly don't ignore it.
+/build*/
+!/build-aux/
+
+# things very common editors create that we never want
+*~
+.*.sw?
+*.patch
+
+# stuff you're likely to make while building test trees
+grub.cfg
+/build*/
+
+# built objects across the whole tree
+Makefile.in
+*.a
+*.am
+*.efi
*.exec
-*.exec.exe
-fddboot_test
@ -92,6 +95,7 @@ index eca17bec9b8..43f04d47277 100644
-gentrigtables
-gentrigtables.exe
-gettext_strings_test
-/gnulib
-grub-bin2h
-/grub-bios-setup
-/grub-bios-setup.exe
@ -184,6 +188,7 @@ index eca17bec9b8..43f04d47277 100644
-*.image.exe
-include/grub/cpu
-include/grub/machine
-INSTALL.grub
-install-sh
-lib/libgcrypt-grub
-libgrub_a_init.c
@ -194,6 +199,7 @@ index eca17bec9b8..43f04d47277 100644
-lzocompress_test
*.marker
-Makefile
/m4
*.mod
-mod-*.c
-missing
@ -208,7 +214,11 @@ index eca17bec9b8..43f04d47277 100644
-*.pp
-po/*.mo
-po/grub.pot
-po/Makefile.in.in
-po/Makevars
-po/Makevars.template
-po/POTFILES
-po/Rules-quot
-po/stamp-po
-printf_test
-priority_queue_unit_test
@ -259,25 +269,7 @@ index eca17bec9b8..43f04d47277 100644
-grub-core/*.pp
-grub-core/kernel.img.bin
-util/bash-completion.d/grub
-grub-core/gnulib/alloca.h
-grub-core/gnulib/arg-nonnull.h
-grub-core/gnulib/c++defs.h
-grub-core/gnulib/charset.alias
-grub-core/gnulib/configmake.h
-grub-core/gnulib/float.h
-grub-core/gnulib/getopt.h
-grub-core/gnulib/langinfo.h
-grub-core/gnulib/ref-add.sed
-grub-core/gnulib/ref-del.sed
-grub-core/gnulib/stdio.h
-grub-core/gnulib/stdlib.h
-grub-core/gnulib/string.h
-grub-core/gnulib/strings.h
-grub-core/gnulib/sys
-grub-core/gnulib/unistd.h
-grub-core/gnulib/warn-on-use.h
-grub-core/gnulib/wchar.h
-grub-core/gnulib/wctype.h
-grub-core/lib/gnulib
-grub-core/rs_decoder.h
-widthspec.bin
-widthspec.h
@ -296,10 +288,6 @@ index eca17bec9b8..43f04d47277 100644
-/grub-render-label
-/grub-glue-efi.exe
-/grub-render-label.exe
-grub-core/gnulib/locale.h
-grub-core/gnulib/unitypes.h
-grub-core/gnulib/uniwidth.h
-build-aux/test-driver
+
+# next are things you get if you do ./configure in the topdir (for e.g.
+# "make dist" invocation.
@ -307,9 +295,16 @@ index eca17bec9b8..43f04d47277 100644
+/config.h
+/include/grub/cpu
+/include/grub/machine
+/INSTALL
+/INSTALL.grub
+/po/Makefile.in.in
+/po/Makevars
+/po/Makevars.template
+/po/POTFILES
+/po/Rules-quot
+/stamp-h
+/stamp-h1
+bootstrap.log
+config.log
+config.status
+
@ -338,6 +333,8 @@ index eca17bec9b8..43f04d47277 100644
+/grub*-fs-tester
+/grub*-fstest
+/grub*-fstest.1
+/grub*-get-kernel-settings
+/grub*-get-kernel-settings.3
+/grub*-glue-efi
+/grub*-glue-efi.1
+/grub*-install
@ -348,6 +345,8 @@ index eca17bec9b8..43f04d47277 100644
+/grub*-macbless.8
+/grub*-menulst2cfg
+/grub*-menulst2cfg.1
+/grub*-mount
+/grub*-mount.1
+/grub*-mkconfig
+/grub*-mkconfig.8
+/grub*-mkconfig_lib
@ -375,16 +374,24 @@ index eca17bec9b8..43f04d47277 100644
+/grub*-reboot.8
+/grub*-render-label
+/grub*-render-label.1
+/grub*-rpm-sort
+/grub*-rpm-sort.8
+/grub*-script-check
+/grub*-script-check.1
+/grub*-set-bootflag
+/grub*-set-bootflag.1
+/grub*-set-default
+/grub*-set-default.8
+/grub*-set-password
+/grub*-set-password.8
+/grub*-shell
+/grub*-shell-tester
+/grub*-sparc64-setup
+/grub*-sparc64-setup.8
+/grub*-syslinux2cfg
+/grub*-syslinux2cfg.1
+/grub*-switch-to-blscfg
+/grub*-switch-to-blscfg.8
+/grub_fstest.pp
+/grub_fstest_init.c
+/grub_fstest_init.lst
@ -394,38 +401,25 @@ index eca17bec9b8..43f04d47277 100644
+/libgrub_a_init.lst
+/stamp-h.in
+/widthspec.h
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
new file mode 100644
index 00000000000..f2f17aab9ff
--- /dev/null
+++ b/build-aux/.gitignore
@@ -0,0 +1,9 @@
+/compile
+/config.guess
+/config.sub
+/depcomp
+/install-sh
+/mdate-sh
+/missing
+/test-driver
+/texinfo.tex
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 00000000000..91aee84d3e9
index 00000000000..e1d849ef95b
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,4 @@
@@ -0,0 +1,5 @@
+/*.in
+/Makefile
+/stamp-1
+/stamp-vti
+/version*.texi
diff --git a/grub-core/.gitignore b/grub-core/.gitignore
new file mode 100644
index 00000000000..c738ac6c649
index 00000000000..2acce281159
--- /dev/null
+++ b/grub-core/.gitignore
@@ -0,0 +1,15 @@
@@ -0,0 +1,16 @@
+/*.lst
+/Makefile
+/Makefile.gcry.def
+/unidata.c
+/build-grub-module-verifier
@ -440,34 +434,6 @@ index 00000000000..c738ac6c649
+/symlist.c
+/symlist.h
+/trigtables.c
diff --git a/grub-core/gnulib/.gitignore b/grub-core/gnulib/.gitignore
new file mode 100644
index 00000000000..29e199c2db4
--- /dev/null
+++ b/grub-core/gnulib/.gitignore
@@ -0,0 +1,22 @@
+/alloca.h
+/arg-nonnull.h
+/c++defs.h
+/charset.alias
+/configmake.h
+/getopt.h
+/langinfo.h
+/libgnu.a
+/locale.h
+/ref-add.sed
+/ref-del.sed
+/stdio.h
+/stdlib.h
+/string.h
+/strings.h
+/sys/
+/unistd.h
+/unitypes.h
+/uniwidth.h
+/warn-on-use.h
+/wchar.h
+/wctype.h
diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore
new file mode 100644
index 00000000000..68154591404
@ -485,18 +451,20 @@ index 00000000000..8fbf5646246
+gcrypt.h
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 00000000000..97b679c3138
index 00000000000..f507e7741e3
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,4 @@
@@ -0,0 +1,5 @@
+/Makefile
+/POTFILES*.in
+/grub.pot
+/remove-potcdate.sed
+/stamp-po
diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore
new file mode 100644
index 00000000000..b7e1eb12428
index 00000000000..6813a527ad3
--- /dev/null
+++ b/util/bash-completion.d/.gitignore
@@ -0,0 +1 @@
@@ -0,0 +1,2 @@
+Makefile
+grub

View File

@ -25,10 +25,10 @@ parameters
4 files changed, 91 insertions(+)
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 62929d983bf..2d53c0e8608 100644
index 4d493ab7661..3a6689abb11 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -588,3 +588,66 @@ grub_ieee1275_get_boot_dev (void)
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)
return bootpath;
}
@ -96,7 +96,7 @@ index 62929d983bf..2d53c0e8608 100644
+ return 0;
+}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 78a70a8bf47..249e19bc788 100644
index 1b03dfd57b9..222e239c1be 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -33,6 +33,9 @@
@ -133,20 +133,20 @@ index 78a70a8bf47..249e19bc788 100644
grub_errno = GRUB_ERR_NONE;
}
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index a8502d90711..ab78ca87f90 100644
index ee299fd0ea6..0d05d6b0709 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -27,6 +27,9 @@
#include <grub/normal.h>
@@ -28,6 +28,9 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/verify.h>
+#ifdef GRUB_MACHINE_IEEE1275
+#include <grub/ieee1275/ieee1275.h>
+#endif
/* Max digits for a char is 3 (0xFF is 255), similarly for an int it
is sizeof (int) * 3, and one extra for a possible -ve sign. */
@@ -877,6 +880,10 @@ grub_script_execute_sourcecode (const char *source)
@@ -878,6 +881,10 @@ grub_script_execute_sourcecode (const char *source)
grub_err_t ret = 0;
struct grub_script *parsed_script;
@ -158,10 +158,10 @@ index a8502d90711..ab78ca87f90 100644
{
char *line;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 8868f3a756f..2310f33dbc2 100644
index 73e2f464475..0a599607f31 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -252,6 +252,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

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=973205
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index 3e12e6b24e1..3e14f539368 100644
index 20cbbd761ec..04df9d2c667 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void)
@ -48,14 +48,14 @@ index 17a3dbbb575..b8e4b3feb32 100644
GRUB_MOD_FINI(ieee1275_fb)
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 2310f33dbc2..ca08bd96681 100644
index 0a599607f31..b5a1d49bbc3 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -146,6 +146,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_BROKEN_REPEAT,
@@ -148,6 +148,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
+
GRUB_IEEE1275_FLAG_RAW_DEVNAMES,
+
+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
};

View File

@ -11,7 +11,7 @@ the -o option follows it rather than overwriting it with a regular file.
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 33332360eec..bc5a3f17541 100644
index 9f477ff0546..523d4e029bb 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -287,7 +287,8 @@ and /etc/grub.d/* files or please file a bug report with

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 c7888e40f66..783118ccdcd 100644
index 7656f2434e5..d283af64c8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -289,6 +289,14 @@ AC_SUBST(grubdirname)
@@ -305,6 +305,14 @@ AC_SUBST(grubdirname)
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
[Default grub directory name])
@ -28,7 +28,7 @@ index c7888e40f66..783118ccdcd 100644
#
# Checks for build programs.
#
@@ -498,6 +506,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
@@ -516,6 +524,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
# Check for target programs.
#

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 e7a83c2d6e2..d2f64b05e0a 100644
index d5e0c79a70e..9175ad297d8 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -163,16 +163,41 @@ grub_menu_set_timeout (int timeout)

View File

@ -15,7 +15,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index 2adfa97bee8..2fd32608c01 100644
index 87795075a87..6f524305085 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1441,6 +1441,13 @@ enable the use of partition UUIDs, set this option to @samp{false}.
@ -33,7 +33,7 @@ index 2adfa97bee8..2fd32608c01 100644
If graphical video support is required, either because the @samp{gfxterm}
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index bc5a3f17541..b0a8626dd1c 100644
index 523d4e029bb..9ecbcfb5b43 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -133,12 +133,12 @@ fi

View File

@ -27,10 +27,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
14 files changed, 48 insertions(+), 21 deletions(-)
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
index a3a11824172..b25ca4b9f17 100644
index 6bbce3128cf..6d66b7c453a 100644
--- a/grub-core/commands/minicmd.c
+++ b/grub-core/commands/minicmd.c
@@ -176,12 +176,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
@@ -179,12 +179,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
}
/* exit */
@ -60,7 +60,7 @@ index a3a11824172..b25ca4b9f17 100644
}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 708581fcbde..e339f264b3a 100644
index 6e1ceb90516..370ce03c5d7 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -164,11 +164,16 @@ grub_reboot (void)
@ -96,10 +96,10 @@ index 425bb960347..55ea5a11ccd 100644
grub_reboot ();
}
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index 76661337f10..82012a72fcb 100644
index 65db79baa10..19cd007d448 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -137,9 +137,10 @@ xasprintf (const char *fmt, ...)
@@ -139,9 +139,10 @@ xasprintf (const char *fmt, ...)
#if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
void
@ -139,10 +139,10 @@ index 271b6fbfabd..9fafe98f015 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 0d8ebf58b95..f5423ce27d9 100644
index d483e35eed2..e71d1584164 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -68,7 +68,7 @@ grub_addr_t grub_ieee1275_original_stack;
@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack;
#endif
void
@ -240,10 +240,10 @@ 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 0559c033c3d..fce526d417b 100644
index 782ca72952a..708b060f324 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -549,7 +549,7 @@ grub_machine_init (void)
@@ -584,7 +584,7 @@ grub_machine_init (void)
}
void
@ -253,7 +253,7 @@ index 0559c033c3d..fce526d417b 100644
struct sched_shutdown arg;
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 372f009e84f..83fd69f4ada 100644
index ee48eb7a726..f9135b62e35 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -334,7 +334,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,

View File

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index e92a7ef322f..f8065388213 100644
index eb1088fd654..41b5e16a3ce 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -191,6 +191,7 @@ kernel = {
@@ -203,6 +203,7 @@ kernel = {
efi = term/efi/console.c;
efi = kern/acpi.c;
efi = kern/efi/acpi.c;

View File

@ -1,31 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Tue, 27 Nov 2012 17:18:53 -0200
Date: Mon, 8 Jul 2019 14:10:58 +0200
Subject: [PATCH] DHCP client ID and UUID options added.
---
grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++-----
grub-core/net/bootp.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++-----
include/grub/net.h | 2 ++
2 files changed, 81 insertions(+), 8 deletions(-)
2 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 9e2fdb795f5..f03eeab2fb4 100644
index 04cfbb04504..0e6e41a1699 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -25,6 +25,49 @@
#include <grub/net/udp.h>
#include <grub/datetime.h>
@@ -95,6 +95,49 @@ enum
/* Max timeout when waiting for BOOTP/DHCP reply */
#define GRUB_DHCP_MAX_PACKET_TIMEOUT 32
+static char *
+grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
+ const char *val __attribute__ ((unused)))
+ const char *val __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+static void
+set_env_limn_ro (const char *intername, const char *suffix,
+ const char *value, grub_size_t len)
+ const char *value, grub_size_t len)
+{
+ char *varname, *varvalue;
+ char *ptr;
@ -59,60 +59,58 @@ index 9e2fdb795f5..f03eeab2fb4 100644
+ return val + 'a' - 10;
+}
+
static void
parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
{
@@ -55,6 +98,9 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
taglength = *ptr++;
static const void *
find_dhcp_option (const struct grub_net_bootp_packet *bp, grub_size_t size,
grub_uint8_t opt_code, grub_uint8_t *opt_len)
@@ -152,6 +195,9 @@ again:
if (i + taglength >= size)
return NULL;
+ grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n",
+ tagtype, tagtype, taglength);
+
switch (tagtype)
/* FIXME RFC 3396 options concatentation */
if (tagtype == opt_code)
{
case GRUB_NET_BOOTP_NETMASK:
@@ -120,6 +166,39 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
taglength);
break;
@@ -354,6 +400,37 @@ grub_net_configure_by_dhcp_ack (const char *name,
}
grub_net_add_ipv4_local (inter, mask);
+ case GRUB_NET_BOOTP_CLIENT_ID:
+ set_env_limn_ro (name, "clientid", (char *) ptr, taglength);
+ break;
+ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_ID, &opt_len);
+ if (opt)
+ {
+ set_env_limn_ro (name, "clientid", (char *) opt, opt_len);
+ }
+
+ case GRUB_NET_BOOTP_CLIENT_UUID:
+ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_UUID, &opt_len);
+ if (opt && opt_len == 17)
+ {
+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
+
+ opt += 1;
+ opt_len -= 1;
+
+ char *val = grub_malloc (2 * opt_len + 4 + 1);
+ int i = 0;
+ int j = 0;
+ for (i = 0; i < opt_len; i++)
+ {
+ val[2 * i + j] = hexdigit (opt[i] >> 4);
+ val[2 * i + 1 + j] = hexdigit (opt[i] & 0xf);
+
+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
+ {
+ if (taglength != 17)
+ break;
+
+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
+
+ ptr += 1;
+ taglength -= 1;
+
+ char *val = grub_malloc (2 * taglength + 4 + 1);
+ int i = 0;
+ int j = 0;
+ for (i = 0; i < taglength; i++)
+ {
+ val[2 * i + j] = hexdigit (ptr[i] >> 4);
+ val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf);
+
+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
+ {
+ j++;
+ val[2 * i + 1+ j] = '-';
+ }
+ }
+
+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4);
+ j++;
+ val[2 * i + 1+ j] = '-';
+ }
+ break;
+ }
+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * opt_len + 4);
+ }
+
/* If you need any other options please contact GRUB
development team. */
}
@@ -302,14 +381,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
/* We do not implement dead gateway detection and the first entry SHOULD
be preferred one */
opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_ROUTER, &opt_len);
@@ -631,14 +708,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
}
}
@ -128,15 +126,15 @@ index 9e2fdb795f5..f03eeab2fb4 100644
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
diff --git a/include/grub/net.h b/include/grub/net.h
index 1096b24322e..e266bae23f4 100644
index 4a9069a1474..556c54e579f 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -457,6 +457,8 @@ enum
@@ -462,6 +462,8 @@ enum
GRUB_NET_BOOTP_DOMAIN = 0x0f,
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
+ GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
+ GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
GRUB_NET_BOOTP_END = 0xff
};
GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50,
GRUB_NET_DHCP_OVERLOAD = 52,
GRUB_NET_DHCP_MESSAGE_TYPE = 53,

View File

@ -20,7 +20,7 @@ Resolves: rhbz#1063414
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 61ebd7dc714..87a7da34982 100644
index 4532266be68..58defdbd83f 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -261,7 +261,11 @@ while [ "x$list" != "x" ] ; do

View File

@ -12,10 +12,10 @@ maximum screen size so that text is not overwritten.
create mode 100644 util/grub.d/20_ppc_terminfo.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 3180ac880a9..c7b775bce73 100644
index 969d32f0097..8717774d510 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -487,6 +487,13 @@ script = {
@@ -496,6 +496,13 @@ script = {
condition = COND_HOST_LINUX;
};

View File

@ -41,7 +41,7 @@ index 9cad0c4485c..8ab7794c47b 100644
}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 249e19bc788..759c475c4d9 100644
index 222e239c1be..394bfbea868 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -338,7 +338,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
@ -59,7 +59,7 @@ index 249e19bc788..759c475c4d9 100644
+ {
+ grub_file_t file;
+
+ file = grub_file_open (config);
+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
+ if (file)
+ {
+ grub_file_close (file);

View File

@ -10,7 +10,7 @@ Subject: [PATCH] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested.
3 files changed, 84 insertions(+), 9 deletions(-)
diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
index 9b4e72766ff..02c46f9fdfa 100644
index 4a106ca040b..560d437cdc6 100644
--- a/grub-core/commands/wildcard.c
+++ b/grub-core/commands/wildcard.c
@@ -462,6 +462,12 @@ check_file (const char *dir, const char *basename)
@ -44,7 +44,7 @@ index 9b4e72766ff..02c46f9fdfa 100644
*optr++ = iptr[1];
iptr += 2;
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index d5e10ee8798..0a5b2afb94b 100644
index ed0b149dca5..e0fb0a9e48a 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -20,6 +20,12 @@
@ -75,7 +75,7 @@ index d5e10ee8798..0a5b2afb94b 100644
size++;
else if (*c == ' ')
space = 1;
@@ -85,7 +97,25 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
@@ -86,7 +98,25 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf,
while (*c)
{
@ -103,10 +103,10 @@ index d5e10ee8798..0a5b2afb94b 100644
*buf++ = *c;
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index ab78ca87f90..cf6cd6601d6 100644
index 0d05d6b0709..ba38b5e8aef 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -55,6 +55,12 @@ static struct grub_script_scope *scope = 0;
@@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0;
/* Wildcard translator for GRUB script. */
struct grub_script_wildcard_translator *grub_wildcard_translator;
@ -119,7 +119,7 @@ index ab78ca87f90..cf6cd6601d6 100644
static char*
wildcard_escape (const char *s)
{
@@ -71,7 +77,15 @@ wildcard_escape (const char *s)
@@ -72,7 +78,15 @@ wildcard_escape (const char *s)
i = 0;
while ((ch = *s++))
{
@ -136,7 +136,7 @@ index ab78ca87f90..cf6cd6601d6 100644
p[i++] = '\\';
p[i++] = ch;
}
@@ -95,7 +109,14 @@ wildcard_unescape (const char *s)
@@ -96,7 +110,14 @@ wildcard_unescape (const char *s)
i = 0;
while ((ch = *s++))
{
@ -152,7 +152,7 @@ index ab78ca87f90..cf6cd6601d6 100644
p[i++] = *s++;
else
p[i++] = ch;
@@ -397,10 +418,20 @@ parse_string (const char *str,
@@ -398,10 +419,20 @@ parse_string (const char *str,
switch (*ptr)
{
case '\\':

View File

@ -22,7 +22,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=873406
3 files changed, 135 insertions(+), 4 deletions(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 10773fc3435..0769bf850d3 100644
index d5d726a315e..06454564b8f 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1735,6 +1735,124 @@ grub_net_restore_hw (void)
@ -43,7 +43,7 @@ index 10773fc3435..0769bf850d3 100644
+ grub_dprintf ("net", "probe %s\n", config);
+
+ grub_file_t file;
+ file = grub_file_open (config);
+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
+
+ if (file)
+ {
@ -151,7 +151,7 @@ index 10773fc3435..0769bf850d3 100644
static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 759c475c4d9..b2654ef62e8 100644
index 394bfbea868..9ef98481f70 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -33,6 +33,7 @@
@ -187,10 +187,10 @@ index 759c475c4d9..b2654ef62e8 100644
grub_enter_normal_mode (config);
grub_free (config);
diff --git a/include/grub/net.h b/include/grub/net.h
index e266bae23f4..50d62ab0c8c 100644
index 556c54e579f..ff6d347f7da 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -566,4 +566,7 @@ extern char *grub_net_default_server;
@@ -578,4 +578,7 @@ extern char *grub_net_default_server;
#define VLANTAG_IDENTIFIER 0x8100

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 f8065388213..8bd220a41ba 100644
index 41b5e16a3ce..57e253ab1a1 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -768,6 +768,16 @@ module = {
@@ -811,6 +811,16 @@ module = {
common = commands/blocklist.c;
};
@ -48,7 +48,7 @@ index f8065388213..8bd220a41ba 100644
module = {
name = boot;
common = commands/boot.c;
@@ -929,6 +939,7 @@ module = {
@@ -988,6 +998,7 @@ module = {
module = {
name = loadenv;
common = commands/loadenv.c;
@ -58,7 +58,7 @@ index f8065388213..8bd220a41ba 100644
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
new file mode 100644
index 00000000000..26dbe873fe4
index 00000000000..54458b14518
--- /dev/null
+++ b/grub-core/commands/blscfg.c
@@ -0,0 +1,1096 @@
@ -500,7 +500,7 @@ index 00000000000..26dbe873fe4
+
+ p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename);
+
+ f = grub_file_open (p);
+ f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG);
+ if (!f)
+ goto finish;
+ }
@ -886,7 +886,7 @@ index 00000000000..26dbe873fe4
+ }
+
+ src = grub_xasprintf ("load_video\n"
+ "set gfx_payload=keep\n"
+ "set gfxpayload=keep\n"
+ "insmod gzio\n"
+ "linux %s%s%s%s\n"
+ "%s",
@ -943,8 +943,8 @@ index 00000000000..26dbe873fe4
+ read_entry_info.devid = info->devid;
+
+read_fallback:
+ r = blsdir_fs->dir (blsdir_dev, read_entry_info.dirname, read_entry,
+ &read_entry_info);
+ r = blsdir_fs->fs_dir (blsdir_dev, read_entry_info.dirname, read_entry,
+ &read_entry_info);
+ if (r != 0) {
+ grub_dprintf ("blscfg", "read_entry returned error\n");
+ grub_err_t e;
@ -987,7 +987,7 @@ index 00000000000..26dbe873fe4
+ if (path) {
+ len = grub_strlen (path);
+ if (grub_strcmp (path + len - 5, ".conf") == 0) {
+ rei.file = grub_file_open (path);
+ rei.file = grub_file_open (path, GRUB_FILE_TYPE_CONFIG);
+ if (!rei.file)
+ return grub_errno;
+ /*
@ -1159,7 +1159,7 @@ index 00000000000..26dbe873fe4
+ grub_unregister_extcmd (oldcmd);
+}
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
index b32f3c74cb1..ef8dd74c589 100644
index db7a8f00273..891eac5a33f 100644
--- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c
@@ -133,7 +133,7 @@ legacy_file (const char *filename)
@ -1182,7 +1182,7 @@ index b32f3c74cb1..ef8dd74c589 100644
}
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
index acd93d123ed..91c99456091 100644
index 3fd664aac33..163b9a09042 100644
--- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c
@@ -28,6 +28,8 @@
@ -1194,7 +1194,7 @@ index acd93d123ed..91c99456091 100644
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
@@ -84,81 +86,6 @@ open_envblk_file (char *filename, int untrusted)
@@ -79,81 +81,6 @@ open_envblk_file (char *filename,
return file;
}
@ -1349,7 +1349,7 @@ index 2c5363da7f5..9faf2be0f64 100644
src[len - 1] = ch;
args[argc - 1] = src;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index b2654ef62e8..5116aac6614 100644
index 9ef98481f70..a326b192c89 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -20,6 +20,7 @@

View File

@ -20,7 +20,7 @@ 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 b0a8626dd1c..f68d4925ee6 100644
index 9ecbcfb5b43..c645351dd2a 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -254,7 +254,8 @@ export GRUB_DEFAULT \
@ -34,7 +34,7 @@ index b0a8626dd1c..f68d4925ee6 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 87a7da34982..233754ff296 100644
index 58defdbd83f..dd3128440c4 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -153,6 +153,13 @@ EOF

View File

@ -15,7 +15,7 @@ very appealing.
5 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
index 4880cefe3f8..b22e1bcc94b 100644
index 4d02e62c109..84d520cd494 100644
--- a/grub-core/gettext/gettext.c
+++ b/grub-core/gettext/gettext.c
@@ -434,16 +434,12 @@ static char *
@ -143,7 +143,7 @@ index c1addc0df29..68d31de0c4c 100644
movw $LOCAL(firstlist), %di
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 233754ff296..3a5aa0f8dc9 100644
index dd3128440c4..ceb413fc2e3 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -138,27 +138,20 @@ linux_entry ()

View File

@ -9,7 +9,7 @@ No one cares.
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 5116aac6614..31b624a23cf 100644
index a326b192c89..09d0dfe76f1 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -208,15 +208,16 @@ read_config_file (const char *config)

View File

@ -9,7 +9,7 @@ That is consistent with the menu help text
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 31b624a23cf..7f295e3946b 100644
index 09d0dfe76f1..7f61c5b618b 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -432,8 +432,8 @@ grub_normal_reader_init (int nested)

View File

@ -9,7 +9,7 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 3a5aa0f8dc9..6299836b5cd 100644
index ceb413fc2e3..2b402d85a52 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
@ -25,7 +25,7 @@ index 3a5aa0f8dc9..6299836b5cd 100644
fi
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index e8143b079dc..972a4b5a03d 100644
index 96179ea613c..47e0d3f5cd6 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

@ -8,7 +8,7 @@ Subject: [PATCH] Add .eh_frame to list of relocations stripped
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 311da61c6c5..044ab3abe88 100644
index 6cd71cbb2ab..4ba729e14d8 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding

View File

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index 0a5b2afb94b..970ea868c14 100644
index e0fb0a9e48a..8e2294d8ff6 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -97,16 +97,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
@@ -98,16 +98,7 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf,
while (*c)
{

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 6299836b5cd..b744438e04a 100644
index 2b402d85a52..d35b0f406bc 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"

View File

@ -14,10 +14,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index d2f64b05e0a..5e2f5283d3d 100644
index 9175ad297d8..783bde55b9e 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
@@ -839,12 +839,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
/* Callback invoked immediately before a menu entry is executed. */
static void

View File

@ -122,10 +122,10 @@ Replace a bunch of machine generated ones with ones that look nicer.
create mode 100644 util/grub-sparc64-setup.8
diff --git a/configure.ac b/configure.ac
index 783118ccdcd..d5db2803ec4 100644
index d283af64c8c..8df400e0a8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default])
@@ -74,6 +74,29 @@ grub_TRANSFORM([grub-set-default])
grub_TRANSFORM([grub-sparc64-setup])
grub_TRANSFORM([grub-render-label])
grub_TRANSFORM([grub-file])
@ -156,7 +156,7 @@ index 783118ccdcd..d5db2803ec4 100644
# Optimization flag. Allow user to override.
if test "x$TARGET_CFLAGS" = x; then
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
index b16bd925320..39eb94bded6 100644
index 46c4e95e2fa..58d7d9540be 100644
--- a/conf/Makefile.extra-dist
+++ b/conf/Makefile.extra-dist
@@ -11,7 +11,6 @@ EXTRA_DIST += unicode
@ -498,10 +498,10 @@ index ad25c8ab753..00000000000
-[SEE ALSO]
-.BR grub-menulst2cfg (8)
diff --git a/gentpl.py b/gentpl.py
index da67965a41a..bf8439fa743 100644
index 387588c0589..f05812eace3 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -802,10 +802,7 @@ def manpage(defn, adddeps):
@@ -805,10 +805,7 @@ def manpage(defn, adddeps):
output("if COND_MAN_PAGES\n")
gvar_add("man_MANS", name + "." + mansection)

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 7f295e3946b..231f3f86371 100644
index 7f61c5b618b..8add30e605f 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View File

@ -1,15 +1,15 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 6 Mar 2014 11:51:33 -0500
Date: Mon, 8 Jul 2019 17:33:22 +0200
Subject: [PATCH] Try mac/guid/etc before grub.cfg on tftp config files.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/normal/main.c | 80 ++++++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 37 deletions(-)
grub-core/normal/main.c | 84 ++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 39 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 231f3f86371..cf5c0b273ce 100644
index 8add30e605f..d93bee613ac 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -347,53 +347,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
@ -26,7 +26,7 @@ index 231f3f86371..cf5c0b273ce 100644
- {
- grub_file_t file;
-
- file = grub_file_open (config);
- file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
- if (file)
- {
- grub_file_close (file);
@ -47,65 +47,67 @@ index 231f3f86371..cf5c0b273ce 100644
prefix = grub_env_get ("prefix");
+
if (prefix)
- {
{
- grub_size_t config_len;
- config_len = grub_strlen (prefix) +
- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
- config = grub_malloc (config_len);
+ {
+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
+ {
+ grub_size_t config_len;
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
-
- if (! config)
- goto quit;
+ if (! config)
+ goto quit;
-
- grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
-
if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
- grub_net_search_configfile (config);
+ grub_net_search_configfile (config);
+ {
+ grub_size_t config_len;
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
- grub_enter_normal_mode (config);
- grub_free (config);
+ grub_enter_normal_mode (config);
+ grub_free (config);
+ config = NULL;
+ }
- }
+ if (! config)
+ goto quit;
+
+ if (!config)
+ {
+ config = grub_xasprintf ("%s/grub.cfg", prefix);
+ if (config)
+ {
+ grub_file_t file;
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+
+ file = grub_file_open (config);
+ if (file)
+ {
+ grub_file_close (file);
+ grub_enter_normal_mode (config);
+ }
+ else
+ {
+ /* Ignore all errors. */
+ grub_errno = 0;
+ }
+ grub_free (config);
+ }
+ }
}
+ grub_net_search_configfile (config);
+
+ grub_enter_normal_mode (config);
+ grub_free (config);
+ config = NULL;
+ }
+
+ if (!config)
+ {
+ config = grub_xasprintf ("%s/grub.cfg", prefix);
+ if (config)
+ {
+ grub_file_t file;
+
+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
+ if (file)
+ {
+ grub_file_close (file);
+ grub_enter_normal_mode (config);
+ }
+ else
+ {
+ /* Ignore all errors. */
+ grub_errno = 0;
+ }
+ grub_free (config);
+ }
+ }
+ }
else
- grub_enter_normal_mode (0);
+ {
+ grub_enter_normal_mode (0);
+ }
+ {
+ grub_enter_normal_mode (0);
+ }
}
else
grub_enter_normal_mode (argv[0]);

File diff suppressed because it is too large Load Diff

View File

@ -16,10 +16,10 @@ Reviewed-by: Adam Jackson <ajax@redhat.com>
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/Makefile.util.def b/Makefile.util.def
index c7b775bce73..3efc5718ae8 100644
index 8717774d510..1f298d05f3d 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -231,8 +231,19 @@ program = {
@@ -240,8 +240,19 @@ program = {
common = util/grub-editenv.c;
common = util/editenv.c;
@ -40,7 +40,7 @@ index c7b775bce73..3efc5718ae8 100644
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
diff --git a/util/editenv.c b/util/editenv.c
index c6f8d2298c3..d8d1dad6ab9 100644
index eb2d0c03a98..e61dc1283a4 100644
--- a/util/editenv.c
+++ b/util/editenv.c
@@ -37,6 +37,7 @@ grub_util_create_envblk_file (const char *name)
@ -51,7 +51,7 @@ index c6f8d2298c3..d8d1dad6ab9 100644
buf = xmalloc (DEFAULT_ENVBLK_SIZE);
@@ -59,7 +60,48 @@ grub_util_create_envblk_file (const char *name)
@@ -60,7 +61,48 @@ grub_util_create_envblk_file (const char *name)
free (buf);
fclose (fp);

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 b744438e04a..43d98476b88 100644
index d35b0f406bc..d12d2d784dc 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 3 Oct 2014 11:08:03 -0400
Date: Tue, 9 Jul 2019 10:35:16 +0200
Subject: [PATCH] Try $prefix if $fw_path doesn't work.
Related: rhbz#1148652
@ -13,10 +13,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index f5423ce27d9..e01bc6eab19 100644
index e71d1584164..0cd2a627231 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -124,23 +124,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
@ -56,7 +56,7 @@ index f5423ce27d9..e01bc6eab19 100644
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 0769bf850d3..16d2ce06d5a 100644
index 06454564b8f..4b7972b8e7e 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1850,7 +1850,7 @@ grub_net_search_configfile (char *config)
@ -69,7 +69,7 @@ index 0769bf850d3..16d2ce06d5a 100644
static struct grub_preboot *fini_hnd;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index cf5c0b273ce..ea749f26fd5 100644
index d93bee613ac..2fe6743399d 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -337,74 +337,72 @@ grub_enter_normal_mode (const char *config)
@ -89,31 +89,31 @@ index cf5c0b273ce..ea749f26fd5 100644
+
+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
+ {
+ grub_size_t config_len;
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
+ grub_size_t config_len;
+ config_len = grub_strlen (prefix) +
+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+ config = grub_malloc (config_len);
+
+ if (! config)
+ return GRUB_ERR_FILE_NOT_FOUND;
+ if (! config)
+ return GRUB_ERR_FILE_NOT_FOUND;
+
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+ err = grub_net_search_configfile (config);
+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+ err = grub_net_search_configfile (config);
+ }
+
+ if (err != GRUB_ERR_NONE)
+ {
+ config = grub_xasprintf ("%s/grub.cfg", prefix);
+ if (config)
+ {
+ grub_file_t file;
+ file = grub_file_open (config);
+ if (file)
+ {
+ grub_file_close (file);
+ err = GRUB_ERR_NONE;
+ }
+ }
+ config = grub_xasprintf ("%s/grub.cfg", prefix);
+ if (config)
+ {
+ grub_file_t file;
+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
+ if (file)
+ {
+ grub_file_close (file);
+ err = GRUB_ERR_NONE;
+ }
+ }
+ }
+
+ if (err == GRUB_ERR_NONE)
@ -141,52 +141,52 @@ index cf5c0b273ce..ea749f26fd5 100644
- prefix = grub_env_get ("prefix");
-
- if (prefix)
- {
- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
- {
- grub_size_t config_len;
- config_len = grub_strlen (prefix) +
- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
- config = grub_malloc (config_len);
- {
- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
- {
- grub_size_t config_len;
- config_len = grub_strlen (prefix) +
- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
- config = grub_malloc (config_len);
-
- if (! config)
- goto quit;
- if (! config)
- goto quit;
-
- grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
- grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
-
- grub_net_search_configfile (config);
- grub_net_search_configfile (config);
-
- grub_enter_normal_mode (config);
- grub_free (config);
- config = NULL;
- }
- grub_enter_normal_mode (config);
- grub_free (config);
- config = NULL;
- }
-
- if (!config)
- {
- config = grub_xasprintf ("%s/grub.cfg", prefix);
- if (config)
- {
- grub_file_t file;
- if (!config)
- {
- config = grub_xasprintf ("%s/grub.cfg", prefix);
- if (config)
- {
- grub_file_t file;
-
- file = grub_file_open (config);
- if (file)
- {
- grub_file_close (file);
- grub_enter_normal_mode (config);
- }
- else
- {
- /* Ignore all errors. */
- grub_errno = 0;
- }
- grub_free (config);
- }
- }
- }
- file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
- if (file)
- {
- grub_file_close (file);
- grub_enter_normal_mode (config);
- }
- else
- {
- /* Ignore all errors. */
- grub_errno = 0;
- }
- grub_free (config);
- }
- }
- }
- else
- {
- grub_enter_normal_mode (0);
- }
- {
- grub_enter_normal_mode (0);
- }
- }
- else
+ if (argc)

View File

@ -12,7 +12,7 @@ Resolves rhbz#1148650
1 file changed, 42 insertions(+)
diff --git a/docs/grub.texi b/docs/grub.texi
index 2fd32608c01..a7155c22ffe 100644
index 6f524305085..221064b5679 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -2493,6 +2493,48 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38

View File

@ -17,18 +17,17 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
configure.ac | 29 +++++
Makefile.util.def | 16 +++
util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++
.gitignore | 2 +
util/grub-mkconfig_lib.in | 11 +-
util/grub-rpm-sort.8 | 12 ++
6 files changed, 350 insertions(+), 1 deletion(-)
5 files changed, 348 insertions(+), 1 deletion(-)
create mode 100644 util/grub-rpm-sort.c
create mode 100644 util/grub-rpm-sort.8
diff --git a/configure.ac b/configure.ac
index d5db2803ec4..00f1db29b1a 100644
index 8df400e0a8b..6927615819b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
@ -36,7 +35,7 @@ index d5db2803ec4..00f1db29b1a 100644
grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default])
grub_TRANSFORM([grub-sparc64-setup])
@@ -88,6 +89,7 @@ grub_TRANSFORM([grub-mkrescue.1])
@@ -92,6 +93,7 @@ grub_TRANSFORM([grub-mkrescue.1])
grub_TRANSFORM([grub-mkstandalone.3])
grub_TRANSFORM([grub-ofpathname.3])
grub_TRANSFORM([grub-probe.3])
@ -44,7 +43,7 @@ index d5db2803ec4..00f1db29b1a 100644
grub_TRANSFORM([grub-reboot.3])
grub_TRANSFORM([grub-render-label.3])
grub_TRANSFORM([grub-script-check.3])
@@ -1790,6 +1792,33 @@ fi
@@ -1802,6 +1804,33 @@ fi
AC_SUBST([LIBDEVMAPPER])
@ -79,10 +78,10 @@ index d5db2803ec4..00f1db29b1a 100644
if test x$host_kernel = xkfreebsd; then
AC_CHECK_LIB([geom], [geom_gettree], [],
diff --git a/Makefile.util.def b/Makefile.util.def
index 3efc5718ae8..bb21c87c8ed 100644
index 1f298d05f3d..843ce092b94 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -687,6 +687,22 @@ program = {
@@ -696,6 +696,22 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -97,8 +96,8 @@ index 3efc5718ae8..bb21c87c8ed 100644
+ common = util/misc.c;
+ common = util/grub-rpm-sort.c;
+
+ ldadd = grub-core/gnulib/libgnu.a;
+ ldadd = libgrubkern.a;
+ ldadd = grub-core/lib/gnulib/libgnu.a;
+ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)';
+};
+
@ -392,19 +391,6 @@ index 00000000000..f33bd1ed568
+
+ return 0;
+}
diff --git a/.gitignore b/.gitignore
index 43f04d47277..fa2e5b609b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,6 +105,8 @@ grub-*.tar.*
/grub*-reboot.8
/grub*-render-label
/grub*-render-label.1
+/grub*-rpm-sort
+/grub*-rpm-sort.8
/grub*-script-check
/grub*-script-check.1
/grub*-set-default
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 1a4a57898f9..113a41f9409 100644
--- a/util/grub-mkconfig_lib.in

View File

@ -12,7 +12,7 @@ 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 43d98476b88..a8a8e2cf325 100644
index d12d2d784dc..12a20c9ad73 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -78,6 +78,32 @@ case x"$GRUB_FS" in

View File

@ -17,21 +17,20 @@ Andy Lutomirski <luto@kernel.org>
---
configure.ac | 1 +
Makefile.util.def | 13 +++++
.gitignore | 2 +
util/grub-mkconfig.in | 2 +
util/grub-set-password.8 | 28 ++++++++++
util/grub-set-password.in | 128 ++++++++++++++++++++++++++++++++++++++++++++++
util/grub.d/01_users.in | 11 ++++
7 files changed, 185 insertions(+)
6 files changed, 183 insertions(+)
create mode 100644 util/grub-set-password.8
create mode 100644 util/grub-set-password.in
create mode 100644 util/grub.d/01_users.in
diff --git a/configure.ac b/configure.ac
index 00f1db29b1a..1cb6a9615db 100644
index 6927615819b..68501662e8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
@ -40,10 +39,10 @@ index 00f1db29b1a..1cb6a9615db 100644
grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default])
diff --git a/Makefile.util.def b/Makefile.util.def
index bb21c87c8ed..7729e65c607 100644
index 843ce092b94..e50436a4987 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -442,6 +442,12 @@ script = {
@@ -451,6 +451,12 @@ script = {
installdir = grubconf;
};
@ -56,7 +55,7 @@ index bb21c87c8ed..7729e65c607 100644
script = {
name = '10_windows';
common = util/grub.d/10_windows.in;
@@ -724,6 +730,13 @@ script = {
@@ -733,6 +739,13 @@ script = {
installdir = sbin;
};
@ -70,21 +69,8 @@ index bb21c87c8ed..7729e65c607 100644
script = {
name = grub-mkconfig_lib;
common = util/grub-mkconfig_lib.in;
diff --git a/.gitignore b/.gitignore
index fa2e5b609b1..141684867d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,6 +111,8 @@ grub-*.tar.*
/grub*-script-check.1
/grub*-set-default
/grub*-set-default.8
+/grub*-set-password
+/grub*-set-password.8
/grub*-shell
/grub*-shell-tester
/grub*-sparc64-setup
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index f68d4925ee6..bdb9982aefb 100644
index c645351dd2a..4e7a875309e 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -282,6 +282,8 @@ for i in "${grub_mkconfig_dir}"/* ; do

View File

@ -20,10 +20,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/net/url.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 8bd220a41ba..d0c8a8b1908 100644
index 57e253ab1a1..99466b1e47e 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2188,6 +2188,7 @@ module = {
@@ -2284,6 +2284,7 @@ module = {
common = net/ethernet.c;
common = net/arp.c;
common = net/netbuff.c;
@ -923,7 +923,7 @@ index 00000000000..146858284cd
+}
+#endif
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 83fd69f4ada..fcaf1201e39 100644
index f9135b62e35..b4339222ecb 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -85,6 +85,7 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 8 Jun 2016 21:03:37 -0400
Date: Tue, 9 Jul 2019 11:47:37 +0200
Subject: [PATCH] efinet and bootp: add support for dhcpv6
Signed-off-by: Peter Jones <pjones@redhat.com>
@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
6 files changed, 479 insertions(+), 14 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index f03eeab2fb4..da3e454466b 100644
index 0e6e41a1699..8c969595a7b 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -23,6 +23,7 @@
@ -24,10 +24,10 @@ index f03eeab2fb4..da3e454466b 100644
+#include <grub/net/url.h>
#include <grub/datetime.h>
static char *
@@ -349,6 +350,179 @@ grub_net_configure_by_dhcp_ack (const char *name,
return inter;
}
struct grub_dhcp_discover_options
@@ -935,6 +936,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
+struct grub_net_network_level_interface *
+grub_net_configure_by_dhcpv6_ack (const char *name,
@ -203,8 +203,8 @@ index f03eeab2fb4..da3e454466b 100644
+
+
void
grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_card *card)
grub_bootp_init (void)
{
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5388f952ba9..a57189e8bb3 100644
--- a/grub-core/net/drivers/efi/efinet.c
@ -316,7 +316,7 @@ index 5388f952ba9..a57189e8bb3 100644
}
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 16d2ce06d5a..4be228d9576 100644
index 4b7972b8e7e..f24f1fd63f6 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -955,6 +955,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
@ -427,7 +427,7 @@ index 7d90bf66e76..1157524fc50 100644
grub_free (data);
return grub_errno;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index c7c9f0e1db1..28b6adf7648 100644
index addcbfa8fb7..d97cdf98c80 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -572,10 +572,16 @@ typedef void *grub_efi_handle_t;
@ -582,10 +582,10 @@ index c7c9f0e1db1..28b6adf7648 100644
typedef struct grub_efi_pxe
diff --git a/include/grub/net.h b/include/grub/net.h
index 50d62ab0c8c..f8f3ec13acc 100644
index ff6d347f7da..3647012374b 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -442,6 +442,51 @@ struct grub_net_bootp_packet
@@ -447,6 +447,51 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -637,7 +637,7 @@ index 50d62ab0c8c..f8f3ec13acc 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
@@ -470,6 +515,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

@ -13,21 +13,20 @@ Resolves: rhbz#1226325
---
configure.ac | 2 +
Makefile.util.def | 7 ++
.gitignore | 2 +
util/bash-completion.d/grub-completion.bash.in | 22 +++++++
util/grub-get-kernel-settings.3 | 20 ++++++
util/grub-get-kernel-settings.in | 88 ++++++++++++++++++++++++++
util/grub-mkconfig.in | 3 +
util/grub.d/10_linux.in | 23 +++++--
8 files changed, 162 insertions(+), 5 deletions(-)
7 files changed, 160 insertions(+), 5 deletions(-)
create mode 100644 util/grub-get-kernel-settings.3
create mode 100644 util/grub-get-kernel-settings.in
diff --git a/configure.ac b/configure.ac
index 1cb6a9615db..2a6fde5be81 100644
index 68501662e8d..fc3c2b44d60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install])
@@ -62,6 +62,7 @@ grub_TRANSFORM([grub-install])
grub_TRANSFORM([grub-mkconfig])
grub_TRANSFORM([grub-mkfont])
grub_TRANSFORM([grub-mkimage])
@ -35,7 +34,7 @@ index 1cb6a9615db..2a6fde5be81 100644
grub_TRANSFORM([grub-glue-efi])
grub_TRANSFORM([grub-mklayout])
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
@@ -75,6 +76,7 @@ grub_TRANSFORM([grub-file])
@@ -79,6 +80,7 @@ grub_TRANSFORM([grub-file])
grub_TRANSFORM([grub-bios-setup.3])
grub_TRANSFORM([grub-editenv.1])
grub_TRANSFORM([grub-fstest.3])
@ -44,10 +43,10 @@ index 1cb6a9615db..2a6fde5be81 100644
grub_TRANSFORM([grub-install.1])
grub_TRANSFORM([grub-kbdcomp.3])
diff --git a/Makefile.util.def b/Makefile.util.def
index 7729e65c607..c39b3ce6aa9 100644
index e50436a4987..2215cc759c0 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -716,6 +716,13 @@ script = {
@@ -725,6 +725,13 @@ script = {
installdir = sbin;
};
@ -61,19 +60,6 @@ index 7729e65c607..c39b3ce6aa9 100644
script = {
name = grub-set-default;
common = util/grub-set-default.in;
diff --git a/.gitignore b/.gitignore
index 141684867d1..096eeff7de8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,6 +68,8 @@ grub-*.tar.*
/grub*-fs-tester
/grub*-fstest
/grub*-fstest.1
+/grub*-get-kernel-settings
+/grub*-get-kernel-settings.3
/grub*-glue-efi
/grub*-glue-efi.1
/grub*-install
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 44bf135b9f8..5c4acd496d4 100644
--- a/util/bash-completion.d/grub-completion.bash.in
@ -228,7 +214,7 @@ index 00000000000..7e87dfccc0e
+ echo export GRUB_UPDATE_DEFAULT_KERNEL
+fi
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index bdb9982aefb..8218f3d477f 100644
index 4e7a875309e..6247a0ba850 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@"
@ -249,7 +235,7 @@ index bdb9982aefb..8218f3d477f 100644
if [ -z "$GRUB_DEVICE_UUID" ]; then
GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index a8a8e2cf325..4e49ccdf742 100644
index 12a20c9ad73..55f4aa783cf 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -111,7 +111,8 @@ linux_entry ()

View File

@ -30,7 +30,7 @@ The count of zero with __builtin_clz can be 22. (clz counts the number of one bi
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 002446be1c3..3df75357a70 100644
index ac4e62a95c9..3860b6f78d8 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,

View File

@ -13,10 +13,10 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
create mode 100644 grub-core/lib/arm64/backtrace.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index d0c8a8b1908..8bb5eb0f47f 100644
index 99466b1e47e..ebc558019cd 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -175,6 +175,9 @@ kernel = {
@@ -186,6 +186,9 @@ kernel = {
softdiv = lib/division.c;
@ -25,7 +25,7 @@ index d0c8a8b1908..8bb5eb0f47f 100644
+
i386 = kern/i386/dl.c;
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 1c560ea570a..04371ac49f2 100644
--- a/grub-core/kern/misc.c

View File

@ -13,10 +13,10 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed.
create mode 100644 util/grub-syslinux2cfg.1
diff --git a/configure.ac b/configure.ac
index 2a6fde5be81..9318c281108 100644
index fc3c2b44d60..eb851b8d722 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3])
@@ -84,6 +84,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3])
grub_TRANSFORM([grub-glue-efi.3])
grub_TRANSFORM([grub-install.1])
grub_TRANSFORM([grub-kbdcomp.3])
@ -24,7 +24,7 @@ index 2a6fde5be81..9318c281108 100644
grub_TRANSFORM([grub-menulst2cfg.1])
grub_TRANSFORM([grub-mkconfig.1])
grub_TRANSFORM([grub-mkfont.3])
@@ -98,6 +99,7 @@ grub_TRANSFORM([grub-render-label.3])
@@ -102,6 +103,7 @@ grub_TRANSFORM([grub-render-label.3])
grub_TRANSFORM([grub-script-check.3])
grub_TRANSFORM([grub-set-default.1])
grub_TRANSFORM([grub-sparc64-setup.3])

View File

@ -14,10 +14,10 @@ make sure they exist.
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index a1ac7a38867..93b5cd306eb 100644
index 04994d5c67d..4c0a09c06de 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -80,7 +80,21 @@ finalize_params_linux (void)
@@ -81,7 +81,21 @@ finalize_params_linux (void)
node = grub_fdt_find_subnode (fdt, 0, "chosen");
if (node < 0)

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 6 May 2016 18:43:08 -0400
Date: Tue, 9 Jul 2019 12:59:58 +0200
Subject: [PATCH] Make our info pages say "grub2" where appropriate.
This needs to be hooked up to --program-transform=, but I haven't had
@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 161 insertions(+), 161 deletions(-)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index a9f4de6318c..3ce827ab726 100644
index ee389fd83c3..e3fed7312a3 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -1,7 +1,7 @@
@ -35,7 +35,7 @@ index a9f4de6318c..3ce827ab726 100644
@setchapternewpage odd
diff --git a/docs/grub.texi b/docs/grub.texi
index a7155c22ffe..2b7b7faf847 100644
index 221064b5679..960e5f3ba41 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1,7 +1,7 @@
@ -609,7 +609,7 @@ index a7155c22ffe..2b7b7faf847 100644
@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
@@ -4396,7 +4396,7 @@ Translate @var{string} into the current language.
@@ -4398,7 +4398,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
@ -618,7 +618,7 @@ index a7155c22ffe..2b7b7faf847 100644
@end deffn
@@ -4791,7 +4791,7 @@ Define a user named @var{user} with password @var{clear-password}.
@@ -4793,7 +4793,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}.
@ -627,7 +627,7 @@ index a7155c22ffe..2b7b7faf847 100644
to generate password hashes. @xref{Security}.
@end deffn
@@ -5614,8 +5614,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
@@ -5651,8 +5651,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
@ -638,7 +638,7 @@ index a7155c22ffe..2b7b7faf847 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,
@@ -5659,7 +5659,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@@ -5696,7 +5696,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@end group
@end example
@ -647,7 +647,7 @@ index a7155c22ffe..2b7b7faf847 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}
@@ -5684,15 +5684,15 @@ verified with a public key currently trusted by GRUB
@@ -5721,15 +5721,15 @@ verified with a public key currently trusted by GRUB
validation fails, then file @file{foo} cannot be opened. This failure
may halt or otherwise impact the boot process.
@ -668,7 +668,7 @@ index a7155c22ffe..2b7b7faf847 100644
GRUB uses GPG-style detached signatures (meaning that a file
@file{foo.sig} will be produced when file @file{foo} is signed), and
@@ -5712,8 +5712,8 @@ gpg --detach-sign /path/to/file
@@ -5749,8 +5749,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
@ -679,7 +679,7 @@ index a7155c22ffe..2b7b7faf847 100644
@example
@group
@@ -5735,7 +5735,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
@@ -5772,7 +5772,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
@ -688,7 +688,7 @@ index a7155c22ffe..2b7b7faf847 100644
equal to @code{enforce} in @file{core.img} prior to processing any
configuration files.
@@ -6092,10 +6092,10 @@ Required files are:
@@ -6189,10 +6189,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
@ -701,7 +701,7 @@ index a7155c22ffe..2b7b7faf847 100644
things GRUB is supposed to do.
If, instead, you only get a rescue shell, this usually means that GRUB
@@ -6121,8 +6121,8 @@ normal
@@ -6218,8 +6218,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
@ -712,7 +712,7 @@ index a7155c22ffe..2b7b7faf847 100644
@itemize @bullet{}
@item
@@ -6134,7 +6134,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
@@ -6231,7 +6231,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
drive ordering entirely.
@item
@ -721,8 +721,8 @@ index a7155c22ffe..2b7b7faf847 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.
@@ -6154,21 +6154,21 @@ support has not yet been added to GRUB.
@end itemize
@@ -6262,21 +6262,21 @@ entry which claims partition start at block 0. This change will not hamper
bootability on other machines.
-@node Invoking grub-install
@ -749,7 +749,7 @@ index a7155c22ffe..2b7b7faf847 100644
@table @option
@item --help
@@ -6184,13 +6184,13 @@ separate partition or a removable disk.
@@ -6292,13 +6292,13 @@ separate partition or a removable disk.
If this option is not specified then it defaults to @file{/boot}, so
@example
@ -765,7 +765,7 @@ index a7155c22ffe..2b7b7faf847 100644
@end example
Here is an example in which you have a separate @dfn{boot} partition which is
@@ -6198,16 +6198,16 @@ mounted on
@@ -6306,16 +6306,16 @@ mounted on
@file{/mnt/boot}:
@example
@ -785,7 +785,7 @@ index a7155c22ffe..2b7b7faf847 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
@@ -6220,17 +6220,17 @@ installation}) where GRUB does not reside in any unpartitioned space
@@ -6328,17 +6328,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
@ -808,7 +808,7 @@ index a7155c22ffe..2b7b7faf847 100644
@table @option
@item --help
@@ -6246,17 +6246,17 @@ it to standard output.
@@ -6354,17 +6354,17 @@ it to standard output.
@end table
@ -830,7 +830,7 @@ index a7155c22ffe..2b7b7faf847 100644
@table @option
@item -c @var{number}
@@ -6274,23 +6274,23 @@ Length of the salt. Defaults to 64.
@@ -6382,23 +6382,23 @@ Length of the salt. Defaults to 64.
@end table
@ -860,7 +860,7 @@ index a7155c22ffe..2b7b7faf847 100644
@table @option
@item --help
@@ -6301,17 +6301,17 @@ Print the version number of GRUB and exit.
@@ -6409,17 +6409,17 @@ Print the version number of GRUB and exit.
@end table
@ -882,7 +882,7 @@ index a7155c22ffe..2b7b7faf847 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
@@ -6326,7 +6326,7 @@ mkdir -p disk/boot/grub
@@ -6434,7 +6434,7 @@ mkdir -p disk/boot/grub
grub-mkrescue -o grub.iso disk
@end example
@ -891,7 +891,7 @@ index a7155c22ffe..2b7b7faf847 100644
@table @option
@item --help
@@ -6354,15 +6354,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
@@ -6462,15 +6462,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
default.
@item --grub-mkimage=@var{file}
@ -911,7 +911,7 @@ index a7155c22ffe..2b7b7faf847 100644
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:
@@ -6394,13 +6394,13 @@ even if nobody has yet written a FUSE module specifically for that file
@@ -6502,13 +6502,13 @@ even if nobody has yet written a FUSE module specifically for that file
system type.
@end itemize
@ -927,7 +927,7 @@ index a7155c22ffe..2b7b7faf847 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:
@@ -6422,13 +6422,13 @@ Show debugging output for conditions matching @var{string}.
@@ -6530,13 +6530,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,
@ -943,7 +943,7 @@ index a7155c22ffe..2b7b7faf847 100644
root of the supplied file system.
If @var{device} is just a number, then it will be treated as a partition
@@ -6446,10 +6446,10 @@ Print verbose messages.
@@ -6554,10 +6554,10 @@ Print verbose messages.
@end table
@ -957,7 +957,7 @@ index a7155c22ffe..2b7b7faf847 100644
or device.
@example
@@ -6457,7 +6457,7 @@ grub-probe --target=fs /boot/grub
@@ -6565,7 +6565,7 @@ grub-probe --target=fs /boot/grub
grub-probe --target=drive --device /dev/sda1
@end example
@ -966,7 +966,7 @@ index a7155c22ffe..2b7b7faf847 100644
argument, and also accepts the following options:
@table @option
@@ -6470,16 +6470,16 @@ Print the version number of GRUB and exit.
@@ -6578,16 +6578,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
@ -986,7 +986,7 @@ index a7155c22ffe..2b7b7faf847 100644
@item -t @var{target}
@itemx --target=@var{target}
@@ -6532,19 +6532,19 @@ Print verbose messages.
@@ -6640,19 +6640,19 @@ Print verbose messages.
@end table

View File

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index e339f264b3a..562d6887e0e 100644
index 370ce03c5d7..a1af9b46559 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -313,13 +313,23 @@ grub_efi_modules_addr (void)

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney <jeffm@suse.com>
Date: Wed, 18 Dec 2013 09:57:04 +0000
Date: Tue, 9 Jul 2019 13:39:45 +0200
Subject: [PATCH] grub2/btrfs: Add ability to boot from subvolumes
This patch adds the ability to specify a different root on a btrfs
@ -24,20 +24,20 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
2 files changed, 533 insertions(+), 20 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index be195448dbe..51ed63d429b 100644
index 48bd3d04a5e..6823d9765c4 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -29,6 +29,9 @@
#include <minilzo.h>
@@ -38,6 +38,9 @@
#include <zstd.h>
#include <grub/i18n.h>
#include <grub/btrfs.h>
+#include <grub/command.h>
+#include <grub/env.h>
+#include <grub/extcmd.h>
#include <grub/crypto.h>
#include <grub/diskfilter.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -64,9 +67,11 @@ struct grub_btrfs_superblock
@@ -78,9 +81,11 @@ struct grub_btrfs_superblock
grub_uint64_t generation;
grub_uint64_t root_tree;
grub_uint64_t chunk_tree;
@ -51,7 +51,7 @@ index be195448dbe..51ed63d429b 100644
struct grub_btrfs_device this_device;
char label[0x100];
grub_uint8_t dummy4[0x100];
@@ -105,6 +110,7 @@ struct grub_btrfs_data
@@ -120,6 +125,7 @@ struct grub_btrfs_data
grub_uint64_t exttree;
grub_size_t extsize;
struct grub_btrfs_extent_data *extent;
@ -59,7 +59,7 @@ index be195448dbe..51ed63d429b 100644
};
struct grub_btrfs_chunk_item
@@ -171,6 +177,14 @@ struct grub_btrfs_leaf_descriptor
@@ -188,6 +194,14 @@ struct grub_btrfs_leaf_descriptor
} *data;
};
@ -74,7 +74,7 @@ index be195448dbe..51ed63d429b 100644
struct grub_btrfs_time
{
grub_int64_t sec;
@@ -215,6 +229,14 @@ struct grub_btrfs_extent_data
@@ -233,6 +247,14 @@ struct grub_btrfs_extent_data
#define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100
@ -89,7 +89,7 @@ index be195448dbe..51ed63d429b 100644
static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2,
256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2
};
@@ -837,6 +859,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
@@ -1153,6 +1175,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
return GRUB_ERR_NONE;
}
@ -152,7 +152,7 @@ index be195448dbe..51ed63d429b 100644
static struct grub_btrfs_data *
grub_btrfs_mount (grub_device_t dev)
{
@@ -872,6 +950,13 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1188,6 +1266,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 be195448dbe..51ed63d429b 100644
return data;
}
@@ -1232,6 +1317,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
@@ -1653,6 +1738,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
return GRUB_ERR_NONE;
}
@ -258,7 +258,7 @@ index be195448dbe..51ed63d429b 100644
static grub_err_t
find_path (struct grub_btrfs_data *data,
const char *path, struct grub_btrfs_key *key,
@@ -1250,14 +1420,26 @@ find_path (struct grub_btrfs_data *data,
@@ -1671,14 +1841,26 @@ find_path (struct grub_btrfs_data *data,
char *origpath = NULL;
unsigned symlinks_max = 32;
@ -289,7 +289,7 @@ index be195448dbe..51ed63d429b 100644
while (1)
{
while (path[0] == '/')
@@ -1430,9 +1612,21 @@ find_path (struct grub_btrfs_data *data,
@@ -1851,9 +2033,21 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
@ -314,7 +314,7 @@ index be195448dbe..51ed63d429b 100644
}
continue;
}
@@ -1673,18 +1867,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
@@ -2094,18 +2288,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
data->tree, file->offset, buf, len);
}
@ -336,7 +336,7 @@ index be195448dbe..51ed63d429b 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]),
@@ -1693,6 +1879,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
@@ -2114,6 +2300,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]));
@ -357,7 +357,7 @@ index be195448dbe..51ed63d429b 100644
grub_btrfs_unmount (data);
@@ -1749,6 +1949,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
@@ -2170,6 +2370,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
}
#endif
@ -599,8 +599,8 @@ index be195448dbe..51ed63d429b 100644
+
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.dir = grub_btrfs_dir,
@@ -1764,12 +2200,88 @@ static struct grub_fs grub_btrfs_fs = {
.fs_dir = grub_btrfs_dir,
@@ -2185,12 +2621,88 @@ static struct grub_fs grub_btrfs_fs = {
#endif
};

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 51ed63d429b..88d727d161f 100644
index 6823d9765c4..2d099b18ea1 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2273,6 +2273,8 @@ GRUB_MOD_INIT (btrfs)
@@ -2694,6 +2694,8 @@ GRUB_MOD_INIT (btrfs)
subvol_set_env);
grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env,
subvolid_set_env);

View File

@ -8,10 +8,10 @@ Subject: [PATCH] grub2-btrfs-03-follow_default
1 file changed, 76 insertions(+), 31 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 88d727d161f..a47d297567f 100644
index 2d099b18ea1..2db89f71ea5 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -920,6 +920,7 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1236,6 +1236,7 @@ grub_btrfs_mount (grub_device_t dev)
{
struct grub_btrfs_data *data;
grub_err_t err;
@ -19,7 +19,7 @@ index 88d727d161f..a47d297567f 100644
if (!dev->disk)
{
@@ -950,11 +951,14 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1266,11 +1267,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;
@ -38,7 +38,7 @@ index 88d727d161f..a47d297567f 100644
}
return data;
@@ -1414,24 +1418,39 @@ find_path (struct grub_btrfs_data *data,
@@ -1835,24 +1839,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;
@ -85,7 +85,7 @@ index 88d727d161f..a47d297567f 100644
}
else
{
@@ -1442,15 +1461,23 @@ find_path (struct grub_btrfs_data *data,
@@ -1863,15 +1882,23 @@ find_path (struct grub_btrfs_data *data,
while (1)
{
@ -118,7 +118,7 @@ index 88d727d161f..a47d297567f 100644
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
{
@@ -1461,7 +1488,9 @@ find_path (struct grub_btrfs_data *data,
@@ -1882,7 +1909,9 @@ find_path (struct grub_btrfs_data *data,
if (ctokenlen == 1 && ctoken[0] == '.')
{
@ -129,7 +129,7 @@ index 88d727d161f..a47d297567f 100644
continue;
}
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
@@ -1492,8 +1521,9 @@ find_path (struct grub_btrfs_data *data,
@@ -1913,8 +1942,9 @@ find_path (struct grub_btrfs_data *data,
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
key->object_id = key_out.offset;
@ -141,7 +141,7 @@ index 88d727d161f..a47d297567f 100644
continue;
}
@@ -1562,7 +1592,9 @@ find_path (struct grub_btrfs_data *data,
@@ -1983,7 +2013,9 @@ find_path (struct grub_btrfs_data *data,
return err;
}
@ -152,7 +152,7 @@ index 88d727d161f..a47d297567f 100644
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
{
struct grub_btrfs_inode inode;
@@ -1612,14 +1644,26 @@ find_path (struct grub_btrfs_data *data,
@@ -2033,14 +2065,26 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
@ -186,7 +186,7 @@ index 88d727d161f..a47d297567f 100644
}
else
{
@@ -2275,6 +2319,7 @@ GRUB_MOD_INIT (btrfs)
@@ -2696,6 +2740,7 @@ GRUB_MOD_INIT (btrfs)
subvolid_set_env);
grub_env_export ("btrfs_subvol");
grub_env_export ("btrfs_subvolid");

View File

@ -94,10 +94,10 @@ index ebcdd8f5e22..f044a880a76 100644
sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0)
{
diff --git a/util/grub-install.c b/util/grub-install.c
index 78d0138cb0a..4375c161955 100644
index 8a55ad4b8dc..0e807b09c36 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -816,6 +816,8 @@ fill_core_services (const char *core_services)
@@ -819,6 +819,8 @@ fill_core_services (const char *core_services)
free (sysv_plist);
}
@ -106,7 +106,7 @@ index 78d0138cb0a..4375c161955 100644
int
main (int argc, char *argv[])
{
@@ -849,6 +851,9 @@ main (int argc, char *argv[])
@@ -852,6 +854,9 @@ main (int argc, char *argv[])
grub_util_load_config (&config);
@ -116,7 +116,7 @@ index 78d0138cb0a..4375c161955 100644
if (!bootloader_id && config.grub_distributor)
{
char *ptr;
@@ -1321,6 +1326,16 @@ main (int argc, char *argv[])
@@ -1344,6 +1349,16 @@ main (int argc, char *argv[])
fprintf (load_cfg_f, "set debug='%s'\n",
debug_image);
}

View File

@ -13,7 +13,7 @@ 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 8218f3d477f..4248b9341ab 100644
index 6247a0ba850..4649e92eb0f 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -258,7 +258,8 @@ export GRUB_DEFAULT \
@ -90,7 +90,7 @@ index 858b526c925..de727e6ee6b 100644
+EOF
+fi
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 4e49ccdf742..d9a05937e46 100644
index 55f4aa783cf..5cab299dc08 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -66,10 +66,14 @@ fi
@ -109,7 +109,7 @@ index 4e49ccdf742..d9a05937e46 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 972a4b5a03d..bcdc3ceac02 100644
index 47e0d3f5cd6..1519ec692fe 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -73,10 +73,14 @@ fi

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Fri, 22 May 2015 11:45:25 +0000
Date: Tue, 9 Jul 2019 13:56:16 +0200
Subject: [PATCH] grub2-btrfs-06-subvol-mount
---
@ -11,18 +11,18 @@ Subject: [PATCH] grub2-btrfs-06-subvol-mount
4 files changed, 392 insertions(+), 5 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index a47d297567f..2e36ac47e8a 100644
index 2db89f71ea5..162723423ca 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -32,6 +32,7 @@
@@ -41,6 +41,7 @@
#include <grub/command.h>
#include <grub/env.h>
#include <grub/extcmd.h>
+#include <grub/list.h>
#include <grub/crypto.h>
#include <grub/diskfilter.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -245,6 +246,12 @@ static grub_err_t
@@ -263,6 +264,12 @@ static grub_err_t
grub_btrfs_read_logical (struct grub_btrfs_data *data,
grub_disk_addr_t addr, void *buf, grub_size_t size,
int recursion_depth);
@ -35,7 +35,7 @@ index a47d297567f..2e36ac47e8a 100644
static grub_err_t
read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb)
@@ -887,9 +894,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1203,9 +1210,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;
@ -62,7 +62,7 @@ index a47d297567f..2e36ac47e8a 100644
if (err)
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
@@ -1758,11 +1782,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
@@ -2179,11 +2203,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
int r = 0;
grub_uint64_t tree;
grub_uint8_t type;
@ -84,7 +84,7 @@ index a47d297567f..2e36ac47e8a 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -1864,11 +1897,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
@@ -2285,11 +2318,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;
@ -107,7 +107,7 @@ index a47d297567f..2e36ac47e8a 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -2039,6 +2082,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
@@ -2460,6 +2503,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
return 0;
}
@ -258,7 +258,7 @@ index a47d297567f..2e36ac47e8a 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,
@@ -2245,6 +2432,7 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2666,6 +2853,7 @@ static struct grub_fs grub_btrfs_fs = {
};
static grub_command_t cmd_info;
@ -266,7 +266,7 @@ index a47d297567f..2e36ac47e8a 100644
static grub_extcmd_t cmd_list_subvols;
static char *
@@ -2308,6 +2496,9 @@ GRUB_MOD_INIT (btrfs)
@@ -2729,6 +2917,9 @@ GRUB_MOD_INIT (btrfs)
cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
"DEVICE",
"Print BtrFS info about DEVICE.");
@ -460,10 +460,10 @@ index 5d50dd6f8dc..4c5a13022dc 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 4375c161955..a0ad99729fd 100644
index 0e807b09c36..3e718b9e3fb 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1535,6 +1535,55 @@ main (int argc, char *argv[])
@@ -1561,6 +1561,55 @@ main (int argc, char *argv[])
prefix_drive = xasprintf ("(%s)", grub_drives[0]);
}

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 2e36ac47e8a..4a31d39ee74 100644
index 162723423ca..69c30e62354 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -924,11 +924,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1240,11 +1240,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
return GRUB_ERR_NONE;
}

View File

@ -8,10 +8,10 @@ Subject: [PATCH] Grub not working correctly with btrfs snapshots (bsc#1026511)
1 file changed, 238 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 4a31d39ee74..7002ad81b7e 100644
index 69c30e62354..ba99d04f8ed 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2446,6 +2446,238 @@ out:
@@ -2867,6 +2867,238 @@ out:
return 0;
}
@ -249,8 +249,8 @@ index 4a31d39ee74..7002ad81b7e 100644
+
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.dir = grub_btrfs_dir,
@@ -2464,6 +2696,7 @@ static struct grub_fs grub_btrfs_fs = {
.fs_dir = grub_btrfs_dir,
@@ -2885,6 +3117,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;
@ -258,7 +258,7 @@ index 4a31d39ee74..7002ad81b7e 100644
static char *
subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)),
@@ -2534,6 +2767,11 @@ GRUB_MOD_INIT (btrfs)
@@ -2955,6 +3188,11 @@ GRUB_MOD_INIT (btrfs)
"[-p|-n] [-o var] DEVICE",
"Print list of BtrFS subvolumes on "
"DEVICE.", options);

View File

@ -10,7 +10,7 @@ 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 39480b38674..09a18e56302 100644
index 090c8621066..5e2b479daec 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -24,6 +24,10 @@

View File

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 5cd9b6e08a8..106eb10a362 100644
index 5aa3a5dc7dd..3a724a9fcbf 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -65,7 +65,7 @@ grub_chainloader_unload (void)
@ -34,7 +34,7 @@ index 5cd9b6e08a8..106eb10a362 100644
grub_loader_unset ();
@@ -500,10 +500,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp)
@@ -506,10 +506,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)
{
@ -46,7 +46,7 @@ index 5cd9b6e08a8..106eb10a362 100644
char *buffer_aligned = NULL;
grub_efi_uint32_t i;
struct grub_pe32_section_table *section;
@@ -514,8 +513,6 @@ handle_image (void *data, grub_efi_uint32_t datasize)
@@ -520,8 +519,6 @@ handle_image (void *data, grub_efi_uint32_t datasize)
int found_entry_point = 0;
int rc;
@ -55,7 +55,7 @@ index 5cd9b6e08a8..106eb10a362 100644
rc = read_header (data, datasize, &context);
if (rc < 0)
{
@@ -555,8 +552,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
@@ -561,8 +558,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);
@ -66,7 +66,7 @@ index 5cd9b6e08a8..106eb10a362 100644
if (efi_status != GRUB_EFI_SUCCESS)
{
@@ -788,14 +785,14 @@ handle_image (void *data, grub_efi_uint32_t datasize)
@@ -794,14 +791,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));
@ -83,7 +83,7 @@ index 5cd9b6e08a8..106eb10a362 100644
return 0;
}
@@ -803,10 +800,7 @@ error_exit:
@@ -809,10 +806,7 @@ error_exit:
static grub_err_t
grub_secureboot_chainloader_unload (void)
{
@ -95,7 +95,7 @@ index 5cd9b6e08a8..106eb10a362 100644
grub_free (file_path);
grub_free (cmdline);
cmdline = 0;
@@ -1073,7 +1067,7 @@ fail:
@@ -1079,7 +1073,7 @@ fail:
grub_free (file_path);
if (address)

View File

@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 106eb10a362..3630b0cbf2d 100644
index 3a724a9fcbf..f4ddbeda687 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -783,7 +783,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
@@ -789,7 +789,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);
@ -26,7 +26,7 @@ index 106eb10a362..3630b0cbf2d 100644
efi_status = grub_efi_free_pool (buffer);
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 28b6adf7648..e5b521bd9be 100644
index d97cdf98c80..955973ed484 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -527,6 +527,14 @@ typedef grub_uint8_t grub_efi_char8_t;

View File

@ -9,7 +9,7 @@ Subject: [PATCH] Don't use dynamic sized arrays since we don't build with
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 4be228d9576..fa3e2912643 100644
index f24f1fd63f6..5366e443d2a 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1853,14 +1853,25 @@ grub_net_search_configfile (char *config)

View File

@ -8,7 +8,7 @@ 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 562d6887e0e..bcae7f4699d 100644
index a1af9b46559..2cf6a5ad526 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -166,7 +166,7 @@ grub_reboot (void)

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 2bca56ce0e8..b1ed3c33317 100644
index f03c03561a1..90dc9bb1017 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -54,6 +54,7 @@ grub_mod_fini (void)

View File

@ -14,7 +14,7 @@ Signed-off-by: Jonathan Lebon <jlebon@redhat.com>
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/util/editenv.c b/util/editenv.c
index d8d1dad6ab9..41bc7cb1c9a 100644
index e61dc1283a4..1f7f6f3ae18 100644
--- a/util/editenv.c
+++ b/util/editenv.c
@@ -28,6 +28,7 @@
@ -25,7 +25,7 @@ index d8d1dad6ab9..41bc7cb1c9a 100644
#define DEFAULT_ENVBLK_SIZE 1024
@@ -87,9 +88,20 @@ grub_util_create_envblk_file (const char *name)
@@ -88,9 +89,20 @@ grub_util_create_envblk_file (const char *name)
continue;
}

View File

@ -31,7 +31,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 7795baeb654..c7b0e6a9c46 100644
index 1f4bb9b8c5a..bf9c1ba64c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,7 +37,7 @@ grub_script.yy.c: grub_script.yy.h

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 a0ad99729fd..16f137ca854 100644
index 3e718b9e3fb..37fcdac12cc 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1159,18 +1159,8 @@ main (int argc, char *argv[])
@@ -1182,18 +1182,8 @@ main (int argc, char *argv[])
char *d;
is_guess = 1;

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 19 Oct 2017 11:29:11 -0400
Date: Tue, 9 Jul 2019 14:31:19 +0200
Subject: [PATCH] 20_linux_xen: load xen or multiboot{,2} modules as needed.
Signed-off-by: Peter Jones <pjones@redhat.com>
@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 3 insertions(+)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index bcdc3ceac02..2bc03fd36b9 100644
index 1519ec692fe..9aa23bc7d51 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -136,6 +136,8 @@ linux_entry ()
@ -21,11 +21,11 @@ index bcdc3ceac02..2bc03fd36b9 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}
@@ -145,6 +147,7 @@ EOF
message="$(gettext_printf "Loading initial ramdisk ...")"
@@ -149,6 +151,7 @@ EOF
done
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
+ insmod ${module_loader}
${module_loader} --nounzip ${rel_dirname}/${initrd}
${module_loader} --nounzip $(echo $initrd_path)
EOF
fi

View File

@ -20,7 +20,7 @@ index 36d2dedf47e..9d93ba88bac 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 b93e4820194..f6a9723971d 100644
index 035a4b528fc..2fc4be4039a 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -29,6 +29,7 @@

View File

@ -32,10 +32,10 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
create mode 100644 util/grub.d/10_linux_bls.in
diff --git a/Makefile.util.def b/Makefile.util.def
index c39b3ce6aa9..c16c2ca545a 100644
index 2215cc759c0..a61613656d1 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -490,6 +490,13 @@ script = {
@@ -499,6 +499,13 @@ script = {
condition = COND_HOST_LINUX;
};
@ -64,7 +64,7 @@ index a2d1f577b9b..434fa4deda4 100644
.SH SEE ALSO
.BR "info grub"
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 4248b9341ab..5e643e16973 100644
index 4649e92eb0f..2601bdc0711 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
@ -157,7 +157,7 @@ index b3aae534ddc..bc11df2bd84 100644
fi
IFS="$old_ifs"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index d9a05937e46..3919b8aff4e 100644
index 5cab299dc08..301594a0c9e 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -82,6 +82,67 @@ case x"$GRUB_FS" in

View File

@ -18,10 +18,10 @@ to the kexec command line tool, to allow booting the selected menu entry.
create mode 100644 grub-core/loader/emu/linux.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 8bb5eb0f47f..e70558a800a 100644
index ebc558019cd..528f76a8c8e 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1712,7 +1712,6 @@ module = {
@@ -1802,7 +1802,6 @@ module = {
common = loader/linux.c;
common = lib/cmdline.c;
@ -52,10 +52,10 @@ index 55ea5a11ccd..846fe9715ec 100644
case ARGP_KEY_ARG:
{
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index 82012a72fcb..3d3a4a4a975 100644
index 19cd007d448..245b69cab51 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -37,6 +37,7 @@
@@ -39,6 +39,7 @@
#include <grub/emu/misc.h>
int verbosity;
@ -63,7 +63,7 @@ index 82012a72fcb..3d3a4a4a975 100644
void
grub_util_warn (const char *fmt, ...)
@@ -80,7 +81,7 @@ grub_util_error (const char *fmt, ...)
@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...)
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
@ -72,7 +72,7 @@ index 82012a72fcb..3d3a4a4a975 100644
}
void *
@@ -140,6 +141,9 @@ void
@@ -142,6 +143,9 @@ void
__attribute__ ((noreturn))
grub_exit (int rc)
{
@ -82,7 +82,7 @@ index 82012a72fcb..3d3a4a4a975 100644
exit (rc < 0 ? 1 : rc);
}
#endif
@@ -201,3 +205,15 @@ grub_util_load_image (const char *path, char *buf)
@@ -203,3 +207,15 @@ grub_util_load_image (const char *path, char *buf)
fclose (fp);
}
@ -299,7 +299,7 @@ index d1073ef86af..1b61b4a2e5d 100644
grub_util_exec_redirect (const char *const *argv, const char *stdin_file,
const char *stdout_file);
diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h
index 8e37d5acb42..12c937a1af9 100644
index cfb1e2b5661..a61568e36e9 100644
--- a/include/grub/emu/hostfile.h
+++ b/include/grub/emu/hostfile.h
@@ -22,6 +22,7 @@
@ -320,12 +320,12 @@ index 8e37d5acb42..12c937a1af9 100644
char *
grub_util_path_concat (size_t n, ...);
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
index df6085bcb7c..a653132e36a 100644
index ce464cfd007..5ef4f79e689 100644
--- a/include/grub/emu/misc.h
+++ b/include/grub/emu/misc.h
@@ -60,6 +60,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2), noreturn));
@@ -56,6 +56,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn));
+void EXPORT_FUNC(grub_util_set_kexecute) (void);
+int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT;
@ -334,10 +334,10 @@ index df6085bcb7c..a653132e36a 100644
#ifdef HAVE_DEVICE_MAPPER
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 9c69aa88626..0108c0d4233 100644
index c6ba5b2d763..5ff3afd62fa 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -274,6 +274,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
@@ -304,6 +304,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h

View File

@ -9,19 +9,18 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
---
Makefile.util.def | 7 +
.gitignore | 2 +
util/grub-set-password.in | 2 +-
util/grub-switch-to-blscfg.8 | 33 +++++
util/grub-switch-to-blscfg.in | 314 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 357 insertions(+), 1 deletion(-)
4 files changed, 355 insertions(+), 1 deletion(-)
create mode 100644 util/grub-switch-to-blscfg.8
create mode 100644 util/grub-switch-to-blscfg.in
diff --git a/Makefile.util.def b/Makefile.util.def
index c16c2ca545a..aa59418ff2c 100644
index a61613656d1..f55473c76aa 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -1355,6 +1355,13 @@ program = {
@@ -1364,6 +1364,13 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -35,19 +34,6 @@ index c16c2ca545a..aa59418ff2c 100644
program = {
name = grub-glue-efi;
mansection = 1;
diff --git a/.gitignore b/.gitignore
index 096eeff7de8..7aaae594d51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,8 @@ grub-*.tar.*
/grub*-sparc64-setup.8
/grub*-syslinux2cfg
/grub*-syslinux2cfg.1
+/grub*-switch-to-blscfg
+/grub*-switch-to-blscfg.8
/grub_fstest.pp
/grub_fstest_init.c
/grub_fstest_init.lst
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index 5ebf50576d6..c0b5ebbfdc5 100644
--- a/util/grub-set-password.in

View File

@ -47,7 +47,7 @@ index 636f97e1ba1..e758ab3416d 100644
grub_printf ("%s:%d: ", file, line);
va_start (args, fmt);
diff --git a/include/grub/misc.h b/include/grub/misc.h
index fcaf1201e39..0f5abc4638e 100644
index b4339222ecb..4a4f485a5f6 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -367,6 +367,7 @@ grub_puts (const char *s)

View File

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 6 Nov 2017 18:31:56 -0500
Date: Tue, 9 Jul 2019 17:05:03 +0200
Subject: [PATCH] make better backtraces
Signed-off-by: Peter Jones <pjones@redhat.com>
---
Makefile.util.def | 6 ++
grub-core/Makefile.core.def | 15 ++--
grub-core/Makefile.core.def | 16 ++--
grub-core/{lib => commands}/backtrace.c | 2 +-
grub-core/gdb/cstub.c | 1 -
grub-core/kern/arm64/backtrace.c | 94 ++++++++++++++++++++++++
@ -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, 414 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 aa59418ff2c..4e722ab766b 100644
index f55473c76aa..c13ca685ce1 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -49,6 +49,12 @@ library = {
@ -55,10 +55,10 @@ index aa59418ff2c..4e722ab766b 100644
library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index e70558a800a..63b33490b11 100644
index 528f76a8c8e..49c5dc4c3b7 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -129,6 +129,12 @@ kernel = {
@@ -140,6 +140,12 @@ kernel = {
common = kern/rescue_parser.c;
common = kern/rescue_reader.c;
common = kern/term.c;
@ -71,7 +71,7 @@ index e70558a800a..63b33490b11 100644
noemu = kern/compiler-rt.c;
noemu = kern/mm.c;
@@ -175,9 +181,6 @@ kernel = {
@@ -186,9 +192,6 @@ kernel = {
softdiv = lib/division.c;
@ -80,17 +80,19 @@ index e70558a800a..63b33490b11 100644
-
i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c;
@@ -2279,13 +2282,11 @@ module = {
i386_xen_pvh = kern/i386/dl.c;
@@ -2376,15 +2379,12 @@ module = {
module = {
name = backtrace;
- x86 = lib/i386/backtrace.c;
- i386_xen_pvh = lib/i386/backtrace.c;
- i386_xen = lib/i386/backtrace.c;
- x86_64_xen = lib/i386/backtrace.c;
- common = lib/backtrace.c;
+ common = commands/backtrace.c;
enable = x86;
enable = i386_xen_pvh;
enable = i386_xen;
enable = x86_64_xen;
+ enable = arm64;
@ -329,7 +331,7 @@ index 00000000000..4a82e865cc6
+ grub_backtrace (skip + 1);
+}
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 621070918d4..5028d157c46 100644
index d7718d26abc..2e57e5e6829 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name)
@ -545,10 +547,10 @@ index 27bc68b8a53..b51d0abfa6e 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 e01bc6eab19..e731a57a47b 100644
index 0cd2a627231..937c1bc44cb 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -60,7 +60,6 @@
@@ -63,7 +63,6 @@
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
#endif
@ -785,10 +787,10 @@ index 395519762f0..275cf85e2d3 100644
#endif
diff --git a/include/grub/dl.h b/include/grub/dl.h
index b1ed3c33317..7b5bfb07ce6 100644
index 90dc9bb1017..4fe2b524f73 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -244,6 +244,8 @@ grub_dl_get (const char *name)
@@ -257,6 +257,8 @@ grub_dl_is_persistent (grub_dl_t mod)
#endif
@ -798,10 +800,10 @@ index b1ed3c33317..7b5bfb07ce6 100644
int isfunc, grub_dl_t mod);
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index ecd88ca72c6..ae69218af20 100644
index 133a37c8d03..e5a5f436709 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -108,6 +108,9 @@ grub_addr_t grub_modules_get_end (void);
@@ -110,6 +110,9 @@ grub_addr_t grub_modules_get_end (void);
#endif
@ -895,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 0108c0d4233..f36200bd688 100644
index 5ff3afd62fa..d9ad30052f1 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 ea749f26fd5..4117317c4c4 100644
index 2fe6743399d..f7ee912e715 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -425,6 +425,9 @@ grub_normal_reader_init (int nested)

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 9318c281108..5f47a9265f3 100644
index eb851b8d722..8ee18ba159a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1386,7 +1386,15 @@ grub_PROG_TARGET_CC
@@ -1414,7 +1414,15 @@ grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_LINKER" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi

View File

@ -42,7 +42,7 @@ index 5c2d2039d0b..0e89c483d5e 100644
int
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 0f5abc4638e..de9016ab709 100644
index 4a4f485a5f6..960097fbd06 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -372,6 +372,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,

View File

@ -20,7 +20,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
4 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 5028d157c46..eb8b969cded 100644
index 2e57e5e6829..6a5e7706143 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)
@ -95,7 +95,7 @@ index 5028d157c46..eb8b969cded 100644
{
grub_dl_unload (mod);
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index bcae7f4699d..a2a732ffc0d 100644
index 2cf6a5ad526..19054b1465f 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -283,7 +283,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
@ -164,11 +164,11 @@ index 71d2279a0c1..e6183a4c44d 100644
}
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 09a18e56302..570a69361a5 100644
index 5e2b479daec..8ca3981d7a1 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -132,7 +132,7 @@ grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh
grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, char *args);
@@ -132,7 +132,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);

View File

@ -9,10 +9,10 @@ Subject: [PATCH] Fixup for newer compiler
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 7002ad81b7e..dac73b2fa8b 100644
index ba99d04f8ed..9cd7f4bdf65 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -198,7 +198,7 @@ struct grub_btrfs_inode
@@ -215,7 +215,7 @@ struct grub_btrfs_inode
grub_uint64_t size;
grub_uint8_t dummy2[0x70];
struct grub_btrfs_time mtime;

View File

@ -1,891 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg59@coreos.com>
Date: Tue, 14 Jul 2015 17:06:35 -0700
Subject: [PATCH] TPM support
Add support for performing basic TPM measurements. Right now this only
supports extending PCRs statically and only on UEFI, but will measure
all modules as they're loaded, kernel and initrd images, command line,
grub commands and multiboot images.
Signed-off-by: Matthew Garrett <mjg59@coreos.com>
[hdegoede: fix hash_log_extend_event prototype and compile warnings]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[michael.marineau: fix warnings when compiling for other platforms]
Michael Marineau <michael.marineau@coreos.com>
[javierm: squash in a single patch and drop legacy BIOS support]
Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/Makefile.core.def | 2 +
grub-core/kern/dl.c | 4 +
grub-core/kern/efi/tpm.c | 274 ++++++++++++++++++++++++++++++++++
grub-core/kern/tpm.c | 19 +++
grub-core/lib/cmdline.c | 7 +-
grub-core/loader/i386/efi/linux.c | 6 +
grub-core/loader/i386/linux.c | 6 +
grub-core/loader/i386/multiboot_mbi.c | 4 +
grub-core/loader/linux.c | 4 +
grub-core/loader/multiboot.c | 3 +
grub-core/loader/multiboot_mbi2.c | 5 +-
grub-core/script/execute.c | 26 +++-
include/grub/efi/tpm.h | 153 +++++++++++++++++++
include/grub/tpm.h | 94 ++++++++++++
grub-core/Makefile.am | 1 +
15 files changed, 604 insertions(+), 4 deletions(-)
create mode 100644 grub-core/kern/efi/tpm.c
create mode 100644 grub-core/kern/tpm.c
create mode 100644 include/grub/efi/tpm.h
create mode 100644 include/grub/tpm.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 63b33490b11..3be42a95195 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -130,6 +130,7 @@ kernel = {
common = kern/rescue_reader.c;
common = kern/term.c;
common = kern/backtrace.c;
+ common = kern/tpm.c;
x86 = kern/i386/backtrace.c;
i386_xen = kern/i386/backtrace.c;
@@ -198,6 +199,7 @@ kernel = {
efi = kern/acpi.c;
efi = kern/efi/acpi.c;
efi = lib/envblk.c;
+ efi = kern/efi/tpm.c;
i386_coreboot = kern/i386/pc/acpi.c;
i386_multiboot = kern/i386/pc/acpi.c;
i386_coreboot = kern/acpi.c;
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index eb8b969cded..91105bc4677 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -33,6 +33,7 @@
#include <grub/cache.h>
#include <grub/i18n.h>
#include <grub/efi/sb.h>
+#include <grub/tpm.h>
/* Platforms where modules are in a readonly area of memory. */
#if defined(GRUB_MACHINE_QEMU)
@@ -829,6 +830,9 @@ grub_dl_load_file (const char *filename)
opens of the same device. */
grub_file_close (file);
+ grub_tpm_measure(core, size, GRUB_BINARY_PCR, "grub_module", filename);
+ grub_print_error();
+
mod = grub_dl_load_core (core, size);
grub_free (core);
if (! mod)
diff --git a/grub-core/kern/efi/tpm.c b/grub-core/kern/efi/tpm.c
new file mode 100644
index 00000000000..0d3ebe22e57
--- /dev/null
+++ b/grub-core/kern/efi/tpm.c
@@ -0,0 +1,274 @@
+#include <grub/err.h>
+#include <grub/i18n.h>
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
+#include <grub/efi/tpm.h>
+#include <grub/mm.h>
+#include <grub/tpm.h>
+#include <grub/term.h>
+
+static grub_efi_guid_t tpm_guid = EFI_TPM_GUID;
+static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID;
+
+static grub_efi_boolean_t grub_tpm_present(grub_efi_tpm_protocol_t *tpm)
+{
+ grub_efi_status_t status;
+ TCG_EFI_BOOT_SERVICE_CAPABILITY caps;
+ grub_uint32_t flags;
+ grub_efi_physical_address_t eventlog, lastevent;
+
+ caps.Size = (grub_uint8_t)sizeof(caps);
+
+ status = efi_call_5(tpm->status_check, tpm, &caps, &flags, &eventlog,
+ &lastevent);
+
+ if (status != GRUB_EFI_SUCCESS || caps.TPMDeactivatedFlag
+ || !caps.TPMPresentFlag)
+ return 0;
+
+ return 1;
+}
+
+static grub_efi_boolean_t grub_tpm2_present(grub_efi_tpm2_protocol_t *tpm)
+{
+ grub_efi_status_t status;
+ EFI_TCG2_BOOT_SERVICE_CAPABILITY caps;
+
+ caps.Size = (grub_uint8_t)sizeof(caps);
+
+ status = efi_call_2(tpm->get_capability, tpm, &caps);
+
+ if (status != GRUB_EFI_SUCCESS || !caps.TPMPresentFlag)
+ return 0;
+
+ return 1;
+}
+
+static grub_efi_boolean_t grub_tpm_handle_find(grub_efi_handle_t *tpm_handle,
+ grub_efi_uint8_t *protocol_version)
+{
+ grub_efi_handle_t *handles;
+ grub_efi_uintn_t num_handles;
+
+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm_guid, NULL,
+ &num_handles);
+ if (handles && num_handles > 0) {
+ *tpm_handle = handles[0];
+ *protocol_version = 1;
+ return 1;
+ }
+
+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm2_guid, NULL,
+ &num_handles);
+ if (handles && num_handles > 0) {
+ *tpm_handle = handles[0];
+ *protocol_version = 2;
+ return 1;
+ }
+
+ return 0;
+}
+
+static grub_err_t
+grub_tpm1_execute(grub_efi_handle_t tpm_handle,
+ PassThroughToTPM_InputParamBlock *inbuf,
+ PassThroughToTPM_OutputParamBlock *outbuf)
+{
+ grub_efi_status_t status;
+ grub_efi_tpm_protocol_t *tpm;
+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn);
+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut);
+
+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ if (!grub_tpm_present(tpm))
+ return 0;
+
+ /* UEFI TPM protocol takes the raw operand block, no param block header */
+ status = efi_call_5 (tpm->pass_through_to_tpm, tpm,
+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
+
+ switch (status) {
+ case GRUB_EFI_SUCCESS:
+ return 0;
+ case GRUB_EFI_DEVICE_ERROR:
+ return grub_error (GRUB_ERR_IO, N_("Command failed"));
+ case GRUB_EFI_INVALID_PARAMETER:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
+ case GRUB_EFI_BUFFER_TOO_SMALL:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small"));
+ case GRUB_EFI_NOT_FOUND:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
+ default:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
+ }
+}
+
+static grub_err_t
+grub_tpm2_execute(grub_efi_handle_t tpm_handle,
+ PassThroughToTPM_InputParamBlock *inbuf,
+ PassThroughToTPM_OutputParamBlock *outbuf)
+{
+ grub_efi_status_t status;
+ grub_efi_tpm2_protocol_t *tpm;
+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn);
+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut);
+
+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ if (!grub_tpm2_present(tpm))
+ return 0;
+
+ /* UEFI TPM protocol takes the raw operand block, no param block header */
+ status = efi_call_5 (tpm->submit_command, tpm,
+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
+
+ switch (status) {
+ case GRUB_EFI_SUCCESS:
+ return 0;
+ case GRUB_EFI_DEVICE_ERROR:
+ return grub_error (GRUB_ERR_IO, N_("Command failed"));
+ case GRUB_EFI_INVALID_PARAMETER:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
+ case GRUB_EFI_BUFFER_TOO_SMALL:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small"));
+ case GRUB_EFI_NOT_FOUND:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
+ default:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
+ }
+}
+
+grub_err_t
+grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf,
+ PassThroughToTPM_OutputParamBlock *outbuf)
+{
+ grub_efi_handle_t tpm_handle;
+ grub_uint8_t protocol_version;
+
+ /* It's not a hard failure for there to be no TPM */
+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version))
+ return 0;
+
+ if (protocol_version == 1) {
+ return grub_tpm1_execute(tpm_handle, inbuf, outbuf);
+ } else {
+ return grub_tpm2_execute(tpm_handle, inbuf, outbuf);
+ }
+}
+
+static grub_err_t
+grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
+ grub_size_t size, grub_uint8_t pcr,
+ const char *description)
+{
+ TCG_PCR_EVENT *event;
+ grub_efi_status_t status;
+ grub_efi_tpm_protocol_t *tpm;
+ grub_efi_physical_address_t lastevent;
+ grub_uint32_t algorithm;
+ grub_uint32_t eventnum = 0;
+
+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ if (!grub_tpm_present(tpm))
+ return 0;
+
+ event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1);
+ if (!event)
+ return grub_error (GRUB_ERR_OUT_OF_MEMORY,
+ N_("cannot allocate TPM event buffer"));
+
+ event->PCRIndex = pcr;
+ event->EventType = EV_IPL;
+ event->EventSize = grub_strlen(description) + 1;
+ grub_memcpy(event->Event, description, event->EventSize);
+
+ algorithm = TCG_ALG_SHA;
+ status = efi_call_7 (tpm->log_extend_event, tpm,
+ (unsigned long) buf, (grub_uint64_t) size,
+ algorithm, event, &eventnum, &lastevent);
+
+ switch (status) {
+ case GRUB_EFI_SUCCESS:
+ return 0;
+ case GRUB_EFI_DEVICE_ERROR:
+ return grub_error (GRUB_ERR_IO, N_("Command failed"));
+ case GRUB_EFI_INVALID_PARAMETER:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
+ case GRUB_EFI_BUFFER_TOO_SMALL:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small"));
+ case GRUB_EFI_NOT_FOUND:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
+ default:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
+ }
+}
+
+static grub_err_t
+grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
+ grub_size_t size, grub_uint8_t pcr,
+ const char *description)
+{
+ EFI_TCG2_EVENT *event;
+ grub_efi_status_t status;
+ grub_efi_tpm2_protocol_t *tpm;
+
+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ if (!grub_tpm2_present(tpm))
+ return 0;
+
+ event = grub_zalloc(sizeof (EFI_TCG2_EVENT) + grub_strlen(description) + 1);
+ if (!event)
+ return grub_error (GRUB_ERR_OUT_OF_MEMORY,
+ N_("cannot allocate TPM event buffer"));
+
+ event->Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER);
+ event->Header.HeaderVersion = 1;
+ event->Header.PCRIndex = pcr;
+ event->Header.EventType = EV_IPL;
+ event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1;
+ grub_memcpy(event->Event, description, grub_strlen(description) + 1);
+
+ status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (unsigned long) buf,
+ (grub_uint64_t) size, event);
+
+ switch (status) {
+ case GRUB_EFI_SUCCESS:
+ return 0;
+ case GRUB_EFI_DEVICE_ERROR:
+ return grub_error (GRUB_ERR_IO, N_("Command failed"));
+ case GRUB_EFI_INVALID_PARAMETER:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
+ case GRUB_EFI_BUFFER_TOO_SMALL:
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small"));
+ case GRUB_EFI_NOT_FOUND:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
+ default:
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
+ }
+}
+
+grub_err_t
+grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
+ const char *description)
+{
+ grub_efi_handle_t tpm_handle;
+ grub_efi_uint8_t protocol_version;
+
+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version))
+ return 0;
+
+ if (protocol_version == 1) {
+ return grub_tpm1_log_event(tpm_handle, buf, size, pcr, description);
+ } else {
+ return grub_tpm2_log_event(tpm_handle, buf, size, pcr, description);
+ }
+}
diff --git a/grub-core/kern/tpm.c b/grub-core/kern/tpm.c
new file mode 100644
index 00000000000..e5e8fced624
--- /dev/null
+++ b/grub-core/kern/tpm.c
@@ -0,0 +1,19 @@
+#include <grub/err.h>
+#include <grub/i18n.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/tpm.h>
+#include <grub/term.h>
+
+grub_err_t
+grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
+ const char *kind, const char *description)
+{
+ grub_err_t ret;
+ char *desc = grub_xasprintf("%s %s", kind, description);
+ if (!desc)
+ return GRUB_ERR_OUT_OF_MEMORY;
+ ret = grub_tpm_log_event(buf, size, pcr, desc);
+ grub_free(desc);
+ return ret;
+}
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index 970ea868c14..d5c12957cad 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -19,6 +19,7 @@
#include <grub/lib/cmdline.h>
#include <grub/misc.h>
+#include <grub/tpm.h>
static int
is_hex(char c)
@@ -79,7 +80,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
{
int i, space;
unsigned int arg_size;
- char *c;
+ char *c, *orig = buf;
for (i = 0; i < argc; i++)
{
@@ -125,5 +126,9 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
*buf = 0;
+ grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_ASCII_PCR,
+ "grub_kernel_cmdline", orig);
+ grub_print_error();
+
return i;
}
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index 800c3e54022..ea9f5134e67 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -27,6 +27,7 @@
#include <grub/lib/cmdline.h>
#include <grub/efi/efi.h>
#include <grub/efi/linux.h>
+#include <grub/tpm.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -131,6 +132,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
argv[i]);
goto fail;
}
+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_linuxefi", "Initrd");
+ grub_print_error();
ptr += cursize;
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
@@ -195,6 +198,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
+ grub_tpm_measure (kernel, filelen, GRUB_BINARY_PCR, "grub_linuxefi", "Kernel");
+ grub_print_error();
+
rc = grub_linuxefi_secure_validate (kernel, filelen);
if (rc < 0)
{
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index c84747ea857..76304f05700 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -36,6 +36,7 @@
#include <grub/lib/cmdline.h>
#include <grub/linux.h>
#include <grub/efi/sb.h>
+#include <grub/tpm.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -724,7 +725,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
+ grub_tpm_measure (kernel, len, GRUB_BINARY_PCR, "grub_linux", "Kernel");
+ grub_print_error();
+
grub_memcpy (&lh, kernel, sizeof (lh));
+
kernel_offset = sizeof (lh);
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
@@ -1038,6 +1043,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
len = prot_file_size;
grub_memcpy (prot_mode_mem, kernel + kernel_offset, len);
+ kernel_offset += len;
if (grub_errno == GRUB_ERR_NONE)
{
diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
index dc98dbcae25..ca85358f771 100644
--- a/grub-core/loader/i386/multiboot_mbi.c
+++ b/grub-core/loader/i386/multiboot_mbi.c
@@ -36,6 +36,7 @@
#include <grub/net.h>
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
+#include <grub/tpm.h>
#ifdef GRUB_MACHINE_EFI
#include <grub/efi/efi.h>
@@ -173,6 +174,9 @@ grub_multiboot_load (grub_file_t file, const char *filename)
return grub_errno;
}
+ grub_tpm_measure((unsigned char*)buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename);
+ grub_print_error();
+
header = find_header (buffer, len);
if (header == 0)
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
index be6fa0f4d45..c2c7cfcd0fd 100644
--- a/grub-core/loader/linux.c
+++ b/grub-core/loader/linux.c
@@ -4,6 +4,7 @@
#include <grub/misc.h>
#include <grub/file.h>
#include <grub/mm.h>
+#include <grub/tpm.h>
struct newc_head
{
@@ -288,6 +289,9 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
grub_initrd_close (initrd_ctx);
return grub_errno;
}
+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_initrd", "Initrd");
+ grub_print_error();
+
ptr += cursize;
}
if (newc)
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
index 26df46a4161..9a8dae5565b 100644
--- a/grub-core/loader/multiboot.c
+++ b/grub-core/loader/multiboot.c
@@ -51,6 +51,7 @@
#include <grub/memory.h>
#include <grub/i18n.h>
#include <grub/efi/sb.h>
+#include <grub/tpm.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -440,6 +441,8 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
}
grub_file_close (file);
+ grub_tpm_measure (module, size, GRUB_BINARY_PCR, "grub_multiboot", argv[0]);
+ grub_print_error();
return GRUB_ERR_NONE;
}
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
index 4df6595954d..54078455e2f 100644
--- a/grub-core/loader/multiboot_mbi2.c
+++ b/grub-core/loader/multiboot_mbi2.c
@@ -36,6 +36,7 @@
#include <grub/i18n.h>
#include <grub/net.h>
#include <grub/lib/cmdline.h>
+#include <grub/tpm.h>
#if defined (GRUB_MACHINE_EFI)
#include <grub/efi/efi.h>
@@ -131,8 +132,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename)
COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0);
+ grub_tpm_measure ((unsigned char *)mld.buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename);
+ grub_print_error();
+
header = find_header (mld.buffer, len);
-
if (header == 0)
{
grub_free (mld.buffer);
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index cf6cd6601d6..93965777138 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -30,6 +30,7 @@
#ifdef GRUB_MACHINE_IEEE1275
#include <grub/ieee1275/ieee1275.h>
#endif
+#include <grub/tpm.h>
/* Max digits for a char is 3 (0xFF is 255), similarly for an int it
is sizeof (int) * 3, and one extra for a possible -ve sign. */
@@ -967,8 +968,9 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
grub_err_t ret = 0;
grub_script_function_t func = 0;
char errnobuf[18];
- char *cmdname;
- int argc;
+ char *cmdname, *cmdstring;
+ int argc, offset = 0, cmdlen = 0;
+ unsigned int i;
char **args;
int invert;
struct grub_script_argv argv = { 0, 0, 0 };
@@ -977,6 +979,26 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
if (grub_script_arglist_to_argv (cmdline->arglist, &argv) || ! argv.args[0])
return grub_errno;
+ for (i = 0; i < argv.argc; i++) {
+ cmdlen += grub_strlen (argv.args[i]) + 1;
+ }
+
+ cmdstring = grub_malloc (cmdlen);
+ if (!cmdstring)
+ {
+ return grub_error (GRUB_ERR_OUT_OF_MEMORY,
+ N_("cannot allocate command buffer"));
+ }
+
+ for (i = 0; i < argv.argc; i++) {
+ offset += grub_snprintf (cmdstring + offset, cmdlen - offset, "%s ",
+ argv.args[i]);
+ }
+ cmdstring[cmdlen-1]= '\0';
+ grub_tpm_measure ((unsigned char *)cmdstring, cmdlen, GRUB_ASCII_PCR,
+ "grub_cmd", cmdstring);
+ grub_print_error();
+ grub_free(cmdstring);
invert = 0;
argc = argv.argc - 1;
args = argv.args + 1;
diff --git a/include/grub/efi/tpm.h b/include/grub/efi/tpm.h
new file mode 100644
index 00000000000..63d8a0fe714
--- /dev/null
+++ b/include/grub/efi/tpm.h
@@ -0,0 +1,153 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2015 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_EFI_TPM_HEADER
+#define GRUB_EFI_TPM_HEADER 1
+
+#define EFI_TPM_GUID {0xf541796d, 0xa62e, 0x4954, {0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }};
+#define EFI_TPM2_GUID {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }};
+
+typedef struct {
+ grub_efi_uint8_t Major;
+ grub_efi_uint8_t Minor;
+ grub_efi_uint8_t RevMajor;
+ grub_efi_uint8_t RevMinor;
+} TCG_VERSION;
+
+typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {
+ grub_efi_uint8_t Size; /// Size of this structure.
+ TCG_VERSION StructureVersion;
+ TCG_VERSION ProtocolSpecVersion;
+ grub_efi_uint8_t HashAlgorithmBitmap; /// Hash algorithms .
+ char TPMPresentFlag; /// 00h = TPM not present.
+ char TPMDeactivatedFlag; /// 01h = TPM currently deactivated.
+} TCG_EFI_BOOT_SERVICE_CAPABILITY;
+
+typedef struct {
+ grub_efi_uint32_t PCRIndex;
+ grub_efi_uint32_t EventType;
+ grub_efi_uint8_t digest[20];
+ grub_efi_uint32_t EventSize;
+ grub_efi_uint8_t Event[1];
+} TCG_PCR_EVENT;
+
+struct grub_efi_tpm_protocol
+{
+ grub_efi_status_t (*status_check) (struct grub_efi_tpm_protocol *this,
+ TCG_EFI_BOOT_SERVICE_CAPABILITY *ProtocolCapability,
+ grub_efi_uint32_t *TCGFeatureFlags,
+ grub_efi_physical_address_t *EventLogLocation,
+ grub_efi_physical_address_t *EventLogLastEntry);
+ grub_efi_status_t (*hash_all) (struct grub_efi_tpm_protocol *this,
+ grub_efi_uint8_t *HashData,
+ grub_efi_uint64_t HashLen,
+ grub_efi_uint32_t AlgorithmId,
+ grub_efi_uint64_t *HashedDataLen,
+ grub_efi_uint8_t **HashedDataResult);
+ grub_efi_status_t (*log_event) (struct grub_efi_tpm_protocol *this,
+ TCG_PCR_EVENT *TCGLogData,
+ grub_efi_uint32_t *EventNumber,
+ grub_efi_uint32_t Flags);
+ grub_efi_status_t (*pass_through_to_tpm) (struct grub_efi_tpm_protocol *this,
+ grub_efi_uint32_t TpmInputParameterBlockSize,
+ grub_efi_uint8_t *TpmInputParameterBlock,
+ grub_efi_uint32_t TpmOutputParameterBlockSize,
+ grub_efi_uint8_t *TpmOutputParameterBlock);
+ grub_efi_status_t (*log_extend_event) (struct grub_efi_tpm_protocol *this,
+ grub_efi_physical_address_t HashData,
+ grub_efi_uint64_t HashDataLen,
+ grub_efi_uint32_t AlgorithmId,
+ TCG_PCR_EVENT *TCGLogData,
+ grub_efi_uint32_t *EventNumber,
+ grub_efi_physical_address_t *EventLogLastEntry);
+};
+
+typedef struct grub_efi_tpm_protocol grub_efi_tpm_protocol_t;
+
+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_BITMAP;
+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_FORMAT;
+typedef grub_efi_uint32_t EFI_TCG2_EVENT_ALGORITHM_BITMAP;
+
+typedef struct tdEFI_TCG2_VERSION {
+ grub_efi_uint8_t Major;
+ grub_efi_uint8_t Minor;
+} GRUB_PACKED EFI_TCG2_VERSION;
+
+typedef struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY {
+ grub_efi_uint8_t Size;
+ EFI_TCG2_VERSION StructureVersion;
+ EFI_TCG2_VERSION ProtocolVersion;
+ EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap;
+ EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs;
+ grub_efi_boolean_t TPMPresentFlag;
+ grub_efi_uint16_t MaxCommandSize;
+ grub_efi_uint16_t MaxResponseSize;
+ grub_efi_uint32_t ManufacturerID;
+ grub_efi_uint32_t NumberOfPcrBanks;
+ EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks;
+} EFI_TCG2_BOOT_SERVICE_CAPABILITY;
+
+typedef grub_efi_uint32_t TCG_PCRINDEX;
+typedef grub_efi_uint32_t TCG_EVENTTYPE;
+
+typedef struct tdEFI_TCG2_EVENT_HEADER {
+ grub_efi_uint32_t HeaderSize;
+ grub_efi_uint16_t HeaderVersion;
+ TCG_PCRINDEX PCRIndex;
+ TCG_EVENTTYPE EventType;
+} GRUB_PACKED EFI_TCG2_EVENT_HEADER;
+
+typedef struct tdEFI_TCG2_EVENT {
+ grub_efi_uint32_t Size;
+ EFI_TCG2_EVENT_HEADER Header;
+ grub_efi_uint8_t Event[1];
+} GRUB_PACKED EFI_TCG2_EVENT;
+
+struct grub_efi_tpm2_protocol
+{
+ grub_efi_status_t (*get_capability) (struct grub_efi_tpm2_protocol *this,
+ EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability);
+ grub_efi_status_t (*get_event_log) (struct grub_efi_tpm2_protocol *this,
+ EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
+ grub_efi_physical_address_t *EventLogLocation,
+ grub_efi_physical_address_t *EventLogLastEntry,
+ grub_efi_boolean_t *EventLogTruncated);
+ grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint64_t Flags,
+ grub_efi_physical_address_t DataToHash,
+ grub_efi_uint64_t DataToHashLen,
+ EFI_TCG2_EVENT *EfiTcgEvent);
+ grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t InputParameterBlockSize,
+ grub_efi_uint8_t *InputParameterBlock,
+ grub_efi_uint32_t OutputParameterBlockSize,
+ grub_efi_uint8_t *OutputParameterBlock);
+ grub_efi_status_t (*get_active_pcr_blanks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t *ActivePcrBanks);
+ grub_efi_status_t (*set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t ActivePcrBanks);
+ grub_efi_status_t (*get_result_of_set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t *OperationPresent,
+ grub_efi_uint32_t *Response);
+};
+
+typedef struct grub_efi_tpm2_protocol grub_efi_tpm2_protocol_t;
+
+#define TCG_ALG_SHA 0x00000004
+
+#endif
diff --git a/include/grub/tpm.h b/include/grub/tpm.h
new file mode 100644
index 00000000000..ce52be4ff7f
--- /dev/null
+++ b/include/grub/tpm.h
@@ -0,0 +1,94 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2015 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_TPM_HEADER
+#define GRUB_TPM_HEADER 1
+
+#define SHA1_DIGEST_SIZE 20
+
+#define TPM_BASE 0x0
+#define TPM_SUCCESS TPM_BASE
+#define TPM_AUTHFAIL (TPM_BASE + 0x1)
+#define TPM_BADINDEX (TPM_BASE + 0x2)
+
+#define GRUB_ASCII_PCR 8
+#define GRUB_BINARY_PCR 9
+
+#define TPM_TAG_RQU_COMMAND 0x00C1
+#define TPM_ORD_Extend 0x14
+
+#define EV_IPL 0x0d
+
+/* TCG_PassThroughToTPM Input Parameter Block */
+typedef struct {
+ grub_uint16_t IPBLength;
+ grub_uint16_t Reserved1;
+ grub_uint16_t OPBLength;
+ grub_uint16_t Reserved2;
+ grub_uint8_t TPMOperandIn[1];
+} GRUB_PACKED PassThroughToTPM_InputParamBlock;
+
+/* TCG_PassThroughToTPM Output Parameter Block */
+typedef struct {
+ grub_uint16_t OPBLength;
+ grub_uint16_t Reserved;
+ grub_uint8_t TPMOperandOut[1];
+} GRUB_PACKED PassThroughToTPM_OutputParamBlock;
+
+typedef struct {
+ grub_uint16_t tag;
+ grub_uint32_t paramSize;
+ grub_uint32_t ordinal;
+ grub_uint32_t pcrNum;
+ grub_uint8_t inDigest[SHA1_DIGEST_SIZE]; /* The 160 bit value representing the event to be recorded. */
+} GRUB_PACKED ExtendIncoming;
+
+/* TPM_Extend Outgoing Operand */
+typedef struct {
+ grub_uint16_t tag;
+ grub_uint32_t paramSize;
+ grub_uint32_t returnCode;
+ grub_uint8_t outDigest[SHA1_DIGEST_SIZE]; /* The PCR value after execution of the command. */
+} GRUB_PACKED ExtendOutgoing;
+
+grub_err_t EXPORT_FUNC(grub_tpm_measure) (unsigned char *buf, grub_size_t size,
+ grub_uint8_t pcr, const char *kind,
+ const char *description);
+#if defined (GRUB_MACHINE_EFI)
+grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf,
+ PassThroughToTPM_OutputParamBlock *outbuf);
+grub_err_t grub_tpm_log_event(unsigned char *buf, grub_size_t size,
+ grub_uint8_t pcr, const char *description);
+#else
+static inline grub_err_t grub_tpm_execute(
+ PassThroughToTPM_InputParamBlock *inbuf __attribute__ ((unused)),
+ PassThroughToTPM_OutputParamBlock *outbuf __attribute__ ((unused)))
+{
+ return 0;
+};
+static inline grub_err_t grub_tpm_log_event(
+ unsigned char *buf __attribute__ ((unused)),
+ grub_size_t size __attribute__ ((unused)),
+ grub_uint8_t pcr __attribute__ ((unused)),
+ const char *description __attribute__ ((unused)))
+{
+ return 0;
+};
+#endif
+
+#endif
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f36200bd688..3781bb9cbb9 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -94,6 +94,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/tpm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
if COND_i386_pc

View File

@ -26,10 +26,10 @@ 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 ae69218af20..9548d552aad 100644
index e5a5f436709..de48cd44ccb 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -108,8 +108,10 @@ grub_addr_t grub_modules_get_end (void);
@@ -110,8 +110,10 @@ grub_addr_t grub_modules_get_end (void);
#endif

View File

@ -8,7 +8,7 @@ Subject: [PATCH] Fixup for newer compiler
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 044ab3abe88..c75848f5c06 100644
index 4ba729e14d8..5e8ba2ae3b0 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
Date: Fri, 21 Apr 2017 10:06:20 +0200
Date: Wed, 10 Jul 2019 15:22:29 +0200
Subject: [PATCH] Add support for non-Ethernet network cards
This patch replaces fixed 6-byte link layer address with
@ -24,7 +24,7 @@ Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
---
grub-core/net/arp.c | 155 ++++++++++++++++++++++-----------
grub-core/net/bootp.c | 14 ++-
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 +--
@ -35,7 +35,7 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
grub-core/net/ip.c | 4 +-
grub-core/net/net.c | 50 ++++++-----
include/grub/net.h | 19 ++--
12 files changed, 218 insertions(+), 152 deletions(-)
12 files changed, 219 insertions(+), 152 deletions(-)
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 54306e3b16d..67b409a8acc 100644
@ -271,10 +271,10 @@ index 54306e3b16d..67b409a8acc 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 2869482fe06..4e55adc557b 100644
index 8c969595a7b..3cf6dbf0e72 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -219,7 +219,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -269,7 +269,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
int is_def, char **device, char **path)
{
grub_net_network_level_address_t addr;
@ -282,7 +282,7 @@ index 2869482fe06..4e55adc557b 100644
struct grub_net_network_level_interface *inter;
int mask = -1;
char server_ip[sizeof ("xxx.xxx.xxx.xxx")];
@@ -232,12 +231,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -286,12 +285,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (path)
*path = 0;
@ -297,24 +297,25 @@ index 2869482fe06..4e55adc557b 100644
if (!inter)
return 0;
@@ -770,7 +765,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
grub_memset (pack, 0, sizeof (*pack) + 64);
pack->opcode = 1;
pack->hw_type = 1;
- pack->hw_len = 6;
+ pack->hw_len = ifaces[j].hwaddress.len > 16 ? 0
+ : ifaces[j].hwaddress.len;
err = grub_get_datetime (&date);
if (err || !grub_datetime2unixtime (&date, &t))
{
@@ -781,7 +777,7 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
ifaces[j].dhcp_xid = pack->xid;
pack->seconds = grub_cpu_to_be16 (t);
@@ -601,7 +596,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
grub_memset (pack, 0, sizeof (*pack));
pack->opcode = 1;
pack->hw_type = 1;
- pack->hw_len = 6;
+ pack->hw_len = iface->hwaddress.len > 16 ? 0
+ : iface->hwaddress.len;
+
err = grub_get_datetime (&date);
if (err || !grub_datetime2unixtime (&date, &t))
{
@@ -614,7 +611,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
else
pack->ident = iface->xid;
- grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, 6);
+ grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, pack->hw_len);
- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6);
+ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len);
grub_netbuff_push (nb, sizeof (*udph));
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 a57189e8bb3..4444e8e60ee 100644
@ -389,7 +390,7 @@ index 3f4152d036c..9f8fb4b6d2b 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 3df75357a70..ba50415f5f6 100644
index 3860b6f78d8..bcb3f9ea02d 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,
@ -611,22 +612,22 @@ index 2cbd95dce25..56a3ec5c8e8 100644
}
if (ohdr->type == OPTION_PREFIX && ohdr->len == 4)
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index 8411e0ecca3..b2ca74b6eb1 100644
index ea5edf8f1f6..a5896f6dc26 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -277,8 +277,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->dhcp_xid == bootp->xid
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
- && grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr,
- sizeof (inf->hwaddress.mac)) == 0)
+ && (grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr,
+ bootp->hw_len) == 0 || bootp->hw_len == 0))
{
grub_net_process_dhcp (nb, inf->card);
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 fa3e2912643..9700e2d09a2 100644
index 5366e443d2a..6468eb24596 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -128,8 +128,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
@ -712,7 +713,7 @@ index fa3e2912643..9700e2d09a2 100644
int
diff --git a/include/grub/net.h b/include/grub/net.h
index de51894cbbf..e9ebc6a1b4f 100644
index 3647012374b..fc1fc44baef 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -29,7 +29,8 @@
@ -745,7 +746,7 @@ index de51894cbbf..e9ebc6a1b4f 100644
};
} grub_net_link_level_address_t;
@@ -555,11 +558,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")
/*

View File

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
Date: Fri, 21 Apr 2017 09:20:38 +0200
Subject: [PATCH] Use xid to match DHCP replies
Transaction identifier (xid) from DHCP request
packet is stored in network level interface and used
to match request with the responses it generates.
Resolves: rhbz#1370642
Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
---
grub-core/net/bootp.c | 3 ++-
grub-core/net/ip.c | 1 +
include/grub/net.h | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index da3e454466b..2869482fe06 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -777,7 +777,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
grub_errno = GRUB_ERR_NONE;
t = 0;
}
- pack->ident = grub_cpu_to_be32 (t);
+ pack->xid = grub_cpu_to_be32 (t);
+ ifaces[j].dhcp_xid = pack->xid;
pack->seconds = grub_cpu_to_be16 (t);
grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, 6);
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index 7c95cc7464a..8411e0ecca3 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -275,6 +275,7 @@ handle_dgram (struct grub_net_buff *nb,
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
+ && inf->dhcp_xid == bootp->xid
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
&& grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr,
sizeof (inf->hwaddress.mac)) == 0)
diff --git a/include/grub/net.h b/include/grub/net.h
index f8f3ec13acc..de51894cbbf 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -292,6 +292,7 @@ struct grub_net_network_level_interface
struct grub_net_bootp_packet *dhcp_ack;
grub_size_t dhcp_acklen;
grub_uint16_t vlantag;
+ grub_uint32_t dhcp_xid;
void *data;
};
@@ -429,7 +430,7 @@ struct grub_net_bootp_packet
grub_uint8_t hw_type; /* hardware type. */
grub_uint8_t hw_len; /* hardware addr len. */
grub_uint8_t gate_hops; /* zero it. */
- grub_uint32_t ident; /* random number chosen by client. */
+ grub_uint32_t xid; /* transaction id chosen by client. */
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
grub_uint16_t flags;
grub_uint32_t client_ip;

View File

@ -89,7 +89,7 @@ index 5aa4ad3befc..00737c52750 100644
if (!data->sock)
{
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 9700e2d09a2..191e8e41bd6 100644
index 6468eb24596..2734f70d22f 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -439,6 +439,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
@ -260,7 +260,7 @@ index f90071353ad..e267af354f4 100644
if (!data->sock)
{
diff --git a/include/grub/net.h b/include/grub/net.h
index e9ebc6a1b4f..f4cd86e582f 100644
index fc1fc44baef..fa7a8c39704 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -273,6 +273,7 @@ typedef struct grub_net

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Sun, 10 Jul 2016 23:46:06 +0800
Date: Wed, 10 Jul 2019 15:42:36 +0200
Subject: [PATCH] bootp: New net_bootp6 command
Implement new net_bootp6 command for IPv6 network auto configuration via the
@ -11,15 +11,15 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
[pjones: Put back our code to add a local route]
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 1053 ++++++++++++++++++++++++++++++------
grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------
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, 999 insertions(+), 206 deletions(-)
5 files changed, 1002 insertions(+), 209 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 4e55adc557b..242cd1f4cbd 100644
index 3cf6dbf0e72..85adc9cb447 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -25,6 +25,98 @@
@ -119,26 +119,12 @@ index 4e55adc557b..242cd1f4cbd 100644
+ return 1;
+}
static char *
grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
@@ -345,178 +437,583 @@ grub_net_configure_by_dhcp_ack (const char *name,
return inter;
struct grub_dhcp_discover_options
{
@@ -638,6 +730,584 @@ out:
return err;
}
-struct grub_net_network_level_interface *
-grub_net_configure_by_dhcpv6_ack (const char *name,
- struct grub_net_card *card,
- grub_net_interface_flags_t flags
- __attribute__((__unused__)),
- const grub_net_link_level_address_t *hwaddr,
- const struct grub_net_dhcpv6_packet *packet,
- int is_def, char **device, char **path)
-{
- struct grub_net_network_level_interface *inter = NULL;
- struct grub_net_network_level_address addr;
- int mask = -1;
-
- if (!device || !path)
+/* The default netbuff size for sending DHCPv6 packets which should be
+ large enough to hold the information */
+#define GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE 512
@ -356,19 +342,8 @@ index 4e55adc557b..242cd1f4cbd 100644
+
+ options = grub_zalloc (sizeof(*options));
+ if (!options)
return NULL;
- *device = 0;
- *path = 0;
-
- grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n",
- hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2],
- hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]);
-
- if (is_def)
- grub_net_default_server = 0;
-
- if (is_def && !grub_net_default_server && packet)
+ return NULL;
+
+ foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)v6h->dhcp_options,
+ size - sizeof (*v6h), parse_dhcp6_option, options);
+
@ -412,165 +387,37 @@ index 4e55adc557b..242cd1f4cbd 100644
+ struct grub_net_network_level_interface *inf;
+
+ if (dhcp6->ia_addr)
{
- const grub_uint8_t *options = packet->dhcp_options;
- unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet);
- unsigned int i;
-
- for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); )
- {
- grub_uint16_t num, len;
- grub_net_dhcpv6_option_t *opt =
- (grub_net_dhcpv6_option_t *)(options + i);
-
- num = grub_be_to_cpu16(opt->option_num);
- len = grub_be_to_cpu16(opt->option_len);
-
- grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len);
-
- if (len == 0)
- break;
-
- if (len + i > 1024)
- break;
-
- if (num == GRUB_NET_DHCP6_BOOTFILE_URL)
- {
- char *scheme, *userinfo, *host, *file;
- char *tmp;
- int hostlen;
- int port;
- int rc = extract_url_info ((const char *)opt->option_data,
- (grub_size_t)len,
- &scheme, &userinfo, &host, &port,
- &file);
- if (rc < 0)
- continue;
-
- /* right now this only handles tftp. */
- if (grub_strcmp("tftp", scheme))
- {
- grub_free (scheme);
- grub_free (userinfo);
- grub_free (host);
- grub_free (file);
- continue;
- }
- grub_free (userinfo);
-
- hostlen = grub_strlen (host);
- if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']')
- {
- tmp = host+1;
- host[hostlen-1] = '\0';
- }
- else
- tmp = host;
+ {
+ inf = grub_net_add_addr (name, card, dhcp6->ia_addr, &card->default_address, flags);
- *device = grub_xasprintf ("%s,%s", scheme, tmp);
- grub_free (scheme);
- grub_free (host);
+
+ netaddr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ netaddr.ipv6.base[0] = dhcp6->ia_addr->ipv6[0];
+ netaddr.ipv6.base[1] = 0;
+ netaddr.ipv6.masksize = 64;
+ grub_net_add_route (name, netaddr, inf);
- if (file && *file)
- {
- tmp = grub_strrchr (file, '/');
- if (tmp)
- *(tmp+1) = '\0';
- else
- file[0] = '\0';
- }
- else if (!file)
- file = grub_strdup ("");
-
- if (file[0] == '/')
- {
- *path = grub_strdup (file+1);
- grub_free (file);
- }
- else
- *path = file;
- }
- else if (num == GRUB_NET_DHCP6_IA_NA)
- {
- const grub_net_dhcpv6_option_t *ia_na_opt;
- const grub_net_dhcpv6_opt_ia_na_t *ia_na =
- (const grub_net_dhcpv6_opt_ia_na_t *)opt;
- unsigned int left = len - OFFSET_OF (options, ia_na);
- unsigned int j;
-
- if ((grub_uint8_t *)ia_na + left >
- (grub_uint8_t *)options + option_max)
- left -= ((grub_uint8_t *)ia_na + left)
- - ((grub_uint8_t *)options + option_max);
-
- if (len < OFFSET_OF (option_data, opt)
- + sizeof (grub_net_dhcpv6_option_t))
- {
- grub_dprintf ("net",
- "found dhcpv6 ia_na option with no address\n");
- continue;
- }
-
- for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); )
- {
- ia_na_opt = (const grub_net_dhcpv6_option_t *)
- (ia_na->options + j);
- grub_uint16_t ia_na_opt_num, ia_na_opt_len;
-
- ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num);
- ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len);
- if (ia_na_opt_len == 0)
- break;
- if (j + ia_na_opt_len > left)
- break;
- if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS)
- {
- const grub_net_dhcpv6_opt_ia_address_t *ia_addr;
-
- ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *)
- ia_na_opt;
- addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
- grub_memcpy(addr.ipv6, ia_addr->ipv6_address,
- sizeof (ia_addr->ipv6_address));
- inter = grub_net_add_addr (name, card, &addr, hwaddr, 0);
- }
-
- j += ia_na_opt_len;
- left -= ia_na_opt_len;
- }
- }
+
+ if (ret_inf)
+ *ret_inf = inf;
+ }
- i += len + 4;
- }
+
+ if (dhcp6->dns_server_addrs)
+ {
+ grub_uint16_t i;
- grub_print_error ();
+
+ for (i = 0; i < dhcp6->num_dns_server; ++i)
+ grub_net_add_dns_server (dhcp6->dns_server_addrs + i);
}
- if (is_def)
+ }
+
+ if (dhcp6->boot_file_path)
+ grub_env_set_net_property (name, "boot_file", dhcp6->boot_file_path,
+ grub_strlen (dhcp6->boot_file_path));
+
+ if (is_def && dhcp6->boot_file_server_ip)
{
+ {
+ grub_net_default_server = grub_strdup (dhcp6->boot_file_server_ip);
grub_env_set ("net_default_interface", name);
grub_env_export ("net_default_interface");
}
+ grub_env_set ("net_default_interface", name);
+ grub_env_export ("net_default_interface");
+ }
+}
+
+static void
@ -590,10 +437,7 @@ index 4e55adc557b..242cd1f4cbd 100644
+ grub_errno = GRUB_ERR_NONE;
+ t = 0;
+ }
- if (inter)
- grub_net_add_ipv6_local (inter, mask);
- return inter;
+
+ se->iface = iface;
+ se->iaid = iaid;
+ se->transaction_id = t;
@ -604,8 +448,8 @@ index 4e55adc557b..242cd1f4cbd 100644
+ se->adv = NULL;
+ se->reply = NULL;
+ grub_list_push (GRUB_AS_LIST_P (&grub_dhcp6_sessions), GRUB_AS_LIST (se));
}
+}
+
+static void
+grub_dhcp6_session_remove (grub_dhcp6_session_t se)
+{
@ -858,16 +702,17 @@ index 4e55adc557b..242cd1f4cbd 100644
+
+ return inf;
+}
void
grub_net_process_dhcp (struct grub_net_buff *nb,
@@ -550,6 +1047,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
+
/*
* This is called directly from net/ip.c:handle_dgram(), because those
* BOOTP/DHCP packets are a bit special due to their improper
@@ -706,6 +1376,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
}
}
+grub_err_t
+grub_net_process_dhcp6 (struct grub_net_buff *nb,
+ struct grub_net_card *card __attribute__ ((unused)))
+ struct grub_net_card *card __attribute__ ((unused)))
+{
+ const struct grub_net_dhcp6_packet *v6h;
+ grub_dhcp6_session_t se;
@ -890,9 +735,9 @@ index 4e55adc557b..242cd1f4cbd 100644
+ FOR_DHCP6_SESSIONS (se)
+ {
+ if (se->transaction_id == v6h->transaction_id &&
+ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 &&
+ se->iaid == options->iaid)
+ break;
+ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 &&
+ se->iaid == options->iaid)
+ break;
+ }
+
+ if (!se)
@ -905,11 +750,11 @@ index 4e55adc557b..242cd1f4cbd 100644
+ if (v6h->message_type == GRUB_NET_DHCP6_ADVERTISE)
+ {
+ if (se->adv)
+ {
+ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n");
+ grub_dhcp6_options_free (options);
+ return GRUB_ERR_NONE;
+ }
+ {
+ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n");
+ grub_dhcp6_options_free (options);
+ return GRUB_ERR_NONE;
+ }
+
+ se->adv = options;
+ return grub_dhcp6_session_send_request (se);
@ -917,11 +762,11 @@ index 4e55adc557b..242cd1f4cbd 100644
+ else if (v6h->message_type == GRUB_NET_DHCP6_REPLY)
+ {
+ if (!se->adv)
+ {
+ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n");
+ grub_dhcp6_options_free (options);
+ return GRUB_ERR_NONE;
+ }
+ {
+ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n");
+ grub_dhcp6_options_free (options);
+ return GRUB_ERR_NONE;
+ }
+
+ se->reply = options;
+ grub_dhcp6_session_configure_network (se);
@ -939,183 +784,342 @@ index 4e55adc557b..242cd1f4cbd 100644
static grub_err_t
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
@@ -824,7 +1392,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
@@ -931,180 +1672,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
return err;
}
-static grub_command_t cmd_getdhcp, cmd_bootp;
-static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
-
-struct grub_net_network_level_interface *
-grub_net_configure_by_dhcpv6_ack (const char *name,
- struct grub_net_card *card,
- grub_net_interface_flags_t flags
- __attribute__((__unused__)),
- const grub_net_link_level_address_t *hwaddr,
- const struct grub_net_dhcpv6_packet *packet,
- int is_def, char **device, char **path)
+static grub_err_t
+grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)),
+ int argc, char **args)
+{
+ int argc, char **args)
{
- struct grub_net_network_level_interface *inter = NULL;
- struct grub_net_network_level_address addr;
- int mask = -1;
+ struct grub_net_card *card;
+ grub_uint32_t iaid = 0;
+ int interval;
+ grub_err_t err;
+ grub_dhcp6_session_t se;
+
- if (!device || !path)
- return NULL;
+ err = GRUB_ERR_NONE;
+
- *device = 0;
- *path = 0;
+ FOR_NET_CARDS (card)
+ {
+ struct grub_net_network_level_interface *iface;
+
- grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n",
- hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2],
- hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]);
+ if (argc > 0 && grub_strcmp (card->name, args[0]) != 0)
+ continue;
+
- if (is_def)
- grub_net_default_server = 0;
+ iface = grub_net_ipv6_get_link_local (card, &card->default_address);
+ if (!iface)
+ {
+ grub_dhcp6_session_remove_all ();
+ return grub_errno;
+ grub_dhcp6_session_remove_all ();
+ return grub_errno;
+ }
+
- if (is_def && !grub_net_default_server && packet)
+ grub_dhcp6_session_add (iface, iaid++);
+ }
+
+ for (interval = 200; interval < 10000; interval *= 2)
+ {
{
- const grub_uint8_t *options = packet->dhcp_options;
- unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet);
- unsigned int i;
-
- for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); )
- {
- grub_uint16_t num, len;
- grub_net_dhcpv6_option_t *opt =
- (grub_net_dhcpv6_option_t *)(options + i);
-
- num = grub_be_to_cpu16(opt->option_num);
- len = grub_be_to_cpu16(opt->option_len);
-
- grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len);
-
- if (len == 0)
- break;
-
- if (len + i > 1024)
- break;
-
- if (num == GRUB_NET_DHCP6_BOOTFILE_URL)
- {
- char *scheme, *userinfo, *host, *file;
- char *tmp;
- int hostlen;
- int port;
- int rc = extract_url_info ((const char *)opt->option_data,
- (grub_size_t)len,
- &scheme, &userinfo, &host, &port,
- &file);
- if (rc < 0)
- continue;
-
- /* right now this only handles tftp. */
- if (grub_strcmp("tftp", scheme))
- {
- grub_free (scheme);
- grub_free (userinfo);
- grub_free (host);
- grub_free (file);
- continue;
- }
- grub_free (userinfo);
-
- hostlen = grub_strlen (host);
- if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']')
- {
- tmp = host+1;
- host[hostlen-1] = '\0';
- }
- else
- tmp = host;
-
- *device = grub_xasprintf ("%s,%s", scheme, tmp);
- grub_free (scheme);
- grub_free (host);
-
- if (file && *file)
- {
- tmp = grub_strrchr (file, '/');
- if (tmp)
- *(tmp+1) = '\0';
- else
- file[0] = '\0';
- }
- else if (!file)
- file = grub_strdup ("");
-
- if (file[0] == '/')
- {
- *path = grub_strdup (file+1);
- grub_free (file);
- }
- else
- *path = file;
- }
- else if (num == GRUB_NET_DHCP6_IA_NA)
- {
- const grub_net_dhcpv6_option_t *ia_na_opt;
- const grub_net_dhcpv6_opt_ia_na_t *ia_na =
- (const grub_net_dhcpv6_opt_ia_na_t *)opt;
- unsigned int left = len - OFFSET_OF (options, ia_na);
- unsigned int j;
-
- if ((grub_uint8_t *)ia_na + left >
- (grub_uint8_t *)options + option_max)
- left -= ((grub_uint8_t *)ia_na + left)
- - ((grub_uint8_t *)options + option_max);
-
- if (len < OFFSET_OF (option_data, opt)
- + sizeof (grub_net_dhcpv6_option_t))
- {
- grub_dprintf ("net",
- "found dhcpv6 ia_na option with no address\n");
- continue;
- }
-
- for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); )
- {
- ia_na_opt = (const grub_net_dhcpv6_option_t *)
- (ia_na->options + j);
- grub_uint16_t ia_na_opt_num, ia_na_opt_len;
-
- ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num);
- ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len);
- if (ia_na_opt_len == 0)
- break;
- if (j + ia_na_opt_len > left)
- break;
- if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS)
- {
- const grub_net_dhcpv6_opt_ia_address_t *ia_addr;
-
- ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *)
- ia_na_opt;
- addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
- grub_memcpy(addr.ipv6, ia_addr->ipv6_address,
- sizeof (ia_addr->ipv6_address));
- inter = grub_net_add_addr (name, card, &addr, hwaddr, 0);
- }
-
- j += ia_na_opt_len;
- left -= ia_na_opt_len;
- }
- }
-
- i += len + 4;
- }
-
- grub_print_error ();
+ int done = 1;
+
+ FOR_DHCP6_SESSIONS (se)
+ {
+ struct grub_net_buff *nb;
+ struct grub_net_dhcp6_option *opt;
+ struct grub_net_dhcp6_packet *v6h;
+ struct grub_net_dhcp6_option_duid_ll *duid;
+ struct grub_net_dhcp6_option_iana *ia_na;
+ grub_net_network_level_address_t multicast;
+ grub_net_link_level_address_t ll_multicast;
+ struct udphdr *udph;
+ {
+ struct grub_net_buff *nb;
+ struct grub_net_dhcp6_option *opt;
+ struct grub_net_dhcp6_packet *v6h;
+ struct grub_net_dhcp6_option_duid_ll *duid;
+ struct grub_net_dhcp6_option_iana *ia_na;
+ grub_net_network_level_address_t multicast;
+ grub_net_link_level_address_t ll_multicast;
+ struct udphdr *udph;
+
+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48);
+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL);
+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48);
+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL);
+
+ err = grub_net_link_layer_resolve (se->iface,
+ &multicast, &ll_multicast);
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ return err;
+ }
+ err = grub_net_link_layer_resolve (se->iface,
+ &multicast, &ll_multicast);
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ return err;
+ }
+
+ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE);
+ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE);
+
+ if (!nb)
+ {
+ grub_dhcp6_session_remove_all ();
+ return grub_errno;
+ }
+ if (!nb)
+ {
+ grub_dhcp6_session_remove_all ();
+ return grub_errno;
+ }
+
+ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE);
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE);
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME);
+ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t));
+ grub_set_unaligned16 (opt->data, 0);
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME);
+ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t));
+ grub_set_unaligned16 (opt->data, 0);
+
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID);
+ opt->len = grub_cpu_to_be16 (sizeof (*duid));
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID);
+ opt->len = grub_cpu_to_be16 (sizeof (*duid));
+
+ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data;
+ grub_memcpy (duid, &se->duid, sizeof (*duid));
+ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data;
+ grub_memcpy (duid, &se->duid, sizeof (*duid));
+
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA);
+ opt->len = grub_cpu_to_be16 (sizeof (*ia_na));
+ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data;
+ ia_na->iaid = grub_cpu_to_be32 (se->iaid);
+ ia_na->t1 = 0;
+ ia_na->t2 = 0;
+ opt = (struct grub_net_dhcp6_option *)nb->data;
+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA);
+ opt->len = grub_cpu_to_be16 (sizeof (*ia_na));
+ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data;
+ ia_na->iaid = grub_cpu_to_be32 (se->iaid);
+ ia_na->t1 = 0;
+ ia_na->t2 = 0;
+
+ err = grub_netbuff_push (nb, sizeof (*v6h));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+ err = grub_netbuff_push (nb, sizeof (*v6h));
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ grub_netbuff_free (nb);
+ return err;
+ }
+
+ v6h = (struct grub_net_dhcp6_packet *)nb->data;
+ v6h->message_type = GRUB_NET_DHCP6_SOLICIT;
+ v6h->transaction_id = se->transaction_id;
+ v6h = (struct grub_net_dhcp6_packet *)nb->data;
+ v6h->message_type = GRUB_NET_DHCP6_SOLICIT;
+ v6h->transaction_id = se->transaction_id;
+
+ grub_netbuff_push (nb, sizeof (*udph));
+ grub_netbuff_push (nb, sizeof (*udph));
+
+ udph = (struct udphdr *) nb->data;
+ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT);
+ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT);
+ udph->chksum = 0;
+ udph->len = grub_cpu_to_be16 (nb->tail - nb->data);
+ udph = (struct udphdr *) nb->data;
+ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT);
+ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT);
+ udph->chksum = 0;
+ udph->len = grub_cpu_to_be16 (nb->tail - nb->data);
+
+ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP,
+ &se->iface->address, &multicast);
+ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP,
+ &se->iface->address, &multicast);
+
+ err = grub_net_send_ip_packet (se->iface, &multicast,
+ &ll_multicast, nb, GRUB_NET_IP_UDP);
+ done = 0;
+ grub_netbuff_free (nb);
+ err = grub_net_send_ip_packet (se->iface, &multicast,
+ &ll_multicast, nb, GRUB_NET_IP_UDP);
+ done = 0;
+ grub_netbuff_free (nb);
+
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ return err;
+ }
+ }
+ if (err)
+ {
+ grub_dhcp6_session_remove_all ();
+ return err;
+ }
+ }
+ if (!done)
+ grub_net_poll_cards (interval, 0);
+ }
+
+ grub_net_poll_cards (interval, 0);
}
- if (is_def)
+ FOR_DHCP6_SESSIONS (se)
+ {
{
- grub_env_set ("net_default_interface", name);
- grub_env_export ("net_default_interface");
+ grub_error_push ();
+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND,
+ N_("couldn't autoconfigure %s"),
+ se->iface->card->name);
+ }
+
+ N_("couldn't autoconfigure %s"),
+ se->iface->card->name);
}
- if (inter)
- grub_net_add_ipv6_local (inter, mask);
- return inter;
+ grub_dhcp6_session_remove_all ();
+
+ return err;
+}
+
+static grub_command_t cmd_getdhcp, cmd_bootp, cmd_bootp6;
}
+static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp, cmd_bootp6;
void
grub_bootp_init (void)
@@ -835,6 +1570,9 @@ grub_bootp_init (void)
@@ -1118,11 +1853,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."));
@ -1125,12 +1129,12 @@ index 4e55adc557b..242cd1f4cbd 100644
}
void
@@ -842,4 +1580,5 @@ grub_bootp_fini (void)
grub_bootp_fini (void)
{
+ grub_unregister_command (cmd_bootp6);
grub_unregister_command (cmd_getdhcp);
grub_unregister_command (cmd_bootp);
+ grub_unregister_command (cmd_bootp6);
}
grub_unregister_command (cmd_dhcp);
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 4444e8e60ee..00d7d37b8de 100644
--- a/grub-core/net/drivers/efi/efinet.c
@ -1170,7 +1174,7 @@ index 4444e8e60ee..00d7d37b8de 100644
}
else
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index b2ca74b6eb1..9a4e589aa39 100644
index a5896f6dc26..ce6bdc75c6d 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb,
@ -1220,7 +1224,7 @@ index b2ca74b6eb1..9a4e589aa39 100644
{
const struct grub_net_bootp_packet *bootp;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index e5b521bd9be..1250d493e25 100644
index 955973ed484..71d972a3d89 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1507,7 +1507,7 @@ typedef struct grub_efi_pxe_ip_filter
@ -1233,10 +1237,10 @@ index e5b521bd9be..1250d493e25 100644
} grub_efi_pxe_ip_filter_t;
diff --git a/include/grub/net.h b/include/grub/net.h
index f4cd86e582f..5f78b22e109 100644
index fa7a8c39704..aedf4b59cfe 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -447,50 +447,65 @@ struct grub_net_bootp_packet
@@ -451,50 +451,65 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -1332,7 +1336,7 @@ index f4cd86e582f..5f78b22e109 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
@@ -521,12 +536,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 *
@ -1351,9 +1355,9 @@ index f4cd86e582f..5f78b22e109 100644
int
grub_ipv6_get_masksize(grub_uint16_t *mask);
@@ -543,6 +558,10 @@ void
@@ -554,6 +569,10 @@ void
grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_card *card);
struct grub_net_network_level_interface *iface);
+grub_err_t
+grub_net_process_dhcp6 (struct grub_net_buff *nb,

View File

@ -28,7 +28,7 @@ index 00d7d37b8de..c3db3285b97 100644
else
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 1250d493e25..2f164d4209c 100644
index 71d972a3d89..186cf398840 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1499,31 +1499,6 @@ typedef union

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 2b7b7faf847..c54bee31679 100644
index 960e5f3ba41..495462b8e48 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -5303,6 +5303,7 @@ This command is only available on AArch64 systems.
@@ -5338,6 +5338,7 @@ This command is only available on AArch64 systems.
* net_add_dns:: Add a DNS server
* net_add_route:: Add routing entry
* net_bootp:: Perform a bootp autoconfiguration
@ -23,7 +23,7 @@ index 2b7b7faf847..c54bee31679 100644
* net_del_addr:: Remove IP address from interface
* net_del_dns:: Remove a DNS server
* net_del_route:: Remove a route entry
@@ -5384,6 +5385,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
@@ -5419,6 +5420,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
@end deffn

View File

@ -0,0 +1,108 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Wed, 10 Jul 2019 23:58:28 +0200
Subject: [PATCH] bootp: Add processing DHCPACK packet from HTTP Boot
The vendor class identifier with the string "HTTPClient" is used to denote the
packet as responding to HTTP boot request. In DHCP4 config, the filename for
HTTP boot is the URL of the boot file while for PXE boot it is the path to the
boot file. As a consequence, the next-server becomes obseleted because the HTTP
URL already contains the server address for the boot file. For DHCP6 config,
there's no difference definition in existing config as dhcp6.bootfile-url can
be used to specify URL for both HTTP and PXE boot file.
This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK
packet by treating it as HTTP format, not as the PXE format.
Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/bootp.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
include/grub/net.h | 1 +
2 files changed, 56 insertions(+)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 85adc9cb447..2e46842e829 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -20,6 +20,7 @@
#include <grub/env.h>
#include <grub/i18n.h>
#include <grub/command.h>
+#include <grub/net.h>
#include <grub/net/ip.h>
#include <grub/net/netbuff.h>
#include <grub/net/udp.h>
@@ -567,6 +568,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);
+ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER, &opt_len);
+ if (opt && opt_len)
+ {
+ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len);
+ if (opt && grub_strcmp (opt, "HTTPClient") == 0)
+ {
+ char *proto, *ip, *pa;
+
+ if (!dissect_url (bp->boot_file, &proto, &ip, &pa))
+ return inter;
+
+ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa));
+ if (is_def)
+ {
+ grub_net_default_server = grub_strdup (ip);
+ grub_env_set ("net_default_interface", name);
+ grub_env_export ("net_default_interface");
+ }
+ if (device && !*device)
+ {
+ *device = grub_xasprintf ("%s,%s", proto, ip);
+ grub_print_error ();
+ }
+ if (path)
+ {
+ *path = grub_strdup (pa);
+ grub_print_error ();
+ if (*path)
+ {
+ char *slash;
+ slash = grub_strrchr (*path, '/');
+ if (slash)
+ *slash = 0;
+ else
+ **path = 0;
+ }
+ }
+ grub_net_add_ipv4_local (inter, mask);
+ inter->dhcp_ack = grub_malloc (size);
+ if (inter->dhcp_ack)
+ {
+ grub_memcpy (inter->dhcp_ack, bp, size);
+ inter->dhcp_acklen = size;
+ }
+ else
+ grub_errno = GRUB_ERR_NONE;
+
+ grub_free (proto);
+ grub_free (ip);
+ grub_free (pa);
+ return inter;
+ }
+ }
+
opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_EXTENSIONS_PATH, &opt_len);
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 aedf4b59cfe..ebb569bd86e 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -526,6 +526,7 @@ enum
GRUB_NET_BOOTP_DOMAIN = 0x0f,
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
+ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C,
GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50,

View File

@ -375,7 +375,7 @@ index c3db3285b97..2817b6f8fb9 100644
}
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 2f164d4209c..eb6bb50857c 100644
index 186cf398840..0d4839a41f1 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -839,6 +839,8 @@ struct grub_efi_ipv4_device_path

View File

@ -1,135 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Thu, 14 Jul 2016 18:45:14 +0800
Subject: [PATCH] bootp: Add processing DHCPACK packet from HTTP Boot
The vendor class identifier with the string "HTTPClient" is used to denote the
packet as responding to HTTP boot request. In DHCP4 config, the filename for
HTTP boot is the URL of the boot file while for PXE boot it is the path to the
boot file. As a consequence, the next-server becomes obseleted because the HTTP
URL already contains the server address for the boot file. For DHCP6 config,
there's no difference definition in existing config as dhcp6.bootfile-url can
be used to specify URL for both HTTP and PXE boot file.
This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK
packet by treating it as HTTP format, not as the PXE format.
Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/bootp.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++--
include/grub/net.h | 1 +
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 242cd1f4cbd..8b6fc9f2411 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -20,6 +20,7 @@
#include <grub/env.h>
#include <grub/i18n.h>
#include <grub/command.h>
+#include <grub/net.h>
#include <grub/net/ip.h>
#include <grub/net/netbuff.h>
#include <grub/net/udp.h>
@@ -254,6 +255,11 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
taglength);
break;
+ case GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER:
+ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) ptr,
+ taglength);
+ break;
+
case GRUB_NET_BOOTP_EXTENSIONS_PATH:
grub_env_set_net_property (name, "extensionspath", (const char *) ptr,
taglength);
@@ -357,6 +363,66 @@ grub_net_configure_by_dhcp_ack (const char *name,
}
#endif
+ if (size > OFFSET_OF (vendor, bp))
+ {
+ char *cidvar;
+ const char *cid;
+
+ parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask);
+ cidvar = grub_xasprintf ("net_%s_%s", name, "vendor_class_identifier");
+ cid = grub_env_get (cidvar);
+ grub_free (cidvar);
+
+ if (cid && grub_strcmp (cid, "HTTPClient") == 0)
+ {
+ char *proto, *ip, *pa;
+
+ if (!dissect_url (bp->boot_file, &proto, &ip, &pa))
+ return inter;
+
+ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa));
+ if (is_def)
+ {
+ grub_net_default_server = grub_strdup (ip);
+ grub_env_set ("net_default_interface", name);
+ grub_env_export ("net_default_interface");
+ }
+ if (device && !*device)
+ {
+ *device = grub_xasprintf ("%s,%s", proto, ip);
+ grub_print_error ();
+ }
+ if (path)
+ {
+ *path = grub_strdup (pa);
+ grub_print_error ();
+ if (*path)
+ {
+ char *slash;
+ slash = grub_strrchr (*path, '/');
+ if (slash)
+ *slash = 0;
+ else
+ **path = 0;
+ }
+ }
+ grub_net_add_ipv4_local (inter, mask);
+ inter->dhcp_ack = grub_malloc (size);
+ if (inter->dhcp_ack)
+ {
+ grub_memcpy (inter->dhcp_ack, bp, size);
+ inter->dhcp_acklen = size;
+ }
+ else
+ grub_errno = GRUB_ERR_NONE;
+
+ grub_free (proto);
+ grub_free (ip);
+ grub_free (pa);
+ return inter;
+ }
+ }
+
if (size > OFFSET_OF (boot_file, bp))
grub_env_set_net_property (name, "boot_file", bp->boot_file,
sizeof (bp->boot_file));
@@ -421,8 +487,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
**path = 0;
}
}
- if (size > OFFSET_OF (vendor, bp))
- parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask);
grub_net_add_ipv4_local (inter, mask);
inter->dhcp_ack = grub_malloc (size);
diff --git a/include/grub/net.h b/include/grub/net.h
index 5f78b22e109..9cf6da68973 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -522,6 +522,7 @@ enum
GRUB_NET_BOOTP_DOMAIN = 0x0f,
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
+ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C,
GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
GRUB_NET_BOOTP_END = 0xff

View File

@ -242,7 +242,7 @@ index 2817b6f8fb9..c843654b830 100644
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index eb6bb50857c..dd3b07eac97 100644
index 0d4839a41f1..716f121728b 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -334,6 +334,16 @@
@ -333,5 +333,5 @@ index eb6bb50857c..dd3b07eac97 100644
+typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
+
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__)
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)

View File

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c
index 2c9b9e9312a..93aa0d8eda8 100644
index 596102848c1..c07100a8de3 100644
--- a/grub-core/normal/completion.c
+++ b/grub-core/normal/completion.c
@@ -284,7 +284,8 @@ complete_file (void)
@ -24,4 +24,4 @@ index 2c9b9e9312a..93aa0d8eda8 100644
+ dirfile[1] = '\0';
/* Iterate the directory. */
(fs->dir) (dev, dir, iterate_dir, NULL);
(fs->fs_dir) (dev, dir, iterate_dir, NULL);

View File

@ -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 3be42a95195..4168ec5d3ff 100644
index 49c5dc4c3b7..48491b50683 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2182,6 +2182,12 @@ module = {
@@ -2276,6 +2276,12 @@ module = {
common = hook/datehook.c;
};
@ -73,7 +73,7 @@ index 3be42a95195..4168ec5d3ff 100644
module = {
name = net;
common = net/net.c;
@@ -2196,6 +2202,12 @@ module = {
@@ -2290,6 +2296,12 @@ module = {
common = net/arp.c;
common = net/netbuff.c;
common = net/url.c;
@ -87,7 +87,7 @@ index 3be42a95195..4168ec5d3ff 100644
module = {
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
index dbed6474431..6118bade50d 100644
index a458c3aca78..1637731535e 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 dbed6474431..6118bade50d 100644
if (file->offset + res < next_buf)
{
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index a2a732ffc0d..4d36fe31177 100644
index 19054b1465f..ada3004cfba 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -696,7 +696,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -709,7 +709,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 a2a732ffc0d..4d36fe31177 100644
(unsigned) ipv4->local_ip_address[0],
(unsigned) ipv4->local_ip_address[1],
(unsigned) ipv4->local_ip_address[2],
@@ -709,33 +709,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -722,33 +722,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 a2a732ffc0d..4d36fe31177 100644
}
break;
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
@@ -775,6 +802,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -788,6 +815,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
break;
@ -2027,7 +2027,7 @@ index 00000000000..017c4d05bc7
+ };
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
new file mode 100644
index 00000000000..9e0078ac1c6
index 00000000000..86bce6535d3
--- /dev/null
+++ b/grub-core/net/efi/net.c
@@ -0,0 +1,1428 @@
@ -3324,13 +3324,13 @@ index 00000000000..9e0078ac1c6
+static struct grub_fs grub_efi_netfs =
+ {
+ .name = "efi netfs",
+ .dir = grub_efi_netfs_dir,
+ .open = grub_efi_netfs_open,
+ .read = grub_efi_netfs_read,
+ .close = grub_efi_netfs_close,
+ .label = NULL,
+ .uuid = NULL,
+ .mtime = NULL,
+ .fs_dir = grub_efi_netfs_dir,
+ .fs_open = grub_efi_netfs_open,
+ .fs_read = grub_efi_netfs_read,
+ .fs_close = grub_efi_netfs_close,
+ .fs_label = NULL,
+ .fs_uuid = NULL,
+ .fs_mtime = NULL,
+ };
+
+int
@ -3890,7 +3890,7 @@ index 00000000000..531949cba5c
+ };
+
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 191e8e41bd6..a571ee92efa 100644
index 2734f70d22f..27a0a1d6961 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -32,6 +32,9 @@
@ -4000,7 +4000,7 @@ index 191e8e41bd6..a571ee92efa 100644
+#endif
}
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c
index 82073d5cc94..ae31271bbc0 100644
index 602574d52e8..1a61e05c6ec 100644
--- a/util/grub-mknetdir.c
+++ b/util/grub-mknetdir.c
@@ -32,13 +32,15 @@
@ -4055,7 +4055,7 @@ index 82073d5cc94..ae31271bbc0 100644
{
const char *mkimage_target;
const char *netmodule;
@@ -154,6 +159,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);
@ -4063,7 +4063,7 @@ index 82073d5cc94..ae31271bbc0 100644
grub_install_make_image_wrap (input_dir, prefix, output,
0, load_cfg,
targets[platform].mkimage_target, 0);
@@ -190,7 +196,16 @@ main (int argc, char *argv[])
@@ -192,7 +198,16 @@ main (int argc, char *argv[])
grub_install_mkdir_p (base);
@ -4082,7 +4082,7 @@ index 82073d5cc94..ae31271bbc0 100644
if (!grub_install_source_directory)
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index dd3b07eac97..b337e1a193d 100644
index 716f121728b..2ed9c26a450 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -602,6 +602,23 @@ typedef union
@ -4329,8 +4329,8 @@ index dd3b07eac97..b337e1a193d 100644
+typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
+
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__)
|| 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

View File

@ -22,7 +22,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
index 9e0078ac1c6..2bf15447fd5 100644
index 86bce6535d3..4bb308026ce 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,

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