mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 09:01:15 +00:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a1c6fe2d24 | ||
|
dbeb4023a2 | ||
|
58b1bbe0b5 | ||
|
86b13727ca | ||
|
006f26d07d | ||
|
9203aa1ab3 | ||
|
5291d66736 | ||
|
ba5978d298 | ||
|
7f717a7fe9 | ||
|
c57717aea2 | ||
|
be0e19fc5b | ||
|
34a36bfc3e | ||
|
82e99a3b37 | ||
|
b685431d66 | ||
|
8be8fd50b3 | ||
|
999b15c4ef | ||
|
28998edd94 | ||
|
2ad69decad | ||
|
c2cc0bd3dc | ||
|
b128a0b6d3 | ||
|
676831dbbe | ||
|
e5fa5e6d84 | ||
|
76a6b8061c | ||
|
036b58ff0c | ||
|
8e529c8559 |
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
@@ -21,7 +21,7 @@ body:
|
||||
attributes:
|
||||
label: Ventoy Version
|
||||
description: What version of ventoy are you running?
|
||||
placeholder: 1.0.63
|
||||
placeholder: 1.0.67
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -27,6 +27,10 @@ jobs:
|
||||
with:
|
||||
name: ventoy-livecd
|
||||
path: INSTALL/ventoy-*livecd*
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: SHA256SUM
|
||||
path: INSTALL/sha256.txt
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: xxx-build-log
|
||||
|
@@ -68,9 +68,17 @@ static volatile ko_param g_ko_param =
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
#if defined(CONFIG_X86_64)
|
||||
#define PATCH_OP_POS 3
|
||||
#define CODE_MATCH(code, i) \
|
||||
(code[i] == 0x40 && code[i + 1] == 0x80 && code[i + 2] == 0xce && code[i + 3] == 0x80)
|
||||
#elif defined(CONFIG_X86_32)
|
||||
#define PATCH_OP_POS 2
|
||||
#define CODE_MATCH(code, i) \
|
||||
(code[i] == 0x80 && code[i + 1] == 0xca && code[i + 2] == 0x80 && code[i + 3] == 0xe8)
|
||||
#else
|
||||
#error "unsupported arch"
|
||||
#endif
|
||||
|
||||
#define vdebug(fmt, args...) if(kprintf) kprintf(KERN_ERR fmt, ##args)
|
||||
|
||||
@@ -88,7 +96,7 @@ static int notrace dmpatch_replace_code(unsigned long addr, unsigned long size,
|
||||
{
|
||||
if (CODE_MATCH(opCode, i) && cnt < MAX_PATCH)
|
||||
{
|
||||
patch[cnt] = opCode + i + 3;
|
||||
patch[cnt] = opCode + i + PATCH_OP_POS;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
1. install ubuntu 21.10
|
||||
2. apt-get install build-essential flex ncurse linux-headers-generic linux-source ...... and so on
|
||||
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev ...... and so on
|
||||
3. cp /lib/modules/5.13.0-23-generic/build/Module.symvers ./
|
||||
4. /boot/config-5.13.0-23-generic as .config make oldconfig
|
||||
5. make menuconfig
|
||||
@@ -9,6 +9,7 @@
|
||||
6. modify ./scripts/mod/modpost.c
|
||||
1. skip add_srcversion (just return)
|
||||
2. force add_retpoline (#ifdef --> #ifndef)
|
||||
3. force add_intree_flag
|
||||
|
||||
7. make modules_prepare LOCALVERSION=-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
@@ -229,12 +229,14 @@ static void EFIAPI ventoy_dump_chain(ventoy_chain_head *chain)
|
||||
debug("os_param->vtoy_img_size=<%llu>", chain->os_param.vtoy_img_size);
|
||||
debug("os_param->vtoy_img_location_addr=<0x%llx>", chain->os_param.vtoy_img_location_addr);
|
||||
debug("os_param->vtoy_img_location_len=<%u>", chain->os_param.vtoy_img_location_len);
|
||||
debug("os_param->vtoy_reserved=<%u %u %u %u %u>",
|
||||
debug("os_param->vtoy_reserved=<%u %u %u %u %u %u %u>",
|
||||
g_os_param_reserved[0],
|
||||
g_os_param_reserved[1],
|
||||
g_os_param_reserved[2],
|
||||
g_os_param_reserved[3],
|
||||
g_os_param_reserved[4]
|
||||
g_os_param_reserved[4],
|
||||
g_os_param_reserved[5],
|
||||
g_os_param_reserved[6]
|
||||
);
|
||||
|
||||
ventoy_debug_pause();
|
||||
@@ -578,7 +580,7 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
|
||||
if (CompareMem(g_chain->os_param.vtoy_disk_guid, pBuffer + 0x180, 16) == 0)
|
||||
{
|
||||
pMBR = (MBR_HEAD *)pBuffer;
|
||||
if (pMBR->PartTbl[0].FsFlag != 0xEE)
|
||||
if (g_os_param_reserved[6] == 0 && pMBR->PartTbl[0].FsFlag != 0xEE)
|
||||
{
|
||||
if (pMBR->PartTbl[0].StartSectorId != 2048 ||
|
||||
pMBR->PartTbl[1].SectorCount != 65536 ||
|
||||
@@ -956,6 +958,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
debug("memdisk mode iso_buf_size:%u", g_iso_buf_size);
|
||||
|
||||
g_chain = chain;
|
||||
g_os_param_reserved = (UINT8 *)(g_chain->os_param.vtoy_reserved);
|
||||
gMemdiskMode = TRUE;
|
||||
}
|
||||
else
|
||||
|
@@ -1610,6 +1610,7 @@ module = {
|
||||
common = ventoy/ventoy_vhd.c;
|
||||
common = ventoy/ventoy_plugin.c;
|
||||
common = ventoy/ventoy_json.c;
|
||||
common = ventoy/ventoy_browser.c;
|
||||
common = ventoy/lzx.c;
|
||||
common = ventoy/xpress.c;
|
||||
common = ventoy/huffman.c;
|
||||
|
@@ -106,19 +106,134 @@ int ventoy_check_file_exist(const char * fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct grub_vlnk
|
||||
{
|
||||
int srclen;
|
||||
char src[512];
|
||||
char dst[512];
|
||||
struct grub_vlnk *next;
|
||||
}grub_vlnk;
|
||||
|
||||
static grub_vlnk g_vtoy_vlnk;
|
||||
static grub_vlnk *g_vlnk_list;
|
||||
|
||||
int grub_file_is_vlnk_suffix(const char *name, int len)
|
||||
{
|
||||
grub_uint32_t suffix;
|
||||
|
||||
if (len > 9)
|
||||
{
|
||||
suffix = *(grub_uint32_t *)(name + len - 4);
|
||||
if (grub_strncmp(name + len - 9, ".vlnk.", 6) == 0)
|
||||
{
|
||||
/* .iso .wim .img .vhd .efi .dat */
|
||||
if (suffix == 0x6F73692E || suffix == 0x6D69772E ||
|
||||
suffix == 0x676D692E || suffix == 0x6468762E ||
|
||||
suffix == 0x6966652E || suffix == 0x7461642E)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (len > 10 && grub_strncmp(name + len - 10, ".vlnk.", 6) == 0)
|
||||
{
|
||||
/* vhdx vtoy */
|
||||
if (suffix == 0x78646876 || suffix == 0x796F7476)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int grub_file_vtoy_vlnk(const char *src, const char *dst)
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
g_vtoy_vlnk.srclen = (int)grub_strlen(src);
|
||||
grub_strncpy(g_vtoy_vlnk.src, src, sizeof(g_vtoy_vlnk.src) - 1);
|
||||
grub_strncpy(g_vtoy_vlnk.dst, dst, sizeof(g_vtoy_vlnk.dst) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_vtoy_vlnk.srclen = 0;
|
||||
g_vtoy_vlnk.src[0] = 0;
|
||||
g_vtoy_vlnk.dst[0] = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int grub_file_add_vlnk(const char *src, const char *dst)
|
||||
{
|
||||
grub_vlnk *node = NULL;
|
||||
|
||||
if (src && dst)
|
||||
{
|
||||
node = grub_zalloc(sizeof(grub_vlnk));
|
||||
if (node)
|
||||
{
|
||||
node->srclen = (int)grub_strlen(src);
|
||||
grub_strncpy(node->src, src, sizeof(node->src) - 1);
|
||||
grub_strncpy(node->dst, dst, sizeof(node->dst) - 1);
|
||||
|
||||
node->next = g_vlnk_list;
|
||||
g_vlnk_list = node;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *grub_file_get_vlnk(const char *name, int *vlnk)
|
||||
{
|
||||
int len;
|
||||
grub_vlnk *node = g_vlnk_list;
|
||||
|
||||
len = grub_strlen(name);
|
||||
|
||||
if (!grub_file_is_vlnk_suffix(name, len))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
if (len == g_vtoy_vlnk.srclen && grub_strcmp(name, g_vtoy_vlnk.src) == 0)
|
||||
{
|
||||
*vlnk = 1;
|
||||
return g_vtoy_vlnk.dst;
|
||||
}
|
||||
|
||||
while (node)
|
||||
{
|
||||
if (node->srclen == len && grub_strcmp(name, node->src) == 0)
|
||||
{
|
||||
*vlnk = 1;
|
||||
return node->dst;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
grub_file_t
|
||||
grub_file_open (const char *name, enum grub_file_type type)
|
||||
{
|
||||
int vlnk = 0;
|
||||
grub_device_t device = 0;
|
||||
grub_file_t file = 0, last_file = 0;
|
||||
char *device_name;
|
||||
const char *file_name;
|
||||
grub_file_filter_id_t filter;
|
||||
|
||||
/* <DESC> : mem:xxx:size:xxx format in chainloader */
|
||||
if (grub_strncmp(name, GRUB_MEMFILE_MEM, grub_strlen(GRUB_MEMFILE_MEM)) == 0) {
|
||||
/* <DESC> : mem:xxx:size:xxx format in chainloader grub_strlen(GRUB_MEMFILE_MEM) */
|
||||
if (grub_strncmp(name, GRUB_MEMFILE_MEM, 4) == 0) {
|
||||
return grub_memfile_open(name);
|
||||
}
|
||||
}
|
||||
|
||||
if ((g_vlnk_list || g_vtoy_vlnk.srclen) && (type & GRUB_FILE_TYPE_NO_VLNK) == 0)
|
||||
name = grub_file_get_vlnk(name, &vlnk);
|
||||
|
||||
device_name = grub_file_get_device_name (name);
|
||||
if (grub_errno)
|
||||
@@ -141,6 +256,7 @@ grub_file_open (const char *name, enum grub_file_type type)
|
||||
goto fail;
|
||||
|
||||
file->device = device;
|
||||
file->vlnk = vlnk;
|
||||
|
||||
/* In case of relative pathnames and non-Unix systems (like Windows)
|
||||
* name of host files may not start with `/'. Blocklists for host files
|
||||
|
@@ -42,6 +42,44 @@ probe_dummy_iter (const char *filename __attribute__ ((unused)),
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_fs_t grub_fs_list_probe(grub_device_t device, const char **list)
|
||||
{
|
||||
int i;
|
||||
grub_fs_t p;
|
||||
|
||||
if (!device->disk)
|
||||
return 0;
|
||||
|
||||
for (p = grub_fs_list; p; p = p->next)
|
||||
{
|
||||
for (i = 0; list[i]; i++)
|
||||
{
|
||||
if (grub_strcmp(p->name, list[i]) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (list[i] == NULL)
|
||||
continue;
|
||||
|
||||
grub_dprintf("fs", "Detecting %s...\n", p->name);
|
||||
|
||||
(p->fs_dir) (device, "/", probe_dummy_iter, NULL);
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
return p;
|
||||
|
||||
grub_error_push ();
|
||||
grub_dprintf ("fs", "%s detection failed.\n", p->name);
|
||||
grub_error_pop ();
|
||||
|
||||
if (grub_errno != GRUB_ERR_BAD_FS && grub_errno != GRUB_ERR_OUT_OF_RANGE) {
|
||||
return 0;
|
||||
}
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_fs_t
|
||||
grub_fs_probe (grub_device_t device)
|
||||
{
|
||||
|
@@ -671,9 +671,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
|
||||
if (g_ventoy_suppress_esc)
|
||||
default_entry = g_ventoy_suppress_esc_default;
|
||||
else if (g_ventoy_last_entry >= 0 && g_ventoy_last_entry < menu->size) {
|
||||
default_entry = g_ventoy_last_entry;
|
||||
}
|
||||
|
||||
/* If DEFAULT_ENTRY is not within the menu entries, fall back to
|
||||
the first entry. */
|
||||
else if (default_entry < 0 || default_entry >= menu->size)
|
||||
|
500
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
Normal file
500
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
Normal file
@@ -0,0 +1,500 @@
|
||||
/******************************************************************************
|
||||
* ventoy_browser.c
|
||||
*
|
||||
* Copyright (c) 2022, longpanda <admin@ventoy.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/net.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/ventoy.h>
|
||||
#include "ventoy_def.h"
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define BROWSER_MENU_BUF 65536
|
||||
|
||||
static grub_fs_t g_menu_fs = NULL;
|
||||
static char *g_menu_device = NULL;
|
||||
static char g_menu_path_buf[1024];
|
||||
static int g_menu_path_len = 0;
|
||||
static browser_node *g_browser_list = NULL;
|
||||
|
||||
static int ventoy_browser_strcmp(char *str1, char *str2)
|
||||
{
|
||||
char *s1, *s2;
|
||||
int c1 = 0;
|
||||
int c2 = 0;
|
||||
|
||||
for (s1 = str1, s2 = str2; *s1 && *s2; s1++, s2++)
|
||||
{
|
||||
c1 = *s1;
|
||||
c2 = *s2;
|
||||
|
||||
if (0 == g_sort_case_sensitive)
|
||||
{
|
||||
if (grub_islower(c1))
|
||||
{
|
||||
c1 = c1 - 'a' + 'A';
|
||||
}
|
||||
|
||||
if (grub_islower(c2))
|
||||
{
|
||||
c2 = c2 - 'a' + 'A';
|
||||
}
|
||||
}
|
||||
|
||||
if (c1 != c2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (c1 - c2);
|
||||
}
|
||||
|
||||
static int ventoy_browser_mbuf_alloc(browser_mbuf *mbuf)
|
||||
{
|
||||
grub_memset(mbuf, 0, sizeof(browser_mbuf));
|
||||
mbuf->buf = grub_malloc(BROWSER_MENU_BUF);
|
||||
if (!mbuf->buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mbuf->pos = 0;
|
||||
mbuf->max = BROWSER_MENU_BUF;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ventoy_browser_mbuf_free(browser_mbuf *mbuf)
|
||||
{
|
||||
if (mbuf)
|
||||
grub_check_free(mbuf->buf)
|
||||
}
|
||||
|
||||
static int ventoy_browser_mbuf_extend(browser_mbuf *mbuf)
|
||||
{
|
||||
if (mbuf->max - mbuf->pos <= VTOY_SIZE_1KB)
|
||||
{
|
||||
mbuf->max += BROWSER_MENU_BUF;
|
||||
mbuf->buf = grub_realloc(mbuf->buf, mbuf->max);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static browser_node * ventoy_browser_find_top_node(int dir)
|
||||
{
|
||||
browser_node *node = NULL;
|
||||
browser_node *sel = NULL;
|
||||
|
||||
for (node = g_browser_list; node; node = node->next)
|
||||
{
|
||||
if (node->dir == dir)
|
||||
{
|
||||
if (sel)
|
||||
{
|
||||
if (ventoy_browser_strcmp(sel->filename, node->filename) > 0)
|
||||
{
|
||||
sel = node;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sel;
|
||||
}
|
||||
|
||||
static int ventoy_browser_check_filename(const char *filename, int len, int *type)
|
||||
{
|
||||
if (len < 4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (FILE_FLT(ISO) && 0 == grub_strcasecmp(filename + len - 4, ".iso"))
|
||||
{
|
||||
*type = img_type_iso;
|
||||
}
|
||||
else if (FILE_FLT(WIM) && g_wimboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".wim")))
|
||||
{
|
||||
*type = img_type_wim;
|
||||
}
|
||||
else if (FILE_FLT(VHD) && g_vhdboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".vhd") ||
|
||||
(len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vhdx"))))
|
||||
{
|
||||
*type = img_type_vhd;
|
||||
}
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
else if (FILE_FLT(EFI) && 0 == grub_strcasecmp(filename + len - 4, ".efi"))
|
||||
{
|
||||
*type = img_type_efi;
|
||||
}
|
||||
#endif
|
||||
else if (FILE_FLT(IMG) && 0 == grub_strcasecmp(filename + len - 4, ".img"))
|
||||
{
|
||||
if (len == 18 && grub_strncmp(filename, "ventoy_", 7) == 0)
|
||||
{
|
||||
if (grub_strncmp(filename + 7, "wimboot", 7) == 0 ||
|
||||
grub_strncmp(filename + 7, "vhdboot", 7) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*type = img_type_img;
|
||||
}
|
||||
else if (FILE_FLT(VTOY) && len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vtoy"))
|
||||
{
|
||||
*type = img_type_vtoy;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_filt_dot_underscore_file && filename[0] == '.' && filename[1] == '_')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int type;
|
||||
int len;
|
||||
browser_node *node;
|
||||
|
||||
(void)data;
|
||||
|
||||
len = grub_strlen(filename);
|
||||
|
||||
if (info->dir)
|
||||
{
|
||||
if ((len == 1 && filename[0] == '.') ||
|
||||
(len == 2 && filename[0] == '.' && filename[1] == '.'))
|
||||
{
|
||||
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));
|
||||
if (!node)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
node->dir = 1;
|
||||
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
||||
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||
"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_uint64_t fsize;
|
||||
grub_file_t file = NULL;
|
||||
|
||||
if (ventoy_browser_check_filename(filename, len, &type) == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
node = grub_zalloc(sizeof(browser_node));
|
||||
if (!node)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
node->dir = 0;
|
||||
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]);
|
||||
|
||||
}
|
||||
|
||||
node->prev = NULL;
|
||||
node->next = g_browser_list;
|
||||
if (g_browser_list)
|
||||
{
|
||||
g_browser_list->prev = node;
|
||||
}
|
||||
g_browser_list = node;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
grub_fs_t fs;
|
||||
grub_device_t dev;
|
||||
char cfgfile[64];
|
||||
browser_node *node;
|
||||
browser_mbuf mbuf;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (!ventoy_browser_mbuf_alloc(&mbuf))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
fs = (grub_fs_t)grub_strtoul(args[1], NULL, 16);
|
||||
if (!fs)
|
||||
{
|
||||
debug("Invalid fs %s\n", args[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dev = grub_device_open(args[0]);
|
||||
if (!dev)
|
||||
{
|
||||
debug("Failed to open device %s\n", args[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_menu_fs = fs;
|
||||
g_menu_device = args[0];
|
||||
g_browser_list = NULL;
|
||||
|
||||
if (args[2][0] == '/' && args[2][1] == 0)
|
||||
{
|
||||
g_menu_path_len = 0;
|
||||
g_menu_path_buf[0] = 0;
|
||||
fs->fs_dir(dev, "/", ventoy_browser_iterate_dir, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_menu_path_len = grub_snprintf(g_menu_path_buf, sizeof(g_menu_path_buf), "%s", args[2]);
|
||||
fs->fs_dir(dev, g_menu_path_buf, ventoy_browser_iterate_dir, NULL);
|
||||
}
|
||||
grub_device_close(dev);
|
||||
|
||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||
" echo 'return ...' \n}\n", "<--");
|
||||
|
||||
for (i = 1; i >= 0; i--)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
node = ventoy_browser_find_top_node(i);
|
||||
if (node)
|
||||
{
|
||||
grub_printf("Find Node <%s>\n", node->filename);
|
||||
browser_ssprintf(&mbuf, "%s", node->menuentry);
|
||||
if (node->prev)
|
||||
{
|
||||
node->prev->next = node->next;
|
||||
}
|
||||
if (node->next)
|
||||
{
|
||||
node->next->prev = node->prev;
|
||||
}
|
||||
|
||||
if (node == g_browser_list)
|
||||
{
|
||||
g_browser_list = node->next;
|
||||
}
|
||||
grub_free(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_browser_list = NULL;
|
||||
|
||||
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%lx:size:%d", (ulong)mbuf.buf, mbuf.pos);
|
||||
grub_script_execute_sourcecode(cfgfile);
|
||||
|
||||
ventoy_browser_mbuf_free(&mbuf);
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
char cfgfile[64];
|
||||
browser_mbuf mbuf;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (!ventoy_browser_mbuf_alloc(&mbuf))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||
" echo 'return ...' \n}\n", "<--");
|
||||
|
||||
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);
|
||||
|
||||
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%lx:size:%d", (ulong)mbuf.buf, mbuf.pos);
|
||||
grub_script_execute_sourcecode(cfgfile);
|
||||
|
||||
ventoy_browser_mbuf_free(&mbuf);
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
@@ -102,6 +102,7 @@ ventoy_img_chunk_list g_img_chunk_list;
|
||||
int g_wimboot_enable = 0;
|
||||
ventoy_img_chunk_list g_wimiso_chunk_list;
|
||||
char *g_wimiso_path = NULL;
|
||||
grub_uint32_t g_wimiso_size = 0;
|
||||
|
||||
int g_vhdboot_enable = 0;
|
||||
|
||||
@@ -124,6 +125,7 @@ static int g_list_script_pos = 0;
|
||||
|
||||
static char *g_part_list_buf = NULL;
|
||||
static int g_part_list_pos = 0;
|
||||
static grub_uint64_t g_part_end_max = 0;
|
||||
|
||||
static int g_video_mode_max = 0;
|
||||
static int g_video_mode_num = 0;
|
||||
@@ -132,14 +134,14 @@ static ventoy_video_mode *g_video_mode_list = NULL;
|
||||
static int g_enumerate_time_checked = 0;
|
||||
static grub_uint64_t g_enumerate_start_time_ms;
|
||||
static grub_uint64_t g_enumerate_finish_time_ms;
|
||||
static int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT] = {0};
|
||||
int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT] = {0};
|
||||
|
||||
static int g_pager_flag = 0;
|
||||
static char g_old_pager[32];
|
||||
|
||||
static const char *g_vtoy_winpeshl_ini = "[LaunchApps]\r\nvtoyjump.exe";
|
||||
|
||||
static const char *g_menu_class[] =
|
||||
const char *g_menu_class[img_type_max] =
|
||||
{
|
||||
"vtoyiso", "vtoywim", "vtoyefi", "vtoyimg", "vtoyvhd", "vtoyvtoy"
|
||||
};
|
||||
@@ -154,7 +156,9 @@ static char g_vtoy_prompt_msg[64];
|
||||
|
||||
static char g_json_case_mis_path[32];
|
||||
|
||||
static int ventoy_get_fs_type(const char *fs)
|
||||
static ventoy_vlnk_part *g_vlnk_part_list = NULL;
|
||||
|
||||
int ventoy_get_fs_type(const char *fs)
|
||||
{
|
||||
if (NULL == fs)
|
||||
{
|
||||
@@ -682,10 +686,10 @@ grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...
|
||||
{
|
||||
va_list ap;
|
||||
grub_file_t file;
|
||||
char fullpath[256] = {0};
|
||||
char fullpath[512] = {0};
|
||||
|
||||
va_start (ap, fmt);
|
||||
grub_vsnprintf(fullpath, 255, fmt, ap);
|
||||
grub_vsnprintf(fullpath, 511, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
file = grub_file_open(fullpath, type);
|
||||
@@ -698,44 +702,18 @@ grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...
|
||||
return file;
|
||||
}
|
||||
|
||||
int ventoy_is_file_exist(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int len;
|
||||
char *pos = NULL;
|
||||
char buf[256] = {0};
|
||||
|
||||
grub_snprintf(buf, sizeof(buf), "%s", "[ -f \"");
|
||||
pos = buf + 6;
|
||||
|
||||
va_start (ap, fmt);
|
||||
len = grub_vsnprintf(pos, 255, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
grub_strncpy(pos + len, "\" ]", 3);
|
||||
|
||||
debug("script exec %s\n", buf);
|
||||
|
||||
if (0 == grub_script_execute_sourcecode(buf))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ventoy_is_dir_exist(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int len;
|
||||
char *pos = NULL;
|
||||
char buf[256] = {0};
|
||||
char buf[512] = {0};
|
||||
|
||||
grub_snprintf(buf, sizeof(buf), "%s", "[ -d \"");
|
||||
pos = buf + 6;
|
||||
|
||||
va_start (ap, fmt);
|
||||
len = grub_vsnprintf(pos, 255, fmt, ap);
|
||||
len = grub_vsnprintf(pos, 511, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
grub_strncpy(pos + len, "\" ]", 3);
|
||||
@@ -1006,6 +984,7 @@ static grub_err_t ventoy_cmd_load_wimboot(grub_extcmd_context_t ctxt, int argc,
|
||||
(void)args;
|
||||
|
||||
g_wimboot_enable = 0;
|
||||
g_wimiso_size = 0;
|
||||
grub_check_free(g_wimiso_path);
|
||||
grub_check_free(g_wimiso_chunk_list.chunk);
|
||||
|
||||
@@ -1029,7 +1008,7 @@ static grub_err_t ventoy_cmd_load_wimboot(grub_extcmd_context_t ctxt, int argc,
|
||||
|
||||
g_wimboot_enable = 1;
|
||||
g_wimiso_path = grub_strdup(args[0]);
|
||||
|
||||
g_wimiso_size = (grub_uint32_t)(file->size);
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
@@ -1073,6 +1052,11 @@ static grub_err_t ventoy_cmd_concat_efi_iso(grub_extcmd_context_t ctxt, int argc
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (grub_strncmp(args[0], g_iso_path, grub_strlen(g_iso_path)))
|
||||
{
|
||||
file->vlnk = 1;
|
||||
}
|
||||
|
||||
totlen += ventoy_align_2k(file->size);
|
||||
|
||||
dirent = (ventoy_iso9660_override *)(buf + offset);
|
||||
@@ -1598,7 +1582,7 @@ void ventoy_swap_img(img_info *img1, img_info *img2)
|
||||
grub_memcpy(img2, &g_img_swap_tmp, sizeof(img_info));
|
||||
}
|
||||
|
||||
static int ventoy_img_name_valid(const char *filename, grub_size_t namelen)
|
||||
int ventoy_img_name_valid(const char *filename, grub_size_t namelen)
|
||||
{
|
||||
(void)namelen;
|
||||
|
||||
@@ -1610,12 +1594,231 @@ static int ventoy_img_name_valid(const char *filename, grub_size_t namelen)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ventoy_vlnk_iterate_partition(struct grub_disk *disk, const grub_partition_t partition, void *data)
|
||||
{
|
||||
ventoy_vlnk_part *node = NULL;
|
||||
grub_uint32_t *pSig = (grub_uint32_t *)data;
|
||||
|
||||
node = grub_zalloc(sizeof(ventoy_vlnk_part));
|
||||
if (node)
|
||||
{
|
||||
node->disksig = *pSig;
|
||||
node->partoffset = (partition->start << GRUB_DISK_SECTOR_BITS);
|
||||
grub_snprintf(node->disk, sizeof(node->disk) - 1, "%s", disk->name);
|
||||
grub_snprintf(node->device, sizeof(node->device) - 1, "%s,%d", disk->name, partition->number + 1);
|
||||
|
||||
node->next = g_vlnk_part_list;
|
||||
g_vlnk_part_list = node;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_vlnk_iterate_disk(const char *name, void *data)
|
||||
{
|
||||
grub_disk_t disk;
|
||||
grub_uint32_t sig;
|
||||
|
||||
(void)data;
|
||||
|
||||
disk = grub_disk_open(name);
|
||||
if (disk)
|
||||
{
|
||||
grub_disk_read(disk, 0, 0x1b8, 4, &sig);
|
||||
|
||||
/* skip ventoy device self */
|
||||
if (sig != *(grub_uint32_t *)data)
|
||||
{
|
||||
grub_partition_iterate(disk, ventoy_vlnk_iterate_partition, &sig);
|
||||
}
|
||||
|
||||
grub_disk_close(disk);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_vlnk_probe_fs(ventoy_vlnk_part *cur)
|
||||
{
|
||||
const char *fs[ventoy_fs_max + 1] =
|
||||
{
|
||||
"exfat", "ntfs", "ext2", "xfs", "udf", "fat", NULL
|
||||
};
|
||||
|
||||
if (!cur->dev)
|
||||
{
|
||||
cur->dev = grub_device_open(cur->device);
|
||||
}
|
||||
|
||||
if (cur->dev)
|
||||
{
|
||||
cur->fs = grub_fs_list_probe(cur->dev, fs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_check_vlnk_data(ventoy_vlnk *vlnk, int print, char *dst, int size)
|
||||
{
|
||||
int diskfind = 0;
|
||||
int partfind = 0;
|
||||
int filefind = 0;
|
||||
char *disk, *device;
|
||||
grub_uint32_t readcrc, calccrc;
|
||||
ventoy_vlnk_part *cur;
|
||||
grub_fs_t fs = NULL;
|
||||
|
||||
if (grub_memcmp(&(vlnk->guid), &g_ventoy_guid, sizeof(ventoy_guid)))
|
||||
{
|
||||
if (print)
|
||||
{
|
||||
grub_printf("VLNK invalid guid\n");
|
||||
grub_refresh();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
readcrc = vlnk->crc32;
|
||||
vlnk->crc32 = 0;
|
||||
calccrc = grub_getcrc32c(0, vlnk, sizeof(ventoy_vlnk));
|
||||
if (readcrc != calccrc)
|
||||
{
|
||||
if (print)
|
||||
{
|
||||
grub_printf("VLNK invalid crc 0x%08x 0x%08x\n", calccrc, readcrc);
|
||||
grub_refresh();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!g_vlnk_part_list)
|
||||
{
|
||||
grub_disk_dev_iterate(ventoy_vlnk_iterate_disk, g_ventoy_part_info->MBR.BootCode + 0x1b8);
|
||||
}
|
||||
|
||||
for (cur = g_vlnk_part_list; cur && filefind == 0; cur = cur->next)
|
||||
{
|
||||
if (cur->disksig == vlnk->disk_signature)
|
||||
{
|
||||
diskfind = 1;
|
||||
disk = cur->disk;
|
||||
if (cur->partoffset == vlnk->part_offset)
|
||||
{
|
||||
partfind = 1;
|
||||
device = cur->device;
|
||||
|
||||
if (cur->probe == 0)
|
||||
{
|
||||
cur->probe = 1;
|
||||
ventoy_vlnk_probe_fs(cur);
|
||||
}
|
||||
|
||||
if (!fs)
|
||||
{
|
||||
fs = cur->fs;
|
||||
}
|
||||
|
||||
if (cur->fs)
|
||||
{
|
||||
struct grub_file file;
|
||||
|
||||
grub_memset(&file, 0, sizeof(file));
|
||||
file.device = cur->dev;
|
||||
if (cur->fs->fs_open(&file, vlnk->filepath) == GRUB_ERR_NONE)
|
||||
{
|
||||
filefind = 1;
|
||||
cur->fs->fs_close(&file);
|
||||
grub_snprintf(dst, size - 1, "(%s)%s", cur->device, vlnk->filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (print)
|
||||
{
|
||||
grub_printf("\n==== VLNK Information ====\n"
|
||||
"Disk Signature: %08x\n"
|
||||
"Partition Offset: %llu\n"
|
||||
"File Path: <%s>\n\n",
|
||||
vlnk->disk_signature, (ulonglong)vlnk->part_offset, vlnk->filepath);
|
||||
|
||||
if (diskfind)
|
||||
{
|
||||
grub_printf("Disk Find: [ YES ] [ %s ]\n", disk);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_printf("Disk Find: [ NO ]\n");
|
||||
}
|
||||
|
||||
if (partfind)
|
||||
{
|
||||
grub_printf("Part Find: [ YES ] [ %s ] [ %s ]\n", device, fs ? fs->name : "N/A");
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_printf("Part Find: [ NO ]\n");
|
||||
}
|
||||
grub_printf("File Find: [ %s ]\n", filefind ? "YES" : "NO");
|
||||
if (filefind)
|
||||
{
|
||||
grub_printf("VLNK File: <%s>\n", dst);
|
||||
}
|
||||
|
||||
grub_printf("\n");
|
||||
grub_refresh();
|
||||
}
|
||||
|
||||
return (1 - filefind);
|
||||
}
|
||||
|
||||
int ventoy_add_vlnk_file(char *dir, const char *name)
|
||||
{
|
||||
int rc = 1;
|
||||
char src[512];
|
||||
char dst[512];
|
||||
grub_file_t file = NULL;
|
||||
ventoy_vlnk vlnk;
|
||||
|
||||
if (!dir)
|
||||
{
|
||||
grub_snprintf(src, sizeof(src), "%s%s", g_iso_path, name);
|
||||
}
|
||||
else if (dir[0] == '/')
|
||||
{
|
||||
grub_snprintf(src, sizeof(src), "%s%s%s", g_iso_path, dir, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_snprintf(src, sizeof(src), "%s/%s%s", g_iso_path, dir, name);
|
||||
}
|
||||
|
||||
file = grub_file_open(src, VENTOY_FILE_TYPE);
|
||||
if (!file)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_memset(&vlnk, 0, sizeof(vlnk));
|
||||
grub_file_read(file, &vlnk, sizeof(vlnk));
|
||||
grub_file_close(file);
|
||||
|
||||
if (ventoy_check_vlnk_data(&vlnk, 0, dst, sizeof(dst)) == 0)
|
||||
{
|
||||
rc = grub_file_add_vlnk(src, dst);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ventoy_collect_img_files(const char *filename, const struct grub_dirhook_info *info, void *data)
|
||||
{
|
||||
//int i = 0;
|
||||
int type = 0;
|
||||
int ignore = 0;
|
||||
int index = 0;
|
||||
int vlnk = 0;
|
||||
grub_size_t len;
|
||||
img_info *img;
|
||||
img_info *tail;
|
||||
@@ -1784,6 +1987,18 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->size == VTOY_FILT_MIN_FILE_SIZE || info->size == 0)
|
||||
{
|
||||
if (grub_file_is_vlnk_suffix(filename, len))
|
||||
{
|
||||
vlnk = 1;
|
||||
if (ventoy_add_vlnk_file(node->dir, filename) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
img = grub_zalloc(sizeof(img_info));
|
||||
if (img)
|
||||
@@ -1795,9 +2010,16 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
|
||||
img->pathlen = grub_snprintf(img->path, sizeof(img->path), "%s%s", node->dir, img->name);
|
||||
|
||||
img->size = info->size;
|
||||
if (0 == img->size)
|
||||
if (vlnk || 0 == img->size)
|
||||
{
|
||||
img->size = ventoy_grub_get_file_size("%s/%s%s", g_iso_path, node->dir, filename);
|
||||
if (node->dir[0] == '/')
|
||||
{
|
||||
img->size = ventoy_grub_get_file_size("%s%s%s", g_iso_path, node->dir, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
img->size = ventoy_grub_get_file_size("%s/%s%s", g_iso_path, node->dir, filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (img->size < VTOY_FILT_MIN_FILE_SIZE)
|
||||
@@ -2342,6 +2564,40 @@ static grub_err_t ventoy_cmd_ext_select_img_path(grub_extcmd_context_t ctxt, int
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static char g_fake_vlnk_src[512];
|
||||
static char g_fake_vlnk_dst[512];
|
||||
static grub_uint64_t g_fake_vlnk_size;
|
||||
static grub_err_t ventoy_cmd_set_fake_vlnk(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
g_fake_vlnk_size = (grub_uint64_t)grub_strtoull(args[2], NULL, 10);
|
||||
|
||||
grub_strncpy(g_fake_vlnk_dst, args[0], sizeof(g_fake_vlnk_dst));
|
||||
grub_snprintf(g_fake_vlnk_src, sizeof(g_fake_vlnk_src), "%s/________VENTOYVLNK.vlnk.%s", g_iso_path, args[1]);
|
||||
|
||||
grub_file_vtoy_vlnk(g_fake_vlnk_src, g_fake_vlnk_dst);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_reset_fake_vlnk(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
g_fake_vlnk_src[0] = 0;
|
||||
g_fake_vlnk_dst[0] = 0;
|
||||
g_fake_vlnk_size = 0;
|
||||
grub_file_vtoy_vlnk(NULL, NULL);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
char value[32];
|
||||
@@ -2356,6 +2612,18 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s {var}", cmd_raw_name);
|
||||
}
|
||||
|
||||
if (g_fake_vlnk_src[0] && g_fake_vlnk_dst[0])
|
||||
{
|
||||
grub_env_set(args[0], grub_strchr(g_fake_vlnk_src, '/'));
|
||||
if (argc > 1)
|
||||
{
|
||||
grub_snprintf(value, sizeof(value), "%llu", (ulonglong)(g_fake_vlnk_size));
|
||||
grub_env_set(args[1], value);
|
||||
}
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
id = grub_env_get("chosen");
|
||||
|
||||
pos = grub_strstr(id, "VID_");
|
||||
@@ -2381,6 +2649,7 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
|
||||
grub_env_set(args[1], value);
|
||||
}
|
||||
|
||||
end:
|
||||
g_svd_replace_offset = 0;
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
@@ -2802,6 +3071,10 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
|
||||
param->vtoy_reserved[5] = 1;
|
||||
}
|
||||
|
||||
/* ventoy_disk_signature used for vlnk */
|
||||
param->vtoy_reserved[6] = file->vlnk;
|
||||
grub_memcpy(param->vtoy_reserved + 7, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||
|
||||
/* calculate checksum */
|
||||
for (i = 0; i < sizeof(ventoy_os_param); i++)
|
||||
{
|
||||
@@ -3646,6 +3919,7 @@ end:
|
||||
|
||||
static int ventoy_img_partition_callback (struct grub_disk *disk, const grub_partition_t partition, void *data)
|
||||
{
|
||||
grub_uint64_t end_max = 0;
|
||||
int *pCnt = (int *)data;
|
||||
|
||||
(void)disk;
|
||||
@@ -3654,6 +3928,12 @@ static int ventoy_img_partition_callback (struct grub_disk *disk, const grub_par
|
||||
g_part_list_pos += grub_snprintf(g_part_list_buf + g_part_list_pos, VTOY_MAX_SCRIPT_BUF - g_part_list_pos,
|
||||
"0 %llu linear /dev/ventoy %llu\n",
|
||||
(ulonglong)partition->len, (ulonglong)partition->start);
|
||||
|
||||
end_max = (partition->len + partition->start) * 512;
|
||||
if (end_max > g_part_end_max)
|
||||
{
|
||||
g_part_end_max = end_max;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3668,6 +3948,7 @@ static grub_err_t ventoy_cmd_img_part_info(grub_extcmd_context_t ctxt, int argc,
|
||||
(void)ctxt;
|
||||
|
||||
g_part_list_pos = 0;
|
||||
g_part_end_max = 0;
|
||||
grub_env_unset("vtoy_img_part_file");
|
||||
|
||||
if (argc != 1)
|
||||
@@ -3696,6 +3977,9 @@ static grub_err_t ventoy_cmd_img_part_info(grub_extcmd_context_t ctxt, int argc,
|
||||
|
||||
grub_snprintf(buf, sizeof(buf), "%d", cnt);
|
||||
grub_env_set("vtoy_img_part_cnt", buf);
|
||||
|
||||
grub_snprintf(buf, sizeof(buf), "%llu", (ulonglong)g_part_end_max);
|
||||
grub_env_set("vtoy_img_max_part_end", buf);
|
||||
|
||||
end:
|
||||
|
||||
@@ -5072,6 +5356,114 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_err_t grub_cmd_vlnk_dump_part(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int n = 0;
|
||||
ventoy_vlnk_part *node;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
for (node = g_vlnk_part_list; node; node = node->next)
|
||||
{
|
||||
grub_printf("[%d] %s disksig:%08x offset:%llu fs:%s\n",
|
||||
++n, node->device, node->disksig,
|
||||
(ulonglong)node->partoffset, (node->fs ? node->fs->name : "N/A"));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t grub_cmd_is_vlnk_name(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
len = (int)grub_strlen(args[0]);
|
||||
if (grub_file_is_vlnk_suffix(args[0], len))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static grub_err_t grub_cmd_get_vlnk_dst(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int vlnk = 0;
|
||||
const char *name = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
grub_env_unset(args[1]);
|
||||
name = grub_file_get_vlnk(args[0], &vlnk);
|
||||
if (vlnk)
|
||||
{
|
||||
debug("VLNK SRC: <%s>\n", args[0]);
|
||||
debug("VLNK DST: <%s>\n", name);
|
||||
grub_env_set(args[1], name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static grub_err_t grub_cmd_check_vlnk(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int ret = 1;
|
||||
int len = 0;
|
||||
grub_file_t file = NULL;
|
||||
ventoy_vlnk vlnk;
|
||||
char dst[512];
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
len = (int)grub_strlen(args[0]);
|
||||
if (!grub_file_is_vlnk_suffix(args[0], len))
|
||||
{
|
||||
grub_printf("Invalid vlnk suffix\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
file = grub_file_open(args[0], VENTOY_FILE_TYPE | GRUB_FILE_TYPE_NO_VLNK);
|
||||
if (!file)
|
||||
{
|
||||
grub_printf("Failed to open %s\n", args[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (file->size != 32768)
|
||||
{
|
||||
grub_printf("Invalid vlnk file (size=%llu).\n", (ulonglong)file->size);
|
||||
goto out;
|
||||
}
|
||||
|
||||
grub_memset(&vlnk, 0, sizeof(vlnk));
|
||||
grub_file_read(file, &vlnk, sizeof(vlnk));
|
||||
|
||||
ret = ventoy_check_vlnk_data(&vlnk, 1, dst, sizeof(dst));
|
||||
|
||||
out:
|
||||
|
||||
grub_refresh();
|
||||
check_free(file, grub_file_close);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ventoy_env_init(void)
|
||||
{
|
||||
char buf[64];
|
||||
@@ -5123,6 +5515,8 @@ int ventoy_env_init(void)
|
||||
|
||||
static cmd_para ventoy_cmds[] =
|
||||
{
|
||||
{ "vt_browser_disk", ventoy_cmd_browser_disk, 0, NULL, "", "", NULL },
|
||||
{ "vt_browser_dir", ventoy_cmd_browser_dir, 0, NULL, "", "", NULL },
|
||||
{ "vt_incr", ventoy_cmd_incr, 0, NULL, "{Var} {INT}", "Increase integer variable", NULL },
|
||||
{ "vt_mod", ventoy_cmd_mod, 0, NULL, "{Int} {Int} {Var}", "mod integer variable", NULL },
|
||||
{ "vt_strstr", ventoy_cmd_strstr, 0, NULL, "", "", NULL },
|
||||
@@ -5259,6 +5653,12 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_append_extra_sector", ventoy_cmd_append_ext_sector, 0, NULL, "", "", NULL },
|
||||
{ "gptpriority", grub_cmd_gptpriority, 0, NULL, "", "", NULL },
|
||||
{ "vt_syslinux_need_nojoliet", grub_cmd_syslinux_nojoliet, 0, NULL, "", "", NULL },
|
||||
{ "vt_vlnk_check", grub_cmd_check_vlnk, 0, NULL, "", "", NULL },
|
||||
{ "vt_vlnk_dump_part", grub_cmd_vlnk_dump_part, 0, NULL, "", "", NULL },
|
||||
{ "vt_is_vlnk_name", grub_cmd_is_vlnk_name, 0, NULL, "", "", NULL },
|
||||
{ "vt_get_vlnk_dst", grub_cmd_get_vlnk_dst, 0, NULL, "", "", NULL },
|
||||
{ "vt_set_fake_vlnk", ventoy_cmd_set_fake_vlnk, 0, NULL, "", "", NULL },
|
||||
{ "vt_reset_fake_vlnk", ventoy_cmd_reset_fake_vlnk, 0, NULL, "", "", NULL },
|
||||
};
|
||||
|
||||
int ventoy_register_all_cmd(void)
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#define VTOY_SIZE_4MB (4 * 1024 * 1024)
|
||||
#define VTOY_SIZE_512KB (512 * 1024)
|
||||
#define VTOY_SIZE_1KB 1024
|
||||
#define VTOY_SIZE_32KB (32 * 1024)
|
||||
|
||||
#define JSON_SUCCESS 0
|
||||
#define JSON_FAILED 1
|
||||
@@ -304,6 +305,7 @@ extern ventoy_guid g_ventoy_guid;
|
||||
extern ventoy_img_chunk_list g_img_chunk_list;
|
||||
extern ventoy_img_chunk_list g_wimiso_chunk_list;
|
||||
extern char *g_wimiso_path;
|
||||
extern grub_uint32_t g_wimiso_size;
|
||||
extern char g_arch_mode_suffix[64];
|
||||
extern const char *g_menu_prefix[img_type_max];
|
||||
|
||||
@@ -314,6 +316,9 @@ void ventoy_debug(const char *fmt, ...);
|
||||
#define vtoy_ssprintf(buf, pos, fmt, ...) \
|
||||
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
|
||||
|
||||
#define browser_ssprintf(mbuf, fmt, args...) \
|
||||
(mbuf)->pos += grub_snprintf((mbuf)->buf + (mbuf)->pos, (mbuf)->max - (mbuf)->pos, fmt, ##args)
|
||||
|
||||
#define FLAG_HEADER_RESERVED 0x00000001
|
||||
#define FLAG_HEADER_COMPRESSION 0x00000002
|
||||
#define FLAG_HEADER_READONLY 0x00000004
|
||||
@@ -604,7 +609,6 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
|
||||
int ventoy_cpio_newc_fill_head(void *buf, int filesize, const void *filedata, const char *name);
|
||||
grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
|
||||
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...);
|
||||
int ventoy_is_file_exist(const char *fmt, ...);
|
||||
int ventoy_is_dir_exist(const char *fmt, ...);
|
||||
int ventoy_fill_data(grub_uint32_t buflen, char *buffer);
|
||||
grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
@@ -826,6 +830,7 @@ typedef struct ventoy_video_mode
|
||||
typedef struct file_fullpath
|
||||
{
|
||||
char path[256];
|
||||
int vlnk_add;
|
||||
}file_fullpath;
|
||||
|
||||
typedef struct theme_list
|
||||
@@ -1153,5 +1158,46 @@ struct g_ventoy_map{
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
typedef struct ventoy_vlnk_part
|
||||
{
|
||||
grub_uint32_t disksig;
|
||||
grub_uint64_t partoffset;
|
||||
char disk[64];
|
||||
char device[64];
|
||||
grub_device_t dev;
|
||||
grub_fs_t fs;
|
||||
int probe;
|
||||
struct ventoy_vlnk_part *next;
|
||||
}ventoy_vlnk_part;
|
||||
|
||||
|
||||
typedef struct browser_mbuf
|
||||
{
|
||||
int max;
|
||||
int pos;
|
||||
char *buf;
|
||||
}browser_mbuf;
|
||||
|
||||
typedef struct browser_node
|
||||
{
|
||||
int dir;
|
||||
char menuentry[1024];
|
||||
char filename[512];
|
||||
struct browser_node *prev;
|
||||
struct browser_node *next;
|
||||
}browser_node;
|
||||
|
||||
extern int g_sort_case_sensitive;
|
||||
extern int g_wimboot_enable;
|
||||
extern int g_filt_dot_underscore_file;
|
||||
extern int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT];
|
||||
extern const char *g_menu_class[img_type_max];
|
||||
extern char g_iso_path[256];
|
||||
int ventoy_add_vlnk_file(char *dir, const char *name);
|
||||
grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_get_fs_type(const char *fs);
|
||||
int ventoy_img_name_valid(const char *filename, grub_size_t namelen);
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
@@ -171,11 +171,11 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
|
||||
grub_printf("file: %s\n", value);
|
||||
if (value[0] == '/')
|
||||
{
|
||||
exist = ventoy_is_file_exist("%s%s", isodisk, value);
|
||||
exist = ventoy_check_file_exist("%s%s", isodisk, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
exist = ventoy_is_file_exist("%s/ventoy/%s", isodisk, value);
|
||||
exist = ventoy_check_file_exist("%s/ventoy/%s", isodisk, value);
|
||||
}
|
||||
|
||||
if (exist == 0)
|
||||
@@ -195,11 +195,11 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
|
||||
grub_printf("file: %s\n", value);
|
||||
if (value[0] == '/')
|
||||
{
|
||||
exist = ventoy_is_file_exist("%s%s", isodisk, value);
|
||||
exist = ventoy_check_file_exist("%s%s", isodisk, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
exist = ventoy_is_file_exist("%s/ventoy/%s", isodisk, value);
|
||||
exist = ventoy_check_file_exist("%s/ventoy/%s", isodisk, value);
|
||||
}
|
||||
|
||||
if (exist == 0)
|
||||
@@ -463,7 +463,7 @@ static int ventoy_plugin_check_path(const char *path, const char *file)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!ventoy_is_file_exist("%s%s", path, file))
|
||||
if (!ventoy_check_file_exist("%s%s", path, file))
|
||||
{
|
||||
grub_printf("%s%s does NOT exist\n", path, file);
|
||||
return 1;
|
||||
@@ -561,7 +561,7 @@ static int ventoy_plugin_parse_fullpath
|
||||
{
|
||||
debug("%s is string type data\n", node->pcName);
|
||||
|
||||
if ((node->unData.pcStrVal[0] != '/') || (!ventoy_is_file_exist("%s%s", isodisk, node->unData.pcStrVal)))
|
||||
if ((node->unData.pcStrVal[0] != '/') || (!ventoy_check_file_exist("%s%s", isodisk, node->unData.pcStrVal)))
|
||||
{
|
||||
debug("%s%s file not found\n", isodisk, node->unData.pcStrVal);
|
||||
return 1;
|
||||
@@ -596,7 +596,7 @@ static int ventoy_plugin_parse_fullpath
|
||||
|
||||
for (count = 0, child = node->pstChild; child; child = child->pstNext)
|
||||
{
|
||||
if (ventoy_is_file_exist("%s%s", isodisk, child->unData.pcStrVal))
|
||||
if (ventoy_check_file_exist("%s%s", isodisk, child->unData.pcStrVal))
|
||||
{
|
||||
grub_snprintf(path->path, sizeof(path->path), "%s", child->unData.pcStrVal);
|
||||
path++;
|
||||
@@ -1401,7 +1401,7 @@ static int ventoy_plugin_menualias_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
grub_printf("image: <%s> [ * ]\n", path);
|
||||
}
|
||||
else if (ventoy_is_file_exist("%s%s", isodisk, path))
|
||||
else if (ventoy_check_file_exist("%s%s", isodisk, path))
|
||||
{
|
||||
grub_printf("image: <%s> [ OK ]\n", path);
|
||||
}
|
||||
@@ -1542,7 +1542,7 @@ static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
grub_printf("image: <%s> [ * ]\n", path);
|
||||
}
|
||||
else if (ventoy_is_file_exist("%s%s", isodisk, path))
|
||||
else if (ventoy_check_file_exist("%s%s", isodisk, path))
|
||||
{
|
||||
grub_printf("image: <%s> [ OK ]\n", path);
|
||||
}
|
||||
@@ -2684,6 +2684,8 @@ persistence_config * ventoy_plugin_find_persistent(const char *isopath)
|
||||
int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list)
|
||||
{
|
||||
int rc = 1;
|
||||
int len = 0;
|
||||
char *path = NULL;
|
||||
grub_uint64_t start = 0;
|
||||
grub_file_t file = NULL;
|
||||
persistence_config *node = NULL;
|
||||
@@ -2704,10 +2706,22 @@ int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, vento
|
||||
return 1;
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", g_iso_disk_name, node->backendpath[index].path);
|
||||
path = node->backendpath[index].path;
|
||||
|
||||
if (node->backendpath[index].vlnk_add == 0)
|
||||
{
|
||||
len = grub_strlen(path);
|
||||
if (len > 9 && grub_strncmp(path + len - 9, ".vlnk.dat", 9) == 0)
|
||||
{
|
||||
ventoy_add_vlnk_file(NULL, path);
|
||||
node->backendpath[index].vlnk_add = 1;
|
||||
}
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", g_iso_disk_name, path);
|
||||
if (!file)
|
||||
{
|
||||
debug("Failed to open file %s%s\n", g_iso_disk_name, node->backendpath[index].path);
|
||||
debug("Failed to open file %s%s\n", g_iso_disk_name, path);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@@ -667,6 +667,11 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (grub_strncmp(args[0], g_iso_path, grub_strlen(g_iso_path)))
|
||||
{
|
||||
file->vlnk = 1;
|
||||
}
|
||||
|
||||
img_chunk_size = g_img_chunk_list.cur_chunk * sizeof(ventoy_img_chunk);
|
||||
|
||||
size = sizeof(ventoy_chain_head) + img_chunk_size;
|
||||
|
@@ -1994,21 +1994,12 @@ static grub_uint32_t ventoy_get_wim_iso_offset(const char *filepath)
|
||||
return imgoffset;
|
||||
}
|
||||
|
||||
static int ventoy_get_wim_chunklist(const char *filename, ventoy_img_chunk_list *wimchunk, grub_uint64_t *wimsize)
|
||||
static int ventoy_get_wim_chunklist(grub_file_t wimfile, ventoy_img_chunk_list *wimchunk)
|
||||
{
|
||||
grub_file_t wimfile;
|
||||
|
||||
wimfile = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", filename);
|
||||
if (!wimfile)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_memset(wimchunk, 0, sizeof(ventoy_img_chunk_list));
|
||||
wimchunk->chunk = grub_malloc(sizeof(ventoy_img_chunk) * DEFAULT_CHUNK_NUM);
|
||||
if (NULL == wimchunk->chunk)
|
||||
{
|
||||
grub_file_close(wimfile);
|
||||
return grub_error(GRUB_ERR_OUT_OF_MEMORY, "Can't allocate image chunk memoty\n");
|
||||
}
|
||||
|
||||
@@ -2017,9 +2008,6 @@ static int ventoy_get_wim_chunklist(const char *filename, ventoy_img_chunk_list
|
||||
|
||||
ventoy_get_block_list(wimfile, wimchunk, wimfile->device->disk->partition->start);
|
||||
|
||||
*wimsize = wimfile->size;
|
||||
grub_file_close(wimfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2058,7 +2046,7 @@ grub_err_t ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, c
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
|
||||
{
|
||||
grub_uint32_t i = 0;
|
||||
grub_uint32_t imgoffset = 0;
|
||||
@@ -2079,10 +2067,7 @@ grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
ventoy_img_chunk_list wimchunk;
|
||||
char envbuf[128];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
debug("wim chain data begin <%s> ...\n", args[0]);
|
||||
debug("vlnk wim chain data begin <%s> ...\n", wimfile->name);
|
||||
|
||||
if (NULL == g_wimiso_chunk_list.chunk || NULL == g_wimiso_path)
|
||||
{
|
||||
@@ -2097,11 +2082,177 @@ grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (0 != ventoy_get_wim_chunklist(args[0], &wimchunk, &wimsize))
|
||||
if (0 != ventoy_get_wim_chunklist(wimfile, &wimchunk))
|
||||
{
|
||||
grub_printf("Failed to get wim chunklist\n");
|
||||
return 1;
|
||||
}
|
||||
wimsize = wimfile->size;
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", g_wimiso_path);
|
||||
if (!file)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
boot_catlog = ventoy_get_iso_boot_catlog(file);
|
||||
|
||||
img_chunk1_size = g_wimiso_chunk_list.cur_chunk * sizeof(ventoy_img_chunk);
|
||||
img_chunk2_size = wimchunk.cur_chunk * sizeof(ventoy_img_chunk);
|
||||
override_size = sizeof(ventoy_override_chunk) + g_wimiso_size;
|
||||
|
||||
size = sizeof(ventoy_chain_head) + img_chunk1_size + img_chunk2_size + override_size;
|
||||
|
||||
pLastChain = grub_env_get("vtoy_chain_mem_addr");
|
||||
if (pLastChain)
|
||||
{
|
||||
chain = (ventoy_chain_head *)grub_strtoul(pLastChain, NULL, 16);
|
||||
if (chain)
|
||||
{
|
||||
debug("free last chain memory %p\n", chain);
|
||||
grub_free(chain);
|
||||
}
|
||||
}
|
||||
|
||||
chain = grub_malloc(size);
|
||||
if (!chain)
|
||||
{
|
||||
grub_printf("Failed to alloc chain memory size %u\n", size);
|
||||
grub_file_close(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
/* part 1: os parameter */
|
||||
g_ventoy_chain_type = ventoy_chain_wim;
|
||||
ventoy_fill_os_param(wimfile, &(chain->os_param));
|
||||
|
||||
/* part 2: chain head */
|
||||
disk = wimfile->device->disk;
|
||||
chain->disk_drive = disk->id;
|
||||
chain->disk_sector_size = (1 << disk->log_sector_size);
|
||||
chain->real_img_size_in_bytes = ventoy_align_2k(file->size) + ventoy_align_2k(wimsize);
|
||||
chain->virt_img_size_in_bytes = chain->real_img_size_in_bytes;
|
||||
chain->boot_catalog = boot_catlog;
|
||||
|
||||
if (!ventoy_is_efi_os())
|
||||
{
|
||||
grub_file_seek(file, boot_catlog * 2048);
|
||||
grub_file_read(file, chain->boot_catalog_sector, sizeof(chain->boot_catalog_sector));
|
||||
}
|
||||
|
||||
/* part 3: image chunk */
|
||||
chain->img_chunk_offset = sizeof(ventoy_chain_head);
|
||||
chain->img_chunk_num = g_wimiso_chunk_list.cur_chunk + wimchunk.cur_chunk;
|
||||
grub_memcpy((char *)chain + chain->img_chunk_offset, g_wimiso_chunk_list.chunk, img_chunk1_size);
|
||||
|
||||
chunknode = (ventoy_img_chunk *)((char *)chain + chain->img_chunk_offset);
|
||||
for (i = 0; i < g_wimiso_chunk_list.cur_chunk; i++)
|
||||
{
|
||||
chunknode->disk_end_sector = chunknode->disk_end_sector - chunknode->disk_start_sector;
|
||||
chunknode->disk_start_sector = 0;
|
||||
chunknode++;
|
||||
}
|
||||
|
||||
/* fs cluster size >= 2048, so don't need to proc align */
|
||||
|
||||
/* align by 2048 */
|
||||
chunknode = wimchunk.chunk + wimchunk.cur_chunk - 1;
|
||||
i = (chunknode->disk_end_sector + 1 - chunknode->disk_start_sector) % 4;
|
||||
if (i)
|
||||
{
|
||||
chunknode->disk_end_sector += 4 - i;
|
||||
}
|
||||
|
||||
isosector = (grub_uint32_t)((file->size + 2047) / 2048);
|
||||
for (i = 0; i < wimchunk.cur_chunk; i++)
|
||||
{
|
||||
chunknode = wimchunk.chunk + i;
|
||||
chunknode->img_start_sector = isosector;
|
||||
chunknode->img_end_sector = chunknode->img_start_sector +
|
||||
((chunknode->disk_end_sector + 1 - chunknode->disk_start_sector) / 4) - 1;
|
||||
isosector = chunknode->img_end_sector + 1;
|
||||
}
|
||||
|
||||
grub_memcpy((char *)chain + chain->img_chunk_offset + img_chunk1_size, wimchunk.chunk, img_chunk2_size);
|
||||
|
||||
/* part 4: override chunk */
|
||||
chain->override_chunk_offset = chain->img_chunk_offset + img_chunk1_size + img_chunk2_size;
|
||||
chain->override_chunk_num = 1;
|
||||
|
||||
override = (ventoy_override_chunk *)((char *)chain + chain->override_chunk_offset);
|
||||
override->img_offset = 0;
|
||||
override->override_size = g_wimiso_size;
|
||||
|
||||
grub_file_seek(file, 0);
|
||||
grub_file_read(file, override->override_data, file->size);
|
||||
|
||||
dirent = (ventoy_iso9660_override *)(override->override_data + imgoffset);
|
||||
dirent->first_sector = (grub_uint32_t)((file->size + 2047) / 2048);
|
||||
dirent->size = (grub_uint32_t)(wimsize);
|
||||
dirent->first_sector_be = grub_swap_bytes32(dirent->first_sector);
|
||||
dirent->size_be = grub_swap_bytes32(dirent->size);
|
||||
|
||||
debug("imgoffset=%u first_sector=0x%x size=0x%x\n", imgoffset, dirent->first_sector, dirent->size);
|
||||
|
||||
if (ventoy_is_efi_os() == 0)
|
||||
{
|
||||
ventoy_windows_drive_map(chain);
|
||||
}
|
||||
|
||||
grub_file_close(file);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
|
||||
{
|
||||
grub_uint32_t i = 0;
|
||||
grub_uint32_t imgoffset = 0;
|
||||
grub_uint32_t size = 0;
|
||||
grub_uint32_t isosector = 0;
|
||||
grub_uint64_t wimsize = 0;
|
||||
grub_uint32_t boot_catlog = 0;
|
||||
grub_uint32_t img_chunk1_size = 0;
|
||||
grub_uint32_t img_chunk2_size = 0;
|
||||
grub_uint32_t override_size = 0;
|
||||
grub_file_t file;
|
||||
grub_disk_t disk;
|
||||
const char *pLastChain = NULL;
|
||||
ventoy_chain_head *chain;
|
||||
ventoy_iso9660_override *dirent;
|
||||
ventoy_img_chunk *chunknode;
|
||||
ventoy_override_chunk *override;
|
||||
ventoy_img_chunk_list wimchunk;
|
||||
char envbuf[128];
|
||||
|
||||
debug("normal wim chain data begin <%s> ...\n", wimfile->name);
|
||||
|
||||
if (NULL == g_wimiso_chunk_list.chunk || NULL == g_wimiso_path)
|
||||
{
|
||||
grub_printf("ventoy not ready\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
imgoffset = ventoy_get_wim_iso_offset(g_wimiso_path);
|
||||
if (imgoffset == 0)
|
||||
{
|
||||
grub_printf("image offset not found\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (0 != ventoy_get_wim_chunklist(wimfile, &wimchunk))
|
||||
{
|
||||
grub_printf("Failed to get wim chunklist\n");
|
||||
return 1;
|
||||
}
|
||||
wimsize = wimfile->size;
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", g_wimiso_path);
|
||||
if (!file)
|
||||
@@ -2214,6 +2365,33 @@ grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_err_t ret;
|
||||
grub_file_t wimfile;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
wimfile = grub_file_open(args[0], VENTOY_FILE_TYPE);
|
||||
if (!wimfile)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (wimfile->vlnk)
|
||||
{
|
||||
ret = ventoy_vlnk_wim_chain_data(wimfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ventoy_normal_wim_chain_data(wimfile);
|
||||
}
|
||||
|
||||
grub_file_close(wimfile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ventoy_chain_file_size(const char *path)
|
||||
{
|
||||
int size;
|
||||
|
@@ -132,7 +132,8 @@ enum grub_file_type
|
||||
|
||||
/* --skip-sig is specified. */
|
||||
GRUB_FILE_TYPE_SKIP_SIGNATURE = 0x10000,
|
||||
GRUB_FILE_TYPE_NO_DECOMPRESS = 0x20000
|
||||
GRUB_FILE_TYPE_NO_DECOMPRESS = 0x20000,
|
||||
GRUB_FILE_TYPE_NO_VLNK = 0x40000,
|
||||
};
|
||||
|
||||
/* File description. */
|
||||
@@ -141,6 +142,8 @@ struct grub_file
|
||||
/* File name. */
|
||||
char *name;
|
||||
|
||||
int vlnk;
|
||||
|
||||
/* The underlying device. */
|
||||
grub_device_t device;
|
||||
|
||||
@@ -213,6 +216,11 @@ grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf,
|
||||
grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset);
|
||||
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
|
||||
|
||||
int EXPORT_FUNC(grub_file_is_vlnk_suffix)(const char *name, int len);
|
||||
int EXPORT_FUNC(grub_file_add_vlnk)(const char *src, const char *dst);
|
||||
int EXPORT_FUNC(grub_file_vtoy_vlnk)(const char *src, const char *dst);
|
||||
const char * EXPORT_FUNC(grub_file_get_vlnk)(const char *name, int *vlnk);
|
||||
|
||||
/* Return value of grub_file_size() in case file size is unknown. */
|
||||
#define GRUB_FILE_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
|
@@ -128,5 +128,6 @@ grub_fs_unregister (grub_fs_t fs)
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
||||
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||
grub_fs_t EXPORT_FUNC(grub_fs_list_probe) (grub_device_t device, const char **list);
|
||||
|
||||
#endif /* ! GRUB_FS_HEADER */
|
||||
|
@@ -122,6 +122,8 @@ typedef struct ventoy_os_param
|
||||
* vtoy_reserved[3]: vtoy_iso_format 0:iso9660 1:udf
|
||||
* vtoy_reserved[4]: vtoy_windows_cd_prompt
|
||||
* vtoy_reserved[5]: vtoy_linux_remount
|
||||
* vtoy_reserved[6]: vtoy_vlnk
|
||||
* vtoy_reserved[7~10]: vtoy_disk_sig[4] used for vlnk
|
||||
*
|
||||
*/
|
||||
grub_uint8_t vtoy_reserved[32]; // Internal use by ventoy
|
||||
@@ -151,11 +153,23 @@ typedef struct ventoy_secure_data
|
||||
grub_uint8_t magic2[16]; /* VENTOY_GUID */
|
||||
}ventoy_secure_data;
|
||||
|
||||
|
||||
typedef struct ventoy_vlnk
|
||||
{
|
||||
ventoy_guid guid; // VENTOY_GUID
|
||||
grub_uint32_t crc32; // crc32
|
||||
grub_uint32_t disk_signature;
|
||||
grub_uint64_t part_offset; // in bytes
|
||||
char filepath[384];
|
||||
grub_uint8_t reserved[96];
|
||||
}ventoy_vlnk;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
// compile assert check : sizeof(ventoy_os_param) must be 512
|
||||
COMPILE_ASSERT(1,sizeof(ventoy_os_param) == 512);
|
||||
COMPILE_ASSERT(2,sizeof(ventoy_secure_data) == 4096);
|
||||
COMPILE_ASSERT(3,sizeof(ventoy_vlnk) == 512);
|
||||
|
||||
|
||||
|
||||
|
@@ -115,6 +115,8 @@ fi
|
||||
|
||||
if [ "$VTOY_ARCH" = "x86_64" ]; then
|
||||
echo "Use x86_64 busybox toolkit ..." >>$VTLOG
|
||||
$BUSYBOX_PATH/xzcat $BUSYBOX_PATH/xzcat64_musl.xz > $BUSYBOX_PATH/xzcat_musl
|
||||
$BUSYBOX_PATH/chmod +x $BUSYBOX_PATH/xzcat_musl
|
||||
ln -s $BUSYBOX_PATH/xzminidec64 $BUSYBOX_PATH/xzminidec
|
||||
ln -s $VTOY_PATH/tool/dmsetup64 $VTOY_PATH/tool/dmsetup
|
||||
ln -s $VTOY_PATH/tool/lunzip64 $VTOY_PATH/tool/lunzip
|
||||
@@ -124,6 +126,8 @@ if [ "$VTOY_ARCH" = "x86_64" ]; then
|
||||
ln -s $VTOY_PATH/tool/zstdcat64 $VTOY_PATH/tool/zstdcat
|
||||
elif [ "$VTOY_ARCH" = "i386" ]; then
|
||||
echo "Use i386 busybox toolkit ..." >>$VTLOG
|
||||
$BUSYBOX_PATH/xzcat $BUSYBOX_PATH/xzcat32_musl.xz > $BUSYBOX_PATH/xzcat_musl
|
||||
$BUSYBOX_PATH/chmod +x $BUSYBOX_PATH/xzcat_musl
|
||||
ln -s $BUSYBOX_PATH/xzminidec32 $BUSYBOX_PATH/xzminidec
|
||||
ln -s $VTOY_PATH/tool/dmsetup32 $VTOY_PATH/tool/dmsetup
|
||||
ln -s $VTOY_PATH/tool/lunzip32 $VTOY_PATH/tool/lunzip
|
||||
|
@@ -49,7 +49,12 @@ done
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
vtlog "ln -s /dev/$vtDM $1"
|
||||
ln -s /dev/$vtDM "$1"
|
||||
|
||||
if [ -e "$1" ]; then
|
||||
vtlog "$1 already exist"
|
||||
else
|
||||
ln -s /dev/$vtDM "$1"
|
||||
fi
|
||||
else
|
||||
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
|
||||
vtlog "vtLABEL is $vtLABEL"
|
||||
@@ -59,7 +64,11 @@ else
|
||||
vtlog "vtLABEL is $vtLABEL from cmdline"
|
||||
fi
|
||||
|
||||
ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
|
||||
if [ -e "/dev/disk/by-label/$vtLABEL" ]; then
|
||||
vtlog "$1 already exist"
|
||||
else
|
||||
ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
|
||||
fi
|
||||
fi
|
||||
|
||||
# OK finish
|
||||
|
@@ -54,8 +54,15 @@ fi
|
||||
if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
echo "Do auto install ..." >> $VTLOG
|
||||
|
||||
if $GREP -q "^mount /proc$" /init; then
|
||||
$SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'" -i /init
|
||||
if $GREP -q '^autoinstall:' $VTOY_PATH/autoinstall; then
|
||||
echo "cloud-init auto install ..." >> $VTLOG
|
||||
if $GREP -q "maybe_break init" /init; then
|
||||
$SED "/maybe_break init/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ventoy-cloud-init.sh \$rootmnt" -i /init
|
||||
fi
|
||||
else
|
||||
if $GREP -q "^mount /proc$" /init; then
|
||||
$SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'" -i /init
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
63
IMG/cpio/ventoy/hook/debian/ventoy-cloud-init.sh
Normal file
63
IMG/cpio/ventoy/hook/debian/ventoy-cloud-init.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
newroot=$1
|
||||
|
||||
dd if=/dev/zero of=$newroot/tmp/cidata.img bs=1M count=8 status=none
|
||||
freeloop=$(losetup -f)
|
||||
|
||||
losetup $freeloop $newroot/tmp/cidata.img
|
||||
|
||||
mkfs.vfat -n CIDATA $freeloop
|
||||
|
||||
mkdir /tmpcidata
|
||||
mount $newroot/tmp/cidata.img /tmpcidata
|
||||
|
||||
vtSplit=$(grep VENTOY_META_DATA_SPLIT $VTOY_PATH/autoinstall | wc -l)
|
||||
if [ $vtSplit -eq 1 ]; then
|
||||
vtlog "split autoinstall script to user-data and meta-data"
|
||||
vtLine=$(grep -n VENTOY_META_DATA_SPLIT $VTOY_PATH/autoinstall | awk -F: '{print $1}')
|
||||
vtLine1=$(expr $vtLine - 1)
|
||||
vtLine2=$(expr $vtLine + 1)
|
||||
vtlog "Line number: $vtLine $vtLine1 $vtLine2"
|
||||
sed -n "1,${vtLine1}p" $VTOY_PATH/autoinstall >/tmpcidata/user-data
|
||||
sed -n "${vtLine2},\$p" $VTOY_PATH/autoinstall >/tmpcidata/meta-data
|
||||
else
|
||||
vtlog "only user-data avaliable"
|
||||
cp -a $VTOY_PATH/autoinstall /tmpcidata/user-data
|
||||
touch /tmpcidata/meta-data
|
||||
fi
|
||||
|
||||
|
||||
umount /tmpcidata
|
||||
rm -rf /tmpcidata
|
||||
|
||||
vtCMD=$(cat /proc/cmdline)
|
||||
echo "autoinstall $vtCMD" > $newroot/tmp/kcmdline
|
||||
mount --bind $newroot/tmp/kcmdline /proc/cmdline
|
||||
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
@@ -31,6 +31,7 @@ HEAD=$BUSYBOX_PATH/head
|
||||
VTOY_DM_PATH=/dev/mapper/ventoy
|
||||
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||
VTOY_LINUX_REMOUNT=$($BUSYBOX_PATH/hexdump -n 1 -s 454 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||
VTOY_VLNK_BOOT=$($BUSYBOX_PATH/hexdump -n 1 -s 455 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||
|
||||
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
|
||||
if [ -e /dev/console ]; then
|
||||
@@ -65,12 +66,16 @@ set_ventoy_hook_finish() {
|
||||
echo 'Y' > $VTOY_PATH/hook_finish
|
||||
}
|
||||
|
||||
get_ventoy_disk_name() {
|
||||
line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ${line%%#*}
|
||||
else
|
||||
echo "unknown"
|
||||
get_ventoy_disk_name() {
|
||||
if [ "$VTOY_VLNK_BOOT" = "01" ]; then
|
||||
$VTOY_PATH/tool/vtoydump -t /ventoy/ventoy_os_param
|
||||
else
|
||||
line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ${line%%#*}
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -121,14 +126,6 @@ check_usb_disk_ready() {
|
||||
[ -e "${vtpart2}" ]
|
||||
}
|
||||
|
||||
is_ventoy_disk() {
|
||||
if $VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c "$1"; then
|
||||
$BUSYBOX_PATH/true
|
||||
else
|
||||
$BUSYBOX_PATH/false
|
||||
fi
|
||||
}
|
||||
|
||||
not_ventoy_disk() {
|
||||
if echo $1 | $EGREP -q "nvme.*p$|mmc.*p$|nbd.*p$"; then
|
||||
vtDiskName=${1:0:-1}
|
||||
@@ -136,10 +133,15 @@ not_ventoy_disk() {
|
||||
vtDiskName=$1
|
||||
fi
|
||||
|
||||
if $VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c "$vtDiskName"; then
|
||||
$BUSYBOX_PATH/false
|
||||
if [ "$VTOY_VLNK_BOOT" = "01" ]; then
|
||||
vtVtoyDisk=$($VTOY_PATH/tool/vtoydump -t $VTOY_PATH/ventoy_os_param)
|
||||
[ "$vtVtoyDisk" != "/dev/$vtDiskName" ]
|
||||
else
|
||||
$BUSYBOX_PATH/true
|
||||
if $VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c "$vtDiskName"; then
|
||||
$BUSYBOX_PATH/false
|
||||
else
|
||||
$BUSYBOX_PATH/true
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -256,6 +258,8 @@ ventoy_dm_patch() {
|
||||
|
||||
if echo $vtMType | $EGREP -i -q "x86.64|amd64"; then
|
||||
vtKoName=dm_patch_64.ko
|
||||
elif echo $vtMType | $EGREP -i -q "i[3-6]86"; then
|
||||
vtKoName=dm_patch_32.ko
|
||||
else
|
||||
vtlog "unsupported machine type $vtMType"
|
||||
return
|
||||
@@ -310,7 +314,10 @@ ventoy_dm_patch() {
|
||||
|
||||
vtKv=$($BUSYBOX_PATH/uname -r)
|
||||
|
||||
if [ -d /lib/modules/$vtKv/kernel/fs ]; then
|
||||
if [ ! -d /lib/modules/$vtKv ]; then
|
||||
vtlog "No modules directory found"
|
||||
return
|
||||
elif [ -d /lib/modules/$vtKv/kernel/fs ]; then
|
||||
vtModPath=$($FIND /lib/modules/$vtKv/kernel/fs/ -name "*.ko*" | $HEAD -n1)
|
||||
else
|
||||
vtModPath=$($FIND /lib/modules/$vtKv/kernel/ -name "xfs.ko*" | $HEAD -n1)
|
||||
@@ -324,7 +331,10 @@ ventoy_dm_patch() {
|
||||
|
||||
vtlog "template module is $vtModPath $vtModName"
|
||||
|
||||
if echo $vtModPath | $GREP -q "[.]ko$"; then
|
||||
if [ -z "$vtModPath" ]; then
|
||||
vtlog "No template module found"
|
||||
return
|
||||
elif echo $vtModPath | $GREP -q "[.]ko$"; then
|
||||
$BUSYBOX_PATH/cp -a $vtModPath $VTOY_PATH/$vtModName
|
||||
elif echo $vtModPath | $GREP -q "[.]ko[.]xz$"; then
|
||||
$BUSYBOX_PATH/xzcat $vtModPath > $VTOY_PATH/$vtModName
|
||||
@@ -795,7 +805,12 @@ is_inotify_ventoy_part() {
|
||||
fi
|
||||
|
||||
if [ -e /dev/$vtShortName ]; then
|
||||
$VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c $vtShortName
|
||||
if [ "$VTOY_VLNK_BOOT" = "01" ]; then
|
||||
vtOrgDiskName=$($VTOY_PATH/tool/vtoydump -t $VTOY_PATH/ventoy_os_param)
|
||||
[ "$vtOrgDiskName" = "/dev/$vtShortName" ]
|
||||
else
|
||||
$VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c $vtShortName
|
||||
fi
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
@@ -77,12 +77,10 @@ ventoy_unpack_initramfs() {
|
||||
if [ "${vtx:5}" = "xzcat" ]; then
|
||||
rm -f $VTOY_PATH/xzlog
|
||||
${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
|
||||
if grep -q 'corrupted data' $VTOY_PATH/xzlog; then
|
||||
echo 'xzcat failed, now try xzminidec...' >> $VTLOG
|
||||
cat $vtfile | xzminidec | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
echo 'xzcat failed, now try xzcat_musl ...' >> $VTLOG
|
||||
xzcat_musl $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
fi
|
||||
|
||||
else
|
||||
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||
fi
|
||||
|
@@ -129,6 +129,10 @@ mount -t devtmpfs dev /newdev
|
||||
cp -a /dev/mapper/ventoy* /newdev/mapper/
|
||||
cp -a /dev/ventoy* /newdev/
|
||||
|
||||
if [ "$VTOY_VLNK_BOOT" = "01" ]; then
|
||||
vtLine=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
|
||||
vtdiskname=${vtLine%%#*}
|
||||
fi
|
||||
|
||||
vtshortname="${vtdiskname#/dev/}"
|
||||
mv /newdev/${vtshortname} /newdev/backup_${vtshortname}
|
||||
|
@@ -129,6 +129,10 @@ mount -t devtmpfs dev /newdev
|
||||
cp -a /dev/mapper/ventoy* /newdev/mapper/
|
||||
cp -a /dev/ventoy* /newdev/
|
||||
|
||||
if [ "$VTOY_VLNK_BOOT" = "01" ]; then
|
||||
vtLine=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param)
|
||||
vtdiskname=${vtLine%%#*}
|
||||
fi
|
||||
|
||||
vtshortname="${vtdiskname#/dev/}"
|
||||
mv /newdev/${vtshortname} /newdev/backup_${vtshortname}
|
||||
|
45
IMG/cpio/ventoy/loop/recalbox/ventoy-create-part.sh
Normal file
45
IMG/cpio/ventoy/loop/recalbox/ventoy-create-part.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
if [ -f /vtoy_dm_table ]; then
|
||||
vtPartCnt=$(cat /vtoy_dm_table | wc -l)
|
||||
if [ $vtPartCnt -ne 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "try patch init script"
|
||||
|
||||
if [ -f /new_root/etc/init.d/S11share ]; then
|
||||
cp -a /new_root/etc/init.d/S11share /new_root/overlay/S11share
|
||||
sed "/^ *createMissingPartitions *$/r $VTOY_PATH/loop/recalbox/ventoy-share.sh" -i /new_root/overlay/S11share
|
||||
|
||||
vtFile=$(ls -1 /new_root/etc/init.d/ | grep -m1 S01)
|
||||
|
||||
mount --bind /new_root/overlay/S11share /new_root/etc/init.d/$vtFile
|
||||
vtlog "patch S11share to $vtFile"
|
||||
fi
|
||||
|
||||
PATH=$VTPATH_OLD
|
@@ -36,10 +36,15 @@ if [ "$vtdiskname" = "unknown" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f $VTOY_PATH/modules/dm-mod.ko ]; then
|
||||
insmod $VTOY_PATH/modules/dm-mod.ko
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
ventoy_create_dev_ventoy_part
|
||||
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
||||
|
@@ -20,4 +20,6 @@
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$SED "/mount.*devtmpfs/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/recalbox/ventoy-disk.sh" -i /init
|
||||
$SED "/switch_root/i\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/recalbox/ventoy-create-part.sh" -i /init
|
||||
|
||||
#$SED "/switch_root/i\ exec /ventoy/busybox/sh" -i /init
|
||||
|
21
IMG/cpio/ventoy/loop/recalbox/ventoy-share.sh
Normal file
21
IMG/cpio/ventoy/loop/recalbox/ventoy-share.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
sync
|
||||
|
||||
while [ -n "Y" ]; do
|
||||
clear > /dev/console
|
||||
echo '################################################' > /dev/console
|
||||
echo '################################################' > /dev/console
|
||||
echo '### Please reboot and load from Ventoy again ###' > /dev/console
|
||||
echo '### This only needed for the first boot time ###' > /dev/console
|
||||
echo '################################################' > /dev/console
|
||||
echo '################################################' > /dev/console
|
||||
|
||||
clear > /dev/tty0
|
||||
echo '################################################' > /dev/tty0
|
||||
echo '################################################' > /dev/tty0
|
||||
echo '### Please reboot and load from Ventoy again ###' > /dev/tty0
|
||||
echo '### This only needed for the first boot time ###' > /dev/tty0
|
||||
echo '################################################' > /dev/tty0
|
||||
echo '################################################' > /dev/tty0
|
||||
sleep 1
|
||||
done
|
||||
|
BIN
IMG/cpio_x86/ventoy/busybox/xzcat32_musl.xz
Normal file
BIN
IMG/cpio_x86/ventoy/busybox/xzcat32_musl.xz
Normal file
Binary file not shown.
BIN
IMG/cpio_x86/ventoy/busybox/xzcat64_musl.xz
Normal file
BIN
IMG/cpio_x86/ventoy/busybox/xzcat64_musl.xz
Normal file
Binary file not shown.
BIN
IMG/cpio_x86/ventoy/tool/dm_patch_32.ko
Normal file
BIN
IMG/cpio_x86/ventoy/tool/dm_patch_32.ko
Normal file
Binary file not shown.
Binary file not shown.
@@ -56,10 +56,15 @@ fi
|
||||
|
||||
# check size
|
||||
if echo $size | grep -q "^[0-9][0-9]*$"; then
|
||||
if [ $size -le 1 ]; then
|
||||
echo "Invalid size $size"
|
||||
exit 1
|
||||
vtMinSize=1
|
||||
if echo $fstype | grep -q '^xfs$'; then
|
||||
vtMinSize=16
|
||||
fi
|
||||
|
||||
if [ $size -lt $vtMinSize ]; then
|
||||
echo "size too small ($size)"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Invalid size $size"
|
||||
exit 1
|
||||
|
@@ -26,6 +26,14 @@ Please refer https://www.ventoy.net/en/doc_start.html for details.
|
||||
1. sudo sh VentoyPlugson.sh
|
||||
2. open your browser and visit http://127.0.0.1:24681
|
||||
|
||||
========== VentoyVlnk.sh ===============
|
||||
Usage: sudo sh VentoyVlnk.sh CMD FILE
|
||||
CMD:
|
||||
-c FILE create vlnk for FILE
|
||||
-l VLNK parse vlnk file
|
||||
-v print verbose info
|
||||
-h print this help
|
||||
|
||||
|
||||
========= VentoyGUI ===================
|
||||
VentoyGUI is native GUI program for Linux (GTK/QT)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
|
||||
source $prefix/power.cfg
|
||||
source $prefix/keyboard.cfg
|
||||
|
||||
submenu "Resolution Configuration" --class=debug_resolution --class=F5tool {
|
||||
|
@@ -65,10 +65,6 @@ function ventoy_vcfg_proc {
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_power {
|
||||
configfile $prefix/power.cfg
|
||||
}
|
||||
|
||||
function ventoy_diagnosis {
|
||||
vt_enum_video_mode
|
||||
configfile $prefix/debug.cfg
|
||||
@@ -362,6 +358,9 @@ function distro_specify_initrd_file_phase2 {
|
||||
vt_linux_specify_initrd_file /pyabr/boot/initrfs.img
|
||||
elif [ -f (loop)/initrd0.img ]; then
|
||||
vt_linux_specify_initrd_file /initrd0.img
|
||||
elif [ -f (loop)/sysresccd/boot/i686/sysresccd.img ]; then
|
||||
vt_linux_specify_initrd_file /sysresccd/boot/i686/sysresccd.img
|
||||
|
||||
|
||||
fi
|
||||
}
|
||||
@@ -1390,7 +1389,19 @@ function efi_common_menuentry {
|
||||
return
|
||||
fi
|
||||
|
||||
vt_concat_efi_iso "${vtoy_iso_part}${vt_chosen_path}" vtoy_iso_buf
|
||||
unset vt_vlnk_dst
|
||||
if vt_is_vlnk_name "${vt_chosen_path}"; then
|
||||
vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
|
||||
if [ -z "$vt_vlnk_dst" ]; then
|
||||
echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
|
||||
ventoy_pause
|
||||
return
|
||||
fi
|
||||
else
|
||||
vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
|
||||
fi
|
||||
|
||||
vt_concat_efi_iso "${vt_vlnk_dst}" vtoy_iso_buf
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
@@ -1402,7 +1413,7 @@ function efi_common_menuentry {
|
||||
|
||||
if [ -n "$vtoy_dotefi_retry" ]; then
|
||||
unset vtoy_dotefi_retry
|
||||
chainloader "${vtoy_iso_part}${vt_chosen_path}"
|
||||
chainloader "${vt_vlnk_dst}"
|
||||
boot
|
||||
fi
|
||||
|
||||
@@ -1438,17 +1449,6 @@ function vhdboot_common_func {
|
||||
}
|
||||
|
||||
function vhd_common_menuentry {
|
||||
|
||||
if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
|
||||
if [ "$vtoy_iso_fs" != "ntfs" ]; then
|
||||
echo -e "!!! WARNING !!!\n"
|
||||
echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
|
||||
echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
|
||||
echo -n "press ENTER to continue boot (请按 回车 键继续) ..."
|
||||
read vtInputKey
|
||||
fi
|
||||
fi
|
||||
|
||||
vt_chosen_img_path vt_chosen_path vt_chosen_size
|
||||
|
||||
if vt_check_password "${vt_chosen_path}"; then
|
||||
@@ -1459,7 +1459,28 @@ function vhd_common_menuentry {
|
||||
return
|
||||
fi
|
||||
|
||||
vhdboot_common_func "${vt_chosen_path}"
|
||||
unset vt_vlnk_dst
|
||||
if vt_is_vlnk_name "${vt_chosen_path}"; then
|
||||
vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
|
||||
if [ -z "$vt_vlnk_dst" ]; then
|
||||
echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
|
||||
ventoy_pause
|
||||
return
|
||||
fi
|
||||
else
|
||||
vt_vlnk_dst="${vt_chosen_path}"
|
||||
if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
|
||||
if [ "$vtoy_iso_fs" != "ntfs" ]; then
|
||||
echo -e "!!! WARNING !!!\n"
|
||||
echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
|
||||
echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
|
||||
echo -n "press ENTER to continue boot (请按 回车 键继续) ..."
|
||||
read vtInputKey
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
vhdboot_common_func "${vt_vlnk_dst}"
|
||||
}
|
||||
|
||||
function vhd_unsupport_menuentry {
|
||||
@@ -1535,7 +1556,19 @@ function vtoy_common_menuentry {
|
||||
return
|
||||
fi
|
||||
|
||||
vtoyboot_common_func "${vtoy_iso_part}${vt_chosen_path}"
|
||||
unset vt_vlnk_dst
|
||||
if vt_is_vlnk_name "${vt_chosen_path}"; then
|
||||
vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
|
||||
if [ -z "$vt_vlnk_dst" ]; then
|
||||
echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
|
||||
ventoy_pause
|
||||
return
|
||||
fi
|
||||
else
|
||||
vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
|
||||
fi
|
||||
|
||||
vtoyboot_common_func "${vt_vlnk_dst}"
|
||||
}
|
||||
|
||||
function vtoy_unsupport_menuentry {
|
||||
@@ -1688,9 +1721,23 @@ function ventoy_img_ubos {
|
||||
}
|
||||
|
||||
function ventoy_img_recalbox {
|
||||
if [ $vtoy_img_max_part_end -gt $vt_chosen_size ]; then
|
||||
echo -e "\nPlease extend the img file size before boot it. \n"
|
||||
ventoy_pause
|
||||
return
|
||||
fi
|
||||
|
||||
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
|
||||
|
||||
if [ -e (vtimghd,1)/boot/recalbox ]; then
|
||||
loopback recalbox (vtimghd,1)/boot/recalbox
|
||||
vt_get_lib_module_ver (recalbox) /lib/modules/ vt_module_ver
|
||||
if [ -n "$vt_module_ver" ]; then
|
||||
vt_img_extra_initrd_append (recalbox)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
|
||||
fi
|
||||
fi
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
#boot image file
|
||||
@@ -1971,7 +2018,7 @@ function img_common_menuentry {
|
||||
ventoy_img_batocera
|
||||
elif vt_str_begin "$vtImgHd1Label" "Tails"; then
|
||||
ventoy_img_tails
|
||||
elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
|
||||
elif [ "$vtImgHd2Label" = "RECALBOX" -o "$vtImgHd1Label" = "RECALBOX" ]; then
|
||||
ventoy_img_recalbox
|
||||
elif [ "$vtImgHd1Label" = "ESYSRESCUE" ]; then
|
||||
ventoy_img_esysrescue
|
||||
@@ -2022,7 +2069,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.64"
|
||||
set VENTOY_VERSION="1.0.67"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -2038,7 +2085,7 @@ set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
|
||||
set VTOY_WIMBOOT_MODE_STR="WIMBOOT Mode"
|
||||
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
|
||||
|
||||
set VTOY_F2_CMD="ventoy_power"
|
||||
set VTOY_F2_CMD="vt_browser_disk"
|
||||
set VTOY_F4_CMD="ventoy_localboot"
|
||||
set VTOY_F5_CMD="ventoy_diagnosis"
|
||||
set VTOY_F6_CMD="ventoy_ext_menu"
|
||||
@@ -2136,12 +2183,13 @@ fi
|
||||
|
||||
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
|
||||
set VTOY_F3_CMD="vt_dynamic_menu 1 1"
|
||||
set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Tools F6:ExMenu"
|
||||
set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Browser F3:TreeView F4:Localboot F5:Tools F6:ExMenu"
|
||||
else
|
||||
set VTOY_F3_CMD="vt_dynamic_menu 1 0"
|
||||
set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Tools F6:ExMenu"
|
||||
set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Browser F3:ListView F4:Localboot F5:Tools F6:ExMenu"
|
||||
fi
|
||||
|
||||
terminal_output console
|
||||
|
||||
if [ -n "$vtoy_gfxmode" ]; then
|
||||
set gfxmode=$vtoy_gfxmode
|
||||
@@ -2258,9 +2306,7 @@ if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
|
||||
export timeout
|
||||
export default
|
||||
|
||||
if [ "$vtHotkey" = "F2" ]; then
|
||||
ventoy_power
|
||||
elif [ "$vtHotkey" = "F4" ]; then
|
||||
if [ "$vtHotkey" = "F4" ]; then
|
||||
ventoy_localboot
|
||||
elif [ "$vtHotkey" = "F5" ]; then
|
||||
ventoy_diagnosis
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Zeigt dieses Hilfe Menu
|
||||
F1 - Memdisk Modus (Nur für kleine WinPE/LiveCD ISO/IMG)
|
||||
F2 - Neustarten/Herunterfahren
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Menu wechsel zwischen Baum <-> Listen Ansicht
|
||||
F4 - Windows/Linux vom lokalem Datenträger starten
|
||||
F5 - Dienstprogramme
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Display this help information
|
||||
F1 - Memdisk Mode (Only for small WinPE/LiveCD ISO/IMG)
|
||||
F2 - Reboot/Power off
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Switch menu mode between Treeview <-> ListView
|
||||
F4 - Boot Windows/Linux in local disk
|
||||
F5 - Utilities
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Afficher cette aide
|
||||
F1 - Mode Memdisk (Seulement pour WinPE/LiveCD ISO/IMG)
|
||||
F2 - Redémarrer/arrêter
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Basculer l'affichage 'Vue en arbre' <-> 'Vue en liste'
|
||||
F4 - Démarrer le système Windows/Linux local
|
||||
F5 - Utilitaires
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Prikazuje ove informacije
|
||||
F1 - Memdisk način rada (samo za male WinPE/LiveCD imidž fajlove)
|
||||
F2 - Ponovno pokretanje/isključivanje
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Mijenja meni između TreeView <-> ListView
|
||||
F4 - Pokreće Windows/Linux na lokalnom disku
|
||||
F5 - Postavke
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Tampilkan bantuan informasi ini
|
||||
F1 - Mode Memdisk (Hanya untuk ukuran WinPE/LiveCD ISO/IMG yang kecil)
|
||||
F2 - Mulai ulang/Matikan
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Beralih mode menu antara Treeview <-> ListView
|
||||
F4 - Jalankan (boot) Windows/Linux pada disk lokal
|
||||
F5 - Alat Utilitas
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - この画面を表示する
|
||||
F1 - 主記憶装置上に記憶域を作成する(容量の小さなWinPE・LiveCD専用)
|
||||
F2 - 再起動・電源断
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - 表示形式を切り替える(一覧 ↔ 階層)
|
||||
F4 - 手元の記憶装置にあるOSを起動する
|
||||
F5 - 諸機能
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Mostra esta informação de ajuda
|
||||
F1 - Modo Memdisk (Apenas para pequenos WinPE/LiveCD ISO/IMG)
|
||||
F2 - Reiniciar/Desligar
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Alternar o modo menu entre Vista de árvore <-> Vista de lista
|
||||
F4 - Arrancar o Windows/Linux em disco local
|
||||
F5 - Utilitários
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Приказује ове информације
|
||||
F1 - Memdisk начин рада (само за мале WinPE/LiveCD имиџ фајлове)
|
||||
F2 - Поновно покретање/искључивање
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Мијења мени између TreeView <-> ListView
|
||||
F4 - Покреће Windows/Linux на локалном диску
|
||||
F5 - Поставке
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Prikazuje ove informacije
|
||||
F1 - Memdisk način rada (samo za male WinPE/LiveCD imidž fajlove)
|
||||
F2 - Ponovno pokretanje/isključivanje
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Mijenja meni između TreeView <-> ListView
|
||||
F4 - Pokreće Windows/Linux na lokalnom disku
|
||||
F5 - Postavke
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - Yardım bilgilerini göster
|
||||
F1 - Memdisk Modu başlatır(Yalnızca küçük WinPE/LiveCD ISO/IMG ler için bu modu kullanabilirsiniz)
|
||||
F2 - Bilgisayarı Yeniden Başlat/Kapat
|
||||
F2 - Browse and boot files in local disk
|
||||
F3 - Ventoy Menü modu olarak,Klasör görünümü(Treeview) ile Liste görünümü(ListView) arasında geçiş yapmayı sağlar.
|
||||
F4 - Bilgisayarınızda yüklü olan Windows yada Linux işletim sistemini, sabit diskten başlatır.
|
||||
F5 - Ventoy Araçlar menüsü
|
||||
|
@@ -1,6 +1,6 @@
|
||||
h - 显示本帮助信息
|
||||
F1 - 把文件加载到内存启动(只适用于文件很小的 WinPE/LiveCD等)
|
||||
F2 - 电源操作 (重启、关机)
|
||||
F2 - 浏览并启动本地硬盘中的镜像文件
|
||||
F3 - 菜单显示模式切换。可在列表模式和目录模式之间自由切换。
|
||||
F4 - 启动本地硬盘上的 Windows/Linux 等系统。
|
||||
F5 - 各类工具
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user