mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 17:11:13 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
045f53d768 | ||
|
a173acaf17 | ||
|
96fdd594f0 | ||
|
62dc0033ad | ||
|
1c3fcbdfe9 | ||
|
7d37cab21d |
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
@@ -21,7 +21,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Ventoy Version
|
label: Ventoy Version
|
||||||
description: What version of ventoy are you running?
|
description: What version of ventoy are you running?
|
||||||
placeholder: 1.0.67
|
placeholder: 1.0.68
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
|
@@ -40,8 +40,10 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
|
|
||||||
#define BROWSER_MENU_BUF 65536
|
#define BROWSER_MENU_BUF 65536
|
||||||
|
|
||||||
|
static const char *g_vtoy_dev = NULL;
|
||||||
static grub_fs_t g_menu_fs = NULL;
|
static grub_fs_t g_menu_fs = NULL;
|
||||||
static char *g_menu_device = NULL;
|
static char *g_menu_device = NULL;
|
||||||
|
static grub_device_t g_menu_dev = NULL;
|
||||||
static char g_menu_path_buf[1024];
|
static char g_menu_path_buf[1024];
|
||||||
static int g_menu_path_len = 0;
|
static int g_menu_path_len = 0;
|
||||||
static browser_node *g_browser_list = NULL;
|
static browser_node *g_browser_list = NULL;
|
||||||
@@ -93,13 +95,13 @@ static int ventoy_browser_mbuf_alloc(browser_mbuf *mbuf)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ventoy_browser_mbuf_free(browser_mbuf *mbuf)
|
static inline void ventoy_browser_mbuf_free(browser_mbuf *mbuf)
|
||||||
{
|
{
|
||||||
if (mbuf)
|
if (mbuf)
|
||||||
grub_check_free(mbuf->buf)
|
grub_check_free(mbuf->buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ventoy_browser_mbuf_extend(browser_mbuf *mbuf)
|
static inline int ventoy_browser_mbuf_extend(browser_mbuf *mbuf)
|
||||||
{
|
{
|
||||||
if (mbuf->max - mbuf->pos <= VTOY_SIZE_1KB)
|
if (mbuf->max - mbuf->pos <= VTOY_SIZE_1KB)
|
||||||
{
|
{
|
||||||
@@ -136,7 +138,125 @@ static browser_node * ventoy_browser_find_top_node(int dir)
|
|||||||
return sel;
|
return sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ventoy_browser_check_filename(const char *filename, int len, int *type)
|
static int ventoy_browser_iterate_partition(struct grub_disk *disk, const grub_partition_t partition, void *data)
|
||||||
|
{
|
||||||
|
char partname[64];
|
||||||
|
char title[256];
|
||||||
|
grub_device_t dev;
|
||||||
|
grub_fs_t fs;
|
||||||
|
char *Label = NULL;
|
||||||
|
browser_mbuf *mbuf = (browser_mbuf *)data;
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
|
||||||
|
if (partition->number == 1 && g_vtoy_dev && grub_strcmp(disk->name, g_vtoy_dev) == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_snprintf(partname, sizeof(partname) - 1, "%s,%d", disk->name, partition->number + 1);
|
||||||
|
|
||||||
|
dev = grub_device_open(partname);
|
||||||
|
if (!dev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs = grub_fs_probe(dev);
|
||||||
|
if (!fs)
|
||||||
|
{
|
||||||
|
grub_device_close(dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->fs_label(dev, &Label);
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
|
grub_snprintf(title, sizeof(title), "%-10s (%s,%s%d) [%s] %s %s",
|
||||||
|
"DISK", disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
||||||
|
partition->number + 1, (Label ? Label : ""), fs->name,
|
||||||
|
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(title, sizeof(title), "(%s,%s%d) [%s] %s %s",
|
||||||
|
disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
||||||
|
partition->number + 1, (Label ? Label : ""), fs->name,
|
||||||
|
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ventoy_get_fs_type(fs->name) >= ventoy_fs_max)
|
||||||
|
{
|
||||||
|
browser_ssprintf(mbuf, "menuentry \"%s\" --class=vtoydisk {\n"
|
||||||
|
" echo \"unsupported file system type!\" \n"
|
||||||
|
" ventoy_pause\n"
|
||||||
|
"}\n",
|
||||||
|
title);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browser_ssprintf(mbuf, "menuentry \"%s\" --class=vtoydisk {\n"
|
||||||
|
" vt_browser_dir %s,%d 0x%lx /\n"
|
||||||
|
"}\n",
|
||||||
|
title, disk->name, partition->number + 1, (ulong)fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
ventoy_browser_mbuf_extend(mbuf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ventoy_browser_iterate_disk(const char *name, void *data)
|
||||||
|
{
|
||||||
|
grub_disk_t disk;
|
||||||
|
|
||||||
|
if (name[0] != 'h')
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
disk = grub_disk_open(name);
|
||||||
|
if (disk)
|
||||||
|
{
|
||||||
|
grub_partition_iterate(disk, ventoy_browser_iterate_partition, data);
|
||||||
|
grub_disk_close(disk);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ventoy_browser_valid_dirname(const char *name, int len)
|
||||||
|
{
|
||||||
|
if ((len == 1 && name[0] == '.') ||
|
||||||
|
(len == 2 && name[0] == '.' && name[1] == '.'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ventoy_img_name_valid(name, len))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name[0] == '$')
|
||||||
|
{
|
||||||
|
if (0 == grub_strncmp(name, "$RECYCLE.BIN", 12) ||
|
||||||
|
0 == grub_strncasecmp(name, "$Extend", 7))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len == 25 && grub_strncmp(name, "System Volume Information", 25) == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ventoy_browser_valid_filename(const char *filename, int len, int *type)
|
||||||
{
|
{
|
||||||
if (len < 4)
|
if (len < 4)
|
||||||
{
|
{
|
||||||
@@ -191,92 +311,6 @@ static int ventoy_browser_check_filename(const char *filename, int len, int *typ
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ventoy_browser_iterate_partition(struct grub_disk *disk, const grub_partition_t partition, void *data)
|
|
||||||
{
|
|
||||||
char partname[64];
|
|
||||||
char title[256];
|
|
||||||
grub_device_t dev;
|
|
||||||
grub_fs_t fs;
|
|
||||||
char *Label = NULL;
|
|
||||||
browser_mbuf *mbuf = (browser_mbuf *)data;
|
|
||||||
|
|
||||||
(void)data;
|
|
||||||
|
|
||||||
grub_snprintf(partname, sizeof(partname) - 1, "%s,%d", disk->name, partition->number + 1);
|
|
||||||
|
|
||||||
dev = grub_device_open(partname);
|
|
||||||
if (!dev)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs = grub_fs_probe(dev);
|
|
||||||
if (!fs)
|
|
||||||
{
|
|
||||||
grub_device_close(dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs->fs_label(dev, &Label);
|
|
||||||
|
|
||||||
grub_snprintf(title, sizeof(title), "%-10s (%s,%s%d) [%s] %s %s",
|
|
||||||
"DISK", disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
|
||||||
partition->number + 1, (Label ? Label : ""), fs->name,
|
|
||||||
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
|
||||||
|
|
||||||
if (ventoy_get_fs_type(fs->name) >= ventoy_fs_max)
|
|
||||||
{
|
|
||||||
browser_ssprintf(mbuf, "menuentry \"%s\" --class=vtoydisk {\n"
|
|
||||||
" echo \"unsupported file system type!\" \n"
|
|
||||||
" ventoy_pause\n"
|
|
||||||
"}\n",
|
|
||||||
title);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
browser_ssprintf(mbuf, "menuentry \"%s\" --class=vtoydisk {\n"
|
|
||||||
" vt_browser_dir %s,%d 0x%lx /\n"
|
|
||||||
"}\n",
|
|
||||||
title, disk->name, partition->number + 1, (ulong)fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
ventoy_browser_mbuf_extend(mbuf);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int ventoy_browser_iterate_disk(const char *name, void *data)
|
|
||||||
{
|
|
||||||
grub_disk_t disk;
|
|
||||||
grub_uint32_t sig;
|
|
||||||
grub_uint32_t selfsig;
|
|
||||||
|
|
||||||
grub_memcpy(&selfsig, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
|
||||||
|
|
||||||
if (name[0] != 'h')
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
disk = grub_disk_open(name);
|
|
||||||
if (disk)
|
|
||||||
{
|
|
||||||
grub_disk_read(disk, 0, 0x1b8, 4, &sig);
|
|
||||||
|
|
||||||
/* skip ventoy device self */
|
|
||||||
if (sig != selfsig)
|
|
||||||
{
|
|
||||||
grub_partition_iterate(disk, ventoy_browser_iterate_partition, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_disk_close(disk);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ventoy_browser_iterate_dir(const char *filename, const struct grub_dirhook_info *info, void *data)
|
static int ventoy_browser_iterate_dir(const char *filename, const struct grub_dirhook_info *info, void *data)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
@@ -289,26 +323,11 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
|
|
||||||
if (info->dir)
|
if (info->dir)
|
||||||
{
|
{
|
||||||
if ((len == 1 && filename[0] == '.') ||
|
if (!ventoy_browser_valid_dirname(filename, len))
|
||||||
(len == 2 && filename[0] == '.' && filename[1] == '.'))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ventoy_img_name_valid(filename, len))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filename[0] == '$')
|
|
||||||
{
|
|
||||||
if (0 == grub_strncmp(filename, "$RECYCLE.BIN", 12) ||
|
|
||||||
0 == grub_strncasecmp(filename, "$Extend", 7))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node = grub_zalloc(sizeof(browser_node));
|
node = grub_zalloc(sizeof(browser_node));
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
@@ -317,36 +336,29 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
|
|
||||||
node->dir = 1;
|
node->dir = 1;
|
||||||
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
||||||
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
|
||||||
"menuentry \"%-10s [%s]\" --class=vtoydir {\n"
|
if (g_tree_view_menu_style == 0)
|
||||||
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
{
|
||||||
"}\n",
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
"DIR", filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
"menuentry \"%-10s [%s]\" --class=vtoydir {\n"
|
||||||
|
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
||||||
|
"}\n",
|
||||||
|
"DIR", filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
|
"menuentry \"[%s]\" --class=vtoydir {\n"
|
||||||
|
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
||||||
|
"}\n",
|
||||||
|
filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_uint64_t fsize;
|
grub_uint64_t fsize = info->size;
|
||||||
grub_file_t file = NULL;
|
|
||||||
|
|
||||||
if (ventoy_browser_check_filename(filename, len, &type) == 0)
|
if (!ventoy_browser_valid_filename(filename, len, &type))
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fsize = info->size;
|
|
||||||
if (fsize == 0)
|
|
||||||
{
|
|
||||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(%s)%s/%s", g_menu_device, g_menu_path_buf, filename);
|
|
||||||
if (!file)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fsize = file->size;
|
|
||||||
grub_file_close(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fsize < VTOY_FILT_MIN_FILE_SIZE)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -357,18 +369,47 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fsize == 0)
|
||||||
|
{
|
||||||
|
struct grub_file file;
|
||||||
|
|
||||||
|
grub_memset(&file, 0, sizeof(file));
|
||||||
|
file.device = g_menu_dev;
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry), "%s/%s", g_menu_path_buf, filename);
|
||||||
|
if (g_menu_fs->fs_open(&file, node->menuentry) == GRUB_ERR_NONE)
|
||||||
|
{
|
||||||
|
fsize = file.size;
|
||||||
|
g_menu_fs->fs_close(&file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node->dir = 0;
|
node->dir = 0;
|
||||||
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
||||||
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
|
||||||
"menuentry \"%-10s %s\" --class=%s {\n"
|
|
||||||
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
|
||||||
" %s_common_menuentry\n"
|
|
||||||
" vt_reset_fake_vlnk\n"
|
|
||||||
"}\n",
|
|
||||||
grub_get_human_size(fsize, GRUB_HUMAN_SIZE_SHORT), filename, g_menu_class[type],
|
|
||||||
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
|
||||||
g_menu_prefix[type]);
|
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
|
"menuentry \"%-10s %s\" --class=%s {\n"
|
||||||
|
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
||||||
|
" %s_common_menuentry\n"
|
||||||
|
" vt_reset_fake_vlnk\n"
|
||||||
|
"}\n",
|
||||||
|
grub_get_human_size(fsize, GRUB_HUMAN_SIZE_SHORT), filename, g_menu_class[type],
|
||||||
|
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
||||||
|
g_menu_prefix[type]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
|
"menuentry \"%s\" --class=%s {\n"
|
||||||
|
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
||||||
|
" %s_common_menuentry\n"
|
||||||
|
" vt_reset_fake_vlnk\n"
|
||||||
|
"}\n",
|
||||||
|
filename, g_menu_class[type],
|
||||||
|
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
||||||
|
g_menu_prefix[type]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node->prev = NULL;
|
node->prev = NULL;
|
||||||
@@ -382,6 +423,43 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t ventoy_browser_iso_part(void)
|
||||||
|
{
|
||||||
|
char cfgfile[64];
|
||||||
|
char *buffer = NULL;
|
||||||
|
int pos = 0;
|
||||||
|
int buflen = 0;
|
||||||
|
int cfglen = 0;
|
||||||
|
|
||||||
|
cfglen = g_tree_script_pos - g_tree_script_pre;
|
||||||
|
buflen = cfglen + 512;
|
||||||
|
buffer = grub_malloc(buflen);
|
||||||
|
if (!buffer)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
|
pos = grub_snprintf(buffer, buflen, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n", "<--");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos = grub_snprintf(buffer, buflen, "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_memcpy(buffer + pos, g_tree_script_buf + g_tree_script_pre, cfglen);
|
||||||
|
pos += cfglen;
|
||||||
|
|
||||||
|
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%lx:size:%d", (ulong)buffer, pos);
|
||||||
|
grub_script_execute_sourcecode(cfgfile);
|
||||||
|
|
||||||
|
grub_free(buffer);
|
||||||
|
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **args)
|
grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -394,6 +472,15 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
|
|||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
|
||||||
|
if (args[2][0] == '/' && args[2][1] == 0)
|
||||||
|
{
|
||||||
|
grub_snprintf(cfgfile, sizeof(cfgfile), "(%s)", args[0]);
|
||||||
|
if (grub_strcmp(cfgfile, g_iso_path) == 0)
|
||||||
|
{
|
||||||
|
return ventoy_browser_iso_part();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ventoy_browser_mbuf_alloc(&mbuf))
|
if (!ventoy_browser_mbuf_alloc(&mbuf))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@@ -415,6 +502,7 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
|
|||||||
|
|
||||||
g_menu_fs = fs;
|
g_menu_fs = fs;
|
||||||
g_menu_device = args[0];
|
g_menu_device = args[0];
|
||||||
|
g_menu_dev = dev;
|
||||||
g_browser_list = NULL;
|
g_browser_list = NULL;
|
||||||
|
|
||||||
if (args[2][0] == '/' && args[2][1] == 0)
|
if (args[2][0] == '/' && args[2][1] == 0)
|
||||||
@@ -430,8 +518,16 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
|
|||||||
}
|
}
|
||||||
grub_device_close(dev);
|
grub_device_close(dev);
|
||||||
|
|
||||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
if (g_tree_view_menu_style == 0)
|
||||||
" echo 'return ...' \n}\n", "<--");
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n", "<--");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1; i >= 0; i--)
|
for (i = 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@@ -440,8 +536,9 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
|
|||||||
node = ventoy_browser_find_top_node(i);
|
node = ventoy_browser_find_top_node(i);
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
grub_printf("Find Node <%s>\n", node->filename);
|
|
||||||
browser_ssprintf(&mbuf, "%s", node->menuentry);
|
browser_ssprintf(&mbuf, "%s", node->menuentry);
|
||||||
|
ventoy_browser_mbuf_extend(&mbuf);
|
||||||
|
|
||||||
if (node->prev)
|
if (node->prev)
|
||||||
{
|
{
|
||||||
node->prev->next = node->next;
|
node->prev->next = node->next;
|
||||||
@@ -486,8 +583,18 @@ grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
g_vtoy_dev = grub_env_get("vtoydev");
|
||||||
" echo 'return ...' \n}\n", "<--");
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n", "<--");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"[Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n");
|
||||||
|
}
|
||||||
|
|
||||||
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);
|
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);
|
||||||
|
|
||||||
|
@@ -117,8 +117,9 @@ ventoy_gpt_info *g_ventoy_part_info = NULL;
|
|||||||
grub_uint64_t g_ventoy_disk_size = 0;
|
grub_uint64_t g_ventoy_disk_size = 0;
|
||||||
grub_uint64_t g_ventoy_disk_part_size[2];
|
grub_uint64_t g_ventoy_disk_part_size[2];
|
||||||
|
|
||||||
static char *g_tree_script_buf = NULL;
|
char *g_tree_script_buf = NULL;
|
||||||
static int g_tree_script_pos = 0;
|
int g_tree_script_pos = 0;
|
||||||
|
int g_tree_script_pre = 0;
|
||||||
|
|
||||||
static char *g_list_script_buf = NULL;
|
static char *g_list_script_buf = NULL;
|
||||||
static int g_list_script_pos = 0;
|
static int g_list_script_pos = 0;
|
||||||
@@ -1597,8 +1598,16 @@ int ventoy_img_name_valid(const char *filename, grub_size_t namelen)
|
|||||||
static int ventoy_vlnk_iterate_partition(struct grub_disk *disk, const grub_partition_t partition, void *data)
|
static int ventoy_vlnk_iterate_partition(struct grub_disk *disk, const grub_partition_t partition, void *data)
|
||||||
{
|
{
|
||||||
ventoy_vlnk_part *node = NULL;
|
ventoy_vlnk_part *node = NULL;
|
||||||
|
grub_uint32_t SelfSig;
|
||||||
grub_uint32_t *pSig = (grub_uint32_t *)data;
|
grub_uint32_t *pSig = (grub_uint32_t *)data;
|
||||||
|
|
||||||
|
/* skip Ventoy partition 1/2 */
|
||||||
|
grub_memcpy(&SelfSig, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||||
|
if (partition->number < 2 && SelfSig == *pSig)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
node = grub_zalloc(sizeof(ventoy_vlnk_part));
|
node = grub_zalloc(sizeof(ventoy_vlnk_part));
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -1625,13 +1634,7 @@ static int ventoy_vlnk_iterate_disk(const char *name, void *data)
|
|||||||
if (disk)
|
if (disk)
|
||||||
{
|
{
|
||||||
grub_disk_read(disk, 0, 0x1b8, 4, &sig);
|
grub_disk_read(disk, 0, 0x1b8, 4, &sig);
|
||||||
|
grub_partition_iterate(disk, ventoy_vlnk_iterate_partition, &sig);
|
||||||
/* skip ventoy device self */
|
|
||||||
if (sig != *(grub_uint32_t *)data)
|
|
||||||
{
|
|
||||||
grub_partition_iterate(disk, ventoy_vlnk_iterate_partition, &sig);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_disk_close(disk);
|
grub_disk_close(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1693,7 +1696,7 @@ static int ventoy_check_vlnk_data(ventoy_vlnk *vlnk, int print, char *dst, int s
|
|||||||
|
|
||||||
if (!g_vlnk_part_list)
|
if (!g_vlnk_part_list)
|
||||||
{
|
{
|
||||||
grub_disk_dev_iterate(ventoy_vlnk_iterate_disk, g_ventoy_part_info->MBR.BootCode + 0x1b8);
|
grub_disk_dev_iterate(ventoy_vlnk_iterate_disk, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cur = g_vlnk_part_list; cur && filefind == 0; cur = cur->next)
|
for (cur = g_vlnk_part_list; cur && filefind == 0; cur = cur->next)
|
||||||
@@ -2292,6 +2295,8 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
|
|||||||
"}\n", "return");
|
"}\n", "return");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_tree_script_pre = g_tree_script_pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1187,6 +1187,10 @@ typedef struct browser_node
|
|||||||
struct browser_node *next;
|
struct browser_node *next;
|
||||||
}browser_node;
|
}browser_node;
|
||||||
|
|
||||||
|
extern char *g_tree_script_buf;
|
||||||
|
extern int g_tree_script_pos;
|
||||||
|
extern int g_tree_script_pre;
|
||||||
|
extern int g_tree_view_menu_style;
|
||||||
extern int g_sort_case_sensitive;
|
extern int g_sort_case_sensitive;
|
||||||
extern int g_wimboot_enable;
|
extern int g_wimboot_enable;
|
||||||
extern int g_filt_dot_underscore_file;
|
extern int g_filt_dot_underscore_file;
|
||||||
|
@@ -2069,7 +2069,7 @@ function img_unsupport_menuentry {
|
|||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.67"
|
set VENTOY_VERSION="1.0.69"
|
||||||
|
|
||||||
#ACPI not compatible with Window7/8, so disable by default
|
#ACPI not compatible with Window7/8, so disable by default
|
||||||
set VTOY_PARAM_NO_ACPI=1
|
set VTOY_PARAM_NO_ACPI=1
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. <br/>
|
Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. <br/>
|
||||||
With ventoy, you don't need to format the disk over and over, you just need to copy the image files to the USB drive and boot it.
|
With ventoy, you don't need to format the disk over and over, you just need to copy the image files to the USB drive and boot it.
|
||||||
You can copy many image files at a time and ventoy will give you a boot menu to select them. <br/>
|
You can copy many image files at a time and ventoy will give you a boot menu to select them. <br/>
|
||||||
|
You can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.<br/>
|
||||||
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
|
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
|
||||||
Both MBR and GPT partition style are supported in the same way.<br/>
|
Both MBR and GPT partition style are supported in the same way.<br/>
|
||||||
Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
|
Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...) <br/>
|
||||||
@@ -38,6 +39,9 @@ VMware ESXi, Citrix XenServer, Xen XCP-ng
|
|||||||
|
|
||||||
# Tested Image Report
|
# Tested Image Report
|
||||||
[【How to report a successfully tested image file】](https://github.com/ventoy/Ventoy/issues/1195)
|
[【How to report a successfully tested image file】](https://github.com/ventoy/Ventoy/issues/1195)
|
||||||
|
|
||||||
|
# Ventoy Browser
|
||||||
|
With Ventoy you can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them. [Notes](https://www.ventoy.net/en/doc_browser.html)
|
||||||
|
|
||||||
# VentoyPlugson
|
# VentoyPlugson
|
||||||
A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plugin_plugson.html)
|
A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plugin_plugson.html)
|
||||||
@@ -48,6 +52,7 @@ A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plug
|
|||||||
* Fast (limited only by the speed of copying iso file)
|
* Fast (limited only by the speed of copying iso file)
|
||||||
* Can be installed in USB/Local Disk/SSD/NVMe/SD Card
|
* Can be installed in USB/Local Disk/SSD/NVMe/SD Card
|
||||||
* Directly boot from ISO/WIM/IMG/VHD(x)/EFI files, no extraction needed
|
* Directly boot from ISO/WIM/IMG/VHD(x)/EFI files, no extraction needed
|
||||||
|
* Support to browse and boot ISO/WIM/IMG/VHD(x)/EFI files in local disk
|
||||||
* No need to be continuous in disk for ISO/WIM/IMG/VHD(x)/EFI files
|
* No need to be continuous in disk for ISO/WIM/IMG/VHD(x)/EFI files
|
||||||
* MBR and GPT partition style supported (1.0.15+)
|
* MBR and GPT partition style supported (1.0.15+)
|
||||||
* x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI, MIPS64EL UEFI supported
|
* x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI, MIPS64EL UEFI supported
|
||||||
|
Reference in New Issue
Block a user