mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 17:11:13 +00:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b15a96b747 | ||
|
6bd0463d34 | ||
|
1ce568d971 | ||
|
f82475d950 | ||
|
aad154616c | ||
|
83c3a932d3 | ||
|
0aff8f5109 | ||
|
2750f0c5a7 | ||
|
f71a1fcce9 | ||
|
e252fab9a4 | ||
|
37212a8ea4 | ||
|
e71221cdba |
@@ -2229,6 +2229,42 @@ static grub_err_t ventoy_cmd_img_name(grub_extcmd_context_t ctxt, int argc, char
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_ext_select_img_path(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len = 0;
|
||||
char id[32] = {0};
|
||||
img_info *cur = g_ventoy_img_list;
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s {var}", cmd_raw_name);
|
||||
}
|
||||
|
||||
len = (int)grub_strlen(args[0]);
|
||||
|
||||
while (cur)
|
||||
{
|
||||
if (len == cur->pathlen && 0 == grub_strcmp(args[0], cur->path))
|
||||
{
|
||||
break;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
if (!cur)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "No such image");
|
||||
}
|
||||
|
||||
grub_snprintf(id, sizeof(id), "VID_%d", cur->id);
|
||||
grub_env_set("chosen", id);
|
||||
grub_env_export("chosen");
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int img_id = 0;
|
||||
@@ -2467,6 +2503,7 @@ int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist,
|
||||
{
|
||||
grub_uint32_t i = 0;
|
||||
grub_uint64_t total = 0;
|
||||
grub_uint64_t fileblk = 0;
|
||||
ventoy_img_chunk *chunk = NULL;
|
||||
|
||||
for (i = 0; i < chunklist->cur_chunk; i++)
|
||||
@@ -2482,9 +2519,17 @@ int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist,
|
||||
total += chunk->disk_end_sector + 1 - chunk->disk_start_sector;
|
||||
}
|
||||
|
||||
if (total != ((file->size + 511) / 512))
|
||||
fileblk = (file->size + 511) / 512;
|
||||
|
||||
if (total != fileblk)
|
||||
{
|
||||
debug("Invalid total: %llu %llu\n", (ulonglong)total, (ulonglong)((file->size + 511) / 512));
|
||||
debug("Invalid total: %llu %llu\n", (ulonglong)total, (ulonglong)fileblk);
|
||||
if ((file->size % 512) && (total + 1 == fileblk))
|
||||
{
|
||||
debug("maybe img file to be processed.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3465,6 +3510,84 @@ static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, in
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t ventoy_cmd_img_check_range(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
int ret = 1;
|
||||
grub_file_t file;
|
||||
grub_uint64_t FileSectors = 0;
|
||||
ventoy_gpt_info *gpt = NULL;
|
||||
ventoy_part_table *pt = NULL;
|
||||
grub_uint8_t zeroguid[16] = {0};
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (file->size % 512)
|
||||
{
|
||||
debug("unaligned file size: %llu\n", (ulonglong)file->size);
|
||||
goto out;
|
||||
}
|
||||
|
||||
gpt = grub_zalloc(sizeof(ventoy_gpt_info));
|
||||
if (!gpt)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
FileSectors = file->size / 512;
|
||||
|
||||
grub_file_read(file, gpt, sizeof(ventoy_gpt_info));
|
||||
if (grub_strncmp(gpt->Head.Signature, "EFI PART", 8) == 0)
|
||||
{
|
||||
debug("This is EFI partition table\n");
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
if (grub_memcmp(gpt->PartTbl[i].PartGuid, zeroguid, 16))
|
||||
{
|
||||
if (FileSectors < gpt->PartTbl[i].LastLBA)
|
||||
{
|
||||
debug("out of range: part[%d] LastLBA:%llu FileSectors:%llu\n", i,
|
||||
(ulonglong)gpt->PartTbl[i].LastLBA, (ulonglong)FileSectors);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("This is MBR partition table\n");
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
pt = gpt->MBR.PartTbl + i;
|
||||
if (FileSectors < pt->StartSectorId + pt->SectorCount)
|
||||
{
|
||||
debug("out of range: part[%d] LastLBA:%llu FileSectors:%llu\n", i,
|
||||
(ulonglong)(pt->StartSectorId + pt->SectorCount),
|
||||
(ulonglong)FileSectors);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
grub_file_close(file);
|
||||
grub_check_free(gpt);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_clear_key(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
@@ -3840,6 +3963,8 @@ static grub_err_t ventoy_cmd_get_fs_label(grub_extcmd_context_t ctxt, int argc,
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
debug("get fs label for %s\n", args[0]);
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
debug("ventoy_cmd_get_fs_label, invalid param num %d\n", argc);
|
||||
@@ -3861,19 +3986,20 @@ static grub_err_t ventoy_cmd_get_fs_label(grub_extcmd_context_t ctxt, int argc,
|
||||
}
|
||||
|
||||
fs = grub_fs_probe(dev);
|
||||
if (!fs)
|
||||
if (NULL == fs || NULL == fs->fs_label)
|
||||
{
|
||||
debug("grub_fs_probe failed, %s\n", device_name);
|
||||
debug("grub_fs_probe failed, %s %p %p\n", device_name, fs, fs->fs_label);
|
||||
goto end;
|
||||
}
|
||||
|
||||
fs->fs_label(dev, &label);
|
||||
if (label)
|
||||
{
|
||||
debug("label=<%s>\n", label);
|
||||
ventoy_set_env(args[1], label);
|
||||
grub_free(label);
|
||||
}
|
||||
|
||||
|
||||
rc = 0;
|
||||
|
||||
end:
|
||||
@@ -4255,6 +4381,8 @@ static int ventoy_env_init(void)
|
||||
grub_snprintf(buf, sizeof(buf), "%p", g_grub_param);
|
||||
grub_env_set("env_param", buf);
|
||||
grub_env_set("ventoy_env_param", buf);
|
||||
|
||||
grub_env_export("env_param");
|
||||
grub_env_export("ventoy_env_param");
|
||||
}
|
||||
|
||||
@@ -4277,6 +4405,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_clear_img", ventoy_cmd_clear_img, 0, NULL, "", "clear image list", NULL },
|
||||
{ "vt_img_name", ventoy_cmd_img_name, 0, NULL, "{imageID} {var}", "get image name", NULL },
|
||||
{ "vt_chosen_img_path", ventoy_cmd_chosen_img_path, 0, NULL, "{var}", "get chosen img path", NULL },
|
||||
{ "vt_ext_select_img_path", ventoy_cmd_ext_select_img_path, 0, NULL, "{var}", "select chosen img path", NULL },
|
||||
{ "vt_img_sector", ventoy_cmd_img_sector, 0, NULL, "{imageName}", "", NULL },
|
||||
{ "vt_dump_img_sector", ventoy_cmd_dump_img_sector, 0, NULL, "", "", NULL },
|
||||
{ "vt_load_wimboot", ventoy_cmd_load_wimboot, 0, NULL, "", "", NULL },
|
||||
@@ -4363,6 +4492,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_parse_iso_create_date", ventoy_cmd_parse_create_date, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_freenas_ver", ventoy_cmd_parse_freenas_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_parse_freebsd_ver", ventoy_cmd_unix_freebsd_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_parse_freebsd_ver_elf", ventoy_cmd_unix_freebsd_ver_elf, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_reset", ventoy_cmd_unix_reset, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_replace_conf", ventoy_cmd_unix_replace_conf, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_replace_ko", ventoy_cmd_unix_replace_ko, 0, NULL, "", "", NULL },
|
||||
@@ -4375,6 +4505,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_acpi_param", ventoy_cmd_acpi_param, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_secureboot_var", ventoy_cmd_check_secureboot_var, 0, NULL, "", "", NULL },
|
||||
{ "vt_clear_key", ventoy_cmd_clear_key, 0, NULL, "", "", NULL },
|
||||
{ "vt_img_check_range", ventoy_cmd_img_check_range, 0, NULL, "", "", NULL },
|
||||
|
||||
};
|
||||
|
||||
|
@@ -284,7 +284,7 @@ extern char g_arch_mode_suffix[64];
|
||||
|
||||
extern int g_ventoy_debug;
|
||||
void ventoy_debug(const char *fmt, ...);
|
||||
#define debug(fmt, ...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, __VA_ARGS__)
|
||||
#define debug(fmt, args...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, ##args)
|
||||
|
||||
#define vtoy_ssprintf(buf, pos, fmt, ...) \
|
||||
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
|
||||
@@ -983,6 +983,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc,
|
||||
grub_err_t ventoy_cmd_unix_gzip_newko(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver_elf(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_check_device_result(int ret);
|
||||
int ventoy_check_device(grub_device_t dev);
|
||||
void ventoy_debug_dump_guid(const char *prefix, grub_uint8_t *guid);
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/net.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/elfload.h>
|
||||
#include <grub/ventoy.h>
|
||||
#include "ventoy_def.h"
|
||||
|
||||
@@ -383,6 +385,174 @@ grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, cha
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver_elf(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int j;
|
||||
int k;
|
||||
grub_elf_t elf = NULL;
|
||||
grub_off_t offset = 0;
|
||||
grub_uint32_t len = 0;
|
||||
char *str = NULL;
|
||||
char *data = NULL;
|
||||
void *hdr = NULL;
|
||||
char ver[64] = {0};
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
debug("Invalid argc %d\n", argc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
data = grub_zalloc(8192);
|
||||
if (!data)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
elf = grub_elf_open(args[0], GRUB_FILE_TYPE_LINUX_INITRD);
|
||||
if (!elf)
|
||||
{
|
||||
debug("Failed to open file %s\n", args[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (args[1][0] == '6')
|
||||
{
|
||||
Elf64_Ehdr *e = &(elf->ehdr.ehdr64);
|
||||
Elf64_Shdr *h;
|
||||
Elf64_Shdr *s;
|
||||
Elf64_Shdr *t;
|
||||
Elf64_Half i;
|
||||
|
||||
h = hdr = grub_zalloc(e->e_shnum * e->e_shentsize);
|
||||
if (!h)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
debug("read section header %u %u %u\n", e->e_shnum, e->e_shentsize, e->e_shstrndx);
|
||||
grub_file_seek(elf->file, e->e_shoff);
|
||||
grub_file_read(elf->file, h, e->e_shnum * e->e_shentsize);
|
||||
|
||||
s = (Elf64_Shdr *)((char *)h + e->e_shstrndx * e->e_shentsize);
|
||||
str = grub_malloc(s->sh_size + 1);
|
||||
if (!str)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
str[s->sh_size] = 0;
|
||||
|
||||
debug("read string table %u %u\n", (grub_uint32_t)s->sh_offset, (grub_uint32_t)s->sh_size);
|
||||
grub_file_seek(elf->file, s->sh_offset);
|
||||
grub_file_read(elf->file, str, s->sh_size);
|
||||
|
||||
for (t = h, i = 0; i < e->e_shnum; i++)
|
||||
{
|
||||
if (grub_strcmp(str + t->sh_name, ".data") == 0)
|
||||
{
|
||||
offset = t->sh_offset;
|
||||
len = t->sh_size;
|
||||
debug("find .data section at %u %u\n", (grub_uint32_t)offset, len);
|
||||
break;
|
||||
}
|
||||
t = (Elf64_Shdr *)((char *)t + e->e_shentsize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Elf32_Ehdr *e = &(elf->ehdr.ehdr32);
|
||||
Elf32_Shdr *h;
|
||||
Elf32_Shdr *s;
|
||||
Elf32_Shdr *t;
|
||||
Elf32_Half i;
|
||||
|
||||
h = hdr = grub_zalloc(e->e_shnum * e->e_shentsize);
|
||||
if (!h)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
debug("read section header %u %u %u\n", e->e_shnum, e->e_shentsize, e->e_shstrndx);
|
||||
grub_file_seek(elf->file, e->e_shoff);
|
||||
grub_file_read(elf->file, h, e->e_shnum * e->e_shentsize);
|
||||
|
||||
s = (Elf32_Shdr *)((char *)h + e->e_shstrndx * e->e_shentsize);
|
||||
str = grub_malloc(s->sh_size + 1);
|
||||
if (!str)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
str[s->sh_size] = 0;
|
||||
|
||||
debug("read string table %u %u\n", (grub_uint32_t)s->sh_offset, (grub_uint32_t)s->sh_size);
|
||||
grub_file_seek(elf->file, s->sh_offset);
|
||||
grub_file_read(elf->file, str, s->sh_size);
|
||||
|
||||
for (t = h, i = 0; i < e->e_shnum; i++)
|
||||
{
|
||||
if (grub_strcmp(str + t->sh_name, ".data") == 0)
|
||||
{
|
||||
offset = t->sh_offset;
|
||||
len = t->sh_size;
|
||||
debug("find .data section at %u %u\n", (grub_uint32_t)offset, len);
|
||||
break;
|
||||
}
|
||||
t = (Elf32_Shdr *)((char *)t + e->e_shentsize);
|
||||
}
|
||||
}
|
||||
|
||||
if (offset == 0 || len == 0)
|
||||
{
|
||||
debug(".data section not found %s\n", args[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
grub_file_seek(elf->file, offset + len - 8192);
|
||||
grub_file_read(elf->file, data, 8192);
|
||||
|
||||
for (j = 0; j < 8192 - 12; j++)
|
||||
{
|
||||
if (grub_strncmp(data + j, "@(#)FreeBSD ", 12) == 0)
|
||||
{
|
||||
for (k = j + 12; k < 8192; k++)
|
||||
{
|
||||
if (0 == grub_isdigit(data[k]) && data[k] != '.')
|
||||
{
|
||||
data[k] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grub_snprintf(ver, sizeof(ver), "%s", data + j + 12);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ver[0])
|
||||
{
|
||||
k = (int)grub_strtoul(ver, NULL, 10);
|
||||
debug("freebsd version:<%s> <%d.x>\n", ver, k);
|
||||
grub_snprintf(ver, sizeof(ver), "%d.x", k);
|
||||
ventoy_set_env(args[2], ver);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("freebsd version:<%s>\n", "NOT FOUND");
|
||||
}
|
||||
|
||||
out:
|
||||
grub_check_free(str);
|
||||
grub_check_free(hdr);
|
||||
grub_check_free(data);
|
||||
check_free(elf, grub_elf_close);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_uint32_t i;
|
||||
|
@@ -12,14 +12,14 @@ make install
|
||||
PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
|
||||
|
||||
net_modules_legacy="net tftp http"
|
||||
all_modules_legacy="setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
|
||||
all_modules_legacy="file setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
|
||||
|
||||
net_modules_uefi="efinet net tftp http"
|
||||
all_modules_uefi="setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
all_modules_arm64_uefi="setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_arm64_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
all_modules_mips64el_uefi="setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_mips64el_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
|
||||
if [ "$1" = "uefi" ]; then
|
||||
|
@@ -19,9 +19,6 @@
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
#ventoy_systemd_udevd_work_around
|
||||
#ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
|
||||
|
||||
if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
VTKS="inst.ks=file:$VTOY_PATH/autoinstall"
|
||||
else
|
||||
@@ -40,7 +37,25 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
echo "VTKS=$VTKS" >> $VTLOG
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
VTOVERLAY="rd.live.overlay=/dev/dm-1:/vtoyoverlayfs/overlayfs"
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/openEuler/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
#close selinux
|
||||
$BUSYBOX_PATH/mkdir -p $VTOY_PATH/selinuxfs
|
||||
if $BUSYBOX_PATH/mount -t selinuxfs selinuxfs $VTOY_PATH/selinuxfs; then
|
||||
echo 1 > $VTOY_PATH/selinuxfs/disable
|
||||
$BUSYBOX_PATH/umount $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
$BUSYBOX_PATH/rm -rf $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
|
||||
|
||||
echo "VTKS=$VTKS VTOVERLAY=$VTOVERLAY" >> $VTLOG
|
||||
|
||||
if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
|
||||
@@ -49,11 +64,7 @@ if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
fi
|
||||
echo "vtInstDD=$vtInstDD" >> $VTLOG
|
||||
|
||||
if $GREP -q 'root=live' /proc/cmdline; then
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
else
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
fi
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
|
||||
ventoy_set_inotify_script openEuler/ventoy-inotifyd-hook.sh
|
||||
|
||||
@@ -66,14 +77,15 @@ fi
|
||||
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
if [ -f /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/openEuler/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
# suppress write protected mount warning
|
||||
if [ -e /usr/sbin/anaconda-diskroot ]; then
|
||||
if [ -f /usr/sbin/anaconda-diskroot ]; then
|
||||
$SED 's/^mount $dev $repodir/mount -oro $dev $repodir/' -i /usr/sbin/anaconda-diskroot
|
||||
fi
|
||||
|
||||
|
@@ -29,20 +29,11 @@ if is_inotify_ventoy_part $3; then
|
||||
|
||||
vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
|
||||
|
||||
vtGenRulFile='/etc/udev/rules.d/99-live-squash.rules'
|
||||
if [ -e $vtGenRulFile ] && $GREP -q dmsquash $vtGenRulFile; then
|
||||
vtScript=$($GREP -m1 'RUN.=' $vtGenRulFile | $AWK -F'RUN.=' '{print $2}' | $SED 's/"\(.*\)".*/\1/')
|
||||
vtlog "vtScript=$vtScript"
|
||||
$vtScript
|
||||
else
|
||||
vtlog "$vtGenRulFile not exist..."
|
||||
fi
|
||||
|
||||
vtlog "find ventoy partition ..."
|
||||
|
||||
vtReplaceOpt=noreplace
|
||||
#vtReplaceOpt=noreplace
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3
|
||||
|
||||
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
|
21
IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh
Normal file
21
IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
[ -d /run/initramfs/overlayfs$pathspec ] || mkdir -p /run/initramfs/overlayfs$pathspec
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ] || mkdir -p /run/initramfs/overlayfs$pathspec/../ovlwork
|
29
IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh
Normal file
29
IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/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
|
||||
|
||||
repodev=$(ls $VTOY_PATH/dev_backup*)
|
||||
echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline
|
||||
|
||||
PATH=$VTPATH_OLD
|
@@ -45,7 +45,8 @@ if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/rhel7/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/rhel7/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
$SED "s/osmin.img/osmin.imgxxxx/g" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
#close selinux
|
||||
@@ -85,6 +86,20 @@ fi
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
|
||||
|
||||
vtNeedRepo=
|
||||
if [ -f /etc/system-release ]; then
|
||||
if $GREP -q 'RED OS' /etc/system-release; then
|
||||
vtNeedRepo="yes"
|
||||
fi
|
||||
fi
|
||||
if $GREP -q el8 /proc/version; then
|
||||
vtNeedRepo="yes"
|
||||
fi
|
||||
|
||||
if [ "$vtNeedRepo" = "yes" ]; then
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
|
||||
fi
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/rhel7/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
|
||||
|
@@ -41,14 +41,8 @@ if is_inotify_ventoy_part $3; then
|
||||
vtlog "find ventoy partition ..."
|
||||
|
||||
vtReplaceOpt=noreplace
|
||||
|
||||
if $GREP -q el8 /proc/version && [ -f /etc/system-release ]; then
|
||||
vtRhel8Ver=$($SED "s#.*8\.\([0-9]*\).*#\1#" /etc/system-release)
|
||||
if [ $vtRhel8Ver -ge 3 ]; then
|
||||
vtReplaceOpt=""
|
||||
elif $GREP -q "Stream" /etc/system-release; then
|
||||
vtReplaceOpt=""
|
||||
fi
|
||||
if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then
|
||||
vtReplaceOpt=""
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
|
||||
|
29
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
Normal file
29
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/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
|
||||
|
||||
repodev=$(ls $VTOY_PATH/dev_backup*)
|
||||
echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline
|
||||
|
||||
PATH=$VTPATH_OLD
|
@@ -45,6 +45,9 @@ echo -n $vtDM > /ventoy/vtDM
|
||||
ventoy_create_dev_ventoy_part
|
||||
mdev -s
|
||||
|
||||
mkdir /ventoy_rdroot
|
||||
mount /dev/ventoy2 /ventoy_rdroot
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
||||
|
@@ -19,12 +19,39 @@
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$BUSYBOX_PATH/mkdir /sys
|
||||
$BUSYBOX_PATH/mount -t proc proc /proc
|
||||
$BUSYBOX_PATH/mount -t sysfs sys /sys
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
$BUSYBOX_PATH/mdev -s
|
||||
wrt_insmod() {
|
||||
kbit=$1
|
||||
kv=$(uname -r)
|
||||
|
||||
echo "insmod $kv $kbit" >> $VTOY_PATH/log
|
||||
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dax.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dax.ko > /dev/null 2>&1
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dm-mod.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko > /dev/null 2>&1
|
||||
}
|
||||
|
||||
#$BUSYBOX_PATH/sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
|
||||
exec $BUSYBOX_PATH/sh
|
||||
mkdir /sys
|
||||
mount -t sysfs sys /sys
|
||||
mdev -s
|
||||
|
||||
|
||||
if [ -f /ventoy_openwrt.xz ]; then
|
||||
tar xf /ventoy_openwrt.xz -C /
|
||||
rm -f /ventoy_openwrt.xz
|
||||
fi
|
||||
|
||||
|
||||
if uname -m | egrep -q "amd64|x86_64"; then
|
||||
wrt_insmod 64
|
||||
else
|
||||
wrt_insmod generic
|
||||
if lsmod | grep -q 'dm-mod'; then
|
||||
echo "insmod generic failed" >> $VTOY_PATH/log
|
||||
else
|
||||
wrt_insmod legacy
|
||||
fi
|
||||
fi
|
||||
|
||||
sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
|
Binary file not shown.
@@ -93,7 +93,7 @@ terminal:
|
||||
div:
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -318,13 +318,8 @@ function distro_specify_initrd_file_phase2 {
|
||||
}
|
||||
|
||||
function ventoy_get_ghostbsd_ver {
|
||||
|
||||
# vt_parse_iso_create_date "$1/${chosen_path}" vt_create_date
|
||||
# if regexp "^202005" "$vt_create_date"; then
|
||||
# set vt_freebsd_ver=12.x
|
||||
# fi
|
||||
|
||||
set vt_freebsd_ver=12.x
|
||||
# fallback to parse version from elf /boot/kernel/kernel
|
||||
set vt_freebsd_ver=xx
|
||||
}
|
||||
|
||||
function ventoy_get_furybsd_ver {
|
||||
@@ -366,11 +361,18 @@ function ventoy_get_truenas_ver {
|
||||
}
|
||||
|
||||
function ventoy_get_midnightbsd_ver {
|
||||
set vt_freebsd_ver=11.x
|
||||
if vt_str_begin "$vt_volume_id" "1_"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif vt_str_begin "$vt_volume_id" "2_"; then
|
||||
set vt_freebsd_ver=2.x
|
||||
elif vt_str_begin "$vt_volume_id" "3_"; then
|
||||
set vt_freebsd_ver=3.x
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
set vtFreeBsdDistro=FreeBSD
|
||||
set vt_freebsd_ver=xx
|
||||
|
||||
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
|
||||
ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
|
||||
@@ -421,8 +423,11 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
elif vt_strstr "${chosen_path}" "MidnightBSD"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
else
|
||||
set vt_freebsd_ver=12.x
|
||||
fi
|
||||
|
||||
|
||||
if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
|
||||
set vtFreeBsdDistro=ClonOS
|
||||
fi
|
||||
|
||||
set vt_freebsd_bit=64
|
||||
@@ -433,10 +438,20 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
if [ -e (loop)/boot/kernel/kernel ]; then
|
||||
vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
|
||||
fi
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
set vt_freebsd_ver=13.x
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
unset vt_unix_mod_path
|
||||
@@ -447,10 +462,6 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
|
||||
set vtFreeBsdDistro=ClonOS
|
||||
fi
|
||||
|
||||
vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
|
||||
vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
|
||||
}
|
||||
@@ -891,9 +902,39 @@ function legacy_linux_menu_func {
|
||||
ventoy_debug_pause
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
if vt_check_mode 3; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
# fallback
|
||||
set vtback_root=$root
|
||||
vt_push_last_entry
|
||||
set vtback_theme=$theme
|
||||
unset theme
|
||||
|
||||
vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy
|
||||
|
||||
set root=(loop)
|
||||
set vtback_cfg_find=0
|
||||
for cfg in "/boot/grub/grub.cfg" "/EFI/BOOT/grub.cfg" "/EFI/debian/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "/grub/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||
if [ -e "$cfg" ]; then
|
||||
set vtback_cfg_find=1
|
||||
configfile "$cfg"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unset_boot_opt
|
||||
set root=$vtback_root
|
||||
set theme=$vtback_theme
|
||||
vt_pop_last_entry
|
||||
ventoy_gui_console
|
||||
else
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
fi
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
@@ -1486,6 +1527,51 @@ function ventoy_img_batocera {
|
||||
vt_unset_boot_opt
|
||||
}
|
||||
|
||||
function ventoy_img_openwrt {
|
||||
if [ -e (vtimghd,2)/lib64 ]; then
|
||||
set ventoy_busybox_ver=64
|
||||
fi
|
||||
|
||||
if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
|
||||
ventoy_gui_console
|
||||
echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
|
||||
echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
|
||||
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
|
||||
read vtInputKey
|
||||
ventoy_cli_console
|
||||
return
|
||||
fi
|
||||
|
||||
if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
|
||||
ventoy_debug_pause
|
||||
else
|
||||
ventoy_gui_console
|
||||
echo -e "\n IMG file need processed. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
|
||||
echo -e " 此 IMG 文件必须处理之后才能支持。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
|
||||
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
|
||||
read vtInputKey
|
||||
ventoy_cli_console
|
||||
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
|
||||
|
||||
vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
|
||||
|
||||
|
||||
#boot image file
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
|
||||
vt_img_hook_root
|
||||
|
||||
set root=(vtimghd,1)
|
||||
configfile (vtimghd,1)/boot/grub/grub.cfg
|
||||
|
||||
vt_img_unhook_root
|
||||
vt_unset_boot_opt
|
||||
}
|
||||
|
||||
function ventoy_img_tails {
|
||||
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
|
||||
@@ -1546,8 +1632,9 @@ function img_common_menuentry {
|
||||
|
||||
vt_img_extra_initrd_reset
|
||||
|
||||
|
||||
vt_get_fs_label (vtimghd,1) vtImgHd1Label
|
||||
if [ -d (vtimghd,2)/lib ]; then
|
||||
if [ -d (vtimghd,2)/lib ]; then
|
||||
vt_get_fs_label (vtimghd,2) vtImgHd2Label
|
||||
fi
|
||||
|
||||
@@ -1555,6 +1642,7 @@ function img_common_menuentry {
|
||||
vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
|
||||
fi
|
||||
|
||||
|
||||
if [ -e (vtimghd,1)/easy.sfs ]; then
|
||||
ventoy_img_easyos
|
||||
elif [ -e (vtimghd,1)/volumio.initrd ]; then
|
||||
@@ -1575,6 +1663,8 @@ function img_common_menuentry {
|
||||
ventoy_img_recalbox
|
||||
elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
|
||||
ventoy_img_ubos
|
||||
elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
|
||||
ventoy_img_openwrt
|
||||
elif [ -f (vtimghd,1)/efi/boot/mt86.png ]; then
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
img_unsupport_tip
|
||||
@@ -1612,7 +1702,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.40"
|
||||
set VENTOY_VERSION="1.0.41"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -1786,6 +1876,7 @@ export gfxpayload
|
||||
export vtoydev
|
||||
export vtoy_path
|
||||
export vtdebug_flag
|
||||
export vtoy_iso_fs
|
||||
export vtoy_iso_part
|
||||
export vtoy_efi_part
|
||||
export VENTOY_VERSION
|
||||
|
Binary file not shown.
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -123,7 +123,7 @@ crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536: pci
|
||||
biosdisk:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
|
||||
lsapm:
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -27,6 +27,10 @@ sh mkcpio.sh
|
||||
sh mkloopex.sh
|
||||
cd -
|
||||
|
||||
cd ../Unix
|
||||
sh pack_unix.sh
|
||||
cd -
|
||||
|
||||
cd ../LinuxGUI
|
||||
sh language.sh || exit 1
|
||||
sh build.sh
|
||||
@@ -78,6 +82,7 @@ cp $OPT ./tool/i386/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_i386
|
||||
cp $OPT ./tool/x86_64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_x86_64
|
||||
cp $OPT ./tool/aarch64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_aarch64
|
||||
|
||||
|
||||
rm -f $tmpmnt/grub/i386-pc/*.img
|
||||
|
||||
|
||||
|
Binary file not shown.
@@ -16,7 +16,7 @@ You can copy many image files at a time and ventoy will give you a boot menu to
|
||||
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
|
||||
Both MBR and GPT partition style are supported in the same way.<br/>
|
||||
Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
|
||||
650+ ISO files are tested. 90%+ distros in distrowatch.com supported. <br/>
|
||||
700+ ISO files are tested. 90%+ distros in distrowatch.com supported. <br/>
|
||||
</h4>
|
||||
|
||||
# Features
|
||||
@@ -35,7 +35,7 @@ Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
|
||||
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
|
||||
* ISO files larger than 4GB supported
|
||||
* Native boot menu style for Legacy & UEFI
|
||||
* Most type of OS supported, 650+ iso files tested
|
||||
* Most type of OS supported, 700+ iso files tested
|
||||
* Linux vDisk boot supported
|
||||
* Not only boot but also complete installation process
|
||||
* Menu dynamically switchable between List/TreeView mode
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -435,43 +435,6 @@ static int vtoy_printf_iso_path(ventoy_os_param *param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
|
||||
{
|
||||
int cnt = 0;
|
||||
char *path = param->vtoy_img_path;
|
||||
const char *fs;
|
||||
|
||||
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
|
||||
if (cnt > 1)
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
}
|
||||
else if (cnt == 0)
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
|
||||
}
|
||||
|
||||
if (param->vtoy_disk_part_type < ventoy_fs_max)
|
||||
{
|
||||
fs = g_ventoy_fs[param->vtoy_disk_part_type];
|
||||
}
|
||||
else
|
||||
{
|
||||
fs = "unknown";
|
||||
}
|
||||
|
||||
if (1 == cnt)
|
||||
{
|
||||
printf("/dev/%s#%s#%s\n", diskname, fs, path);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int vtoy_check_device(ventoy_os_param *param, const char *device)
|
||||
{
|
||||
unsigned long long size;
|
||||
@@ -499,6 +462,47 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
|
||||
}
|
||||
}
|
||||
|
||||
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
|
||||
{
|
||||
int cnt = 0;
|
||||
char *path = param->vtoy_img_path;
|
||||
const char *fs;
|
||||
|
||||
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
|
||||
debug("find disk by size %llu, cnt=%d...\n", (unsigned long long)param->vtoy_disk_size, cnt);
|
||||
if (1 == cnt)
|
||||
{
|
||||
if (vtoy_check_device(param, diskname) != 0)
|
||||
{
|
||||
cnt = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
debug("find disk by guid cnt=%d...\n", cnt);
|
||||
}
|
||||
|
||||
if (param->vtoy_disk_part_type < ventoy_fs_max)
|
||||
{
|
||||
fs = g_ventoy_fs[param->vtoy_disk_part_type];
|
||||
}
|
||||
else
|
||||
{
|
||||
fs = "unknown";
|
||||
}
|
||||
|
||||
if (1 == cnt)
|
||||
{
|
||||
printf("/dev/%s#%s#%s\n", diskname, fs, path);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find disk and image path from ventoy runtime data.
|
||||
* By default data is read from phymem(legacy bios) or efivar(UEFI), if -f is input, data is read from file.
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user