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
8cde5a48
Commit
8cde5a48
authored
May 30, 2020
by
longpanda
Browse files
1.0.12 release
parent
c8e86938
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
208 additions
and
14 deletions
+208
-14
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
+11
-2
IMG/cpio/ventoy/hook/android/ventoy-disk.sh
IMG/cpio/ventoy/hook/android/ventoy-disk.sh
+42
-0
IMG/cpio/ventoy/hook/android/ventoy-hook.sh
IMG/cpio/ventoy/hook/android/ventoy-hook.sh
+27
-0
IMG/cpio/ventoy/ventoy.sh
IMG/cpio/ventoy/ventoy.sh
+4
-0
INSTALL/CreatePersistentImg.sh
INSTALL/CreatePersistentImg.sh
+77
-0
INSTALL/EFI/BOOT/grubx64_real.efi
INSTALL/EFI/BOOT/grubx64_real.efi
+0
-0
INSTALL/Ventoy2Disk.exe
INSTALL/Ventoy2Disk.exe
+0
-0
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+5
-3
INSTALL/grub/i386-pc/core.img
INSTALL/grub/i386-pc/core.img
+0
-0
INSTALL/tool/VentoyWorker.sh
INSTALL/tool/VentoyWorker.sh
+10
-0
INSTALL/tool/ventoy_lib.sh
INSTALL/tool/ventoy_lib.sh
+2
-2
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/ventoy.cpio
+0
-0
INSTALL/ventoy_pack.sh
INSTALL/ventoy_pack.sh
+5
-2
README.md
README.md
+4
-1
Ventoy2Disk/Ventoy2Disk/PhyDrive.c
Ventoy2Disk/Ventoy2Disk/PhyDrive.c
+12
-0
Ventoy2Disk/Ventoy2Disk/Utility.c
Ventoy2Disk/Ventoy2Disk/Utility.c
+2
-2
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
+7
-2
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
View file @
8cde5a48
...
@@ -686,6 +686,8 @@ static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
...
@@ -686,6 +686,8 @@ static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
static
void
ventoy_linux_fill_override_data
(
grub_uint64_t
isosize
,
void
*
override
)
static
void
ventoy_linux_fill_override_data
(
grub_uint64_t
isosize
,
void
*
override
)
{
{
initrd_info
*
node
;
initrd_info
*
node
;
grub_uint32_t
mod
;
grub_uint32_t
newlen
;
grub_uint64_t
sector
;
grub_uint64_t
sector
;
ventoy_override_chunk
*
cur
;
ventoy_override_chunk
*
cur
;
...
@@ -699,13 +701,20 @@ static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *ove
...
@@ -699,13 +701,20 @@ static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *ove
continue
;
continue
;
}
}
newlen
=
(
grub_uint32_t
)(
node
->
size
+
g_ventoy_cpio_size
);
mod
=
newlen
%
4
;
if
(
mod
>
0
)
{
newlen
+=
4
-
mod
;
}
if
(
node
->
iso_type
==
0
)
if
(
node
->
iso_type
==
0
)
{
{
ventoy_iso9660_override
*
dirent
=
(
ventoy_iso9660_override
*
)
node
->
override_data
;
ventoy_iso9660_override
*
dirent
=
(
ventoy_iso9660_override
*
)
node
->
override_data
;
node
->
override_length
=
sizeof
(
ventoy_iso9660_override
);
node
->
override_length
=
sizeof
(
ventoy_iso9660_override
);
dirent
->
first_sector
=
(
grub_uint32_t
)
sector
;
dirent
->
first_sector
=
(
grub_uint32_t
)
sector
;
dirent
->
size
=
(
grub_uint32_t
)(
node
->
size
+
g_ventoy_cpio_size
)
;
dirent
->
size
=
newlen
;
dirent
->
first_sector_be
=
grub_swap_bytes32
(
dirent
->
first_sector
);
dirent
->
first_sector_be
=
grub_swap_bytes32
(
dirent
->
first_sector
);
dirent
->
size_be
=
grub_swap_bytes32
(
dirent
->
size
);
dirent
->
size_be
=
grub_swap_bytes32
(
dirent
->
size
);
...
@@ -716,7 +725,7 @@ static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *ove
...
@@ -716,7 +725,7 @@ static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *ove
ventoy_udf_override
*
udf
=
(
ventoy_udf_override
*
)
node
->
override_data
;
ventoy_udf_override
*
udf
=
(
ventoy_udf_override
*
)
node
->
override_data
;
node
->
override_length
=
sizeof
(
ventoy_udf_override
);
node
->
override_length
=
sizeof
(
ventoy_udf_override
);
udf
->
length
=
(
grub_uint32_t
)(
node
->
size
+
g_ventoy_cpio_size
)
;
udf
->
length
=
newlen
;
udf
->
position
=
(
grub_uint32_t
)
sector
-
node
->
udf_start_block
;
udf
->
position
=
(
grub_uint32_t
)
sector
-
node
->
udf_start_block
;
sector
+=
(
udf
->
length
+
2047
)
/
2048
;
sector
+=
(
udf
->
length
+
2047
)
/
2048
;
...
...
IMG/cpio/ventoy/hook/android/ventoy-disk.sh
0 → 100644
View file @
8cde5a48
#!/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
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"
if
!
[
-e
$VTOY_DM_PATH
]
;
then
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/'
)
mknod
-m
0666
$VTOY_DM_PATH
b
$blkdev_num
fi
# OK finish
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/android/ventoy-hook.sh
0 → 100644
View file @
8cde5a48
#!/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
!
[
-d
/dev
]
;
then
$BUSYBOX_PATH
/mkdir /dev
fi
$SED
"1a
\e
xport ROOT=/dev/mapper/ventoy"
-i
/init
$SED
"/check_root
\$
device/i
\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/android/ventoy-disk.sh"
-i
/init
IMG/cpio/ventoy/ventoy.sh
View file @
8cde5a48
...
@@ -184,6 +184,10 @@ ventoy_get_os_type() {
...
@@ -184,6 +184,10 @@ ventoy_get_os_type() {
fi
fi
fi
fi
if
$GREP
-q
'android.x86'
/proc/version
;
then
echo
'android'
;
return
fi
echo
"default"
echo
"default"
}
}
...
...
INSTALL/CreatePersistentImg.sh
0 → 100644
View file @
8cde5a48
#!/bin/sh
size
=
1024
fstype
=
ext4
label
=
casper-rw
print_usage
()
{
echo
'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ]'
echo
' OPTION: (optional)'
echo
' -s size in MB, default is 1024'
echo
' -t filesystem type, default is ext4 ext2/ext3/ext4/xfs are supported now'
echo
' -l label, default is casper-rw'
echo
''
}
while
[
-n
"
$1
"
]
;
do
if
[
"
$1
"
=
"-s"
]
;
then
shift
size
=
$1
elif
[
"
$1
"
=
"-t"
]
;
then
shift
fstype
=
$1
elif
[
"
$1
"
=
"-l"
]
;
then
shift
label
=
$1
else
print_usage
exit
1
fi
shift
done
# check label
if
[
-z
"
$label
"
]
;
then
echo
"The label can NOT be empty."
exit
1
fi
# check size
if
echo
$size
|
grep
-q
"^[0-9][0-9]*$"
;
then
if
[
$size
-le
1
]
;
then
echo
"Invalid size
$size
"
exit
1
fi
else
echo
"Invalid size
$size
"
exit
1
fi
# check file system type
# nodiscard must be set for ext2/3/4
# -K must be set for xfs
if
echo
$fstype
|
grep
-q
'^ext[234]$'
;
then
fsopt
=
'-E nodiscard'
elif
[
"
$fstype
"
=
"xfs"
]
;
then
fsopt
=
'-K'
else
echo
"unsupported file system
$fstype
"
exit
1
fi
# 00->ff avoid sparse file
dd
if
=
/dev/zero
bs
=
1M
count
=
$size
|
tr
'\000'
'\377'
>
persistence.img
sync
freeloop
=
$(
losetup
-f
)
losetup
$freeloop
persistence.img
mkfs
-t
$fstype
$fsopt
-L
$label
$freeloop
sync
losetup
-d
$freeloop
INSTALL/EFI/BOOT/grubx64_real.efi
View file @
8cde5a48
No preview for this file type
INSTALL/Ventoy2Disk.exe
View file @
8cde5a48
No preview for this file type
INSTALL/grub/grub.cfg
View file @
8cde5a48
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#************************************************************************************
#************************************************************************************
function ventoy_power {
function ventoy_power {
configfile
${vtoy_path}
/grub/power.cfg
configfile
($root)
/grub/power.cfg
}
}
function get_os_type {
function get_os_type {
...
@@ -117,9 +117,11 @@ function distro_specify_initrd_file_phase2 {
...
@@ -117,9 +117,11 @@ function distro_specify_initrd_file_phase2 {
vt_linux_specify_initrd_file /boot/iniramfs.igz
vt_linux_specify_initrd_file /boot/iniramfs.igz
elif [ -f (loop)/initrd-x86_64 ]; then
elif [ -f (loop)/initrd-x86_64 ]; then
vt_linux_specify_initrd_file /initrd-x86_64
vt_linux_specify_initrd_file /initrd-x86_64
elif [ -f (loop)/live/initrd.img ]; then
elif [ -f (loop)/live/initrd.img ]; then
vt_linux_specify_initrd_file /live/initrd.img
vt_linux_specify_initrd_file /live/initrd.img
elif [ -f (loop)/initrd.img ]; then
vt_linux_specify_initrd_file /initrd.img
fi
fi
}
}
...
...
INSTALL/grub/i386-pc/core.img
View file @
8cde5a48
No preview for this file type
INSTALL/tool/VentoyWorker.sh
View file @
8cde5a48
...
@@ -266,6 +266,16 @@ else
...
@@ -266,6 +266,16 @@ else
dd
status
=
none
conv
=
fsync
if
=
./boot/boot.img
of
=
$DISK
bs
=
1
count
=
440
dd
status
=
none
conv
=
fsync
if
=
./boot/boot.img
of
=
$DISK
bs
=
1
count
=
440
PART1_ACTIVE
=
$(
dd
if
=
$DISK
bs
=
1
count
=
1
skip
=
446
status
=
none | ./tool/hexdump
-n1
-e
'1/1 "%02X"'
)
PART2_ACTIVE
=
$(
dd
if
=
$DISK
bs
=
1
count
=
1
skip
=
462
status
=
none | ./tool/hexdump
-n1
-e
'1/1 "%02X"'
)
vtdebug
"PART1_ACTIVE=
$PART1_ACTIVE
PART2_ACTIVE=
$PART2_ACTIVE
"
if
[
"
$PART1_ACTIVE
"
=
"00"
]
&&
[
"
$PART2_ACTIVE
"
=
"80"
]
;
then
vtdebug
"change 1st partition active, 2nd partition inactive ..."
echo
-en
'\x80'
|
dd
of
=
$DISK
conv
=
fsync
bs
=
1
count
=
1
seek
=
446
status
=
none
echo
-en
'\x00'
|
dd
of
=
$DISK
conv
=
fsync
bs
=
1
count
=
1
seek
=
462
status
=
none
fi
./tool/xzcat ./boot/core.img.xz |
dd
status
=
none
conv
=
fsync
of
=
$DISK
bs
=
512
count
=
2047
seek
=
1
./tool/xzcat ./boot/core.img.xz |
dd
status
=
none
conv
=
fsync
of
=
$DISK
bs
=
512
count
=
2047
seek
=
1
disk_sector_num
=
$(
cat
/sys/block/
${
DISK
#/dev/
}
/size
)
disk_sector_num
=
$(
cat
/sys/block/
${
DISK
#/dev/
}
/size
)
...
...
INSTALL/tool/ventoy_lib.sh
View file @
8cde5a48
...
@@ -216,7 +216,7 @@ format_ventoy_disk() {
...
@@ -216,7 +216,7 @@ format_ventoy_disk() {
unit s
\
unit s
\
mkpart primary ntfs
$part1_start_sector
$part1_end_sector
\
mkpart primary ntfs
$part1_start_sector
$part1_end_sector
\
mkpart primary fat16
$part2_start_sector
$part2_end_sector
\
mkpart primary fat16
$part2_start_sector
$part2_end_sector
\
set
2
boot on
\
set
1
boot on
\
quit
quit
sync
sync
...
@@ -243,7 +243,7 @@ t
...
@@ -243,7 +243,7 @@ t
2
2
ef
ef
a
a
2
1
w
w
EOF
EOF
fi
fi
...
...
INSTALL/ventoy/ventoy.cpio
View file @
8cde5a48
No preview for this file type
INSTALL/ventoy_pack.sh
View file @
8cde5a48
#!/bin/sh
#!/bin/sh
dos2unix
-q
./tool/ventoy_lib.sh
dos2unix
-q
./tool/ventoy_lib.sh
dos2unix
-q
./tool/VentoyWorker.sh
.
./tool/ventoy_lib.sh
.
./tool/ventoy_lib.sh
...
@@ -30,7 +31,7 @@ while ! grep -q 524288 /sys/block/${LOOP#/dev/}/size 2>/dev/null; do
...
@@ -30,7 +31,7 @@ while ! grep -q 524288 /sys/block/${LOOP#/dev/}/size 2>/dev/null; do
sleep
1
sleep
1
done
done
format_ventoy_disk
$LOOP
format_ventoy_disk
$LOOP
fdisk
$GRUB_DIR
/sbin/grub-bios-setup
--skip-fs-probe
--directory
=
"./grub/i386-pc"
$LOOP
$GRUB_DIR
/sbin/grub-bios-setup
--skip-fs-probe
--directory
=
"./grub/i386-pc"
$LOOP
...
@@ -77,8 +78,9 @@ xz --check=crc32 $tmpdir/boot/core.img
...
@@ -77,8 +78,9 @@ xz --check=crc32 $tmpdir/boot/core.img
cp
-a
./tool
$tmpdir
/
cp
-a
./tool
$tmpdir
/
cp
-a
Ventoy2Disk.sh
$tmpdir
/
cp
-a
Ventoy2Disk.sh
$tmpdir
/
cp
-a
CreatePersistentImg.sh
$tmpdir
/
dos2unix
-q
$tmpdir
/Ventoy2Disk.sh
dos2unix
-q
$tmpdir
/Ventoy2Disk.sh
dos2unix
-q
$tmpdir
/CreatePersistentImg.sh
#32MB disk img
#32MB disk img
dd
status
=
none
if
=
$LOOP
of
=
$tmpdir
/ventoy/ventoy.disk.img
bs
=
512
count
=
$VENTOY_SECTOR_NUM
skip
=
$part2_start_sector
dd
status
=
none
if
=
$LOOP
of
=
$tmpdir
/ventoy/ventoy.disk.img
bs
=
512
count
=
$VENTOY_SECTOR_NUM
skip
=
$part2_start_sector
...
@@ -119,4 +121,5 @@ else
...
@@ -119,4 +121,5 @@ else
exit
1
exit
1
fi
fi
rm
-f
log.txt
README.md
View file @
8cde5a48
...
@@ -15,13 +15,15 @@ See https://www.ventoy.net for detail.
...
@@ -15,13 +15,15 @@ See https://www.ventoy.net for detail.
*
Legacy + UEFI supported in the same way
*
Legacy + UEFI supported in the same way
*
UEFI Secure Boot supported (since 1.0.07+)
*
UEFI Secure Boot supported (since 1.0.07+)
*
Persistence supported (since 1.0.11+)
*
Persistence supported (since 1.0.11+)
*
WIM files boot supported (Legacy + UEFI) (1.0.12+)
*
Auto installation supported (1.0.09+)
*
ISO files larger than 4GB supported
*
ISO files larger than 4GB supported
*
Native boot menu style for Legacy & UEFI
*
Native boot menu style for Legacy & UEFI
*
Most type of OS supported, 200+ iso files tested
*
Most type of OS supported, 200+ iso files tested
*
Not only boot but also complete installation process
*
Not only boot but also complete installation process
*
ISO files can be listed in List mode/TreeView mode
*
"Ventoy Compatible" concept
*
"Ventoy Compatible" concept
*
Plugin Framework
*
Plugin Framework
*
Auto installation supported (1.0.09+)
*
Readonly to USB drive during boot
*
Readonly to USB drive during boot
*
USB normal use unaffected
*
USB normal use unaffected
*
Data nondestructive during version upgrade
*
Data nondestructive during version upgrade
...
@@ -43,6 +45,7 @@ Title | Link
...
@@ -43,6 +45,7 @@ Title | Link
**Customize Theme**
|
[
https://www.ventoy.net/en/plugin_theme.html
](
https://www.ventoy.net/en/plugin_theme.html
)
**Customize Theme**
|
[
https://www.ventoy.net/en/plugin_theme.html
](
https://www.ventoy.net/en/plugin_theme.html
)
**Auto Installation**
|
[
https://www.ventoy.net/en/plugin_autoinstall.html
](
https://www.ventoy.net/en/plugin_autoinstall.html
)
**Auto Installation**
|
[
https://www.ventoy.net/en/plugin_autoinstall.html
](
https://www.ventoy.net/en/plugin_autoinstall.html
)
**Persistence Support**
|
[
https://www.ventoy.net/en/plugin_persistence.html
](
https://www.ventoy.net/en/plugin_persistence.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
)
**Memdisk Mode**
|
[
https://www.ventoy.net/en/doc_memdisk.html
](
https://www.ventoy.net/en/doc_memdisk.html
)
**Memdisk Mode**
|
[
https://www.ventoy.net/en/doc_memdisk.html
](
https://www.ventoy.net/en/doc_memdisk.html
)
**TreeView Mode**
|
[
https://www.ventoy.net/en/doc_treeview.html
](
https://www.ventoy.net/en/doc_treeview.html
)
**TreeView Mode**
|
[
https://www.ventoy.net/en/doc_treeview.html
](
https://www.ventoy.net/en/doc_treeview.html
)
**Disk Layout**
|
[
https://www.ventoy.net/en/doc_disk_layout.html
](
https://www.ventoy.net/en/doc_disk_layout.html
)
**Disk Layout**
|
[
https://www.ventoy.net/en/doc_disk_layout.html
](
https://www.ventoy.net/en/doc_disk_layout.html
)
...
...
Ventoy2Disk/Ventoy2Disk/PhyDrive.c
View file @
8cde5a48
...
@@ -1591,6 +1591,18 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
...
@@ -1591,6 +1591,18 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
Log
(
"Write Boot Image ret:%u dwSize:%u Error:%u"
,
bRet
,
dwSize
,
LASTERR
);
Log
(
"Write Boot Image ret:%u dwSize:%u Error:%u"
,
bRet
,
dwSize
,
LASTERR
);
}
}
if
(
0x00
==
MBR
.
PartTbl
[
0
].
Active
&&
0x80
==
MBR
.
PartTbl
[
1
].
Active
)
{
Log
(
"Need to chage 1st partition active and 2nd partition inactive."
);
MBR
.
PartTbl
[
0
].
Active
=
0x80
;
MBR
.
PartTbl
[
1
].
Active
=
0x00
;
SetFilePointer
(
hDrive
,
0
,
NULL
,
FILE_BEGIN
);
bRet
=
WriteFile
(
hDrive
,
&
MBR
,
512
,
&
dwSize
,
NULL
);
Log
(
"Write NEW MBR ret:%u dwSize:%u Error:%u"
,
bRet
,
dwSize
,
LASTERR
);
}
//Refresh Drive Layout
//Refresh Drive Layout
DeviceIoControl
(
hDrive
,
IOCTL_DISK_UPDATE_PROPERTIES
,
NULL
,
0
,
NULL
,
0
,
&
dwSize
,
NULL
);
DeviceIoControl
(
hDrive
,
IOCTL_DISK_UPDATE_PROPERTIES
,
NULL
,
0
,
NULL
,
0
,
&
dwSize
,
NULL
);
...
...
Ventoy2Disk/Ventoy2Disk/Utility.c
View file @
8cde5a48
...
@@ -449,7 +449,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
...
@@ -449,7 +449,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
PartSectorCount
=
DiskSectorCount
-
VENTOY_EFI_PART_SIZE
/
512
-
PartStartSector
;
PartSectorCount
=
DiskSectorCount
-
VENTOY_EFI_PART_SIZE
/
512
-
PartStartSector
;
VentoyFillLocation
(
DiskSizeBytes
,
PartStartSector
,
PartSectorCount
,
pMBR
->
PartTbl
);
VentoyFillLocation
(
DiskSizeBytes
,
PartStartSector
,
PartSectorCount
,
pMBR
->
PartTbl
);
pMBR
->
PartTbl
[
0
].
Active
=
0x
0
0
;
pMBR
->
PartTbl
[
0
].
Active
=
0x
8
0
;
// bootable
pMBR
->
PartTbl
[
0
].
FsFlag
=
0x07
;
// exFAT/NTFS/HPFS
pMBR
->
PartTbl
[
0
].
FsFlag
=
0x07
;
// exFAT/NTFS/HPFS
//Part2
//Part2
...
@@ -457,7 +457,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
...
@@ -457,7 +457,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR)
PartSectorCount
=
VENTOY_EFI_PART_SIZE
/
512
;
PartSectorCount
=
VENTOY_EFI_PART_SIZE
/
512
;
VentoyFillLocation
(
DiskSizeBytes
,
PartStartSector
,
PartSectorCount
,
pMBR
->
PartTbl
+
1
);
VentoyFillLocation
(
DiskSizeBytes
,
PartStartSector
,
PartSectorCount
,
pMBR
->
PartTbl
+
1
);
pMBR
->
PartTbl
[
1
].
Active
=
0x
8
0
;
// bootable
pMBR
->
PartTbl
[
1
].
Active
=
0x
0
0
;
pMBR
->
PartTbl
[
1
].
FsFlag
=
0xEF
;
// EFI System Partition
pMBR
->
PartTbl
[
1
].
FsFlag
=
0xEF
;
// EFI System Partition
pMBR
->
Byte55
=
0x55
;
pMBR
->
Byte55
=
0x55
;
...
...
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
View file @
8cde5a48
...
@@ -140,8 +140,7 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
...
@@ -140,8 +140,7 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
PartStartSector
=
(
UINT32
)((
SizeBytes
-
VENTOY_EFI_PART_SIZE
)
/
512
);
PartStartSector
=
(
UINT32
)((
SizeBytes
-
VENTOY_EFI_PART_SIZE
)
/
512
);
PartSectorCount
=
VENTOY_EFI_PART_SIZE
/
512
;
PartSectorCount
=
VENTOY_EFI_PART_SIZE
/
512
;
if
(
MBR
.
PartTbl
[
1
].
Active
!=
0x80
||
if
(
MBR
.
PartTbl
[
1
].
FsFlag
!=
0xEF
||
MBR
.
PartTbl
[
1
].
FsFlag
!=
0xEF
||
MBR
.
PartTbl
[
1
].
StartSectorId
!=
PartStartSector
||
MBR
.
PartTbl
[
1
].
StartSectorId
!=
PartStartSector
||
MBR
.
PartTbl
[
1
].
SectorCount
!=
PartSectorCount
)
MBR
.
PartTbl
[
1
].
SectorCount
!=
PartSectorCount
)
{
{
...
@@ -149,6 +148,12 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
...
@@ -149,6 +148,12 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes)
return
FALSE
;
return
FALSE
;
}
}
if
(
MBR
.
PartTbl
[
0
].
Active
!=
0x80
&&
MBR
.
PartTbl
[
1
].
Active
!=
0x80
)
{
Log
(
"Part1 and Part2 are both NOT active 0x%x 0x%x"
,
MBR
.
PartTbl
[
0
].
Active
,
MBR
.
PartTbl
[
1
].
Active
);
return
FALSE
;
}
Log
(
"PhysicalDrive%d is ventoy disk"
,
PhyDrive
);
Log
(
"PhysicalDrive%d is ventoy disk"
,
PhyDrive
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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