Commit be50ea69 authored by longpanda's avatar longpanda
Browse files

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
parent 433d854a
...@@ -17,10 +17,8 @@ ...@@ -17,10 +17,8 @@
#************************************************************************************ #************************************************************************************
function ventoy_pause { function ventoy_pause {
if [ -n "${vtdebug_flag}" ]; then echo "press Enter to continue ......"
echo "press Enter to continue ......" read vtTmpPause
read vtTmpPause
fi
} }
function ventoy_debug_pause { function ventoy_debug_pause {
...@@ -30,29 +28,20 @@ function ventoy_debug_pause { ...@@ -30,29 +28,20 @@ function ventoy_debug_pause {
fi fi
} }
function ventoy_cli_console { function ventoy_cli_console {
if [ "$grub_platform" = "pc" ]; then if [ -z "$vtoy_display_mode" ]; then
#terminal_output vga_text terminal_output console
elif [ "$vtoy_display_mode" = "GUI" ]; then
terminal_output console terminal_output console
else
if [ "$vtoy_display_mode" != "CLI" ]; then
terminal_output console
fi
fi fi
} }
function ventoy_gui_console { function ventoy_gui_console {
if [ "$grub_platform" = "pc" ]; then if [ -z "$vtoy_display_mode" ]; then
if [ "$vtoy_display_mode" = "CLI" ]; then terminal_output gfxterm
terminal_output console elif [ "$vtoy_display_mode" = "GUI" ]; then
else terminal_output gfxterm
terminal_output gfxterm fi
fi
else
if [ "$vtoy_display_mode" != "CLI" ]; then
terminal_output gfxterm
fi
fi
} }
function ventoy_power { function ventoy_power {
...@@ -401,7 +390,7 @@ function uefi_linux_menu_func { ...@@ -401,7 +390,7 @@ function uefi_linux_menu_func {
fi fi
vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1 vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1
vt_linux_clear_initrd vt_linux_clear_initrd
if [ -d (loop)/pmagic ]; then if [ -d (loop)/pmagic ]; then
...@@ -501,7 +490,7 @@ function uefi_iso_menu_func { ...@@ -501,7 +490,7 @@ function uefi_iso_menu_func {
unset LoadIsoEfiDriver unset LoadIsoEfiDriver
fi fi
vt_chosen_img_path chosen_path set chosen_path=$2
vt_select_auto_install ${chosen_path} vt_select_auto_install ${chosen_path}
vt_select_persistence ${chosen_path} vt_select_persistence ${chosen_path}
...@@ -512,8 +501,7 @@ function uefi_iso_menu_func { ...@@ -512,8 +501,7 @@ function uefi_iso_menu_func {
vt_iso9660_nojoliet 0 vt_iso9660_nojoliet 0
fi fi
loopback loop ${1}${chosen_path} loopback loop ${1}${chosen_path}
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
get_os_type (loop) get_os_type (loop)
if [ -d (loop)/EFI ]; then if [ -d (loop)/EFI ]; then
...@@ -548,10 +536,8 @@ function uefi_iso_menu_func { ...@@ -548,10 +536,8 @@ function uefi_iso_menu_func {
} }
function uefi_iso_memdisk { function uefi_iso_memdisk {
vt_chosen_img_path chosen_path
echo 'Loading ISO file to memory ...' 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 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} 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 { ...@@ -679,7 +665,7 @@ function legacy_iso_menu_func {
loopback -d loop loopback -d loop
fi fi
vt_chosen_img_path chosen_path set chosen_path=$2
vt_select_auto_install ${chosen_path} vt_select_auto_install ${chosen_path}
vt_select_persistence ${chosen_path} vt_select_persistence ${chosen_path}
...@@ -691,7 +677,7 @@ function legacy_iso_menu_func { ...@@ -691,7 +677,7 @@ function legacy_iso_menu_func {
fi fi
loopback loop ${1}${chosen_path} loopback loop ${1}${chosen_path}
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
get_os_type (loop) get_os_type (loop)
if [ -n "$vtcompat" ]; then if [ -n "$vtcompat" ]; then
...@@ -716,29 +702,99 @@ function legacy_iso_menu_func { ...@@ -716,29 +702,99 @@ function legacy_iso_menu_func {
} }
function legacy_iso_memdisk { function legacy_iso_memdisk {
vt_chosen_img_path chosen_path
linux16 $vtoy_path/memdisk iso raw linux16 $vtoy_path/memdisk iso raw
echo "Loading ISO file to memory ..." 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 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 { function iso_common_menuentry {
unset vt_system_id unset vt_system_id
unset vt_volume_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 [ "$grub_platform" = "pc" ]; then
if vt_check_mode 0; then if vt_check_mode 0; then
legacy_iso_memdisk $vtoy_iso_part legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
else else
legacy_iso_menu_func $vtoy_iso_part legacy_iso_menu_func $vtoy_iso_part $vt_chosen_path
fi fi
else else
if vt_check_mode 0; then if vt_check_mode 0; then
uefi_iso_memdisk $vtoy_iso_part uefi_iso_memdisk $vtoy_iso_part $vt_chosen_path
else else
uefi_iso_menu_func $vtoy_iso_part uefi_iso_menu_func $vtoy_iso_part $vt_chosen_path
fi fi
fi fi
} }
...@@ -755,8 +811,8 @@ function iso_unsupport_menuentry { ...@@ -755,8 +811,8 @@ function iso_unsupport_menuentry {
} }
function wim_common_menuentry { function wim_common_menuentry {
vt_chosen_img_path chosen_path vt_chosen_img_path vt_chosen_path vt_chosen_size
vt_wim_chain_data ${vtoy_iso_part}${chosen_path} vt_wim_chain_data ${vtoy_iso_part}${vt_chosen_path}
ventoy_debug_pause ventoy_debug_pause
...@@ -780,10 +836,14 @@ function wim_unsupport_menuentry { ...@@ -780,10 +836,14 @@ function wim_unsupport_menuentry {
} }
function efi_common_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 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 boot
ventoy_gui_console ventoy_gui_console
} }
...@@ -794,6 +854,17 @@ function efi_unsupport_menuentry { ...@@ -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 ...@@ -892,6 +963,18 @@ fi
if [ "$vtoy_display_mode" = "CLI" ]; then if [ "$vtoy_display_mode" = "CLI" ]; then
terminal_output console 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 else
if [ -n "$vtoy_theme" ]; then if [ -n "$vtoy_theme" ]; then
set theme=$vtoy_theme set theme=$vtoy_theme
......
*acpi: acpi *acpi: acpi
*all_functional_test: functional_test *all_functional_test: functional_test
*background_image: gfxterm_background *background_image: gfxterm_background
*bls_import: blscfg
*blscfg: blscfg
*cat: cat *cat: cat
*cpuid: cpuid *cpuid: cpuid
*crc: hashsum *crc: hashsum
...@@ -106,6 +108,7 @@ help: minicmd ...@@ -106,6 +108,7 @@ help: minicmd
hexdump_random: random hexdump_random: random
initrd16: linux16 initrd16: linux16
initrd: linux initrd: linux
initrdefi: linux
keymap: keylayouts keymap: keylayouts
kfreebsd_loadenv: bsd kfreebsd_loadenv: bsd
kfreebsd_module: bsd kfreebsd_module: bsd
...@@ -122,6 +125,7 @@ legacy_password: legacycfg ...@@ -122,6 +125,7 @@ legacy_password: legacycfg
legacy_source: legacycfg legacy_source: legacycfg
linux16: linux16 linux16: linux16
linux: linux linux: linux
linuxefi: linux
list_trusted: pgp list_trusted: pgp
loadfont: font loadfont: font
lsapm: lsapm lsapm: lsapm
...@@ -184,6 +188,8 @@ vbeinfo: videoinfo ...@@ -184,6 +188,8 @@ vbeinfo: videoinfo
vbetest: videotest vbetest: videotest
videoinfo: videoinfo videoinfo: videoinfo
videotest: videotest videotest: videotest
vt_set_boot_opt: linux
vt_unset_boot_opt: linux
write_byte: memrw write_byte: memrw
write_dword: memrw write_dword: memrw
write_word: memrw write_word: memrw
......
...@@ -96,6 +96,7 @@ bufio: ...@@ -96,6 +96,7 @@ bufio:
usbserial_ftdi: serial usb usbserial_common usbserial_ftdi: serial usb usbserial_common
legacy_password_test: functional_test legacycfg legacy_password_test: functional_test legacycfg
cpuid: extcmd cpuid: extcmd
blscfg: extcmd normal
hdparm: extcmd hexdump hdparm: extcmd hexdump
bfs: fshelp bfs: fshelp
gcry_blowfish: crypto gcry_blowfish: crypto
......
*acpi: acpi *acpi: acpi
*all_functional_test: functional_test *all_functional_test: functional_test
*background_image: gfxterm_background *background_image: gfxterm_background
*bls_import: blscfg
*blscfg: blscfg
*cat: cat *cat: cat
*cpuid: cpuid *cpuid: cpuid
*crc: hashsum *crc: hashsum
...@@ -96,6 +98,7 @@ help: minicmd ...@@ -96,6 +98,7 @@ help: minicmd
hexdump_random: random hexdump_random: random
initrd16: linux16 initrd16: linux16
initrd: linux initrd: linux
initrdefi: linux
keymap: keylayouts keymap: keylayouts
kfreebsd_loadenv: bsd kfreebsd_loadenv: bsd
kfreebsd_module: bsd kfreebsd_module: bsd
...@@ -112,6 +115,7 @@ legacy_password: legacycfg ...@@ -112,6 +115,7 @@ legacy_password: legacycfg
legacy_source: legacycfg legacy_source: legacycfg
linux16: linux16 linux16: linux16
linux: linux linux: linux
linuxefi: linux
list_trusted: pgp list_trusted: pgp
loadbios: loadbios loadbios: loadbios
loadfont: font loadfont: font
...@@ -173,6 +177,8 @@ true: true ...@@ -173,6 +177,8 @@ true: true
usb: usbtest usb: usbtest
videoinfo: videoinfo videoinfo: videoinfo
videotest: videotest videotest: videotest
vt_set_boot_opt: linux
vt_unset_boot_opt: linux
write_byte: memrw write_byte: memrw
write_dword: memrw write_dword: memrw
write_word: memrw write_word: memrw
......
...@@ -93,6 +93,7 @@ bufio: ...@@ -93,6 +93,7 @@ bufio:
usbserial_ftdi: serial usb usbserial_common usbserial_ftdi: serial usb usbserial_common
legacy_password_test: functional_test legacycfg legacy_password_test: functional_test legacycfg
cpuid: extcmd cpuid: extcmd
blscfg: extcmd normal
hdparm: extcmd hexdump hdparm: extcmd hexdump
bfs: fshelp bfs: fshelp
gcry_blowfish: crypto gcry_blowfish: crypto
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment