nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Javier Martinez Canillas <javierm@redhat.com>
5593c8
Date: Tue, 27 Aug 2019 10:34:24 +0200
5593c8
Subject: [PATCH] Fix build error with the fdt module on risc-v
5593c8
5593c8
The risc-v architecture also uses Device Trees, but the symbols in the
5593c8
fdt header aren't defined for this arch which lead to following error:
5593c8
5593c8
BUILDSTDERR: ../../grub-core/loader/efi/fdt.c: In function 'grub_fdt_load':
5593c8
BUILDSTDERR: ../../grub-core/loader/efi/fdt.c:48:39: warning: implicit declaration of function 'grub_fdt_get_totalsize' [-Wimplicit-function-declaration]
5593c8
BUILDSTDERR:    48 |       size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt));
5593c8
5593c8
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
5593c8
---
5593c8
 include/grub/fdt.h | 6 ++++--
5593c8
 1 file changed, 4 insertions(+), 2 deletions(-)
5593c8
5593c8
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
d3c3ab
index 2041341fd68..3514aa4a5b6 100644
5593c8
--- a/include/grub/fdt.h
5593c8
+++ b/include/grub/fdt.h
5593c8
@@ -19,7 +19,8 @@
5593c8
 #ifndef GRUB_FDT_HEADER
5593c8
 #define GRUB_FDT_HEADER	1
5593c8
 
5593c8
-#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__aarch64__))
5593c8
+#if !defined(GRUB_MACHINE_EMU) && \
5593c8
+    (defined(__arm__) || defined(__aarch64__) || defined(__riscv))
5593c8
 
5593c8
 #include <grub/types.h>
5593c8
 #include <grub/symbol.h>
5593c8
@@ -146,6 +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
 
5593c8
-#endif /* defined(__arm__) || defined(__aarch64__) */
5593c8
+#endif /* !defined(GRUB_MACHINE_EMU) && \
5593c8
+          (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */
5593c8
 
5593c8
 #endif	/* ! GRUB_FDT_HEADER */