Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
c3718d60
Commit
c3718d60
authored
Feb 22, 2022
by
longpanda
Browse files
Auto use memdisk mode for Memtest86+ iso file.
parent
d0744513
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
2 deletions
+103
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
+85
-0
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+18
-2
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
View file @
c3718d60
...
@@ -137,6 +137,10 @@ static grub_uint64_t g_enumerate_start_time_ms;
...
@@ -137,6 +137,10 @@ static grub_uint64_t g_enumerate_start_time_ms;
static
grub_uint64_t
g_enumerate_finish_time_ms
;
static
grub_uint64_t
g_enumerate_finish_time_ms
;
int
g_vtoy_file_flt
[
VTOY_FILE_FLT_BUTT
]
=
{
0
};
int
g_vtoy_file_flt
[
VTOY_FILE_FLT_BUTT
]
=
{
0
};
static
char
g_iso_vd_id_publisher
[
130
];
static
char
g_iso_vd_id_prepare
[
130
];
static
char
g_iso_vd_id_application
[
130
];
static
int
g_pager_flag
=
0
;
static
int
g_pager_flag
=
0
;
static
char
g_old_pager
[
32
];
static
char
g_old_pager
[
32
];
...
@@ -5469,6 +5473,84 @@ out:
...
@@ -5469,6 +5473,84 @@ out:
return
ret
;
return
ret
;
}
}
static
grub_err_t
ventoy_iso_vd_id_clear
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
(
void
)
ctxt
;
(
void
)
argc
;
(
void
)
args
;
g_iso_vd_id_publisher
[
0
]
=
0
;
g_iso_vd_id_prepare
[
0
]
=
0
;
g_iso_vd_id_application
[
0
]
=
0
;
return
0
;
}
static
grub_err_t
ventoy_cmd_iso_vd_id_parse
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
ret
=
1
;
int
offset
=
318
;
grub_file_t
file
=
NULL
;
(
void
)
ctxt
;
(
void
)
argc
;
file
=
grub_file_open
(
args
[
0
],
VENTOY_FILE_TYPE
);
if
(
!
file
)
{
grub_printf
(
"Failed to open %s
\n
"
,
args
[
0
]);
goto
out
;
}
grub_file_seek
(
file
,
16
*
2048
+
offset
);
grub_file_read
(
file
,
g_iso_vd_id_publisher
,
128
);
offset
+=
128
;
grub_file_seek
(
file
,
16
*
2048
+
offset
);
grub_file_read
(
file
,
g_iso_vd_id_prepare
,
128
);
offset
+=
128
;
grub_file_seek
(
file
,
16
*
2048
+
offset
);
grub_file_read
(
file
,
g_iso_vd_id_application
,
128
);
out:
check_free
(
file
,
grub_file_close
);
grub_errno
=
GRUB_ERR_NONE
;
return
ret
;
}
static
grub_err_t
ventoy_cmd_iso_vd_id_begin
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
ret
=
1
;
char
*
id
=
g_iso_vd_id_publisher
;
(
void
)
ctxt
;
(
void
)
argc
;
if
(
args
[
0
][
0
]
==
'1'
)
{
id
=
g_iso_vd_id_prepare
;
}
else
if
(
args
[
0
][
0
]
==
'2'
)
{
id
=
g_iso_vd_id_application
;
}
if
(
args
[
1
][
0
]
==
'0'
&&
grub_strncasecmp
(
id
,
args
[
2
],
grub_strlen
(
args
[
2
]))
==
0
)
{
ret
=
0
;
}
if
(
args
[
1
][
0
]
==
'1'
&&
grub_strncmp
(
id
,
args
[
2
],
grub_strlen
(
args
[
2
]))
==
0
)
{
ret
=
0
;
}
grub_errno
=
GRUB_ERR_NONE
;
return
ret
;
}
int
ventoy_env_init
(
void
)
int
ventoy_env_init
(
void
)
{
{
char
buf
[
64
];
char
buf
[
64
];
...
@@ -5664,6 +5746,9 @@ static cmd_para ventoy_cmds[] =
...
@@ -5664,6 +5746,9 @@ static cmd_para ventoy_cmds[] =
{
"vt_get_vlnk_dst"
,
grub_cmd_get_vlnk_dst
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_get_vlnk_dst"
,
grub_cmd_get_vlnk_dst
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_set_fake_vlnk"
,
ventoy_cmd_set_fake_vlnk
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_set_fake_vlnk"
,
ventoy_cmd_set_fake_vlnk
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_reset_fake_vlnk"
,
ventoy_cmd_reset_fake_vlnk
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_reset_fake_vlnk"
,
ventoy_cmd_reset_fake_vlnk
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_iso_vd_id_parse"
,
ventoy_cmd_iso_vd_id_parse
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_iso_vd_id_clear"
,
ventoy_iso_vd_id_clear
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_iso_vd_id_begin"
,
ventoy_cmd_iso_vd_id_begin
,
0
,
NULL
,
""
,
""
,
NULL
},
};
};
int
ventoy_register_all_cmd
(
void
)
int
ventoy_register_all_cmd
(
void
)
...
...
INSTALL/grub/grub.cfg
View file @
c3718d60
...
@@ -1303,14 +1303,30 @@ function iso_common_menuentry {
...
@@ -1303,14 +1303,30 @@ function iso_common_menuentry {
set vtcompat=1
set vtcompat=1
fi
fi
# auto memdisk mode for some special ISO files
vt_iso_vd_id_parse "${vtoy_iso_part}${vt_chosen_path}"
unset vtMemDiskBoot
if vt_check_mode 0; then
set vtMemDiskBoot=1
else
if [ "$grub_platform" = "pc" ]; then
if vt_iso_vd_id_begin 1 0 "Memtest86+"; then
set vtMemDiskBoot=1
fi
fi
fi
vt_iso_vd_id_clear
if [ "$grub_platform" = "pc" ]; then
if [ "$grub_platform" = "pc" ]; then
if
vt_check_mode 0
; then
if
[ -n "$vtMemDiskBoot" ]
; then
legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
else
else
legacy_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
legacy_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
fi
fi
else
else
if
vt_check_mode 0
; then
if
[ -n "$vtMemDiskBoot" ]
; then
uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
else
else
uefi_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
uefi_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
...
...
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