1.1.11
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled

. Fix the display issue when UEFI boot Windows/WinPE
. #3537
. #3532
. Add VT_WINDOWS_DISK_NONVTOY_CLOSEST_XXX  VT_LINUX_DISK_NONVTOY_CLOSEST_XXX
This commit is contained in:
longpanda
2026-04-05 23:11:45 +08:00
parent d35b8431fe
commit 167c87402c
12 changed files with 786 additions and 587 deletions

View File

@@ -1263,6 +1263,11 @@ EFI_STATUS EFIAPI VentoyEfiMain
return Status;
}
if (g_os_param_reserved[11] == 1)
{
ventoy_lock_max_res();
}
ventoy_disable_ex_filesystem();
if (gMemdiskMode)
@@ -1341,6 +1346,11 @@ EFI_STATUS EFIAPI VentoyEfiMain
ventoy_enable_ex_filesystem();
if (g_os_param_reserved[11] == 1)
{
ventoy_unlock_max_res();
}
return EFI_SUCCESS;
}

View File

@@ -428,6 +428,8 @@ EFI_STATUS ventoy_hook_1st_cdrom_start(VOID);
EFI_STATUS ventoy_hook_1st_cdrom_stop(VOID);
EFI_STATUS ventoy_disable_ex_filesystem(VOID);
EFI_STATUS ventoy_enable_ex_filesystem(VOID);
EFI_STATUS ventoy_lock_max_res(VOID);
EFI_STATUS ventoy_unlock_max_res(VOID);
#endif

View File

@@ -1797,3 +1797,108 @@ EFI_STATUS ventoy_hook_1st_cdrom_stop(VOID)
return EFI_SUCCESS;
}
#if 0
/* For force highest resolution for Windows/WinPE */
#endif
STATIC UINT32 g_org_mode_num;
STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE g_org_set_mode = NULL;
STATIC EFI_STATUS EFIAPI ventoy_set_mode
(
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
)
{
(void)This;
(void)ModeNumber;
/* Force highest resolution */
return EFI_SUCCESS;
}
EFI_STATUS ventoy_lock_max_res(VOID)
{
UINT32 i = 0;
UINT32 x = 0;
UINT32 y = 0;
UINT32 CurMode = 0;
UINT32 Highest = 0;
UINTN Size;
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info = NULL;
/* already hook */
if (g_org_set_mode)
{
return EFI_SUCCESS;
}
rc = gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (void **)&gop);
if (rc != EFI_SUCCESS)
{
debug("Failed to locate GOP protocol");
return EFI_SUCCESS;
}
CurMode = gop->Mode->Mode;
for (i = 0 ; i < gop->Mode->MaxMode ; i++)
{
/* Get mode information */
if (gop->QueryMode(gop, i, &Size, &info) == EFI_SUCCESS)
{
if (x < info->HorizontalResolution ||
(x == info->HorizontalResolution && y < info->VerticalResolution))
{
Highest = i;
x = info->HorizontalResolution;
y = info->VerticalResolution;
}
}
}
if (Highest != CurMode)
{
gop->SetMode(gop, Highest);
}
debug("Lock resolution to Mode:%d %d x %d", Highest, x, y);
g_org_mode_num = CurMode;
g_org_set_mode = gop->SetMode;
gop->SetMode = ventoy_set_mode;
return EFI_SUCCESS;
}
EFI_STATUS ventoy_unlock_max_res(VOID)
{
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
/* not hooked yet */
if (!g_org_set_mode)
{
return EFI_SUCCESS;
}
rc = gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (void **)&gop);
if (rc != EFI_SUCCESS)
{
debug("Failed to locate GOP protocol");
return EFI_SUCCESS;
}
g_org_set_mode(gop, g_org_mode_num);
gop->SetMode = g_org_set_mode;
g_org_set_mode = NULL;
return EFI_SUCCESS;
}

View File

@@ -435,6 +435,7 @@ static ctrl_var_cfg g_ctrl_vars[] =
{ "VTOY_WIN11_BYPASS_NRO", 1 },
{ "VTOY_LINUX_REMOUNT", 0 },
{ "VTOY_SECONDARY_BOOT_MENU", 1 },
{ "VTOY_WIN_UEFI_MAX_RES", 1 },
{ NULL, 0 }
};

View File

