+function vtoyboot_common_func {
+ set AltBootPart=0
+ set vtoysupport=0
+
+ vt_get_vtoy_type "${1}" vtoytype parttype AltBootPart
+
+ if vt_str_begin $vtoytype vhd; then
+ set vtoysupport=1
+ elif [ "$vtoytype" = "raw" ]; then
+ set vtoysupport=1
+ elif [ "$vtoytype" = "vdi" ]; then
+ set vtoysupport=1
+ fi
+
+ if [ $vtoysupport -eq 1 ]; then
+ if [ "$grub_platform" = "pc" ]; then
+ if [ "$parttype" = "gpt" -a $AltBootPart -eq 0 ]; then
+ echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode."
+ echo "虚拟磁盘内的系统是在UEFI模式下创建的,而当前系统是Legacy BIOS模式,可能无法正常启动。"
+ ventoy_pause
+ fi
+ else
+ if [ "$parttype" = "mbr" -a $AltBootPart -eq 0 ]; then
+ echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode."
+ echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的,而当前系统是UEFI模式,可能无法正常启动。"
+ ventoy_pause
+ fi
+ fi
+
+ vt_img_sector "${1}"
+ vt_raw_chain_data "${1}"
+
+ ventoy_debug_pause
+
+ if [ -n "$vtoy_chain_mem_addr" ]; then
+ if [ "$grub_platform" = "pc" ]; then
+ vt_acpi_param ${vtoy_chain_mem_addr} 512
+ linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80 sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ boot
+ else
+ ventoy_acpi_param ${vtoy_chain_mem_addr} 512
+ ventoy_cli_console
+ chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ boot
+ ventoy_gui_console
+ fi
+ else
+ echo "chain empty failed!"
+ ventoy_pause
+ fi
+ else
+ echo "Unsupported vtoy type $vtoytype"
+ ventoy_pause
+ fi
+}
+
+function vtoy_common_menuentry {
+ vt_chosen_img_path vt_chosen_path vt_chosen_size
+
+ if vt_check_password "${vt_chosen_path}"; then
+ return
+ fi
+
+ vtoyboot_common_func "${vtoy_iso_part}${vt_chosen_path}"
+}
+
+function vtoy_unsupport_menuentry {
+ common_unsupport_menuentry
+}
+