grub2/0361-Don-t-build-the-fdt-command.patch
2018-07-17 10:50:12 -04:00

190 lines
5.4 KiB
Diff

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] Don't build the fdt command
Don't build the fdt command separately but *do* build it into the arm64 kernel.
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 | 15 ++++++++++++---
grub-core/kern/efi/fdt.c | 43 -------------------------------------------
grub-core/loader/efi/fdt.c | 22 ++++++++++++++++++++++
include/grub/efi/efi.h | 4 ----
4 files changed, 34 insertions(+), 50 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 8a967f42ef9..83e71aeb844 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -242,10 +242,8 @@ kernel = {
arm_efi = kern/arm/efi/init.c;
arm_efi = kern/arm/efi/misc.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;
@@ -1694,11 +1692,17 @@ module = {
enable = i386_pc;
};
+/*
module = {
name = xen_boot;
arm64 = loader/arm64/xen_boot.c;
+
+ fdt = lib/fdt.c;
+ fdt = loader/efi/fdt.c;
+
enable = arm64;
};
+*/
module = {
name = linux;
@@ -1714,7 +1718,9 @@ module = {
arm = loader/arm/linux.c;
arm64 = loader/arm64/linux.c;
emu = loader/emu/linux.c;
+
fdt = lib/fdt.c;
+ fdt = loader/efi/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1722,12 +1728,14 @@ module = {
efi = loader/efi/linux.c;
};
+/*
module = {
name = fdt;
arm64 = loader/efi/fdt.c;
common = lib/fdt.c;
enable = fdt;
};
+*/
module = {
name = xnu;
@@ -1788,7 +1796,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/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/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index a4c6e803645..55c09a19939 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -35,6 +35,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/efi/efi.h b/include/grub/efi/efi.h
index 29b4dbac1e4..f54828aaeae 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -123,10 +123,6 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,
char **path);
-#if defined(__arm__) || defined(__aarch64__)
-void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
-#endif
-
grub_addr_t grub_efi_section_addr (const char *section);
void grub_efi_mm_init (void);