Blame SOURCES/0090-Rework-how-the-fdt-command-builds.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Peter Jones <pjones@redhat.com>
5593c8
Date: Thu, 11 Jul 2019 13:01:41 +0200
5593c8
Subject: [PATCH] Rework how the fdt command builds.
5593c8
5593c8
Trying to avoid all variants of:
5593c8
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
5593c8
grub_fdt_install in linux is not defined
5593c8
grub_fdt_load in linux is not defined
5593c8
grub_fdt_unload in linux is not defined
5593c8
grub_fdt_install in xen_boot is not defined
5593c8
grub_fdt_load in xen_boot is not defined
5593c8
grub_fdt_unload in xen_boot is not defined
5593c8
5593c8
Signed-off-by: Peter Jones <pjones@redhat.com>
fd0330
[javierm: Fix build with platform emu, aarch64, and risc-v]
fd0330
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
fd0330
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
5593c8
---
5593c8
 grub-core/Makefile.core.def | 5 ++---
5593c8
 grub-core/lib/fdt.c         | 2 --
5593c8
 grub-core/loader/efi/fdt.c  | 2 ++
fd0330
 include/grub/fdt.h          | 6 ++++++
5593c8
 grub-core/Makefile.am       | 1 +
fd0330
 5 files changed, 11 insertions(+), 5 deletions(-)
5593c8
5593c8
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
fd0330
index 12797336c9..4e7d90da76 100644
5593c8
--- a/grub-core/Makefile.core.def
5593c8
+++ b/grub-core/Makefile.core.def
5593c8
@@ -177,7 +177,6 @@ kernel = {
5593c8
   arm_coreboot = kern/arm/coreboot/init.c;
5593c8
   arm_coreboot = kern/arm/coreboot/timer.c;
5593c8
   arm_coreboot = kern/arm/coreboot/coreboot.S;
5593c8
-  arm_coreboot = lib/fdt.c;
5593c8
   arm_coreboot = bus/fdt.c;
5593c8
   arm_coreboot = term/ps2.c;
5593c8
   arm_coreboot = term/arm/pl050.c;
5593c8
@@ -351,6 +350,8 @@ kernel = {
5593c8
   riscv64 = kern/riscv/cache_flush.S;
5593c8
   riscv64 = kern/riscv/dl.c;
5593c8
 
5593c8
+  fdt = lib/fdt.c;
5593c8
+
5593c8
   emu = disk/host.c;
5593c8
   emu = kern/emu/cache_s.S;
5593c8
   emu = kern/emu/hostdisk.c;
5593c8
@@ -1825,7 +1826,6 @@ module = {
5593c8
   riscv32 = loader/riscv/linux.c;
5593c8
   riscv64 = loader/riscv/linux.c;
5593c8
   emu = loader/emu/linux.c;
5593c8
-  fdt = lib/fdt.c;
5593c8
 
5593c8
   common = loader/linux.c;
5593c8
   common = lib/cmdline.c;
fd0330
@@ -1837,7 +1837,6 @@ module = {
5593c8
 module = {
5593c8
   name = fdt;
5593c8
   efi = loader/efi/fdt.c;
5593c8
-  common = lib/fdt.c;
5593c8
   enable = fdt;
5593c8
 };
5593c8
 
5593c8
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
fd0330
index 0d371c5633..37e04bd69e 100644
5593c8
--- a/grub-core/lib/fdt.c
5593c8
+++ b/grub-core/lib/fdt.c
5593c8
@@ -21,8 +21,6 @@
5593c8
 #include <grub/mm.h>
5593c8
 #include <grub/dl.h>
5593c8
 
5593c8
-GRUB_MOD_LICENSE ("GPLv3+");
5593c8
-
5593c8
 #define FDT_SUPPORTED_VERSION	17
5593c8
 
5593c8
 #define FDT_BEGIN_NODE	0x00000001
5593c8
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
fd0330
index c86f283d75..c572415d38 100644
5593c8
--- a/grub-core/loader/efi/fdt.c
5593c8
+++ b/grub-core/loader/efi/fdt.c
5593c8
@@ -27,6 +27,8 @@
5593c8
 #include <grub/efi/memory.h>
5593c8
 #include <grub/cpu/efi/memory.h>
5593c8
 
5593c8
+GRUB_MOD_LICENSE ("GPLv3+");
5593c8
+
5593c8
 static void *loaded_fdt;
5593c8
 static void *fdt;
5593c8
 
5593c8
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
fd0330
index e609c7e411..3514aa4a5b 100644
5593c8
--- a/include/grub/fdt.h
5593c8
+++ b/include/grub/fdt.h
fd0330
@@ -19,6 +19,9 @@
5593c8
 #ifndef GRUB_FDT_HEADER
5593c8
 #define GRUB_FDT_HEADER	1
5593c8
 
fd0330
+#if !defined(GRUB_MACHINE_EMU) && \
fd0330
+    (defined(__arm__) || defined(__aarch64__) || defined(__riscv))
5593c8
+
5593c8
 #include <grub/types.h>
5593c8
 #include <grub/symbol.h>
5593c8
 
fd0330
@@ -144,4 +147,7 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch
5593c8
   grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16);  \
5593c8
 })
5593c8
 
fd0330
+#endif /* !defined(GRUB_MACHINE_EMU) && \
fd0330
+          (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */
5593c8
+
5593c8
 #endif	/* ! GRUB_FDT_HEADER */
5593c8
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
fd0330
index bfd29a3bf0..c2e8a82bce 100644
5593c8
--- a/grub-core/Makefile.am
5593c8
+++ b/grub-core/Makefile.am
5593c8
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
5593c8
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
5593c8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h