Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
1cbe4c81
Commit
1cbe4c81
authored
Jun 25, 2020
by
longpanda
Browse files
1.0.14 release
parent
42990058
Changes
58
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
837 additions
and
235 deletions
+837
-235
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
...dk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
+32
-6
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
...dk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
+3
-1
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyDebug.c
...table201911/MdeModulePkg/Application/Ventoy/VentoyDebug.c
+9
-182
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
...le201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
+288
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
+1
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+73
-13
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+15
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
+152
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
+105
-3
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
+1
-0
GRUB2/MOD_SRC/grub-2.04/install.sh
GRUB2/MOD_SRC/grub-2.04/install.sh
+8
-2
IMG/cpio/ventoy/hook/adelie/disk-hook.sh
IMG/cpio/ventoy/hook/adelie/disk-hook.sh
+13
-7
IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh
IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh
+23
-0
IMG/cpio/ventoy/hook/alt/udev_disk_hook.sh
IMG/cpio/ventoy/hook/alt/udev_disk_hook.sh
+7
-6
IMG/cpio/ventoy/hook/arch/ovios-disk.sh
IMG/cpio/ventoy/hook/arch/ovios-disk.sh
+50
-0
IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
+8
-0
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
+1
-0
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
+2
-0
IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh
IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh
+26
-0
IMG/cpio/ventoy/hook/guix/ventoy-disk.sh
IMG/cpio/ventoy/hook/guix/ventoy-disk.sh
+20
-12
No files found.
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
View file @
1cbe4c81
...
...
@@ -52,6 +52,8 @@ static grub_env_get_pf grub_env_get = NULL;
ventoy_grub_param_file_replace
*
g_file_replace_list
=
NULL
;
ventoy_efi_file_replace
g_efi_file_replace
;
STATIC
BOOLEAN
g_hook_keyboard
=
FALSE
;
CHAR16
gFirstTryBootFile
[
256
]
=
{
0
};
/* Boot filename */
...
...
@@ -191,11 +193,12 @@ static void EFIAPI ventoy_dump_chain(ventoy_chain_head *chain)
debug
(
"os_param->vtoy_img_size=<%llu>"
,
chain
->
os_param
.
vtoy_img_size
);
debug
(
"os_param->vtoy_img_location_addr=<0x%llx>"
,
chain
->
os_param
.
vtoy_img_location_addr
);
debug
(
"os_param->vtoy_img_location_len=<%u>"
,
chain
->
os_param
.
vtoy_img_location_len
);
debug
(
"os_param->vtoy_reserved=<%u %u %u %u>"
,
debug
(
"os_param->vtoy_reserved=<%u %u %u
%u
%u>"
,
g_os_param_reserved
[
0
],
g_os_param_reserved
[
1
],
g_os_param_reserved
[
2
],
g_os_param_reserved
[
3
]
g_os_param_reserved
[
3
],
g_os_param_reserved
[
4
]
);
ventoy_debug_pause
();
...
...
@@ -585,6 +588,13 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
g_fixup_iso9660_secover_enable
=
TRUE
;
}
if
(
g_os_param_reserved
[
2
]
==
1
&&
g_os_param_reserved
[
4
]
!=
1
)
{
g_hook_keyboard
=
TRUE
;
}
debug
(
"internal param: secover:%u keyboard:%u"
,
g_fixup_iso9660_secover_enable
,
g_hook_keyboard
);
for
(
i
=
0
;
i
<
sizeof
(
ventoy_os_param
);
i
++
)
{
chksum
+=
*
((
UINT8
*
)(
&
(
g_chain
->
os_param
))
+
i
);
...
...
@@ -707,16 +717,26 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
if
(
gDebugPrint
)
{
gST
->
ConIn
->
Reset
(
gST
->
ConIn
,
FALSE
);
//ventoy_wrapper_system();
}
if
(
g_file_replace_list
&&
g_file_replace_list
->
magic
==
GRUB_FILE_REPLACE_MAGIC
)
{
ventoy_wrapper_push_openvolume
(
pFile
->
OpenVolume
);
pFile
->
OpenVolume
=
ventoy_wrapper_open_volume
;
}
if
(
g_hook_keyboard
)
{
ventoy_hook_keyboard_start
();
}
/* can't add debug print here */
//ventoy_wrapper_system();
Status
=
gBS
->
StartImage
(
Image
,
NULL
,
NULL
);
if
(
g_hook_keyboard
)
{
ventoy_hook_keyboard_stop
();
}
if
(
EFI_ERROR
(
Status
))
{
debug
(
"Failed to start image %r"
,
Status
);
...
...
@@ -743,7 +763,6 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
VentoyEfiMain
(
IN
EFI_HANDLE
ImageHandle
,
...
...
@@ -751,6 +770,7 @@ EFI_STATUS EFIAPI VentoyEfiMain
)
{
EFI_STATUS
Status
=
EFI_SUCCESS
;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*
Protocol
;
g_sector_flag_num
=
512
;
/* initial value */
...
...
@@ -760,6 +780,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
return
EFI_OUT_OF_RESOURCES
;
}
Status
=
gBS
->
HandleProtocol
(
gST
->
ConsoleInHandle
,
&
gEfiSimpleTextInputExProtocolGuid
,
(
VOID
**
)
&
Protocol
);
if
(
EFI_SUCCESS
==
Status
)
{
g_con_simple_input_ex
=
Protocol
;
}
gST
->
ConOut
->
ClearScreen
(
gST
->
ConOut
);
ventoy_clear_input
();
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
View file @
1cbe4c81
...
...
@@ -291,7 +291,6 @@ typedef struct ventoy_system_wrapper
extern
BOOLEAN
gDebugPrint
;
VOID
EFIAPI
VtoyDebug
(
IN
CONST
CHAR8
*
Format
,
...);
EFI_STATUS
EFIAPI
ventoy_wrapper_system
(
VOID
);
EFI_STATUS
EFIAPI
ventoy_wrapper_file_procotol
(
EFI_FILE_PROTOCOL
*
File
);
EFI_STATUS
EFIAPI
ventoy_block_io_read
(
IN
EFI_BLOCK_IO_PROTOCOL
*
This
,
...
...
@@ -317,6 +316,7 @@ extern BOOLEAN gMemdiskMode;
extern
UINTN
g_iso_buf_size
;
extern
ventoy_grub_param_file_replace
*
g_file_replace_list
;
extern
BOOLEAN
g_fixup_iso9660_secover_enable
;
extern
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*
g_con_simple_input_ex
;
EFI_STATUS
EFIAPI
ventoy_wrapper_open_volume
(
...
...
@@ -325,6 +325,8 @@ EFI_STATUS EFIAPI ventoy_wrapper_open_volume
);
EFI_STATUS
EFIAPI
ventoy_install_blockio
(
IN
EFI_HANDLE
ImageHandle
,
IN
UINT64
ImgSize
);
EFI_STATUS
EFIAPI
ventoy_wrapper_push_openvolume
(
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME
OpenVolume
);
EFI_STATUS
ventoy_hook_keyboard_start
(
VOID
);
EFI_STATUS
ventoy_hook_keyboard_stop
(
VOID
);
#endif
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyDebug.c
View file @
1cbe4c81
...
...
@@ -36,6 +36,10 @@
#include <Protocol/SimpleFileSystem.h>
#include <Ventoy.h>
#define PROCOTOL_SLEEP_SECONDS 0
#define debug_sleep() if (PROCOTOL_SLEEP_SECONDS) sleep(PROCOTOL_SLEEP_SECONDS)
STATIC
ventoy_system_wrapper
g_system_wrapper
;
static
struct
well_known_guid
g_efi_well_known_guids
[]
=
...
...
@@ -84,183 +88,6 @@ static const char * ventoy_get_guid_name(EFI_GUID *guid)
return
gEfiGuidName
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_fs_open
(
EFI_FILE_HANDLE
This
,
EFI_FILE_HANDLE
*
New
,
CHAR16
*
Name
,
UINT64
Mode
,
UINT64
Attributes
)
{
(
VOID
)
This
;
(
VOID
)
New
;
(
VOID
)
Name
;
(
VOID
)
Mode
;
(
VOID
)
Attributes
;
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_open_ex
(
EFI_FILE_HANDLE
This
,
EFI_FILE_HANDLE
*
New
,
CHAR16
*
Name
,
UINT64
Mode
,
UINT64
Attributes
,
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_fs_open
(
This
,
New
,
Name
,
Mode
,
Attributes
);
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_delete
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_set_info
(
EFI_FILE_HANDLE
This
,
EFI_GUID
*
Type
,
UINTN
Len
,
VOID
*
Data
)
{
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_flush
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
/* Ex version */
EFI_STATUS
EFIAPI
ventoy_wrapper_file_flush_ex
(
EFI_FILE_HANDLE
This
,
EFI_FILE_IO_TOKEN
*
Token
)
{
(
VOID
)
This
;
(
VOID
)
Token
;
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_write
(
EFI_FILE_HANDLE
This
,
UINTN
*
Len
,
VOID
*
Data
)
{
(
VOID
)
This
;
(
VOID
)
Len
;
(
VOID
)
Data
;
return
EFI_WRITE_PROTECTED
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_write_ex
(
IN
EFI_FILE_PROTOCOL
*
This
,
IN
OUT
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_file_write
(
This
,
&
(
Token
->
BufferSize
),
Token
->
Buffer
);
}
static
EFI_STATUS
EFIAPI
ventoy_wrapper_file_close
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
static
EFI_STATUS
EFIAPI
ventoy_wrapper_file_set_pos
(
EFI_FILE_HANDLE
This
,
UINT64
Position
)
{
(
VOID
)
This
;
g_efi_file_replace
.
CurPos
=
Position
;
return
EFI_SUCCESS
;
}
static
EFI_STATUS
EFIAPI
ventoy_wrapper_file_get_pos
(
EFI_FILE_HANDLE
This
,
UINT64
*
Position
)
{
(
VOID
)
This
;
*
Position
=
g_efi_file_replace
.
CurPos
;
return
EFI_SUCCESS
;
}
static
EFI_STATUS
EFIAPI
ventoy_wrapper_file_get_info
(
EFI_FILE_HANDLE
This
,
EFI_GUID
*
Type
,
UINTN
*
Len
,
VOID
*
Data
)
{
EFI_FILE_INFO
*
Info
=
(
EFI_FILE_INFO
*
)
Data
;
debug
(
"ventoy_wrapper_file_get_info ... %u"
,
*
Len
);
if
(
!
CompareGuid
(
Type
,
&
gEfiFileInfoGuid
))
{
return
EFI_INVALID_PARAMETER
;
}
if
(
*
Len
==
0
)
{
*
Len
=
384
;
return
EFI_BUFFER_TOO_SMALL
;
}
ZeroMem
(
Data
,
sizeof
(
EFI_FILE_INFO
));
Info
->
Size
=
sizeof
(
EFI_FILE_INFO
);
Info
->
FileSize
=
g_efi_file_replace
.
FileSizeBytes
;
Info
->
PhysicalSize
=
g_efi_file_replace
.
FileSizeBytes
;
Info
->
Attribute
=
EFI_FILE_READ_ONLY
;
//Info->FileName = EFI_FILE_READ_ONLY;
*
Len
=
Info
->
Size
;
return
EFI_SUCCESS
;
}
static
EFI_STATUS
EFIAPI
ventoy_wrapper_file_read
(
EFI_FILE_HANDLE
This
,
UINTN
*
Len
,
VOID
*
Data
)
{
EFI_LBA
Lba
;
UINTN
ReadLen
=
*
Len
;
(
VOID
)
This
;
debug
(
"ventoy_wrapper_file_read ... %u"
,
*
Len
);
if
(
g_efi_file_replace
.
CurPos
+
ReadLen
>
g_efi_file_replace
.
FileSizeBytes
)
{
ReadLen
=
g_efi_file_replace
.
FileSizeBytes
-
g_efi_file_replace
.
CurPos
;
}
Lba
=
g_efi_file_replace
.
CurPos
/
2048
+
g_efi_file_replace
.
BlockIoSectorStart
;
ventoy_block_io_read
(
NULL
,
0
,
Lba
,
ReadLen
,
Data
);
*
Len
=
ReadLen
;
g_efi_file_replace
.
CurPos
+=
ReadLen
;
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_read_ex
(
IN
EFI_FILE_PROTOCOL
*
This
,
IN
OUT
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_file_read
(
This
,
&
(
Token
->
BufferSize
),
Token
->
Buffer
);
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_procotol
(
EFI_FILE_PROTOCOL
*
File
)
{
File
->
Revision
=
EFI_FILE_PROTOCOL_REVISION2
;
File
->
Open
=
ventoy_wrapper_fs_open
;
File
->
Close
=
ventoy_wrapper_file_close
;
File
->
Delete
=
ventoy_wrapper_file_delete
;
File
->
Read
=
ventoy_wrapper_file_read
;
File
->
Write
=
ventoy_wrapper_file_write
;
File
->
GetPosition
=
ventoy_wrapper_file_get_pos
;
File
->
SetPosition
=
ventoy_wrapper_file_set_pos
;
File
->
GetInfo
=
ventoy_wrapper_file_get_info
;
File
->
SetInfo
=
ventoy_wrapper_file_set_info
;
File
->
Flush
=
ventoy_wrapper_file_flush
;
File
->
OpenEx
=
ventoy_wrapper_file_open_ex
;
File
->
ReadEx
=
ventoy_wrapper_file_read_ex
;
File
->
WriteEx
=
ventoy_wrapper_file_write_ex
;
File
->
FlushEx
=
ventoy_wrapper_file_flush_ex
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_handle_protocol
(
IN
EFI_HANDLE
Handle
,
...
...
@@ -270,7 +97,7 @@ STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
{
EFI_STATUS
Status
=
EFI_SUCCESS
;
debug
(
"ventoy_handle_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug
(
"ventoy_handle_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug_sleep
();
Status
=
g_system_wrapper
.
OriHandleProtocol
(
Handle
,
Protocol
,
Interface
);
if
(
CompareGuid
(
Protocol
,
&
gEfiSimpleFileSystemProtocolGuid
))
...
...
@@ -280,7 +107,7 @@ STATIC EFI_STATUS EFIAPI ventoy_handle_protocol
pFile
->
OpenVolume
(
pFile
,
&
FileProtocol
);
debug
(
"Handle FS Protocol: %p OpenVolume:%p, FileProtocol:%p, Open:%p"
,
trace
(
"Handle FS Protocol: %p OpenVolume:%p, FileProtocol:%p, Open:%p"
,
pFile
,
pFile
->
OpenVolume
,
FileProtocol
,
FileProtocol
->
Open
);
sleep
(
3
);
...
...
@@ -299,7 +126,7 @@ STATIC EFI_STATUS EFIAPI ventoy_open_protocol
IN
UINT32
Attributes
)
{
debug
(
"ventoy_open_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug
(
"ventoy_open_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug_sleep
();
return
g_system_wrapper
.
OriOpenProtocol
(
Handle
,
Protocol
,
Interface
,
AgentHandle
,
ControllerHandle
,
Attributes
);
}
...
...
@@ -310,7 +137,7 @@ STATIC EFI_STATUS EFIAPI ventoy_locate_protocol
OUT
VOID
**
Interface
)
{
debug
(
"ventoy_locate_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug
(
"ventoy_locate_protocol:%a"
,
ventoy_get_guid_name
(
Protocol
));
debug_sleep
();
return
g_system_wrapper
.
OriLocateProtocol
(
Protocol
,
Registration
,
Interface
);
}
...
...
@@ -318,7 +145,7 @@ EFI_STATUS EFIAPI ventoy_wrapper_system(VOID)
{
ventoy_wrapper
(
gBS
,
g_system_wrapper
,
LocateProtocol
,
ventoy_locate_protocol
);
ventoy_wrapper
(
gBS
,
g_system_wrapper
,
HandleProtocol
,
ventoy_handle_protocol
);
ventoy_wrapper
(
gBS
,
g_system_wrapper
,
OpenProtocol
,
ventoy_open_protocol
);
ventoy_wrapper
(
gBS
,
g_system_wrapper
,
OpenProtocol
,
ventoy_open_protocol
);
return
EFI_SUCCESS
;
}
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
View file @
1cbe4c81
...
...
@@ -57,6 +57,18 @@ UINT64 g_fixup_iso9660_secover_1st_secs = 0;
UINT64
g_fixup_iso9660_secover_cur_secs
=
0
;
UINT64
g_fixup_iso9660_secover_tot_secs
=
0
;
STATIC
UINTN
g_keyboard_hook_count
=
0
;
STATIC
BOOLEAN
g_blockio_start_record_bcd
=
FALSE
;
STATIC
BOOLEAN
g_blockio_bcd_read_done
=
FALSE
;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*
g_con_simple_input_ex
=
NULL
;
STATIC
EFI_INPUT_READ_KEY_EX
g_org_read_key_ex
=
NULL
;
STATIC
EFI_INPUT_READ_KEY
g_org_read_key
=
NULL
;
#if 0
/* Block IO procotol */
#endif
EFI_STATUS
EFIAPI
ventoy_block_io_reset
(
IN
EFI_BLOCK_IO_PROTOCOL
*
This
,
...
...
@@ -176,6 +188,14 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
}
}
if
(
g_blockio_start_record_bcd
&&
FALSE
==
g_blockio_bcd_read_done
)
{
if
(
*
(
UINT32
*
)
Buffer
==
0x66676572
)
{
g_blockio_bcd_read_done
=
TRUE
;
}
}
return
EFI_SUCCESS
;
}
...
...
@@ -194,6 +214,14 @@ EFI_STATUS EFIAPI ventoy_block_io_ramdisk_read
(
VOID
)
MediaId
;
CopyMem
(
Buffer
,
(
char
*
)
g_chain
+
(
Lba
*
2048
),
BufferSize
);
if
(
g_blockio_start_record_bcd
&&
FALSE
==
g_blockio_bcd_read_done
)
{
if
(
*
(
UINT32
*
)
Buffer
==
0x66676572
)
{
g_blockio_bcd_read_done
=
TRUE
;
}
}
return
EFI_SUCCESS
;
}
...
...
@@ -548,7 +576,187 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
return
EFI_SUCCESS
;
}
EFI_STATUS
EFIAPI
ventoy_wrapper_file_open
#if 0
/* For file replace */
#endif
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_fs_open
(
EFI_FILE_HANDLE
This
,
EFI_FILE_HANDLE
*
New
,
CHAR16
*
Name
,
UINT64
Mode
,
UINT64
Attributes
)
{
(
VOID
)
This
;
(
VOID
)
New
;
(
VOID
)
Name
;
(
VOID
)
Mode
;
(
VOID
)
Attributes
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_open_ex
(
EFI_FILE_HANDLE
This
,
EFI_FILE_HANDLE
*
New
,
CHAR16
*
Name
,
UINT64
Mode
,
UINT64
Attributes
,
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_fs_open
(
This
,
New
,
Name
,
Mode
,
Attributes
);
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_delete
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_set_info
(
EFI_FILE_HANDLE
This
,
EFI_GUID
*
Type
,
UINTN
Len
,
VOID
*
Data
)
{
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_flush
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
/* Ex version */
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_flush_ex
(
EFI_FILE_HANDLE
This
,
EFI_FILE_IO_TOKEN
*
Token
)
{
(
VOID
)
This
;
(
VOID
)
Token
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_write
(
EFI_FILE_HANDLE
This
,
UINTN
*
Len
,
VOID
*
Data
)
{
(
VOID
)
This
;
(
VOID
)
Len
;
(
VOID
)
Data
;
return
EFI_WRITE_PROTECTED
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_write_ex
(
IN
EFI_FILE_PROTOCOL
*
This
,
IN
OUT
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_file_write
(
This
,
&
(
Token
->
BufferSize
),
Token
->
Buffer
);
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_close
(
EFI_FILE_HANDLE
This
)
{
(
VOID
)
This
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_set_pos
(
EFI_FILE_HANDLE
This
,
UINT64
Position
)
{
(
VOID
)
This
;
g_efi_file_replace
.
CurPos
=
Position
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_get_pos
(
EFI_FILE_HANDLE
This
,
UINT64
*
Position
)
{
(
VOID
)
This
;
*
Position
=
g_efi_file_replace
.
CurPos
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_get_info
(
EFI_FILE_HANDLE
This
,
EFI_GUID
*
Type
,
UINTN
*
Len
,
VOID
*
Data
)
{
EFI_FILE_INFO
*
Info
=
(
EFI_FILE_INFO
*
)
Data
;
debug
(
"ventoy_wrapper_file_get_info ... %u"
,
*
Len
);
if
(
!
CompareGuid
(
Type
,
&
gEfiFileInfoGuid
))
{
return
EFI_INVALID_PARAMETER
;
}
if
(
*
Len
==
0
)
{
*
Len
=
384
;
return
EFI_BUFFER_TOO_SMALL
;
}
ZeroMem
(
Data
,
sizeof
(
EFI_FILE_INFO
));
Info
->
Size
=
sizeof
(
EFI_FILE_INFO
);
Info
->
FileSize
=
g_efi_file_replace
.
FileSizeBytes
;
Info
->
PhysicalSize
=
g_efi_file_replace
.
FileSizeBytes
;
Info
->
Attribute
=
EFI_FILE_READ_ONLY
;
//Info->FileName = EFI_FILE_READ_ONLY;
*
Len
=
Info
->
Size
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_read
(
EFI_FILE_HANDLE
This
,
UINTN
*
Len
,
VOID
*
Data
)
{
EFI_LBA
Lba
;
UINTN
ReadLen
=
*
Len
;
(
VOID
)
This
;
debug
(
"ventoy_wrapper_file_read ... %u"
,
*
Len
);
if
(
g_efi_file_replace
.
CurPos
+
ReadLen
>
g_efi_file_replace
.
FileSizeBytes
)
{
ReadLen
=
g_efi_file_replace
.
FileSizeBytes
-
g_efi_file_replace
.
CurPos
;
}
Lba
=
g_efi_file_replace
.
CurPos
/
2048
+
g_efi_file_replace
.
BlockIoSectorStart
;
ventoy_block_io_read
(
NULL
,
0
,
Lba
,
ReadLen
,
Data
);
*
Len
=
ReadLen
;
g_efi_file_replace
.
CurPos
+=
ReadLen
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_read_ex
(
IN
EFI_FILE_PROTOCOL
*
This
,
IN
OUT
EFI_FILE_IO_TOKEN
*
Token
)
{
return
ventoy_wrapper_file_read
(
This
,
&
(
Token
->
BufferSize
),
Token
->
Buffer
);
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_procotol
(
EFI_FILE_PROTOCOL
*
File
)
{
File
->
Revision
=
EFI_FILE_PROTOCOL_REVISION2
;
File
->
Open
=
ventoy_wrapper_fs_open
;
File
->
Close
=
ventoy_wrapper_file_close
;
File
->
Delete
=
ventoy_wrapper_file_delete
;
File
->
Read
=
ventoy_wrapper_file_read
;
File
->
Write
=
ventoy_wrapper_file_write
;
File
->
GetPosition
=
ventoy_wrapper_file_get_pos
;
File
->
SetPosition
=
ventoy_wrapper_file_set_pos
;
File
->
GetInfo
=
ventoy_wrapper_file_get_info
;
File
->
SetInfo
=
ventoy_wrapper_file_set_info
;
File
->
Flush
=
ventoy_wrapper_file_flush
;
File
->
OpenEx
=
ventoy_wrapper_file_open_ex
;
File
->
ReadEx
=
ventoy_wrapper_file_read_ex
;
File
->
WriteEx
=
ventoy_wrapper_file_write_ex
;
File
->
FlushEx
=
ventoy_wrapper_file_flush_ex
;
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_file_open
(
EFI_FILE_HANDLE
This
,
EFI_FILE_HANDLE
*
New
,
...
...
@@ -629,3 +837,82 @@ EFI_STATUS EFIAPI ventoy_wrapper_push_openvolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTO
return
EFI_SUCCESS
;
}
#if 0
/* For auto skip Windows 'Press any key to boot from CD or DVD ...' */
#endif
STATIC
EFI_STATUS
EFIAPI
ventoy_wrapper_read_key_ex
(
IN
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*
This
,
OUT
EFI_KEY_DATA
*
KeyData
)
{
/* only hook once before BCD file read */
if
(
g_keyboard_hook_count
==
0
&&
g_blockio_bcd_read_done
==
FALSE
)
{
g_keyboard_hook_count
++
;
KeyData
->
Key
.
ScanCode
=
SCAN_DELETE
;
KeyData
->
Key
.
UnicodeChar
=
0
;
KeyData
->
KeyState
.
KeyShiftState
=
0
;
KeyData
->
KeyState
.
KeyToggleState
=
0
;
return
EFI_SUCCESS
;
}
return
g_org_read_key_ex
(
This
,
KeyData
);
}
EFI_STATUS
EFIAPI
ventoy_wrapper_read_key
(
IN
EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*
This
,
OUT
EFI_INPUT_KEY
*
Key
)
{
/* only hook once before BCD file read */
if
(
g_keyboard_hook_count
==
0
&&
g_blockio_bcd_read_done
==
FALSE
)
{
g_keyboard_hook_count
++
;
Key
->
ScanCode
=
SCAN_DELETE
;
Key
->
UnicodeChar
=
0
;
return
EFI_SUCCESS
;
}
return
g_org_read_key
(
This
,
Key
);
}
EFI_STATUS
ventoy_hook_keyboard_start
(
VOID
)
{
g_blockio_start_record_bcd
=
TRUE
;
g_blockio_bcd_read_done
=
FALSE
;
g_keyboard_hook_count
=
0
;
if
(
g_con_simple_input_ex
)
{
g_org_read_key_ex
=
g_con_simple_input_ex
->
ReadKeyStrokeEx
;
g_con_simple_input_ex
->
ReadKeyStrokeEx
=
ventoy_wrapper_read_key_ex
;
}
g_org_read_key
=
gST
->
ConIn
->
ReadKeyStroke
;
gST
->
ConIn
->
ReadKeyStroke
=
ventoy_wrapper_read_key
;
return
EFI_SUCCESS
;
}
EFI_STATUS
ventoy_hook_keyboard_stop
(
VOID
)
{
g_blockio_start_record_bcd
=
FALSE
;
g_blockio_bcd_read_done
=
FALSE
;
g_keyboard_hook_count
=
0
;
if
(
g_con_simple_input_ex
)
{
g_con_simple_input_ex
->
ReadKeyStrokeEx
=
g_org_read_key_ex
;
}
gST
->
ConIn
->
ReadKeyStroke
=
g_org_read_key
;
return
EFI_SUCCESS
;
}
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
View file @
1cbe4c81
...
...
@@ -38,7 +38,7 @@ int g_ventoy_menu_refresh = 0;
int
g_ventoy_memdisk_mode
=
0
;
int
g_ventoy_iso_raw
=
0
;
int
g_ventoy_iso_uefi_drv
=
0
;
int
g_ventoy_last_entry
=
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
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
1cbe4c81
...
...
@@ -69,6 +69,7 @@ img_iterator_node *g_img_iterator_tail = NULL;
grub_uint8_t
g_ventoy_break_level
=
0
;
grub_uint8_t
g_ventoy_debug_level
=
0
;
grub_uint8_t
g_ventoy_chain_type
=
0
;
grub_uint8_t
*
g_ventoy_cpio_buf
=
NULL
;
grub_uint32_t
g_ventoy_cpio_size
=
0
;
cpio_newc_header
*
g_ventoy_initrd_head
=
NULL
;
...
...
@@ -90,6 +91,15 @@ static int g_tree_script_pos = 0;
static
char
*
g_list_script_buf
=
NULL
;
static
int
g_list_script_pos
=
0
;
static
const
char
*
g_menu_class
[]
=
{
"vtoyiso"
,
"vtoywim"
,
"vtoyefi"
,
"vtoyimg"
};
static
const
char
*
g_menu_prefix
[]
=
{
"iso"
,
"wim"
,
"efi"
,
"img"
};
void
ventoy_debug
(
const
char
*
fmt
,
...)
{
...
...
@@ -806,6 +816,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
{
type
=
img_type_wim
;
}
#ifdef GRUB_MACHINE_EFI
else
if
(
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".efi"
))
{
type
=
img_type_efi
;
}
#endif
else
{
return
0
;
...
...
@@ -831,12 +847,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
}
}
grub_snprintf
(
img
->
path
,
sizeof
(
img
->
path
),
"%s%s"
,
node
->
dir
,
img
->
name
);
img
->
pathlen
=
grub_snprintf
(
img
->
path
,
sizeof
(
img
->
path
),
"%s%s"
,
node
->
dir
,
img
->
name
);
img
->
size
=
info
->
size
;
if
(
0
==
img
->
size
)
{
img
->
size
=
ventoy_grub_get_file_size
(
"%s/%s"
,
g_iso_path
,
img
->
path
);
img
->
size
=
ventoy_grub_get_file_size
(
"%s/%s
%s
"
,
g_iso_path
,
node
->
dir
,
filename
);
}
if
(
img
->
size
<
VTOY_FILT_MIN_FILE_SIZE
)
...
...
@@ -876,6 +892,12 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
g_ventoy_img_count
++
;
img
->
alias
=
ventoy_plugin_get_menu_alias
(
img
->
path
);
img
->
class
=
ventoy_plugin_get_menu_class
(
img
->
name
);
if
(
!
img
->
class
)
{
img
->
class
=
g_menu_class
[
type
];
}
img
->
menu_prefix
=
g_menu_prefix
[
type
];
debug
(
"Add %s%s to list %d
\n
"
,
node
->
dir
,
filename
,
g_ventoy_img_count
);
}
...
...
@@ -1025,7 +1047,7 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
if
(
g_default_menu_mode
==
0
)
{
vtoy_ssprintf
(
g_tree_script_buf
,
g_tree_script_pos
,
"menuentry
\"
%-10s [Return to ListView]
\"
VTOY_RET {
\n
"
"menuentry
\"
%-10s [Return to ListView]
\"
--class=
\"
vtoyret
\"
VTOY_RET {
\n
"
" echo 'return ...'
\n
"
"}
\n
"
,
"<--"
);
}
...
...
@@ -1034,11 +1056,11 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
{
node
->
dir
[
node
->
dirlen
-
1
]
=
0
;
vtoy_ssprintf
(
g_tree_script_buf
,
g_tree_script_pos
,
"submenu
\"
%-10s [%s]
\"
{
\n
"
,
"submenu
\"
%-10s [%s]
\"
--class=
\"
vtoydir
\"
{
\n
"
,
"DIR"
,
node
->
dir
+
offset
);
vtoy_ssprintf
(
g_tree_script_buf
,
g_tree_script_pos
,
"menuentry
\"
%-10s [../]
\"
VTOY_RET {
\n
"
"menuentry
\"
%-10s [../]
\"
--class=
\"
vtoyret
\"
VTOY_RET {
\n
"
" echo 'return ...'
\n
"
"}
\n
"
,
"<--"
);
}
...
...
@@ -1051,13 +1073,13 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
while
((
img
=
ventoy_get_min_iso
(
node
))
!=
NULL
)
{
vtoy_ssprintf
(
g_tree_script_buf
,
g_tree_script_pos
,
"menuentry
\"
%-10s %s%s
\"
--id=
\"
VID_%d
\"
{
\n
"
"menuentry
\"
%-10s %s%s
\"
--class=
\"
%s
\"
--id=
\"
VID_%d
\"
{
\n
"
" %s_%s
\n
"
"}
\n
"
,
grub_get_human_size
(
img
->
size
,
GRUB_HUMAN_SIZE_SHORT
),
img
->
unsupport
?
"[unsupported] "
:
""
,
img
->
alias
?
img
->
alias
:
img
->
name
,
img
->
id
,
(
img
->
type
==
img_type_iso
)
?
"iso"
:
"wim"
,
img
->
alias
?
img
->
alias
:
img
->
name
,
img
->
class
,
img
->
id
,
img
->
menu_prefix
,
img
->
unsupport
?
"unsupport_menuentry"
:
"common_menuentry"
);
}
...
...
@@ -1077,8 +1099,11 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
grub_device_t
dev
=
NULL
;
img_info
*
cur
=
NULL
;
img_info
*
tail
=
NULL
;
img_info
*
default_node
=
NULL
;
const
char
*
strdata
=
NULL
;
char
*
device_name
=
NULL
;
const
char
*
default_image
=
NULL
;
int
img_len
=
0
;
char
buf
[
32
];
img_iterator_node
*
node
=
NULL
;
img_iterator_node
*
tmp
=
NULL
;
...
...
@@ -1188,22 +1213,45 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
if
(
g_default_menu_mode
==
1
)
{
vtoy_ssprintf
(
g_list_script_buf
,
g_list_script_pos
,
"menuentry
\"
%s [Return to TreeView]
\"
VTOY_RET {
\n
"
"menuentry
\"
%s [Return to TreeView]
\"
--class=
\"
vtoyret
\"
VTOY_RET {
\n
"
" echo 'return ...'
\n
"
"}
\n
"
,
"<--"
);
}
if
(
g_default_menu_mode
==
0
)
{
default_image
=
ventoy_get_env
(
"VTOY_DEFAULT_IMAGE"
);
if
(
default_image
)
{
img_len
=
grub_strlen
(
default_image
);
}
}
for
(
cur
=
g_ventoy_img_list
;
cur
;
cur
=
cur
->
next
)
{
vtoy_ssprintf
(
g_list_script_buf
,
g_list_script_pos
,
"menuentry
\"
%s%s
\"
--id=
\"
VID_%d
\"
{
\n
"
"menuentry
\"
%s%s
\"
--class=
\"
%s
\"
--id=
\"
VID_%d
\"
{
\n
"
" %s_%s
\n
"
"}
\n
"
,
cur
->
unsupport
?
"[unsupported] "
:
""
,
cur
->
alias
?
cur
->
alias
:
cur
->
name
,
cur
->
id
,
(
cur
->
type
==
img_type_iso
)
?
"iso"
:
"wim"
,
cur
->
alias
?
cur
->
alias
:
cur
->
name
,
cur
->
class
,
cur
->
id
,
cur
->
menu_prefix
,
cur
->
unsupport
?
"unsupport_menuentry"
:
"common_menuentry"
);
if
(
g_default_menu_mode
==
0
&&
default_image
&&
default_node
==
NULL
)
{
if
(
img_len
==
cur
->
pathlen
&&
grub_strcmp
(
default_image
,
cur
->
path
)
==
0
)
{
default_node
=
cur
;
}
}
}
if
(
default_node
)
{
vtoy_ssprintf
(
g_list_script_buf
,
g_list_script_pos
,
"set default='VID_%d'
\n
"
,
default_node
->
id
);
}
g_list_script_buf
[
g_list_script_pos
]
=
0
;
grub_snprintf
(
buf
,
sizeof
(
buf
),
"%d"
,
g_ventoy_img_count
);
...
...
@@ -1421,6 +1469,7 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
{
char
*
pos
;
const
char
*
fs
=
NULL
;
const
char
*
cdprompt
=
NULL
;
grub_uint32_t
i
;
grub_uint8_t
chksum
=
0
;
grub_disk_t
disk
;
...
...
@@ -1449,6 +1498,17 @@ void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param)
param
->
vtoy_reserved
[
2
]
=
g_ventoy_chain_type
;
/* Windows CD/DVD prompt 0:suppress 1:reserved */
param
->
vtoy_reserved
[
4
]
=
0
;
if
(
g_ventoy_chain_type
==
1
)
/* Windows */
{
cdprompt
=
ventoy_get_env
(
"VTOY_WINDOWS_CD_PROMPT"
);
if
(
cdprompt
&&
cdprompt
[
0
]
==
'1'
&&
cdprompt
[
1
]
==
0
)
{
param
->
vtoy_reserved
[
4
]
=
1
;
}
}
fs
=
ventoy_get_env
(
"ventoy_fs_probe"
);
if
(
fs
&&
grub_strcmp
(
fs
,
"udf"
)
==
0
)
{
...
...
@@ -1905,7 +1965,7 @@ static grub_err_t ventoy_cmd_dump_img_list(grub_extcmd_context_t ctxt, int argc,
while
(
cur
)
{
grub_printf
(
"path:<%s>
\n
"
,
cur
->
path
);
grub_printf
(
"path:<%s>
id=%d
\n
"
,
cur
->
path
,
cur
->
id
);
grub_printf
(
"name:<%s>
\n\n
"
,
cur
->
name
);
cur
=
cur
->
next
;
}
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
1cbe4c81
...
...
@@ -127,13 +127,18 @@ typedef struct ventoy_udf_override
#define img_type_iso 0
#define img_type_wim 1
#define img_type_efi 2
#define img_type_img 3
typedef
struct
img_info
{
int
pathlen
;
char
path
[
512
];
char
name
[
256
];
const
char
*
alias
;
const
char
*
class
;
const
char
*
menu_prefix
;
int
id
;
int
type
;
...
...
@@ -623,6 +628,15 @@ typedef struct menu_alias
struct
menu_alias
*
next
;
}
menu_alias
;
typedef
struct
menu_class
{
int
patlen
;
char
pattern
[
256
];
char
class
[
64
];
struct
menu_class
*
next
;
}
menu_class
;
extern
int
g_ventoy_menu_esc
;
extern
int
g_ventoy_suppress_esc
;
extern
int
g_ventoy_last_entry
;
...
...
@@ -641,6 +655,7 @@ 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_menu_alias
(
const
char
*
isopath
);
const
char
*
ventoy_plugin_get_menu_class
(
const
char
*
isoname
);
int
ventoy_get_block_list
(
grub_file_t
file
,
ventoy_img_chunk_list
*
chunklist
,
grub_disk_addr_t
start
);
int
ventoy_check_block_list
(
grub_file_t
file
,
ventoy_img_chunk_list
*
chunklist
,
grub_disk_addr_t
start
);
void
ventoy_plugin_dump_persistence
(
void
);
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
View file @
1cbe4c81
...
...
@@ -33,6 +33,7 @@
#include <grub/i18n.h>
#include <grub/net.h>
#include <grub/time.h>
#include <grub/font.h>
#include <grub/ventoy.h>
#include "ventoy_def.h"
...
...
@@ -42,6 +43,7 @@ static char g_iso_disk_name[128];
static
install_template
*
g_install_template_head
=
NULL
;
static
persistence_config
*
g_persistence_head
=
NULL
;
static
menu_alias
*
g_menu_alias_head
=
NULL
;
static
menu_class
*
g_menu_class_head
=
NULL
;
static
int
ventoy_plugin_control_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
...
...
@@ -114,6 +116,7 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
{
int
exist
=
0
;
const
char
*
value
;
VTOY_JSON
*
node
;
value
=
vtoy_json_get_string_ex
(
json
->
pstChild
,
"file"
);
if
(
value
)
...
...
@@ -165,6 +168,29 @@ static int ventoy_plugin_theme_check(VTOY_JSON *json, const char *isodisk)
grub_printf
(
"ventoy_color: %s
\n
"
,
value
);
}
node
=
vtoy_json_find_item
(
json
->
pstChild
,
JSON_TYPE_ARRAY
,
"fonts"
);
if
(
node
)
{
for
(
node
=
node
->
pstChild
;
node
;
node
=
node
->
pstNext
)
{
if
(
node
->
enDataType
==
JSON_TYPE_STRING
)
{
if
(
ventoy_check_file_exist
(
"%s%s"
,
isodisk
,
node
->
unData
.
pcStrVal
))
{
grub_printf
(
"%s [OK]
\n
"
,
node
->
unData
.
pcStrVal
);
}
else
{
grub_printf
(
"%s [NOT EXIST]
\n
"
,
node
->
unData
.
pcStrVal
);
}
}
}
}
else
{
grub_printf
(
"fonts NOT found
\n
"
);
}
return
0
;
}
...
...
@@ -172,6 +198,7 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
{
const
char
*
value
;
char
filepath
[
256
];
VTOY_JSON
*
node
;
value
=
vtoy_json_get_string_ex
(
json
->
pstChild
,
"file"
);
if
(
value
)
...
...
@@ -227,6 +254,20 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
grub_env_set
(
"VTLE_CLR"
,
value
);
}
node
=
vtoy_json_find_item
(
json
->
pstChild
,
JSON_TYPE_ARRAY
,
"fonts"
);
if
(
node
)
{
for
(
node
=
node
->
pstChild
;
node
;
node
=
node
->
pstNext
)
{
if
(
node
->
enDataType
==
JSON_TYPE_STRING
&&
ventoy_check_file_exist
(
"%s%s"
,
isodisk
,
node
->
unData
.
pcStrVal
))
{
grub_snprintf
(
filepath
,
sizeof
(
filepath
),
"%s%s"
,
isodisk
,
node
->
unData
.
pcStrVal
);
grub_font_load
(
filepath
);
}
}
}
return
0
;
}
...
...
@@ -612,7 +653,15 @@ static int ventoy_plugin_menualias_check(VTOY_JSON *json, const char *isodisk)
alias
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"alias"
);
if
(
iso
&&
iso
[
0
]
==
'/'
&&
alias
)
{
grub_printf
(
"image: <%s>
\n
"
,
iso
);
if
(
ventoy_is_file_exist
(
"%s%s"
,
isodisk
,
iso
))
{
grub_printf
(
"image: <%s> [ OK ]
\n
"
,
iso
);
}
else
{
grub_printf
(
"image: <%s> [ NOT EXIST ]
\n
"
,
iso
);
}
grub_printf
(
"alias: <%s>
\n\n
"
,
alias
);
}
}
...
...
@@ -672,6 +721,90 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk)
return
0
;
}
static
int
ventoy_plugin_menuclass_entry
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
const
char
*
key
=
NULL
;
const
char
*
class
=
NULL
;
VTOY_JSON
*
pNode
=
NULL
;
menu_class
*
tail
=
NULL
;
menu_class
*
node
=
NULL
;
menu_class
*
next
=
NULL
;
(
void
)
isodisk
;
if
(
json
->
enDataType
!=
JSON_TYPE_ARRAY
)
{
debug
(
"Not array %d
\n
"
,
json
->
enDataType
);
return
0
;
}
if
(
g_menu_class_head
)
{
for
(
node
=
g_menu_class_head
;
node
;
node
=
next
)
{
next
=
node
->
next
;
grub_free
(
node
);
}
g_menu_class_head
=
NULL
;
}
for
(
pNode
=
json
->
pstChild
;
pNode
;
pNode
=
pNode
->
pstNext
)
{
key
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"key"
);
class
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"class"
);
if
(
key
&&
class
)
{
node
=
grub_zalloc
(
sizeof
(
menu_class
));
if
(
node
)
{
node
->
patlen
=
grub_snprintf
(
node
->
pattern
,
sizeof
(
node
->
pattern
),
"%s"
,
key
);
grub_snprintf
(
node
->
class
,
sizeof
(
node
->
class
),
"%s"
,
class
);
if
(
g_menu_class_head
)
{
tail
->
next
=
node
;
}
else
{
g_menu_class_head
=
node
;
}
tail
=
node
;
}
}
}
return
0
;
}
static
int
ventoy_plugin_menuclass_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
const
char
*
key
=
NULL
;
const
char
*
class
=
NULL
;
VTOY_JSON
*
pNode
=
NULL
;
(
void
)
isodisk
;
if
(
json
->
enDataType
!=
JSON_TYPE_ARRAY
)
{
grub_printf
(
"Not array %d
\n
"
,
json
->
enDataType
);
return
1
;
}
for
(
pNode
=
json
->
pstChild
;
pNode
;
pNode
=
pNode
->
pstNext
)
{
key
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"key"
);
class
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"class"
);
if
(
key
&&
class
)
{
grub_printf
(
"key: <%s>
\n
"
,
key
);
grub_printf
(
"class: <%s>
\n\n
"
,
class
);
}
}
return
0
;
}
static
plugin_entry
g_plugin_entries
[]
=
{
{
"control"
,
ventoy_plugin_control_entry
,
ventoy_plugin_control_check
},
...
...
@@ -679,6 +812,7 @@ static plugin_entry g_plugin_entries[] =
{
"auto_install"
,
ventoy_plugin_auto_install_entry
,
ventoy_plugin_auto_install_check
},
{
"persistence"
,
ventoy_plugin_persistence_entry
,
ventoy_plugin_persistence_check
},
{
"menu_alias"
,
ventoy_plugin_menualias_entry
,
ventoy_plugin_menualias_check
},
{
"menu_class"
,
ventoy_plugin_menuclass_entry
,
ventoy_plugin_menuclass_check
},
};
static
int
ventoy_parse_plugin_config
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
...
...
@@ -932,6 +1066,23 @@ const char * ventoy_plugin_get_menu_alias(const char *isopath)
return
NULL
;
}
const
char
*
ventoy_plugin_get_menu_class
(
const
char
*
isoname
)
{
menu_class
*
node
=
NULL
;
int
len
=
(
int
)
grub_strlen
(
isoname
);
for
(
node
=
g_menu_class_head
;
node
;
node
=
node
->
next
)
{
if
(
node
->
patlen
<=
len
&&
grub_strstr
(
isoname
,
node
->
pattern
))
{
return
node
->
class
;
}
}
return
NULL
;
}
grub_err_t
ventoy_cmd_plugin_check_json
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
i
=
0
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
View file @
1cbe4c81
...
...
@@ -45,6 +45,9 @@ static int g_wim_total_patch_count = 0;
static
int
g_wim_valid_patch_count
=
0
;
static
wim_patch
*
g_wim_patch_head
=
NULL
;
static
grub_uint64_t
g_suppress_wincd_override_offset
=
0
;
static
grub_uint32_t
g_suppress_wincd_override_data
=
0
;
grub_uint8_t
g_temp_buf
[
512
];
grub_ssize_t
lzx_decompress
(
const
void
*
data
,
grub_size_t
len
,
void
*
buf
);
...
...
@@ -923,13 +926,15 @@ grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, cha
static
grub_uint32_t
ventoy_get_override_chunk_num
(
void
)
{
grub_uint32_t
chunk_num
=
0
;
if
(
g_iso_fs_type
==
0
)
{
/* ISO9660: */
/* per wim */
/* 1: file_size and file_offset */
/* 2: new wim file header */
return
g_wim_valid_patch_count
*
2
;
chunk_num
=
g_wim_valid_patch_count
*
2
;
}
else
{
...
...
@@ -941,8 +946,24 @@ static grub_uint32_t ventoy_get_override_chunk_num(void)
/* 1: file_size in file_entry or extend_file_entry */
/* 2: data_size and position in extend data short ad */
/* 3: new wim file header */
return
g_wim_valid_patch_count
*
3
+
1
;
chunk_num
=
g_wim_valid_patch_count
*
3
+
1
;
}
if
(
g_suppress_wincd_override_offset
>
0
)
{
chunk_num
++
;
}
return
chunk_num
;
}
static
void
ventoy_fill_suppress_wincd_override_data
(
void
*
override
)
{
ventoy_override_chunk
*
cur
=
(
ventoy_override_chunk
*
)
override
;
cur
->
override_size
=
4
;
cur
->
img_offset
=
g_suppress_wincd_override_offset
;
grub_memcpy
(
cur
->
override_data
,
&
g_suppress_wincd_override_data
,
cur
->
override_size
);
}
static
void
ventoy_windows_fill_override_data_iso9660
(
grub_uint64_t
isosize
,
void
*
override
)
...
...
@@ -958,6 +979,12 @@ static void ventoy_windows_fill_override_data_iso9660( grub_uint64_t isosize,
cur
=
(
ventoy_override_chunk
*
)
override
;
if
(
g_suppress_wincd_override_offset
>
0
)
{
ventoy_fill_suppress_wincd_override_data
(
cur
);
cur
++
;
}
debug
(
"ventoy_windows_fill_override_data_iso9660 %lu
\n
"
,
(
ulong
)
isosize
);
for
(
node
=
g_wim_patch_head
;
node
;
node
=
node
->
next
)
...
...
@@ -1012,6 +1039,12 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
sector
=
(
isosize
+
2047
)
/
2048
;
cur
=
(
ventoy_override_chunk
*
)
override
;
if
(
g_suppress_wincd_override_offset
>
0
)
{
ventoy_fill_suppress_wincd_override_data
(
cur
);
cur
++
;
}
debug
(
"ventoy_windows_fill_override_data_udf %lu
\n
"
,
(
ulong
)
isosize
);
...
...
@@ -1182,6 +1215,61 @@ static int ventoy_windows_drive_map(ventoy_chain_head *chain)
return
0
;
}
static
int
ventoy_suppress_windows_cd_prompt
(
void
)
{
int
rc
=
1
;
const
char
*
cdprompt
=
NULL
;
grub_uint64_t
readpos
=
0
;
grub_file_t
file
=
NULL
;
grub_uint8_t
data
[
32
];
cdprompt
=
ventoy_get_env
(
"VTOY_WINDOWS_CD_PROMPT"
);
if
(
cdprompt
&&
cdprompt
[
0
]
==
'1'
&&
cdprompt
[
1
]
==
0
)
{
debug
(
"VTOY_WINDOWS_CD_PROMPT:<%s>
\n
"
,
cdprompt
);
return
0
;
}
g_ventoy_case_insensitive
=
1
;
file
=
ventoy_grub_file_open
(
VENTOY_FILE_TYPE
,
"%s/boot/bootfix.bin"
,
"(loop)"
);
g_ventoy_case_insensitive
=
0
;
if
(
!
file
)
{
debug
(
"Failed to open %s
\n
"
,
"bootfix.bin"
);
goto
end
;
}
grub_file_read
(
file
,
data
,
32
);
if
(
file
->
fs
&&
file
->
fs
->
name
&&
grub_strcmp
(
file
->
fs
->
name
,
"udf"
)
==
0
)
{
readpos
=
grub_udf_get_file_offset
(
file
);
}
else
{
readpos
=
grub_iso9660_get_last_read_pos
(
file
);
}
debug
(
"bootfix.bin readpos:%lu (sector:%lu) data: %02x %02x %02x %02x
\n
"
,
(
ulong
)
readpos
,
(
ulong
)
readpos
/
2048
,
data
[
24
],
data
[
25
],
data
[
26
],
data
[
27
]);
if
(
*
(
grub_uint32_t
*
)(
data
+
24
)
==
0x13cd0080
)
{
g_suppress_wincd_override_offset
=
readpos
+
24
;
g_suppress_wincd_override_data
=
0x13cd00fd
;
rc
=
0
;
}
debug
(
"g_suppress_wincd_override_offset:%lu
\n
"
,
(
ulong
)
g_suppress_wincd_override_offset
);
end:
check_free
(
file
,
grub_file_close
);
return
rc
;
}
grub_err_t
ventoy_cmd_windows_chain_data
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
unknown_image
=
0
;
...
...
@@ -1250,11 +1338,18 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
}
}
g_suppress_wincd_override_offset
=
0
;
if
(
!
ventoy_is_efi_os
())
/* legacy mode */
{
ventoy_suppress_windows_cd_prompt
();
}
img_chunk_size
=
g_img_chunk_list
.
cur_chunk
*
sizeof
(
ventoy_img_chunk
);
if
(
ventoy_compatible
||
unknown_image
)
{
size
=
sizeof
(
ventoy_chain_head
)
+
img_chunk_size
;
override_size
=
g_suppress_wincd_override_offset
>
0
?
sizeof
(
ventoy_override_chunk
)
:
0
;
size
=
sizeof
(
ventoy_chain_head
)
+
img_chunk_size
+
override_size
;
}
else
{
...
...
@@ -1319,6 +1414,13 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
if
(
ventoy_compatible
||
unknown_image
)
{
if
(
g_suppress_wincd_override_offset
>
0
)
{
chain
->
override_chunk_offset
=
chain
->
img_chunk_offset
+
img_chunk_size
;
chain
->
override_chunk_num
=
1
;
ventoy_fill_suppress_wincd_override_data
((
char
*
)
chain
+
chain
->
override_chunk_offset
);
}
return
0
;
}
...
...
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
View file @
1cbe4c81
...
...
@@ -111,6 +111,7 @@ typedef struct ventoy_os_param
* vtoy_reserved[1]: vtoy_debug_level
* vtoy_reserved[2]: vtoy_chain_type 0:Linux 1:Windows
* vtoy_reserved[3]: vtoy_iso_format 0:iso9660 1:udf
* vtoy_reserved[4]: vtoy_windows_cd_prompt
*
*/
grub_uint8_t
vtoy_reserved
[
32
];
// Internal use by ventoy
...
...
GRUB2/MOD_SRC/grub-2.04/install.sh
View file @
1cbe4c81
...
...
@@ -12,14 +12,15 @@ make install
PATH
=
$PATH
:
$VT_DIR
/GRUB2/INSTALL/bin/:
$VT_DIR
/GRUB2/INSTALL/sbin/
net_modules_legacy
=
"net tftp http"
all_modules_legacy
=
"date drivemap blocklist 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_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
all_modules_legacy
=
"date drivemap blocklist 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
=
"blocklist ventoy test search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
all_extra_modules
=
"elf macho offsetio regexp file"
if
[
"
$1
"
=
"uefi"
]
;
then
all_modules
=
"
$net_modules_uefi
$all_modules_uefi
"
all_modules
=
"
$net_modules_uefi
$all_modules_uefi
$all_extra_modules
"
grub-mkimage
-v
--directory
"
$VT_DIR
/GRUB2/INSTALL/lib/grub/x86_64-efi"
--prefix
'(,msdos2)/grub'
--output
"
$VT_DIR
/INSTALL/EFI/BOOT/grubx64_real.efi"
--format
'x86_64-efi'
--compression
'auto'
$all_modules_uefi
'fat'
'part_msdos'
else
all_modules
=
"
$net_modules_legacy
$all_modules_legacy
"
...
...
@@ -38,6 +39,11 @@ else
rm
-f
$VT_DIR
/GRUB2/NBP/core.0
cp
-a
$VT_DIR
/GRUB2/PXE/grub2/i386-pc/core.0
$VT_DIR
/GRUB2/NBP/core.0
||
exit
1
for
md
in
$all_extra_modules
;
do
rm
-f
$VT_DIR
/INSTALL/grub/i386-pc/
${
md
}
.mod
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/
${
md
}
.mod
$VT_DIR
/INSTALL/grub/i386-pc/
done
rm
-f
$VT_DIR
/INSTALL/grub/i386-pc/boot.img
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/boot.img
$VT_DIR
/INSTALL/grub/i386-pc/boot.img
||
exit
1
fi
IMG/cpio/ventoy/hook/
guix/ventoy-waitdev
.sh
→
IMG/cpio/ventoy/hook/
adelie/disk-hook
.sh
View file @
1cbe4c81
...
...
@@ -19,19 +19,25 @@
.
/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
while
!
[
-e
/dev/null
]
;
do
echo
'xxxxxxxxxx'
echo
'xxxxxxxxxx'
>
/dev/console
sleep
1
done
wait_for_usb_disk_ready
vtlog
"... start inotifyd listen
$vtHook
..."
$BUSYBOX_PATH
/nohup
$VTOY_PATH
/tool/inotifyd
$VTOY_PATH
/hook/guix/ventoy-disk.sh /dev:n 2>&- &
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/adelie/ventoy-hook.sh
0 → 100644
View file @
1cbe4c81
#!/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
$VTOY_PATH
/hook/adelie/disk-hook.sh &
IMG/cpio/ventoy/hook/alt/udev_disk_hook.sh
View file @
1cbe4c81
...
...
@@ -32,13 +32,14 @@ fi
#
# We do a trick for ATL series here.
# Use /dev/
l
oop
7
and wapper it as a cdrom with bind mount.
# Then the installer will accept /dev/
l
oop
7
as the install medium.
# Use /dev/
vtCheatL
oop and wapper it as a cdrom with bind mount.
# Then the installer will accept /dev/
vtCheatL
oop as the install medium.
#
ventoy_copy_device_mapper /dev/loop7
$BUSYBOX_PATH
/mkdir
-p
/tmp/loop7/device/
echo
5
>
/tmp/loop7/device/type
$BUSYBOX_PATH
/mount
--bind
/tmp/loop7 /sys/block/loop7
>>
$VTLOG
2>&1
vtCheatLoop
=
loop6
ventoy_copy_device_mapper /dev/
$vtCheatLoop
$BUSYBOX_PATH
/mkdir
-p
/tmp/
$vtCheatLoop
/device/
echo
5
>
/tmp/
$vtCheatLoop
/device/type
$BUSYBOX_PATH
/mount
--bind
/tmp/
$vtCheatLoop
/sys/block/
$vtCheatLoop
>>
$VTLOG
2>&1
# OK finish
...
...
IMG/cpio/ventoy/hook/arch/ovios-disk.sh
0 → 100644
View file @
1cbe4c81
#!/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
wait_for_usb_disk_ready
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
blkdev_num_mknod
=
$(
$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
"blkdev_num=
$blkdev_num
blkdev_num_mknod=
$blkdev_num_mknod
vtDM=
$vtDM
"
if
[
-b
/dev/
$vtDM
]
;
then
vtlog
"dev already exist ..."
else
vtlog
"mknode dev ..."
mknod
-m
660 /dev/
$vtDM
b
$blkdev_num_mknod
fi
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
View file @
1cbe4c81
...
...
@@ -26,6 +26,14 @@ if $GREP -q '^"$mount_handler"' /init; then
if
[
-f
/hooks/archiso
]
;
then
$SED
'/while ! poll_device "${dev}"/a\ if /ventoy/busybox/sh /ventoy/hook/arch/ventoy-timeout.sh ${dev}; then break; fi'
-i
/hooks/archiso
fi
elif
$GREP
-q
'^KEEP_SEARCHING'
/init
;
then
echo
'KEEP_SEARCHING found ...'
>>
$VTLOG
$SED
"/^KEEP_SEARCHING/i
\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/arch/ovios-disk.sh "
-i
/init
$BUSYBOX_PATH
/mkdir
-p
/dev
$BUSYBOX_PATH
/mkdir
-p
/sys
$BUSYBOX_PATH
/mount
-t
sysfs sys /sys
else
# some archlinux initramfs doesn't contain device-mapper udev rules file
ARCH_UDEV_DIR
=
$(
ventoy_get_udev_conf_dir
)
...
...
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
View file @
1cbe4c81
...
...
@@ -32,4 +32,5 @@ if [ "$vtdiskname" = "unknown" ]; then
exit
0
fi
vtlog
"
${
vtdiskname
#/dev/
}
2 found..."
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/udev_disk_hook.sh
"
${
vtdiskname
#/dev/
}
2"
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
View file @
1cbe4c81
...
...
@@ -21,6 +21,8 @@
ventoy_os_install_dmsetup
()
{
vtlog
"ventoy_os_install_dmsetup
$1
..."
vt_usb_disk
=
$1
# dump iso file location
...
...
IMG/cpio/ventoy/hook/guix/ventoy-before-init.sh
0 → 100644
View file @
1cbe4c81
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
$BUSYBOX_PATH
/mkdir /dev
$BUSYBOX_PATH
/mknod
-m
0660 /dev/null c 1 3
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/guix/ventoy-disk.sh &
IMG/cpio/ventoy/hook/guix/ventoy-disk.sh
View file @
1cbe4c81
...
...
@@ -19,24 +19,32 @@
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
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
vtlog
"##### INOTIFYD:
$2
/
$3
is created ..."
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
if
is_inotify_ventoy_part
$3
;
then
vtlog
"find ventoy partition ..."
$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
}
)
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
blkdev_num_mknod
=
$(
$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
"
This is
$vtDM
...
"
vtlog
"
blkdev_num=
$blkdev_num
blkdev_num_mknod=
$blkdev_num_mknod
vtDM=
$vtDM
"
set_ventoy_hook_finish
if
[
-b
/dev/
$vtDM
]
;
then
vtlog
"dev already exist ..."
else
vtlog
"mknode dev ..."
mknod
-m
660 /dev/
$vtDM
b
$blkdev_num_mknod
fi
PATH
=
$VTPATH_OLD
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment