Enable armv7 EFI builds. This was way harder than I expected.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-08-02 14:04:20 -04:00
parent dbfd2e6b04
commit 3e07ee7c3e
38 changed files with 551 additions and 567 deletions

View File

@ -4,7 +4,7 @@ Date: Tue, 8 Aug 2017 12:48:04 -0400
Subject: [PATCH] re-write .gitignore Subject: [PATCH] re-write .gitignore
--- ---
.gitignore | 356 +++++++++++++------------------------- .gitignore | 357 +++++++++++++-------------------------
build-aux/.gitignore | 9 + build-aux/.gitignore | 9 +
docs/.gitignore | 4 + docs/.gitignore | 4 +
grub-core/.gitignore | 15 ++ grub-core/.gitignore | 15 ++
@ -13,7 +13,7 @@ Subject: [PATCH] re-write .gitignore
include/grub/gcrypt/.gitignore | 2 + include/grub/gcrypt/.gitignore | 2 +
po/.gitignore | 4 + po/.gitignore | 4 +
util/bash-completion.d/.gitignore | 1 + util/bash-completion.d/.gitignore | 1 +
9 files changed, 174 insertions(+), 240 deletions(-) 9 files changed, 175 insertions(+), 240 deletions(-)
create mode 100644 build-aux/.gitignore create mode 100644 build-aux/.gitignore
create mode 100644 docs/.gitignore create mode 100644 docs/.gitignore
create mode 100644 grub-core/.gitignore create mode 100644 grub-core/.gitignore
@ -24,10 +24,10 @@ Subject: [PATCH] re-write .gitignore
create mode 100644 util/bash-completion.d/.gitignore create mode 100644 util/bash-completion.d/.gitignore
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index eca17bec9b8..2dda15a37b8 100644 index eca17bec9b8..43f04d47277 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -1,249 +1,125 @@ @@ -1,249 +1,126 @@
-00_header -00_header
-10_* -10_*
-20_linux_xen -20_linux_xen
@ -78,6 +78,7 @@ index eca17bec9b8..2dda15a37b8 100644
+# things very common editors create that we never want +# things very common editors create that we never want
+*~ +*~
+.*.sw? +.*.sw?
+*.patch
+ +
+# built objects across the whole tree +# built objects across the whole tree
+Makefile.in +Makefile.in

View File

@ -389,10 +389,10 @@ index 00000000000..f33bd1ed568
+ return 0; + return 0;
+} +}
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 2dda15a37b8..56c641b5f7b 100644 index 43f04d47277..fa2e5b609b1 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -104,6 +104,8 @@ grub-*.tar.* @@ -105,6 +105,8 @@ grub-*.tar.*
/grub*-reboot.8 /grub*-reboot.8
/grub*-render-label /grub*-render-label
/grub*-render-label.1 /grub*-render-label.1

View File

@ -65,10 +65,10 @@ index 406d96861b6..fd91045bd6d 100644
name = grub-mkconfig_lib; name = grub-mkconfig_lib;
common = util/grub-mkconfig_lib.in; common = util/grub-mkconfig_lib.in;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 56c641b5f7b..4e9a0f6d9cf 100644 index fa2e5b609b1..5066689bc0a 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -110,6 +110,8 @@ grub-*.tar.* @@ -111,6 +111,8 @@ grub-*.tar.*
/grub*-script-check.1 /grub*-script-check.1
/grub*-set-default /grub*-set-default
/grub*-set-default.8 /grub*-set-default.8

View File

@ -62,10 +62,10 @@ index fd91045bd6d..2d032643de7 100644
name = grub-set-default; name = grub-set-default;
common = util/grub-set-default.in; common = util/grub-set-default.in;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 4e9a0f6d9cf..ac92bfd4c3d 100644 index 5066689bc0a..54795fa60be 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -67,6 +67,8 @@ grub-*.tar.* @@ -68,6 +68,8 @@ grub-*.tar.*
/grub*-fs-tester /grub*-fs-tester
/grub*-fstest /grub*-fstest
/grub*-fstest.1 /grub*-fstest.1

View File

@ -32,10 +32,10 @@ index 879e8eb98a4..f4fbd250630 100644
name = grub-glue-efi; name = grub-glue-efi;
mansection = 1; mansection = 1;
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index ac92bfd4c3d..b718546f993 100644 index 54795fa60be..42475592123 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -120,6 +120,8 @@ grub-*.tar.* @@ -121,6 +121,8 @@ grub-*.tar.*
/grub*-sparc64-setup.8 /grub*-sparc64-setup.8
/grub*-syslinux2cfg /grub*-syslinux2cfg
/grub*-syslinux2cfg.1 /grub*-syslinux2cfg.1

View File

@ -227,10 +227,10 @@ index 00000000000..f8dc310909a
+ return 0; + return 0;
+} +}
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index b718546f993..99a3e801bc4 100644 index 42475592123..6c4cfc53781 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -110,6 +110,8 @@ grub-*.tar.* @@ -111,6 +111,8 @@ grub-*.tar.*
/grub*-rpm-sort.8 /grub*-rpm-sort.8
/grub*-script-check /grub*-script-check
/grub*-script-check.1 /grub*-script-check.1

View File

@ -44,10 +44,10 @@ index 5da55393291..97cd8bdebd9 100644
installdir = sbin; installdir = sbin;
}; };
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 99a3e801bc4..e7d3727834d 100644 index 6c4cfc53781..a999024652e 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -114,8 +114,8 @@ grub-*.tar.* @@ -115,8 +115,8 @@ grub-*.tar.*
/grub*-set-bootflag.1 /grub*-set-bootflag.1
/grub*-set-default /grub*-set-default
/grub*-set-default.8 /grub*-set-default.8

View File

@ -1,127 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 11 Jul 2018 13:47:56 -0400
Subject: [PATCH] Make the "reboot" module be linked more like the "exit"
module.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 5 +++--
grub-core/commands/efi/efifwsetup.c | 2 +-
grub-core/kern/efi/efi.c | 2 +-
grub-core/lib/efi/reboot.c | 29 +++++++++++++++++++++++++++++
include/grub/efi/efi.h | 1 +
include/grub/misc.h | 3 +--
6 files changed, 36 insertions(+), 6 deletions(-)
create mode 100644 grub-core/lib/efi/reboot.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 2851437e098..9b39c8e3cea 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -889,8 +889,8 @@ module = {
module = {
name = reboot;
- i386 = lib/i386/reboot.c;
- i386 = lib/i386/reboot_trampoline.S;
+ i386_pc = lib/i386/reboot.c;
+ i386_pc = lib/i386/reboot_trampoline.S;
powerpc_ieee1275 = lib/ieee1275/reboot.c;
sparc64_ieee1275 = lib/ieee1275/reboot.c;
mips_arc = lib/mips/arc/reboot.c;
@@ -899,6 +899,7 @@ module = {
xen = lib/xen/reboot.c;
uboot = lib/uboot/reboot.c;
arm_coreboot = lib/dummy/reboot.c;
+ efi = lib/efi/reboot.c;
common = commands/reboot.c;
};
diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c
index 7a137a72a2f..be11c08a9ae 100644
--- a/grub-core/commands/efi/efifwsetup.c
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -49,7 +49,7 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
if (status != GRUB_ERR_NONE)
return status;
- grub_reboot ();
+ grub_efi_reboot ();
return GRUB_ERR_BUG;
}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 4d36fe31177..c54cb5df1fc 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -155,7 +155,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
}
void
-grub_reboot (void)
+grub_efi_reboot (void)
{
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
diff --git a/grub-core/lib/efi/reboot.c b/grub-core/lib/efi/reboot.c
new file mode 100644
index 00000000000..6934a3b369e
--- /dev/null
+++ b/grub-core/lib/efi/reboot.c
@@ -0,0 +1,29 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 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/misc.h>
+#include <grub/mm.h>
+#include <grub/kernel.h>
+#include <grub/loader.h>
+#include <grub/efi/efi.h>
+
+void
+grub_reboot (void)
+{
+ grub_efi_reboot();
+}
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 570a69361a5..3f02db48279 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -29,6 +29,7 @@ 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_reboot) (void) __attribute__ ((noreturn));
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *registration);
grub_efi_handle_t *
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 5f1c1c1be4e..4607e8defa9 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -444,8 +444,7 @@ grub_abs (int x)
}
/* Reboot the machine. */
-#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) || \
- defined (GRUB_MACHINE_EFI)
+#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS)
void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn));
#else
void grub_reboot (void) __attribute__ ((noreturn));

View File

@ -18,7 +18,7 @@ Signed-off-by: Will Thompson <wjt@endlessm.com>
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 36ae895f10c..b89104f979e 100644 index 2851437e098..aa44d66aca4 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -781,6 +781,7 @@ module = { @@ -781,6 +781,7 @@ module = {
@ -29,7 +29,7 @@ index 36ae895f10c..b89104f979e 100644
enable = efi; enable = efi;
enable = i386_pc; enable = i386_pc;
enable = emu; enable = emu;
@@ -948,6 +949,7 @@ module = { @@ -947,6 +948,7 @@ module = {
module = { module = {
name = loadenv; name = loadenv;
common = commands/loadenv.c; common = commands/loadenv.c;

View File

@ -1,379 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 12 Jul 2018 11:00:45 -0400
Subject: [PATCH] Rework how the fdt command builds.
Trying to avoid all variants of:
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
grub_fdt_install in linux is not defined
grub_fdt_load in linux is not defined
grub_fdt_unload in linux is not defined
grub_fdt_install in xen_boot is not defined
grub_fdt_load in xen_boot is not defined
grub_fdt_unload in xen_boot is not defined
This is an egregious hack until I can figure out how linking this thing is
supposed to work.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 9 +++-----
grub-core/bus/fdt.c | 6 ++++++
grub-core/kern/efi/fdt.c | 43 ---------------------------------------
grub-core/lib/fdt.c | 25 ++++++++++++++++++++++-
grub-core/loader/arm/linux.c | 2 ++
grub-core/loader/arm64/linux.c | 4 ++++
grub-core/loader/arm64/xen_boot.c | 3 +++
grub-core/loader/efi/fdt.c | 27 ++++++++++++++++++++++++
include/grub/fdt.h | 16 ---------------
9 files changed, 69 insertions(+), 66 deletions(-)
delete mode 100644 grub-core/kern/efi/fdt.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index b89104f979e..de61ac8cf48 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -166,7 +166,6 @@ kernel = {
arm_coreboot = kern/arm/coreboot/init.c;
arm_coreboot = kern/arm/coreboot/timer.c;
arm_coreboot = kern/arm/coreboot/coreboot.S;
- arm_coreboot = lib/fdt.c;
arm_coreboot = bus/fdt.c;
arm_coreboot = term/ps2.c;
arm_coreboot = term/arm/pl050.c;
@@ -240,10 +239,8 @@ kernel = {
ia64_efi = kern/ia64/cache.c;
arm_efi = kern/arm/efi/init.c;
- arm_efi = kern/efi/fdt.c;
arm64_efi = kern/arm64/efi/init.c;
- arm64_efi = kern/efi/fdt.c;
i386_pc = kern/i386/pc/init.c;
i386_pc = kern/i386/pc/mmap.c;
@@ -1715,7 +1712,6 @@ module = {
arm_uboot = loader/arm/linux.c;
arm64 = loader/arm64/linux.c;
emu = loader/emu/linux.c;
- fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1725,7 +1721,7 @@ module = {
module = {
name = fdt;
- efi = loader/efi/fdt.c;
+ arm64 = loader/efi/fdt.c;
common = lib/fdt.c;
enable = fdt;
};
@@ -1789,7 +1785,8 @@ module = {
i386_coreboot = lib/LzmaDec.c;
enable = i386_pc;
enable = i386_coreboot;
- enable = efi;
+ enable = i386_efi;
+ enable = x86_64_efi;
};
module = {
diff --git a/grub-core/bus/fdt.c b/grub-core/bus/fdt.c
index 135da497ba6..4d1914d2c28 100644
--- a/grub-core/bus/fdt.c
+++ b/grub-core/bus/fdt.c
@@ -19,6 +19,12 @@
#include <grub/fdtbus.h>
#include <grub/fdt.h>
#include <grub/term.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/dl.h>
+
+
+#include "../lib/fdt.c"
static const void *dtb;
static grub_size_t root_address_cells, root_size_cells;
diff --git a/grub-core/kern/efi/fdt.c b/grub-core/kern/efi/fdt.c
deleted file mode 100644
index 30100c61c14..00000000000
--- a/grub-core/kern/efi/fdt.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* fdt.c - EFI Flattened Device Tree interaction */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2006,2007 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/efi/efi.h>
-#include <grub/mm.h>
-
-void *
-grub_efi_get_firmware_fdt (void)
-{
- grub_efi_configuration_table_t *tables;
- grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
- void *firmware_fdt = NULL;
- unsigned int i;
-
- /* Look for FDT in UEFI config tables. */
- tables = grub_efi_system_table->configuration_table;
-
- for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
- if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
- {
- firmware_fdt = tables[i].vendor_table;
- grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
- break;
- }
-
- return firmware_fdt;
-}
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
index 0d371c5633e..85e44541ddb 100644
--- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c
@@ -21,7 +21,20 @@
#include <grub/mm.h>
#include <grub/dl.h>
-GRUB_MOD_LICENSE ("GPLv3+");
+static int grub_fdt_create_empty_tree (void *fdt, unsigned int size);
+static int grub_fdt_check_header (const void *fdt, unsigned int size);
+static int grub_fdt_check_header_nosize (const void *fdt);
+static int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
+ const char *name);
+static int grub_fdt_first_node (const void *fdt, unsigned int parentoffset);
+static int grub_fdt_next_node (const void *fdt, unsigned int currentoffset);
+static const char *
+grub_fdt_get_nodename (const void *fdt, unsigned int nodeoffset);
+static const void *grub_fdt_get_prop (const void *fdt, unsigned int nodeoffset, const char *name,
+ grub_uint32_t *len);
+
+static int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
+ const void *val, grub_uint32_t len);
#define FDT_SUPPORTED_VERSION 17
@@ -263,6 +276,7 @@ static grub_uint32_t *find_prop (const void *fdt, unsigned int nodeoffset,
the size allocated for the FDT; if this function is called before the other
functions in this file and returns success, the other functions are
guaranteed not to access memory locations outside the allocated memory. */
+static inline __attribute__((__unused__))
int grub_fdt_check_header_nosize (const void *fdt)
{
if (((grub_addr_t) fdt & 0x3) || (grub_fdt_get_magic (fdt) != FDT_MAGIC)
@@ -281,6 +295,7 @@ int grub_fdt_check_header_nosize (const void *fdt)
return 0;
}
+static inline __attribute__((__unused__))
int grub_fdt_check_header (const void *fdt, unsigned int size)
{
if (size < sizeof (grub_fdt_header_t)
@@ -327,6 +342,7 @@ advance_token (const void *fdt, const grub_uint32_t *token, const grub_uint32_t
return 0;
}
+static inline __attribute__((__unused__))
int grub_fdt_next_node (const void *fdt, unsigned int currentoffset)
{
const grub_uint32_t *token = (const grub_uint32_t *) fdt + (currentoffset + grub_fdt_get_off_dt_struct (fdt)) / 4;
@@ -337,6 +353,7 @@ int grub_fdt_next_node (const void *fdt, unsigned int currentoffset)
- grub_fdt_get_off_dt_struct (fdt));
}
+static inline __attribute__((__unused__))
int grub_fdt_first_node (const void *fdt, unsigned int parentoffset)
{
const grub_uint32_t *token, *end;
@@ -358,6 +375,7 @@ int grub_fdt_first_node (const void *fdt, unsigned int parentoffset)
}
/* Find a direct sub-node of a given parent node. */
+static inline __attribute__((__unused__))
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
const char *name)
{
@@ -385,12 +403,14 @@ int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
}
}
+static inline __attribute__((__unused__))
const char *
grub_fdt_get_nodename (const void *fdt, unsigned int nodeoffset)
{
return (const char *) fdt + grub_fdt_get_off_dt_struct(fdt) + nodeoffset + 4;
}
+static inline __attribute__((__unused__))
int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset,
const char *name)
{
@@ -407,6 +427,7 @@ int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset,
return add_subnode (fdt, parentoffset, name);
}
+static inline __attribute__((__unused__))
const void *
grub_fdt_get_prop (const void *fdt, unsigned int nodeoffset, const char *name,
grub_uint32_t *len)
@@ -425,6 +446,7 @@ grub_fdt_get_prop (const void *fdt, unsigned int nodeoffset, const char *name,
return prop + 3;
}
+static inline __attribute__((__unused__))
int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
const void *val, grub_uint32_t len)
{
@@ -501,6 +523,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
return 0;
}
+static inline __attribute__((__unused__))
int
grub_fdt_create_empty_tree (void *fdt, unsigned int size)
{
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index b4f609d2d01..58594e9719f 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -29,6 +29,8 @@
#include <grub/lib/cmdline.h>
#include <grub/linux.h>
+#include "../../lib/fdt.c"
+
GRUB_MOD_LICENSE ("GPLv3+");
static grub_dl_t my_mod;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 93b5cd306eb..94ceeeb9789 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -24,6 +24,8 @@
#include <grub/linux.h>
#include <grub/loader.h>
#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/dl.h>
#include <grub/types.h>
#include <grub/cpu/linux.h>
#include <grub/efi/efi.h>
@@ -34,6 +36,8 @@
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
+#include "../../lib/fdt.c"
+
GRUB_MOD_LICENSE ("GPLv3+");
static grub_dl_t my_mod;
diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
index 1003a0b9997..5c71045551c 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -34,6 +34,9 @@
#include <grub/efi/pe32.h> /* required by struct xen_hypervisor_header */
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
+#include <grub/dl.h>
+
+#include "../../lib/fdt.c"
GRUB_MOD_LICENSE ("GPLv3+");
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index a4c6e803645..44555fd42f0 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -20,12 +20,17 @@
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
+#include <grub/misc.h>
#include <grub/command.h>
#include <grub/file.h>
#include <grub/efi/efi.h>
#include <grub/efi/fdtload.h>
#include <grub/efi/memory.h>
+#include "../../lib/fdt.c"
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
static void *loaded_fdt;
static void *fdt;
@@ -35,6 +40,28 @@ static void *fdt;
sizeof (FDT_ADDR_CELLS_STRING) + \
sizeof (FDT_SIZE_CELLS_STRING))
+static void *
+grub_efi_get_firmware_fdt (void)
+{
+ grub_efi_configuration_table_t *tables;
+ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+ void *firmware_fdt = NULL;
+ unsigned int i;
+
+ /* Look for FDT in UEFI config tables. */
+ tables = grub_efi_system_table->configuration_table;
+
+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+ if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+ {
+ firmware_fdt = tables[i].vendor_table;
+ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+ break;
+ }
+
+ return firmware_fdt;
+}
+
void *
grub_fdt_load (grub_size_t additional_size)
{
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
index 158b1bc4b3a..6b39cfe4861 100644
--- a/include/grub/fdt.h
+++ b/include/grub/fdt.h
@@ -101,22 +101,6 @@ struct grub_fdt_empty_tree {
#define grub_fdt_set_size_dt_struct(fdt, value) \
grub_fdt_set_header(fdt, size_dt_struct, value)
-int EXPORT_FUNC(grub_fdt_create_empty_tree) (void *fdt, unsigned int size);
-int EXPORT_FUNC(grub_fdt_check_header) (const void *fdt, unsigned int size);
-int EXPORT_FUNC(grub_fdt_check_header_nosize) (const void *fdt);
-int EXPORT_FUNC(grub_fdt_find_subnode) (const void *fdt, unsigned int parentoffset,
- const char *name);
-int EXPORT_FUNC(grub_fdt_first_node) (const void *fdt, unsigned int parentoffset);
-int EXPORT_FUNC(grub_fdt_next_node) (const void *fdt, unsigned int currentoffset);
-int EXPORT_FUNC(grub_fdt_add_subnode) (void *fdt, unsigned int parentoffset,
- const char *name);
-const char *
-EXPORT_FUNC(grub_fdt_get_nodename) (const void *fdt, unsigned int nodeoffset);
-const void *EXPORT_FUNC(grub_fdt_get_prop) (const void *fdt, unsigned int nodeoffset, const char *name,
- grub_uint32_t *len);
-
-int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const char *name,
- const void *val, grub_uint32_t len);
#define grub_fdt_set_prop32(fdt, nodeoffset, name, val) \
({ \
grub_uint32_t _val = grub_cpu_to_be32(val); \

View File

@ -1,7 +1,10 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com> From: Peter Jones <pjones@redhat.com>
Date: Mon, 30 Jul 2018 16:39:57 -0400 Date: Mon, 30 Jul 2018 16:39:57 -0400
Subject: [PATCH] Make root_url reflect the protocol+hostname of our boot url. Subject: [PATCH] efi/http: Make root_url reflect the protocol+hostname of our
boot url.
This lets you write config files that don't know urls.
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---

View File

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 9b39c8e3cea..895ed1430d5 100644 index aa44d66aca4..d3e3bfd4d7a 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -1679,7 +1679,7 @@ module = { @@ -1680,7 +1680,7 @@ module = {
common = loader/multiboot.c; common = loader/multiboot.c;
common = loader/multiboot_mbi2.c; common = loader/multiboot_mbi2.c;
@ -22,7 +22,7 @@ index 9b39c8e3cea..895ed1430d5 100644
enable = mips; enable = mips;
}; };
@@ -1688,7 +1688,7 @@ module = { @@ -1689,7 +1689,7 @@ module = {
common = loader/multiboot.c; common = loader/multiboot.c;
x86 = loader/i386/multiboot_mbi.c; x86 = loader/i386/multiboot_mbi.c;
extra_dist = loader/multiboot_elfxx.c; extra_dist = loader/multiboot_elfxx.c;

View File

@ -11,12 +11,13 @@ float for grub.efi.
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
configure.ac | 48 +++++++++++++++++++++++++++++++++++++++++++++++- configure.ac | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
conf/Makefile.common | 15 ++++++++------- conf/Makefile.common | 23 ++++++++++++-----------
2 files changed, 55 insertions(+), 8 deletions(-) gentpl.py | 8 ++++----
3 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 9ab683fefac..c0609d87702 100644 index 9ab683fefac..819212095ff 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p @@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p
@ -44,7 +45,7 @@ index 9ab683fefac..c0609d87702 100644
AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
grub_cv_target_cc_soft_float=no grub_cv_target_cc_soft_float=no
if test "x$target_cpu" = xarm64; then if test "x$target_cpu" = xarm64; then
@@ -1939,6 +1951,40 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" @@ -1939,6 +1951,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
@ -54,21 +55,18 @@ index 9ab683fefac..c0609d87702 100644
+ UTILS_CPPFLAGS=$HOST_CPPFLAGS + UTILS_CPPFLAGS=$HOST_CPPFLAGS
+ UTILS_CCASFLAGS=$HOST_CCASFLAGS + UTILS_CCASFLAGS=$HOST_CCASFLAGS
+ UTILS_LDFLAGS=$HOST_LDFLAGS + UTILS_LDFLAGS=$HOST_LDFLAGS
+ BUILD_UTILS_LIBS=true
+ ;; + ;;
+ target) + target)
+ UTILS_CFLAGS=$TARGET_CFLAGS + UTILS_CFLAGS=$TARGET_CFLAGS
+ UTILS_CPPFLAGS=$TARGET_CPPFLAGS + UTILS_CPPFLAGS=$TARGET_CPPFLAGS
+ UTILS_CCASFLAGS=$TARGET_CCASFLAGS + UTILS_CCASFLAGS=$TARGET_CCASFLAGS
+ UTILS_LDFLAGS=$TARGET_LDFLAGS + UTILS_LDFLAGS=$TARGET_LDFLAGS
+ BUILD_UTILS_LIBS=false
+ ;; + ;;
+ build) + build)
+ UTILS_CFLAGS=$BUILD_CFLAGS + UTILS_CFLAGS=$BUILD_CFLAGS
+ UTILS_CPPFLAGS=$BUILD_CPPFLAGS + UTILS_CPPFLAGS=$BUILD_CPPFLAGS
+ UTILS_CCASFLAGS=$BUILD_CCASFLAGS + UTILS_CCASFLAGS=$BUILD_CCASFLAGS
+ UTILS_LDFLAGS=$BUILD_LDFLAGS + UTILS_LDFLAGS=$BUILD_LDFLAGS
+ BUILD_UTILS_LIBS=true
+ ;; + ;;
+ *) + *)
+ AC_MSG_ERROR([--with-utils must be either host, target, or build]) + AC_MSG_ERROR([--with-utils must be either host, target, or build])
@ -76,20 +74,38 @@ index 9ab683fefac..c0609d87702 100644
+esac +esac
+AC_MSG_NOTICE([Using $with_utils flags for utilities.]) +AC_MSG_NOTICE([Using $with_utils flags for utilities.])
+ +
+unset CFLAGS
+unset CPPFLAGS
+unset CCASFLAGS
+unset LDFLAGS
+
+AC_SUBST(UTILS_CFLAGS) +AC_SUBST(UTILS_CFLAGS)
+AC_SUBST(UTILS_CPPFLAGS) +AC_SUBST(UTILS_CPPFLAGS)
+AC_SUBST(UTILS_CCASFLAGS) +AC_SUBST(UTILS_CCASFLAGS)
+AC_SUBST(UTILS_LDFLAGS) +AC_SUBST(UTILS_LDFLAGS)
+AC_SUBST(BUILD_UTILS_LIBS)
+ +
GRUB_TARGET_CPU="${target_cpu}" GRUB_TARGET_CPU="${target_cpu}"
GRUB_PLATFORM="${platform}" GRUB_PLATFORM="${platform}"
diff --git a/conf/Makefile.common b/conf/Makefile.common diff --git a/conf/Makefile.common b/conf/Makefile.common
index 1ecb921db65..657253d5e46 100644 index 1ecb921db65..b93879804c0 100644
--- a/conf/Makefile.common --- a/conf/Makefile.common
+++ b/conf/Makefile.common +++ b/conf/Makefile.common
@@ -50,14 +50,15 @@ LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S @@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
-CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
+CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
@ -112,3 +128,22 @@ index 1ecb921db65..657253d5e46 100644
# Other variables # Other variables
diff --git a/gentpl.py b/gentpl.py
index 6409736e81c..1e4635f4426 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -694,10 +694,10 @@ def module(defn, platform):
var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources")
var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))
- var_set(cname(defn) + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(defn, platform))
- var_set(cname(defn) + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
- var_set(cname(defn) + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
- var_set(cname(defn) + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
+ var_set(cname(defn) + "_CFLAGS", "$(CFLAGS_MODULE) " + platform_cflags(defn, platform))
+ var_set(cname(defn) + "_LDFLAGS", "$(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
+ var_set(cname(defn) + "_CPPFLAGS", "$(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
+ var_set(cname(defn) + "_CCASFLAGS", "$(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
var_set(cname(defn) + "_DEPENDENCIES", "$(TARGET_OBJ2ELF) " + platform_dependencies(defn, platform))
gvar_add("dist_noinst_DATA", extra_dist(defn))

View File

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

View File

@ -0,0 +1,250 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 1 Aug 2018 10:12:47 -0400
Subject: [PATCH] grub-module-verifier: report the filename or modname in
errors.
Make it so that when grub-module-verifier complains of an issue, it tells you
which module the issue was with.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub-module-verifier.c | 6 ++---
util/grub-module-verifierXX.c | 58 ++++++++++++++++++++++--------------------
include/grub/module_verifier.h | 4 +--
3 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
index a79271f6631..03ba1ab437a 100644
--- a/util/grub-module-verifier.c
+++ b/util/grub-module-verifier.c
@@ -157,7 +157,7 @@ main (int argc, char **argv)
if (strcmp(archs[arch].name, argv[2]) == 0)
break;
if (arch == ARRAY_SIZE(archs))
- grub_util_error("unknown arch: %s", argv[2]);
+ grub_util_error("%s: unknown arch: %s", argv[1], argv[2]);
for (whitelist = 0; whitelist < ARRAY_SIZE(whitelists); whitelist++)
if (strcmp(whitelists[whitelist].arch, argv[2]) == 0
@@ -169,8 +169,8 @@ main (int argc, char **argv)
module_size = grub_util_get_image_size (argv[1]);
module_img = grub_util_read_image (argv[1]);
if (archs[arch].voidp_sizeof == 8)
- grub_module_verify64(module_img, module_size, &archs[arch], whitelist_empty);
+ grub_module_verify64(argv[1], module_img, module_size, &archs[arch], whitelist_empty);
else
- grub_module_verify32(module_img, module_size, &archs[arch], whitelist_empty);
+ grub_module_verify32(argv[1], module_img, module_size, &archs[arch], whitelist_empty);
return 0;
}
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index 597ded14362..a98e2f9b1ac 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -160,14 +160,15 @@ find_section (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e, const c
}
static void
-check_license (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
+check_license (const char * const filename,
+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
{
Elf_Shdr *s = find_section (arch, e, ".module_license");
if (s && (strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3") == 0
|| strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3+") == 0
|| strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv2+") == 0))
return;
- grub_util_error ("incompatible license");
+ grub_util_error ("%s: incompatible license", filename);
}
static Elf_Sym *
@@ -233,10 +234,10 @@ check_symbols (const struct grub_module_verifier_arch *arch,
s = find_section (arch, e, ".moddeps");
if (!s)
- grub_util_error ("no symbol table and no .moddeps section");
+ grub_util_error ("%s: no symbol table and no .moddeps section", modname);
if (!s->sh_size)
- grub_util_error ("no symbol table and empty .moddeps section");
+ grub_util_error ("%s: no symbol table and empty .moddeps section", modname);
return;
}
@@ -257,7 +258,7 @@ check_symbols (const struct grub_module_verifier_arch *arch,
break;
default:
- return grub_util_error ("unknown symbol type `%d'", (int) type);
+ return grub_util_error ("%s: unknown symbol type `%d'", modname, (int) type);
}
}
}
@@ -283,7 +284,8 @@ is_symbol_local(Elf_Sym *sym)
}
static void
-section_check_relocations (const struct grub_module_verifier_arch *arch, void *ehdr,
+section_check_relocations (const char * const modname,
+ const struct grub_module_verifier_arch *arch, void *ehdr,
Elf_Shdr *s, size_t target_seg_size)
{
Elf_Rel *rel, *max;
@@ -292,7 +294,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
symtab = get_symtab (arch, ehdr, &symtabsize, &symtabentsize);
if (!symtab)
- grub_util_error ("relocation without symbol table");
+ grub_util_error ("%s: relocation without symbol table", modname);
for (rel = (Elf_Rel *) ((char *) ehdr + grub_target_to_host (s->sh_offset)),
max = (Elf_Rel *) ((char *) rel + grub_target_to_host (s->sh_size));
@@ -303,7 +305,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
unsigned i;
if (target_seg_size < grub_target_to_host (rel->r_offset))
- grub_util_error ("reloc offset is out of the segment");
+ grub_util_error ("%s: reloc offset is out of the segment", modname);
grub_uint32_t type = ELF_R_TYPE (grub_target_to_host (rel->r_info));
@@ -316,17 +318,17 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
if (arch->supported_relocations[i] != -1)
continue;
if (!arch->short_relocations)
- grub_util_error ("unsupported relocation 0x%x", type);
+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type);
for (i = 0; arch->short_relocations[i] != -1; i++)
if (type == arch->short_relocations[i])
break;
if (arch->short_relocations[i] == -1)
- grub_util_error ("unsupported relocation 0x%x", type);
+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type);
sym = (Elf_Sym *) ((char *) symtab + symtabentsize * ELF_R_SYM (grub_target_to_host (rel->r_info)));
if (is_symbol_local (sym))
continue;
- grub_util_error ("relocation 0x%x is not module-local", type);
+ grub_util_error ("%s: relocation 0x%x is not module-local", modname, type);
}
#if defined(MODULEVERIFIER_ELF64)
if (arch->machine == EM_AARCH64)
@@ -351,11 +353,11 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
&& ELF_R_TYPE (rel2->r_info) == R_AARCH64_LD64_GOT_LO12_NC)
break;
if (rel2 >= (Elf_Rela *) max)
- grub_util_error ("ADR_GOT_PAGE without matching LD64_GOT_LO12_NC");
+ grub_util_error ("%s: ADR_GOT_PAGE without matching LD64_GOT_LO12_NC", modname);
break;
case R_AARCH64_LD64_GOT_LO12_NC:
if (unmatched_adr_got_page == 0)
- grub_util_error ("LD64_GOT_LO12_NC without matching ADR_GOT_PAGE");
+ grub_util_error ("%s: LD64_GOT_LO12_NC without matching ADR_GOT_PAGE", modname);
unmatched_adr_got_page--;
break;
}
@@ -365,7 +367,8 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
}
static void
-check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
+check_relocations (const char * const modname,
+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
{
Elf_Shdr *s;
unsigned i;
@@ -378,21 +381,22 @@ check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
Elf_Shdr *ts;
if (grub_target_to_host32 (s->sh_type) == SHT_REL && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_REL))
- grub_util_error ("unsupported SHT_REL");
+ grub_util_error ("%s: unsupported SHT_REL", modname);
if (grub_target_to_host32 (s->sh_type) == SHT_RELA && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_RELA))
- grub_util_error ("unsupported SHT_RELA");
+ grub_util_error ("%s: unsupported SHT_RELA", modname);
/* Find the target segment. */
if (grub_target_to_host32 (s->sh_info) >= grub_target_to_host16 (e->e_shnum))
- grub_util_error ("orphaned reloc section");
+ grub_util_error ("%s: orphaned reloc section", modname);
ts = (Elf_Shdr *) ((char *) e + grub_target_to_host (e->e_shoff) + grub_target_to_host32 (s->sh_info) * grub_target_to_host16 (e->e_shentsize));
- section_check_relocations (arch, e, s, grub_target_to_host (ts->sh_size));
+ section_check_relocations (modname, arch, e, s, grub_target_to_host (ts->sh_size));
}
}
void
-SUFFIX(grub_module_verify) (void *module_img, size_t size,
+SUFFIX(grub_module_verify) (const char * const filename,
+ void *module_img, size_t size,
const struct grub_module_verifier_arch *arch,
const char **whitelist_empty)
{
@@ -400,7 +404,7 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size,
/* Check the header size. */
if (size < sizeof (Elf_Ehdr))
- grub_util_error ("ELF header smaller than expected");
+ grub_util_error ("%s: ELF header smaller than expected", filename);
/* Check the magic numbers. */
if (e->e_ident[EI_MAG0] != ELFMAG0
@@ -409,36 +413,36 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size,
|| e->e_ident[EI_MAG3] != ELFMAG3
|| e->e_ident[EI_VERSION] != EV_CURRENT
|| grub_target_to_host32 (e->e_version) != EV_CURRENT)
- grub_util_error ("invalid arch-independent ELF magic");
+ grub_util_error ("%s: invalid arch-independent ELF magic", filename);
if (e->e_ident[EI_CLASS] != ELFCLASSXX
|| e->e_ident[EI_DATA] != (arch->bigendian ? ELFDATA2MSB : ELFDATA2LSB)
|| grub_target_to_host16 (e->e_machine) != arch->machine)
- grub_util_error ("invalid arch-dependent ELF magic");
+ grub_util_error ("%s: invalid arch-dependent ELF magic", filename);
if (grub_target_to_host16 (e->e_type) != ET_REL)
{
- grub_util_error ("this ELF file is not of the right type");
+ grub_util_error ("%s: this ELF file is not of the right type", filename);
}
/* Make sure that every section is within the core. */
if (size < grub_target_to_host (e->e_shoff)
+ (grub_uint32_t) grub_target_to_host16 (e->e_shentsize) * grub_target_to_host16(e->e_shnum))
{
- grub_util_error ("ELF sections outside core");
+ grub_util_error ("%s: ELF sections outside core", filename);
}
- check_license (arch, e);
+ check_license (filename, arch, e);
Elf_Shdr *s;
const char *modname;
s = find_section (arch, e, ".modname");
if (!s)
- grub_util_error ("no module name found");
+ grub_util_error ("%s: no module name found", filename);
modname = (const char *) e + grub_target_to_host (s->sh_offset);
check_symbols(arch, e, modname, whitelist_empty);
- check_relocations(arch, e);
+ check_relocations(modname, arch, e);
}
diff --git a/include/grub/module_verifier.h b/include/grub/module_verifier.h
index f4870cb9c2d..ba21c75e2eb 100644
--- a/include/grub/module_verifier.h
+++ b/include/grub/module_verifier.h
@@ -16,5 +16,5 @@ struct grub_module_verifier_arch {
const int *short_relocations;
};
-void grub_module_verify64(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
-void grub_module_verify32(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
+void grub_module_verify64(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
+void grub_module_verify32(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);

View File

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 6 deletions(-) 1 file changed, 6 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 895ed1430d5..36ae895f10c 100644 index d3e3bfd4d7a..715d3a3ec02 100644
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -2185,12 +2185,6 @@ module = { @@ -2186,12 +2186,6 @@ module = {
module = { module = {
name = efi_netfs; name = efi_netfs;
common = net/efi/efi_netfs.c; common = net/efi/efi_netfs.c;

View File

@ -0,0 +1,97 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 12 Jul 2018 11:00:45 -0400
Subject: [PATCH] Rework how the fdt command builds.
Trying to avoid all variants of:
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
grub_fdt_install in linux is not defined
grub_fdt_load in linux is not defined
grub_fdt_unload in linux is not defined
grub_fdt_install in xen_boot is not defined
grub_fdt_load in xen_boot is not defined
grub_fdt_unload in xen_boot is not defined
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 5 ++---
grub-core/lib/fdt.c | 2 --
grub-core/loader/efi/fdt.c | 2 ++
grub-core/Makefile.am | 1 +
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 715d3a3ec02..203584fb00b 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -166,7 +166,6 @@ kernel = {
arm_coreboot = kern/arm/coreboot/init.c;
arm_coreboot = kern/arm/coreboot/timer.c;
arm_coreboot = kern/arm/coreboot/coreboot.S;
- arm_coreboot = lib/fdt.c;
arm_coreboot = bus/fdt.c;
arm_coreboot = term/ps2.c;
arm_coreboot = term/arm/pl050.c;
@@ -317,6 +316,8 @@ kernel = {
arm64 = kern/arm64/dl.c;
arm64 = kern/arm64/dl_helper.c;
+ fdt = lib/fdt.c;
+
emu = disk/host.c;
emu = kern/emu/cache_s.S;
emu = kern/emu/hostdisk.c;
@@ -1714,7 +1715,6 @@ module = {
arm_uboot = loader/arm/linux.c;
arm64 = loader/arm64/linux.c;
emu = loader/emu/linux.c;
- fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1725,7 +1725,6 @@ module = {
module = {
name = fdt;
efi = loader/efi/fdt.c;
- common = lib/fdt.c;
enable = fdt;
};
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
index 0d371c5633e..37e04bd69e7 100644
--- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c
@@ -21,8 +21,6 @@
#include <grub/mm.h>
#include <grub/dl.h>
-GRUB_MOD_LICENSE ("GPLv3+");
-
#define FDT_SUPPORTED_VERSION 17
#define FDT_BEGIN_NODE 0x00000001
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index a4c6e803645..a9dbcfdfeaf 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -26,6 +26,8 @@
#include <grub/efi/fdtload.h>
#include <grub/efi/memory.h>
+GRUB_MOD_LICENSE ("GPLv3+");
+
static void *loaded_fdt;
static void *fdt;
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 3781bb9cbb9..4062652506d 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h

View File

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 2 Aug 2018 10:56:38 -0400
Subject: [PATCH] Disable non-wordsize allocations on arm
Signed-off-by: Peter Jones <pjones@redhat.com>
---
configure.ac | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index 819212095ff..9323c125469 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1234,6 +1234,26 @@ if test "x$target_cpu" = xarm; then
done
])
+ AC_CACHE_CHECK([for options to disable movt and movw relocations],
+ grub_cv_target_cc_mword_relocations,
+ [grub_cv_target_cc_mword_relocations=no
+ for cand in "-mword-relocations" ; do
+ if test x"$grub_cv_target_cc_mword_relocations" != xno ; then
+ break
+ fi
+ CFLAGS="$TARGET_CFLAGS $cand -Werror"
+ CPPFLAGS="$TARGET_CPPFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [grub_cv_target_cc_mword_relocations="$cand"],
+ [])
+ done
+ ])
+ if test x"$grub_cv_target_cc_mword_relocations" = xno ; then
+ AC_MSG_ERROR(["your compiler doesn't support disabling movw/movt relocations"])
+ else
+ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mword_relocations"
+ fi
+
if test x"$grub_cv_target_cc_mno_movt" != xno ; then
# A trick so that clang doesn't see it on link stage
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_movt"

View File

@ -198,29 +198,31 @@ Patch0197: 0197-00_menu_auto_hide-Reduce-number-of-save_env-calls.patch
Patch0198: 0198-30_uefi-firmware-fix-use-with-sys-firmware-efi-efiva.patch Patch0198: 0198-30_uefi-firmware-fix-use-with-sys-firmware-efi-efiva.patch
Patch0199: 0199-gentpl-add-disable-support.patch Patch0199: 0199-gentpl-add-disable-support.patch
Patch0200: 0200-gentpl-add-pc-firmware-type.patch Patch0200: 0200-gentpl-add-pc-firmware-type.patch
Patch0201: 0201-Make-the-reboot-module-be-linked-more-like-the-exit-.patch Patch0201: 0201-blscfg-remove-unused-typedef.patch
Patch0202: 0202-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch Patch0202: 0202-blscfg-don-t-dynamically-allocate-default_blsdir.patch
Patch0203: 0203-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch Patch0203: 0203-blscfg-sort-BLS-entries-by-version-field.patch
Patch0204: 0204-blscfg-remove-unused-typedef.patch Patch0204: 0204-blscfg-remove-NULL-guards-around-grub_free.patch
Patch0205: 0205-blscfg-don-t-dynamically-allocate-default_blsdir.patch Patch0205: 0205-blscfg-fix-filename-in-no-linux-key-error.patch
Patch0206: 0206-blscfg-sort-BLS-entries-by-version-field.patch Patch0206: 0206-blscfg-don-t-leak-bls_entry.filename.patch
Patch0207: 0207-blscfg-remove-NULL-guards-around-grub_free.patch Patch0207: 0207-blscfg-fix-compilation-on-EFI-and-EMU.patch
Patch0208: 0208-blscfg-fix-filename-in-no-linux-key-error.patch Patch0208: 0208-Add-loadenv-to-blscfg-and-loadenv-source-file-list.patch
Patch0209: 0209-blscfg-don-t-leak-bls_entry.filename.patch Patch0209: 0209-blscfg-Get-rid-of-the-linuxefi-linux16-linux-distinc.patch
Patch0210: 0210-blscfg-fix-compilation-on-EFI-and-EMU.patch Patch0210: 0210-grub-switch-to-blscfg-Only-fix-boot-prefix-for-non-g.patch
Patch0211: 0211-Add-loadenv-to-blscfg-and-loadenv-source-file-list.patch Patch0211: 0211-blscfg-Expand-the-BLS-options-field-instead-of-showi.patch
Patch0212: 0212-blscfg-Get-rid-of-the-linuxefi-linux16-linux-distinc.patch Patch0212: 0212-blscfg-Fallback-to-search-BLS-snippets-in-boot-loade.patch
Patch0213: 0213-grub-switch-to-blscfg-Only-fix-boot-prefix-for-non-g.patch Patch0213: 0213-blscfg-Don-t-attempt-to-sort-by-version-if-not-prese.patch
Patch0214: 0214-blscfg-Expand-the-BLS-options-field-instead-of-showi.patch Patch0214: 0214-blscfg-remove-logic-to-read-the-grubenv-file-and-set.patch
Patch0215: 0215-blscfg-Fallback-to-search-BLS-snippets-in-boot-loade.patch Patch0215: 0215-Rename-00_menu_auto_hide.in-to-01_menu_auto_hide.in.patch
Patch0216: 0216-blscfg-Don-t-attempt-to-sort-by-version-if-not-prese.patch Patch0216: 0216-Boot-Counting.patch
Patch0217: 0217-Fix-an-8-year-old-typo.patch Patch0217: 0217-efinet-also-use-the-firmware-acceleration-for-http.patch
Patch0218: 0218-Rework-how-the-fdt-command-builds.patch Patch0218: 0218-efi-http-Make-root_url-reflect-the-protocol-hostname.patch
Patch0219: 0219-autogen-don-t-run-autoreconf-in-the-topdir.patch Patch0219: 0219-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch
Patch0220: 0220-Force-everything-to-use-python3.patch Patch0220: 0220-Force-everything-to-use-python3.patch
Patch0221: 0221-Rename-00_menu_auto_hide.in-to-01_menu_auto_hide.in.patch Patch0221: 0221-Fix-an-8-year-old-typo.patch
Patch0222: 0222-Boot-Counting.patch Patch0222: 0222-autogen-don-t-run-autoreconf-in-the-topdir.patch
Patch0223: 0223-blscfg-remove-logic-to-read-the-grubenv-file-and-set.patch Patch0223: 0223-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch
Patch0224: 0224-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch Patch0224: 0224-module-verifier-make-it-possible-to-run-checkers-on-.patch
Patch0225: 0225-efinet-also-use-the-firmware-acceleration-for-http.patch Patch0225: 0225-grub-module-verifier-report-the-filename-or-modname-.patch
Patch0226: 0226-Make-root_url-reflect-the-protocol-hostname-of-our-b.patch Patch0226: 0226-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch
Patch0227: 0227-Rework-how-the-fdt-command-builds.patch
Patch0228: 0228-Disable-non-wordsize-allocations-on-arm.patch

View File

@ -7,7 +7,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.02 Version: 2.02
Release: 46%{?dist} Release: 47%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base Group: System Environment/Base
License: GPLv3+ License: GPLv3+
@ -486,6 +486,9 @@ fi
%endif %endif
%changelog %changelog
* Thu Aug 02 2018 Peter Jones <pjones@redhat.com> - 2.02-47
- Enable armv7 EFI builds. This was way harder than I expected.
* Tue Jul 17 2018 Peter Jones <pjones@redhat.com> - 2.02-46 * Tue Jul 17 2018 Peter Jones <pjones@redhat.com> - 2.02-46
- Fix some minor BLS issues - Fix some minor BLS issues
- Rework the FDT module linking to make aarch64 build and boot right - Rework the FDT module linking to make aarch64 build and boot right