+ 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 "${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 ventoy_img_openelec {
+ elec_ver=$1
+
+ 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
+
+ loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio
+ vt_img_extra_initrd_append (vtloopex)/$elec_ver/vtloopex.tar.xz
+
+ ventoy_debug_pause
+
+ #boot image file
+ vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=$elec_ver
+ vt_img_hook_root
+
+ set root=(vtimghd,1)
+ syslinux_configfile (vtimghd,1)/syslinux.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+ loopback -d vtloopex
+}
+
+
+function ventoy_img_freedombox {
+ 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
+
+ vt_get_lib_module_ver (vtimghd,1) /lib/modules/ vt_module_ver
+ if [ -n "$vt_module_ver" ]; then
+ vt_img_extra_initrd_append (vtimghd,1)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
+ fi
+
+ ventoy_debug_pause
+
+ #boot image file
+ vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=freedombox
+ vt_img_hook_root
+
+ configfile (vtimghd,1)/boot/grub/grub.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_paldo {
+ 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=paldo
+ vt_img_hook_root
+
+ vt_fs_enum_1st_file (vtimghd,1) /loader/entries/ vt_paldo_entry_conf
+ vt_file_basename $vt_paldo_entry_conf vtPaldoVer
+
+ echo loading file...
+ linux (vtimghd,1)/linux-${vtPaldoVer} root=/dev/ventoy1 rootfstype=vfat
+ initrd (vtimghd,1)/initramfs-${vtPaldoVer}
+ boot
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_ubos {
+ 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
+
+ vt_get_lib_module_ver (vtimghd,3) /lib/modules/ vt_module_ver
+ if [ -n "$vt_module_ver" ]; then
+ vt_img_extra_initrd_append (vtimghd,3)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko.xz
+ fi
+
+ ventoy_debug_pause
+
+ #boot image file
+ vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=ubos
+ vt_img_hook_root
+
+ echo loading file...
+ linux (vtimghd,2)/vmlinuz-linux root=/dev/ventoy3 rw
+ initrd (vtimghd,2)/initramfs-linux.img
+ boot
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_recalbox {
+ 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=recalbox
+ vt_img_hook_root
+
+ set root=(vtimghd,1)
+ configfile (vtimghd,1)/boot/grub/grub.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_batocera {
+ 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=batocera
+ vt_img_hook_root
+
+ set root=(vtimghd,1)
+ syslinux_configfile (vtimghd,1)/boot/syslinux/syslinux.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_openwrt {
+ if [ -e (vtimghd,2)/lib64 ]; then
+ set ventoy_busybox_ver=64
+ fi
+
+ if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
+ 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 (请按 回车 键返回) ..."
+ read vtInputKey
+ ventoy_cli_console
+ return
+ fi
+
+ if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
+ ventoy_debug_pause
+ else
+ ventoy_gui_console
+ echo -e "\n IMG file need processed. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
+ echo -e " 此 IMG 文件必须处理之后才能支持。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
+ echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
+ read vtInputKey
+ ventoy_cli_console
+ 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
+
+ vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
+
+
+ #boot image file
+ vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
+ vt_img_hook_root
+
+ set root=(vtimghd,1)
+ configfile (vtimghd,1)/boot/grub/grub.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_tails {
+ 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 live-media=/dev/dm-1 ventoyos=tails
+ vt_img_hook_root
+
+ set root=(vtimghd,1)
+ configfile (vtimghd,1)/efi/debian/grub.cfg
+
+ vt_img_unhook_root
+ vt_unset_boot_opt
+}
+
+function ventoy_img_memtest86 {
+ chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
+ boot
+}
+
+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 (请按 回车 键返回) ..."
+ read vtInputKey
+}
+
+function img_common_menuentry {
+ set ventoy_compatible=YES
+ set ventoy_busybox_ver=32
+
+ vt_chosen_img_path vt_chosen_path vt_chosen_size
+
+ if vt_check_password "${vt_chosen_path}"; then
+ return
+ fi
+
+ if ventoy_vcfg_proc "${vt_chosen_path}"; then
+ return
+ fi
+
+ 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
+ set vtback_theme=$theme
+ unset theme
+
+ vt_img_extra_initrd_reset
+
+
+ vt_get_fs_label (vtimghd,1) vtImgHd1Label
+ if [ -d (vtimghd,2)/lib ]; then
+ vt_get_fs_label (vtimghd,2) vtImgHd2Label
+ fi
+
+ if [ -e (vtimghd,1)/etc/hostname ]; then
+ vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
+ fi
+
+
+ if [ -e (vtimghd,1)/easy.sfs ]; then
+ ventoy_img_easyos
+ elif [ -e (vtimghd,1)/volumio.initrd ]; then
+ ventoy_img_volumio
+ elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
+ ventoy_img_openelec lakka
+ elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
+ ventoy_img_openelec LibreELEC
+ elif vt_str_begin "$vtImgHd1Label" "paldo-live"; then
+ ventoy_img_paldo
+ elif vt_str_begin "$vtImgHostname" "freedombox"; then
+ ventoy_img_freedombox
+ elif vt_str_begin "$vtImgHd1Label" "BATOCERA"; then
+ ventoy_img_batocera
+ elif vt_str_begin "$vtImgHd1Label" "Tails"; then
+ ventoy_img_tails
+ elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
+ ventoy_img_recalbox
+ 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
+ else
+ vt_linux_chain_data "${vtoy_iso_part}${vt_chosen_path}"
+ ventoy_acpi_param ${vtoy_chain_mem_addr} 512
+ if [ "$grub_platform" = "pc" ]; then
+ linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ boot
+ else
+ chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi sector512 env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+ boot
+ fi
+ fi
+
+ set root=$vtback_root
+ vt_pop_last_entry
+ set theme=$vtback_theme
+ ventoy_gui_console
+ set ventoy_compatible=NO
+}
+
+function img_unsupport_menuentry {
+ common_unsupport_menuentry
+}