Compare commits
8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6fa1c44dc |
||
|
|
bd7cb174b2 |
||
|
|
97b9451527 |
||
|
|
3fe31072fa |
||
|
|
caf66c845a |
||
|
|
f5482fc2cf |
||
|
|
03701dc758 |
||
|
|
fbd0a312da |
460 changed files with 8983 additions and 28472 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,7 +1,7 @@
|
|||
grub-*.tar.?z
|
||||
*.rpm
|
||||
clog
|
||||
/unifont-*.pcf.?z
|
||||
/unifont-5.1.20080820.pcf.gz
|
||||
/theme.tar.bz2
|
||||
kojilogs
|
||||
/grub-*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Garrett <mjg@redhat.com>
|
||||
Date: Mon, 1 Apr 2024 13:20:18 -0600
|
||||
Date: Tue, 10 Jul 2012 11:58:52 -0400
|
||||
Subject: [PATCH] Add support for Linux EFI stub loading.
|
||||
|
||||
Also:
|
||||
|
|
@ -26,25 +26,32 @@ grub-2.00-no-insmod-on-sb.patch), but this should be more correct. It
|
|||
moves the check into grub_dl_load_file.
|
||||
---
|
||||
grub-core/Makefile.core.def | 16 +-
|
||||
grub-core/kern/dl.c | 22 +++
|
||||
grub-core/kern/dl.c | 21 +++
|
||||
grub-core/kern/efi/efi.c | 28 ++++
|
||||
grub-core/kern/efi/mm.c | 32 ++++
|
||||
grub-core/loader/efi/linux.c | 47 ++++++
|
||||
grub-core/loader/arm64/linux.c | 118 +++++++-------
|
||||
grub-core/loader/arm64/xen_boot.c | 1 -
|
||||
grub-core/loader/efi/linux.c | 70 ++++++++
|
||||
grub-core/loader/i386/efi/linux.c | 335 ++++++++++++++++++++++++++++++++++++++
|
||||
grub-core/loader/i386/pc/linux.c | 10 +-
|
||||
include/grub/efi/efi.h | 3 +
|
||||
include/grub/arm/linux.h | 9 +
|
||||
include/grub/arm64/linux.h | 9 +
|
||||
include/grub/efi/efi.h | 7 +-
|
||||
include/grub/efi/linux.h | 31 ++++
|
||||
8 files changed, 485 insertions(+), 11 deletions(-)
|
||||
13 files changed, 618 insertions(+), 69 deletions(-)
|
||||
create mode 100644 grub-core/loader/efi/linux.c
|
||||
create mode 100644 grub-core/loader/i386/efi/linux.c
|
||||
create mode 100644 include/grub/efi/linux.h
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index a5a3ee31800..3f6e944d6a5 100644
|
||||
index 8022e1c0a79..45d3edaa4dc 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -1831,12 +1831,6 @@ module = {
|
||||
@@ -1734,13 +1734,6 @@ module = {
|
||||
enable = i386_pc;
|
||||
};
|
||||
|
||||
|
||||
-
|
||||
-module = {
|
||||
- name = linux16;
|
||||
- common = loader/i386/pc/linux.c;
|
||||
|
|
@ -54,47 +61,37 @@ index a5a3ee31800..3f6e944d6a5 100644
|
|||
module = {
|
||||
name = ntldr;
|
||||
i386_pc = loader/i386/pc/ntldr.c;
|
||||
@@ -1892,10 +1886,9 @@ module = {
|
||||
@@ -1796,7 +1789,9 @@ module = {
|
||||
|
||||
module = {
|
||||
name = linux;
|
||||
- x86 = loader/i386/linux.c;
|
||||
+ i386_pc = loader/i386/pc/linux.c;
|
||||
+ x86_64_efi = loader/i386/efi/linux.c;
|
||||
+ i386_efi = loader/i386/efi/linux.c;
|
||||
i386_xen_pvh = loader/i386/linux.c;
|
||||
xen = loader/i386/xen.c;
|
||||
- i386_pc = lib/i386/pc/vesa_modes_table.c;
|
||||
+ i386_pc = loader/i386/pc/linux.c;
|
||||
i386_xen_pvh = lib/i386/pc/vesa_modes_table.c;
|
||||
mips = loader/mips/linux.c;
|
||||
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
||||
@@ -1908,11 +1901,14 @@ module = {
|
||||
loongarch64 = loader/efi/linux.c;
|
||||
riscv32 = loader/efi/linux.c;
|
||||
riscv64 = loader/efi/linux.c;
|
||||
- i386_efi = loader/efi/linux.c;
|
||||
- x86_64_efi = loader/efi/linux.c;
|
||||
+ i386_efi = loader/i386/efi/linux.c;
|
||||
+ x86_64_efi = loader/i386/efi/linux.c;
|
||||
emu = loader/emu/linux.c;
|
||||
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
||||
@@ -1811,9 +1806,14 @@ module = {
|
||||
arm64 = loader/arm64/linux.c;
|
||||
riscv32 = loader/riscv/linux.c;
|
||||
riscv64 = loader/riscv/linux.c;
|
||||
+ emu = loader/emu/linux.c;
|
||||
+ fdt = lib/fdt.c;
|
||||
+
|
||||
common = loader/linux.c;
|
||||
common = lib/cmdline.c;
|
||||
enable = noemu;
|
||||
+
|
||||
+ efi = loader/efi/linux.c;
|
||||
+ efi = loader/i386/linux.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
||||
index c55f0ecf931..d48d4131ba7 100644
|
||||
index 48f8a79073d..b7149370950 100644
|
||||
--- a/grub-core/kern/dl.c
|
||||
+++ b/grub-core/kern/dl.c
|
||||
@@ -32,12 +32,21 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/efi/sb.h>
|
||||
|
||||
/* Platforms where modules are in a readonly area of memory. */
|
||||
#if defined(GRUB_MACHINE_QEMU)
|
||||
@@ -38,6 +38,14 @@
|
||||
#define GRUB_MODULES_MACHINE_READONLY
|
||||
#endif
|
||||
|
||||
|
|
@ -109,12 +106,12 @@ index c55f0ecf931..d48d4131ba7 100644
|
|||
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
@@ -861,6 +870,19 @@ grub_dl_load_file (const char *filename)
|
||||
@@ -695,6 +703,19 @@ grub_dl_load_file (const char *filename)
|
||||
void *core = 0;
|
||||
grub_dl_t mod = 0;
|
||||
|
||||
+#ifdef GRUB_MACHINE_EFI
|
||||
+ if (grub_efi_get_secureboot ())
|
||||
+ if (grub_efi_secure_boot ())
|
||||
+ {
|
||||
+#if 0
|
||||
+ /* This is an error, but grub2-mkconfig still generates a pile of
|
||||
|
|
@ -129,11 +126,50 @@ index c55f0ecf931..d48d4131ba7 100644
|
|||
grub_boot_time ("Loading module %s", filename);
|
||||
|
||||
file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE);
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 8cff7be0289..35b8f670602 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
|
||||
}
|
||||
|
||||
+grub_efi_boolean_t
|
||||
+grub_efi_secure_boot (void)
|
||||
+{
|
||||
+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
+ grub_size_t datasize;
|
||||
+ char *secure_boot = NULL;
|
||||
+ char *setup_mode = NULL;
|
||||
+ grub_efi_boolean_t ret = 0;
|
||||
+
|
||||
+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
|
||||
+
|
||||
+ if (datasize != 1 || !secure_boot)
|
||||
+ goto out;
|
||||
+
|
||||
+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
|
||||
+
|
||||
+ if (datasize != 1 || !setup_mode)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (*secure_boot && !*setup_mode)
|
||||
+ ret = 1;
|
||||
+
|
||||
+ out:
|
||||
+ grub_free (secure_boot);
|
||||
+ grub_free (setup_mode);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
/* Search the mods section from the PE32/PE32+ image. This code uses
|
||||
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
||||
index df443f434d4..fb9dbf52528 100644
|
||||
index 0cdb063bb1b..74360542062 100644
|
||||
--- a/grub-core/kern/efi/mm.c
|
||||
+++ b/grub-core/kern/efi/mm.c
|
||||
@@ -112,6 +112,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
|
||||
@@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +186,7 @@ index df443f434d4..fb9dbf52528 100644
|
|||
+ return 0;
|
||||
+
|
||||
+ b = grub_efi_system_table->boot_services;
|
||||
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
||||
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ return 0;
|
||||
|
|
@ -160,7 +196,7 @@ index df443f434d4..fb9dbf52528 100644
|
|||
+ /* Uggh, the address 0 was allocated... This is too annoying,
|
||||
+ so reallocate another one. */
|
||||
+ address = max;
|
||||
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
||||
+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
||||
+ grub_efi_free_pages (0, pages);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ return 0;
|
||||
|
|
@ -172,27 +208,231 @@ index df443f434d4..fb9dbf52528 100644
|
|||
/* Allocate pages. Return the pointer to the first of allocated pages. */
|
||||
void *
|
||||
grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
|
||||
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
|
||||
index bfbd95aeef0..925394d1767 100644
|
||||
--- a/grub-core/loader/efi/linux.c
|
||||
+++ b/grub-core/loader/efi/linux.c
|
||||
@@ -25,10 +25,12 @@
|
||||
#include <grub/loader.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
+#include <grub/cpu/linux.h>
|
||||
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
|
||||
index ef3e9f9444c..a312c668685 100644
|
||||
--- a/grub-core/loader/arm64/linux.c
|
||||
+++ b/grub-core/loader/arm64/linux.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/fdtload.h>
|
||||
#include <grub/efi/memory.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
+#include <grub/efi/linux.h>
|
||||
#include <grub/efi/sb.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/lib/cmdline.h>
|
||||
@@ -87,6 +89,51 @@ static grub_efi_load_file2_t initrd_lf2 = {
|
||||
grub_efi_initrd_load_file2
|
||||
};
|
||||
@@ -41,6 +42,7 @@ static int loaded;
|
||||
|
||||
static void *kernel_addr;
|
||||
static grub_uint64_t kernel_size;
|
||||
+static grub_uint32_t handover_offset;
|
||||
|
||||
static char *linux_args;
|
||||
static grub_uint32_t cmdline_size;
|
||||
@@ -67,7 +69,8 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
|
||||
static grub_err_t
|
||||
finalize_params_linux (void)
|
||||
{
|
||||
- int node, retval;
|
||||
+ grub_efi_loaded_image_t *loaded_image = NULL;
|
||||
+ int node, retval, len;
|
||||
|
||||
void *fdt;
|
||||
|
||||
@@ -102,79 +105,70 @@ finalize_params_linux (void)
|
||||
if (grub_fdt_install() != GRUB_ERR_NONE)
|
||||
goto failure;
|
||||
|
||||
- return GRUB_ERR_NONE;
|
||||
-
|
||||
-failure:
|
||||
- grub_fdt_unload();
|
||||
- return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
|
||||
-}
|
||||
-
|
||||
-grub_err_t
|
||||
-grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
|
||||
-{
|
||||
- grub_efi_memory_mapped_device_path_t *mempath;
|
||||
- grub_efi_handle_t image_handle;
|
||||
- grub_efi_boot_services_t *b;
|
||||
- grub_efi_status_t status;
|
||||
- grub_efi_loaded_image_t *loaded_image;
|
||||
- int len;
|
||||
-
|
||||
- mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t));
|
||||
- if (!mempath)
|
||||
- return grub_errno;
|
||||
-
|
||||
- mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE;
|
||||
- mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE;
|
||||
- mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath));
|
||||
- mempath[0].memory_type = GRUB_EFI_LOADER_DATA;
|
||||
- mempath[0].start_address = addr;
|
||||
- mempath[0].end_address = addr + size;
|
||||
-
|
||||
- mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
- mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
- mempath[1].header.length = sizeof (grub_efi_device_path_t);
|
||||
-
|
||||
- b = grub_efi_system_table->boot_services;
|
||||
- status = b->load_image (0, grub_efi_image_handle,
|
||||
- (grub_efi_device_path_t *) mempath,
|
||||
- (void *) addr, size, &image_handle);
|
||||
- if (status != GRUB_EFI_SUCCESS)
|
||||
- return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
|
||||
-
|
||||
- grub_dprintf ("linux", "linux command line: '%s'\n", args);
|
||||
+ grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n",
|
||||
+ fdt);
|
||||
|
||||
/* Convert command line to UCS-2 */
|
||||
- loaded_image = grub_efi_get_loaded_image (image_handle);
|
||||
+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
|
||||
+ if (!loaded_image)
|
||||
+ goto failure;
|
||||
+
|
||||
loaded_image->load_options_size = len =
|
||||
- (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
|
||||
+ (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t);
|
||||
loaded_image->load_options =
|
||||
grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
|
||||
if (!loaded_image->load_options)
|
||||
- return grub_errno;
|
||||
+ return grub_error(GRUB_ERR_BAD_OS, "failed to create kernel parameters");
|
||||
|
||||
loaded_image->load_options_size =
|
||||
2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
|
||||
- (grub_uint8_t *) args, len, NULL);
|
||||
+ (grub_uint8_t *) linux_args, len, NULL);
|
||||
|
||||
- grub_dprintf ("linux", "starting image %p\n", image_handle);
|
||||
- status = b->start_image (image_handle, 0, NULL);
|
||||
+ return GRUB_ERR_NONE;
|
||||
|
||||
- /* When successful, not reached */
|
||||
- b->unload_image (image_handle);
|
||||
- grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
|
||||
- GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
|
||||
+failure:
|
||||
+ grub_fdt_unload();
|
||||
+ return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
|
||||
+}
|
||||
|
||||
- return grub_errno;
|
||||
+static void
|
||||
+free_params (void)
|
||||
+{
|
||||
+ grub_efi_loaded_image_t *loaded_image = NULL;
|
||||
+
|
||||
+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
|
||||
+ if (loaded_image)
|
||||
+ {
|
||||
+ if (loaded_image->load_options)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options,
|
||||
+ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
|
||||
+ loaded_image->load_options = NULL;
|
||||
+ loaded_image->load_options_size = 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+grub_err_t
|
||||
+grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args)
|
||||
+{
|
||||
+ grub_err_t retval;
|
||||
+
|
||||
+ retval = finalize_params_linux ();
|
||||
+ if (retval != GRUB_ERR_NONE)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ grub_dprintf ("linux", "linux command line: '%s'\n", args);
|
||||
+
|
||||
+ retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr);
|
||||
+
|
||||
+ /* Never reached... */
|
||||
+ free_params();
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_linux_boot (void)
|
||||
{
|
||||
- if (finalize_params_linux () != GRUB_ERR_NONE)
|
||||
- return grub_errno;
|
||||
-
|
||||
- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
|
||||
- kernel_size, linux_args));
|
||||
+ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args));
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
@@ -288,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_file_t file = 0;
|
||||
struct linux_arch_kernel_header lh;
|
||||
+ struct grub_armxx_linux_pe_header *pe;
|
||||
grub_err_t err;
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
@@ -333,6 +328,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
|
||||
|
||||
+ if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset);
|
||||
+ handover_offset = pe->opt.entry_addr;
|
||||
+
|
||||
cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE);
|
||||
linux_args = grub_malloc (cmdline_size);
|
||||
if (!linux_args)
|
||||
diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
|
||||
index 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_arch_efi_linux_boot_image (xen_hypervisor->start,
|
||||
- xen_hypervisor->size,
|
||||
xen_hypervisor->cmdline);
|
||||
}
|
||||
|
||||
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
|
||||
new file mode 100644
|
||||
index 00000000000..c24202a5dd1
|
||||
--- /dev/null
|
||||
+++ b/grub-core/loader/efi/linux.c
|
||||
@@ -0,0 +1,70 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/cpu/linux.h>
|
||||
+#include <grub/efi/efi.h>
|
||||
+#include <grub/efi/pe32.h>
|
||||
+#include <grub/efi/linux.h>
|
||||
+
|
||||
+#define SHIM_LOCK_GUID \
|
||||
+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
|
||||
+
|
||||
|
|
@ -205,7 +445,7 @@ index bfbd95aeef0..925394d1767 100644
|
|||
+grub_efi_boolean_t
|
||||
+grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
|
||||
+{
|
||||
+ grub_guid_t guid = SHIM_LOCK_GUID;
|
||||
+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
|
||||
+ grub_efi_shim_lock_t *shim_lock;
|
||||
+
|
||||
+ shim_lock = grub_efi_locate_protocol(&guid, NULL);
|
||||
|
|
@ -225,25 +465,21 @@ index bfbd95aeef0..925394d1767 100644
|
|||
+typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *);
|
||||
+
|
||||
+grub_err_t
|
||||
+grub_efi_linux_boot (void *kernel_address, grub_off_t offset,
|
||||
+grub_efi_linux_boot (void *kernel_addr, grub_off_t offset,
|
||||
+ void *kernel_params)
|
||||
+{
|
||||
+ handover_func hf;
|
||||
+
|
||||
+ hf = (handover_func)((char *)kernel_address + offset);
|
||||
+ hf = (handover_func)((char *)kernel_addr + offset);
|
||||
+ hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
|
||||
+
|
||||
+ return GRUB_ERR_BUG;
|
||||
+}
|
||||
+
|
||||
+#pragma GCC diagnostic pop
|
||||
+
|
||||
grub_err_t
|
||||
grub_arch_efi_linux_load_image_header (grub_file_t file,
|
||||
struct linux_arch_kernel_header * lh)
|
||||
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
||||
new file mode 100644
|
||||
index 00000000000..9bfb4ab9e3e
|
||||
index 00000000000..bb2616a8092
|
||||
--- /dev/null
|
||||
+++ b/grub-core/loader/i386/efi/linux.c
|
||||
@@ -0,0 +1,335 @@
|
||||
|
|
@ -301,7 +537,7 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ asm volatile ("cli");
|
||||
+
|
||||
+ return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset,
|
||||
+ params);
|
||||
+ params);
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
|
|
@ -311,17 +547,17 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ loaded = 0;
|
||||
+ if (initrd_mem)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem,
|
||||
+ BYTES_TO_PAGES(params->ramdisk_size));
|
||||
+ BYTES_TO_PAGES(params->ramdisk_size));
|
||||
+ if (linux_cmdline)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
|
||||
+ linux_cmdline,
|
||||
+ BYTES_TO_PAGES(params->cmdline_size + 1));
|
||||
+ linux_cmdline,
|
||||
+ BYTES_TO_PAGES(params->cmdline_size + 1));
|
||||
+ if (kernel_mem)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
|
||||
+ BYTES_TO_PAGES(kernel_size));
|
||||
+ BYTES_TO_PAGES(kernel_size));
|
||||
+ if (params)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params,
|
||||
+ BYTES_TO_PAGES(16384));
|
||||
+ BYTES_TO_PAGES(16384));
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
|
|
@ -395,14 +631,14 @@ index 00000000000..9bfb4ab9e3e
|
|||
+
|
||||
+ if (initrd_mem && grub_errno)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem,
|
||||
+ BYTES_TO_PAGES(size));
|
||||
+ BYTES_TO_PAGES(size));
|
||||
+
|
||||
+ return grub_errno;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
+ int argc, char *argv[])
|
||||
+ int argc, char *argv[])
|
||||
+{
|
||||
+ grub_file_t file = 0;
|
||||
+ struct linux_i386_kernel_header lh;
|
||||
|
|
@ -440,7 +676,7 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ if (! grub_linuxefi_secure_validate (kernel, filelen))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"),
|
||||
+ argv[0]);
|
||||
+ argv[0]);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
|
|
@ -482,7 +718,7 @@ index 00000000000..9bfb4ab9e3e
|
|||
+
|
||||
+ grub_dprintf ("linux", "setting up cmdline\n");
|
||||
+ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
|
||||
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+
|
||||
+ if (!linux_cmdline)
|
||||
+ {
|
||||
|
|
@ -493,8 +729,8 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
||||
+ grub_create_loader_cmdline (argc, argv,
|
||||
+ linux_cmdline + sizeof (LINUX_IMAGE) - 1,
|
||||
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
|
||||
+ GRUB_VERIFY_KERNEL_CMDLINE);
|
||||
+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
|
||||
+ GRUB_VERIFY_KERNEL_CMDLINE);
|
||||
+
|
||||
+ lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
|
||||
+
|
||||
|
|
@ -504,11 +740,11 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ len = grub_file_size(file) - start;
|
||||
+
|
||||
+ kernel_mem = grub_efi_allocate_pages_max(lh.pref_address,
|
||||
+ BYTES_TO_PAGES(lh.init_size));
|
||||
+ BYTES_TO_PAGES(lh.init_size));
|
||||
+
|
||||
+ if (!kernel_mem)
|
||||
+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
|
||||
+ BYTES_TO_PAGES(lh.init_size));
|
||||
+ BYTES_TO_PAGES(lh.init_size));
|
||||
+
|
||||
+ if (!kernel_mem)
|
||||
+ {
|
||||
|
|
@ -541,16 +777,16 @@ index 00000000000..9bfb4ab9e3e
|
|||
+
|
||||
+ if (linux_cmdline && !loaded)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
|
||||
+ linux_cmdline,
|
||||
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+ linux_cmdline,
|
||||
+ BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+
|
||||
+ if (kernel_mem && !loaded)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
|
||||
+ BYTES_TO_PAGES(kernel_size));
|
||||
+ BYTES_TO_PAGES(kernel_size));
|
||||
+
|
||||
+ if (params && !loaded)
|
||||
+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params,
|
||||
+ BYTES_TO_PAGES(16384));
|
||||
+ BYTES_TO_PAGES(16384));
|
||||
+
|
||||
+ return grub_errno;
|
||||
+}
|
||||
|
|
@ -583,10 +819,10 @@ index 00000000000..9bfb4ab9e3e
|
|||
+ grub_unregister_command (cmd_initrdefi);
|
||||
+}
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 600530a742b..8593d74737f 100644
|
||||
index 2a299520160..8be4c3b3f48 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -483,14 +483,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
@ -608,7 +844,7 @@ index 600530a742b..8593d74737f 100644
|
|||
grub_register_command ("initrd16", grub_cmd_initrd,
|
||||
0, N_("Load initrd."));
|
||||
my_mod = mod;
|
||||
@@ -499,5 +505,7 @@ GRUB_MOD_INIT(linux16)
|
||||
@@ -490,5 +496,7 @@ GRUB_MOD_INIT(linux16)
|
||||
GRUB_MOD_FINI(linux16)
|
||||
{
|
||||
grub_unregister_command (cmd_linux);
|
||||
|
|
@ -616,11 +852,71 @@ index 600530a742b..8593d74737f 100644
|
|||
grub_unregister_command (cmd_initrd);
|
||||
+ grub_unregister_command (cmd_initrd16);
|
||||
}
|
||||
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
|
||||
index bcd5a7eb186..b582f67f661 100644
|
||||
--- a/include/grub/arm/linux.h
|
||||
+++ b/include/grub/arm/linux.h
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef GRUB_ARM_LINUX_HEADER
|
||||
#define GRUB_ARM_LINUX_HEADER 1
|
||||
|
||||
+#include <grub/efi/pe32.h>
|
||||
#include "system.h"
|
||||
|
||||
#define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818
|
||||
@@ -34,9 +35,17 @@ struct linux_arm_kernel_header {
|
||||
grub_uint32_t hdr_offset;
|
||||
};
|
||||
|
||||
+struct grub_arm_linux_pe_header
|
||||
+{
|
||||
+ grub_uint32_t magic;
|
||||
+ struct grub_pe32_coff_header coff;
|
||||
+ struct grub_pe32_optional_header opt;
|
||||
+};
|
||||
+
|
||||
#if defined(__arm__)
|
||||
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
|
||||
# define linux_arch_kernel_header linux_arm_kernel_header
|
||||
+# define grub_armxx_linux_pe_header grub_arm_linux_pe_header
|
||||
#endif
|
||||
|
||||
#if defined GRUB_MACHINE_UBOOT
|
||||
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
|
||||
index 7e22b4ab699..ea030312df3 100644
|
||||
--- a/include/grub/arm64/linux.h
|
||||
+++ b/include/grub/arm64/linux.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef GRUB_ARM64_LINUX_HEADER
|
||||
#define GRUB_ARM64_LINUX_HEADER 1
|
||||
|
||||
+#include <grub/efi/pe32.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */
|
||||
@@ -38,9 +39,17 @@ struct linux_arm64_kernel_header
|
||||
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
|
||||
};
|
||||
|
||||
+struct grub_arm64_linux_pe_header
|
||||
+{
|
||||
+ grub_uint32_t magic;
|
||||
+ struct grub_pe32_coff_header coff;
|
||||
+ struct grub_pe64_optional_header opt;
|
||||
+};
|
||||
+
|
||||
#if defined(__aarch64__)
|
||||
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
|
||||
# define linux_arch_kernel_header linux_arm64_kernel_header
|
||||
+# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_ARM64_LINUX_HEADER */
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index 3670eddc52b..83ddbe26e57 100644
|
||||
index 83d958f9945..6295df85f3f 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -75,6 +75,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
|
||||
@@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
|
||||
grub_efi_uintn_t pages);
|
||||
void *
|
||||
EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
|
||||
|
|
@ -630,9 +926,27 @@ index 3670eddc52b..83ddbe26e57 100644
|
|||
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
|
||||
grub_efi_uintn_t pages);
|
||||
grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
|
||||
@@ -88,6 +91,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
|
||||
const grub_efi_guid_t *guid,
|
||||
void *data,
|
||||
grub_size_t datasize);
|
||||
+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
|
||||
int
|
||||
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
||||
const grub_efi_device_path_t *dp2);
|
||||
@@ -101,8 +105,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
|
||||
grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
|
||||
#include <grub/cpu/linux.h>
|
||||
grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
|
||||
-grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
|
||||
- char *args);
|
||||
+grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args);
|
||||
#endif
|
||||
|
||||
grub_addr_t grub_efi_modules_addr (void);
|
||||
diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h
|
||||
new file mode 100644
|
||||
index 00000000000..d224daafa4f
|
||||
index 00000000000..d9ede36773b
|
||||
--- /dev/null
|
||||
+++ b/include/grub/efi/linux.h
|
||||
@@ -0,0 +1,31 @@
|
||||
|
|
@ -664,6 +978,6 @@ index 00000000000..d224daafa4f
|
|||
+EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size);
|
||||
+grub_err_t
|
||||
+EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset,
|
||||
+ void *kernel_param);
|
||||
+ void *kernel_param);
|
||||
+
|
||||
+#endif /* ! GRUB_EFI_LINUX_HEADER */
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Fri, 11 Jun 2021 12:10:45 +0200
|
||||
Subject: [PATCH] Revert "templates: Fix user-facing typo with an incorrect use
|
||||
of "it's""
|
||||
|
||||
This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821.
|
||||
---
|
||||
util/grub.d/30_os-prober.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
|
||||
index 656301eaf22..376ca47efe4 100644
|
||||
--- a/util/grub.d/30_os-prober.in
|
||||
+++ b/util/grub.d/30_os-prober.in
|
||||
@@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIts output will be used to detect bootable binaries on them and create new boot entries.")"
|
||||
+grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")"
|
||||
|
||||
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
|
||||
if [ -z "${OSPROBED}" ] ; then
|
||||
|
|
@ -13,10 +13,10 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
|
|||
1 file changed, 23 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index 977757f2cc9..10f967f2563 100644
|
||||
index 9f74a96b19a..dccf3bb3005 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -661,13 +661,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_file_t file = 0;
|
||||
struct linux_i386_kernel_header lh;
|
||||
|
|
@ -33,7 +33,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
@@ -681,7 +683,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -669,7 +671,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
@@ -689,6 +699,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -677,6 +687,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_OS, "invalid magic number");
|
||||
@@ -796,13 +809,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -784,13 +797,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
/* We've already read lh so there is no need to read it second time. */
|
||||
len -= sizeof(lh);
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
}
|
||||
|
||||
linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR;
|
||||
@@ -865,7 +876,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -853,7 +864,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
/* The other parameters are filled when booting. */
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
|
||||
grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
|
||||
(unsigned) real_size, (unsigned) prot_size);
|
||||
@@ -1019,9 +1030,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -1007,9 +1018,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
|
||||
len = prot_file_size;
|
||||
|
|
@ -98,7 +98,7 @@ index 977757f2cc9..10f967f2563 100644
|
|||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
{
|
||||
@@ -1032,6 +1041,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -1020,6 +1029,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
fail:
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
|
|||
1 file changed, 21 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 4adeee9ae00..600530a742b 100644
|
||||
index 8be4c3b3f48..4b1750e360e 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Raymund Will <rw@suse.com>
|
||||
Date: Tue, 2 Apr 2024 16:39:53 -0600
|
||||
Date: Mon, 8 Jul 2019 11:55:18 +0200
|
||||
Subject: [PATCH] Add secureboot support on efi chainloader
|
||||
|
||||
Expand the chainloader to be able to verify the image by means of shim
|
||||
|
|
@ -164,93 +164,104 @@ following branches:
|
|||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1347291
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
|
||||
Also:
|
||||
|
||||
commit cc06f149fbd2d8c1da1e83173d21629ba97e0d92
|
||||
Author: Raymund Will <rw@suse.com>
|
||||
|
||||
chainloader: Define machine types for RISC-V
|
||||
|
||||
The commit "Add secureboot support on efi chainloader" didn't add machine
|
||||
types for RISC-V, so this patch adds them.
|
||||
|
||||
Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not
|
||||
supported yet. This patch might need a new revision once that's the case.
|
||||
|
||||
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 849 +++++++++++++++++++++++++++++++++----
|
||||
grub-core/kern/efi/efi.c | 14 +-
|
||||
grub-core/loader/arm64/linux.c | 4 +-
|
||||
grub-core/loader/efi/chainloader.c | 816 +++++++++++++++++++++++++++++++++----
|
||||
grub-core/loader/efi/linux.c | 25 +-
|
||||
grub-core/loader/i386/efi/linux.c | 17 +-
|
||||
include/grub/efi/linux.h | 2 +-
|
||||
include/grub/efi/pe32.h | 51 ++-
|
||||
5 files changed, 848 insertions(+), 96 deletions(-)
|
||||
include/grub/efi/pe32.h | 52 ++-
|
||||
7 files changed, 840 insertions(+), 90 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 35b8f670602..4a2259aa1c7 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -296,14 +296,20 @@ grub_efi_secure_boot (void)
|
||||
grub_efi_boolean_t ret = 0;
|
||||
|
||||
secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
|
||||
-
|
||||
if (datasize != 1 || !secure_boot)
|
||||
- goto out;
|
||||
+ {
|
||||
+ grub_dprintf ("secureboot", "No SecureBoot variable\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot);
|
||||
|
||||
setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
|
||||
-
|
||||
if (datasize != 1 || !setup_mode)
|
||||
- goto out;
|
||||
+ {
|
||||
+ grub_dprintf ("secureboot", "No SetupMode variable\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode);
|
||||
|
||||
if (*secure_boot && !*setup_mode)
|
||||
ret = 1;
|
||||
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
|
||||
index a312c668685..04994d5c67d 100644
|
||||
--- a/grub-core/loader/arm64/linux.c
|
||||
+++ b/grub-core/loader/arm64/linux.c
|
||||
@@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
struct linux_arch_kernel_header lh;
|
||||
struct grub_armxx_linux_pe_header *pe;
|
||||
grub_err_t err;
|
||||
+ int rc;
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
@@ -328,7 +329,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
|
||||
|
||||
- if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size))
|
||||
+ rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size);
|
||||
+ if (rc < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
|
||||
goto fail;
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index 2036924504b..e4ac39c87b4 100644
|
||||
index 2bd80f4db3d..b54cf6986fc 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -32,6 +32,9 @@
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/disk.h>
|
||||
+#include <grub/efi/pe32.h>
|
||||
+#include <grub/efi/sb.h>
|
||||
+#include <grub/efi/linux.h>
|
||||
#include <grub/efi/memory.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
@@ -45,13 +48,24 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
#include <grub/net.h>
|
||||
@@ -46,9 +48,14 @@ static grub_dl_t my_mod;
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
+static grub_efi_physical_address_t address;
|
||||
+static grub_efi_uintn_t pages;
|
||||
static grub_efi_physical_address_t address;
|
||||
static grub_efi_uintn_t pages;
|
||||
+static grub_ssize_t fsize;
|
||||
+static grub_efi_device_path_t *file_path;
|
||||
+static grub_efi_handle_t image_handle;
|
||||
+static grub_efi_char16_t *cmdline;
|
||||
static grub_efi_device_path_t *file_path;
|
||||
static grub_efi_handle_t image_handle;
|
||||
static grub_efi_char16_t *cmdline;
|
||||
+static grub_ssize_t cmdline_len;
|
||||
+static grub_efi_handle_t dev_handle;
|
||||
+
|
||||
+static grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table);
|
||||
+
|
||||
+static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table);
|
||||
|
||||
static grub_err_t
|
||||
grub_chainloader_unload (void *context)
|
||||
{
|
||||
- grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
||||
grub_efi_loaded_image_t *loaded_image;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_chainloader_unload (void)
|
||||
@@ -63,6 +70,7 @@ grub_chainloader_unload (void)
|
||||
grub_free (cmdline);
|
||||
cmdline = 0;
|
||||
file_path = 0;
|
||||
+ dev_handle = 0;
|
||||
|
||||
+ image_handle = (grub_efi_handle_t) context;
|
||||
loaded_image = grub_efi_get_loaded_image (image_handle);
|
||||
if (loaded_image != NULL)
|
||||
grub_free (loaded_image->load_options);
|
||||
@@ -66,12 +80,12 @@ grub_chainloader_unload (void *context)
|
||||
static grub_err_t
|
||||
grub_chainloader_boot (void *context)
|
||||
{
|
||||
- grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_efi_status_t status;
|
||||
grub_efi_uintn_t exit_data_size;
|
||||
grub_efi_char16_t *exit_data = NULL;
|
||||
|
||||
+ image_handle = (grub_efi_handle_t) context;
|
||||
b = grub_efi_system_table->boot_services;
|
||||
status = b->start_image (image_handle, &exit_data_size, &exit_data);
|
||||
if (status != GRUB_EFI_SUCCESS)
|
||||
@@ -136,7 +150,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
char *dir_start;
|
||||
char *dir_end;
|
||||
grub_size_t size;
|
||||
- grub_efi_device_path_t *d, *file_path;
|
||||
+ grub_efi_device_path_t *d;
|
||||
|
||||
dir_start = grub_strchr (filename, ')');
|
||||
if (! dir_start)
|
||||
@@ -209,24 +223,701 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
grub_dl_unref (my_mod);
|
||||
return GRUB_ERR_NONE;
|
||||
@@ -213,20 +221,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
return file_path;
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +312,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+read_header (void *data, grub_efi_uint32_t size,
|
||||
+ pe_coff_loader_image_context_t *context)
|
||||
+{
|
||||
+ grub_guid_t guid = SHIM_LOCK_GUID;
|
||||
+ grub_efi_guid_t guid = SHIM_LOCK_GUID;
|
||||
+ grub_efi_shim_lock_t *shim_lock;
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
|
|
@ -365,10 +376,6 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ GRUB_PE32_MACHINE_I386;
|
||||
+#elif defined(__ia64__)
|
||||
+ GRUB_PE32_MACHINE_IA64;
|
||||
+#elif defined(__riscv) && (__riscv_xlen == 32)
|
||||
+ GRUB_PE32_MACHINE_RISCV32;
|
||||
+#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
+ GRUB_PE32_MACHINE_RISCV64;
|
||||
+#else
|
||||
+#error this architecture is not supported by grub2
|
||||
+#endif
|
||||
|
|
@ -614,8 +621,8 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n",
|
||||
+ context.image_size, datasize);
|
||||
+
|
||||
+ efi_status = b->allocate_pool (GRUB_EFI_LOADER_DATA,
|
||||
+ buffer_size, (void**)&buffer);
|
||||
+ efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
|
||||
+ buffer_size, &buffer);
|
||||
+
|
||||
+ if (efi_status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
|
|
@ -842,19 +849,19 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ }
|
||||
+
|
||||
+ grub_dprintf ("chain", "booting via entry point\n");
|
||||
+ efi_status = entry_point (grub_efi_image_handle,
|
||||
+ grub_efi_system_table);
|
||||
+ efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
|
||||
+ grub_efi_system_table);
|
||||
+
|
||||
+ grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
|
||||
+ grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
|
||||
+ efi_status = b->free_pool (buffer);
|
||||
+ efi_status = efi_call_1 (b->free_pool, buffer);
|
||||
+
|
||||
+ return 1;
|
||||
+
|
||||
+error_exit:
|
||||
+ grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno);
|
||||
+ if (buffer)
|
||||
+ b->free_pool (buffer);
|
||||
+ efi_call_1 (b->free_pool, buffer);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
|
@ -865,7 +872,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ grub_efi_boot_services_t *b;
|
||||
+
|
||||
+ b = grub_efi_system_table->boot_services;
|
||||
+ b->free_pages (address, pages);
|
||||
+ efi_call_2 (b->free_pages, address, pages);
|
||||
+ grub_free (file_path);
|
||||
+ grub_free (cmdline);
|
||||
+ cmdline = 0;
|
||||
|
|
@ -885,8 +892,8 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+
|
||||
+ b = grub_efi_system_table->boot_services;
|
||||
+
|
||||
+ status = b->load_image (0, grub_efi_image_handle, file_path,
|
||||
+ boot_image, fsize, &image_handle);
|
||||
+ status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
|
||||
+ boot_image, fsize, &image_handle);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ if (status == GRUB_EFI_OUT_OF_RESOURCES)
|
||||
|
|
@ -939,28 +946,20 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
grub_efi_status_t status;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_device_t dev = 0;
|
||||
- grub_efi_device_path_t *dp = NULL, *file_path = NULL;
|
||||
grub_efi_device_path_t *dp = 0;
|
||||
- grub_efi_loaded_image_t *loaded_image;
|
||||
+ grub_efi_device_path_t *dp = NULL;
|
||||
char *filename;
|
||||
void *boot_image = 0;
|
||||
- grub_efi_handle_t dev_handle = 0;
|
||||
- grub_efi_physical_address_t address = 0;
|
||||
- grub_efi_uintn_t pages = 0;
|
||||
- grub_efi_char16_t *cmdline = NULL;
|
||||
- grub_efi_handle_t image_handle = NULL;
|
||||
+ int rc;
|
||||
+
|
||||
+ file_path = NULL;
|
||||
+ address = 0;
|
||||
+ pages = 0;
|
||||
+ cmdline = NULL;
|
||||
+ image_handle = NULL;
|
||||
+ dev_handle = 0;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
@@ -236,12 +927,42 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -238,15 +916,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
address = 0;
|
||||
image_handle = 0;
|
||||
file_path = 0;
|
||||
+ dev_handle = 0;
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
|
||||
|
|
@ -989,7 +988,6 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ }
|
||||
+ *(--p16) = 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
|
||||
if (! file)
|
||||
|
|
@ -1002,18 +1000,16 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ dev = grub_device_open (devname);
|
||||
+ if (devname)
|
||||
+ grub_free (devname);
|
||||
if (dev == NULL)
|
||||
;
|
||||
else if (dev->disk)
|
||||
@@ -272,19 +993,16 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
file_path = make_file_path (dp, filename);
|
||||
if (file_path == NULL)
|
||||
goto fail;
|
||||
-
|
||||
- grub_printf ("file path: ");
|
||||
- grub_efi_print_device_path (file_path);
|
||||
}
|
||||
if (! dev)
|
||||
goto fail;
|
||||
|
||||
@@ -283,17 +991,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
if (! file_path)
|
||||
goto fail;
|
||||
|
||||
- grub_printf ("file path: ");
|
||||
- grub_efi_print_device_path (file_path);
|
||||
-
|
||||
- size = grub_file_size (file);
|
||||
- if (!size)
|
||||
+ fsize = grub_file_size (file);
|
||||
|
|
@ -1023,12 +1019,12 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
filename);
|
||||
goto fail;
|
||||
}
|
||||
- pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (size);
|
||||
+ pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (fsize);
|
||||
- pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12);
|
||||
+ pages = (((grub_efi_uintn_t) fsize + ((1 << 12) - 1)) >> 12);
|
||||
|
||||
status = b->allocate_pages (GRUB_EFI_ALLOCATE_ANY_PAGES,
|
||||
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
|
||||
GRUB_EFI_LOADER_CODE,
|
||||
@@ -298,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -307,7 +1012,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
|
||||
boot_image = (void *) ((grub_addr_t) address);
|
||||
|
|
@ -1037,7 +1033,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
{
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
@@ -308,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -317,7 +1022,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
|
|
@ -1046,7 +1042,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
{
|
||||
struct grub_macho_fat_header *head = boot_image;
|
||||
if (head->magic
|
||||
@@ -317,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -326,6 +1031,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_uint32_t i;
|
||||
struct grub_macho_fat_arch *archs
|
||||
= (struct grub_macho_fat_arch *) (head + 1);
|
||||
|
|
@ -1061,7 +1057,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++)
|
||||
{
|
||||
if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype))
|
||||
@@ -331,83 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
@@ -340,79 +1053,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
> ~grub_cpu_to_le32 (archs[i].size)
|
||||
|| grub_cpu_to_le32 (archs[i].offset)
|
||||
+ grub_cpu_to_le32 (archs[i].size)
|
||||
|
|
@ -1079,9 +1075,9 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
}
|
||||
#endif
|
||||
|
||||
- status = b->load_image (0, grub_efi_image_handle, file_path,
|
||||
- boot_image, size,
|
||||
- &image_handle);
|
||||
- status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
|
||||
- boot_image, size,
|
||||
- &image_handle);
|
||||
- if (status != GRUB_EFI_SUCCESS)
|
||||
+ rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize);
|
||||
+ grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc);
|
||||
|
|
@ -1112,7 +1108,6 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
- }
|
||||
- loaded_image->device_handle = dev_handle;
|
||||
-
|
||||
- /* Build load options with arguments from chainloader command line. */
|
||||
- if (argc > 1)
|
||||
- {
|
||||
- int i, len;
|
||||
|
|
@ -1128,7 +1123,7 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
+ grub_load_and_start_image(boot_image);
|
||||
+ grub_file_close (file);
|
||||
+ grub_device_close (dev);
|
||||
+ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
|
||||
+ grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
|
||||
|
||||
- for (i = 1; i < argc; i++)
|
||||
- {
|
||||
|
|
@ -1150,33 +1145,30 @@ index 2036924504b..e4ac39c87b4 100644
|
|||
- grub_file_close (file);
|
||||
- grub_device_close (dev);
|
||||
-
|
||||
- /* We're finished with the source image buffer and file path now. */
|
||||
- b->free_pages (address, pages);
|
||||
- grub_free (file_path);
|
||||
-
|
||||
- grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
|
||||
- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
|
||||
- return 0;
|
||||
-
|
||||
- fail:
|
||||
-
|
||||
+fail:
|
||||
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
@@ -421,6 +1103,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
@@ -424,6 +1097,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
if (address)
|
||||
grub_efi_free_pages (address, pages);
|
||||
efi_call_2 (b->free_pages, address, pages);
|
||||
|
||||
+ if (cmdline)
|
||||
+ grub_free (cmdline);
|
||||
+
|
||||
if (image_handle != NULL)
|
||||
b->unload_image (image_handle);
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
return grub_errno;
|
||||
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
|
||||
index 925394d1767..0a7f8208022 100644
|
||||
index c24202a5dd1..c8ecce6dfd0 100644
|
||||
--- a/grub-core/loader/efi/linux.c
|
||||
+++ b/grub-core/loader/efi/linux.c
|
||||
@@ -98,21 +98,36 @@ struct grub_efi_shim_lock
|
||||
@@ -33,21 +33,34 @@ struct grub_efi_shim_lock
|
||||
};
|
||||
typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
|
||||
|
||||
|
|
@ -1184,12 +1176,12 @@ index 925394d1767..0a7f8208022 100644
|
|||
+int
|
||||
grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
|
||||
{
|
||||
grub_guid_t guid = SHIM_LOCK_GUID;
|
||||
grub_efi_guid_t guid = SHIM_LOCK_GUID;
|
||||
grub_efi_shim_lock_t *shim_lock;
|
||||
+ grub_efi_status_t status;
|
||||
|
||||
shim_lock = grub_efi_locate_protocol(&guid, NULL);
|
||||
|
||||
-
|
||||
+ grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock);
|
||||
if (!shim_lock)
|
||||
- return 1;
|
||||
|
|
@ -1208,18 +1200,17 @@ index 925394d1767..0a7f8208022 100644
|
|||
+ grub_dprintf ("secureboot", "Kernel signature verification passed\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
|
||||
- return 0;
|
||||
+ grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n",
|
||||
+ (unsigned long) status);
|
||||
+
|
||||
+ return -1;
|
||||
|
||||
- return 0;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
||||
index 9bfb4ab9e3e..b59d125286d 100644
|
||||
index bb2616a8092..6b24cbb9483 100644
|
||||
--- a/grub-core/loader/i386/efi/linux.c
|
||||
+++ b/grub-core/loader/i386/efi/linux.c
|
||||
@@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
|
@ -1245,7 +1236,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
|
|||
{
|
||||
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
|
||||
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"),
|
||||
+ argv[0]);
|
||||
+ argv[0]);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -1254,7 +1245,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
|
|||
+ if (rc < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"),
|
||||
argv[0]);
|
||||
argv[0]);
|
||||
@@ -203,6 +208,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -1269,7 +1260,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
|
|||
}
|
||||
|
||||
+ grub_dprintf ("linux", "linux_cmdline = %lx\n",
|
||||
+ (unsigned long)linux_cmdline);
|
||||
+ (unsigned long)linux_cmdline);
|
||||
+
|
||||
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
|
|
@ -1279,7 +1270,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
|
|||
|
||||
params->type_of_loader = 0x21;
|
||||
+ grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n",
|
||||
+ kernel_mem, handover_offset);
|
||||
+ kernel_mem, handover_offset);
|
||||
|
||||
fail:
|
||||
-
|
||||
|
|
@ -1287,7 +1278,7 @@ index 9bfb4ab9e3e..b59d125286d 100644
|
|||
grub_file_close (file);
|
||||
|
||||
diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h
|
||||
index d224daafa4f..b2cfd8c1f44 100644
|
||||
index d9ede36773b..0033d9305a9 100644
|
||||
--- a/include/grub/efi/linux.h
|
||||
+++ b/include/grub/efi/linux.h
|
||||
@@ -22,7 +22,7 @@
|
||||
|
|
@ -1300,10 +1291,10 @@ index d224daafa4f..b2cfd8c1f44 100644
|
|||
grub_err_t
|
||||
EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset,
|
||||
diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
|
||||
index 9887e14b278..a39743396dc 100644
|
||||
index 0ed8781f037..a43adf27464 100644
|
||||
--- a/include/grub/efi/pe32.h
|
||||
+++ b/include/grub/efi/pe32.h
|
||||
@@ -238,7 +238,11 @@ struct grub_pe64_optional_header
|
||||
@@ -223,7 +223,11 @@ struct grub_pe64_optional_header
|
||||
struct grub_pe32_section_table
|
||||
{
|
||||
char name[8];
|
||||
|
|
@ -1316,7 +1307,7 @@ index 9887e14b278..a39743396dc 100644
|
|||
grub_uint32_t virtual_address;
|
||||
grub_uint32_t raw_data_size;
|
||||
grub_uint32_t raw_data_offset;
|
||||
@@ -249,12 +253,18 @@ struct grub_pe32_section_table
|
||||
@@ -234,12 +238,18 @@ struct grub_pe32_section_table
|
||||
grub_uint32_t characteristics;
|
||||
};
|
||||
|
||||
|
|
@ -1339,7 +1330,7 @@ index 9887e14b278..a39743396dc 100644
|
|||
|
||||
#define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000
|
||||
#define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000
|
||||
@@ -263,10 +273,26 @@ struct grub_pe32_section_table
|
||||
@@ -248,10 +258,28 @@ struct grub_pe32_section_table
|
||||
#define GRUB_PE32_SCN_ALIGN_16BYTES 0x00500000
|
||||
#define GRUB_PE32_SCN_ALIGN_32BYTES 0x00600000
|
||||
#define GRUB_PE32_SCN_ALIGN_64BYTES 0x00700000
|
||||
|
|
@ -1362,11 +1353,13 @@ index 9887e14b278..a39743396dc 100644
|
|||
+#define GRUB_PE32_SCN_MEM_EXECUTE 0x20000000
|
||||
+#define GRUB_PE32_SCN_MEM_READ 0x40000000
|
||||
+#define GRUB_PE32_SCN_MEM_WRITE 0x80000000
|
||||
+
|
||||
+
|
||||
+
|
||||
#define GRUB_PE32_SIGNATURE_SIZE 4
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
@@ -292,6 +318,21 @@ struct grub_pe_image_header
|
||||
struct grub_pe32_header
|
||||
@@ -274,6 +302,20 @@ struct grub_pe32_header
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -1383,7 +1376,6 @@ index 9887e14b278..a39743396dc 100644
|
|||
+ struct grub_pe32_coff_header coff_header;
|
||||
+ struct grub_pe64_optional_header optional_header;
|
||||
+};
|
||||
+
|
||||
+
|
||||
struct grub_pe32_fixup_block
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 13 Feb 2024 16:30:24 -0600
|
||||
Date: Tue, 6 Oct 2015 16:09:25 -0400
|
||||
Subject: [PATCH] Make any of the loaders that link in efi mode honor secure
|
||||
boot.
|
||||
|
||||
|
|
@ -9,20 +9,23 @@ won't register commands if SB is enabled."
|
|||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/commands/iorw.c | 7 +++++++
|
||||
grub-core/commands/memrw.c | 7 +++++++
|
||||
grub-core/kern/dl.c | 4 ++--
|
||||
grub-core/loader/efi/appleloader.c | 7 +++++++
|
||||
grub-core/loader/i386/bsd.c | 7 +++++++
|
||||
grub-core/loader/i386/linux.c | 7 +++++++
|
||||
grub-core/loader/i386/pc/linux.c | 7 +++++++
|
||||
grub-core/loader/multiboot.c | 7 +++++++
|
||||
grub-core/loader/xnu.c | 7 +++++++
|
||||
include/grub/ia64/linux.h | 0
|
||||
include/grub/mips/linux.h | 0
|
||||
include/grub/powerpc/linux.h | 0
|
||||
include/grub/sparc64/linux.h | 0
|
||||
13 files changed, 58 insertions(+), 2 deletions(-)
|
||||
grub-core/commands/iorw.c | 7 +++++++
|
||||
grub-core/commands/memrw.c | 7 +++++++
|
||||
grub-core/kern/dl.c | 3 ++-
|
||||
grub-core/kern/efi/efi.c | 34 ----------------------------------
|
||||
grub-core/loader/efi/appleloader.c | 7 +++++++
|
||||
grub-core/loader/efi/chainloader.c | 1 +
|
||||
grub-core/loader/i386/bsd.c | 7 +++++++
|
||||
grub-core/loader/i386/linux.c | 7 +++++++
|
||||
grub-core/loader/i386/pc/linux.c | 7 +++++++
|
||||
grub-core/loader/multiboot.c | 7 +++++++
|
||||
grub-core/loader/xnu.c | 7 +++++++
|
||||
include/grub/efi/efi.h | 1 -
|
||||
include/grub/ia64/linux.h | 0
|
||||
include/grub/mips/linux.h | 0
|
||||
include/grub/powerpc/linux.h | 0
|
||||
include/grub/sparc64/linux.h | 0
|
||||
16 files changed, 59 insertions(+), 36 deletions(-)
|
||||
create mode 100644 include/grub/ia64/linux.h
|
||||
create mode 100644 include/grub/mips/linux.h
|
||||
create mode 100644 include/grub/powerpc/linux.h
|
||||
|
|
@ -93,27 +96,73 @@ index d401a6db0ef..39cf3a06dbd 100644
|
|||
grub_unregister_extcmd (cmd_read_word);
|
||||
grub_unregister_extcmd (cmd_read_dword);
|
||||
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
||||
index d48d4131ba7..2a9ae9fc894 100644
|
||||
index b7149370950..7afb9e6f724 100644
|
||||
--- a/grub-core/kern/dl.c
|
||||
+++ b/grub-core/kern/dl.c
|
||||
@@ -871,13 +871,13 @@ grub_dl_load_file (const char *filename)
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/efi/sb.h>
|
||||
|
||||
/* Platforms where modules are in a readonly area of memory. */
|
||||
#if defined(GRUB_MACHINE_QEMU)
|
||||
@@ -704,7 +705,7 @@ grub_dl_load_file (const char *filename)
|
||||
grub_dl_t mod = 0;
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
- if (grub_efi_get_secureboot ())
|
||||
- if (grub_efi_secure_boot ())
|
||||
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
||||
{
|
||||
#if 0
|
||||
/* This is an error, but grub2-mkconfig still generates a pile of
|
||||
* insmod commands, so emitting it would be mostly just obnoxious. */
|
||||
grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
- "Secure Boot forbids loading module from %s", filename);
|
||||
+ "Secure Boot forbids loading module from %s", filename);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 4a2259aa1c7..8cff7be0289 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
|
||||
}
|
||||
|
||||
-grub_efi_boolean_t
|
||||
-grub_efi_secure_boot (void)
|
||||
-{
|
||||
- grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
- grub_size_t datasize;
|
||||
- char *secure_boot = NULL;
|
||||
- char *setup_mode = NULL;
|
||||
- grub_efi_boolean_t ret = 0;
|
||||
-
|
||||
- secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
|
||||
- if (datasize != 1 || !secure_boot)
|
||||
- {
|
||||
- grub_dprintf ("secureboot", "No SecureBoot variable\n");
|
||||
- goto out;
|
||||
- }
|
||||
- grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot);
|
||||
-
|
||||
- setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
|
||||
- if (datasize != 1 || !setup_mode)
|
||||
- {
|
||||
- grub_dprintf ("secureboot", "No SetupMode variable\n");
|
||||
- goto out;
|
||||
- }
|
||||
- grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode);
|
||||
-
|
||||
- if (*secure_boot && !*setup_mode)
|
||||
- ret = 1;
|
||||
-
|
||||
- out:
|
||||
- grub_free (secure_boot);
|
||||
- grub_free (setup_mode);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
/* Search the mods section from the PE32/PE32+ image. This code uses
|
||||
diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c
|
||||
index a0b61a240b7..35d53c5f85d 100644
|
||||
index 74888c463ba..585f2b57385 100644
|
||||
--- a/grub-core/loader/efi/appleloader.c
|
||||
+++ b/grub-core/loader/efi/appleloader.c
|
||||
@@ -24,6 +24,7 @@
|
||||
|
|
@ -143,8 +192,20 @@ index a0b61a240b7..35d53c5f85d 100644
|
|||
+
|
||||
grub_unregister_command (cmd);
|
||||
}
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index b54cf6986fc..3ff305b1d32 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <grub/efi/disk.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
#include <grub/efi/linux.h>
|
||||
+#include <grub/efi/sb.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/net.h>
|
||||
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
|
||||
index 1f9128f6f20..8075ac9b06a 100644
|
||||
index 5f3290ce17b..54befc26626 100644
|
||||
--- a/grub-core/loader/i386/bsd.c
|
||||
+++ b/grub-core/loader/i386/bsd.c
|
||||
@@ -40,6 +40,7 @@
|
||||
|
|
@ -176,7 +237,7 @@ index 1f9128f6f20..8075ac9b06a 100644
|
|||
grub_unregister_extcmd (cmd_openbsd);
|
||||
grub_unregister_extcmd (cmd_netbsd);
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index 10f967f2563..5a257552234 100644
|
||||
index dccf3bb3005..4aeb0e4b9a6 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -37,6 +37,7 @@
|
||||
|
|
@ -187,7 +248,7 @@ index 10f967f2563..5a257552234 100644
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -1164,6 +1165,9 @@ static grub_command_t cmd_linux, cmd_initrd;
|
||||
@@ -1138,6 +1139,9 @@ static grub_command_t cmd_linux, cmd_initrd;
|
||||
|
||||
GRUB_MOD_INIT(linux)
|
||||
{
|
||||
|
|
@ -197,7 +258,7 @@ index 10f967f2563..5a257552234 100644
|
|||
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
|
||||
0, N_("Load Linux."));
|
||||
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
|
||||
@@ -1173,6 +1177,9 @@ GRUB_MOD_INIT(linux)
|
||||
@@ -1147,6 +1151,9 @@ GRUB_MOD_INIT(linux)
|
||||
|
||||
GRUB_MOD_FINI(linux)
|
||||
{
|
||||
|
|
@ -208,7 +269,7 @@ index 10f967f2563..5a257552234 100644
|
|||
grub_unregister_command (cmd_initrd);
|
||||
}
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 8593d74737f..54a76504a79 100644
|
||||
index 4b1750e360e..e3fa1221e81 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -36,6 +36,7 @@
|
||||
|
|
@ -240,7 +301,7 @@ index 8593d74737f..54a76504a79 100644
|
|||
grub_unregister_command (cmd_linux16);
|
||||
grub_unregister_command (cmd_initrd);
|
||||
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
|
||||
index 94be512c4d0..94c112a29d4 100644
|
||||
index facb13f3d36..47e481f4576 100644
|
||||
--- a/grub-core/loader/multiboot.c
|
||||
+++ b/grub-core/loader/multiboot.c
|
||||
@@ -50,6 +50,7 @@
|
||||
|
|
@ -272,7 +333,7 @@ index 94be512c4d0..94c112a29d4 100644
|
|||
grub_unregister_command (cmd_module);
|
||||
}
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 4cca55df92d..f76f511ac2d 100644
|
||||
index 1c0cf6a430a..baa54e652ab 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -35,6 +35,7 @@
|
||||
|
|
@ -303,6 +364,18 @@ index 4cca55df92d..f76f511ac2d 100644
|
|||
#ifndef GRUB_MACHINE_EMU
|
||||
grub_unregister_command (cmd_resume);
|
||||
#endif
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index 6295df85f3f..585fa6662b6 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
|
||||
const grub_efi_guid_t *guid,
|
||||
void *data,
|
||||
grub_size_t datasize);
|
||||
-grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
|
||||
int
|
||||
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
||||
const grub_efi_device_path_t *dp2);
|
||||
diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h
|
||||
new file mode 100644
|
||||
index 00000000000..e69de29bb2d
|
||||
|
|
@ -7,40 +7,40 @@ Allow booting 64-bit kernels on 32-bit EFI on x86.
|
|||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/loader/efi/linux.c | 9 ++-
|
||||
grub-core/loader/i386/efi/linux.c | 116 ++++++++++++++++++++++++++------------
|
||||
include/grub/i386/linux.h | 5 ++
|
||||
3 files changed, 91 insertions(+), 39 deletions(-)
|
||||
grub-core/loader/efi/linux.c | 9 +++-
|
||||
grub-core/loader/i386/efi/linux.c | 110 ++++++++++++++++++++++++++------------
|
||||
include/grub/i386/linux.h | 7 ++-
|
||||
3 files changed, 89 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
|
||||
index 0a7f8208022..742e8e9af35 100644
|
||||
index c8ecce6dfd0..0622dfa48d4 100644
|
||||
--- a/grub-core/loader/efi/linux.c
|
||||
+++ b/grub-core/loader/efi/linux.c
|
||||
@@ -136,12 +136,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
|
||||
@@ -69,12 +69,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
|
||||
typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *);
|
||||
|
||||
grub_err_t
|
||||
-grub_efi_linux_boot (void *kernel_address, grub_off_t offset,
|
||||
+grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset,
|
||||
-grub_efi_linux_boot (void *kernel_addr, grub_off_t offset,
|
||||
+grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset,
|
||||
void *kernel_params)
|
||||
{
|
||||
handover_func hf;
|
||||
+ int offset = 0;
|
||||
|
||||
- hf = (handover_func)((char *)kernel_address + offset);
|
||||
- hf = (handover_func)((char *)kernel_addr + offset);
|
||||
+#ifdef __x86_64__
|
||||
+ offset = 512;
|
||||
+#endif
|
||||
+
|
||||
+ hf = (handover_func)((char *)kernel_address + handover_offset + offset);
|
||||
+ hf = (handover_func)((char *)kernel_addr + handover_offset + offset);
|
||||
hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
|
||||
|
||||
return GRUB_ERR_BUG;
|
||||
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
||||
index b59d125286d..3c2e30f8751 100644
|
||||
index 6b24cbb9483..3017d0f3e52 100644
|
||||
--- a/grub-core/loader/i386/efi/linux.c
|
||||
+++ b/grub-core/loader/i386/efi/linux.c
|
||||
@@ -44,15 +44,11 @@ static char *linux_cmdline;
|
||||
@@ -44,14 +44,10 @@ static char *linux_cmdline;
|
||||
static grub_err_t
|
||||
grub_linuxefi_boot (void)
|
||||
{
|
||||
|
|
@ -52,13 +52,11 @@ index b59d125286d..3c2e30f8751 100644
|
|||
asm volatile ("cli");
|
||||
|
||||
- return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset,
|
||||
- params);
|
||||
+ return grub_efi_linux_boot ((char *)kernel_mem,
|
||||
+ handover_offset,
|
||||
+ params);
|
||||
params);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
@@ -153,14 +149,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
return grub_errno;
|
||||
}
|
||||
|
|
@ -70,7 +68,7 @@ index b59d125286d..3c2e30f8751 100644
|
|||
+
|
||||
static grub_err_t
|
||||
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
int argc, char *argv[])
|
||||
{
|
||||
grub_file_t file = 0;
|
||||
- struct linux_i386_kernel_header lh;
|
||||
|
|
@ -168,7 +166,7 @@ index b59d125286d..3c2e30f8751 100644
|
|||
+
|
||||
grub_dprintf ("linux", "setting up cmdline\n");
|
||||
linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
|
||||
- BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
- BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
-
|
||||
+ BYTES_TO_PAGES(lh->cmdline_size + 1));
|
||||
if (!linux_cmdline)
|
||||
|
|
@ -178,10 +176,9 @@ index b59d125286d..3c2e30f8751 100644
|
|||
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
linux_cmdline + sizeof (LINUX_IMAGE) - 1,
|
||||
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
|
||||
- GRUB_VERIFY_KERNEL_CMDLINE);
|
||||
- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1),
|
||||
+ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1),
|
||||
+ GRUB_VERIFY_KERNEL_CMDLINE);
|
||||
GRUB_VERIFY_KERNEL_CMDLINE);
|
||||
|
||||
- lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
|
||||
+ grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline);
|
||||
|
|
@ -197,13 +194,13 @@ index b59d125286d..3c2e30f8751 100644
|
|||
+ start = (lh->setup_sects + 1) * 512;
|
||||
|
||||
- kernel_mem = grub_efi_allocate_pages_max(lh.pref_address,
|
||||
- BYTES_TO_PAGES(lh.init_size));
|
||||
- BYTES_TO_PAGES(lh.init_size));
|
||||
+ kernel_mem = grub_efi_allocate_pages_max(lh->pref_address,
|
||||
+ BYTES_TO_PAGES(lh->init_size));
|
||||
|
||||
if (!kernel_mem)
|
||||
kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
|
||||
- BYTES_TO_PAGES(lh.init_size));
|
||||
- BYTES_TO_PAGES(lh.init_size));
|
||||
+ BYTES_TO_PAGES(lh->init_size));
|
||||
|
||||
if (!kernel_mem)
|
||||
|
|
@ -232,7 +229,7 @@ index b59d125286d..3c2e30f8751 100644
|
|||
+ params->ext_loader_type = 0;
|
||||
+ params->ext_loader_ver = 2;
|
||||
grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n",
|
||||
kernel_mem, handover_offset);
|
||||
kernel_mem, handover_offset);
|
||||
|
||||
@@ -301,10 +343,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
loaded = 0;
|
||||
|
|
@ -241,26 +238,27 @@ index b59d125286d..3c2e30f8751 100644
|
|||
- if (linux_cmdline && !loaded)
|
||||
+ if (linux_cmdline && lh && !loaded)
|
||||
grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
|
||||
- linux_cmdline,
|
||||
- BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+ linux_cmdline,
|
||||
linux_cmdline,
|
||||
- BYTES_TO_PAGES(lh.cmdline_size + 1));
|
||||
+ BYTES_TO_PAGES(lh->cmdline_size + 1));
|
||||
|
||||
if (kernel_mem && !loaded)
|
||||
grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem,
|
||||
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
|
||||
index d4b55086953..4ccd9d7d9f2 100644
|
||||
index eddf9251d9a..25ef52c04eb 100644
|
||||
--- a/include/grub/i386/linux.h
|
||||
+++ b/include/grub/i386/linux.h
|
||||
@@ -148,6 +148,11 @@ struct linux_i386_kernel_header
|
||||
@@ -138,7 +138,12 @@ struct linux_i386_kernel_header
|
||||
grub_uint32_t kernel_alignment;
|
||||
grub_uint8_t relocatable;
|
||||
grub_uint8_t min_alignment;
|
||||
- grub_uint8_t pad[2];
|
||||
+#define LINUX_XLF_KERNEL_64 (1<<0)
|
||||
+#define LINUX_XLF_CAN_BE_LOADED_ABOVE_4G (1<<1)
|
||||
+#define LINUX_XLF_EFI_HANDOVER_32 (1<<2)
|
||||
+#define LINUX_XLF_EFI_HANDOVER_64 (1<<3)
|
||||
+#define LINUX_XLF_EFI_KEXEC (1<<4)
|
||||
grub_uint16_t xloadflags;
|
||||
+ grub_uint16_t xloadflags;
|
||||
grub_uint32_t cmdline_size;
|
||||
grub_uint32_t hardware_subarch;
|
||||
grub_uint64_t hardware_subarch_data;
|
||||
|
|
@ -4,14 +4,14 @@ Date: Mon, 8 Jul 2019 12:55:29 +0200
|
|||
Subject: [PATCH] re-write .gitignore
|
||||
|
||||
---
|
||||
.gitignore | 150 ++++++++++++++++++++++++++++++++++++++
|
||||
.gitignore | 152 ++++++++++++++++++++++++++++++++++++++
|
||||
docs/.gitignore | 5 ++
|
||||
grub-core/.gitignore | 16 ++++
|
||||
grub-core/lib/.gitignore | 1 +
|
||||
include/grub/gcrypt/.gitignore | 2 +
|
||||
po/.gitignore | 5 ++
|
||||
util/bash-completion.d/.gitignore | 2 +
|
||||
7 files changed, 181 insertions(+)
|
||||
7 files changed, 183 insertions(+)
|
||||
create mode 100644 docs/.gitignore
|
||||
create mode 100644 grub-core/.gitignore
|
||||
create mode 100644 grub-core/lib/.gitignore
|
||||
|
|
@ -20,10 +20,10 @@ Subject: [PATCH] re-write .gitignore
|
|||
create mode 100644 util/bash-completion.d/.gitignore
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 4d0dfb700e4..a18787dcfe6 100644
|
||||
index f6a1bd05175..594d0134d33 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -279,3 +279,153 @@ widthspec.bin
|
||||
@@ -275,3 +275,155 @@ widthspec.bin
|
||||
/xfs_test
|
||||
/xzcompress_test
|
||||
/zfs_test
|
||||
|
|
@ -152,6 +152,8 @@ index 4d0dfb700e4..a18787dcfe6 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
|
||||
|
|
@ -7,20 +7,16 @@ This is an implementation of IBM client architecture (CAS) reboot for GRUB.
|
|||
|
||||
There are cases where the POWER firmware must reboot in order to support
|
||||
specific features requested by a kernel. The kernel calls
|
||||
ibm,client-architecture-support and it may either return or reboot with
|
||||
the new feature set. eg:
|
||||
ibm,client-architecture-support and it may either return or reboot with the new
|
||||
feature set. eg:
|
||||
|
||||
Calling ibm,client-architecture-support.../
|
||||
Elapsed time since release of system processors: 70959 mins 50 secs
|
||||
Welcome to GRUB!
|
||||
|
||||
Instead of return to the GRUB menu, it will check if the flag for CAS
|
||||
reboot is set. If so, grub will automatically boot the last booted
|
||||
kernel using the same parameters
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
[rharwood@redhat.com: commit message rewrap]
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Instead of return to the GRUB menu, it will check if the flag for CAS reboot is
|
||||
set. If so, grub will automatically boot the last booted kernel using the same
|
||||
parameters
|
||||
---
|
||||
grub-core/kern/ieee1275/openfw.c | 63 ++++++++++++++++++++++++++++++++++++++++
|
||||
grub-core/normal/main.c | 19 ++++++++++++
|
||||
|
|
@ -29,7 +25,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|||
4 files changed, 91 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
|
||||
index 11b2beb2ff2..e2ecc65d2d8 100644
|
||||
index 4d493ab7661..3a6689abb11 100644
|
||||
--- a/grub-core/kern/ieee1275/openfw.c
|
||||
+++ b/grub-core/kern/ieee1275/openfw.c
|
||||
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)
|
||||
|
|
@ -100,7 +96,7 @@ index 11b2beb2ff2..e2ecc65d2d8 100644
|
|||
+ return 0;
|
||||
+}
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index bd44310005d..d3f53d93d87 100644
|
||||
index c4ebe9e22ad..70614de1565 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -34,6 +34,9 @@
|
||||
|
|
@ -137,7 +133,7 @@ index bd44310005d..d3f53d93d87 100644
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index 14ff09094f0..dab8fd2aeb0 100644
|
||||
index 25158407dd8..ad80399246a 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -28,6 +28,9 @@
|
||||
|
|
@ -162,10 +158,10 @@ index 14ff09094f0..dab8fd2aeb0 100644
|
|||
{
|
||||
char *line;
|
||||
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
|
||||
index dddb385149e..4f6e6aaa098 100644
|
||||
index 73e2f464475..0a599607f31 100644
|
||||
--- a/include/grub/ieee1275/ieee1275.h
|
||||
+++ b/include/grub/ieee1275/ieee1275.h
|
||||
@@ -251,6 +251,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
|
||||
@@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
|
||||
void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
|
||||
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
|
||||
struct grub_ieee1275_devalias *alias);
|
||||
|
|
@ -10,14 +10,12 @@ This should fix this bugzilla:
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=908519
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/term/terminfo.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
|
||||
index 4e534c683eb..3dbe88e8933 100644
|
||||
index cd720080375..44d0b3b19fb 100644
|
||||
--- a/grub-core/term/terminfo.c
|
||||
+++ b/grub-core/term/terminfo.c
|
||||
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,
|
||||
|
|
@ -5,9 +5,6 @@ Subject: [PATCH] Disable GRUB video support for IBM power machines
|
|||
|
||||
Should fix the problem in bugzilla:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=973205
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/kern/ieee1275/cmain.c | 5 ++++-
|
||||
grub-core/video/ieee1275.c | 9 ++++++---
|
||||
|
|
@ -15,10 +12,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|||
3 files changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
|
||||
index e74de32483f..810a089a934 100644
|
||||
index 20cbbd761ec..04df9d2c667 100644
|
||||
--- a/grub-core/kern/ieee1275/cmain.c
|
||||
+++ b/grub-core/kern/ieee1275/cmain.c
|
||||
@@ -89,7 +89,10 @@ grub_ieee1275_find_options (void)
|
||||
@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void)
|
||||
}
|
||||
|
||||
if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
|
||||
|
|
@ -31,10 +28,10 @@ index e74de32483f..810a089a934 100644
|
|||
/* Old Macs have no key repeat, newer ones have fully working one.
|
||||
The ones inbetween when repeated key generates an escaoe sequence
|
||||
diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c
|
||||
index ca3d3c3b2c8..5592e4bb7c9 100644
|
||||
index 17a3dbbb575..b8e4b3feb32 100644
|
||||
--- a/grub-core/video/ieee1275.c
|
||||
+++ b/grub-core/video/ieee1275.c
|
||||
@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
|
||||
@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
|
||||
|
||||
GRUB_MOD_INIT(ieee1275_fb)
|
||||
{
|
||||
|
|
@ -51,14 +48,14 @@ index ca3d3c3b2c8..5592e4bb7c9 100644
|
|||
|
||||
GRUB_MOD_FINI(ieee1275_fb)
|
||||
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
|
||||
index 4f6e6aaa098..db0ec5f4c68 100644
|
||||
index 0a599607f31..b5a1d49bbc3 100644
|
||||
--- a/include/grub/ieee1275/ieee1275.h
|
||||
+++ b/include/grub/ieee1275/ieee1275.h
|
||||
@@ -145,6 +145,8 @@ enum grub_ieee1275_flag
|
||||
GRUB_IEEE1275_FLAG_POWER_VM,
|
||||
@@ -148,6 +148,8 @@ enum grub_ieee1275_flag
|
||||
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
|
||||
|
||||
GRUB_IEEE1275_FLAG_POWER_KVM,
|
||||
+
|
||||
GRUB_IEEE1275_FLAG_RAW_DEVNAMES,
|
||||
+
|
||||
+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
|
||||
};
|
||||
|
||||
|
|
@ -10,10 +10,10 @@ Apparently these go in a new place now.
|
|||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index cd667a2eb75..ae3a49321ad 100644
|
||||
index 74719416c4c..c0103b30d4e 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -319,6 +319,14 @@ AC_SUBST(grubdirname)
|
||||
@@ -314,6 +314,14 @@ AC_SUBST(grubdirname)
|
||||
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
|
||||
[Default grub directory name])
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ index cd667a2eb75..ae3a49321ad 100644
|
|||
#
|
||||
# Checks for build programs.
|
||||
#
|
||||
@@ -534,6 +542,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
|
||||
@@ -525,6 +533,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
|
||||
# Check for target programs.
|
||||
#
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 58 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
|
||||
index 6a90e091f22..6444ee6f969 100644
|
||||
index 8397886fa05..d7a222e681b 100644
|
||||
--- a/grub-core/normal/menu.c
|
||||
+++ b/grub-core/normal/menu.c
|
||||
@@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout)
|
||||
|
|
@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/commands/minicmd.c | 20 ++++++++++++++++----
|
||||
grub-core/kern/efi/efi.c | 9 +++++++--
|
||||
grub-core/kern/emu/main.c | 2 +-
|
||||
grub-core/kern/emu/misc.c | 9 +++++----
|
||||
grub-core/kern/emu/misc.c | 5 +++--
|
||||
grub-core/kern/i386/coreboot/init.c | 2 +-
|
||||
grub-core/kern/i386/qemu/init.c | 2 +-
|
||||
grub-core/kern/ieee1275/init.c | 2 +-
|
||||
|
|
@ -24,7 +24,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/kern/uboot/init.c | 6 +++---
|
||||
grub-core/kern/xen/init.c | 2 +-
|
||||
include/grub/misc.h | 2 +-
|
||||
14 files changed, 50 insertions(+), 23 deletions(-)
|
||||
14 files changed, 48 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
|
||||
index fa498931ed2..2bd3ac76f2d 100644
|
||||
|
|
@ -60,10 +60,10 @@ index fa498931ed2..2bd3ac76f2d 100644
|
|||
}
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index b93ae3aba12..885d7c6420e 100644
|
||||
index 8cff7be0289..05d8237a9b2 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -175,11 +175,16 @@ grub_reboot (void)
|
||||
@@ -165,11 +165,16 @@ grub_reboot (void)
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -76,14 +76,14 @@ index b93ae3aba12..885d7c6420e 100644
|
|||
+ rc = GRUB_EFI_SUCCESS;
|
||||
+
|
||||
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
|
||||
grub_efi_system_table->boot_services->exit (grub_efi_image_handle,
|
||||
- GRUB_EFI_SUCCESS, 0, 0);
|
||||
+ rc, 0, 0);
|
||||
efi_call_4 (grub_efi_system_table->boot_services->exit,
|
||||
- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
|
||||
+ grub_efi_image_handle, rc, 0, 0);
|
||||
for (;;) ;
|
||||
}
|
||||
|
||||
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
|
||||
index 855b11c3dec..38c1576a2ef 100644
|
||||
index 425bb960347..55ea5a11ccd 100644
|
||||
--- a/grub-core/kern/emu/main.c
|
||||
+++ b/grub-core/kern/emu/main.c
|
||||
@@ -67,7 +67,7 @@ grub_reboot (void)
|
||||
|
|
@ -96,19 +96,10 @@ index 855b11c3dec..38c1576a2ef 100644
|
|||
grub_reboot ();
|
||||
}
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 521220b49d2..16c79bc9488 100644
|
||||
index dfd8a8ec488..0ff13bcaf8c 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -83,7 +83,7 @@ grub_util_error (const char *fmt, ...)
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
fprintf (stderr, ".\n");
|
||||
- grub_exit ();
|
||||
+ grub_exit (1);
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -152,12 +152,13 @@ xasprintf (const char *fmt, ...)
|
||||
@@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...)
|
||||
|
||||
#if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
|
||||
void
|
||||
|
|
@ -116,17 +107,13 @@ index 521220b49d2..16c79bc9488 100644
|
|||
+__attribute__ ((noreturn))
|
||||
+grub_exit (int rc)
|
||||
{
|
||||
-#if defined (GRUB_KERNEL)
|
||||
+#if defined (GRUB_KERNEL) && !defined (GRUB_MACHINE_EFI)
|
||||
grub_reboot ();
|
||||
#endif
|
||||
- exit (1);
|
||||
+ exit (rc < 0 ? 1 : rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c
|
||||
index 4fae8b571f1..feaf9295e30 100644
|
||||
index 3314f027fec..36f9134b7b7 100644
|
||||
--- a/grub-core/kern/i386/coreboot/init.c
|
||||
+++ b/grub-core/kern/i386/coreboot/init.c
|
||||
@@ -41,7 +41,7 @@ extern grub_uint8_t _end[];
|
||||
|
|
@ -139,7 +126,7 @@ index 4fae8b571f1..feaf9295e30 100644
|
|||
/* We can't use grub_fatal() in this function. This would create an infinite
|
||||
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
|
||||
diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c
|
||||
index 08f81d25e68..604fc94b5a0 100644
|
||||
index 271b6fbfabd..9fafe98f015 100644
|
||||
--- a/grub-core/kern/i386/qemu/init.c
|
||||
+++ b/grub-core/kern/i386/qemu/init.c
|
||||
@@ -42,7 +42,7 @@ extern grub_uint8_t _end[];
|
||||
|
|
@ -152,11 +139,11 @@ index 08f81d25e68..604fc94b5a0 100644
|
|||
/* We can't use grub_fatal() in this function. This would create an infinite
|
||||
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
|
||||
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
|
||||
index fb7d1a3bacf..50c65b2f6e5 100644
|
||||
index d483e35eed2..e71d1584164 100644
|
||||
--- a/grub-core/kern/ieee1275/init.c
|
||||
+++ b/grub-core/kern/ieee1275/init.c
|
||||
@@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack;
|
||||
#define BYTE22 (DY_MEM_V2 | DRC_INFO)
|
||||
@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack;
|
||||
#endif
|
||||
|
||||
void
|
||||
-grub_exit (void)
|
||||
|
|
@ -178,7 +165,7 @@ index 2ed3ff3191e..5c40c34078d 100644
|
|||
GRUB_ARC_FIRMWARE_VECTOR->exit ();
|
||||
|
||||
diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c
|
||||
index 5bd721260f6..97b09b0eeea 100644
|
||||
index 7b96531b983..dff598ca7b0 100644
|
||||
--- a/grub-core/kern/mips/loongson/init.c
|
||||
+++ b/grub-core/kern/mips/loongson/init.c
|
||||
@@ -304,7 +304,7 @@ grub_halt (void)
|
||||
|
|
@ -191,7 +178,7 @@ index 5bd721260f6..97b09b0eeea 100644
|
|||
grub_halt ();
|
||||
}
|
||||
diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c
|
||||
index b5477b87ffa..69488a34e7c 100644
|
||||
index be88b77d22d..8b6c55ffc01 100644
|
||||
--- a/grub-core/kern/mips/qemu_mips/init.c
|
||||
+++ b/grub-core/kern/mips/qemu_mips/init.c
|
||||
@@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused)))
|
||||
|
|
@ -204,10 +191,10 @@ index b5477b87ffa..69488a34e7c 100644
|
|||
grub_halt ();
|
||||
}
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index 7cee5d75c3c..11037dc0227 100644
|
||||
index 3af336ee227..63b586d09cb 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -1311,9 +1311,18 @@ grub_abort (void)
|
||||
@@ -1209,9 +1209,18 @@ grub_abort (void)
|
||||
grub_getkey ();
|
||||
}
|
||||
|
||||
|
|
@ -266,15 +253,15 @@ index 782ca72952a..708b060f324 100644
|
|||
struct sched_shutdown arg;
|
||||
|
||||
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
||||
index 1b35a167fde..72aff15750d 100644
|
||||
index 7d2b5519690..fd18e6320b8 100644
|
||||
--- a/include/grub/misc.h
|
||||
+++ b/include/grub/misc.h
|
||||
@@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
|
||||
@@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
|
||||
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
|
||||
__attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
|
||||
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT;
|
||||
|
||||
-void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
+void EXPORT_FUNC(grub_exit) (int rc) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
||||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
|
|
@ -6,14 +6,14 @@ Subject: [PATCH] Make efi machines load an env block from a variable
|
|||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/Makefile.core.def | 1 +
|
||||
grub-core/kern/efi/init.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 35 insertions(+)
|
||||
grub-core/kern/efi/init.c | 36 +++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 36 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 1571421d7e8..0bffbfea917 100644
|
||||
index 45d3edaa4dc..c865a08b027 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -219,6 +219,7 @@ kernel = {
|
||||
@@ -207,6 +207,7 @@ kernel = {
|
||||
efi = kern/efi/acpi.c;
|
||||
efi = kern/efi/sb.c;
|
||||
efi = kern/lockdown.c;
|
||||
|
|
@ -22,10 +22,10 @@ index 1571421d7e8..0bffbfea917 100644
|
|||
i386_multiboot = kern/i386/pc/acpi.c;
|
||||
i386_coreboot = kern/acpi.c;
|
||||
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
|
||||
index 6c54af6e79e..b5201974a76 100644
|
||||
index 7facacf09c7..6d39bd3ad29 100644
|
||||
--- a/grub-core/kern/efi/init.c
|
||||
+++ b/grub-core/kern/efi/init.c
|
||||
@@ -28,8 +28,11 @@
|
||||
@@ -27,8 +27,11 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/kernel.h>
|
||||
|
|
@ -36,8 +36,8 @@ index 6c54af6e79e..b5201974a76 100644
|
|||
+
|
||||
#ifdef GRUB_STACK_PROTECTOR
|
||||
|
||||
static grub_efi_char16_t stack_chk_fail_msg[] =
|
||||
@@ -103,6 +106,36 @@ stack_protector_init (void)
|
||||
static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
|
||||
@@ -82,6 +85,36 @@ stack_protector_init (void)
|
||||
|
||||
grub_addr_t grub_modbase;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ index 6c54af6e79e..b5201974a76 100644
|
|||
+static void
|
||||
+grub_efi_env_init (void)
|
||||
+{
|
||||
+ grub_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
|
||||
+ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
|
||||
+ struct grub_envblk envblk_s = { NULL, 0 };
|
||||
+ grub_envblk_t envblk = &envblk_s;
|
||||
+
|
||||
|
|
@ -71,14 +71,19 @@ index 6c54af6e79e..b5201974a76 100644
|
|||
+ grub_free (envblk_s.buf);
|
||||
+}
|
||||
+
|
||||
__attribute__ ((__optimize__ ("-fno-stack-protector"))) void
|
||||
void
|
||||
grub_efi_init (void)
|
||||
{
|
||||
@@ -128,6 +161,7 @@ grub_efi_init (void)
|
||||
|
||||
grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL);
|
||||
@@ -108,10 +141,11 @@ grub_efi_init (void)
|
||||
efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
|
||||
0, 0, 0, NULL);
|
||||
|
||||
+ grub_efi_env_init ();
|
||||
grub_efidisk_init ();
|
||||
}
|
||||
|
||||
-void (*grub_efi_net_config) (grub_efi_handle_t hnd,
|
||||
+void (*grub_efi_net_config) (grub_efi_handle_t hnd,
|
||||
char **device,
|
||||
char **path);
|
||||
|
||||
grub_efi_register_debug_commands ();
|
||||
|
|
@ -3,11 +3,8 @@ From: Mark Hamzy <hamzy@us.ibm.com>
|
|||
Date: Wed, 28 Mar 2012 14:46:41 -0500
|
||||
Subject: [PATCH] Migrate PPC from Yaboot to Grub2
|
||||
|
||||
Add configuration support for serial terminal consoles. This will set
|
||||
the maximum screen size so that text is not overwritten.
|
||||
|
||||
Signed-off-by: Mark Hamzy <hamzy@us.ibm.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Add configuration support for serial terminal consoles. This will set the
|
||||
maximum screen size so that text is not overwritten.
|
||||
---
|
||||
Makefile.util.def | 7 +++
|
||||
util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++
|
||||
|
|
@ -15,11 +12,11 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|||
create mode 100644 util/grub.d/20_ppc_terminfo.in
|
||||
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index 9432365a9df..09bfcadd976 100644
|
||||
index f8b356cc1fa..2c9b283a230 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -517,6 +517,13 @@ script = {
|
||||
installdir = grubconf;
|
||||
@@ -508,6 +508,13 @@ script = {
|
||||
condition = COND_HOST_LINUX;
|
||||
};
|
||||
|
||||
+script = {
|
||||
|
|
@ -8,16 +8,13 @@ found. It was originally written by Matthew Garrett, and adapted to fix the
|
|||
"No modules are loaded on grub2 network boot" issue:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=857936
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/kern/main.c | 13 ++++++-------
|
||||
grub-core/normal/main.c | 25 ++++++++++++++++++++++++-
|
||||
2 files changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
|
||||
index 731c07c2901..463dafdba02 100644
|
||||
index 73967e2f5b0..d1de9fa6873 100644
|
||||
--- a/grub-core/kern/main.c
|
||||
+++ b/grub-core/kern/main.c
|
||||
@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)
|
||||
|
|
@ -44,7 +41,7 @@ index 731c07c2901..463dafdba02 100644
|
|||
}
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index d3f53d93d87..08f48c71df1 100644
|
||||
index 70614de1565..62571e6dfcc 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
|
|
@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
3 files changed, 75 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
|
||||
index ed65865050a..5455242c352 100644
|
||||
index cc3290311f0..8f67a4be7f0 100644
|
||||
--- a/grub-core/commands/wildcard.c
|
||||
+++ b/grub-core/commands/wildcard.c
|
||||
@@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename)
|
||||
|
|
@ -97,7 +97,7 @@ index ed0b149dca5..8e2294d8ff6 100644
|
|||
|
||||
*buf++ = *c;
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index dab8fd2aeb0..c19b4bf700e 100644
|
||||
index ad80399246a..0c6dd9c5201 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0;
|
||||
|
|
@ -28,10 +28,10 @@ Signed-off-by: Will Thompson <wjt@endlessm.com>
|
|||
create mode 100644 grub-core/commands/loadenv.h
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 0bffbfea917..47c0fc755a2 100644
|
||||
index c865a08b027..c15e91943b9 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -842,6 +842,16 @@ module = {
|
||||
@@ -814,6 +814,16 @@ module = {
|
||||
common = commands/blocklist.c;
|
||||
};
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ index 0bffbfea917..47c0fc755a2 100644
|
|||
module = {
|
||||
name = boot;
|
||||
common = commands/boot.c;
|
||||
@@ -1009,6 +1019,7 @@ module = {
|
||||
@@ -980,6 +990,7 @@ module = {
|
||||
module = {
|
||||
name = loadenv;
|
||||
common = commands/loadenv.c;
|
||||
|
|
@ -1240,7 +1240,7 @@ index 00000000000..e907a6a5d28
|
|||
+ grub_unregister_extcmd (oldcmd);
|
||||
+}
|
||||
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
|
||||
index e9e9d94eff5..2c5d1a0ef9a 100644
|
||||
index cc5971f4dbd..782761c31aa 100644
|
||||
--- a/grub-core/commands/legacycfg.c
|
||||
+++ b/grub-core/commands/legacycfg.c
|
||||
@@ -143,7 +143,7 @@ legacy_file (const char *filename)
|
||||
|
|
@ -1263,7 +1263,7 @@ index e9e9d94eff5..2c5d1a0ef9a 100644
|
|||
}
|
||||
|
||||
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
|
||||
index 16644584978..dfcb19e0ff8 100644
|
||||
index 3fd664aac33..163b9a09042 100644
|
||||
--- a/grub-core/commands/loadenv.c
|
||||
+++ b/grub-core/commands/loadenv.c
|
||||
@@ -28,6 +28,8 @@
|
||||
|
|
@ -1430,7 +1430,7 @@ index 720e6d8ea3b..b194123eb67 100644
|
|||
src[len - 1] = ch;
|
||||
args[argc - 1] = src;
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 08f48c71df1..1317279c081 100644
|
||||
index 62571e6dfcc..7ca2e5400b1 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -21,6 +21,7 @@
|
||||
|
|
@ -1553,7 +1553,7 @@ index 00000000000..952f46121bd
|
|||
+ return 0;
|
||||
+}
|
||||
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
|
||||
index 0c5519387b2..441a9eca07c 100644
|
||||
index 8f3be3ae706..ebafec68957 100644
|
||||
--- a/include/grub/compiler.h
|
||||
+++ b/include/grub/compiler.h
|
||||
@@ -56,4 +56,6 @@
|
||||
|
|
@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin <dmarlin@redhat.com>
|
|||
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index 7516a015be0..7b355115dd4 100644
|
||||
index f8cbb8d7a2b..91d761bae80 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -252,7 +252,8 @@ export GRUB_DEFAULT \
|
||||
@@ -251,7 +251,8 @@ export GRUB_DEFAULT \
|
||||
GRUB_ENABLE_CRYPTODISK \
|
||||
GRUB_BADRAM \
|
||||
GRUB_OS_PROBER_SKIP_LIST \
|
||||
|
|
@ -34,10 +34,10 @@ index 7516a015be0..7b355115dd4 100644
|
|||
if test "x${grub_cfg}" != "x"; then
|
||||
rm -f "${grub_cfg}.new"
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index cc393be7eda..00d4b220ccb 100644
|
||||
index e8b01c0d0c7..dc75a1c30bf 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -155,6 +155,13 @@ EOF
|
||||
@@ -153,6 +153,13 @@ EOF
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
echo '$(echo "$message" | grub_quote)'
|
||||
initrd $(echo $initrd_path)
|
||||
|
|
@ -51,7 +51,7 @@ index cc393be7eda..00d4b220ccb 100644
|
|||
EOF
|
||||
fi
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
@@ -250,6 +257,14 @@ for linux in ${reverse_sorted_list}; do
|
||||
@@ -236,6 +243,14 @@ while [ "x$list" != "x" ] ; do
|
||||
gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
|
||||
fi
|
||||
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 14 Mar 2011 14:27:42 -0400
|
||||
Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
|
||||
|
||||
[rharwood: say it even less]
|
||||
---
|
||||
grub-core/normal/main.c | 2 +-
|
||||
tests/util/grub-shell-tester.in | 2 +-
|
||||
tests/util/grub-shell.in | 2 +-
|
||||
util/grub.d/10_linux.in | 4 ++--
|
||||
util/grub.d/20_linux_xen.in | 4 ++--
|
||||
5 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 1317279c081..568c2adfa16 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term,
|
||||
|
||||
grub_term_cls (term);
|
||||
|
||||
- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
|
||||
+ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION);
|
||||
if (!msg_formatted)
|
||||
return;
|
||||
|
||||
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
|
||||
index 8a87109b152..9a4319d4f4f 100644
|
||||
--- a/tests/util/grub-shell-tester.in
|
||||
+++ b/tests/util/grub-shell-tester.in
|
||||
@@ -56,7 +56,7 @@ for option in "$@"; do
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
- echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--modules=*)
|
||||
ms=`echo "$option" | sed -e 's/--modules=//'`
|
||||
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
|
||||
index 496e1bab33c..e0570c88e15 100644
|
||||
--- a/tests/util/grub-shell.in
|
||||
+++ b/tests/util/grub-shell.in
|
||||
@@ -243,7 +243,7 @@ for option in "$@"; do
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
- echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--trim)
|
||||
trim=1 ;;
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 00d4b220ccb..901745707f1 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index 94dd8be1342..98ee5bc58dc 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
176
0020-Don-t-write-messages-to-the-screen.patch
Normal file
176
0020-Don-t-write-messages-to-the-screen.patch
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 13:30:20 -0400
|
||||
Subject: [PATCH] Don't write messages to the screen
|
||||
|
||||
Writing messages to the screen before the menus or boot splash
|
||||
happens so quickly it looks like something is wrong and isn't
|
||||
very appealing.
|
||||
---
|
||||
grub-core/gettext/gettext.c | 25 +++++--------------------
|
||||
grub-core/kern/main.c | 5 -----
|
||||
grub-core/boot/i386/pc/boot.S | 3 ---
|
||||
grub-core/boot/i386/pc/diskboot.S | 5 -----
|
||||
util/grub.d/10_linux.in | 7 -------
|
||||
5 files changed, 5 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
|
||||
index 4d02e62c109..84d520cd494 100644
|
||||
--- a/grub-core/gettext/gettext.c
|
||||
+++ b/grub-core/gettext/gettext.c
|
||||
@@ -434,16 +434,12 @@ static char *
|
||||
grub_gettext_env_write_lang (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, val, grub_env_get ("locale_dir"),
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
err = grub_gettext_init_ext (&secondary_context, val,
|
||||
grub_env_get ("secondary_locale_dir"), 0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
return grub_strdup (val);
|
||||
}
|
||||
@@ -451,23 +447,19 @@ grub_gettext_env_write_lang (struct grub_env_var *var
|
||||
void
|
||||
grub_gettext_reread_prefix (const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"),
|
||||
grub_env_get ("locale_dir"),
|
||||
val);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
}
|
||||
|
||||
static char *
|
||||
read_main (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), val,
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
return grub_strdup (val);
|
||||
}
|
||||
|
||||
@@ -475,12 +467,9 @@ static char *
|
||||
read_secondary (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&secondary_context, grub_env_get ("lang"), val,
|
||||
0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
-
|
||||
return grub_strdup (val);
|
||||
}
|
||||
|
||||
@@ -500,18 +489,14 @@ grub_cmd_translate (grub_command_t cmd __attribute__ ((unused)),
|
||||
GRUB_MOD_INIT (gettext)
|
||||
{
|
||||
const char *lang;
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
|
||||
lang = grub_env_get ("lang");
|
||||
|
||||
err = grub_gettext_init_ext (&main_context, lang, grub_env_get ("locale_dir"),
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
err = grub_gettext_init_ext (&secondary_context, lang,
|
||||
grub_env_get ("secondary_locale_dir"), 0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
grub_register_variable_hook ("locale_dir", NULL, read_main);
|
||||
grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary);
|
||||
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
|
||||
index d1de9fa6873..48058d983ce 100644
|
||||
--- a/grub-core/kern/main.c
|
||||
+++ b/grub-core/kern/main.c
|
||||
@@ -269,11 +269,6 @@ grub_main (void)
|
||||
|
||||
grub_boot_time ("After machine init.");
|
||||
|
||||
- /* Hello. */
|
||||
- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
- grub_printf ("Welcome to GRUB!\n\n");
|
||||
- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
-
|
||||
/* Init verifiers API. */
|
||||
grub_verifiers_init ();
|
||||
|
||||
diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S
|
||||
index 2bd0b2d2866..ea167fe1206 100644
|
||||
--- a/grub-core/boot/i386/pc/boot.S
|
||||
+++ b/grub-core/boot/i386/pc/boot.S
|
||||
@@ -249,9 +249,6 @@ real_start:
|
||||
/* save drive reference first thing! */
|
||||
pushw %dx
|
||||
|
||||
- /* print a notification message on the screen */
|
||||
- MSG(notification_string)
|
||||
-
|
||||
/* set %si to the disk address packet */
|
||||
movw $disk_address_packet, %si
|
||||
|
||||
diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S
|
||||
index c1addc0df29..68d31de0c4c 100644
|
||||
--- a/grub-core/boot/i386/pc/diskboot.S
|
||||
+++ b/grub-core/boot/i386/pc/diskboot.S
|
||||
@@ -50,11 +50,6 @@ _start:
|
||||
/* save drive reference first thing! */
|
||||
pushw %dx
|
||||
|
||||
- /* print a notification message on the screen */
|
||||
- pushw %si
|
||||
- MSG(notification_string)
|
||||
- popw %si
|
||||
-
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
movw $LOCAL(firstlist), %di
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index dc75a1c30bf..ad2ac4b078d 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -138,27 +138,20 @@ linux_entry ()
|
||||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
||||
fi
|
||||
- message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
- # TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||
- message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||
initrd_path=
|
||||
for i in ${initrd}; do
|
||||
initrd_path="${initrd_path} ${rel_dirname}/${i}"
|
||||
done
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
initrd $(echo $initrd_path)
|
||||
EOF
|
||||
fi
|
||||
if test -n "${fdt}" ; then
|
||||
- message="$(gettext_printf "Loading fdt ...")"
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
devicetree ${rel_dirname}/${fdt}
|
||||
EOF
|
||||
fi
|
||||
42
0021-Don-t-print-GNU-GRUB-header.patch
Normal file
42
0021-Don-t-print-GNU-GRUB-header.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 13:53:48 -0400
|
||||
Subject: [PATCH] Don't print GNU GRUB header
|
||||
|
||||
No one cares.
|
||||
---
|
||||
grub-core/normal/main.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 7ca2e5400b1..5d5f7b539f5 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -208,15 +208,16 @@ read_config_file (const char *config)
|
||||
/* Initialize the screen. */
|
||||
void
|
||||
grub_normal_init_page (struct grub_term_output *term,
|
||||
- int y)
|
||||
+ int y __attribute__((__unused__)))
|
||||
{
|
||||
+ grub_term_cls (term);
|
||||
+
|
||||
+#if 0
|
||||
grub_ssize_t msg_len;
|
||||
int posx;
|
||||
char *msg_formatted;
|
||||
grub_uint32_t *unicode_msg;
|
||||
grub_uint32_t *last_position;
|
||||
-
|
||||
- grub_term_cls (term);
|
||||
|
||||
msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
|
||||
if (!msg_formatted)
|
||||
@@ -241,6 +242,7 @@ grub_normal_init_page (struct grub_term_output *term,
|
||||
grub_putcode ('\n', term);
|
||||
grub_putcode ('\n', term);
|
||||
grub_free (unicode_msg);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void
|
||||
23
0022-Don-t-add-to-highlighted-row.patch
Normal file
23
0022-Don-t-add-to-highlighted-row.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 17:49:45 -0400
|
||||
Subject: [PATCH] Don't add '*' to highlighted row
|
||||
|
||||
It is already highlighted.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 18240e76cea..65deafda531 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
||||
unicode_title[i] = ' ';
|
||||
|
||||
if (data->geo.num_entries > 1)
|
||||
- grub_putcode (highlight ? '*' : ' ', data->term);
|
||||
+ grub_putcode (' ', data->term);
|
||||
|
||||
grub_print_ucs4_menu (unicode_title,
|
||||
unicode_title + len,
|
||||
68
0023-Message-string-cleanups.patch
Normal file
68
0023-Message-string-cleanups.patch
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 11:09:04 -0400
|
||||
Subject: [PATCH] Message string cleanups
|
||||
|
||||
Make use of terminology consistent. Remove jargon.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 21 +++++++++------------
|
||||
1 file changed, 9 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 65deafda531..cc5837ed2b8 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
|
||||
if (edit)
|
||||
{
|
||||
- ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
|
||||
-supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
|
||||
-command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
+ ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
|
||||
+command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term, dry_run);
|
||||
}
|
||||
@@ -167,8 +166,8 @@ command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
{
|
||||
char *msg_translated;
|
||||
|
||||
- msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
|
||||
- "entry is highlighted."),
|
||||
+ msg_translated = grub_xasprintf (_("Use the %C and %C keys to change the "
|
||||
+ "selection."),
|
||||
GRUB_UNICODE_UPARROW,
|
||||
GRUB_UNICODE_DOWNARROW);
|
||||
if (!msg_translated)
|
||||
@@ -181,17 +180,15 @@ command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
if (nested)
|
||||
{
|
||||
ret += grub_print_message_indented_real
|
||||
- (_("Press enter to boot the selected OS, "
|
||||
- "`e' to edit the commands before booting "
|
||||
- "or `c' for a command-line. ESC to return previous menu."),
|
||||
+ (_("Press 'e' to edit the selected item, "
|
||||
+ "or 'c' for a command prompt. Press Escape to return to the previous menu."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret += grub_print_message_indented_real
|
||||
- (_("Press enter to boot the selected OS, "
|
||||
- "`e' to edit the commands before booting "
|
||||
- "or `c' for a command-line."),
|
||||
+ (_("Press 'e' to edit the selected item, "
|
||||
+ "or 'c' for a command prompt."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
}
|
||||
@@ -443,7 +440,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
|
||||
|| data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
|
||||
msg_translated = grub_xasprintf (_("%ds"), timeout);
|
||||
else
|
||||
- msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
|
||||
+ msg_translated = grub_xasprintf (_("The selected entry will be started automatically in %ds."), timeout);
|
||||
if (!msg_translated)
|
||||
{
|
||||
grub_print_error ();
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:08:23 -0400
|
||||
Subject: [PATCH] Fix border spacing now that we aren't displaying it
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index cc5837ed2b8..b49835a9af7 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit,
|
||||
int empty_lines = 1;
|
||||
int version_msg = 1;
|
||||
|
||||
- geo->border = 1;
|
||||
- geo->first_entry_x = 1 /* margin */ + 1 /* border */;
|
||||
+ geo->border = 0;
|
||||
+ geo->first_entry_x = 0 /* margin */ + 0 /* border */;
|
||||
geo->entry_width = grub_term_width (term) - 5;
|
||||
|
||||
geo->first_entry_y = 2 /* two empty lines*/
|
||||
- + 1 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
+ + 0 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
|
||||
geo->timeout_lines = 2;
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:08:49 -0400
|
||||
Subject: [PATCH] Use the correct indentation for the term help text
|
||||
|
||||
That is consistent with the menu help text
|
||||
---
|
||||
grub-core/normal/main.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 5d5f7b539f5..ec1cd257397 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -440,8 +440,8 @@ grub_normal_reader_init (int nested)
|
||||
grub_normal_init_page (term, 1);
|
||||
grub_term_setcursor (term, 1);
|
||||
|
||||
- if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
|
||||
- grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
|
||||
+ if (grub_term_width (term) > 2 * STANDARD_MARGIN + 20)
|
||||
+ grub_print_message_indented (msg_formatted, STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
else
|
||||
grub_print_message_indented (msg_formatted, 0, 0, term);
|
||||
grub_putcode ('\n', term);
|
||||
23
0026-Indent-menu-entries.patch
Normal file
23
0026-Indent-menu-entries.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:30:55 -0400
|
||||
Subject: [PATCH] Indent menu entries
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index b49835a9af7..6a57376fa80 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
||||
unicode_title[i] = ' ';
|
||||
|
||||
if (data->geo.num_entries > 1)
|
||||
- grub_putcode (' ', data->term);
|
||||
+ for (i = 0; i < STANDARD_MARGIN; i++)
|
||||
+ grub_putcode (' ', data->term);
|
||||
|
||||
grub_print_ucs4_menu (unicode_title,
|
||||
unicode_title + len,
|
||||
34
0027-Fix-margins.patch
Normal file
34
0027-Fix-margins.patch
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:59:36 -0400
|
||||
Subject: [PATCH] Fix margins
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 6a57376fa80..cbd62f714cb 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit,
|
||||
int version_msg = 1;
|
||||
|
||||
geo->border = 0;
|
||||
- geo->first_entry_x = 0 /* margin */ + 0 /* border */;
|
||||
- geo->entry_width = grub_term_width (term) - 5;
|
||||
+ geo->first_entry_x = 0; /* no margin */
|
||||
+ geo->entry_width = grub_term_width (term) - 1;
|
||||
|
||||
- geo->first_entry_y = 2 /* two empty lines*/
|
||||
- + 0 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
+ geo->first_entry_y = 3; /* three empty lines*/
|
||||
|
||||
geo->timeout_lines = 2;
|
||||
|
||||
/* 3 lines for timeout message and bottom margin. 2 lines for the border. */
|
||||
geo->num_entries = grub_term_height (term) - geo->first_entry_y
|
||||
- - 1 /* bottom border */
|
||||
- 1 /* empty line before info message*/
|
||||
- geo->timeout_lines /* timeout */
|
||||
- 1 /* empty final line */;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 21 Jun 2013 14:44:08 -0400
|
||||
Subject: [PATCH] Use -2 instead of -1 for our right-hand margin, so
|
||||
linewrapping works (#976643).
|
||||
|
||||
Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index cbd62f714cb..26e9e82042a 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit,
|
||||
|
||||
geo->border = 0;
|
||||
geo->first_entry_x = 0; /* no margin */
|
||||
- geo->entry_width = grub_term_width (term) - 1;
|
||||
+ geo->entry_width = grub_term_width (term) - 2;
|
||||
|
||||
geo->first_entry_y = 3; /* three empty lines*/
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
||||
index 6a316a5ba77..c2d8b093762 100644
|
||||
index 93a90233ead..858b526c925 100644
|
||||
--- a/util/grub.d/00_header.in
|
||||
+++ b/util/grub.d/00_header.in
|
||||
@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 28 Oct 2013 10:13:27 -0400
|
||||
Subject: [PATCH] F10 doesn't work on serial, so don't tell the user to hit it
|
||||
(#987443)
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 26e9e82042a..4895ffe7d1d 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
|
||||
if (edit)
|
||||
{
|
||||
- ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
|
||||
+ ret += grub_print_message_indented_real (_("Press Ctrl-x to start, Ctrl-c for a \
|
||||
command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term, dry_run);
|
||||
42
0031-Don-t-say-GNU-Linux-in-generated-menus.patch
Normal file
42
0031-Don-t-say-GNU-Linux-in-generated-menus.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 14 Mar 2011 14:27:42 -0400
|
||||
Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
|
||||
|
||||
---
|
||||
util/grub.d/10_linux.in | 4 ++--
|
||||
util/grub.d/20_linux_xen.in | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index ad2ac4b078d..4fc58c83304 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index 3b1f4704921..ada20775a14 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
71
0032-Don-t-draw-a-border-around-the-menu.patch
Normal file
71
0032-Don-t-draw-a-border-around-the-menu.patch
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 16:47:33 -0400
|
||||
Subject: [PATCH] Don't draw a border around the menu
|
||||
|
||||
It looks cleaner without it.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 43 -------------------------------------------
|
||||
1 file changed, 43 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 4895ffe7d1d..e72ed438ba3 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right,
|
||||
grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
|
||||
}
|
||||
|
||||
-static void
|
||||
-draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo)
|
||||
-{
|
||||
- int i;
|
||||
-
|
||||
- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
-
|
||||
- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y - 1 });
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_UL, term);
|
||||
- for (i = 0; i < geo->entry_width + 1; i++)
|
||||
- grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_UR, term);
|
||||
-
|
||||
- for (i = 0; i < geo->num_entries; i++)
|
||||
- {
|
||||
- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y + i });
|
||||
- grub_putcode (GRUB_UNICODE_VLINE, term);
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1,
|
||||
- geo->first_entry_y + i });
|
||||
- grub_putcode (GRUB_UNICODE_VLINE, term);
|
||||
- }
|
||||
-
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y - 1 + geo->num_entries + 1 });
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_LL, term);
|
||||
- for (i = 0; i < geo->entry_width + 1; i++)
|
||||
- grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_LR, term);
|
||||
-
|
||||
- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
-
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- (geo->first_entry_y - 1 + geo->num_entries
|
||||
- + GRUB_TERM_MARGIN + 1) });
|
||||
-}
|
||||
-
|
||||
static int
|
||||
print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
{
|
||||
@@ -406,8 +365,6 @@ grub_menu_init_page (int nested, int edit,
|
||||
|
||||
grub_term_normal_color = grub_color_menu_normal;
|
||||
grub_term_highlight_color = grub_color_menu_highlight;
|
||||
- if (geo->border)
|
||||
- draw_border (term, geo);
|
||||
grub_term_normal_color = old_color_normal;
|
||||
grub_term_highlight_color = old_color_highlight;
|
||||
geo->timeout_y = geo->first_entry_y + geo->num_entries
|
||||
40
0033-Use-the-standard-margin-for-the-timeout-string.patch
Normal file
40
0033-Use-the-standard-margin-for-the-timeout-string.patch
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 10:52:32 -0400
|
||||
Subject: [PATCH] Use the standard margin for the timeout string
|
||||
|
||||
So that it aligns with the other messages
|
||||
---
|
||||
grub-core/normal/menu_text.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index e72ed438ba3..ca135624356 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -372,7 +372,7 @@ grub_menu_init_page (int nested, int edit,
|
||||
if (bottom_message)
|
||||
{
|
||||
grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { GRUB_TERM_MARGIN,
|
||||
+ (struct grub_term_coordinate) { STANDARD_MARGIN,
|
||||
geo->timeout_y });
|
||||
|
||||
print_message (nested, edit, term, 0);
|
||||
@@ -407,14 +407,14 @@ menu_text_print_timeout (int timeout, void *dataptr)
|
||||
if (data->timeout_msg == TIMEOUT_UNKNOWN)
|
||||
{
|
||||
data->timeout_msg = grub_print_message_indented_real (msg_translated,
|
||||
- 3, 1, data->term, 1)
|
||||
+ STANDARD_MARGIN, 1, data->term, 1)
|
||||
<= data->geo.timeout_lines ? TIMEOUT_NORMAL : TIMEOUT_TERSE;
|
||||
if (data->timeout_msg == TIMEOUT_TERSE)
|
||||
{
|
||||
grub_free (msg_translated);
|
||||
msg_translated = grub_xasprintf (_("%ds"), timeout);
|
||||
if (grub_term_width (data->term) < 10)
|
||||
- data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN;
|
||||
+ data->timeout_msg = STANDARD_MARGIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3,21 +3,20 @@ From: Fedora Ninjas <grub2-owner@fedoraproject.org>
|
|||
Date: Mon, 13 Jan 2014 21:50:59 -0500
|
||||
Subject: [PATCH] Add .eh_frame to list of relocations stripped
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
conf/Makefile.common | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/conf/Makefile.common b/conf/Makefile.common
|
||||
index b8f216f6cd3..ece9ed8a1bf 100644
|
||||
index 2a1a886f6d5..191b1a70c6b 100644
|
||||
--- a/conf/Makefile.common
|
||||
+++ b/conf/Makefile.common
|
||||
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
|
||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||
-STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
||||
+STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
||||
if !COND_emu
|
||||
if COND_HAVE_ASM_USCORE
|
||||
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free
|
||||
|
||||
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
||||
|
|
@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 901745707f1..9c31a94decb 100644
|
||||
index 4fc58c83304..635d2fe0cd3 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"
|
||||
49
0036-Don-t-emit-Booting-.-message.patch
Normal file
49
0036-Don-t-emit-Booting-.-message.patch
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 18 Feb 2014 09:37:49 -0500
|
||||
Subject: [PATCH] Don't emit "Booting ..." message.
|
||||
|
||||
UI team still hates this stuff, so we're disabling it for RHEL 7.
|
||||
|
||||
Resolves: rhbz#1023142
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/normal/menu.c | 4 +++-
|
||||
grub-core/normal/menu_entry.c | 3 ---
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
|
||||
index d7a222e681b..37d753d8081 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)
|
||||
|
||||
/* Callback invoked immediately before a menu entry is executed. */
|
||||
static void
|
||||
-notify_booting (grub_menu_entry_t entry,
|
||||
+notify_booting (grub_menu_entry_t __attribute__((unused)) entry,
|
||||
void *userdata __attribute__((unused)))
|
||||
{
|
||||
+#if 0
|
||||
grub_printf (" ");
|
||||
grub_printf_ (N_("Booting `%s'"), entry->title);
|
||||
grub_printf ("\n\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Callback invoked when a default menu entry executed because of a timeout
|
||||
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
|
||||
index 50eef918cf6..de64a367c4e 100644
|
||||
--- a/grub-core/normal/menu_entry.c
|
||||
+++ b/grub-core/normal/menu_entry.c
|
||||
@@ -1176,9 +1176,6 @@ run (struct screen *screen)
|
||||
char *dummy[1] = { NULL };
|
||||
|
||||
grub_cls ();
|
||||
- grub_printf (" ");
|
||||
- grub_printf_ (N_("Booting a command list"));
|
||||
- grub_printf ("\n\n");
|
||||
|
||||
errs_before = grub_err_printed_errors;
|
||||
|
||||
1959
0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch
Normal file
1959
0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,40 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 8 Jan 2024 15:41:52 -0500
|
||||
Subject: [PATCH] btrfs: fix a bad null check
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
current gcc complains:
|
||||
|
||||
grub-core/fs/btrfs.c: In function ‘grub_cmd_btrfs_info’:
|
||||
grub-core/fs/btrfs.c:2745:7: error: the comparison will always evaluate as ‘true’ for the address of ‘label’ will never be NULL [-Werror=address]
|
||||
2745 | if (data->sblock.label)
|
||||
| ^~~~
|
||||
grub-core/fs/btrfs.c:92:8: note: ‘label’ declared here
|
||||
92 | char label[0x100];
|
||||
| ^~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
|
||||
Obviously this check should be on the first data byte instead of the
|
||||
symbol itself.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index f14fe9c1bda..8e2b1e9f7bc 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -2625,7 +2625,7 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs");
|
||||
}
|
||||
|
||||
- if (data->sblock.label)
|
||||
+ if (data->sblock.label[0])
|
||||
grub_printf("Label: '%s' ", data->sblock.label);
|
||||
else
|
||||
grub_printf("Label: none ");
|
||||
|
|
@ -17,10 +17,10 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
|
|||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 568c2adfa16..0b2bbee19c3 100644
|
||||
index ec1cd257397..d85f7598d23 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
@@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
char *config;
|
||||
const char *prefix, *fw_path;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ index 568c2adfa16..0b2bbee19c3 100644
|
|||
if (fw_path)
|
||||
{
|
||||
config = grub_xasprintf ("%s/grub.cfg", fw_path);
|
||||
@@ -370,7 +370,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
@@ -372,7 +372,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 51 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 0b2bbee19c3..4c89892fa70 100644
|
||||
index d85f7598d23..1e509fceb91 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
@@ -347,61 +347,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
/* Guess the config filename. It is necessary to make CONFIG static,
|
||||
so that it won't get broken by longjmp. */
|
||||
char *config;
|
||||
|
|
@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 9c31a94decb..b7809091b36 100644
|
||||
index 635d2fe0cd3..fed73271478 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
|
|
@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
||||
index c2e107b41ab..4eadcba4b85 100644
|
||||
index 301d1ac229a..0f6505bf3b6 100644
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -299,6 +299,14 @@ version_test_gt ()
|
||||
@@ -253,6 +253,14 @@ version_test_gt ()
|
||||
*.old:*.old) ;;
|
||||
*.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
|
||||
*:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
|
||||
|
|
@ -7,26 +7,38 @@ Related: rhbz#1148652
|
|||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/kern/ieee1275/init.c | 34 ++++++-----
|
||||
grub-core/kern/ieee1275/init.c | 28 +++++----
|
||||
grub-core/net/net.c | 2 +-
|
||||
grub-core/normal/main.c | 134 ++++++++++++++++++++---------------------
|
||||
3 files changed, 85 insertions(+), 85 deletions(-)
|
||||
3 files changed, 82 insertions(+), 82 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
|
||||
index 50c65b2f6e5..51c1e1c9d9f 100644
|
||||
index e71d1584164..0cd2a627231 100644
|
||||
--- a/grub-core/kern/ieee1275/init.c
|
||||
+++ b/grub-core/kern/ieee1275/init.c
|
||||
@@ -170,23 +170,25 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
@@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
grub_free (canon);
|
||||
}
|
||||
else
|
||||
- *device = grub_ieee1275_encode_devname (bootpath);
|
||||
+ {
|
||||
- grub_free (type);
|
||||
-
|
||||
- filename = grub_ieee1275_get_filename (bootpath);
|
||||
- if (filename)
|
||||
{
|
||||
- char *lastslash = grub_strrchr (filename, '\\');
|
||||
-
|
||||
- /* Truncate at last directory. */
|
||||
- if (lastslash)
|
||||
+ filename = grub_ieee1275_get_filename (bootpath);
|
||||
+ if (filename)
|
||||
+ {
|
||||
{
|
||||
- *lastslash = '\0';
|
||||
- grub_translate_ieee1275_path (filename);
|
||||
+ char *lastslash = grub_strrchr (filename, '\\');
|
||||
+
|
||||
|
||||
- *path = filename;
|
||||
- }
|
||||
+ /* Truncate at last directory. */
|
||||
+ if (lastslash)
|
||||
+ {
|
||||
|
|
@ -37,32 +49,17 @@ index 50c65b2f6e5..51c1e1c9d9f 100644
|
|||
+ }
|
||||
+ }
|
||||
+ *device = grub_ieee1275_encode_devname (bootpath);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
grub_free (type);
|
||||
-
|
||||
- filename = grub_ieee1275_get_filename (bootpath);
|
||||
- if (filename)
|
||||
- {
|
||||
- char *lastslash = grub_strrchr (filename, '\\');
|
||||
-
|
||||
- /* Truncate at last directory. */
|
||||
- if (lastslash)
|
||||
- {
|
||||
- *lastslash = '\0';
|
||||
- grub_translate_ieee1275_path (filename);
|
||||
-
|
||||
- *path = filename;
|
||||
- }
|
||||
- }
|
||||
+ grub_free (type);
|
||||
grub_free (bootpath);
|
||||
}
|
||||
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index 8cad4fb6d4d..54451cea2a7 100644
|
||||
index 4d3eb5c1a52..0ef148f4adc 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -2005,7 +2005,7 @@ grub_net_search_config_file (char *config)
|
||||
@@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config)
|
||||
/* Remove the remaining minus sign at the end. */
|
||||
config[config_len] = '\0';
|
||||
|
||||
|
|
@ -72,10 +69,10 @@ index 8cad4fb6d4d..54451cea2a7 100644
|
|||
|
||||
static struct grub_preboot *fini_hnd;
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 4c89892fa70..3463f444f74 100644
|
||||
index 1e509fceb91..d5968797f4f 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config)
|
||||
@@ -337,81 +337,79 @@ grub_enter_normal_mode (const char *config)
|
||||
grub_boot_time ("Exiting normal mode");
|
||||
}
|
||||
|
||||
458
0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch
Normal file
458
0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marshall <rmarshall@redhat.com>
|
||||
Date: Mon, 16 Mar 2015 14:14:19 -0400
|
||||
Subject: [PATCH] Use Distribution Package Sort for grub2-mkconfig (#1124074)
|
||||
|
||||
Users reported that newly installed kernels on their systems installed
|
||||
with grub-mkconfig would not appear on the grub boot list in order
|
||||
starting with the most recent. Added an option for rpm-based systems to
|
||||
use the rpm-sort library to sort kernels instead.
|
||||
|
||||
Resolves rhbz#1124074
|
||||
|
||||
Signed-off-by: Robert Marshall <rmarshall@redhat.com>
|
||||
[pjones: fix --enable-rpm-sort configure option]
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
[thierry.vignaud: fix build with rpm-4.16]
|
||||
Signed-off-by: Thierry Vignaud <thierry.vignaud@gmail.com>
|
||||
---
|
||||
configure.ac | 38 +++++++
|
||||
Makefile.util.def | 16 +++
|
||||
util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
util/grub-mkconfig_lib.in | 11 +-
|
||||
util/grub-rpm-sort.8 | 12 ++
|
||||
5 files changed, 357 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 b8c4d52dfd1..ac84a8ccf69 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath])
|
||||
grub_TRANSFORM([grub-mkrescue])
|
||||
grub_TRANSFORM([grub-probe])
|
||||
grub_TRANSFORM([grub-reboot])
|
||||
+grub_TRANSFORM([grub-rpm-sort])
|
||||
grub_TRANSFORM([grub-script-check])
|
||||
grub_TRANSFORM([grub-set-default])
|
||||
grub_TRANSFORM([grub-sparc64-setup])
|
||||
@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1])
|
||||
grub_TRANSFORM([grub-mkstandalone.3])
|
||||
grub_TRANSFORM([grub-ofpathname.3])
|
||||
grub_TRANSFORM([grub-probe.3])
|
||||
+grub_TRANSFORM([grub-rpm-sort.8])
|
||||
grub_TRANSFORM([grub-reboot.3])
|
||||
grub_TRANSFORM([grub-render-label.3])
|
||||
grub_TRANSFORM([grub-script-check.3])
|
||||
@@ -1860,6 +1862,42 @@ fi
|
||||
|
||||
AC_SUBST([LIBDEVMAPPER])
|
||||
|
||||
+AC_ARG_ENABLE([rpm-sort],
|
||||
+ [AS_HELP_STRING([--enable-rpm-sort],
|
||||
+ [enable native rpm sorting of kernels in grub (default=guessed)])])
|
||||
+if test x"$enable_rpm_sort" = xno ; then
|
||||
+ rpm_sort_excuse="explicitly disabled"
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ # Check for rpmlib header.
|
||||
+ AC_CHECK_HEADER([rpm/rpmlib.h], [],
|
||||
+ [rpm_sort_excuse="need rpm/rpmlib header"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ # Check for rpm library.
|
||||
+ AC_CHECK_LIB([rpm], [rpmvercmp], [],
|
||||
+ [rpm_sort_excuse="rpmlib missing rpmvercmp"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ LIBRPM="-lrpm";
|
||||
+ AC_DEFINE([HAVE_RPM], [1],
|
||||
+ [Define to 1 if you have the rpm library.])
|
||||
+fi
|
||||
+
|
||||
+if test x"$LIBRPM" = x ; then
|
||||
+ # Check for rpm library.
|
||||
+ AC_CHECK_LIB([rpmio], [rpmvercmp], [],
|
||||
+ [rpm_sort_excuse="rpmio missing rpmvercmp"])
|
||||
+ LIBRPM="-lrpmio";
|
||||
+ AC_DEFINE([HAVE_RPMIO], [1],
|
||||
+ [Define to 1 if you have the rpm library.])
|
||||
+fi
|
||||
+
|
||||
+AC_SUBST([LIBRPM])
|
||||
+
|
||||
LIBGEOM=
|
||||
if test x$host_kernel = xkfreebsd; then
|
||||
AC_CHECK_LIB([geom], [geom_gettree], [],
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index 2c9b283a230..ba4cf4b29b0 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -703,6 +703,22 @@ program = {
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
+program = {
|
||||
+ name = grub-rpm-sort;
|
||||
+ mansection = 8;
|
||||
+ installdir = sbin;
|
||||
+
|
||||
+ common = grub-core/kern/emu/misc.c;
|
||||
+ common = grub-core/kern/emu/argp_common.c;
|
||||
+ common = grub-core/osdep/init.c;
|
||||
+ common = util/misc.c;
|
||||
+ common = util/grub-rpm-sort.c;
|
||||
+
|
||||
+ ldadd = libgrubkern.a;
|
||||
+ ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||
+ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)';
|
||||
+};
|
||||
+
|
||||
script = {
|
||||
name = grub-mkconfig;
|
||||
common = util/grub-mkconfig.in;
|
||||
diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c
|
||||
new file mode 100644
|
||||
index 00000000000..f33bd1ed568
|
||||
--- /dev/null
|
||||
+++ b/util/grub-rpm-sort.c
|
||||
@@ -0,0 +1,281 @@
|
||||
+#include <config.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/util/misc.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <assert.h>
|
||||
+#include <argp.h>
|
||||
+#include <rpm/rpmlib.h>
|
||||
+
|
||||
+static size_t
|
||||
+read_file (const char *input, char **ret)
|
||||
+{
|
||||
+ FILE *in;
|
||||
+ size_t s;
|
||||
+ size_t sz = 2048;
|
||||
+ size_t offset = 0;
|
||||
+ char *text;
|
||||
+
|
||||
+ if (!strcmp(input, "-"))
|
||||
+ in = stdin;
|
||||
+ else
|
||||
+ in = grub_util_fopen(input, "r");
|
||||
+
|
||||
+ text = xmalloc (sz);
|
||||
+
|
||||
+ if (!in)
|
||||
+ grub_util_error (_("cannot open `%s': %s"), input, strerror (errno));
|
||||
+
|
||||
+ while ((s = fread (text + offset, 1, sz - offset, in)) != 0)
|
||||
+ {
|
||||
+ offset += s;
|
||||
+ if (sz - offset == 0)
|
||||
+ {
|
||||
+ sz += 2048;
|
||||
+ text = xrealloc (text, sz);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ text[offset] = '\0';
|
||||
+ *ret = text;
|
||||
+
|
||||
+ if (in != stdin)
|
||||
+ fclose(in);
|
||||
+
|
||||
+ return offset + 1;
|
||||
+}
|
||||
+
|
||||
+/* returns name/version/release */
|
||||
+/* NULL string pointer returned if nothing found */
|
||||
+static void
|
||||
+split_package_string (char *package_string, char **name,
|
||||
+ char **version, char **release)
|
||||
+{
|
||||
+ char *package_version, *package_release;
|
||||
+
|
||||
+ /* Release */
|
||||
+ package_release = strrchr (package_string, '-');
|
||||
+
|
||||
+ if (package_release != NULL)
|
||||
+ *package_release++ = '\0';
|
||||
+
|
||||
+ *release = package_release;
|
||||
+
|
||||
+ /* Version */
|
||||
+ package_version = strrchr(package_string, '-');
|
||||
+
|
||||
+ if (package_version != NULL)
|
||||
+ *package_version++ = '\0';
|
||||
+
|
||||
+ *version = package_version;
|
||||
+ /* Name */
|
||||
+ *name = package_string;
|
||||
+
|
||||
+ /* Bubble up non-null values from release to name */
|
||||
+ if (*name == NULL)
|
||||
+ {
|
||||
+ *name = (*version == NULL ? *release : *version);
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+ if (*version == NULL)
|
||||
+ {
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * package name-version-release comparator for qsort
|
||||
+ * expects p, q which are pointers to character strings (char *)
|
||||
+ * which will not be altered in this function
|
||||
+ */
|
||||
+static int
|
||||
+package_version_compare (const void *p, const void *q)
|
||||
+{
|
||||
+ char *local_p, *local_q;
|
||||
+ char *lhs_name, *lhs_version, *lhs_release;
|
||||
+ char *rhs_name, *rhs_version, *rhs_release;
|
||||
+ int vercmpflag = 0;
|
||||
+
|
||||
+ local_p = alloca (strlen (*(char * const *)p) + 1);
|
||||
+ local_q = alloca (strlen (*(char * const *)q) + 1);
|
||||
+
|
||||
+ /* make sure these allocated */
|
||||
+ assert (local_p);
|
||||
+ assert (local_q);
|
||||
+
|
||||
+ strcpy (local_p, *(char * const *)p);
|
||||
+ strcpy (local_q, *(char * const *)q);
|
||||
+
|
||||
+ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release);
|
||||
+ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release);
|
||||
+
|
||||
+ /* Check Name and return if unequal */
|
||||
+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name),
|
||||
+ (rhs_name == NULL ? "" : rhs_name));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check version and return if unequal */
|
||||
+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version),
|
||||
+ (rhs_version == NULL ? "" : rhs_version));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check release and return the version compare value */
|
||||
+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release),
|
||||
+ (rhs_release == NULL ? "" : rhs_release));
|
||||
+
|
||||
+ return vercmpflag;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+add_input (const char *filename, char ***package_names, size_t *n_package_names)
|
||||
+{
|
||||
+ char *orig_input_buffer = NULL;
|
||||
+ char *input_buffer;
|
||||
+ char *position_of_newline;
|
||||
+ char **names = *package_names;
|
||||
+ char **new_names = NULL;
|
||||
+ size_t n_names = *n_package_names;
|
||||
+
|
||||
+ if (!*package_names)
|
||||
+ new_names = names = xmalloc (sizeof (char *) * 2);
|
||||
+
|
||||
+ if (read_file (filename, &orig_input_buffer) < 2)
|
||||
+ {
|
||||
+ if (new_names)
|
||||
+ free (new_names);
|
||||
+ if (orig_input_buffer)
|
||||
+ free (orig_input_buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ input_buffer = orig_input_buffer;
|
||||
+ while (input_buffer && *input_buffer &&
|
||||
+ (position_of_newline = strchrnul (input_buffer, '\n')))
|
||||
+ {
|
||||
+ size_t sz = position_of_newline - input_buffer;
|
||||
+ char *new;
|
||||
+
|
||||
+ if (sz == 0)
|
||||
+ {
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ new = xmalloc (sz+1);
|
||||
+ strncpy (new, input_buffer, sz);
|
||||
+ new[sz] = '\0';
|
||||
+
|
||||
+ names = xrealloc (names, sizeof (char *) * (n_names + 1));
|
||||
+ names[n_names] = new;
|
||||
+ n_names++;
|
||||
+
|
||||
+ /* move buffer ahead to next line */
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ if (*position_of_newline == '\0')
|
||||
+ input_buffer = NULL;
|
||||
+ }
|
||||
+
|
||||
+ free (orig_input_buffer);
|
||||
+
|
||||
+ *package_names = names;
|
||||
+ *n_package_names = n_names;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
||||
+{
|
||||
+ return (char *)text;
|
||||
+}
|
||||
+
|
||||
+static struct argp_option options[] = {
|
||||
+ { 0, }
|
||||
+};
|
||||
+
|
||||
+struct arguments
|
||||
+{
|
||||
+ size_t ninputs;
|
||||
+ size_t input_max;
|
||||
+ char **inputs;
|
||||
+};
|
||||
+
|
||||
+static error_t
|
||||
+argp_parser (int key, char *arg, struct argp_state *state)
|
||||
+{
|
||||
+ struct arguments *arguments = state->input;
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case ARGP_KEY_ARG:
|
||||
+ assert (arguments->ninputs < arguments->input_max);
|
||||
+ arguments->inputs[arguments->ninputs++] = xstrdup (arg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return ARGP_ERR_UNKNOWN;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct argp argp = {
|
||||
+ options, argp_parser, N_("[INPUT_FILES]"),
|
||||
+ N_("Sort a list of strings in RPM version sort order."),
|
||||
+ NULL, help_filter, NULL
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ struct arguments arguments;
|
||||
+ char **package_names = NULL;
|
||||
+ size_t n_package_names = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ grub_util_host_init (&argc, &argv);
|
||||
+
|
||||
+ memset (&arguments, 0, sizeof (struct arguments));
|
||||
+ arguments.input_max = argc+1;
|
||||
+ arguments.inputs = xmalloc ((arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+ memset (arguments.inputs, 0, (arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+
|
||||
+ /* Parse our arguments */
|
||||
+ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
||||
+ grub_util_error ("%s", _("Error in parsing command line arguments\n"));
|
||||
+
|
||||
+ /* If there's no inputs in argv, add one for stdin */
|
||||
+ if (!arguments.ninputs)
|
||||
+ {
|
||||
+ arguments.ninputs = 1;
|
||||
+ arguments.inputs[0] = xmalloc (2);
|
||||
+ strcpy(arguments.inputs[0], "-");
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ add_input(arguments.inputs[i], &package_names, &n_package_names);
|
||||
+
|
||||
+ if (package_names == NULL || n_package_names < 1)
|
||||
+ grub_util_error ("%s", _("Invalid input\n"));
|
||||
+
|
||||
+ qsort (package_names, n_package_names, sizeof (char *),
|
||||
+ package_version_compare);
|
||||
+
|
||||
+ /* send sorted list to stdout */
|
||||
+ for (i = 0; i < n_package_names; i++)
|
||||
+ {
|
||||
+ fprintf (stdout, "%s\n", package_names[i]);
|
||||
+ free (package_names[i]);
|
||||
+ }
|
||||
+
|
||||
+ free (package_names);
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ free (arguments.inputs[i]);
|
||||
+
|
||||
+ free (arguments.inputs);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
||||
index 0f6505bf3b6..42c2ea9ba50 100644
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -33,6 +33,9 @@ fi
|
||||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
|
||||
fi
|
||||
+if test "x$grub_rpm_sort" = x; then
|
||||
+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@"
|
||||
+fi
|
||||
|
||||
if command -v gettext >/dev/null; then
|
||||
:
|
||||
@@ -218,6 +221,12 @@ version_sort ()
|
||||
esac
|
||||
}
|
||||
|
||||
+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then
|
||||
+ kernel_sort="$grub_rpm_sort"
|
||||
+else
|
||||
+ kernel_sort=version_sort
|
||||
+fi
|
||||
+
|
||||
version_test_numeric ()
|
||||
{
|
||||
version_test_numeric_a="$1"
|
||||
@@ -234,7 +243,7 @@ version_test_numeric ()
|
||||
version_test_numeric_a="$version_test_numeric_b"
|
||||
version_test_numeric_b="$version_test_numeric_c"
|
||||
fi
|
||||
- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
||||
+ if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | "$kernel_sort" | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8
|
||||
new file mode 100644
|
||||
index 00000000000..8ce21488448
|
||||
--- /dev/null
|
||||
+++ b/util/grub-rpm-sort.8
|
||||
@@ -0,0 +1,12 @@
|
||||
+.TH GRUB-RPM-SORT 8 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-rpm-sort\fR \(em Sort input according to RPM version compare.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-rpm-sort\fR [OPTIONS].
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+You should not normally run this program directly. Use grub-mkconfig instead.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
|
|
@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 27 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index b7809091b36..993c53ad92e 100644
|
||||
index fed73271478..2e59f3b4197 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -80,6 +80,32 @@ case x"$GRUB_FS" in
|
||||
@@ -78,6 +78,32 @@ case x"$GRUB_FS" in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ index b7809091b36..993c53ad92e 100644
|
|||
title_correction_code=
|
||||
|
||||
linux_entry ()
|
||||
@@ -93,17 +119,11 @@ linux_entry ()
|
||||
@@ -91,17 +117,11 @@ linux_entry ()
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
fi
|
||||
if [ x$type != xsimple ] ; then
|
||||
|
|
@ -13,38 +13,36 @@ Signed-off-by: Robert Marshall <rmarshall@redhat.com>
|
|||
[pjones: fix the efidir in grub-setpassword and rename tool]
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
[luto: fix grub-setpassword -o's output path]
|
||||
Signed-off-by: Andy Lutomirski <luto@kernel.org>
|
||||
[rharwood: migrate man page to h2m, context]
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Andy Lutomirski <luto@kernel.org>
|
||||
---
|
||||
configure.ac | 1 +
|
||||
Makefile.util.def | 13 +++++
|
||||
docs/man/grub-set-password.h2m | 2 +
|
||||
util/grub-mkconfig.in | 2 +
|
||||
util/grub-set-password.in | 128 +++++++++++++++++++++++++++++++++++++++++
|
||||
util/grub.d/01_users.in | 11 ++++
|
||||
6 files changed, 157 insertions(+)
|
||||
create mode 100644 docs/man/grub-set-password.h2m
|
||||
configure.ac | 1 +
|
||||
Makefile.util.def | 13 +++++
|
||||
util/grub-mkconfig.in | 2 +
|
||||
util/grub-set-password.8 | 28 ++++++++++
|
||||
util/grub-set-password.in | 128 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
util/grub.d/01_users.in | 11 ++++
|
||||
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 ae3a49321ad..493e336ec6c 100644
|
||||
index ac84a8ccf69..9ecd3540bd6 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -77,6 +77,7 @@ grub_TRANSFORM([grub-mkrelpath])
|
||||
@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath])
|
||||
grub_TRANSFORM([grub-mkrescue])
|
||||
grub_TRANSFORM([grub-probe])
|
||||
grub_TRANSFORM([grub-reboot])
|
||||
+grub_TRANSFORM([grub-set-password])
|
||||
grub_TRANSFORM([grub-rpm-sort])
|
||||
grub_TRANSFORM([grub-script-check])
|
||||
grub_TRANSFORM([grub-set-default])
|
||||
grub_TRANSFORM([grub-sparc64-setup])
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index 09bfcadd976..95884956a68 100644
|
||||
index ba4cf4b29b0..1a7dd433e33 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -455,6 +455,12 @@ script = {
|
||||
@@ -452,6 +452,12 @@ script = {
|
||||
installdir = grubconf;
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +55,7 @@ index 09bfcadd976..95884956a68 100644
|
|||
script = {
|
||||
name = '10_windows';
|
||||
common = util/grub.d/10_windows.in;
|
||||
@@ -733,6 +739,13 @@ script = {
|
||||
@@ -740,6 +746,13 @@ script = {
|
||||
installdir = sbin;
|
||||
};
|
||||
|
||||
|
|
@ -71,19 +69,11 @@ index 09bfcadd976..95884956a68 100644
|
|||
script = {
|
||||
name = grub-mkconfig_lib;
|
||||
common = util/grub-mkconfig_lib.in;
|
||||
diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m
|
||||
new file mode 100644
|
||||
index 00000000000..10ee82f4d52
|
||||
--- /dev/null
|
||||
+++ b/docs/man/grub-set-password.h2m
|
||||
@@ -0,0 +1,2 @@
|
||||
+[NAME]
|
||||
+grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password
|
||||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index 7b355115dd4..5f2824d4f58 100644
|
||||
index 91d761bae80..3e4c6c5240b 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -280,6 +280,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
|
||||
@@ -279,6 +279,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
|
||||
*~) ;;
|
||||
# emacsen autosave files. FIXME: support other editors
|
||||
*/\#*\#) ;;
|
||||
|
|
@ -92,6 +82,40 @@ index 7b355115dd4..5f2824d4f58 100644
|
|||
*)
|
||||
if grub_file_is_not_garbage "$i" && test -x "$i" ; then
|
||||
echo
|
||||
diff --git a/util/grub-set-password.8 b/util/grub-set-password.8
|
||||
new file mode 100644
|
||||
index 00000000000..9646546e43d
|
||||
--- /dev/null
|
||||
+++ b/util/grub-set-password.8
|
||||
@@ -0,0 +1,28 @@
|
||||
+.TH GRUB-SET-PASSWORD 3 "Thu Jun 25 2015"
|
||||
+.SH NAME
|
||||
+\fBgrub-set-password\fR \(em Generate the user.cfg file containing the hashed grub bootloader password.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-set-password\fR [OPTION]
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-set-password\fR outputs the user.cfg file which contains the hashed GRUB bootloader password. This utility only supports configurations where there is a single root user.
|
||||
+
|
||||
+The file has the format:
|
||||
+GRUB2_PASSWORD=<\fIhashed password\fR>.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+-h, --help
|
||||
+Display program usage and exit.
|
||||
+.TP
|
||||
+-v, --version
|
||||
+Display the current version.
|
||||
+.TP
|
||||
+-o, --output=<\fIDIRECTORY\fR>
|
||||
+Choose the file path to which user.cfg will be written.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
+
|
||||
+.BR "info grub2-mkpasswd-pbkdf2"
|
||||
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
|
||||
new file mode 100644
|
||||
index 00000000000..5ebf50576d6
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 1 Jun 2017 10:06:38 -0400
|
||||
Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable.
|
||||
|
||||
This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and
|
||||
grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we
|
||||
get more reasonable type checking.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index 1de98f78313..2036924504b 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -95,7 +95,7 @@ grub_chainloader_boot (void *context)
|
||||
}
|
||||
|
||||
if (exit_data)
|
||||
- b->free_pool (exit_data);
|
||||
+ grub_efi_free_pool (exit_data);
|
||||
|
||||
grub_loader_unset ();
|
||||
|
||||
@@ -419,7 +419,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_free (file_path);
|
||||
|
||||
if (address)
|
||||
- b->free_pages (address, pages);
|
||||
+ grub_efi_free_pages (address, pages);
|
||||
|
||||
if (image_handle != NULL)
|
||||
b->unload_image (image_handle);
|
||||
|
|
@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik <jbacik@fb.com>
|
|||
1 file changed, 29 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c
|
||||
index 93dee0caa1b..902ab7e8ae6 100644
|
||||
index e8ad34b84d4..7d4b822626d 100644
|
||||
--- a/grub-core/net/tcp.c
|
||||
+++ b/grub-core/net/tcp.c
|
||||
@@ -106,6 +106,18 @@ struct tcphdr
|
||||
|
|
@ -39,7 +39,7 @@ index 93dee0caa1b..902ab7e8ae6 100644
|
|||
struct tcp_pseudohdr
|
||||
{
|
||||
grub_uint32_t src;
|
||||
@@ -571,7 +583,7 @@ grub_net_tcp_open (char *server,
|
||||
@@ -566,7 +578,7 @@ grub_net_tcp_open (char *server,
|
||||
grub_net_tcp_socket_t socket;
|
||||
static grub_uint16_t in_port = 21550;
|
||||
struct grub_net_buff *nb;
|
||||
|
|
@ -48,7 +48,7 @@ index 93dee0caa1b..902ab7e8ae6 100644
|
|||
int i;
|
||||
grub_uint8_t *nbd;
|
||||
grub_net_link_level_address_t ll_target_addr;
|
||||
@@ -640,20 +652,24 @@ grub_net_tcp_open (char *server,
|
||||
@@ -635,20 +647,24 @@ grub_net_tcp_open (char *server,
|
||||
}
|
||||
|
||||
tcph = (void *) nb->data;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 1 Jun 2017 10:07:50 -0400
|
||||
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
|
||||
|
||||
This avoids syntax checkers getting confused about if it's llx or lx.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
include/grub/efi/api.h | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index c1b869db520..daa9268fdaa 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -577,7 +577,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
|
||||
typedef grub_uint8_t grub_efi_char8_t;
|
||||
typedef grub_uint16_t grub_efi_char16_t;
|
||||
|
||||
+
|
||||
typedef grub_efi_uintn_t grub_efi_status_t;
|
||||
+/* Make grub_efi_status_t reasonably printable. */
|
||||
+#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
+#define PRIxGRUB_EFI_STATUS "lx"
|
||||
+#define PRIdGRUB_EFI_STATUS "ld"
|
||||
+#else
|
||||
+#define PRIxGRUB_EFI_STATUS "llx"
|
||||
+#define PRIdGRUB_EFI_STATUS "lld"
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* On x86, the EFI calling convention may deviate from the local one, so
|
||||
|
|
@ -6,18 +6,18 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6
|
|||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++
|
||||
grub-core/net/drivers/efi/efinet.c | 84 +++++++++++++-----
|
||||
grub-core/net/drivers/efi/efinet.c | 53 ++++++++++--
|
||||
grub-core/net/net.c | 72 +++++++++++++++
|
||||
grub-core/net/tftp.c | 3 +
|
||||
grub-core/net/tftp.c | 4 +
|
||||
include/grub/efi/api.h | 129 +++++++++++++++++++++++++--
|
||||
include/grub/net.h | 60 +++++++++++++
|
||||
6 files changed, 491 insertions(+), 30 deletions(-)
|
||||
6 files changed, 477 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
|
||||
index abe45ef7bf6..02d2c2614cb 100644
|
||||
index e33be51f83b..8d9edaac447 100644
|
||||
--- a/grub-core/net/bootp.c
|
||||
+++ b/grub-core/net/bootp.c
|
||||
@@ -905,6 +905,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
|
||||
@@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
|
||||
|
||||
static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ index abe45ef7bf6..02d2c2614cb 100644
|
|||
grub_bootp_init (void)
|
||||
{
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 3ea25cf9894..2af8742f904 100644
|
||||
index 5388f952ba9..173fb63153c 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -18,11 +18,14 @@
|
||||
|
|
@ -216,16 +216,16 @@ index 3ea25cf9894..2af8742f904 100644
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -346,7 +349,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -329,7 +332,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
char **path)
|
||||
{
|
||||
struct grub_net_card *card;
|
||||
- grub_efi_device_path_t *dp;
|
||||
+ grub_efi_device_path_t *dp, *ldp = NULL;
|
||||
struct grub_net_network_level_interface *inter;
|
||||
grub_efi_device_path_t *vlan_dp;
|
||||
grub_efi_uint16_t vlan_dp_len;
|
||||
@@ -361,14 +364,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
|
||||
dp = grub_efi_get_device_path (hnd);
|
||||
if (! dp)
|
||||
@@ -340,14 +343,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
grub_efi_device_path_t *cdp;
|
||||
struct grub_efi_pxe *pxe;
|
||||
struct grub_efi_pxe_mode *pxe_mode;
|
||||
|
|
@ -246,7 +246,7 @@ index 3ea25cf9894..2af8742f904 100644
|
|||
int match;
|
||||
|
||||
/* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6
|
||||
@@ -377,7 +385,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -356,7 +364,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
devices. We skip them when enumerating cards, so here we need to
|
||||
find matching MAC device.
|
||||
*/
|
||||
|
|
@ -254,7 +254,7 @@ index 3ea25cf9894..2af8742f904 100644
|
|||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
||||
@@ -394,41 +401,70 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -373,16 +380,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
if (!match)
|
||||
continue;
|
||||
}
|
||||
|
|
@ -265,6 +265,11 @@ index 3ea25cf9894..2af8742f904 100644
|
|||
continue;
|
||||
+
|
||||
pxe_mode = pxe->mode;
|
||||
- grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
- (struct grub_net_bootp_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
- 1, device, path);
|
||||
+ if (pxe_mode->using_ipv6)
|
||||
+ {
|
||||
+ grub_net_link_level_address_t hwaddr;
|
||||
|
|
@ -276,86 +281,41 @@ index 3ea25cf9894..2af8742f904 100644
|
|||
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
|
||||
+ if (!pxe_mode->dhcp_ack_received)
|
||||
+ continue;
|
||||
|
||||
- inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
- (struct grub_net_bootp_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
- 1, device, path);
|
||||
+
|
||||
+ hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
+ grub_memcpy (hwaddr.mac,
|
||||
+ card->efi_net->mode->current_address,
|
||||
+ sizeof (hwaddr.mac));
|
||||
|
||||
- if (inter != NULL)
|
||||
+ inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
|
||||
+
|
||||
+ intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
|
||||
+ (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
|
||||
+ 1, device, path);
|
||||
+ if (inter && device && path)
|
||||
+ if (intf && device && path)
|
||||
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
- /*
|
||||
- * Search the device path for any VLAN subtype and use it
|
||||
- * to configure the interface.
|
||||
- */
|
||||
- vlan_dp = dp;
|
||||
+ {
|
||||
+ grub_dprintf ("efinet", "using ipv4 and dhcp\n");
|
||||
+ inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
+ (struct grub_net_bootp_packet *)
|
||||
+ &pxe_mode->dhcp_ack,
|
||||
+ sizeof (pxe_mode->dhcp_ack),
|
||||
+ 1, device, path);
|
||||
|
||||
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
|
||||
+ grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
+ (struct grub_net_bootp_packet *)
|
||||
+ &pxe_mode->dhcp_ack,
|
||||
+ sizeof (pxe_mode->dhcp_ack),
|
||||
+ 1, device, path);
|
||||
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
||||
+ if (inter != NULL)
|
||||
{
|
||||
- if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
|
||||
- GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
|
||||
+ /*
|
||||
+ * Search the device path for any VLAN subtype and use it
|
||||
+ * to configure the interface.
|
||||
+ */
|
||||
+ vlan_dp = dp;
|
||||
+
|
||||
+ while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
|
||||
{
|
||||
- vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
|
||||
- inter->vlantag = vlan->vlan_id;
|
||||
- break;
|
||||
+ if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
|
||||
+ GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
|
||||
+ {
|
||||
+ vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
|
||||
+ inter->vlantag = vlan->vlan_id;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
|
||||
+ vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
|
||||
}
|
||||
-
|
||||
- vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
|
||||
- vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
|
||||
}
|
||||
+ return;
|
||||
}
|
||||
- return;
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index 54451cea2a7..20c55257647 100644
|
||||
index 0ef148f4adc..22f2689aaeb 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -984,6 +984,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
|
||||
@@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
|
||||
grub_net_network_level_interfaces = inter;
|
||||
}
|
||||
|
||||
+int
|
||||
+grub_ipv6_get_masksize (grub_uint16_t *be_mask)
|
||||
+grub_ipv6_get_masksize (grub_uint16_t be_mask[8])
|
||||
+{
|
||||
+ grub_uint8_t *mask;
|
||||
+ grub_uint16_t mask16[8];
|
||||
|
|
@ -430,10 +390,10 @@ index 54451cea2a7..20c55257647 100644
|
|||
grub_err_t
|
||||
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter,
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 409b1d09bcd..f300a9d4007 100644
|
||||
index 7f44b30f521..4ab2f5c7357 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -359,6 +359,7 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
@@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
file->not_easily_seekable = 1;
|
||||
file->data = data;
|
||||
|
||||
|
|
@ -441,13 +401,14 @@ index 409b1d09bcd..f300a9d4007 100644
|
|||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
@@ -369,11 +370,13 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
+ grub_dprintf("tftp", "Address resolution failed: %d\n", err);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
|
||||
+ grub_dprintf("tftp", "opening connection\n");
|
||||
data->sock = grub_net_udp_open (addr,
|
||||
port ? port : TFTP_SERVER_PORT, tftp_receive,
|
||||
TFTP_SERVER_PORT, tftp_receive,
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
|
|
@ -456,10 +417,10 @@ index 409b1d09bcd..f300a9d4007 100644
|
|||
return grub_errno;
|
||||
}
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index d44d00ad7d5..c6d702831f7 100644
|
||||
index f1a52210c0c..117469450d3 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -637,10 +637,16 @@ typedef void *grub_efi_handle_t;
|
||||
@@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t;
|
||||
typedef void *grub_efi_event_t;
|
||||
typedef grub_efi_uint64_t grub_efi_lba_t;
|
||||
typedef grub_efi_uintn_t grub_efi_tpl_t;
|
||||
|
|
@ -480,7 +441,7 @@ index d44d00ad7d5..c6d702831f7 100644
|
|||
typedef grub_efi_uint64_t grub_efi_physical_address_t;
|
||||
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
|
||||
|
||||
@@ -1521,16 +1527,127 @@ struct grub_efi_simple_text_output_interface
|
||||
@@ -1474,16 +1480,127 @@ struct grub_efi_simple_text_output_interface
|
||||
};
|
||||
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
|
||||
|
||||
|
|
@ -611,10 +572,10 @@ index d44d00ad7d5..c6d702831f7 100644
|
|||
|
||||
typedef struct grub_efi_pxe
|
||||
diff --git a/include/grub/net.h b/include/grub/net.h
|
||||
index 844e501c128..bf8430a6364 100644
|
||||
index 7ae4b6bd805..8a05ec4fe7a 100644
|
||||
--- a/include/grub/net.h
|
||||
+++ b/include/grub/net.h
|
||||
@@ -450,6 +450,51 @@ struct grub_net_bootp_packet
|
||||
@@ -447,6 +447,51 @@ struct grub_net_bootp_packet
|
||||
grub_uint8_t vendor[0];
|
||||
} GRUB_PACKED;
|
||||
|
||||
|
|
@ -666,7 +627,7 @@ index 844e501c128..bf8430a6364 100644
|
|||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
|
||||
@@ -485,6 +530,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
@@ -482,6 +527,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
grub_size_t size,
|
||||
int is_def, char **device, char **path);
|
||||
|
||||
|
|
@ -10,24 +10,23 @@ variables are then used by 10_linux to choose whether or not to create
|
|||
debug stanzas.
|
||||
|
||||
Resolves: rhbz#1226325
|
||||
[rharwood: migrate man page to h2m]
|
||||
---
|
||||
configure.ac | 1 +
|
||||
configure.ac | 2 +
|
||||
Makefile.util.def | 7 ++
|
||||
docs/man/grub-get-kernel-settings.h2m | 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 +++++--
|
||||
7 files changed, 141 insertions(+), 5 deletions(-)
|
||||
create mode 100644 docs/man/grub-get-kernel-settings.h2m
|
||||
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 493e336ec6c..3602b4ab62b 100644
|
||||
index 9ecd3540bd6..281201f671e 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -70,6 +70,7 @@ grub_TRANSFORM([grub-install])
|
||||
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install])
|
||||
grub_TRANSFORM([grub-mkconfig])
|
||||
grub_TRANSFORM([grub-mkfont])
|
||||
grub_TRANSFORM([grub-mkimage])
|
||||
|
|
@ -35,11 +34,19 @@ index 493e336ec6c..3602b4ab62b 100644
|
|||
grub_TRANSFORM([grub-glue-efi])
|
||||
grub_TRANSFORM([grub-mklayout])
|
||||
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
|
||||
@@ -82,6 +83,7 @@ grub_TRANSFORM([grub-file])
|
||||
grub_TRANSFORM([grub-bios-setup.3])
|
||||
grub_TRANSFORM([grub-editenv.1])
|
||||
grub_TRANSFORM([grub-fstest.3])
|
||||
+grub_TRANSFORM([grub-get-kernel-settings.3])
|
||||
grub_TRANSFORM([grub-glue-efi.3])
|
||||
grub_TRANSFORM([grub-install.1])
|
||||
grub_TRANSFORM([grub-kbdcomp.3])
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index 95884956a68..84a17ef5cfa 100644
|
||||
index 1a7dd433e33..cdd2f51fe4b 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -725,6 +725,13 @@ script = {
|
||||
@@ -732,6 +732,13 @@ script = {
|
||||
installdir = sbin;
|
||||
};
|
||||
|
||||
|
|
@ -53,19 +60,11 @@ index 95884956a68..84a17ef5cfa 100644
|
|||
script = {
|
||||
name = grub-set-default;
|
||||
common = util/grub-set-default.in;
|
||||
diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m
|
||||
new file mode 100644
|
||||
index 00000000000..b8051f01f3a
|
||||
--- /dev/null
|
||||
+++ b/docs/man/grub-get-kernel-settings.h2m
|
||||
@@ -0,0 +1,2 @@
|
||||
+[NAME]
|
||||
+grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file
|
||||
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
|
||||
index 213ce1e57cf..da7fca5efac 100644
|
||||
index 44bf135b9f8..5c4acd496d4 100644
|
||||
--- a/util/bash-completion.d/grub-completion.bash.in
|
||||
+++ b/util/bash-completion.d/grub-completion.bash.in
|
||||
@@ -275,6 +275,28 @@ have ${__grub_sparc64_setup_program} && \
|
||||
@@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \
|
||||
unset __grub_sparc64_setup_program
|
||||
|
||||
|
||||
|
|
@ -94,6 +93,32 @@ index 213ce1e57cf..da7fca5efac 100644
|
|||
#
|
||||
# grub-install
|
||||
#
|
||||
diff --git a/util/grub-get-kernel-settings.3 b/util/grub-get-kernel-settings.3
|
||||
new file mode 100644
|
||||
index 00000000000..ba33330e28d
|
||||
--- /dev/null
|
||||
+++ b/util/grub-get-kernel-settings.3
|
||||
@@ -0,0 +1,20 @@
|
||||
+.TH GRUB-GET-KERNEL-SETTINGS 3 "Thu Jun 25 2015"
|
||||
+.SH NAME
|
||||
+\fBgrub-get-kernel-settings\fR \(em Evaluate the system's kernel installation settings for use while making a grub configuration file.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-get-kernel-settings\fR [OPTION]
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-get-kernel-settings\fR reads the kernel installation settings on the host system, and emits a set of grub settings suitable for use when creating a grub configuration file.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+-h, --help
|
||||
+Display program usage and exit.
|
||||
+.TP
|
||||
+-v, --version
|
||||
+Display the current version.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
|
||||
new file mode 100644
|
||||
index 00000000000..7e87dfccc0e
|
||||
|
|
@ -189,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 5f2824d4f58..28e92515795 100644
|
||||
index 3e4c6c5240b..60beaaa6962 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@"
|
||||
|
|
@ -200,7 +225,7 @@ index 5f2824d4f58..28e92515795 100644
|
|||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
export TEXTDOMAINDIR="@localedir@"
|
||||
@@ -158,6 +159,8 @@ if test -f ${sysconfdir}/default/grub ; then
|
||||
@@ -161,6 +162,8 @@ if test -f ${sysconfdir}/default/grub ; then
|
||||
. ${sysconfdir}/default/grub
|
||||
fi
|
||||
|
||||
|
|
@ -210,10 +235,10 @@ index 5f2824d4f58..28e92515795 100644
|
|||
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
|
||||
GRUB_DISABLE_LINUX_UUID="true"
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 993c53ad92e..e8ab4082f87 100644
|
||||
index 2e59f3b4197..0f3c19e30cc 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -113,7 +113,8 @@ linux_entry ()
|
||||
@@ -111,7 +111,8 @@ linux_entry ()
|
||||
os="$1"
|
||||
version="$2"
|
||||
type="$3"
|
||||
|
|
@ -223,7 +248,7 @@ index 993c53ad92e..e8ab4082f87 100644
|
|||
|
||||
if [ -z "$boot_device_id" ]; then
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
@@ -125,6 +126,9 @@ linux_entry ()
|
||||
@@ -123,6 +124,9 @@ linux_entry ()
|
||||
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
|
||||
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
|
||||
fi
|
||||
|
|
@ -233,7 +258,7 @@ index 993c53ad92e..e8ab4082f87 100644
|
|||
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
||||
else
|
||||
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
||||
@@ -320,11 +324,15 @@ for linux in ${reverse_sorted_list}; do
|
||||
@@ -299,11 +303,15 @@ while [ "x$list" != "x" ] ; do
|
||||
fi
|
||||
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
|
||||
|
|
@ -251,7 +276,7 @@ index 993c53ad92e..e8ab4082f87 100644
|
|||
if [ -z "$boot_device_id" ]; then
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
fi
|
||||
@@ -333,10 +341,15 @@ for linux in ${reverse_sorted_list}; do
|
||||
@@ -312,10 +320,15 @@ while [ "x$list" != "x" ] ; do
|
||||
is_top_level=false
|
||||
fi
|
||||
|
||||
|
|
@ -266,6 +291,6 @@ index 993c53ad92e..e8ab4082f87 100644
|
|||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||
- linux_entry "${OS}" "${version}" recovery \
|
||||
+ linux_entry "${OS}" "${version}" recovery standard \
|
||||
"${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
|
||||
"single ${GRUB_CMDLINE_LINUX}"
|
||||
fi
|
||||
done
|
||||
|
||||
45
0049-bz1374141-fix-incorrect-mask-for-ppc64.patch
Normal file
45
0049-bz1374141-fix-incorrect-mask-for-ppc64.patch
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Masahiro Matsuya <mmatsuya@redhat.com>
|
||||
Date: Sat, 29 Oct 2016 08:35:26 +0900
|
||||
Subject: [PATCH] bz1374141 fix incorrect mask for ppc64
|
||||
|
||||
The netmask configured in firmware is not respected on ppc64 (big endian).
|
||||
When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath().
|
||||
|
||||
/vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512
|
||||
|
||||
The netmask in this bootpath is no problem, since it's a value specified in firmware. But,
|
||||
The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22).
|
||||
As a result, 16 was used for netmask wrongly.
|
||||
|
||||
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
|
||||
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
|
||||
1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4)
|
||||
|
||||
And, the count of zero with __builtin_ctz can be 16.
|
||||
This patch changes it as below.
|
||||
|
||||
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
|
||||
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
|
||||
1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
|
||||
0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
|
||||
|
||||
The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit)
|
||||
---
|
||||
grub-core/net/drivers/ieee1275/ofnet.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
|
||||
index 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,
|
||||
flags);
|
||||
inter->vlantag = vlantag;
|
||||
grub_net_add_ipv4_local (inter,
|
||||
- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
|
||||
-
|
||||
+ __builtin_clz (~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))));
|
||||
}
|
||||
|
||||
if (gateway_addr.ipv4 != 0)
|
||||
|
|
@ -5,18 +5,18 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
|
|||
|
||||
---
|
||||
grub-core/Makefile.core.def | 3 ++
|
||||
grub-core/kern/misc.c | 6 ++++
|
||||
grub-core/kern/misc.c | 8 +++++-
|
||||
grub-core/lib/arm64/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++
|
||||
grub-core/lib/backtrace.c | 2 ++
|
||||
grub-core/lib/i386/backtrace.c | 14 +++++++++-
|
||||
5 files changed, 86 insertions(+), 1 deletion(-)
|
||||
5 files changed, 87 insertions(+), 2 deletions(-)
|
||||
create mode 100644 grub-core/lib/arm64/backtrace.c
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 47c0fc755a2..63f053b3add 100644
|
||||
index c15e91943b9..058c88ac3af 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -199,6 +199,9 @@ kernel = {
|
||||
@@ -188,6 +188,9 @@ kernel = {
|
||||
|
||||
softdiv = lib/division.c;
|
||||
|
||||
|
|
@ -27,19 +27,19 @@ index 47c0fc755a2..63f053b3add 100644
|
|||
i386_xen = kern/i386/dl.c;
|
||||
i386_xen_pvh = kern/i386/dl.c;
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index 11037dc0227..465a8e74ea7 100644
|
||||
index 63b586d09cb..a3e215155bd 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -26,6 +26,7 @@
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <grub/term.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/charset.h>
|
||||
+#include <grub/backtrace.h>
|
||||
|
||||
union printf_arg
|
||||
{
|
||||
@@ -1301,6 +1302,11 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
|
||||
void __attribute__ ((noreturn))
|
||||
@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
|
||||
static void __attribute__ ((noreturn))
|
||||
grub_abort (void)
|
||||
{
|
||||
+#ifndef GRUB_UTIL
|
||||
|
|
@ -48,8 +48,11 @@ index 11037dc0227..465a8e74ea7 100644
|
|||
+#endif
|
||||
+#endif
|
||||
grub_printf ("\nAborted.");
|
||||
|
||||
-
|
||||
+
|
||||
#ifndef GRUB_UTIL
|
||||
if (grub_term_inputs)
|
||||
#endif
|
||||
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
|
||||
new file mode 100644
|
||||
index 00000000000..1079b5380e1
|
||||
150
0051-Fix-up-some-man-pages-rpmdiff-noticed.patch
Normal file
150
0051-Fix-up-some-man-pages-rpmdiff-noticed.patch
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 23 Sep 2014 09:58:49 -0400
|
||||
Subject: [PATCH] Fix up some man pages rpmdiff noticed.
|
||||
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
util/grub-macbless.8 | 26 +++++++++++++++++++
|
||||
util/grub-mkimage.1 | 2 +-
|
||||
util/grub-syslinux2cfg.1 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 94 insertions(+), 1 deletion(-)
|
||||
create mode 100644 util/grub-macbless.8
|
||||
create mode 100644 util/grub-syslinux2cfg.1
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 281201f671e..6c16968ad9c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3])
|
||||
grub_TRANSFORM([grub-glue-efi.3])
|
||||
grub_TRANSFORM([grub-install.1])
|
||||
grub_TRANSFORM([grub-kbdcomp.3])
|
||||
+grub_TRANSFORM([grub-macbless.8])
|
||||
grub_TRANSFORM([grub-menulst2cfg.1])
|
||||
grub_TRANSFORM([grub-mkconfig.1])
|
||||
grub_TRANSFORM([grub-mkfont.3])
|
||||
@@ -105,6 +106,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])
|
||||
+grub_TRANSFORM([grub-syslinux2cfg.1])
|
||||
|
||||
# Optimization flag. Allow user to override.
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
diff --git a/util/grub-macbless.8 b/util/grub-macbless.8
|
||||
new file mode 100644
|
||||
index 00000000000..ae842f3a606
|
||||
--- /dev/null
|
||||
+++ b/util/grub-macbless.8
|
||||
@@ -0,0 +1,26 @@
|
||||
+.TH GRUB-MACBLESS 1 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-macbless\fR \(em Mac-style bless utility for HFS or HFS+
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-macbless\fR [-p | --ppc] [-v | --verbose] [-x | --x86] \fIFILE\fR
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-mkimage\fR blesses a file on an HFS or HFS+ file system, so that it
|
||||
+can be used to boot a Mac.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+--ppc
|
||||
+Bless the file for use on PPC-based Macs.
|
||||
+
|
||||
+.TP
|
||||
+--verbose
|
||||
+Print verbose messages.
|
||||
+
|
||||
+.TP
|
||||
+--x86
|
||||
+Bless the file for use on x86-based Macs.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1
|
||||
index 4dea4f54597..0eaaafe505b 100644
|
||||
--- a/util/grub-mkimage.1
|
||||
+++ b/util/grub-mkimage.1
|
||||
@@ -17,7 +17,7 @@
|
||||
[-v | --verbose] \fIMODULES\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
-\fBgrub-mkimage\fI builds a bootable image of GRUB.
|
||||
+\fBgrub-mkimage\fR builds a bootable image of GRUB.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
diff --git a/util/grub-syslinux2cfg.1 b/util/grub-syslinux2cfg.1
|
||||
new file mode 100644
|
||||
index 00000000000..85309482718
|
||||
--- /dev/null
|
||||
+++ b/util/grub-syslinux2cfg.1
|
||||
@@ -0,0 +1,65 @@
|
||||
+.TH GRUB-SYSLINUX2CFG 1 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-syslinux2cfg\fR \(em Transform a syslinux config file into a GRUB config.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-syslinux2cfg\fR [-c | --cwd=\fRDIR\fI] [-r | --root=\fIDIR\fR] [-v | --verbose]
|
||||
+.RE
|
||||
+.RS 25
|
||||
+[-t | --target-root=\fIDIR\fR] [-T | --target-cwd=\fIDIR\fR]
|
||||
+.RE
|
||||
+.RS 25
|
||||
+[-o | --output=\fIFILE\fR] [[-i | --isolinux] |
|
||||
+.RE
|
||||
+.RS 46
|
||||
+ [-s | --syslinux] |
|
||||
+.RE
|
||||
+.RS 46
|
||||
+ [-p | --pxelinux]] \fIFILE\fR
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-syslinux2cfg\fR builds a GRUB configuration file out of an existing
|
||||
+syslinux configuration file.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+--cwd=\fIDIR\fR
|
||||
+Set \fIDIR\fR as syslinux's working directory. The default is to use the
|
||||
+parent directory of the input file.
|
||||
+
|
||||
+.TP
|
||||
+--root=\fIDIR\fR
|
||||
+Set \fIDIR\fR as the root directory of the syslinux disk. The default value
|
||||
+is "/".
|
||||
+
|
||||
+.TP
|
||||
+--verbose
|
||||
+Print verbose messages.
|
||||
+
|
||||
+.TP
|
||||
+--target-root=\fIDIR\fR
|
||||
+Root directory as it will be seen at runtime. The default value is "/".
|
||||
+
|
||||
+.TP
|
||||
+--target-cwd=\fIDIR\fR
|
||||
+Working directory of syslinux as it will be seen at runtime. The default
|
||||
+value is the parent directory of the input file.
|
||||
+
|
||||
+.TP
|
||||
+--output=\fIFILE\fR
|
||||
+Write the new config file to \fIFILE\fR. The default value is standard output.
|
||||
+
|
||||
+.TP
|
||||
+--isolinux
|
||||
+Assume that the input file is an isolinux configuration file.
|
||||
+
|
||||
+.TP
|
||||
+--pxelinux
|
||||
+Assume that the input file is a pxelinux configuration file.
|
||||
+
|
||||
+.TP
|
||||
+--syslinux
|
||||
+Assume that the input file is a syslinux configuration file.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
|
|
@ -9,11 +9,11 @@ time.
|
|||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
docs/grub-dev.texi | 4 +-
|
||||
docs/grub.texi | 357 ++++++++++++++++++++++++++++-------------------------
|
||||
2 files changed, 189 insertions(+), 172 deletions(-)
|
||||
docs/grub.texi | 323 ++++++++++++++++++++++++++++-------------------------
|
||||
2 files changed, 172 insertions(+), 155 deletions(-)
|
||||
|
||||
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
|
||||
index 1276c59302a..04c6678cb6b 100644
|
||||
index a834b3a9c32..a55af53fd45 100644
|
||||
--- a/docs/grub-dev.texi
|
||||
+++ b/docs/grub-dev.texi
|
||||
@@ -1,7 +1,7 @@
|
||||
|
|
@ -35,7 +35,7 @@ index 1276c59302a..04c6678cb6b 100644
|
|||
|
||||
@setchapternewpage odd
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index 974bc0ddb07..c30701b4e1f 100644
|
||||
index eeb3118ebde..aa3a7de9d4f 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -1,7 +1,7 @@
|
||||
|
|
@ -72,7 +72,31 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end direntry
|
||||
|
||||
@setchapternewpage odd
|
||||
@@ -223,7 +223,7 @@ surprising.
|
||||
@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}.
|
||||
* Platform-specific operations:: Platform-specific operations
|
||||
* Supported kernels:: The list of supported kernels
|
||||
* Troubleshooting:: Error messages produced by GRUB
|
||||
-* Invoking grub-install:: How to use the GRUB installer
|
||||
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
|
||||
-* Invoking grub-mkpasswd-pbkdf2::
|
||||
+* Invoking grub2-install:: How to use the GRUB installer
|
||||
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
|
||||
+* Invoking grub2-mkpasswd-pbkdf2::
|
||||
Generate GRUB password hashes
|
||||
-* Invoking grub-mkrelpath:: Make system path relative to its root
|
||||
-* Invoking grub-mkrescue:: Make a GRUB rescue image
|
||||
-* Invoking grub-mount:: Mount a file system using GRUB
|
||||
-* Invoking grub-probe:: Probe device information for GRUB
|
||||
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
|
||||
+* Invoking grub2-mkrelpath:: Make system path relative to its root
|
||||
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
|
||||
+* Invoking grub2-mount:: Mount a file system using GRUB
|
||||
+* Invoking grub2-probe:: Probe device information for GRUB
|
||||
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
|
||||
* Obtaining and Building GRUB:: How to obtain and build GRUB
|
||||
* Reporting bugs:: Where you should send a bug report
|
||||
* Future:: Some future plans on GRUB
|
||||
@@ -230,7 +230,7 @@ surprising.
|
||||
|
||||
@item
|
||||
@file{grub.cfg} is typically automatically generated by
|
||||
|
|
@ -81,7 +105,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
easier to handle versioned kernel upgrades.
|
||||
|
||||
@item
|
||||
@@ -237,7 +237,7 @@ scripting language: variables, conditionals, and loops are available.
|
||||
@@ -244,7 +244,7 @@ scripting language: variables, conditionals, and loops are available.
|
||||
@item
|
||||
A small amount of persistent storage is available across reboots, using the
|
||||
@command{save_env} and @command{load_env} commands in GRUB and the
|
||||
|
|
@ -90,7 +114,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
(@pxref{Environment block}).
|
||||
|
||||
@item
|
||||
@@ -542,7 +542,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
|
||||
@@ -549,7 +549,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
|
||||
OS name. E.g. for GNU/Linux:
|
||||
|
||||
@example
|
||||
|
|
@ -99,7 +123,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
On AROS we use another syntax. For volumes:
|
||||
@@ -565,7 +565,7 @@ For disks we use syntax:
|
||||
@@ -572,7 +572,7 @@ For disks we use syntax:
|
||||
E.g.
|
||||
|
||||
@example
|
||||
|
|
@ -108,7 +132,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
On Windows we use UNC path. For volumes it's typically
|
||||
@@ -592,7 +592,7 @@ For disks it's
|
||||
@@ -599,7 +599,7 @@ For disks it's
|
||||
E.g.
|
||||
|
||||
@example
|
||||
|
|
@ -117,7 +141,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
Beware that you may need to further escape the backslashes depending on your
|
||||
@@ -602,7 +602,7 @@ When compiled with cygwin support then cygwin drive names are automatically
|
||||
@@ -609,7 +609,7 @@ When compiled with cygwin support then cygwin drive names are automatically
|
||||
when needed. E.g.
|
||||
|
||||
@example
|
||||
|
|
@ -126,7 +150,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
@node Installation
|
||||
@@ -615,7 +615,7 @@ from the source tarball, or as a package for your OS.
|
||||
@@ -622,7 +622,7 @@ from the source tarball, or as a package for your OS.
|
||||
|
||||
After you have done that, you need to install the boot loader on a
|
||||
drive (floppy or hard disk) by using the utility
|
||||
|
|
@ -135,7 +159,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
GRUB comes with boot images, which are normally put in the directory
|
||||
@file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
|
||||
@@ -626,22 +626,22 @@ loader needs to find them (usually @file{/boot}) will be called
|
||||
@@ -633,22 +633,22 @@ loader needs to find them (usually @file{/boot}) will be called
|
||||
the @dfn{boot directory}.
|
||||
|
||||
@menu
|
||||
|
|
@ -163,7 +187,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
The usage is basically very simple. You only need to specify one
|
||||
argument to the program, namely, where to install the boot loader. The
|
||||
@@ -650,13 +650,13 @@ For example, under Linux the following will install GRUB into the MBR
|
||||
@@ -657,13 +657,13 @@ For example, under Linux the following will install GRUB into the MBR
|
||||
of the first IDE disk:
|
||||
|
||||
@example
|
||||
|
|
@ -179,7 +203,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
But all the above examples assume that GRUB should put images under
|
||||
@@ -670,7 +670,7 @@ boot floppy with a filesystem. Here is an example:
|
||||
@@ -677,7 +677,7 @@ boot floppy with a filesystem. Here is an example:
|
||||
# @kbd{mke2fs /dev/fd0}
|
||||
# @kbd{mount -t ext2 /dev/fd0 /mnt}
|
||||
# @kbd{mkdir /mnt/boot}
|
||||
|
|
@ -188,7 +212,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
# @kbd{umount /mnt}
|
||||
@end group
|
||||
@end example
|
||||
@@ -682,30 +682,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
|
||||
@@ -689,30 +689,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
|
||||
@example
|
||||
# @kbd{losetup /dev/loop0 /dev/sdb1}
|
||||
# @kbd{mount /dev/loop0 /mnt/usb}
|
||||
|
|
@ -230,7 +254,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
@node Making a GRUB bootable CD-ROM
|
||||
@@ -725,10 +732,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
|
||||
@@ -732,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
|
||||
other GRUB modules.
|
||||
|
||||
To make a simple generic GRUB rescue CD, you can use the
|
||||
|
|
@ -243,7 +267,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
You will often need to include other files in your image. To do this, first
|
||||
@@ -751,7 +758,7 @@ directory @file{iso/}.
|
||||
@@ -758,7 +765,7 @@ directory @file{iso/}.
|
||||
Finally, make the image:
|
||||
|
||||
@example
|
||||
|
|
@ -252,7 +276,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
This produces a file named @file{grub.iso}, which then can be burned
|
||||
@@ -767,7 +774,7 @@ storage devices.
|
||||
@@ -774,7 +781,7 @@ storage devices.
|
||||
@node Device map
|
||||
@section The map between BIOS drives and OS devices
|
||||
|
||||
|
|
@ -261,7 +285,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
etc.) read it to map BIOS drives to OS devices. This file consists of lines
|
||||
like this:
|
||||
|
||||
@@ -1269,23 +1276,23 @@ need to write the whole thing by hand.
|
||||
@@ -1254,23 +1261,23 @@ need to write the whole thing by hand.
|
||||
@node Simple configuration
|
||||
@section Simple configuration handling
|
||||
|
||||
|
|
@ -290,7 +314,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
valid POSIX shell input; normally, it will just be a sequence of
|
||||
@samp{KEY=value} lines, but if the value contains spaces or other special
|
||||
characters then it must be quoted. For example:
|
||||
@@ -1323,7 +1330,7 @@ works it's not recommended since titles often contain unstable device names
|
||||
@@ -1308,7 +1315,7 @@ works it's not recommended since titles often contain unstable device names
|
||||
and may be translated
|
||||
|
||||
If you set this to @samp{saved}, then the default menu entry will be that
|
||||
|
|
@ -299,7 +323,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
the environment block, which may not be available in all situations
|
||||
(@pxref{Environment block}).
|
||||
|
||||
@@ -1334,7 +1341,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
|
||||
@@ -1319,7 +1326,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
|
||||
it as a new default entry for use by future runs of GRUB. This is only
|
||||
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
|
||||
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
|
||||
|
|
@ -308,7 +332,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
This option relies on the environment block, which may not be available in
|
||||
all situations (@pxref{Environment block}).
|
||||
|
||||
@@ -1481,15 +1488,15 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
|
||||
@@ -1449,7 +1456,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
|
||||
@end example
|
||||
|
||||
@item GRUB_DISABLE_LINUX_UUID
|
||||
|
|
@ -317,17 +341,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
universally-unique identifiers (UUIDs) to identify the root filesystem to
|
||||
the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
|
||||
usually more reliable, but in some cases it may not be appropriate. To
|
||||
disable the use of UUIDs, set this option to @samp{true}.
|
||||
|
||||
@item GRUB_DISABLE_LINUX_PARTUUID
|
||||
-If @command{grub-mkconfig} cannot identify the root filesystem via its
|
||||
-universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID
|
||||
+If @command{grub2-mkconfig} cannot identify the root filesystem via its
|
||||
+universally-unique indentifier (UUID), @command{grub2-mkconfig} can use the UUID
|
||||
of the partition containing the filesystem to identify the root filesystem to
|
||||
the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not
|
||||
as reliable as using the filesystem UUID, but is more reliable than using the
|
||||
@@ -1503,7 +1510,7 @@ If this option is set to @samp{true}, disable the generation of recovery
|
||||
@@ -1471,7 +1478,7 @@ If this option is set to @samp{true}, disable the generation of recovery
|
||||
mode menu entries.
|
||||
|
||||
@item GRUB_DISABLE_UUID
|
||||
|
|
@ -336,7 +350,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
universally-unique identifiers (UUIDs) to identify various filesystems to
|
||||
search for files. This is usually more reliable, but in some cases it may
|
||||
not be appropriate. To disable this use of UUIDs, set this option to
|
||||
@@ -1514,12 +1521,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
|
||||
@@ -1482,12 +1489,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
|
||||
@item GRUB_VIDEO_BACKEND
|
||||
If graphical video support is required, either because the @samp{gfxterm}
|
||||
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
|
||||
|
|
@ -352,16 +366,22 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@item GRUB_GFXMODE
|
||||
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
|
||||
@@ -1552,7 +1559,7 @@ boot sequence. If you have problems, set this option to @samp{text} and
|
||||
@@ -1519,20 +1526,20 @@ boot sequence. If you have problems, set this option to @samp{text} and
|
||||
GRUB will tell Linux to boot in normal text mode.
|
||||
|
||||
@item GRUB_DISABLE_OS_PROBER
|
||||
-Normally, @command{grub-mkconfig} will try to use the external
|
||||
+Normally, @command{grub2-mkconfig} will try to use the external
|
||||
@command{os-prober} program, if installed, to discover other operating
|
||||
systems installed on the same system and generate appropriate menu entries
|
||||
for them. Set this option to @samp{true} to disable this.
|
||||
@@ -1562,7 +1569,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober
|
||||
-The @command{grub-mkconfig} has a feature to use the external
|
||||
+The @command{grub2-mkconfig} has a feature to use the external
|
||||
@command{os-prober} program to discover other operating systems installed on
|
||||
the same machine and generate appropriate menu entries for them. It is disabled
|
||||
by default since automatic and silent execution of @command{os-prober}, and
|
||||
creating boot entries based on that data, is a potential attack vector. Set
|
||||
this option to @samp{false} to enable this feature in the
|
||||
-@command{grub-mkconfig} command.
|
||||
+@command{grub2-mkconfig} command.
|
||||
|
||||
@item GRUB_OS_PROBER_SKIP_LIST
|
||||
List of space-separated FS UUIDs of filesystems to be ignored from os-prober
|
||||
output. For efi chainloaders it's <UUID>@@<EFI FILE>
|
||||
|
||||
@item GRUB_DISABLE_SUBMENU
|
||||
|
|
@ -370,7 +390,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
the kernel with highest version number and put all other found kernels
|
||||
or alternative menu entries for recovery mode in submenu. For entries returned
|
||||
by @command{os-prober} first entry will be put on top level and all others
|
||||
@@ -1570,11 +1577,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
|
||||
@@ -1540,11 +1547,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
|
||||
on top level will be generated instead. Changing this option will require
|
||||
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
|
||||
and @samp{default} (@pxref{default}) environment variables as well as saved
|
||||
|
|
@ -385,7 +405,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
check for encrypted disks and generate additional commands needed to access
|
||||
them during boot. Note that in this case unattended boot is not possible
|
||||
because GRUB will wait for passphrase to unlock encrypted container.
|
||||
@@ -1633,7 +1640,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
|
||||
@@ -1603,7 +1610,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
|
||||
|
||||
@end table
|
||||
|
||||
|
|
@ -394,48 +414,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
edit the scripts in @file{/etc/grub.d} directly.
|
||||
@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
|
||||
menu entries; simply type the menu entries you want to add at the end of
|
||||
@@ -1641,14 +1648,14 @@ that file, making sure to leave at least the first two lines intact.
|
||||
|
||||
@node Root Identifcation Heuristics
|
||||
@section Root Identifcation Heuristics
|
||||
-If the target operating system uses the Linux kernel, @command{grub-mkconfig}
|
||||
+If the target operating system uses the Linux kernel, @command{grub2-mkconfig}
|
||||
attempts to identify the root file system via a heuristic algoirthm. This
|
||||
algorithm selects the identification method of the root file system by
|
||||
considering three factors. The first is if an initrd for the target operating
|
||||
system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set
|
||||
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
|
||||
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
|
||||
system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set
|
||||
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
|
||||
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
|
||||
system via the UUID of its enclosing partition. If the variables are assigned
|
||||
any other value, that value is considered equivalent to @samp{false}. The
|
||||
variables are also considered to be set to @samp{false} if they are not set.
|
||||
@@ -1658,18 +1665,18 @@ filesystem to the initrd. Most initrd images determine the root file system by
|
||||
checking the Linux kernel's command-line for the @samp{root} key and use its
|
||||
value as the identification method of the root file system. To improve the
|
||||
reliability of booting, most initrd images also allow the root file system to be
|
||||
-identified by its UUID. Because of this behavior, the @command{grub-mkconfig}
|
||||
+identified by its UUID. Because of this behavior, the @command{grub2-mkconfig}
|
||||
command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with
|
||||
the filesystem UUID of the root file system.
|
||||
|
||||
If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true}
|
||||
-then @command{grub-command} will identify the root filesystem by setting the
|
||||
+then @command{grub2-command} will identify the root filesystem by setting the
|
||||
kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless
|
||||
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If
|
||||
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true},
|
||||
-@command{grub-command} will identify by its Linux device name.
|
||||
+@command{grub2-command} will identify by its Linux device name.
|
||||
|
||||
-The following table summarizes the behavior of the @command{grub-mkconfig}
|
||||
+The following table summarizes the behavior of the @command{grub2-mkconfig}
|
||||
command.
|
||||
|
||||
@multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root}
|
||||
@@ -1898,7 +1905,7 @@ images as well.
|
||||
@@ -1864,7 +1871,7 @@ images as well.
|
||||
Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
|
||||
install self-compiled latest GRUB with:
|
||||
|
||||
|
|
@ -444,7 +423,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
In all the OSes install GRUB tools but disable installing GRUB in bootsector,
|
||||
so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
|
||||
@@ -1908,20 +1915,20 @@ use by setting:
|
||||
@@ -1874,20 +1881,20 @@ use by setting:
|
||||
|
||||
in /etc/default/grub
|
||||
|
||||
|
|
@ -468,7 +447,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@}
|
||||
|
||||
menuentry "Windows XP" @{
|
||||
@@ -1984,15 +1991,15 @@ GRUB supports embedding a configuration file directly into the core image,
|
||||
@@ -1950,15 +1957,15 @@ GRUB supports embedding a configuration file directly into the core image,
|
||||
so that it is loaded before entering normal mode. This is useful, for
|
||||
example, when it is not straightforward to find the real configuration file,
|
||||
or when you need to debug problems with loading that file.
|
||||
|
|
@ -487,7 +466,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
After the embedded configuration file (if any) is executed, GRUB will load
|
||||
the @samp{normal} module (@pxref{normal}), which will then read the real
|
||||
@@ -2027,13 +2034,13 @@ included in the core image:
|
||||
@@ -1993,13 +2000,13 @@ included in the core image:
|
||||
@example
|
||||
@group
|
||||
search.fs_label grub root
|
||||
|
|
@ -505,7 +484,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
else
|
||||
echo "Could not find an example configuration file!"
|
||||
fi
|
||||
@@ -2557,7 +2564,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
|
||||
@@ -2523,7 +2530,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
|
||||
@end group
|
||||
@end example
|
||||
|
||||
|
|
@ -514,7 +493,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
server.
|
||||
|
||||
The grub.cfg file is placed in the same directory as the path output by
|
||||
@@ -2760,7 +2767,7 @@ team are:
|
||||
@@ -2717,7 +2724,7 @@ team are:
|
||||
@end table
|
||||
|
||||
To take full advantage of this function, install GRUB into the MBR
|
||||
|
|
@ -523,7 +502,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
If you have a laptop which has a similar feature and not in the above list
|
||||
could you figure your address and contribute?
|
||||
@@ -2821,7 +2828,7 @@ bytes.
|
||||
@@ -2778,7 +2785,7 @@ bytes.
|
||||
The sole function of @file{boot.img} is to read the first sector of the core
|
||||
image from a local disk and jump to it. Because of the size restriction,
|
||||
@file{boot.img} cannot understand any file system structure, so
|
||||
|
|
@ -532,7 +511,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
core image into @file{boot.img} when installing GRUB.
|
||||
|
||||
@item diskboot.img
|
||||
@@ -2851,7 +2858,7 @@ images.
|
||||
@@ -2808,7 +2815,7 @@ images.
|
||||
|
||||
@item core.img
|
||||
This is the core image of GRUB. It is built dynamically from the kernel
|
||||
|
|
@ -541,7 +520,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
program. Usually, it contains enough modules to access @file{/boot/grub},
|
||||
and loads everything else (including menu handling, the ability to load
|
||||
target operating systems, and so on) from the file system at run-time. The
|
||||
@@ -2903,7 +2910,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
|
||||
@@ -2860,7 +2867,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
|
||||
In GRUB 2, images for booting from CD-ROM drives are now constructed using
|
||||
@file{cdboot.img} and @file{core.img}, making sure that the core image
|
||||
contains the @samp{iso9660} module. It is usually best to use the
|
||||
|
|
@ -550,7 +529,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@item nbgrub
|
||||
There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
|
||||
@@ -3071,8 +3078,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
|
||||
@@ -3016,8 +3023,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
|
||||
|
||||
An absolute file name resembles a Unix absolute file name, using
|
||||
@samp{/} for the directory separator (not @samp{\} as in DOS). One
|
||||
|
|
@ -561,7 +540,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
disk. If you omit the device name in an absolute file name, GRUB uses
|
||||
GRUB's @dfn{root device} implicitly. So if you set the root device to,
|
||||
say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
|
||||
@@ -3080,8 +3087,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
|
||||
@@ -3025,8 +3032,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
|
||||
|
||||
On ZFS filesystem the first path component must be
|
||||
@var{volume}@samp{@@}[@var{snapshot}].
|
||||
|
|
@ -572,7 +551,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
|
||||
snapshot name is omitted.
|
||||
|
||||
@@ -3500,7 +3507,7 @@ The more recent release of Minix would then be identified as
|
||||
@@ -3429,7 +3436,7 @@ The more recent release of Minix would then be identified as
|
||||
@samp{other>minix>minix-3.4.0}.
|
||||
|
||||
This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
|
||||
|
|
@ -581,7 +560,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
|
||||
@node fallback
|
||||
@@ -3590,7 +3597,7 @@ If this variable is set, it names the language code that the
|
||||
@@ -3519,7 +3526,7 @@ If this variable is set, it names the language code that the
|
||||
example, French would be named as @samp{fr}, and Simplified Chinese as
|
||||
@samp{zh_CN}.
|
||||
|
||||
|
|
@ -590,7 +569,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
reasonable default for this variable based on the system locale.
|
||||
|
||||
|
||||
@@ -3598,10 +3605,10 @@ reasonable default for this variable based on the system locale.
|
||||
@@ -3527,10 +3534,10 @@ reasonable default for this variable based on the system locale.
|
||||
@subsection locale_dir
|
||||
|
||||
If this variable is set, it names the directory where translation files may
|
||||
|
|
@ -603,7 +582,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
default for this variable if internationalization is needed and any
|
||||
translation files are available.
|
||||
|
||||
@@ -3738,7 +3745,7 @@ input. The default is not to pause output.
|
||||
@@ -3648,7 +3655,7 @@ input. The default is not to pause output.
|
||||
|
||||
The location of the @samp{/boot/grub} directory as an absolute file name
|
||||
(@pxref{File name syntax}). This is normally set by GRUB at startup based
|
||||
|
|
@ -612,7 +591,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
dynamically loaded from this directory, so it must be set correctly in order
|
||||
for many parts of GRUB to work.
|
||||
|
||||
@@ -3850,17 +3857,17 @@ GRUB provides an ``environment block'' which can be used to save a small
|
||||
@@ -3739,17 +3746,17 @@ GRUB provides an ``environment block'' which can be used to save a small
|
||||
amount of state.
|
||||
|
||||
The environment block is a preallocated 1024-byte file, which normally lives
|
||||
|
|
@ -632,8 +611,8 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
+@command{grub2-mkconfig} uses this facility to implement
|
||||
@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
|
||||
|
||||
@node Modules
|
||||
@@ -4922,7 +4929,7 @@ Translate @var{string} into the current language.
|
||||
|
||||
@@ -4473,7 +4480,7 @@ Translate @var{string} into the current language.
|
||||
|
||||
The current language code is stored in the @samp{lang} variable in GRUB's
|
||||
environment (@pxref{lang}). Translation files in MO format are read from
|
||||
|
|
@ -642,7 +621,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end deffn
|
||||
|
||||
|
||||
@@ -5274,7 +5281,7 @@ Define a user named @var{user} with password @var{clear-password}.
|
||||
@@ -4868,7 +4875,7 @@ Define a user named @var{user} with password @var{clear-password}.
|
||||
|
||||
@deffn Command password_pbkdf2 user hashed-password
|
||||
Define a user named @var{user} with password hash @var{hashed-password}.
|
||||
|
|
@ -651,7 +630,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
to generate password hashes. @xref{Security}.
|
||||
@end deffn
|
||||
|
||||
@@ -6400,8 +6407,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
|
||||
@@ -5811,8 +5818,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
|
||||
which has an associated password. @samp{password} sets the password in
|
||||
plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
|
||||
sets the password hashed using the Password-Based Key Derivation Function
|
||||
|
|
@ -662,7 +641,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
In order to enable authentication support, the @samp{superusers} environment
|
||||
variable must be set to a list of usernames, separated by any of spaces,
|
||||
@@ -6446,7 +6453,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
|
||||
@@ -5857,7 +5864,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
|
||||
@end group
|
||||
@end example
|
||||
|
||||
|
|
@ -671,13 +650,11 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
generating configuration files with authentication. You can use
|
||||
@file{/etc/grub.d/40_custom} to add simple superuser authentication, by
|
||||
adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
|
||||
@@ -6472,8 +6479,18 @@ validation fails, then file @file{foo} cannot be opened. This failure
|
||||
may halt or otherwise impact the boot process.
|
||||
@@ -5884,7 +5891,17 @@ may halt or otherwise impact the boot process.
|
||||
|
||||
An initial trusted public key can be embedded within the GRUB @file{core.img}
|
||||
-using the @code{--pubkey} option to @command{grub-install}
|
||||
using the @code{--pubkey} option to @command{grub-install}
|
||||
-(@pxref{Invoking grub-install}).
|
||||
+using the @code{--pubkey} option to @command{grub2-install}
|
||||
+(@pxref{Invoking grub2-install}).
|
||||
+
|
||||
+@comment Unfortunately --pubkey is not yet supported by grub2-install,
|
||||
|
|
@ -692,7 +669,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
GRUB uses GPG-style detached signatures (meaning that a file
|
||||
@file{foo.sig} will be produced when file @file{foo} is signed), and
|
||||
@@ -6493,8 +6510,8 @@ gpg --detach-sign /path/to/file
|
||||
@@ -5904,8 +5921,8 @@ gpg --detach-sign /path/to/file
|
||||
For successful validation of all of GRUB's subcomponents and the
|
||||
loaded OS kernel, they must all be signed. One way to accomplish this
|
||||
is the following (after having already produced the desired
|
||||
|
|
@ -703,7 +680,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@example
|
||||
@group
|
||||
@@ -6516,7 +6533,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
|
||||
@@ -5927,7 +5944,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
|
||||
Note that internally signature enforcement is controlled by setting
|
||||
the environment variable @code{check_signatures} equal to
|
||||
@code{enforce}. Passing one or more @code{--pubkey} options to
|
||||
|
|
@ -712,16 +689,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
equal to @code{enforce} in @file{core.img} prior to processing any
|
||||
configuration files.
|
||||
|
||||
@@ -6564,7 +6581,7 @@ UTF-8 strings as comma-separated values (CSV). See
|
||||
@uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
|
||||
|
||||
To add a data section containing the SBAT information into the binary, the
|
||||
-@option{--sbat} option of @command{grub-mkimage} command should be used. The content
|
||||
+@option{--sbat} option of @command{grub2-mkimage} command should be used. The content
|
||||
of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
|
||||
the generated EFI binary. The CSV file can be stored anywhere on the file system.
|
||||
|
||||
@@ -6975,10 +6992,10 @@ Required files are:
|
||||
@@ -6385,10 +6402,10 @@ Required files are:
|
||||
|
||||
GRUB's normal start-up procedure involves setting the @samp{prefix}
|
||||
environment variable to a value set in the core image by
|
||||
|
|
@ -734,7 +702,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
things GRUB is supposed to do.
|
||||
|
||||
If, instead, you only get a rescue shell, this usually means that GRUB
|
||||
@@ -7004,8 +7021,8 @@ normal
|
||||
@@ -6414,8 +6431,8 @@ normal
|
||||
|
||||
However, any problem that leaves you in the rescue shell probably means that
|
||||
GRUB was not correctly installed. It may be more useful to try to reinstall
|
||||
|
|
@ -745,7 +713,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@itemize @bullet{}
|
||||
@item
|
||||
@@ -7017,7 +7034,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
|
||||
@@ -6427,7 +6444,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
|
||||
drive ordering entirely.
|
||||
|
||||
@item
|
||||
|
|
@ -754,34 +722,14 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
to a partition but GRUB has already been installed in the master boot
|
||||
record, then the GRUB installation in the partition will be ignored.
|
||||
|
||||
@@ -7052,33 +7069,33 @@ bootability on other machines.
|
||||
@chapter User-space utilities
|
||||
|
||||
@menu
|
||||
-* Invoking grub-install:: How to use the GRUB installer
|
||||
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
|
||||
-* Invoking grub-mkpasswd-pbkdf2::
|
||||
+* Invoking grub2-install:: How to use the GRUB installer
|
||||
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
|
||||
+* Invoking grub2-mkpasswd-pbkdf2::
|
||||
Generate GRUB password hashes
|
||||
-* Invoking grub-mkrelpath:: Make system path relative to its root
|
||||
-* Invoking grub-mkrescue:: Make a GRUB rescue image
|
||||
-* Invoking grub-mount:: Mount a file system using GRUB
|
||||
-* Invoking grub-probe:: Probe device information for GRUB
|
||||
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
|
||||
+* Invoking grub2-mkrelpath:: Make system path relative to its root
|
||||
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
|
||||
+* Invoking grub2-mount:: Mount a file system using GRUB
|
||||
+* Invoking grub2-probe:: Probe device information for GRUB
|
||||
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
|
||||
@end menu
|
||||
@@ -6458,21 +6475,21 @@ entry which claims partition start at block 0. This change will not hamper
|
||||
bootability on other machines.
|
||||
|
||||
|
||||
-@node Invoking grub-install
|
||||
-@section Invoking grub-install
|
||||
-@chapter Invoking grub-install
|
||||
+@node Invoking grub2-install
|
||||
+@section Invoking grub2-install
|
||||
+@chapter Invoking grub2-install
|
||||
|
||||
-The program @command{grub-install} generates a GRUB core image using
|
||||
-@command{grub-mkimage} and installs it on your system. You must specify the
|
||||
|
|
@ -802,7 +750,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@table @option
|
||||
@item --help
|
||||
@@ -7094,13 +7111,13 @@ separate partition or a removable disk.
|
||||
@@ -6488,13 +6505,13 @@ separate partition or a removable disk.
|
||||
If this option is not specified then it defaults to @file{/boot}, so
|
||||
|
||||
@example
|
||||
|
|
@ -818,7 +766,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
@end example
|
||||
|
||||
Here is an example in which you have a separate @dfn{boot} partition which is
|
||||
@@ -7108,16 +7125,16 @@ mounted on
|
||||
@@ -6502,16 +6519,16 @@ mounted on
|
||||
@file{/mnt/boot}:
|
||||
|
||||
@example
|
||||
|
|
@ -838,14 +786,14 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
extra space in the bootloader embedding area for Reed-Solomon
|
||||
error-correcting codes. This enables GRUB to still boot successfully
|
||||
if some blocks are corrupted. The exact amount of protection offered
|
||||
@@ -7130,17 +7147,17 @@ installation}) where GRUB does not reside in any unpartitioned space
|
||||
@@ -6524,17 +6541,17 @@ installation}) where GRUB does not reside in any unpartitioned space
|
||||
outside of the MBR. Disable the Reed-Solomon codes with this option.
|
||||
@end table
|
||||
|
||||
-@node Invoking grub-mkconfig
|
||||
-@section Invoking grub-mkconfig
|
||||
-@chapter Invoking grub-mkconfig
|
||||
+@node Invoking grub2-mkconfig
|
||||
+@section Invoking grub2-mkconfig
|
||||
+@chapter Invoking grub2-mkconfig
|
||||
|
||||
-The program @command{grub-mkconfig} generates a configuration file for GRUB
|
||||
+The program @command{grub2-mkconfig} generates a configuration file for GRUB
|
||||
|
|
@ -853,7 +801,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@example
|
||||
-grub-mkconfig -o /boot/grub/grub.cfg
|
||||
+grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
+grub-mkconfig -o /boot/grub2/grub.cfg
|
||||
@end example
|
||||
|
||||
-@command{grub-mkconfig} accepts the following options:
|
||||
|
|
@ -861,22 +809,21 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@table @option
|
||||
@item --help
|
||||
@@ -7156,17 +7173,17 @@ it to standard output.
|
||||
@@ -6550,17 +6567,17 @@ it to standard output.
|
||||
@end table
|
||||
|
||||
|
||||
-@node Invoking grub-mkpasswd-pbkdf2
|
||||
-@section Invoking grub-mkpasswd-pbkdf2
|
||||
-@chapter Invoking grub-mkpasswd-pbkdf2
|
||||
+@node Invoking grub2-mkpasswd-pbkdf2
|
||||
+@section Invoking grub2-mkpasswd-pbkdf2
|
||||
+@chapter Invoking grub2-mkpasswd-pbkdf2
|
||||
|
||||
-The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
|
||||
+The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for
|
||||
GRUB (@pxref{Security}).
|
||||
|
||||
@example
|
||||
-grub-mkpasswd-pbkdf2
|
||||
+grub2-mkpasswd-pbkdf2
|
||||
grub-mkpasswd-pbkdf2
|
||||
@end example
|
||||
|
||||
-@command{grub-mkpasswd-pbkdf2} accepts the following options:
|
||||
|
|
@ -884,14 +831,14 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@table @option
|
||||
@item -c @var{number}
|
||||
@@ -7184,23 +7201,23 @@ Length of the salt. Defaults to 64.
|
||||
@@ -6578,23 +6595,23 @@ Length of the salt. Defaults to 64.
|
||||
@end table
|
||||
|
||||
|
||||
-@node Invoking grub-mkrelpath
|
||||
-@section Invoking grub-mkrelpath
|
||||
-@chapter Invoking grub-mkrelpath
|
||||
+@node Invoking grub2-mkrelpath
|
||||
+@section Invoking grub2-mkrelpath
|
||||
+@chapter Invoking grub2-mkrelpath
|
||||
|
||||
-The program @command{grub-mkrelpath} makes a file system path relative to
|
||||
+The program @command{grub2-mkrelpath} makes a file system path relative to
|
||||
|
|
@ -914,22 +861,21 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@table @option
|
||||
@item --help
|
||||
@@ -7211,17 +7228,17 @@ Print the version number of GRUB and exit.
|
||||
@@ -6605,17 +6622,17 @@ Print the version number of GRUB and exit.
|
||||
@end table
|
||||
|
||||
|
||||
-@node Invoking grub-mkrescue
|
||||
-@section Invoking grub-mkrescue
|
||||
-@chapter Invoking grub-mkrescue
|
||||
+@node Invoking grub2-mkrescue
|
||||
+@section Invoking grub2-mkrescue
|
||||
+@chapter Invoking grub2-mkrescue
|
||||
|
||||
-The program @command{grub-mkrescue} generates a bootable GRUB rescue image
|
||||
+The program @command{grub2-mkrescue} generates a bootable GRUB rescue image
|
||||
(@pxref{Making a GRUB bootable CD-ROM}).
|
||||
|
||||
@example
|
||||
-grub-mkrescue -o grub.iso
|
||||
+grub2-mkrescue -o grub.iso
|
||||
grub-mkrescue -o grub.iso
|
||||
@end example
|
||||
|
||||
-All arguments not explicitly listed as @command{grub-mkrescue} options are
|
||||
|
|
@ -937,12 +883,8 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
|
||||
Options passed to @command{xorriso} will normally be interpreted as
|
||||
@command{mkisofs} options; if the option @samp{--} is used, then anything
|
||||
@@ -7233,10 +7250,10 @@ commonly used to add extra files to the image:
|
||||
@example
|
||||
mkdir -p disk/boot/grub
|
||||
@r{(add extra files to @file{disk/boot/grub})}
|
||||
-grub-mkrescue -o grub.iso disk
|
||||
+grub2-mkrescue -o grub.iso disk
|
||||
@@ -6630,7 +6647,7 @@ mkdir -p disk/boot/grub
|
||||
grub-mkrescue -o grub.iso disk
|
||||
@end example
|
||||
|
||||
-@command{grub-mkrescue} accepts the following options:
|
||||
|
|
@ -950,7 +892,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@table @option
|
||||
@item --help
|
||||
@@ -7264,15 +7281,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
|
||||
@@ -6658,15 +6675,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
|
||||
default.
|
||||
|
||||
@item --grub-mkimage=@var{file}
|
||||
|
|
@ -961,16 +903,16 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
|
||||
-@node Invoking grub-mount
|
||||
-@section Invoking grub-mount
|
||||
-@chapter Invoking grub-mount
|
||||
+@node Invoking grub2-mount
|
||||
+@section Invoking grub2-mount
|
||||
+@chapter Invoking grub2-mount
|
||||
|
||||
-The program @command{grub-mount} performs a read-only mount of any file
|
||||
+The program @command{grub2-mount} performs a read-only mount of any file
|
||||
system or file system image that GRUB understands, using GRUB's file system
|
||||
drivers via FUSE. (It is only available if FUSE development files were
|
||||
present when GRUB was built.) This has a number of uses:
|
||||
@@ -7304,13 +7321,13 @@ even if nobody has yet written a FUSE module specifically for that file
|
||||
@@ -6698,13 +6715,13 @@ even if nobody has yet written a FUSE module specifically for that file
|
||||
system type.
|
||||
@end itemize
|
||||
|
||||
|
|
@ -978,8 +920,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
+Using @command{grub2-mount} is normally as simple as:
|
||||
|
||||
@example
|
||||
-grub-mount /dev/sda1 /mnt
|
||||
+grub2-mount /dev/sda1 /mnt
|
||||
grub-mount /dev/sda1 /mnt
|
||||
@end example
|
||||
|
||||
-@command{grub-mount} must be given one or more images and a mount point as
|
||||
|
|
@ -987,7 +928,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
non-option arguments (if it is given more than one image, it will treat them
|
||||
as a RAID set), and also accepts the following options:
|
||||
|
||||
@@ -7332,13 +7349,13 @@ Show debugging output for conditions matching @var{string}.
|
||||
@@ -6726,13 +6743,13 @@ Show debugging output for conditions matching @var{string}.
|
||||
@item -K prompt|@var{file}
|
||||
@itemx --zfs-key=prompt|@var{file}
|
||||
Load a ZFS encryption key. If you use @samp{prompt} as the argument,
|
||||
|
|
@ -1003,33 +944,22 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
root of the supplied file system.
|
||||
|
||||
If @var{device} is just a number, then it will be treated as a partition
|
||||
@@ -7347,7 +7364,7 @@ an entire disk in @file{disk.img}, then you can use this command to mount
|
||||
its second partition:
|
||||
|
||||
@example
|
||||
-grub-mount -r 2 disk.img mount-point
|
||||
+grub2-mount -r 2 disk.img mount-point
|
||||
@end example
|
||||
|
||||
@item -v
|
||||
@@ -7356,18 +7373,18 @@ Print verbose messages.
|
||||
@@ -6750,10 +6767,10 @@ Print verbose messages.
|
||||
@end table
|
||||
|
||||
|
||||
-@node Invoking grub-probe
|
||||
-@section Invoking grub-probe
|
||||
-@chapter Invoking grub-probe
|
||||
+@node Invoking grub2-probe
|
||||
+@section Invoking grub2-probe
|
||||
+@chapter Invoking grub2-probe
|
||||
|
||||
-The program @command{grub-probe} probes device information for a given path
|
||||
+The program @command{grub2-probe} probes device information for a given path
|
||||
or device.
|
||||
|
||||
@example
|
||||
-grub-probe --target=fs /boot/grub
|
||||
-grub-probe --target=drive --device /dev/sda1
|
||||
+grub2-probe --target=fs /boot/grub
|
||||
+grub2-probe --target=drive --device /dev/sda1
|
||||
@@ -6761,7 +6778,7 @@ grub-probe --target=fs /boot/grub
|
||||
grub-probe --target=drive --device /dev/sda1
|
||||
@end example
|
||||
|
||||
-@command{grub-probe} must be given a path or device as a non-option
|
||||
|
|
@ -1037,7 +967,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
argument, and also accepts the following options:
|
||||
|
||||
@table @option
|
||||
@@ -7380,16 +7397,16 @@ Print the version number of GRUB and exit.
|
||||
@@ -6774,16 +6791,16 @@ Print the version number of GRUB and exit.
|
||||
@item -d
|
||||
@itemx --device
|
||||
If this option is given, then the non-option argument is a system device
|
||||
|
|
@ -1057,14 +987,14 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@item -t @var{target}
|
||||
@itemx --target=@var{target}
|
||||
@@ -7442,19 +7459,19 @@ Print verbose messages.
|
||||
@@ -6836,19 +6853,19 @@ Print verbose messages.
|
||||
@end table
|
||||
|
||||
|
||||
-@node Invoking grub-script-check
|
||||
-@section Invoking grub-script-check
|
||||
-@chapter Invoking grub-script-check
|
||||
+@node Invoking grub2-script-check
|
||||
+@section Invoking grub2-script-check
|
||||
+@chapter Invoking grub2-script-check
|
||||
|
||||
-The program @command{grub-script-check} takes a GRUB script file
|
||||
+The program @command{grub2-script-check} takes a GRUB script file
|
||||
|
|
@ -1074,7 +1004,7 @@ index 974bc0ddb07..c30701b4e1f 100644
|
|||
|
||||
@example
|
||||
-grub-script-check /boot/grub/grub.cfg
|
||||
+grub2-script-check /boot/grub2/grub.cfg
|
||||
+grub-script-check /boot/grub2/grub.cfg
|
||||
@end example
|
||||
|
||||
-@command{grub-script-check} accepts the following options:
|
||||
|
|
@ -20,10 +20,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 18 insertions(+), 60 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
|
||||
index f300e46fc6a..d7d423b2eaf 100644
|
||||
index 94622481284..9d6ea55bdd3 100644
|
||||
--- a/util/grub.d/30_os-prober.in
|
||||
+++ b/util/grub.d/30_os-prober.in
|
||||
@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then
|
||||
@@ -45,68 +45,25 @@ if [ -z "${OSPROBED}" ] ; then
|
||||
fi
|
||||
|
||||
osx_entry() {
|
||||
|
|
@ -104,7 +104,7 @@ index f300e46fc6a..d7d423b2eaf 100644
|
|||
}
|
||||
EOF
|
||||
}
|
||||
@@ -296,11 +253,12 @@ EOF
|
||||
@@ -295,11 +252,12 @@ EOF
|
||||
echo "$title_correction_code"
|
||||
;;
|
||||
macosx)
|
||||
|
|
@ -19,12 +19,12 @@ variable and loading the config file from the subvolume.
|
|||
|
||||
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 558 ++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
grub-core/fs/btrfs.c | 552 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
include/grub/btrfs.h | 1 +
|
||||
2 files changed, 536 insertions(+), 23 deletions(-)
|
||||
2 files changed, 533 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index ba0c583526d..f14fe9c1bda 100644
|
||||
index 63203034dfc..f1fff7385b5 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -38,6 +38,9 @@
|
||||
|
|
@ -89,7 +89,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2,
|
||||
256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2
|
||||
};
|
||||
@@ -1252,6 +1274,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
@@ -1173,6 +1195,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
static struct grub_btrfs_data *
|
||||
grub_btrfs_mount (grub_device_t dev)
|
||||
{
|
||||
@@ -1287,6 +1365,13 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
@@ -1208,6 +1286,13 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
data->devices_attached[0].dev = dev;
|
||||
data->devices_attached[0].id = data->sblock.this_device.device_id;
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
return data;
|
||||
}
|
||||
|
||||
@@ -1784,6 +1869,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
|
||||
@@ -1673,6 +1758,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
static grub_err_t
|
||||
find_path (struct grub_btrfs_data *data,
|
||||
const char *path, struct grub_btrfs_key *key,
|
||||
@@ -1802,14 +1972,26 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1691,14 +1861,26 @@ find_path (struct grub_btrfs_data *data,
|
||||
char *origpath = NULL;
|
||||
unsigned symlinks_max = 32;
|
||||
|
||||
|
|
@ -289,18 +289,15 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
while (1)
|
||||
{
|
||||
while (path[0] == '/')
|
||||
@@ -1982,13 +2164,25 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1871,9 +2053,21 @@ find_path (struct grub_btrfs_data *data,
|
||||
path = path_alloc = tmp;
|
||||
if (path[0] == '/')
|
||||
{
|
||||
- err = get_root (data, key, tree, type);
|
||||
- if (err)
|
||||
- return err;
|
||||
+ if (data->fs_tree)
|
||||
{
|
||||
- grub_free (direl);
|
||||
- grub_free (path_alloc);
|
||||
- grub_free (origpath);
|
||||
- return err;
|
||||
+ {
|
||||
+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
||||
+ *tree = data->fs_tree;
|
||||
+ /* This is a tree root, so everything starts at objectid 256 */
|
||||
|
|
@ -312,16 +309,12 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
+ {
|
||||
+ err = get_root (data, key, tree, type);
|
||||
+ if (err)
|
||||
+ {
|
||||
+ grub_free (direl);
|
||||
+ grub_free (path_alloc);
|
||||
+ grub_free (origpath);
|
||||
+ return err;
|
||||
+ }
|
||||
}
|
||||
+ return err;
|
||||
+ }
|
||||
}
|
||||
continue;
|
||||
@@ -2256,18 +2450,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
}
|
||||
@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
data->tree, file->offset, buf, len);
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +336,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
grub_be_to_cpu16 (data->sblock.uuid[0]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]),
|
||||
@@ -2276,6 +2462,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
|
||||
@@ -2134,6 +2320,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
|
||||
grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[7]));
|
||||
|
|
@ -364,7 +357,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
|
||||
grub_btrfs_unmount (data);
|
||||
|
||||
@@ -2396,6 +2596,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
|
||||
@@ -2190,6 +2390,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -607,7 +600,7 @@ index ba0c583526d..f14fe9c1bda 100644
|
|||
static struct grub_fs grub_btrfs_fs = {
|
||||
.name = "btrfs",
|
||||
.fs_dir = grub_btrfs_dir,
|
||||
@@ -2411,12 +2847,88 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
@@ -2205,12 +2641,88 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -12,10 +12,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
|||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index 8e2b1e9f7bc..14e38a4df02 100644
|
||||
index f1fff7385b5..ad1b56b716d 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -2920,6 +2920,8 @@ GRUB_MOD_INIT (btrfs)
|
||||
@@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs)
|
||||
subvol_set_env);
|
||||
grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env,
|
||||
subvolid_set_env);
|
||||
|
|
@ -3,17 +3,15 @@ From: Michael Chang <mchang@suse.com>
|
|||
Date: Thu, 21 Aug 2014 03:39:11 +0000
|
||||
Subject: [PATCH] grub2-btrfs-03-follow_default
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 107 ++++++++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 76 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index 14e38a4df02..d47f9ab0352 100644
|
||||
index ad1b56b716d..113c1f746c9 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -1335,6 +1335,7 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
@@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
{
|
||||
struct grub_btrfs_data *data;
|
||||
grub_err_t err;
|
||||
|
|
@ -21,7 +19,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
|
||||
if (!dev->disk)
|
||||
{
|
||||
@@ -1365,11 +1366,14 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
@@ -1286,11 +1287,14 @@ grub_btrfs_mount (grub_device_t dev)
|
||||
data->devices_attached[0].dev = dev;
|
||||
data->devices_attached[0].id = data->sblock.this_device.device_id;
|
||||
|
||||
|
|
@ -40,7 +38,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
}
|
||||
|
||||
return data;
|
||||
@@ -1966,24 +1970,39 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1855,24 +1859,39 @@ find_path (struct grub_btrfs_data *data,
|
||||
grub_size_t allocated = 0;
|
||||
struct grub_btrfs_dir_item *direl = NULL;
|
||||
struct grub_btrfs_key key_out;
|
||||
|
|
@ -87,7 +85,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -1994,15 +2013,23 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1883,15 +1902,23 @@ find_path (struct grub_btrfs_data *data,
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
@ -120,7 +118,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
|
||||
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
|
||||
{
|
||||
@@ -2013,7 +2040,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1902,7 +1929,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
|
||||
if (ctokenlen == 1 && ctoken[0] == '.')
|
||||
{
|
||||
|
|
@ -131,7 +129,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
continue;
|
||||
}
|
||||
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
|
||||
@@ -2044,8 +2073,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -1933,8 +1962,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
||||
key->object_id = key_out.offset;
|
||||
|
||||
|
|
@ -143,7 +141,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
continue;
|
||||
}
|
||||
|
||||
@@ -2114,7 +2144,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -2003,7 +2033,9 @@ find_path (struct grub_btrfs_data *data,
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +152,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
|
||||
{
|
||||
struct grub_btrfs_inode inode;
|
||||
@@ -2164,14 +2196,26 @@ find_path (struct grub_btrfs_data *data,
|
||||
@@ -2053,14 +2085,26 @@ find_path (struct grub_btrfs_data *data,
|
||||
path = path_alloc = tmp;
|
||||
if (path[0] == '/')
|
||||
{
|
||||
|
|
@ -188,7 +186,7 @@ index 14e38a4df02..d47f9ab0352 100644
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -2922,6 +2966,7 @@ GRUB_MOD_INIT (btrfs)
|
||||
@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs)
|
||||
subvolid_set_env);
|
||||
grub_env_export ("btrfs_subvol");
|
||||
grub_env_export ("btrfs_subvolid");
|
||||
|
|
@ -3,22 +3,20 @@ From: Michael Chang <mchang@suse.com>
|
|||
Date: Thu, 21 Aug 2014 03:39:11 +0000
|
||||
Subject: [PATCH] grub2-btrfs-04-grub2-install
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/osdep/linux/getroot.c | 7 +++++++
|
||||
grub-core/osdep/unix/config.c | 17 +++++++++++++++--
|
||||
util/config.c | 10 ++++++++++
|
||||
util/grub-install.c | 14 ++++++++++++++
|
||||
util/grub-install.c | 15 +++++++++++++++
|
||||
util/grub-mkrelpath.c | 6 ++++++
|
||||
include/grub/emu/config.h | 1 +
|
||||
6 files changed, 53 insertions(+), 2 deletions(-)
|
||||
6 files changed, 54 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
|
||||
index 7dd775d2ad9..7c29b3523b4 100644
|
||||
index 001b818fe58..caf9b1ccd3f 100644
|
||||
--- a/grub-core/osdep/linux/getroot.c
|
||||
+++ b/grub-core/osdep/linux/getroot.c
|
||||
@@ -373,6 +373,7 @@ get_btrfs_fs_prefix (const char *mount_path)
|
||||
@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +24,7 @@ index 7dd775d2ad9..7c29b3523b4 100644
|
|||
|
||||
char **
|
||||
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
|
||||
@@ -516,6 +517,12 @@ again:
|
||||
@@ -519,6 +520,12 @@ again:
|
||||
{
|
||||
ret = grub_find_root_devices_from_btrfs (dir);
|
||||
fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path);
|
||||
|
|
@ -40,7 +38,7 @@ index 7dd775d2ad9..7c29b3523b4 100644
|
|||
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
|
||||
{
|
||||
diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c
|
||||
index 0b1f7618d21..0ce0e309ac0 100644
|
||||
index 7d6325138ce..46a881530c0 100644
|
||||
--- a/grub-core/osdep/unix/config.c
|
||||
+++ b/grub-core/osdep/unix/config.c
|
||||
@@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg)
|
||||
|
|
@ -96,19 +94,19 @@ index ebcdd8f5e22..f044a880a76 100644
|
|||
sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0)
|
||||
{
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index 7dc5657bb67..ec3ed49674b 100644
|
||||
index a0babe3eff9..427ae013701 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -843,6 +843,8 @@ try_open (const char *path)
|
||||
@@ -827,6 +827,8 @@ fill_core_services (const char *core_services)
|
||||
free (sysv_plist);
|
||||
}
|
||||
#endif
|
||||
|
||||
+extern int use_relative_path_on_btrfs;
|
||||
+
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -876,6 +878,9 @@ main (int argc, char *argv[])
|
||||
@@ -860,6 +862,9 @@ main (int argc, char *argv[])
|
||||
|
||||
grub_util_load_config (&config);
|
||||
|
||||
|
|
@ -118,10 +116,11 @@ index 7dc5657bb67..ec3ed49674b 100644
|
|||
if (!bootloader_id && config.grub_distributor)
|
||||
{
|
||||
char *ptr;
|
||||
@@ -1366,6 +1371,15 @@ main (int argc, char *argv[])
|
||||
relative_grubdir = xstrdup ("/");
|
||||
@@ -1352,6 +1357,16 @@ main (int argc, char *argv[])
|
||||
fprintf (load_cfg_f, "set debug='%s'\n",
|
||||
debug_image);
|
||||
}
|
||||
|
||||
+
|
||||
+ if (config.is_suse_btrfs_snapshot_enabled
|
||||
+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0)
|
||||
+ {
|
||||
|
|
@ -13,10 +13,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
|||
5 files changed, 38 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index 28e92515795..884e4d363ca 100644
|
||||
index 60beaaa6962..e671ce68aec 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -256,7 +256,8 @@ export GRUB_DEFAULT \
|
||||
@@ -255,7 +255,8 @@ export GRUB_DEFAULT \
|
||||
GRUB_BADRAM \
|
||||
GRUB_OS_PROBER_SKIP_LIST \
|
||||
GRUB_DISABLE_SUBMENU \
|
||||
|
|
@ -27,10 +27,10 @@ index 28e92515795..884e4d363ca 100644
|
|||
if test "x${grub_cfg}" != "x"; then
|
||||
rm -f "${grub_cfg}.new"
|
||||
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
||||
index 33e1750aebb..0ba0e0e1c65 100644
|
||||
index 42c2ea9ba50..fafeac95061 100644
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -49,7 +49,11 @@ grub_warn ()
|
||||
@@ -52,7 +52,11 @@ grub_warn ()
|
||||
|
||||
make_system_path_relative_to_its_root ()
|
||||
{
|
||||
|
|
@ -43,7 +43,7 @@ index 33e1750aebb..0ba0e0e1c65 100644
|
|||
|
||||
is_path_readable_by_grub ()
|
||||
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
||||
index c2d8b093762..3e1b77265db 100644
|
||||
index 858b526c925..de727e6ee6b 100644
|
||||
--- a/util/grub.d/00_header.in
|
||||
+++ b/util/grub.d/00_header.in
|
||||
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
|
|
@ -90,10 +90,10 @@ index c2d8b093762..3e1b77265db 100644
|
|||
+EOF
|
||||
+fi
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index e8ab4082f87..48ff32c1da4 100644
|
||||
index 0f3c19e30cc..cbfaca34cc7 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -68,10 +68,14 @@ fi
|
||||
@@ -66,10 +66,14 @@ fi
|
||||
|
||||
case x"$GRUB_FS" in
|
||||
xbtrfs)
|
||||
|
|
@ -109,10 +109,10 @@ index e8ab4082f87..48ff32c1da4 100644
|
|||
xzfs)
|
||||
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index 98ee5bc58dc..efcded0fbb4 100644
|
||||
index ada20775a14..e9e73b815fb 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -75,10 +75,14 @@ fi
|
||||
@@ -73,10 +73,14 @@ fi
|
||||
|
||||
case x"$GRUB_FS" in
|
||||
xbtrfs)
|
||||
|
|
@ -3,8 +3,6 @@ From: Michael Chang <mchang@suse.com>
|
|||
Date: Tue, 9 Jul 2019 13:56:16 +0200
|
||||
Subject: [PATCH] grub2-btrfs-06-subvol-mount
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 195 +++++++++++++++++++++++++++++++++++++++-
|
||||
grub-core/osdep/linux/getroot.c | 148 +++++++++++++++++++++++++++++-
|
||||
|
|
@ -13,7 +11,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|||
4 files changed, 392 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index d47f9ab0352..d44a1c73b8a 100644
|
||||
index 113c1f746c9..d323746ecfa 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -41,6 +41,7 @@
|
||||
|
|
@ -37,7 +35,7 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
|
||||
static grub_err_t
|
||||
read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb)
|
||||
@@ -1302,9 +1309,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
|
||||
@@ -1223,9 +1230,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
|
||||
grub_err_t err;
|
||||
grub_uint64_t tree = 0;
|
||||
grub_uint8_t type;
|
||||
|
|
@ -64,10 +62,10 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
if (err)
|
||||
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
||||
|
||||
@@ -2316,11 +2340,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
||||
@@ -2199,11 +2223,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
||||
int r = 0;
|
||||
grub_uint64_t tree;
|
||||
grub_uint8_t type;
|
||||
grub_size_t est_size = 0;
|
||||
+ char *new_path = NULL;
|
||||
|
||||
if (!data)
|
||||
|
|
@ -86,7 +84,7 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
if (err)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
@@ -2447,11 +2480,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
|
||||
@@ -2305,11 +2338,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
|
||||
struct grub_btrfs_inode inode;
|
||||
grub_uint8_t type;
|
||||
struct grub_btrfs_key key_in;
|
||||
|
|
@ -109,7 +107,7 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
if (err)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
@@ -2686,6 +2729,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||
@@ -2480,6 +2523,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +258,7 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
static grub_err_t
|
||||
get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree,
|
||||
grub_uint64_t objectid, grub_uint64_t offset,
|
||||
@@ -2892,6 +3079,7 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
@@ -2686,6 +2873,7 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
};
|
||||
|
||||
static grub_command_t cmd_info;
|
||||
|
|
@ -268,7 +266,7 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
static grub_extcmd_t cmd_list_subvols;
|
||||
|
||||
static char *
|
||||
@@ -2955,6 +3143,9 @@ GRUB_MOD_INIT (btrfs)
|
||||
@@ -2749,6 +2937,9 @@ GRUB_MOD_INIT (btrfs)
|
||||
cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
|
||||
"DEVICE",
|
||||
"Print BtrFS info about DEVICE.");
|
||||
|
|
@ -279,10 +277,10 @@ index d47f9ab0352..d44a1c73b8a 100644
|
|||
grub_cmd_btrfs_list_subvols, 0,
|
||||
"[-p|-n] [-o var] DEVICE",
|
||||
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
|
||||
index 7c29b3523b4..74a48c03026 100644
|
||||
index caf9b1ccd3f..28790307e00 100644
|
||||
--- a/grub-core/osdep/linux/getroot.c
|
||||
+++ b/grub-core/osdep/linux/getroot.c
|
||||
@@ -103,6 +103,14 @@ struct btrfs_ioctl_search_key
|
||||
@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key
|
||||
grub_uint32_t unused[9];
|
||||
};
|
||||
|
||||
|
|
@ -297,7 +295,7 @@ index 7c29b3523b4..74a48c03026 100644
|
|||
struct btrfs_ioctl_search_args {
|
||||
struct btrfs_ioctl_search_key key;
|
||||
grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key))
|
||||
@@ -375,6 +383,109 @@ get_btrfs_fs_prefix (const char *mount_path)
|
||||
@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_path)
|
||||
|
||||
int use_relative_path_on_btrfs = 0;
|
||||
|
||||
|
|
@ -407,7 +405,7 @@ index 7c29b3523b4..74a48c03026 100644
|
|||
char **
|
||||
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
|
||||
{
|
||||
@@ -516,12 +627,15 @@ again:
|
||||
@@ -519,12 +630,15 @@ again:
|
||||
else if (grub_strcmp (entries[i].fstype, "btrfs") == 0)
|
||||
{
|
||||
ret = grub_find_root_devices_from_btrfs (dir);
|
||||
|
|
@ -426,7 +424,7 @@ index 7c29b3523b4..74a48c03026 100644
|
|||
}
|
||||
}
|
||||
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
|
||||
@@ -1147,6 +1261,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
|
||||
@@ -1150,6 +1264,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
|
||||
return grub_dev;
|
||||
}
|
||||
|
||||
|
|
@ -462,10 +460,10 @@ index 7c29b3523b4..74a48c03026 100644
|
|||
grub_make_system_path_relative_to_its_root_os (const char *path)
|
||||
{
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index ec3ed49674b..d3ec2570d1d 100644
|
||||
index 427ae013701..c03214bdfcf 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1615,6 +1615,55 @@ main (int argc, char *argv[])
|
||||
@@ -1569,6 +1569,55 @@ main (int argc, char *argv[])
|
||||
prefix_drive = xasprintf ("(%s)", grub_drives[0]);
|
||||
}
|
||||
|
||||
|
|
@ -10,10 +10,10 @@ Ref: bsc#953538
|
|||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index d44a1c73b8a..dba86d19b1a 100644
|
||||
index d323746ecfa..673ded03522 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -1339,11 +1339,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
|
||||
@@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 10 May 2018 13:40:19 -0400
|
||||
Subject: [PATCH] Fixup for newer compiler
|
||||
|
||||
---
|
||||
grub-core/fs/btrfs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index 87e4dd1a07a..ad35e75750b 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -218,7 +218,7 @@ struct grub_btrfs_inode
|
||||
grub_uint64_t size;
|
||||
grub_uint8_t dummy2[0x70];
|
||||
struct grub_btrfs_time mtime;
|
||||
-} GRUB_PACKED;
|
||||
+} GRUB_PACKED __attribute__ ((aligned(8)));
|
||||
|
||||
struct grub_btrfs_extent_data
|
||||
{
|
||||
|
|
@ -3,17 +3,15 @@ From: Michael Chang <mchang@suse.com>
|
|||
Date: Thu, 11 May 2017 08:56:57 +0000
|
||||
Subject: [PATCH] Grub not working correctly with btrfs snapshots (bsc#1026511)
|
||||
|
||||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
grub-core/fs/btrfs.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 238 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index dba86d19b1a..87e4dd1a07a 100644
|
||||
index 673ded03522..2b21cbaa67e 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -3093,6 +3093,238 @@ out:
|
||||
@@ -2887,6 +2887,238 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -252,7 +250,7 @@ index dba86d19b1a..87e4dd1a07a 100644
|
|||
static struct grub_fs grub_btrfs_fs = {
|
||||
.name = "btrfs",
|
||||
.fs_dir = grub_btrfs_dir,
|
||||
@@ -3111,6 +3343,7 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
@@ -2905,6 +3137,7 @@ static struct grub_fs grub_btrfs_fs = {
|
||||
static grub_command_t cmd_info;
|
||||
static grub_command_t cmd_mount_subvol;
|
||||
static grub_extcmd_t cmd_list_subvols;
|
||||
|
|
@ -260,7 +258,7 @@ index dba86d19b1a..87e4dd1a07a 100644
|
|||
|
||||
static char *
|
||||
subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)),
|
||||
@@ -3181,6 +3414,11 @@ GRUB_MOD_INIT (btrfs)
|
||||
@@ -2975,6 +3208,11 @@ GRUB_MOD_INIT (btrfs)
|
||||
"[-p|-n] [-o var] DEVICE",
|
||||
"Print list of BtrFS subvolumes on "
|
||||
"DEVICE.", options);
|
||||
|
|
@ -10,21 +10,21 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 32 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index a5cd99e5afa..8d98203a784 100644
|
||||
index 585fa6662b6..03f9a9d0118 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -36,6 +36,10 @@ struct linux_arch_kernel_header {
|
||||
struct grub_pe_image_header pe_image_header;
|
||||
};
|
||||
@@ -24,6 +24,10 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/efi/api.h>
|
||||
|
||||
+/* Variables. */
|
||||
+extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
|
||||
+extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
|
||||
+
|
||||
/* Functions. */
|
||||
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol,
|
||||
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
|
||||
void *registration);
|
||||
@@ -71,6 +75,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
|
||||
@@ -60,6 +64,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_uintn_t *descriptor_size,
|
||||
grub_efi_uint32_t *descriptor_version);
|
||||
void grub_efi_memory_fini (void);
|
||||
|
|
@ -39,7 +39,7 @@ index a5cd99e5afa..8d98203a784 100644
|
|||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ b = grub_efi_system_table->boot_services;
|
||||
+ status = b->allocate_pool(pool_type, buffer_size, buffer);
|
||||
+ status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer);
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
|
|
@ -51,14 +51,14 @@ index a5cd99e5afa..8d98203a784 100644
|
|||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ b = grub_efi_system_table->boot_services;
|
||||
+ status = b->free_pool(buffer);
|
||||
+ status = efi_call_1 (b->free_pool, buffer);
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
|
||||
void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
|
||||
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
|
||||
@@ -140,10 +171,7 @@ void grub_efi_init (void);
|
||||
@@ -115,10 +146,7 @@ void grub_efi_init (void);
|
||||
void grub_efi_fini (void);
|
||||
void grub_efi_set_prefix (void);
|
||||
|
||||
106
0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch
Normal file
106
0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 1 Jun 2017 10:06:38 -0400
|
||||
Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable.
|
||||
|
||||
This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and
|
||||
grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we
|
||||
get more reasonable type checking.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 24 +++++++++---------------
|
||||
1 file changed, 9 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index 3ff305b1d32..ba3d2930197 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -65,7 +65,7 @@ grub_chainloader_unload (void)
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
efi_call_1 (b->unload_image, image_handle);
|
||||
- efi_call_2 (b->free_pages, address, pages);
|
||||
+ grub_efi_free_pages (address, pages);
|
||||
|
||||
grub_free (file_path);
|
||||
grub_free (cmdline);
|
||||
@@ -108,7 +108,7 @@ grub_chainloader_boot (void)
|
||||
}
|
||||
|
||||
if (exit_data)
|
||||
- efi_call_1 (b->free_pool, exit_data);
|
||||
+ grub_efi_free_pool (exit_data);
|
||||
|
||||
grub_loader_unset ();
|
||||
|
||||
@@ -523,10 +523,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp)
|
||||
static grub_efi_boolean_t
|
||||
handle_image (void *data, grub_efi_uint32_t datasize)
|
||||
{
|
||||
- grub_efi_boot_services_t *b;
|
||||
grub_efi_loaded_image_t *li, li_bak;
|
||||
grub_efi_status_t efi_status;
|
||||
- char *buffer = NULL;
|
||||
+ void *buffer = NULL;
|
||||
char *buffer_aligned = NULL;
|
||||
grub_efi_uint32_t i;
|
||||
struct grub_pe32_section_table *section;
|
||||
@@ -537,8 +536,6 @@ handle_image (void *data, grub_efi_uint32_t datasize)
|
||||
int found_entry_point = 0;
|
||||
int rc;
|
||||
|
||||
- b = grub_efi_system_table->boot_services;
|
||||
-
|
||||
rc = read_header (data, datasize, &context);
|
||||
if (rc < 0)
|
||||
{
|
||||
@@ -578,8 +575,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
|
||||
grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n",
|
||||
context.image_size, datasize);
|
||||
|
||||
- efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
|
||||
- buffer_size, &buffer);
|
||||
+ efi_status = grub_efi_allocate_pool (GRUB_EFI_LOADER_DATA, buffer_size,
|
||||
+ &buffer);
|
||||
|
||||
if (efi_status != GRUB_EFI_SUCCESS)
|
||||
{
|
||||
@@ -811,14 +808,14 @@ handle_image (void *data, grub_efi_uint32_t datasize)
|
||||
|
||||
grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
|
||||
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
|
||||
- efi_status = efi_call_1 (b->free_pool, buffer);
|
||||
+ efi_status = grub_efi_free_pool (buffer);
|
||||
|
||||
return 1;
|
||||
|
||||
error_exit:
|
||||
grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno);
|
||||
if (buffer)
|
||||
- efi_call_1 (b->free_pool, buffer);
|
||||
+ grub_efi_free_pool (buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -826,10 +823,7 @@ error_exit:
|
||||
static grub_err_t
|
||||
grub_secureboot_chainloader_unload (void)
|
||||
{
|
||||
- grub_efi_boot_services_t *b;
|
||||
-
|
||||
- b = grub_efi_system_table->boot_services;
|
||||
- efi_call_2 (b->free_pages, address, pages);
|
||||
+ grub_efi_free_pages (address, pages);
|
||||
grub_free (file_path);
|
||||
grub_free (cmdline);
|
||||
cmdline = 0;
|
||||
@@ -1096,7 +1090,7 @@ fail:
|
||||
grub_free (file_path);
|
||||
|
||||
if (address)
|
||||
- efi_call_2 (b->free_pages, address, pages);
|
||||
+ grub_efi_free_pages (address, pages);
|
||||
|
||||
if (cmdline)
|
||||
grub_free (cmdline);
|
||||
48
0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch
Normal file
48
0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 1 Jun 2017 10:07:50 -0400
|
||||
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
|
||||
|
||||
This avoids syntax checkers getting confused about if it's llx or lx.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 3 ++-
|
||||
include/grub/efi/api.h | 9 +++++++++
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index ba3d2930197..47f5aa14817 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -806,7 +806,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
|
||||
efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
|
||||
grub_efi_system_table);
|
||||
|
||||
- grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
|
||||
+ grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n",
|
||||
+ efi_status);
|
||||
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
|
||||
efi_status = grub_efi_free_pool (buffer);
|
||||
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index 117469450d3..99628801478 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
|
||||
typedef grub_uint8_t grub_efi_char8_t;
|
||||
typedef grub_uint16_t grub_efi_char16_t;
|
||||
|
||||
+
|
||||
typedef grub_efi_uintn_t grub_efi_status_t;
|
||||
+/* Make grub_efi_status_t reasonably printable. */
|
||||
+#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
+#define PRIxGRUB_EFI_STATUS "lx"
|
||||
+#define PRIdGRUB_EFI_STATUS "ld"
|
||||
+#else
|
||||
+#define PRIxGRUB_EFI_STATUS "llx"
|
||||
+#define PRIdGRUB_EFI_STATUS "lld"
|
||||
+#endif
|
||||
|
||||
#define GRUB_EFI_ERROR_CODE(value) \
|
||||
((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value))
|
||||
|
|
@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 885d7c6420e..2bb8a0e7a38 100644
|
||||
index 05d8237a9b2..ae9885edb84 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -177,7 +177,7 @@ grub_reboot (void)
|
||||
@@ -167,7 +167,7 @@ grub_reboot (void)
|
||||
void
|
||||
grub_exit (int retval)
|
||||
{
|
||||
|
|
@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes.
|
|||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/include/grub/dl.h b/include/grub/dl.h
|
||||
index cd1f46c8bad..f2bf50eb98d 100644
|
||||
index b3753c9ca26..91933b85f2c 100644
|
||||
--- a/include/grub/dl.h
|
||||
+++ b/include/grub/dl.h
|
||||
@@ -54,6 +54,7 @@ grub_mod_fini (void)
|
||||
|
|
@ -16,10 +16,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 1 insertion(+), 11 deletions(-)
|
||||
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index d3ec2570d1d..66ef9494d9d 100644
|
||||
index c03214bdfcf..1e47491bc21 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1234,18 +1234,8 @@ main (int argc, char *argv[])
|
||||
@@ -1190,18 +1190,8 @@ main (int argc, char *argv[])
|
||||
char *d;
|
||||
|
||||
is_guess = 1;
|
||||
|
|
@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index efcded0fbb4..4ecf5deea17 100644
|
||||
index e9e73b815fb..c23b064be6c 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -156,6 +156,7 @@ linux_entry_xsm ()
|
||||
@@ -153,6 +153,7 @@ linux_entry_xsm ()
|
||||
else
|
||||
xen_rm_opts="no-real-mode edd=off"
|
||||
fi
|
||||
|
|
@ -20,15 +20,15 @@ index efcded0fbb4..4ecf5deea17 100644
|
|||
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
|
||||
echo '$(echo "$lmessage" | grub_quote)'
|
||||
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
|
||||
@@ -168,6 +169,7 @@ EOF
|
||||
initrd_path="${rel_dirname}/${i}"
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
@@ -166,6 +167,7 @@ EOF
|
||||
done
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
echo '$(echo "$message" | grub_quote)'
|
||||
+ insmod ${xen_module}
|
||||
${module_loader} --nounzip $(echo $initrd_path)
|
||||
EOF
|
||||
done
|
||||
@@ -269,13 +271,16 @@ for current_xen in ${reverse_sorted_xen_list}; do
|
||||
fi
|
||||
@@ -253,13 +255,16 @@ while [ "x${xen_list}" != "x" ] ; do
|
||||
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
|
||||
fi
|
||||
if ($grub_file --is-arm64-efi $current_xen); then
|
||||
211
0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch
Normal file
211
0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 7 Nov 2017 17:12:17 -0500
|
||||
Subject: [PATCH] Make pmtimer tsc calibration not take 51 seconds to fail.
|
||||
|
||||
On my laptop running at 2.4GHz, if I run a VM where tsc calibration
|
||||
using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds
|
||||
to do so (as measured with the stopwatch on my phone), with a tsc delta
|
||||
of 0x1cd1c85300, or around 125 billion cycles.
|
||||
|
||||
If instead of trying to wait for 5-200ms to show up on the pmtimer, we try
|
||||
to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka ~2.4
|
||||
million cycles, or more or less instantly.
|
||||
|
||||
Additionally, this reading the pmtimer was returning 0xffffffff anyway,
|
||||
and that's obviously an invalid return. I've added a check for that and
|
||||
0 so we don't bother waiting for the test if what we're seeing is dead
|
||||
pins with no response at all.
|
||||
|
||||
If "debug" is includes "pmtimer", you will see one of the following
|
||||
three outcomes. If pmtimer gives all 0 or all 1 bits, you will see:
|
||||
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 1
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 2
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 3
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 4
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 5
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 6
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 7
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 8
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 9
|
||||
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 10
|
||||
kern/i386/tsc_pmtimer.c:78: timer is broken; giving up.
|
||||
|
||||
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and
|
||||
these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
|
||||
|
||||
If pmtimer gives any other bit patterns but is not actually marching
|
||||
forward fast enough to use for clock calibration, you will see:
|
||||
|
||||
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
|
||||
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
|
||||
|
||||
This outcome was tested using grub compiled with GRUB_PMTIMER_IGNORE_BAD_READS
|
||||
defined (so as not to trip the bad read test) using qemu+kvm with UEFI
|
||||
(OVMF) firmware, and these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
|
||||
|
||||
If pmtimer actually works, you'll see something like:
|
||||
|
||||
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
|
||||
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
|
||||
|
||||
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and
|
||||
these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX
|
||||
|
||||
I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel
|
||||
Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here:
|
||||
https://firmware.intel.com/sites/default/files/UEFIDevKit_S1200RP_vB8.zip
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/kern/i386/tsc_pmtimer.c | 109 +++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 89 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c
|
||||
index c9c36169978..ca15c3aacd7 100644
|
||||
--- a/grub-core/kern/i386/tsc_pmtimer.c
|
||||
+++ b/grub-core/kern/i386/tsc_pmtimer.c
|
||||
@@ -28,40 +28,101 @@
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/cpu/io.h>
|
||||
|
||||
+/*
|
||||
+ * Define GRUB_PMTIMER_IGNORE_BAD_READS if you're trying to test a timer that's
|
||||
+ * present but doesn't keep time well.
|
||||
+ */
|
||||
+// #define GRUB_PMTIMER_IGNORE_BAD_READS
|
||||
+
|
||||
grub_uint64_t
|
||||
grub_pmtimer_wait_count_tsc (grub_port_t pmtimer,
|
||||
grub_uint16_t num_pm_ticks)
|
||||
{
|
||||
grub_uint32_t start;
|
||||
- grub_uint32_t last;
|
||||
- grub_uint32_t cur, end;
|
||||
+ grub_uint64_t cur, end;
|
||||
grub_uint64_t start_tsc;
|
||||
grub_uint64_t end_tsc;
|
||||
- int num_iter = 0;
|
||||
+ unsigned int num_iter = 0;
|
||||
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
|
||||
+ int bad_reads = 0;
|
||||
+#endif
|
||||
|
||||
- start = grub_inl (pmtimer) & 0xffffff;
|
||||
- last = start;
|
||||
+ /*
|
||||
+ * Some timers are 24-bit and some are 32-bit, but it doesn't make much
|
||||
+ * difference to us. Caring which one we have isn't really worth it since
|
||||
+ * the low-order digits will give us enough data to calibrate TSC. So just
|
||||
+ * mask the top-order byte off.
|
||||
+ */
|
||||
+ cur = start = grub_inl (pmtimer) & 0xffffffUL;
|
||||
end = start + num_pm_ticks;
|
||||
start_tsc = grub_get_tsc ();
|
||||
while (1)
|
||||
{
|
||||
- cur = grub_inl (pmtimer) & 0xffffff;
|
||||
- if (cur < last)
|
||||
- cur |= 0x1000000;
|
||||
- num_iter++;
|
||||
+ cur &= 0xffffffffff000000ULL;
|
||||
+ cur |= grub_inl (pmtimer) & 0xffffffUL;
|
||||
+
|
||||
+ end_tsc = grub_get_tsc();
|
||||
+
|
||||
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
|
||||
+ /*
|
||||
+ * If we get 10 reads in a row that are obviously dead pins, there's no
|
||||
+ * reason to do this thousands of times.
|
||||
+ */
|
||||
+ if (cur == 0xffffffUL || cur == 0)
|
||||
+ {
|
||||
+ bad_reads++;
|
||||
+ grub_dprintf ("pmtimer",
|
||||
+ "pmtimer: 0x%"PRIxGRUB_UINT64_T" bad_reads: %d\n",
|
||||
+ cur, bad_reads);
|
||||
+ grub_dprintf ("pmtimer", "timer is broken; giving up.\n");
|
||||
+
|
||||
+ if (bad_reads == 10)
|
||||
+ return 0;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ if (cur < start)
|
||||
+ cur += 0x1000000;
|
||||
+
|
||||
if (cur >= end)
|
||||
{
|
||||
- end_tsc = grub_get_tsc ();
|
||||
+ grub_dprintf ("pmtimer", "pmtimer delta is 0x%"PRIxGRUB_UINT64_T"\n",
|
||||
+ cur - start);
|
||||
+ grub_dprintf ("pmtimer", "tsc delta is 0x%"PRIxGRUB_UINT64_T"\n",
|
||||
+ end_tsc - start_tsc);
|
||||
return end_tsc - start_tsc;
|
||||
}
|
||||
- /* Check for broken PM timer.
|
||||
- 50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz)
|
||||
- if after this time we still don't have 1 ms on pmtimer, then
|
||||
- pmtimer is broken.
|
||||
+
|
||||
+ /*
|
||||
+ * Check for broken PM timer. 1ms at 10GHz should be 1E+7 TSCs; at
|
||||
+ * 250MHz it should be 2.5E6. So if after 4E+7 TSCs on a 10GHz machine,
|
||||
+ * we should have seen pmtimer show 4ms of change (i.e. cur =~
|
||||
+ * start+14320); on a 250MHz machine that should be 16ms (start+57280).
|
||||
+ * If after this a time we still don't have 1ms on pmtimer, then pmtimer
|
||||
+ * is broken.
|
||||
+ *
|
||||
+ * Likewise, if our code is perfectly efficient and introduces no delays
|
||||
+ * whatsoever, on a 10GHz system we should see a TSC delta of 3580 in
|
||||
+ * ~3580 iterations. On a 250MHz machine that should be ~900 iterations.
|
||||
+ *
|
||||
+ * With those factors in mind, there are two limits here. There's a hard
|
||||
+ * limit here at 8x our desired pm timer delta, picked as an arbitrarily
|
||||
+ * large value that's still not a lot of time to humans, because if we
|
||||
+ * get that far this is either an implausibly fast machine or the pmtimer
|
||||
+ * is not running. And there's another limit on 4x our 10GHz tsc delta
|
||||
+ * without seeing cur converge on our target value.
|
||||
*/
|
||||
- if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) {
|
||||
- return 0;
|
||||
- }
|
||||
+ if ((++num_iter > (grub_uint32_t)num_pm_ticks << 3UL) ||
|
||||
+ end_tsc - start_tsc > 40000000)
|
||||
+ {
|
||||
+ grub_dprintf ("pmtimer",
|
||||
+ "pmtimer delta is 0x%"PRIxGRUB_UINT64_T" (%u iterations)\n",
|
||||
+ cur - start, num_iter);
|
||||
+ grub_dprintf ("pmtimer",
|
||||
+ "tsc delta is implausible: 0x%"PRIxGRUB_UINT64_T"\n",
|
||||
+ end_tsc - start_tsc);
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +135,20 @@ grub_tsc_calibrate_from_pmtimer (void)
|
||||
|
||||
fadt = grub_acpi_find_fadt ();
|
||||
if (!fadt)
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_dprintf ("pmtimer", "No FADT found; not using pmtimer.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
pmtimer = fadt->pmtimer;
|
||||
if (!pmtimer)
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_dprintf ("pmtimer", "FADT does not specify pmtimer; skipping.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- /* It's 3.579545 MHz clock. Wait 1 ms. */
|
||||
+ /*
|
||||
+ * It's 3.579545 MHz clock. Wait 1 ms.
|
||||
+ */
|
||||
tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer, 3580);
|
||||
if (tsc_diff == 0)
|
||||
return 0;
|
||||
|
|
@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better...
|
|||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
|
||||
index 2ff42984545..6363fd522e1 100644
|
||||
index 36d2dedf47e..9d93ba88bac 100644
|
||||
--- a/include/grub/efiemu/runtime.h
|
||||
+++ b/include/grub/efiemu/runtime.h
|
||||
@@ -33,5 +33,5 @@ struct efi_variable
|
||||
|
|
@ -20,10 +20,10 @@ index 2ff42984545..6363fd522e1 100644
|
|||
+} GRUB_PACKED GRUB_ALIGNED(8);
|
||||
#endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */
|
||||
diff --git a/include/grub/types.h b/include/grub/types.h
|
||||
index 064066e2e18..59e030268c2 100644
|
||||
index b36b26a79d4..30e57254889 100644
|
||||
--- a/include/grub/types.h
|
||||
+++ b/include/grub/types.h
|
||||
@@ -30,6 +30,7 @@
|
||||
@@ -29,6 +29,7 @@
|
||||
#else
|
||||
#define GRUB_PACKED __attribute__ ((packed))
|
||||
#endif
|
||||
|
|
@ -20,20 +20,30 @@ kernels are found in the boot directory were proposed by Yclept Nemo
|
|||
and Tom Gundersen respectively.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
[javierm: remove outdated URL for BLS document]
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
[iwienand@redhat.com: skip machine ID check when updating entries]
|
||||
Signed-off-by: Ian Wienand <iwienand@redhat.com>
|
||||
[rharwood: use sort(1), commit message composits, drop man pages]
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
util/grub-mkconfig.8 | 4 +
|
||||
util/grub-mkconfig.in | 9 +-
|
||||
util/grub-mkconfig_lib.in | 22 ++++-
|
||||
util/grub.d/10_linux.in | 218 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
3 files changed, 243 insertions(+), 6 deletions(-)
|
||||
util/grub.d/10_linux.in | 223 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
4 files changed, 252 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
|
||||
index a2d1f577b9b..434fa4deda4 100644
|
||||
--- a/util/grub-mkconfig.8
|
||||
+++ b/util/grub-mkconfig.8
|
||||
@@ -13,5 +13,9 @@
|
||||
\fB--output\fR=\fIFILE\fR
|
||||
Write generated output to \fIFILE\fR.
|
||||
|
||||
+.TP
|
||||
+\fB--no-grubenv-update\fR
|
||||
+Do not update variables in the grubenv file.
|
||||
+
|
||||
.SH SEE ALSO
|
||||
.BR "info grub"
|
||||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index 884e4d363ca..bec52e052fc 100644
|
||||
index e671ce68aec..1a70b7ea056 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
|
||||
|
|
@ -63,7 +73,7 @@ index 884e4d363ca..bec52e052fc 100644
|
|||
-*)
|
||||
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
|
||||
usage
|
||||
@@ -257,7 +263,8 @@ export GRUB_DEFAULT \
|
||||
@@ -256,7 +262,8 @@ export GRUB_DEFAULT \
|
||||
GRUB_OS_PROBER_SKIP_LIST \
|
||||
GRUB_DISABLE_SUBMENU \
|
||||
GRUB_DEFAULT_DTB \
|
||||
|
|
@ -74,7 +84,7 @@ index 884e4d363ca..bec52e052fc 100644
|
|||
if test "x${grub_cfg}" != "x"; then
|
||||
rm -f "${grub_cfg}.new"
|
||||
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
||||
index 0ba0e0e1c65..c2e107b41ab 100644
|
||||
index fafeac95061..d8bb4069360 100644
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -30,6 +30,9 @@ fi
|
||||
|
|
@ -87,7 +97,7 @@ index 0ba0e0e1c65..c2e107b41ab 100644
|
|||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
|
||||
fi
|
||||
@@ -122,8 +125,19 @@ EOF
|
||||
@@ -125,8 +128,19 @@ EOF
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +117,7 @@ index 0ba0e0e1c65..c2e107b41ab 100644
|
|||
old_ifs="$IFS"
|
||||
IFS='
|
||||
'
|
||||
@@ -158,18 +172,18 @@ prepare_grub_to_access_device ()
|
||||
@@ -161,18 +175,18 @@ prepare_grub_to_access_device ()
|
||||
# otherwise set root as per value in device.map.
|
||||
fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`"
|
||||
if [ "x$fs_hint" != x ]; then
|
||||
|
|
@ -131,10 +141,10 @@ index 0ba0e0e1c65..c2e107b41ab 100644
|
|||
fi
|
||||
IFS="$old_ifs"
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 48ff32c1da4..cd9aea0cc01 100644
|
||||
index cbfaca34cc7..68adb55d893 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -84,6 +84,218 @@ case x"$GRUB_FS" in
|
||||
@@ -82,6 +82,223 @@ case x"$GRUB_FS" in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -152,7 +162,7 @@ index 48ff32c1da4..cd9aea0cc01 100644
|
|||
+#
|
||||
+# The $bls_parser parses the BootLoaderSpec files stored in /boot/loader/entries and
|
||||
+# populates the boot menu. Please refer to the Boot Loader Specification documentation
|
||||
+# for the files format: https://systemd.io/BOOT_LOADER_SPECIFICATION/.
|
||||
+# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
|
||||
+
|
||||
+EOF
|
||||
+}
|
||||
|
|
@ -194,20 +204,25 @@ index 48ff32c1da4..cd9aea0cc01 100644
|
|||
+
|
||||
+get_sorted_bls()
|
||||
+{
|
||||
+ if ! [ -d "${blsdir}" ]; then
|
||||
+ if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then
|
||||
+ return
|
||||
+ fi
|
||||
+
|
||||
+ read machine_id < /etc/machine-id
|
||||
+ if [ -z "${machine_id}" ]; then
|
||||
+ return
|
||||
+ fi
|
||||
+
|
||||
+ local IFS=$'\n'
|
||||
+
|
||||
+ files=($(for bls in ${blsdir}/*.conf; do
|
||||
+ files=($(for bls in ${blsdir}/${machine_id}-*.conf; do
|
||||
+ if ! [[ -e "${bls}" ]] ; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ bls="${bls%.conf}"
|
||||
+ bls="${bls##*/}"
|
||||
+ echo "${bls}"
|
||||
+ done | sort -Vr 2>/dev/null)) || :
|
||||
+ done | ${kernel_sort} 2>/dev/null | tac)) || :
|
||||
+
|
||||
+ echo "${files[@]}"
|
||||
+}
|
||||
|
|
@ -248,7 +263,7 @@ index 48ff32c1da4..cd9aea0cc01 100644
|
|||
+}
|
||||
+
|
||||
+# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed.
|
||||
+if [ -z "${GRUB_ENABLE_BLSCFG}" ] && ! command -v new-kernel-pkg >/dev/null; then
|
||||
+if [ -z "${GRUB_ENABLE_BLSCFG}" ] && [ -z "$(which new-kernel-pkg 2> /dev/null)" ]; then
|
||||
+ GRUB_ENABLE_BLSCFG="true"
|
||||
+fi
|
||||
+
|
||||
|
|
@ -353,7 +368,7 @@ index 48ff32c1da4..cd9aea0cc01 100644
|
|||
mktitle ()
|
||||
{
|
||||
local title_type
|
||||
@@ -123,6 +335,7 @@ linux_entry ()
|
||||
@@ -121,6 +338,7 @@ linux_entry ()
|
||||
if [ -z "$boot_device_id" ]; then
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
fi
|
||||
|
|
@ -361,15 +376,15 @@ index 48ff32c1da4..cd9aea0cc01 100644
|
|||
if [ x$type != xsimple ] ; then
|
||||
title=$(mktitle "$type" "$version")
|
||||
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
|
||||
@@ -243,6 +456,7 @@ fi
|
||||
is_top_level=true
|
||||
for linux in ${reverse_sorted_list}; do
|
||||
@@ -224,6 +442,7 @@ is_top_level=true
|
||||
while [ "x$list" != "x" ] ; do
|
||||
linux=`version_find_latest $list`
|
||||
gettext_printf "Found linux image: %s\n" "$linux" >&2
|
||||
+
|
||||
basename=`basename $linux`
|
||||
dirname=`dirname $linux`
|
||||
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
||||
@@ -283,7 +497,9 @@ for linux in ${reverse_sorted_list}; do
|
||||
@@ -262,7 +481,9 @@ while [ "x$list" != "x" ] ; do
|
||||
for i in ${initrd}; do
|
||||
initrd_display="${initrd_display} ${dirname}/${i}"
|
||||
done
|
||||
|
|
@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index 465a8e74ea7..b1d399d37d7 100644
|
||||
index a3e215155bd..c60601b699d 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -1303,7 +1303,7 @@ void __attribute__ ((noreturn))
|
||||
@@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn))
|
||||
grub_abort (void)
|
||||
{
|
||||
#ifndef GRUB_UTIL
|
||||
347
0073-Add-linux-and-initrd-commands-for-grub-emu.patch
Normal file
347
0073-Add-linux-and-initrd-commands-for-grub-emu.patch
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Tue, 6 Feb 2018 09:09:00 +0100
|
||||
Subject: [PATCH] Add linux and initrd commands for grub-emu
|
||||
|
||||
When using grub-emu, the linux and initrd commands are used as arguments
|
||||
to the kexec command line tool, to allow booting the selected menu entry.
|
||||
---
|
||||
grub-core/Makefile.core.def | 1 -
|
||||
grub-core/kern/emu/main.c | 4 +
|
||||
grub-core/kern/emu/misc.c | 18 ++++-
|
||||
grub-core/loader/emu/linux.c | 172 +++++++++++++++++++++++++++++++++++++++++++
|
||||
include/grub/emu/exec.h | 4 +-
|
||||
include/grub/emu/hostfile.h | 3 +-
|
||||
include/grub/emu/misc.h | 3 +
|
||||
grub-core/Makefile.am | 1 +
|
||||
8 files changed, 202 insertions(+), 4 deletions(-)
|
||||
create mode 100644 grub-core/loader/emu/linux.c
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 058c88ac3af..5354f9613d3 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -1826,7 +1826,6 @@ module = {
|
||||
|
||||
common = loader/linux.c;
|
||||
common = lib/cmdline.c;
|
||||
- enable = noemu;
|
||||
|
||||
efi = loader/efi/linux.c;
|
||||
};
|
||||
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
|
||||
index 55ea5a11ccd..846fe9715ec 100644
|
||||
--- a/grub-core/kern/emu/main.c
|
||||
+++ b/grub-core/kern/emu/main.c
|
||||
@@ -107,6 +107,7 @@ static struct argp_option options[] = {
|
||||
N_("use GRUB files in the directory DIR [default=%s]"), 0},
|
||||
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
||||
{"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0},
|
||||
+ {"kexec", 'X', 0, 0, N_("try the untryable."), 0},
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -164,6 +165,9 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
||||
case 'v':
|
||||
verbosity++;
|
||||
break;
|
||||
+ case 'X':
|
||||
+ grub_util_set_kexecute();
|
||||
+ break;
|
||||
|
||||
case ARGP_KEY_ARG:
|
||||
{
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 0ff13bcaf8c..eeea092752d 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <grub/emu/misc.h>
|
||||
|
||||
int verbosity;
|
||||
+int kexecute;
|
||||
|
||||
void
|
||||
grub_util_warn (const char *fmt, ...)
|
||||
@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...)
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
fprintf (stderr, ".\n");
|
||||
- exit (1);
|
||||
+ grub_exit (1);
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -154,6 +155,9 @@ void
|
||||
__attribute__ ((noreturn))
|
||||
grub_exit (int rc)
|
||||
{
|
||||
+#if defined (GRUB_KERNEL)
|
||||
+ grub_reboot();
|
||||
+#endif
|
||||
exit (rc < 0 ? 1 : rc);
|
||||
}
|
||||
#endif
|
||||
@@ -215,3 +219,15 @@ grub_util_load_image (const char *path, char *buf)
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
+
|
||||
+void
|
||||
+grub_util_set_kexecute(void)
|
||||
+{
|
||||
+ kexecute++;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+grub_util_get_kexecute(void)
|
||||
+{
|
||||
+ return kexecute;
|
||||
+}
|
||||
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
|
||||
new file mode 100644
|
||||
index 00000000000..fda9e00d24c
|
||||
--- /dev/null
|
||||
+++ b/grub-core/loader/emu/linux.c
|
||||
@@ -0,0 +1,172 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/loader.h>
|
||||
+#include <grub/dl.h>
|
||||
+#include <grub/command.h>
|
||||
+#include <grub/time.h>
|
||||
+
|
||||
+#include <grub/emu/exec.h>
|
||||
+#include <grub/emu/hostfile.h>
|
||||
+#include <grub/emu/misc.h>
|
||||
+
|
||||
+GRUB_MOD_LICENSE ("GPLv3+");
|
||||
+
|
||||
+static grub_dl_t my_mod;
|
||||
+
|
||||
+static char *kernel_path;
|
||||
+static char *initrd_path;
|
||||
+static char *boot_cmdline;
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_linux_boot (void)
|
||||
+{
|
||||
+ grub_err_t rc = GRUB_ERR_NONE;
|
||||
+ char *initrd_param;
|
||||
+ const char *kexec[] = { "kexec", "-l", kernel_path, boot_cmdline, NULL, NULL };
|
||||
+ const char *systemctl[] = { "systemctl", "kexec", NULL };
|
||||
+ int kexecute = grub_util_get_kexecute();
|
||||
+
|
||||
+ if (initrd_path) {
|
||||
+ initrd_param = grub_xasprintf("--initrd=%s", initrd_path);
|
||||
+ kexec[3] = initrd_param;
|
||||
+ kexec[4] = boot_cmdline;
|
||||
+ } else {
|
||||
+ initrd_param = grub_xasprintf("%s", "");
|
||||
+ }
|
||||
+
|
||||
+ grub_printf("%serforming 'kexec -l %s %s %s'\n",
|
||||
+ (kexecute) ? "P" : "Not p",
|
||||
+ kernel_path, initrd_param, boot_cmdline);
|
||||
+
|
||||
+ if (kexecute)
|
||||
+ rc = grub_util_exec(kexec);
|
||||
+
|
||||
+ grub_free(initrd_param);
|
||||
+
|
||||
+ if (rc != GRUB_ERR_NONE) {
|
||||
+ grub_error (rc, N_("Error trying to perform kexec load operation."));
|
||||
+ grub_sleep (3);
|
||||
+ return rc;
|
||||
+ }
|
||||
+ if (kexecute < 1)
|
||||
+ grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart."));
|
||||
+
|
||||
+ grub_printf("Performing 'systemctl kexec' (%s) ",
|
||||
+ (kexecute==1) ? "do-or-die" : "just-in-case");
|
||||
+ rc = grub_util_exec (systemctl);
|
||||
+
|
||||
+ if (kexecute == 1)
|
||||
+ grub_fatal (N_("Error trying to perform 'systemctl kexec'"));
|
||||
+
|
||||
+ /* need to check read-only root before resetting hard!? */
|
||||
+ grub_printf("Performing 'kexec -e'");
|
||||
+ kexec[1] = "-e";
|
||||
+ kexec[2] = NULL;
|
||||
+ rc = grub_util_exec(kexec);
|
||||
+ if ( rc != GRUB_ERR_NONE )
|
||||
+ grub_fatal (N_("Error trying to directly perform 'kexec -e'."));
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_linux_unload (void)
|
||||
+{
|
||||
+ grub_dl_unref (my_mod);
|
||||
+ if ( boot_cmdline != NULL )
|
||||
+ grub_free (boot_cmdline);
|
||||
+ boot_cmdline = NULL;
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[])
|
||||
+{
|
||||
+ int i;
|
||||
+ char *tempstr;
|
||||
+
|
||||
+ grub_dl_ref (my_mod);
|
||||
+
|
||||
+ if (argc == 0)
|
||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
+
|
||||
+ if ( !grub_util_is_regular(argv[0]) )
|
||||
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find kernel file %s"), argv[0]);
|
||||
+
|
||||
+ if ( kernel_path != NULL )
|
||||
+ grub_free(kernel_path);
|
||||
+
|
||||
+ kernel_path = grub_xasprintf("%s", argv[0]);
|
||||
+
|
||||
+ if ( boot_cmdline != NULL ) {
|
||||
+ grub_free(boot_cmdline);
|
||||
+ boot_cmdline = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if ( argc > 1 )
|
||||
+ {
|
||||
+ boot_cmdline = grub_xasprintf("--command-line=%s", argv[1]);
|
||||
+ for ( i = 2; i < argc; i++ ) {
|
||||
+ tempstr = grub_xasprintf("%s %s", boot_cmdline, argv[i]);
|
||||
+ grub_free(boot_cmdline);
|
||||
+ boot_cmdline = tempstr;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[])
|
||||
+{
|
||||
+ if (argc == 0)
|
||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
+
|
||||
+ if ( !grub_util_is_regular(argv[0]) )
|
||||
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find initrd file %s"), argv[0]);
|
||||
+
|
||||
+ if ( initrd_path != NULL )
|
||||
+ grub_free(initrd_path);
|
||||
+
|
||||
+ initrd_path = grub_xasprintf("%s", argv[0]);
|
||||
+
|
||||
+ grub_dl_unref (my_mod);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_command_t cmd_linux, cmd_initrd;
|
||||
+
|
||||
+GRUB_MOD_INIT(linux)
|
||||
+{
|
||||
+ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux."));
|
||||
+ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, N_("Load initrd."));
|
||||
+ my_mod = mod;
|
||||
+ kernel_path = NULL;
|
||||
+ initrd_path = NULL;
|
||||
+ boot_cmdline = NULL;
|
||||
+}
|
||||
+
|
||||
+GRUB_MOD_FINI(linux)
|
||||
+{
|
||||
+ grub_unregister_command (cmd_linux);
|
||||
+ grub_unregister_command (cmd_initrd);
|
||||
+}
|
||||
diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h
|
||||
index d1073ef86af..1b61b4a2e5d 100644
|
||||
--- a/include/grub/emu/exec.h
|
||||
+++ b/include/grub/emu/exec.h
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
+#include <grub/symbol.h>
|
||||
+
|
||||
pid_t
|
||||
grub_util_exec_pipe (const char *const *argv, int *fd);
|
||||
pid_t
|
||||
@@ -32,7 +34,7 @@ int
|
||||
grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file,
|
||||
const char *stdout_file, const char *stderr_file);
|
||||
int
|
||||
-grub_util_exec (const char *const *argv);
|
||||
+EXPORT_FUNC(grub_util_exec) (const char *const *argv);
|
||||
int
|
||||
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 cfb1e2b5661..a61568e36e9 100644
|
||||
--- a/include/grub/emu/hostfile.h
|
||||
+++ b/include/grub/emu/hostfile.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <sys/types.h>
|
||||
+#include <grub/symbol.h>
|
||||
#include <grub/osdep/hostfile.h>
|
||||
|
||||
int
|
||||
@@ -29,7 +30,7 @@ grub_util_is_directory (const char *path);
|
||||
int
|
||||
grub_util_is_special_file (const char *path);
|
||||
int
|
||||
-grub_util_is_regular (const char *path);
|
||||
+EXPORT_FUNC(grub_util_is_regular) (const char *path);
|
||||
|
||||
char *
|
||||
grub_util_path_concat (size_t n, ...);
|
||||
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
||||
index ff9c48a6490..01056954b96 100644
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -57,6 +57,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;
|
||||
+
|
||||
grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
|
||||
index ee88e44e97a..80e7a83edf9 100644
|
||||
--- a/grub-core/Makefile.am
|
||||
+++ b/grub-core/Makefile.am
|
||||
@@ -307,6 +307,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
|
||||
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/exec.h
|
||||
if COND_GRUB_EMU_SDL
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
||||
endif
|
||||
|
|
@ -7,23 +7,20 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
[jhlavac: Use ${etcdefaultgrub} instead of /etc/default/grub]
|
||||
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
|
||||
[rharwood: skip on ostree installations, migrate man to h2m]
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
Makefile.util.def | 7 +
|
||||
docs/man/grub-switch-to-blscfg.h2m | 2 +
|
||||
util/grub-set-password.in | 2 +-
|
||||
util/grub-switch-to-blscfg.in | 317 +++++++++++++++++++++++++++++++++++++
|
||||
util/grub.d/10_linux.in | 2 +-
|
||||
5 files changed, 328 insertions(+), 2 deletions(-)
|
||||
create mode 100644 docs/man/grub-switch-to-blscfg.h2m
|
||||
Makefile.util.def | 7 +
|
||||
util/grub-set-password.in | 2 +-
|
||||
util/grub-switch-to-blscfg.8 | 33 +++++
|
||||
util/grub-switch-to-blscfg.in | 317 ++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 358 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 84a17ef5cfa..acbcc8c208c 100644
|
||||
index cdd2f51fe4b..afc4d7b0c3e 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -1387,6 +1387,13 @@ program = {
|
||||
@@ -1364,6 +1364,13 @@ program = {
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
|
|
@ -37,14 +34,6 @@ index 84a17ef5cfa..acbcc8c208c 100644
|
|||
program = {
|
||||
name = grub-glue-efi;
|
||||
mansection = 1;
|
||||
diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m
|
||||
new file mode 100644
|
||||
index 00000000000..fa341426a50
|
||||
--- /dev/null
|
||||
+++ b/docs/man/grub-switch-to-blscfg.h2m
|
||||
@@ -0,0 +1,2 @@
|
||||
+[NAME]
|
||||
+grub-switch-to-blscfg \- switch to using BLS config files
|
||||
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
|
||||
index 5ebf50576d6..c0b5ebbfdc5 100644
|
||||
--- a/util/grub-set-password.in
|
||||
|
|
@ -57,6 +46,45 @@ index 5ebf50576d6..c0b5ebbfdc5 100644
|
|||
if [ -d /sys/firmware/efi/efivars/ ]; then
|
||||
grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
|
||||
else
|
||||
diff --git a/util/grub-switch-to-blscfg.8 b/util/grub-switch-to-blscfg.8
|
||||
new file mode 100644
|
||||
index 00000000000..9a886282976
|
||||
--- /dev/null
|
||||
+++ b/util/grub-switch-to-blscfg.8
|
||||
@@ -0,0 +1,33 @@
|
||||
+.TH GRUB-SWITCH-TO-BLSCFG 1 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-switch-to-blscfg\fR \(em Switch to using BLS config files.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-switch-to-blscfg\fR [--grub-directory=\fIDIR\fR] [--config-file=\fIFILE\fR] [--grub-defaults=\fIFILE\fR]
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-switch-to-blscfg\fR reconfigures grub-mkconfig to use BLS-style config files, and then regenerates the GRUB configuration.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+--grub-directory=\fIDIR\fR
|
||||
+Search for grub.cfg under \fIDIR\fR. The default value is \fI/boot/efi/EFI/\fBVENDOR\fR on UEFI machines and \fI/boot/grub2\fR elsewhere.
|
||||
+
|
||||
+.TP
|
||||
+--config-file=\fIFILE\fR
|
||||
+The grub config file to use. The default value is \fI/etc/grub2-efi.cfg\fR on UEFI machines and \fI/etc/grub2.cfg\fR elsewhere. Symbolic links will be followed.
|
||||
+
|
||||
+.TP
|
||||
+--grub-defaults=\fIFILE\fR
|
||||
+The defaults file for grub-mkconfig. The default value is \fI/etc/default/grub\fR.
|
||||
+
|
||||
+.TP
|
||||
+--bls-directory=\fIDIR\fR
|
||||
+Create BootLoaderSpec fragments in \fIDIR\fR. The default value is \fI/boot/loader/entries\fR.
|
||||
+
|
||||
+.TP
|
||||
+--backup-suffix=\fSUFFIX\fR
|
||||
+The suffix to use for saved backup files. The default value is \fI.bak\fR.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
|
||||
new file mode 100644
|
||||
index 00000000000..a851424beb2
|
||||
|
|
@ -129,7 +157,7 @@ index 00000000000..a851424beb2
|
|||
+# Print the usage.
|
||||
+usage () {
|
||||
+ gettext_printf "Usage: %s\n" "$self"
|
||||
+ gettext "Switch to BLS config files."; echo
|
||||
+ gettext "Switch to BLS config files.\n"; echo
|
||||
+ echo
|
||||
+ print_option_help "-h, --help" "$(gettext "print this message and exit")"
|
||||
+ print_option_help "-V, --version" "$(gettext "print the version information and exit")"
|
||||
|
|
@ -380,16 +408,3 @@ index 00000000000..a851424beb2
|
|||
+
|
||||
+# Bye.
|
||||
+exit 0
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index cd9aea0cc01..b8bc37e92aa 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -140,7 +140,7 @@ blsdir="/boot/loader/entries"
|
||||
|
||||
get_sorted_bls()
|
||||
{
|
||||
- if ! [ -d "${blsdir}" ]; then
|
||||
+ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ] || [ -d /ostree/repo ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++
|
||||
grub-core/kern/i386/pc/init.c | 4 +-
|
||||
grub-core/kern/ieee1275/init.c | 1 -
|
||||
grub-core/kern/misc.c | 11 +--
|
||||
grub-core/kern/misc.c | 13 ++--
|
||||
grub-core/kern/mm.c | 6 +-
|
||||
grub-core/lib/arm64/backtrace.c | 62 ----------------
|
||||
grub-core/lib/i386/backtrace.c | 78 --------------------
|
||||
|
|
@ -29,7 +29,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/kern/ia64/efi/startup.S | 3 +-
|
||||
grub-core/kern/sparc64/ieee1275/crt0.S | 3 +-
|
||||
grub-core/Makefile.am | 1 +
|
||||
24 files changed, 413 insertions(+), 166 deletions(-)
|
||||
24 files changed, 414 insertions(+), 167 deletions(-)
|
||||
rename grub-core/{lib => commands}/backtrace.c (98%)
|
||||
create mode 100644 grub-core/kern/arm64/backtrace.c
|
||||
create mode 100644 grub-core/kern/backtrace.c
|
||||
|
|
@ -38,7 +38,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
delete mode 100644 grub-core/lib/i386/backtrace.c
|
||||
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index acbcc8c208c..1079add5bbe 100644
|
||||
index afc4d7b0c3e..41906486a71 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -51,6 +51,12 @@ library = {
|
||||
|
|
@ -55,10 +55,10 @@ index acbcc8c208c..1079add5bbe 100644
|
|||
|
||||
library = {
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 63f053b3add..6645fbae34f 100644
|
||||
index 5354f9613d3..4b7c45a7b06 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -153,6 +153,12 @@ kernel = {
|
||||
@@ -142,6 +142,12 @@ kernel = {
|
||||
common = kern/rescue_reader.c;
|
||||
common = kern/term.c;
|
||||
common = kern/verifiers.c;
|
||||
|
|
@ -71,7 +71,7 @@ index 63f053b3add..6645fbae34f 100644
|
|||
|
||||
noemu = kern/compiler-rt.c;
|
||||
noemu = kern/mm.c;
|
||||
@@ -199,9 +205,6 @@ kernel = {
|
||||
@@ -188,9 +194,6 @@ kernel = {
|
||||
|
||||
softdiv = lib/division.c;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ index 63f053b3add..6645fbae34f 100644
|
|||
i386 = kern/i386/dl.c;
|
||||
i386_xen = kern/i386/dl.c;
|
||||
i386_xen_pvh = kern/i386/dl.c;
|
||||
@@ -2455,15 +2458,12 @@ module = {
|
||||
@@ -2398,15 +2401,12 @@ module = {
|
||||
|
||||
module = {
|
||||
name = backtrace;
|
||||
|
|
@ -331,10 +331,10 @@ index 00000000000..4a82e865cc6
|
|||
+ grub_backtrace (skip + 1);
|
||||
+}
|
||||
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
||||
index 0bf40caa61a..931f6e41442 100644
|
||||
index 7afb9e6f724..88d2077709e 100644
|
||||
--- a/grub-core/kern/dl.c
|
||||
+++ b/grub-core/kern/dl.c
|
||||
@@ -115,6 +115,50 @@ grub_dl_resolve_symbol (const char *name)
|
||||
@@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -385,7 +385,7 @@ index 0bf40caa61a..931f6e41442 100644
|
|||
/* Register a symbol with the name NAME and the address ADDR. */
|
||||
grub_err_t
|
||||
grub_dl_register_symbol (const char *name, void *addr, int isfunc,
|
||||
@@ -330,6 +374,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
||||
@@ -336,6 +380,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
||||
const char *str;
|
||||
Elf_Word size, entsize;
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ index 00000000000..2413f9a57db
|
|||
+#endif
|
||||
+}
|
||||
diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c
|
||||
index 326d491c586..fe7ad14d45c 100644
|
||||
index 27bc68b8a53..b51d0abfa6e 100644
|
||||
--- a/grub-core/kern/i386/pc/init.c
|
||||
+++ b/grub-core/kern/i386/pc/init.c
|
||||
@@ -153,7 +153,7 @@ compact_mem_regions (void)
|
||||
|
|
@ -537,7 +537,7 @@ index 326d491c586..fe7ad14d45c 100644
|
|||
|
||||
/* Helper for grub_machine_init. */
|
||||
static int
|
||||
@@ -226,7 +226,7 @@ grub_machine_init (void)
|
||||
@@ -217,7 +217,7 @@ grub_machine_init (void)
|
||||
/* This has to happen before any BIOS calls. */
|
||||
grub_via_workaround_init ();
|
||||
|
||||
|
|
@ -547,23 +547,27 @@ index 326d491c586..fe7ad14d45c 100644
|
|||
/* Initialize the console as early as possible. */
|
||||
grub_console_init ();
|
||||
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
|
||||
index 51c1e1c9d9f..c4d6962197b 100644
|
||||
index 0cd2a627231..937c1bc44cb 100644
|
||||
--- a/grub-core/kern/ieee1275/init.c
|
||||
+++ b/grub-core/kern/ieee1275/init.c
|
||||
@@ -70,7 +70,6 @@
|
||||
*/
|
||||
#define RUNTIME_MIN_SPACE (128UL * 1024 * 1024)
|
||||
@@ -63,7 +63,6 @@
|
||||
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
-extern char _start[];
|
||||
extern char _end[];
|
||||
|
||||
#ifdef __sparc__
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index b1d399d37d7..779586658cb 100644
|
||||
index c60601b699d..a432a6be54a 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -1302,12 +1302,12 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
|
||||
void __attribute__ ((noreturn))
|
||||
@@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
|
||||
|
||||
|
||||
/* Abort GRUB. This function does not return. */
|
||||
-static void __attribute__ ((noreturn))
|
||||
+static inline void __attribute__ ((noreturn))
|
||||
grub_abort (void)
|
||||
{
|
||||
-#ifndef GRUB_UTIL
|
||||
|
|
@ -580,7 +584,7 @@ index b1d399d37d7..779586658cb 100644
|
|||
|
||||
#ifndef GRUB_UTIL
|
||||
if (grub_term_inputs)
|
||||
@@ -1334,6 +1334,7 @@ grub_fatal (const char *fmt, ...)
|
||||
@@ -1232,6 +1232,7 @@ grub_fatal (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
@ -589,10 +593,10 @@ index b1d399d37d7..779586658cb 100644
|
|||
grub_vprintf (_(fmt), ap);
|
||||
va_end (ap);
|
||||
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
|
||||
index 027a25cd1f0..1aeeba9e27e 100644
|
||||
index c070afc621f..d8c8377578b 100644
|
||||
--- a/grub-core/kern/mm.c
|
||||
+++ b/grub-core/kern/mm.c
|
||||
@@ -144,13 +144,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
|
||||
@@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
|
||||
break;
|
||||
|
||||
if (! *r)
|
||||
|
|
@ -783,10 +787,10 @@ index 395519762f0..275cf85e2d3 100644
|
|||
|
||||
#endif
|
||||
diff --git a/include/grub/dl.h b/include/grub/dl.h
|
||||
index f2bf50eb98d..8a3d188d1d1 100644
|
||||
index 91933b85f2c..2f76e6b0437 100644
|
||||
--- a/include/grub/dl.h
|
||||
+++ b/include/grub/dl.h
|
||||
@@ -258,6 +258,8 @@ grub_dl_is_persistent (grub_dl_t mod)
|
||||
@@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -893,7 +897,7 @@ index 03b916f0534..701bf63abcf 100644
|
|||
ba codestart
|
||||
mov %o4, %o0
|
||||
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
|
||||
index f18550c1c98..b7192a3da82 100644
|
||||
index 80e7a83edf9..f512573c0da 100644
|
||||
--- a/grub-core/Makefile.am
|
||||
+++ b/grub-core/Makefile.am
|
||||
@@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
|
|
@ -8,10 +8,10 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set
|
|||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 3463f444f74..b5fa6156549 100644
|
||||
index d5968797f4f..e349303c29b 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -430,6 +430,9 @@ grub_normal_reader_init (int nested)
|
||||
@@ -432,6 +432,9 @@ grub_normal_reader_init (int nested)
|
||||
const char *msg_esc = _("ESC at any time exits.");
|
||||
char *msg_formatted;
|
||||
|
||||
|
|
@ -20,4 +20,4 @@ index 3463f444f74..b5fa6156549 100644
|
|||
+
|
||||
msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For "
|
||||
"the first word, TAB lists possible command completions. Anywhere "
|
||||
"else TAB lists possible device or file completions. To enable "
|
||||
"else TAB lists possible device or file completions. %s"),
|
||||
|
|
@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 3602b4ab62b..fcfbcbb664d 100644
|
||||
index 6c16968ad9c..f4cfd06cbe6 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1540,7 +1540,15 @@ grub_PROG_TARGET_CC
|
||||
@@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC
|
||||
if test "x$TARGET_APPLE_LINKER" != x1 ; then
|
||||
grub_PROG_OBJCOPY_ABSOLUTE
|
||||
fi
|
||||
|
|
@ -30,7 +30,7 @@ index 3602b4ab62b..fcfbcbb664d 100644
|
|||
if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
|
||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||
diff --git a/acinclude.m4 b/acinclude.m4
|
||||
index fa7840f09af..0231e64e337 100644
|
||||
index 6e14bb553c6..21238fcfd03 100644
|
||||
--- a/acinclude.m4
|
||||
+++ b/acinclude.m4
|
||||
@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
|
||||
|
|
@ -13,10 +13,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
2 files changed, 20 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index 96ab7c96b52..98700423d79 100644
|
||||
index a432a6be54a..9a2fae6398e 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -280,6 +280,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
|
||||
@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -42,13 +42,13 @@ index 96ab7c96b52..98700423d79 100644
|
|||
|
||||
int
|
||||
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
||||
index 3e9a00f0a9c..db517acd592 100644
|
||||
index fd18e6320b8..3adc4036e3b 100644
|
||||
--- a/include/grub/misc.h
|
||||
+++ b/include/grub/misc.h
|
||||
@@ -386,6 +386,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
||||
@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
||||
const int line,
|
||||
const char *condition,
|
||||
const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5)));
|
||||
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
|
||||
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
|
||||
+void EXPORT_FUNC(grub_qdprintf) (const char *condition,
|
||||
+ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3)));
|
||||
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
|
||||
178
0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch
Normal file
178
0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 25 Jun 2015 15:11:36 -0400
|
||||
Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses.
|
||||
|
||||
This makes a grub_dprintf() call during platform init and during module
|
||||
loading that tells us the virtual addresses of the .text and .data
|
||||
sections of grub-core/kernel.exec and any modules it loads.
|
||||
|
||||
Specifically, it displays them in the gdb "add-symbol-file" syntax, with
|
||||
the presumption that there's a variable $grubdir that reflects the path
|
||||
to any such binaries.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/kern/dl.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
grub-core/kern/efi/efi.c | 4 ++--
|
||||
grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++-
|
||||
include/grub/efi/efi.h | 2 +-
|
||||
4 files changed, 78 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
||||
index 88d2077709e..9557254035e 100644
|
||||
--- a/grub-core/kern/dl.c
|
||||
+++ b/grub-core/kern/dl.c
|
||||
@@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name)
|
||||
return s;
|
||||
return NULL;
|
||||
}
|
||||
+static long
|
||||
+grub_dl_find_section_index (Elf_Ehdr *e, const char *name)
|
||||
+{
|
||||
+ Elf_Shdr *s;
|
||||
+ const char *str;
|
||||
+ unsigned i;
|
||||
+
|
||||
+ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize);
|
||||
+ str = (char *) e + s->sh_offset;
|
||||
+
|
||||
+ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
+ i < e->e_shnum;
|
||||
+ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||
+ if (grub_strcmp (str + s->sh_name, name) == 0)
|
||||
+ return (long)i;
|
||||
+ return -1;
|
||||
+}
|
||||
|
||||
/* Me, Vladimir Serbinenko, hereby I add this module check as per new
|
||||
GNU module policy. Note that this license check is informative only.
|
||||
@@ -653,6 +670,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
+static void
|
||||
+grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e)
|
||||
+{
|
||||
+ void *text, *data = NULL;
|
||||
+ long idx;
|
||||
+
|
||||
+ idx = grub_dl_find_section_index (e, ".text");
|
||||
+ if (idx < 0)
|
||||
+ return;
|
||||
+
|
||||
+ text = grub_dl_get_section_addr (mod, idx);
|
||||
+ if (!text)
|
||||
+ return;
|
||||
+
|
||||
+ idx = grub_dl_find_section_index (e, ".data");
|
||||
+ if (idx >= 0)
|
||||
+ data = grub_dl_get_section_addr (mod, idx);
|
||||
+
|
||||
+ if (data)
|
||||
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
|
||||
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
|
||||
+ "\\\n %p -s .data %p\n",
|
||||
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
|
||||
+ mod->name, text, data);
|
||||
+ else
|
||||
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
|
||||
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
|
||||
+ "\\\n%p\n",
|
||||
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
|
||||
+ mod->name, text);
|
||||
+}
|
||||
|
||||
/* Load a module from core memory. */
|
||||
grub_dl_t
|
||||
@@ -712,6 +760,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
|
||||
grub_dprintf ("modules", "module name: %s\n", mod->name);
|
||||
grub_dprintf ("modules", "init function: %p\n", mod->init);
|
||||
|
||||
+ grub_dl_print_gdb_info (mod, e);
|
||||
+
|
||||
if (grub_dl_add (mod))
|
||||
{
|
||||
grub_dl_unload (mod);
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index ae9885edb84..d6a2fb57789 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
/* Search the mods section from the PE32/PE32+ image. This code uses
|
||||
a PE32 header, but should work with PE32+ as well. */
|
||||
grub_addr_t
|
||||
-grub_efi_modules_addr (void)
|
||||
+grub_efi_section_addr (const char *section_name)
|
||||
{
|
||||
grub_efi_loaded_image_t *image;
|
||||
struct grub_pe32_header *header;
|
||||
@@ -321,7 +321,7 @@ grub_efi_modules_addr (void)
|
||||
i < coff_header->num_sections;
|
||||
i++, section++)
|
||||
{
|
||||
- if (grub_strcmp (section->name, "mods") == 0)
|
||||
+ if (grub_strcmp (section->name, section_name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
|
||||
index 6d39bd3ad29..2d12e6188fd 100644
|
||||
--- a/grub-core/kern/efi/init.c
|
||||
+++ b/grub-core/kern/efi/init.c
|
||||
@@ -115,10 +115,33 @@ grub_efi_env_init (void)
|
||||
grub_free (envblk_s.buf);
|
||||
}
|
||||
|
||||
+static void
|
||||
+grub_efi_print_gdb_info (void)
|
||||
+{
|
||||
+ grub_addr_t text;
|
||||
+ grub_addr_t data;
|
||||
+
|
||||
+ text = grub_efi_section_addr (".text");
|
||||
+ if (!text)
|
||||
+ return;
|
||||
+
|
||||
+ data = grub_efi_section_addr (".data");
|
||||
+ if (data)
|
||||
+ grub_qdprintf ("gdb",
|
||||
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
|
||||
+ "kernel.exec %p -s .data %p\n",
|
||||
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data);
|
||||
+ else
|
||||
+ grub_qdprintf ("gdb",
|
||||
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
|
||||
+ "kernel.exec %p\n",
|
||||
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text);
|
||||
+}
|
||||
+
|
||||
void
|
||||
grub_efi_init (void)
|
||||
{
|
||||
- grub_modbase = grub_efi_modules_addr ();
|
||||
+ grub_modbase = grub_efi_section_addr ("mods");
|
||||
/* First of all, initialize the console so that GRUB can display
|
||||
messages. */
|
||||
grub_console_init ();
|
||||
@@ -142,6 +165,7 @@ grub_efi_init (void)
|
||||
0, 0, 0, NULL);
|
||||
|
||||
grub_efi_env_init ();
|
||||
+ grub_efi_print_gdb_info ();
|
||||
grub_efidisk_init ();
|
||||
}
|
||||
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index 03f9a9d0118..2e0691454b1 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
|
||||
grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args);
|
||||
#endif
|
||||
|
||||
-grub_addr_t grub_efi_modules_addr (void);
|
||||
+grub_addr_t grub_efi_section_addr (const char *section);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
36
0081-Fixup-for-newer-compiler.patch
Normal file
36
0081-Fixup-for-newer-compiler.patch
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 10 May 2018 13:40:19 -0400
|
||||
Subject: [PATCH] Fixup for newer compiler
|
||||
|
||||
---
|
||||
grub-core/fs/btrfs.c | 2 +-
|
||||
include/grub/gpt_partition.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index 2b21cbaa67e..4cc86e9b79e 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -218,7 +218,7 @@ struct grub_btrfs_inode
|
||||
grub_uint64_t size;
|
||||
grub_uint8_t dummy2[0x70];
|
||||
struct grub_btrfs_time mtime;
|
||||
-} GRUB_PACKED;
|
||||
+} GRUB_PACKED __attribute__ ((aligned(8)));
|
||||
|
||||
struct grub_btrfs_extent_data
|
||||
{
|
||||
diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
|
||||
index 7a93f43291c..8212697bf6b 100644
|
||||
--- a/include/grub/gpt_partition.h
|
||||
+++ b/include/grub/gpt_partition.h
|
||||
@@ -76,7 +76,7 @@ struct grub_gpt_partentry
|
||||
grub_uint64_t end;
|
||||
grub_uint64_t attrib;
|
||||
char name[72];
|
||||
-} GRUB_PACKED;
|
||||
+} GRUB_PACKED __attribute__ ((aligned(8)));
|
||||
|
||||
grub_err_t
|
||||
grub_gpt_partition_map_iterate (grub_disk_t disk,
|
||||
|
|
@ -8,15 +8,15 @@ Subject: [PATCH] Fixup for newer compiler
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/conf/Makefile.common b/conf/Makefile.common
|
||||
index ece9ed8a1bf..6262f21a772 100644
|
||||
index 191b1a70c6b..5f0ef969857 100644
|
||||
--- a/conf/Makefile.common
|
||||
+++ b/conf/Makefile.common
|
||||
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
|
||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||
-STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
||||
+STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
|
||||
if !COND_emu
|
||||
if COND_HAVE_ASM_USCORE
|
||||
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free
|
||||
|
||||
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
||||
|
|
@ -23,22 +23,22 @@ Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
|
|||
[msalter: Fix max string calculation in grub_net_hwaddr_to_str]
|
||||
Signed-off-by: Mark Salter <msalter@redhat.com>
|
||||
---
|
||||
grub-core/net/arp.c | 156 ++++++++++++++++++++++-----------
|
||||
grub-core/net/arp.c | 155 ++++++++++++++++++++++-----------
|
||||
grub-core/net/bootp.c | 15 ++--
|
||||
grub-core/net/drivers/efi/efinet.c | 8 +-
|
||||
grub-core/net/drivers/emu/emunet.c | 1 +
|
||||
grub-core/net/drivers/i386/pc/pxe.c | 13 +--
|
||||
grub-core/net/drivers/ieee1275/ofnet.c | 2 +
|
||||
grub-core/net/drivers/uboot/ubootnet.c | 1 +
|
||||
grub-core/net/ethernet.c | 89 +++++++++----------
|
||||
grub-core/net/ethernet.c | 88 +++++++++----------
|
||||
grub-core/net/icmp6.c | 15 ++--
|
||||
grub-core/net/ip.c | 4 +-
|
||||
grub-core/net/net.c | 50 ++++++-----
|
||||
include/grub/net.h | 19 ++--
|
||||
12 files changed, 220 insertions(+), 153 deletions(-)
|
||||
12 files changed, 219 insertions(+), 152 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
|
||||
index 1d367436cfc..8bf0a06e193 100644
|
||||
index 54306e3b16d..67b409a8acc 100644
|
||||
--- a/grub-core/net/arp.c
|
||||
+++ b/grub-core/net/arp.c
|
||||
@@ -31,22 +31,12 @@ enum
|
||||
|
|
@ -137,7 +137,7 @@ index 1d367436cfc..8bf0a06e193 100644
|
|||
|
||||
nbd = nb.data;
|
||||
send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP);
|
||||
@@ -114,30 +124,56 @@ grub_err_t
|
||||
@@ -114,28 +124,53 @@ grub_err_t
|
||||
grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
|
||||
grub_uint16_t *vlantag)
|
||||
{
|
||||
|
|
@ -177,36 +177,33 @@ index 1d367436cfc..8bf0a06e193 100644
|
|||
+
|
||||
+ /* The source protocol address. */
|
||||
sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
|
||||
- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
|
||||
- sender_addr.ipv4 = arp_packet->sender_ip;
|
||||
- target_addr.ipv4 = arp_packet->recv_ip;
|
||||
sender_addr.option = 0;
|
||||
target_addr.option = 0;
|
||||
- if (arp_packet->sender_ip == pending_req)
|
||||
- have_pending = 1;
|
||||
|
||||
- sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
- grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac,
|
||||
- sizeof (sender_mac_addr.mac));
|
||||
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
|
||||
+ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln);
|
||||
+ tmp_ptr += pln;
|
||||
+
|
||||
grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
|
||||
|
||||
+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
|
||||
+
|
||||
+ /* The target hardware address. */
|
||||
+ tmp_ptr += hln;
|
||||
+
|
||||
+ /* The target protocol address. */
|
||||
+ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
|
||||
target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
|
||||
- sender_addr.ipv4 = arp_packet->sender_ip;
|
||||
- target_addr.ipv4 = arp_packet->recv_ip;
|
||||
- if (arp_packet->sender_ip == pending_req)
|
||||
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
|
||||
+
|
||||
+ if (sender_addr.ipv4 == pending_req)
|
||||
+ have_pending = 1;
|
||||
+
|
||||
have_pending = 1;
|
||||
|
||||
- sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
- grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac,
|
||||
- sizeof (sender_mac_addr.mac));
|
||||
- grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
|
||||
-
|
||||
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
|
||||
{
|
||||
/* Verify vlantag id */
|
||||
@@ -150,11 +186,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
|
||||
@@ -148,11 +183,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
|
||||
|
||||
/* Am I the protocol address target? */
|
||||
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
|
||||
|
|
@ -220,7 +217,7 @@ index 1d367436cfc..8bf0a06e193 100644
|
|||
grub_uint8_t arp_data[128];
|
||||
grub_err_t err;
|
||||
|
||||
@@ -163,25 +199,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
|
||||
@@ -161,25 +196,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
|
||||
grub_netbuff_clear (&nb_reply);
|
||||
grub_netbuff_reserve (&nb_reply, 128);
|
||||
|
||||
|
|
@ -274,10 +271,10 @@ index 1d367436cfc..8bf0a06e193 100644
|
|||
/* Change operation to REPLY and send packet */
|
||||
send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP);
|
||||
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
|
||||
index e0aec25233d..76e4c11a46f 100644
|
||||
index 8d9edaac447..dd5c8d04da9 100644
|
||||
--- a/grub-core/net/bootp.c
|
||||
+++ b/grub-core/net/bootp.c
|
||||
@@ -325,7 +325,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
@@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
int is_def, char **device, char **path)
|
||||
{
|
||||
grub_net_network_level_address_t addr;
|
||||
|
|
@ -285,7 +282,7 @@ index e0aec25233d..76e4c11a46f 100644
|
|||
struct grub_net_network_level_interface *inter;
|
||||
int mask = -1;
|
||||
char server_ip[sizeof ("xxx.xxx.xxx.xxx")];
|
||||
@@ -343,12 +342,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
@@ -250,12 +249,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
if (path)
|
||||
*path = 0;
|
||||
|
||||
|
|
@ -300,7 +297,7 @@ index e0aec25233d..76e4c11a46f 100644
|
|||
if (!inter)
|
||||
return 0;
|
||||
|
||||
@@ -660,7 +655,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
|
||||
@@ -567,7 +562,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
|
||||
grub_memset (pack, 0, sizeof (*pack));
|
||||
pack->opcode = 1;
|
||||
pack->hw_type = 1;
|
||||
|
|
@ -311,20 +308,20 @@ index e0aec25233d..76e4c11a46f 100644
|
|||
err = grub_get_datetime (&date);
|
||||
if (err || !grub_datetime2unixtime (&date, &t))
|
||||
{
|
||||
@@ -673,7 +670,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
|
||||
@@ -580,7 +577,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
|
||||
else
|
||||
pack->ident = iface->xid;
|
||||
|
||||
- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6);
|
||||
+ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len);
|
||||
|
||||
err = grub_netbuff_push (nb, sizeof (*udph));
|
||||
if (err)
|
||||
grub_netbuff_push (nb, sizeof (*udph));
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 3e2432fb61c..7deb0a32efd 100644
|
||||
index 173fb63153c..a673bea807a 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -288,6 +288,9 @@ grub_efinet_findcards (void)
|
||||
@@ -279,6 +279,9 @@ grub_efinet_findcards (void)
|
||||
/* This should not happen... Why? */
|
||||
continue;
|
||||
|
||||
|
|
@ -332,12 +329,12 @@ index 3e2432fb61c..7deb0a32efd 100644
|
|||
+ continue;
|
||||
+
|
||||
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
|
||||
&& net->start (net) != GRUB_EFI_SUCCESS)
|
||||
&& efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
|
||||
continue;
|
||||
@@ -332,10 +335,11 @@ grub_efinet_findcards (void)
|
||||
* such as LoadFile2 for initrd loading.
|
||||
*/
|
||||
card->flags = GRUB_NET_CARD_NO_CLOSE_ON_FINI_HW;
|
||||
@@ -315,10 +318,11 @@ grub_efinet_findcards (void)
|
||||
card->name = grub_xasprintf ("efinet%d", i++);
|
||||
card->driver = &efidriver;
|
||||
card->flags = 0;
|
||||
- card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
+ card->default_address.type = net->mode->if_type;
|
||||
+ card->default_address.len = net->mode->hwaddr_size;
|
||||
|
|
@ -349,7 +346,7 @@ index 3e2432fb61c..7deb0a32efd 100644
|
|||
card->efi_handle = *handle;
|
||||
|
||||
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c
|
||||
index 5f311d40f49..7461d13bbc2 100644
|
||||
index b194920861f..5b6c5e16a6d 100644
|
||||
--- a/grub-core/net/drivers/emu/emunet.c
|
||||
+++ b/grub-core/net/drivers/emu/emunet.c
|
||||
@@ -46,6 +46,7 @@ static struct grub_net_card emucard =
|
||||
|
|
@ -361,7 +358,7 @@ index 5f311d40f49..7461d13bbc2 100644
|
|||
},
|
||||
.flags = 0
|
||||
diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c
|
||||
index db17186ee7d..816d1d0eeda 100644
|
||||
index 3f4152d036c..9f8fb4b6d2b 100644
|
||||
--- a/grub-core/net/drivers/i386/pc/pxe.c
|
||||
+++ b/grub-core/net/drivers/i386/pc/pxe.c
|
||||
@@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe)
|
||||
|
|
@ -393,7 +390,7 @@ index db17186ee7d..816d1d0eeda 100644
|
|||
|
||||
grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
|
||||
index 78f03df8e21..c56461ff1ae 100644
|
||||
index 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,
|
||||
|
|
@ -404,7 +401,7 @@ index 78f03df8e21..c56461ff1ae 100644
|
|||
|
||||
args = bootpath + grub_strlen (devpath) + 1;
|
||||
do
|
||||
@@ -491,6 +492,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
|
||||
@@ -503,6 +504,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
|
||||
grub_memcpy (&lla.mac, pprop, 6);
|
||||
|
||||
lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
|
|
@ -413,7 +410,7 @@ index 78f03df8e21..c56461ff1ae 100644
|
|||
|
||||
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
|
||||
diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c
|
||||
index b9d5a0cd494..9f3354a1b74 100644
|
||||
index 056052e40d5..22ebcbf211e 100644
|
||||
--- a/grub-core/net/drivers/uboot/ubootnet.c
|
||||
+++ b/grub-core/net/drivers/uboot/ubootnet.c
|
||||
@@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet)
|
||||
|
|
@ -425,7 +422,7 @@ index b9d5a0cd494..9f3354a1b74 100644
|
|||
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
|
||||
card->txbuf = grub_zalloc (card->txbufsize);
|
||||
diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
|
||||
index 707bbb12cb2..1441a1bacff 100644
|
||||
index 4d7ceed6f93..9aae83a5eb4 100644
|
||||
--- a/grub-core/net/ethernet.c
|
||||
+++ b/grub-core/net/ethernet.c
|
||||
@@ -29,13 +29,6 @@
|
||||
|
|
@ -450,7 +447,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
+ grub_uint8_t *eth;
|
||||
grub_err_t err;
|
||||
- grub_uint8_t etherhdr_size;
|
||||
- grub_uint16_t vlantag_id = grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER);
|
||||
- grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER;
|
||||
+ grub_uint32_t vlantag = 0;
|
||||
+ grub_uint8_t hw_addr_len = inf->card->default_address.len;
|
||||
+ grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2;
|
||||
|
|
@ -490,7 +487,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
if (!inf->card->opened)
|
||||
{
|
||||
err = GRUB_ERR_NONE;
|
||||
@@ -85,19 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
@@ -85,18 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
inf->card->opened = 1;
|
||||
}
|
||||
|
||||
|
|
@ -502,15 +499,14 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
- (char *) nb->data + etherhdr_size - 6, 2);
|
||||
-
|
||||
- /* Add the tag in the middle */
|
||||
- grub_uint16_t vlan = grub_cpu_to_be16 (inf->vlantag);
|
||||
- grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2);
|
||||
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, &vlan, 2);
|
||||
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2);
|
||||
- }
|
||||
-
|
||||
return inf->card->driver->send (inf->card, nb);
|
||||
}
|
||||
|
||||
@@ -105,31 +98,40 @@ grub_err_t
|
||||
@@ -104,31 +98,40 @@ grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card)
|
||||
{
|
||||
|
|
@ -532,7 +528,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
- /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */
|
||||
- /* longer than the original one. The vlantag id is extracted and the header */
|
||||
- /* is reseted to the original size. */
|
||||
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER))
|
||||
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER)
|
||||
+ hwaddress.type = card->default_address.type;
|
||||
+ hwaddress.len = hw_addr_len;
|
||||
+ grub_memcpy (hwaddress.mac, eth, hw_addr_len);
|
||||
|
|
@ -546,7 +542,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
+ type = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
|
||||
+ if (type == VLANTAG_IDENTIFIER)
|
||||
{
|
||||
- vlantag = grub_be_to_cpu16 (grub_get_unaligned16 (nb->data + etherhdr_size));
|
||||
- vlantag = grub_get_unaligned16 (nb->data + etherhdr_size);
|
||||
+ /* Skip vlan tag */
|
||||
+ eth += 2;
|
||||
+ vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
|
||||
|
|
@ -563,7 +559,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
err = grub_netbuff_pull (nb, etherhdr_size);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -149,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
@@ -148,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -576,7 +572,7 @@ index 707bbb12cb2..1441a1bacff 100644
|
|||
{
|
||||
/* ARP packet. */
|
||||
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
|
||||
index 9a8c4511285..5924fd53aca 100644
|
||||
index 2cbd95dce25..56a3ec5c8e8 100644
|
||||
--- a/grub-core/net/icmp6.c
|
||||
+++ b/grub-core/net/icmp6.c
|
||||
@@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
|
||||
|
|
@ -616,10 +612,10 @@ index 9a8c4511285..5924fd53aca 100644
|
|||
}
|
||||
if (ohdr->type == OPTION_PREFIX && ohdr->len == 4)
|
||||
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
|
||||
index f967618e53f..3c475762cc0 100644
|
||||
index ea5edf8f1f6..a5896f6dc26 100644
|
||||
--- a/grub-core/net/ip.c
|
||||
+++ b/grub-core/net/ip.c
|
||||
@@ -316,8 +316,8 @@ handle_dgram (struct grub_net_buff *nb,
|
||||
@@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb,
|
||||
if (inf->card == card
|
||||
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
|
||||
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
||||
|
|
@ -631,7 +627,7 @@ index f967618e53f..3c475762cc0 100644
|
|||
grub_net_process_dhcp (nb, inf);
|
||||
grub_netbuff_free (nb);
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index 20c55257647..fa6b6537142 100644
|
||||
index 22f2689aaeb..a46f82362ed 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
|
||||
|
|
@ -654,7 +650,7 @@ index 20c55257647..fa6b6537142 100644
|
|||
hw_addr->mac[0] = 0x33;
|
||||
hw_addr->mac[1] = 0x33;
|
||||
hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff);
|
||||
@@ -772,23 +774,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
|
||||
@@ -762,23 +764,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
|
||||
void
|
||||
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
|
||||
{
|
||||
|
|
@ -692,8 +688,8 @@ index 20c55257647..fa6b6537142 100644
|
|||
- grub_printf (_("Unsupported hw address type %d\n"), addr->type);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -813,13 +815,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||
int
|
||||
@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||
return -1;
|
||||
if (a->type > b->type)
|
||||
return +1;
|
||||
|
|
@ -717,7 +713,7 @@ index 20c55257647..fa6b6537142 100644
|
|||
|
||||
int
|
||||
diff --git a/include/grub/net.h b/include/grub/net.h
|
||||
index ff901b96e22..1d76fd9a1f5 100644
|
||||
index 8a05ec4fe7a..af0404db7e3 100644
|
||||
--- a/include/grub/net.h
|
||||
+++ b/include/grub/net.h
|
||||
@@ -29,7 +29,8 @@
|
||||
|
|
@ -732,7 +728,7 @@ index ff901b96e22..1d76fd9a1f5 100644
|
|||
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
|
||||
@@ -42,15 +43,17 @@ enum
|
||||
|
||||
typedef enum grub_link_level_protocol_id
|
||||
typedef enum grub_link_level_protocol_id
|
||||
{
|
||||
- GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
||||
+ /* IANA ARP constant to define hardware type. */
|
||||
|
|
@ -750,7 +746,7 @@ index ff901b96e22..1d76fd9a1f5 100644
|
|||
};
|
||||
} grub_net_link_level_address_t;
|
||||
|
||||
@@ -588,11 +591,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
|
||||
@@ -566,11 +569,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")
|
||||
|
||||
/*
|
||||
|
|
@ -766,5 +762,5 @@ index ff901b96e22..1d76fd9a1f5 100644
|
|||
+ "XX:XX:XX:XX:XX:XX:XX:XX:"\
|
||||
+ "XX:XX:XX:XX:XX:XX:XX:XX"))
|
||||
|
||||
/* Max VLAN id = 4094 */
|
||||
#define GRUB_NET_MAX_STR_VLAN_LEN (sizeof ("vlanXXXX"))
|
||||
void
|
||||
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
|
||||
270
0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
Normal file
270
0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
Normal file
|
|
@ -0,0 +1,270 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Miller <aaronmiller@fb.com>
|
||||
Date: Fri, 29 Jul 2016 17:41:38 +0800
|
||||
Subject: [PATCH] net: read bracketed ipv6 addrs and port numbers
|
||||
|
||||
Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses
|
||||
to be recognized with brackets around them, which is required to specify a port
|
||||
number
|
||||
|
||||
Signed-off-by: Aaron Miller <aaronmiller@fb.com>
|
||||
[pjones: various bug fixes]
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/net/http.c | 25 ++++++++++++---
|
||||
grub-core/net/net.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
grub-core/net/tftp.c | 8 +++--
|
||||
include/grub/net.h | 1 +
|
||||
4 files changed, 109 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
|
||||
index b616cf40b1e..12a2632ea55 100644
|
||||
--- a/grub-core/net/http.c
|
||||
+++ b/grub-core/net/http.c
|
||||
@@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
|
||||
nb2 = grub_netbuff_alloc (data->chunk_rem);
|
||||
if (!nb2)
|
||||
return grub_errno;
|
||||
- grub_netbuff_put (nb2, data->chunk_rem);
|
||||
+ err = grub_netbuff_put (nb2, data->chunk_rem);
|
||||
+ if (err)
|
||||
+ return grub_errno;
|
||||
grub_memcpy (nb2->data, nb->data, data->chunk_rem);
|
||||
if (file->device->net->packs.count >= 20)
|
||||
{
|
||||
@@ -312,12 +314,14 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
int i;
|
||||
struct grub_net_buff *nb;
|
||||
grub_err_t err;
|
||||
+ char* server = file->device->net->server;
|
||||
+ int port = file->device->net->port;
|
||||
|
||||
nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE
|
||||
+ sizeof ("GET ") - 1
|
||||
+ grub_strlen (data->filename)
|
||||
+ sizeof (" HTTP/1.1\r\nHost: ") - 1
|
||||
- + grub_strlen (file->device->net->server)
|
||||
+ + grub_strlen (server) + sizeof (":XXXXXXXXXX")
|
||||
+ sizeof ("\r\nUser-Agent: " PACKAGE_STRING
|
||||
"\r\n") - 1
|
||||
+ sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX"
|
||||
@@ -356,7 +360,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
sizeof (" HTTP/1.1\r\nHost: ") - 1);
|
||||
|
||||
ptr = nb->tail;
|
||||
- err = grub_netbuff_put (nb, grub_strlen (file->device->net->server));
|
||||
+ err = grub_netbuff_put (nb, grub_strlen (server));
|
||||
if (err)
|
||||
{
|
||||
grub_netbuff_free (nb);
|
||||
@@ -365,6 +369,15 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
grub_memcpy (ptr, file->device->net->server,
|
||||
grub_strlen (file->device->net->server));
|
||||
|
||||
+ if (port)
|
||||
+ {
|
||||
+ ptr = nb->tail;
|
||||
+ grub_snprintf ((char *) ptr,
|
||||
+ sizeof (":XXXXXXXXXX"),
|
||||
+ ":%d",
|
||||
+ port);
|
||||
+ }
|
||||
+
|
||||
ptr = nb->tail;
|
||||
err = grub_netbuff_put (nb,
|
||||
sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n")
|
||||
@@ -390,8 +403,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
grub_netbuff_put (nb, 2);
|
||||
grub_memcpy (ptr, "\r\n", 2);
|
||||
|
||||
- data->sock = grub_net_tcp_open (file->device->net->server,
|
||||
- HTTP_PORT, http_receive,
|
||||
+ grub_dprintf ("http", "opening path %s on host %s TCP port %d\n",
|
||||
+ data->filename, server, port ? port : HTTP_PORT);
|
||||
+ data->sock = grub_net_tcp_open (server,
|
||||
+ port ? port : HTTP_PORT, http_receive,
|
||||
http_err, NULL,
|
||||
file);
|
||||
if (!data->sock)
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index a46f82362ed..0ce5e675ed7 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
||||
grub_uint16_t newip[8];
|
||||
const char *ptr = val;
|
||||
int word, quaddot = -1;
|
||||
+ int bracketed = 0;
|
||||
+
|
||||
+ if (ptr[0] == '[')
|
||||
+ {
|
||||
+ bracketed = 1;
|
||||
+ ptr++;
|
||||
+ }
|
||||
|
||||
if (ptr[0] == ':' && ptr[1] != ':')
|
||||
return 0;
|
||||
@@ -482,6 +489,8 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
||||
grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0]));
|
||||
}
|
||||
grub_memcpy (ip, newip, 16);
|
||||
+ if (bracketed && *ptr == ']')
|
||||
+ ptr++;
|
||||
if (rest)
|
||||
*rest = ptr;
|
||||
return 1;
|
||||
@@ -1343,8 +1352,10 @@ grub_net_open_real (const char *name)
|
||||
{
|
||||
grub_net_app_level_t proto;
|
||||
const char *protname, *server;
|
||||
+ char *host;
|
||||
grub_size_t protnamelen;
|
||||
int try;
|
||||
+ int port = 0;
|
||||
|
||||
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
|
||||
{
|
||||
@@ -1382,6 +1393,72 @@ grub_net_open_real (const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ char* port_start;
|
||||
+ /* ipv6 or port specified? */
|
||||
+ if ((port_start = grub_strchr (server, ':')))
|
||||
+ {
|
||||
+ char* ipv6_begin;
|
||||
+ if((ipv6_begin = grub_strchr (server, '[')))
|
||||
+ {
|
||||
+ char* ipv6_end = grub_strchr (server, ']');
|
||||
+ if(!ipv6_end)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
||||
+ N_("mismatched [ in address"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ /* port number after bracketed ipv6 addr */
|
||||
+ if(ipv6_end[1] == ':')
|
||||
+ {
|
||||
+ port = grub_strtoul (ipv6_end + 2, NULL, 10);
|
||||
+ if(port > 65535)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
||||
+ N_("bad port number"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (grub_strchr (port_start + 1, ':'))
|
||||
+ {
|
||||
+ int iplen = grub_strlen (server);
|
||||
+ /* bracket bare ipv6 addrs */
|
||||
+ host = grub_malloc (iplen + 3);
|
||||
+ if(!host)
|
||||
+ {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ host[0] = '[';
|
||||
+ grub_memcpy (host + 1, server, iplen);
|
||||
+ host[iplen + 1] = ']';
|
||||
+ host[iplen + 2] = '\0';
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* hostname:port or ipv4:port */
|
||||
+ port = grub_strtol (port_start + 1, NULL, 10);
|
||||
+ if(port > 65535)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
||||
+ N_("bad port number"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ host = grub_strndup (server, port_start - server);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ host = grub_strdup (server);
|
||||
+ }
|
||||
+ if (!host)
|
||||
+ {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
for (try = 0; try < 2; try++)
|
||||
{
|
||||
FOR_NET_APP_LEVEL (proto)
|
||||
@@ -1391,14 +1468,13 @@ grub_net_open_real (const char *name)
|
||||
{
|
||||
grub_net_t ret = grub_zalloc (sizeof (*ret));
|
||||
if (!ret)
|
||||
- return NULL;
|
||||
- ret->protocol = proto;
|
||||
- ret->server = grub_strdup (server);
|
||||
- if (!ret->server)
|
||||
{
|
||||
- grub_free (ret);
|
||||
+ grub_free (host);
|
||||
return NULL;
|
||||
}
|
||||
+ ret->protocol = proto;
|
||||
+ ret->port = port;
|
||||
+ ret->server = host;
|
||||
ret->fs = &grub_net_fs;
|
||||
return ret;
|
||||
}
|
||||
@@ -1473,6 +1549,7 @@ grub_net_open_real (const char *name)
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"),
|
||||
name);
|
||||
|
||||
+ grub_free (host);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 4ab2f5c7357..d54b13f09ff 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
grub_err_t err;
|
||||
grub_uint8_t *nbd;
|
||||
grub_net_network_level_address_t addr;
|
||||
+ int port = file->device->net->port;
|
||||
|
||||
data = grub_zalloc (sizeof (*data));
|
||||
if (!data)
|
||||
@@ -362,14 +363,17 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
- grub_dprintf("tftp", "Address resolution failed: %d\n", err);
|
||||
+ grub_dprintf ("tftp", "Address resolution failed: %d\n", err);
|
||||
+ grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n",
|
||||
+ (unsigned long long)data->file_size,
|
||||
+ (unsigned long long)data->block_size);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
|
||||
grub_dprintf("tftp", "opening connection\n");
|
||||
data->sock = grub_net_udp_open (addr,
|
||||
- TFTP_SERVER_PORT, tftp_receive,
|
||||
+ port ? port : TFTP_SERVER_PORT, tftp_receive,
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
diff --git a/include/grub/net.h b/include/grub/net.h
|
||||
index af0404db7e3..d55d505a03a 100644
|
||||
--- a/include/grub/net.h
|
||||
+++ b/include/grub/net.h
|
||||
@@ -273,6 +273,7 @@ typedef struct grub_net
|
||||
{
|
||||
char *server;
|
||||
char *name;
|
||||
+ int port;
|
||||
grub_net_app_level_t protocol;
|
||||
grub_net_packets_t packs;
|
||||
grub_off_t offset;
|
||||
|
|
@ -12,14 +12,14 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
|||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------
|
||||
grub-core/net/drivers/efi/efinet.c | 18 +-
|
||||
grub-core/net/drivers/efi/efinet.c | 20 +-
|
||||
grub-core/net/ip.c | 39 ++
|
||||
include/grub/efi/api.h | 2 +-
|
||||
include/grub/net.h | 91 ++--
|
||||
5 files changed, 1001 insertions(+), 208 deletions(-)
|
||||
5 files changed, 1002 insertions(+), 209 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
|
||||
index 02d2c2614cb..e0aec25233d 100644
|
||||
index dd5c8d04da9..68c4df681b5 100644
|
||||
--- a/grub-core/net/bootp.c
|
||||
+++ b/grub-core/net/bootp.c
|
||||
@@ -24,6 +24,98 @@
|
||||
|
|
@ -121,7 +121,7 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
|
||||
struct grub_dhcp_discover_options
|
||||
{
|
||||
@@ -610,6 +702,584 @@ out:
|
||||
@@ -604,6 +696,584 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
+ grub_dhcp6_session_t se;
|
||||
+ struct grub_datetime date;
|
||||
+ grub_err_t err;
|
||||
+ grub_int64_t t = 0;
|
||||
+ grub_int32_t t = 0;
|
||||
+
|
||||
+ se = grub_malloc (sizeof (*se));
|
||||
+
|
||||
|
|
@ -706,7 +706,7 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
/*
|
||||
* This is called directly from net/ip.c:handle_dgram(), because those
|
||||
* BOOTP/DHCP packets are a bit special due to their improper
|
||||
@@ -678,6 +1348,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||
@@ -672,6 +1342,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
static grub_err_t
|
||||
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
@@ -903,180 +1644,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
|
||||
@@ -897,180 +1638,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1119,7 +1119,7 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
|
||||
void
|
||||
grub_bootp_init (void)
|
||||
@@ -1090,11 +1825,15 @@ grub_bootp_init (void)
|
||||
@@ -1084,11 +1819,15 @@ grub_bootp_init (void)
|
||||
cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt,
|
||||
N_("VAR INTERFACE NUMBER DESCRIPTION"),
|
||||
N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value."));
|
||||
|
|
@ -1136,10 +1136,10 @@ index 02d2c2614cb..e0aec25233d 100644
|
|||
grub_unregister_command (cmd_bootp);
|
||||
grub_unregister_command (cmd_dhcp);
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 2af8742f904..3e2432fb61c 100644
|
||||
index a673bea807a..8e25680db0c 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -410,9 +410,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
pxe_mode = pxe->mode;
|
||||
if (pxe_mode->using_ipv6)
|
||||
{
|
||||
|
|
@ -1149,7 +1149,7 @@ index 2af8742f904..3e2432fb61c 100644
|
|||
grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
|
||||
grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
|
||||
pxe_mode->dhcp_ack_received ? "yes" : "no",
|
||||
@@ -420,14 +417,13 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -403,15 +400,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
if (!pxe_mode->dhcp_ack_received)
|
||||
continue;
|
||||
|
||||
|
|
@ -1158,24 +1158,26 @@ index 2af8742f904..3e2432fb61c 100644
|
|||
- card->efi_net->mode->current_address,
|
||||
- sizeof (hwaddr.mac));
|
||||
-
|
||||
- inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
|
||||
- intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
|
||||
- (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
|
||||
- 1, device, path);
|
||||
+ inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
|
||||
+ (struct grub_net_dhcp6_packet *)
|
||||
+ &pxe_mode->dhcp_ack,
|
||||
+ sizeof (pxe_mode->dhcp_ack),
|
||||
+ 1, device, path);
|
||||
- if (intf && device && path)
|
||||
+ grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
|
||||
+ (struct grub_net_dhcp6_packet *)
|
||||
+ &pxe_mode->dhcp_ack,
|
||||
+ sizeof (pxe_mode->dhcp_ack),
|
||||
+ 1, device, path);
|
||||
+ if (grub_errno)
|
||||
+ grub_print_error ();
|
||||
if (inter && device && path)
|
||||
+ if (device && path)
|
||||
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
||||
}
|
||||
else
|
||||
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
|
||||
index 3c3d0be0e57..f967618e53f 100644
|
||||
index a5896f6dc26..ce6bdc75c6d 100644
|
||||
--- a/grub-core/net/ip.c
|
||||
+++ b/grub-core/net/ip.c
|
||||
@@ -240,6 +240,45 @@ handle_dgram (struct grub_net_buff *nb,
|
||||
@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb,
|
||||
{
|
||||
struct udphdr *udph;
|
||||
udph = (struct udphdr *) nb->data;
|
||||
|
|
@ -1222,10 +1224,10 @@ index 3c3d0be0e57..f967618e53f 100644
|
|||
{
|
||||
const struct grub_net_bootp_packet *bootp;
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index c6d702831f7..c1b869db520 100644
|
||||
index 99628801478..7614b58dca8 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -1570,7 +1570,7 @@ typedef struct grub_efi_pxe_ip_filter
|
||||
@@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter
|
||||
{
|
||||
grub_efi_uint8_t filters;
|
||||
grub_efi_uint8_t ip_count;
|
||||
|
|
@ -1235,10 +1237,10 @@ index c6d702831f7..c1b869db520 100644
|
|||
} grub_efi_pxe_ip_filter_t;
|
||||
|
||||
diff --git a/include/grub/net.h b/include/grub/net.h
|
||||
index bf8430a6364..ff901b96e22 100644
|
||||
index d55d505a03a..543251f7273 100644
|
||||
--- a/include/grub/net.h
|
||||
+++ b/include/grub/net.h
|
||||
@@ -450,50 +450,65 @@ struct grub_net_bootp_packet
|
||||
@@ -451,50 +451,65 @@ struct grub_net_bootp_packet
|
||||
grub_uint8_t vendor[0];
|
||||
} GRUB_PACKED;
|
||||
|
||||
|
|
@ -1334,7 +1336,7 @@ index bf8430a6364..ff901b96e22 100644
|
|||
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
|
||||
@@ -531,12 +546,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
@@ -532,12 +547,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
int is_def, char **device, char **path);
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
|
|
@ -1353,7 +1355,7 @@ index bf8430a6364..ff901b96e22 100644
|
|||
|
||||
int
|
||||
grub_ipv6_get_masksize(grub_uint16_t *mask);
|
||||
@@ -553,6 +568,10 @@ void
|
||||
@@ -554,6 +569,10 @@ void
|
||||
grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *iface);
|
||||
|
||||
|
|
@ -15,12 +15,12 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
|||
2 files changed, 46 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 7deb0a32efd..92bb7444782 100644
|
||||
index 8e25680db0c..014e5bf9802 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -430,6 +430,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
grub_print_error ();
|
||||
if (inter && device && path)
|
||||
if (device && path)
|
||||
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
||||
+ if (grub_errno)
|
||||
+ grub_print_error ();
|
||||
|
|
@ -28,10 +28,10 @@ index 7deb0a32efd..92bb7444782 100644
|
|||
else
|
||||
{
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index daa9268fdaa..53f5c781ac3 100644
|
||||
index 7614b58dca8..91ab528e4d0 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -1571,31 +1571,6 @@ typedef union
|
||||
@@ -1524,31 +1524,6 @@ typedef union
|
||||
grub_efi_pxe_dhcpv6_packet_t dhcpv6;
|
||||
} grub_efi_pxe_packet_t;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ index daa9268fdaa..53f5c781ac3 100644
|
|||
typedef struct grub_efi_pxe_icmp_error
|
||||
{
|
||||
grub_efi_uint8_t type;
|
||||
@@ -1621,6 +1596,48 @@ typedef struct grub_efi_pxe_tftp_error
|
||||
@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error
|
||||
grub_efi_char8_t error_string[127];
|
||||
} grub_efi_pxe_tftp_error_t;
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ index daa9268fdaa..53f5c781ac3 100644
|
|||
typedef struct grub_efi_pxe_mode
|
||||
{
|
||||
grub_efi_boolean_t started;
|
||||
@@ -1652,9 +1669,9 @@ typedef struct grub_efi_pxe_mode
|
||||
@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode
|
||||
grub_efi_pxe_packet_t pxe_bis_reply;
|
||||
grub_efi_pxe_ip_filter_t ip_filter;
|
||||
grub_efi_uint32_t arp_cache_entries;
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 11 Jul 2019 18:03:25 +0200
|
||||
Subject: [PATCH] Attempt to fix up all the places -Wsign-compare=error finds.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/kern/emu/misc.c | 2 +-
|
||||
grub-core/lib/reed_solomon.c | 4 ++--
|
||||
grub-core/osdep/linux/blocklist.c | 2 +-
|
||||
grub-core/osdep/linux/getroot.c | 2 +-
|
||||
util/grub-fstest.c | 2 +-
|
||||
util/grub-menulst2cfg.c | 2 +-
|
||||
util/grub-mkfont.c | 13 +++++++------
|
||||
util/grub-probe.c | 2 +-
|
||||
util/setup.c | 2 +-
|
||||
9 files changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 16c79bc9488..d145e5796b3 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path)
|
||||
sz = ftello (f);
|
||||
if (sz < 0)
|
||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
||||
- if (sz != (size_t) sz)
|
||||
+ if (sz > (off_t)(GRUB_SIZE_MAX >> 1))
|
||||
grub_util_error (_("file `%s' is too big"), path);
|
||||
ret = (size_t) sz;
|
||||
|
||||
diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c
|
||||
index 562bd2e3e3f..5fee7f2a1a4 100644
|
||||
--- a/grub-core/lib/reed_solomon.c
|
||||
+++ b/grub-core/lib/reed_solomon.c
|
||||
@@ -162,7 +162,7 @@ static void
|
||||
rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs)
|
||||
{
|
||||
gf_single_t *rs_polynomial;
|
||||
- int i, j;
|
||||
+ unsigned int i, j;
|
||||
gf_single_t *m;
|
||||
m = xcalloc (s + rs, sizeof (gf_single_t));
|
||||
grub_memcpy (m, data, s * sizeof (gf_single_t));
|
||||
@@ -333,7 +333,7 @@ static void
|
||||
encode_block (gf_single_t *ptr, grub_size_t s,
|
||||
gf_single_t *rptr, grub_size_t rs)
|
||||
{
|
||||
- int i, j;
|
||||
+ unsigned int i, j;
|
||||
for (i = 0; i < SECTOR_SIZE; i++)
|
||||
{
|
||||
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c
|
||||
index 2efee2c2aee..902cfee53ae 100644
|
||||
--- a/grub-core/osdep/linux/blocklist.c
|
||||
+++ b/grub-core/osdep/linux/blocklist.c
|
||||
@@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
|
||||
else
|
||||
{
|
||||
struct fiemap *fie2;
|
||||
- int i;
|
||||
+ unsigned int i;
|
||||
fie2 = xmalloc (sizeof (*fie2)
|
||||
+ fie1.fm_mapped_extents
|
||||
* sizeof (fie1.fm_extents[1]));
|
||||
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
|
||||
index 74a48c03026..477fb420992 100644
|
||||
--- a/grub-core/osdep/linux/getroot.c
|
||||
+++ b/grub-core/osdep/linux/getroot.c
|
||||
@@ -233,7 +233,7 @@ grub_find_root_devices_from_btrfs (const char *dir)
|
||||
{
|
||||
int fd;
|
||||
struct btrfs_ioctl_fs_info_args fsi;
|
||||
- int i, j = 0;
|
||||
+ unsigned int i, j = 0;
|
||||
char **ret;
|
||||
|
||||
fd = open (dir, 0);
|
||||
diff --git a/util/grub-fstest.c b/util/grub-fstest.c
|
||||
index 25ae52ab6f4..982ce9ed7d8 100644
|
||||
--- a/util/grub-fstest.c
|
||||
+++ b/util/grub-fstest.c
|
||||
@@ -329,7 +329,7 @@ cmd_cmp (char *src, char *dest)
|
||||
read_file (src, cmp_hook, ff);
|
||||
|
||||
{
|
||||
- grub_uint64_t pre;
|
||||
+ long long pre;
|
||||
pre = ftell (ff);
|
||||
fseek (ff, 0, SEEK_END);
|
||||
if (pre != ftell (ff))
|
||||
diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c
|
||||
index b80e15cc36e..1ea2a86e129 100644
|
||||
--- a/util/grub-menulst2cfg.c
|
||||
+++ b/util/grub-menulst2cfg.c
|
||||
@@ -34,7 +34,7 @@ main (int argc, char **argv)
|
||||
char *buf = NULL;
|
||||
size_t bufsize = 0;
|
||||
char *suffix = xstrdup ("");
|
||||
- int suffixlen = 0;
|
||||
+ size_t suffixlen = 0;
|
||||
const char *out_fname = 0;
|
||||
|
||||
grub_util_host_init (&argc, &argv);
|
||||
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
|
||||
index 7624d7808b7..e8a914021b2 100644
|
||||
--- a/util/grub-mkfont.c
|
||||
+++ b/util/grub-mkfont.c
|
||||
@@ -143,7 +143,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
|
||||
int width, height;
|
||||
int cuttop, cutbottom, cutleft, cutright;
|
||||
grub_uint8_t *data;
|
||||
- int mask, i, j, bitmap_size;
|
||||
+ int mask, i, bitmap_size;
|
||||
+ unsigned int j;
|
||||
FT_GlyphSlot glyph;
|
||||
int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME;
|
||||
FT_Error err;
|
||||
@@ -188,7 +189,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
|
||||
cuttop = cutbottom = cutleft = cutright = 0;
|
||||
else
|
||||
{
|
||||
- for (cuttop = 0; cuttop < glyph->bitmap.rows; cuttop++)
|
||||
+ for (cuttop = 0; cuttop < (long)glyph->bitmap.rows; cuttop++)
|
||||
{
|
||||
for (j = 0; j < glyph->bitmap.width; j++)
|
||||
if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch]
|
||||
@@ -208,10 +209,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
|
||||
break;
|
||||
}
|
||||
cutbottom = glyph->bitmap.rows - 1 - cutbottom;
|
||||
- if (cutbottom + cuttop >= glyph->bitmap.rows)
|
||||
+ if (cutbottom + cuttop >= (long)glyph->bitmap.rows)
|
||||
cutbottom = 0;
|
||||
|
||||
- for (cutleft = 0; cutleft < glyph->bitmap.width; cutleft++)
|
||||
+ for (cutleft = 0; cutleft < (long)glyph->bitmap.width; cutleft++)
|
||||
{
|
||||
for (j = 0; j < glyph->bitmap.rows; j++)
|
||||
if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch]
|
||||
@@ -230,7 +231,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
|
||||
break;
|
||||
}
|
||||
cutright = glyph->bitmap.width - 1 - cutright;
|
||||
- if (cutright + cutleft >= glyph->bitmap.width)
|
||||
+ if (cutright + cutleft >= (long)glyph->bitmap.width)
|
||||
cutright = 0;
|
||||
}
|
||||
|
||||
@@ -267,7 +268,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
|
||||
|
||||
mask = 0;
|
||||
data = &glyph_info->bitmap[0] - 1;
|
||||
- for (j = cuttop; j < height + cuttop; j++)
|
||||
+ for (j = cuttop; j < (long)height + cuttop; j++)
|
||||
for (i = cutleft; i < width + cutleft; i++)
|
||||
add_pixel (&data, &mask,
|
||||
glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] &
|
||||
diff --git a/util/grub-probe.c b/util/grub-probe.c
|
||||
index 65c1ca3f8b6..08ae915e8d7 100644
|
||||
--- a/util/grub-probe.c
|
||||
+++ b/util/grub-probe.c
|
||||
@@ -799,7 +799,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
||||
|
||||
case 't':
|
||||
{
|
||||
- int i;
|
||||
+ unsigned int i;
|
||||
|
||||
for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++)
|
||||
if (strcmp (arg, targets[i]) == 0)
|
||||
diff --git a/util/setup.c b/util/setup.c
|
||||
index 87a889ff7e3..7aab468b0eb 100644
|
||||
--- a/util/setup.c
|
||||
+++ b/util/setup.c
|
||||
@@ -406,7 +406,7 @@ SETUP (const char *dir,
|
||||
int is_ldm;
|
||||
grub_err_t err;
|
||||
grub_disk_addr_t *sectors;
|
||||
- int i;
|
||||
+ unsigned int i;
|
||||
grub_fs_t fs;
|
||||
unsigned int nsec, maxsec;
|
||||
|
||||
|
|
@ -12,10 +12,10 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
|||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index c30701b4e1f..44c4e665a0d 100644
|
||||
index aa3a7de9d4f..67bf8523ccb 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -5955,6 +5955,7 @@ Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
@@ -5484,6 +5484,7 @@ This command is only available on AArch64 systems.
|
||||
* net_add_dns:: Add a DNS server
|
||||
* net_add_route:: Add routing entry
|
||||
* net_bootp:: Perform a bootp/DHCP autoconfiguration
|
||||
|
|
@ -23,7 +23,7 @@ index c30701b4e1f..44c4e665a0d 100644
|
|||
* net_del_addr:: Remove IP address from interface
|
||||
* net_del_dns:: Remove a DNS server
|
||||
* net_del_route:: Remove a route entry
|
||||
@@ -6080,6 +6081,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
|
||||
@@ -5608,6 +5609,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
|
||||
|
||||
@end deffn
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
|||
2 files changed, 56 insertions(+)
|
||||
|
||||
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
|
||||
index 76e4c11a46f..f56b293ac72 100644
|
||||
index 68c4df681b5..0b430489329 100644
|
||||
--- a/grub-core/net/bootp.c
|
||||
+++ b/grub-core/net/bootp.c
|
||||
@@ -20,6 +20,7 @@
|
||||
|
|
@ -33,7 +33,7 @@ index 76e4c11a46f..f56b293ac72 100644
|
|||
#include <grub/net/ip.h>
|
||||
#include <grub/net/netbuff.h>
|
||||
#include <grub/net/udp.h>
|
||||
@@ -501,6 +502,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
@@ -500,6 +501,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
||||
if (opt && opt_len)
|
||||
grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len);
|
||||
|
||||
|
|
@ -95,10 +95,10 @@ index 76e4c11a46f..f56b293ac72 100644
|
|||
if (opt && opt_len)
|
||||
grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len);
|
||||
diff --git a/include/grub/net.h b/include/grub/net.h
|
||||
index 1d76fd9a1f5..868c9a2ef29 100644
|
||||
index 543251f7273..42af7de250a 100644
|
||||
--- a/include/grub/net.h
|
||||
+++ b/include/grub/net.h
|
||||
@@ -533,6 +533,7 @@ enum
|
||||
@@ -531,6 +531,7 @@ enum
|
||||
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
|
||||
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
|
||||
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,
|
||||
|
|
@ -27,12 +27,12 @@ the same way it used to be.
|
|||
Signed-off-by: Michael Chang <mchang@suse.com>
|
||||
Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
||||
---
|
||||
grub-core/net/drivers/efi/efinet.c | 286 ++++++++++++++++++++++++++++++++++---
|
||||
grub-core/net/drivers/efi/efinet.c | 284 +++++++++++++++++++++++++++++++++++--
|
||||
include/grub/efi/api.h | 11 ++
|
||||
2 files changed, 281 insertions(+), 16 deletions(-)
|
||||
2 files changed, 280 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index 92bb7444782..eb68de22023 100644
|
||||
index 014e5bf9802..8171ecaa5e4 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -26,6 +26,7 @@
|
||||
|
|
@ -43,7 +43,7 @@ index 92bb7444782..eb68de22023 100644
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -348,6 +349,227 @@ grub_efinet_findcards (void)
|
||||
@@ -331,6 +332,227 @@ grub_efinet_findcards (void)
|
||||
grub_free (handles);
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ index 92bb7444782..eb68de22023 100644
|
|||
static void
|
||||
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
char **path)
|
||||
@@ -367,7 +589,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -346,7 +568,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
{
|
||||
grub_efi_device_path_t *cdp;
|
||||
struct grub_efi_pxe *pxe;
|
||||
|
|
@ -284,7 +284,7 @@ index 92bb7444782..eb68de22023 100644
|
|||
|
||||
if (card->driver != &efidriver)
|
||||
continue;
|
||||
@@ -391,11 +617,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -370,11 +596,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
*/
|
||||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
|
|
@ -307,7 +307,7 @@ index 92bb7444782..eb68de22023 100644
|
|||
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
||||
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
@@ -408,23 +644,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -387,23 +623,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
|
||||
pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
|
|
@ -347,45 +347,38 @@ index 92bb7444782..eb68de22023 100644
|
|||
+ pxe_mode->dhcp_ack_received ? "yes" : "no",
|
||||
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
|
||||
|
||||
inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
|
||||
(struct grub_net_dhcp6_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
+ packet_buf,
|
||||
+ packet_bufsz,
|
||||
1, device, path);
|
||||
grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
|
||||
(struct grub_net_dhcp6_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
+ packet_buf,
|
||||
+ packet_bufsz,
|
||||
1, device, path);
|
||||
if (grub_errno)
|
||||
grub_print_error ();
|
||||
@@ -438,8 +688,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -417,11 +667,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
grub_dprintf ("efinet", "using ipv4 and dhcp\n");
|
||||
inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
(struct grub_net_bootp_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
+ packet_buf,
|
||||
+ packet_bufsz,
|
||||
1, device, path);
|
||||
|
||||
grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||
(struct grub_net_bootp_packet *)
|
||||
- &pxe_mode->dhcp_ack,
|
||||
- sizeof (pxe_mode->dhcp_ack),
|
||||
+ packet_buf,
|
||||
+ packet_bufsz,
|
||||
1, device, path);
|
||||
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
||||
@@ -465,8 +715,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
|
||||
}
|
||||
}
|
||||
- return;
|
||||
}
|
||||
+
|
||||
+ if (nb)
|
||||
+ grub_netbuff_free (nb);
|
||||
+
|
||||
+ return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index 53f5c781ac3..fa528e73a27 100644
|
||||
index 91ab528e4d0..4a51667adb1 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -891,6 +891,8 @@ struct grub_efi_ipv4_device_path
|
||||
@@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path
|
||||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
|
|
@ -394,9 +387,9 @@ index 53f5c781ac3..fa528e73a27 100644
|
|||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
||||
|
||||
@@ -954,6 +956,15 @@ struct grub_efi_vlan_device_path
|
||||
@@ -918,6 +920,15 @@ struct grub_efi_sata_device_path
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_vlan_device_path grub_efi_vlan_device_path_t;
|
||||
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
|
||||
|
||||
+#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24
|
||||
+
|
||||
|
|
@ -29,34 +29,34 @@ Signed-off-by: Michael Chang <mchang@suse.com>
|
|||
Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
||||
---
|
||||
grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++
|
||||
include/grub/efi/api.h | 76 +++++++++++++++++
|
||||
2 files changed, 239 insertions(+)
|
||||
include/grub/efi/api.h | 75 +++++++++++++++++
|
||||
2 files changed, 238 insertions(+)
|
||||
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index eb68de22023..a91df09ee6d 100644
|
||||
index 8171ecaa5e4..715a6168d77 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
/* GUID. */
|
||||
static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
|
||||
static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
||||
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
||||
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
||||
static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
|
||||
static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
||||
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
||||
|
||||
static grub_err_t
|
||||
send_card_buffer (struct grub_net_card *dev,
|
||||
@@ -349,6 +351,125 @@ grub_efinet_findcards (void)
|
||||
@@ -332,6 +334,125 @@ grub_efinet_findcards (void)
|
||||
grub_free (handles);
|
||||
}
|
||||
|
||||
+static grub_efi_handle_t
|
||||
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
|
||||
+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
|
||||
+ grub_efi_device_path_t **r_device_path)
|
||||
+{
|
||||
+ grub_efi_handle_t handle;
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = grub_efi_system_table->boot_services->locate_device_path(
|
||||
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
|
||||
+ protocol, &device_path, &handle);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -92,9 +92,9 @@ index eb68de22023..a91df09ee6d 100644
|
|||
+ if (!addrs)
|
||||
+ return 0;
|
||||
+
|
||||
+ status = conf->get_data(conf,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ status = efi_call_4 (conf->get_data, conf,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+
|
||||
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
||||
+ {
|
||||
|
|
@ -103,9 +103,9 @@ index eb68de22023..a91df09ee6d 100644
|
|||
+ if (!addrs)
|
||||
+ return 0;
|
||||
+
|
||||
+ status = conf->get_data(conf,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ status = efi_call_4 (conf->get_data, conf,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ }
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -142,9 +142,9 @@ index eb68de22023..a91df09ee6d 100644
|
|||
+ if (!addrs)
|
||||
+ return 0;
|
||||
+
|
||||
+ status = conf->get_data(conf,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ status = efi_call_4 (conf->get_data, conf,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+
|
||||
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
||||
+ {
|
||||
|
|
@ -153,9 +153,9 @@ index eb68de22023..a91df09ee6d 100644
|
|||
+ if (!addrs)
|
||||
+ return 0;
|
||||
+
|
||||
+ status = conf->get_data(conf,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ status = efi_call_4 (conf->get_data, conf,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
||||
+ &data_size, addrs);
|
||||
+ }
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -171,7 +171,7 @@ index eb68de22023..a91df09ee6d 100644
|
|||
static struct grub_net_buff *
|
||||
grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6)
|
||||
{
|
||||
@@ -407,6 +528,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
@@ -390,6 +511,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp;
|
||||
struct grub_net_bootp_packet *bp;
|
||||
grub_uint8_t *ptr;
|
||||
|
|
@ -180,7 +180,7 @@ index eb68de22023..a91df09ee6d 100644
|
|||
|
||||
bp = (struct grub_net_bootp_packet *) nb->tail;
|
||||
err = grub_netbuff_put (nb, sizeof (*bp) + 4);
|
||||
@@ -468,6 +591,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
@@ -451,6 +574,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
*ptr++ = sizeof ("HTTPClient") - 1;
|
||||
grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1);
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ index eb68de22023..a91df09ee6d 100644
|
|||
ptr = nb->tail;
|
||||
err = grub_netbuff_put (nb, 1);
|
||||
if (err)
|
||||
@@ -500,6 +642,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
@@ -483,6 +625,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
struct grub_net_dhcp6_option *opt;
|
||||
struct grub_net_dhcp6_option_iana *iana;
|
||||
struct grub_net_dhcp6_option_iaaddr *iaaddr;
|
||||
|
|
@ -215,7 +215,7 @@ index eb68de22023..a91df09ee6d 100644
|
|||
|
||||
d6p = (struct grub_net_dhcp6_packet *)nb->tail;
|
||||
err = grub_netbuff_put (nb, sizeof(*d6p));
|
||||
@@ -563,6 +707,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
@@ -546,6 +690,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
opt->len = grub_cpu_to_be16 (uri_len);
|
||||
grub_memcpy (opt->data, uri_dp->uri, uri_len);
|
||||
|
||||
|
|
@ -242,13 +242,14 @@ index eb68de22023..a91df09ee6d 100644
|
|||
}
|
||||
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index fa528e73a27..248d6a28ff9 100644
|
||||
index 4a51667adb1..0b490195ad9 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -369,6 +369,16 @@
|
||||
@@ -352,6 +352,15 @@
|
||||
#define GRUB_EFI_RNG_PROTOCOL_GUID \
|
||||
{ 0x3152bca5, 0xeade, 0x433d, \
|
||||
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
|
||||
}
|
||||
|
||||
+
|
||||
+#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \
|
||||
+ { 0x5b446ed1, 0xe30b, 0x4faa, \
|
||||
+ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
|
||||
|
|
@ -257,14 +258,12 @@ index fa528e73a27..248d6a28ff9 100644
|
|||
+#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \
|
||||
+ { 0x937fe521, 0x95ae, 0x4d1a, \
|
||||
+ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
|
||||
+ }
|
||||
+
|
||||
#define LINUX_EFI_INITRD_MEDIA_GUID \
|
||||
{ 0x5568e427, 0x68fc, 0x4f3d, \
|
||||
{ 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68 } \
|
||||
@@ -1963,6 +1973,72 @@ struct grub_efi_load_file2
|
||||
}
|
||||
|
||||
struct grub_efi_sal_system_table
|
||||
@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol
|
||||
};
|
||||
typedef struct grub_efi_load_file2 grub_efi_load_file2_t;
|
||||
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
|
||||
|
||||
+enum grub_efi_ip4_config2_data_type {
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
||||
|
|
@ -332,6 +331,6 @@ index fa528e73a27..248d6a28ff9 100644
|
|||
+};
|
||||
+typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
|
||||
+
|
||||
struct initrd_media_device_path {
|
||||
grub_efi_vendor_media_device_path_t vendor;
|
||||
grub_efi_device_path_t end;
|
||||
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
||||
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
||||
|| defined(__riscv)
|
||||
|
|
@ -33,18 +33,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
grub-core/net/drivers/efi/efinet.c | 27 +
|
||||
grub-core/net/efi/dhcp.c | 397 ++++++++++
|
||||
grub-core/net/efi/efi_netfs.c | 57 ++
|
||||
grub-core/net/efi/http.c | 410 +++++++++++
|
||||
grub-core/net/efi/http.c | 419 +++++++++++
|
||||
grub-core/net/efi/ip4_config.c | 398 ++++++++++
|
||||
grub-core/net/efi/ip6_config.c | 422 +++++++++++
|
||||
grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++
|
||||
grub-core/net/efi/pxe.c | 424 +++++++++++
|
||||
grub-core/net/net.c | 74 ++
|
||||
util/grub-mknetdir.c | 23 +-
|
||||
include/grub/efi/api.h | 195 ++++-
|
||||
include/grub/efi/api.h | 180 ++++-
|
||||
include/grub/efi/dhcp.h | 343 +++++++++
|
||||
include/grub/efi/http.h | 215 ++++++
|
||||
include/grub/net/efi.h | 144 ++++
|
||||
17 files changed, 4618 insertions(+), 49 deletions(-)
|
||||
17 files changed, 4620 insertions(+), 41 deletions(-)
|
||||
create mode 100644 grub-core/net/efi/dhcp.c
|
||||
create mode 100644 grub-core/net/efi/efi_netfs.c
|
||||
create mode 100644 grub-core/net/efi/http.c
|
||||
|
|
@ -57,10 +57,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|||
create mode 100644 include/grub/net/efi.h
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 6645fbae34f..56eb6a828e8 100644
|
||||
index 4b7c45a7b06..c40170f2dd2 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -2356,6 +2356,12 @@ module = {
|
||||
@@ -2299,6 +2299,12 @@ module = {
|
||||
common = hook/datehook.c;
|
||||
};
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ index 6645fbae34f..56eb6a828e8 100644
|
|||
module = {
|
||||
name = net;
|
||||
common = net/net.c;
|
||||
@@ -2369,6 +2375,12 @@ module = {
|
||||
@@ -2312,6 +2318,12 @@ module = {
|
||||
common = net/ethernet.c;
|
||||
common = net/arp.c;
|
||||
common = net/netbuff.c;
|
||||
|
|
@ -100,10 +100,10 @@ index a458c3aca78..1637731535e 100644
|
|||
if (file->offset + res < next_buf)
|
||||
{
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 2bb8a0e7a38..bf16c4307bc 100644
|
||||
index d6a2fb57789..2a446f5031b 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -775,7 +775,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
@@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
grub_efi_ipv4_device_path_t *ipv4
|
||||
= (grub_efi_ipv4_device_path_t *) dp;
|
||||
|
|
@ -112,7 +112,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
|
|||
(unsigned) ipv4->local_ip_address[0],
|
||||
(unsigned) ipv4->local_ip_address[1],
|
||||
(unsigned) ipv4->local_ip_address[2],
|
||||
@@ -788,33 +788,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
(unsigned) ipv4->remote_port,
|
||||
(unsigned) ipv4->protocol,
|
||||
(unsigned) ipv4->static_ip_address);
|
||||
|
|
@ -190,7 +190,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
|
|||
}
|
||||
break;
|
||||
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
|
||||
@@ -861,6 +888,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
dump_vendor_path ("Messaging",
|
||||
(grub_efi_vendor_device_path_t *) dp);
|
||||
break;
|
||||
|
|
@ -231,7 +231,7 @@ index 2bb8a0e7a38..bf16c4307bc 100644
|
|||
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
|
||||
break;
|
||||
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
||||
index a91df09ee6d..225dc896da0 100644
|
||||
index 715a6168d77..e11d759f19a 100644
|
||||
--- a/grub-core/net/drivers/efi/efinet.c
|
||||
+++ b/grub-core/net/drivers/efi/efinet.c
|
||||
@@ -27,6 +27,7 @@
|
||||
|
|
@ -242,7 +242,7 @@ index a91df09ee6d..225dc896da0 100644
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -508,6 +509,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
@@ -491,6 +492,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
||||
|
||||
ldp = grub_efi_find_last_device_path (ddp);
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ index a91df09ee6d..225dc896da0 100644
|
|||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
||||
@@ -781,6 +793,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -760,6 +772,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE
|
||||
|
|
@ -268,7 +268,7 @@ index a91df09ee6d..225dc896da0 100644
|
|||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
|
||||
continue;
|
||||
dup_dp = grub_efi_duplicate_device_path (dp);
|
||||
@@ -795,6 +808,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
dup_ldp->length = sizeof (*dup_ldp);
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ index a91df09ee6d..225dc896da0 100644
|
|||
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
||||
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
@@ -889,6 +911,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||
|
||||
GRUB_MOD_INIT(efinet)
|
||||
{
|
||||
|
|
@ -294,8 +294,8 @@ index a91df09ee6d..225dc896da0 100644
|
|||
grub_efinet_findcards ();
|
||||
grub_efi_net_config = grub_efi_net_config_real;
|
||||
}
|
||||
@@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet)
|
||||
FOR_NET_CARDS_SAFE (card, next)
|
||||
@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet)
|
||||
FOR_NET_CARDS_SAFE (card, next)
|
||||
if (card->driver == &efidriver)
|
||||
grub_net_card_unregister (card);
|
||||
+
|
||||
|
|
@ -304,7 +304,7 @@ index a91df09ee6d..225dc896da0 100644
|
|||
|
||||
diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c
|
||||
new file mode 100644
|
||||
index 00000000000..ca19902441b
|
||||
index 00000000000..dbef63d8c08
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/dhcp.c
|
||||
@@ -0,0 +1,397 @@
|
||||
|
|
@ -385,7 +385,7 @@ index 00000000000..ca19902441b
|
|||
+ grub_efi_uint32_t option_count = 0;
|
||||
+ grub_efi_uint32_t i;
|
||||
+
|
||||
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, NULL);
|
||||
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL);
|
||||
+
|
||||
+ if (status != GRUB_EFI_BUFFER_TOO_SMALL)
|
||||
+ return NULL;
|
||||
|
|
@ -394,7 +394,7 @@ index 00000000000..ca19902441b
|
|||
+ if (!option_list)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, option_list);
|
||||
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_free (option_list);
|
||||
|
|
@ -443,13 +443,13 @@ index 00000000000..ca19902441b
|
|||
+
|
||||
+ if (!mode->started)
|
||||
+ {
|
||||
+ status = pxe->start(pxe, 0);
|
||||
+ status = efi_call_2 (pxe->start, pxe, 0);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ grub_printf ("Couldn't start PXE\n");
|
||||
+ }
|
||||
+
|
||||
+ status = pxe->dhcp(pxe, 0);
|
||||
+ status = efi_call_2 (pxe->dhcp, pxe, 0);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp4 configure failed, %d\n", (int)status);
|
||||
|
|
@ -500,7 +500,7 @@ index 00000000000..ca19902441b
|
|||
+ config.option_list = &options;
|
||||
+
|
||||
+ /* FIXME: What if the dhcp has bounded */
|
||||
+ status = netdev->dhcp4->configure(netdev->dhcp4, &config);
|
||||
+ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config);
|
||||
+ grub_free (options);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
|
|
@ -508,14 +508,14 @@ index 00000000000..ca19902441b
|
|||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ status = netdev->dhcp4->start(netdev->dhcp4, NULL);
|
||||
+ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp4 start failed, %d\n", (int)status);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ status = netdev->dhcp4->get_mode_data(netdev->dhcp4, &mode);
|
||||
+ status = efi_call_2 (netdev->dhcp4->get_mode_data, netdev->dhcp4, &mode);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
|
||||
|
|
@ -616,21 +616,21 @@ index 00000000000..ca19902441b
|
|||
+ config.rapid_commit = 0;
|
||||
+ config.solicit_retransmission = &retrans;
|
||||
+
|
||||
+ status = dev->dhcp6->configure(dev->dhcp6, &config);
|
||||
+ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config);
|
||||
+ grub_free (opt);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp6 configure failed, %d\n", (int)status);
|
||||
+ continue;
|
||||
+ }
|
||||
+ status = dev->dhcp6->start(dev->dhcp6);
|
||||
+ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp6 start failed, %d\n", (int)status);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ status = dev->dhcp6->get_mode_data(dev->dhcp6, &mode, NULL);
|
||||
+ status = efi_call_3 (dev->dhcp6->get_mode_data, dev->dhcp6, &mode, NULL);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
|
||||
|
|
@ -666,12 +666,12 @@ index 00000000000..ca19902441b
|
|||
+ grub_efi_dhcp6_packet_option_t **options = NULL;
|
||||
+ grub_efi_uint32_t i;
|
||||
+
|
||||
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, NULL);
|
||||
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, NULL);
|
||||
+
|
||||
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL && count)
|
||||
+ {
|
||||
+ options = grub_malloc (count * sizeof(*options));
|
||||
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options);
|
||||
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options);
|
||||
+ }
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -696,8 +696,8 @@ index 00000000000..ca19902441b
|
|||
+ grub_free (options);
|
||||
+ }
|
||||
+
|
||||
+ b->free_pool(mode.client_id);
|
||||
+ b->free_pool(mode.ia);
|
||||
+ efi_call_1 (b->free_pool, mode.client_id);
|
||||
+ efi_call_1 (b->free_pool, mode.ia);
|
||||
+ }
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
|
|
@ -770,10 +770,10 @@ index 00000000000..ef371d885ea
|
|||
+}
|
||||
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
|
||||
new file mode 100644
|
||||
index 00000000000..de28badccb0
|
||||
index 00000000000..3f61fd2fa5b
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/http.c
|
||||
@@ -0,0 +1,410 @@
|
||||
@@ -0,0 +1,419 @@
|
||||
+
|
||||
+#include <grub/efi/api.h>
|
||||
+#include <grub/efi/efi.h>
|
||||
|
|
@ -802,9 +802,9 @@ index 00000000000..de28badccb0
|
|||
+
|
||||
+ http_config.local_address_is_ipv6 = 1;
|
||||
+ sz = sizeof (manual_address);
|
||||
+ status = dev->ip6_config->get_data(dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, &manual_address);
|
||||
+ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, &manual_address);
|
||||
+
|
||||
+ if (status == GRUB_EFI_NOT_FOUND)
|
||||
+ {
|
||||
|
|
@ -834,19 +834,19 @@ index 00000000000..de28badccb0
|
|||
+ http_config.access_point.ipv4_node = &httpv4_node;
|
||||
+ }
|
||||
+
|
||||
+ status = http->configure(http, &http_config);
|
||||
+ status = efi_call_2 (http->configure, http, &http_config);
|
||||
+
|
||||
+ if (status == GRUB_EFI_ALREADY_STARTED)
|
||||
+ {
|
||||
+ /* XXX: This hangs HTTPS boot */
|
||||
+#if 0
|
||||
+ if (http->configure(http, NULL) != GRUB_EFI_SUCCESS)
|
||||
+ if (efi_call_2 (http->configure, http, NULL) != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_IO, N_("couldn't reset http instance"));
|
||||
+ grub_print_error ();
|
||||
+ return;
|
||||
+ }
|
||||
+ status = http->configure(http, &http_config);
|
||||
+ status = efi_call_2 (http->configure, http, &http_config);
|
||||
+#endif
|
||||
+ return;
|
||||
+ }
|
||||
|
|
@ -945,9 +945,12 @@ index 00000000000..de28badccb0
|
|||
+ request_token.message = &request_message;
|
||||
+
|
||||
+ request_callback_done = 0;
|
||||
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_request_callback, NULL,
|
||||
+ &request_token.event);
|
||||
+ status = efi_call_5 (b->create_event,
|
||||
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
||||
+ GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_request_callback,
|
||||
+ NULL,
|
||||
+ &request_token.event);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
|
|
@ -955,17 +958,17 @@ index 00000000000..de28badccb0
|
|||
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
|
||||
+ }
|
||||
+
|
||||
+ status = http->request(http, &request_token);
|
||||
+ status = efi_call_2 (http->request, http, &request_token);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ b->close_event(request_token.event);
|
||||
+ efi_call_1 (b->close_event, request_token.event);
|
||||
+ grub_free (request_data.url);
|
||||
+ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status);
|
||||
+ }
|
||||
+ /* TODO: Add Timeout */
|
||||
+ while (!request_callback_done)
|
||||
+ http->poll(http);
|
||||
+ efi_call_1(http->poll, http);
|
||||
+
|
||||
+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS;
|
||||
+ response_message.data.response = &response_data;
|
||||
|
|
@ -978,13 +981,16 @@ index 00000000000..de28badccb0
|
|||
+ response_message.body = NULL;
|
||||
+ response_token.event = NULL;
|
||||
+
|
||||
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_response_callback, NULL,
|
||||
+ &response_token.event);
|
||||
+ status = efi_call_5 (b->create_event,
|
||||
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
||||
+ GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_response_callback,
|
||||
+ NULL,
|
||||
+ &response_token.event);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ b->close_event(request_token.event);
|
||||
+ efi_call_1 (b->close_event, request_token.event);
|
||||
+ grub_free (request_data.url);
|
||||
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
|
||||
+ }
|
||||
|
|
@ -994,28 +1000,28 @@ index 00000000000..de28badccb0
|
|||
+
|
||||
+ /* wait for HTTP response */
|
||||
+ response_callback_done = 0;
|
||||
+ status = http->response(http, &response_token);
|
||||
+ status = efi_call_2 (http->response, http, &response_token);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ b->close_event(response_token.event);
|
||||
+ b->close_event(request_token.event);
|
||||
+ efi_call_1 (b->close_event, response_token.event);
|
||||
+ efi_call_1 (b->close_event, request_token.event);
|
||||
+ grub_free (request_data.url);
|
||||
+ return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status);
|
||||
+ }
|
||||
+
|
||||
+ /* TODO: Add Timeout */
|
||||
+ while (!response_callback_done)
|
||||
+ http->poll(http);
|
||||
+ efi_call_1 (http->poll, http);
|
||||
+
|
||||
+ if (response_message.data.response->status_code != GRUB_EFI_HTTP_STATUS_200_OK)
|
||||
+ {
|
||||
+ grub_efi_http_status_code_t status_code = response_message.data.response->status_code;
|
||||
+
|
||||
+ if (response_message.headers)
|
||||
+ b->free_pool(response_message.headers);
|
||||
+ b->close_event(response_token.event);
|
||||
+ b->close_event(request_token.event);
|
||||
+ efi_call_1 (b->free_pool, response_message.headers);
|
||||
+ efi_call_1 (b->close_event, response_token.event);
|
||||
+ efi_call_1 (b->close_event, request_token.event);
|
||||
+ grub_free (request_data.url);
|
||||
+ if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND)
|
||||
+ {
|
||||
|
|
@ -1043,9 +1049,9 @@ index 00000000000..de28badccb0
|
|||
+ }
|
||||
+
|
||||
+ if (response_message.headers)
|
||||
+ b->free_pool(response_message.headers);
|
||||
+ b->close_event(response_token.event);
|
||||
+ b->close_event(request_token.event);
|
||||
+ efi_call_1 (b->free_pool, response_message.headers);
|
||||
+ efi_call_1 (b->close_event, response_token.event);
|
||||
+ efi_call_1 (b->close_event, request_token.event);
|
||||
+ grub_free (request_data.url);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
|
|
@ -1070,9 +1076,12 @@ index 00000000000..de28badccb0
|
|||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_response_callback, NULL,
|
||||
+ &response_token.event);
|
||||
+ efi_call_5 (b->create_event,
|
||||
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
||||
+ GRUB_EFI_TPL_CALLBACK,
|
||||
+ grub_efi_http_response_callback,
|
||||
+ NULL,
|
||||
+ &response_token.event);
|
||||
+
|
||||
+ while (len)
|
||||
+ {
|
||||
|
|
@ -1087,23 +1096,23 @@ index 00000000000..de28badccb0
|
|||
+
|
||||
+ response_callback_done = 0;
|
||||
+
|
||||
+ status = http->response(http, &response_token);
|
||||
+ status = efi_call_2 (http->response, http, &response_token);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ b->close_event(response_token.event);
|
||||
+ efi_call_1 (b->close_event, response_token.event);
|
||||
+ grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ while (!response_callback_done)
|
||||
+ http->poll(http);
|
||||
+ efi_call_1(http->poll, http);
|
||||
+
|
||||
+ sum += response_message.body_length;
|
||||
+ buf += response_message.body_length;
|
||||
+ len -= response_message.body_length;
|
||||
+ }
|
||||
+
|
||||
+ b->close_event(response_token.event);
|
||||
+ efi_call_1 (b->close_event, response_token.event);
|
||||
+
|
||||
+ return sum;
|
||||
+}
|
||||
|
|
@ -1186,7 +1195,7 @@ index 00000000000..de28badccb0
|
|||
+ };
|
||||
diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
|
||||
new file mode 100644
|
||||
index 00000000000..1deba25e79e
|
||||
index 00000000000..b711a5d9457
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/ip4_config.c
|
||||
@@ -0,0 +1,398 @@
|
||||
|
|
@ -1296,17 +1305,17 @@ index 00000000000..1deba25e79e
|
|||
+ if (!interface_info)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = ip4_config->get_data(ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+
|
||||
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
||||
+ {
|
||||
+ grub_free (interface_info);
|
||||
+ interface_info = grub_malloc (sz);
|
||||
+ status = ip4_config->get_data(ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+ }
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -1330,9 +1339,9 @@ index 00000000000..1deba25e79e
|
|||
+ if (!manual_address)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = ip4_config->get_data(ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, manual_address);
|
||||
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, manual_address);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
|
|
@ -1537,7 +1546,7 @@ index 00000000000..1deba25e79e
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
||||
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ sizeof(*address), address);
|
||||
+
|
||||
|
|
@ -1553,9 +1562,9 @@ index 00000000000..1deba25e79e
|
|||
+{
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
|
||||
+ sizeof (address->ip4), &address->ip4);
|
||||
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
|
||||
+ sizeof (address->ip4), &address->ip4);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ return 0;
|
||||
|
|
@ -1569,9 +1578,9 @@ index 00000000000..1deba25e79e
|
|||
+{
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ sizeof (address->ip4), &address->ip4);
|
||||
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
||||
+ sizeof (address->ip4), &address->ip4);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ return 0;
|
||||
|
|
@ -1590,7 +1599,7 @@ index 00000000000..1deba25e79e
|
|||
+ };
|
||||
diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
|
||||
new file mode 100644
|
||||
index 00000000000..29a03973265
|
||||
index 00000000000..017c4d05bc7
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/ip6_config.c
|
||||
@@ -0,0 +1,422 @@
|
||||
|
|
@ -1720,7 +1729,7 @@ index 00000000000..29a03973265
|
|||
+ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table);
|
||||
+ interface_info = grub_malloc (sz);
|
||||
+
|
||||
+ status = ip6_config->get_data(ip6_config,
|
||||
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+
|
||||
|
|
@ -1728,7 +1737,7 @@ index 00000000000..29a03973265
|
|||
+ {
|
||||
+ grub_free (interface_info);
|
||||
+ interface_info = grub_malloc (sz);
|
||||
+ status = ip6_config->get_data(ip6_config,
|
||||
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
||||
+ &sz, interface_info);
|
||||
+ }
|
||||
|
|
@ -1754,7 +1763,7 @@ index 00000000000..29a03973265
|
|||
+ if (!manual_address)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = ip6_config->get_data(ip6_config,
|
||||
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, manual_address);
|
||||
+
|
||||
|
|
@ -1965,7 +1974,7 @@ index 00000000000..29a03973265
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
||||
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ sizeof(*address), address);
|
||||
+
|
||||
|
|
@ -1981,7 +1990,7 @@ index 00000000000..29a03973265
|
|||
+{
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
||||
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
|
||||
+ sizeof (address->ip6), &address->ip6);
|
||||
+
|
||||
|
|
@ -1997,7 +2006,7 @@ index 00000000000..29a03973265
|
|||
+
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
||||
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
||||
+ sizeof (address->ip6), &address->ip6);
|
||||
+
|
||||
|
|
@ -2018,7 +2027,7 @@ index 00000000000..29a03973265
|
|||
+ };
|
||||
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
|
||||
new file mode 100644
|
||||
index 00000000000..1a19ee27144
|
||||
index 00000000000..86bce6535d3
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/net.c
|
||||
@@ -0,0 +1,1428 @@
|
||||
|
|
@ -2041,15 +2050,15 @@ index 00000000000..1a19ee27144
|
|||
+
|
||||
+#define GRUB_EFI_IP6_PREFIX_LENGTH 64
|
||||
+
|
||||
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
||||
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
||||
+static grub_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
|
||||
+static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
||||
+static grub_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
|
||||
+static grub_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
||||
+static grub_efi_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
|
||||
+static grub_efi_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
|
||||
+
|
||||
+struct grub_efi_net_device *net_devices;
|
||||
+
|
||||
|
|
@ -2064,13 +2073,13 @@ index 00000000000..1a19ee27144
|
|||
+#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__)
|
||||
+
|
||||
+static grub_efi_handle_t
|
||||
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
|
||||
+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
|
||||
+ grub_efi_device_path_t **r_device_path)
|
||||
+{
|
||||
+ grub_efi_handle_t handle;
|
||||
+ grub_efi_status_t status;
|
||||
+
|
||||
+ status = grub_efi_system_table->boot_services->locate_device_path(
|
||||
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
|
||||
+ protocol, &device_path, &handle);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
|
|
@ -2712,7 +2721,7 @@ index 00000000000..1a19ee27144
|
|||
+}
|
||||
+
|
||||
+static grub_efi_handle_t
|
||||
+grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_guid)
|
||||
+grub_efi_service_binding (grub_efi_handle_t dev, grub_efi_guid_t *service_binding_guid)
|
||||
+{
|
||||
+ grub_efi_service_binding_t *service;
|
||||
+ grub_efi_status_t status;
|
||||
|
|
@ -2725,7 +2734,7 @@ index 00000000000..1a19ee27144
|
|||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ status = service->create_child(service, &child_dev);
|
||||
+ status = efi_call_2 (service->create_child, service, &child_dev);
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status);
|
||||
|
|
@ -2935,7 +2944,7 @@ index 00000000000..1a19ee27144
|
|||
+ {
|
||||
+ grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC;
|
||||
+
|
||||
+ if (dev->ip4_config->set_data(dev->ip4_config,
|
||||
+ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
|
||||
+ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS)
|
||||
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name);
|
||||
|
|
@ -2944,7 +2953,7 @@ index 00000000000..1a19ee27144
|
|||
+ {
|
||||
+ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL;
|
||||
+
|
||||
+ if (dev->ip6_config->set_data(dev->ip6_config,
|
||||
+ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY,
|
||||
+ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS)
|
||||
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name);
|
||||
|
|
@ -3452,7 +3461,7 @@ index 00000000000..1a19ee27144
|
|||
+}
|
||||
diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
|
||||
new file mode 100644
|
||||
index 00000000000..b84f86ea470
|
||||
index 00000000000..531949cba5c
|
||||
--- /dev/null
|
||||
+++ b/grub-core/net/efi/pxe.c
|
||||
@@ -0,0 +1,424 @@
|
||||
|
|
@ -3475,7 +3484,7 @@ index 00000000000..b84f86ea470
|
|||
+ if (!manual_address)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = ip6_config->get_data(ip6_config,
|
||||
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
||||
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, manual_address);
|
||||
+
|
||||
|
|
@ -3500,7 +3509,7 @@ index 00000000000..b84f86ea470
|
|||
+ if (!manual_address)
|
||||
+ return NULL;
|
||||
+
|
||||
+ status = ip4_config->get_data(ip4_config,
|
||||
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
||||
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
||||
+ &sz, manual_address);
|
||||
+
|
||||
|
|
@ -3523,7 +3532,7 @@ index 00000000000..b84f86ea470
|
|||
+ if (!mode->started)
|
||||
+ {
|
||||
+ grub_efi_status_t status;
|
||||
+ status = pxe->start(pxe, prefer_ip6);
|
||||
+ status = efi_call_2 (pxe->start, pxe, prefer_ip6);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ grub_printf ("Couldn't start PXE\n");
|
||||
|
|
@ -3546,7 +3555,7 @@ index 00000000000..b84f86ea470
|
|||
+ grub_efi_pxe_ip_address_t station_ip;
|
||||
+
|
||||
+ grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr));
|
||||
+ status = pxe->set_station_ip(pxe, &station_ip, NULL);
|
||||
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, NULL);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ grub_printf ("Couldn't set station ip\n");
|
||||
|
|
@ -3569,7 +3578,7 @@ index 00000000000..b84f86ea470
|
|||
+ grub_memcpy (station_ip.v4.addr, manual_address->address, sizeof (station_ip.v4.addr));
|
||||
+ grub_memcpy (subnet_mask.v4.addr, manual_address->subnet_mask, sizeof (subnet_mask.v4.addr));
|
||||
+
|
||||
+ status = pxe->set_station_ip(pxe, &station_ip, &subnet_mask);
|
||||
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, &subnet_mask);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ grub_printf ("Couldn't set station ip\n");
|
||||
|
|
@ -3722,7 +3731,7 @@ index 00000000000..b84f86ea470
|
|||
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
|
||||
+ }
|
||||
+
|
||||
+ status = pxe->mtftp(
|
||||
+ status = efi_call_10 (pxe->mtftp,
|
||||
+ pxe,
|
||||
+ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
|
||||
+ NULL,
|
||||
|
|
@ -3807,7 +3816,7 @@ index 00000000000..b84f86ea470
|
|||
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
|
||||
+ }
|
||||
+
|
||||
+ status = pxe->mtftp(
|
||||
+ status = efi_call_10 (pxe->mtftp,
|
||||
+ pxe,
|
||||
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
||||
+ buf,
|
||||
|
|
@ -3838,7 +3847,7 @@ index 00000000000..b84f86ea470
|
|||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ status = pxe->mtftp(
|
||||
+ status = efi_call_10 (pxe->mtftp,
|
||||
+ pxe,
|
||||
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
||||
+ buf2,
|
||||
|
|
@ -3881,7 +3890,7 @@ index 00000000000..b84f86ea470
|
|||
+ };
|
||||
+
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index fa6b6537142..fdec64d55ee 100644
|
||||
index 0ce5e675ed7..55aed92722c 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -32,6 +32,9 @@
|
||||
|
|
@ -3894,8 +3903,8 @@ index fa6b6537142..fdec64d55ee 100644
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
|
||||
static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards;
|
||||
@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
|
||||
static grub_command_t cmd_lsroutes, cmd_lscards;
|
||||
static grub_command_t cmd_lsaddr, cmd_slaac;
|
||||
|
||||
+#ifdef GRUB_MACHINE_EFI
|
||||
|
|
@ -3944,7 +3953,7 @@ index fa6b6537142..fdec64d55ee 100644
|
|||
grub_register_variable_hook ("net_default_server", defserver_get_env,
|
||||
defserver_set_env);
|
||||
grub_env_export ("net_default_server");
|
||||
@@ -2144,10 +2188,37 @@ GRUB_MOD_INIT(net)
|
||||
@@ -2082,10 +2126,37 @@ GRUB_MOD_INIT(net)
|
||||
grub_net_restore_hw,
|
||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
||||
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
|
||||
|
|
@ -3982,16 +3991,16 @@ index fa6b6537142..fdec64d55ee 100644
|
|||
grub_register_variable_hook ("net_default_server", 0, 0);
|
||||
grub_register_variable_hook ("pxe_default_server", 0, 0);
|
||||
|
||||
@@ -2166,4 +2237,7 @@ GRUB_MOD_FINI(net)
|
||||
@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net)
|
||||
grub_net_fini_hw (0);
|
||||
grub_loader_unregister_preboot_hook (fini_hnd);
|
||||
grub_net_poll_cards_idle = NULL;
|
||||
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
|
||||
+#ifdef GRUB_MACHINE_EFI
|
||||
+ init_mode = INIT_MODE_NONE;
|
||||
+#endif
|
||||
}
|
||||
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c
|
||||
index 46f304c2b47..11c9db11775 100644
|
||||
index 602574d52e8..1a61e05c6ec 100644
|
||||
--- a/util/grub-mknetdir.c
|
||||
+++ b/util/grub-mknetdir.c
|
||||
@@ -32,13 +32,15 @@
|
||||
|
|
@ -4046,7 +4055,7 @@ index 46f304c2b47..11c9db11775 100644
|
|||
{
|
||||
const char *mkimage_target;
|
||||
const char *netmodule;
|
||||
@@ -157,6 +162,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
|
||||
@@ -156,6 +161,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
|
||||
grub_install_push_module (targets[platform].netmodule);
|
||||
|
||||
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
|
||||
|
|
@ -4054,7 +4063,7 @@ index 46f304c2b47..11c9db11775 100644
|
|||
grub_install_make_image_wrap (input_dir, prefix, output,
|
||||
0, load_cfg,
|
||||
targets[platform].mkimage_target, 0);
|
||||
@@ -196,7 +202,16 @@ main (int argc, char *argv[])
|
||||
@@ -192,7 +198,16 @@ main (int argc, char *argv[])
|
||||
|
||||
grub_install_mkdir_p (base);
|
||||
|
||||
|
|
@ -4073,10 +4082,10 @@ index 46f304c2b47..11c9db11775 100644
|
|||
if (!grub_install_source_directory)
|
||||
{
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index 248d6a28ff9..805a9d7adf9 100644
|
||||
index 0b490195ad9..f431f49973e 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -668,6 +668,23 @@ typedef union
|
||||
@@ -622,6 +622,23 @@ typedef union
|
||||
|
||||
typedef grub_efi_uint64_t grub_efi_physical_address_t;
|
||||
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
|
||||
|
|
@ -4098,9 +4107,9 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
+ grub_efi_pxe_ipv6_address_t v6;
|
||||
+} grub_efi_pxe_ip_address_t;
|
||||
|
||||
/* XXX although the spec does not specify the padding, this actually
|
||||
must have the padding! */
|
||||
@@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path
|
||||
struct grub_efi_guid
|
||||
{
|
||||
@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path
|
||||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
|
|
@ -4109,7 +4118,7 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
|
||||
|
||||
@@ -975,6 +994,15 @@ struct grub_efi_uri_device_path
|
||||
@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t;
|
||||
|
||||
|
|
@ -4125,7 +4134,7 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
||||
|
||||
/* Media Device Path. */
|
||||
@@ -1057,6 +1085,23 @@ struct grub_efi_bios_device_path
|
||||
@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
|
||||
|
||||
|
|
@ -4149,7 +4158,7 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
struct grub_efi_open_protocol_information_entry
|
||||
{
|
||||
grub_efi_handle_t agent_handle;
|
||||
@@ -1617,23 +1662,27 @@ typedef struct grub_efi_pxe_tftp_error
|
||||
@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error
|
||||
grub_efi_char8_t error_string[127];
|
||||
} grub_efi_pxe_tftp_error_t;
|
||||
|
||||
|
|
@ -4191,27 +4200,18 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
|
||||
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
|
||||
typedef struct grub_efi_pxe_ip_filter
|
||||
@@ -1700,18 +1749,31 @@ typedef struct grub_efi_pxe_mode
|
||||
@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode
|
||||
typedef struct grub_efi_pxe
|
||||
{
|
||||
grub_uint64_t rev;
|
||||
- void *start;
|
||||
- void *stop;
|
||||
- void *dhcp;
|
||||
- void *discover;
|
||||
- void *mftp;
|
||||
- void *udpwrite;
|
||||
- void *udpread;
|
||||
- void *setipfilter;
|
||||
- void *arp;
|
||||
- void *setparams;
|
||||
- void *setstationip;
|
||||
- void *setpackets;
|
||||
- void (*start) (void);
|
||||
+ grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6);
|
||||
+ void (*stop) (void);
|
||||
void (*stop) (void);
|
||||
- void (*dhcp) (void);
|
||||
+ grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this,
|
||||
+ grub_efi_boolean_t sort_offers);
|
||||
+ void (*discover) (void);
|
||||
void (*discover) (void);
|
||||
- void (*mftp) (void);
|
||||
+ grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this,
|
||||
+ grub_efi_pxe_base_code_tftp_opcode_t operation,
|
||||
+ void *buffer_ptr,
|
||||
|
|
@ -4223,19 +4223,20 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
+ grub_efi_char8_t *filename,
|
||||
+ grub_efi_pxe_base_code_mtftp_info_t *info,
|
||||
+ grub_efi_boolean_t dont_use_buffer);
|
||||
+ void (*udpwrite) (void);
|
||||
+ void (*udpread) (void);
|
||||
+ void (*setipfilter) (void);
|
||||
+ void (*arp) (void);
|
||||
+ void (*setparams) (void);
|
||||
void (*udpwrite) (void);
|
||||
void (*udpread) (void);
|
||||
void (*setipfilter) (void);
|
||||
void (*arp) (void);
|
||||
void (*setparams) (void);
|
||||
- void (*setstationip) (void);
|
||||
+ grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this,
|
||||
+ grub_efi_pxe_ip_address_t *new_station_ip,
|
||||
+ grub_efi_pxe_ip_address_t *new_subnet_mask);
|
||||
+ void (*setpackets) (void);
|
||||
+ //void (*setstationip) (void);
|
||||
void (*setpackets) (void);
|
||||
struct grub_efi_pxe_mode *mode;
|
||||
} grub_efi_pxe_t;
|
||||
|
||||
@@ -2005,6 +2067,44 @@ struct grub_efi_ip4_config2_protocol
|
||||
@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol
|
||||
};
|
||||
typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t;
|
||||
|
||||
|
|
@ -4280,7 +4281,7 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
enum grub_efi_ip6_config_data_type {
|
||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID,
|
||||
@@ -2039,6 +2139,49 @@ struct grub_efi_ip6_config_protocol
|
||||
@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol
|
||||
};
|
||||
typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
|
||||
|
||||
|
|
@ -4327,9 +4328,9 @@ index 248d6a28ff9..805a9d7adf9 100644
|
|||
+};
|
||||
+typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
|
||||
+
|
||||
struct initrd_media_device_path {
|
||||
grub_efi_vendor_media_device_path_t vendor;
|
||||
grub_efi_device_path_t end;
|
||||
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
||||
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
||||
|| defined(__riscv)
|
||||
diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h
|
||||
new file mode 100644
|
||||
index 00000000000..fdb88eb810e
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue