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
f7e6bbc7
Commit
f7e6bbc7
authored
Feb 12, 2025
by
longpanda
Browse files
Fix the "Unsupported vtoy type unknown" error when boot a VDI file created by VirtualBox 7.x
parent
ee994a05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+2
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
+18
-5
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
f7e6bbc7
...
@@ -861,7 +861,8 @@ typedef struct vhd_footer_t
...
@@ -861,7 +861,8 @@ typedef struct vhd_footer_t
grub_uint8_t
savedst
;
// Saved state
grub_uint8_t
savedst
;
// Saved state
}
vhd_footer_t
;
}
vhd_footer_t
;
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
#define VDI_IMAGE_FILE_INFO2 "<<< Oracle VirtualBox Disk Image >>>\n"
/** Image signature. */
/** Image signature. */
#define VDI_IMAGE_SIGNATURE (0xbeda107f)
#define VDI_IMAGE_SIGNATURE (0xbeda107f)
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
View file @
f7e6bbc7
...
@@ -536,12 +536,25 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
...
@@ -536,12 +536,25 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
{
{
grub_file_seek
(
file
,
0
);
grub_file_seek
(
file
,
0
);
grub_file_read
(
file
,
&
vdihdr
,
sizeof
(
vdihdr
));
grub_file_read
(
file
,
&
vdihdr
,
sizeof
(
vdihdr
));
if
(
vdihdr
.
u32Signature
==
VDI_IMAGE_SIGNATURE
&&
if
(
vdihdr
.
u32Signature
==
VDI_IMAGE_SIGNATURE
)
grub_strncmp
(
vdihdr
.
szFileInfo
,
VDI_IMAGE_FILE_INFO
,
grub_strlen
(
VDI_IMAGE_FILE_INFO
))
==
0
)
{
{
offset
=
2
*
1048576
;
g_img_trim_head_secnum
=
offset
/
512
;
grub_snprintf
(
type
,
sizeof
(
type
),
"vdi"
);
grub_snprintf
(
type
,
sizeof
(
type
),
"vdi"
);
if
(
grub_strncmp
(
vdihdr
.
szFileInfo
,
VDI_IMAGE_FILE_INFO
,
grub_strlen
(
VDI_IMAGE_FILE_INFO
))
==
0
)
{
offset
=
2
*
1048576
;
g_img_trim_head_secnum
=
offset
/
512
;
debug
(
"VDI V1
\n
"
);
}
else
if
(
grub_strncmp
(
vdihdr
.
szFileInfo
,
VDI_IMAGE_FILE_INFO2
,
grub_strlen
(
VDI_IMAGE_FILE_INFO2
))
==
0
)
{
offset
=
2
*
1048576
;
g_img_trim_head_secnum
=
offset
/
512
;
debug
(
"VDI V2
\n
"
);
}
else
{
debug
(
"invalid file info <%s>
\n
"
,
vdihdr
.
szFileInfo
);
}
}
}
else
else
{
{
...
@@ -568,7 +581,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
...
@@ -568,7 +581,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
if
(
gpt
->
MBR
.
Byte55
!=
0x55
||
gpt
->
MBR
.
ByteAA
!=
0xAA
)
if
(
gpt
->
MBR
.
Byte55
!=
0x55
||
gpt
->
MBR
.
ByteAA
!=
0xAA
)
{
{
grub_env_set
(
args
[
1
],
"unknown"
);
grub_env_set
(
args
[
1
],
"unknown"
);
debug
(
"invalid mbr signature: 0x%x 0x%x
\n
"
,
gpt
->
MBR
.
Byte55
,
gpt
->
MBR
.
ByteAA
);
debug
(
"invalid mbr signature: 0x%x 0x%x
offset=%d
\n
"
,
gpt
->
MBR
.
Byte55
,
gpt
->
MBR
.
ByteAA
,
offset
);
goto
end
;
goto
end
;
}
}
...
...
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