grub-core/ventoy: add some define and code for loongarch64

Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
This commit is contained in:
Wentao Guan 2024-08-26 09:50:56 +08:00
parent 066a25975f
commit c40640c6d1
3 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);
}