]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
最近收到一些特殊的错误报告,最后证明是非标准的Ventoy环境的原因。尤其是单分区下环境下使用 Ventoy 。
authorlongpanda <admin@ventoy.net>
Fri, 13 Nov 2020 08:39:15 +0000 (16:39 +0800)
committerlongpanda <admin@ventoy.net>
Fri, 13 Nov 2020 08:39:15 +0000 (16:39 +0800)
虽然 Ventoy 显示了 Unofficial 的标注信息,但是用户并不会关心,仍然会认为是 Ventoy 的问题。

Ventoy 从一开始就是一个整体的设计,并没有考虑过集成在其他bootloader或分区环境中。
Ventoy 的验证和后续新功能开发也都不会考虑这种非标准的使用方式。

因此,我决定禁止 Ventoy 在非标准环境下的使用,并且不再接受放开检查的请求。

当然,这个只是Ventoy的默认行为。Ventoy仍然是100%开源的,如果你希望把Ventoy应用在自己的环境中,你可以fork一个分支,然后修改源代码实现。

EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c

index edb676914f704ac74ea4213a552843d2488ae1ec..4a3a98c91f750d15f40d858e0e3b1d4c224c2848 100644 (file)
@@ -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, 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"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)
 }
 #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();
     if (pEnv[0] != '0' || pEnv[1] != 0)
     {
         ventoy_warn_invalid_device();
+        return EFI_INVALID_PARAMETER;
     }
     
     g_file_replace_list = &pGrubParam->file_replace;
     }
     
     g_file_replace_list = &pGrubParam->file_replace;
index 7113e86ef4b4427cadd70840fbf6cad12259e33c..b774f859041b71b803e99796573e94859b0daf2f 100644 (file)
@@ -185,7 +185,7 @@ typedef struct ventoy_virt_chunk
   #error Unknown Processor Type
 #endif
 
   #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
 #define VTOY_WARNING  L"!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!"
 
 typedef struct ventoy_sector_flag
index 7c47357da77c84d3284918119eb02de30ab54bcc..8be06582c1ff6070cd432c23a20c86c42d8b3a6d 100644 (file)
@@ -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");
 
     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(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();
         
         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);
 
         ret = ventoy_check_device(dev);
         grub_device_close(dev);
 
-        if (ret & 0x1000)
+        if (ret)
         {
             grub_exit();            
         }
         {
             grub_exit();            
         }