Compare commits

..

13 Commits

Author SHA1 Message Date
longpanda
78ab7a0759 1.0.26 release 2020-10-24 06:26:57 +08:00
longpanda
3ebd58c9df support original order in image_list plugin 2020-10-22 09:34:46 +08:00
longpanda
ce6d379564 1.0.25 release 2020-10-21 20:33:15 +08:00
longpanda
40fdfa66b9 Optimization for Linux vDisk boot in Legacy BIOS mode 2020-10-21 17:45:44 +08:00
longpanda
9ddee7394d support different themes for Legacy BIOS mode and UEFI mode 2020-10-21 17:15:31 +08:00
longpanda
c9b316a757 Fix bug for VTOY_DEFAULT_IMAGE in TreeView mode when VTOY_DEFAULT_SEARCH_ROOT was set. 2020-10-21 13:17:29 +08:00
longpanda
1ba23bcdff add image_list plugin 2020-10-21 10:23:58 +08:00
longpanda
6630ab3585 1.0.24 release 2020-10-17 15:56:54 +08:00
longpanda
c0d478c2dd 1.0.23 release 2020-10-16 20:26:24 +08:00
longpanda
0217c5a923 fix issue #521
blackarch boot failed
2020-10-15 17:50:22 +08:00
longpanda
97312d351e fix issue #516
Arch 2020.10.1 iso boot failed in UEFI mode.
2020-10-09 19:57:35 +08:00
David P
906dc4cd41 fix Parabola EFI booting (#508) 2020-10-09 09:41:04 +08:00
longpanda
82a8b59bc7 fix issue #512
show file with name .iso
2020-10-08 17:13:40 +08:00
23 changed files with 482 additions and 111 deletions

View File

@@ -969,6 +969,9 @@ static struct grub_menu_execute_callback execution_callback =
static grub_err_t static grub_err_t
show_menu (grub_menu_t menu, int nested, int autobooted) show_menu (grub_menu_t menu, int nested, int autobooted)
{ {
const char *def;
def = grub_env_get("VTOY_DEFAULT_IMAGE");
while (1) while (1)
{ {
int boot_entry; int boot_entry;
@@ -979,9 +982,15 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
if (boot_entry < 0) if (boot_entry < 0)
break; break;
g_ventoy_last_entry = boot_entry; if (auto_boot && def && grub_strcmp(def, "VTOY_EXIT") == 0) {
if (g_ventoy_menu_esc) grub_exit();
break; }
if (autobooted == 0 && auto_boot == 0) {
g_ventoy_last_entry = boot_entry;
if (g_ventoy_menu_esc)
break;
}
e = grub_menu_get_entry (menu, boot_entry); e = grub_menu_get_entry (menu, boot_entry);
if (! e) if (! e)

View File

@@ -57,6 +57,7 @@ int g_valid_initrd_count = 0;
int g_default_menu_mode = 0; int g_default_menu_mode = 0;
int g_filt_dot_underscore_file = 0; int g_filt_dot_underscore_file = 0;
int g_sort_case_sensitive = 0; int g_sort_case_sensitive = 0;
int g_tree_view_menu_style = 0;
static grub_file_t g_old_file; static grub_file_t g_old_file;
static int g_ventoy_last_entry_back; static int g_ventoy_last_entry_back;
@@ -81,6 +82,8 @@ grub_uint32_t g_ventoy_cpio_size = 0;
cpio_newc_header *g_ventoy_initrd_head = NULL; cpio_newc_header *g_ventoy_initrd_head = NULL;
grub_uint8_t *g_ventoy_runtime_buf = NULL; grub_uint8_t *g_ventoy_runtime_buf = NULL;
int g_plugin_image_list = 0;
ventoy_grub_param *g_grub_param = NULL; ventoy_grub_param *g_grub_param = NULL;
ventoy_guid g_ventoy_guid = VENTOY_GUID; ventoy_guid g_ventoy_guid = VENTOY_GUID;
@@ -991,7 +994,7 @@ static grub_err_t ventoy_cmd_check_compatible(grub_extcmd_context_t ctxt, int ar
grub_disk_close(disk); grub_disk_close(disk);
g_img_swap_tmp_buf[703] = 0; g_img_swap_tmp_buf[703] = 0;
for (i = 319; i < 703; i++) for (i = 318; i < 703; i++)
{ {
if (g_img_swap_tmp_buf[i] == 'V' && if (g_img_swap_tmp_buf[i] == 'V' &&
0 == grub_strncmp(g_img_swap_tmp_buf + i, VENTOY_COMPATIBLE_STR, VENTOY_COMPATIBLE_STR_LEN)) 0 == grub_strncmp(g_img_swap_tmp_buf + i, VENTOY_COMPATIBLE_STR, VENTOY_COMPATIBLE_STR_LEN))
@@ -1017,6 +1020,11 @@ int ventoy_cmp_img(img_info *img1, img_info *img2)
int c1 = 0; int c1 = 0;
int c2 = 0; int c2 = 0;
if (g_plugin_image_list)
{
return (img1->plugin_list_index - img2->plugin_list_index);
}
for (s1 = img1->name, s2 = img2->name; *s1 && *s2; s1++, s2++) for (s1 = img1->name, s2 = img2->name; *s1 && *s2; s1++, s2++)
{ {
c1 = *s1; c1 = *s1;
@@ -1044,13 +1052,18 @@ int ventoy_cmp_img(img_info *img1, img_info *img2)
return (c1 - c2); return (c1 - c2);
} }
static int ventoy_cmp_subdir(char *name1, char *name2) static int ventoy_cmp_subdir(img_iterator_node *node1, img_iterator_node *node2)
{ {
char *s1, *s2; char *s1, *s2;
int c1 = 0; int c1 = 0;
int c2 = 0; int c2 = 0;
for (s1 = name1, s2 = name2; *s1 && *s2; s1++, s2++) if (g_plugin_image_list)
{
return (node1->plugin_list_index - node2->plugin_list_index);
}
for (s1 = node1->dir, s2 = node2->dir; *s1 && *s2; s1++, s2++)
{ {
c1 = *s1; c1 = *s1;
c2 = *s2; c2 = *s2;
@@ -1134,6 +1147,7 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
int i = 0; int i = 0;
int type = 0; int type = 0;
int ignore = 0; int ignore = 0;
int index = 0;
grub_size_t len; grub_size_t len;
img_info *img; img_info *img;
img_info *tail; img_info *tail;
@@ -1161,9 +1175,21 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
return 0; return 0;
} }
if (g_plugin_image_list)
{
grub_snprintf(g_img_swap_tmp_buf, sizeof(g_img_swap_tmp_buf), "%s%s/", node->dir, filename);
index = ventoy_plugin_get_image_list_index(vtoy_class_directory, g_img_swap_tmp_buf);
if (index == 0)
{
debug("Directory %s not found in image_list plugin config...\n", g_img_swap_tmp_buf);
return 0;
}
}
new_node = grub_zalloc(sizeof(img_iterator_node)); new_node = grub_zalloc(sizeof(img_iterator_node));
if (new_node) if (new_node)
{ {
new_node->plugin_list_index = index;
new_node->dirlen = grub_snprintf(new_node->dir, sizeof(new_node->dir), "%s%s/", node->dir, filename); new_node->dirlen = grub_snprintf(new_node->dir, sizeof(new_node->dir), "%s%s/", node->dir, filename);
g_enum_fs->fs_dir(g_enum_dev, new_node->dir, ventoy_check_ignore_flag, &ignore); g_enum_fs->fs_dir(g_enum_dev, new_node->dir, ventoy_check_ignore_flag, &ignore);
@@ -1197,7 +1223,7 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
else else
{ {
debug("Find a file %s\n", filename); debug("Find a file %s\n", filename);
if (len <= 4) if (len < 4)
{ {
return 0; return 0;
} }
@@ -1211,7 +1237,7 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
type = img_type_wim; type = img_type_wim;
} }
else if (g_vhdboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".vhd") || else if (g_vhdboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".vhd") ||
0 == grub_strcasecmp(filename + len - 5, ".vhdx"))) (len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vhdx"))))
{ {
type = img_type_vhd; type = img_type_vhd;
} }
@@ -1247,10 +1273,22 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
return 0; return 0;
} }
if (g_plugin_image_list)
{
grub_snprintf(g_img_swap_tmp_buf, sizeof(g_img_swap_tmp_buf), "%s%s", node->dir, filename);
index = ventoy_plugin_get_image_list_index(vtoy_class_image_file, g_img_swap_tmp_buf);
if (index == 0)
{
debug("File %s not found in image_list plugin config...\n", g_img_swap_tmp_buf);
return 0;
}
}
img = grub_zalloc(sizeof(img_info)); img = grub_zalloc(sizeof(img_info));
if (img) if (img)
{ {
img->type = type; img->type = type;
img->plugin_list_index = index;
grub_snprintf(img->name, sizeof(img->name), "%s", filename); grub_snprintf(img->name, sizeof(img->name), "%s", filename);
for (i = 0; i < (int)len; i++) for (i = 0; i < (int)len; i++)
@@ -1434,7 +1472,7 @@ static img_iterator_node * ventoy_get_min_child(img_iterator_node *node)
while (child && child->parent == node) while (child && child->parent == node)
{ {
if (child->select == 0 && (NULL == Minchild || ventoy_cmp_subdir(child->dir, Minchild->dir) < 0)) if (child->select == 0 && (NULL == Minchild || ventoy_cmp_subdir(child, Minchild) < 0))
{ {
Minchild = child; Minchild = child;
} }
@@ -1471,10 +1509,20 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
{ {
if (g_default_menu_mode == 0) if (g_default_menu_mode == 0)
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, if (g_tree_view_menu_style == 0)
"menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n " {
" echo 'return ...' \n" vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"}\n", "<--"); "menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"[Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo '%s ...' \n"
"}\n", "return");
}
} }
} }
else else
@@ -1488,22 +1536,52 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
dir_alias = ventoy_plugin_get_menu_alias(vtoy_alias_directory, node->dir); dir_alias = ventoy_plugin_get_menu_alias(vtoy_alias_directory, node->dir);
if (dir_alias) if (dir_alias)
{
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" {\n",
"DIR", dir_alias, dir_class, node->dir + offset);
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" {\n",
dir_alias, dir_class, node->dir + offset);
}
}
else
{
dir_alias = node->dir + offset;
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n",
"DIR", dir_alias, dir_class, node->dir + offset);
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n",
dir_alias, dir_class, node->dir + offset);
}
}
if (g_tree_view_menu_style == 0)
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s %s\" --class=\"%s\" {\n", "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
"DIR", dir_alias, dir_class); " echo 'return ...' \n"
"}\n", "<--");
} }
else else
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s [%s]\" --class=\"%s\" {\n", "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
"DIR", node->dir + offset, dir_class); " echo '%s ...' \n"
"}\n", "return");
} }
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
} }
while ((child = ventoy_get_min_child(node)) != NULL) while ((child = ventoy_get_min_child(node)) != NULL)
@@ -1513,15 +1591,29 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
while ((img = ventoy_get_min_iso(node)) != NULL) while ((img = ventoy_get_min_iso(node)) != NULL)
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, if (g_tree_view_menu_style == 0)
"menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%d\" {\n" {
" %s_%s \n" vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"}\n", "menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT), " %s_%s \n"
img->unsupport ? "[***********] " : "", "}\n",
img->alias ? img->alias : img->name, img->class, img->id, grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT),
img->menu_prefix, img->unsupport ? "[***********] " : "",
img->unsupport ? "unsupport_menuentry" : "common_menuentry"); img->alias ? img->alias : img->name, img->class, img->id,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
" %s_%s \n"
"}\n",
img->unsupport ? "[***********] " : "",
img->alias ? img->alias : img->name, img->class, img->id,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
} }
if (node != &g_img_iterator_head) if (node != &g_img_iterator_head)
@@ -1634,6 +1726,81 @@ int ventoy_check_device(grub_device_t dev)
return ventoy_check_device_result(0); return ventoy_check_device_result(0);
} }
static int ventoy_set_default_menu(void)
{
int img_len = 0;
char *pos = NULL;
char *end = NULL;
char *def = NULL;
const char *strdata = NULL;
img_info *cur = NULL;
img_info *default_node = NULL;
const char *default_image = NULL;
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (default_image && default_image[0] == '/')
{
img_len = grub_strlen(default_image);
for (cur = g_ventoy_img_list; cur; cur = cur->next)
{
if (img_len == cur->pathlen && grub_strcmp(default_image, cur->path) == 0)
{
default_node = cur;
break;
}
}
if (!default_node)
{
return 1;
}
if (0 == g_default_menu_mode)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
}
else
{
def = grub_strdup(default_image);
if (!def)
{
return 1;
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "set default=%c", '\'');
strdata = ventoy_get_env("VTOY_DEFAULT_SEARCH_ROOT");
if (strdata && strdata[0] == '/')
{
pos = def + grub_strlen(strdata);
if (*pos == '/')
{
pos++;
}
}
else
{
pos = def + 1;
}
pos = def + 1;
while ((end = grub_strchr(pos, '/')) != NULL)
{
*end = 0;
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "DIR_%s>", pos);
pos = end + 1;
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "VID_%d'\n", default_node->id);
grub_free(def);
}
}
return 0;
}
static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char **args) static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int len; int len;
@@ -1641,11 +1808,8 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
grub_device_t dev = NULL; grub_device_t dev = NULL;
img_info *cur = NULL; img_info *cur = NULL;
img_info *tail = NULL; img_info *tail = NULL;
img_info *default_node = NULL;
const char *strdata = NULL; const char *strdata = NULL;
char *device_name = NULL; char *device_name = NULL;
const char *default_image = NULL;
int img_len = 0;
char buf[32]; char buf[32];
img_iterator_node *node = NULL; img_iterator_node *node = NULL;
img_iterator_node *tmp = NULL; img_iterator_node *tmp = NULL;
@@ -1734,6 +1898,14 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
fs->fs_dir(dev, node->dir, ventoy_colect_img_files, node); fs->fs_dir(dev, node->dir, ventoy_colect_img_files, node);
} }
strdata = ventoy_get_env("VTOY_TREE_VIEW_MENU_STYLE");
if (strdata && strdata[0] == '1' && strdata[1] == 0)
{
g_tree_view_menu_style = 1;
}
ventoy_set_default_menu();
for (node = &g_img_iterator_head; node; node = node->next) for (node = &g_img_iterator_head; node; node = node->next)
{ {
ventoy_dynamic_tree_menu(node); ventoy_dynamic_tree_menu(node);
@@ -1768,15 +1940,6 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
"}\n", "<--"); "}\n", "<--");
} }
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (g_default_menu_mode == 0)
{
if (default_image)
{
img_len = grub_strlen(default_image);
}
}
for (cur = g_ventoy_img_list; cur; cur = cur->next) for (cur = g_ventoy_img_list; cur; cur = cur->next)
{ {
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
@@ -1787,21 +1950,9 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
cur->alias ? cur->alias : cur->name, cur->class, cur->id, cur->alias ? cur->alias : cur->name, cur->class, cur->id,
cur->menu_prefix, cur->menu_prefix,
cur->unsupport ? "unsupport_menuentry" : "common_menuentry"); cur->unsupport ? "unsupport_menuentry" : "common_menuentry");
if (g_default_menu_mode == 0 && default_image && default_node == NULL)
{
if (img_len == cur->pathlen && grub_strcmp(default_image, cur->path) == 0)
{
default_node = cur;
}
}
}
if (default_node)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
} }
g_tree_script_buf[g_tree_script_pos] = 0;
g_list_script_buf[g_list_script_pos] = 0; g_list_script_buf[g_list_script_pos] = 0;
grub_snprintf(buf, sizeof(buf), "%d", g_ventoy_img_count); grub_snprintf(buf, sizeof(buf), "%d", g_ventoy_img_count);
@@ -2580,7 +2731,7 @@ static grub_err_t ventoy_cmd_dump_img_list(grub_extcmd_context_t ctxt, int argc,
while (cur) while (cur)
{ {
grub_printf("path:<%s> id=%d\n", cur->path, cur->id); grub_printf("path:<%s> id=%d list_index=%d\n", cur->path, cur->id, cur->plugin_list_index);
grub_printf("name:<%s>\n\n", cur->name); grub_printf("name:<%s>\n\n", cur->name);
cur = cur->next; cur = cur->next;
} }

View File

@@ -52,6 +52,12 @@
#define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!" #define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!"
#ifdef GRUB_MACHINE_EFI
#define VTOY_DUAL_MODE_SUFFIX "uefi"
#else
#define VTOY_DUAL_MODE_SUFFIX "legacy"
#endif
typedef struct ventoy_initrd_ctx typedef struct ventoy_initrd_ctx
{ {
const char *path_prefix; const char *path_prefix;
@@ -172,6 +178,7 @@ typedef struct img_info
int id; int id;
int type; int type;
int plugin_list_index;
grub_uint64_t size; grub_uint64_t size;
int select; int select;
int unsupport; int unsupport;
@@ -192,6 +199,8 @@ typedef struct img_iterator_node
int done; int done;
int select; int select;
int plugin_list_index;
struct img_iterator_node *parent; struct img_iterator_node *parent;
struct img_iterator_node *firstchild; struct img_iterator_node *firstchild;
@@ -778,6 +787,14 @@ typedef struct auto_memdisk
struct auto_memdisk *next; struct auto_memdisk *next;
}auto_memdisk; }auto_memdisk;
typedef struct image_list
{
int pathlen;
char isopath[256];
struct image_list *next;
}image_list;
extern int g_ventoy_menu_esc; extern int g_ventoy_menu_esc;
extern int g_ventoy_suppress_esc; extern int g_ventoy_suppress_esc;
extern int g_ventoy_last_entry; extern int g_ventoy_last_entry;
@@ -787,6 +804,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 int g_plugin_image_list;
extern ventoy_gpt_info *g_ventoy_part_info; 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) \
@@ -819,6 +837,7 @@ const char * ventoy_plugin_get_injection(const char *isopath);
const char * ventoy_plugin_get_menu_alias(int type, const char *isopath); const char * ventoy_plugin_get_menu_alias(int type, const char *isopath);
const char * ventoy_plugin_get_menu_class(int type, const char *name); const char * ventoy_plugin_get_menu_class(int type, const char *name);
int ventoy_plugin_check_memdisk(const char *isopath); int ventoy_plugin_check_memdisk(const char *isopath);
int ventoy_plugin_get_image_list_index(int type, const char *name);
int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start); int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start); int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
void ventoy_plugin_dump_persistence(void); void ventoy_plugin_dump_persistence(void);

