#include <Ventoy.h>
BOOLEAN gDebugPrint = FALSE;
+BOOLEAN gBootFallBack = FALSE;
BOOLEAN gDotEfiBoot = FALSE;
BOOLEAN gLoadIsoEfi = FALSE;
+BOOLEAN gIsoUdf = FALSE;
ventoy_ram_disk g_ramdisk_param;
ventoy_chain_head *g_chain;
+void *g_vtoy_img_location_buf;
ventoy_img_chunk *g_chunk;
UINT8 *g_os_param_reserved;
UINT32 g_img_chunk_num;
ventoy_efi_file_replace g_efi_file_replace;
CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
+CONST CHAR16 gUdfEfiDriverPath[] = UDF_EFI_DRIVER_PATH;
BOOLEAN g_fix_windows_1st_cdrom_issue = FALSE;
{
L"@",
EFI_REMOVABLE_MEDIA_FILE_NAME,
+#if defined (MDE_CPU_IA32)
+ L"\\EFI\\BOOT\\GRUBIA32.EFI",
+ L"\\EFI\\BOOT\\BOOTia32.EFI",
+ L"\\EFI\\BOOT\\bootia32.efi",
+ L"\\efi\\boot\\bootia32.efi",
+#elif defined (MDE_CPU_X64)
L"\\EFI\\BOOT\\GRUBX64.EFI",
L"\\EFI\\BOOT\\BOOTx64.EFI",
L"\\EFI\\BOOT\\bootx64.efi",
L"\\efi\\boot\\bootx64.efi",
+#elif defined (MDE_CPU_ARM)
+ L"\\EFI\\BOOT\\GRUBARM.EFI",
+ L"\\EFI\\BOOT\\BOOTarm.EFI",
+ L"\\EFI\\BOOT\\bootarm.efi",
+ L"\\efi\\boot\\bootarm.efi",
+#elif defined (MDE_CPU_AARCH64)
+ L"\\EFI\\BOOT\\GRUBAA64.EFI",
+ L"\\EFI\\BOOT\\BOOTaa64.EFI",
+ L"\\EFI\\BOOT\\bootaa64.efi",
+ L"\\efi\\boot\\bootaa64.efi",
+#endif
+
};
VOID EFIAPI VtoyDebug(IN CONST CHAR8 *Format, ...)
}
address = (UINTN)buffer;
+ g_vtoy_img_location_buf = buffer;
if (address % 4096)
{
gST->ConOut->OutputString(gST->ConOut, VTOY_WARNING L"\r\n");
gST->ConOut->OutputString(gST->ConOut, VTOY_WARNING L"\r\n\r\n\r\n");
- gST->ConOut->OutputString(gST->ConOut, L"This is NOT a standard Ventoy device and is NOT officially supported.\r\n\r\n");
+ gST->ConOut->OutputString(gST->ConOut, L"This is NOT a standard Ventoy device and is NOT supported.\r\n\r\n");
gST->ConOut->OutputString(gST->ConOut, L"You should follow the official instructions in https://www.ventoy.net\r\n");
- gST->ConOut->OutputString(gST->ConOut, L"\r\n\r\nWill continue to boot after 15 seconds ...... ");
+ gST->ConOut->OutputString(gST->ConOut, L"\r\n\r\nWill exit after 10 seconds ...... ");
- sleep(15);
+ sleep(10);
}
#else
STATIC VOID ventoy_warn_invalid_device(VOID)
EFI_HANDLE Image = NULL;
EFI_STATUS Status = EFI_SUCCESS;
CHAR16 LogVar[4] = L"5";
-
- Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
- gIso9660EfiDriverPath,
- sizeof(gIso9660EfiDriverPath),
- &Image);
- debug("load iso efi driver status:%r", Status);
+
+ if (gIsoUdf)
+ {
+ Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
+ gUdfEfiDriverPath,
+ sizeof(gUdfEfiDriverPath),
+ &Image);
+ debug("load iso UDF efi driver status:%r", Status);
+ }
+ else
+ {
+ Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
+ gIso9660EfiDriverPath,
+ sizeof(gIso9660EfiDriverPath),
+ &Image);
+ debug("load iso 9660 efi driver status:%r", Status);
+ }
if (gDebugPrint)
{
gDebugPrint = TRUE;
}
+ if (StrStr(pCmdLine, L"fallback"))
+ {
+ gBootFallBack = TRUE;
+ }
+
if (StrStr(pCmdLine, L"dotefi"))
{
gDotEfiBoot = TRUE;
{
gLoadIsoEfi = TRUE;
}
+
+ if (StrStr(pCmdLine, L"iso_udf"))
+ {
+ gIsoUdf = TRUE;
+ }
pPos = StrStr(pCmdLine, L"FirstTry=@");
if (pPos)
if (pEnv[0] != '0' || pEnv[1] != 0)
{
ventoy_warn_invalid_device();
+ return EFI_INVALID_PARAMETER;
}
g_file_replace_list = &pGrubParam->file_replace;
ventoy_delete_variable();
- if (g_chain->os_param.vtoy_img_location_addr)
+ if (g_vtoy_img_location_buf)
{
- FreePool((VOID *)(UINTN)g_chain->os_param.vtoy_img_location_addr);
+ FreePool(g_vtoy_img_location_buf);
}
- FreePool(g_chain);
+ if (!gMemdiskMode)
+ {
+ FreePool(g_chain);
+ }
return EFI_SUCCESS;
}
}
debug("Fs not found, now wait and retry...");
- sleep(2);
+ sleep(1);
}
}
ventoy_clean_env();
}
- if (FALSE == gDotEfiBoot)
+ if (FALSE == gDotEfiBoot && FALSE == gBootFallBack)
{
if (EFI_NOT_FOUND == Status)
{