X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/bf2517bb2594b07ba2edab8157e77512fbe59cd0..6b22a6200e8f72d3260d292800a8786666623bfc:/INSTALL/grub/grub.cfg diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index 2d2498b..a53de0a 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -158,7 +158,7 @@ function get_os_type { function vt_check_compatible_pe { #Check for PE without external tools #set compatible if ISO file is less than 80MB - if [ $vt_chosen_size -gt 33554432 -a $vt_chosen_size -le 83886080 ]; then + if [ $vt_chosen_size -GT 33554432 -a $vt_chosen_size -LE 83886080 ]; then set ventoy_compatible=YES fi @@ -185,7 +185,7 @@ function locate_initrd { } function locate_wim { - vt_windows_locate_wim_patch (loop) + vt_windows_locate_wim_patch (loop) "$1" if [ -n "${vtdebug_flag}" ]; then echo '###############################################' @@ -381,7 +381,9 @@ function distro_specify_initrd_file_phase2 { vt_linux_specify_initrd_file /sysresccd/boot/i686/sysresccd.img elif [ -f (loop)/boot/full.cz ]; then vt_linux_specify_initrd_file /boot/full.cz - + elif [ -f (loop)/images/pxeboot/initrd.img ]; then + vt_linux_specify_initrd_file /images/pxeboot/initrd.img + fi } @@ -597,34 +599,35 @@ function ventoy_unix_comm_proc { function uefi_windows_menu_func { vt_windows_reset - if [ "$ventoy_compatible" = "NO" ]; then - - if [ "$ventoy_fs_probe" = "iso9660" ]; then - loopback -d loop - vt_iso9660_nojoliet 1 - loopback loop "$1$2" - fi - - for file in "efi/microsoft/boot/bcd"; do - vt_windows_collect_wim_patch bcd (loop)/$file - done + if vt_check_mode 4 "$vt_chosen_name"; then + vt_windows_chain_data "${1}${chosen_path}" + ventoy_debug_pause + vtoy_wimboot_func + else + if [ "$ventoy_compatible" = "NO" ]; then + + if [ "$ventoy_fs_probe" = "iso9660" ]; then + loopback -d loop + vt_iso9660_nojoliet 1 + loopback loop "$1$2" + fi + + for file in "efi/microsoft/boot/bcd"; do + vt_windows_collect_wim_patch bcd (loop)/$file + done - vt_windows_count_wim_patch vt_wim_cnt - if [ $vt_wim_cnt -eq 0 ]; then - distro_specify_wim_patch_phase2 + vt_windows_count_wim_patch vt_wim_cnt + if [ $vt_wim_cnt -eq 0 ]; then + distro_specify_wim_patch_phase2 + fi + + ventoy_debug_pause + locate_wim "${chosen_path}" fi - - ventoy_debug_pause - locate_wim + vt_windows_chain_data "${1}${chosen_path}" + ventoy_debug_pause fi - vt_windows_chain_data "${1}${chosen_path}" - ventoy_debug_pause - - if vt_check_mode 4; then - vtoy_windows_wimboot_func - fi - if [ -n "$vtoy_chain_mem_addr" ]; then ventoy_acpi_param ${vtoy_chain_mem_addr} 2048 ventoy_cli_console @@ -768,7 +771,7 @@ function uefi_linux_menu_func { vt_linux_chain_data "${1}${chosen_path}" - if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -lt 104857600 ]; then + if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -LT 104857600 ]; then if [ -f (loop)/efi/clover/cloverx64.efi ]; then unset LoadIsoEfiDriver fi @@ -779,7 +782,7 @@ function uefi_linux_menu_func { ventoy_cli_console unset vtGrub2Mode - if vt_check_mode 3; then + if vt_check_mode 3 "$vt_chosen_name"; then set vtGrub2Mode=1 elif vt_str_begin "$vt_volume_id" "KRD"; then if [ -f (loop)/boot/grub/grub.cfg.sig ]; then @@ -867,7 +870,7 @@ function uefi_iso_menu_func { if [ -n "$vtisouefi" ]; then set LoadIsoEfiDriver=on unset vtisouefi - elif vt_check_mode 2; then + elif vt_check_mode 2 "$vt_chosen_name"; then set LoadIsoEfiDriver=on else unset LoadIsoEfiDriver @@ -904,7 +907,7 @@ function uefi_iso_menu_func { if [ -n "$vtcompat" ]; then set ventoy_compatible=YES unset vtcompat - elif vt_check_mode 1; then + elif vt_check_mode 1 "$vt_chosen_name"; then set ventoy_compatible=YES else vt_check_compatible (loop) @@ -940,8 +943,7 @@ function uefi_iso_memdisk { ventoy_gui_console } - -function vtoy_windows_wimboot_func { +function vtoy_windows_wimboot { if [ -f (loop)/x86/sources/boot.wim -a -f (loop)/x64/sources/boot.wim ]; then vt_sel_wimboot vtoy_wimboot_bit if [ "$vtoy_wimboot_bit" = "32" ]; then @@ -959,7 +961,7 @@ function vtoy_windows_wimboot_func { fi if [ -n "${vtdebug_flag}" ]; then - echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit + echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel fi for wmfile in sources/boot.wim boot/bcd boot/boot.sdi; do @@ -969,33 +971,24 @@ function vtoy_windows_wimboot_func { done if [ -f $vtoy_wimboot_prefix/sources/install.wim -o -f $vtoy_wimboot_prefix/sources/install.esd ]; then - vt_windows_wimboot_data + vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe else return fi if [ "$grub_platform" = "pc" ]; then - set vt_wimkernel=wimboot.x86_64.xz - linux16 "$vtoy_path/$vt_wimkernel" quiet ventoy_debug_pause vt_set_wim_load_prompt 1 "Loading files......" - initrd16 newc:vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe \ - newc:wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \ - newc:winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size} \ + initrd16 newc:winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \ + newc:vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd \ newc:bcd:$vtoy_wimboot_prefix/boot/bcd \ newc:boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi \ newc:boot.wim:$vtoy_wimboot_prefix/sources/boot.wim vt_set_wim_load_prompt 0 boot else - if [ "$grub_cpu" = "i386" ]; then - set vt_wimkernel=wimboot.i386.efi.xz - else - set vt_wimkernel=wimboot.x86_64.xz - fi - vt_set_wim_load_prompt 1 "Loading files......" vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/sources/boot.wim vtoy_wimfile_mem vt_set_wim_load_prompt 0 @@ -1008,9 +1001,8 @@ function vtoy_windows_wimboot_func { ventoy_cli_console chainloader "$vtoy_path/$vt_wimkernel" quiet \ - "vf=wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \ - "vf=winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size}" \ - "vf=vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe" \ + "vf=winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \ + "vf=vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd" \ "vf=bcd:$vtoy_wimboot_prefix/boot/bcd" \ "vf=boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi" \ "vf=boot.wim:$vtoy_wimfile_path" \ @@ -1021,37 +1013,118 @@ function vtoy_windows_wimboot_func { fi } -function legacy_windows_menu_func { - vt_windows_reset +function vtoy_winpe_wimboot { + unset vtoy_boot_mgr_exe + unset vtoy_boot_mgr_efi + set vtoy_wimboot_prefix=(loop) + set vtoy_bcd_path="$1" + set vtoy_sdi_path="$2" + set vtoy_wim_path="$3" + set vtoy_mgr_flag="$4" - if [ "$ventoy_compatible" = "NO" ]; then - - if [ "$ventoy_fs_probe" = "iso9660" ]; then - loopback -d loop - vt_iso9660_nojoliet 1 - loopback loop "$1$2" + if [ $vtoy_mgr_flag -eq 1 ]; then + set vtoy_boot_mgr_exe="newc:bootmgr.exe:$vtoy_wimboot_prefix/$5" + elif [ $vtoy_mgr_flag -eq 2 ]; then + set vtoy_boot_mgr_efi="vf=bootmgr.efi:$vtoy_wimboot_prefix/$5" + elif [ $vtoy_mgr_flag -eq 3 ]; then + set vtoy_boot_mgr_exe="newc:bootmgr.exe:$vtoy_wimboot_prefix/$5" + set vtoy_boot_mgr_efi="vf=bootmgr.efi:$vtoy_wimboot_prefix/$6" + fi + + vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe + + if [ "$grub_platform" = "pc" ]; then + linux16 "$vtoy_path/$vt_wimkernel" quiet + ventoy_debug_pause + + vt_set_wim_load_prompt 1 "Loading files......" + initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \ + $vtoy_boot_mgr_exe \ + newc:vtoy_wimboot:$vtoy_wimboot_prefix/$vtoy_bcd_path \ + newc:bcd:$vtoy_wimboot_prefix/$vtoy_bcd_path \ + newc:boot.sdi:$vtoy_wimboot_prefix/$vtoy_sdi_path \ + newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path + vt_set_wim_load_prompt 0 + boot + else + vt_set_wim_load_prompt 1 "Loading files......" + vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem + vt_set_wim_load_prompt 0 + + if [ $? -eq 0 ]; then + set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size} + else + set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path fi - - for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do - vt_windows_collect_wim_patch bcd (loop)/$file - done - - distro_specify_wim_patch - vt_windows_count_wim_patch vt_wim_cnt - if [ $vt_wim_cnt -eq 0 ]; then - distro_specify_wim_patch_phase2 + ventoy_cli_console + chainloader "$vtoy_path/$vt_wimkernel" quiet \ + "vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \ + "vf=vtoy_wimboot:$vtoy_wimboot_prefix/$vtoy_bcd_path" \ + "$vtoy_boot_mgr_efi" \ + "vf=bcd:$vtoy_wimboot_prefix/$vtoy_bcd_path" \ + "vf=boot.sdi:$vtoy_wimboot_prefix/$vtoy_sdi_path" \ + "vf=boot.wim:$vtoy_wimfile_path" \ + pfsize=$vtoy_chain_file_size \ + pfread=$vtoy_chain_file_read + boot + ventoy_gui_console + fi +} + +function vtoy_wimboot_func { + echo -e "\n===================== VENTOY WIMBOOT ===================\n" + + if [ "$grub_platform" = "pc" ]; then + set vt_wimkernel=wimboot.x86_64.xz + else + if [ "$grub_cpu" = "i386" ]; then + set vt_wimkernel=wimboot.i386.efi.xz + else + set vt_wimkernel=wimboot.x86_64.xz fi - - ventoy_debug_pause - locate_wim fi - vt_windows_chain_data "${1}${chosen_path}" - ventoy_debug_pause + if vt_str_begin "$vt_volume_id" "Modified-Win10PEx64"; then + vtoy_winpe_wimboot 'Boot/bcd' 'Boot/boot.sdi' 'sources/boot.wim' 1 'bootmgr.exe' + else + vtoy_windows_wimboot + fi +} - if vt_check_mode 4; then - vtoy_windows_wimboot_func +function legacy_windows_menu_func { + vt_windows_reset + + if vt_check_mode 4 "$vt_chosen_name"; then + vt_windows_chain_data "${1}${chosen_path}" + ventoy_debug_pause + vtoy_wimboot_func + else + if [ "$ventoy_compatible" = "NO" ]; then + + if [ "$ventoy_fs_probe" = "iso9660" ]; then + loopback -d loop + vt_iso9660_nojoliet 1 + loopback loop "$1$2" + fi + + for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do + vt_windows_collect_wim_patch bcd (loop)/$file + done + + distro_specify_wim_patch + + vt_windows_count_wim_patch vt_wim_cnt + if [ $vt_wim_cnt -eq 0 ]; then + distro_specify_wim_patch_phase2 + fi + + ventoy_debug_pause + locate_wim "${chosen_path}" + fi + + vt_windows_chain_data "${1}${chosen_path}" + ventoy_debug_pause fi if [ -n "$vtoy_chain_mem_addr" ]; then @@ -1133,7 +1206,7 @@ function legacy_linux_menu_func { ventoy_debug_pause if [ -n "$vtoy_chain_mem_addr" ]; then - if vt_check_mode 3; then + if vt_check_mode 3 "$vt_chosen_name"; then ventoy_acpi_param ${vtoy_chain_mem_addr} 2048 ventoy_cli_console @@ -1212,7 +1285,7 @@ function legacy_iso_menu_func { if [ -n "$vtcompat" ]; then set ventoy_compatible=YES unset vtcompat - elif vt_check_mode 1; then + elif vt_check_mode 1 "$vt_chosen_name"; then set ventoy_compatible=YES else vt_check_compatible (loop) @@ -1307,7 +1380,7 @@ function iso_common_menuentry { vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space - if [ $vt_volume_space -ne $vt_chosen_size ]; then + if [ $vt_volume_space -NE $vt_chosen_size ]; then vt_mod $vt_chosen_size 2048 vt_chosen_size_mod if [ $vt_chosen_size_mod -ne 0 ]; then echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n" @@ -1343,7 +1416,7 @@ function iso_common_menuentry { # auto memdisk mode for some special ISO files vt_iso_vd_id_parse "${vtoy_iso_part}${vt_chosen_path}" unset vtMemDiskBoot - if vt_check_mode 0; then + if vt_check_mode 0 "$vt_chosen_name"; then set vtMemDiskBoot=1 else if [ "$grub_platform" = "pc" ]; then @@ -1355,7 +1428,7 @@ function iso_common_menuentry { fi #For iKuai8 (<64MB) - if [ $vt_chosen_size -le 67108864 ]; then + if [ $vt_chosen_size -LE 67108864 ]; then if vt_str_begin "$vt_chosen_name" "iKuai"; then set vtMemDiskBoot=1 fi @@ -1380,7 +1453,7 @@ function iso_common_menuentry { } function miso_common_menuentry { - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -1414,7 +1487,7 @@ function iso_unsupport_menuentry { } function wim_common_menuentry { - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -1453,7 +1526,7 @@ function wim_unsupport_menuentry { } function efi_common_menuentry { - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -1523,7 +1596,7 @@ function vhdboot_common_func { } function vhd_common_menuentry { - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -1620,7 +1693,7 @@ function vtoyboot_common_func { } function vtoy_common_menuentry { - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -1797,7 +1870,7 @@ function ventoy_img_ubos { } function ventoy_img_recalbox { - if [ $vtoy_img_max_part_end -gt $vt_chosen_size ]; then + if [ $vtoy_img_max_part_end -GT $vt_chosen_size ]; then echo -e "\nPlease extend the img file size before boot it. \n" ventoy_pause return @@ -2030,7 +2103,7 @@ function img_common_menuentry { set ventoy_busybox_ver=32 unset LoadIsoEfiDriver - vt_chosen_img_path vt_chosen_path vt_chosen_size + vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name if vt_check_password "${vt_chosen_path}"; then return @@ -2041,7 +2114,7 @@ function img_common_menuentry { fi if [ "$grub_platform" = "pc" ]; then - if vt_check_mode 0; then + if vt_check_mode 0 "$vt_chosen_name"; then legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path" return fi @@ -2076,11 +2149,15 @@ function img_common_menuentry { if vt_str_begin "$vtImgHd3Label" "ROOT-"; then if [ -f (vtimghd,3)/etc/os-release.d/ID ]; then vt_1st_line (vtimghd,3)/etc/os-release.d/ID vt_release_line1 - if [ vt_str_begin "$vt_release_line1" "FydeOS" ]; then + if vt_str_begin "$vt_release_line1" "FydeOS"; then ventoy_img_fydeos + else + ventoy_img_cloudready fi elif [ -f (vtimghd,3)/etc/cloudready-release ]; then ventoy_img_cloudready + elif [ -f (vtimghd,3)/etc/chrome_dev.conf ]; then + ventoy_img_cloudready fi elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then ventoy_img_openelec lakka @@ -2145,7 +2222,7 @@ function img_unsupport_menuentry { ############################################################# ############################################################# -set VENTOY_VERSION="1.0.75" +set VENTOY_VERSION="1.0.79" #ACPI not compatible with Window7/8, so disable by default set VTOY_PARAM_NO_ACPI=1