Default to using GRUB_MM_ADD_REGION_IN_RANGE on risc-v. This
is because the current grub risc-v ELF loader does not support
some of the relocations produced by -mcmodel=large (e.g. when
compiled with -mcmodel=large grub-mkimage returns 'error:
relocation 0x2b is not implemented yet.'), so it has to be
compiled with -mcmodel=medany, which only works if the grub code
fits in 2GiB.

Signed-off-by: Adriano Cordova <adriano.cord...@canonical.com>
---
 grub-core/kern/efi/mm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index 47cd297a5..7dc2274a1 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -677,6 +677,10 @@ grub_efi_mm_add_regions (grub_size_t required_bytes, 
unsigned int flags)
      from smaller regions.  */
   sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end);
 
+#if defined (__riscv)
+  flags |= GRUB_MM_ADD_REGION_IN_RANGE;
+#endif
+
   /* Allocate memory regions for GRUB's memory management.  */
   err = add_memory_regions (filtered_memory_map, desc_size,
                            filtered_memory_map_end,
-- 
2.48.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to