Signed-off-by: Xiaotian Wu <wuxiaot...@loongson.cn> Signed-off-by: Zhou Yang <zhouy...@loongson.cn> --- Makefile.util.def | 1 + configure.ac | 22 ++++++++++++++++- gentpl.py | 25 ++++++++++--------- grub-core/Makefile.am | 6 +++++ grub-core/Makefile.core.def | 16 ++++++++++++ include/grub/efi/api.h | 2 +- include/grub/util/install.h | 1 + util/grub-install-common.c | 49 +++++++++++++++++++------------------ util/grub-install.c | 16 ++++++++++++ util/grub-mknetdir.c | 1 + util/grub-mkrescue.c | 8 ++++++ util/mkimage.c | 16 ++++++++++++ 12 files changed, 125 insertions(+), 38 deletions(-)
diff --git a/Makefile.util.def b/Makefile.util.def index d919c562c..765c6fea2 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -163,6 +163,7 @@ library = { common = grub-core/kern/ia64/dl_helper.c; common = grub-core/kern/arm/dl_helper.c; common = grub-core/kern/arm64/dl_helper.c; + common = grub-core/kern/loongarch64/dl_helper.c; common = grub-core/lib/minilzo/minilzo.c; common = grub-core/lib/xzembed/xz_dec_bcj.c; common = grub-core/lib/xzembed/xz_dec_lzma2.c; diff --git a/configure.ac b/configure.ac index 90f686f79..71f65a70d 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,7 @@ case "$target_cpu" in ;; arm*) target_cpu=arm ;; aarch64*) target_cpu=arm64 ;; + loongarch64) target_cpu=loongarch64 ;; riscv32*) target_cpu=riscv32 ;; riscv64*) target_cpu=riscv64 ;; esac @@ -144,6 +145,7 @@ if test "x$with_platform" = x; then ia64-*) platform=efi ;; arm-*) platform=uboot ;; arm64-*) platform=efi ;; + loongarch64-*) platform=efi;; riscv32-*) platform=efi ;; riscv64-*) platform=efi ;; *) @@ -194,6 +196,7 @@ case "$target_cpu"-"$platform" in arm-coreboot) ;; arm-efi) ;; arm64-efi) ;; + loongarch64-efi) ;; riscv32-efi) ;; riscv64-efi) ;; *-emu) ;; @@ -855,6 +858,20 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ); then fi fi +if test "x$target_cpu" = xloongarch64; then + AC_CACHE_CHECK([whether -Wa,-mla-global-with-abs works], [grub_cv_cc_mla_global_with_abs], [ + CFLAGS="$TARGET_CFLAGS -Wa,-mla-global-with-abs -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mla_global_with_abs=yes], + [grub_cv_cc_mla_global_with_abs=no]) + ]) + + if test "x$grub_cv_cc_mla_global_with_abs" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -Wa,-mla-global-with-abs" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs" + fi +fi + # GRUB doesn't use float or doubles at all. Yet some toolchains may decide # that floats are a good fit to run instead of what's written in the code. # Given that floating point unit is disabled (if present to begin with) @@ -1216,7 +1233,8 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) LDFLAGS="$TARGET_LDFLAGS" -if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then +if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 \ + || test "$target_cpu" = loongarch64 ; then # Use large model to support 4G memory AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ CFLAGS="$TARGET_CFLAGS -mcmodel=large" @@ -1996,6 +2014,8 @@ AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen]) AM_CONDITIONAL([COND_i386_xen_pvh], [test x$target_cpu = xi386 -a x$platform = xxen_pvh]) +AM_CONDITIONAL([COND_loongarch64], [test x$target_cpu = xloongarch64]) +AM_CONDITIONAL([COND_loongarch64_efi], [test x$target_cpu = xloongarch64 -a x$platform = xefi]) AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc]) AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) diff --git a/gentpl.py b/gentpl.py index 9f51e4fb6..fa53e17e8 100644 --- a/gentpl.py +++ b/gentpl.py @@ -32,27 +32,28 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "mips_loongson", "sparc64_ieee1275", "powerpc_ieee1275", "mips_arc", "ia64_efi", "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi", - "arm_coreboot", "riscv32_efi", "riscv64_efi" ] + "arm_coreboot", "loongarch64_efi", "riscv32_efi", "riscv64_efi" ] GROUPS = {} GROUPS["common"] = GRUB_PLATFORMS[:] # Groups based on CPU -GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ] -GROUPS["x86_64"] = [ "x86_64_efi" ] -GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] -GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ] -GROUPS["sparc64"] = [ "sparc64_ieee1275" ] -GROUPS["powerpc"] = [ "powerpc_ieee1275" ] -GROUPS["arm"] = [ "arm_uboot", "arm_efi", "arm_coreboot" ] -GROUPS["arm64"] = [ "arm64_efi" ] -GROUPS["riscv32"] = [ "riscv32_efi" ] -GROUPS["riscv64"] = [ "riscv64_efi" ] +GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ] +GROUPS["x86_64"] = [ "x86_64_efi" ] +GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] +GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ] +GROUPS["sparc64"] = [ "sparc64_ieee1275" ] +GROUPS["powerpc"] = [ "powerpc_ieee1275" ] +GROUPS["arm"] = [ "arm_uboot", "arm_efi", "arm_coreboot" ] +GROUPS["arm64"] = [ "arm64_efi" ] +GROUPS["loongarch64"] = [ "loongarch64_efi" ] +GROUPS["riscv32"] = [ "riscv32_efi" ] +GROUPS["riscv64"] = [ "riscv64_efi" ] # Groups based on firmware GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi", - "riscv32_efi", "riscv64_efi" ] + "loongarch64_efi", "riscv32_efi", "riscv64_efi" ] GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] GROUPS["uboot"] = [ "arm_uboot" ] GROUPS["xen"] = [ "i386_xen", "x86_64_xen" ] diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index ee88e44e9..aa933b93c 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -288,6 +288,12 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h endif +if COND_loongarch64_efi +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h +endif + if COND_riscv32_efi KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 5212dfab1..33543b1df 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -67,6 +67,9 @@ kernel = { arm64_efi_ldflags = '-Wl,-r'; arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame'; + loongarch64_efi_ldflags = '-Wl,-r'; + loongarch64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame'; + riscv32_efi_ldflags = '-Wl,-r'; riscv32_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame'; @@ -122,6 +125,7 @@ kernel = { arm_coreboot_startup = kern/arm/startup.S; arm_efi_startup = kern/arm/efi/startup.S; arm64_efi_startup = kern/arm64/efi/startup.S; + loongarch64_efi_startup = kern/loongarch64/efi/startup.S; riscv32_efi_startup = kern/riscv/efi/startup.S; riscv64_efi_startup = kern/riscv/efi/startup.S; @@ -260,6 +264,9 @@ kernel = { arm64_efi = kern/arm64/efi/init.c; arm64_efi = kern/efi/fdt.c; + loongarch64_efi = kern/loongarch64/efi/init.c; + loongarch64_efi = kern/efi/fdt.c; + riscv32_efi = kern/riscv/efi/init.c; riscv32_efi = kern/efi/fdt.c; @@ -338,6 +345,11 @@ kernel = { arm64 = kern/arm64/dl.c; arm64 = kern/arm64/dl_helper.c; + loongarch64 = kern/loongarch64/cache.c; + loongarch64 = kern/loongarch64/cache_flush.S; + loongarch64 = kern/loongarch64/dl.c; + loongarch64 = kern/loongarch64/dl_helper.c; + riscv32 = kern/riscv/cache.c; riscv32 = kern/riscv/cache_flush.S; riscv32 = kern/riscv/dl.c; @@ -838,6 +850,7 @@ module = { enable = arm64_efi; enable = arm_uboot; enable = arm_coreboot; + enable = loongarch64_efi; enable = riscv32_efi; enable = riscv64_efi; }; @@ -1719,6 +1732,7 @@ module = { extra_dist = lib/arm/setjmp.S; extra_dist = lib/arm64/setjmp.S; extra_dist = lib/riscv/setjmp.S; + extra_dist = lib/loongarch64/setjmp.S; }; module = { @@ -1820,6 +1834,7 @@ module = { arm_efi = loader/arm64/linux.c; arm_uboot = loader/arm/linux.c; arm64 = loader/arm64/linux.c; + loongarch64 = loader/loongarch64/linux.c; riscv32 = loader/riscv/linux.c; riscv64 = loader/riscv/linux.c; common = loader/linux.c; @@ -1916,6 +1931,7 @@ module = { enable = ia64_efi; enable = arm_efi; enable = arm64_efi; + enable = loongarch64_efi; enable = riscv32_efi; enable = riscv64_efi; enable = mips; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 1ef404622..ed3e70fb9 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1751,7 +1751,7 @@ typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t; #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ - || defined(__riscv) + || defined(__riscv) || defined (__loongarch__) #define efi_call_0(func) func() #define efi_call_1(func, a) func(a) diff --git a/include/grub/util/install.h b/include/grub/util/install.h index 7d7445af9..35cf17a8d 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -107,6 +107,7 @@ enum grub_install_plat GRUB_INSTALL_PLATFORM_I386_XEN_PVH, GRUB_INSTALL_PLATFORM_ARM64_EFI, GRUB_INSTALL_PLATFORM_ARM_COREBOOT, + GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI, GRUB_INSTALL_PLATFORM_RISCV32_EFI, GRUB_INSTALL_PLATFORM_RISCV64_EFI, GRUB_INSTALL_PLATFORM_MAX diff --git a/util/grub-install-common.c b/util/grub-install-common.c index e45fb2903..57ac4456c 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -886,30 +886,31 @@ static struct const char *platform; } platforms[GRUB_INSTALL_PLATFORM_MAX] = { - [GRUB_INSTALL_PLATFORM_I386_PC] = { "i386", "pc" }, - [GRUB_INSTALL_PLATFORM_I386_EFI] = { "i386", "efi" }, - [GRUB_INSTALL_PLATFORM_I386_QEMU] = { "i386", "qemu" }, - [GRUB_INSTALL_PLATFORM_I386_COREBOOT] = { "i386", "coreboot" }, - [GRUB_INSTALL_PLATFORM_I386_MULTIBOOT] = { "i386", "multiboot" }, - [GRUB_INSTALL_PLATFORM_I386_IEEE1275] = { "i386", "ieee1275" }, - [GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64", "efi" }, - [GRUB_INSTALL_PLATFORM_I386_XEN] = { "i386", "xen" }, - [GRUB_INSTALL_PLATFORM_X86_64_XEN] = { "x86_64", "xen" }, - [GRUB_INSTALL_PLATFORM_I386_XEN_PVH] = { "i386", "xen_pvh" }, - [GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON] = { "mipsel", "loongson" }, - [GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS] = { "mipsel", "qemu_mips" }, - [GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS] = { "mips", "qemu_mips" }, - [GRUB_INSTALL_PLATFORM_MIPSEL_ARC] = { "mipsel", "arc" }, - [GRUB_INSTALL_PLATFORM_MIPS_ARC] = { "mips", "arc" }, - [GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275] = { "sparc64", "ieee1275" }, - [GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc", "ieee1275" }, - [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, - [GRUB_INSTALL_PLATFORM_ARM_COREBOOT] = { "arm", "coreboot" }, - [GRUB_INSTALL_PLATFORM_RISCV32_EFI] = { "riscv32", "efi" }, - [GRUB_INSTALL_PLATFORM_RISCV64_EFI] = { "riscv64", "efi" }, + [GRUB_INSTALL_PLATFORM_I386_PC] = { "i386", "pc" }, + [GRUB_INSTALL_PLATFORM_I386_EFI] = { "i386", "efi" }, + [GRUB_INSTALL_PLATFORM_I386_QEMU] = { "i386", "qemu" }, + [GRUB_INSTALL_PLATFORM_I386_COREBOOT] = { "i386", "coreboot" }, + [GRUB_INSTALL_PLATFORM_I386_MULTIBOOT] = { "i386", "multiboot" }, + [GRUB_INSTALL_PLATFORM_I386_IEEE1275] = { "i386", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64", "efi" }, + [GRUB_INSTALL_PLATFORM_I386_XEN] = { "i386", "xen" }, + [GRUB_INSTALL_PLATFORM_X86_64_XEN] = { "x86_64", "xen" }, + [GRUB_INSTALL_PLATFORM_I386_XEN_PVH] = { "i386", "xen_pvh" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON] = { "mipsel", "loongson" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS] = { "mipsel", "qemu_mips" }, + [GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS] = { "mips", "qemu_mips" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_ARC] = { "mipsel", "arc" }, + [GRUB_INSTALL_PLATFORM_MIPS_ARC] = { "mips", "arc" }, + [GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275] = { "sparc64", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, + [GRUB_INSTALL_PLATFORM_ARM_COREBOOT] = { "arm", "coreboot" }, + [GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI] = { "loongarch64", "efi" }, + [GRUB_INSTALL_PLATFORM_RISCV32_EFI] = { "riscv32", "efi" }, + [GRUB_INSTALL_PLATFORM_RISCV64_EFI] = { "riscv64", "efi" }, }; char * diff --git a/util/grub-install.c b/util/grub-install.c index 7b04bd3c5..aa868e6b5 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -324,6 +324,8 @@ get_default_platform (void) return "arm64-efi"; #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__) return grub_install_get_default_x86_platform (); +#elif defined (__loongarch64) + return "loongarch64-efi"; #elif defined (__riscv) #if __riscv_xlen == 32 return "riscv32-efi"; @@ -485,6 +487,7 @@ have_bootdev (enum grub_install_plat pl) case GRUB_INSTALL_PLATFORM_IA64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_I386_IEEE1275: @@ -910,6 +913,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_X86_64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -957,6 +961,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_X86_64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -1012,6 +1017,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_X86_64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -1132,6 +1138,9 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_ARM64_EFI: efi_file = "BOOTAA64.EFI"; break; + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: + efi_file = "BOOTLOONGARCH64.EFI"; + break; case GRUB_INSTALL_PLATFORM_RISCV32_EFI: efi_file = "BOOTRISCV32.EFI"; break; @@ -1165,6 +1174,9 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_ARM64_EFI: efi_file = "grubaa64.efi"; break; + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: + efi_file = "grubloongarch64.efi"; + break; case GRUB_INSTALL_PLATFORM_RISCV32_EFI: efi_file = "grubriscv32.efi"; break; @@ -1473,6 +1485,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_X86_64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -1568,6 +1581,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_X86_64_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -1673,6 +1687,7 @@ main (int argc, char *argv[]) break; case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -1927,6 +1942,7 @@ main (int argc, char *argv[]) /* FALLTHROUGH */ case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: case GRUB_INSTALL_PLATFORM_RISCV32_EFI: case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c index d609ff94c..46f304c2b 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -108,6 +108,7 @@ static const struct [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64-efi", "efinet", ".efi" }, [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm-efi", "efinet", ".efi" }, [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64-efi", "efinet", ".efi" }, + [GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI] = { "loongarch64-efi", "efinet", ".efi" }, [GRUB_INSTALL_PLATFORM_RISCV32_EFI] = { "riscv32-efi", "efinet", ".efi" }, [GRUB_INSTALL_PLATFORM_RISCV64_EFI] = { "riscv64-efi", "efinet", ".efi" }, }; diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index ba89b1394..145aeed74 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -542,6 +542,7 @@ main (int argc, char *argv[]) || source_dirs[GRUB_INSTALL_PLATFORM_IA64_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_ARM_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_ARM64_EFI] + || source_dirs[GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_RISCV32_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_RISCV64_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_X86_64_EFI]) @@ -742,6 +743,7 @@ main (int argc, char *argv[]) || source_dirs[GRUB_INSTALL_PLATFORM_IA64_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_ARM_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_ARM64_EFI] + || source_dirs[GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_RISCV32_EFI] || source_dirs[GRUB_INSTALL_PLATFORM_RISCV64_EFI]) { @@ -778,6 +780,12 @@ main (int argc, char *argv[]) imgname); free (imgname); + imgname = grub_util_path_concat (2, efidir_efi_boot, "bootloongarch64.efi"); + make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI, + "loongarch64-efi", + imgname); + free (imgname); + imgname = grub_util_path_concat (2, efidir_efi_boot, "bootriscv32.efi"); make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_RISCV32_EFI, "riscv32-efi", imgname); diff --git a/util/mkimage.c b/util/mkimage.c index 43078c71c..4237383ac 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -622,6 +622,22 @@ static const struct grub_install_image_target_desc image_targets[] = .pe_target = GRUB_PE32_MACHINE_ARM64, .elf_target = EM_AARCH64, }, + { + .dirname = "loongarch64-efi", + .names = { "loongarch64-efi", NULL }, + .voidp_sizeof = 8, + .bigendian = 0, + .id = IMAGE_EFI, + .flags = PLATFORM_FLAGS_NONE, + .total_module_size = TARGET_NO_FIELD, + .decompressor_compressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_addr = TARGET_NO_FIELD, + .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .vaddr_offset = EFI64_HEADER_SIZE, + .pe_target = GRUB_PE32_MACHINE_LOONGARCH64, + .elf_target = EM_LOONGARCH, + }, { .dirname = "riscv32-efi", .names = { "riscv32-efi", NULL }, -- 2.35.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel