1. Boot menu over serial supported

2. Optimization for booting Solus
3. Optimization for booting .efi file
4. support deepin-live iso
5. support Endless OS
6. framework for booting .img file
This commit is contained in:
longpanda
2020-08-07 22:23:27 +08:00
parent 433d854aab
commit be50ea69aa
54 changed files with 7366 additions and 257 deletions

View File

@@ -17,10 +17,8 @@
#************************************************************************************
function ventoy_pause {
if [ -n "${vtdebug_flag}" ]; then
echo "press Enter to continue ......"
read vtTmpPause
fi
echo "press Enter to continue ......"
read vtTmpPause
}
function ventoy_debug_pause {
@@ -30,29 +28,20 @@ function ventoy_debug_pause {
fi
}
function ventoy_cli_console {
if [ "$grub_platform" = "pc" ]; then
#terminal_output vga_text
function ventoy_cli_console {
if [ -z "$vtoy_display_mode" ]; then
terminal_output console
elif [ "$vtoy_display_mode" = "GUI" ]; then
terminal_output console
else
if [ "$vtoy_display_mode" != "CLI" ]; then
terminal_output console
fi
fi
}
function ventoy_gui_console {
if [ "$grub_platform" = "pc" ]; then
if [ "$vtoy_display_mode" = "CLI" ]; then
terminal_output console
else
terminal_output gfxterm
fi
else
if [ "$vtoy_display_mode" != "CLI" ]; then
terminal_output gfxterm
fi
fi
if [ -z "$vtoy_display_mode" ]; then
terminal_output gfxterm
elif [ "$vtoy_display_mode" = "GUI" ]; then
terminal_output gfxterm
fi
}
function ventoy_power {
@@ -401,7 +390,7 @@ function uefi_linux_menu_func {
fi
vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1
vt_linux_clear_initrd
if [ -d (loop)/pmagic ]; then
@@ -501,7 +490,7 @@ function uefi_iso_menu_func {
unset LoadIsoEfiDriver
fi
vt_chosen_img_path chosen_path
set chosen_path=$2
vt_select_auto_install ${chosen_path}
vt_select_persistence ${chosen_path}
@@ -512,8 +501,7 @@ function uefi_iso_menu_func {
vt_iso9660_nojoliet 0
fi
loopback loop ${1}${chosen_path}
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
loopback loop ${1}${chosen_path}
get_os_type (loop)
if [ -d (loop)/EFI ]; then
@@ -548,10 +536,8 @@ function uefi_iso_menu_func {
}
function uefi_iso_memdisk {
vt_chosen_img_path chosen_path
echo 'Loading ISO file to memory ...'
vt_load_iso_to_mem ${1}${chosen_path} vtoy_iso_buf
vt_load_img_memdisk ${1}${2} vtoy_iso_buf
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
@@ -679,7 +665,7 @@ function legacy_iso_menu_func {
loopback -d loop
fi
vt_chosen_img_path chosen_path
set chosen_path=$2
vt_select_auto_install ${chosen_path}
vt_select_persistence ${chosen_path}
@@ -691,7 +677,7 @@ function legacy_iso_menu_func {
fi
loopback loop ${1}${chosen_path}
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
get_os_type (loop)
if [ -n "$vtcompat" ]; then
@@ -716,29 +702,99 @@ function legacy_iso_menu_func {
}
function legacy_iso_memdisk {
vt_chosen_img_path chosen_path
linux16 $vtoy_path/memdisk iso raw
echo "Loading ISO file to memory ..."
initrd16 ${1}${chosen_path}
initrd16 ${1}${2}
boot
}
function iso_deepin_live_proc {
if [ -d (loop)/ ]; then
loopback -d loop
fi
loopback loop ${1}${2}
vt_img_sector ${1}${2}
vt_load_cpio $vtoy_path/ventoy.cpio $2 $1
vt_trailer_cpio $1 $2 noinit
ventoy_debug_pause
vt_set_boot_opt rdinit=/ventoy/loop/deepin/ventoy-init.sh live-media=/dev/mapper/ventoy
set ventoy_loading_tip="Loading files ......"
linux (loop)/live/vmlinuz boot=live components locales=zh_CN.UTF-8 splash quiet
initrd (loop)/live/initrd.img
boot
unset ventoy_loading_tip
vt_unset_boot_opt
}
function iso_endless_os_proc {
if [ -d (loop)/ ]; then
loopback -d loop
fi
loopback loop ${1}${2}
vt_img_sector ${1}${2}
vt_load_cpio $vtoy_path/ventoy.cpio $2 $1
vt_trailer_cpio $1 $2 noinit
ventoy_debug_pause
vt_set_boot_opt '@kparams' rdinit=/vtoy/vtoy
set eosimage=loop
set ventoy_bls_bootdev=/boot
set ventoy_loading_tip="Loading files ......"
export eosimage
configfile (loop)/endless/grub/grub.cfg
unset eosimage
unset ventoy_bls_bootdev
unset ventoy_loading_tip
vt_unset_boot_opt
}
function iso_common_menuentry {
unset vt_system_id
unset vt_volume_id
vt_chosen_img_path vt_chosen_path vt_chosen_size
vt_parse_iso_volume ${vtoy_iso_part}${vt_chosen_path} vt_system_id vt_volume_id
#special process for deepin-live iso
if [ "$vt_chosen_size" = "403701760" ]; then
if vt_str_begin $vt_chosen_path "/deepin-live"; then
iso_deepin_live_proc $vtoy_iso_part $vt_chosen_path
fi
fi
#special process for Endless OS
if vt_str_begin $vt_volume_id "Endless-OS"; then
iso_endless_os_proc $vtoy_iso_part $vt_chosen_path
fi
if [ "$grub_platform" = "pc" ]; then
if vt_check_mode 0; then
legacy_iso_memdisk $vtoy_iso_part
legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
else
legacy_iso_menu_func $vtoy_iso_part
legacy_iso_menu_func $vtoy_iso_part $vt_chosen_path
fi
else
if vt_check_mode 0; then
uefi_iso_memdisk $vtoy_iso_part
uefi_iso_memdisk $vtoy_iso_part $vt_chosen_path
else
uefi_iso_menu_func $vtoy_iso_part
uefi_iso_menu_func $vtoy_iso_part $vt_chosen_path
fi
fi
}
@@ -755,8 +811,8 @@ function iso_unsupport_menuentry {
}
function wim_common_menuentry {
vt_chosen_img_path chosen_path
vt_wim_chain_data ${vtoy_iso_part}${chosen_path}
vt_chosen_img_path vt_chosen_path vt_chosen_size
vt_wim_chain_data ${vtoy_iso_part}${vt_chosen_path}
ventoy_debug_pause
@@ -780,10 +836,14 @@ function wim_unsupport_menuentry {
}
function efi_common_menuentry {
vt_chosen_img_path chosen_path
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_iso_part}${chosen_path}
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
}
@@ -794,6 +854,17 @@ function efi_unsupport_menuentry {
function img_common_menuentry {
echo "To be implement"
}
function img_unsupport_menuentry {
common_unsupport_menuentry
}
#############################################################
#############################################################
#############################################################
@@ -892,6 +963,18 @@ fi
if [ "$vtoy_display_mode" = "CLI" ]; then
terminal_output console
elif [ "$vtoy_display_mode" = "serial" ]; then
if [ -n "$vtoy_serial_param" ]; then
serial $vtoy_serial_param
fi
terminal_input serial
terminal_output serial
elif [ "$vtoy_display_mode" = "serial_console" ]; then
if [ -n "$vtoy_serial_param" ]; then
serial $vtoy_serial_param
fi
terminal_input serial console
terminal_output serial console
else
if [ -n "$vtoy_theme" ]; then
set theme=$vtoy_theme