dcavalca / rpms / grub2

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