View File

@@ -46,6 +46,7 @@ static menu_alias *g_menu_alias_head = NULL;
static menu_class *g_menu_class_head = NULL; static menu_class *g_menu_class_head = NULL;
static injection_config *g_injection_head = NULL; static injection_config *g_injection_head = NULL;
static auto_memdisk *g_auto_memdisk_head = NULL; static auto_memdisk *g_auto_memdisk_head = NULL;
static image_list *g_image_list_head = NULL;
static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
{ {
@@ -68,7 +69,15 @@ static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
pChild = pNode->pstChild; pChild = pNode->pstChild;
if (pChild->enDataType == JSON_TYPE_STRING) if (pChild->enDataType == JSON_TYPE_STRING)
{ {
grub_printf("%s: %s\n", pChild->pcName, pChild->unData.pcStrVal); if (grub_strcmp(pChild->pcName, "VTOY_DEFAULT_IMAGE") == 0)
{
grub_printf("%s: %s [%s]\n", pChild->pcName, pChild->unData.pcStrVal,
ventoy_check_file_exist("%s%s", isodisk, pChild->unData.pcStrVal) ? "OK" : "NOT EXIST");
}
else
{
grub_printf("%s: %s\n", pChild->pcName, pChild->unData.pcStrVal);
}
} }
else else
{ {
@@ -1088,6 +1097,89 @@ static int ventoy_plugin_auto_memdisk_check(VTOY_JSON *json, const char *isodisk
return 0; return 0;
} }
static int ventoy_plugin_image_list_entry(VTOY_JSON *json, const char *isodisk)
{
VTOY_JSON *pNode = NULL;
image_list *node = NULL;
image_list *next = NULL;
image_list *tail = NULL;
(void)isodisk;
if (json->enDataType != JSON_TYPE_ARRAY)
{
debug("Not array %d\n", json->enDataType);
return 0;
}
if (g_image_list_head)
{
for (node = g_image_list_head; node; node = next)
{
next = node->next;
grub_free(node);
}
g_image_list_head = NULL;
}
g_plugin_image_list = 1;
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
{
if (pNode->enDataType == JSON_TYPE_STRING)
{
node = grub_zalloc(sizeof(image_list));
if (node)
{
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", pNode->unData.pcStrVal);
if (g_image_list_head)
{
tail->next = node;
}
else
{
g_image_list_head = node;
}
tail = node;
}
}
}
return 0;
}
static int ventoy_plugin_image_list_check(VTOY_JSON *json, const char *isodisk)
{
VTOY_JSON *pNode = NULL;
if (json->enDataType != JSON_TYPE_ARRAY)
{
grub_printf("Not array %d\n", json->enDataType);
return 1;
}
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
{
if (pNode->enDataType == JSON_TYPE_STRING)
{
grub_printf("<%s> ", pNode->unData.pcStrVal);
if (ventoy_check_file_exist("%s%s", isodisk, pNode->unData.pcStrVal))
{
grub_printf(" [OK]\n");
}
else
{
grub_printf(" [NOT EXIST]\n");
}
}
}
return 0;
}
static plugin_entry g_plugin_entries[] = static plugin_entry g_plugin_entries[] =
{ {
{ "control", ventoy_plugin_control_entry, ventoy_plugin_control_check }, { "control", ventoy_plugin_control_entry, ventoy_plugin_control_check },
@@ -1098,11 +1190,13 @@ static plugin_entry g_plugin_entries[] =
{ "menu_class", ventoy_plugin_menuclass_entry, ventoy_plugin_menuclass_check }, { "menu_class", ventoy_plugin_menuclass_entry, ventoy_plugin_menuclass_check },
{ "injection", ventoy_plugin_injection_entry, ventoy_plugin_injection_check }, { "injection", ventoy_plugin_injection_entry, ventoy_plugin_injection_check },
{ "auto_memdisk", ventoy_plugin_auto_memdisk_entry, ventoy_plugin_auto_memdisk_check }, { "auto_memdisk", ventoy_plugin_auto_memdisk_entry, ventoy_plugin_auto_memdisk_check },
{ "image_list", ventoy_plugin_image_list_entry, ventoy_plugin_image_list_check },
}; };
static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk) static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk)
{ {
int i; int i;
char key[128];
VTOY_JSON *cur = json; VTOY_JSON *cur = json;
grub_snprintf(g_iso_disk_name, sizeof(g_iso_disk_name), "%s", isodisk); grub_snprintf(g_iso_disk_name, sizeof(g_iso_disk_name), "%s", isodisk);
@@ -1111,7 +1205,8 @@ static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk)
{ {
for (i = 0; i < (int)ARRAY_SIZE(g_plugin_entries); i++) for (i = 0; i < (int)ARRAY_SIZE(g_plugin_entries); i++)
{ {
if (grub_strcmp(g_plugin_entries[i].key, cur->pcName) == 0) grub_snprintf(key, sizeof(key), "%s_%s", g_plugin_entries[i].key, VTOY_DUAL_MODE_SUFFIX);
if (grub_strcmp(g_plugin_entries[i].key, cur->pcName) == 0 || grub_strcmp(key, cur->pcName) == 0)
{ {
debug("Plugin entry for %s\n", g_plugin_entries[i].key); debug("Plugin entry for %s\n", g_plugin_entries[i].key);
g_plugin_entries[i].entryfunc(cur, isodisk); g_plugin_entries[i].entryfunc(cur, isodisk);
@@ -1165,6 +1260,9 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
ret = vtoy_json_parse(json, buf); ret = vtoy_json_parse(json, buf);
if (ret) if (ret)
{ {
grub_env_set("VTOY_PLUGIN_SYNTAX_ERROR", "1");
grub_env_export("VTOY_PLUGIN_SYNTAX_ERROR");
debug("Failed to parse json string %d\n", ret); debug("Failed to parse json string %d\n", ret);
grub_free(buf); grub_free(buf);
return 1; return 1;
@@ -1464,11 +1562,46 @@ int ventoy_plugin_check_memdisk(const char *isopath)
return 0; return 0;
} }
int ventoy_plugin_get_image_list_index(int type, const char *name)
{
int len;
int index = 1;
image_list *node = NULL;
if (!g_image_list_head)
{
return 0;
}
len = (int)grub_strlen(name);
for (node = g_image_list_head; node; node = node->next, index++)
{
if (vtoy_class_directory == type)
{
if (len < node->pathlen && grub_strncmp(name, node->isopath, len) == 0)
{
return index;
}
}
else
{
if (len == node->pathlen && grub_strncmp(name, node->isopath, len) == 0)
{
return index;
}
}
}
return 0;
}
grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int i = 0; int i = 0;
int ret = 0; int ret = 0;
char *buf = NULL; char *buf = NULL;
char key[128];
grub_file_t file; grub_file_t file;
VTOY_JSON *node = NULL; VTOY_JSON *node = NULL;
VTOY_JSON *json = NULL; VTOY_JSON *json = NULL;
@@ -1511,9 +1644,10 @@ grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, ch
goto end; goto end;
} }
grub_snprintf(key, sizeof(key), "%s_%s", args[1], VTOY_DUAL_MODE_SUFFIX);
for (node = json->pstChild; node; node = node->pstNext) for (node = json->pstChild; node; node = node->pstNext)
{ {
if (grub_strcmp(node->pcName, args[1]) == 0) if (grub_strcmp(node->pcName, args[1]) == 0 || grub_strcmp(node->pcName, key) == 0)
{ {
break; break;
} }

View File

@@ -33,12 +33,11 @@ if [ -e /init ] && $GREP -q '^mountroot$' /init; then
fi fi
elif [ -e "$CD_DETECT" ]; then elif [ -e "$CD_DETECT" ]; then
echo "$CD_DETECT exist, now add hook in it..." >> $VTLOG echo "$CD_DETECT exist, now add hook in it..." >> $VTLOG
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i "$CD_DETECT" $SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i "$CD_DETECT"
TITLE_LINE=$($GREP -m1 '^hw-detect.*detect_progress_title' "$CD_DETECT")
if [ $? -eq 0 ]; then if [ -e /bin/list-devices ]; then
echo "add $TITLE_LINE for hook" >> $VTLOG mv /bin/list-devices /bin/list-devices-bk
$SED "1 a$TITLE_LINE" -i "$CD_DETECT" cp -a /ventoy/hook/debian/list-devices /bin/list-devices
fi fi
elif [ -e /init ] && $GREP -q '/start-udev$' /init; then elif [ -e /init ] && $GREP -q '/start-udev$' /init; then
echo "Here use notify ..." >> $VTLOG echo "Here use notify ..." >> $VTLOG

View File

@@ -0,0 +1,9 @@
#! /bin/sh
if [ "$1" = "usb-partition" -a -z "$2" ]; then
if [ -f /ventoy/list-devices-usb-part ]; then
cat /ventoy/list-devices-usb-part
fi
fi
/bin/list-devices-bk $*

View File

@@ -42,6 +42,7 @@ if ! [ -e $VTOY_DM_PATH ]; then
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/') blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
mknod -m 0666 $VTOY_DM_PATH b $blkdev_num mknod -m 0666 $VTOY_DM_PATH b $blkdev_num
fi fi
cp -a $VTOY_DM_PATH /dev/ventoy
PATH=$VTPATH_OLD PATH=$VTPATH_OLD

View File

@@ -19,4 +19,4 @@
$SED '1 apmedia=usbhd' -i /init $SED '1 apmedia=usbhd' -i /init
$SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init $SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init
$SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='mapper/ventoy|iso9660'" -i /init $SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='ventoy|iso9660'" -i /init

View File

@@ -133,15 +133,7 @@ else
vtlog "boot=, or casper, don't mount" vtlog "boot=, or casper, don't mount"
else else
vtlog "No boot param, need to mount" vtlog "No boot param, need to mount"
$BUSYBOX_PATH/mkdir /cdrom echo /dev/$1 > /ventoy/list-devices-usb-part
if [ -b $VTOY_DM_PATH ]; then
vtlog "mount $VTOY_DM_PATH ..."
$BUSYBOX_PATH/mount -t iso9660 $VTOY_DM_PATH /cdrom
else
vtlog "mount /dev/$1 ..."
$BUSYBOX_PATH/mount -t iso9660 /dev/$1 /cdrom
fi
fi fi
fi fi

Binary file not shown.

View File

@@ -1,5 +1,11 @@
#!/bin/sh #!/bin/sh
if ! [ -f ./tool/ventoy_lib.sh ]; then
if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
cd ${0%Ventoy2Disk.sh}
fi
fi
if [ -f ./ventoy/version ]; then if [ -f ./ventoy/version ]; then
curver=$(cat ./ventoy/version) curver=$(cat ./ventoy/version)
fi fi
@@ -12,13 +18,8 @@ echo " https://www.ventoy.net"
echo '**********************************************' echo '**********************************************'
echo '' echo ''
OLDDIR=$PWD OLDDIR=$(pwd)
PATH=./tool:$PATH
if ! [ -f ./tool/xzcat ]; then
if [ -f ${0%Ventoy2Disk.sh}/tool/xzcat ]; then
cd ${0%Ventoy2Disk.sh}
fi
fi
if ! [ -f ./boot/boot.img ]; then if ! [ -f ./boot/boot.img ]; then
if [ -d ./grub ]; then if [ -d ./grub ]; then
@@ -30,27 +31,30 @@ if ! [ -f ./boot/boot.img ]; then
fi fi
echo "############# Ventoy2Disk $* ################" >> ./log.txt echo "############# Ventoy2Disk $* ################" >> ./log.txt
date >> ./log.txt
#decompress tool #decompress tool
if ! [ -f ./tool/ash ]; then if [ -f ./tool/VentoyWorker.sh ]; then
echo "no need to decompress tools" >> ./log.txt
else
cd tool cd tool
chmod +x ./xzcat
if [ -f ./xzcat ]; then
chmod +x ./xzcat
fi
for file in $(ls *.xz); do for file in $(ls *.xz); do
./xzcat $file > ${file%.xz} xzcat $file > ${file%.xz}
chmod +x ${file%.xz} chmod +x ${file%.xz}
done done
cd ../ cd ../
if ! [ -f ./tool/ash ]; then
echo 'Failed to decompress tools ...'
if [ -n "$OLDDIR" ]; then
cd $OLDDIR
fi
exit 1
fi
fi fi
./tool/ash ./tool/VentoyWorker.sh $* if [ -f /bin/bash ]; then
bash ./tool/VentoyWorker.sh $*
else
./tool/ash ./tool/VentoyWorker.sh $*
fi
if [ -n "$OLDDIR" ]; then if [ -n "$OLDDIR" ]; then
cd $OLDDIR cd $OLDDIR

View File

@@ -76,6 +76,15 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
unset pager unset pager
} }
menuentry 'Check image list plugin configuration' --class=debug_imagelist {
set pager=1
vt_check_plugin_json $vt_plugin_path image_list $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
read vtInputKey
unset pager
}
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
echo 'Return ...' echo 'Return ...'
} }

View File

@@ -44,6 +44,12 @@ function ventoy_gui_console {
fi fi
} }
function ventoy_acpi_param {
if [ "$VTOY_PARAM_NO_ACPI" != "1" ]; then
vt_acpi_param $1 $2
fi
}
function ventoy_power { function ventoy_power {
configfile $prefix/power.cfg configfile $prefix/power.cfg
} }
@@ -257,6 +263,8 @@ function distro_specify_initrd_file_phase2 {
if [ "$grub_platform" != "pc" ]; then if [ "$grub_platform" != "pc" ]; then
vt_add_replace_file 0 "EFI\\archiso\\archiso.img" vt_add_replace_file 0 "EFI\\archiso\\archiso.img"
fi fi
elif [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
vt_linux_specify_initrd_file /blackarch/boot/x86_64/archiso.img
fi fi
} }
@@ -434,6 +442,7 @@ function uefi_windows_menu_func {
ventoy_debug_pause ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
@@ -496,14 +505,18 @@ function uefi_linux_menu_func {
if [ -d (loop)/arch ]; then if [ -d (loop)/arch ]; then
if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img" vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
elif [ -f (loop)/arch/boot/x86_64/initramfs-linux.img ]; then
vt_add_replace_file $vtindex "arch\\boot\\x86_64\\initramfs-linux.img"
elif [ -f (loop)/boot/initramfs_x86_64.img ]; then elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img" vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
fi fi
elif [ -d (loop)/blackarch ]; then
if [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
fi
elif [ -d (loop)/parabola ]; then elif [ -d (loop)/parabola ]; then
if [ -f (loop)/parabola/boot/x86_64/parabola.img ]; then if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
vt_add_replace_file $vtindex "EFI\\parabola\\parabola.img" vt_add_replace_file $vtindex "EFI\\parabolaiso\\parabolaiso.img"
elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
fi fi
elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz" vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
@@ -534,6 +547,7 @@ function uefi_linux_menu_func {
vt_linux_chain_data ${1}${chosen_path} vt_linux_chain_data ${1}${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
@@ -547,6 +561,7 @@ function uefi_unix_menu_func {
ventoy_unix_comm_proc $1 ${chosen_path} ventoy_unix_comm_proc $1 ${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
@@ -658,6 +673,7 @@ function legacy_windows_menu_func {
ventoy_debug_pause ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
else else
@@ -722,6 +738,7 @@ function legacy_linux_menu_func {
ventoy_debug_pause ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
else else
@@ -735,6 +752,7 @@ function legacy_unix_menu_func {
ventoy_unix_comm_proc $1 ${chosen_path} ventoy_unix_comm_proc $1 ${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
#ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
else else
@@ -1028,9 +1046,10 @@ function vtoyboot_common_func {
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
vt_acpi_param ${vtoy_chain_mem_addr} 512 vt_acpi_param ${vtoy_chain_mem_addr} 512
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80 sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
else else
ventoy_acpi_param ${vtoy_chain_mem_addr} 512
ventoy_cli_console ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} chainloader ${vtoy_path}/ventoy_x64.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
@@ -1297,6 +1316,7 @@ function img_common_menuentry {
fi fi
else else
vt_linux_chain_data ${vtoy_iso_part}${vt_chosen_path} vt_linux_chain_data ${vtoy_iso_part}${vt_chosen_path}
ventoy_acpi_param ${vtoy_chain_mem_addr} 512
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot boot
@@ -1324,7 +1344,10 @@ function img_unsupport_menuentry {
############################################################# #############################################################
############################################################# #############################################################
set VENTOY_VERSION="1.0.22" set VENTOY_VERSION="1.0.26"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1
# 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
@@ -1361,7 +1384,7 @@ if [ "$vtoy_dev" = "tftp" ]; then
loadfont ascii loadfont ascii
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
set vt_plugin_path=$vtoy_iso_part set vt_plugin_path=$vtoy_iso_part
else else
set vt_plugin_path=$prefix set vt_plugin_path=$prefix
vt_load_plugin $vt_plugin_path vt_load_plugin $vt_plugin_path
@@ -1420,7 +1443,7 @@ if [ -n "$vtoy_gfxmode" ]; then
set gfxmode=$vtoy_gfxmode set gfxmode=$vtoy_gfxmode
set gfxpayload=keep set gfxpayload=keep
else else
set gfxmode=1920x1080,1366x768,1024x768,800x600,auto set gfxmode=1024x768
set gfxpayload=keep set gfxpayload=keep
fi fi
@@ -1448,9 +1471,19 @@ else
terminal_output gfxterm terminal_output gfxterm
fi fi
if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
clear
echo -e "\n Syntax error detected in ventoy.json, please check! \n"
echo -e " ventoy.json 文件中有语法错误,所有配置都不会生效,请检查!\n"
echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
read vtInputKey
fi
#export necessary variable #export necessary variable
export theme export theme
export gfxmode export gfxmode
export gfxpayload
export vtoydev export vtoydev
export vtoy_path export vtoy_path
export vtdebug_flag export vtdebug_flag

Binary file not shown.

Binary file not shown.

View File

@@ -63,7 +63,11 @@ if ! [ -b "$DISK" ]; then
fi fi
if [ -e /sys/class/block/${DISK#/dev/}/start ]; then if [ -e /sys/class/block/${DISK#/dev/}/start ]; then
vterr "$DISK is a partition, please use the whole disk" vterr "$DISK is a partition, please use the whole disk."
echo "For example:"
vterr " sudo sh Ventoy2Disk.sh -i /dev/sdX1 <=== This is wrong"
vtinfo " sudo sh Ventoy2Disk.sh -i /dev/sdX <=== This is right"
echo ""
exit 1 exit 1
fi fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
int g_debug = 0; int g_debug = 0;
int g_hddmode = 0; int g_hddmode = 0;
int g_bios_disk80 = 0;
char *g_cmdline_copy; char *g_cmdline_copy;
void *g_initrd_addr; void *g_initrd_addr;
size_t g_initrd_len; size_t g_initrd_len;
@@ -698,6 +699,11 @@ int ventoy_boot_vdisk(void *data)
g_hddmode = 1; g_hddmode = 1;
} }
if (strstr(g_cmdline_copy, "bios80"))
{
g_bios_disk80 = 1;
}
g_chain = (ventoy_chain_head *)g_initrd_addr; g_chain = (ventoy_chain_head *)g_initrd_addr;
g_chunk = (ventoy_img_chunk *)((char *)g_chain + g_chain->img_chunk_offset); g_chunk = (ventoy_img_chunk *)((char *)g_chain + g_chain->img_chunk_offset);
g_img_chunk_num = g_chain->img_chunk_num; g_img_chunk_num = g_chain->img_chunk_num;

View File

@@ -1425,7 +1425,7 @@ unsigned int ventoy_int13_hook (ventoy_chain_head *chain)
if (g_hddmode) if (g_hddmode)
{ {
natural_drive = num_drives | 0x80; natural_drive = g_bios_disk80 ? 0x80 : (num_drives | 0x80);
} }
else else
{ {

View File

@@ -187,6 +187,7 @@ typedef struct ventoy_sector_flag
extern int g_debug; extern int g_debug;
extern int g_hddmode; extern int g_hddmode;
extern int g_bios_disk80;
extern char *g_cmdline_copy; extern char *g_cmdline_copy;
extern void *g_initrd_addr; extern void *g_initrd_addr;
extern size_t g_initrd_len; extern size_t g_initrd_len;

Binary file not shown.