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;
}
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. */
}
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 ();
--- /dev/null
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+#************************************************************************************
+
+. /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
--- /dev/null
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+#************************************************************************************
+
+$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
fi
fi
+ if [ -e /opt/kerio ]; then
+ echo 'kerio'; return
+ fi
echo 'default'
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"
#############################################################
#############################################################
-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
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;
}
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;
}