diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c index a6e168e0..9866a4a4 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c @@ -474,8 +474,12 @@ EFI_STATUS EFIAPI ventoy_block_io_read offset = Lba * 2048; } - VirtSec = g_chain->virt_img_size_in_bytes / 2048; - if (Lba + secNum > VirtSec) + VirtSec = g_chain->virt_img_size_in_bytes / 2048; + if (Lba >= VirtSec) + { + return EFI_SUCCESS; + } + else if (Lba + secNum > VirtSec) { secNum = VirtSec - Lba; } diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c index 393f2752..a83aecca 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c @@ -42,6 +42,7 @@ int g_ventoy_last_entry = -1; int g_ventoy_suppress_esc = 0; int g_ventoy_menu_esc = 0; int g_ventoy_fn_mutex = 0; +int g_ventoy_terminal_output = 0; /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */ @@ -871,15 +872,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) } break; case GRUB_TERM_KEY_F7: - case '7': - cmdstr = grub_env_get("VTOY_F7_CMD"); - if (cmdstr) + menu_fini (); + if (g_ventoy_terminal_output == 0) { - menu_fini (); - grub_script_execute_sourcecode(cmdstr); - goto refresh; + grub_script_execute_sourcecode("terminal_output console"); + g_ventoy_terminal_output = 1; } - break; + else + { + grub_script_execute_sourcecode("terminal_output gfxterm"); + g_ventoy_terminal_output = 0; + } + goto refresh; case GRUB_TERM_KEY_F1: case '1': menu_fini (); diff --git a/IMG/cpio/ventoy/hook/debian/kerio-disk.sh b/IMG/cpio/ventoy/hook/debian/kerio-disk.sh new file mode 100644 index 00000000..a589d8f8 --- /dev/null +++ b/IMG/cpio/ventoy/hook/debian/kerio-disk.sh @@ -0,0 +1,79 @@ +#!/ventoy/busybox/sh +#************************************************************************************ +# Copyright (c) 2020, longpanda +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +#************************************************************************************ + +. /ventoy/hook/ventoy-hook-lib.sh + +if is_ventoy_hook_finished; then + exit 0 +fi + +vtlog "####### $0 $* ########" + +VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH + + +ventoy_os_install_dmsetup_by_ko() { + vtlog "ventoy_os_install_dmsetup_by_ko $1" + + vtVer=$(uname -r) + if uname -m | $GREP -q 64; then + vtBit=64 + else + vtBit=32 + fi + + ventoy_extract_vtloopex $1 kerio + vtLoopExDir=$VTOY_PATH/vtloopex/kerio/vtloopex + + if [ -e $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz ]; then + $BUSYBOX_PATH/xz -d $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz + insmod $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko + fi +} + + +wait_for_usb_disk_ready + +vtdiskname=$(get_ventoy_disk_name) +if [ "$vtdiskname" = "unknown" ]; then + vtlog "ventoy disk not found" + PATH=$VTPATH_OLD + exit 0 +fi + +if echo $vtdiskname | $EGREP -q "nvme|mmc|nbd"; then + ventoy_os_install_dmsetup_by_ko "${vtdiskname}p2" +else + ventoy_os_install_dmsetup_by_ko "${vtdiskname}2" +fi + + +ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace" + +blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/') +vtDM=$(ventoy_find_dm_id ${blkdev_num}) + +vtlog "/dev/$vtDM" +mount -t iso9660 /dev/$vtDM /cdrom +modprobe squashfs +echo "/dev/$vtDM" > /ventoy/vtDM + +PATH=$VTPATH_OLD + +set_ventoy_hook_finish diff --git a/IMG/cpio/ventoy/hook/debian/kerio-hook.sh b/IMG/cpio/ventoy/hook/debian/kerio-hook.sh new file mode 100644 index 00000000..864292b7 --- /dev/null +++ b/IMG/cpio/ventoy/hook/debian/kerio-hook.sh @@ -0,0 +1,20 @@ +#!/ventoy/busybox/sh +#************************************************************************************ +# Copyright (c) 2020, longpanda +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +#************************************************************************************ + +$SED "/for drive in/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/kerio-disk.sh >/dev/null 2>&1; cat /ventoy/vtDM; exit 0" -i /installer/install_init diff --git a/IMG/cpio/ventoy/hook/debian/ventoy-hook.sh b/IMG/cpio/ventoy/hook/debian/ventoy-hook.sh index 9c4b50fd..2af8bd17 100644 --- a/IMG/cpio/ventoy/hook/debian/ventoy-hook.sh +++ b/IMG/cpio/ventoy/hook/debian/ventoy-hook.sh @@ -86,6 +86,9 @@ ventoy_get_debian_distro() { fi fi + if [ -e /opt/kerio ]; then + echo 'kerio'; return + fi echo 'default' diff --git a/IMG/cpio/ventoy/hook/manjaro/ventoy-disk.sh b/IMG/cpio/ventoy/hook/manjaro/ventoy-disk.sh index e325eabf..d23fe499 100644 --- a/IMG/cpio/ventoy/hook/manjaro/ventoy-disk.sh +++ b/IMG/cpio/ventoy/hook/manjaro/ventoy-disk.sh @@ -49,7 +49,12 @@ done if [ -n "$1" ]; then vtlog "ln -s /dev/$vtDM $1" - ln -s /dev/$vtDM "$1" + + if [ -e "$1" ]; then + vtlog "$1 already exist" + else + ln -s /dev/$vtDM "$1" + fi else vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/') vtlog "vtLABEL is $vtLABEL" diff --git a/IMG/vtloopex/kerio/vtloopex/dm-mod/3.16.0-k5-kerio-amd64/64/dm-mod.ko.xz b/IMG/vtloopex/kerio/vtloopex/dm-mod/3.16.0-k5-kerio-amd64/64/dm-mod.ko.xz new file mode 100644 index 00000000..27d9fcb7 Binary files /dev/null and b/IMG/vtloopex/kerio/vtloopex/dm-mod/3.16.0-k5-kerio-amd64/64/dm-mod.ko.xz differ diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index 783cfdad..162acf35 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -1608,7 +1608,7 @@ function img_unsupport_menuentry { ############################################################# ############################################################# -set VENTOY_VERSION="1.0.38" +set VENTOY_VERSION="1.0.39" #ACPI not compatible with Window7/8, so disable by default set VTOY_PARAM_NO_ACPI=1 diff --git a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c index 58cc9750..074f1afe 100644 --- a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c +++ b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c @@ -402,6 +402,19 @@ int ventoy_vdisk_read(struct san_device *sandev, uint64_t lba, unsigned int coun if (g_hddmode) { + #if 0 + /* need to check ?? */ + lastlba = g_chain->virt_img_size_in_bytes / 512; + if (lba < lastlba) + { + if (lba + count > lastlba) + { + count = lastlba - lba; + } + ventoy_vdisk_read_real_hdd(lba, count, buffer); + } + #endif + ventoy_vdisk_read_real_hdd(lba, count, buffer); ix86->regs.dl = sandev->drive; return 0; @@ -435,7 +448,15 @@ int ventoy_vdisk_read(struct san_device *sandev, uint64_t lba, unsigned int coun } VirtSec = g_chain->virt_img_size_in_bytes / 2048; - if (lba + count > VirtSec) + if (lba >= VirtSec) + { + /* fix for grub4dos Inconsistent data read from error */ + memset((void *)(buffer + (count - 1) * 2048), 0, 2048); + + ix86->regs.dl = sandev->drive; + return 0; + } + else if (lba + count > VirtSec) { count = VirtSec - lba; } diff --git a/LANGUAGES/languages.ini b/LANGUAGES/languages.ini index 8f92970f..b07c287e 100644 Binary files a/LANGUAGES/languages.ini and b/LANGUAGES/languages.ini differ