]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/grub/grub.cfg
Don't force to use max resolution for VMware/VirtualBox. (#3140)
[Ventoy.git] / INSTALL / grub / grub.cfg
index 570fed3684858180816f1683e856812dd8842c12..5b1e300740b0601ae4ee7788e0079e1de510eaeb 100644 (file)
 # 
 #************************************************************************************
 
+if [ "$grub_platform" = "pc" ]; then
+    insmod setkey
+    insmod regexp
+fi
+
 function ventoy_pause {
     echo "press Enter to continue ......"
     read vtTmpPause
@@ -28,6 +33,23 @@ function ventoy_debug_pause {
     fi
 }
 
+
+function ventoy_max_resolution {
+    #Skip this for VM
+    smbios -t 1 -s 0x05 --set=system_product;
+    for vtPdt in "VMware"  "VirtualBox"; then
+        if vt_str_casebegin "$system_product"  "$vtPdt"; then
+            return
+        fi
+    fi
+
+    vt_enum_video_mode
+    vt_get_video_mode 0 vtCurMode
+    terminal_output console
+    set gfxmode=$vtCurMode
+    terminal_output gfxterm
+}
+
 function ventoy_cli_console {
     if [ -z "$vtoy_display_mode" ]; then
         terminal_output  console
@@ -65,8 +87,8 @@ function ventoy_vcfg_proc {
     fi
 }
 
-function ventoy_power {
-    configfile $prefix/power.cfg
+function ventoy_language {
+    configfile $prefix/menulang.cfg
 }
 
 function ventoy_diagnosis {
@@ -85,7 +107,7 @@ function ventoy_ext_menu {
         unset ventoy_new_context
     else
        echo "ventoy_grub.cfg NOT exist."
-       echo -e "\npress ENTER to exit ..."
+       echo -en "\n$VTLANG_ENTER_EXIT ..."
        read vtInputKey
     fi
 }
@@ -103,8 +125,9 @@ function ventoy_show_help {
         fi
 
         loopback vt_help_tarfs mem:${vtoy_help_txt_mem_addr}:size:${vtoy_help_txt_mem_size}
-        if [ -f "(vt_help_tarfs)/help/${VTOY_HELP_TXT_LANGUAGE}.txt" ]; then
-            cat "(vt_help_tarfs)/help/${VTOY_HELP_TXT_LANGUAGE}.txt"
+        vt_cur_menu_lang vtCurLang
+        if [ -f "(vt_help_tarfs)/help/${vtCurLang}.txt" ]; then
+            cat "(vt_help_tarfs)/help/${vtCurLang}.txt"
         else
             cat "(vt_help_tarfs)/help/en_US.txt"
         fi        
@@ -112,15 +135,27 @@ function ventoy_show_help {
     fi
 }
 
+function ventoy_load_menu_lang_file {
+    vt_load_file_to_mem "auto" $prefix/menu.tar.gz vtoy_menu_lang_mem
+    loopback vt_menu_tarfs mem:${vtoy_menu_lang_mem_addr}:size:${vtoy_menu_lang_mem_size}    
+}
+
 function get_os_type {
     set vtoy_os=Linux
-    
-    for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do        
-        if vt_file_exist_nocase (loop)/$file; then        
+    export vtoy_os
+
+    if vt_str_begin "$vt_volume_id" "DLC Boot"; then
+        if [ -f (loop)/DLCBoot.exe ]; then
             set vtoy_os=Windows
-            break
         fi
-    done
+    else
+        for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do        
+            if vt_file_exist_nocase (loop)/$file; then        
+                set vtoy_os=Windows            
+                break
+            fi
+        done
+    fi
 
     if [ "$vtoy_os" = "Linux" ]; then
         if vt_strstr "$vt_system_id" "FreeBSD"; then
@@ -156,7 +191,7 @@ function get_os_type {
 function vt_check_compatible_pe {
     #Check for PE without external tools
     #set compatible if ISO file is less than 80MB
-    if [ $vt_chosen_size -gt 33554432 -a $vt_chosen_size -le 83886080 ]; then
+    if [ $vt_chosen_size -GT 33554432 -a $vt_chosen_size -LE 83886080 ]; then
         set ventoy_compatible=YES    
     fi
 
@@ -166,6 +201,8 @@ function vt_check_compatible_pe {
 function vt_check_compatible_linux {
     if vt_str_begin "$vt_volume_id" "embootkit"; then
         set ventoy_compatible=YES
+    elif [ -e "$1/casper/tinycore.gz" ]; then
+        set ventoy_compatible=YES
     fi
 
     return
@@ -181,7 +218,7 @@ function locate_initrd {
 }
 
 function locate_wim {
-    vt_windows_locate_wim_patch (loop)
+    vt_windows_locate_wim_patch (loop) "$1"
     
     if [ -n "${vtdebug_flag}" ]; then
         echo '###############################################'
@@ -207,7 +244,18 @@ function distro_specify_wim_patch {
 function distro_specify_wim_patch_phase2 {
     if [ -f (loop)/boot/boot.wim ]; then
         vt_windows_collect_wim_patch wim /boot/boot.wim
+    elif [ -f (loop)/sources/boot.wim ]; then
+        vt_windows_collect_wim_patch wim /sources/boot.wim
+    fi
+
+    if vt_str_begin "$vt_volume_id" "DLC Boot"; then
+        for vwfile in "/DLC1/WinPE/W11x64.wim" "/DLC1/WinPE/W10x64.wim" "/DLC1/WinPE/W10x86.wim"; do
+            if [ -f (loop)/$vwfile ]; then
+                vt_windows_collect_wim_patch wim $vwfile
+            fi
+        done
     fi
+    
 }
 
 
@@ -259,6 +307,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"
@@ -360,20 +412,31 @@ 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
+    elif [ -f (loop)/boot/full.cz ]; then
+        vt_linux_specify_initrd_file /boot/full.cz
+    elif [ -f (loop)/images/pxeboot/initrd.img ]; then
+        vt_linux_specify_initrd_file /images/pxeboot/initrd.img
+    elif [ -f (loop)/live/initrd ]; then
+        vt_linux_specify_initrd_file /live/initrd
+    elif [ -f (loop)/initramfs-linux.img ]; then
+        vt_linux_specify_initrd_file /initramfs-linux.img
+    elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
+        vt_linux_specify_initrd_file /boot/isolinux/initrd.gz        
     fi
 }
 
+
 function ventoy_get_ghostbsd_ver {
     # fallback to parse version from elf /boot/kernel/kernel
     set vt_freebsd_ver=xx
 }
 
 function ventoy_get_furybsd_ver {
-    if regexp "13\.[0-9]" "$2"; then
-        set vt_freebsd_ver=13.x
-    else
-        set vt_freebsd_ver=12.x
+    set vt_freebsd_ver=12.x
+    if regexp --set 1:vtFuryVer "(14|13)\.[0-9]" "$2"; then
+        set vt_freebsd_ver=${vtFuryVer}.x
     fi
 }
 
@@ -382,12 +445,8 @@ function ventoy_get_freenas_ver {
 
     if [ -e (loop)/FreeNAS-MANIFEST ]; then
         vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
-        if regexp "^13\.[0-9]" "$vt_freenas_ver"; then
-            set vt_freebsd_ver=13.x
-        elif regexp "^12\.[0-9]" "$vt_freenas_ver"; then
-            set vt_freebsd_ver=12.x
-        elif regexp "^11\.[0-9]" "$vt_freenas_ver"; then
-            set vt_freebsd_ver=11.x
+        if regexp --set 1:vtNasVer "^(14|13|12|11)\.[0-9]" "$vt_freenas_ver"; then
+            set vt_freebsd_ver=${vtNasVer}.x        
         fi
     fi
 }
@@ -397,12 +456,8 @@ function ventoy_get_truenas_ver {
 
     if [ -e (loop)/TrueNAS-MANIFEST ]; then
         vt_parse_freenas_ver (loop)/TrueNAS-MANIFEST vt_truenas_ver
-        if regexp "^13\.[0-9]" "$vt_truenas_ver"; then
-            set vt_freebsd_ver=13.x
-        elif regexp "^12\.[0-9]" "$vt_truenas_ver"; then
-            set vt_freebsd_ver=12.x
-        elif regexp "^11\.[0-9]" "$vt_truenas_ver"; then
-            set vt_freebsd_ver=11.x
+        if regexp --set 1:vtTNasVer "^(14|13|12|11)\.[0-9]" "$vt_truenas_ver"; then
+            set vt_freebsd_ver=${vtTNasVer}.x        
         fi
     fi
 }
@@ -434,49 +489,25 @@ function ventoy_freebsd_proc {
         ventoy_get_truenas_ver "$1" "${chosen_path}"
     elif vt_strstr "$vt_volume_id" "FURYBSD"; then
         ventoy_get_furybsd_ver "$1" "${chosen_path}"  
-    elif regexp "^13_[0-9]" "$vt_volume_id"; then
-        set vt_freebsd_ver=13.x
-    elif regexp "^12_[0-9]" "$vt_volume_id"; then
-        set vt_freebsd_ver=12.x
-    elif regexp "^11_[0-9]" "$vt_volume_id"; then
-        set vt_freebsd_ver=11.x
-    elif regexp "^10_[0-9]" "$vt_volume_id"; then
-        set vt_freebsd_ver=10.x
-    elif regexp "^9_[0-9]" "$vt_volume_id"; then
-        set vt_freebsd_ver=9.x
+    elif regexp --set 1:vtBsdVerNum "^(14|13|12|11|10|9)_[0-9]" "$vt_volume_id"; then
+        set vt_freebsd_ver=${vtBsdVerNum}.x    
     elif [ -d (loop)/usr/midnightbsd-dist ]; then
         ventoy_get_midnightbsd_ver "$1" "${chosen_path}"
         set vtFreeBsdDistro=MidnightBSD
     elif [ -e (loop)/bin/freebsd-version ]; then
-        vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
-        if regexp "\"13\.[0-9]-" "$vt_userland_ver"; then
-            set vt_freebsd_ver=13.x
-        elif regexp "\"12\.[0-9]-" "$vt_userland_ver"; then
-            set vt_freebsd_ver=12.x
-        elif regexp "\"11\.[0-9]-" "$vt_userland_ver"; then
-            set vt_freebsd_ver=11.x
-        elif regexp "\"10\.[0-9]-" "$vt_userland_ver"; then
-            set vt_freebsd_ver=10.x
-        elif regexp "\"9\.[0-9]-" "$vt_userland_ver"; then
-            set vt_freebsd_ver=9.x
-        fi
+        vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver        
+        if regexp --set 1:vtBsdVerNum "\"(14|13|12|11|10|9)\.[0-9]-" "$vt_userland_ver"; then
+            set vt_freebsd_ver=${vtBsdVerNum}.x
+        fi        
     elif [ -e (loop)/README.TXT ]; then
         vt_1st_line (loop)/README.TXT vt_freebsd_line1
-        if regexp "FreeBSD 13\.[0-9]-" "$vt_freebsd_line1"; then
-            set vt_freebsd_ver=13.x
-        elif regexp "FreeBSD 12\.[0-9]-" "$vt_freebsd_line1"; then
-            set vt_freebsd_ver=12.x
-        elif regexp "FreeBSD 11\.[0-9]-" "$vt_freebsd_line1"; then
-            set vt_freebsd_ver=11.x
-        elif regexp "FreeBSD 10\.[0-9]-" "$vt_freebsd_line1"; then
-            set vt_freebsd_ver=10.x
-        elif regexp "FreeBSD 9\.[0-9]-" "$vt_freebsd_line1"; then
-            set vt_freebsd_ver=9.x
+        if regexp --set 1:vtBsdVerNum "FreeBSD (14|13|12|11|10|9)\.[0-9]-" "$vt_freebsd_line1"; then
+            set vt_freebsd_ver=${vtBsdVerNum}.x        
         fi
     elif vt_strstr "${chosen_path}" "MidnightBSD"; then
         set vt_freebsd_ver=9.x
     fi
-    
+
     
     if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
         set vtFreeBsdDistro=ClonOS
@@ -495,13 +526,22 @@ function ventoy_freebsd_proc {
     if [ "$vt_freebsd_ver" = "xx" ]; then
         if [ -e (loop)/boot/kernel/kernel ]; then
             vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
+        elif [ -e (loop)/boot/kernel/kernel.gz ]; then
+            vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel.gz $vt_freebsd_bit vt_freebsd_ver
         fi
         
         if [ "$vt_freebsd_ver" = "xx" ]; then
-            set vt_freebsd_ver=13.x        
+            set vt_freebsd_ver=14.x
         fi
     fi
 
+    if [ "$vt_freebsd_ver" = "14.x" ]; then
+        if [ -e (loop)/boot/lua/brand-pfSense.lua ]; then
+            set vtFreeBsdDistro=pfSense
+        fi
+    fi
+
+
     if [ -n "${vtdebug_flag}" ]; then
         echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
     fi
@@ -514,8 +554,17 @@ function ventoy_freebsd_proc {
         fi
     done
     
-    vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
-    vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
+    if [ -n "$vt_unix_mod_path" ]; then
+        vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
+        vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
+    elif [ -e (loop)/easyre.ufs.uzip ]; then
+        vt_unix_replace_ko "/boot/grub/i386-pc/linux.mod" (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
+        if [ "$grub_platform" = "pc" ]; then
+            vt_unix_replace_grub_conf "/boot/grub/i386-pc/linux.mod" "cd9"
+        else
+            vt_unix_replace_conf FreeBSD "${1}${chosen_path}" "cd9"
+        fi
+    fi
 }
 
 function ventoy_dragonfly_proc {
@@ -537,6 +586,8 @@ function ventoy_dragonfly_proc {
 function ventoy_unix_comm_proc {
     vt_unix_reset
     
+    vt_unix_check_vlnk "${1}${chosen_path}"
+    
     if [ "$ventoy_compatible" = "NO" ]; then
         loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
         
@@ -563,8 +614,12 @@ function ventoy_unix_comm_proc {
 function uefi_windows_menu_func {
     vt_windows_reset
 
-    if [ "$ventoy_compatible" = "NO" ]; then   
-        
+    unset vt_cur_wimboot_mode
+    if vt_check_mode 4 "$vt_chosen_name"; then
+        set vt_cur_wimboot_mode=1
+    fi
+
+    if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
         if [ "$ventoy_fs_probe" = "iso9660" ]; then
             loopback -d loop
             vt_iso9660_nojoliet 1            
@@ -581,19 +636,19 @@ function uefi_windows_menu_func {
         fi
         
         ventoy_debug_pause        
-        locate_wim
+        locate_wim "${chosen_path}"
     fi
-
+    
     vt_windows_chain_data "${1}${chosen_path}"
     ventoy_debug_pause
-    
-    if vt_check_mode 4; then
-        vtoy_windows_wimboot_func
+
+    if [ "$vt_cur_wimboot_mode" = "1" ]; then
+        vtoy_wimboot_func
     fi
-    
+
     if [ -n "$vtoy_chain_mem_addr" ]; then
         ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
-        ventoy_cli_console
+        ventoy_max_resolution
         chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi  env_param=${env_param} isoefi=${LoadIsoEfiDriver} iso_${ventoy_fs_probe} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
         boot
     else
@@ -635,7 +690,7 @@ function uefi_linux_menu_func {
         if [ -d (loop)/pmagic ]; then
             vt_linux_specify_initrd_file /pmagic/initrd.img
         else
-            for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg"; do
+            for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg" "EFI/BOOT/grub/grub.cfg"; do
                 if [ -e (loop)/$file ]; then                    
                     vt_linux_parse_initrd_grub  file  (loop)/$file
                 fi
@@ -654,6 +709,9 @@ function uefi_linux_menu_func {
         vt_linux_initrd_count vtcount
         
         if [ $vtcount -eq 0 ]; then
+            if [ -e (loop)/EFI/boot/livegrub.cfg ]; then
+                vt_linux_parse_initrd_grub  file  (loop)/EFI/boot/livegrub.cfg
+            fi
             distro_specify_initrd_file_phase2
             
             if [ "$vt_efi_dir" = "NO" ]; then
@@ -731,7 +789,7 @@ function uefi_linux_menu_func {
     
     vt_linux_chain_data "${1}${chosen_path}"
 
-    if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -lt 104857600 ]; then
+    if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -LT 104857600 ]; then
         if [ -f (loop)/efi/clover/cloverx64.efi ]; then
             unset LoadIsoEfiDriver
         fi
@@ -741,7 +799,20 @@ function uefi_linux_menu_func {
         ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
         ventoy_cli_console     
 
-        if vt_check_mode 3; then
+        unset vtGrub2Mode
+        if vt_check_mode 3 "$vt_chosen_name"; then
+            set vtGrub2Mode=1
+        elif vt_str_begin "$vt_volume_id" "HOLO_"; then
+            if [ -d (loop)/loader/entries ]; then
+                set vtGrub2Mode=1
+            fi
+        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
@@ -768,6 +839,28 @@ function uefi_linux_menu_func {
                 break
             fi
         done
+        if [ $vtback_cfg_find -eq 0 ]; then
+            if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
+                if vt_str_begin "$vt_volume_id" "HOLO_"; then
+                    set root=(loop,2)
+                    vt_systemd_menu (loop,2) vt_sys_menu_mem
+                else
+                    vt_systemd_menu (loop) vt_sys_menu_mem
+                fi
+                set vtback_cfg_find=1
+                configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
+            fi
+        fi
+        
+        if [ $vtback_cfg_find -eq 0 ]; then
+            if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
+                syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
+                set vtback_cfg_find=1
+            elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
+                syslinux_configfile (loop)/boot/syslinux/porteus.cfg
+                set vtback_cfg_find=1
+            fi
+        fi
 
         if [ "$vtback_cfg_find" = "0" ]; then
             echo " "
@@ -813,15 +906,10 @@ function ventoy_reset_nojoliet {
 }
 
 function uefi_iso_menu_func {
-
-    if [ -d (loop)/ ]; then
-        loopback -d loop
-    fi
-
     if [ -n "$vtisouefi" ]; then
         set LoadIsoEfiDriver=on
         unset vtisouefi
-    elif vt_check_mode 2; then
+    elif vt_check_mode 2 "$vt_chosen_name"; then
         set LoadIsoEfiDriver=on
     else
         unset LoadIsoEfiDriver
@@ -831,21 +919,13 @@ function uefi_iso_menu_func {
     vt_select_auto_install "${chosen_path}"
     vt_select_persistence "${chosen_path}"
 
-    if vt_is_udf "${1}${chosen_path}"; then
-        set ventoy_fs_probe=udf
-    else
-        set ventoy_fs_probe=iso9660
-        ventoy_reset_nojoliet
-
+    if ! vt_is_udf "${1}${chosen_path}"; then
         # Lenovo EasyStartup need an addional sector for boundary check
         if vt_str_begin "$vt_volume_id" "EasyStartup"; then
             vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
             vt_append_extra_sector 1
         fi
     fi
-
-    loopback loop "${1}${chosen_path}"
-    get_os_type (loop)
     
     if [ -d (loop)/EFI ]; then
         set vt_efi_dir=YES
@@ -858,7 +938,7 @@ function uefi_iso_menu_func {
     if [ -n "$vtcompat" ]; then
         set ventoy_compatible=YES
         unset vtcompat
-    elif vt_check_mode 1; then
+    elif vt_check_mode 1 "$vt_chosen_name"; then
         set ventoy_compatible=YES
     else
         vt_check_compatible (loop)        
@@ -880,7 +960,7 @@ function uefi_iso_menu_func {
         uefi_linux_menu_func  "$1" "${chosen_path}"
     fi
 
-    ventoy_gui_console
+    ventoy_gui_console    
 }
 
 function uefi_iso_memdisk {    
@@ -894,8 +974,7 @@ function uefi_iso_memdisk {
     ventoy_gui_console
 }
 
-
-function vtoy_windows_wimboot_func {
+function vtoy_windows_wimboot {
     if [ -f (loop)/x86/sources/boot.wim -a -f (loop)/x64/sources/boot.wim ]; then
         vt_sel_wimboot vtoy_wimboot_bit
         if [ "$vtoy_wimboot_bit" = "32" ]; then
@@ -913,43 +992,24 @@ function vtoy_windows_wimboot_func {
     fi
 
     if [ -n "${vtdebug_flag}" ]; then
-        echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit
+        echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel
     fi
 
-    for wmfile in sources/boot.wim boot/bcd boot/boot.sdi; do
-        if [ ! -f $vtoy_wimboot_prefix/$wmfile ]; then
-            return
-        fi
-    done
-
-    if [ -f $vtoy_wimboot_prefix/sources/install.wim -o -f $vtoy_wimboot_prefix/sources/install.esd ]; then
-        vt_windows_wimboot_data
-    else
-        return
-    fi
+    vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe vtoy_wim_bit
     
     if [ "$grub_platform" = "pc" ]; then
-        set vt_wimkernel=wimboot.x86_64.xz
-        
         linux16  "$vtoy_path/$vt_wimkernel"  quiet
         ventoy_debug_pause
 
         vt_set_wim_load_prompt 1 "Loading files......"
-        initrd16 newc:vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe \
-             newc:wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
-             newc:winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size} \
+        initrd16 newc:winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
+             newc:vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd \
              newc:bcd:$vtoy_wimboot_prefix/boot/bcd \
              newc:boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi \
              newc:boot.wim:$vtoy_wimboot_prefix/sources/boot.wim
         vt_set_wim_load_prompt 0
         boot
     else
-        if [ "$grub_cpu" = "i386" ]; then
-            set vt_wimkernel=wimboot.i386.efi.xz
-        else
-            set vt_wimkernel=wimboot.x86_64.xz
-        fi
-
         vt_set_wim_load_prompt 1 "Loading files......"
         vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/sources/boot.wim vtoy_wimfile_mem
         vt_set_wim_load_prompt 0
@@ -962,9 +1022,8 @@ function vtoy_windows_wimboot_func {
 
         ventoy_cli_console
         chainloader "$vtoy_path/$vt_wimkernel" quiet \
-            "vf=wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
-            "vf=winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size}" \
-            "vf=vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe" \
+            "vf=winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
+            "vf=vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd" \
             "vf=bcd:$vtoy_wimboot_prefix/boot/bcd" \
             "vf=boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi" \
             "vf=boot.wim:$vtoy_wimfile_path" \
@@ -975,11 +1034,125 @@ function vtoy_windows_wimboot_func {
     fi
 }
 
+function vtoy_winpe_wimboot {
+    unset vtoy_boot_sdi_legacy
+    unset vtoy_boot_sdi_efi
+    
+    set vtoy_wimboot_prefix=(loop)    
+    set vtoy_wim_path="$1"
+    
+    if [ -n "${vtdebug_flag}" ]; then
+        echo "winpe_wimboot $1 $2 $3"
+    fi
+    
+    if [ "$2" != "0" ]; then
+        set vtoy_boot_sdi_legacy="newc:boot.sdi:$vtoy_wimboot_prefix/$2"
+        set vtoy_boot_sdi_efi="vf=boot.sdi:$vtoy_wimboot_prefix/$2"
+    fi
+
+    vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe vtoy_wim_bit
+    
+    if [ "$grub_platform" = "pc" ]; then
+        linux16  "$vtoy_path/$vt_wimkernel" quiet
+        ventoy_debug_pause
+
+        vt_set_wim_load_prompt 1 "Loading files......"         
+        initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
+             newc:vtoy_wimboot:$vtoy_path/$vt_wimkernel \
+             newc:bootmgr.exe:mem:${vtoy_pe_bootmgr_mem_addr}:size:${vtoy_pe_bootmgr_mem_size} \
+             newc:bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size} \
+             $vtoy_boot_sdi_legacy \
+             newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path
+        vt_set_wim_load_prompt 0        
+        boot
+    else
+        if [ "$VTOY_EFI_ARCH" = "x64" -a "$vtoy_wim_bit" = "32" ]; then
+            echo -e "\nThis is 32bit Windows and does NOT support x86_64 UEFI firmware.\n"
+            echo -e "这是32位的 Windows 系统,不支持当前的64位 UEFI 环境。\n"
+        fi
+
+        vt_set_wim_load_prompt 1 "Loading files......"
+        vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem
+        vt_set_wim_load_prompt 0
+
+        if [ $? -eq 0 ]; then
+            set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
+        else
+            set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path
+        fi
+        
+        unset vtoy_boot_efi_path
+        if [ -F (loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi ]; then
+            set vtoy_boot_efi_path="vf=bootx64.efi:(loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi"
+        fi
+
+        ventoy_cli_console
+        chainloader "$vtoy_path/$vt_wimkernel" quiet \
+            "vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
+            "vf=vtoy_wimboot:$vtoy_path/$vt_wimkernel" \
+            "vf=bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size}" \
+            "$vtoy_boot_sdi_efi" \
+            "$vtoy_boot_efi_path" \
+            "vf=boot.wim:$vtoy_wimfile_path" \
+            pfsize=$vtoy_chain_file_size  \
+            pfread=$vtoy_chain_file_read
+        boot
+        ventoy_gui_console
+    fi
+}
+
+function vtoy_wimboot_func {
+    if [ "$grub_platform" = "pc" ]; then
+        set vt_wimkernel=wimboot.x86_64.xz        
+    else
+        if [ "$grub_cpu" = "i386" ]; then
+            set vt_wimkernel=wimboot.i386.efi.xz
+        else
+            set vt_wimkernel=wimboot.x86_64.xz
+        fi
+    fi
+
+    if vt_is_standard_winiso (loop); then
+        echo -e "\n==================== VENTOY WIMBOOT ==================\n"
+        vtoy_windows_wimboot
+    else
+        vt_sel_winpe_wim (loop)
+        if [ -n "$vtoy_pe_wim_path" ]; then            
+            echo -e "\n==================== VENTOY WIMBOOT ==================\n"
+            
+            vt_fs_ignore_case 1
+            vt_load_file_to_mem "auto" $vtoy_path/common_bcd.xz vtoy_pe_bcd_mem
+            
+            set vt_sdi_path=0
+            for vsdi in "boot/boot.sdi" "2K10/FONTS/boot.sdi" "SSTR/boot.sdi" "ISPE/BOOT.SDI" \
+            "boot/uqi.sdi" "ISYL/boot.sdi" "WEPE/WEPE.SDI" ; do
+                if [ -F "(loop)/$vsdi" ]; then
+                    set vt_sdi_path=$vsdi
+                    break
+                fi
+            done
+            
+            if [ "$grub_platform" = "pc" ]; then
+                vt_load_file_to_mem "auto" $vtoy_path/common_bootmgr.xz vtoy_pe_bootmgr_mem
+                vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 1
+            else
+                vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 0
+            fi
+            
+            vt_fs_ignore_case 0
+        fi
+    fi
+}
+
 function legacy_windows_menu_func {
     vt_windows_reset
     
-    if [ "$ventoy_compatible" = "NO" ]; then   
-        
+    unset vt_cur_wimboot_mode
+    if vt_check_mode 4 "$vt_chosen_name"; then
+        set vt_cur_wimboot_mode=1
+    fi
+    
+    if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
         if [ "$ventoy_fs_probe" = "iso9660" ]; then
             loopback -d loop
             vt_iso9660_nojoliet 1
@@ -997,20 +1170,26 @@ function legacy_windows_menu_func {
             distro_specify_wim_patch_phase2
         fi
         
-        ventoy_debug_pause        
-        locate_wim
+        ventoy_debug_pause
+        if [ -z "$vt_cur_wimboot_mode" ]; then
+            locate_wim "${chosen_path}"
+        fi
     fi
-
+    
     vt_windows_chain_data "${1}${chosen_path}"
-    ventoy_debug_pause    
-
-    if vt_check_mode 4; then
-        vtoy_windows_wimboot_func
+    ventoy_debug_pause
+    
+    if [ "$vt_cur_wimboot_mode" = "1" ]; then
+        vtoy_wimboot_func
     fi
 
     if [ -n "$vtoy_chain_mem_addr" ]; then
         ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
-        linux16   $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}        
+        if [ "$ventoy_compatible" = "NO" ]; then
+            linux16   $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+        else
+            linux16   $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+        fi
         boot
     else
         echo "chain empty failed"
@@ -1083,10 +1262,19 @@ function legacy_linux_menu_func {
     ventoy_debug_pause
     
     if [ -n "$vtoy_chain_mem_addr" ]; then
-        if vt_check_mode 3; then
+        unset vtGrub2Mode
+        if vt_check_mode 3 "$vt_chosen_name"; then
+            set vtGrub2Mode=1
+        elif vt_str_begin "$vt_volume_id" "HOLO_"; then
+            if [ -d (loop)/loader/entries ]; then
+                set vtGrub2Mode=1
+            fi        
+        fi
+    
+        if [ -n "$vtGrub2Mode" ]; then
             ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
             ventoy_cli_console
-        
+
             # fallback
             set vtback_root=$root        
             vt_push_last_entry
@@ -1105,6 +1293,28 @@ function legacy_linux_menu_func {
                     break
                 fi
             done
+            if [ $vtback_cfg_find -eq 0 ]; then
+                if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then                    
+                    if vt_str_begin "$vt_volume_id" "HOLO_"; then
+                        set root=(loop,2)
+                        vt_systemd_menu (loop,2) vt_sys_menu_mem
+                    else
+                        vt_systemd_menu (loop) vt_sys_menu_mem
+                    fi
+                    set vtback_cfg_find=1  
+                    configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
+                fi
+            fi
+            
+            if [ $vtback_cfg_find -eq 0 ]; then
+                if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
+                    syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
+                    set vtback_cfg_find=1
+                elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
+                    syslinux_configfile (loop)/boot/syslinux/porteus.cfg
+                    set vtback_cfg_find=1
+                fi
+            fi
 
             vt_unset_boot_opt
             set root=$vtback_root        
@@ -1138,31 +1348,15 @@ function legacy_unix_menu_func {
 
 
 function legacy_iso_menu_func {
-
-    if [ -d (loop)/ ]; then
-        loopback -d loop
-    fi
-
     set chosen_path="$2"
     
     vt_select_auto_install "${chosen_path}"
     vt_select_persistence "${chosen_path}"
-
-    if vt_is_udf "${1}${chosen_path}"; then
-        set ventoy_fs_probe=udf
-    else
-        set ventoy_fs_probe=iso9660
-        ventoy_reset_nojoliet
-    fi
-    
-    loopback loop "${1}${chosen_path}"
-    
-    get_os_type (loop)
     
     if [ -n "$vtcompat" ]; then
         set ventoy_compatible=YES
         unset vtcompat
-    elif vt_check_mode 1; then
+    elif vt_check_mode 1 "$vt_chosen_name"; then
         set ventoy_compatible=YES
     else
         vt_check_compatible (loop)
@@ -1183,6 +1377,7 @@ function legacy_iso_menu_func {
         vt_check_compatible_linux (loop)
         legacy_linux_menu_func  "$1" "${chosen_path}"
     fi
+    vt_secondary_recover_mode
 }
 
 function legacy_iso_memdisk {
@@ -1244,6 +1439,8 @@ function ventoy_iso_busybox_ver {
             set ventoy_busybox_ver=64
         elif vt_str_begin "$vt_volume_id" "LDiagBootable"; then
             set ventoy_busybox_ver=64
+        elif vt_str_begin "$vt_volume_id" "KAOS_"; then
+            set ventoy_busybox_ver=64
 
         fi
     fi
@@ -1254,16 +1451,16 @@ function iso_common_menuentry {
     unset vt_system_id
     unset vt_volume_id
     
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
 
     vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
-    if [ $vt_volume_space -ne $vt_chosen_size ]; then        
+    if [ $vt_volume_space -NE $vt_chosen_size ]; then        
         vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
         if [ $vt_chosen_size_mod -ne 0 ]; then
             echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
             echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
             echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
-            echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
+            echo -en "\n$VTLANG_ENTER_CONTINUE ..."
             read vtInputKey
         fi
     fi
@@ -1275,6 +1472,33 @@ function iso_common_menuentry {
     if ventoy_vcfg_proc "${vt_chosen_path}"; then        
         return
     fi
+    
+    
+    
+    #secondary boot menu
+    if vt_is_udf "${vtoy_iso_part}${vt_chosen_path}"; then
+        set ventoy_fs_probe=udf
+    else
+        set ventoy_fs_probe=iso9660
+        ventoy_reset_nojoliet
+    fi
+    
+    if [ -d (loop)/ ]; then
+        loopback -d loop
+    fi
+    loopback loop "${vtoy_iso_part}${vt_chosen_path}" 
+    
+    get_os_type (loop)
+    
+    ventoy_debug_pause
+    
+    if vt_need_secondary_menu "$vt_chosen_name"; then
+        vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
+        if [ "$VTOY_SECOND_EXIT" = "1" ]; then
+            return
+        fi
+    fi
+
 
     if vt_str_begin "$vt_volume_id" "Avira"; then 
         vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
@@ -1289,23 +1513,50 @@ 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 "$vt_chosen_name"; 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
+        
+        #For iKuai8 (<64MB)
+        if [ $vt_chosen_size -LE 67108864 ]; then
+            if vt_str_begin "$vt_chosen_name" "iKuai"; 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"
         fi
-    fi      
+    fi
+
+    vt_secondary_recover_mode
 }
 
 function miso_common_menuentry {
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
 
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1326,7 +1577,7 @@ function miso_common_menuentry {
 function common_unsupport_menuentry {
     echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
     echo -e " 文件名中不能有中文或空格 \n"    
-    echo -e "\npress ENTER to exit (请按 回车 键返回) ..."    
+    echo -en "\n$VTLANG_ENTER_EXIT ..."  
     read vtInputKey
 }
 
@@ -1339,7 +1590,7 @@ function iso_unsupport_menuentry {
 }
 
 function wim_common_menuentry {
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
     
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1378,7 +1629,7 @@ function wim_unsupport_menuentry {
 }
 
 function efi_common_menuentry {
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
     
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1388,22 +1639,34 @@ function efi_common_menuentry {
         return
     fi
     
-    vt_concat_efi_iso "${vtoy_iso_part}${vt_chosen_path}" vtoy_iso_buf
+    unset vt_vlnk_dst
+    if vt_is_vlnk_name "${vt_chosen_path}"; then
+        vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
+        if [ -z "$vt_vlnk_dst" ]; then
+            echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"            
+            ventoy_pause
+            return
+        fi
+    else
+        vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
+    fi
     
     ventoy_debug_pause
-    
+
     ventoy_cli_console
+    
+    #first try with chainload
+    set vtOldRoot=$root
+    set root=$vtoy_iso_part
+    chainloader "${vt_vlnk_dst}"
+    boot
 
-    unset vtoy_dotefi_retry
+    #retry with isoboot
+    set root=$vtOldRoot
+    vt_concat_efi_iso "${vt_vlnk_dst}" vtoy_iso_buf    
     chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} dotefi isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
-    boot
-    
-    if [ -n "$vtoy_dotefi_retry" ]; then
-        unset vtoy_dotefi_retry
-        chainloader "${vtoy_iso_part}${vt_chosen_path}"
-        boot
-    fi
-    
+    boot    
+
     ventoy_gui_console
 }
 
@@ -1436,18 +1699,7 @@ function vhdboot_common_func {
 }
 
 function vhd_common_menuentry {
-
-    if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
-        if [ "$vtoy_iso_fs" != "ntfs" ]; then
-            echo -e "!!! WARNING !!!\n"
-            echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
-            echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
-            echo -n "press ENTER to continue boot (请按 回车 键继续) ..."    
-            read vtInputKey
-        fi
-    fi
-
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
     
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1457,7 +1709,28 @@ function vhd_common_menuentry {
         return
     fi
     
-    vhdboot_common_func "${vt_chosen_path}"
+    unset vt_vlnk_dst
+    if vt_is_vlnk_name "${vt_chosen_path}"; then
+        vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
+        if [ -z "$vt_vlnk_dst" ]; then
+            echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"            
+            ventoy_pause
+            return
+        fi
+    else
+        vt_vlnk_dst="${vt_chosen_path}"
+        if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
+            if [ "$vtoy_iso_fs" != "ntfs" ]; then
+                echo -e "!!! WARNING !!!\n"
+                echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
+                echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
+                echo -en "\n$VTLANG_ENTER_CONTINUE ..."
+                read vtInputKey
+            fi
+        fi
+    fi
+    
+    vhdboot_common_func "${vt_vlnk_dst}"
 }
 
 function vhd_unsupport_menuentry {
@@ -1523,7 +1796,7 @@ function vtoyboot_common_func {
 }
 
 function vtoy_common_menuentry {    
-    vt_chosen_img_path vt_chosen_path vt_chosen_size     
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
     
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1533,7 +1806,19 @@ function vtoy_common_menuentry {
         return
     fi
     
-    vtoyboot_common_func "${vtoy_iso_part}${vt_chosen_path}"
+    unset vt_vlnk_dst
+    if vt_is_vlnk_name "${vt_chosen_path}"; then
+        vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
+        if [ -z "$vt_vlnk_dst" ]; then
+            echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"            
+            ventoy_pause
+            return
+        fi
+    else
+        vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
+    fi
+    
+    vtoyboot_common_func "${vt_vlnk_dst}"
 }
 
 function vtoy_unsupport_menuentry {
@@ -1548,7 +1833,7 @@ function vtoy_unsupport_menuentry {
 
 function only_uefi_tip {
     echo -e "\n This IMG file is only supported in UEFI mode. \n"
-    echo -e "\n press ENTER to exit ..."
+    echo -en "\n$VTLANG_ENTER_EXIT ..."
     read vtInputKey 
 }
 
@@ -1561,7 +1846,9 @@ function ventoy_img_easyos {
     
     if [ -n "$vt_module_ver" ]; then        
         for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
-            vt_img_extra_initrd_append  (easysfs)/lib/modules/$vt_module_ver/$mod
+            if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
+                vt_img_extra_initrd_append  (easysfs)/lib/modules/$vt_module_ver/$mod
+            fi
         done
     fi
 
@@ -1578,6 +1865,41 @@ function ventoy_img_easyos {
     loopback -d easysfs
 }
 
+function ventoy_img_easyos2 {
+    vt_load_cpio  $vtoy_path  "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
+    
+    if [ -e (vtimghd,2)/easyos/easy.sfs ]; then
+        loopback easysfs (vtimghd,2)/easyos/easy.sfs
+    elif [ -d (vtimghd,2)/easyos/releases ]; then
+        vt_fs_enum_1st_dir (vtimghd,2) /easyos/releases/ vt_dir_name
+        loopback easysfs (vtimghd,2)/easyos/releases/$vt_dir_name/easy.sfs
+    fi
+    
+    vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
+    
+    if [ -n "$vt_module_ver" ]; then        
+        for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
+            if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
+                vt_img_extra_initrd_append  (easysfs)/lib/modules/$vt_module_ver/$mod
+            fi
+        done
+    fi
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy
+    vt_img_hook_root
+    
+    vt_limine_menu (vtimghd,1)/limine.cfg vt_sys_menu_mem
+    configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
+    
+    vt_img_unhook_root
+    vt_unset_boot_opt
+    loopback -d easysfs
+}
+
 function ventoy_img_volumio {
     vt_load_cpio  $vtoy_path  "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
     vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
@@ -1603,6 +1925,20 @@ function ventoy_img_openelec {
     loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio    
     vt_img_extra_initrd_append  (vtloopex)/$elec_ver/vtloopex.tar.xz
 
+    if [ "$elec_ver" = "LibreELEC" ]; then
+        if [ -f (vtimghd,1)/system ]; then
+            loopback elecsfs (vtimghd,1)/system
+            vt_get_lib_module_ver (elecsfs) /usr/lib/kernel-overlays/base/lib/modules/  vt_module_ver
+            if [ -n "$vt_module_ver" ]; then        
+                for mod in "kernel/drivers/md/dm-mod.ko"; do
+                    if [ -e (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod ]; then
+                        vt_img_extra_initrd_append  (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod
+                    fi
+                done
+            fi
+        fi
+    fi
+
     ventoy_debug_pause
 
     #boot image file
@@ -1615,6 +1951,7 @@ function ventoy_img_openelec {
     vt_img_unhook_root
     vt_unset_boot_opt
     loopback -d vtloopex
+    loopback -d elecsfs
 }
 
 
@@ -1686,9 +2023,23 @@ function ventoy_img_ubos {
 }
 
 function ventoy_img_recalbox {
+    if [ $vtoy_img_max_part_end -GT $vt_chosen_size ]; then
+        echo -e "\nPlease extend the img file size before boot it. \n"
+        ventoy_pause
+        return
+    fi
+
     vt_load_cpio  $vtoy_path  "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
     vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
 
+    if [ -e (vtimghd,1)/boot/recalbox ]; then
+        loopback recalbox (vtimghd,1)/boot/recalbox
+        vt_get_lib_module_ver (recalbox) /lib/modules/ vt_module_ver
+        if [ -n "$vt_module_ver" ]; then        
+            vt_img_extra_initrd_append  (recalbox)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
+        fi
+    fi
+
     ventoy_debug_pause
 
     #boot image file
@@ -1755,7 +2106,7 @@ function ventoy_img_openwrt {
             ventoy_gui_console
             echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
             echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
-            echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
+            echo -en "\n$VTLANG_ENTER_EXIT ..."
             read vtInputKey
             ventoy_cli_console
             return
@@ -1879,6 +2230,23 @@ function ventoy_img_cloudready {
     unset linuxpartB
 }
 
+
+function ventoy_img_fwts {
+    vt_load_cpio  $vtoy_path  "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fwts
+    vt_img_hook_root
+    
+    configfile $prefix/distro/fwts.cfg
+
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
 function ventoy_img_memtest86 {      
     chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
     boot
@@ -1887,7 +2255,7 @@ function ventoy_img_memtest86 {
 function img_unsupport_tip {
     echo -e "\n This IMG file is NOT supported now. \n"
     echo -e " 当前不支持启动此 IMG 文件 \n"    
-    echo -e "\npress ENTER to exit (请按 回车 键返回) ..."    
+    echo -en "\n$VTLANG_ENTER_EXIT ..."
     read vtInputKey 
 }
 
@@ -1905,7 +2273,7 @@ function img_common_menuentry {
     set ventoy_busybox_ver=32
     unset LoadIsoEfiDriver
 
-    vt_chosen_img_path vt_chosen_path vt_chosen_size
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
     
     if vt_check_password "${vt_chosen_path}"; then
         return
@@ -1916,7 +2284,7 @@ function img_common_menuentry {
     fi
 
     if [ "$grub_platform" = "pc" ]; then
-        if vt_check_mode 0; then
+        if vt_check_mode 0 "$vt_chosen_name"; then
             legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
             return
         fi
@@ -1944,6 +2312,14 @@ function img_common_menuentry {
         vt_get_fs_label (vtimghd,2) vtImgHd2Label
     fi
 
+    if [ -z "$vtImgHd1Label" ]; then
+        if [ -d (vtimghd,2)/efi ]; then
+            vt_get_fs_label (vtimghd,3) vtImgHd3Label
+        elif [ -d (vtimghd,12)/efi ]; then
+            vt_get_fs_label (vtimghd,3) vtImgHd3Label
+        fi
+    fi
+
     if [ -e (vtimghd,1)/etc/hostname ]; then
         vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
     fi
@@ -1951,12 +2327,18 @@ function img_common_menuentry {
     if vt_str_begin "$vtImgHd3Label" "ROOT-"; then
         if [ -f (vtimghd,3)/etc/os-release.d/ID ]; then 
             vt_1st_line (vtimghd,3)/etc/os-release.d/ID vt_release_line1
-            if [ vt_str_begin "$vt_release_line1" "FydeOS" ]; then
+            if vt_str_begin "$vt_release_line1" "FydeOS"; then
                 ventoy_img_fydeos
+            else
+                ventoy_img_cloudready
             fi
         elif [ -f (vtimghd,3)/etc/cloudready-release ]; then
             ventoy_img_cloudready
+        elif [ -f (vtimghd,3)/etc/chrome_dev.conf ]; then
+            ventoy_img_cloudready
         fi
+    elif vt_str_begin "$vtImgHd3Label" "fwts-result"; then
+        ventoy_img_fwts
     elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
         ventoy_img_openelec lakka
     elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
@@ -1969,25 +2351,28 @@ function img_common_menuentry {
         ventoy_img_batocera
     elif vt_str_begin "$vtImgHd1Label" "Tails"; then
         ventoy_img_tails
-    elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
+    elif [ "$vtImgHd2Label" = "RECALBOX" -o "$vtImgHd1Label" = "RECALBOX" ]; then
         ventoy_img_recalbox
     elif [ "$vtImgHd1Label" = "ESYSRESCUE" ]; then
         ventoy_img_esysrescue
     elif [ -e (vtimghd,1)/easy.sfs ]; then
         ventoy_img_easyos
+    elif [ -d (vtimghd,2)/easyos ]; then
+        ventoy_img_easyos2
     elif [ -e (vtimghd,1)/volumio.initrd ]; then
         ventoy_img_volumio
     elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
         ventoy_img_ubos
     elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
-        ventoy_img_openwrt
-    elif [ -f (vtimghd,1)/efi/boot/mt86.png ]; then 
-        if [ "$grub_platform" = "pc" ]; then
-            img_unsupport_tip
-        else
-            ventoy_img_memtest86            
-        fi    
+        ventoy_img_openwrt    
     else
+        if [ -f (vtimghd,1)/efi/boot/mt86.png ]; then 
+            if [ "$grub_platform" = "pc" ]; then
+                img_unsupport_tip
+            fi 
+        fi
+
+        #common chain
         vt_linux_chain_data "${vtoy_iso_part}${vt_chosen_path}"
         ventoy_acpi_param ${vtoy_chain_mem_addr} 512
         if [ "$grub_platform" = "pc" ]; then 
@@ -2012,6 +2397,28 @@ function img_unsupport_menuentry {
     common_unsupport_menuentry
 }
 
+function mimg_common_menuentry {
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
+
+    if vt_check_password "${vt_chosen_path}"; then
+        return
+    fi
+
+    echo "memdisk mode boot for $vt_chosen_path"
+    echo ""
+    ventoy_debug_pause
+
+    if [ "$grub_platform" = "pc" ]; then
+        legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
+    else
+        vt_load_img_memdisk "$vtoy_iso_part$vt_chosen_path" vtoy_img_buf
+        ventoy_cli_console
+        chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_img_buf_addr}:size:${vtoy_img_buf_size}
+        boot
+        ventoy_gui_console    
+    fi      
+}
+
 #############################################################
 #############################################################
 #############################################################
@@ -2020,7 +2427,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.62"
+set VENTOY_VERSION="1.1.05"
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
@@ -2036,7 +2443,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"
@@ -2044,6 +2451,7 @@ set VTOY_HELP_CMD="ventoy_show_help"
 set VTOY_CHKSUM_CMD="ventoy_checksum"
 set VTOY_HELP_TXT_LANGUAGE="en_US"
 set VTOY_CHKSUM_FILE_PATH="X"
+set VTOY_LANG_CMD="ventoy_language"
 
 
 if [ "$grub_platform" = "pc" ]; then
@@ -2078,6 +2486,11 @@ if [ "$vtoy_dev" = "tftp" ]; then
     done
     loadfont ascii
 
+    if [ -n "$vtoy_efi_part" ]; then
+        vt_load_file_to_mem "auto" $vtoy_efi_part/grub/fonts/unicode.pf2 vtoy_font_mem
+        loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
+    fi
+
     if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
         set vt_plugin_path=$vtoy_iso_part
     else
@@ -2104,6 +2517,9 @@ fi
 #Load Partition Table
 vt_load_part_table $vtoydev
 
+#Load menu lang file
+ventoy_load_menu_lang_file
+
 #Load Plugin
 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
     clear
@@ -2113,6 +2529,12 @@ else
     vt_check_json_path_case $vtoy_iso_part
 fi
 
+if [ -n "$VTOY_MENU_LANGUAGE" ]; then
+    vt_init_menu_lang "$VTOY_MENU_LANGUAGE"
+else
+    vt_init_menu_lang en_US
+fi
+
 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
     set timeout=$VTOY_MENU_TIMEOUT
 else
@@ -2134,12 +2556,11 @@ 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"
 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"
 fi
 
+terminal_output  console
 
 if [ -n "$vtoy_gfxmode" ]; then
     set gfxmode=$vtoy_gfxmode
@@ -2164,7 +2585,20 @@ elif [ "$vtoy_display_mode" = "serial_console" ]; then
     fi
     terminal_input   serial console
     terminal_output  serial console    
-else    
+else
+    if [ "$vtoy_gfxmode" = "max" ]; then
+        set gfxmode=1024x768
+        terminal_output  gfxterm
+
+        vt_enum_video_mode
+        vt_get_video_mode 0 vtCurMode
+        terminal_output console
+        set gfxmode=$vtCurMode
+        terminal_output gfxterm
+    elif [ "$vtoy_res_fit" = "1" ]; then
+        terminal_output  gfxterm
+    fi    
+
     if [ -n "$vtoy_theme" ]; then
         vt_set_theme
     else
@@ -2173,6 +2607,11 @@ else
     terminal_output  gfxterm
 fi
 
+if [ "$grub_platform" = "efi" ]; then
+    set mouse_delta=4000
+    # terminal_input --append mouse
+fi
+
 if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
     set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
 fi
@@ -2240,6 +2679,33 @@ export VTOY_HELP_CMD
 export VTOY_CHKSUM_CMD
 export VTOY_HELP_TXT_LANGUAGE
 export VTOY_CHKSUM_FILE_PATH
+export VTOY_LANG_CMD
+
+
+#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 or supported IMG files found, $VTOY_NO_ISO_TIP"
+    elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
+        NO_ISO_MENU="No ISO or supported IMG files found, please check VTOY_DEFAULT_SEARCH_ROOT"
+    else
+        NO_ISO_MENU="No ISO or supported IMG files found"
+    fi
+    menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
+        echo -e "\n    Rebooting ... "
+        reboot
+    }
+fi
 
 
 #special VTOY_DEFAULT_IMAGE process
@@ -2255,9 +2721,12 @@ if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
         
         export timeout
         export default
-        
+
+        vt_fn_mutex_lock 1
+
         if [ "$vtHotkey" = "F2" ]; then
-            ventoy_power
+            unset timeout
+            vt_browser_disk
         elif [ "$vtHotkey" = "F4" ]; then
             ventoy_localboot
         elif [ "$vtHotkey" = "F5" ]; then
@@ -2266,32 +2735,10 @@ if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
             ventoy_ext_menu
         fi
         
+        vt_fn_mutex_lock 0
+        
         unset timeout
         unset default
     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