@@ -3245,6 +3245,18 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
param->vtoy_reserved[6] = file->vlnk;
grub_memcpy(param->vtoy_reserved + 7, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
/* Windows UEFI force highest resolution */
if (g_ventoy_chain_type == 1) /* Windows */
{
val = ventoy_get_env("VTOY_WIN_UEFI_MAX_RES");
if (val && val[0] == '1' && val[1] == 0)
{
param->vtoy_reserved[11] = 1;
}
}
/* calculate checksum */
for (i = 0; i < sizeof(ventoy_os_param); i++)
{

View File

@@ -125,6 +125,7 @@ typedef struct ventoy_os_param
* vtoy_reserved[5]: vtoy_linux_remount
* vtoy_reserved[6]: vtoy_vlnk
* vtoy_reserved[7~10]: vtoy_disk_sig[4] used for vlnk
* vtoy_reserved[11]: vtoy_win_uefi_max_res
*
*/
grub_uint8_t vtoy_reserved[32]; // Internal use by ventoy

View File

@@ -33,11 +33,13 @@ echo "_vtRet1=$_vtRet1 _vtRet2=$_vtRet2 ..." >> $VTLOG
if [ $_vtRet1 -ne 0 -a $_vtRet2 -eq 0 ]; then
vtFindFlag=0
$GREP '`value from`' /usr/* -r | $AWK -F: '{print $1}' | while read vtline; do
$GREP '`value from`' /usr/* -r | $AWK -F: '{print $1}' > $VTOY_PATH/.porteus
while read vtline; do
echo "hooking $vtline ..." >> $VTLOG
$SED "s#\`value from\`#$vtPath#g" -i $vtline
vtFindFlag=1
done
done < $VTOY_PATH/.porteus
rm -f $VTOY_PATH/.porteus
if [ $vtFindFlag -eq 0 ]; then
if $GREP -q '`value from`' /linuxrc; then

View File

@@ -66,6 +66,16 @@ if [ -f mkexfatfs_static ]; then
if ldd --version 2>&1 | grep -qi musl; then
mv mkexfatfs mkexfatfs_shared
mv mkexfatfs_static mkexfatfs
else
if ./mkexfatfs -V > /dev/null 2>&1; then
echo "mkexfatfs can not run, check static version" >> ./log.txt
else
if ./mkexfatfs_static -V > /dev/null 2>&1; then
echo "Use static version of mkexfatfs" >> ./log.txt
mv mkexfatfs mkexfatfs_shared
mv mkexfatfs_static mkexfatfs
fi
fi
fi
fi

View File

@@ -22,7 +22,7 @@ submenu "$VTLANG_CTRL_TEMP_SET" --class=debug_temp_set --class=F5tool {
}
menuentry "[ $VTOY_SECONDARY_BOOT_MENU ] $VTLANG_SECONDARY_BOOT_MENU" --class=debug_temp_second_menu --class=debug_temp_set --class=F5tool \
VTOY_RUN_SET3 {
VTOY_RUN_SET2 {
if [ "$VTOY_SECONDARY_BOOT_MENU" = "0" ]; then
set VTOY_SECONDARY_BOOT_MENU=1
else
@@ -30,6 +30,15 @@ submenu "$VTLANG_CTRL_TEMP_SET" --class=debug_temp_set --class=F5tool {
fi
}
menuentry "[ $VTOY_WIN_UEFI_MAX_RES ] $VTLANG_WIN_UEFI_MAX_RES" --class=debug_temp_win_uefi_res --class=debug_temp_set --class=F5tool \
VTOY_RUN_SET3 {
if [ "$VTOY_WIN_UEFI_MAX_RES" = "0" ]; then
set VTOY_WIN_UEFI_MAX_RES=1
else
set VTOY_WIN_UEFI_MAX_RES=0
fi
}
menuentry "$VTLANG_RETURN_PREVIOUS" --class=vtoyret VTOY_RET {
echo "Return ..."
}

View File

@@ -2449,7 +2449,7 @@ function mimg_common_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.1.10"
set VENTOY_VERSION="1.1.11"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1

View File

@@ -341,6 +341,7 @@ EOF
udevadm trigger --name-match=$DISK >/dev/null 2>&1
partprobe >/dev/null 2>&1
partx -u $DISK >/dev/null 2>&1
sleep 3
echo "Done"
@@ -458,6 +459,7 @@ format_ventoy_disk_gpt() {
udevadm trigger --name-match=$DISK >/dev/null 2>&1
partprobe >/dev/null 2>&1
partx -u $DISK >/dev/null 2>&1
sleep 3
echo "Done"

View File

@@ -446,6 +446,51 @@ static int expand_var(const char *var, char *value, int len)
vlog("[Error] %s not found\n", var);
}
}
else if (strncmp(var, "VT_LINUX_DISK_NONVTOY_CLOSEST_", 30) == 0)
{
uiDst = strtoul(var + 30, NULL, 10);
uiDst = uiDst * (1024ULL * 1024ULL * 1024ULL);
for (i = 0; i < g_disk_num; i++)
{
node = g_disk_list + i;
if (node->size == 0)
{
continue;
}
if (strcmp(node->name, g_vtoy_disk_name) == 0)
{
continue;
}
if (node->size > uiDst)
{
delta = node->size - uiDst;
}
else
{
delta = uiDst - node->size;
}
if (delta < maxdelta)
{
index = i;
maxdelta = delta;
}
}
if (index >= 0)
{
vlog("%s=<%s>\n", var, g_disk_list[index].name);
snprintf(value, len, "%s", g_disk_list[index].name);
return 0;
}
else
{
vlog("[Error] %s not found\n", var);
}
}
else
{
vlog("Invalid var name <%s>\n", var);