mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-18 18:01:14 +00:00
Compare commits
50 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
47e77e003c | ||
|
d05eab2be1 | ||
|
849dfb463d | ||
|
7715bd705c | ||
|
042ca4b5e3 | ||
|
e1099e1e5b | ||
|
c6be35f2c0 | ||
|
b15a96b747 | ||
|
6bd0463d34 | ||
|
1ce568d971 | ||
|
f82475d950 | ||
|
aad154616c | ||
|
83c3a932d3 | ||
|
0aff8f5109 | ||
|
2750f0c5a7 | ||
|
f71a1fcce9 | ||
|
e252fab9a4 | ||
|
37212a8ea4 | ||
|
e71221cdba | ||
|
65a2cb1685 | ||
|
e23e76f54e | ||
|
8ded032c92 | ||
|
fc5cd0a00a | ||
|
6cc400b8d4 | ||
|
ffc915ca53 | ||
|
8ebe972f6e | ||
|
39975dd1c3 | ||
|
1a648d8689 | ||
|
8234961228 | ||
|
e1ffbad431 | ||
|
4a66104c6e | ||
|
32bcd8f87b | ||
|
26c1756e8d | ||
|
f4bbec65ba | ||
|
58d387f732 | ||
|
2e10aabe94 | ||
|
a63a41f79d | ||
|
64748308a3 | ||
|
33cc1e271a | ||
|
291e0a3a38 | ||
|
0717195481 | ||
|
26b3bca25b | ||
|
5d3285356e | ||
|
1e12969555 | ||
|
db892d5e12 | ||
|
7166164afe | ||
|
67e839b9f2 | ||
|
dce5d1b769 | ||
|
83d91c525f | ||
|
78df21fc40 |
@@ -438,6 +438,8 @@ EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
UINT32 j = 0;
|
||||
UINT32 lbacount = 0;
|
||||
UINT32 secNum = 0;
|
||||
UINT32 TmpNum = 0;
|
||||
UINT64 VirtSec = 0;
|
||||
UINT64 offset = 0;
|
||||
EFI_LBA curlba = 0;
|
||||
EFI_LBA lastlba = 0;
|
||||
@@ -461,6 +463,26 @@ EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
{
|
||||
return ventoy_read_iso_sector(Lba, secNum, Buffer);
|
||||
}
|
||||
else if (offset < g_chain->real_img_size_in_bytes)
|
||||
{
|
||||
TmpNum = (g_chain->real_img_size_in_bytes - offset) / 2048;
|
||||
ventoy_read_iso_sector(Lba, TmpNum, Buffer);
|
||||
|
||||
Lba += TmpNum;
|
||||
secNum -= TmpNum;
|
||||
Buffer = (UINT8 *)Buffer + (g_chain->real_img_size_in_bytes - offset);
|
||||
offset = Lba * 2048;
|
||||
}
|
||||
|
||||
VirtSec = g_chain->virt_img_size_in_bytes / 2048;
|
||||
if (Lba >= VirtSec)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
else if (Lba + secNum > VirtSec)
|
||||
{
|
||||
secNum = VirtSec - Lba;
|
||||
}
|
||||
|
||||
if (secNum > g_sector_flag_num)
|
||||
{
|
||||
|
@@ -1603,6 +1603,7 @@ module = {
|
||||
module = {
|
||||
name = ventoy;
|
||||
common = ventoy/ventoy.c;
|
||||
common = ventoy/ventoy_cmd.c;
|
||||
common = ventoy/ventoy_linux.c;
|
||||
common = ventoy/ventoy_unix.c;
|
||||
common = ventoy/ventoy_windows.c;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
|
||||
extern int g_ventoy_memdisk_mode;
|
||||
extern int g_ventoy_iso_raw;
|
||||
extern int g_ventoy_grub2_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
|
||||
static const char *align_options[] =
|
||||
@@ -205,6 +206,9 @@ label_set_property (void *vself, const char *name, const char *value)
|
||||
else if (grub_strcmp (value, "@VTOY_ISO_RAW@") == 0) {
|
||||
value = g_ventoy_iso_raw ? grub_env_get("VTOY_ISO_RAW_STR") : " ";
|
||||
}
|
||||
else if (grub_strcmp (value, "@VTOY_GRUB2_MODE@") == 0) {
|
||||
value = g_ventoy_grub2_mode ? grub_env_get("VTOY_GRUB2_MODE_STR") : " ";
|
||||
}
|
||||
else if (grub_strcmp (value, "@VTOY_ISO_UEFI_DRV@") == 0) {
|
||||
value = g_ventoy_iso_uefi_drv ? grub_env_get("VTOY_ISO_UEFI_DRV_STR") : " ";
|
||||
}
|
||||
|
@@ -304,6 +304,7 @@ static int ventoy_boot_opt_filter(char *opt)
|
||||
static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int TmpIdx;
|
||||
int count = 0;
|
||||
const char *env;
|
||||
char c;
|
||||
@@ -317,10 +318,20 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the 1st parameter is BOOT_IMAGE=xxxx */
|
||||
if (argc > 0 && 0 == ventoy_boot_opt_filter(argv[0]))
|
||||
/* To avoid --- parameter, we split two parts */
|
||||
for (TmpIdx = 0; TmpIdx < argc; TmpIdx++)
|
||||
{
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[0]);
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_strncmp(argv[TmpIdx], "--", 2) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ventoy_linux_argc; i++)
|
||||
@@ -392,15 +403,15 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* We have processed the 1st parameter before, so start from 1 */
|
||||
for (i = 1; i < argc; i++)
|
||||
while (TmpIdx < argc)
|
||||
{
|
||||
if (ventoy_boot_opt_filter(argv[i]))
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[i]);
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
TmpIdx++;
|
||||
}
|
||||
|
||||
if (ventoy_debug)
|
||||
|
@@ -530,6 +530,7 @@ static int ventoy_boot_opt_filter(char *opt)
|
||||
static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int TmpIdx;
|
||||
int count = 0;
|
||||
const char *env;
|
||||
char c;
|
||||
@@ -543,10 +544,20 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the 1st parameter is BOOT_IMAGE=xxxx */
|
||||
if (argc > 0 && 0 == ventoy_boot_opt_filter(argv[0]))
|
||||
/* To avoid --- parameter, we split two parts */
|
||||
for (TmpIdx = 0; TmpIdx < argc; TmpIdx++)
|
||||
{
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[0]);
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_strncmp(argv[TmpIdx], "--", 2) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ventoy_linux_argc; i++)
|
||||
@@ -618,15 +629,15 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* We have processed the 1st parameter before, so start from 1 */
|
||||
for (i = 1; i < argc; i++)
|
||||
while (TmpIdx < argc)
|
||||
{
|
||||
if (ventoy_boot_opt_filter(argv[i]))
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[i]);
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
TmpIdx++;
|
||||
}
|
||||
|
||||
if (ventoy_debug)
|
||||
|
@@ -252,6 +252,7 @@ static int ventoy_boot_opt_filter(char *opt)
|
||||
static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int TmpIdx;
|
||||
int count = 0;
|
||||
const char *env;
|
||||
char c;
|
||||
@@ -265,10 +266,20 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the 1st parameter is BOOT_IMAGE=xxxx */
|
||||
if (argc > 0 && 0 == ventoy_boot_opt_filter(argv[0]))
|
||||
/* To avoid --- parameter, we split two parts */
|
||||
for (TmpIdx = 0; TmpIdx < argc; TmpIdx++)
|
||||
{
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[0]);
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_strncmp(argv[TmpIdx], "--", 2) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ventoy_linux_argc; i++)
|
||||
@@ -340,15 +351,15 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* We have processed the 1st parameter before, so start from 1 */
|
||||
for (i = 1; i < argc; i++)
|
||||
while (TmpIdx < argc)
|
||||
{
|
||||
if (ventoy_boot_opt_filter(argv[i]))
|
||||
if (ventoy_boot_opt_filter(argv[TmpIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[i]);
|
||||
ventoy_linux_args[count++] = grub_strdup(argv[TmpIdx]);
|
||||
TmpIdx++;
|
||||
}
|
||||
|
||||
if (ventoy_debug)
|
||||
|
@@ -37,11 +37,13 @@
|
||||
int g_ventoy_menu_refresh = 0;
|
||||
int g_ventoy_memdisk_mode = 0;
|
||||
int g_ventoy_iso_raw = 0;
|
||||
int g_ventoy_grub2_mode = 0;
|
||||
int g_ventoy_iso_uefi_drv = 0;
|
||||
int g_ventoy_last_entry = -1;
|
||||
int g_ventoy_suppress_esc = 0;
|
||||
int g_ventoy_menu_esc = 0;
|
||||
int g_ventoy_fn_mutex = 0;
|
||||
int g_ventoy_terminal_output = 0;
|
||||
|
||||
/* Time to delay after displaying an error message about a default/fallback
|
||||
entry failing to boot. */
|
||||
@@ -871,15 +873,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
}
|
||||
break;
|
||||
case GRUB_TERM_KEY_F7:
|
||||
case '7':
|
||||
cmdstr = grub_env_get("VTOY_F7_CMD");
|
||||
if (cmdstr)
|
||||
{
|
||||
menu_fini ();
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
goto refresh;
|
||||
if (g_ventoy_terminal_output == 0)
|
||||
{
|
||||
grub_script_execute_sourcecode("terminal_output console");
|
||||
g_ventoy_terminal_output = 1;
|
||||
}
|
||||
break;
|
||||
else
|
||||
{
|
||||
grub_script_execute_sourcecode("terminal_output gfxterm");
|
||||
g_ventoy_terminal_output = 0;
|
||||
}
|
||||
goto refresh;
|
||||
case GRUB_TERM_KEY_F1:
|
||||
case '1':
|
||||
menu_fini ();
|
||||
@@ -893,6 +898,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
case (GRUB_TERM_CTRL | 'r'):
|
||||
menu_fini ();
|
||||
g_ventoy_grub2_mode = 1 - g_ventoy_grub2_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
case (GRUB_TERM_CTRL | 'u'):
|
||||
menu_fini ();
|
||||
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
|
||||
|
795
GRUB2/MOD_SRC/grub-2.04/grub-core/term/keyboard_layout.c
Normal file
795
GRUB2/MOD_SRC/grub-2.04/grub-core/term/keyboard_layout.c
Normal file
@@ -0,0 +1,795 @@
|
||||
|
||||
#define ventoy_keyboard_set_layout(name) if (grub_strcmp(layout, #name) == 0) return ventoy_keyboard_layout_##name()
|
||||
|
||||
static void ventoy_keyboard_layout_QWERTY_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_disable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_AZERTY(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("a", "q");
|
||||
grub_keymap_add_by_string("A", "Q");
|
||||
grub_keymap_add_by_string("z", "w");
|
||||
grub_keymap_add_by_string("Z", "W");
|
||||
grub_keymap_add_by_string("q", "a");
|
||||
grub_keymap_add_by_string("Q", "A");
|
||||
grub_keymap_add_by_string("m", "semicolon");
|
||||
grub_keymap_add_by_string("M", "colon");
|
||||
grub_keymap_add_by_string("w", "z");
|
||||
grub_keymap_add_by_string("W", "Z");
|
||||
grub_keymap_add_by_string("comma", "m");
|
||||
grub_keymap_add_by_string("question", "M");
|
||||
grub_keymap_add_by_string("semicolon", "comma");
|
||||
grub_keymap_add_by_string("period", "less");
|
||||
grub_keymap_add_by_string("colon", "period");
|
||||
grub_keymap_add_by_string("slash", "greater");
|
||||
grub_keymap_add_by_string("exclam", "slash");
|
||||
grub_keymap_add_by_string("dollar", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "backslash");
|
||||
grub_keymap_add_by_string("percent", "doublequote");
|
||||
grub_keymap_add_by_string("ampersand", "1");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("tilde", "2");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("doublequote", "3");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("quote", "4");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("parenleft", "5");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("minus", "6");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("backquote", "7");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("underscore", "8");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("caret", "9");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("at", "0");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("parenright", "minus");
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("numbersign", "braceright");
|
||||
grub_keymap_add_by_string("backslash", "question");
|
||||
grub_keymap_add_by_string("bracketright", "braceleft");
|
||||
grub_keymap_add_by_string("braceleft", "quote");
|
||||
grub_keymap_add_by_string("braceright", "underscore");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_CZECH_QWERTY(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("semicolon", "backquote");
|
||||
grub_keymap_add_by_string("plus", "1");
|
||||
grub_keymap_add_by_string("equal", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("parenright", "bracketright");
|
||||
grub_keymap_add_by_string("doublequote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("percent", "underscore");
|
||||
grub_keymap_add_by_string("slash", "braceleft");
|
||||
grub_keymap_add_by_string("parenleft", "braceright");
|
||||
grub_keymap_add_by_string("doublequote", "colon");
|
||||
grub_keymap_add_by_string("exclam", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("backquote", "Abackquote");
|
||||
grub_keymap_add_by_string("exclam", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("percent", "A5");
|
||||
grub_keymap_add_by_string("caret", "A6");
|
||||
grub_keymap_add_by_string("ampersand", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "A8");
|
||||
grub_keymap_add_by_string("parenleft", "A9");
|
||||
grub_keymap_add_by_string("parenright", "A0");
|
||||
grub_keymap_add_by_string("minus", "Aminus");
|
||||
grub_keymap_add_by_string("equal", "Aequal");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("semicolon", "Asemicolon");
|
||||
grub_keymap_add_by_string("backslash", "Abackslash");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("slash", "Aslash");
|
||||
grub_keymap_add_by_string("tilde", "Atilde");
|
||||
grub_keymap_add_by_string("underscore", "Aunderscore");
|
||||
grub_keymap_add_by_string("plus", "Aplus");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("caret", "Adoublequote");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("question", "Aquestion");
|
||||
grub_keymap_add_by_string("bar", "Abar");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_CZECH_QWERTZ(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("semicolon", "backquote");
|
||||
grub_keymap_add_by_string("plus", "1");
|
||||
grub_keymap_add_by_string("equal", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("parenright", "bracketright");
|
||||
grub_keymap_add_by_string("doublequote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("percent", "underscore");
|
||||
grub_keymap_add_by_string("slash", "braceleft");
|
||||
grub_keymap_add_by_string("parenleft", "braceright");
|
||||
grub_keymap_add_by_string("doublequote", "colon");
|
||||
grub_keymap_add_by_string("exclam", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("dollar", "Asemicolon");
|
||||
grub_keymap_add_by_string("numbersign", "Ax");
|
||||
grub_keymap_add_by_string("ampersand", "Ac");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("asterisk", "Aslash");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_DANISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("plus", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("doublequote", "bracketright");
|
||||
grub_keymap_add_by_string("quote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "braceright");
|
||||
grub_keymap_add_by_string("asterisk", "bar");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("less", "quote");
|
||||
grub_keymap_add_by_string("greater", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_DVORAK_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("[", "minus");
|
||||
grub_keymap_add_by_string("braceleft", "underscore");
|
||||
grub_keymap_add_by_string("quote", "q");
|
||||
grub_keymap_add_by_string("doublequote", "Q");
|
||||
grub_keymap_add_by_string("comma", "w");
|
||||
grub_keymap_add_by_string("less", "W");
|
||||
grub_keymap_add_by_string("s", "semicolon");
|
||||
grub_keymap_add_by_string("S", "colon");
|
||||
grub_keymap_add_by_string("semicolon", "z");
|
||||
grub_keymap_add_by_string("colon", "Z");
|
||||
grub_keymap_add_by_string("w", "comma");
|
||||
grub_keymap_add_by_string("W", "less");
|
||||
grub_keymap_add_by_string("v", "period");
|
||||
grub_keymap_add_by_string("z", "greater");
|
||||
grub_keymap_add_by_string("z", "slash");
|
||||
grub_keymap_add_by_string("equal", "bracketright");
|
||||
grub_keymap_add_by_string("backslash", "backslash");
|
||||
grub_keymap_add_by_string("underscore", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "q");
|
||||
grub_keymap_add_by_string("doublequote", "Q");
|
||||
grub_keymap_add_by_string("comma", "w");
|
||||
grub_keymap_add_by_string("less", "W");
|
||||
grub_keymap_add_by_string("period", "e");
|
||||
grub_keymap_add_by_string("greater", "E");
|
||||
grub_keymap_add_by_string("p", "r");
|
||||
grub_keymap_add_by_string("P", "R");
|
||||
grub_keymap_add_by_string("y", "t");
|
||||
grub_keymap_add_by_string("Y", "T");
|
||||
grub_keymap_add_by_string("f", "y");
|
||||
grub_keymap_add_by_string("F", "Y");
|
||||
grub_keymap_add_by_string("g", "u");
|
||||
grub_keymap_add_by_string("G", "U");
|
||||
grub_keymap_add_by_string("c", "c");
|
||||
grub_keymap_add_by_string("C", "I");
|
||||
grub_keymap_add_by_string("r", "o");
|
||||
grub_keymap_add_by_string("R", "O");
|
||||
grub_keymap_add_by_string("l", "p");
|
||||
grub_keymap_add_by_string("L", "P");
|
||||
grub_keymap_add_by_string("bracketright", "equal");
|
||||
grub_keymap_add_by_string("braceright", "plus");
|
||||
grub_keymap_add_by_string("a", "a");
|
||||
grub_keymap_add_by_string("A", "A");
|
||||
grub_keymap_add_by_string("o", "s");
|
||||
grub_keymap_add_by_string("O", "S");
|
||||
grub_keymap_add_by_string("e", "d");
|
||||
grub_keymap_add_by_string("E", "D");
|
||||
grub_keymap_add_by_string("u", "f");
|
||||
grub_keymap_add_by_string("U", "F");
|
||||
grub_keymap_add_by_string("i", "g");
|
||||
grub_keymap_add_by_string("I", "G");
|
||||
grub_keymap_add_by_string("d", "h");
|
||||
grub_keymap_add_by_string("D", "H");
|
||||
grub_keymap_add_by_string("h", "j");
|
||||
grub_keymap_add_by_string("H", "J");
|
||||
grub_keymap_add_by_string("t", "k");
|
||||
grub_keymap_add_by_string("T", "K");
|
||||
grub_keymap_add_by_string("n", "l");
|
||||
grub_keymap_add_by_string("N", "L");
|
||||
grub_keymap_add_by_string("s", "semicolon");
|
||||
grub_keymap_add_by_string("S", "colon");
|
||||
grub_keymap_add_by_string("minus", "quote");
|
||||
grub_keymap_add_by_string("underscore", "doublequote");
|
||||
grub_keymap_add_by_string("semicolon", "z");
|
||||
grub_keymap_add_by_string("colon", "Z");
|
||||
grub_keymap_add_by_string("q", "x");
|
||||
grub_keymap_add_by_string("Q", "X");
|
||||
grub_keymap_add_by_string("j", "c");
|
||||
grub_keymap_add_by_string("J", "C");
|
||||
grub_keymap_add_by_string("k", "v");
|
||||
grub_keymap_add_by_string("K", "V");
|
||||
grub_keymap_add_by_string("x", "b");
|
||||
grub_keymap_add_by_string("X", "B");
|
||||
grub_keymap_add_by_string("b", "n");
|
||||
grub_keymap_add_by_string("B", "N");
|
||||
grub_keymap_add_by_string("w", "comma");
|
||||
grub_keymap_add_by_string("W", "less");
|
||||
grub_keymap_add_by_string("v", "period");
|
||||
grub_keymap_add_by_string("V", "greater");
|
||||
grub_keymap_add_by_string("z", "slash");
|
||||
grub_keymap_add_by_string("Z", "question");
|
||||
grub_keymap_add_by_string("slash", "bracketleft");
|
||||
grub_keymap_add_by_string("question", "braceleft");
|
||||
grub_keymap_add_by_string("equal", "bracketright");
|
||||
grub_keymap_add_by_string("plus", "braceright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_FRENCH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("ampersand", "1");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("tilde", "2");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("doublequote", "3");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("quote", "4");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("parenleft", "5");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("minus", "6");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("backquote", "7");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("underscore", "8");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("backslash", "9");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("at", "0");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("parenright", "minus");
|
||||
grub_keymap_add_by_string("numbersign", "underscore");
|
||||
grub_keymap_add_by_string("a", "q");
|
||||
grub_keymap_add_by_string("A", "Q");
|
||||
grub_keymap_add_by_string("z", "w");
|
||||
grub_keymap_add_by_string("Z", "W");
|
||||
grub_keymap_add_by_string("caret", "bracketleft");
|
||||
grub_keymap_add_by_string("dollar", "bracketright");
|
||||
grub_keymap_add_by_string("q", "a");
|
||||
grub_keymap_add_by_string("Q", "A");
|
||||
grub_keymap_add_by_string("m", "semicolon");
|
||||
grub_keymap_add_by_string("M", "colon");
|
||||
grub_keymap_add_by_string("bracketleft", "quote");
|
||||
grub_keymap_add_by_string("percent", "doublequote");
|
||||
grub_keymap_add_by_string("asterisk", "backslash");
|
||||
grub_keymap_add_by_string("bracketright", "bar");
|
||||
grub_keymap_add_by_string("w", "z");
|
||||
grub_keymap_add_by_string("W", "Z");
|
||||
grub_keymap_add_by_string("comma", "m");
|
||||
grub_keymap_add_by_string("question", "M");
|
||||
grub_keymap_add_by_string("semicolon", "comma");
|
||||
grub_keymap_add_by_string("period", "less");
|
||||
grub_keymap_add_by_string("colon", "period");
|
||||
grub_keymap_add_by_string("slash", "greater");
|
||||
grub_keymap_add_by_string("exclam", "slash");
|
||||
grub_keymap_add_by_string("bar", "question");
|
||||
grub_keymap_add_by_string("tilde", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("braceleft", "A4");
|
||||
grub_keymap_add_by_string("bracketleft", "A5");
|
||||
grub_keymap_add_by_string("bar", "A6");
|
||||
grub_keymap_add_by_string("quote", "A7");
|
||||
grub_keymap_add_by_string("backslash", "A8");
|
||||
grub_keymap_add_by_string("caret", "A9");
|
||||
grub_keymap_add_by_string("at", "A0");
|
||||
grub_keymap_add_by_string("bracketright", "Aminus");
|
||||
grub_keymap_add_by_string("braceright", "Aequal");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_GERMAN(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backslash", "minus");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "backquote");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("braceright", "doublequote");
|
||||
grub_keymap_add_by_string("bar", "bracketleft");
|
||||
grub_keymap_add_by_string("at", "braceleft");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("greater", "semicolon");
|
||||
grub_keymap_add_by_string("less", "colon");
|
||||
grub_keymap_add_by_string("bar", "quote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_ITALIANO(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("tilde", "numbersign");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "plus");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "braceleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("at", "semicolon");
|
||||
grub_keymap_add_by_string("braceleft", "colon");
|
||||
grub_keymap_add_by_string("numbersign", "quote");
|
||||
grub_keymap_add_by_string("braceright", "doublequote");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("at", "Asemicolon");
|
||||
grub_keymap_add_by_string("numbersign", "Aquote");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_JAPAN_106(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("at", "bracketleft");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("quote", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("underscore", "parenright");
|
||||
grub_keymap_add_by_string("equal", "underscore");
|
||||
grub_keymap_add_by_string("plus", "colon");
|
||||
grub_keymap_add_by_string("colon", "quote");
|
||||
grub_keymap_add_by_string("asterisk", "doublequote");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketright");
|
||||
grub_keymap_add_by_string("braceleft", "braceright");
|
||||
grub_keymap_add_by_string("bracketright", "backslash");
|
||||
grub_keymap_add_by_string("braceright", "bar");
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("tilde", "plus");
|
||||
grub_keymap_add_by_string("caret", "equal");
|
||||
grub_keymap_add_by_string("backquote", "braceleft");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_LATIN_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("bar", "backquote");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backquote", "bracketleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("braceleft", "quote");
|
||||
grub_keymap_add_by_string("braceright", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("bracketleft", "doublequote");
|
||||
grub_keymap_add_by_string("bracketright", "bar");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "Aquote");
|
||||
grub_keymap_add_by_string("doublequote", "braceleft");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("backquote", "Abackslash");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("greater", "plus");
|
||||
grub_keymap_add_by_string("less", "equal");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("backquote", "Abackslash");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_add_by_string("caret", "Aquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_PORTU_BRAZIL(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("quote", "backquote");
|
||||
grub_keymap_add_by_string("quote", "bracketleft");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketright");
|
||||
grub_keymap_add_by_string("tilde", "quote");
|
||||
grub_keymap_add_by_string("bracketright", "backslash");
|
||||
grub_keymap_add_by_string("semicolon", "slash");
|
||||
grub_keymap_add_by_string("bar", "colon");
|
||||
grub_keymap_add_by_string("doublequote", "tilde");
|
||||
grub_keymap_add_by_string("backquote", "braceleft");
|
||||
grub_keymap_add_by_string("braceleft", "braceright");
|
||||
grub_keymap_add_by_string("caret", "doublequote");
|
||||
grub_keymap_add_by_string("braceright", "bar");
|
||||
grub_keymap_add_by_string("colon", "question");
|
||||
grub_keymap_add_by_string("backslash", "semicolon");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("slash", "Aq");
|
||||
grub_keymap_add_by_string("question", "Aw");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTY_UK(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("at", "doublequote");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("tilde", "bar");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("backslash", "numbersign");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_add_by_string("backslash", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "percent");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backslash", "minus");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "backquote");
|
||||
grub_keymap_add_by_string("backquote", "equal");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("percent", "caret");
|
||||
grub_keymap_add_by_string("less", "numbersign");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ_HUN(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("0", "backquote");
|
||||
grub_keymap_add_by_string("quote", "exclam");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("plus", "numbersign");
|
||||
grub_keymap_add_by_string("exclam", "dollar");
|
||||
grub_keymap_add_by_string("slash", "caret");
|
||||
grub_keymap_add_by_string("equal", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("greater", "Az");
|
||||
grub_keymap_add_by_string("numbersign", "Ax");
|
||||
grub_keymap_add_by_string("ampersand", "Ac");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Am");
|
||||
grub_keymap_add_by_string("dollar", "colon");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("at", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backquote", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "0");
|
||||
grub_keymap_add_by_string("dollar", "Asemicolon");
|
||||
grub_keymap_add_by_string("semicolon", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("asterisk", "Aslash");
|
||||
grub_keymap_add_by_string("backquote", "A9");
|
||||
grub_keymap_add_by_string("doublequote", "A0");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ_SLOV_CROAT(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("plus", "equal");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "tilde");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("asterisk", "plus");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backquote", "A7");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_SPANISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("caret", "braceleft");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("backquote", "bracketleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("plus", "colon");
|
||||
grub_keymap_add_by_string("at", "semicolon");
|
||||
grub_keymap_add_by_string("bar", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("tilde", "A4");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("braceleft", "Aquote");
|
||||
grub_keymap_add_by_string("braceright", "Abackslash");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_SWEDISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("plus", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("doublequote", "bracketright");
|
||||
grub_keymap_add_by_string("quote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "braceright");
|
||||
grub_keymap_add_by_string("asterisk", "bar");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("less", "quote");
|
||||
grub_keymap_add_by_string("greater", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_TURKISH_Q(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "backquote");
|
||||
grub_keymap_add_by_string("asterisk", "minus");
|
||||
grub_keymap_add_by_string("minus", "equal");
|
||||
grub_keymap_add_by_string("comma", "backslash");
|
||||
grub_keymap_add_by_string("period", "slash");
|
||||
grub_keymap_add_by_string("quote", "at");
|
||||
grub_keymap_add_by_string("caret", "numbersign");
|
||||
grub_keymap_add_by_string("plus", "dollar");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("underscore", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "bar");
|
||||
grub_keymap_add_by_string("colon", "question");
|
||||
grub_keymap_add_by_string("less", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "A1");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("bar", "Aequal");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("doublequote", "Abracketleft");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_VIETNAMESE(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("exclam", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("percent", "A5");
|
||||
grub_keymap_add_by_string("caret", "A6");
|
||||
grub_keymap_add_by_string("ampersand", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "A8");
|
||||
grub_keymap_add_by_string("parenleft", "A9");
|
||||
grub_keymap_add_by_string("parenright", "A0");
|
||||
grub_keymap_add_by_string("plus", "Aplus");
|
||||
grub_keymap_add_by_string("equal", "Aequal");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("semicolon", "Asemicolon");
|
||||
grub_keymap_add_by_string("quote", "Aquote");
|
||||
grub_keymap_add_by_string("backslash", "Abackslash");
|
||||
grub_keymap_add_by_string("less", "Aless");
|
||||
grub_keymap_add_by_string("greater", "Agreater");
|
||||
grub_keymap_add_by_string("comma", "Acomma");
|
||||
grub_keymap_add_by_string("period", "Aperiod");
|
||||
grub_keymap_add_by_string("question", "Aquestion");
|
||||
grub_keymap_add_by_string("slash", "Aslash");
|
||||
grub_keymap_add_by_string("tilde", "Atilde");
|
||||
grub_keymap_add_by_string("backquote", "Abackquote");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bar", "Abar");
|
||||
grub_keymap_add_by_string("doublequote", "Adoublequote");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("minus", "Aminus");
|
||||
grub_keymap_add_by_string("underscore", "Aunderscore");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
void ventoy_set_keyboard_layout(const char *layout);
|
||||
void ventoy_set_keyboard_layout(const char *layout) {
|
||||
ventoy_keyboard_set_layout(QWERTY_USA);
|
||||
ventoy_keyboard_set_layout(AZERTY);
|
||||
ventoy_keyboard_set_layout(CZECH_QWERTY);
|
||||
ventoy_keyboard_set_layout(CZECH_QWERTZ);
|
||||
ventoy_keyboard_set_layout(DANISH);
|
||||
ventoy_keyboard_set_layout(DVORAK_USA);
|
||||
ventoy_keyboard_set_layout(FRENCH);
|
||||
ventoy_keyboard_set_layout(GERMAN);
|
||||
ventoy_keyboard_set_layout(ITALIANO);
|
||||
ventoy_keyboard_set_layout(JAPAN_106);
|
||||
ventoy_keyboard_set_layout(LATIN_USA);
|
||||
ventoy_keyboard_set_layout(PORTU_BRAZIL);
|
||||
ventoy_keyboard_set_layout(QWERTY_UK);
|
||||
ventoy_keyboard_set_layout(QWERTZ);
|
||||
ventoy_keyboard_set_layout(QWERTZ_HUN);
|
||||
ventoy_keyboard_set_layout(QWERTZ_SLOV_CROAT);
|
||||
ventoy_keyboard_set_layout(SPANISH);
|
||||
ventoy_keyboard_set_layout(SWEDISH);
|
||||
ventoy_keyboard_set_layout(TURKISH_Q);
|
||||
ventoy_keyboard_set_layout(VIETNAMESE);
|
||||
}
|
@@ -348,12 +348,38 @@ out:
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
static void grub_keymap_add_by_string(const char *src, const char *dst)
|
||||
{
|
||||
int in = 0;
|
||||
int out = 0;
|
||||
|
||||
in = parse_key(dst);
|
||||
out = parse_key(src);
|
||||
|
||||
if (in && out)
|
||||
{
|
||||
grub_keymap_add (in, out);
|
||||
}
|
||||
}
|
||||
|
||||
#include "keyboard_layout.c"
|
||||
|
||||
static grub_err_t grub_cmd_set_keylayout (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
ventoy_set_keyboard_layout(args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd, setcmd;
|
||||
|
||||
GRUB_MOD_INIT(setkey)
|
||||
{
|
||||
cmd = grub_register_extcmd ("setkey", grub_cmd_setkey, 0, N_("NEW_KEY USA_KEY"),
|
||||
N_("Map default USA_KEY to NEW_KEY."), options);
|
||||
setcmd = grub_register_extcmd ("set_keyboard_layout", grub_cmd_set_keylayout, 0, N_("layout"),
|
||||
N_("Set keyboard layout."), NULL);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(setkey)
|
||||
|
File diff suppressed because it is too large
Load Diff
4497
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
Normal file
4497
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -76,6 +76,20 @@
|
||||
return (err);\
|
||||
}
|
||||
|
||||
typedef enum VTOY_FILE_FLT
|
||||
{
|
||||
VTOY_FILE_FLT_ISO = 0, /* .iso */
|
||||
VTOY_FILE_FLT_WIM, /* .wim */
|
||||
VTOY_FILE_FLT_EFI, /* .efi */
|
||||
VTOY_FILE_FLT_IMG, /* .img */
|
||||
VTOY_FILE_FLT_VHD, /* .vhd(x) */
|
||||
VTOY_FILE_FLT_VTOY, /* .vtoy */
|
||||
|
||||
VTOY_FILE_FLT_BUTT
|
||||
}VTOY_FILE_FLT;
|
||||
|
||||
#define FILE_FLT(type) (0 == g_vtoy_file_flt[VTOY_FILE_FLT_##type])
|
||||
|
||||
typedef struct ventoy_initrd_ctx
|
||||
{
|
||||
const char *path_prefix;
|
||||
@@ -126,6 +140,7 @@ typedef struct cpio_newc_header
|
||||
typedef int (*grub_char_check_func)(int c);
|
||||
#define ventoy_is_decimal(str) ventoy_string_check(str, grub_isdigit)
|
||||
|
||||
#define OFFSET_OF(TYPE, MEMBER) ((grub_size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct ventoy_patch_vhd
|
||||
@@ -270,7 +285,7 @@ extern char g_arch_mode_suffix[64];
|
||||
|
||||
extern int g_ventoy_debug;
|
||||
void ventoy_debug(const char *fmt, ...);
|
||||
#define debug(fmt, ...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, __VA_ARGS__)
|
||||
#define debug(fmt, args...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, ##args)
|
||||
|
||||
#define vtoy_ssprintf(buf, pos, fmt, ...) \
|
||||
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
|
||||
@@ -376,6 +391,15 @@ typedef struct wim_security_header
|
||||
grub_uint32_t count; /* Number of entries */
|
||||
}wim_security_header;
|
||||
|
||||
typedef struct wim_stream_entry
|
||||
{
|
||||
grub_uint64_t len;
|
||||
grub_uint64_t unused1;
|
||||
wim_hash hash;
|
||||
grub_uint16_t name_len;
|
||||
/* name */
|
||||
}wim_stream_entry;
|
||||
|
||||
/* Directory entry */
|
||||
typedef struct wim_directory_entry
|
||||
{
|
||||
@@ -504,7 +528,8 @@ typedef struct plugin_entry
|
||||
ventoy_plugin_check_pf checkfunc;
|
||||
}plugin_entry;
|
||||
|
||||
|
||||
int ventoy_strcmp(const char *pattern, const char *str);
|
||||
int ventoy_strncmp (const char *pattern, const char *str, grub_size_t n);
|
||||
void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param);
|
||||
grub_err_t ventoy_cmd_isolinux_initrd_collect(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_grub_initrd_collect(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
@@ -806,6 +831,7 @@ typedef struct menu_class
|
||||
{
|
||||
int type;
|
||||
int patlen;
|
||||
int parent;
|
||||
char pattern[256];
|
||||
char class[64];
|
||||
|
||||
@@ -889,6 +915,7 @@ extern int g_ventoy_suppress_esc;
|
||||
extern int g_ventoy_last_entry;
|
||||
extern int g_ventoy_memdisk_mode;
|
||||
extern int g_ventoy_iso_raw;
|
||||
extern int g_ventoy_grub2_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
extern int g_ventoy_case_insensitive;
|
||||
extern grub_uint8_t g_ventoy_chain_type;
|
||||
@@ -906,6 +933,8 @@ extern grub_uint8_t *g_conf_replace_new_buf;
|
||||
extern int g_conf_replace_new_len;
|
||||
extern int g_conf_replace_new_len_align;
|
||||
extern grub_uint64_t g_ventoy_disk_size;
|
||||
extern grub_uint64_t g_ventoy_disk_part_size[2];
|
||||
extern grub_uint32_t g_ventoy_plat_data;
|
||||
|
||||
#define ventoy_unix_fill_virt(new_data, new_len) \
|
||||
{ \
|
||||
@@ -923,19 +952,23 @@ extern grub_uint64_t g_ventoy_disk_size;
|
||||
chain->virt_img_size_in_bytes += data_secs * 2048; \
|
||||
}
|
||||
|
||||
#define ventoy_syscall0(name) grub_##name()
|
||||
#define ventoy_syscall1(name, a) grub_##name(a)
|
||||
|
||||
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);
|
||||
grub_uint64_t ventoy_get_vtoy_partsize(int part);
|
||||
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);
|
||||
const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path);
|
||||
int ventoy_plugin_check_memdisk(const char *isopath);
|
||||
int ventoy_plugin_get_image_list_index(int type, const char *name);
|
||||
conf_replace * ventoy_plugin_find_conf_replace(const char *iso);
|
||||
@@ -959,6 +992,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc,
|
||||
grub_err_t ventoy_cmd_unix_gzip_newko(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver_elf(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_check_device_result(int ret);
|
||||
int ventoy_check_device(grub_device_t dev);
|
||||
void ventoy_debug_dump_guid(const char *prefix, grub_uint8_t *guid);
|
||||
@@ -967,11 +1001,16 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||
grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_check_password(const vtoy_password *pwd, int retry);
|
||||
int ventoy_gzip_compress(void *mem_in, int mem_in_len, void *mem_out, int mem_out_len);
|
||||
grub_uint64_t ventoy_get_part1_size(ventoy_gpt_info *gpt);
|
||||
int ventoy_plugin_add_custom_boot(const char *vcfgpath);
|
||||
const char * ventoy_plugin_get_custom_boot(const char *isopath);
|
||||
grub_err_t ventoy_cmd_dump_custom_boot(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_gzip_compress(void *mem_in, int mem_in_len, void *mem_out, int mem_out_len);
|
||||
int ventoy_load_part_table(const char *diskname);
|
||||
int ventoy_env_init(void);
|
||||
int ventoy_register_all_cmd(void);
|
||||
int ventoy_unregister_all_cmd(void);
|
||||
|
||||
#define VTOY_CMD_CHECK(a) if (33554432 != g_ventoy_disk_part_size[a]) ventoy_syscall0(exit)
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
@@ -481,6 +481,7 @@ static int ventoy_plugin_auto_install_check(VTOY_JSON *json, const char *isodisk
|
||||
{
|
||||
int pathnum = 0;
|
||||
int autosel = 0;
|
||||
char *pos = NULL;
|
||||
const char *iso = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
|
||||
@@ -500,9 +501,10 @@ static int ventoy_plugin_auto_install_check(VTOY_JSON *json, const char *isodisk
|
||||
iso = vtoy_json_get_string_ex(pNode->pstChild, "image");
|
||||
if (iso)
|
||||
{
|
||||
if (0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
pos = grub_strchr(iso, '*');
|
||||
if (pos || 0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
{
|
||||
grub_printf("image: %s [OK]\n", iso);
|
||||
grub_printf("image: %s [%s]\n", iso, (pos ? "*" : "OK"));
|
||||
ventoy_plugin_check_fullpath(pNode->pstChild, isodisk, "template", &pathnum);
|
||||
|
||||
if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "autosel", &autosel))
|
||||
@@ -599,6 +601,7 @@ static int ventoy_plugin_auto_install_entry(VTOY_JSON *json, const char *isodisk
|
||||
static int ventoy_plugin_dud_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int pathnum = 0;
|
||||
char *pos = NULL;
|
||||
const char *iso = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
|
||||
@@ -618,9 +621,10 @@ static int ventoy_plugin_dud_check(VTOY_JSON *json, const char *isodisk)
|
||||
iso = vtoy_json_get_string_ex(pNode->pstChild, "image");
|
||||
if (iso)
|
||||
{
|
||||
if (0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
pos = grub_strchr(iso, '*');
|
||||
if (pos || 0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
{
|
||||
grub_printf("image: %s [OK]\n", iso);
|
||||
grub_printf("image: %s [%s]\n", iso, (pos ? "*" : "OK"));
|
||||
ventoy_plugin_check_fullpath(pNode->pstChild, isodisk, "dud", &pathnum);
|
||||
}
|
||||
else
|
||||
@@ -884,6 +888,7 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
|
||||
|
||||
static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
char *pos = NULL;
|
||||
const char *iso = NULL;
|
||||
const char *pwd = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
@@ -922,13 +927,14 @@ static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
|
||||
iso = vtoy_json_get_string_ex(pCNode->pstChild, "file");
|
||||
if (iso)
|
||||
{
|
||||
if (0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
pos = grub_strchr(iso, '*');
|
||||
if (pos || 0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
{
|
||||
pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd");
|
||||
|
||||
if (0 == ventoy_plugin_parse_pwdstr((char *)pwd, NULL))
|
||||
{
|
||||
grub_printf("file:<%s> [OK]\n", iso);
|
||||
grub_printf("file:<%s> [%s]\n", iso, (pos ? "*" : "OK"));
|
||||
grub_printf("pwd:<%s>\n\n", pwd);
|
||||
}
|
||||
else
|
||||
@@ -956,6 +962,7 @@ static int ventoy_plugin_persistence_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int autosel = 0;
|
||||
int pathnum = 0;
|
||||
char *pos = NULL;
|
||||
const char *iso = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
|
||||
@@ -975,9 +982,10 @@ static int ventoy_plugin_persistence_check(VTOY_JSON *json, const char *isodisk)
|
||||
iso = vtoy_json_get_string_ex(pNode->pstChild, "image");
|
||||
if (iso)
|
||||
{
|
||||
if (0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
pos = grub_strchr(iso, '*');
|
||||
if (pos || 0 == ventoy_plugin_check_path(isodisk, iso))
|
||||
{
|
||||
grub_printf("image: %s [OK]\n", iso);
|
||||
grub_printf("image: %s [%s]\n", iso, (pos ? "*" : "OK"));
|
||||
ventoy_plugin_check_fullpath(pNode->pstChild, isodisk, "backend", &pathnum);
|
||||
|
||||
if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "autosel", &autosel))
|
||||
@@ -1103,7 +1111,11 @@ static int ventoy_plugin_menualias_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
if (vtoy_alias_image_file == type)
|
||||
{
|
||||
if (ventoy_is_file_exist("%s%s", isodisk, path))
|
||||
if (grub_strchr(path, '*'))
|
||||
{
|
||||
grub_printf("image: <%s> [ * ]\n", path);
|
||||
}
|
||||
else if (ventoy_is_file_exist("%s%s", isodisk, path))
|
||||
{
|
||||
grub_printf("image: <%s> [ OK ]\n", path);
|
||||
}
|
||||
@@ -1223,7 +1235,15 @@ static int ventoy_plugin_injection_check(VTOY_JSON *json, const char *isodisk)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_strchr(path, '*'))
|
||||
{
|
||||
grub_printf("image: <%s> [*]\n", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -1285,6 +1305,7 @@ static int ventoy_plugin_injection_entry(VTOY_JSON *json, const char *isodisk)
|
||||
static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int type;
|
||||
int parent = 0;
|
||||
const char *key = NULL;
|
||||
const char *class = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
@@ -1313,13 +1334,22 @@ static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
|
||||
|
||||
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
|
||||
{
|
||||
parent = 0;
|
||||
type = vtoy_class_image_file;
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "key");
|
||||
if (!key)
|
||||
{
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "parent");
|
||||
if (key)
|
||||
{
|
||||
parent = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "dir");
|
||||
type = vtoy_class_directory;
|
||||
}
|
||||
}
|
||||
|
||||
class = vtoy_json_get_string_ex(pNode->pstChild, "class");
|
||||
if (key && class)
|
||||
@@ -1328,6 +1358,7 @@ static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
|
||||
if (node)
|
||||
{
|
||||
node->type = type;
|
||||
node->parent = parent;
|
||||
node->patlen = grub_snprintf(node->pattern, sizeof(node->pattern), "%s", key);
|
||||
grub_snprintf(node->class, sizeof(node->class), "%s", class);
|
||||
|
||||
@@ -1349,7 +1380,7 @@ static int ventoy_plugin_menuclass_entry(VTOY_JSON *json, const char *isodisk)
|
||||
|
||||
static int ventoy_plugin_menuclass_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int type;
|
||||
const char *name = NULL;
|
||||
const char *key = NULL;
|
||||
const char *class = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
@@ -1364,18 +1395,23 @@ static int ventoy_plugin_menuclass_check(VTOY_JSON *json, const char *isodisk)
|
||||
|
||||
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
|
||||
{
|
||||
type = vtoy_class_image_file;
|
||||
name = "key";
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "key");
|
||||
if (!key)
|
||||
{
|
||||
name = "parent";
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "parent");
|
||||
if (!key)
|
||||
{
|
||||
name = "dir";
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "dir");
|
||||
type = vtoy_class_directory;
|
||||
}
|
||||
}
|
||||
|
||||
class = vtoy_json_get_string_ex(pNode->pstChild, "class");
|
||||
if (key && class)
|
||||
{
|
||||
grub_printf("%s: <%s>\n", (type == vtoy_class_directory) ? "dir" : "key", key);
|
||||
grub_printf("%s: <%s>\n", name, key);
|
||||
grub_printf("class: <%s>\n\n", class);
|
||||
}
|
||||
}
|
||||
@@ -1611,6 +1647,11 @@ static int ventoy_plugin_conf_replace_check(VTOY_JSON *json, const char *isodisk
|
||||
|
||||
grub_script_execute_sourcecode("loopback -d vtisocheck");
|
||||
}
|
||||
else if (grub_strchr(isof, '*'))
|
||||
{
|
||||
grub_printf("iso:<%s> [*]\n", isof);
|
||||
grub_printf("org:<%s>\n", orgf);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_printf("iso:<%s> [NOT Exist]\n", isof);
|
||||
@@ -1704,7 +1745,11 @@ static int ventoy_plugin_auto_memdisk_check(VTOY_JSON *json, const char *isodisk
|
||||
{
|
||||
grub_printf("<%s> ", pNode->unData.pcStrVal);
|
||||
|
||||
if (ventoy_check_file_exist("%s%s", isodisk, pNode->unData.pcStrVal))
|
||||
if (grub_strchr(pNode->unData.pcStrVal, '*'))
|
||||
{
|
||||
grub_printf(" [*]\n");
|
||||
}
|
||||
else if (ventoy_check_file_exist("%s%s", isodisk, pNode->unData.pcStrVal))
|
||||
{
|
||||
grub_printf(" [OK]\n");
|
||||
}
|
||||
@@ -1744,7 +1789,7 @@ static int ventoy_plugin_image_list_entry(VTOY_JSON *json, const char *isodisk)
|
||||
g_image_list_head = NULL;
|
||||
}
|
||||
|
||||
if (grub_strcmp(json->pcName, "image_blacklist") == 0)
|
||||
if (grub_strncmp(json->pcName, "image_blacklist", 15) == 0)
|
||||
{
|
||||
g_plugin_image_list = VENTOY_IMG_BLACK_LIST;
|
||||
}
|
||||
@@ -1794,7 +1839,11 @@ static int ventoy_plugin_image_list_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
grub_printf("<%s> ", pNode->unData.pcStrVal);
|
||||
|
||||
if (ventoy_check_file_exist("%s%s", isodisk, pNode->unData.pcStrVal))
|
||||
if (grub_strchr(pNode->unData.pcStrVal, '*'))
|
||||
{
|
||||
grub_printf(" [*]\n");
|
||||
}
|
||||
else if (ventoy_check_file_exist("%s%s", isodisk, pNode->unData.pcStrVal))
|
||||
{
|
||||
grub_printf(" [OK]\n");
|
||||
}
|
||||
@@ -1996,7 +2045,7 @@ install_template * ventoy_plugin_find_install_template(const char *isopath)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_install_template_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strcmp(node->isopath, isopath) == 0)
|
||||
if (node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
@@ -2036,7 +2085,7 @@ persistence_config * ventoy_plugin_find_persistent(const char *isopath)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_persistence_head; node; node = node->next)
|
||||
{
|
||||
if ((len == node->pathlen) && (grub_strcmp(node->isopath, isopath) == 0))
|
||||
if ((len == node->pathlen) && (ventoy_strcmp(node->isopath, isopath) == 0))
|
||||
{
|
||||
return node;
|
||||
}
|
||||
@@ -2117,7 +2166,7 @@ const char * ventoy_plugin_get_injection(const char *isopath)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_injection_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strcmp(node->isopath, isopath) == 0)
|
||||
if (node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0)
|
||||
{
|
||||
return node->archive;
|
||||
}
|
||||
@@ -2140,7 +2189,7 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
|
||||
for (node = g_menu_alias_head; node; node = node->next)
|
||||
{
|
||||
if (node->type == type && node->pathlen &&
|
||||
node->pathlen == len && grub_strcmp(node->isopath, isopath) == 0)
|
||||
node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0)
|
||||
{
|
||||
return node->alias;
|
||||
}
|
||||
@@ -2149,7 +2198,7 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * ventoy_plugin_get_menu_class(int type, const char *name)
|
||||
const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path)
|
||||
{
|
||||
int len;
|
||||
menu_class *node = NULL;
|
||||
@@ -2159,20 +2208,37 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = (int)grub_strlen(name);
|
||||
|
||||
if (vtoy_class_image_file == type)
|
||||
{
|
||||
for (node = g_menu_class_head; node; node = node->next)
|
||||
{
|
||||
if (node->type == type && node->patlen <= len && grub_strstr(name, node->pattern))
|
||||
if (node->type != type)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (node->parent)
|
||||
{
|
||||
len = (int)grub_strlen(path);
|
||||
if ((node->patlen < len) && (path[node->patlen] == '/') &&
|
||||
(grub_strncmp(path, node->pattern, node->patlen) == 0))
|
||||
{
|
||||
return node->class;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (int)grub_strlen(name);
|
||||
if ((node->patlen < len) && grub_strstr(name, node->pattern))
|
||||
{
|
||||
return node->class;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (int)grub_strlen(name);
|
||||
for (node = g_menu_class_head; node; node = node->next)
|
||||
{
|
||||
if (node->type == type && node->patlen == len && grub_strncmp(name, node->pattern, len) == 0)
|
||||
@@ -2288,7 +2354,7 @@ int ventoy_plugin_check_memdisk(const char *isopath)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_auto_memdisk_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strncmp(isopath, node->isopath, len) == 0)
|
||||
if (node->pathlen == len && ventoy_strncmp(node->isopath, isopath, len) == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -2314,14 +2380,14 @@ int ventoy_plugin_get_image_list_index(int type, const char *name)
|
||||
{
|
||||
if (vtoy_class_directory == type)
|
||||
{
|
||||
if (len < node->pathlen && grub_strncmp(name, node->isopath, len) == 0)
|
||||
if (len < node->pathlen && ventoy_strncmp(node->isopath, name, len) == 0)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len == node->pathlen && grub_strncmp(name, node->isopath, len) == 0)
|
||||
if (len == node->pathlen && ventoy_strncmp(node->isopath, name, len) == 0)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
@@ -2345,7 +2411,7 @@ conf_replace * ventoy_plugin_find_conf_replace(const char *iso)
|
||||
|
||||
for (node = g_conf_replace_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strncmp(iso, node->isopath, len) == 0)
|
||||
if (node->pathlen == len && ventoy_strncmp(node->isopath, iso, len) == 0)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
@@ -2367,7 +2433,7 @@ dud * ventoy_plugin_find_dud(const char *iso)
|
||||
len = (int)grub_strlen(iso);
|
||||
for (node = g_dud_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strncmp(iso, node->isopath, len) == 0)
|
||||
if (node->pathlen == len && ventoy_strncmp(node->isopath, iso, len) == 0)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
@@ -2420,7 +2486,7 @@ static const vtoy_password * ventoy_plugin_get_password(const char *isopath)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_pwd_head; node; node = node->next)
|
||||
{
|
||||
if (node->pathlen == len && grub_strncmp(isopath, node->isopath, len) == 0)
|
||||
if (node->pathlen == len && ventoy_strncmp(node->isopath, isopath, len) == 0)
|
||||
{
|
||||
return &(node->password);
|
||||
}
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/net.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/elfload.h>
|
||||
#include <grub/ventoy.h>
|
||||
#include "ventoy_def.h"
|
||||
|
||||
@@ -383,6 +385,174 @@ grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, cha
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver_elf(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int j;
|
||||
int k;
|
||||
grub_elf_t elf = NULL;
|
||||
grub_off_t offset = 0;
|
||||
grub_uint32_t len = 0;
|
||||
char *str = NULL;
|
||||
char *data = NULL;
|
||||
void *hdr = NULL;
|
||||
char ver[64] = {0};
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
debug("Invalid argc %d\n", argc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
data = grub_zalloc(8192);
|
||||
if (!data)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
elf = grub_elf_open(args[0], GRUB_FILE_TYPE_LINUX_INITRD);
|
||||
if (!elf)
|
||||
{
|
||||
debug("Failed to open file %s\n", args[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (args[1][0] == '6')
|
||||
{
|
||||
Elf64_Ehdr *e = &(elf->ehdr.ehdr64);
|
||||
Elf64_Shdr *h;
|
||||
Elf64_Shdr *s;
|
||||
Elf64_Shdr *t;
|
||||
Elf64_Half i;
|
||||
|
||||
h = hdr = grub_zalloc(e->e_shnum * e->e_shentsize);
|
||||
if (!h)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
debug("read section header %u %u %u\n", e->e_shnum, e->e_shentsize, e->e_shstrndx);
|
||||
grub_file_seek(elf->file, e->e_shoff);
|
||||
grub_file_read(elf->file, h, e->e_shnum * e->e_shentsize);
|
||||
|
||||
s = (Elf64_Shdr *)((char *)h + e->e_shstrndx * e->e_shentsize);
|
||||
str = grub_malloc(s->sh_size + 1);
|
||||
if (!str)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
str[s->sh_size] = 0;
|
||||
|
||||
debug("read string table %u %u\n", (grub_uint32_t)s->sh_offset, (grub_uint32_t)s->sh_size);
|
||||
grub_file_seek(elf->file, s->sh_offset);
|
||||
grub_file_read(elf->file, str, s->sh_size);
|
||||
|
||||
for (t = h, i = 0; i < e->e_shnum; i++)
|
||||
{
|
||||
if (grub_strcmp(str + t->sh_name, ".data") == 0)
|
||||
{
|
||||
offset = t->sh_offset;
|
||||
len = t->sh_size;
|
||||
debug("find .data section at %u %u\n", (grub_uint32_t)offset, len);
|
||||
break;
|
||||
}
|
||||
t = (Elf64_Shdr *)((char *)t + e->e_shentsize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Elf32_Ehdr *e = &(elf->ehdr.ehdr32);
|
||||
Elf32_Shdr *h;
|
||||
Elf32_Shdr *s;
|
||||
Elf32_Shdr *t;
|
||||
Elf32_Half i;
|
||||
|
||||
h = hdr = grub_zalloc(e->e_shnum * e->e_shentsize);
|
||||
if (!h)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
debug("read section header %u %u %u\n", e->e_shnum, e->e_shentsize, e->e_shstrndx);
|
||||
grub_file_seek(elf->file, e->e_shoff);
|
||||
grub_file_read(elf->file, h, e->e_shnum * e->e_shentsize);
|
||||
|
||||
s = (Elf32_Shdr *)((char *)h + e->e_shstrndx * e->e_shentsize);
|
||||
str = grub_malloc(s->sh_size + 1);
|
||||
if (!str)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
str[s->sh_size] = 0;
|
||||
|
||||
debug("read string table %u %u\n", (grub_uint32_t)s->sh_offset, (grub_uint32_t)s->sh_size);
|
||||
grub_file_seek(elf->file, s->sh_offset);
|
||||
grub_file_read(elf->file, str, s->sh_size);
|
||||
|
||||
for (t = h, i = 0; i < e->e_shnum; i++)
|
||||
{
|
||||
if (grub_strcmp(str + t->sh_name, ".data") == 0)
|
||||
{
|
||||
offset = t->sh_offset;
|
||||
len = t->sh_size;
|
||||
debug("find .data section at %u %u\n", (grub_uint32_t)offset, len);
|
||||
break;
|
||||
}
|
||||
t = (Elf32_Shdr *)((char *)t + e->e_shentsize);
|
||||
}
|
||||
}
|
||||
|
||||
if (offset == 0 || len == 0)
|
||||
{
|
||||
debug(".data section not found %s\n", args[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
grub_file_seek(elf->file, offset + len - 8192);
|
||||
grub_file_read(elf->file, data, 8192);
|
||||
|
||||
for (j = 0; j < 8192 - 12; j++)
|
||||
{
|
||||
if (grub_strncmp(data + j, "@(#)FreeBSD ", 12) == 0)
|
||||
{
|
||||
for (k = j + 12; k < 8192; k++)
|
||||
{
|
||||
if (0 == grub_isdigit(data[k]) && data[k] != '.')
|
||||
{
|
||||
data[k] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grub_snprintf(ver, sizeof(ver), "%s", data + j + 12);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ver[0])
|
||||
{
|
||||
k = (int)grub_strtoul(ver, NULL, 10);
|
||||
debug("freebsd version:<%s> <%d.x>\n", ver, k);
|
||||
grub_snprintf(ver, sizeof(ver), "%d.x", k);
|
||||
ventoy_set_env(args[2], ver);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("freebsd version:<%s>\n", "NOT FOUND");
|
||||
}
|
||||
|
||||
out:
|
||||
grub_check_free(str);
|
||||
grub_check_free(hdr);
|
||||
grub_check_free(data);
|
||||
check_free(elf, grub_elf_close);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_uint32_t i;
|
||||
@@ -550,7 +720,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc,
|
||||
|
||||
desc = (ventoy_image_desc *)(byte + i);
|
||||
desc->disk_size = g_ventoy_disk_size;
|
||||
desc->part1_size = ventoy_get_part1_size(g_ventoy_part_info);
|
||||
desc->part1_size = g_ventoy_disk_part_size[0];
|
||||
grub_memcpy(desc->disk_uuid, g_ventoy_part_info->MBR.BootCode + 0x180, 16);
|
||||
grub_memcpy(desc->disk_signature, g_ventoy_part_info->MBR.BootCode + 0x1B8, 4);
|
||||
|
||||
|
@@ -44,14 +44,12 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static int g_vhdboot_bcd_offset = 0;
|
||||
static int g_vhdboot_bcd_len = 0;
|
||||
static int g_vhdboot_isolen = 0;
|
||||
static char *g_vhdboot_totbuf = NULL;
|
||||
static char *g_vhdboot_isobuf = NULL;
|
||||
static grub_uint64_t g_img_trim_head_secnum = 0;
|
||||
|
||||
static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
|
||||
static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen, const char *path)
|
||||
{
|
||||
grub_uint32_t offset;
|
||||
grub_file_t file;
|
||||
@@ -61,10 +59,9 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
|
||||
|
||||
grub_script_execute_sourcecode(cmdbuf);
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", "(vhdiso)/boot/bcd");
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(vhdiso)%s", path);
|
||||
if (!file)
|
||||
{
|
||||
grub_printf("Failed to open bcd file in the image file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -83,13 +80,15 @@ static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
|
||||
static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2,
|
||||
int bcdoffset, int bcdlen)
|
||||
{
|
||||
int i;
|
||||
int cnt = 0;
|
||||
char *pos;
|
||||
grub_size_t pathlen;
|
||||
const char *plat;
|
||||
char *newpath = NULL;
|
||||
grub_uint16_t *unicode_path;
|
||||
const grub_uint8_t winloadexe[] =
|
||||
{
|
||||
@@ -97,6 +96,11 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
|
||||
0x65, 0x00, 0x78, 0x00, 0x65, 0x00
|
||||
};
|
||||
|
||||
while ((*vhdpath) != '/')
|
||||
{
|
||||
vhdpath++;
|
||||
}
|
||||
|
||||
pathlen = sizeof(grub_uint16_t) * (grub_strlen(vhdpath) + 1);
|
||||
debug("unicode path for <%s> len:%d\n", vhdpath, (int)pathlen);
|
||||
|
||||
@@ -110,10 +114,10 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
|
||||
|
||||
if (plat && (plat[0] == 'e')) /* UEFI */
|
||||
{
|
||||
pos = g_vhdboot_isobuf + g_vhdboot_bcd_offset;
|
||||
pos = g_vhdboot_isobuf + bcdoffset;
|
||||
|
||||
/* winload.exe ==> winload.efi */
|
||||
for (i = 0; i + (int)sizeof(winloadexe) < g_vhdboot_bcd_len; i++)
|
||||
for (i = 0; i + (int)sizeof(winloadexe) < bcdlen; i++)
|
||||
{
|
||||
if (*((grub_uint32_t *)(pos + i)) == 0x00690077 &&
|
||||
grub_memcmp(pos + i, winloadexe, sizeof(winloadexe)) == 0)
|
||||
@@ -127,7 +131,8 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
|
||||
debug("winload patch %d times\n", cnt);
|
||||
}
|
||||
|
||||
for (pos = vhdpath; *pos; pos++)
|
||||
newpath = grub_strdup(vhdpath);
|
||||
for (pos = newpath; *pos; pos++)
|
||||
{
|
||||
if (*pos == '/')
|
||||
{
|
||||
@@ -135,40 +140,159 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
|
||||
}
|
||||
}
|
||||
|
||||
grub_utf8_to_utf16(unicode_path, pathlen, (grub_uint8_t *)vhdpath, -1, NULL);
|
||||
grub_utf8_to_utf16(unicode_path, pathlen, (grub_uint8_t *)newpath, -1, NULL);
|
||||
grub_memcpy(patch1->vhd_file_path, unicode_path, pathlen);
|
||||
grub_memcpy(patch2->vhd_file_path, unicode_path, pathlen);
|
||||
|
||||
grub_free(newpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
|
||||
static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, int *index)
|
||||
{
|
||||
int i;
|
||||
int ret = 1;
|
||||
grub_uint64_t start;
|
||||
grub_file_t file = NULL;
|
||||
grub_disk_t disk = NULL;
|
||||
grub_uint8_t zeroguid[16] = {0};
|
||||
|
||||
file = grub_file_open(filename, VENTOY_FILE_TYPE);
|
||||
if (!file)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
disk = grub_disk_open(file->device->disk->name);
|
||||
if (!disk)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), gpt);
|
||||
|
||||
start = file->device->disk->partition->start;
|
||||
|
||||
if (grub_memcmp(gpt->Head.Signature, "EFI PART", 8) == 0)
|
||||
{
|
||||
debug("GPT part start: %llu\n", (ulonglong)start);
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
if (grub_memcmp(gpt->PartTbl[i].PartGuid, zeroguid, 16))
|
||||
{
|
||||
if (start == gpt->PartTbl[i].StartLBA)
|
||||
{
|
||||
*index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("MBR part start: %llu\n", (ulonglong)start);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if ((grub_uint32_t)start == gpt->MBR.PartTbl[i].StartSectorId)
|
||||
{
|
||||
*index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
check_free(file, grub_file_close);
|
||||
check_free(disk, grub_disk_close);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ventoy_vhd_patch_disk(const char *vhdpath, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
|
||||
{
|
||||
int partIndex = 0;
|
||||
grub_uint64_t offset = 0;
|
||||
char efipart[16] = {0};
|
||||
ventoy_gpt_info *gpt = NULL;
|
||||
|
||||
grub_memcpy(efipart, g_ventoy_part_info->Head.Signature, sizeof(g_ventoy_part_info->Head.Signature));
|
||||
if (vhdpath[0] == '/')
|
||||
{
|
||||
gpt = g_ventoy_part_info;
|
||||
partIndex = 0;
|
||||
debug("This is Ventoy ISO partIndex %d %s\n", partIndex, vhdpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpt = grub_zalloc(sizeof(ventoy_gpt_info));
|
||||
ventoy_vhd_read_parttbl(vhdpath, gpt, &partIndex);
|
||||
debug("This is HDD partIndex %d %s\n", partIndex, vhdpath);
|
||||
}
|
||||
|
||||
debug("part1 type: 0x%x <%s>\n", g_ventoy_part_info->MBR.PartTbl[0].FsFlag, efipart);
|
||||
grub_memcpy(efipart, gpt->Head.Signature, sizeof(gpt->Head.Signature));
|
||||
|
||||
grub_memset(patch1, 0, OFFSET_OF(ventoy_patch_vhd, vhd_file_path));
|
||||
grub_memset(patch2, 0, OFFSET_OF(ventoy_patch_vhd, vhd_file_path));
|
||||
|
||||
if (grub_strncmp(efipart, "EFI PART", 8) == 0)
|
||||
{
|
||||
ventoy_debug_dump_guid("GPT disk GUID: ", g_ventoy_part_info->Head.DiskGuid);
|
||||
ventoy_debug_dump_guid("GPT part GUID: ", g_ventoy_part_info->PartTbl[0].PartGuid);
|
||||
ventoy_debug_dump_guid("GPT disk GUID: ", gpt->Head.DiskGuid);
|
||||
ventoy_debug_dump_guid("GPT partIndex GUID: ", gpt->PartTbl[partIndex].PartGuid);
|
||||
|
||||
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
|
||||
grub_memcpy(patch1->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
|
||||
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
|
||||
grub_memcpy(patch2->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
|
||||
grub_memcpy(patch1->disk_signature_or_guid, gpt->Head.DiskGuid, 16);
|
||||
grub_memcpy(patch1->part_offset_or_guid, gpt->PartTbl[partIndex].PartGuid, 16);
|
||||
grub_memcpy(patch2->disk_signature_or_guid, gpt->Head.DiskGuid, 16);
|
||||
grub_memcpy(patch2->part_offset_or_guid, gpt->PartTbl[partIndex].PartGuid, 16);
|
||||
|
||||
patch1->part_type = patch2->part_type = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("MBR disk signature: %02x%02x%02x%02x\n",
|
||||
g_ventoy_part_info->MBR.BootCode[0x1b8 + 0], g_ventoy_part_info->MBR.BootCode[0x1b8 + 1],
|
||||
g_ventoy_part_info->MBR.BootCode[0x1b8 + 2], g_ventoy_part_info->MBR.BootCode[0x1b8 + 3]);
|
||||
grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||
grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
|
||||
offset = gpt->MBR.PartTbl[partIndex].StartSectorId;
|
||||
offset *= 512;
|
||||
|
||||
debug("MBR disk signature: %02x%02x%02x%02x Part(%d) offset:%llu\n",
|
||||
gpt->MBR.BootCode[0x1b8 + 0], gpt->MBR.BootCode[0x1b8 + 1],
|
||||
gpt->MBR.BootCode[0x1b8 + 2], gpt->MBR.BootCode[0x1b8 + 3],
|
||||
partIndex + 1, offset);
|
||||
|
||||
grub_memcpy(patch1->part_offset_or_guid, &offset, 8);
|
||||
grub_memcpy(patch2->part_offset_or_guid, &offset, 8);
|
||||
|
||||
grub_memcpy(patch1->disk_signature_or_guid, gpt->MBR.BootCode + 0x1b8, 4);
|
||||
grub_memcpy(patch2->disk_signature_or_guid, gpt->MBR.BootCode + 0x1b8, 4);
|
||||
|
||||
patch1->part_type = patch2->part_type = 1;
|
||||
}
|
||||
|
||||
if (gpt != g_ventoy_part_info)
|
||||
{
|
||||
grub_free(gpt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_find_vhdpatch_offset(int bcdoffset, int bcdlen, int *offset)
|
||||
{
|
||||
int i;
|
||||
int cnt = 0;
|
||||
grub_uint8_t *buf = (grub_uint8_t *)(g_vhdboot_isobuf + bcdoffset);
|
||||
grub_uint8_t magic[16] = {
|
||||
0x5C, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00, 0x58, 0x00
|
||||
};
|
||||
|
||||
for (i = 0; i < bcdlen - 16 && cnt < 2; i++)
|
||||
{
|
||||
if (*(grub_uint32_t *)(buf + i) == 0x0058005C)
|
||||
{
|
||||
if (grub_memcmp(magic, buf + i, 16) == 0)
|
||||
{
|
||||
*offset++ = i - (int)OFFSET_OF(ventoy_patch_vhd, vhd_file_path);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -177,6 +301,8 @@ static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *pat
|
||||
grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int rc;
|
||||
int bcdoffset, bcdlen;
|
||||
int patchoffset[2];
|
||||
ventoy_patch_vhd *patch1;
|
||||
ventoy_patch_vhd *patch2;
|
||||
char envbuf[64];
|
||||
@@ -194,18 +320,39 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = ventoy_vhd_find_bcd(&g_vhdboot_bcd_offset, &g_vhdboot_bcd_len);
|
||||
rc = ventoy_vhd_find_bcd(&bcdoffset, &bcdlen, "/boot/bcd");
|
||||
if (rc)
|
||||
{
|
||||
debug("failed to get bcd location %d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ventoy_find_vhdpatch_offset(bcdoffset, bcdlen, patchoffset);
|
||||
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[0]);
|
||||
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[1]);
|
||||
|
||||
debug("Find /boot/bcd (%d %d) now patch it (offset: 0x%x 0x%x) ...\n",
|
||||
bcdoffset, bcdlen, patchoffset[0], patchoffset[1]);
|
||||
ventoy_vhd_patch_disk(args[0], patch1, patch2);
|
||||
ventoy_vhd_patch_path(args[0], patch1, patch2, bcdoffset, bcdlen);
|
||||
}
|
||||
|
||||
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x495a);
|
||||
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x50aa);
|
||||
rc = ventoy_vhd_find_bcd(&bcdoffset, &bcdlen, "/boot/BCD");
|
||||
if (rc)
|
||||
{
|
||||
debug("No file /boot/BCD \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
ventoy_find_vhdpatch_offset(bcdoffset, bcdlen, patchoffset);
|
||||
patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[0]);
|
||||
patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + bcdoffset + patchoffset[1]);
|
||||
|
||||
ventoy_vhd_patch_disk(patch1, patch2);
|
||||
ventoy_vhd_patch_path(args[0], patch1, patch2);
|
||||
debug("Find /boot/BCD (%d %d) now patch it (offset: 0x%x 0x%x) ...\n",
|
||||
bcdoffset, bcdlen, patchoffset[0], patchoffset[1]);
|
||||
ventoy_vhd_patch_disk(args[0], patch1, patch2);
|
||||
ventoy_vhd_patch_path(args[0], patch1, patch2, bcdoffset, bcdlen);
|
||||
}
|
||||
|
||||
/* set buffer and size */
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
@@ -220,7 +367,7 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||
grub_env_set("vtoy_vhd_buf_size", envbuf);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
|
@@ -636,6 +636,21 @@ static wim_lookup_entry * ventoy_find_meta_entry(wim_header *header, wim_lookup_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static grub_uint64_t ventoy_get_stream_len(wim_directory_entry *dir)
|
||||
{
|
||||
grub_uint16_t i;
|
||||
grub_uint64_t offset = 0;
|
||||
wim_stream_entry *stream = (wim_stream_entry *)((char *)dir + dir->len);
|
||||
|
||||
for (i = 0; i < dir->streams; i++)
|
||||
{
|
||||
offset += stream->len;
|
||||
stream = (wim_stream_entry *)((char *)stream + stream->len);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int ventoy_update_all_hash(wim_patch *patch, void *meta_data, wim_directory_entry *dir)
|
||||
{
|
||||
if ((meta_data == NULL) || (dir == NULL))
|
||||
@@ -661,7 +676,14 @@ static int ventoy_update_all_hash(wim_patch *patch, void *meta_data, wim_directo
|
||||
ventoy_update_all_hash(patch, meta_data, (wim_directory_entry *)((char *)meta_data + dir->subdir));
|
||||
}
|
||||
|
||||
if (dir->streams)
|
||||
{
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len + ventoy_get_stream_len(dir));
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len);
|
||||
}
|
||||
} while (dir->len >= sizeof(wim_directory_entry));
|
||||
|
||||
return 0;
|
||||
@@ -860,7 +882,14 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
|
||||
}
|
||||
|
||||
security = (wim_security_header *)decompress_data;
|
||||
if (security->len > 0)
|
||||
{
|
||||
rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U));
|
||||
}
|
||||
else
|
||||
{
|
||||
rootdir = (wim_directory_entry *)(decompress_data + 8);
|
||||
}
|
||||
|
||||
/* search winpeshl.exe dirent entry */
|
||||
search = search_replace_wim_dirent(decompress_data, rootdir);
|
||||
|
@@ -12,14 +12,14 @@ make install
|
||||
PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
|
||||
|
||||
net_modules_legacy="net tftp http"
|
||||
all_modules_legacy="setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
|
||||
all_modules_legacy="file setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
|
||||
|
||||
net_modules_uefi="efinet net tftp http"
|
||||
all_modules_uefi="setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
all_modules_arm64_uefi="setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_arm64_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
all_modules_mips64el_uefi="setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
all_modules_mips64el_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
|
||||
if [ "$1" = "uefi" ]; then
|
||||
|
@@ -61,3 +61,7 @@ else
|
||||
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
||||
fi
|
||||
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
$SED "1 aexport cow_label=vtoycow" -i /init
|
||||
fi
|
||||
|
79
IMG/cpio/ventoy/hook/debian/kerio-disk.sh
Normal file
79
IMG/cpio/ventoy/hook/debian/kerio-disk.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
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
|
||||
ventoy_os_install_dmsetup_by_ko() {
|
||||
vtlog "ventoy_os_install_dmsetup_by_ko $1"
|
||||
|
||||
vtVer=$(uname -r)
|
||||
if uname -m | $GREP -q 64; then
|
||||
vtBit=64
|
||||
else
|
||||
vtBit=32
|
||||
fi
|
||||
|
||||
ventoy_extract_vtloopex $1 kerio
|
||||
vtLoopExDir=$VTOY_PATH/vtloopex/kerio/vtloopex
|
||||
|
||||
if [ -e $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz ]; then
|
||||
$BUSYBOX_PATH/xz -d $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz
|
||||
insmod $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
if echo $vtdiskname | $EGREP -q "nvme|mmc|nbd"; then
|
||||
ventoy_os_install_dmsetup_by_ko "${vtdiskname}p2"
|
||||
else
|
||||
ventoy_os_install_dmsetup_by_ko "${vtdiskname}2"
|
||||
fi
|
||||
|
||||
|
||||
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/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
|
||||
vtlog "/dev/$vtDM"
|
||||
mount -t iso9660 /dev/$vtDM /cdrom
|
||||
modprobe squashfs
|
||||
echo "/dev/$vtDM" > /ventoy/vtDM
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
20
IMG/cpio/ventoy/hook/debian/kerio-hook.sh
Normal file
20
IMG/cpio/ventoy/hook/debian/kerio-hook.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/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 "/for drive in/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/kerio-disk.sh >/dev/null 2>&1; cat /ventoy/vtDM; exit 0" -i /installer/install_init
|
@@ -37,9 +37,17 @@ ventoy_os_install_dmsetup_by_fuse() {
|
||||
|
||||
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
|
||||
|
||||
sfsfile=$(ls $VTOY_PATH/mnt/iso/adrv_veket*.sfs)
|
||||
|
||||
for sfsfile in $(ls $VTOY_PATH/mnt/iso/*drv_veket*.sfs); do
|
||||
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
|
||||
if [ -d $VTOY_PATH/mnt/squashfs/lib/modules ]; then
|
||||
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
|
||||
if [ -n "$KoName" -a -f $KoName ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
umount $VTOY_PATH/mnt/squashfs
|
||||
done
|
||||
|
||||
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/dax/dax.ko*)
|
||||
vtlog "insmod $KoName"
|
||||
|
@@ -20,3 +20,10 @@
|
||||
$SED '1 apmedia=usbhd' -i /init
|
||||
$SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/veket-disk.sh" -i /init
|
||||
$SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='ventoy|iso9660'" -i /init
|
||||
|
||||
if [ -d /dev ]; then
|
||||
[ -e /dev/null ] || $BUSYBOX_PATH/mknod /dev/null c 1 3
|
||||
else
|
||||
$BUSYBOX_PATH/mkdir /dev
|
||||
$BUSYBOX_PATH/mknod /dev/null c 1 3
|
||||
fi
|
||||
|
@@ -28,6 +28,12 @@ ventoy_get_debian_distro() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /DISTRO_SPECS ]; then
|
||||
if $GREP -q veket /DISTRO_SPECS; then
|
||||
echo 'veket'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /init ]; then
|
||||
if $GREP -q PUPPYSFS /init; then
|
||||
if $GREP -q VEKETSFS /init; then
|
||||
@@ -80,6 +86,9 @@ ventoy_get_debian_distro() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /opt/kerio ]; then
|
||||
echo 'kerio'; return
|
||||
fi
|
||||
|
||||
|
||||
echo 'default'
|
||||
|
@@ -49,7 +49,12 @@ done
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
vtlog "ln -s /dev/$vtDM $1"
|
||||
|
||||
if [ -e "$1" ]; then
|
||||
vtlog "$1 already exist"
|
||||
else
|
||||
ln -s /dev/$vtDM "$1"
|
||||
fi
|
||||
else
|
||||
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
|
||||
vtlog "vtLABEL is $vtLABEL"
|
||||
|
91
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
Normal file
91
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/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 [ -f $VTOY_PATH/autoinstall ]; then
|
||||
VTKS="inst.ks=file:$VTOY_PATH/autoinstall"
|
||||
else
|
||||
for vtParam in $($CAT /proc/cmdline); do
|
||||
if echo $vtParam | $GREP -q 'inst.ks=hd:LABEL='; then
|
||||
vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}')
|
||||
VTKS="inst.ks=hd:/dev/dm-0:$vtRawKs"
|
||||
break
|
||||
fi
|
||||
|
||||
if echo $vtParam | $GREP -q '^ks=.*:/'; then
|
||||
vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}')
|
||||
VTKS="ks=hd:/dev/dm-0:$vtRawKs"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
VTOVERLAY="rd.live.overlay=/dev/dm-1:/vtoyoverlayfs/overlayfs"
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/openEuler/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
#close selinux
|
||||
$BUSYBOX_PATH/mkdir -p $VTOY_PATH/selinuxfs
|
||||
if $BUSYBOX_PATH/mount -t selinuxfs selinuxfs $VTOY_PATH/selinuxfs; then
|
||||
echo 1 > $VTOY_PATH/selinuxfs/disable
|
||||
$BUSYBOX_PATH/umount $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
$BUSYBOX_PATH/rm -rf $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
|
||||
|
||||
echo "VTKS=$VTKS VTOVERLAY=$VTOVERLAY" >> $VTLOG
|
||||
|
||||
if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
|
||||
vtInstDD="$vtInstDD inst.dd=file:$vtDud"
|
||||
done
|
||||
fi
|
||||
echo "vtInstDD=$vtInstDD" >> $VTLOG
|
||||
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
|
||||
ventoy_set_inotify_script openEuler/ventoy-inotifyd-hook.sh
|
||||
|
||||
#Fedora
|
||||
if $BUSYBOX_PATH/which dmsquash-live-root > /dev/null; then
|
||||
vtPriority=99
|
||||
else
|
||||
vtPriority=01
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
|
||||
|
||||
if [ -f /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/openEuler/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
# suppress write protected mount warning
|
||||
if [ -f /usr/sbin/anaconda-diskroot ]; then
|
||||
$SED 's/^mount $dev $repodir/mount -oro $dev $repodir/' -i /usr/sbin/anaconda-diskroot
|
||||
fi
|
||||
|
58
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
Normal file
58
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/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
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
if is_inotify_ventoy_part $3; then
|
||||
|
||||
vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
|
||||
|
||||
vtlog "find ventoy partition ..."
|
||||
|
||||
#vtReplaceOpt=noreplace
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3
|
||||
|
||||
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
|
||||
if [ "$vtDM" = "dm-0" ]; then
|
||||
vtlog "This is dm-0, OK ..."
|
||||
else
|
||||
vtlog "####### This is $vtDM ####### this is abnormal ..."
|
||||
ventoy_swap_device /dev/dm-0 /dev/$vtDM
|
||||
fi
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot ..."
|
||||
/sbin/anaconda-diskroot /dev/dm-0
|
||||
fi
|
||||
|
||||
set_ventoy_hook_finish
|
||||
else
|
||||
vtlog "##### INOTIFYD: $2/$3 is created (NO) ..."
|
||||
fi
|
||||
|
||||
PATH=$VTPATH_OLD
|
31
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-start.sh
Normal file
31
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-start.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
||||
|
||||
vtHook=$($CAT $VTOY_PATH/inotifyd-hook-script.txt)
|
||||
|
||||
vtdisk=$(get_ventoy_disk_name)
|
||||
if [ "$vtdisk" = "unknown" ]; then
|
||||
vtlog "... start inotifyd listen $vtHook ..."
|
||||
$BUSYBOX_PATH/nohup $VTOY_PATH/tool/inotifyd $vtHook /dev:n 2>&- &
|
||||
else
|
||||
vtlog "... $vtdisk already exist ..."
|
||||
$BUSYBOX_PATH/sh $vtHook n /dev "${vtdisk#/dev/}2"
|
||||
fi
|
35
IMG/cpio/ventoy/hook/openEuler/ventoy-make-link.sh
Normal file
35
IMG/cpio/ventoy/hook/openEuler/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
|
21
IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh
Normal file
21
IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
[ -d /run/initramfs/overlayfs$pathspec ] || mkdir -p /run/initramfs/overlayfs$pathspec
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ] || mkdir -p /run/initramfs/overlayfs$pathspec/../ovlwork
|
29
IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh
Normal file
29
IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "##### $0 $* ..."
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
repodev=$(ls $VTOY_PATH/dev_backup*)
|
||||
echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline
|
||||
|
||||
PATH=$VTPATH_OLD
|
34
IMG/cpio/ventoy/hook/openEuler/ventoy-timeout.sh
Normal file
34
IMG/cpio/ventoy/hook/openEuler/ventoy-timeout.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "##### $0 $* ..."
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
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})
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot ..."
|
||||
/sbin/anaconda-diskroot /dev/dm-0
|
||||
fi
|
||||
|
||||
PATH=$VTPATH_OLD
|
@@ -26,3 +26,13 @@ ventoy_add_udev_rule "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
|
||||
|
||||
#loop7 was used by loader
|
||||
ventoy_add_kernel_udev_rule "loop6" "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
|
||||
|
||||
if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
$BUSYBOX_PATH/mv /sbin/loader /sbin/loader_bk
|
||||
$BUSYBOX_PATH/mv $VTOY_PATH/tool/loader /sbin/loader
|
||||
|
||||
RawCmdLine=$($BUSYBOX_PATH/cat /proc/cmdline)
|
||||
echo -n "/sbin/loader_bk" > "/ventoy/loader_exec_file"
|
||||
echo -n "--cmdline=$RawCmdLine ks=file:$VTOY_PATH/autoinstall" > "/ventoy/loader_exec_cmdline"
|
||||
#echo 111 > "/ventoy/loader_debug"
|
||||
fi
|
||||
|
@@ -40,7 +40,26 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
echo "VTKS=$VTKS" >> $VTLOG
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
VTOVERLAY="rd.live.overlay=/dev/dm-1:/vtoyoverlayfs/overlayfs"
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/rhel7/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
$SED "s/osmin.img/osmin.imgxxxx/g" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
#close selinux
|
||||
$BUSYBOX_PATH/mkdir -p $VTOY_PATH/selinuxfs
|
||||
if $BUSYBOX_PATH/mount -t selinuxfs selinuxfs $VTOY_PATH/selinuxfs; then
|
||||
echo 1 > $VTOY_PATH/selinuxfs/disable
|
||||
$BUSYBOX_PATH/umount $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
$BUSYBOX_PATH/rm -rf $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
|
||||
|
||||
echo "VTKS=$VTKS VTOVERLAY=$VTOVERLAY" >> $VTLOG
|
||||
|
||||
if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
|
||||
@@ -50,9 +69,9 @@ fi
|
||||
echo "vtInstDD=$vtInstDD" >> $VTLOG
|
||||
|
||||
if $GREP -q 'root=live' /proc/cmdline; then
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
else
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
fi
|
||||
|
||||
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
|
||||
@@ -67,6 +86,20 @@ fi
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
|
||||
|
||||
vtNeedRepo=
|
||||
if [ -f /etc/system-release ]; then
|
||||
if $GREP -q 'RED OS' /etc/system-release; then
|
||||
vtNeedRepo="yes"
|
||||
fi
|
||||
fi
|
||||
if $GREP -q el8 /proc/version; then
|
||||
vtNeedRepo="yes"
|
||||
fi
|
||||
|
||||
if [ "$vtNeedRepo" = "yes" ]; then
|
||||
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
|
||||
fi
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
|
||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/rhel7/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
|
||||
|
@@ -41,13 +41,9 @@ if is_inotify_ventoy_part $3; then
|
||||
vtlog "find ventoy partition ..."
|
||||
|
||||
vtReplaceOpt=noreplace
|
||||
|
||||
if $GREP -q el8 /proc/version && [ -f /etc/system-release ]; then
|
||||
vtRhel8Ver=$($SED "s#.*8\.\([0-9]*\).*#\1#" /etc/system-release)
|
||||
if [ $vtRhel8Ver -ge 3 ]; then
|
||||
if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then
|
||||
vtReplaceOpt=""
|
||||
fi
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
|
||||
|
||||
|
21
IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh
Normal file
21
IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
[ -d /run/initramfs/overlayfs$pathspec ] || mkdir -p /run/initramfs/overlayfs$pathspec
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ] || mkdir -p /run/initramfs/overlayfs$pathspec/../ovlwork
|
29
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
Normal file
29
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "##### $0 $* ..."
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
repodev=$(ls $VTOY_PATH/dev_backup*)
|
||||
echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline
|
||||
|
||||
PATH=$VTPATH_OLD
|
@@ -45,6 +45,9 @@ echo -n $vtDM > /ventoy/vtDM
|
||||
ventoy_create_dev_ventoy_part
|
||||
mdev -s
|
||||
|
||||
mkdir /ventoy_rdroot
|
||||
mount /dev/ventoy2 /ventoy_rdroot
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
||||
|
@@ -19,12 +19,39 @@
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$BUSYBOX_PATH/mkdir /sys
|
||||
$BUSYBOX_PATH/mount -t proc proc /proc
|
||||
$BUSYBOX_PATH/mount -t sysfs sys /sys
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
$BUSYBOX_PATH/mdev -s
|
||||
wrt_insmod() {
|
||||
kbit=$1
|
||||
kv=$(uname -r)
|
||||
|
||||
#$BUSYBOX_PATH/sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
echo "insmod $kv $kbit" >> $VTOY_PATH/log
|
||||
|
||||
exec $BUSYBOX_PATH/sh
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dax.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dax.ko > /dev/null 2>&1
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dm-mod.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
mkdir /sys
|
||||
mount -t sysfs sys /sys
|
||||
mdev -s
|
||||
|
||||
|
||||
if [ -f /ventoy_openwrt.xz ]; then
|
||||
tar xf /ventoy_openwrt.xz -C /
|
||||
rm -f /ventoy_openwrt.xz
|
||||
fi
|
||||
|
||||
|
||||
if uname -m | egrep -q "amd64|x86_64"; then
|
||||
wrt_insmod 64
|
||||
else
|
||||
wrt_insmod generic
|
||||
if lsmod | grep -q 'dm-mod'; then
|
||||
echo "insmod generic failed" >> $VTOY_PATH/log
|
||||
else
|
||||
wrt_insmod legacy
|
||||
fi
|
||||
fi
|
||||
|
||||
sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
|
61
IMG/cpio/ventoy/loop/tails/ventoy-disk.sh
Normal file
61
IMG/cpio/ventoy/loop/tails/ventoy-disk.sh
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/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
|
||||
|
||||
modprobe dm-mod
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
ventoy_create_dev_ventoy_part
|
||||
|
||||
if [ -n "${FSUUID}" ]; then
|
||||
vtPartid=0
|
||||
MaxPart=$(cat /vtoy_dm_table|wc -l)
|
||||
|
||||
while [ $vtPartid -le $MaxPart ]; do
|
||||
if blkid /dev/dm-${vtPartid} | grep -q "${FSUUID}"; then
|
||||
ln -s ../../dm-${vtPartid} "/dev/disk/by-uuid/${FSUUID}"
|
||||
break
|
||||
fi
|
||||
vtPartid=$(expr $vtPartid + 1)
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
26
IMG/cpio/ventoy/loop/tails/ventoy-hook.sh
Normal file
26
IMG/cpio/ventoy/loop/tails/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
|
||||
|
||||
$SED "/^mount_premount$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/loop/tails/ventoy-disk.sh" -i /init
|
||||
|
||||
if [ -f /scripts/init-premount/partitioning ]; then
|
||||
$SED "1a exit 0" -i /scripts/init-premount/partitioning
|
||||
fi
|
@@ -151,6 +151,10 @@ ventoy_get_os_type() {
|
||||
echo 'debian'; return
|
||||
elif $GREP -q 'Solus' /etc/os-release; then
|
||||
echo 'rhel7'; return
|
||||
elif $GREP -q 'openEuler' /etc/os-release; then
|
||||
echo 'openEuler'; return
|
||||
elif $GREP -q 'fuyu' /etc/os-release; then
|
||||
echo 'openEuler'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -315,9 +319,15 @@ ventoy_get_os_type() {
|
||||
if [ -f /DISTRO_SPECS ]; then
|
||||
if $GREP -q '[Pp]uppy' /DISTRO_SPECS; then
|
||||
echo 'debian'; return
|
||||
elif $GREP -q 'veket' /DISTRO_SPECS; then
|
||||
echo 'debian'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/openEuler-release ]; then
|
||||
echo "openEuler"; return
|
||||
fi
|
||||
|
||||
echo "default"
|
||||
}
|
||||
|
||||
|
@@ -196,6 +196,10 @@ ventoy_get_os_type() {
|
||||
echo 'debian'; return
|
||||
elif $GREP -q 'Solus' /etc/os-release; then
|
||||
echo 'rhel7'; return
|
||||
elif $GREP -q 'openEuler' /etc/os-release; then
|
||||
echo 'openEuler'; return
|
||||
elif $GREP -q 'fuyu' /etc/os-release; then
|
||||
echo 'openEuler'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -360,9 +364,15 @@ ventoy_get_os_type() {
|
||||
if [ -f /DISTRO_SPECS ]; then
|
||||
if $GREP -q '[Pp]uppy' /DISTRO_SPECS; then
|
||||
echo 'debian'; return
|
||||
elif $GREP -q 'veket' /DISTRO_SPECS; then
|
||||
echo 'debian'; return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/openEuler-release ]; then
|
||||
echo "openEuler"; return
|
||||
fi
|
||||
|
||||
echo "default"
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -1,11 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
if echo "$*" | grep -q '[-]v'; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
print_usage() {
|
||||
echo 'Usage: VentoyWebDeepin.sh [ OPTION ]'
|
||||
echo ' OPTION: (optional)'
|
||||
echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)'
|
||||
echo ' -p PORT http server PORT (default is 24680)'
|
||||
echo ' -h print this help'
|
||||
echo ' -v print verbose info'
|
||||
echo ''
|
||||
}
|
||||
|
||||
@@ -15,7 +20,6 @@ print_err() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
get_user() {
|
||||
name=$(logname)
|
||||
if [ -n "$name" -a "$name" != "root" ]; then
|
||||
@@ -28,7 +32,6 @@ get_user() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
uid=$(id -u)
|
||||
if [ $uid -ne 0 ]; then
|
||||
exec sudo sh $0 $*
|
||||
@@ -70,6 +73,8 @@ while [ -n "$1" ]; do
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
elif [ "$1" = "-v" ]; then
|
||||
VERBOSE=1
|
||||
elif [ "$1" = "-H" ]; then
|
||||
shift
|
||||
if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
|
||||
@@ -97,96 +102,8 @@ if ps -ef | grep "V2DServer.*$HOST.*$PORT" | grep -q -v grep; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VUSER=$(get_user)
|
||||
|
||||
LOGFILE=log.txt
|
||||
if [ -e $LOGFILE ]; then
|
||||
chown $VUSER $LOGFILE
|
||||
if grep -q -i uos /etc/os-release; then
|
||||
. ./tool/WebUos.sh
|
||||
else
|
||||
su $VUSER -c "touch $LOGFILE"
|
||||
fi
|
||||
|
||||
#delete the log.txt if it's more than 8MB
|
||||
if [ -f $LOGFILE ]; then
|
||||
logsize=$(stat -c '%s' $LOGFILE)
|
||||
if [ $logsize -gt 8388608 ]; then
|
||||
rm -f $LOGFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -f ./tool/$TOOLDIR/V2DServer.xz ]; then
|
||||
xz -d ./tool/$TOOLDIR/V2DServer.xz
|
||||
chmod +x ./tool/$TOOLDIR/V2DServer
|
||||
fi
|
||||
|
||||
rm -rf ./*_VTMPDIR
|
||||
vtWebTmpDir=$(mktemp -d -p ./ --suffix=_VTMPDIR)
|
||||
chown $VUSER $vtWebTmpDir
|
||||
|
||||
|
||||
V2DServer "$HOST" "$PORT" &
|
||||
V2DPid=$!
|
||||
sleep 1
|
||||
|
||||
su $VUSER -c "browser --window-size=550,400 --app=\"http://${HOST}:${PORT}/index.html?chrome-app\" --user-data-dir=$vtWebTmpDir >> $LOGFILE 2>&1" &
|
||||
WebPid=$!
|
||||
|
||||
|
||||
vtoy_trap_exit() {
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
[ -d /proc/$WebPid ] && kill -9 $WebPid
|
||||
|
||||
while [ -n "1" ]; do
|
||||
curPid=$(ps -ef | grep -m1 "$vtWebTmpDir" | egrep -v '\sgrep\s' | awk '{print $2}')
|
||||
if [ -z "$curPid" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ -d /proc/$curPid ]; then
|
||||
kill -9 $curPid
|
||||
fi
|
||||
done
|
||||
|
||||
[ -d $vtWebTmpDir ] && rm -rf $vtWebTmpDir
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap vtoy_trap_exit HUP INT QUIT TSTP
|
||||
sleep 1
|
||||
|
||||
|
||||
vtVer=$(cat ventoy/version)
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
if [ "$LANG" = "zh_CN.UTF-8" ]; then
|
||||
echo " Ventoy Server $vtVer 已经启动 ..."
|
||||
else
|
||||
echo " Ventoy Server $vtVer is running ..."
|
||||
fi
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
echo "########### Press Ctrl + C to exit ###############"
|
||||
echo ""
|
||||
|
||||
wait $WebPid
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
|
||||
[ -d $vtWebTmpDir ] && rm -rf $vtWebTmpDir
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
. ./tool/WebDeepin.sh
|
||||
fi
|
||||
|
@@ -2,25 +2,29 @@
|
||||
|
||||
VTOY_PATH=$PWD/..
|
||||
|
||||
cilog() {
|
||||
datestr=$(date +"%Y/%m/%d %H:%M:%S")
|
||||
echo "$datestr $*"
|
||||
}
|
||||
|
||||
LOG=$VTOY_PATH/DOC/build.log
|
||||
[ -f $LOG ] && rm -f $LOG
|
||||
|
||||
cd $VTOY_PATH/DOC
|
||||
echo "prepare_env ..."
|
||||
cilog "prepare_env ..."
|
||||
sh prepare_env.sh
|
||||
|
||||
export PATH=$PATH:/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin:/opt/aarch64--uclibc--stable-2020.08-1/bin:/opt/mips-loongson-gcc7.3-linux-gnu/2019.06-29/bin/:/opt/mips64el-linux-musl-gcc730/bin/
|
||||
|
||||
|
||||
echo "build grub2 ..."
|
||||
cilog "build grub2 ..."
|
||||
cd $VTOY_PATH/GRUB2
|
||||
sh buildgrub.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo "build ipxe ..."
|
||||
cilog "build ipxe ..."
|
||||
cd $VTOY_PATH/IPXE
|
||||
sh buildipxe.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo "build edk2 ..."
|
||||
cilog "build edk2 ..."
|
||||
cd $VTOY_PATH/EDK2
|
||||
sh buildedk.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
@@ -74,7 +78,7 @@ if [ "$1" = "CI" ]; then
|
||||
sed "s/VENTOY_VERSION=.*/VENTOY_VERSION=\"$Ver\"/" -i ./grub/grub.cfg
|
||||
fi
|
||||
|
||||
echo "packing ventoy-$Ver ..."
|
||||
cilog "packing ventoy-$Ver ..."
|
||||
sh ventoy_pack.sh $1 >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo -e '\n============== SUCCESS ==================\n'
|
||||
|
@@ -2,12 +2,18 @@
|
||||
|
||||
VTOY_PATH=$PWD/..
|
||||
|
||||
wget -q -P $VTOY_PATH/DOC/ https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz
|
||||
wget -q -P $VTOY_PATH/DOC/ https://musl.libc.org/releases/musl-1.2.1.tar.gz
|
||||
wget -q -P $VTOY_PATH/GRUB2/ https://ftp.gnu.org/gnu/grub/grub-2.04.tar.xz
|
||||
date +"%Y/%m/%d %H:%M:%S"
|
||||
echo downloading envrionment ...
|
||||
|
||||
wget -q -P $VTOY_PATH/DOC/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/dietlibc-0.34.tar.xz
|
||||
wget -q -P $VTOY_PATH/DOC/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/musl-1.2.1.tar.gz
|
||||
wget -q -P $VTOY_PATH/GRUB2/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/grub-2.04.tar.xz
|
||||
wget -q -O $VTOY_PATH/EDK2/edk2-edk2-stable201911.zip https://codeload.github.com/tianocore/edk2/zip/edk2-stable201911
|
||||
wget -q -P /opt/ https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
|
||||
wget -q -P /opt/ https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--uclibc--stable-2020.08-1.tar.bz2
|
||||
wget -q -P /opt/ http://ftp.loongnix.org/toolchain/gcc/release/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/aarch64--uclibc--stable-2020.08-1.tar.bz2
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
|
||||
|
||||
date +"%Y/%m/%d %H:%M:%S"
|
||||
echo downloading envrionment finish...
|
||||
|
||||
sh all_in_one.sh CI
|
||||
|
@@ -32,6 +32,7 @@
|
||||
*save_env: loadenv
|
||||
*search: search
|
||||
*serial: serial
|
||||
*set_keyboard_layout: setkey
|
||||
*setkey: setkey
|
||||
*sha1sum: hashsum
|
||||
*sha256sum: hashsum
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
videotest: font video gfxmenu
|
||||
setkey: extcmd
|
||||
odc: archelp
|
||||
loopback: extcmd
|
||||
setkey: extcmd
|
||||
macho:
|
||||
gcry_des: crypto
|
||||
memrw: extcmd
|
||||
@@ -93,7 +93,7 @@ terminal:
|
||||
div:
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
source $prefix/keyboard.cfg.gz
|
||||
source $prefix/keyboard.cfg
|
||||
|
||||
submenu "Resolution Configuration" --class=debug_resolution {
|
||||
submenu "Resolution Configuration" --class=debug_resolution --class=F5tool {
|
||||
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
|
||||
echo 'Return ...'
|
||||
}
|
||||
@@ -16,7 +16,7 @@ submenu "Resolution Configuration" --class=debug_resolution {
|
||||
set vtActive="[*]"
|
||||
fi
|
||||
|
||||
menuentry "$vtCurMode $vtActive" --class=debug_videomode VTOY_RUN_RET {
|
||||
menuentry "$vtCurMode $vtActive" --class=debug_videomode --class=debug_resolution --class=F5tool VTOY_RUN_RET {
|
||||
terminal_output console
|
||||
set gfxmode=$1
|
||||
terminal_output gfxterm
|
||||
@@ -26,11 +26,11 @@ submenu "Resolution Configuration" --class=debug_resolution {
|
||||
done
|
||||
}
|
||||
|
||||
submenu "Screen Display Mode" --class=debug_screen_mode {
|
||||
menuentry 'Force Text Mode' --class=debug_text_mode {
|
||||
submenu "Screen Display Mode" --class=debug_screen_mode --class=F5tool {
|
||||
menuentry 'Force Text Mode' --class=debug_text_mode --class=debug_screen_mode --class=F5tool {
|
||||
terminal_output console
|
||||
}
|
||||
menuentry 'Force Graphics Mode' --class=debug_gui_mode {
|
||||
menuentry 'Force Graphics Mode' --class=debug_gui_mode --class=debug_screen_mode --class=F5tool {
|
||||
terminal_output gfxterm
|
||||
}
|
||||
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
|
||||
@@ -39,8 +39,8 @@ submenu "Screen Display Mode" --class=debug_screen_mode {
|
||||
}
|
||||
|
||||
if [ "$grub_platform" != "pc" ]; then
|
||||
submenu 'Ventoy UEFI Utilities' --class=debug_util {
|
||||
menuentry 'Fixup Windows BlinitializeLibrary Failure' --class=debug_util_blinit {
|
||||
submenu 'Ventoy UEFI Utilities' --class=debug_util --class=F5tool {
|
||||
menuentry 'Fixup Windows BlinitializeLibrary Failure' --class=debug_util_blinit --class=debug_util --class=F5tool {
|
||||
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=fix_windows_mmap
|
||||
boot
|
||||
echo -e "\npress ENTER to exit ..."
|
||||
@@ -54,8 +54,8 @@ if [ "$grub_platform" != "pc" ]; then
|
||||
fi
|
||||
|
||||
|
||||
submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
menuentry 'Check global control plugin configuration' --class=debug_control {
|
||||
submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --class=F5tool {
|
||||
menuentry 'Check global control plugin configuration' --class=debug_control --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path control $vtoy_iso_part
|
||||
|
||||
@@ -64,7 +64,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check theme plugin configuration' --class=debug_theme {
|
||||
menuentry 'Check theme plugin configuration' --class=debug_theme --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path theme $vtoy_iso_part
|
||||
|
||||
@@ -73,7 +73,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check auto install plugin configuration' --class=debug_autoinstall {
|
||||
menuentry 'Check auto install plugin configuration' --class=debug_autoinstall --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path auto_install $vtoy_iso_part
|
||||
|
||||
@@ -82,7 +82,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check persistence plugin configuration' --class=debug_persistence {
|
||||
menuentry 'Check persistence plugin configuration' --class=debug_persistence --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path persistence $vtoy_iso_part
|
||||
|
||||
@@ -94,7 +94,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check menu alias plugin configuration' --class=debug_menualias {
|
||||
menuentry 'Check menu alias plugin configuration' --class=debug_menualias --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path menu_alias $vtoy_iso_part
|
||||
|
||||
@@ -103,7 +103,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check menu class plugin configuration' --class=debug_menuclass {
|
||||
menuentry 'Check menu class plugin configuration' --class=debug_menuclass --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path menu_class $vtoy_iso_part
|
||||
|
||||
@@ -112,7 +112,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check injection plugin configuration' --class=debug_injection {
|
||||
menuentry 'Check injection plugin configuration' --class=debug_injection --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
|
||||
|
||||
@@ -121,7 +121,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check auto memdisk plugin configuration' --class=debug_automemdisk {
|
||||
menuentry 'Check auto memdisk plugin configuration' --class=debug_automemdisk --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path auto_memdisk $vtoy_iso_part
|
||||
|
||||
@@ -130,7 +130,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check image list plugin configuration' --class=debug_imagelist {
|
||||
menuentry 'Check image list plugin configuration' --class=debug_imagelist --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path image_list $vtoy_iso_part
|
||||
|
||||
@@ -139,7 +139,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check image blacklist plugin configuration' --class=debug_imageblacklist {
|
||||
menuentry 'Check image blacklist plugin configuration' --class=debug_imageblacklist --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path image_blacklist $vtoy_iso_part
|
||||
|
||||
@@ -148,7 +148,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check boot conf replace plugin configuration' --class=debug_bootconf_replace {
|
||||
menuentry 'Check boot conf replace plugin configuration' --class=debug_bootconf_replace --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path conf_replace $vtoy_iso_part
|
||||
|
||||
@@ -157,7 +157,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check dud plugin configuration' --class=debug_dud {
|
||||
menuentry 'Check dud plugin configuration' --class=debug_dud --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path dud $vtoy_iso_part
|
||||
|
||||
@@ -166,7 +166,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check password plugin configuration' --class=debug_pwd {
|
||||
menuentry 'Check password plugin configuration' --class=debug_pwd --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path password $vtoy_iso_part
|
||||
|
||||
@@ -175,7 +175,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
|
||||
unset pager
|
||||
}
|
||||
|
||||
menuentry 'Check custom boot plugin configuration' --class=debug_custom_boot {
|
||||
menuentry 'Check custom boot plugin configuration' --class=debug_custom_boot --class=debug_json --class=F5tool {
|
||||
set pager=1
|
||||
vt_check_plugin_json $vt_plugin_path custom_boot $vtoy_iso_part
|
||||
|
||||
|
@@ -311,18 +311,15 @@ function distro_specify_initrd_file_phase2 {
|
||||
vt_linux_specify_initrd_file /antiX/initrd.gz
|
||||
elif [ -f (loop)/360Disk/initrd.gz ]; then
|
||||
vt_linux_specify_initrd_file /360Disk/initrd.gz
|
||||
elif [ -f (loop)/porteus/initrd.xz ]; then
|
||||
vt_linux_specify_initrd_file /porteus/initrd.xz
|
||||
|
||||
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
|
||||
# fallback to parse version from elf /boot/kernel/kernel
|
||||
set vt_freebsd_ver=xx
|
||||
}
|
||||
|
||||
function ventoy_get_furybsd_ver {
|
||||
@@ -364,11 +361,18 @@ function ventoy_get_truenas_ver {
|
||||
}
|
||||
|
||||
function ventoy_get_midnightbsd_ver {
|
||||
if vt_str_begin "$vt_volume_id" "1_"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif vt_str_begin "$vt_volume_id" "2_"; then
|
||||
set vt_freebsd_ver=2.x
|
||||
elif vt_str_begin "$vt_volume_id" "3_"; then
|
||||
set vt_freebsd_ver=3.x
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
set vtFreeBsdDistro=FreeBSD
|
||||
set vt_freebsd_ver=xx
|
||||
|
||||
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
|
||||
ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
|
||||
@@ -419,8 +423,11 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
elif vt_strstr "${chosen_path}" "MidnightBSD"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
else
|
||||
set vt_freebsd_ver=12.x
|
||||
fi
|
||||
|
||||
|
||||
if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
|
||||
set vtFreeBsdDistro=ClonOS
|
||||
fi
|
||||
|
||||
set vt_freebsd_bit=64
|
||||
@@ -433,8 +440,18 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
if [ -e (loop)/boot/kernel/kernel ]; then
|
||||
vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
|
||||
fi
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
set vt_freebsd_ver=13.x
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
unset vt_unix_mod_path
|
||||
@@ -445,10 +462,6 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
|
||||
set vtFreeBsdDistro=ClonOS
|
||||
fi
|
||||
|
||||
vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
|
||||
vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
|
||||
}
|
||||
@@ -647,10 +660,14 @@ function uefi_linux_menu_func {
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
if vt_check_mode 3; then
|
||||
ventoy_debug_pause
|
||||
else
|
||||
if [ "$VTOY_EFI_ARCH" != "mips" ]; then
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi fallback env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
fi
|
||||
fi
|
||||
|
||||
# fallback
|
||||
set vtback_root=$root
|
||||
@@ -885,9 +902,39 @@ function legacy_linux_menu_func {
|
||||
ventoy_debug_pause
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
if vt_check_mode 3; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
# fallback
|
||||
set vtback_root=$root
|
||||
vt_push_last_entry
|
||||
set vtback_theme=$theme
|
||||
unset theme
|
||||
|
||||
vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy
|
||||
|
||||
set root=(loop)
|
||||
set vtback_cfg_find=0
|
||||
for cfg in "/boot/grub/grub.cfg" "/EFI/BOOT/grub.cfg" "/EFI/debian/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "/grub/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||
if [ -e "$cfg" ]; then
|
||||
set vtback_cfg_find=1
|
||||
configfile "$cfg"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unset_boot_opt
|
||||
set root=$vtback_root
|
||||
set theme=$vtback_theme
|
||||
vt_pop_last_entry
|
||||
ventoy_gui_console
|
||||
else
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
fi
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
@@ -1030,7 +1077,7 @@ function iso_common_menuentry {
|
||||
vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
|
||||
if [ $vt_volume_space -ne $vt_chosen_size ]; then
|
||||
vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
|
||||
if [ $vt_volume_space -gt $vt_chosen_size -o $vt_chosen_size_mod -ne 0 ]; then
|
||||
if [ $vt_chosen_size_mod -ne 0 ]; then
|
||||
echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
|
||||
echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
|
||||
echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
|
||||
@@ -1183,6 +1230,30 @@ function efi_unsupport_menuentry {
|
||||
common_unsupport_menuentry
|
||||
}
|
||||
|
||||
function vhdboot_common_func {
|
||||
vt_patch_vhdboot "$1"
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
if [ -n "$vtoy_vhd_buf_addr" ]; then
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
ventoy_cli_console
|
||||
linux16 $vtoy_path/memdisk iso raw
|
||||
initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
|
||||
boot
|
||||
ventoy_gui_console
|
||||
else
|
||||
ventoy_cli_console
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
|
||||
boot
|
||||
ventoy_gui_console
|
||||
fi
|
||||
else
|
||||
echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
|
||||
ventoy_pause
|
||||
fi
|
||||
}
|
||||
|
||||
function vhd_common_menuentry {
|
||||
|
||||
if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
|
||||
@@ -1205,25 +1276,7 @@ function vhd_common_menuentry {
|
||||
return
|
||||
fi
|
||||
|
||||
vt_patch_vhdboot "$vt_chosen_path"
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
if [ -n "$vtoy_vhd_buf_addr" ]; then
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
linux16 $vtoy_path/memdisk iso raw
|
||||
initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
|
||||
boot
|
||||
else
|
||||
ventoy_cli_console
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
|
||||
boot
|
||||
ventoy_gui_console
|
||||
fi
|
||||
else
|
||||
echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
|
||||
ventoy_pause
|
||||
fi
|
||||
vhdboot_common_func "${vt_chosen_path}"
|
||||
}
|
||||
|
||||
function vhd_unsupport_menuentry {
|
||||
@@ -1480,6 +1533,68 @@ function ventoy_img_batocera {
|
||||
vt_unset_boot_opt
|
||||
}
|
||||
|
||||
function ventoy_img_openwrt {
|
||||
if [ -e (vtimghd,2)/lib64 ]; then
|
||||
set ventoy_busybox_ver=64
|
||||
fi
|
||||
|
||||
if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
|
||||
ventoy_gui_console
|
||||
echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
|
||||
echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
|
||||
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
|
||||
read vtInputKey
|
||||
ventoy_cli_console
|
||||
return
|
||||
fi
|
||||
|
||||
if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
|
||||
ventoy_debug_pause
|
||||
else
|
||||
ventoy_gui_console
|
||||
echo -e "\n IMG file need processed. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
|
||||
echo -e " 此 IMG 文件必须处理之后才能支持。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
|
||||
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
|
||||
read vtInputKey
|
||||
ventoy_cli_console
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
|
||||
|
||||
vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
|
||||
|
||||
|
||||
#boot image file
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
|
||||
vt_img_hook_root
|
||||
|
||||
set root=(vtimghd,1)
|
||||
configfile (vtimghd,1)/boot/grub/grub.cfg
|
||||
|
||||
vt_img_unhook_root
|
||||
vt_unset_boot_opt
|
||||
}
|
||||
|
||||
function ventoy_img_tails {
|
||||
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
#boot image file
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy live-media=/dev/dm-1 ventoyos=tails
|
||||
vt_img_hook_root
|
||||
|
||||
set root=(vtimghd,1)
|
||||
configfile (vtimghd,1)/efi/debian/grub.cfg
|
||||
|
||||
vt_img_unhook_root
|
||||
vt_unset_boot_opt
|
||||
}
|
||||
|
||||
function ventoy_img_memtest86 {
|
||||
chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
|
||||
boot
|
||||
@@ -1518,9 +1633,12 @@ function img_common_menuentry {
|
||||
set vtback_root=$root
|
||||
ventoy_cli_console
|
||||
vt_push_last_entry
|
||||
set vtback_theme=$theme
|
||||
unset theme
|
||||
|
||||
vt_img_extra_initrd_reset
|
||||
|
||||
|
||||
vt_get_fs_label (vtimghd,1) vtImgHd1Label
|
||||
if [ -d (vtimghd,2)/lib ]; then
|
||||
vt_get_fs_label (vtimghd,2) vtImgHd2Label
|
||||
@@ -1530,6 +1648,7 @@ function img_common_menuentry {
|
||||
vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
|
||||
fi
|
||||
|
||||
|
||||
if [ -e (vtimghd,1)/easy.sfs ]; then
|
||||
ventoy_img_easyos
|
||||
elif [ -e (vtimghd,1)/volumio.initrd ]; then
|
||||
@@ -1544,10 +1663,14 @@ function img_common_menuentry {
|
||||
ventoy_img_freedombox
|
||||
elif vt_str_begin "$vtImgHd1Label" "BATOCERA"; then
|
||||
ventoy_img_batocera
|
||||
elif vt_str_begin "$vtImgHd1Label" "Tails"; then
|
||||
ventoy_img_tails
|
||||
elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
|
||||
ventoy_img_recalbox
|
||||
elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
|
||||
ventoy_img_ubos
|
||||
elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
|
||||
ventoy_img_openwrt
|
||||
elif [ -f (vtimghd,1)/efi/boot/mt86.png ]; then
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
img_unsupport_tip
|
||||
@@ -1568,6 +1691,7 @@ function img_common_menuentry {
|
||||
|
||||
set root=$vtback_root
|
||||
vt_pop_last_entry
|
||||
set theme=$vtback_theme
|
||||
ventoy_gui_console
|
||||
set ventoy_compatible=NO
|
||||
}
|
||||
@@ -1584,7 +1708,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.37"
|
||||
set VENTOY_VERSION="1.0.43"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -1596,6 +1720,7 @@ set VTOY_DEFAULT_MENU_MODE=0
|
||||
|
||||
set VTOY_MEM_DISK_STR="[Memdisk]"
|
||||
set VTOY_ISO_RAW_STR="Compatible Mode"
|
||||
set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
|
||||
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
|
||||
|
||||
set VTOY_F2_CMD="ventoy_power"
|
||||
@@ -1725,6 +1850,9 @@ else
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
|
||||
if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
|
||||
set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
|
||||
fi
|
||||
|
||||
if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
|
||||
clear
|
||||
@@ -1744,6 +1872,8 @@ for vtTFile in ventoy.json ventoy_grub.cfg; do
|
||||
fi
|
||||
done
|
||||
|
||||
#clear all input key before show main menu
|
||||
vt_clear_key
|
||||
|
||||
#export necessary variable
|
||||
export theme
|
||||
@@ -1752,6 +1882,7 @@ export gfxpayload
|
||||
export vtoydev
|
||||
export vtoy_path
|
||||
export vtdebug_flag
|
||||
export vtoy_iso_fs
|
||||
export vtoy_iso_part
|
||||
export vtoy_efi_part
|
||||
export VENTOY_VERSION
|
||||
|
@@ -43,6 +43,7 @@
|
||||
*save_env: loadenv
|
||||
*search: search
|
||||
*serial: serial
|
||||
*set_keyboard_layout: setkey
|
||||
*setkey: setkey
|
||||
*setpci: setpci
|
||||
*sha1sum: hashsum
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
videotest: font video gfxmenu
|
||||
setkey: extcmd
|
||||
odc: archelp
|
||||
loopback: extcmd
|
||||
setkey: extcmd
|
||||
macho:
|
||||
gcry_des: crypto
|
||||
memrw: extcmd
|
||||
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -47,6 +47,7 @@
|
||||
*search: search
|
||||
*sendkey: sendkey
|
||||
*serial: serial
|
||||
*set_keyboard_layout: setkey
|
||||
*setkey: setkey
|
||||
*setpci: setpci
|
||||
*sha1sum: hashsum
|
||||
|
@@ -1,7 +1,7 @@
|
||||
videotest: font video gfxmenu
|
||||
setkey: extcmd
|
||||
odc: archelp
|
||||
loopback: extcmd
|
||||
setkey: extcmd
|
||||
macho:
|
||||
gcry_des: crypto
|
||||
memrw: extcmd
|
||||
@@ -123,7 +123,7 @@ crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536: pci
|
||||
biosdisk:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
|
||||
lsapm:
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
|
62
INSTALL/grub/keyboard.cfg
Normal file
62
INSTALL/grub/keyboard.cfg
Normal file
@@ -0,0 +1,62 @@
|
||||
submenu "Keyboard Layouts" --class=debug_krdlayout --class=F5tool {
|
||||
menuentry QWERTY_USA --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout QWERTY_USA
|
||||
}
|
||||
menuentry AZERTY --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout AZERTY
|
||||
}
|
||||
menuentry CZECH_QWERTY --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout CZECH_QWERTY
|
||||
}
|
||||
menuentry CZECH_QWERTZ --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout CZECH_QWERTZ
|
||||
}
|
||||
menuentry DANISH --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout DANISH
|
||||
}
|
||||
menuentry DVORAK_USA --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout DVORAK_USA
|
||||
}
|
||||
menuentry FRENCH --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout FRENCH
|
||||
}
|
||||
menuentry GERMAN --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout GERMAN
|
||||
}
|
||||
menuentry ITALIANO --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout ITALIANO
|
||||
}
|
||||
menuentry JAPAN_106 --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout JAPAN_106
|
||||
}
|
||||
menuentry LATIN_USA --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout LATIN_USA
|
||||
}
|
||||
menuentry PORTU_BRAZIL --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout PORTU_BRAZIL
|
||||
}
|
||||
menuentry QWERTY_UK --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout QWERTY_UK
|
||||
}
|
||||
menuentry QWERTZ --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout QWERTZ
|
||||
}
|
||||
menuentry QWERTZ_HUN --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout QWERTZ_HUN
|
||||
}
|
||||
menuentry QWERTZ_SLOV_CROAT --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout QWERTZ_SLOV_CROAT
|
||||
}
|
||||
menuentry SPANISH --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout SPANISH
|
||||
}
|
||||
menuentry SWEDISH --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout SWEDISH
|
||||
}
|
||||
menuentry TURKISH_Q --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout TURKISH_Q
|
||||
}
|
||||
menuentry VIETNAMESE --class=debug_kbd --class=debug_krdlayout --class=F5tool {
|
||||
set_keyboard_layout VIETNAMESE
|
||||
}
|
||||
}
|
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
menuentry 'Search and boot Windows' --class=boot_windows {
|
||||
menuentry 'Search and boot Windows' --class=boot_windows --class=F4boot {
|
||||
|
||||
set partid=3
|
||||
while [ $partid -le 128 ]; do
|
||||
@@ -38,7 +38,7 @@ if [ "$grub_platform" = "pc" ]; then
|
||||
fi
|
||||
}
|
||||
|
||||
menuentry 'Search and boot Grub4dos' --class=boot_g4d {
|
||||
menuentry 'Search and boot Grub4dos' --class=boot_g4d --class=F4boot {
|
||||
if search -n -s -f /grldr; then
|
||||
ntldr /grldr
|
||||
else
|
||||
@@ -46,19 +46,19 @@ if [ "$grub_platform" = "pc" ]; then
|
||||
fi
|
||||
}
|
||||
|
||||
menuentry 'Boot the 1st local disk' --class=boot_disk {
|
||||
menuentry 'Boot the 1st local disk' --class=boot_disk --class=F4boot {
|
||||
set root=(hd0,1)
|
||||
chainloader +1
|
||||
boot
|
||||
}
|
||||
|
||||
menuentry 'Boot the 2nd local disk' --class=boot_disk {
|
||||
menuentry 'Boot the 2nd local disk' --class=boot_disk --class=F4boot {
|
||||
set root=(hd1,1)
|
||||
chainloader +1
|
||||
boot
|
||||
}
|
||||
|
||||
menuentry 'Boot the 3rd local disk' --class=boot_disk {
|
||||
menuentry 'Boot the 3rd local disk' --class=boot_disk --class=F4boot {
|
||||
set root=(hd2,1)
|
||||
chainloader +1
|
||||
boot
|
||||
@@ -66,7 +66,7 @@ if [ "$grub_platform" = "pc" ]; then
|
||||
|
||||
else
|
||||
|
||||
menuentry 'Search and boot Windows' --class=boot_windows {
|
||||
menuentry 'Search and boot Windows' --class=boot_windows --class=F4boot {
|
||||
|
||||
set partid=3
|
||||
while [ $partid -le 128 ]; do
|
||||
@@ -93,7 +93,7 @@ else
|
||||
}
|
||||
|
||||
if [ "$grub_cpu" = "i386" ]; then
|
||||
menuentry 'Search and boot BOOTIA32.EFI' --class=boot_uefi {
|
||||
menuentry 'Search and boot BOOTIA32.EFI' --class=boot_uefi --class=F4boot {
|
||||
set VTOY_SEARCH_NO_VTOYEFI=1
|
||||
if search -n -s -f /efi/boot/bootia32.efi; then
|
||||
unset VTOY_SEARCH_NO_VTOYEFI
|
||||
@@ -106,7 +106,7 @@ else
|
||||
fi
|
||||
}
|
||||
elif [ "$grub_cpu" = "arm64" ]; then
|
||||
menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi {
|
||||
menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi --class=F4boot {
|
||||
set VTOY_SEARCH_NO_VTOYEFI=1
|
||||
if search -n -s -f /efi/boot/bootaa64.efi; then
|
||||
unset VTOY_SEARCH_NO_VTOYEFI
|
||||
@@ -119,7 +119,7 @@ else
|
||||
fi
|
||||
}
|
||||
else
|
||||
menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi {
|
||||
menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi --class=F4boot {
|
||||
set VTOY_SEARCH_NO_VTOYEFI=1
|
||||
if search -n -s -f /efi/boot/bootx64.efi; then
|
||||
unset VTOY_SEARCH_NO_VTOYEFI
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -70,6 +70,14 @@ terminal-box: "terminal_box_*.png"
|
||||
}
|
||||
|
||||
|
||||
+ hbox{
|
||||
left = 30%+200
|
||||
top = 95%-50
|
||||
width = 10%
|
||||
height = 25
|
||||
+ label {text = "@VTOY_GRUB2_MODE@" color = "red" align = "left"}
|
||||
}
|
||||
|
||||
+ hbox{
|
||||
left = 90%
|
||||
top = 55
|
||||
|
@@ -43,6 +43,7 @@
|
||||
*save_env: loadenv
|
||||
*search: search
|
||||
*serial: serial
|
||||
*set_keyboard_layout: setkey
|
||||
*setkey: setkey
|
||||
*setpci: setpci
|
||||
*sha1sum: hashsum
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
videotest: font video gfxmenu
|
||||
setkey: extcmd
|
||||
odc: archelp
|
||||
loopback: extcmd
|
||||
setkey: extcmd
|
||||
macho:
|
||||
gcry_des: crypto
|
||||
memrw: extcmd
|
||||
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536:
|
||||
ventoy: ext2 fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
ventoy: elf fshelp ext2 btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
@@ -365,12 +365,16 @@ else
|
||||
|
||||
oldver=$(get_disk_ventoy_version $DISK)
|
||||
if [ $? -ne 0 ]; then
|
||||
if is_disk_contains_ventoy $DISK; then
|
||||
oldver="Unknown"
|
||||
else
|
||||
vtwarn "$DISK does not contain Ventoy or data corrupted"
|
||||
echo ""
|
||||
vtwarn "Please use -i option if you want to install ventoy to $DISK"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#reserve secure boot option
|
||||
if [ -z "$SECUREBOOT" ]; then
|
||||
|
95
INSTALL/tool/WebDeepin.sh
Normal file
95
INSTALL/tool/WebDeepin.sh
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
|
||||
LOGFILE=log.txt
|
||||
VUSER=$(get_user)
|
||||
|
||||
if [ -e $LOGFILE ]; then
|
||||
chown $VUSER $LOGFILE
|
||||
else
|
||||
su $VUSER -c "touch $LOGFILE"
|
||||
fi
|
||||
|
||||
#delete the log.txt if it's more than 8MB
|
||||
if [ -f $LOGFILE ]; then
|
||||
logsize=$(stat -c '%s' $LOGFILE)
|
||||
if [ $logsize -gt 8388608 ]; then
|
||||
rm -f $LOGFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -f ./tool/$TOOLDIR/V2DServer.xz ]; then
|
||||
xz -d ./tool/$TOOLDIR/V2DServer.xz
|
||||
chmod +x ./tool/$TOOLDIR/V2DServer
|
||||
fi
|
||||
|
||||
rm -rf ./*_VTMPDIR
|
||||
vtWebTmpDir=$(mktemp -d -p ./ --suffix=_VTMPDIR)
|
||||
chown $VUSER $vtWebTmpDir
|
||||
|
||||
|
||||
V2DServer "$HOST" "$PORT" &
|
||||
V2DPid=$!
|
||||
sleep 1
|
||||
|
||||
su $VUSER -c "browser --window-size=550,400 --app=\"http://${HOST}:${PORT}/index.html?chrome-app\" --user-data-dir=$vtWebTmpDir >> $LOGFILE 2>&1" &
|
||||
WebPid=$!
|
||||
|
||||
|
||||
vtoy_trap_exit() {
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
[ -d /proc/$WebPid ] && kill -9 $WebPid
|
||||
|
||||
while [ -n "1" ]; do
|
||||
curPid=$(ps -ef | grep -m1 "$vtWebTmpDir" | egrep -v '\sgrep\s' | awk '{print $2}')
|
||||
if [ -z "$curPid" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ -d /proc/$curPid ]; then
|
||||
kill -9 $curPid
|
||||
fi
|
||||
done
|
||||
|
||||
[ -d $vtWebTmpDir ] && rm -rf $vtWebTmpDir
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap vtoy_trap_exit HUP INT QUIT TSTP
|
||||
sleep 1
|
||||
|
||||
|
||||
vtVer=$(cat ventoy/version)
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
if [ "$LANG" = "zh_CN.UTF-8" ]; then
|
||||
echo " Ventoy Server $vtVer 已经启动 ..."
|
||||
else
|
||||
echo " Ventoy Server $vtVer is running ..."
|
||||
fi
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
echo "########### Press Ctrl + C to exit ###############"
|
||||
echo ""
|
||||
|
||||
wait $WebPid
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
|
||||
[ -d $vtWebTmpDir ] && rm -rf $vtWebTmpDir
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
fi
|
68
INSTALL/tool/WebUos.sh
Normal file
68
INSTALL/tool/WebUos.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
|
||||
LOGFILE=log.txt
|
||||
|
||||
#delete the log.txt if it's more than 8MB
|
||||
if [ -f $LOGFILE ]; then
|
||||
logsize=$(stat -c '%s' $LOGFILE)
|
||||
if [ $logsize -gt 8388608 ]; then
|
||||
rm -f $LOGFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -f ./tool/$TOOLDIR/V2DServer.xz ]; then
|
||||
xz -d ./tool/$TOOLDIR/V2DServer.xz
|
||||
chmod +x ./tool/$TOOLDIR/V2DServer
|
||||
fi
|
||||
|
||||
V2DServer "$HOST" "$PORT" &
|
||||
V2DPid=$!
|
||||
sleep 1
|
||||
|
||||
|
||||
vtoy_trap_exit() {
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap vtoy_trap_exit HUP INT QUIT TSTP
|
||||
sleep 1
|
||||
|
||||
|
||||
vtVer=$(cat ventoy/version)
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
if [ "$LANG" = "zh_CN.UTF-8" ]; then
|
||||
echo " Ventoy Server $vtVer 已经启动 ..."
|
||||
else
|
||||
echo " Ventoy Server $vtVer is running ..."
|
||||
fi
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
echo "########### Press Ctrl + C to exit ###############"
|
||||
echo ""
|
||||
|
||||
if [ "$VERBOSE" = "1" ]; then
|
||||
uos-browser --window-size=550,400 --app="http://${HOST}:${PORT}/index.html?chrome-app"
|
||||
else
|
||||
uos-browser --window-size=550,400 --app="http://${HOST}:${PORT}/index.html?chrome-app" > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
[ -d /proc/$V2DPid ] && kill -2 $V2DPid
|
||||
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
CURDIR=$(pwd)
|
||||
if [ "$CURDIR" != "$OLDDIR" ]; then
|
||||
cd "$OLDDIR"
|
||||
fi
|
||||
fi
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,6 +8,8 @@ fi
|
||||
|
||||
dos2unix -q ./tool/ventoy_lib.sh
|
||||
dos2unix -q ./tool/VentoyWorker.sh
|
||||
dos2unix -q ./tool/WebDeepin.sh
|
||||
dos2unix -q ./tool/WebUos.sh
|
||||
|
||||
. ./tool/ventoy_lib.sh
|
||||
|
||||
@@ -25,6 +27,10 @@ sh mkcpio.sh
|
||||
sh mkloopex.sh
|
||||
cd -
|
||||
|
||||
cd ../Unix
|
||||
sh pack_unix.sh
|
||||
cd -
|
||||
|
||||
cd ../LinuxGUI
|
||||
sh language.sh || exit 1
|
||||
sh build.sh
|
||||
@@ -76,6 +82,7 @@ cp $OPT ./tool/i386/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_i386
|
||||
cp $OPT ./tool/x86_64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_x86_64
|
||||
cp $OPT ./tool/aarch64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_aarch64
|
||||
|
||||
|
||||
rm -f $tmpmnt/grub/i386-pc/*.img
|
||||
|
||||
|
||||
@@ -144,7 +151,7 @@ tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
|
||||
|
||||
rm -f ventoy-${curver}-windows.zip
|
||||
cp $OPT Ventoy2Disk*.exe $tmpdir/
|
||||
cp $OPT $LANG_DIR/languages.ini $tmpdir/ventoy/
|
||||
cp $OPT $LANG_DIR/languages.json $tmpdir/ventoy/
|
||||
rm -rf $tmpdir/tool
|
||||
rm -f $tmpdir/*.sh
|
||||
rm -rf $tmpdir/WebUI
|
||||
|
@@ -386,6 +386,7 @@ int ventoy_vdisk_read(struct san_device *sandev, uint64_t lba, unsigned int coun
|
||||
uint32_t lbacount = 0;
|
||||
unsigned long lastbuffer;
|
||||
uint64_t readend;
|
||||
uint64_t VirtSec;
|
||||
ventoy_virt_chunk *node;
|
||||
ventoy_sector_flag *cur_flag;
|
||||
ventoy_sector_flag *sector_flag = g_sector_flag;
|
||||
@@ -401,6 +402,19 @@ int ventoy_vdisk_read(struct san_device *sandev, uint64_t lba, unsigned int coun
|
||||
|
||||
if (g_hddmode)
|
||||
{
|
||||
#if 0
|
||||
/* need to check ?? */
|
||||
lastlba = g_chain->virt_img_size_in_bytes / 512;
|
||||
if (lba < lastlba)
|
||||
{
|
||||
if (lba + count > lastlba)
|
||||
{
|
||||
count = lastlba - lba;
|
||||
}
|
||||
ventoy_vdisk_read_real_hdd(lba, count, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
ventoy_vdisk_read_real_hdd(lba, count, buffer);
|
||||
ix86->regs.dl = sandev->drive;
|
||||
return 0;
|
||||
@@ -419,6 +433,33 @@ int ventoy_vdisk_read(struct san_device *sandev, uint64_t lba, unsigned int coun
|
||||
ix86->regs.dl = sandev->drive;
|
||||
return 0;
|
||||
}
|
||||
else if ((lba * 2048) < g_chain->real_img_size_in_bytes)
|
||||
{
|
||||
/* fix for grub4dos Inconsistent data read from error */
|
||||
memset((void *)(buffer + (count - 1) * 2048), 0, 2048);
|
||||
|
||||
count = (g_chain->real_img_size_in_bytes / 2048) - lba;
|
||||
ventoy_vdisk_read_real(lba, count, buffer);
|
||||
ix86->regs.dl = sandev->drive;
|
||||
|
||||
lba += count;
|
||||
buffer += count * 2048;
|
||||
count = (readend - g_chain->real_img_size_in_bytes) / 2048;
|
||||
}
|
||||
|
||||
VirtSec = g_chain->virt_img_size_in_bytes / 2048;
|
||||
if (lba >= VirtSec)
|
||||
{
|
||||
/* fix for grub4dos Inconsistent data read from error */
|
||||
memset((void *)(buffer + (count - 1) * 2048), 0, 2048);
|
||||
|
||||
ix86->regs.dl = sandev->drive;
|
||||
return 0;
|
||||
}
|
||||
else if (lba + count > VirtSec)
|
||||
{
|
||||
count = VirtSec - lba;
|
||||
}
|
||||
|
||||
if (count > sizeof(g_sector_flag))
|
||||
{
|
||||
|
795
KBD/keyboard_layout.c
Normal file
795
KBD/keyboard_layout.c
Normal file
@@ -0,0 +1,795 @@
|
||||
|
||||
#define ventoy_keyboard_set_layout(name) if (grub_strcmp(layout, #name) == 0) return ventoy_keyboard_layout_##name()
|
||||
|
||||
static void ventoy_keyboard_layout_QWERTY_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_disable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_AZERTY(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("a", "q");
|
||||
grub_keymap_add_by_string("A", "Q");
|
||||
grub_keymap_add_by_string("z", "w");
|
||||
grub_keymap_add_by_string("Z", "W");
|
||||
grub_keymap_add_by_string("q", "a");
|
||||
grub_keymap_add_by_string("Q", "A");
|
||||
grub_keymap_add_by_string("m", "semicolon");
|
||||
grub_keymap_add_by_string("M", "colon");
|
||||
grub_keymap_add_by_string("w", "z");
|
||||
grub_keymap_add_by_string("W", "Z");
|
||||
grub_keymap_add_by_string("comma", "m");
|
||||
grub_keymap_add_by_string("question", "M");
|
||||
grub_keymap_add_by_string("semicolon", "comma");
|
||||
grub_keymap_add_by_string("period", "less");
|
||||
grub_keymap_add_by_string("colon", "period");
|
||||
grub_keymap_add_by_string("slash", "greater");
|
||||
grub_keymap_add_by_string("exclam", "slash");
|
||||
grub_keymap_add_by_string("dollar", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "backslash");
|
||||
grub_keymap_add_by_string("percent", "doublequote");
|
||||
grub_keymap_add_by_string("ampersand", "1");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("tilde", "2");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("doublequote", "3");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("quote", "4");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("parenleft", "5");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("minus", "6");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("backquote", "7");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("underscore", "8");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("caret", "9");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("at", "0");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("parenright", "minus");
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("numbersign", "braceright");
|
||||
grub_keymap_add_by_string("backslash", "question");
|
||||
grub_keymap_add_by_string("bracketright", "braceleft");
|
||||
grub_keymap_add_by_string("braceleft", "quote");
|
||||
grub_keymap_add_by_string("braceright", "underscore");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_CZECH_QWERTY(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("semicolon", "backquote");
|
||||
grub_keymap_add_by_string("plus", "1");
|
||||
grub_keymap_add_by_string("equal", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("parenright", "bracketright");
|
||||
grub_keymap_add_by_string("doublequote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("percent", "underscore");
|
||||
grub_keymap_add_by_string("slash", "braceleft");
|
||||
grub_keymap_add_by_string("parenleft", "braceright");
|
||||
grub_keymap_add_by_string("doublequote", "colon");
|
||||
grub_keymap_add_by_string("exclam", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("backquote", "Abackquote");
|
||||
grub_keymap_add_by_string("exclam", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("percent", "A5");
|
||||
grub_keymap_add_by_string("caret", "A6");
|
||||
grub_keymap_add_by_string("ampersand", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "A8");
|
||||
grub_keymap_add_by_string("parenleft", "A9");
|
||||
grub_keymap_add_by_string("parenright", "A0");
|
||||
grub_keymap_add_by_string("minus", "Aminus");
|
||||
grub_keymap_add_by_string("equal", "Aequal");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("semicolon", "Asemicolon");
|
||||
grub_keymap_add_by_string("backslash", "Abackslash");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("slash", "Aslash");
|
||||
grub_keymap_add_by_string("tilde", "Atilde");
|
||||
grub_keymap_add_by_string("underscore", "Aunderscore");
|
||||
grub_keymap_add_by_string("plus", "Aplus");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("caret", "Adoublequote");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("question", "Aquestion");
|
||||
grub_keymap_add_by_string("bar", "Abar");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_CZECH_QWERTZ(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("semicolon", "backquote");
|
||||
grub_keymap_add_by_string("plus", "1");
|
||||
grub_keymap_add_by_string("equal", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("parenright", "bracketright");
|
||||
grub_keymap_add_by_string("doublequote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("percent", "underscore");
|
||||
grub_keymap_add_by_string("slash", "braceleft");
|
||||
grub_keymap_add_by_string("parenleft", "braceright");
|
||||
grub_keymap_add_by_string("doublequote", "colon");
|
||||
grub_keymap_add_by_string("exclam", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("dollar", "Asemicolon");
|
||||
grub_keymap_add_by_string("numbersign", "Ax");
|
||||
grub_keymap_add_by_string("ampersand", "Ac");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("asterisk", "Aslash");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_DANISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("plus", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("doublequote", "bracketright");
|
||||
grub_keymap_add_by_string("quote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "braceright");
|
||||
grub_keymap_add_by_string("asterisk", "bar");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("less", "quote");
|
||||
grub_keymap_add_by_string("greater", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_DVORAK_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("[", "minus");
|
||||
grub_keymap_add_by_string("braceleft", "underscore");
|
||||
grub_keymap_add_by_string("quote", "q");
|
||||
grub_keymap_add_by_string("doublequote", "Q");
|
||||
grub_keymap_add_by_string("comma", "w");
|
||||
grub_keymap_add_by_string("less", "W");
|
||||
grub_keymap_add_by_string("s", "semicolon");
|
||||
grub_keymap_add_by_string("S", "colon");
|
||||
grub_keymap_add_by_string("semicolon", "z");
|
||||
grub_keymap_add_by_string("colon", "Z");
|
||||
grub_keymap_add_by_string("w", "comma");
|
||||
grub_keymap_add_by_string("W", "less");
|
||||
grub_keymap_add_by_string("v", "period");
|
||||
grub_keymap_add_by_string("z", "greater");
|
||||
grub_keymap_add_by_string("z", "slash");
|
||||
grub_keymap_add_by_string("equal", "bracketright");
|
||||
grub_keymap_add_by_string("backslash", "backslash");
|
||||
grub_keymap_add_by_string("underscore", "doublequote");
|
||||
grub_keymap_add_by_string("quote", "q");
|
||||
grub_keymap_add_by_string("doublequote", "Q");
|
||||
grub_keymap_add_by_string("comma", "w");
|
||||
grub_keymap_add_by_string("less", "W");
|
||||
grub_keymap_add_by_string("period", "e");
|
||||
grub_keymap_add_by_string("greater", "E");
|
||||
grub_keymap_add_by_string("p", "r");
|
||||
grub_keymap_add_by_string("P", "R");
|
||||
grub_keymap_add_by_string("y", "t");
|
||||
grub_keymap_add_by_string("Y", "T");
|
||||
grub_keymap_add_by_string("f", "y");
|
||||
grub_keymap_add_by_string("F", "Y");
|
||||
grub_keymap_add_by_string("g", "u");
|
||||
grub_keymap_add_by_string("G", "U");
|
||||
grub_keymap_add_by_string("c", "c");
|
||||
grub_keymap_add_by_string("C", "I");
|
||||
grub_keymap_add_by_string("r", "o");
|
||||
grub_keymap_add_by_string("R", "O");
|
||||
grub_keymap_add_by_string("l", "p");
|
||||
grub_keymap_add_by_string("L", "P");
|
||||
grub_keymap_add_by_string("bracketright", "equal");
|
||||
grub_keymap_add_by_string("braceright", "plus");
|
||||
grub_keymap_add_by_string("a", "a");
|
||||
grub_keymap_add_by_string("A", "A");
|
||||
grub_keymap_add_by_string("o", "s");
|
||||
grub_keymap_add_by_string("O", "S");
|
||||
grub_keymap_add_by_string("e", "d");
|
||||
grub_keymap_add_by_string("E", "D");
|
||||
grub_keymap_add_by_string("u", "f");
|
||||
grub_keymap_add_by_string("U", "F");
|
||||
grub_keymap_add_by_string("i", "g");
|
||||
grub_keymap_add_by_string("I", "G");
|
||||
grub_keymap_add_by_string("d", "h");
|
||||
grub_keymap_add_by_string("D", "H");
|
||||
grub_keymap_add_by_string("h", "j");
|
||||
grub_keymap_add_by_string("H", "J");
|
||||
grub_keymap_add_by_string("t", "k");
|
||||
grub_keymap_add_by_string("T", "K");
|
||||
grub_keymap_add_by_string("n", "l");
|
||||
grub_keymap_add_by_string("N", "L");
|
||||
grub_keymap_add_by_string("s", "semicolon");
|
||||
grub_keymap_add_by_string("S", "colon");
|
||||
grub_keymap_add_by_string("minus", "quote");
|
||||
grub_keymap_add_by_string("underscore", "doublequote");
|
||||
grub_keymap_add_by_string("semicolon", "z");
|
||||
grub_keymap_add_by_string("colon", "Z");
|
||||
grub_keymap_add_by_string("q", "x");
|
||||
grub_keymap_add_by_string("Q", "X");
|
||||
grub_keymap_add_by_string("j", "c");
|
||||
grub_keymap_add_by_string("J", "C");
|
||||
grub_keymap_add_by_string("k", "v");
|
||||
grub_keymap_add_by_string("K", "V");
|
||||
grub_keymap_add_by_string("x", "b");
|
||||
grub_keymap_add_by_string("X", "B");
|
||||
grub_keymap_add_by_string("b", "n");
|
||||
grub_keymap_add_by_string("B", "N");
|
||||
grub_keymap_add_by_string("w", "comma");
|
||||
grub_keymap_add_by_string("W", "less");
|
||||
grub_keymap_add_by_string("v", "period");
|
||||
grub_keymap_add_by_string("V", "greater");
|
||||
grub_keymap_add_by_string("z", "slash");
|
||||
grub_keymap_add_by_string("Z", "question");
|
||||
grub_keymap_add_by_string("slash", "bracketleft");
|
||||
grub_keymap_add_by_string("question", "braceleft");
|
||||
grub_keymap_add_by_string("equal", "bracketright");
|
||||
grub_keymap_add_by_string("plus", "braceright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_FRENCH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("ampersand", "1");
|
||||
grub_keymap_add_by_string("1", "exclam");
|
||||
grub_keymap_add_by_string("tilde", "2");
|
||||
grub_keymap_add_by_string("2", "at");
|
||||
grub_keymap_add_by_string("doublequote", "3");
|
||||
grub_keymap_add_by_string("3", "numbersign");
|
||||
grub_keymap_add_by_string("quote", "4");
|
||||
grub_keymap_add_by_string("4", "dollar");
|
||||
grub_keymap_add_by_string("parenleft", "5");
|
||||
grub_keymap_add_by_string("5", "percent");
|
||||
grub_keymap_add_by_string("minus", "6");
|
||||
grub_keymap_add_by_string("6", "caret");
|
||||
grub_keymap_add_by_string("backquote", "7");
|
||||
grub_keymap_add_by_string("7", "ampersand");
|
||||
grub_keymap_add_by_string("underscore", "8");
|
||||
grub_keymap_add_by_string("8", "asterisk");
|
||||
grub_keymap_add_by_string("backslash", "9");
|
||||
grub_keymap_add_by_string("9", "parenleft");
|
||||
grub_keymap_add_by_string("at", "0");
|
||||
grub_keymap_add_by_string("0", "parenright");
|
||||
grub_keymap_add_by_string("parenright", "minus");
|
||||
grub_keymap_add_by_string("numbersign", "underscore");
|
||||
grub_keymap_add_by_string("a", "q");
|
||||
grub_keymap_add_by_string("A", "Q");
|
||||
grub_keymap_add_by_string("z", "w");
|
||||
grub_keymap_add_by_string("Z", "W");
|
||||
grub_keymap_add_by_string("caret", "bracketleft");
|
||||
grub_keymap_add_by_string("dollar", "bracketright");
|
||||
grub_keymap_add_by_string("q", "a");
|
||||
grub_keymap_add_by_string("Q", "A");
|
||||
grub_keymap_add_by_string("m", "semicolon");
|
||||
grub_keymap_add_by_string("M", "colon");
|
||||
grub_keymap_add_by_string("bracketleft", "quote");
|
||||
grub_keymap_add_by_string("percent", "doublequote");
|
||||
grub_keymap_add_by_string("asterisk", "backslash");
|
||||
grub_keymap_add_by_string("bracketright", "bar");
|
||||
grub_keymap_add_by_string("w", "z");
|
||||
grub_keymap_add_by_string("W", "Z");
|
||||
grub_keymap_add_by_string("comma", "m");
|
||||
grub_keymap_add_by_string("question", "M");
|
||||
grub_keymap_add_by_string("semicolon", "comma");
|
||||
grub_keymap_add_by_string("period", "less");
|
||||
grub_keymap_add_by_string("colon", "period");
|
||||
grub_keymap_add_by_string("slash", "greater");
|
||||
grub_keymap_add_by_string("exclam", "slash");
|
||||
grub_keymap_add_by_string("bar", "question");
|
||||
grub_keymap_add_by_string("tilde", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("braceleft", "A4");
|
||||
grub_keymap_add_by_string("bracketleft", "A5");
|
||||
grub_keymap_add_by_string("bar", "A6");
|
||||
grub_keymap_add_by_string("quote", "A7");
|
||||
grub_keymap_add_by_string("backslash", "A8");
|
||||
grub_keymap_add_by_string("caret", "A9");
|
||||
grub_keymap_add_by_string("at", "A0");
|
||||
grub_keymap_add_by_string("bracketright", "Aminus");
|
||||
grub_keymap_add_by_string("braceright", "Aequal");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_GERMAN(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backslash", "minus");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "backquote");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("braceright", "doublequote");
|
||||
grub_keymap_add_by_string("bar", "bracketleft");
|
||||
grub_keymap_add_by_string("at", "braceleft");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("less", "backquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("quote", "bar");
|
||||
grub_keymap_add_by_string("greater", "semicolon");
|
||||
grub_keymap_add_by_string("less", "colon");
|
||||
grub_keymap_add_by_string("bar", "quote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_ITALIANO(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("tilde", "numbersign");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "plus");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "braceleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("at", "semicolon");
|
||||
grub_keymap_add_by_string("braceleft", "colon");
|
||||
grub_keymap_add_by_string("numbersign", "quote");
|
||||
grub_keymap_add_by_string("braceright", "doublequote");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("at", "Asemicolon");
|
||||
grub_keymap_add_by_string("numbersign", "Aquote");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_JAPAN_106(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("at", "bracketleft");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("quote", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("underscore", "parenright");
|
||||
grub_keymap_add_by_string("equal", "underscore");
|
||||
grub_keymap_add_by_string("plus", "colon");
|
||||
grub_keymap_add_by_string("colon", "quote");
|
||||
grub_keymap_add_by_string("asterisk", "doublequote");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketright");
|
||||
grub_keymap_add_by_string("braceleft", "braceright");
|
||||
grub_keymap_add_by_string("bracketright", "backslash");
|
||||
grub_keymap_add_by_string("braceright", "bar");
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("tilde", "plus");
|
||||
grub_keymap_add_by_string("caret", "equal");
|
||||
grub_keymap_add_by_string("backquote", "braceleft");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_LATIN_USA(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("bar", "backquote");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backquote", "bracketleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("braceleft", "quote");
|
||||
grub_keymap_add_by_string("braceright", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("bracketleft", "doublequote");
|
||||
grub_keymap_add_by_string("bracketright", "bar");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "Aquote");
|
||||
grub_keymap_add_by_string("doublequote", "braceleft");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("backquote", "Abackslash");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("greater", "plus");
|
||||
grub_keymap_add_by_string("less", "equal");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("backquote", "Abackslash");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_add_by_string("caret", "Aquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_PORTU_BRAZIL(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("quote", "backquote");
|
||||
grub_keymap_add_by_string("quote", "bracketleft");
|
||||
grub_keymap_add_by_string("bracketleft", "bracketright");
|
||||
grub_keymap_add_by_string("tilde", "quote");
|
||||
grub_keymap_add_by_string("bracketright", "backslash");
|
||||
grub_keymap_add_by_string("semicolon", "slash");
|
||||
grub_keymap_add_by_string("bar", "colon");
|
||||
grub_keymap_add_by_string("doublequote", "tilde");
|
||||
grub_keymap_add_by_string("backquote", "braceleft");
|
||||
grub_keymap_add_by_string("braceleft", "braceright");
|
||||
grub_keymap_add_by_string("caret", "doublequote");
|
||||
grub_keymap_add_by_string("braceright", "bar");
|
||||
grub_keymap_add_by_string("colon", "question");
|
||||
grub_keymap_add_by_string("backslash", "semicolon");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("slash", "Aq");
|
||||
grub_keymap_add_by_string("question", "Aw");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTY_UK(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("at", "doublequote");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("tilde", "bar");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("backslash", "numbersign");
|
||||
grub_keymap_add_by_string("bar", "tilde");
|
||||
grub_keymap_add_by_string("backslash", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "percent");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("backslash", "minus");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("caret", "backquote");
|
||||
grub_keymap_add_by_string("backquote", "equal");
|
||||
grub_keymap_add_by_string("numbersign", "backslash");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("percent", "caret");
|
||||
grub_keymap_add_by_string("less", "numbersign");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ_HUN(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("z", "y");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("Z", "Y");
|
||||
grub_keymap_add_by_string("0", "backquote");
|
||||
grub_keymap_add_by_string("quote", "exclam");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("plus", "numbersign");
|
||||
grub_keymap_add_by_string("exclam", "dollar");
|
||||
grub_keymap_add_by_string("slash", "caret");
|
||||
grub_keymap_add_by_string("equal", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("greater", "Az");
|
||||
grub_keymap_add_by_string("numbersign", "Ax");
|
||||
grub_keymap_add_by_string("ampersand", "Ac");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Am");
|
||||
grub_keymap_add_by_string("dollar", "colon");
|
||||
grub_keymap_add_by_string("question", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("at", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backquote", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "0");
|
||||
grub_keymap_add_by_string("dollar", "Asemicolon");
|
||||
grub_keymap_add_by_string("semicolon", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_add_by_string("asterisk", "Aslash");
|
||||
grub_keymap_add_by_string("backquote", "A9");
|
||||
grub_keymap_add_by_string("doublequote", "A0");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_QWERTZ_SLOV_CROAT(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("plus", "equal");
|
||||
grub_keymap_add_by_string("y", "z");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "tilde");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("asterisk", "plus");
|
||||
grub_keymap_add_by_string("Y", "Z");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("tilde", "A1");
|
||||
grub_keymap_add_by_string("caret", "A3");
|
||||
grub_keymap_add_by_string("backquote", "A7");
|
||||
grub_keymap_add_by_string("backslash", "Aq");
|
||||
grub_keymap_add_by_string("bar", "Aw");
|
||||
grub_keymap_add_by_string("bracketleft", "Af");
|
||||
grub_keymap_add_by_string("bracketright", "Ag");
|
||||
grub_keymap_add_by_string("at", "Av");
|
||||
grub_keymap_add_by_string("braceleft", "Ab");
|
||||
grub_keymap_add_by_string("braceright", "An");
|
||||
grub_keymap_add_by_string("less", "Acomma");
|
||||
grub_keymap_add_by_string("greater", "Aperiod");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_SPANISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("caret", "braceleft");
|
||||
grub_keymap_add_by_string("asterisk", "braceright");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("quote", "minus");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("backslash", "backquote");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("backquote", "bracketleft");
|
||||
grub_keymap_add_by_string("plus", "bracketright");
|
||||
grub_keymap_add_by_string("plus", "colon");
|
||||
grub_keymap_add_by_string("at", "semicolon");
|
||||
grub_keymap_add_by_string("bar", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("tilde", "A4");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("braceleft", "Aquote");
|
||||
grub_keymap_add_by_string("braceright", "Abackslash");
|
||||
grub_keymap_add_by_string("greater", "bar");
|
||||
grub_keymap_add_by_string("less", "backslash");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_SWEDISH(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("plus", "minus");
|
||||
grub_keymap_add_by_string("quote", "equal");
|
||||
grub_keymap_add_by_string("doublequote", "bracketright");
|
||||
grub_keymap_add_by_string("quote", "backslash");
|
||||
grub_keymap_add_by_string("minus", "slash");
|
||||
grub_keymap_add_by_string("doublequote", "at");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("caret", "braceright");
|
||||
grub_keymap_add_by_string("asterisk", "bar");
|
||||
grub_keymap_add_by_string("backquote", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "less");
|
||||
grub_keymap_add_by_string("colon", "greater");
|
||||
grub_keymap_add_by_string("underscore", "question");
|
||||
grub_keymap_add_by_string("bar", "Atilde");
|
||||
grub_keymap_add_by_string("backslash", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "tilde");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("less", "quote");
|
||||
grub_keymap_add_by_string("greater", "doublequote");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_TURKISH_Q(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("doublequote", "backquote");
|
||||
grub_keymap_add_by_string("asterisk", "minus");
|
||||
grub_keymap_add_by_string("minus", "equal");
|
||||
grub_keymap_add_by_string("comma", "backslash");
|
||||
grub_keymap_add_by_string("period", "slash");
|
||||
grub_keymap_add_by_string("quote", "at");
|
||||
grub_keymap_add_by_string("caret", "numbersign");
|
||||
grub_keymap_add_by_string("plus", "dollar");
|
||||
grub_keymap_add_by_string("ampersand", "caret");
|
||||
grub_keymap_add_by_string("slash", "ampersand");
|
||||
grub_keymap_add_by_string("parenleft", "asterisk");
|
||||
grub_keymap_add_by_string("parenright", "parenleft");
|
||||
grub_keymap_add_by_string("equal", "parenright");
|
||||
grub_keymap_add_by_string("question", "underscore");
|
||||
grub_keymap_add_by_string("underscore", "plus");
|
||||
grub_keymap_add_by_string("semicolon", "bar");
|
||||
grub_keymap_add_by_string("colon", "question");
|
||||
grub_keymap_add_by_string("less", "Abackquote");
|
||||
grub_keymap_add_by_string("greater", "A1");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("braceleft", "A7");
|
||||
grub_keymap_add_by_string("bracketleft", "A8");
|
||||
grub_keymap_add_by_string("bracketright", "A9");
|
||||
grub_keymap_add_by_string("braceright", "A0");
|
||||
grub_keymap_add_by_string("backslash", "Aminus");
|
||||
grub_keymap_add_by_string("bar", "Aequal");
|
||||
grub_keymap_add_by_string("at", "Aq");
|
||||
grub_keymap_add_by_string("doublequote", "Abracketleft");
|
||||
grub_keymap_add_by_string("tilde", "Abracketright");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
static void ventoy_keyboard_layout_VIETNAMESE(void) {
|
||||
grub_keymap_reset();
|
||||
grub_keymap_add_by_string("exclam", "A1");
|
||||
grub_keymap_add_by_string("at", "A2");
|
||||
grub_keymap_add_by_string("numbersign", "A3");
|
||||
grub_keymap_add_by_string("dollar", "A4");
|
||||
grub_keymap_add_by_string("percent", "A5");
|
||||
grub_keymap_add_by_string("caret", "A6");
|
||||
grub_keymap_add_by_string("ampersand", "A7");
|
||||
grub_keymap_add_by_string("asterisk", "A8");
|
||||
grub_keymap_add_by_string("parenleft", "A9");
|
||||
grub_keymap_add_by_string("parenright", "A0");
|
||||
grub_keymap_add_by_string("plus", "Aplus");
|
||||
grub_keymap_add_by_string("equal", "Aequal");
|
||||
grub_keymap_add_by_string("braceleft", "Abraceleft");
|
||||
grub_keymap_add_by_string("braceright", "Abraceright");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("semicolon", "Asemicolon");
|
||||
grub_keymap_add_by_string("quote", "Aquote");
|
||||
grub_keymap_add_by_string("backslash", "Abackslash");
|
||||
grub_keymap_add_by_string("less", "Aless");
|
||||
grub_keymap_add_by_string("greater", "Agreater");
|
||||
grub_keymap_add_by_string("comma", "Acomma");
|
||||
grub_keymap_add_by_string("period", "Aperiod");
|
||||
grub_keymap_add_by_string("question", "Aquestion");
|
||||
grub_keymap_add_by_string("slash", "Aslash");
|
||||
grub_keymap_add_by_string("tilde", "Atilde");
|
||||
grub_keymap_add_by_string("backquote", "Abackquote");
|
||||
grub_keymap_add_by_string("bracketright", "Abracketright");
|
||||
grub_keymap_add_by_string("bracketleft", "Abracketleft");
|
||||
grub_keymap_add_by_string("bar", "Abar");
|
||||
grub_keymap_add_by_string("doublequote", "Adoublequote");
|
||||
grub_keymap_add_by_string("colon", "Acolon");
|
||||
grub_keymap_add_by_string("minus", "Aminus");
|
||||
grub_keymap_add_by_string("underscore", "Aunderscore");
|
||||
grub_keymap_enable();
|
||||
}
|
||||
void ventoy_set_keyboard_layout(const char *layout);
|
||||
void ventoy_set_keyboard_layout(const char *layout) {
|
||||
ventoy_keyboard_set_layout(QWERTY_USA);
|
||||
ventoy_keyboard_set_layout(AZERTY);
|
||||
ventoy_keyboard_set_layout(CZECH_QWERTY);
|
||||
ventoy_keyboard_set_layout(CZECH_QWERTZ);
|
||||
ventoy_keyboard_set_layout(DANISH);
|
||||
ventoy_keyboard_set_layout(DVORAK_USA);
|
||||
ventoy_keyboard_set_layout(FRENCH);
|
||||
ventoy_keyboard_set_layout(GERMAN);
|
||||
ventoy_keyboard_set_layout(ITALIANO);
|
||||
ventoy_keyboard_set_layout(JAPAN_106);
|
||||
ventoy_keyboard_set_layout(LATIN_USA);
|
||||
ventoy_keyboard_set_layout(PORTU_BRAZIL);
|
||||
ventoy_keyboard_set_layout(QWERTY_UK);
|
||||
ventoy_keyboard_set_layout(QWERTZ);
|
||||
ventoy_keyboard_set_layout(QWERTZ_HUN);
|
||||
ventoy_keyboard_set_layout(QWERTZ_SLOV_CROAT);
|
||||
ventoy_keyboard_set_layout(SPANISH);
|
||||
ventoy_keyboard_set_layout(SWEDISH);
|
||||
ventoy_keyboard_set_layout(TURKISH_Q);
|
||||
ventoy_keyboard_set_layout(VIETNAMESE);
|
||||
}
|
@@ -4,12 +4,13 @@
|
||||
# Configfiles are from grubfilemanager project
|
||||
#
|
||||
|
||||
cfgfile=../INSTALL/grub/keyboard.cfg
|
||||
rm -f ${cfgfile}.gz
|
||||
|
||||
echo "submenu \"Keyboard Layouts\" --class=debug_krdlayout {" >>$cfgfile
|
||||
cfgfile=keyboard_layout.c
|
||||
rm -f ${cfgfile}
|
||||
|
||||
cat >>$cfgfile << EOF
|
||||
|
||||
#define ventoy_keyboard_set_layout(name) if (grub_strcmp(layout, #name) == 0) return ventoy_keyboard_layout_##name()
|
||||
|
||||
menuentry QWERTY_USA --class=debug_kbd {
|
||||
setkey -r
|
||||
setkey -d
|
||||
@@ -25,6 +26,59 @@ ls -1 cfg | while read line; do
|
||||
echo "}" >> $cfgfile
|
||||
done
|
||||
|
||||
dos2unix $cfgfile
|
||||
sed 's/menuentry \([^ ]*\) .*/static void ventoy_keyboard_layout_\1(void) {/g' -i $cfgfile
|
||||
sed 's/setkey *-r/grub_keymap_reset();/g' -i $cfgfile
|
||||
sed 's/setkey *-d/grub_keymap_disable();/g' -i $cfgfile
|
||||
sed 's/setkey *-e/grub_keymap_enable();/g' -i $cfgfile
|
||||
sed 's/^setkey *\([^ ]*\) *\([^ ]*\)/grub_keymap_add_by_string("\1", "\2");/g' -i $cfgfile
|
||||
|
||||
rm -f .tmpfunc
|
||||
echo "void ventoy_set_keyboard_layout(const char *layout);" >> .tmpfunc
|
||||
echo "void ventoy_set_keyboard_layout(const char *layout) {" >> .tmpfunc
|
||||
grep 'void *ventoy_keyboard_layout_' $cfgfile | while read line; do
|
||||
name=$(echo $line | sed 's/.*ventoy_keyboard_layout_\(.*\)(.*/\1/g')
|
||||
echo "ventoy_keyboard_set_layout($name);" >> .tmpfunc
|
||||
done
|
||||
|
||||
echo "}" >> .tmpfunc
|
||||
|
||||
cat .tmpfunc >> $cfgfile
|
||||
rm -f .tmpfunc
|
||||
|
||||
rm -f ../GRUB2/SRC/grub-2.04/grub-core/term/$cfgfile
|
||||
cp -a $cfgfile ../GRUB2/SRC/grub-2.04/grub-core/term/$cfgfile
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
############
|
||||
#
|
||||
# cfg
|
||||
#############
|
||||
|
||||
cfgfile=../INSTALL/grub/keyboard.cfg
|
||||
rm -f ${cfgfile}
|
||||
|
||||
echo "submenu \"Keyboard Layouts\" --class=debug_krdlayout {" >>$cfgfile
|
||||
|
||||
cat >>$cfgfile << EOF
|
||||
menuentry QWERTY_USA --class=debug_kbd {
|
||||
set_keyboard_layout QWERTY_USA
|
||||
}
|
||||
EOF
|
||||
|
||||
ls -1 cfg | while read line; do
|
||||
kbd=${line%.cfg}
|
||||
name=${kbd#KBD_}
|
||||
|
||||
echo " menuentry $name --class=debug_kbd {" >> $cfgfile
|
||||
echo " set_keyboard_layout $name" >> $cfgfile
|
||||
echo " }" >> $cfgfile
|
||||
done
|
||||
|
||||
echo "}" >>$cfgfile
|
||||
|
||||
gzip $cfgfile
|
||||
|
||||
|
||||
|
17
LANGUAGES/README
Normal file
17
LANGUAGES/README
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
File encoding: UTF-8
|
||||
|
||||
language name must in the format: "Language-XXX (YYY)"
|
||||
1. Language- fixed 9 characters
|
||||
2. XXX: name in English
|
||||
3. a space (ASCII: 0x20)
|
||||
4. a left brace (ASCII: 0x28)
|
||||
5. YYY: name in the specified language
|
||||
6. a right brace (ASCII: 0x29)
|
||||
|
||||
string translation:
|
||||
all the String Define
|
||||
#@ will be replaced with \r\n
|
||||
|
||||
All the languages will be sorted by the name
|
||||
|
17
LANGUAGES/check.sh
Normal file
17
LANGUAGES/check.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
VTOY_PATH=$1
|
||||
|
||||
if [ ! -f $VTOY_PATH/LANGUAGES/languages.json ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gcc -DFOR_VTOY_JSON_CHECK $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/VentoyJson.c -I $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/ -o checkjson
|
||||
|
||||
./checkjson $VTOY_PATH/LANGUAGES/languages.json
|
||||
ret=$?
|
||||
|
||||
rm -f ./checkjson
|
||||
[ $ret -eq 0 ]
|
||||
|
||||
|
Binary file not shown.
1741
LANGUAGES/languages.json
Normal file
1741
LANGUAGES/languages.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -233,6 +233,12 @@ static int ventoy_is_possible_blkdev(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* /dev/zramX */
|
||||
if (name[0] == 'z' && name[1] == 'r' && name[2] == 'a' && name[3] == 'm')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* /dev/loopX */
|
||||
if (name[0] == 'l' && name[1] == 'o' && name[2] == 'o' && name[3] == 'p')
|
||||
{
|
||||
@@ -508,6 +514,8 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle)
|
||||
vdebug("ventoy partition layout check OK: [%llu %llu] [%llu %llu]\n",
|
||||
part1_start_sector, part1_sector_count, part2_start_sector, part2_sector_count);
|
||||
|
||||
vtoy->ventoy_valid = 1;
|
||||
|
||||
vdebug("now check secure boot for %s ...\n", info->disk_path);
|
||||
|
||||
g_fatlib_media_fd = fd;
|
||||
@@ -520,7 +528,6 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle)
|
||||
if (ret == 0 && vtoy->ventoy_ver[0])
|
||||
{
|
||||
vtoy->secure_boot_flag = fatlib_is_secure_boot_enable();
|
||||
vtoy->ventoy_valid = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -536,6 +543,11 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle)
|
||||
g_fatlib_media_fd = -1;
|
||||
g_fatlib_media_offset = 0;
|
||||
|
||||
if (vtoy->ventoy_ver[0] == 0)
|
||||
{
|
||||
vtoy->ventoy_ver[0] = '?';
|
||||
}
|
||||
|
||||
if (0 == vtoy->ventoy_valid)
|
||||
{
|
||||
goto end;
|
||||
|
@@ -1,36 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "generating languages.js ..."
|
||||
VTOY_PATH=$PWD/../
|
||||
|
||||
iconv -f utf-16 -t utf-8 ../LANGUAGES/languages.ini | egrep -v '=STR|^;' | egrep 'Language-|STR_' > languages.js
|
||||
echo "checking languages.json ..."
|
||||
sh $VTOY_PATH/LANGUAGES/check.sh $VTOY_PATH || exit 1
|
||||
|
||||
echo "generating languages.json ..."
|
||||
|
||||
echo "var vtoy_language_data = " > languages.js
|
||||
cat $VTOY_PATH/LANGUAGES/languages.json >> languages.js
|
||||
echo ";" >> languages.js
|
||||
|
||||
dos2unix languages.js
|
||||
|
||||
sed 's/\(STR_.*\)=/"\1":/g' -i languages.js
|
||||
|
||||
sed "s/: *'/:\"/g" -i languages.js
|
||||
|
||||
sed "s/'\s*$/\",/g" -i languages.js
|
||||
|
||||
sed 's/\[Language-\(.*\)\].*/"STR_XXX":""},{"name":"\1",/g' -i languages.js
|
||||
|
||||
sed "1s/.*\},/var vtoy_language_data = \[/" -i languages.js
|
||||
|
||||
sed 's/\("STR_WEB_COMMUNICATION_ERR"[^,]*\)/\1,/g' -i languages.js
|
||||
sed 's/,,/,/g' -i languages.js
|
||||
|
||||
CNT=$(grep -v -c ',$' languages.js)
|
||||
|
||||
if [ $CNT -gt 0 ]; then
|
||||
echo "====== FAILED ========="
|
||||
grep -v -n ',$' languages.js
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo '"STR_XXX":""}' >> languages.js
|
||||
echo '];' >> languages.js
|
||||
|
||||
rm -f WebUI/static/js/languages.js
|
||||
mv languages.js WebUI/static/js/
|
||||
|
||||
|
18
README.md
18
README.md
@@ -13,10 +13,10 @@
|
||||
Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. <br/>
|
||||
With ventoy, you don't need to format the disk over and over, you just need to copy the image files to the USB drive and boot it.
|
||||
You can copy many image files at a time and ventoy will give you a boot menu to select them. <br/>
|
||||
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI and ARM64 UEFI are supported in the same way.<br/>
|
||||
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.<br/>
|
||||
Both MBR and GPT partition style are supported in the same way.<br/>
|
||||
Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
|
||||
610+ ISO files are tested. 90%+ distros in distrowatch.com supported. <br/>
|
||||
700+ ISO files are tested. 90%+ distros in distrowatch.com supported. <br/>
|
||||
</h4>
|
||||
|
||||
# Features
|
||||
@@ -27,15 +27,15 @@ Most type of OS supported(Windows/WinPE/Linux/Unix/Vmware/Xen...) <br/>
|
||||
* Directly boot from ISO/WIM/IMG/VHD(x)/EFI files, no extraction needed
|
||||
* No need to be continuous in disk for ISO/IMG files
|
||||
* MBR and GPT partition style supported (1.0.15+)
|
||||
* x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI supported
|
||||
* UEFI Secure Boot supported (1.0.07+)
|
||||
* x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI, MIPS64EL UEFI supported
|
||||
* IA32/x86_64 UEFI Secure Boot supported (1.0.07+)
|
||||
* Persistence supported (1.0.11+)
|
||||
* Windows auto installation supported (1.0.09+)
|
||||
* RHEL7/8/CentOS/7/8/SUSE/Ubuntu Server/Debian ... auto installation supported (1.0.09+)
|
||||
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
|
||||
* ISO files larger than 4GB supported
|
||||
* Native boot menu style for Legacy & UEFI
|
||||
* Most type of OS supported, 610+ iso files tested
|
||||
* Most type of OS supported, 700+ iso files tested
|
||||
* Linux vDisk boot supported
|
||||
* Not only boot but also complete installation process
|
||||
* Menu dynamically switchable between List/TreeView mode
|
||||
@@ -62,12 +62,19 @@ Please refer to [BuildVentoyFromSource.txt](https://github.com/ventoy/Ventoy/blo
|
||||
Title | Link
|
||||
-|-
|
||||
**Install & Update** | [https://www.ventoy.net/en/doc_start.html](https://www.ventoy.net/en/doc_start.html)
|
||||
**Secure Boot** | [https://www.ventoy.net/en/doc_secure.html](https://www.ventoy.net/en/doc_secure.html)
|
||||
**Customize Theme** | [https://www.ventoy.net/en/plugin_theme.html](https://www.ventoy.net/en/plugin_theme.html)
|
||||
**Global Control** | [https://www.ventoy.net/en/plugin_control.html](https://www.ventoy.net/en/plugin_control.html)
|
||||
**Image List** | [https://www.ventoy.net/en/plugin_imagelist.html](https://www.ventoy.net/en/plugin_imagelist.html)
|
||||
**Auto Installation** | [https://www.ventoy.net/en/plugin_autoinstall.html](https://www.ventoy.net/en/plugin_autoinstall.html)
|
||||
**Injection Plugin** | [https://www.ventoy.net/en/plugin_injection.html](https://www.ventoy.net/en/plugin_injection.html)
|
||||
**Persistence Support** | [https://www.ventoy.net/en/plugin_persistence.html](https://www.ventoy.net/en/plugin_persistence.html)
|
||||
**Boot WIM file** | [https://www.ventoy.net/en/plugin_wimboot.html](https://www.ventoy.net/en/plugin_wimboot.html)
|
||||
**Windows VHD Boot** | [https://www.ventoy.net/en/plugin_vhdboot.html](https://www.ventoy.net/en/plugin_vhdboot.html)
|
||||
**Linux vDisk Boot** | [https://www.ventoy.net/en/plugin_vtoyboot.html](https://www.ventoy.net/en/plugin_vtoyboot.html)
|
||||
**DUD Plugin** | [https://www.ventoy.net/en/plugin_dud.html](https://www.ventoy.net/en/plugin_dud.html)
|
||||
**Password Plugin** | [https://www.ventoy.net/en/plugin_password.html](https://www.ventoy.net/en/plugin_password.html)
|
||||
**Conf Replace Plugin** | [https://www.ventoy.net/en/plugin_bootconf_replace.html](https://www.ventoy.net/en/plugin_bootconf_replace.html)
|
||||
**Menu Class** | [https://www.ventoy.net/en/plugin_menuclass.html](https://www.ventoy.net/en/plugin_menuclass.html)
|
||||
**Menu Alias** | [https://www.ventoy.net/en/plugin_menualias.html](https://www.ventoy.net/en/plugin_menualias.html)
|
||||
**Menu Extension** | [https://www.ventoy.net/en/plugin_grubmenu.html](https://www.ventoy.net/en/plugin_grubmenu.html)
|
||||
@@ -75,6 +82,7 @@ Title | Link
|
||||
**TreeView Mode** | [https://www.ventoy.net/en/doc_treeview.html](https://www.ventoy.net/en/doc_treeview.html)
|
||||
**Disk Layout MBR** | [https://www.ventoy.net/en/doc_disk_layout.html](https://www.ventoy.net/en/doc_disk_layout.html)
|
||||
**Disk Layout GPT** | [https://www.ventoy.net/en/doc_disk_layout_gpt.html](https://www.ventoy.net/en/doc_disk_layout_gpt.html)
|
||||
**Search Configuration** | [https://www.ventoy.net/en/doc_search_path.html](https://www.ventoy.net/en/doc_search_path.html)
|
||||
|
||||
|
||||
# FAQ
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -102,12 +102,18 @@ typedef enum OPT_SUBMENU
|
||||
|
||||
|
||||
#define VENTOY_LANGUAGE_INI TEXT(".\\ventoy\\languages.ini")
|
||||
#define VENTOY_LANGUAGE_JSON TEXT(".\\ventoy\\languages.json")
|
||||
#define VENTOY_LANGUAGE_INI_A ".\\ventoy\\languages.ini"
|
||||
#define VENTOY_LANGUAGE_JSON_A ".\\ventoy\\languages.json"
|
||||
|
||||
#define VENTOY_CFG_INI TEXT(".\\Ventoy2Disk.ini")
|
||||
#define VENTOY_CFG_INI_A ".\\Ventoy2Disk.ini"
|
||||
#define VENTOY_MAX_LANGUAGE 200
|
||||
|
||||
#define GET_INI_STRING(Section, Key, Buf) GetPrivateProfileString(Section, Key, TEXT("#"), Buf, sizeof(Buf), VENTOY_LANGUAGE_INI)
|
||||
|
||||
|
||||
|
||||
typedef struct VENTOY_LANGUAGE
|
||||
{
|
||||
WCHAR Name[128];
|
||||
|
@@ -283,6 +283,12 @@ static int FilterPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount)
|
||||
CurDrive->PartStyle = (MBR.PartTbl[0].FsFlag == 0xEE) ? 1 : 0;
|
||||
GetVentoyVerInPhyDrive(CurDrive, Part2StartSector, CurDrive->VentoyVersion, sizeof(CurDrive->VentoyVersion), &(CurDrive->SecureBootSupport));
|
||||
Log("PhyDrive %d is Ventoy Disk ver:%s SecureBoot:%u", CurDrive->PhyDrive, CurDrive->VentoyVersion, CurDrive->SecureBootSupport);
|
||||
|
||||
if (CurDrive->VentoyVersion[0] == 0)
|
||||
{
|
||||
CurDrive->VentoyVersion[0] = '?';
|
||||
Log("Unknown Ventoy Version");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,7 @@
|
||||
<ClCompile Include="process.c" />
|
||||
<ClCompile Include="Utility.c" />
|
||||
<ClCompile Include="Ventoy2Disk.c" />
|
||||
<ClCompile Include="VentoyJson.c" />
|
||||
<ClCompile Include="WinDialog.c" />
|
||||
<ClCompile Include="xz-embedded-20130513\linux\lib\decompress_unxz.c" />
|
||||
</ItemGroup>
|
||||
@@ -133,6 +134,7 @@
|
||||
<ClInclude Include="process.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="Ventoy2Disk.h" />
|
||||
<ClInclude Include="VentoyJson.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Ventoy2Disk.rc" />
|
||||
|
@@ -78,6 +78,9 @@
|
||||
<ClCompile Include="crc32.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VentoyJson.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Ventoy2Disk.h">
|
||||
@@ -137,6 +140,9 @@
|
||||
<ClInclude Include="process.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VentoyJson.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Ventoy2Disk.rc">
|
||||
|
771
Ventoy2Disk/Ventoy2Disk/VentoyJson.c
Normal file
771
Ventoy2Disk/Ventoy2Disk/VentoyJson.c
Normal file
@@ -0,0 +1,771 @@
|
||||
/******************************************************************************
|
||||
* VentoyJson.c
|
||||
*
|
||||
* Copyright (c) 2021, 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef FOR_VTOY_JSON_CHECK
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <Windows.h>
|
||||
#include "Ventoy2Disk.h"
|
||||
#endif
|
||||
|
||||
#include "VentoyJson.h"
|
||||
|
||||
static void vtoy_json_free(VTOY_JSON *pstJsonHead)
|
||||
{
|
||||
VTOY_JSON *pstNext = NULL;
|
||||
|
||||
while (NULL != pstJsonHead)
|
||||
{
|
||||
pstNext = pstJsonHead->pstNext;
|
||||
if ((pstJsonHead->enDataType < JSON_TYPE_BUTT) && (NULL != pstJsonHead->pstChild))
|
||||
{
|
||||
vtoy_json_free(pstJsonHead->pstChild);
|
||||
}
|
||||
|
||||
free(pstJsonHead);
|
||||
pstJsonHead = pstNext;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static char *vtoy_json_skip(const char *pcData)
|
||||
{
|
||||
while ((NULL != pcData) && ('\0' != *pcData) && (*pcData <= 32))
|
||||
{
|
||||
pcData++;
|
||||
}
|
||||
|
||||
return (char *)pcData;
|
||||
}
|
||||
|
||||
VTOY_JSON *vtoy_json_find_item
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
JSON_TYPE enDataType,
|
||||
const char *szKey
|
||||
)
|
||||
{
|
||||
while (NULL != pstJson)
|
||||
{
|
||||
if ((enDataType == pstJson->enDataType) &&
|
||||
(0 == strcmp(szKey, pstJson->pcName)))
|
||||
{
|
||||
return pstJson;
|
||||
}
|
||||
pstJson = pstJson->pstNext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int vtoy_json_parse_number
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
)
|
||||
{
|
||||
unsigned long Value;
|
||||
|
||||
Value = strtoul(pcData, (char **)ppcEnd, 10);
|
||||
if (*ppcEnd == pcData)
|
||||
{
|
||||
Log("Failed to parse json number %s.", pcData);
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pstJson->enDataType = JSON_TYPE_NUMBER;
|
||||
pstJson->unData.lValue = Value;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
static int vtoy_json_parse_string
|
||||
(
|
||||
char *pcNewStart,
|
||||
char *pcRawStart,
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
)
|
||||
{
|
||||
UINT32 uiLen = 0;
|
||||
const char *pcPos = NULL;
|
||||
const char *pcTmp = pcData + 1;
|
||||
|
||||
*ppcEnd = pcData;
|
||||
|
||||
if ('\"' != *pcData)
|
||||
{
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcPos = strchr(pcTmp, '\"');
|
||||
if ((NULL == pcPos) || (pcPos < pcTmp))
|
||||
{
|
||||
Log("Invalid string %s.", pcData);
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
*ppcEnd = pcPos + 1;
|
||||
uiLen = (UINT32)(unsigned long)(pcPos - pcTmp);
|
||||
|
||||
pstJson->enDataType = JSON_TYPE_STRING;
|
||||
pstJson->unData.pcStrVal = pcNewStart + (pcTmp - pcRawStart);
|
||||
pstJson->unData.pcStrVal[uiLen] = '\0';
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
static int vtoy_json_parse_array
|
||||
(
|
||||
char *pcNewStart,
|
||||
char *pcRawStart,
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
)
|
||||
{
|
||||
int Ret = JSON_SUCCESS;
|
||||
VTOY_JSON *pstJsonChild = NULL;
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
const char *pcTmp = pcData + 1;
|
||||
|
||||
*ppcEnd = pcData;
|
||||
pstJson->enDataType = JSON_TYPE_ARRAY;
|
||||
|
||||
if ('[' != *pcData)
|
||||
{
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcTmp = vtoy_json_skip(pcTmp);
|
||||
|
||||
if (']' == *pcTmp)
|
||||
{
|
||||
*ppcEnd = pcTmp + 1;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
JSON_NEW_ITEM(pstJson->pstChild, JSON_FAILED);
|
||||
|
||||
Ret = vtoy_json_parse_value(pcNewStart, pcRawStart, pstJson->pstChild, pcTmp, ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pstJsonChild = pstJson->pstChild;
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
while ((NULL != pcTmp) && (',' == *pcTmp))
|
||||
{
|
||||
JSON_NEW_ITEM(pstJsonItem, JSON_FAILED);
|
||||
pstJsonChild->pstNext = pstJsonItem;
|
||||
pstJsonItem->pstPrev = pstJsonChild;
|
||||
pstJsonChild = pstJsonItem;
|
||||
|
||||
Ret = vtoy_json_parse_value(pcNewStart, pcRawStart, pstJsonChild, vtoy_json_skip(pcTmp + 1), ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
}
|
||||
|
||||
if ((NULL != pcTmp) && (']' == *pcTmp))
|
||||
{
|
||||
*ppcEnd = pcTmp + 1;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppcEnd = pcTmp;
|
||||
return JSON_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
static int vtoy_json_parse_object
|
||||
(
|
||||
char *pcNewStart,
|
||||
char *pcRawStart,
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
)
|
||||
{
|
||||
int Ret = JSON_SUCCESS;
|
||||
VTOY_JSON *pstJsonChild = NULL;
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
const char *pcTmp = pcData + 1;
|
||||
|
||||
*ppcEnd = pcData;
|
||||
pstJson->enDataType = JSON_TYPE_OBJECT;
|
||||
|
||||
if ('{' != *pcData)
|
||||
{
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcTmp = vtoy_json_skip(pcTmp);
|
||||
if ('}' == *pcTmp)
|
||||
{
|
||||
*ppcEnd = pcTmp + 1;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
JSON_NEW_ITEM(pstJson->pstChild, JSON_FAILED);
|
||||
|
||||
Ret = vtoy_json_parse_string(pcNewStart, pcRawStart, pstJson->pstChild, pcTmp, ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pstJsonChild = pstJson->pstChild;
|
||||
pstJsonChild->pcName = pstJsonChild->unData.pcStrVal;
|
||||
pstJsonChild->unData.pcStrVal = NULL;
|
||||
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
if ((NULL == pcTmp) || (':' != *pcTmp))
|
||||
{
|
||||
*ppcEnd = pcTmp;
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
Ret = vtoy_json_parse_value(pcNewStart, pcRawStart, pstJsonChild, vtoy_json_skip(pcTmp + 1), ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
while ((NULL != pcTmp) && (',' == *pcTmp))
|
||||
{
|
||||
JSON_NEW_ITEM(pstJsonItem, JSON_FAILED);
|
||||
pstJsonChild->pstNext = pstJsonItem;
|
||||
pstJsonItem->pstPrev = pstJsonChild;
|
||||
pstJsonChild = pstJsonItem;
|
||||
|
||||
Ret = vtoy_json_parse_string(pcNewStart, pcRawStart, pstJsonChild, vtoy_json_skip(pcTmp + 1), ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
pstJsonChild->pcName = pstJsonChild->unData.pcStrVal;
|
||||
pstJsonChild->unData.pcStrVal = NULL;
|
||||
if ((NULL == pcTmp) || (':' != *pcTmp))
|
||||
{
|
||||
*ppcEnd = pcTmp;
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
Ret = vtoy_json_parse_value(pcNewStart, pcRawStart, pstJsonChild, vtoy_json_skip(pcTmp + 1), ppcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse array child.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
pcTmp = vtoy_json_skip(*ppcEnd);
|
||||
}
|
||||
|
||||
if ((NULL != pcTmp) && ('}' == *pcTmp))
|
||||
{
|
||||
*ppcEnd = pcTmp + 1;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppcEnd = pcTmp;
|
||||
return JSON_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
int vtoy_json_parse_value
|
||||
(
|
||||
char *pcNewStart,
|
||||
char *pcRawStart,
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
)
|
||||
{
|
||||
pcData = vtoy_json_skip(pcData);
|
||||
|
||||
switch (*pcData)
|
||||
{
|
||||
case 'n':
|
||||
{
|
||||
if (0 == strncmp(pcData, "null", 4))
|
||||
{
|
||||
pstJson->enDataType = JSON_TYPE_NULL;
|
||||
*ppcEnd = pcData + 4;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
if (0 == strncmp(pcData, "false", 5))
|
||||
{
|
||||
pstJson->enDataType = JSON_TYPE_BOOL;
|
||||
pstJson->unData.lValue = 0;
|
||||
*ppcEnd = pcData + 5;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
{
|
||||
if (0 == strncmp(pcData, "true", 4))
|
||||
{
|
||||
pstJson->enDataType = JSON_TYPE_BOOL;
|
||||
pstJson->unData.lValue = 1;
|
||||
*ppcEnd = pcData + 4;
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '\"':
|
||||
{
|
||||
return vtoy_json_parse_string(pcNewStart, pcRawStart, pstJson, pcData, ppcEnd);
|
||||
}
|
||||
case '[':
|
||||
{
|
||||
return vtoy_json_parse_array(pcNewStart, pcRawStart, pstJson, pcData, ppcEnd);
|
||||
}
|
||||
case '{':
|
||||
{
|
||||
return vtoy_json_parse_object(pcNewStart, pcRawStart, pstJson, pcData, ppcEnd);
|
||||
}
|
||||
case '-':
|
||||
{
|
||||
return vtoy_json_parse_number(pstJson, pcData, ppcEnd);
|
||||
}
|
||||
default :
|
||||
{
|
||||
if (*pcData >= '0' && *pcData <= '9')
|
||||
{
|
||||
return vtoy_json_parse_number(pstJson, pcData, ppcEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*ppcEnd = pcData;
|
||||
Log("Invalid json data %u.", (UINT8)(*pcData));
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
VTOY_JSON * vtoy_json_create(void)
|
||||
{
|
||||
VTOY_JSON *pstJson = NULL;
|
||||
|
||||
pstJson = (VTOY_JSON *)malloc(sizeof(VTOY_JSON));
|
||||
if (NULL == pstJson)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
memset(pstJson, 0, sizeof(VTOY_JSON));
|
||||
return pstJson;
|
||||
}
|
||||
|
||||
int vtoy_json_parse(VTOY_JSON *pstJson, const char *szJsonData)
|
||||
{
|
||||
UINT32 uiMemSize = 0;
|
||||
int Ret = JSON_SUCCESS;
|
||||
char *pcNewBuf = NULL;
|
||||
const char *pcEnd = NULL;
|
||||
|
||||
uiMemSize = strlen(szJsonData) + 1;
|
||||
pcNewBuf = (char *)malloc(uiMemSize);
|
||||
if (NULL == pcNewBuf)
|
||||
{
|
||||
Log("Failed to alloc new buf.");
|
||||
return JSON_FAILED;
|
||||
}
|
||||
memcpy(pcNewBuf, szJsonData, uiMemSize);
|
||||
pcNewBuf[uiMemSize - 1] = 0;
|
||||
|
||||
Ret = vtoy_json_parse_value(pcNewBuf, (char *)szJsonData, pstJson, szJsonData, &pcEnd);
|
||||
if (JSON_SUCCESS != Ret)
|
||||
{
|
||||
Log("Failed to parse json data start=%p, end=%p", szJsonData, pcEnd);
|
||||
return JSON_FAILED;
|
||||
}
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_scan_parse
|
||||
(
|
||||
const VTOY_JSON *pstJson,
|
||||
UINT32 uiParseNum,
|
||||
JSON_PARSE *pstJsonParse
|
||||
)
|
||||
{
|
||||
UINT32 i = 0;
|
||||
const VTOY_JSON *pstJsonCur = NULL;
|
||||
JSON_PARSE *pstCurParse = NULL;
|
||||
|
||||
for (pstJsonCur = pstJson; NULL != pstJsonCur; pstJsonCur = pstJsonCur->pstNext)
|
||||
{
|
||||
if ((JSON_TYPE_OBJECT == pstJsonCur->enDataType) ||
|
||||
(JSON_TYPE_ARRAY == pstJsonCur->enDataType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0, pstCurParse = NULL; i < uiParseNum; i++)
|
||||
{
|
||||
if (0 == strcmp(pstJsonParse[i].pcKey, pstJsonCur->pcName))
|
||||
{
|
||||
pstCurParse = pstJsonParse + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == pstCurParse)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (pstJsonCur->enDataType)
|
||||
{
|
||||
case JSON_TYPE_NUMBER:
|
||||
{
|
||||
if (sizeof(UINT32) == pstCurParse->uiBufSize)
|
||||
{
|
||||
*(UINT32 *)(pstCurParse->pDataBuf) = (UINT32)pstJsonCur->unData.lValue;
|
||||
}
|
||||
else if (sizeof(UINT16) == pstCurParse->uiBufSize)
|
||||
{
|
||||
*(UINT16 *)(pstCurParse->pDataBuf) = (UINT16)pstJsonCur->unData.lValue;
|
||||
}
|
||||
else if (sizeof(UINT8) == pstCurParse->uiBufSize)
|
||||
{
|
||||
*(UINT8 *)(pstCurParse->pDataBuf) = (UINT8)pstJsonCur->unData.lValue;
|
||||
}
|
||||
else if ((pstCurParse->uiBufSize > sizeof(UINT64)))
|
||||
{
|
||||
sprintf_s((char *)pstCurParse->pDataBuf, pstCurParse->uiBufSize, "%llu",
|
||||
(unsigned long long)(pstJsonCur->unData.lValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Invalid number data buf size %u.", pstCurParse->uiBufSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JSON_TYPE_STRING:
|
||||
{
|
||||
strcpy_s((char *)pstCurParse->pDataBuf, pstCurParse->uiBufSize, pstJsonCur->unData.pcStrVal);
|
||||
break;
|
||||
}
|
||||
case JSON_TYPE_BOOL:
|
||||
{
|
||||
*(UINT8 *)(pstCurParse->pDataBuf) = (pstJsonCur->unData.lValue) > 0 ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_scan_array
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstArrayItem
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_ARRAY, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*ppstArrayItem = pstJsonItem;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_scan_array_ex
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstArrayItem
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_ARRAY, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*ppstArrayItem = pstJsonItem->pstChild;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_scan_object
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstObjectItem
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_OBJECT, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*ppstObjectItem = pstJsonItem;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_get_int
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
int *piValue
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_NUMBER, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*piValue = (int)pstJsonItem->unData.lValue;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_get_uint
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT32 *puiValue
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_NUMBER, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*puiValue = (UINT32)pstJsonItem->unData.lValue;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_get_uint64
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT64 *pui64Value
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_NUMBER, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*pui64Value = (UINT64)pstJsonItem->unData.lValue;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_get_bool
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT8 *pbValue
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_BOOL, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
*pbValue = pstJsonItem->unData.lValue > 0 ? 1 : 0;
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
int vtoy_json_get_string
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT32 uiBufLen,
|
||||
char *pcBuf
|
||||
)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_STRING, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return JSON_NOT_FOUND;
|
||||
}
|
||||
|
||||
strcpy_s(pcBuf, uiBufLen, pstJsonItem->unData.pcStrVal);
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
const char * vtoy_json_get_string_ex(VTOY_JSON *pstJson, const char *szKey)
|
||||
{
|
||||
VTOY_JSON *pstJsonItem = NULL;
|
||||
|
||||
if ((NULL == pstJson) || (NULL == szKey))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pstJsonItem = vtoy_json_find_item(pstJson, JSON_TYPE_STRING, szKey);
|
||||
if (NULL == pstJsonItem)
|
||||
{
|
||||
Log("Key %s is not found in json data.", szKey);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pstJsonItem->unData.pcStrVal;
|
||||
}
|
||||
|
||||
int vtoy_json_destroy(VTOY_JSON *pstJson)
|
||||
{
|
||||
if (NULL == pstJson)
|
||||
{
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
if (NULL != pstJson->pstChild)
|
||||
{
|
||||
vtoy_json_free(pstJson->pstChild);
|
||||
}
|
||||
|
||||
if (NULL != pstJson->pstNext)
|
||||
{
|
||||
vtoy_json_free(pstJson->pstNext);
|
||||
}
|
||||
|
||||
free(pstJson);
|
||||
|
||||
return JSON_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#ifdef FOR_VTOY_JSON_CHECK
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
int ret = 1;
|
||||
int FileSize;
|
||||
FILE *fp;
|
||||
void *Data = NULL;
|
||||
VTOY_JSON *json = NULL;
|
||||
|
||||
fp = fopen(argv[1], "rb");
|
||||
if (!fp)
|
||||
{
|
||||
Log("Failed to open %s\n", argv[1]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
FileSize = (int)ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
Data = malloc(FileSize + 4);
|
||||
if (!Data)
|
||||
{
|
||||
Log("Failed to malloc %d\n", FileSize + 4);
|
||||
goto out;
|
||||
}
|
||||
*((char *)Data + FileSize) = 0;
|
||||
|
||||
fread(Data, 1, FileSize, fp);
|
||||
|
||||
json = vtoy_json_create();
|
||||
if (!json)
|
||||
{
|
||||
Log("Failed vtoy_json_create\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vtoy_json_parse(json, (char *)Data) != JSON_SUCCESS)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
if (fp) fclose(fp);
|
||||
if (Data) free(Data);
|
||||
if (json) vtoy_json_destroy(json);
|
||||
|
||||
printf("\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
164
Ventoy2Disk/Ventoy2Disk/VentoyJson.h
Normal file
164
Ventoy2Disk/Ventoy2Disk/VentoyJson.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/******************************************************************************
|
||||
* VentoyJson.h
|
||||
*
|
||||
* Copyright (c) 2021, 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __VENTOY_JSON_H__
|
||||
#define __VENTOY_JSON_H__
|
||||
|
||||
#ifdef FOR_VTOY_JSON_CHECK
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
typedef unsigned long long UINT64;
|
||||
|
||||
#define Log printf
|
||||
#define strcpy_s(a, b, c) strncpy(a, c, b)
|
||||
#define sprintf_s snprintf
|
||||
#endif
|
||||
|
||||
#define JSON_SUCCESS 0
|
||||
#define JSON_FAILED 1
|
||||
#define JSON_NOT_FOUND 2
|
||||
|
||||
typedef enum _JSON_TYPE
|
||||
{
|
||||
JSON_TYPE_NUMBER = 0,
|
||||
JSON_TYPE_STRING,
|
||||
JSON_TYPE_BOOL,
|
||||
JSON_TYPE_ARRAY,
|
||||
JSON_TYPE_OBJECT,
|
||||
JSON_TYPE_NULL,
|
||||
JSON_TYPE_BUTT
|
||||
}JSON_TYPE;
|
||||
|
||||
|
||||
typedef struct _VTOY_JSON
|
||||
{
|
||||
struct _VTOY_JSON *pstPrev;
|
||||
struct _VTOY_JSON *pstNext;
|
||||
struct _VTOY_JSON *pstChild;
|
||||
|
||||
JSON_TYPE enDataType;
|
||||
union
|
||||
{
|
||||
char *pcStrVal;
|
||||
int iNumVal;
|
||||
UINT64 lValue;
|
||||
}unData;
|
||||
|
||||
char *pcName;
|
||||
}VTOY_JSON;
|
||||
|
||||
typedef struct _JSON_PARSE
|
||||
{
|
||||
char *pcKey;
|
||||
void *pDataBuf;
|
||||
UINT32 uiBufSize;
|
||||
}JSON_PARSE;
|
||||
|
||||
#define JSON_NEW_ITEM(pstJson, ret) \
|
||||
{ \
|
||||
(pstJson) = (VTOY_JSON *)malloc(sizeof(VTOY_JSON)); \
|
||||
if (NULL == (pstJson)) \
|
||||
{ \
|
||||
Log("Failed to alloc memory for json.\n"); \
|
||||
return (ret); \
|
||||
} \
|
||||
memset((pstJson), 0, sizeof(VTOY_JSON));\
|
||||
}
|
||||
|
||||
VTOY_JSON *vtoy_json_find_item
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
JSON_TYPE enDataType,
|
||||
const char *szKey
|
||||
);
|
||||
int vtoy_json_parse_value
|
||||
(
|
||||
char *pcNewStart,
|
||||
char *pcRawStart,
|
||||
VTOY_JSON *pstJson,
|
||||
const char *pcData,
|
||||
const char **ppcEnd
|
||||
);
|
||||
VTOY_JSON * vtoy_json_create(void);
|
||||
int vtoy_json_parse(VTOY_JSON *pstJson, const char *szJsonData);
|
||||
|
||||
int vtoy_json_scan_parse
|
||||
(
|
||||
const VTOY_JSON *pstJson,
|
||||
UINT32 uiParseNum,
|
||||
JSON_PARSE *pstJsonParse
|
||||
);
|
||||
|
||||
int vtoy_json_scan_array
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstArrayItem
|
||||
);
|
||||
|
||||
int vtoy_json_scan_array_ex
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstArrayItem
|
||||
);
|
||||
int vtoy_json_scan_object
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
VTOY_JSON **ppstObjectItem
|
||||
);
|
||||
int vtoy_json_get_int
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
int *piValue
|
||||
);
|
||||
int vtoy_json_get_uint
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT32 *puiValue
|
||||
);
|
||||
int vtoy_json_get_uint64
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT64 *pui64Value
|
||||
);
|
||||
int vtoy_json_get_bool
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT8 *pbValue
|
||||
);
|
||||
int vtoy_json_get_string
|
||||
(
|
||||
VTOY_JSON *pstJson,
|
||||
const char *szKey,
|
||||
UINT32 uiBufLen,
|
||||
char *pcBuf
|
||||
);
|
||||
const char * vtoy_json_get_string_ex(VTOY_JSON *pstJson, const char *szKey);
|
||||
int vtoy_json_destroy(VTOY_JSON *pstJson);
|
||||
|
||||
#endif /* __VENTOY_JSON_H__ */
|
||||
|
Binary file not shown.
@@ -435,43 +435,6 @@ static int vtoy_printf_iso_path(ventoy_os_param *param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
|
||||
{
|
||||
int cnt = 0;
|
||||
char *path = param->vtoy_img_path;
|
||||
const char *fs;
|
||||
|
||||
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
|
||||
if (cnt > 1)
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
}
|
||||
else if (cnt == 0)
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
|
||||
}
|
||||
|
||||
if (param->vtoy_disk_part_type < ventoy_fs_max)
|
||||
{
|
||||
fs = g_ventoy_fs[param->vtoy_disk_part_type];
|
||||
}
|
||||
else
|
||||
{
|
||||
fs = "unknown";
|
||||
}
|
||||
|
||||
if (1 == cnt)
|
||||
{
|
||||
printf("/dev/%s#%s#%s\n", diskname, fs, path);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int vtoy_check_device(ventoy_os_param *param, const char *device)
|
||||
{
|
||||
unsigned long long size;
|
||||
@@ -499,6 +462,81 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
|
||||
}
|
||||
}
|
||||
|
||||
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
|
||||
{
|
||||
int fd, size;
|
||||
int cnt = 0;
|
||||
char *path = param->vtoy_img_path;
|
||||
const char *fs;
|
||||
char diskpath[256] = {0};
|
||||
char sizebuf[64] = {0};
|
||||
|
||||
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
|
||||
debug("find disk by size %llu, cnt=%d...\n", (unsigned long long)param->vtoy_disk_size, cnt);
|
||||
if (1 == cnt)
|
||||
{
|
||||
if (vtoy_check_device(param, diskname) != 0)
|
||||
{
|
||||
cnt = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = vtoy_find_disk_by_guid(param, diskname);
|
||||
debug("find disk by guid cnt=%d...\n", cnt);
|
||||
}
|
||||
|
||||
if (param->vtoy_disk_part_type < ventoy_fs_max)
|
||||
{
|
||||
fs = g_ventoy_fs[param->vtoy_disk_part_type];
|
||||
}
|
||||
else
|
||||
{
|
||||
fs = "unknown";
|
||||
}
|
||||
|
||||
if (1 == cnt)
|
||||
{
|
||||
if (strstr(diskname, "nvme") || strstr(diskname, "mmc") || strstr(diskname, "nbd"))
|
||||
{
|
||||
snprintf(diskpath, sizeof(diskpath) - 1, "/sys/class/block/%sp2/size", diskname);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(diskpath, sizeof(diskpath) - 1, "/sys/class/block/%s2/size", diskname);
|
||||
}
|
||||
|
||||
if (access(diskpath, F_OK) >= 0)
|
||||
{
|
||||
debug("get part size from sysfs for %s\n", diskpath);
|
||||
|
||||
fd = open(diskpath, O_RDONLY | O_BINARY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
read(fd, sizebuf, sizeof(sizebuf));
|
||||
size = (int)strtoull(sizebuf, NULL, 10);
|
||||
close(fd);
|
||||
if ((size != (64 * 1024)) && (size != (8 * 1024)))
|
||||
{
|
||||
debug("sizebuf=<%s> size=%d\n", sizebuf, size);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("%s not exist \n", diskpath);
|
||||
}
|
||||
|
||||
printf("/dev/%s#%s#%s\n", diskname, fs, path);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find disk and image path from ventoy runtime data.
|
||||
* By default data is read from phymem(legacy bios) or efivar(UEFI), if -f is input, data is read from file.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user