+ if [ "$grub_platform" = "pc" ]; then
+ if vt_check_mode 0; 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
+ uefi_iso_memdisk $vtoy_iso_part $vt_chosen_path
+ else
+ uefi_iso_menu_func $vtoy_iso_part $vt_chosen_path
+ fi
+ fi
+}
+
+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 (请按 回车 键返回) ..."
+ read vtInputKey
+}
+
+function iso_unsupport_menuentry {
+ common_unsupport_menuentry
+}
+
+function wim_common_menuentry {
+ vt_chosen_img_path vt_chosen_path vt_chosen_size
+ vt_wim_chain_data ${vtoy_iso_part}${vt_chosen_path}
+
+ ventoy_debug_pause
+
+ if [ -n "$vtoy_chain_mem_addr" ]; then
+ if [ "$grub_platform" = "pc" ]; then
+ linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ else
+ ventoy_cli_console
+ chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ ventoy_gui_console
+ fi
+ boot
+ else
+ echo "chain empty failed"
+ ventoy_pause
+ fi
+}
+
+function wim_unsupport_menuentry {
+ common_unsupport_menuentry
+}
+
+function efi_common_menuentry {
+ vt_chosen_img_path vt_chosen_path vt_chosen_size
+
+ vt_concat_efi_iso ${vtoy_iso_part}${vt_chosen_path} vtoy_iso_buf
+
+ ventoy_debug_pause
+
+ ventoy_cli_console
+ chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
+ boot
+ ventoy_gui_console
+}
+
+function efi_unsupport_menuentry {
+ common_unsupport_menuentry
+}
+
+#
+#============================================================#
+# IMG file boot process #
+#============================================================#
+#
+
+
+function ventoy_img_easyos {
+ vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+ vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+ loopback easysfs (vtimghd,1)/easy.sfs
+ 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
+ vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
+ done
+ fi
+
+ ventoy_debug_pause
+
+ #boot image file
+ vt_set_boot_opt rdinit=/vtoy/vtoy
+ vt_img_hook_root
+
+ syslinux_configfile (vtimghd,1)/syslinux.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+ loopback -d easysfs
+}
+
+function ventoy_img_volumio {
+ vt_load_cpio $vtoy_path/ventoy.cpio ${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 imgpart=/dev/ventoy2 bootpart=/dev/ventoy1
+ vt_img_hook_root
+
+ syslinux_configfile (vtimghd,1)/syslinux.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+
+function img_common_menuentry {
+ set ventoy_busybox_ver=32
+
+ vt_chosen_img_path vt_chosen_path vt_chosen_size
+
+ if [ -d (vtimghd)/ ]; then
+ loopback -d vtimghd
+ fi
+
+ loopback vtimghd ${vtoy_iso_part}${vt_chosen_path}
+ vt_img_sector ${vtoy_iso_part}${vt_chosen_path}
+
+ vt_img_part_info (vtimghd)
+
+ set vtback_root=$root
+ ventoy_cli_console
+ vt_push_last_entry
+
+ vt_img_extra_initrd_reset
+
+ #vt_get_fs_label (vtimghd,1) vtImgHd1Label
+
+ if [ -e (vtimghd,1)/easy.sfs ]; then
+ ventoy_img_easyos
+ elif [ -e (vtimghd,1)/volumio.initrd ]; then
+ ventoy_img_volumio
+
+
+ else
+ echo -e "\n This IMG file is NOT supported now. \n"
+ echo -e " 当前不支持启动此 IMG 文件 \n"
+ echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
+ read vtInputKey
+ fi
+
+ set root=$vtback_root
+ vt_pop_last_entry
+ ventoy_gui_console
+}
+
+function img_unsupport_menuentry {
+ common_unsupport_menuentry
+}