3e07ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3e07ee
From: Peter Jones <pjones@redhat.com>
e15314
Date: Thu, 11 Jul 2019 13:01:41 +0200
3e07ee
Subject: [PATCH] Rework how the fdt command builds.
3e07ee
3e07ee
Trying to avoid all variants of:
3e07ee
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
3e07ee
grub_fdt_install in linux is not defined
3e07ee
grub_fdt_load in linux is not defined
3e07ee
grub_fdt_unload in linux is not defined
3e07ee
grub_fdt_install in xen_boot is not defined
3e07ee
grub_fdt_load in xen_boot is not defined
3e07ee
grub_fdt_unload in xen_boot is not defined
3e07ee
3e07ee
Signed-off-by: Peter Jones <pjones@redhat.com>
3e07ee
---
3e07ee
 grub-core/Makefile.core.def | 5 ++---
3e07ee
 grub-core/lib/fdt.c         | 2 --
3e07ee
 grub-core/loader/efi/fdt.c  | 2 ++
976325
 include/grub/fdt.h          | 4 ++++
3e07ee
 grub-core/Makefile.am       | 1 +
976325
 5 files changed, 9 insertions(+), 5 deletions(-)
3e07ee
3e07ee
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
e15314
index 48491b50683..556adca7074 100644
3e07ee
--- a/grub-core/Makefile.core.def
3e07ee
+++ b/grub-core/Makefile.core.def
e15314
@@ -175,7 +175,6 @@ kernel = {
3e07ee
   arm_coreboot = kern/arm/coreboot/init.c;
3e07ee
   arm_coreboot = kern/arm/coreboot/timer.c;
3e07ee
   arm_coreboot = kern/arm/coreboot/coreboot.S;
3e07ee
-  arm_coreboot = lib/fdt.c;
3e07ee
   arm_coreboot = bus/fdt.c;
3e07ee
   arm_coreboot = term/ps2.c;
3e07ee
   arm_coreboot = term/arm/pl050.c;
e15314
@@ -348,6 +347,8 @@ kernel = {
e15314
   riscv64 = kern/riscv/cache_flush.S;
e15314
   riscv64 = kern/riscv/dl.c;
3e07ee
 
3e07ee
+  fdt = lib/fdt.c;
3e07ee
+
3e07ee
   emu = disk/host.c;
3e07ee
   emu = kern/emu/cache_s.S;
3e07ee
   emu = kern/emu/hostdisk.c;
e15314
@@ -1801,7 +1802,6 @@ module = {
e15314
   riscv32 = loader/riscv/linux.c;
e15314
   riscv64 = loader/riscv/linux.c;
3e07ee
   emu = loader/emu/linux.c;
3e07ee
-  fdt = lib/fdt.c;
3e07ee
 
3e07ee
   common = loader/linux.c;
3e07ee
   common = lib/cmdline.c;
e15314
@@ -1812,7 +1812,6 @@ module = {
3e07ee
 module = {
3e07ee
   name = fdt;
3e07ee
   efi = loader/efi/fdt.c;
3e07ee
-  common = lib/fdt.c;
3e07ee
   enable = fdt;
3e07ee
 };
3e07ee
 
3e07ee
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
3e07ee
index 0d371c5633e..37e04bd69e7 100644
3e07ee
--- a/grub-core/lib/fdt.c
3e07ee
+++ b/grub-core/lib/fdt.c
3e07ee
@@ -21,8 +21,6 @@
3e07ee
 #include <grub mm.h="">
3e07ee
 #include <grub dl.h="">
3e07ee
 
3e07ee
-GRUB_MOD_LICENSE ("GPLv3+");
3e07ee
-
3e07ee
 #define FDT_SUPPORTED_VERSION	17
3e07ee
 
3e07ee
 #define FDT_BEGIN_NODE	0x00000001
3e07ee
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
e15314
index ee9c5592c70..37ca407bb36 100644
3e07ee
--- a/grub-core/loader/efi/fdt.c
3e07ee
+++ b/grub-core/loader/efi/fdt.c
3e07ee
@@ -26,6 +26,8 @@
3e07ee
 #include <grub efi="" fdtload.h="">
3e07ee
 #include <grub efi="" memory.h="">
3e07ee
 
3e07ee
+GRUB_MOD_LICENSE ("GPLv3+");
3e07ee
+
3e07ee
 static void *loaded_fdt;
3e07ee
 static void *fdt;
3e07ee
 
976325
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
e15314
index e609c7e4111..22b7c5463fc 100644
976325
--- a/include/grub/fdt.h
976325
+++ b/include/grub/fdt.h
976325
@@ -19,6 +19,8 @@
976325
 #ifndef GRUB_FDT_HEADER
976325
 #define GRUB_FDT_HEADER	1
976325
 
976325
+#if defined(__arm__) || defined(__aarch64__)
976325
+
976325
 #include <grub types.h="">
976325
 #include <grub symbol.h="">
976325
 
e15314
@@ -144,4 +146,6 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch
976325
   grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16);  \
976325
 })
976325
 
976325
+#endif /* defined(__arm__) || defined(__aarch64__) */
976325
+
976325
 #endif	/* ! GRUB_FDT_HEADER */
3e07ee
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
e15314
index d9ad30052f1..ee9c4e4eb88 100644
3e07ee
--- a/grub-core/Makefile.am
3e07ee
+++ b/grub-core/Makefile.am
3e07ee
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
3e07ee
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
3e07ee
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h