From c40640c6d144c3d062052e456999f664b2c311f7 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 26 Aug 2024 09:50:56 +0800 Subject: [PATCH] grub-core/ventoy: add some define and code for loongarch64 Signed-off-by: Wentao Guan --- GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c | 5 +++++ GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h | 3 +++ GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c index 38927df8..55d63242 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c @@ -316,6 +316,11 @@ static int ventoy_arch_mode_init(void) g_ventoy_plat_data = VTOY_PLAT_MIPS_UEFI; grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "mips"); } + else if (grub_strcmp(GRUB_TARGET_CPU, "loongarch64") == 0) + { + g_ventoy_plat_data = VTOY_PLAT_LOONGARCH64_UEFI; + grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "loongarch64"); + } else { g_ventoy_plat_data = VTOY_PLAT_X86_64_UEFI; diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h index d51a33ce..013f8622 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h @@ -69,12 +69,15 @@ #define VTOY_PLAT_X86_64_UEFI 0x55454649 #define VTOY_PLAT_X86_LEGACY 0x42494f53 #define VTOY_PLAT_MIPS_UEFI 0x4D495053 +#define VTOY_PLAT_LOONGARCH64_UEFI 0xf595124d #define VTOY_COMM_CPIO "ventoy.cpio" #if defined(__arm__) || defined(__aarch64__) #define VTOY_ARCH_CPIO "ventoy_arm64.cpio" #elif defined(__mips__) #define VTOY_ARCH_CPIO "ventoy_mips64.cpio" +#elif defined(__loongarch__) +#define VTOY_ARCH_CPIO "ventoy_loongarch64.cpio" #else #define VTOY_ARCH_CPIO "ventoy_x86.cpio" #endif diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c index 93ebeb92..b43fed4b 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c @@ -1547,6 +1547,11 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg debug("cpio busybox proc %s\n", args[3]); ventoy_cpio_busybox64((cpio_newc_header *)g_ventoy_cpio_buf, "m64"); } + else if (grub_strcmp(args[3], "busybox=l64") == 0) + { + debug("cpio busybox proc %s\n", args[3]); + ventoy_cpio_busybox64((cpio_newc_header *)g_ventoy_cpio_buf, "l64"); + } VENTOY_CMD_RETURN(GRUB_ERR_NONE); }