8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Peter Jones <pjones@redhat.com>
8631a2
Date: Thu, 12 Jul 2018 11:00:45 -0400
8631a2
Subject: [PATCH] Rework how the fdt command builds.
8631a2
8631a2
Trying to avoid all variants of:
8631a2
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
8631a2
grub_fdt_install in linux is not defined
8631a2
grub_fdt_load in linux is not defined
8631a2
grub_fdt_unload in linux is not defined
8631a2
grub_fdt_install in xen_boot is not defined
8631a2
grub_fdt_load in xen_boot is not defined
8631a2
grub_fdt_unload in xen_boot is not defined
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 grub-core/Makefile.core.def | 5 ++---
8631a2
 grub-core/lib/fdt.c         | 2 --
8631a2
 grub-core/loader/efi/fdt.c  | 2 ++
8631a2
 include/grub/fdt.h          | 4 ++++
8631a2
 grub-core/Makefile.am       | 1 +
8631a2
 5 files changed, 9 insertions(+), 5 deletions(-)
8631a2
8631a2
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
f6e916
index e35217b86..cf3d549d2 100644
8631a2
--- a/grub-core/Makefile.core.def
8631a2
+++ b/grub-core/Makefile.core.def
8631a2
@@ -166,7 +166,6 @@ kernel = {
8631a2
   arm_coreboot = kern/arm/coreboot/init.c;
8631a2
   arm_coreboot = kern/arm/coreboot/timer.c;
8631a2
   arm_coreboot = kern/arm/coreboot/coreboot.S;
8631a2
-  arm_coreboot = lib/fdt.c;
8631a2
   arm_coreboot = bus/fdt.c;
8631a2
   arm_coreboot = term/ps2.c;
8631a2
   arm_coreboot = term/arm/pl050.c;
8631a2
@@ -317,6 +316,8 @@ kernel = {
8631a2
   arm64 = kern/arm64/dl.c;
8631a2
   arm64 = kern/arm64/dl_helper.c;
8631a2
 
8631a2
+  fdt = lib/fdt.c;
8631a2
+
8631a2
   emu = disk/host.c;
8631a2
   emu = kern/emu/cache_s.S;
8631a2
   emu = kern/emu/hostdisk.c;
8631a2
@@ -1714,7 +1715,6 @@ module = {
8631a2
   arm_uboot = loader/arm/linux.c;
8631a2
   arm64 = loader/arm64/linux.c;
8631a2
   emu = loader/emu/linux.c;
8631a2
-  fdt = lib/fdt.c;
8631a2
 
8631a2
   common = loader/linux.c;
8631a2
   common = lib/cmdline.c;
8631a2
@@ -1725,7 +1725,6 @@ module = {
8631a2
 module = {
8631a2
   name = fdt;
8631a2
   efi = loader/efi/fdt.c;
8631a2
-  common = lib/fdt.c;
8631a2
   enable = fdt;
8631a2
 };
8631a2
 
8631a2
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
f6e916
index 0d371c563..37e04bd69 100644
8631a2
--- a/grub-core/lib/fdt.c
8631a2
+++ b/grub-core/lib/fdt.c
8631a2
@@ -21,8 +21,6 @@
8631a2
 #include <grub/mm.h>
8631a2
 #include <grub/dl.h>
8631a2
 
8631a2
-GRUB_MOD_LICENSE ("GPLv3+");
8631a2
-
8631a2
 #define FDT_SUPPORTED_VERSION	17
8631a2
 
8631a2
 #define FDT_BEGIN_NODE	0x00000001
8631a2
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
f6e916
index a4c6e8036..a9dbcfdfe 100644
8631a2
--- a/grub-core/loader/efi/fdt.c
8631a2
+++ b/grub-core/loader/efi/fdt.c
8631a2
@@ -26,6 +26,8 @@
8631a2
 #include <grub/efi/fdtload.h>
8631a2
 #include <grub/efi/memory.h>
8631a2
 
8631a2
+GRUB_MOD_LICENSE ("GPLv3+");
8631a2
+
8631a2
 static void *loaded_fdt;
8631a2
 static void *fdt;
8631a2
 
8631a2
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
f6e916
index 158b1bc4b..6ee57e11a 100644
8631a2
--- a/include/grub/fdt.h
8631a2
+++ b/include/grub/fdt.h
8631a2
@@ -19,6 +19,8 @@
8631a2
 #ifndef GRUB_FDT_HEADER
8631a2
 #define GRUB_FDT_HEADER	1
8631a2
 
8631a2
+#if defined(__arm__) || defined(__aarch64__)
8631a2
+
8631a2
 #include <grub/types.h>
8631a2
 #include <grub/symbol.h>
8631a2
 
8631a2
@@ -141,4 +143,6 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch
8631a2
   grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16);  \
8631a2
 })
8631a2
 
8631a2
+#endif /* defined(__arm__) || defined(__aarch64__) */
8631a2
+
8631a2
 #endif	/* ! GRUB_FDT_HEADER */
8631a2
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
f6e916
index 3781bb9cb..406265250 100644
8631a2
--- a/grub-core/Makefile.am
8631a2
+++ b/grub-core/Makefile.am
8631a2
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
8631a2
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
8631a2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h