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
3c46432d
Commit
3c46432d
authored
Jul 18, 2020
by
longpanda
Browse files
Add new iso support
parent
88dcceea
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
558 additions
and
7 deletions
+558
-7
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
...dk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
+107
-1
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
...dk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
+3
-0
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
...le201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
+16
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+12
-0
IMG/cpio/ventoy/hook/cdlinux/ventoy-hook.sh
IMG/cpio/ventoy/hook/cdlinux/ventoy-hook.sh
+2
-2
IMG/cpio/ventoy/hook/cucumber/disk-hook.sh
IMG/cpio/ventoy/hook/cucumber/disk-hook.sh
+52
-0
IMG/cpio/ventoy/hook/cucumber/ventoy-hook.sh
IMG/cpio/ventoy/hook/cucumber/ventoy-hook.sh
+26
-0
IMG/cpio/ventoy/hook/fatdog/disk-hook.sh
IMG/cpio/ventoy/hook/fatdog/disk-hook.sh
+43
-0
IMG/cpio/ventoy/hook/fatdog/ventoy-hook.sh
IMG/cpio/ventoy/hook/fatdog/ventoy-hook.sh
+23
-0
IMG/cpio/ventoy/hook/kwort/disk-hook.sh
IMG/cpio/ventoy/hook/kwort/disk-hook.sh
+43
-0
IMG/cpio/ventoy/hook/kwort/ventoy-hook.sh
IMG/cpio/ventoy/hook/kwort/ventoy-hook.sh
+22
-0
IMG/cpio/ventoy/hook/parabola/ventoy-disk.sh
IMG/cpio/ventoy/hook/parabola/ventoy-disk.sh
+48
-0
IMG/cpio/ventoy/hook/parabola/ventoy-hook.sh
IMG/cpio/ventoy/hook/parabola/ventoy-hook.sh
+44
-0
IMG/cpio/ventoy/hook/parabola/ventoy-timeout.sh
IMG/cpio/ventoy/hook/parabola/ventoy-timeout.sh
+36
-0
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
+5
-0
IMG/cpio/ventoy/hook/rhel7/ventoy-make-link.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-make-link.sh
+35
-0
IMG/cpio/ventoy/ventoy.sh
IMG/cpio/ventoy/ventoy.sh
+20
-2
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+20
-1
INSTALL/ventoy_pack.sh
INSTALL/ventoy_pack.sh
+1
-0
No files found.
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
View file @
3c46432d
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <Ventoy.h>
#include <Ventoy.h>
BOOLEAN
gDebugPrint
=
FALSE
;
BOOLEAN
gDebugPrint
=
FALSE
;
BOOLEAN
gLoadIsoEfi
=
FALSE
;
ventoy_ram_disk
g_ramdisk_param
;
ventoy_ram_disk
g_ramdisk_param
;
ventoy_chain_head
*
g_chain
;
ventoy_chain_head
*
g_chain
;
ventoy_img_chunk
*
g_chunk
;
ventoy_img_chunk
*
g_chunk
;
...
@@ -52,6 +53,8 @@ static grub_env_get_pf grub_env_get = NULL;
...
@@ -52,6 +53,8 @@ static grub_env_get_pf grub_env_get = NULL;
ventoy_grub_param_file_replace
*
g_file_replace_list
=
NULL
;
ventoy_grub_param_file_replace
*
g_file_replace_list
=
NULL
;
ventoy_efi_file_replace
g_efi_file_replace
;
ventoy_efi_file_replace
g_efi_file_replace
;
CONST
CHAR16
gIso9660EfiDriverPath
[]
=
ISO9660_EFI_DRIVER_PATH
;
BOOLEAN
g_fix_windows_1st_cdrom_issue
=
FALSE
;
BOOLEAN
g_fix_windows_1st_cdrom_issue
=
FALSE
;
STATIC
BOOLEAN
g_hook_keyboard
=
FALSE
;
STATIC
BOOLEAN
g_hook_keyboard
=
FALSE
;
...
@@ -67,7 +70,7 @@ CONST CHAR16 *gEfiBootFileName[] =
...
@@ -67,7 +70,7 @@ CONST CHAR16 *gEfiBootFileName[] =
L"
\\
EFI
\\
BOOT
\\
GRUBX64.EFI"
,
L"
\\
EFI
\\
BOOT
\\
GRUBX64.EFI"
,
L"
\\
EFI
\\
BOOT
\\
BOOTx64.EFI"
,
L"
\\
EFI
\\
BOOT
\\
BOOTx64.EFI"
,
L"
\\
EFI
\\
BOOT
\\
bootx64.efi"
,
L"
\\
EFI
\\
BOOT
\\
bootx64.efi"
,
L"
\\
efi
\\
boot
\\
bootx64.efi"
,
L"
\\
efi
\\
boot
\\
bootx64.efi"
};
};
VOID
EFIAPI
VtoyDebug
(
IN
CONST
CHAR8
*
Format
,
...)
VOID
EFIAPI
VtoyDebug
(
IN
CONST
CHAR8
*
Format
,
...)
...
@@ -484,6 +487,93 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
...
@@ -484,6 +487,93 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
}
}
}
}
STATIC
EFI_STATUS
EFIAPI
ventoy_find_iso_disk_fs
(
IN
EFI_HANDLE
ImageHandle
)
{
UINTN
i
=
0
;
UINTN
Count
=
0
;
EFI_HANDLE
Parent
=
NULL
;
EFI_HANDLE
*
Handles
=
NULL
;
EFI_STATUS
Status
=
EFI_SUCCESS
;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
pFile
=
NULL
;
EFI_DEVICE_PATH_PROTOCOL
*
pDevPath
=
NULL
;
Status
=
gBS
->
LocateHandleBuffer
(
ByProtocol
,
&
gEfiSimpleFileSystemProtocolGuid
,
NULL
,
&
Count
,
&
Handles
);
if
(
EFI_ERROR
(
Status
))
{
return
Status
;
}
debug
(
"ventoy_find_iso_disk_fs fs count:%u"
,
Count
);
for
(
i
=
0
;
i
<
Count
;
i
++
)
{
Status
=
gBS
->
HandleProtocol
(
Handles
[
i
],
&
gEfiSimpleFileSystemProtocolGuid
,
(
VOID
**
)
&
pFile
);
if
(
EFI_ERROR
(
Status
))
{
continue
;
}
Status
=
gBS
->
OpenProtocol
(
Handles
[
i
],
&
gEfiDevicePathProtocolGuid
,
(
VOID
**
)
&
pDevPath
,
ImageHandle
,
Handles
[
i
],
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if
(
EFI_ERROR
(
Status
))
{
debug
(
"Failed to open device path protocol %r"
,
Status
);
continue
;
}
debug
(
"Handle:%p FS DP: <%s>"
,
Handles
[
i
],
ConvertDevicePathToText
(
pDevPath
,
FALSE
,
FALSE
));
Parent
=
ventoy_get_parent_handle
(
pDevPath
);
if
(
Parent
==
gBlockData
.
RawBlockIoHandle
)
{
debug
(
"Find ventoy disk fs"
);
gBlockData
.
DiskFsHandle
=
Handles
[
i
];
gBlockData
.
pDiskFs
=
pFile
;
gBlockData
.
pDiskFsDevPath
=
pDevPath
;
break
;
}
}
FreePool
(
Handles
);
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_load_isoefi_driver
(
IN
EFI_HANDLE
ImageHandle
)
{
EFI_HANDLE
Image
=
NULL
;
EFI_STATUS
Status
=
EFI_SUCCESS
;
CHAR16
LogVar
[
4
]
=
L"5"
;
Status
=
ventoy_load_image
(
ImageHandle
,
gBlockData
.
pDiskFsDevPath
,
gIso9660EfiDriverPath
,
sizeof
(
gIso9660EfiDriverPath
),
&
Image
);
debug
(
"load iso efi driver status:%r"
,
Status
);
if
(
gDebugPrint
)
{
gRT
->
SetVariable
(
L"FS_LOGGING"
,
&
gShellVariableGuid
,
EFI_VARIABLE_BOOTSERVICE_ACCESS
|
EFI_VARIABLE_RUNTIME_ACCESS
,
sizeof
(
LogVar
),
LogVar
);
}
gRT
->
SetVariable
(
L"FS_NAME_NOCASE"
,
&
gShellVariableGuid
,
EFI_VARIABLE_BOOTSERVICE_ACCESS
|
EFI_VARIABLE_RUNTIME_ACCESS
,
sizeof
(
LogVar
),
LogVar
);
gBlockData
.
IsoDriverImage
=
Image
;
Status
=
gBS
->
StartImage
(
Image
,
NULL
,
NULL
);
debug
(
"Start iso efi driver status:%r"
,
Status
);
return
EFI_SUCCESS
;
}
STATIC
EFI_STATUS
EFIAPI
ventoy_parse_cmdline
(
IN
EFI_HANDLE
ImageHandle
)
STATIC
EFI_STATUS
EFIAPI
ventoy_parse_cmdline
(
IN
EFI_HANDLE
ImageHandle
)
{
{
UINT32
i
=
0
;
UINT32
i
=
0
;
...
@@ -513,6 +603,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
...
@@ -513,6 +603,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
gDebugPrint
=
TRUE
;
gDebugPrint
=
TRUE
;
}
}
if
(
StrStr
(
pCmdLine
,
L"isoefi=on"
))
{
gLoadIsoEfi
=
TRUE
;
}
pPos
=
StrStr
(
pCmdLine
,
L"FirstTry=@"
);
pPos
=
StrStr
(
pCmdLine
,
L"FirstTry=@"
);
if
(
pPos
)
if
(
pPos
)
{
{
...
@@ -639,6 +734,11 @@ EFI_STATUS EFIAPI ventoy_clean_env(VOID)
...
@@ -639,6 +734,11 @@ EFI_STATUS EFIAPI ventoy_clean_env(VOID)
FreePool
(
g_sector_flag
);
FreePool
(
g_sector_flag
);
g_sector_flag_num
=
0
;
g_sector_flag_num
=
0
;
if
(
gLoadIsoEfi
&&
gBlockData
.
IsoDriverImage
)
{
gBS
->
UnloadImage
(
gBlockData
.
IsoDriverImage
);
}
gBS
->
DisconnectController
(
gBlockData
.
Handle
,
NULL
,
NULL
);
gBS
->
DisconnectController
(
gBlockData
.
Handle
,
NULL
,
NULL
);
gBS
->
UninstallMultipleProtocolInterfaces
(
gBlockData
.
Handle
,
gBS
->
UninstallMultipleProtocolInterfaces
(
gBlockData
.
Handle
,
...
@@ -857,6 +957,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
...
@@ -857,6 +957,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
ventoy_save_variable
();
ventoy_save_variable
();
ventoy_find_iso_disk
(
ImageHandle
);
ventoy_find_iso_disk
(
ImageHandle
);
if
(
gLoadIsoEfi
)
{
ventoy_find_iso_disk_fs
(
ImageHandle
);
ventoy_load_isoefi_driver
(
ImageHandle
);
}
ventoy_debug_pause
();
ventoy_debug_pause
();
ventoy_install_blockio
(
ImageHandle
,
g_chain
->
virt_img_size_in_bytes
);
ventoy_install_blockio
(
ImageHandle
,
g_chain
->
virt_img_size_in_bytes
);
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
View file @
3c46432d
...
@@ -168,6 +168,8 @@ typedef struct ventoy_virt_chunk
...
@@ -168,6 +168,8 @@ typedef struct ventoy_virt_chunk
#define VTOY_BLOCK_DEVICE_PATH_GUID \
#define VTOY_BLOCK_DEVICE_PATH_GUID \
{ 0x37b87ac6, 0xc180, 0x4583, { 0xa7, 0x05, 0x41, 0x4d, 0xa8, 0xf7, 0x7e, 0xd2 }}
{ 0x37b87ac6, 0xc180, 0x4583, { 0xa7, 0x05, 0x41, 0x4d, 0xa8, 0xf7, 0x7e, 0xd2 }}
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_x64.efi"
#define VTOY_BLOCK_DEVICE_PATH_NAME L"ventoy"
#define VTOY_BLOCK_DEVICE_PATH_NAME L"ventoy"
#if defined (MDE_CPU_IA32)
#if defined (MDE_CPU_IA32)
...
@@ -208,6 +210,7 @@ typedef struct vtoy_block_data
...
@@ -208,6 +210,7 @@ typedef struct vtoy_block_data
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
pDiskFs
;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
pDiskFs
;
EFI_DEVICE_PATH_PROTOCOL
*
pDiskFsDevPath
;
EFI_DEVICE_PATH_PROTOCOL
*
pDiskFsDevPath
;
EFI_HANDLE
IsoDriverImage
;
}
vtoy_block_data
;
}
vtoy_block_data
;
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
View file @
3c46432d
...
@@ -700,7 +700,15 @@ ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
...
@@ -700,7 +700,15 @@ ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
{
{
(
VOID
)
This
;
(
VOID
)
This
;
if
(
Position
<=
g_efi_file_replace
.
FileSizeBytes
)
{
g_efi_file_replace
.
CurPos
=
Position
;
g_efi_file_replace
.
CurPos
=
Position
;
}
else
{
g_efi_file_replace
.
CurPos
=
g_efi_file_replace
.
FileSizeBytes
;
}
return
EFI_SUCCESS
;
return
EFI_SUCCESS
;
}
}
...
@@ -815,6 +823,8 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
...
@@ -815,6 +823,8 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
CHAR8
TmpName
[
256
];
CHAR8
TmpName
[
256
];
ventoy_virt_chunk
*
virt
=
NULL
;
ventoy_virt_chunk
*
virt
=
NULL
;
debug
(
"## ventoy_wrapper_file_open <%s> "
,
Name
);
Status
=
g_original_fopen
(
This
,
New
,
Name
,
Mode
,
Attributes
);
Status
=
g_original_fopen
(
This
,
New
,
Name
,
Mode
,
Attributes
);
if
(
EFI_ERROR
(
Status
))
if
(
EFI_ERROR
(
Status
))
{
{
...
@@ -850,6 +860,11 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
...
@@ -850,6 +860,11 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
return
Status
;
return
Status
;
}
}
}
}
if
(
StrCmp
(
Name
,
L"
\\
EFI
\\
BOOT"
)
==
0
)
{
(
*
New
)
->
Open
=
ventoy_wrapper_file_open
;
}
}
}
return
Status
;
return
Status
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
3c46432d
...
@@ -1459,6 +1459,7 @@ grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file)
...
@@ -1459,6 +1459,7 @@ grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file)
int
ventoy_has_efi_eltorito
(
grub_file_t
file
,
grub_uint32_t
sector
)
int
ventoy_has_efi_eltorito
(
grub_file_t
file
,
grub_uint32_t
sector
)
{
{
int
i
;
int
i
;
int
x86count
=
0
;
grub_uint8_t
buf
[
512
];
grub_uint8_t
buf
[
512
];
grub_file_seek
(
file
,
sector
*
2048
);
grub_file_seek
(
file
,
sector
*
2048
);
...
@@ -1470,6 +1471,11 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
...
@@ -1470,6 +1471,11 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
return
1
;
return
1
;
}
}
if
(
buf
[
0
]
==
0x01
&&
buf
[
1
]
==
0x00
)
{
x86count
++
;
}
for
(
i
=
64
;
i
<
(
int
)
sizeof
(
buf
);
i
+=
32
)
for
(
i
=
64
;
i
<
(
int
)
sizeof
(
buf
);
i
+=
32
)
{
{
if
((
buf
[
i
]
==
0x90
||
buf
[
i
]
==
0x91
)
&&
buf
[
i
+
1
]
==
0xEF
)
if
((
buf
[
i
]
==
0x90
||
buf
[
i
]
==
0x91
)
&&
buf
[
i
+
1
]
==
0xEF
)
...
@@ -1477,6 +1483,12 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
...
@@ -1477,6 +1483,12 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
debug
(
"%s efi eltorito offset %d 0x%02x
\n
"
,
file
->
name
,
i
,
buf
[
i
]);
debug
(
"%s efi eltorito offset %d 0x%02x
\n
"
,
file
->
name
,
i
,
buf
[
i
]);
return
1
;
return
1
;
}
}
if
(
buf
[
i
]
==
0x91
&&
buf
[
i
+
1
]
==
0x00
&&
x86count
==
1
)
{
debug
(
"0x9100 assume %s efi eltorito offset %d 0x%02x
\n
"
,
file
->
name
,
i
,
buf
[
i
]);
return
1
;
}
}
}
debug
(
"%s does not contain efi eltorito
\n
"
,
file
->
name
);
debug
(
"%s does not contain efi eltorito
\n
"
,
file
->
name
);
...
...
IMG/cpio/ventoy/hook/cdlinux/ventoy-hook.sh
View file @
3c46432d
...
@@ -36,8 +36,8 @@ done
...
@@ -36,8 +36,8 @@ done
$BUSYBOX_PATH
/umount /vtmnt
&&
$BUSYBOX_PATH
/rm
-rf
/vtmnt
$BUSYBOX_PATH
/umount /vtmnt
&&
$BUSYBOX_PATH
/rm
-rf
/vtmnt
$BUSYBOX_PATH
/cp
-a
/ventoy /ventoy_rdroot
$BUSYBOX_PATH
/cp
-a
/ventoy /ventoy_rdroot
echo
"CDL_DEV=/dev/mapper/ventoy"
>>
/ventoy_rdroot/etc/
default/cdlinux
echo
'
echo "CDL_DEV=/dev/mapper/ventoy"
>>"$VAR_FILE"'
>>
/ventoy_rdroot/etc/
rc.d/rc.var
ventoy_set_rule_dir_prefix /ventoy_rdroot
ventoy_set_rule_dir_prefix /ventoy_rdroot
ventoy_systemd_udevd_work_around
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k"
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k
noreplace
"
IMG/cpio/ventoy/hook/cucumber/disk-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
exit
0
fi
vtlog
"#######
$0
$*
########"
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
wait_for_usb_disk_ready
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
blkdev_num
=
$(
dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
vtDM
=
$(
ventoy_find_dm_id
${
blkdev_num
}
)
vtlog
"mount media /dev/
$vtDM
..."
if
!
[
-e
/media/install
]
;
then
mkdir
-p
/media/install
fi
mount /dev/
$vtDM
/media/install
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/cucumber/ventoy-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
if
[
-e
/sbin/mount_installer
]
;
then
echo
"hook at mount_installer ..."
>>
$VTLOG
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/cucumber/disk-hook.sh"
-i
/sbin/mount_installer
fi
IMG/cpio/ventoy/hook/fatdog/disk-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
exit
0
fi
vtlog
"#######
$0
$*
########"
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
wait_for_usb_disk_ready
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/fatdog/ventoy-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
$SED
"/find_local_device *(/a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/fatdog/disk-hook.sh"
-i
/init
$SED
"/find_and_choose_local_device *(/a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/fatdog/disk-hook.sh"
-i
/init
IMG/cpio/ventoy/hook/kwort/disk-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
exit
0
fi
vtlog
"#######
$0
$*
########"
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
wait_for_usb_disk_ready
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/kwort/ventoy-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/kwort/disk-hook.sh"
-i
/etc/rc.d/init/media
IMG/cpio/ventoy/hook/parabola/ventoy-disk.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
vtlog
"#########
$0
$*
############"
if
is_ventoy_hook_finished
;
then
exit
0
fi
wait_for_usb_disk_ready
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
if
[
-n
"
$1
"
]
;
then
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
vtDM
=
$(
ventoy_find_dm_id
${
blkdev_num
}
)
vtlog
"ln -s /dev/
$vtDM
$1
"
ln
-s
/dev/
$vtDM
"
$1
"
fi
# OK finish
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/parabola/ventoy-hook.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
if
$GREP
-q
'^"$mount_handler"'
/init
;
then
echo
'use mount_handler ...'
>>
$VTLOG
$SED
"/^
\"\$
mount_handler
\"
/i
\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/parabola/ventoy-disk.sh
\"\$
parabolaisodevice
\"
"
-i
/init
if
[
-f
/hooks/parabolaiso
]
;
then
$SED
'/while ! poll_device "${dev}"/a\ if /ventoy/busybox/sh /ventoy/hook/parabola/ventoy-timeout.sh ${dev}; then break; fi'
-i
/hooks/parabolaiso
fi
else
# some archlinux initramfs doesn't contain device-mapper udev rules file
ARCH_UDEV_DIR
=
$(
ventoy_get_udev_conf_dir
)
if
[
-s
"
$ARCH_UDEV_DIR
/13-dm-disk.rules"
]
;
then
echo
'dm-disk rule exist'
>>
$VTLOG
else
echo
'Copy dm-disk rule file'
>>
$VTLOG
$CAT
$VTOY_PATH
/hook/default/13-dm-disk.rules
>
"
$ARCH_UDEV_DIR
/13-dm-disk.rules"
fi
# use default proc
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k"
fi
IMG/cpio/ventoy/hook/parabola/ventoy-timeout.sh
0 → 100644
View file @
3c46432d
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
vtlog
"#########
$0
$*
############"
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
vtDM
=
$(
ventoy_find_dm_id
${
blkdev_num
}
)
if
[
-b
/dev/
$vtDM
]
;
then
vtlog
"ln -s /dev/
$vtDM
$1
"
ln
-s
/dev/
$vtDM
"
$1
"
exit
0
else
vtlog
"Device-mapper not found"
exit
1
fi
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
View file @
3c46432d
...
@@ -60,6 +60,11 @@ fi
...
@@ -60,6 +60,11 @@ fi
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/
${
vtPriority
}
-ventoy-inotifyd-start
.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-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
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/
${
vtPriority
}
-ventoy-timeout
.sh
if
[
-e
/sbin/dmsquash-live-root
]
;
then
echo
"patch /sbin/dmsquash-live-root ..."
>>
$VTLOG
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/rhel7/ventoy-make-link.sh"
-i
/sbin/dmsquash-live-root
fi
# suppress write protected mount warning
# suppress write protected mount warning
if
[
-e
/usr/sbin/anaconda-diskroot
]
;
then
if
[
-e
/usr/sbin/anaconda-diskroot
]
;
then
$SED
's/^mount $dev $repodir/mount -oro $dev $repodir/'
-i
/usr/sbin/anaconda-diskroot
$SED
's/^mount $dev $repodir/mount -oro $dev $repodir/'
-i
/usr/sbin/anaconda-diskroot
...
...
IMG/cpio/ventoy/hook/rhel7/ventoy-make-link.sh
0 → 100644
View file @
3c46432d
#!/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
IMG/cpio/ventoy/ventoy.sh
View file @
3c46432d
...
@@ -134,7 +134,8 @@ ventoy_get_os_type() {
...
@@ -134,7 +134,8 @@ ventoy_get_os_type() {
echo
'xen'
;
return
echo
'xen'
;
return
elif
$GREP
-q
'SUSE '
/etc/os-release
;
then
elif
$GREP
-q
'SUSE '
/etc/os-release
;
then
echo
'suse'
;
return
echo
'suse'
;
return
elif
$GREP
-q
'uruk'
/etc/os-release
;
then
echo
'debian'
;
return
fi
fi
fi
fi
...
@@ -204,6 +205,23 @@ ventoy_get_os_type() {
...
@@ -204,6 +205,23 @@ ventoy_get_os_type() {
echo
'cdlinux'
;
return
echo
'cdlinux'
;
return
fi
fi
if
$GREP
-q
'parabola'
/proc/version
;
then
echo
'parabola'
;
return
fi
if
$GREP
-q
'cucumber'
/proc/version
;
then
echo
'cucumber'
;
return
fi
if
$GREP
-q
'fatdog'
/proc/version
;
then
echo
'fatdog'
;
return
fi
if
$GREP
-q
'KWORT'
/proc/version
;
then
echo
'kwort'
;
return
fi
echo
"default"
echo
"default"
}
}
...
...
INSTALL/grub/grub.cfg
View file @
3c46432d
...
@@ -180,6 +180,21 @@ function distro_specify_initrd_file_phase2 {
...
@@ -180,6 +180,21 @@ function distro_specify_initrd_file_phase2 {
vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
elif [ -f (loop)/CDlinux/initrd ]; then
elif [ -f (loop)/CDlinux/initrd ]; then
vt_linux_specify_initrd_file /CDlinux/initrd
vt_linux_specify_initrd_file /CDlinux/initrd
elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
fi
elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
#Qubes
vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
if [ "$grub_platform" != "pc" ]; then
vt_add_replace_file 0 "initrd.img"
fi
elif [ -f (loop)/initrd ]; then
vt_linux_specify_initrd_file /initrd
elif [ -f (loop)/live/initrd1 ]; then
vt_linux_specify_initrd_file /live/initrd1
fi
fi
}
}
...
@@ -278,6 +293,10 @@ function uefi_linux_menu_func {
...
@@ -278,6 +293,10 @@ function uefi_linux_menu_func {
elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
fi
fi
elif [ -d (loop)/EFI/boot/entries ]; then
if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
fi
elif [ -e (loop)/syslinux/alt0/full.cz ]; then
elif [ -e (loop)/syslinux/alt0/full.cz ]; then
vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
...
...
INSTALL/ventoy_pack.sh
View file @
3c46432d
...
@@ -77,6 +77,7 @@ dd if=$LOOP of=$tmpdir/boot/core.img bs=512 count=2047 skip=1 status=none
...
@@ -77,6 +77,7 @@ dd if=$LOOP of=$tmpdir/boot/core.img bs=512 count=2047 skip=1 status=none
xz
--check
=
crc32
$tmpdir
/boot/core.img
xz
--check
=
crc32
$tmpdir
/boot/core.img
cp
-a
./tool
$tmpdir
/
cp
-a
./tool
$tmpdir
/
rm
-f
$tmpdir
/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
cp
-a
Ventoy2Disk.sh
$tmpdir
/
cp
-a
Ventoy2Disk.sh
$tmpdir
/
cp
-a
CreatePersistentImg.sh
$tmpdir
/
cp
-a
CreatePersistentImg.sh
$tmpdir
/
dos2unix
-q
$tmpdir
/Ventoy2Disk.sh
dos2unix
-q
$tmpdir
/Ventoy2Disk.sh
...
...
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