Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
433d854aab | ||
|
4cb9134e5c | ||
|
faceaf4267 | ||
|
37edd5a349 | ||
|
ed0f8721d7 | ||
|
d80a008c04 | ||
|
036e9cc167 | ||
|
26258653b7 | ||
|
754e754412 | ||
|
5af01de7c2 | ||
|
f9763a44b2 | ||
|
d063dbb7f2 | ||
|
89938e3c78 | ||
|
85840f626b | ||
|
7d1507906d | ||
|
0f8478fbe1 | ||
|
a6d3ecc7a9 | ||
|
5817b8b7b0 | ||
|
8493715fb4 | ||
|
3c46432d6f | ||
|
88dcceeabc | ||
|
ef204263ad | ||
|
e08e6705cf | ||
|
a8b2fdccc7 | ||
|
85348956df | ||
|
aa0a2ed067 | ||
|
49ceaa0f61 | ||
|
23986d742d |
@@ -202,3 +202,10 @@
|
||||
https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/ busybox_ASH
|
||||
SHA-256: 2943f02f85fee0c9551aec47110a558a73f919c032b3c51e56d6f197b5ec4d7b
|
||||
|
||||
5.12 7za.exe
|
||||
download from https://www.7-zip.org/a/7z1900-extra.7z
|
||||
ISNTALL/ventoy/7z/64/7za.exe SHA-256: 8117e40ee7f824f63373a4f5625bb62749f69159d0c449b3ce2f35aad3b83549
|
||||
ISNTALL/ventoy/7z/32/7za.exe SHA-256: ea308c76a2f927b160a143d94072b0dce232e04b751f0c6432a94e05164e716d
|
||||
|
||||
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <Ventoy.h>
|
||||
|
||||
BOOLEAN gDebugPrint = FALSE;
|
||||
BOOLEAN gLoadIsoEfi = FALSE;
|
||||
ventoy_ram_disk g_ramdisk_param;
|
||||
ventoy_chain_head *g_chain;
|
||||
ventoy_img_chunk *g_chunk;
|
||||
@@ -52,6 +53,8 @@ static grub_env_get_pf grub_env_get = NULL;
|
||||
ventoy_grub_param_file_replace *g_file_replace_list = NULL;
|
||||
ventoy_efi_file_replace g_efi_file_replace;
|
||||
|
||||
CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
|
||||
|
||||
BOOLEAN g_fix_windows_1st_cdrom_issue = FALSE;
|
||||
|
||||
STATIC BOOLEAN g_hook_keyboard = FALSE;
|
||||
@@ -484,6 +487,93 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk_fs(IN EFI_HANDLE ImageHandle)
|
||||
{
|
||||
UINTN i = 0;
|
||||
UINTN Count = 0;
|
||||
EFI_HANDLE Parent = NULL;
|
||||
EFI_HANDLE *Handles = NULL;
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *pFile = NULL;
|
||||
EFI_DEVICE_PATH_PROTOCOL *pDevPath = NULL;
|
||||
|
||||
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSimpleFileSystemProtocolGuid,
|
||||
NULL, &Count, &Handles);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
debug("ventoy_find_iso_disk_fs fs count:%u", Count);
|
||||
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
Status = gBS->HandleProtocol(Handles[i], &gEfiSimpleFileSystemProtocolGuid, (VOID **)&pFile);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol(Handles[i], &gEfiDevicePathProtocolGuid,
|
||||
(VOID **)&pDevPath,
|
||||
ImageHandle,
|
||||
Handles[i],
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
debug("Failed to open device path protocol %r", Status);
|
||||
continue;
|
||||
}
|
||||
|
||||
debug("Handle:%p FS DP: <%s>", Handles[i], ConvertDevicePathToText(pDevPath, FALSE, FALSE));
|
||||
Parent = ventoy_get_parent_handle(pDevPath);
|
||||
|
||||
if (Parent == gBlockData.RawBlockIoHandle)
|
||||
{
|
||||
debug("Find ventoy disk fs");
|
||||
gBlockData.DiskFsHandle = Handles[i];
|
||||
gBlockData.pDiskFs = pFile;
|
||||
gBlockData.pDiskFsDevPath = pDevPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool(Handles);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS EFIAPI ventoy_load_isoefi_driver(IN EFI_HANDLE ImageHandle)
|
||||
{
|
||||
EFI_HANDLE Image = NULL;
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
CHAR16 LogVar[4] = L"5";
|
||||
|
||||
Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
|
||||
gIso9660EfiDriverPath,
|
||||
sizeof(gIso9660EfiDriverPath),
|
||||
&Image);
|
||||
debug("load iso efi driver status:%r", Status);
|
||||
|
||||
if (gDebugPrint)
|
||||
{
|
||||
gRT->SetVariable(L"FS_LOGGING", &gShellVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof(LogVar), LogVar);
|
||||
}
|
||||
|
||||
gRT->SetVariable(L"FS_NAME_NOCASE", &gShellVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof(LogVar), LogVar);
|
||||
|
||||
gBlockData.IsoDriverImage = Image;
|
||||
Status = gBS->StartImage(Image, NULL, NULL);
|
||||
debug("Start iso efi driver status:%r", Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
{
|
||||
UINT32 i = 0;
|
||||
@@ -513,6 +603,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
gDebugPrint = TRUE;
|
||||
}
|
||||
|
||||
if (StrStr(pCmdLine, L"isoefi=on"))
|
||||
{
|
||||
gLoadIsoEfi = TRUE;
|
||||
}
|
||||
|
||||
pPos = StrStr(pCmdLine, L"FirstTry=@");
|
||||
if (pPos)
|
||||
{
|
||||
@@ -639,6 +734,11 @@ EFI_STATUS EFIAPI ventoy_clean_env(VOID)
|
||||
FreePool(g_sector_flag);
|
||||
g_sector_flag_num = 0;
|
||||
|
||||
if (gLoadIsoEfi && gBlockData.IsoDriverImage)
|
||||
{
|
||||
gBS->UnloadImage(gBlockData.IsoDriverImage);
|
||||
}
|
||||
|
||||
gBS->DisconnectController(gBlockData.Handle, NULL, NULL);
|
||||
|
||||
gBS->UninstallMultipleProtocolInterfaces(gBlockData.Handle,
|
||||
@@ -857,6 +957,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
|
||||
ventoy_save_variable();
|
||||
ventoy_find_iso_disk(ImageHandle);
|
||||
|
||||
if (gLoadIsoEfi)
|
||||
{
|
||||
ventoy_find_iso_disk_fs(ImageHandle);
|
||||
ventoy_load_isoefi_driver(ImageHandle);
|
||||
}
|
||||
|
||||
ventoy_debug_pause();
|
||||
|
||||
ventoy_install_blockio(ImageHandle, g_chain->virt_img_size_in_bytes);
|
||||
|
@@ -168,6 +168,8 @@ typedef struct ventoy_virt_chunk
|
||||
#define VTOY_BLOCK_DEVICE_PATH_GUID \
|
||||
{ 0x37b87ac6, 0xc180, 0x4583, { 0xa7, 0x05, 0x41, 0x4d, 0xa8, 0xf7, 0x7e, 0xd2 }}
|
||||
|
||||
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_x64.efi"
|
||||
|
||||
#define VTOY_BLOCK_DEVICE_PATH_NAME L"ventoy"
|
||||
|
||||
#if defined (MDE_CPU_IA32)
|
||||
@@ -208,6 +210,7 @@ typedef struct vtoy_block_data
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *pDiskFs;
|
||||
EFI_DEVICE_PATH_PROTOCOL *pDiskFsDevPath;
|
||||
|
||||
EFI_HANDLE IsoDriverImage;
|
||||
}vtoy_block_data;
|
||||
|
||||
|
||||
|
@@ -699,8 +699,16 @@ STATIC EFI_STATUS EFIAPI
|
||||
ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
|
||||
{
|
||||
(VOID)This;
|
||||
|
||||
if (Position <= g_efi_file_replace.FileSizeBytes)
|
||||
{
|
||||
g_efi_file_replace.CurPos = Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_efi_file_replace.CurPos = g_efi_file_replace.FileSizeBytes;
|
||||
}
|
||||
|
||||
g_efi_file_replace.CurPos = Position;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -815,6 +823,8 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
|
||||
CHAR8 TmpName[256];
|
||||
ventoy_virt_chunk *virt = NULL;
|
||||
|
||||
debug("## ventoy_wrapper_file_open <%s> ", Name);
|
||||
|
||||
Status = g_original_fopen(This, New, Name, Mode, Attributes);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
@@ -850,6 +860,11 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (StrCmp(Name, L"\\EFI\\BOOT") == 0)
|
||||
{
|
||||
(*New)->Open = ventoy_wrapper_file_open;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@@ -1578,10 +1578,12 @@ module = {
|
||||
name = ventoy;
|
||||
common = ventoy/ventoy.c;
|
||||
common = ventoy/ventoy_linux.c;
|
||||
common = ventoy/ventoy_unix.c;
|
||||
common = ventoy/ventoy_windows.c;
|
||||
common = ventoy/ventoy_plugin.c;
|
||||
common = ventoy/ventoy_json.c;
|
||||
common = ventoy/lzx.c;
|
||||
common = ventoy/xpress.c;
|
||||
common = ventoy/huffman.c;
|
||||
};
|
||||
|
||||
|
@@ -99,7 +99,7 @@ grub_env_new_context (int export_all)
|
||||
grub_err_t
|
||||
grub_env_context_open (void)
|
||||
{
|
||||
return grub_env_new_context (1);
|
||||
return grub_env_new_context (grub_env_get("ventoy_new_context") ? 0 : 1);
|
||||
}
|
||||
|
||||
int grub_extractor_level = 0;
|
||||
|
@@ -853,12 +853,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
}
|
||||
break;
|
||||
case GRUB_TERM_KEY_F6:
|
||||
cmdstr = grub_env_get("VTOY_F6_CMD");
|
||||
if (cmdstr)
|
||||
{
|
||||
menu_fini ();
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
goto refresh;
|
||||
if (0 == g_ventoy_fn_mutex) {
|
||||
cmdstr = grub_env_get("VTOY_F6_CMD");
|
||||
if (cmdstr)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_fn_mutex = 1;
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
g_ventoy_fn_mutex = 0;
|
||||
goto refresh;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GRUB_TERM_KEY_F7:
|
||||
|
@@ -305,6 +305,18 @@ static grub_err_t ventoy_cmd_break(grub_extcmd_context_t ctxt, int argc, char **
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_strstr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (grub_strstr(args[0], args[1])) ? 0 : 1;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_incr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
long value_long = 0;
|
||||
@@ -1389,7 +1401,7 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid)
|
||||
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid)
|
||||
{
|
||||
grub_disk_t disk;
|
||||
char *device_name;
|
||||
@@ -1459,6 +1471,7 @@ grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file)
|
||||
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
|
||||
{
|
||||
int i;
|
||||
int x86count = 0;
|
||||
grub_uint8_t buf[512];
|
||||
|
||||
grub_file_seek(file, sector * 2048);
|
||||
@@ -1470,6 +1483,11 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (buf[0] == 0x01 && buf[1] == 0x00)
|
||||
{
|
||||
x86count++;
|
||||
}
|
||||
|
||||
for (i = 64; i < (int)sizeof(buf); i += 32)
|
||||
{
|
||||
if ((buf[i] == 0x90 || buf[i] == 0x91) && buf[i + 1] == 0xEF)
|
||||
@@ -1477,6 +1495,12 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
|
||||
debug("%s efi eltorito offset %d 0x%02x\n", file->name, i, buf[i]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((buf[i] == 0x90 || buf[i] == 0x91) && buf[i + 1] == 0x00 && x86count == 1)
|
||||
{
|
||||
debug("0x9100 assume %s efi eltorito offset %d 0x%02x\n", file->name, i, buf[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
debug("%s does not contain efi eltorito\n", file->name);
|
||||
@@ -2005,6 +2029,17 @@ static grub_err_t ventoy_cmd_dump_img_list(grub_extcmd_context_t ctxt, int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_dump_injection(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
ventoy_plugin_dump_injection();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_dump_auto_install(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
@@ -2155,7 +2190,7 @@ static grub_err_t ventoy_cmd_find_bootable_hdd(grub_extcmd_context_t ctxt, int a
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s variable\n", cmd_raw_name);
|
||||
}
|
||||
|
||||
isopath = grub_env_get("iso_path");
|
||||
isopath = grub_env_get("vtoy_iso_part");
|
||||
if (!isopath)
|
||||
{
|
||||
debug("isopath is null %p\n", isopath);
|
||||
@@ -2208,6 +2243,129 @@ static grub_err_t ventoy_cmd_find_bootable_hdd(grub_extcmd_context_t ctxt, int a
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_read_1st_line(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len = 1024;
|
||||
grub_file_t file;
|
||||
char *buf = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s file var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = grub_malloc(len);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
buf[len - 1] = 0;
|
||||
grub_file_read(file, buf, len - 1);
|
||||
|
||||
ventoy_get_line(buf);
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
|
||||
grub_check_free(buf);
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_volume(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
grub_file_t file;
|
||||
char buf[64];
|
||||
ventoy_iso9660_vd pvd;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s sysid volid \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_file_seek(file, 16 * 2048);
|
||||
len = (int)grub_file_read(file, &pvd, sizeof(pvd));
|
||||
if (len != sizeof(pvd))
|
||||
{
|
||||
debug("failed to read pvd %d\n", len);
|
||||
goto end;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_memcpy(buf, pvd.sys, sizeof(pvd.sys));
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_memcpy(buf, pvd.vol, sizeof(pvd.vol));
|
||||
ventoy_set_env(args[2], buf);
|
||||
|
||||
end:
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_create_date(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
grub_file_t file;
|
||||
char buf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_file_seek(file, 16 * 2048 + 813);
|
||||
len = (int)grub_file_read(file, buf, 17);
|
||||
if (len != 17)
|
||||
{
|
||||
debug("failed to read create date %d\n", len);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
|
||||
{
|
||||
grub_uint64_t size = 0;
|
||||
@@ -2309,9 +2467,6 @@ static int ventoy_env_init(void)
|
||||
char buf[64];
|
||||
|
||||
grub_env_set("vtdebug_flag", "");
|
||||
grub_env_export("vtdebug_flag");
|
||||
|
||||
|
||||
|
||||
g_tree_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
|
||||
g_list_script_buf = grub_malloc(VTOY_MAX_SCRIPT_BUF);
|
||||
@@ -2333,6 +2488,7 @@ static int ventoy_env_init(void)
|
||||
static cmd_para ventoy_cmds[] =
|
||||
{
|
||||
{ "vt_incr", ventoy_cmd_incr, 0, NULL, "{Var} {INT}", "Increase integer variable", NULL },
|
||||
{ "vt_strstr", ventoy_cmd_strstr, 0, NULL, "", "", NULL },
|
||||
{ "vt_debug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtdebug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtbreak", ventoy_cmd_break, 0, NULL, "{level}", "set debug break", NULL },
|
||||
@@ -2352,6 +2508,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_dynamic_menu", ventoy_cmd_dynamic_menu, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_mode", ventoy_cmd_check_mode, 0, NULL, "", "", NULL },
|
||||
{ "vt_dump_img_list", ventoy_cmd_dump_img_list, 0, NULL, "", "", NULL },
|
||||
{ "vt_dump_injection", ventoy_cmd_dump_injection, 0, NULL, "", "", NULL },
|
||||
{ "vt_dump_auto_install", ventoy_cmd_dump_auto_install, 0, NULL, "", "", NULL },
|
||||
{ "vt_dump_persistence", ventoy_cmd_dump_persistence, 0, NULL, "", "", NULL },
|
||||
{ "vt_select_auto_install", ventoy_cmd_sel_auto_install, 0, NULL, "", "", NULL },
|
||||
@@ -2389,6 +2546,16 @@ static cmd_para ventoy_cmds[] =
|
||||
|
||||
{ "vt_load_plugin", ventoy_cmd_load_plugin, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_plugin_json", ventoy_cmd_plugin_check_json, 0, NULL, "", "", NULL },
|
||||
|
||||
{ "vt_1st_line", ventoy_cmd_read_1st_line, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_iso_volume", ventoy_cmd_parse_volume, 0, NULL, "", "", NULL },
|
||||
{ "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_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 },
|
||||
{ "vt_unix_chain_data", ventoy_cmd_unix_chain_data, 0, NULL, "", "", NULL },
|
||||
|
||||
};
|
||||
|
||||
|
@@ -123,6 +123,16 @@ typedef struct ventoy_udf_override
|
||||
grub_uint32_t position;
|
||||
}ventoy_udf_override;
|
||||
|
||||
typedef struct ventoy_iso9660_vd
|
||||
{
|
||||
grub_uint8_t type;
|
||||
grub_uint8_t id[5];
|
||||
grub_uint8_t ver;
|
||||
grub_uint8_t res;
|
||||
char sys[32];
|
||||
char vol[32];
|
||||
}ventoy_iso9660_vd;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define img_type_iso 0
|
||||
@@ -649,6 +659,15 @@ typedef struct menu_class
|
||||
struct menu_class *next;
|
||||
}menu_class;
|
||||
|
||||
typedef struct injection_config
|
||||
{
|
||||
int pathlen;
|
||||
char isopath[256];
|
||||
char archive[256];
|
||||
|
||||
struct injection_config *next;
|
||||
}injection_config;
|
||||
|
||||
extern int g_ventoy_menu_esc;
|
||||
extern int g_ventoy_suppress_esc;
|
||||
extern int g_ventoy_last_entry;
|
||||
@@ -658,14 +677,34 @@ extern int g_ventoy_iso_uefi_drv;
|
||||
extern int g_ventoy_case_insensitive;
|
||||
extern grub_uint8_t g_ventoy_chain_type;
|
||||
|
||||
|
||||
#define ventoy_unix_fill_virt(new_data, new_len) \
|
||||
{ \
|
||||
data_secs = (new_len + 2047) / 2048; \
|
||||
cur->mem_sector_start = sector; \
|
||||
cur->mem_sector_end = cur->mem_sector_start + data_secs; \
|
||||
cur->mem_sector_offset = offset; \
|
||||
cur->remap_sector_start = 0; \
|
||||
cur->remap_sector_end = 0; \
|
||||
cur->org_sector_start = 0; \
|
||||
grub_memcpy(override + offset, new_data, new_len); \
|
||||
cur++; \
|
||||
sector += data_secs; \
|
||||
offset += new_len; \
|
||||
chain->virt_img_size_in_bytes += data_secs * 2048; \
|
||||
}
|
||||
|
||||
char * ventoy_get_line(char *start);
|
||||
int ventoy_cmp_img(img_info *img1, img_info *img2);
|
||||
void ventoy_swap_img(img_info *img1, img_info *img2);
|
||||
char * ventoy_plugin_get_cur_install_template(const char *isopath);
|
||||
install_template * ventoy_plugin_find_install_template(const char *isopath);
|
||||
persistence_config * ventoy_plugin_find_persistent(const char *isopath);
|
||||
void ventoy_plugin_dump_injection(void);
|
||||
void ventoy_plugin_dump_auto_install(void);
|
||||
int ventoy_fill_windows_rtdata(void *buf, char *isopath);
|
||||
int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
|
||||
const char * ventoy_plugin_get_injection(const char *isopath);
|
||||
const char * ventoy_plugin_get_menu_alias(int type, const char *isopath);
|
||||
const char * ventoy_plugin_get_menu_class(int type, const char *name);
|
||||
int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
|
||||
@@ -676,6 +715,13 @@ grub_err_t ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt, in
|
||||
grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid);
|
||||
grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_replace_ko(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);
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
@@ -38,8 +38,7 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
static char * ventoy_get_line(char *start)
|
||||
char * ventoy_get_line(char *start)
|
||||
{
|
||||
if (start == NULL)
|
||||
{
|
||||
@@ -909,6 +908,8 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
|
||||
char *template_file = NULL;
|
||||
char *template_buf = NULL;
|
||||
char *persistent_buf = NULL;
|
||||
char *injection_buf = NULL;
|
||||
const char *injection_file = NULL;
|
||||
grub_uint8_t *buf = NULL;
|
||||
grub_uint32_t mod;
|
||||
grub_uint32_t headlen;
|
||||
@@ -917,8 +918,9 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
|
||||
grub_uint32_t img_chunk_size;
|
||||
grub_uint32_t template_size = 0;
|
||||
grub_uint32_t persistent_size = 0;
|
||||
grub_uint32_t injection_size = 0;
|
||||
grub_file_t file;
|
||||
grub_file_t scriptfile;
|
||||
grub_file_t tmpfile;
|
||||
ventoy_img_chunk_list chunk_list;
|
||||
|
||||
(void)ctxt;
|
||||
@@ -960,18 +962,18 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
|
||||
if (template_file)
|
||||
{
|
||||
debug("auto install template: <%s>\n", template_file);
|
||||
scriptfile = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[2], template_file);
|
||||
if (scriptfile)
|
||||
tmpfile = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[2], template_file);
|
||||
if (tmpfile)
|
||||
{
|
||||
debug("auto install script size %d\n", (int)scriptfile->size);
|
||||
template_size = scriptfile->size;
|
||||
debug("auto install script size %d\n", (int)tmpfile->size);
|
||||
template_size = tmpfile->size;
|
||||
template_buf = grub_malloc(template_size);
|
||||
if (template_buf)
|
||||
{
|
||||
grub_file_read(scriptfile, template_buf, template_size);
|
||||
grub_file_read(tmpfile, template_buf, template_size);
|
||||
}
|
||||
|
||||
grub_file_close(scriptfile);
|
||||
grub_file_close(tmpfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -983,7 +985,34 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
|
||||
debug("auto install script skipped or not configed %s\n", args[1]);
|
||||
}
|
||||
|
||||
g_ventoy_cpio_buf = grub_malloc(file->size + 4096 + template_size + persistent_size + img_chunk_size);
|
||||
injection_file = ventoy_plugin_get_injection(args[1]);
|
||||
if (injection_file)
|
||||
{
|
||||
debug("injection archive: <%s>\n", injection_file);
|
||||
tmpfile = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[2], injection_file);
|
||||
if (tmpfile)
|
||||
{
|
||||
debug("injection archive size:%d\n", (int)tmpfile->size);
|
||||
injection_size = tmpfile->size;
|
||||
injection_buf = grub_malloc(injection_size);
|
||||
if (injection_buf)
|
||||
{
|
||||
grub_file_read(tmpfile, injection_buf, injection_size);
|
||||
}
|
||||
|
||||
grub_file_close(tmpfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("Failed to open injection archive %s%s\n", args[2], injection_file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("injection not configed %s\n", args[1]);
|
||||
}
|
||||
|
||||
g_ventoy_cpio_buf = grub_malloc(file->size + 4096 + template_size + persistent_size + injection_size + img_chunk_size);
|
||||
if (NULL == g_ventoy_cpio_buf)
|
||||
{
|
||||
grub_file_close(file);
|
||||
@@ -1020,6 +1049,15 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
|
||||
persistent_buf = NULL;
|
||||
}
|
||||
|
||||
if (injection_size > 0 && injection_buf)
|
||||
{
|
||||
headlen = ventoy_cpio_newc_fill_head(buf, injection_size, injection_buf, "ventoy/ventoy_injection");
|
||||
buf += headlen + ventoy_align(injection_size, 4);
|
||||
|
||||
grub_free(injection_buf);
|
||||
injection_buf = NULL;
|
||||
}
|
||||
|
||||
/* step2: insert os param to cpio */
|
||||
headlen = ventoy_cpio_newc_fill_head(buf, 0, NULL, "ventoy/ventoy_os_param");
|
||||
padlen = sizeof(ventoy_os_param);
|
||||
|
@@ -44,6 +44,7 @@ static install_template *g_install_template_head = NULL;
|
||||
static persistence_config *g_persistence_head = NULL;
|
||||
static menu_alias *g_menu_alias_head = NULL;
|
||||
static menu_class *g_menu_class_head = NULL;
|
||||
static injection_config *g_injection_head = NULL;
|
||||
|
||||
static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
@@ -805,6 +806,96 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ventoy_plugin_injection_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *archive = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
|
||||
(void)isodisk;
|
||||
|
||||
if (json->enDataType != JSON_TYPE_ARRAY)
|
||||
{
|
||||
grub_printf("Not array %d\n", json->enDataType);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
|
||||
{
|
||||
path = vtoy_json_get_string_ex(pNode->pstChild, "image");
|
||||
if (!path)
|
||||
{
|
||||
grub_printf("image not found\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
archive = vtoy_json_get_string_ex(pNode->pstChild, "archive");
|
||||
if (!archive)
|
||||
{
|
||||
grub_printf("archive not found\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_printf("image: <%s> [%s]\n", path, ventoy_check_file_exist("%s%s", isodisk, path) ? "OK" : "NOT EXIST");
|
||||
grub_printf("archive: <%s> [%s]\n\n", archive, ventoy_check_file_exist("%s%s", isodisk, archive) ? "OK" : "NOT EXIST");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_plugin_injection_entry(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *archive = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
injection_config *node = NULL;
|
||||
injection_config *next = NULL;
|
||||
|
||||
(void)isodisk;
|
||||
|
||||
if (json->enDataType != JSON_TYPE_ARRAY)
|
||||
{
|
||||
debug("Not array %d\n", json->enDataType);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_injection_head)
|
||||
{
|
||||
for (node = g_injection_head; node; node = next)
|
||||
{
|
||||
next = node->next;
|
||||
grub_free(node);
|
||||
}
|
||||
|
||||
g_injection_head = NULL;
|
||||
}
|
||||
|
||||
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
|
||||
{
|
||||
path = vtoy_json_get_string_ex(pNode->pstChild, "image");
|
||||
archive = vtoy_json_get_string_ex(pNode->pstChild, "archive");
|
||||
if (path && path[0] == '/' && archive && archive[0] == '/')
|
||||
{
|
||||
node = grub_zalloc(sizeof(injection_config));
|
||||
if (node)
|
||||
{
|
||||
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", path);
|
||||
grub_snprintf(node->archive, sizeof(node->archive), "%s", archive);
|
||||
|
||||
if (g_injection_head)
|
||||
{
|
||||
node->next = g_injection_head;
|
||||
}
|
||||
|
||||
g_injection_head = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int type;
|
||||
@@ -914,6 +1005,7 @@ static plugin_entry g_plugin_entries[] =
|
||||
{ "persistence", ventoy_plugin_persistence_entry, ventoy_plugin_persistence_check },
|
||||
{ "menu_alias", ventoy_plugin_menualias_entry, ventoy_plugin_menualias_check },
|
||||
{ "menu_class", ventoy_plugin_menuclass_entry, ventoy_plugin_menuclass_check },
|
||||
{ "injection", ventoy_plugin_injection_entry, ventoy_plugin_injection_check },
|
||||
};
|
||||
|
||||
static int ventoy_parse_plugin_config(VTOY_JSON *json, const char *isodisk)
|
||||
@@ -995,6 +1087,20 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
void ventoy_plugin_dump_injection(void)
|
||||
{
|
||||
injection_config *node = NULL;
|
||||
|
||||
for (node = g_injection_head; node; node = node->next)
|
||||
{
|
||||
grub_printf("\nIMAGE:<%s>\n", node->isopath);
|
||||
grub_printf("ARCHIVE:<%s>\n", node->archive);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ventoy_plugin_dump_auto_install(void)
|
||||
{
|
||||
int i;
|
||||
@@ -1151,6 +1257,22 @@ end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
const char * ventoy_plugin_get_injection(const char *isopath)
|
||||
{
|
||||
injection_config *node = NULL;
|
||||
int len = (int)grub_strlen(isopath);
|
||||
|
||||
for (node = g_injection_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strcmp(node->isopath, isopath) == 0)
|
||||
{
|
||||
return node->archive;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
|
||||
{
|
||||
menu_alias *node = NULL;
|
||||
|
@@ -51,6 +51,7 @@ static grub_uint32_t g_suppress_wincd_override_data = 0;
|
||||
grub_uint8_t g_temp_buf[512];
|
||||
|
||||
grub_ssize_t lzx_decompress ( const void *data, grub_size_t len, void *buf );
|
||||
grub_ssize_t xca_decompress ( const void *data, grub_size_t len, void *buf );
|
||||
|
||||
static wim_patch *ventoy_find_wim_patch(const char *path)
|
||||
{
|
||||
@@ -427,7 +428,7 @@ static int ventoy_get_override_info(grub_file_t file, wim_tail *wim_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_read_resource(grub_file_t fp, wim_resource_header *head, void **buffer)
|
||||
static int ventoy_read_resource(grub_file_t fp, wim_header *wimhdr, wim_resource_header *head, void **buffer)
|
||||
{
|
||||
int decompress_len = 0;
|
||||
int total_decompress = 0;
|
||||
@@ -477,7 +478,14 @@ static int ventoy_read_resource(grub_file_t fp, wim_resource_header *head, void
|
||||
}
|
||||
else
|
||||
{
|
||||
decompress_len = (int)lzx_decompress(buffer_compress + cur_offset, chunk_size, cur_dst);
|
||||
if (wimhdr->flags & FLAG_HEADER_COMPRESS_XPRESS)
|
||||
{
|
||||
decompress_len = (int)xca_decompress(buffer_compress + cur_offset, chunk_size, cur_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
decompress_len = (int)lzx_decompress(buffer_compress + cur_offset, chunk_size, cur_dst);
|
||||
}
|
||||
}
|
||||
|
||||
//debug("chunk_size:%u decompresslen:%d\n", chunk_size, decompress_len);
|
||||
@@ -499,7 +507,14 @@ static int ventoy_read_resource(grub_file_t fp, wim_resource_header *head, void
|
||||
}
|
||||
else
|
||||
{
|
||||
decompress_len = (int)lzx_decompress(buffer_compress + cur_offset, head->size_in_wim - cur_offset, cur_dst);
|
||||
if (wimhdr->flags & FLAG_HEADER_COMPRESS_XPRESS)
|
||||
{
|
||||
decompress_len = (int)xca_decompress(buffer_compress + cur_offset, head->size_in_wim - cur_offset, cur_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
decompress_len = (int)lzx_decompress(buffer_compress + cur_offset, head->size_in_wim - cur_offset, cur_dst);
|
||||
}
|
||||
}
|
||||
|
||||
cur_dst += decompress_len;
|
||||
@@ -707,6 +722,24 @@ int ventoy_fill_windows_rtdata(void *buf, char *isopath)
|
||||
{
|
||||
debug("auto install script skipped or not configed %s\n", pos);
|
||||
}
|
||||
|
||||
script = (char *)ventoy_plugin_get_injection(pos);
|
||||
if (script)
|
||||
{
|
||||
if (ventoy_check_file_exist("%s%s", ventoy_get_env("vtoy_iso_part"), script))
|
||||
{
|
||||
debug("injection archive <%s> OK\n", script);
|
||||
grub_snprintf(data->injection_archive, sizeof(data->injection_archive) - 1, "%s", script);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("injection archive <%s> NOT exist\n", script);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("injection archive not configed %s\n", pos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -811,14 +844,14 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((head->flags & FLAG_HEADER_COMPRESS_XPRESS) || (head->flags & FLAG_HEADER_COMPRESS_LZMS))
|
||||
if (head->flags & FLAG_HEADER_COMPRESS_LZMS)
|
||||
{
|
||||
debug("Xpress or LZMS compress is not supported 0x%x\n", head->flags);
|
||||
debug("LZMS compress is not supported 0x%x\n", head->flags);
|
||||
grub_file_close(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = ventoy_read_resource(file, &head->metadata, (void **)&decompress_data);
|
||||
rc = ventoy_read_resource(file, head, &head->metadata, (void **)&decompress_data);
|
||||
if (rc)
|
||||
{
|
||||
grub_printf("failed to read meta data %d\n", rc);
|
||||
@@ -855,7 +888,7 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
|
||||
debug("find replace lookup entry_id:%ld raw_size:%u\n",
|
||||
((long)patch->replace_look - (long)lookup) / sizeof(wim_lookup_entry), exe_len);
|
||||
|
||||
if (0 == ventoy_read_resource(file, &(patch->replace_look->resource), (void **)&(exe_data)))
|
||||
if (0 == ventoy_read_resource(file, head, &(patch->replace_look->resource), (void **)&(exe_data)))
|
||||
{
|
||||
ventoy_cat_exe_file_data(wim_data, exe_len, exe_data);
|
||||
grub_free(exe_data);
|
||||
|
157
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/xpress.c
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Xpress Compression Algorithm (MS-XCA) decompression
|
||||
*
|
||||
*/
|
||||
|
||||
#include "wimboot.h"
|
||||
#include "huffman.h"
|
||||
#include "xpress.h"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
/**
|
||||
* Decompress XCA-compressed data
|
||||
*
|
||||
* @v data Compressed data
|
||||
* @v len Length of compressed data
|
||||
* @v buf Decompression buffer, or NULL
|
||||
* @ret out_len Length of decompressed data, or negative error
|
||||
*/
|
||||
ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
|
||||
const void *src = data;
|
||||
const void *end = ( uint8_t * ) src + len;
|
||||
uint8_t *out = buf;
|
||||
size_t out_len = 0;
|
||||
size_t out_len_threshold = 0;
|
||||
const struct xca_huf_len *lengths;
|
||||
struct xca xca;
|
||||
uint32_t accum = 0;
|
||||
int extra_bits = 0;
|
||||
unsigned int huf;
|
||||
struct huffman_symbols *sym;
|
||||
unsigned int raw;
|
||||
unsigned int match_len;
|
||||
unsigned int match_offset_bits;
|
||||
unsigned int match_offset;
|
||||
const uint8_t *copy;
|
||||
int rc;
|
||||
|
||||
/* Process data stream */
|
||||
while ( src < end ) {
|
||||
|
||||
/* (Re)initialise decompressor if applicable */
|
||||
if ( out_len >= out_len_threshold ) {
|
||||
|
||||
/* Construct symbol lengths */
|
||||
lengths = src;
|
||||
src = ( uint8_t * ) src + sizeof ( *lengths );
|
||||
if ( src > end ) {
|
||||
DBG ( "XCA too short to hold Huffman lengths table.\n");
|
||||
return -1;
|
||||
}
|
||||
for ( raw = 0 ; raw < XCA_CODES ; raw++ )
|
||||
xca.lengths[raw] = xca_huf_len ( lengths, raw );
|
||||
|
||||
/* Construct Huffman alphabet */
|
||||
if ( ( rc = huffman_alphabet ( &xca.alphabet,
|
||||
xca.lengths,
|
||||
XCA_CODES ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Initialise state */
|
||||
accum = XCA_GET16 ( src );
|
||||
accum <<= 16;
|
||||
accum |= XCA_GET16 ( src );
|
||||
extra_bits = 16;
|
||||
|
||||
/* Determine next threshold */
|
||||
out_len_threshold = ( out_len + XCA_BLOCK_SIZE );
|
||||
}
|
||||
|
||||
/* Determine symbol */
|
||||
huf = ( accum >> ( 32 - HUFFMAN_BITS ) );
|
||||
sym = huffman_sym ( &xca.alphabet, huf );
|
||||
raw = huffman_raw ( sym, huf );
|
||||
accum <<= huffman_len ( sym );
|
||||
extra_bits -= huffman_len ( sym );
|
||||
if ( extra_bits < 0 ) {
|
||||
accum |= ( XCA_GET16 ( src ) << ( -extra_bits ) );
|
||||
extra_bits += 16;
|
||||
}
|
||||
|
||||
/* Process symbol */
|
||||
if ( raw < XCA_END_MARKER ) {
|
||||
|
||||
/* Literal symbol - add to output stream */
|
||||
if ( buf )
|
||||
*(out++) = raw;
|
||||
out_len++;
|
||||
|
||||
} else if ( ( raw == XCA_END_MARKER ) &&
|
||||
( (uint8_t *) src >= ( ( uint8_t * ) end - 1 ) ) ) {
|
||||
|
||||
/* End marker symbol */
|
||||
return out_len;
|
||||
|
||||
} else {
|
||||
|
||||
/* LZ77 match symbol */
|
||||
raw -= XCA_END_MARKER;
|
||||
match_offset_bits = ( raw >> 4 );
|
||||
match_len = ( raw & 0x0f );
|
||||
if ( match_len == 0x0f ) {
|
||||
match_len = XCA_GET8 ( src );
|
||||
if ( match_len == 0xff ) {
|
||||
match_len = XCA_GET16 ( src );
|
||||
} else {
|
||||
match_len += 0x0f;
|
||||
}
|
||||
}
|
||||
match_len += 3;
|
||||
if ( match_offset_bits ) {
|
||||
match_offset =
|
||||
( ( accum >> ( 32 - match_offset_bits ))
|
||||
+ ( 1 << match_offset_bits ) );
|
||||
} else {
|
||||
match_offset = 1;
|
||||
}
|
||||
accum <<= match_offset_bits;
|
||||
extra_bits -= match_offset_bits;
|
||||
if ( extra_bits < 0 ) {
|
||||
accum |= ( XCA_GET16 ( src ) << (-extra_bits) );
|
||||
extra_bits += 16;
|
||||
}
|
||||
|
||||
/* Copy data */
|
||||
out_len += match_len;
|
||||
if ( buf ) {
|
||||
copy = ( out - match_offset );
|
||||
while ( match_len-- )
|
||||
*(out++) = *(copy++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out_len;
|
||||
}
|
87
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/xpress.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef _XCA_H
|
||||
#define _XCA_H
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Xpress Compression Algorithm (MS-XCA) decompression
|
||||
*
|
||||
*/
|
||||
|
||||
#include "huffman.h"
|
||||
|
||||
/** Number of XCA codes */
|
||||
#define XCA_CODES 512
|
||||
|
||||
/** XCA decompressor */
|
||||
struct xca {
|
||||
/** Huffman alphabet */
|
||||
struct huffman_alphabet alphabet;
|
||||
/** Raw symbols
|
||||
*
|
||||
* Must immediately follow the Huffman alphabet.
|
||||
*/
|
||||
huffman_raw_symbol_t raw[XCA_CODES];
|
||||
/** Code lengths */
|
||||
uint8_t lengths[XCA_CODES];
|
||||
};
|
||||
|
||||
/** XCA symbol Huffman lengths table */
|
||||
struct xca_huf_len {
|
||||
/** Lengths of each symbol */
|
||||
uint8_t nibbles[ XCA_CODES / 2 ];
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/**
|
||||
* Extract Huffman-coded length of a raw symbol
|
||||
*
|
||||
* @v lengths Huffman lengths table
|
||||
* @v symbol Raw symbol
|
||||
* @ret len Huffman-coded length
|
||||
*/
|
||||
static inline unsigned int xca_huf_len ( const struct xca_huf_len *lengths,
|
||||
unsigned int symbol ) {
|
||||
return ( ( ( lengths->nibbles[ symbol / 2 ] ) >>
|
||||
( 4 * ( symbol % 2 ) ) ) & 0x0f );
|
||||
}
|
||||
|
||||
/** Get word from source data stream */
|
||||
#define XCA_GET16( src ) ( { \
|
||||
const uint16_t *src16 = src; \
|
||||
src = ( uint8_t * ) src + sizeof ( *src16 ); \
|
||||
*src16; } )
|
||||
|
||||
/** Get byte from source data stream */
|
||||
#define XCA_GET8( src ) ( { \
|
||||
const uint8_t *src8 = src; \
|
||||
src = ( uint8_t * ) src + sizeof ( *src8 ); \
|
||||
*src8; } )
|
||||
|
||||
/** XCA source data stream end marker */
|
||||
#define XCA_END_MARKER 256
|
||||
|
||||
/** XCA block size */
|
||||
#define XCA_BLOCK_SIZE ( 64 * 1024 )
|
||||
|
||||
extern ssize_t xca_decompress ( const void *data, size_t len, void *buf );
|
||||
|
||||
#endif /* _XCA_H */
|
@@ -132,7 +132,8 @@ typedef struct ventoy_os_param
|
||||
typedef struct ventoy_windows_data
|
||||
{
|
||||
char auto_install_script[384];
|
||||
grub_uint8_t reserved[128];
|
||||
char injection_archive[384];
|
||||
grub_uint8_t reserved[256];
|
||||
}ventoy_windows_data;
|
||||
|
||||
|
||||
|
@@ -17,13 +17,11 @@ all_modules_legacy="date drivemap blocklist vga_text ntldr search at_keyboard us
|
||||
net_modules_uefi="efinet net tftp http"
|
||||
all_modules_uefi="blocklist ventoy test 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_extra_modules="elf macho offsetio regexp file"
|
||||
|
||||
if [ "$1" = "uefi" ]; then
|
||||
all_modules="$net_modules_uefi $all_modules_uefi $all_extra_modules"
|
||||
all_modules="$net_modules_uefi $all_modules_uefi "
|
||||
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi" --format 'x86_64-efi' --compression 'auto' $all_modules_uefi 'fat' 'part_msdos'
|
||||
else
|
||||
all_modules="$net_modules_legacy $all_modules_legacy"
|
||||
all_modules="$net_modules_legacy $all_modules_legacy "
|
||||
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc" --prefix '(,2)/grub' --output "$VT_DIR/INSTALL/grub/i386-pc/core.img" --format 'i386-pc' --compression 'auto' $all_modules_legacy 'fat' 'part_msdos' 'biosdisk'
|
||||
fi
|
||||
|
||||
@@ -34,16 +32,29 @@ if [ "$1" = "uefi" ]; then
|
||||
cp -a $VT_DIR/GRUB2/PXE/grub2/x86_64-efi/core.efi $VT_DIR/GRUB2/NBP/core.efi || exit 1
|
||||
|
||||
rm -f $VT_DIR/INSTALL/grub/x86_64-efi/normal.mod
|
||||
cp -a $VT_DIR/GRUB2/PXE/grub2/x86_64-efi/normal.mod $VT_DIR/INSTALL/grub/x86_64-efi/normal.mod || exit 1
|
||||
cp -a $VT_DIR/GRUB2/PXE/grub2/x86_64-efi/normal.mod $VT_DIR/INSTALL/grub/x86_64-efi/normal.mod || exit 1
|
||||
|
||||
#copy other modules
|
||||
ls -1 $VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi/ | egrep '\.(lst|mod)$' | while read line; do
|
||||
if ! echo $all_modules | grep -q " ${line%.mod} "; then
|
||||
echo "Copy $line ..."
|
||||
rm -f $VT_DIR/INSTALL/grub/x86_64-efi/$line
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi/$line $VT_DIR/INSTALL/grub/x86_64-efi/
|
||||
fi
|
||||
done
|
||||
else
|
||||
rm -f $VT_DIR/GRUB2/NBP/core.0
|
||||
cp -a $VT_DIR/GRUB2/PXE/grub2/i386-pc/core.0 $VT_DIR/GRUB2/NBP/core.0 || exit 1
|
||||
|
||||
for md in $all_extra_modules; do
|
||||
rm -f $VT_DIR/INSTALL/grub/i386-pc/${md}.mod
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/${md}.mod $VT_DIR/INSTALL/grub/i386-pc/
|
||||
done
|
||||
|
||||
rm -f $VT_DIR/INSTALL/grub/i386-pc/boot.img
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/boot.img $VT_DIR/INSTALL/grub/i386-pc/boot.img || exit 1
|
||||
|
||||
#copy other modules
|
||||
ls -1 $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/ | egrep '\.(lst|mod)$' | while read line; do
|
||||
if ! echo $all_modules | grep -q " ${line%.mod} "; then
|
||||
echo "Copy $line ..."
|
||||
rm -f $VT_DIR/INSTALL/grub/i386-pc/$line
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/$line $VT_DIR/INSTALL/grub/i386-pc/
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
BIN
ICON/forums.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
ICON/logo_128.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
ICON/logo_16.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
ICON/logo_256.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
ICON/logo_32.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
ICON/logo_48.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
ICON/logo_512.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
ICON/logo_64.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
ICON/logo_72.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
@@ -36,8 +36,8 @@ done
|
||||
$BUSYBOX_PATH/umount /vtmnt && $BUSYBOX_PATH/rm -rf /vtmnt
|
||||
$BUSYBOX_PATH/cp -a /ventoy /ventoy_rdroot
|
||||
|
||||
echo "CDL_DEV=/dev/mapper/ventoy" >> /ventoy_rdroot/etc/default/cdlinux
|
||||
echo 'echo "CDL_DEV=/dev/mapper/ventoy" >>"$VAR_FILE"' >> /ventoy_rdroot/etc/rc.d/rc.var
|
||||
|
||||
ventoy_set_rule_dir_prefix /ventoy_rdroot
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
|
||||
|
52
IMG/cpio/ventoy/hook/cucumber/disk-hook.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/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
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
|
||||
vtlog "mount media /dev/$vtDM ..."
|
||||
if ! [ -e /media/install ]; then
|
||||
mkdir -p /media/install
|
||||
fi
|
||||
mount /dev/$vtDM /media/install
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
26
IMG/cpio/ventoy/hook/cucumber/ventoy-hook.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
if [ -e /sbin/mount_installer ]; then
|
||||
echo "hook at mount_installer ..." >> $VTLOG
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/cucumber/disk-hook.sh" -i /sbin/mount_installer
|
||||
fi
|
||||
|
71
IMG/cpio/ventoy/hook/debian/linuxconsole-disk.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/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
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
vtoydm -i -f $VTOY_PATH/ventoy_image_map -d $vtdiskname > $VTOY_PATH/iso_file_list
|
||||
|
||||
vtline=$(grep '[-][-] drivers-.*\.squashfs' $VTOY_PATH/iso_file_list)
|
||||
sector=$(echo $vtline | awk '{print $(NF-1)}')
|
||||
length=$(echo $vtline | awk '{print $NF}')
|
||||
|
||||
vtoydm -e -f $VTOY_PATH/ventoy_image_map -d $vtdiskname -s $sector -l $length -o $VTOY_PATH/driver.squashfs
|
||||
mount -t squashfs $VTOY_PATH/driver.squashfs /lib/modules
|
||||
modprobe dm-mod
|
||||
|
||||
umount /lib/modules
|
||||
rm -f $VTOY_PATH/driver.squashfs
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
blkdev_dev=$($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})
|
||||
|
||||
if ! [ -b /dev/$vtDM ]; then
|
||||
mknod -m 0660 /dev/$vtDM b $blkdev_dev
|
||||
fi
|
||||
|
||||
if mount /dev/$vtDM /media/ydfs; then
|
||||
vtlog "mount success"
|
||||
else
|
||||
vtlog "mount failed"
|
||||
fi
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
23
IMG/cpio/ventoy/hook/debian/linuxconsole-hook.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
$SED "s#/busybox/bin/sleep 2#/busybox/bin/sleep 10#" -i /etc/init.d/tty1
|
||||
$SED "/install *-d *.media.ydfs/a return" -i /ydfs/detect/media
|
||||
$SED "/install *-d *.media.ydfs/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/linuxconsole-disk.sh" -i /ydfs/detect/media
|
||||
|
@@ -20,5 +20,11 @@
|
||||
$SED "s#.*livefs_root=.*find_livefs.*#$BUSYBOX_PATH/mount -t iso9660 /dev/mapper/ventoy \$mountpoint; livefs_root=\$mountpoint#" -i /usr/lib/live/boot/9990-main.sh
|
||||
$SED "s#.*livefs_root=.*find_livefs.*#$BUSYBOX_PATH/mount -t iso9660 /dev/mapper/ventoy \$mountpoint; livefs_root=\$mountpoint#" -i /usr/bin/boot/9990-main.sh
|
||||
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
||||
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||
echo "Here before mountroot ..." >> $VTLOG
|
||||
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i /init
|
||||
else
|
||||
echo "Use default hook ..." >> $VTLOG
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
||||
fi
|
||||
|
@@ -50,7 +50,7 @@ ventoy_os_install_dmsetup() {
|
||||
if $GREP -q 'device-mapper' /proc/devices; then
|
||||
vtlog "device mapper module is loaded"
|
||||
else
|
||||
vtlog"device mapper module is NOT loaded, now load it..."
|
||||
vtlog "device mapper module is NOT loaded, now load it..."
|
||||
|
||||
VER=$($BUSYBOX_PATH/uname -r)
|
||||
KO=$($FIND /lib/modules/$VER/kernel/drivers/md -name "dm-mod*")
|
||||
|
@@ -60,6 +60,10 @@ ventoy_get_debian_distro() {
|
||||
echo 'porteus'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'linuxconsole' /proc/version; then
|
||||
echo 'linuxconsole'; return
|
||||
fi
|
||||
|
||||
echo 'default'
|
||||
}
|
||||
|
||||
|
43
IMG/cpio/ventoy/hook/fatdog/disk-hook.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/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
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
23
IMG/cpio/ventoy/hook/fatdog/ventoy-hook.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$SED "/find_local_device *(/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/fatdog/disk-hook.sh" -i /init
|
||||
$SED "/find_and_choose_local_device *(/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/fatdog/disk-hook.sh" -i /init
|
43
IMG/cpio/ventoy/hook/kwort/disk-hook.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/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
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
22
IMG/cpio/ventoy/hook/kwort/ventoy-hook.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/kwort/disk-hook.sh" -i /etc/rc.d/init/media
|
48
IMG/cpio/ventoy/hook/parabola/ventoy-disk.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/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 $* ############"
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
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})
|
||||
|
||||
vtlog "ln -s /dev/$vtDM $1"
|
||||
ln -s /dev/$vtDM "$1"
|
||||
fi
|
||||
|
||||
# OK finish
|
||||
set_ventoy_hook_finish
|
||||
|
44
IMG/cpio/ventoy/hook/parabola/ventoy-hook.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
if $GREP -q '^"$mount_handler"' /init; then
|
||||
echo 'use mount_handler ...' >> $VTLOG
|
||||
$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/parabola/ventoy-disk.sh \"\$parabolaisodevice\"" -i /init
|
||||
|
||||
if [ -f /hooks/parabolaiso ]; then
|
||||
$SED '/while ! poll_device "${dev}"/a\ if /ventoy/busybox/sh /ventoy/hook/parabola/ventoy-timeout.sh ${dev}; then break; fi' -i /hooks/parabolaiso
|
||||
fi
|
||||
|
||||
else
|
||||
# some archlinux initramfs doesn't contain device-mapper udev rules file
|
||||
ARCH_UDEV_DIR=$(ventoy_get_udev_conf_dir)
|
||||
if [ -s "$ARCH_UDEV_DIR/13-dm-disk.rules" ]; then
|
||||
echo 'dm-disk rule exist' >> $VTLOG
|
||||
else
|
||||
echo 'Copy dm-disk rule file' >> $VTLOG
|
||||
$CAT $VTOY_PATH/hook/default/13-dm-disk.rules > "$ARCH_UDEV_DIR/13-dm-disk.rules"
|
||||
fi
|
||||
|
||||
# use default proc
|
||||
ventoy_systemd_udevd_work_around
|
||||
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
||||
fi
|
36
IMG/cpio/ventoy/hook/parabola/ventoy-timeout.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/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 $* ############"
|
||||
|
||||
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})
|
||||
|
||||
if [ -b /dev/$vtDM ]; then
|
||||
vtlog "ln -s /dev/$vtDM $1"
|
||||
ln -s /dev/$vtDM "$1"
|
||||
exit 0
|
||||
else
|
||||
vtlog "Device-mapper not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -60,6 +60,11 @@ 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
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
# suppress write protected mount warning
|
||||
if [ -e /usr/sbin/anaconda-diskroot ]; then
|
||||
$SED 's/^mount $dev $repodir/mount -oro $dev $repodir/' -i /usr/sbin/anaconda-diskroot
|
||||
|
35
IMG/cpio/ventoy/hook/rhel7/ventoy-make-link.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/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
|
||||
|
||||
if ! [ -e /dev/mapper/ventoy ]; then
|
||||
vtlog "link to /dev/mapper/ventoy"
|
||||
ln -s /dev/dm-0 /dev/mapper/ventoy
|
||||
fi
|
||||
|
||||
VTLABEL=$($BUSYBOX_PATH/blkid /dev/dm-0 | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
|
||||
vtlog "VTLABEL=$VTLABEL"
|
||||
|
||||
if [ -n "$VTLABEL" ]; then
|
||||
if ! [ -e "/dev/disk/by-label/$VTLABEL" ]; then
|
||||
vtlog "link to /dev/disk/by-label/$VTLABEL"
|
||||
ln -s /dev/dm-0 "/dev/disk/by-label/$VTLABEL"
|
||||
fi
|
||||
fi
|
63
IMG/cpio/ventoy/hook/vine/dev-listen.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
|
||||
|
||||
while [ -n "1" ]; do
|
||||
if [ -e /dev/null ]; then
|
||||
break
|
||||
else
|
||||
$SLEEP 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
while [ -n "1" ]; do
|
||||
if [ -e /sys/block ]; then
|
||||
break
|
||||
else
|
||||
$SLEEP 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
while [ -n "Y" ]; do
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" != "unknown" ]; then
|
||||
break
|
||||
else
|
||||
$SLEEP 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
vtshortdev=${vtdiskname#/dev/}
|
||||
|
||||
if ! [ -b $vtdiskname ]; then
|
||||
blkdev=$($CAT /sys/class/block/$vtshortdev/dev | $SED 's/:/ /g')
|
||||
$BUSYBOX_PATH/mknod -m 0660 $vtdiskname b $blkdev
|
||||
fi
|
||||
|
||||
if ! [ -b "${vtdiskname}2" ]; then
|
||||
blkdev=$($CAT /sys/class/block/${vtshortdev}2/dev | $SED 's/:/ /g')
|
||||
$BUSYBOX_PATH/mknod -m 0660 "${vtdiskname}2" b $blkdev
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/ls /dev/ > /dev/console
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/vine/udev_disk_hook.sh "${vtdiskname#/dev/}2"
|
||||
|
||||
|
79
IMG/cpio/ventoy/hook/vine/udev_disk_hook.sh
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/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
|
||||
|
||||
vtCheatLoop=loop6
|
||||
|
||||
ventoy_os_install_dmsetup() {
|
||||
vtlog "ventoy_os_install_dmsetup $1"
|
||||
|
||||
vt_usb_disk=$1
|
||||
|
||||
# dump iso file location
|
||||
$VTOY_PATH/tool/vtoydm -i -f $VTOY_PATH/ventoy_image_map -d ${vt_usb_disk} > $VTOY_PATH/iso_file_list
|
||||
|
||||
# install dmsetup
|
||||
LINE=$($GREP 'kernel-[0-9].*\.rpm' $VTOY_PATH/iso_file_list)
|
||||
if [ $? -eq 0 ]; then
|
||||
install_rpm_from_line "$LINE" ${vt_usb_disk}
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/modprobe dm-mod
|
||||
|
||||
vtlog "dmsetup install finish, now check it..."
|
||||
|
||||
dmsetup_path=/ventoy/tool/dmsetup
|
||||
if [ -z "$dmsetup_path" ]; then
|
||||
vterr "dmsetup still not found after install"
|
||||
elif $dmsetup_path info >> $VTLOG 2>&1; then
|
||||
vtlog "$dmsetup_path work ok"
|
||||
else
|
||||
vterr "$dmsetup_path not work"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
|
||||
# /dev/vtCheatLoop come first
|
||||
if [ "$1" = "$vtCheatLoop" ] && [ -b $VTOY_DM_PATH ]; then
|
||||
ventoy_copy_device_mapper /dev/$vtCheatLoop
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
||||
|
||||
ventoy_udev_disk_common_hook $* "noreplace"
|
||||
|
||||
$BUSYBOX_PATH/mount $VTOY_DM_PATH /mnt/ventoy
|
||||
|
||||
#
|
||||
# We do a trick for rhel6 series here.
|
||||
# Use /dev/$vtCheatLoop and wapper it as a removable cdrom with bind mount.
|
||||
# Then the anaconda installer will accept /dev/$vtCheatLoop as the install medium.
|
||||
#
|
||||
ventoy_copy_device_mapper /dev/$vtCheatLoop
|
||||
|
||||
$BUSYBOX_PATH/cp -a /sys/devices/virtual/block/$vtCheatLoop /tmp/ >> $VTLOG 2>&1
|
||||
echo 19 > /tmp/$vtCheatLoop/capability
|
||||
$BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
|
||||
|
||||
# OK finish
|
||||
set_ventoy_hook_finish
|
28
IMG/cpio/ventoy/hook/vine/ventoy-hook.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$BUSYBOX_PATH/mkdir -p /etc/anaconda.repos.d /mnt/ventoy
|
||||
ventoy_print_yum_repo "ventoy" "file:///mnt/ventoy" > /etc/anaconda.repos.d/ventoy.repo
|
||||
|
||||
|
||||
$BUSYBOX_PATH/mknod -m 0660 /dev/null c 1 3
|
||||
$VTOY_PATH/hook/vine/dev-listen.sh &
|
||||
|
@@ -183,7 +183,40 @@ fi
|
||||
|
||||
####################################################################
|
||||
# #
|
||||
# Step 3 : Hand over to ventoy.sh #
|
||||
# Step 3 : Extract injection archive #
|
||||
# #
|
||||
####################################################################
|
||||
ventoy_unpack_injection() {
|
||||
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $VTOY_PATH/ventoy_injection)
|
||||
echo "ventoy_unpack_injection vtmagic=$vtmagic ..."
|
||||
|
||||
if [ "1F8B" = "$vtmagic" ] || [ "1F9E" = "$vtmagic" ]; then
|
||||
echo "tar.gz tar -xzvf"
|
||||
tar -xzvf $VTOY_PATH/ventoy_injection -C /
|
||||
elif [ "425A" = "$vtmagic" ]; then
|
||||
echo "tar.bz2 tar -xjvf"
|
||||
tar -xjvf $VTOY_PATH/ventoy_injection -C /
|
||||
elif [ "FD37" = "$vtmagic" ]; then
|
||||
echo "tar.xz tar -xJvf"
|
||||
tar -xJvf $VTOY_PATH/ventoy_injection -C /
|
||||
elif [ "5D00" = "$vtmagic" ]; then
|
||||
echo "tar.lzma tar -xavf"
|
||||
tar -xavf $VTOY_PATH/ventoy_injection -C /
|
||||
else
|
||||
echo "unzip -o"
|
||||
unzip -o $VTOY_PATH/ventoy_injection -d /
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -e $VTOY_PATH/ventoy_injection ]; then
|
||||
echo "### decompress injection ... ###" >>$VTLOG
|
||||
ventoy_unpack_injection > $VTOY_PATH/injection.log 2>&1
|
||||
fi
|
||||
|
||||
|
||||
####################################################################
|
||||
# #
|
||||
# Step 4 : Hand over to ventoy.sh #
|
||||
# #
|
||||
####################################################################
|
||||
echo "Now hand over to ventoy.sh" >>$VTLOG
|
||||
|
@@ -133,8 +133,9 @@ ventoy_get_os_type() {
|
||||
if $GREP -q 'XenServer' /etc/os-release; then
|
||||
echo 'xen'; return
|
||||
elif $GREP -q 'SUSE ' /etc/os-release; then
|
||||
echo 'suse'; return
|
||||
|
||||
echo 'suse'; return
|
||||
elif $GREP -q 'uruk' /etc/os-release; then
|
||||
echo 'debian'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -204,6 +205,26 @@ ventoy_get_os_type() {
|
||||
echo 'cdlinux'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'parabola' /proc/version; then
|
||||
echo 'parabola'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'cucumber' /proc/version; then
|
||||
echo 'cucumber'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'fatdog' /proc/version; then
|
||||
echo 'fatdog'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'KWORT' /proc/version; then
|
||||
echo 'kwort'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'iwamoto' /proc/version; then
|
||||
echo 'vine'; return
|
||||
fi
|
||||
|
||||
echo "default"
|
||||
}
|
||||
|
||||
@@ -230,6 +251,7 @@ if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
|
||||
exec $BUSYBOX_PATH/sh
|
||||
fi
|
||||
|
||||
|
||||
####################################################################
|
||||
# #
|
||||
# Step 4 : Hand over to real init #
|
||||
|
28
INSTALL/README
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
========== Ventoy2Disk.sh ===============
|
||||
|
||||
sudo sh Ventoy2Disk.sh { -i | -I | -u } /dev/XXX XXX is the USB device, for example /dev/sdb.
|
||||
|
||||
Ventoy2Disk.sh CMD [ OPTION ] /dev/sdX
|
||||
CMD:
|
||||
-i install ventoy to sdX (fail if disk already installed with ventoy)
|
||||
-I force install ventoy to sdX (no matter installed or not)
|
||||
-u update ventoy in sdX
|
||||
|
||||
OPTION: (optional)
|
||||
-r SIZE_MB preserve some space at the bottom of the disk (only for install)
|
||||
-s enable secure boot support (default is disabled)
|
||||
-g use GPT partition style, default is MBR style (only for install)
|
||||
|
||||
|
||||
========== CreatePersistentImg.sh ===============
|
||||
|
||||
sudo sh CreatePersistentImg.sh
|
||||
|
||||
sh CreatePersistentImg.sh [ -s SIZE_IN_MB ] [ -t FSTYPE ] [ -l LABEL ] for example:
|
||||
|
||||
sh CreatePersistentImg.sh ----> persistence.img in 1GB size and ext4 filesystem and casper-rw label
|
||||
sh CreatePersistentImg.sh -l MX-Persist ----> persistence.img in 1GB size and ext4 filesystem and MX-Persist label
|
||||
sh CreatePersistentImg.sh -s 2048 ----> persistence.img in 2GB size and ext4 filesystem and casper-rw label
|
||||
sh CreatePersistentImg.sh -s 4096 -t xfs ----> persistence.img in 4GB size and xfs filesystem (ext2/3/4 xfs are supported) and casper-rw label
|
||||
|
@@ -39,12 +39,17 @@ if ! [ -f ./tool/ash ]; then
|
||||
|
||||
if ! [ -f ./tool/ash ]; then
|
||||
echo 'Failed to decompress tools ...'
|
||||
cd $OLDDIR
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
cd $OLDDIR
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./tool/ash ./tool/VentoyWorker.sh $*
|
||||
|
||||
cd $OLDDIR
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
cd $OLDDIR
|
||||
fi
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
menuentry 'Check global control plugin configuration' --class=debug_control {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path control $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path control $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
@@ -10,7 +10,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
|
||||
menuentry 'Check theme plugin configuration' --class=debug_theme {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path theme $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path theme $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
@@ -19,7 +19,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
|
||||
menuentry 'Check auto install plugin configuration' --class=debug_autoinstall {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path auto_install $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path auto_install $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
@@ -28,7 +28,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
|
||||
menuentry 'Check persistence plugin configuration' --class=debug_persistence {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path persistence $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path persistence $vtoy_iso_part
|
||||
|
||||
echo -e "\n############### dump persistence ###############"
|
||||
vt_dump_persistence
|
||||
@@ -40,7 +40,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
|
||||
menuentry 'Check menu alias plugin configuration' --class=debug_menualias {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path menu_alias $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path menu_alias $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
@@ -49,12 +49,21 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
|
||||
menuentry 'Check menu class plugin configuration' --class=debug_menuclass {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path menu_class $iso_path
|
||||
vt_check_plugin_json $vt_plugin_path menu_class $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
unset pager
|
||||
}
|
||||
}
|
||||
|
||||
menuentry 'Check injection plugin configuration' --class=debug_injection {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
|
||||
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
|
||||
echo 'Return ...'
|
||||
|
@@ -67,6 +67,18 @@ function ventoy_localboot {
|
||||
configfile $prefix/localboot.cfg
|
||||
}
|
||||
|
||||
function ventoy_ext_menu {
|
||||
if [ -e $vt_plugin_path/ventoy/ventoy_grub.cfg ]; then
|
||||
set ventoy_new_context=1
|
||||
configfile $vt_plugin_path/ventoy/ventoy_grub.cfg
|
||||
unset ventoy_new_context
|
||||
else
|
||||
echo "ventoy_grub.cfg NOT exist."
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
read vtInputKey
|
||||
fi
|
||||
}
|
||||
|
||||
function get_os_type {
|
||||
set vtoy_os=Linux
|
||||
|
||||
@@ -77,6 +89,26 @@ function get_os_type {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$vtoy_os" = "Linux" ]; then
|
||||
if vt_strstr "$vt_system_id" "FreeBSD"; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
|
||||
|
||||
elif [ -e (loop)/boot/kernel/kernel ]; then
|
||||
if file --is-x86-kfreebsd (loop)/boot/kernel/kernel; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
elif file --is-x86-knetbsd (loop)/boot/kernel/kernel; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=NetBSD
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo ISO is $vtoy_os
|
||||
fi
|
||||
@@ -180,10 +212,148 @@ function distro_specify_initrd_file_phase2 {
|
||||
vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
|
||||
elif [ -f (loop)/CDlinux/initrd ]; then
|
||||
vt_linux_specify_initrd_file /CDlinux/initrd
|
||||
|
||||
elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
|
||||
vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
|
||||
if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
|
||||
vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
|
||||
fi
|
||||
elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
|
||||
#Qubes
|
||||
vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
|
||||
if [ "$grub_platform" != "pc" ]; then
|
||||
vt_add_replace_file 0 "initrd.img"
|
||||
fi
|
||||
elif [ -f (loop)/initrd ]; then
|
||||
vt_linux_specify_initrd_file /initrd
|
||||
elif [ -f (loop)/live/initrd1 ]; then
|
||||
vt_linux_specify_initrd_file /live/initrd1
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
function ventoy_get_freenas_ver {
|
||||
set vt_freebsd_ver=11.x
|
||||
|
||||
if [ -e (loop)/FreeNAS-MANIFEST ]; then
|
||||
vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
|
||||
if regexp "^13\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "^12\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "^11\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
|
||||
ventoy_get_ghostbsd_ver $1 ${chosen_path}
|
||||
elif vt_strstr "$vt_volume_id" "FREENAS"; then
|
||||
ventoy_get_freenas_ver $1 ${chosen_path}
|
||||
elif regexp "^13_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "^12_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "^11_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "^10_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=10.x
|
||||
elif regexp "^9_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
|
||||
if regexp "\"13\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "\"12\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "\"11\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "\"10\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=10.x
|
||||
elif regexp "\"9\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
fi
|
||||
elif [ -e (loop)/README.TXT ]; then
|
||||
vt_1st_line (loop)/README.TXT vt_freebsd_line1
|
||||
if regexp "FreeBSD 13\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "FreeBSD 12\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "FreeBSD 11\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "FreeBSD 10\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=10.x
|
||||
elif regexp "FreeBSD 9\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
fi
|
||||
elif vt_strstr "${chosen_path}" "MidnightBSD"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
else
|
||||
set vt_freebsd_ver=12.x
|
||||
fi
|
||||
|
||||
set vt_freebsd_bit=64
|
||||
for file in "/boot/kernel/kernel" "/boot/kernel/kernel.gz"; do
|
||||
if [ -e (loop)/$file ]; then
|
||||
if file --is-i386-kfreebsd (loop)/$file; then
|
||||
set vt_freebsd_bit=32
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
unset vt_unix_mod_path
|
||||
for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/version"; do
|
||||
if [ -e (loop)${file} ]; then
|
||||
set vt_unix_mod_path=${file}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/FreeBSD/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
|
||||
vt_unix_replace_conf FreeBSD ${1}${chosen_path}
|
||||
}
|
||||
|
||||
function ventoy_unix_comm_proc {
|
||||
vt_unix_reset
|
||||
|
||||
if [ "$ventoy_compatible" = "NO" ]; then
|
||||
loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
|
||||
|
||||
if [ "$vt_unix_type" = "FreeBSD" ]; then
|
||||
ventoy_freebsd_proc $1 ${chosen_path}
|
||||
elif [ "$vt_unix_type" = "NetBSD" ]; then
|
||||
echo "NetBSD not supported"
|
||||
|
||||
|
||||
|
||||
else
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "Unknown unix type"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
vt_unix_chain_data ${1}${chosen_path}
|
||||
ventoy_debug_pause
|
||||
}
|
||||
|
||||
|
||||
function uefi_windows_menu_func {
|
||||
vt_windows_reset
|
||||
|
||||
@@ -277,6 +447,12 @@ function uefi_linux_menu_func {
|
||||
fi
|
||||
elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
|
||||
vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
|
||||
elif [ -f (loop)/loader/entries/thinstation.conf ]; then
|
||||
vt_add_replace_file $vtindex "boot\\initrd"
|
||||
fi
|
||||
elif [ -d (loop)/EFI/boot/entries ]; then
|
||||
if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
|
||||
vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
|
||||
fi
|
||||
elif [ -e (loop)/syslinux/alt0/full.cz ]; then
|
||||
vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
|
||||
@@ -297,6 +473,18 @@ function uefi_linux_menu_func {
|
||||
fi
|
||||
}
|
||||
|
||||
function uefi_unix_menu_func {
|
||||
ventoy_unix_comm_proc $1 ${chosen_path}
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_cli_console
|
||||
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
fi
|
||||
}
|
||||
|
||||
function uefi_iso_menu_func {
|
||||
|
||||
@@ -325,6 +513,7 @@ function uefi_iso_menu_func {
|
||||
fi
|
||||
|
||||
loopback loop ${1}${chosen_path}
|
||||
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
|
||||
get_os_type (loop)
|
||||
|
||||
if [ -d (loop)/EFI ]; then
|
||||
@@ -349,6 +538,8 @@ function uefi_iso_menu_func {
|
||||
if [ "$vtoy_os" = "Windows" ]; then
|
||||
vt_check_compatible_pe (loop)
|
||||
uefi_windows_menu_func $1 ${chosen_path}
|
||||
elif [ "$vtoy_os" = "Unix" ]; then
|
||||
uefi_unix_menu_func $1 ${chosen_path}
|
||||
else
|
||||
uefi_linux_menu_func $1 ${chosen_path}
|
||||
fi
|
||||
@@ -468,6 +659,20 @@ function legacy_linux_menu_func {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function legacy_unix_menu_func {
|
||||
ventoy_unix_comm_proc $1 ${chosen_path}
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function legacy_iso_menu_func {
|
||||
|
||||
if [ -d (loop)/ ]; then
|
||||
@@ -486,6 +691,7 @@ function legacy_iso_menu_func {
|
||||
fi
|
||||
|
||||
loopback loop ${1}${chosen_path}
|
||||
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
|
||||
get_os_type (loop)
|
||||
|
||||
if [ -n "$vtcompat" ]; then
|
||||
@@ -502,6 +708,8 @@ function legacy_iso_menu_func {
|
||||
if [ "$vtoy_os" = "Windows" ]; then
|
||||
vt_check_compatible_pe (loop)
|
||||
legacy_windows_menu_func $1 ${chosen_path}
|
||||
elif [ "$vtoy_os" = "Unix" ]; then
|
||||
legacy_unix_menu_func $1 ${chosen_path}
|
||||
else
|
||||
legacy_linux_menu_func $1 ${chosen_path}
|
||||
fi
|
||||
@@ -517,26 +725,29 @@ function legacy_iso_memdisk {
|
||||
}
|
||||
|
||||
function iso_common_menuentry {
|
||||
unset vt_system_id
|
||||
unset vt_volume_id
|
||||
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
if vt_check_mode 0; then
|
||||
legacy_iso_memdisk $iso_path
|
||||
legacy_iso_memdisk $vtoy_iso_part
|
||||
else
|
||||
legacy_iso_menu_func $iso_path
|
||||
legacy_iso_menu_func $vtoy_iso_part
|
||||
fi
|
||||
else
|
||||
if vt_check_mode 0; then
|
||||
uefi_iso_memdisk $iso_path
|
||||
uefi_iso_memdisk $vtoy_iso_part
|
||||
else
|
||||
uefi_iso_menu_func $iso_path
|
||||
uefi_iso_menu_func $vtoy_iso_part
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function common_unsupport_menuentry {
|
||||
echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
|
||||
echo -e " 文件名中不能有中文或空格 \n"
|
||||
echo -e "\n Will return to main menu after 10 seconds ...\n"
|
||||
sleep 10
|
||||
echo -e " 文件名中不能有中文或空格 \n"
|
||||
echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
|
||||
read vtInputKey
|
||||
}
|
||||
|
||||
function iso_unsupport_menuentry {
|
||||
@@ -545,7 +756,7 @@ function iso_unsupport_menuentry {
|
||||
|
||||
function wim_common_menuentry {
|
||||
vt_chosen_img_path chosen_path
|
||||
vt_wim_chain_data ${iso_path}${chosen_path}
|
||||
vt_wim_chain_data ${vtoy_iso_part}${chosen_path}
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
@@ -572,7 +783,7 @@ function efi_common_menuentry {
|
||||
vt_chosen_img_path chosen_path
|
||||
|
||||
ventoy_cli_console
|
||||
chainloader ${iso_path}${chosen_path}
|
||||
chainloader ${vtoy_iso_part}${chosen_path}
|
||||
boot
|
||||
ventoy_gui_console
|
||||
}
|
||||
@@ -591,7 +802,7 @@ function efi_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.15"
|
||||
set VENTOY_VERSION="1.0.18"
|
||||
|
||||
# Default menu display mode, you can change it as you want.
|
||||
# 0: List mode
|
||||
@@ -605,6 +816,7 @@ set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
|
||||
set VTOY_F2_CMD="ventoy_power"
|
||||
set VTOY_F4_CMD="ventoy_localboot"
|
||||
set VTOY_F5_CMD="ventoy_diagnosis"
|
||||
set VTOY_F6_CMD="ventoy_ext_menu"
|
||||
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
|
||||
@@ -618,15 +830,15 @@ if [ "$vtoy_dev" = "tftp" ]; then
|
||||
set vtoy_path=($root)
|
||||
for vtid in 0 1 2 3; do
|
||||
if [ -d (hd$vtid,2)/ventoy ]; then
|
||||
set iso_path=(hd$vtid,1)
|
||||
set vtoy_iso_part=(hd$vtid,1)
|
||||
set vtoy_efi_part=(hd$vtid,2)
|
||||
break
|
||||
fi
|
||||
done
|
||||
loadfont ascii
|
||||
|
||||
if [ -f $iso_path/ventoy/ventoy.json ]; then
|
||||
set vt_plugin_path=$iso_path
|
||||
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
|
||||
set vt_plugin_path=$vtoy_iso_part
|
||||
else
|
||||
set vt_plugin_path=$prefix
|
||||
vt_load_plugin $vt_plugin_path
|
||||
@@ -638,16 +850,16 @@ else
|
||||
set vtoy_path=($root)/ventoy
|
||||
fi
|
||||
|
||||
set iso_path=($vtoy_dev,1)
|
||||
set vtoy_iso_part=($vtoy_dev,1)
|
||||
set vtoy_efi_part=($vtoy_dev,2)
|
||||
loadfont unicode
|
||||
set vt_plugin_path=$iso_path
|
||||
set vt_plugin_path=$vtoy_iso_part
|
||||
fi
|
||||
|
||||
|
||||
#Load Plugin
|
||||
if [ -f $iso_path/ventoy/ventoy.json ]; then
|
||||
vt_load_plugin $iso_path
|
||||
if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
|
||||
vt_load_plugin $vtoy_iso_part
|
||||
fi
|
||||
|
||||
if [ -n "$VTOY_MENU_TIMEOUT" ]; then
|
||||
@@ -656,8 +868,8 @@ else
|
||||
unset timeout
|
||||
fi
|
||||
|
||||
if [ -f $iso_path/ventoy/ventoy_wimboot.img ]; then
|
||||
vt_load_wimboot $iso_path/ventoy/ventoy_wimboot.img
|
||||
if [ -f $vtoy_iso_part/ventoy/ventoy_wimboot.img ]; then
|
||||
vt_load_wimboot $vtoy_iso_part/ventoy/ventoy_wimboot.img
|
||||
elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
|
||||
vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
|
||||
fi
|
||||
@@ -665,10 +877,10 @@ fi
|
||||
|
||||
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
|
||||
set VTOY_F3_CMD="vt_dynamic_menu 1 1"
|
||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Debug"
|
||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Debug F6:ExMenu"
|
||||
else
|
||||
set VTOY_F3_CMD="vt_dynamic_menu 1 0"
|
||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Debug"
|
||||
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Debug F6:ExMenu"
|
||||
fi
|
||||
|
||||
|
||||
@@ -689,9 +901,20 @@ else
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
|
||||
#export necessary variable
|
||||
export theme
|
||||
export gfxmode
|
||||
export vtoy_dev
|
||||
export vtoy_iso_part
|
||||
export vtoy_efi_part
|
||||
export VENTOY_VERSION
|
||||
|
||||
|
||||
|
||||
|
||||
#colect all image files (iso files)
|
||||
set ventoy_img_count=0
|
||||
vt_list_img $iso_path ventoy_img_count
|
||||
vt_list_img $vtoy_iso_part ventoy_img_count
|
||||
|
||||
#Main menu
|
||||
if [ $ventoy_img_count -gt 0 ]; then
|
||||
|
BIN
INSTALL/grub/i386-pc/acpi.mod
Normal file
BIN
INSTALL/grub/i386-pc/adler32.mod
Normal file
BIN
INSTALL/grub/i386-pc/affs.mod
Normal file
BIN
INSTALL/grub/i386-pc/afs.mod
Normal file
BIN
INSTALL/grub/i386-pc/ahci.mod
Normal file
BIN
INSTALL/grub/i386-pc/aout.mod
Normal file
BIN
INSTALL/grub/i386-pc/archelp.mod
Normal file
BIN
INSTALL/grub/i386-pc/ata.mod
Normal file
BIN
INSTALL/grub/i386-pc/backtrace.mod
Normal file
BIN
INSTALL/grub/i386-pc/bfs.mod
Normal file
BIN
INSTALL/grub/i386-pc/bitmap.mod
Normal file
BIN
INSTALL/grub/i386-pc/bitmap_scale.mod
Normal file
BIN
INSTALL/grub/i386-pc/bsd.mod
Normal file
BIN
INSTALL/grub/i386-pc/bswap_test.mod
Normal file
BIN
INSTALL/grub/i386-pc/btrfs.mod
Normal file
BIN
INSTALL/grub/i386-pc/bufio.mod
Normal file
BIN
INSTALL/grub/i386-pc/cat.mod
Normal file
BIN
INSTALL/grub/i386-pc/cbfs.mod
Normal file
BIN
INSTALL/grub/i386-pc/cbls.mod
Normal file
BIN
INSTALL/grub/i386-pc/cbmemc.mod
Normal file
BIN
INSTALL/grub/i386-pc/cbtable.mod
Normal file
BIN
INSTALL/grub/i386-pc/cbtime.mod
Normal file
BIN
INSTALL/grub/i386-pc/cmdline_cat_test.mod
Normal file
BIN
INSTALL/grub/i386-pc/cmosdump.mod
Normal file
BIN
INSTALL/grub/i386-pc/cmostest.mod
Normal file
BIN
INSTALL/grub/i386-pc/cmp.mod
Normal file
BIN
INSTALL/grub/i386-pc/cmp_test.mod
Normal file
201
INSTALL/grub/i386-pc/command.lst
Normal file
@@ -0,0 +1,201 @@
|
||||
*acpi: acpi
|
||||
*all_functional_test: functional_test
|
||||
*background_image: gfxterm_background
|
||||
*cat: cat
|
||||
*cpuid: cpuid
|
||||
*crc: hashsum
|
||||
*cryptomount: cryptodisk
|
||||
*drivemap: drivemap
|
||||
*echo: echo
|
||||
*extract_syslinux_entries_configfile: syslinuxcfg
|
||||
*extract_syslinux_entries_source: syslinuxcfg
|
||||
*file: file
|
||||
*functional_test: functional_test
|
||||
*gettext: gettext
|
||||
*halt: halt
|
||||
*hashsum: hashsum
|
||||
*hdparm: hdparm
|
||||
*hello: hello
|
||||
*help: help
|
||||
*hexdump: hexdump
|
||||
*inb: iorw
|
||||
*inl: iorw
|
||||
*inw: iorw
|
||||
*keystatus: keystatus
|
||||
*kfreebsd: bsd
|
||||
*knetbsd: bsd
|
||||
*kopenbsd: bsd
|
||||
*list_env: loadenv
|
||||
*load_env: loadenv
|
||||
*loopback: loopback
|
||||
*ls: ls
|
||||
*lsacpi: lsacpi
|
||||
*lspci: lspci
|
||||
*md5sum: hashsum
|
||||
*menuentry: normal
|
||||
*pcidump: pcidump
|
||||
*plan9: plan9
|
||||
*probe: probe
|
||||
*rdmsr: rdmsr
|
||||
*read_byte: memrw
|
||||
*read_dword: memrw
|
||||
*read_word: memrw
|
||||
*regexp: regexp
|
||||
*save_env: loadenv
|
||||
*search: search
|
||||
*sendkey: sendkey
|
||||
*serial: serial
|
||||
*setpci: setpci
|
||||
*sha1sum: hashsum
|
||||
*sha256sum: hashsum
|
||||
*sha512sum: hashsum
|
||||
*sleep: sleep
|
||||
*submenu: normal
|
||||
*syslinux_configfile: syslinuxcfg
|
||||
*syslinux_source: syslinuxcfg
|
||||
*terminfo: terminfo
|
||||
*test_blockarg: test_blockarg
|
||||
*testspeed: testspeed
|
||||
*tr: tr
|
||||
*trust: pgp
|
||||
*verify_detached: pgp
|
||||
*xnu_splash: xnu
|
||||
*zfskey: zfscrypt
|
||||
.: configfile
|
||||
[: test
|
||||
authenticate: normal
|
||||
background_color: gfxterm_background
|
||||
backtrace: backtrace
|
||||
badram: mmap
|
||||
blocklist: blocklist
|
||||
boot: boot
|
||||
break: normal
|
||||
cat: minicmd
|
||||
cbmemc: cbmemc
|
||||
chainloader: chain
|
||||
clear: normal
|
||||
cmosclean: cmostest
|
||||
cmosdump: cmosdump
|
||||
cmosset: cmostest
|
||||
cmostest: cmostest
|
||||
cmp: cmp
|
||||
configfile: configfile
|
||||
continue: normal
|
||||
coreboot_boottime: cbtime
|
||||
cutmem: mmap
|
||||
date: date
|
||||
distrust: pgp
|
||||
dump: minicmd
|
||||
efiemu_loadcore: efiemu
|
||||
efiemu_prepare: efiemu
|
||||
efiemu_unload: efiemu
|
||||
eval: eval
|
||||
exit: minicmd
|
||||
export: normal
|
||||
extract_entries_configfile: configfile
|
||||
extract_entries_source: configfile
|
||||
extract_legacy_entries_configfile: legacycfg
|
||||
extract_legacy_entries_source: legacycfg
|
||||
false: true
|
||||
freedos: freedos
|
||||
gdbstub: gdb
|
||||
gdbstub_break: gdb
|
||||
gdbstub_stop: gdb
|
||||
gptsync: gptsync
|
||||
help: minicmd
|
||||
hexdump_random: random
|
||||
initrd16: linux16
|
||||
initrd: linux
|
||||
keymap: keylayouts
|
||||
kfreebsd_loadenv: bsd
|
||||
kfreebsd_module: bsd
|
||||
kfreebsd_module_elf: bsd
|
||||
knetbsd_module: bsd
|
||||
knetbsd_module_elf: bsd
|
||||
kopenbsd_ramdisk: bsd
|
||||
legacy_check_password: legacycfg
|
||||
legacy_configfile: legacycfg
|
||||
legacy_initrd: legacycfg
|
||||
legacy_initrd_nounzip: legacycfg
|
||||
legacy_kernel: legacycfg
|
||||
legacy_password: legacycfg
|
||||
legacy_source: legacycfg
|
||||
linux16: linux16
|
||||
linux: linux
|
||||
list_trusted: pgp
|
||||
loadfont: font
|
||||
lsapm: lsapm
|
||||
lscoreboot: cbls
|
||||
lsfonts: font
|
||||
lsmmap: lsmmap
|
||||
lsmod: minicmd
|
||||
macppcbless: macbless
|
||||
mactelbless: macbless
|
||||
module2: multiboot2
|
||||
module: multiboot
|
||||
multiboot2: multiboot2
|
||||
multiboot: multiboot
|
||||
nativedisk: nativedisk
|
||||
net_add_addr: net
|
||||
net_add_dns: net
|
||||
net_add_route: net
|
||||
net_bootp: net
|
||||
net_del_addr: net
|
||||
net_del_dns: net
|
||||
net_del_route: net
|
||||
net_dhcp: net
|
||||
net_get_dhcp_option: net
|
||||
net_ipv6_autoconf: net
|
||||
net_ls_addr: net
|
||||
net_ls_cards: net
|
||||
net_ls_dns: net
|
||||
net_ls_routes: net
|
||||
net_nslookup: net
|
||||
normal: normal
|
||||
normal_exit: normal
|
||||
ntldr: ntldr
|
||||
outb: iorw
|
||||
outl: iorw
|
||||
outw: iorw
|
||||
parttool: parttool
|
||||
password: password
|
||||
password_pbkdf2: password_pbkdf2
|
||||
play: play
|
||||
pxechainloader: pxechain
|
||||
read: read
|
||||
reboot: reboot
|
||||
return: normal
|
||||
rmmod: minicmd
|
||||
search.file: search_fs_file
|
||||
search.fs_label: search_label
|
||||
search.fs_uuid: search_fs_uuid
|
||||
setparams: normal
|
||||
shift: normal
|
||||
source: configfile
|
||||
terminal_input: terminal
|
||||
terminal_output: terminal
|
||||
test: test
|
||||
testload: testload
|
||||
time: time
|
||||
true: true
|
||||
truecrypt: truecrypt
|
||||
usb: usbtest
|
||||
vbeinfo: videoinfo
|
||||
vbetest: videotest
|
||||
videoinfo: videoinfo
|
||||
videotest: videotest
|
||||
write_byte: memrw
|
||||
write_dword: memrw
|
||||
write_word: memrw
|
||||
wrmsr: wrmsr
|
||||
xnu_devprop_load: xnu
|
||||
xnu_kernel64: xnu
|
||||
xnu_kernel: xnu
|
||||
xnu_kext: xnu
|
||||
xnu_kextdir: xnu
|
||||
xnu_mkext: xnu
|
||||
xnu_ramdisk: xnu
|
||||
xnu_resume: xnu
|
||||
xnu_uuid: xnu_uuid
|
||||
zfs-bootfs: zfsinfo
|
||||
zfsinfo: zfsinfo
|
BIN
INSTALL/grub/i386-pc/cpio.mod
Normal file
BIN
INSTALL/grub/i386-pc/cpio_be.mod
Normal file
BIN
INSTALL/grub/i386-pc/cpuid.mod
Normal file
BIN
INSTALL/grub/i386-pc/crc64.mod
Normal file
45
INSTALL/grub/i386-pc/crypto.lst
Normal file
@@ -0,0 +1,45 @@
|
||||
RIJNDAEL: gcry_rijndael
|
||||
RIJNDAEL192: gcry_rijndael
|
||||
RIJNDAEL256: gcry_rijndael
|
||||
AES128: gcry_rijndael
|
||||
AES-128: gcry_rijndael
|
||||
AES-192: gcry_rijndael
|
||||
AES-256: gcry_rijndael
|
||||
ADLER32: adler32
|
||||
CRC64: crc64
|
||||
ARCFOUR: gcry_arcfour
|
||||
BLOWFISH: gcry_blowfish
|
||||
CAMELLIA128: gcry_camellia
|
||||
CAMELLIA192: gcry_camellia
|
||||
CAMELLIA256: gcry_camellia
|
||||
CAST5: gcry_cast5
|
||||
CRC32: gcry_crc
|
||||
CRC32RFC1510: gcry_crc
|
||||
CRC24RFC2440: gcry_crc
|
||||
DES: gcry_des
|
||||
3DES: gcry_des
|
||||
DSA: gcry_dsa
|
||||
IDEA: gcry_idea
|
||||
MD4: gcry_md4
|
||||
MD5: gcry_md5
|
||||
RFC2268_40: gcry_rfc2268
|
||||
AES: gcry_rijndael
|
||||
AES192: gcry_rijndael
|
||||
AES256: gcry_rijndael
|
||||
RIPEMD160: gcry_rmd160
|
||||
RSA: gcry_rsa
|
||||
SEED: gcry_seed
|
||||
SERPENT128: gcry_serpent
|
||||
SERPENT192: gcry_serpent
|
||||
SERPENT256: gcry_serpent
|
||||
SHA1: gcry_sha1
|
||||
SHA224: gcry_sha256
|
||||
SHA256: gcry_sha256
|
||||
SHA512: gcry_sha512
|
||||
SHA384: gcry_sha512
|
||||
TIGER192: gcry_tiger
|
||||
TIGER: gcry_tiger
|
||||
TIGER2: gcry_tiger
|
||||
TWOFISH: gcry_twofish
|
||||
TWOFISH128: gcry_twofish
|
||||
WHIRLPOOL: gcry_whirlpool
|