mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-06-29 06:28:13 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d51e76daa9 | ||
|
|
f677d72e8d | ||
|
|
6418c2a09f | ||
|
|
c2a3f181c0 |
@@ -190,7 +190,6 @@ EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
||||
Status = gBS->StartImage(ChildHandle, NULL, NULL);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
@@ -199,7 +198,6 @@ EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
||||
END:
|
||||
|
||||
CheckBSFreePool(DevDpStr);
|
||||
@@ -604,7 +602,6 @@ STATIC BOOLEAN EFIAPI IsSecureBootEnabled(VOID)
|
||||
STATIC EFI_STATUS EFIAPI EnvInit(VOID)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = SHIM_LOCK_GUID;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&gDpToText);
|
||||
if (EFI_ERROR(Status) || !gDpToText || !gDpToText->ConvertDevicePathToText)
|
||||
@@ -620,13 +617,6 @@ STATIC EFI_STATUS EFIAPI EnvInit(VOID)
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&gShimLock);
|
||||
if (EFI_ERROR(Status) || !gShimLock)
|
||||
{
|
||||
vLog(L"Failed to locate SHIM LOCK Protocol %lx", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -638,21 +628,35 @@ EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = SHIM_LOCK_GUID;
|
||||
unhook_system_services_pf Func = NULL;
|
||||
|
||||
/* If secure boot is not enabled, nothing needed, just launch Ventoy grub */
|
||||
if (!IsSecureBootEnabled())
|
||||
{
|
||||
return LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
}
|
||||
|
||||
Status = EnvInit();
|
||||
if (EFI_ERROR(Status))
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to prepare env");
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* If secure boot is not enabled, nothing needed, just launch Ventoy grub */
|
||||
if (!IsSecureBootEnabled())
|
||||
{
|
||||
Status = LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to launch %s", REAL_GRUB_FILE);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&gShimLock);
|
||||
if (EFI_ERROR(Status) || !gShimLock)
|
||||
{
|
||||
vErr(L"Failed to locate SHIM LOCK Protocol %lx", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = InstallVtoyShimProtocol();
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
@@ -696,6 +700,11 @@ EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
|
||||
/* Finally launch Ventoy grub */
|
||||
Status = LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to finally launch real grub %s", REAL_GRUB_FILE);
|
||||
goto END;
|
||||
}
|
||||
|
||||
END:
|
||||
|
||||
|
||||
@@ -6413,6 +6413,19 @@ static grub_err_t ventoy_cmd_load_menu_lang(grub_extcmd_context_t ctxt, int argc
|
||||
VENTOY_CMD_RETURN(0);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_update_sb_policy(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
ventoy_set_sb_policy();
|
||||
#endif
|
||||
|
||||
VENTOY_CMD_RETURN(0);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_sb_info(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
@@ -7095,6 +7108,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_linux_initrd", ventoy_cmd_linux_initrd, 0, NULL, "", "", NULL },
|
||||
|
||||
{ "vt_sbinfo", ventoy_cmd_sb_info, 0, NULL, "", "", NULL },
|
||||
{ "vt_update_sb_policy", ventoy_cmd_update_sb_policy, 0, NULL, "", "", NULL },
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2556,10 +2556,6 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
|
||||
grub_env_unset("VTOY_MENU_TIP_ENABLE");
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
ventoy_set_sb_policy();
|
||||
#endif
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
|
||||
@@ -2449,7 +2449,7 @@ function mimg_common_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.1.13"
|
||||
set VENTOY_VERSION="1.1.15"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -2551,6 +2551,10 @@ else
|
||||
vt_check_json_path_case $vtoy_iso_part
|
||||
fi
|
||||
|
||||
#Update Secure Boot Policy
|
||||
vt_update_sb_policy
|
||||
|
||||
|
||||
if [ -n "$VTOY_MENU_LANGUAGE" ]; then
|
||||
vt_init_menu_lang "$VTOY_MENU_LANGUAGE"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user