mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-03-30 09:13:45 -04:00
1.0.21 release
This commit is contained in:
parent
260a3269b7
commit
9eb334d99a
@ -999,6 +999,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
|
|||||||
grub_menu_execute_entry (e, 0);
|
grub_menu_execute_entry (e, 0);
|
||||||
if (autobooted)
|
if (autobooted)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (2 == e->argc && e->args && e->args[1] && grub_strncmp(e->args[1], "VTOY_RUN_RET", 12) == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#endif
|
#endif
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
#include <grub/video.h>
|
||||||
#include <grub/relocator.h>
|
#include <grub/relocator.h>
|
||||||
#include <grub/charset.h>
|
#include <grub/charset.h>
|
||||||
#include <grub/ventoy.h>
|
#include <grub/ventoy.h>
|
||||||
@ -90,6 +91,8 @@ char *g_wimiso_path = NULL;
|
|||||||
|
|
||||||
int g_vhdboot_enable = 0;
|
int g_vhdboot_enable = 0;
|
||||||
|
|
||||||
|
ventoy_gpt_info *g_ventoy_part_info = NULL;
|
||||||
|
|
||||||
static char *g_tree_script_buf = NULL;
|
static char *g_tree_script_buf = NULL;
|
||||||
static int g_tree_script_pos = 0;
|
static int g_tree_script_pos = 0;
|
||||||
|
|
||||||
@ -99,6 +102,10 @@ static int g_list_script_pos = 0;
|
|||||||
static char *g_part_list_buf = NULL;
|
static char *g_part_list_buf = NULL;
|
||||||
static int g_part_list_pos = 0;
|
static int g_part_list_pos = 0;
|
||||||
|
|
||||||
|
static int g_video_mode_max = 0;
|
||||||
|
static int g_video_mode_num = 0;
|
||||||
|
static ventoy_video_mode *g_video_mode_list = NULL;
|
||||||
|
|
||||||
static const char *g_menu_class[] =
|
static const char *g_menu_class[] =
|
||||||
{
|
{
|
||||||
"vtoyiso", "vtoywim", "vtoyefi", "vtoyimg", "vtoyvhd"
|
"vtoyiso", "vtoywim", "vtoyefi", "vtoyimg", "vtoyvhd"
|
||||||
@ -215,6 +222,120 @@ static grub_err_t ventoy_fs_close(grub_file_t file)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ventoy_video_hook(const struct grub_video_mode_info *info, void *hook_arg)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
(void)hook_arg;
|
||||||
|
|
||||||
|
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < g_video_mode_num; i++)
|
||||||
|
{
|
||||||
|
if (g_video_mode_list[i].width == info->width &&
|
||||||
|
g_video_mode_list[i].height == info->height &&
|
||||||
|
g_video_mode_list[i].bpp == info->bpp)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_video_mode_list[g_video_mode_num].width = info->width;
|
||||||
|
g_video_mode_list[g_video_mode_num].height = info->height;
|
||||||
|
g_video_mode_list[g_video_mode_num].bpp = info->bpp;
|
||||||
|
g_video_mode_num++;
|
||||||
|
|
||||||
|
if (g_video_mode_num == g_video_mode_max)
|
||||||
|
{
|
||||||
|
g_video_mode_max *= 2;
|
||||||
|
g_video_mode_list = grub_realloc(g_video_mode_list, g_video_mode_max * sizeof(ventoy_video_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ventoy_video_mode_cmp(ventoy_video_mode *v1, ventoy_video_mode *v2)
|
||||||
|
{
|
||||||
|
if (v1->bpp == v2->bpp)
|
||||||
|
{
|
||||||
|
if (v1->width == v2->width)
|
||||||
|
{
|
||||||
|
if (v1->height == v2->height)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (v1->height < v2->height) ? -1 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (v1->width < v2->width) ? -1 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (v1->bpp < v2->bpp) ? -1 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ventoy_enum_video_mode(void)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
grub_video_adapter_t adapter;
|
||||||
|
grub_video_driver_id_t id;
|
||||||
|
ventoy_video_mode mode;
|
||||||
|
|
||||||
|
g_video_mode_num = 0;
|
||||||
|
g_video_mode_max = 1024;
|
||||||
|
g_video_mode_list = grub_malloc(sizeof(ventoy_video_mode) * g_video_mode_max);
|
||||||
|
if (!g_video_mode_list)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_PCBIOS
|
||||||
|
grub_dl_load ("vbe");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
id = grub_video_get_driver_id ();
|
||||||
|
|
||||||
|
FOR_VIDEO_ADAPTERS (adapter)
|
||||||
|
{
|
||||||
|
if (!adapter->iterate ||
|
||||||
|
(adapter->id != id && (id != GRUB_VIDEO_DRIVER_NONE ||
|
||||||
|
adapter->init() != GRUB_ERR_NONE)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter->iterate(ventoy_video_hook, NULL);
|
||||||
|
|
||||||
|
if (adapter->id != id)
|
||||||
|
{
|
||||||
|
adapter->fini();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sort video mode */
|
||||||
|
for (i = 0; i < g_video_mode_num; i++)
|
||||||
|
for (j = i + 1; j < g_video_mode_num; j++)
|
||||||
|
{
|
||||||
|
if (ventoy_video_mode_cmp(g_video_mode_list + i, g_video_mode_list + j) < 0)
|
||||||
|
{
|
||||||
|
grub_memcpy(&mode, g_video_mode_list + i, sizeof(ventoy_video_mode));
|
||||||
|
grub_memcpy(g_video_mode_list + i, g_video_mode_list + j, sizeof(ventoy_video_mode));
|
||||||
|
grub_memcpy(g_video_mode_list + j, &mode, sizeof(ventoy_video_mode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
static grub_file_t ventoy_wrapper_open(grub_file_t rawFile, enum grub_file_type type)
|
static grub_file_t ventoy_wrapper_open(grub_file_t rawFile, enum grub_file_type type)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
@ -2958,6 +3079,67 @@ end:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t ventoy_cmd_load_part_table(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
grub_disk_t disk;
|
||||||
|
|
||||||
|
(void)argc;
|
||||||
|
(void)ctxt;
|
||||||
|
|
||||||
|
g_ventoy_part_info = grub_zalloc(sizeof(ventoy_gpt_info));
|
||||||
|
if (!g_ventoy_part_info)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
disk = grub_disk_open(args[0]);
|
||||||
|
if (!disk)
|
||||||
|
{
|
||||||
|
debug("Failed to open disk %s\n", args[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), g_ventoy_part_info);
|
||||||
|
grub_disk_close(disk);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t ventoy_cmd_part_exist(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
grub_uint8_t zeroguid[16] = {0};
|
||||||
|
|
||||||
|
(void)argc;
|
||||||
|
(void)ctxt;
|
||||||
|
|
||||||
|
id = (int)grub_strtoul(args[0], NULL, 10);
|
||||||
|
grub_errno = 0;
|
||||||
|
|
||||||
|
if (grub_memcmp(g_ventoy_part_info->Head.Signature, "EFI PART", 8) == 0)
|
||||||
|
{
|
||||||
|
if (id >= 1 && id <= 128)
|
||||||
|
{
|
||||||
|
if (grub_memcmp(g_ventoy_part_info->PartTbl[id - 1].PartGuid, zeroguid, 16))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (id >= 1 && id <= 4)
|
||||||
|
{
|
||||||
|
if (g_ventoy_part_info->MBR.PartTbl[id - 1].FsFlag)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t ventoy_cmd_get_fs_label(grub_extcmd_context_t ctxt, int argc, char **args)
|
static grub_err_t ventoy_cmd_get_fs_label(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
@ -3115,6 +3297,85 @@ static grub_err_t ventoy_cmd_basename(grub_extcmd_context_t ctxt, int argc, char
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t ventoy_cmd_enum_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
struct grub_video_mode_info info;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
(void)ctxt;
|
||||||
|
(void)argc;
|
||||||
|
(void)args;
|
||||||
|
|
||||||
|
if (!g_video_mode_list)
|
||||||
|
{
|
||||||
|
ventoy_enum_video_mode();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_video_get_info(&info) == GRUB_ERR_NONE)
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "Resolution (%ux%u)", info.width, info.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "Resolution (0x0)");
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_env_set("VTOY_CUR_VIDEO_MODE", buf);
|
||||||
|
|
||||||
|
grub_snprintf(buf, sizeof(buf), "%d", g_video_mode_num);
|
||||||
|
grub_env_set("VTOY_VIDEO_MODE_NUM", buf);
|
||||||
|
|
||||||
|
VENTOY_CMD_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t vt_cmd_update_cur_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
struct grub_video_mode_info info;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
(void)ctxt;
|
||||||
|
(void)argc;
|
||||||
|
(void)args;
|
||||||
|
|
||||||
|
if (grub_video_get_info(&info) == GRUB_ERR_NONE)
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "%ux%ux%u", info.width, info.height, info.bpp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "0x0x0");
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_env_set(args[0], buf);
|
||||||
|
|
||||||
|
VENTOY_CMD_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t ventoy_cmd_get_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
(void)ctxt;
|
||||||
|
(void)argc;
|
||||||
|
|
||||||
|
if (!g_video_mode_list)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = (int)grub_strtoul(args[0], NULL, 10);
|
||||||
|
if (id < g_video_mode_num)
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "%ux%ux%u",
|
||||||
|
g_video_mode_list[id].width, g_video_mode_list[id].height, g_video_mode_list[id].bpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_env_set(args[1], buf);
|
||||||
|
|
||||||
|
VENTOY_CMD_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
|
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
grub_uint64_t size = 0;
|
grub_uint64_t size = 0;
|
||||||
@ -3264,10 +3525,14 @@ static cmd_para ventoy_cmds[] =
|
|||||||
{ "vt_pop_last_entry", ventoy_cmd_pop_last_entry, 0, NULL, "", "", NULL },
|
{ "vt_pop_last_entry", ventoy_cmd_pop_last_entry, 0, NULL, "", "", NULL },
|
||||||
{ "vt_get_lib_module_ver", ventoy_cmd_lib_module_ver, 0, NULL, "", "", NULL },
|
{ "vt_get_lib_module_ver", ventoy_cmd_lib_module_ver, 0, NULL, "", "", NULL },
|
||||||
|
|
||||||
|
{ "vt_load_part_table", ventoy_cmd_load_part_table, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_check_part_exist", ventoy_cmd_part_exist, 0, NULL, "", "", NULL },
|
||||||
{ "vt_get_fs_label", ventoy_cmd_get_fs_label, 0, NULL, "", "", NULL },
|
{ "vt_get_fs_label", ventoy_cmd_get_fs_label, 0, NULL, "", "", NULL },
|
||||||
{ "vt_fs_enum_1st_file", ventoy_cmd_fs_enum_1st_file, 0, NULL, "", "", NULL },
|
{ "vt_fs_enum_1st_file", ventoy_cmd_fs_enum_1st_file, 0, NULL, "", "", NULL },
|
||||||
{ "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },
|
{ "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_enum_video_mode", ventoy_cmd_enum_video_mode, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_get_video_mode", ventoy_cmd_get_video_mode, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_update_cur_video_mode", vt_cmd_update_cur_video_mode, 0, NULL, "", "", NULL },
|
||||||
|
|
||||||
|
|
||||||
{ "vt_find_first_bootable_hd", ventoy_cmd_find_bootable_hdd, 0, NULL, "", "", NULL },
|
{ "vt_find_first_bootable_hd", ventoy_cmd_find_bootable_hdd, 0, NULL, "", "", NULL },
|
||||||
|
@ -658,6 +658,15 @@ typedef struct ventoy_gpt_info
|
|||||||
}ventoy_gpt_info;
|
}ventoy_gpt_info;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
typedef struct ventoy_video_mode
|
||||||
|
{
|
||||||
|
grub_uint32_t width;
|
||||||
|
grub_uint32_t height;
|
||||||
|
grub_uint32_t bpp;
|
||||||
|
}ventoy_video_mode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct file_fullpath
|
typedef struct file_fullpath
|
||||||
{
|
{
|
||||||
char path[256];
|
char path[256];
|
||||||
@ -741,6 +750,7 @@ extern int g_ventoy_iso_uefi_drv;
|
|||||||
extern int g_ventoy_case_insensitive;
|
extern int g_ventoy_case_insensitive;
|
||||||
extern grub_uint8_t g_ventoy_chain_type;
|
extern grub_uint8_t g_ventoy_chain_type;
|
||||||
extern int g_vhdboot_enable;
|
extern int g_vhdboot_enable;
|
||||||
|
extern ventoy_gpt_info *g_ventoy_part_info;
|
||||||
|
|
||||||
|
|
||||||
#define ventoy_unix_fill_virt(new_data, new_len) \
|
#define ventoy_unix_fill_virt(new_data, new_len) \
|
||||||
|
@ -141,64 +141,35 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ventoy_vhd_patch_disk(char *isopart, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
|
static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
|
||||||
{
|
{
|
||||||
char *pos;
|
|
||||||
grub_disk_t disk;
|
|
||||||
ventoy_gpt_info *gptinfo;
|
|
||||||
char efipart[16] = {0};
|
char efipart[16] = {0};
|
||||||
|
|
||||||
pos = grub_strchr(isopart, ',');
|
grub_memcpy(efipart, g_ventoy_part_info->Head.Signature, sizeof(g_ventoy_part_info->Head.Signature));
|
||||||
if (pos)
|
|
||||||
{
|
|
||||||
*pos = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = isopart;
|
debug("part1 type: 0x%x <%s>\n", g_ventoy_part_info->MBR.PartTbl[0].FsFlag, efipart);
|
||||||
if (*pos == '(')
|
|
||||||
{
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
debug("vhd disk <%s>\n", pos);
|
|
||||||
|
|
||||||
disk = grub_disk_open(pos);
|
|
||||||
if (!disk)
|
|
||||||
{
|
|
||||||
debug("Failed to open disk %s\n", pos);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gptinfo = (ventoy_gpt_info *)(g_vhdboot_isobuf + g_vhdboot_isolen);
|
|
||||||
grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), gptinfo);
|
|
||||||
|
|
||||||
grub_memcpy(efipart, gptinfo->Head.Signature, sizeof(gptinfo->Head.Signature));
|
|
||||||
|
|
||||||
debug("part1 type: 0x%x <%s>\n", gptinfo->MBR.PartTbl[0].FsFlag, efipart);
|
|
||||||
|
|
||||||
if (grub_strncmp(efipart, "EFI PART", 8) == 0)
|
if (grub_strncmp(efipart, "EFI PART", 8) == 0)
|
||||||
{
|
{
|
||||||
ventoy_debug_dump_guid("GPT disk GUID: ", gptinfo->Head.DiskGuid);
|
ventoy_debug_dump_guid("GPT disk GUID: ", g_ventoy_part_info->Head.DiskGuid);
|
||||||
ventoy_debug_dump_guid("GPT part GUID: ", gptinfo->PartTbl[0].PartGuid);
|
ventoy_debug_dump_guid("GPT part GUID: ", g_ventoy_part_info->PartTbl[0].PartGuid);
|
||||||
|
|
||||||
grub_memcpy(patch1->disk_signature_or_guid, gptinfo->Head.DiskGuid, 16);
|
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
|
||||||
grub_memcpy(patch1->part_offset_or_guid, gptinfo->PartTbl[0].PartGuid, 16);
|
grub_memcpy(patch1->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
|
||||||
grub_memcpy(patch2->disk_signature_or_guid, gptinfo->Head.DiskGuid, 16);
|
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
|
||||||
grub_memcpy(patch2->part_offset_or_guid, gptinfo->PartTbl[0].PartGuid, 16);
|
grub_memcpy(patch2->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
|
||||||
|
|
||||||
patch1->part_type = patch2->part_type = 0;
|
patch1->part_type = patch2->part_type = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug("MBR disk signature: %02x%02x%02x%02x\n",
|
debug("MBR disk signature: %02x%02x%02x%02x\n",
|
||||||
gptinfo->MBR.BootCode[0x1b8 + 0], gptinfo->MBR.BootCode[0x1b8 + 1],
|
g_ventoy_part_info->MBR.BootCode[0x1b8 + 0], g_ventoy_part_info->MBR.BootCode[0x1b8 + 1],
|
||||||
gptinfo->MBR.BootCode[0x1b8 + 2], gptinfo->MBR.BootCode[0x1b8 + 3]);
|
g_ventoy_part_info->MBR.BootCode[0x1b8 + 2], g_ventoy_part_info->MBR.BootCode[0x1b8 + 3]);
|
||||||
grub_memcpy(patch1->disk_signature_or_guid, gptinfo->MBR.BootCode + 0x1b8, 4);
|
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||||
grub_memcpy(patch2->disk_signature_or_guid, gptinfo->MBR.BootCode + 0x1b8, 4);
|
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_disk_close(disk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +185,7 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
|||||||
|
|
||||||
grub_env_unset("vtoy_vhd_buf_addr");
|
grub_env_unset("vtoy_vhd_buf_addr");
|
||||||
|
|
||||||
debug("patch vhd <%s> <%s>\n", args[0], args[1]);
|
debug("patch vhd <%s>\n", args[0]);
|
||||||
|
|
||||||
if ((!g_vhdboot_enable) || (!g_vhdboot_totbuf))
|
if ((!g_vhdboot_enable) || (!g_vhdboot_totbuf))
|
||||||
{
|
{
|
||||||
@ -232,8 +203,8 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
|||||||
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x495a);
|
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x495a);
|
||||||
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x50aa);
|
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x50aa);
|
||||||
|
|
||||||
ventoy_vhd_patch_disk(args[0], patch1, patch2);
|
ventoy_vhd_patch_disk(patch1, patch2);
|
||||||
ventoy_vhd_patch_path(args[1], patch1, patch2);
|
ventoy_vhd_patch_path(args[0], patch1, patch2);
|
||||||
|
|
||||||
/* set buffer and size */
|
/* set buffer and size */
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
@ -278,7 +249,7 @@ grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **
|
|||||||
|
|
||||||
g_vhdboot_isolen = (int)file->size;
|
g_vhdboot_isolen = (int)file->size;
|
||||||
|
|
||||||
buflen = (int)(file->size + sizeof(ventoy_gpt_info) + sizeof(ventoy_chain_head));
|
buflen = (int)(file->size + sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
g_vhdboot_totbuf = (char *)grub_efi_allocate_iso_buf(buflen);
|
g_vhdboot_totbuf = (char *)grub_efi_allocate_iso_buf(buflen);
|
||||||
|
Binary file not shown.
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||||
menuentry 'Check global control plugin configuration' --class=debug_control {
|
menuentry 'Check global control plugin configuration' --class=debug_control {
|
||||||
set pager=1
|
set pager=1
|
||||||
@ -60,6 +62,15 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
|||||||
set pager=1
|
set pager=1
|
||||||
vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
|
vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
|
||||||
|
|
||||||
|
echo -e "\npress ENTER to exit ..."
|
||||||
|
read vtInputKey
|
||||||
|
unset pager
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry 'Check auto memdisk plugin configuration' --class=debug_automemdisk {
|
||||||
|
set pager=1
|
||||||
|
vt_check_plugin_json $vt_plugin_path auto_memdisk $vtoy_iso_part
|
||||||
|
|
||||||
echo -e "\npress ENTER to exit ..."
|
echo -e "\npress ENTER to exit ..."
|
||||||
read vtInputKey
|
read vtInputKey
|
||||||
unset pager
|
unset pager
|
||||||
@ -71,6 +82,33 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
submenu "Resolution Configuration" --class=debug_resolution {
|
||||||
|
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
|
||||||
|
echo 'Return ...'
|
||||||
|
}
|
||||||
|
|
||||||
|
vt_update_cur_video_mode VT_CUR_MODE
|
||||||
|
set vdid=0
|
||||||
|
while [ $vdid -lt $VTOY_VIDEO_MODE_NUM ]; do
|
||||||
|
vt_get_video_mode $vdid vtCurMode
|
||||||
|
|
||||||
|
unset vtActive
|
||||||
|
if [ "$vtCurMode" = "$VT_CUR_MODE" ]; then
|
||||||
|
set vtActive="[*]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
menuentry "$vtCurMode $vtActive" --class=debug_videomode VTOY_RUN_RET {
|
||||||
|
terminal_output console
|
||||||
|
set gfxmode=$1
|
||||||
|
terminal_output gfxterm
|
||||||
|
}
|
||||||
|
|
||||||
|
vt_incr vdid 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$grub_platform" != "pc" ]; then
|
if [ "$grub_platform" != "pc" ]; then
|
||||||
submenu 'Ventoy UEFI Utilities' --class=debug_util {
|
submenu 'Ventoy UEFI Utilities' --class=debug_util {
|
||||||
menuentry 'Fixup Windows BlinitializeLibrary Failure' {
|
menuentry 'Fixup Windows BlinitializeLibrary Failure' {
|
||||||
|
@ -48,7 +48,8 @@ function ventoy_power {
|
|||||||
configfile $prefix/power.cfg
|
configfile $prefix/power.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
function ventoy_diagnosis {
|
function ventoy_diagnosis {
|
||||||
|
vt_enum_video_mode
|
||||||
configfile $prefix/debug.cfg
|
configfile $prefix/debug.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,6 +865,10 @@ function iso_common_menuentry {
|
|||||||
function miso_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
|
||||||
|
|
||||||
|
echo "memdisk mode boot for $vt_chosen_path"
|
||||||
|
echo ""
|
||||||
|
ventoy_debug_pause
|
||||||
|
|
||||||
if [ "$grub_platform" = "pc" ]; then
|
if [ "$grub_platform" = "pc" ]; then
|
||||||
legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
|
legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
|
||||||
else
|
else
|
||||||
@ -954,7 +959,7 @@ function vhd_common_menuentry {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
vt_chosen_img_path vt_chosen_path vt_chosen_size
|
vt_chosen_img_path vt_chosen_path vt_chosen_size
|
||||||
vt_patch_vhdboot ${vtoy_iso_part} ${vt_chosen_path}
|
vt_patch_vhdboot ${vt_chosen_path}
|
||||||
|
|
||||||
ventoy_debug_pause
|
ventoy_debug_pause
|
||||||
|
|
||||||
@ -1250,7 +1255,7 @@ function img_unsupport_menuentry {
|
|||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.20"
|
set VENTOY_VERSION="1.0.21"
|
||||||
|
|
||||||
# Default menu display mode, you can change it as you want.
|
# Default menu display mode, you can change it as you want.
|
||||||
# 0: List mode
|
# 0: List mode
|
||||||
@ -1277,9 +1282,10 @@ vt_device $root vtoy_dev
|
|||||||
if [ "$vtoy_dev" = "tftp" ]; then
|
if [ "$vtoy_dev" = "tftp" ]; then
|
||||||
set vtoy_path=($root)
|
set vtoy_path=($root)
|
||||||
for vtid in 0 1 2 3; do
|
for vtid in 0 1 2 3; do
|
||||||
if [ -d (hd$vtid,2)/ventoy ]; then
|
if [ -f (hd$vtid,2)/ventoy/ventoy.cpio ]; then
|
||||||
set vtoy_iso_part=(hd$vtid,1)
|
set vtoy_iso_part=(hd$vtid,1)
|
||||||
set vtoy_efi_part=(hd$vtid,2)
|
set vtoy_efi_part=(hd$vtid,2)
|
||||||
|
set vtoydev=hd$vtid
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -1298,12 +1304,15 @@ else
|
|||||||
set vtoy_path=($root)/ventoy
|
set vtoy_path=($root)/ventoy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set vtoydev=$vtoy_dev
|
||||||
set vtoy_iso_part=($vtoy_dev,1)
|
set vtoy_iso_part=($vtoy_dev,1)
|
||||||
set vtoy_efi_part=($vtoy_dev,2)
|
set vtoy_efi_part=($vtoy_dev,2)
|
||||||
loadfont unicode
|
loadfont unicode
|
||||||
set vt_plugin_path=$vtoy_iso_part
|
set vt_plugin_path=$vtoy_iso_part
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Load Partition Table
|
||||||
|
vt_load_part_table $vtoydev
|
||||||
|
|
||||||
#Load Plugin
|
#Load Plugin
|
||||||
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
|
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
|
||||||
@ -1331,17 +1340,19 @@ fi
|
|||||||
|
|
||||||
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
|
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
|
||||||
set VTOY_F3_CMD="vt_dynamic_menu 1 1"
|
set VTOY_F3_CMD="vt_dynamic_menu 1 1"
|
||||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Debug F6:ExMenu"
|
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Tools F6:ExMenu"
|
||||||
else
|
else
|
||||||
set VTOY_F3_CMD="vt_dynamic_menu 1 0"
|
set VTOY_F3_CMD="vt_dynamic_menu 1 0"
|
||||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Debug F6:ExMenu"
|
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Tools F6:ExMenu"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$vtoy_gfxmode" ]; then
|
if [ -n "$vtoy_gfxmode" ]; then
|
||||||
set gfxmode=$vtoy_gfxmode
|
set gfxmode=$vtoy_gfxmode
|
||||||
|
set gfxpayload=keep
|
||||||
else
|
else
|
||||||
set gfxmode=1920x1080,1366x768,1024x768,800x600,auto
|
set gfxmode=1920x1080,1366x768,1024x768,800x600,auto
|
||||||
|
set gfxpayload=keep
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$vtoy_display_mode" = "CLI" ]; then
|
if [ "$vtoy_display_mode" = "CLI" ]; then
|
||||||
@ -1370,10 +1381,11 @@ fi
|
|||||||
#export necessary variable
|
#export necessary variable
|
||||||
export theme
|
export theme
|
||||||
export gfxmode
|
export gfxmode
|
||||||
export vtoy_dev
|
export vtoydev
|
||||||
export vtoy_iso_part
|
export vtoy_iso_part
|
||||||
export vtoy_efi_part
|
export vtoy_efi_part
|
||||||
export VENTOY_VERSION
|
export VENTOY_VERSION
|
||||||
|
export VTOY_CUR_VIDEO_MODE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -122,7 +122,7 @@ crypto:
|
|||||||
part_bsd: part_msdos
|
part_bsd: part_msdos
|
||||||
cs5536: pci
|
cs5536: pci
|
||||||
biosdisk:
|
biosdisk:
|
||||||
ventoy: ext2 fshelp font crypto exfat udf extcmd normal relocator gcry_sha1 iso9660
|
ventoy: ext2 fshelp font crypto exfat udf extcmd normal video gcry_sha1 relocator iso9660
|
||||||
lsapm:
|
lsapm:
|
||||||
gcry_sha512: crypto
|
gcry_sha512: crypto
|
||||||
password: crypto normal
|
password: crypto normal
|
||||||
|
@ -1,10 +1,33 @@
|
|||||||
|
|
||||||
if [ "$grub_platform" = "pc" ]; then
|
if [ "$grub_platform" = "pc" ]; then
|
||||||
menuentry 'Search and boot Windows' --class=boot_windows {
|
menuentry 'Search and boot Windows' --class=boot_windows {
|
||||||
if search -n -s -f /bootmgr; then
|
|
||||||
ntldr /bootmgr
|
set partid=3
|
||||||
elif search -n -s -f /NTLDR; then
|
while [ $partid -le 128 ]; do
|
||||||
ntldr /NTLDR
|
if vt_check_part_exist $partid; then
|
||||||
|
for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
|
||||||
|
if [ -f ($vtoydev,$partid)/$bt ]; then
|
||||||
|
set root=($vtoydev,$partid)
|
||||||
|
ntldr /$bt
|
||||||
|
boot
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
vt_incr partid 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if search -n -s -f /Boot/BCD; then
|
||||||
|
for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
|
||||||
|
if [ -f /$bt ]; then
|
||||||
|
ntldr /$bt
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
elif search -n -s -f /NTDETECT.COM; then
|
||||||
|
drivemap -s hd0 $root
|
||||||
|
ntldr /ntldr
|
||||||
else
|
else
|
||||||
echo "Windows NOT found ..."
|
echo "Windows NOT found ..."
|
||||||
fi
|
fi
|
||||||
@ -39,6 +62,22 @@ if [ "$grub_platform" = "pc" ]; then
|
|||||||
else
|
else
|
||||||
|
|
||||||
menuentry 'Search and boot Windows' --class=boot_windows {
|
menuentry 'Search and boot Windows' --class=boot_windows {
|
||||||
|
|
||||||
|
set partid=3
|
||||||
|
while [ $partid -le 128 ]; do
|
||||||
|
if vt_check_part_exist $partid; then
|
||||||
|
if [ -f ($vtoydev,$partid)/EFI/Microsoft/Boot/bootmgfw.efi ]; then
|
||||||
|
set root=($vtoydev,$partid)
|
||||||
|
terminal_output console
|
||||||
|
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
||||||
|
boot
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
vt_incr partid 1
|
||||||
|
done
|
||||||
|
|
||||||
if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
|
if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
|
||||||
terminal_output console
|
terminal_output console
|
||||||
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
||||||
|
@ -119,7 +119,7 @@ ehci: cs5536 usb boot
|
|||||||
crypto:
|
crypto:
|
||||||
part_bsd: part_msdos
|
part_bsd: part_msdos
|
||||||
cs5536:
|
cs5536:
|
||||||
ventoy: ext2 fshelp crypto font exfat udf extcmd normal gcry_sha1 iso9660
|
ventoy: ext2 fshelp crypto font exfat udf extcmd normal video gcry_sha1 iso9660
|
||||||
gcry_sha512: crypto
|
gcry_sha512: crypto
|
||||||
password: crypto normal
|
password: crypto normal
|
||||||
fshelp:
|
fshelp:
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user