Blame SOURCES/0142-chainloader-Define-machine-types-for-RISC-V.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
5593c8
Date: Sat, 9 Nov 2019 18:06:32 +0000
5593c8
Subject: [PATCH] chainloader: Define machine types for RISC-V
5593c8
5593c8
The commit "Add secureboot support on efi chainloader" didn't add machine
5593c8
types for RISC-V, so this patch adds them.
5593c8
5593c8
Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not
5593c8
supported yet. This patch might need a new revision once that's the case.
5593c8
5593c8
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
5593c8
---
5593c8
 grub-core/loader/efi/chainloader.c | 4 ++++
5593c8
 1 file changed, 4 insertions(+)
5593c8
5593c8
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
1c6ba0
index 47f5aa1481..ac8dfd40c6 100644
5593c8
--- a/grub-core/loader/efi/chainloader.c
5593c8
+++ b/grub-core/loader/efi/chainloader.c
5593c8
@@ -333,6 +333,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) =
5593c8
   GRUB_PE32_MACHINE_I386;
5593c8
 #elif defined(__ia64__)
5593c8
   GRUB_PE32_MACHINE_IA64;
5593c8
+#elif defined(__riscv) && (__riscv_xlen == 32)
5593c8
+  GRUB_PE32_MACHINE_RISCV32;
5593c8
+#elif defined(__riscv) && (__riscv_xlen == 64)
5593c8
+  GRUB_PE32_MACHINE_RISCV64;
5593c8
 #else
5593c8
 #error this architecture is not supported by grub2
5593c8
 #endif