From 8bbd5a14a3ca4820266bed6afc1314c3f41e76c3 Mon Sep 17 00:00:00 2001 From: longpanda Date: Fri, 13 Nov 2020 16:39:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E8=BF=91=E6=94=B6=E5=88=B0=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E7=89=B9=E6=AE=8A=E7=9A=84=E9=94=99=E8=AF=AF=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=EF=BC=8C=E6=9C=80=E5=90=8E=E8=AF=81=E6=98=8E=E6=98=AF?= =?UTF-8?q?=E9=9D=9E=E6=A0=87=E5=87=86=E7=9A=84Ventoy=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=9A=84=E5=8E=9F=E5=9B=A0=E3=80=82=E5=B0=A4=E5=85=B6=E6=98=AF?= =?UTF-8?q?=E5=8D=95=E5=88=86=E5=8C=BA=E4=B8=8B=E7=8E=AF=E5=A2=83=E4=B8=8B?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20Ventoy=20=E3=80=82=20=E8=99=BD=E7=84=B6=20?= =?UTF-8?q?Ventoy=20=E6=98=BE=E7=A4=BA=E4=BA=86=20Unofficial=20=E7=9A=84?= =?UTF-8?q?=E6=A0=87=E6=B3=A8=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=B9=B6=E4=B8=8D=E4=BC=9A=E5=85=B3=E5=BF=83?= =?UTF-8?q?=EF=BC=8C=E4=BB=8D=E7=84=B6=E4=BC=9A=E8=AE=A4=E4=B8=BA=E6=98=AF?= =?UTF-8?q?=20Ventoy=20=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ventoy 从一开始就是一个整体的设计,并没有考虑过集成在其他bootloader或分区环境中。 Ventoy 的验证和后续新功能开发也都不会考虑这种非标准的使用方式。 因此,我决定禁止 Ventoy 在非标准环境下的使用,并且不再接受放开检查的请求。 当然,这个只是Ventoy的默认行为。Ventoy仍然是100%开源的,如果你希望把Ventoy应用在自己的环境中,你可以fork一个分支,然后修改源代码实现。 --- .../MdeModulePkg/Application/Ventoy/Ventoy.c | 7 ++++--- .../MdeModulePkg/Application/Ventoy/Ventoy.h | 2 +- GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c | 9 ++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c index edb67691..4a3a98c9 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c @@ -408,12 +408,12 @@ STATIC VOID ventoy_warn_invalid_device(VOID) 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) @@ -718,6 +718,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle) if (pEnv[0] != '0' || pEnv[1] != 0) { ventoy_warn_invalid_device(); + return EFI_INVALID_PARAMETER; } g_file_replace_list = &pGrubParam->file_replace; diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h index 7113e86e..b774f859 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h @@ -185,7 +185,7 @@ typedef struct ventoy_virt_chunk #error Unknown Processor Type #endif -#define VENTOY_DEVICE_WARN 0 +#define VENTOY_DEVICE_WARN 1 #define VTOY_WARNING L"!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!" typedef struct ventoy_sector_flag 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 7c47357d..8be06582 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 @@ -1639,15 +1639,14 @@ int ventoy_check_device_result(int ret) grub_env_set("VTOY_CHKDEV_RESULT_STRING", buf); grub_env_export("VTOY_CHKDEV_RESULT_STRING"); - if (ret & 0x1000) + if (ret) { grub_printf(VTOY_WARNING"\n"); grub_printf(VTOY_WARNING"\n"); grub_printf(VTOY_WARNING"\n\n\n"); - grub_printf("Unsatisfied conditions detected for Ventoy.\n\n"); - grub_printf("This is NOT a standard Ventoy device and is NOT officially supported.\n\n"); - grub_printf("Recommend to follow the instructions in https://www.ventoy.net to use Ventoy.\n"); + grub_printf("This is NOT a standard Ventoy device and is NOT supported.\n\n"); + grub_printf("You should follow the instructions in https://www.ventoy.net to use Ventoy.\n"); grub_printf("\n\nWill exit after 10 seconds ...... "); grub_refresh(); @@ -3522,7 +3521,7 @@ static grub_err_t ventoy_cmd_load_part_table(grub_extcmd_context_t ctxt, int arg ret = ventoy_check_device(dev); grub_device_close(dev); - if (ret & 0x1000) + if (ret) { grub_exit(); }