nalika / rpms / grub2

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