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