summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2023-02-28 18:05:18 +0100
committerJan Janssen <medhefgo@web.de>2023-03-10 11:41:08 +0100
commit31ffb6b183bafb4c005ba86bf10f961e07e42e0c (patch)
tree572ddbec2418fdc1bba0f882b044fe5f02058c1a /tools
parentc4ad9b23cafd67e87abbcdcb186db470a5a487e4 (diff)
downloadsystemd-31ffb6b183bafb4c005ba86bf10f961e07e42e0c.tar.gz
boot: Add RISCV32 and LoongArch support
This is completely untested, but should work in theory, as it's just adding a couple defines according to the specs.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/elf2efi.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/elf2efi.py b/tools/elf2efi.py
index b26af1f38d..2ca9d248e7 100755
--- a/tools/elf2efi.py
+++ b/tools/elf2efi.py
@@ -336,6 +336,7 @@ def convert_elf_reloc_table(
"EM_386": ENUM_RELOC_TYPE_i386["R_386_NONE"],
"EM_AARCH64": ENUM_RELOC_TYPE_AARCH64["R_AARCH64_NONE"],
"EM_ARM": ENUM_RELOC_TYPE_ARM["R_ARM_NONE"],
+ "EM_LOONGARCH": 0,
"EM_RISCV": 0,
"EM_X86_64": ENUM_RELOC_TYPE_x64["R_X86_64_NONE"],
}[elf["e_machine"]]
@@ -344,6 +345,7 @@ def convert_elf_reloc_table(
"EM_386": ENUM_RELOC_TYPE_i386["R_386_RELATIVE"],
"EM_AARCH64": ENUM_RELOC_TYPE_AARCH64["R_AARCH64_RELATIVE"],
"EM_ARM": ENUM_RELOC_TYPE_ARM["R_ARM_RELATIVE"],
+ "EM_LOONGARCH": 3,
"EM_RISCV": 3,
"EM_X86_64": ENUM_RELOC_TYPE_x64["R_X86_64_RELATIVE"],
}[elf["e_machine"]]
@@ -465,7 +467,8 @@ def elf2efi(args: argparse.Namespace):
"EM_386": 0x014C,
"EM_AARCH64": 0xAA64,
"EM_ARM": 0x01C2,
- "EM_RISCV": 0x5064,
+ "EM_LOONGARCH": 0x6232 if elf.elfclass == 32 else 0x6264,
+ "EM_RISCV": 0x5032 if elf.elfclass == 32 else 0x5064,
"EM_X86_64": 0x8664,
}.get(elf["e_machine"])
if pe_arch is None: