1.0.30 release

This commit is contained in:
longpanda 2020-12-12 17:42:45 +08:00
parent ebaa4d954a
commit 40c0504dfb
18 changed files with 271 additions and 134 deletions

View File

@ -42,6 +42,7 @@
#include <grub/video.h> #include <grub/video.h>
#include <grub/acpi.h> #include <grub/acpi.h>
#include <grub/charset.h> #include <grub/charset.h>
#include <grub/crypto.h>
#include <grub/ventoy.h> #include <grub/ventoy.h>
#include "ventoy_def.h" #include "ventoy_def.h"
@ -59,6 +60,7 @@ int g_sort_case_sensitive = 0;
int g_tree_view_menu_style = 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;
static grub_uint32_t g_ventoy_plat_data;
char g_iso_path[256]; char g_iso_path[256];
char g_img_swap_tmp_buf[1024]; char g_img_swap_tmp_buf[1024];
@ -973,7 +975,7 @@ static grub_err_t ventoy_cmd_check_compatible(grub_extcmd_context_t ctxt, int ar
for (i = 0; i < (int)ARRAY_SIZE(files); i++) for (i = 0; i < (int)ARRAY_SIZE(files); i++)
{ {
grub_snprintf(buf, sizeof(buf) - 1, "[ -e %s/%s ]", args[0], files[i]); grub_snprintf(buf, sizeof(buf) - 1, "[ -e \"%s/%s\" ]", args[0], files[i]);
if (0 == grub_script_execute_sourcecode(buf)) if (0 == grub_script_execute_sourcecode(buf))
{ {
debug("file %s exist, ventoy_compatible YES\n", buf); debug("file %s exist, ventoy_compatible YES\n", buf);
@ -1351,6 +1353,32 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
return 0; return 0;
} }
static int ventoy_arch_mode_init(void)
{
#ifdef GRUB_MACHINE_EFI
if (grub_strcmp(GRUB_TARGET_CPU, "i386") == 0)
{
g_ventoy_plat_data = VTOY_PLAT_I386_UEFI;
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "ia32");
}
else if (grub_strcmp(GRUB_TARGET_CPU, "arm64") == 0)
{
g_ventoy_plat_data = VTOY_PLAT_ARM64_UEFI;
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "aa64");
}
else
{
g_ventoy_plat_data = VTOY_PLAT_X86_64_UEFI;
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "uefi");
}
#else
g_ventoy_plat_data = VTOY_PLAT_X86_LEGACY;
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "legacy");
#endif
return 0;
}
int ventoy_fill_data(grub_uint32_t buflen, char *buffer) int ventoy_fill_data(grub_uint32_t buflen, char *buffer)
{ {
int len = GRUB_UINT_MAX; int len = GRUB_UINT_MAX;
@ -1402,11 +1430,7 @@ int ventoy_fill_data(grub_uint32_t buflen, char *buffer)
grub_memcpy(guidstr, &guid, sizeof(guid)); grub_memcpy(guidstr, &guid, sizeof(guid));
#if defined (GRUB_MACHINE_EFI) puint2[0] = grub_swap_bytes32(g_ventoy_plat_data);
puint2[0] = grub_swap_bytes32(0x55454649);
#else
puint2[0] = grub_swap_bytes32(0x42494f53);
#endif
/* Easter egg :) It will be appreciated if you reserve it, but NOT mandatory. */ /* Easter egg :) It will be appreciated if you reserve it, but NOT mandatory. */
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -1427,6 +1451,55 @@ int ventoy_fill_data(grub_uint32_t buflen, char *buffer)
return len; return len;
} }
int ventoy_check_password(const vtoy_password *pwd, int retry)
{
int offset;
char input[256];
grub_uint8_t md5[16];
while (retry--)
{
grub_memset(input, 0, sizeof(input));
grub_printf("Enter password: ");
grub_refresh();
if (pwd->type == VTOY_PASSWORD_TXT)
{
grub_password_get(input, 128);
if (grub_strcmp(pwd->text, input) == 0)
{
return 0;
}
}
else if (pwd->type == VTOY_PASSWORD_MD5)
{
grub_password_get(input, 128);
grub_crypto_hash(GRUB_MD_MD5, md5, input, grub_strlen(input));
if (grub_memcmp(pwd->md5, md5, 16) == 0)
{
return 0;
}
}
else if (pwd->type == VTOY_PASSWORD_SALT_MD5)
{
offset = (int)grub_snprintf(input, 128, "%s", pwd->salt);
grub_password_get(input + offset, 128);
grub_crypto_hash(GRUB_MD_MD5, md5, input, grub_strlen(input));
if (grub_memcmp(pwd->md5, md5, 16) == 0)
{
return 0;
}
}
grub_printf("Invalid password!\n\n");
grub_refresh();
}
return 1;
}
static img_info * ventoy_get_min_iso(img_iterator_node *node) static img_info * ventoy_get_min_iso(img_iterator_node *node)
{ {
img_info *minimg = NULL; img_info *minimg = NULL;
@ -3771,14 +3844,14 @@ int ventoy_is_file_exist(const char *fmt, ...)
char *pos = NULL; char *pos = NULL;
char buf[256] = {0}; char buf[256] = {0};
grub_snprintf(buf, sizeof(buf), "%s", "[ -f "); grub_snprintf(buf, sizeof(buf), "%s", "[ -f \"");
pos = buf + 5; pos = buf + 6;
va_start (ap, fmt); va_start (ap, fmt);
len = grub_vsnprintf(pos, 255, fmt, ap); len = grub_vsnprintf(pos, 255, fmt, ap);
va_end (ap); va_end (ap);
grub_strncpy(pos + len, " ]", 2); grub_strncpy(pos + len, "\" ]", 3);
debug("script exec %s\n", buf); debug("script exec %s\n", buf);
@ -3797,14 +3870,14 @@ int ventoy_is_dir_exist(const char *fmt, ...)
char *pos = NULL; char *pos = NULL;
char buf[256] = {0}; char buf[256] = {0};
grub_snprintf(buf, sizeof(buf), "%s", "[ -d "); grub_snprintf(buf, sizeof(buf), "%s", "[ -d \"");
pos = buf + 5; pos = buf + 6;
va_start (ap, fmt); va_start (ap, fmt);
len = grub_vsnprintf(pos, 255, fmt, ap); len = grub_vsnprintf(pos, 255, fmt, ap);
va_end (ap); va_end (ap);
grub_strncpy(pos + len, " ]", 2); grub_strncpy(pos + len, "\" ]", 3);
debug("script exec %s\n", buf); debug("script exec %s\n", buf);
@ -3961,23 +4034,8 @@ GRUB_MOD_INIT(ventoy)
cmd_para *cur = NULL; cmd_para *cur = NULL;
ventoy_env_init(); ventoy_env_init();
#ifdef GRUB_MACHINE_EFI ventoy_arch_mode_init();
if (grub_strcmp(GRUB_TARGET_CPU, "i386") == 0)
{
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "ia32");
}
else if (grub_strcmp(GRUB_TARGET_CPU, "arm64") == 0)
{
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "aa64");
}
else
{
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "uefi");
}
#else
grub_snprintf(g_arch_mode_suffix, sizeof(g_arch_mode_suffix), "%s", "legacy");
#endif
for (i = 0; i < ARRAY_SIZE(ventoy_cmds); i++) for (i = 0; i < ARRAY_SIZE(ventoy_cmds); i++)
{ {

View File

@ -52,6 +52,11 @@
#define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!" #define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!"
#define VTOY_PLAT_I386_UEFI 0x49413332
#define VTOY_PLAT_ARM64_UEFI 0x41413634
#define VTOY_PLAT_X86_64_UEFI 0x55454649
#define VTOY_PLAT_X86_LEGACY 0x42494f53
#define VTOY_PWD_CORRUPTED(err) \ #define VTOY_PWD_CORRUPTED(err) \
{\ {\
grub_printf("\n\n Password corrupted, will reboot after 5 seconds.\n\n"); \ grub_printf("\n\n Password corrupted, will reboot after 5 seconds.\n\n"); \
@ -830,14 +835,28 @@ typedef struct image_list
struct image_list *next; struct image_list *next;
}image_list; }image_list;
#define VTOY_PASSWORD_NONE 0
#define VTOY_PASSWORD_TXT 1
#define VTOY_PASSWORD_MD5 2
#define VTOY_PASSWORD_SALT_MD5 3
typedef struct vtoy_password typedef struct vtoy_password
{
int type;
char text[128];
char salt[64];
grub_uint8_t md5[16];
}vtoy_password;
typedef struct menu_password
{ {
int pathlen; int pathlen;
char isopath[256]; char isopath[256];
grub_uint8_t sha256[32];
struct vtoy_password *next; vtoy_password password;
}vtoy_password;
struct menu_password *next;
}menu_password;
extern int g_ventoy_menu_esc; extern int g_ventoy_menu_esc;
extern int g_ventoy_suppress_esc; extern int g_ventoy_suppress_esc;
@ -914,7 +933,7 @@ grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **
grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args); grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_check_password(const grub_uint8_t *pwdsha256, int retry); int ventoy_check_password(const vtoy_password *pwd, int retry);
#endif /* __VENTOY_DEF_H__ */ #endif /* __VENTOY_DEF_H__ */

View File

@ -42,11 +42,10 @@ GRUB_MOD_LICENSE ("GPLv3+");
char g_arch_mode_suffix[64]; char g_arch_mode_suffix[64];
static char g_iso_disk_name[128]; static char g_iso_disk_name[128];
static grub_uint8_t g_boot_pwd = 0; static vtoy_password g_boot_pwd;
static grub_uint8_t g_boot_sha256[32];
static install_template *g_install_template_head = NULL; static install_template *g_install_template_head = NULL;
static dud *g_dud_head = NULL; static dud *g_dud_head = NULL;
static vtoy_password *g_pwd_head = NULL; static menu_password *g_pwd_head = NULL;
static persistence_config *g_persistence_head = NULL; static persistence_config *g_persistence_head = NULL;
static menu_alias *g_menu_alias_head = NULL; static menu_alias *g_menu_alias_head = NULL;
static menu_class *g_menu_class_head = NULL; static menu_class *g_menu_class_head = NULL;
@ -700,18 +699,120 @@ static int ventoy_plugin_dud_entry(VTOY_JSON *json, const char *isodisk)
return 0; return 0;
} }
static int ventoy_plugin_parse_pwdstr(char *pwdstr, vtoy_password *pwd)
{
int i;
int len;
char ch;
char *pos;
char bytes[3];
vtoy_password tmpPwd;
len = (int)grub_strlen(pwdstr);
if (len > 64)
{
if (NULL == pwd) grub_printf("Password too long %d\n", len);
return 1;
}
grub_memset(&tmpPwd, 0, sizeof(tmpPwd));
if (grub_strncmp(pwdstr, "txt#", 4) == 0)
{
tmpPwd.type = VTOY_PASSWORD_TXT;
grub_snprintf(tmpPwd.text, sizeof(tmpPwd.text), "%s", pwdstr + 4);
}
else if (grub_strncmp(pwdstr, "md5#", 4) == 0)
{
if ((len - 4) == 32)
{
for (i = 0; i < 16; i++)
{
bytes[0] = pwdstr[4 + i * 2];
bytes[1] = pwdstr[4 + i * 2 + 1];
bytes[2] = 0;
if (grub_isxdigit(bytes[0]) && grub_isxdigit(bytes[1]))
{
tmpPwd.md5[i] = (grub_uint8_t)grub_strtoul(bytes, NULL, 16);
}
else
{
if (NULL == pwd) grub_printf("Invalid md5 hex format %s %d\n", pwdstr, i);
return 1;
}
}
tmpPwd.type = VTOY_PASSWORD_MD5;
}
else if ((len - 4) > 32)
{
pos = grub_strchr(pwdstr + 4, '#');
if (!pos)
{
if (NULL == pwd) grub_printf("Invalid md5 password format %s\n", pwdstr);
return 1;
}
if (len - 1 - (int)(long)(pos - pwdstr) != 32)
{
if (NULL == pwd) grub_printf("Invalid md5 salt password format %s\n", pwdstr);
return 1;
}
ch = *pos;
*pos = 0;
grub_snprintf(tmpPwd.salt, sizeof(tmpPwd.salt), "%s", pwdstr + 4);
*pos = ch;
pos++;
for (i = 0; i < 16; i++)
{
bytes[0] = pos[i * 2];
bytes[1] = pos[i * 2 + 1];
bytes[2] = 0;
if (grub_isxdigit(bytes[0]) && grub_isxdigit(bytes[1]))
{
tmpPwd.md5[i] = (grub_uint8_t)grub_strtoul(bytes, NULL, 16);
}
else
{
if (NULL == pwd) grub_printf("Invalid md5 hex format %s %d\n", pwdstr, i);
return 1;
}
}
tmpPwd.type = VTOY_PASSWORD_SALT_MD5;
}
else
{
if (NULL == pwd) grub_printf("Invalid md5 password format %s\n", pwdstr);
return 1;
}
}
else
{
if (NULL == pwd) grub_printf("Invalid password format %s\n", pwdstr);
return 1;
}
if (pwd)
{
grub_memcpy(pwd, &tmpPwd, sizeof(tmpPwd));
}
return 0;
}
static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
{ {
int i = 0;
int len = 0;
const char *iso = NULL; const char *iso = NULL;
const char *pwd = NULL; const char *pwd = NULL;
VTOY_JSON *pNode = NULL; VTOY_JSON *pNode = NULL;
VTOY_JSON *pCNode = NULL; VTOY_JSON *pCNode = NULL;
vtoy_password *node = NULL; menu_password *node = NULL;
vtoy_password *tail = NULL; menu_password *tail = NULL;
vtoy_password *next = NULL; menu_password *next = NULL;
char bytes[3];
(void)isodisk; (void)isodisk;
@ -736,18 +837,7 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
{ {
if (pNode->pcName && grub_strcmp("bootpwd", pNode->pcName) == 0) if (pNode->pcName && grub_strcmp("bootpwd", pNode->pcName) == 0)
{ {
len = (int)grub_strlen(pNode->unData.pcStrVal); ventoy_plugin_parse_pwdstr(pNode->unData.pcStrVal, &g_boot_pwd);
if (len == 64)
{
g_boot_pwd = 1;
for (i = 0; i < 32; i++)
{
bytes[0] = pNode->unData.pcStrVal[i * 2];
bytes[1] = pNode->unData.pcStrVal[i * 2 + 1];
bytes[2] = 0;
g_boot_sha256[i] = (grub_uint8_t)grub_strtoul(bytes, NULL, 16);
}
}
} }
else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0) else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0)
{ {
@ -762,24 +852,16 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd"); pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd");
if (iso && pwd && iso[0] == '/') if (iso && pwd && iso[0] == '/')
{ {
node = grub_zalloc(sizeof(vtoy_password)); node = grub_zalloc(sizeof(menu_password));
if (node) if (node)
{ {
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", iso); node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", iso);
len = (int)grub_strlen(pwd);
if (len != 64) if (ventoy_plugin_parse_pwdstr((char *)pwd, &(node->password)))
{ {
grub_free(node); grub_free(node);
continue; continue;
} }
for (i = 0; i < 32; i++)
{
bytes[0] = pwd[i * 2];
bytes[1] = pwd[i * 2 + 1];
bytes[2] = 0;
node->sha256[i] = (grub_uint8_t)grub_strtoul(bytes, NULL, 16);
}
if (g_pwd_head) if (g_pwd_head)
{ {
@ -801,7 +883,6 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
{ {
int len = 0;
const char *iso = NULL; const char *iso = NULL;
const char *pwd = NULL; const char *pwd = NULL;
VTOY_JSON *pNode = NULL; VTOY_JSON *pNode = NULL;
@ -817,18 +898,18 @@ static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
{ {
if (pNode->pcName && grub_strcmp("bootpwd", pNode->pcName) == 0) if (pNode->pcName && grub_strcmp("bootpwd", pNode->pcName) == 0)
{ {
len = (int)grub_strlen(pNode->unData.pcStrVal); if (0 == ventoy_plugin_parse_pwdstr(pNode->unData.pcStrVal, NULL))
if (len != 64)
{ {
grub_printf("Invalid bootpwd len :%d\n", len); grub_printf("bootpwd:<%s>\n", pNode->unData.pcStrVal);
} }
else else
{ {
grub_printf("bootpwd:<%s>\n", pNode->unData.pcStrVal); grub_printf("Invalid bootpwd.\n");
} }
} }
else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0) else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0)
{ {
grub_printf("\n");
for (pCNode = pNode->pstChild; pCNode; pCNode = pCNode->pstNext) for (pCNode = pNode->pstChild; pCNode; pCNode = pCNode->pstNext)
{ {
if (pCNode->enDataType != JSON_TYPE_OBJECT) if (pCNode->enDataType != JSON_TYPE_OBJECT)
@ -844,21 +925,24 @@ static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
{ {
pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd"); pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd");
len = (int)grub_strlen(pwd); if (0 == ventoy_plugin_parse_pwdstr((char *)pwd, NULL))
if (len != 64)
{
grub_printf("Invalid sha256 len <%d>\n", len);
}
else
{ {
grub_printf("file:<%s> [OK]\n", iso); grub_printf("file:<%s> [OK]\n", iso);
grub_printf("pwd:<%s>\n\n", pwd); grub_printf("pwd:<%s>\n\n", pwd);
} }
else
{
grub_printf("Invalid password for <%s>\n", iso);
}
}
else
{
grub_printf("<%s%s> not found\n", isodisk, iso);
} }
} }
else else
{ {
grub_printf("No file found\n"); grub_printf("No file item found in json.\n");
} }
} }
} }
@ -1385,7 +1469,7 @@ static int ventoy_plugin_conf_replace_check(VTOY_JSON *json, const char *isodisk
{ {
grub_printf("iso:<%s> [OK]\n", isof); grub_printf("iso:<%s> [OK]\n", isof);
grub_snprintf(cmd, sizeof(cmd), "loopback vtisocheck %s%s", isodisk, isof); grub_snprintf(cmd, sizeof(cmd), "loopback vtisocheck \"%s%s\"", isodisk, isof);
grub_script_execute_sourcecode(cmd); grub_script_execute_sourcecode(cmd);
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(vtisocheck)/%s", orgf); file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(vtisocheck)/%s", orgf);
@ -1695,10 +1779,10 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
grub_free(buf); grub_free(buf);
if (g_boot_pwd) if (g_boot_pwd.type)
{ {
grub_printf("\n\n\n\n"); grub_printf("\n\n======= %s ======\n\n", grub_env_get("VTOY_TEXT_MENU_VER"));
if (ventoy_check_password(g_boot_sha256, 3)) if (ventoy_check_password(&g_boot_pwd, 3))
{ {
grub_printf("\n!!! Password check failed, will exit after 5 seconds. !!!\n"); grub_printf("\n!!! Password check failed, will exit after 5 seconds. !!!\n");
grub_refresh(); grub_refresh();
@ -2105,10 +2189,10 @@ int ventoy_plugin_load_dud(dud *node, const char *isopart)
return 0; return 0;
} }
static const grub_uint8_t * ventoy_plugin_get_password(const char *isopath) static const vtoy_password * ventoy_plugin_get_password(const char *isopath)
{ {
int len; int len;
vtoy_password *node = NULL; menu_password *node = NULL;
if ((!g_pwd_head) || (!isopath)) if ((!g_pwd_head) || (!isopath))
{ {
@ -2120,54 +2204,25 @@ static const grub_uint8_t * ventoy_plugin_get_password(const char *isopath)
{ {
if (node->pathlen == len && grub_strncmp(isopath, node->isopath, len) == 0) if (node->pathlen == len && grub_strncmp(isopath, node->isopath, len) == 0)
{ {
return node->sha256; return &(node->password);
} }
} }
return NULL; return NULL;
} }
int ventoy_check_password(const grub_uint8_t *pwdsha256, int retry)
{
char input[128];
grub_uint8_t sha256[32];
while (retry--)
{
grub_memset(input, 0, sizeof(input));
grub_printf("Enter password: ");
grub_refresh();
grub_password_get(input, sizeof(input));
grub_crypto_hash(GRUB_MD_SHA256, sha256, input, grub_strlen(input));
if (grub_memcmp(pwdsha256, sha256, 32) == 0)
{
return 0;
}
else
{
grub_printf("Invalid password!\n\n");
grub_refresh();
}
}
return 1;
}
grub_err_t ventoy_cmd_check_password(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_check_password(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int ret; int ret;
const grub_uint8_t *sha256 = NULL; const vtoy_password *pwd = NULL;
(void)ctxt; (void)ctxt;
(void)argc; (void)argc;
sha256 = ventoy_plugin_get_password(args[0]); pwd = ventoy_plugin_get_password(args[0]);
if (sha256) if (pwd)
{ {
if (0 == ventoy_check_password(sha256, 1)) if (0 == ventoy_check_password(pwd, 1))
{ {
ret = 1; ret = 1;
} }

View File

@ -1492,7 +1492,7 @@ static grub_uint32_t ventoy_get_wim_iso_offset(const char *filepath)
grub_file_t file; grub_file_t file;
char cmdbuf[128]; char cmdbuf[128];
grub_snprintf(cmdbuf, sizeof(cmdbuf), "loopback wimiso %s", filepath); grub_snprintf(cmdbuf, sizeof(cmdbuf), "loopback wimiso \"%s\"", filepath);
grub_script_execute_sourcecode(cmdbuf); grub_script_execute_sourcecode(cmdbuf);
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", "(wimiso)/boot/boot.wim"); file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", "(wimiso)/boot/boot.wim");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -92,7 +92,7 @@ terminal:
div: div:
crypto: crypto:
part_bsd: part_msdos part_bsd: part_msdos
ventoy: ext2 fshelp font crypto exfat udf extcmd normal video gcry_sha256 gcry_sha1 iso9660 ventoy: ext2 fshelp font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
gcry_sha512: crypto gcry_sha512: crypto
password: crypto normal password: crypto normal
fshelp: fshelp:

View File

@ -106,13 +106,13 @@ function get_os_type {
fi fi
if [ -n "${vtdebug_flag}" ]; then if [ -n "${vtdebug_flag}" ]; then
echo ISO is $vtoy_os echo ISO is "$vtoy_os"
fi fi
} }
function vt_check_compatible_pe { function vt_check_compatible_pe {
#Check for PE without external tools #Check for PE without external tools
if [ -f $1/HBCD_PE.ini ]; then if [ -f "$1/HBCD_PE.ini" ]; then
set ventoy_compatible=YES set ventoy_compatible=YES
fi fi
} }
@ -1382,15 +1382,15 @@ function img_common_menuentry {
ventoy_img_easyos ventoy_img_easyos
elif [ -e (vtimghd,1)/volumio.initrd ]; then elif [ -e (vtimghd,1)/volumio.initrd ]; then
ventoy_img_volumio ventoy_img_volumio
elif vt_str_begin $vtImgHd1Label "LAKKA"; then elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
ventoy_img_openelec lakka ventoy_img_openelec lakka
elif vt_str_begin $vtImgHd1Label "LIBREELEC"; then elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
ventoy_img_openelec LibreELEC ventoy_img_openelec LibreELEC
elif vt_str_begin $vtImgHd1Label "paldo-live"; then elif vt_str_begin "$vtImgHd1Label" "paldo-live"; then
ventoy_img_paldo ventoy_img_paldo
elif vt_str_begin $vtImgHostname "freedombox"; then elif vt_str_begin "$vtImgHostname" "freedombox"; then
ventoy_img_freedombox ventoy_img_freedombox
elif vt_str_begin $vtImgHd1Label "BATOCERA"; then elif vt_str_begin "$vtImgHd1Label" "BATOCERA"; then
ventoy_img_batocera ventoy_img_batocera
elif [ "$vtImgHd2Label" = "RECALBOX" ]; then elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
ventoy_img_recalbox ventoy_img_recalbox
@ -1453,14 +1453,16 @@ set VTOY_F6_CMD="ventoy_ext_menu"
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net" set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
else else
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
if [ "$grub_cpu" = "i386" ]; then if [ "$grub_cpu" = "i386" ]; then
set VTOY_EFI_ARCH=ia32 set VTOY_EFI_ARCH=ia32
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION IA32 www.ventoy.net"
elif [ "$grub_cpu" = "arm64" ]; then elif [ "$grub_cpu" = "arm64" ]; then
set VTOY_EFI_ARCH=aa64 set VTOY_EFI_ARCH=aa64
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION AA64 www.ventoy.net"
else else
set VTOY_EFI_ARCH=x64 set VTOY_EFI_ARCH=x64
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
fi fi
fi fi
@ -1505,6 +1507,7 @@ vt_load_part_table $vtoydev
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
clear clear
vt_load_plugin $vtoy_iso_part vt_load_plugin $vtoy_iso_part
clear
fi fi
if [ -n "$VTOY_MENU_TIMEOUT" ]; then if [ -n "$VTOY_MENU_TIMEOUT" ]; then

View File

@ -119,7 +119,7 @@ ehci: cs5536 usb boot
crypto: crypto:
part_bsd: part_msdos part_bsd: part_msdos
cs5536: cs5536:
ventoy: ext2 fshelp font crypto exfat udf extcmd normal video gcry_sha256 gcry_sha1 iso9660 ventoy: ext2 fshelp font crypto gcry_md5 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.

View File

@ -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 video gcry_sha256 gcry_sha1 iso9660 acpi ventoy: ext2 fshelp font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
lsapm: lsapm:
gcry_sha512: crypto gcry_sha512: crypto
password: crypto normal password: crypto normal

View File

@ -119,7 +119,7 @@ ehci: cs5536 usb boot
crypto: crypto:
part_bsd: part_msdos part_bsd: part_msdos
cs5536: cs5536:
ventoy: ext2 fshelp font crypto exfat udf extcmd normal video gcry_sha256 gcry_sha1 iso9660 ventoy: ext2 fshelp font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
gcry_sha512: crypto gcry_sha512: crypto
password: crypto normal password: crypto normal
fshelp: fshelp:

View File

@ -422,7 +422,8 @@ else
dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of=./rsvdata.bin dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of=./rsvdata.bin
if [ "$PART1_TYPE" = "EE" ]; then if [ "$PART1_TYPE" = "EE" ]; then
vtdebug "This is GPT partition style ..." vtdebug "This is GPT partition style ..."
echo -en '\x22' | dd status=none of=$DISK conv=fsync bs=1 count=1 seek=92
xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34
echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none
else else

Binary file not shown.

Binary file not shown.

View File

@ -31,12 +31,13 @@ Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
* UEFI Secure Boot supported (1.0.07+) * UEFI Secure Boot supported (1.0.07+)
* Persistence supported (1.0.11+) * Persistence supported (1.0.11+)
* Windows/Linux auto installation supported (1.0.09+) * Windows/Linux auto installation supported (1.0.09+)
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
* ISO files larger than 4GB supported * ISO files larger than 4GB supported
* Native boot menu style for Legacy & UEFI * Native boot menu style for Legacy & UEFI
* Most type of OS supported, 580+ iso files tested * Most type of OS supported, 580+ iso files tested
* Linux vDisk boot supported * Linux vDisk boot supported
* Not only boot but also complete installation process * Not only boot but also complete installation process
* Menu can be switched between List mode and TreeView mode dynamically * Menu dynamically switchable between List/TreeView mode
* "Ventoy Compatible" concept * "Ventoy Compatible" concept
* Plugin Framework * Plugin Framework
* Injection files to runtime enviroment * Injection files to runtime enviroment