3e07ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3e07ee
From: Peter Jones <pjones@redhat.com>
3e07ee
Date: Thu, 12 Jul 2018 11:00:45 -0400
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
3e07ee
index 715d3a3ec02..203584fb00b 100644
3e07ee
--- a/grub-core/Makefile.core.def
3e07ee
+++ b/grub-core/Makefile.core.def
3e07ee
@@ -166,7 +166,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;
3e07ee
@@ -317,6 +316,8 @@ kernel = {
3e07ee
   arm64 = kern/arm64/dl.c;
3e07ee
   arm64 = kern/arm64/dl_helper.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;
3e07ee
@@ -1714,7 +1715,6 @@ module = {
3e07ee
   arm_uboot = loader/arm/linux.c;
3e07ee
   arm64 = loader/arm64/linux.c;
3e07ee
   emu = loader/emu/linux.c;
3e07ee
-  fdt = lib/fdt.c;
3e07ee
 
3e07ee
   common = loader/linux.c;
3e07ee
   common = lib/cmdline.c;
3e07ee
@@ -1725,7 +1725,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
3e07ee
index a4c6e803645..a9dbcfdfeaf 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
976325
index 158b1bc4b3a..6ee57e11ab3 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
 
976325
@@ -141,4 +143,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
3e07ee
index 3781bb9cbb9..4062652506d 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