mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 09:01:15 +00:00
Compare commits
59 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
99fbd14f08 | ||
|
1c5aeb35dc | ||
|
f7b3bd1729 | ||
|
672632a0c2 | ||
|
d07aa6ce07 | ||
|
93996cf7e2 | ||
|
ca62128f9b | ||
|
265b70f1c7 | ||
|
491f0bea8a | ||
|
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 |
@@ -148,7 +148,7 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
|
||||
ventoy_override_chunk *pOverride = g_override_chunk;
|
||||
EFI_BLOCK_IO_PROTOCOL *pRawBlockIo = gBlockData.pRawBlockIo;
|
||||
|
||||
debug("read iso sector %lu count %u", Sector, Count);
|
||||
debug("read iso sector %lu count %u Buffer:%p Align:%u", Sector, Count, Buffer, pRawBlockIo->Media->IoAlign);
|
||||
|
||||
ReadStart = Sector * 2048;
|
||||
ReadEnd = (Sector + Count) * 2048;
|
||||
@@ -173,7 +173,6 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
|
||||
{
|
||||
MapLba = ((Sector - pchunk->img_start_sector) >> 1) + pchunk->disk_start_sector;
|
||||
}
|
||||
|
||||
|
||||
secLeft = pchunk->img_end_sector + 1 - Sector;
|
||||
secRead = (Count < secLeft) ? Count : secLeft;
|
||||
@@ -182,7 +181,7 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
|
||||
MapLba, secRead * 2048, pCurBuf);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
debug("Raw disk read block failed %r LBA:%lu Count:%u", Status, MapLba, secRead);
|
||||
debug("Raw disk read block failed %r LBA:%lu Count:%u %p", Status, MapLba, secRead, pCurBuf);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -425,7 +424,7 @@ end:
|
||||
return Lba;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
EFI_STATUS EFIAPI ventoy_block_io_read_real
|
||||
(
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
@@ -438,6 +437,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;
|
||||
@@ -445,7 +446,7 @@ EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
ventoy_sector_flag *cur_flag;
|
||||
ventoy_virt_chunk *node;
|
||||
|
||||
//debug("### ventoy_block_io_read sector:%u count:%u", (UINT32)Lba, (UINT32)BufferSize / 2048);
|
||||
debug("### block_io_read_real sector:%u count:%u Buffer:%p", (UINT32)Lba, (UINT32)BufferSize / 2048, Buffer);
|
||||
|
||||
secNum = BufferSize / 2048;
|
||||
|
||||
@@ -461,6 +462,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)
|
||||
{
|
||||
@@ -529,6 +550,42 @@ EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI ventoy_block_io_read
|
||||
(
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
UINT32 IoAlign = 0;
|
||||
VOID *NewBuf = NULL;
|
||||
EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
|
||||
|
||||
if (gBlockData.pRawBlockIo && gBlockData.pRawBlockIo->Media)
|
||||
{
|
||||
IoAlign = gBlockData.pRawBlockIo->Media->IoAlign;
|
||||
}
|
||||
|
||||
if ((IoAlign == 0) || (((UINTN) Buffer & (IoAlign - 1)) == 0))
|
||||
{
|
||||
Status = ventoy_block_io_read_real(This, MediaId, Lba, BufferSize, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewBuf = AllocatePages(EFI_SIZE_TO_PAGES(BufferSize + IoAlign));
|
||||
if (NewBuf)
|
||||
{
|
||||
Status = ventoy_block_io_read_real(This, MediaId, Lba, BufferSize, NewBuf);
|
||||
CopyMem(Buffer, NewBuf, BufferSize);
|
||||
FreePages(NewBuf, EFI_SIZE_TO_PAGES(BufferSize + IoAlign));
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI ventoy_block_io_write
|
||||
(
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
@@ -698,7 +755,7 @@ EFI_STATUS EFIAPI ventoy_block_io_read_512
|
||||
UINT8 *CurBuf = NULL;
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
debug("ventoy_block_io_read_512 %lu %lu\n", Lba, BufferSize / 512);
|
||||
debug("ventoy_block_io_read_512 %lu %lu Buffer:%p\n", Lba, BufferSize / 512, Buffer);
|
||||
|
||||
CurBuf = (UINT8 *)Buffer;
|
||||
|
||||
|
@@ -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,8 @@
|
||||
|
||||
extern int g_ventoy_memdisk_mode;
|
||||
extern int g_ventoy_iso_raw;
|
||||
extern int g_ventoy_grub2_mode;
|
||||
extern int g_ventoy_wimboot_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
|
||||
static const char *align_options[] =
|
||||
@@ -205,6 +207,12 @@ 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_WIMBOOT_MODE@") == 0) {
|
||||
value = g_ventoy_wimboot_mode ? grub_env_get("VTOY_WIMBOOT_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") : " ";
|
||||
}
|
||||
|
@@ -964,3 +964,20 @@ void * grub_efi_allocate_iso_buf(grub_uint64_t size)
|
||||
|
||||
return (void *)(unsigned long)address;
|
||||
}
|
||||
|
||||
void * grub_efi_allocate_chain_buf(grub_uint64_t size)
|
||||
{
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_efi_status_t status;
|
||||
grub_efi_physical_address_t address = 0;
|
||||
grub_efi_uintn_t pages = GRUB_EFI_BYTES_TO_PAGES(size);
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_DATA, pages, &address);
|
||||
if (status != GRUB_EFI_SUCCESS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (void *)(unsigned long)address;
|
||||
}
|
||||
|
@@ -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)
|
||||
|
316
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/linux.c
Normal file
316
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/linux.c
Normal file
@@ -0,0 +1,316 @@
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/linux.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
struct newc_head
|
||||
{
|
||||
char magic[6];
|
||||
char ino[8];
|
||||
char mode[8];
|
||||
char uid[8];
|
||||
char gid[8];
|
||||
char nlink[8];
|
||||
char mtime[8];
|
||||
char filesize[8];
|
||||
char devmajor[8];
|
||||
char devminor[8];
|
||||
char rdevmajor[8];
|
||||
char rdevminor[8];
|
||||
char namesize[8];
|
||||
char check[8];
|
||||
} GRUB_PACKED;
|
||||
|
||||
struct grub_linux_initrd_component
|
||||
{
|
||||
grub_file_t file;
|
||||
char *newc_name;
|
||||
grub_off_t size;
|
||||
};
|
||||
|
||||
struct dir
|
||||
{
|
||||
char *name;
|
||||
struct dir *next;
|
||||
struct dir *child;
|
||||
};
|
||||
|
||||
static char
|
||||
hex (grub_uint8_t val)
|
||||
{
|
||||
if (val < 10)
|
||||
return '0' + val;
|
||||
return 'a' + val - 10;
|
||||
}
|
||||
|
||||
static void
|
||||
set_field (char *var, grub_uint32_t val)
|
||||
{
|
||||
int i;
|
||||
char *ptr = var;
|
||||
for (i = 28; i >= 0; i -= 4)
|
||||
*ptr++ = hex((val >> i) & 0xf);
|
||||
}
|
||||
|
||||
static grub_uint8_t *
|
||||
make_header (grub_uint8_t *ptr,
|
||||
const char *name, grub_size_t len,
|
||||
grub_uint32_t mode,
|
||||
grub_off_t fsize)
|
||||
{
|
||||
struct newc_head *head = (struct newc_head *) ptr;
|
||||
grub_uint8_t *optr;
|
||||
grub_size_t oh = 0;
|
||||
grub_memcpy (head->magic, "070701", 6);
|
||||
set_field (head->ino, 0);
|
||||
set_field (head->mode, mode);
|
||||
set_field (head->uid, 0);
|
||||
set_field (head->gid, 0);
|
||||
set_field (head->nlink, 1);
|
||||
set_field (head->mtime, 0);
|
||||
set_field (head->filesize, fsize);
|
||||
set_field (head->devmajor, 0);
|
||||
set_field (head->devminor, 0);
|
||||
set_field (head->rdevmajor, 0);
|
||||
set_field (head->rdevminor, 0);
|
||||
set_field (head->namesize, len);
|
||||
set_field (head->check, 0);
|
||||
optr = ptr;
|
||||
ptr += sizeof (struct newc_head);
|
||||
grub_memcpy (ptr, name, len);
|
||||
ptr += len;
|
||||
oh = ALIGN_UP_OVERHEAD (ptr - optr, 4);
|
||||
grub_memset (ptr, 0, oh);
|
||||
ptr += oh;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
free_dir (struct dir *root)
|
||||
{
|
||||
if (!root)
|
||||
return;
|
||||
free_dir (root->next);
|
||||
free_dir (root->child);
|
||||
grub_free (root->name);
|
||||
grub_free (root);
|
||||
}
|
||||
|
||||
static grub_size_t
|
||||
insert_dir (const char *name, struct dir **root,
|
||||
grub_uint8_t *ptr)
|
||||
{
|
||||
struct dir *cur, **head = root;
|
||||
const char *cb, *ce = name;
|
||||
grub_size_t size = 0;
|
||||
while (1)
|
||||
{
|
||||
for (cb = ce; *cb == '/'; cb++);
|
||||
for (ce = cb; *ce && *ce != '/'; ce++);
|
||||
if (!*ce)
|
||||
break;
|
||||
|
||||
for (cur = *root; cur; cur = cur->next)
|
||||
if (grub_memcmp (cur->name, cb, ce - cb)
|
||||
&& cur->name[ce - cb] == 0)
|
||||
break;
|
||||
if (!cur)
|
||||
{
|
||||
struct dir *n;
|
||||
n = grub_zalloc (sizeof (*n));
|
||||
if (!n)
|
||||
return 0;
|
||||
n->next = *head;
|
||||
n->name = grub_strndup (cb, ce - cb);
|
||||
if (ptr)
|
||||
{
|
||||
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
|
||||
ptr = make_header (ptr, name, ce - name,
|
||||
040777, 0);
|
||||
}
|
||||
size += ALIGN_UP ((ce - (char *) name)
|
||||
+ sizeof (struct newc_head), 4);
|
||||
*head = n;
|
||||
cur = n;
|
||||
}
|
||||
root = &cur->next;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_initrd_init (int argc, char *argv[],
|
||||
struct grub_linux_initrd_context *initrd_ctx)
|
||||
{
|
||||
int i;
|
||||
int newc = 0;
|
||||
struct dir *root = 0;
|
||||
|
||||
initrd_ctx->nfiles = 0;
|
||||
initrd_ctx->components = 0;
|
||||
|
||||
initrd_ctx->components = grub_zalloc (argc
|
||||
* sizeof (initrd_ctx->components[0]));
|
||||
if (!initrd_ctx->components)
|
||||
return grub_errno;
|
||||
|
||||
initrd_ctx->size = 0;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
const char *fname = argv[i];
|
||||
|
||||
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
||||
|
||||
if (grub_memcmp (argv[i], "newc:", 5) == 0)
|
||||
{
|
||||
const char *ptr, *eptr;
|
||||
ptr = argv[i] + 5;
|
||||
while (*ptr == '/')
|
||||
ptr++;
|
||||
eptr = grub_strchr (ptr, ':');
|
||||
if (eptr)
|
||||
{
|
||||
initrd_ctx->components[i].newc_name = grub_strndup (ptr, eptr - ptr);
|
||||
if (!initrd_ctx->components[i].newc_name)
|
||||
{
|
||||
grub_initrd_close (initrd_ctx);
|
||||
return grub_errno;
|
||||
}
|
||||
initrd_ctx->size
|
||||
+= ALIGN_UP (sizeof (struct newc_head)
|
||||
+ grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
4);
|
||||
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
&root, 0);
|
||||
newc = 1;
|
||||
fname = eptr + 1;
|
||||
}
|
||||
}
|
||||
else if (newc)
|
||||
{
|
||||
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
+ sizeof ("TRAILER!!!") - 1, 4);
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
newc = 0;
|
||||
}
|
||||
initrd_ctx->components[i].file = grub_file_open (fname,
|
||||
GRUB_FILE_TYPE_LINUX_INITRD
|
||||
| GRUB_FILE_TYPE_NO_DECOMPRESS);
|
||||
if (!initrd_ctx->components[i].file)
|
||||
{
|
||||
grub_initrd_close (initrd_ctx);
|
||||
return grub_errno;
|
||||
}
|
||||
initrd_ctx->nfiles++;
|
||||
initrd_ctx->components[i].size
|
||||
= grub_file_size (initrd_ctx->components[i].file);
|
||||
initrd_ctx->size += initrd_ctx->components[i].size;
|
||||
}
|
||||
|
||||
if (newc)
|
||||
{
|
||||
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
||||
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
+ sizeof ("TRAILER!!!") - 1, 4);
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_size_t
|
||||
grub_get_initrd_size (struct grub_linux_initrd_context *initrd_ctx)
|
||||
{
|
||||
return initrd_ctx->size;
|
||||
}
|
||||
|
||||
void
|
||||
grub_initrd_close (struct grub_linux_initrd_context *initrd_ctx)
|
||||
{
|
||||
int i;
|
||||
if (!initrd_ctx->components)
|
||||
return;
|
||||
for (i = 0; i < initrd_ctx->nfiles; i++)
|
||||
{
|
||||
grub_free (initrd_ctx->components[i].newc_name);
|
||||
grub_file_close (initrd_ctx->components[i].file);
|
||||
}
|
||||
grub_free (initrd_ctx->components);
|
||||
initrd_ctx->components = 0;
|
||||
}
|
||||
|
||||
extern int ventoy_need_prompt_load_file(void);
|
||||
extern grub_ssize_t ventoy_load_file_with_prompt(grub_file_t file, void *buf, grub_ssize_t size);
|
||||
grub_err_t
|
||||
grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
||||
char *argv[], void *target)
|
||||
{
|
||||
grub_uint8_t *ptr = target;
|
||||
int i;
|
||||
int newc = 0;
|
||||
struct dir *root = 0;
|
||||
grub_ssize_t cursize = 0;
|
||||
grub_ssize_t readsize = 0;
|
||||
|
||||
for (i = 0; i < initrd_ctx->nfiles; i++)
|
||||
{
|
||||
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
||||
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
||||
|
||||
if (initrd_ctx->components[i].newc_name)
|
||||
{
|
||||
ptr += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
&root, ptr);
|
||||
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
|
||||
grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
0100777,
|
||||
initrd_ctx->components[i].size);
|
||||
newc = 1;
|
||||
}
|
||||
else if (newc)
|
||||
{
|
||||
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1,
|
||||
0, 0);
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
newc = 0;
|
||||
}
|
||||
|
||||
cursize = initrd_ctx->components[i].size;
|
||||
if (ventoy_need_prompt_load_file() && initrd_ctx->components[i].newc_name &&
|
||||
grub_strcmp(initrd_ctx->components[i].newc_name, "boot.wim") == 0)
|
||||
{
|
||||
readsize = ventoy_load_file_with_prompt(initrd_ctx->components[i].file, ptr, cursize);
|
||||
}
|
||||
else
|
||||
{
|
||||
readsize = grub_file_read (initrd_ctx->components[i].file, ptr, cursize);
|
||||
}
|
||||
|
||||
if (readsize != cursize)
|
||||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
argv[i]);
|
||||
grub_initrd_close (initrd_ctx);
|
||||
return grub_errno;
|
||||
}
|
||||
ptr += cursize;
|
||||
}
|
||||
if (newc)
|
||||
{
|
||||
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
||||
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
||||
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
|
||||
}
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
@@ -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,14 @@
|
||||
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_wimboot_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 +874,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 ();
|
||||
if (g_ventoy_terminal_output == 0)
|
||||
{
|
||||
menu_fini ();
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
goto refresh;
|
||||
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 +899,18 @@ 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 | 'w'):
|
||||
menu_fini ();
|
||||
g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_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
4606
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
Normal file
4606
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,8 @@
|
||||
|
||||
#define VTOY_SIZE_1GB 1073741824
|
||||
#define VTOY_SIZE_1MB (1024 * 1024)
|
||||
#define VTOY_SIZE_2MB (2 * 1024 * 1024)
|
||||
#define VTOY_SIZE_4MB (4 * 1024 * 1024)
|
||||
#define VTOY_SIZE_512KB (512 * 1024)
|
||||
#define VTOY_SIZE_1KB 1024
|
||||
|
||||
@@ -76,6 +78,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 +142,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
|
||||
@@ -179,12 +196,14 @@ typedef struct ventoy_iso9660_vd
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define img_type_iso 0
|
||||
#define img_type_wim 1
|
||||
#define img_type_efi 2
|
||||
#define img_type_img 3
|
||||
#define img_type_vhd 4
|
||||
#define img_type_vtoy 5
|
||||
#define img_type_start 0
|
||||
#define img_type_iso 0
|
||||
#define img_type_wim 1
|
||||
#define img_type_efi 2
|
||||
#define img_type_img 3
|
||||
#define img_type_vhd 4
|
||||
#define img_type_vtoy 5
|
||||
#define img_type_max 6
|
||||
|
||||
typedef struct img_info
|
||||
{
|
||||
@@ -267,10 +286,11 @@ extern ventoy_img_chunk_list g_img_chunk_list;
|
||||
extern ventoy_img_chunk_list g_wimiso_chunk_list;
|
||||
extern char *g_wimiso_path;
|
||||
extern char g_arch_mode_suffix[64];
|
||||
extern const char *g_menu_prefix[img_type_max];
|
||||
|
||||
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 +396,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 +533,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);
|
||||
@@ -529,10 +559,16 @@ int ventoy_is_dir_exist(const char *fmt, ...);
|
||||
int ventoy_fill_data(grub_uint32_t buflen, char *buffer);
|
||||
grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_wimdows_reset(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_is_pe64(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_sel_wimboot(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_set_wim_prompt(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_ssize_t ventoy_load_file_with_prompt(grub_file_t file, void *buf, grub_ssize_t size);
|
||||
int ventoy_need_prompt_load_file(void);
|
||||
|
||||
VTOY_JSON *vtoy_json_find_item
|
||||
(
|
||||
@@ -806,6 +842,7 @@ typedef struct menu_class
|
||||
{
|
||||
int type;
|
||||
int patlen;
|
||||
int parent;
|
||||
char pattern[256];
|
||||
char class[64];
|
||||
|
||||
@@ -874,8 +911,12 @@ typedef struct vtoy_password
|
||||
grub_uint8_t md5[16];
|
||||
}vtoy_password;
|
||||
|
||||
#define vtoy_menu_pwd_file 0
|
||||
#define vtoy_menu_pwd_parent 1
|
||||
|
||||
typedef struct menu_password
|
||||
{
|
||||
int type;
|
||||
int pathlen;
|
||||
char isopath[256];
|
||||
|
||||
@@ -889,6 +930,8 @@ 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_wimboot_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
extern int g_ventoy_case_insensitive;
|
||||
extern grub_uint8_t g_ventoy_chain_type;
|
||||
@@ -906,6 +949,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 +968,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 +1008,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 +1017,18 @@ 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);
|
||||
int ventoy_chain_file_size(const char *path);
|
||||
int ventoy_chain_file_read(const char *path, int offset, int len, void *buf);
|
||||
|
||||
#define VTOY_CMD_CHECK(a) if (33554432 != g_ventoy_disk_part_size[a]) ventoy_syscall0(exit)
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
@@ -43,6 +43,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
char g_arch_mode_suffix[64];
|
||||
static char g_iso_disk_name[128];
|
||||
static vtoy_password g_boot_pwd;
|
||||
static vtoy_password g_file_type_pwd[img_type_max];
|
||||
static install_template *g_install_template_head = NULL;
|
||||
static dud *g_dud_head = NULL;
|
||||
static menu_password *g_pwd_head = NULL;
|
||||
@@ -481,6 +482,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 +502,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 +602,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 +622,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
|
||||
@@ -805,8 +810,26 @@ static int ventoy_plugin_parse_pwdstr(char *pwdstr, vtoy_password *pwd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ventoy_plugin_get_pwd_type(const char *pwd)
|
||||
{
|
||||
int i;
|
||||
char pwdtype[64];
|
||||
|
||||
for (i = 0; pwd && i < (int)ARRAY_SIZE(g_menu_prefix); i++)
|
||||
{
|
||||
grub_snprintf(pwdtype, sizeof(pwdtype), "%spwd", g_menu_prefix[i]);
|
||||
if (grub_strcmp(pwdtype, pwd) == 0)
|
||||
{
|
||||
return img_type_start + i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int type = -1;
|
||||
const char *iso = NULL;
|
||||
const char *pwd = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
@@ -840,6 +863,10 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
ventoy_plugin_parse_pwdstr(pNode->unData.pcStrVal, &g_boot_pwd);
|
||||
}
|
||||
else if ((type = ventoy_plugin_get_pwd_type(pNode->pcName)) >= 0)
|
||||
{
|
||||
ventoy_plugin_parse_pwdstr(pNode->unData.pcStrVal, g_file_type_pwd + type);
|
||||
}
|
||||
else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0)
|
||||
{
|
||||
for (pCNode = pNode->pstChild; pCNode; pCNode = pCNode->pstNext)
|
||||
@@ -849,13 +876,21 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
|
||||
continue;
|
||||
}
|
||||
|
||||
type = vtoy_menu_pwd_file;
|
||||
iso = vtoy_json_get_string_ex(pCNode->pstChild, "file");
|
||||
if (!iso)
|
||||
{
|
||||
type = vtoy_menu_pwd_parent;
|
||||
iso = vtoy_json_get_string_ex(pCNode->pstChild, "parent");
|
||||
}
|
||||
|
||||
pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd");
|
||||
if (iso && pwd && iso[0] == '/')
|
||||
{
|
||||
node = grub_zalloc(sizeof(menu_password));
|
||||
if (node)
|
||||
{
|
||||
node->type = type;
|
||||
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", iso);
|
||||
|
||||
if (ventoy_plugin_parse_pwdstr((char *)pwd, &(node->password)))
|
||||
@@ -884,6 +919,8 @@ static int ventoy_plugin_pwd_entry(VTOY_JSON *json, const char *isodisk)
|
||||
|
||||
static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
|
||||
{
|
||||
int type = -1;
|
||||
char *pos = NULL;
|
||||
const char *iso = NULL;
|
||||
const char *pwd = NULL;
|
||||
VTOY_JSON *pNode = NULL;
|
||||
@@ -908,6 +945,17 @@ static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
|
||||
grub_printf("Invalid bootpwd.\n");
|
||||
}
|
||||
}
|
||||
else if ((type = ventoy_plugin_get_pwd_type(pNode->pcName)) >= 0)
|
||||
{
|
||||
if (0 == ventoy_plugin_parse_pwdstr(pNode->unData.pcStrVal, NULL))
|
||||
{
|
||||
grub_printf("%s:<%s>\n", pNode->pcName, pNode->unData.pcStrVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_printf("Invalid pwd <%s>\n", pNode->unData.pcStrVal);
|
||||
}
|
||||
}
|
||||
else if (pNode->pcName && grub_strcmp("menupwd", pNode->pcName) == 0)
|
||||
{
|
||||
grub_printf("\n");
|
||||
@@ -919,16 +967,36 @@ static int ventoy_plugin_pwd_check(VTOY_JSON *json, const char *isodisk)
|
||||
continue;
|
||||
}
|
||||
|
||||
iso = vtoy_json_get_string_ex(pCNode->pstChild, "file");
|
||||
if (iso)
|
||||
if ((iso = vtoy_json_get_string_ex(pCNode->pstChild, "file")) != NULL)
|
||||
{
|
||||
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
|
||||
{
|
||||
grub_printf("Invalid password for <%s>\n", iso);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_printf("<%s%s> not found\n", isodisk, iso);
|
||||
}
|
||||
}
|
||||
else if ((iso = vtoy_json_get_string_ex(pCNode->pstChild, "parent")) != NULL)
|
||||
{
|
||||
if (ventoy_is_dir_exist("%s%s", isodisk, iso))
|
||||
{
|
||||
pwd = vtoy_json_get_string_ex(pCNode->pstChild, "pwd");
|
||||
if (0 == ventoy_plugin_parse_pwdstr((char *)pwd, NULL))
|
||||
{
|
||||
grub_printf("dir:<%s> [%s]\n", iso, (pos ? "*" : "OK"));
|
||||
grub_printf("pwd:<%s>\n\n", pwd);
|
||||
}
|
||||
else
|
||||
@@ -956,6 +1024,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 +1044,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))
|
||||
@@ -1102,8 +1172,12 @@ static int ventoy_plugin_menualias_check(VTOY_JSON *json, const char *isodisk)
|
||||
if (path && path[0] == '/' && alias)
|
||||
{
|
||||
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 +1297,15 @@ static int ventoy_plugin_injection_check(VTOY_JSON *json, const char *isodisk)
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_printf("image: <%s> [%s]\n", path, ventoy_check_file_exist("%s%s", isodisk, path) ? "OK" : "NOT EXIST");
|
||||
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 +1367,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,12 +1396,21 @@ 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, "dir");
|
||||
type = vtoy_class_directory;
|
||||
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");
|
||||
@@ -1328,6 +1420,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 +1442,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 +1457,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)
|
||||
{
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "dir");
|
||||
type = vtoy_class_directory;
|
||||
name = "parent";
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "parent");
|
||||
if (!key)
|
||||
{
|
||||
name = "dir";
|
||||
key = vtoy_json_get_string_ex(pNode->pstChild, "dir");
|
||||
}
|
||||
}
|
||||
|
||||
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 +1709,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 +1807,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 +1851,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 +1901,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 +2107,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 +2147,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 +2228,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 +2251,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 +2260,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;
|
||||
@@ -2158,21 +2269,38 @@ 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)
|
||||
{
|
||||
return node->class;
|
||||
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 +2416,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 +2442,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 +2473,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 +2495,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;
|
||||
}
|
||||
@@ -2409,20 +2537,60 @@ int ventoy_plugin_load_dud(dud *node, const char *isopart)
|
||||
|
||||
static const vtoy_password * ventoy_plugin_get_password(const char *isopath)
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
const char *pos = NULL;
|
||||
menu_password *node = NULL;
|
||||
|
||||
if ((!g_pwd_head) || (!isopath))
|
||||
if (!isopath)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_pwd_head; node; node = node->next)
|
||||
if (g_pwd_head)
|
||||
{
|
||||
if (node->pathlen == len && grub_strncmp(isopath, node->isopath, len) == 0)
|
||||
len = (int)grub_strlen(isopath);
|
||||
for (node = g_pwd_head; node; node = node->next)
|
||||
{
|
||||
return &(node->password);
|
||||
if (node->type == vtoy_menu_pwd_file)
|
||||
{
|
||||
if (node->pathlen == len && ventoy_strncmp(node->isopath, isopath, len) == 0)
|
||||
{
|
||||
return &(node->password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (node = g_pwd_head; node; node = node->next)
|
||||
{
|
||||
if (node->type == vtoy_menu_pwd_parent)
|
||||
{
|
||||
if (node->pathlen < len && (isopath[node->pathlen] == '/') &&
|
||||
ventoy_strncmp(node->isopath, isopath, node->pathlen) == 0)
|
||||
{
|
||||
return &(node->password);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (*isopath)
|
||||
{
|
||||
if (*isopath == '.')
|
||||
{
|
||||
pos = isopath;
|
||||
}
|
||||
isopath++;
|
||||
}
|
||||
|
||||
if (pos)
|
||||
{
|
||||
for (i = 0; i < (int)ARRAY_SIZE(g_menu_prefix); i++)
|
||||
{
|
||||
if (g_file_type_pwd[i].type && 0 == grub_strcasecmp(pos + 1, g_menu_prefix[i]))
|
||||
{
|
||||
return g_file_type_pwd + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
ventoy_vhd_patch_disk(patch1, patch2);
|
||||
ventoy_vhd_patch_path(args[0], patch1, patch2);
|
||||
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]);
|
||||
|
||||
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)
|
||||
@@ -396,7 +543,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
|
||||
}
|
||||
|
||||
grub_env_set(args[1], type);
|
||||
debug("<%s> vtoy type: <%s> ", args[0], type);
|
||||
debug("<%s> vtoy type: <%s> offset:%d\n", args[0], type, offset);
|
||||
|
||||
if (offset >= 0)
|
||||
{
|
||||
@@ -451,6 +598,14 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
|
||||
altboot = 1;
|
||||
grub_env_set(args[3], "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("offset data=0x%x\n", data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("BootCode: 0x%x\n", gpt->MBR.BootCode[92]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -314,6 +314,90 @@ static int ventoy_is_pe64(grub_uint8_t *buffer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_is_pe64(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int ret = 1;
|
||||
grub_file_t file;
|
||||
grub_uint8_t buf[512];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
file = grub_file_open(args[0], VENTOY_FILE_TYPE);
|
||||
if (!file)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, 512);
|
||||
grub_file_read(file, buf, 512);
|
||||
if (ventoy_is_pe64(buf))
|
||||
{
|
||||
debug("%s is PE64\n", args[0]);
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("%s is PE32\n", args[0]);
|
||||
}
|
||||
grub_file_close(file);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_sel_wimboot(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int size;
|
||||
char *buf = NULL;
|
||||
char configfile[128];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
debug("select wimboot argc:%d\n", argc);
|
||||
|
||||
buf = (char *)grub_malloc(8192);
|
||||
if (!buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = (int)grub_snprintf(buf, 8192,
|
||||
"menuentry \"Windows Setup (32-bit)\" {\n"
|
||||
" set vtoy_wimboot_sel=32\n"
|
||||
"}\n"
|
||||
"menuentry \"Windows Setup (64-bit)\" {\n"
|
||||
" set vtoy_wimboot_sel=64\n"
|
||||
"}\n"
|
||||
);
|
||||
buf[size] = 0;
|
||||
|
||||
g_ventoy_menu_esc = 1;
|
||||
g_ventoy_suppress_esc = 1;
|
||||
|
||||
grub_snprintf(configfile, sizeof(configfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)buf, size);
|
||||
grub_script_execute_sourcecode(configfile);
|
||||
|
||||
g_ventoy_menu_esc = 0;
|
||||
g_ventoy_suppress_esc = 0;
|
||||
|
||||
grub_free(buf);
|
||||
|
||||
if (g_ventoy_last_entry == 0)
|
||||
{
|
||||
debug("last entry=%d %s=32\n", g_ventoy_last_entry, args[0]);
|
||||
grub_env_set(args[0], "32");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("last entry=%d %s=64\n", g_ventoy_last_entry, args[0]);
|
||||
grub_env_set(args[0], "64");
|
||||
}
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_wimdows_reset(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
wim_patch *next = NULL;
|
||||
@@ -636,6 +720,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))
|
||||
@@ -660,8 +759,15 @@ 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));
|
||||
}
|
||||
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len);
|
||||
|
||||
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 +966,14 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
|
||||
}
|
||||
|
||||
security = (wim_security_header *)decompress_data;
|
||||
rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U));
|
||||
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);
|
||||
@@ -1301,6 +1414,54 @@ end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_uint32_t size = 0;
|
||||
const char *addr = NULL;
|
||||
ventoy_chain_head *chain = NULL;
|
||||
ventoy_os_param *param = NULL;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
addr = grub_env_get("vtoy_chain_mem_addr");
|
||||
if (!addr)
|
||||
{
|
||||
debug("Failed to find vtoy_chain_mem_addr\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
chain = (ventoy_chain_head *)(void *)grub_strtoul(addr, NULL, 16);
|
||||
|
||||
if (grub_memcmp(&g_ventoy_guid, &chain->os_param.guid, 16) != 0)
|
||||
{
|
||||
debug("os_param.guid not match\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
size = sizeof(ventoy_os_param) + sizeof(ventoy_windows_data);
|
||||
param = (ventoy_os_param *)grub_zalloc(size);
|
||||
if (!param)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_memcpy(param, &chain->os_param, sizeof(ventoy_os_param));
|
||||
ventoy_fill_windows_rtdata(param + 1, param->vtoy_img_path);
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)param);
|
||||
grub_env_set("vtoy_wimboot_mem_addr", envbuf);
|
||||
debug("vtoy_wimboot_mem_addr: %s\n", envbuf);
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_wimboot_mem_size", envbuf);
|
||||
debug("vtoy_wimboot_mem_size: %s\n", envbuf);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int unknown_image = 0;
|
||||
@@ -1733,3 +1894,29 @@ grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
int ventoy_chain_file_size(const char *path)
|
||||
{
|
||||
int size;
|
||||
grub_file_t file;
|
||||
|
||||
file = grub_file_open(path, VENTOY_FILE_TYPE);
|
||||
size = (int)(file->size);
|
||||
|
||||
grub_file_close(file);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int ventoy_chain_file_read(const char *path, int offset, int len, void *buf)
|
||||
{
|
||||
int size;
|
||||
grub_file_t file;
|
||||
|
||||
file = grub_file_open(path, VENTOY_FILE_TYPE);
|
||||
grub_file_seek(file, offset);
|
||||
size = grub_file_read(file, buf, len);
|
||||
grub_file_close(file);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@@ -87,6 +87,7 @@ EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
||||
const grub_efi_device_path_t *dp2);
|
||||
|
||||
void * EXPORT_FUNC (grub_efi_allocate_iso_buf) (grub_uint64_t size);
|
||||
void * EXPORT_FUNC (grub_efi_allocate_chain_buf) (grub_uint64_t size);
|
||||
|
||||
|
||||
extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
|
||||
|
@@ -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)
|
||||
|
||||
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
|
||||
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"
|
||||
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,26 @@ 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 $GREP -i -q Fedora /proc/version; then
|
||||
if $GREP -q 'Server Edition' /etc/os-release; then
|
||||
vtNeedRepo="yes"
|
||||
fi
|
||||
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,12 +41,8 @@ if is_inotify_ventoy_part $3; then
|
||||
vtlog "find ventoy partition ..."
|
||||
|
||||
vtReplaceOpt=noreplace
|
||||
|
||||
if $GREP -q el8 /proc/version && [ -f /etc/system-release ]; then
|
||||
vtRhel8Ver=$($SED "s#.*8\.\([0-9]*\).*#\1#" /etc/system-release)
|
||||
if [ $vtRhel8Ver -ge 3 ]; then
|
||||
vtReplaceOpt=""
|
||||
fi
|
||||
if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then
|
||||
vtReplaceOpt=""
|
||||
fi
|
||||
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
|
||||
|
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)
|
||||
|
||||
echo "insmod $kv $kbit" >> $VTOY_PATH/log
|
||||
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dax.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dax.ko > /dev/null 2>&1
|
||||
[ -f /ventoy_openwrt/$kv/$kbit/dm-mod.ko ] && insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko > /dev/null 2>&1
|
||||
}
|
||||
|
||||
#$BUSYBOX_PATH/sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
|
||||
exec $BUSYBOX_PATH/sh
|
||||
mkdir /sys
|
||||
mount -t sysfs sys /sys
|
||||
mdev -s
|
||||
|
||||
|
||||
if [ -f /ventoy_openwrt.xz ]; then
|
||||
tar xf /ventoy_openwrt.xz -C /
|
||||
rm -f /ventoy_openwrt.xz
|
||||
fi
|
||||
|
||||
|
||||
if uname -m | egrep -q "amd64|x86_64"; then
|
||||
wrt_insmod 64
|
||||
else
|
||||
wrt_insmod generic
|
||||
if lsmod | grep -q 'dm-mod'; then
|
||||
echo "insmod generic failed" >> $VTOY_PATH/log
|
||||
else
|
||||
wrt_insmod legacy
|
||||
fi
|
||||
fi
|
||||
|
||||
sh $VTOY_PATH/loop/openwrt/ventoy-disk.sh
|
||||
|
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.
@@ -4,6 +4,7 @@ size=1024
|
||||
fstype=ext4
|
||||
label=casper-rw
|
||||
config=''
|
||||
outputfile=persistence.dat
|
||||
|
||||
print_usage() {
|
||||
echo 'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ] [ -c CFG ]'
|
||||
@@ -12,6 +13,7 @@ print_usage() {
|
||||
echo ' -t filesystem type, default is ext4 ext2/ext3/ext4/xfs are supported now'
|
||||
echo ' -l label, default is casper-rw'
|
||||
echo ' -c configfile name inside the persistence file. File content is "/ union"'
|
||||
echo ' -o outputfile name, default is persistence.dat'
|
||||
echo ''
|
||||
}
|
||||
|
||||
@@ -28,6 +30,9 @@ while [ -n "$1" ]; do
|
||||
elif [ "$1" = "-c" ]; then
|
||||
shift
|
||||
config=$1
|
||||
elif [ "$1" = "-o" ]; then
|
||||
shift
|
||||
outputfile=$1
|
||||
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
@@ -69,13 +74,17 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$outputdir" != "persistence.dat" ]; then
|
||||
mkdir -p "$(dirname "$outputfile")"
|
||||
fi
|
||||
|
||||
# 00->ff avoid sparse file
|
||||
dd if=/dev/zero bs=1M count=$size | tr '\000' '\377' > persistence.dat
|
||||
dd if=/dev/zero bs=1M count=$size | tr '\000' '\377' > "$outputfile"
|
||||
sync
|
||||
|
||||
freeloop=$(losetup -f)
|
||||
|
||||
losetup $freeloop persistence.dat
|
||||
losetup $freeloop "$outputfile"
|
||||
|
||||
mkfs -t $fstype $fsopt -L $label $freeloop
|
||||
|
||||
|
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
|
||||
@@ -23,7 +23,7 @@ sfs: fshelp
|
||||
reiserfs: fshelp
|
||||
part_sunpc:
|
||||
zstd:
|
||||
gfxmenu: video_colors trig bitmap_scale gfxterm font normal bitmap video
|
||||
gfxmenu: trig video_colors bitmap_scale gfxterm font normal bitmap video
|
||||
jfs:
|
||||
help: extcmd normal
|
||||
configfile: normal
|
||||
@@ -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
|
||||
|
||||
|
@@ -131,7 +131,7 @@ function get_os_type {
|
||||
function vt_check_compatible_pe {
|
||||
#Check for PE without external tools
|
||||
if [ -f "$1/HBCD_PE.ini" ]; then
|
||||
set ventoy_compatible=YES
|
||||
set ventoy_compatible=YES
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
set vt_freebsd_ver=11.x
|
||||
if vt_str_begin "$vt_volume_id" "1_"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif vt_str_begin "$vt_volume_id" "2_"; then
|
||||
set vt_freebsd_ver=2.x
|
||||
elif vt_str_begin "$vt_volume_id" "3_"; then
|
||||
set vt_freebsd_ver=3.x
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
set vtFreeBsdDistro=FreeBSD
|
||||
set vt_freebsd_ver=xx
|
||||
|
||||
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
|
||||
ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
|
||||
@@ -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
|
||||
@@ -431,10 +438,20 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
if [ -e (loop)/boot/kernel/kernel ]; then
|
||||
vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
|
||||
fi
|
||||
|
||||
if [ "$vt_freebsd_ver" = "xx" ]; then
|
||||
set vt_freebsd_ver=13.x
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
unset vt_unix_mod_path
|
||||
@@ -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}"
|
||||
}
|
||||
@@ -522,6 +535,10 @@ function uefi_windows_menu_func {
|
||||
vt_windows_chain_data "${1}${chosen_path}"
|
||||
ventoy_debug_pause
|
||||
|
||||
if vt_check_mode 4; then
|
||||
vtoy_windows_wimboot_func
|
||||
fi
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
@@ -646,10 +663,14 @@ function uefi_linux_menu_func {
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
@@ -788,6 +809,86 @@ function uefi_iso_memdisk {
|
||||
}
|
||||
|
||||
|
||||
function vtoy_windows_wimboot_func {
|
||||
if [ -f (loop)/x86/sources/boot.wim -a -f (loop)/x64/sources/boot.wim ]; then
|
||||
vt_sel_wimboot vtoy_wimboot_bit
|
||||
if [ "$vtoy_wimboot_bit" = "32" ]; then
|
||||
set vtoy_wimboot_prefix=(loop)/x86
|
||||
else
|
||||
set vtoy_wimboot_prefix=(loop)/x64
|
||||
fi
|
||||
else
|
||||
set vtoy_wimboot_prefix=(loop)
|
||||
if vt_is_pe64 $vtoy_wimboot_prefix/setup.exe; then
|
||||
set vtoy_wimboot_bit=64
|
||||
else
|
||||
set vtoy_wimboot_bit=32
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit
|
||||
fi
|
||||
|
||||
for wmfile in sources/boot.wim boot/bcd boot/boot.sdi; do
|
||||
if [ ! -f $vtoy_wimboot_prefix/$wmfile ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f $vtoy_wimboot_prefix/sources/install.wim -o -f $vtoy_wimboot_prefix/sources/install.esd ]; then
|
||||
vt_windows_wimboot_data
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
set vt_wimkernel=wimboot.x86_64.xz
|
||||
|
||||
linux16 "$vtoy_path/$vt_wimkernel" quiet
|
||||
ventoy_debug_pause
|
||||
|
||||
vt_set_wim_load_prompt 1 "Loading files......"
|
||||
initrd16 newc:vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe \
|
||||
newc:wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
|
||||
newc:winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size} \
|
||||
newc:bcd:$vtoy_wimboot_prefix/boot/bcd \
|
||||
newc:boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi \
|
||||
newc:boot.wim:$vtoy_wimboot_prefix/sources/boot.wim
|
||||
vt_set_wim_load_prompt 0
|
||||
boot
|
||||
else
|
||||
if [ "$grub_cpu" = "i386" ]; then
|
||||
set vt_wimkernel=wimboot.i386.efi.xz
|
||||
else
|
||||
set vt_wimkernel=wimboot.x86_64.xz
|
||||
fi
|
||||
|
||||
vt_set_wim_load_prompt 1 "Loading files......"
|
||||
vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/sources/boot.wim vtoy_wimfile_mem
|
||||
vt_set_wim_load_prompt 0
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
|
||||
else
|
||||
set vtoy_wimfile_path=$vtoy_wimboot_prefix/sources/boot.wim
|
||||
fi
|
||||
|
||||
ventoy_cli_console
|
||||
chainloader "$vtoy_path/$vt_wimkernel" quiet \
|
||||
"vf=wimboot.data:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
|
||||
"vf=winpeshl.ini:mem:${vtoy_winpeshl_ini_addr}:size:${vtoy_winpeshl_ini_size}" \
|
||||
"vf=vtoyjump.exe:$vtoy_path/vtoyjump${vtoy_wimboot_bit}.exe" \
|
||||
"vf=bcd:$vtoy_wimboot_prefix/boot/bcd" \
|
||||
"vf=boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi" \
|
||||
"vf=boot.wim:$vtoy_wimfile_path" \
|
||||
pfsize=$vtoy_chain_file_size \
|
||||
pfread=$vtoy_chain_file_read
|
||||
boot
|
||||
ventoy_gui_console
|
||||
fi
|
||||
}
|
||||
|
||||
function legacy_windows_menu_func {
|
||||
vt_windows_reset
|
||||
|
||||
@@ -816,7 +917,11 @@ function legacy_windows_menu_func {
|
||||
|
||||
vt_windows_chain_data "${1}${chosen_path}"
|
||||
ventoy_debug_pause
|
||||
|
||||
|
||||
if vt_check_mode 4; then
|
||||
vtoy_windows_wimboot_func
|
||||
fi
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
@@ -885,9 +990,39 @@ function legacy_linux_menu_func {
|
||||
ventoy_debug_pause
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
if vt_check_mode 3; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
# fallback
|
||||
set vtback_root=$root
|
||||
vt_push_last_entry
|
||||
set vtback_theme=$theme
|
||||
unset theme
|
||||
|
||||
vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy
|
||||
|
||||
set root=(loop)
|
||||
set vtback_cfg_find=0
|
||||
for cfg in "/boot/grub/grub.cfg" "/EFI/BOOT/grub.cfg" "/EFI/debian/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "/grub/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||
if [ -e "$cfg" ]; then
|
||||
set vtback_cfg_find=1
|
||||
configfile "$cfg"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unset_boot_opt
|
||||
set root=$vtback_root
|
||||
set theme=$vtback_theme
|
||||
vt_pop_last_entry
|
||||
ventoy_gui_console
|
||||
else
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
fi
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
@@ -1030,7 +1165,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 +1318,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 +1364,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 +1621,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,11 +1721,14 @@ 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
|
||||
if [ -d (vtimghd,2)/lib ]; then
|
||||
vt_get_fs_label (vtimghd,2) vtImgHd2Label
|
||||
fi
|
||||
|
||||
@@ -1530,6 +1736,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 +1751,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 +1779,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 +1796,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.37"
|
||||
set VENTOY_VERSION="1.0.44"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -1596,6 +1808,8 @@ 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_WIMBOOT_MODE_STR="WIMBOOT Mode"
|
||||
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
|
||||
|
||||
set VTOY_F2_CMD="ventoy_power"
|
||||
@@ -1725,6 +1939,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 +1961,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 +1971,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
|
||||
@@ -26,7 +26,7 @@ sfs: fshelp
|
||||
reiserfs: fshelp
|
||||
part_sunpc:
|
||||
zstd:
|
||||
gfxmenu: video_colors trig bitmap_scale gfxterm font normal bitmap video
|
||||
gfxmenu: trig video_colors bitmap_scale gfxterm font normal bitmap video
|
||||
backtrace:
|
||||
jfs:
|
||||
help: extcmd normal
|
||||
@@ -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
|
||||
@@ -26,7 +26,7 @@ sfs: fshelp
|
||||
reiserfs: fshelp
|
||||
part_sunpc:
|
||||
zstd:
|
||||
gfxmenu: video_colors trig bitmap_scale gfxterm font normal bitmap video
|
||||
gfxmenu: trig video_colors bitmap_scale gfxterm font normal bitmap video
|
||||
backtrace:
|
||||
jfs:
|
||||
help: extcmd normal
|
||||
@@ -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,22 @@ 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 = 30%+200
|
||||
top = 95%-25
|
||||
width = 10%
|
||||
height = 25
|
||||
+ label {text = "@VTOY_WIMBOOT_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
|
||||
@@ -26,7 +26,7 @@ sfs: fshelp
|
||||
reiserfs: fshelp
|
||||
part_sunpc:
|
||||
zstd:
|
||||
gfxmenu: video_colors trig bitmap_scale gfxterm font normal bitmap video
|
||||
gfxmenu: trig video_colors bitmap_scale gfxterm font normal bitmap video
|
||||
backtrace:
|
||||
jfs:
|
||||
help: extcmd normal
|
||||
@@ -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,11 +365,15 @@ else
|
||||
|
||||
oldver=$(get_disk_ventoy_version $DISK)
|
||||
if [ $? -ne 0 ]; then
|
||||
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
|
||||
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
|
||||
|
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.
Binary file not shown.
Binary file not shown.
BIN
INSTALL/ventoy/wimboot.i386.efi.xz
Normal file
BIN
INSTALL/ventoy/wimboot.i386.efi.xz
Normal file
Binary file not shown.
BIN
INSTALL/ventoy/wimboot.x86_64.xz
Normal file
BIN
INSTALL/ventoy/wimboot.x86_64.xz
Normal file
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
@@ -1,5 +1,4 @@
|
||||
wimboot follows GPLv2+ license (see gpl-2.0.txt)
|
||||
|
||||
Ventoy use the lzx decompress file from wimboot. These code follow the same license as wimboot.
|
||||
|
||||
Ventoy modified the code and follow the same license as wimboot.
|
||||
|
||||
|
@@ -232,6 +232,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,37 +1,19 @@
|
||||
#!/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/
|
||||
|
||||
echo "====== SUCCESS =========="
|
||||
echo "====== SUCCESS =========="
|
||||
|
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.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user