]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/grub/grub.cfg
Auto use memdisk mode for KolibriOS.iso
[Ventoy.git] / INSTALL / grub / grub.cfg
index e110bc869fa39900f7afd6fc65dbc3455de407ab..feb8b2ac85b470c09f65116988e4581e4df46d8a 100644 (file)
@@ -65,10 +65,6 @@ function ventoy_vcfg_proc {
     fi
 }
 
-function ventoy_power {
-    configfile $prefix/power.cfg
-}
-
 function ventoy_diagnosis {
     vt_enum_video_mode    
     configfile $prefix/debug.cfg
@@ -261,6 +257,10 @@ function distro_specify_initrd_file {
         vt_linux_specify_initrd_file /isolinux/initrd.gz
     fi
     
+    if vt_str_begin "$vt_volume_id" "QUBES"; then 
+        vt_linux_specify_initrd_file /images/pxeboot/initrd.img
+    fi
+    
     if [ "$vt_chosen_size" = "1133375488" ]; then
         if [ -d (loop)/boot/grub/x86_64-efi ]; then
             vt_cpio_busybox64 "64h"
@@ -362,6 +362,9 @@ function distro_specify_initrd_file_phase2 {
         vt_linux_specify_initrd_file /pyabr/boot/initrfs.img
     elif [ -f (loop)/initrd0.img ]; then
         vt_linux_specify_initrd_file /initrd0.img
+    elif [ -f (loop)/sysresccd/boot/i686/sysresccd.img ]; then
+        vt_linux_specify_initrd_file /sysresccd/boot/i686/sysresccd.img
+    
     
     fi
 }
@@ -743,7 +746,16 @@ function uefi_linux_menu_func {
         ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
         ventoy_cli_console     
 
+        unset vtGrub2Mode
         if vt_check_mode 3; then
+            set vtGrub2Mode=1
+        elif vt_str_begin "$vt_volume_id" "KRD"; then
+            if [ -f (loop)/boot/grub/grub.cfg.sig ]; then
+                set vtGrub2Mode=1
+            fi
+        fi
+
+        if [ -n "$vtGrub2Mode" ]; then
             ventoy_debug_pause
         else
             if [ "$VTOY_EFI_ARCH" != "mips" ]; then
@@ -1291,14 +1303,32 @@ function iso_common_menuentry {
         set vtcompat=1
     fi
 
+
+    # auto memdisk mode for some special ISO files
+    vt_iso_vd_id_parse "${vtoy_iso_part}${vt_chosen_path}"    
+    unset vtMemDiskBoot
+    if vt_check_mode 0; then
+        set vtMemDiskBoot=1
+    else
+        if [ "$grub_platform" = "pc" ]; then
+            if vt_iso_vd_id_begin 1 0 "Memtest86+"; then
+                set vtMemDiskBoot=1
+            elif vt_iso_vd_id_begin 0 1 "KolibriOS"; then
+                set vtMemDiskBoot=1
+            fi
+        fi 
+    fi
+    vt_iso_vd_id_clear
+        
+
     if [ "$grub_platform" = "pc" ]; then
-        if vt_check_mode 0; then
+        if [ -n "$vtMemDiskBoot" ]; then
             legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
         else
             legacy_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
         fi
     else
-        if vt_check_mode 0; then
+        if [ -n "$vtMemDiskBoot" ]; then
             uefi_iso_memdisk $vtoy_iso_part  "$vt_chosen_path"
         else
             uefi_iso_menu_func $vtoy_iso_part  "$vt_chosen_path"
@@ -2070,7 +2100,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.66"
+set VENTOY_VERSION="1.0.70"
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
@@ -2078,7 +2108,7 @@ set VTOY_PARAM_NO_ACPI=1
 # Default menu display mode, you can change it as you want.
 #    0: List mode   
 #    1: TreeView mode
-set VTOY_DEFAULT_MENU_MODE=1
+set VTOY_DEFAULT_MENU_MODE=0
 
 set VTOY_MEM_DISK_STR="[Memdisk]"
 set VTOY_ISO_RAW_STR="Compatible Mode"
@@ -2086,7 +2116,7 @@ set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
 set VTOY_WIMBOOT_MODE_STR="WIMBOOT Mode"
 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
 
-set VTOY_F2_CMD="ventoy_power"
+set VTOY_F2_CMD="vt_browser_disk"
 set VTOY_F4_CMD="ventoy_localboot"
 set VTOY_F5_CMD="ventoy_diagnosis"
 set VTOY_F6_CMD="ventoy_ext_menu"
@@ -2184,10 +2214,10 @@ fi
 
 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
     set VTOY_F3_CMD="vt_dynamic_menu 1 1"
-    set VTOY_HOTKEY_TIP="h:Help  F1:Memdisk  F2:Power  F3:TreeView  F4:Localboot  F5:Tools  F6:ExMenu"
+    set VTOY_HOTKEY_TIP="h:Help  F1:Memdisk  F2:Browser  F3:TreeView  F4:Localboot  F5:Tools  F6:ExMenu"
 else
     set VTOY_F3_CMD="vt_dynamic_menu 1 0"
-    set VTOY_HOTKEY_TIP="h:Help  F1:Memdisk  F2:Power  F3:ListView  F4:Localboot  F5:Tools  F6:ExMenu"
+    set VTOY_HOTKEY_TIP="h:Help  F1:Memdisk  F2:Browser  F3:ListView  F4:Localboot  F5:Tools  F6:ExMenu"
 fi
 
 terminal_output  console
@@ -2293,6 +2323,32 @@ export VTOY_HELP_TXT_LANGUAGE
 export VTOY_CHKSUM_FILE_PATH
 
 
+#colect all image files (iso files)
+set ventoy_img_count=0
+vt_list_img $vtoy_iso_part ventoy_img_count
+
+#Main menu
+if [ $ventoy_img_count -gt 0 ]; then
+    if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
+        vt_dynamic_menu 0 0 
+    else
+        vt_dynamic_menu 0 1
+    fi
+else
+    if [ -n "$VTOY_NO_ISO_TIP" ]; then
+        NO_ISO_MENU="No ISO files found, $VTOY_NO_ISO_TIP"
+    elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
+        NO_ISO_MENU="No ISO files found, please check VTOY_DEFAULT_SEARCH_ROOT"
+    else
+        NO_ISO_MENU="No ISO files found"
+    fi
+    menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
+        echo -e "\n    Rebooting ... "
+        reboot
+    }
+fi
+
+
 #special VTOY_DEFAULT_IMAGE process
 if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
     if regexp --set 1:vtHotkey --set 2:vtDefault "(F[2-9])>(.*)" "$VTOY_DEFAULT_IMAGE"; then
@@ -2306,9 +2362,10 @@ if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
         
         export timeout
         export default
-        
+
         if [ "$vtHotkey" = "F2" ]; then
-            ventoy_power
+            unset timeout
+            vt_browser_disk
         elif [ "$vtHotkey" = "F4" ]; then
             ventoy_localboot
         elif [ "$vtHotkey" = "F5" ]; then
@@ -2322,27 +2379,3 @@ if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
     fi    
 fi
 
-#colect all image files (iso files)
-set ventoy_img_count=0
-vt_list_img $vtoy_iso_part ventoy_img_count
-
-#Main menu
-if [ $ventoy_img_count -gt 0 ]; then
-    if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
-        vt_dynamic_menu 0 0 
-    else
-        vt_dynamic_menu 0 1
-    fi
-else
-    if [ -n "$VTOY_NO_ISO_TIP" ]; then
-        NO_ISO_MENU="No ISO files found, $VTOY_NO_ISO_TIP"
-    elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
-        NO_ISO_MENU="No ISO files found, please check VTOY_DEFAULT_SEARCH_ROOT"
-    else
-        NO_ISO_MENU="No ISO files found"
-    fi
-    menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
-        echo -e "\n    Rebooting ... "
-        reboot
-    }
-fi