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
07574f03
Commit
07574f03
authored
Apr 05, 2023
by
longpanda
Browse files
Improve grub2 mode process for legacy BIOS mode.
parent
142aa479
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
48 deletions
+88
-48
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/i386/linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/i386/linux.c
+88
-48
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/i386/linux.c
View file @
07574f03
...
@@ -88,6 +88,8 @@ static int ventoy_linux_argc = 0;
...
@@ -88,6 +88,8 @@ static int ventoy_linux_argc = 0;
static
char
**
ventoy_linux_args
=
NULL
;
static
char
**
ventoy_linux_args
=
NULL
;
static
int
ventoy_extra_initrd_num
=
0
;
static
int
ventoy_extra_initrd_num
=
0
;
static
char
*
ventoy_extra_initrd_list
[
256
];
static
char
*
ventoy_extra_initrd_list
[
256
];
static
grub_command_func_t
ventoy_linux16_func
=
NULL
;
static
grub_command_func_t
ventoy_initrd16_func
=
NULL
;
static
grub_err_t
static
grub_err_t
grub_cmd_initrd
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[]);
grub_cmd_initrd
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[]);
...
@@ -667,54 +669,6 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
...
@@ -667,54 +669,6 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
return
0
;
return
0
;
}
}
static
grub_err_t
grub_cmd_set_boot_opt
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[])
{
int
i
;
const
char
*
vtdebug
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
ventoy_linux_args
[
ventoy_linux_argc
+
(
LINUX_MAX_ARGC
/
2
)
]
=
grub_strdup
(
argv
[
i
]);
ventoy_linux_argc
++
;
}
vtdebug
=
grub_env_get
(
"vtdebug_flag"
);
if
(
vtdebug
&&
vtdebug
[
0
])
{
ventoy_debug
=
1
;
}
if
(
ventoy_debug
)
grub_printf
(
"ventoy set boot opt %d
\n
"
,
ventoy_linux_argc
);
return
0
;
}
static
grub_err_t
grub_cmd_unset_boot_opt
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[])
{
int
i
;
(
void
)
argc
;
(
void
)
argv
;
for
(
i
=
0
;
i
<
LINUX_MAX_ARGC
;
i
++
)
{
if
(
ventoy_linux_args
[
i
])
{
grub_free
(
ventoy_linux_args
[
i
]);
}
}
ventoy_debug
=
0
;
ventoy_linux_argc
=
0
;
ventoy_initrd_called
=
0
;
grub_memset
(
ventoy_linux_args
,
0
,
sizeof
(
char
*
)
*
LINUX_MAX_ARGC
);
return
0
;
}
static
grub_err_t
static
grub_err_t
grub_cmd_extra_initrd_append
(
grub_command_t
cmd
__attribute__
((
unused
)),
grub_cmd_extra_initrd_append
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[])
int
argc
,
char
*
argv
[])
...
@@ -1576,6 +1530,92 @@ ventoy_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
...
@@ -1576,6 +1530,92 @@ ventoy_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return
grub_cmd_initrd
(
cmd
,
ventoy_extra_initrd_num
,
ventoy_extra_initrd_list
);
return
grub_cmd_initrd
(
cmd
,
ventoy_extra_initrd_num
,
ventoy_extra_initrd_list
);
}
}
static
grub_err_t
grub_cmd_set_boot_opt
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[])
{
int
i
;
const
char
*
vtdebug
;
grub_command_t
regcmd
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
ventoy_linux_args
[
ventoy_linux_argc
+
(
LINUX_MAX_ARGC
/
2
)
]
=
grub_strdup
(
argv
[
i
]);
ventoy_linux_argc
++
;
}
vtdebug
=
grub_env_get
(
"vtdebug_flag"
);
if
(
vtdebug
&&
vtdebug
[
0
])
{
ventoy_debug
=
1
;
}
if
(
ventoy_debug
)
grub_printf
(
"ventoy set boot opt %d
\n
"
,
ventoy_linux_argc
);
ventoy_linux16_func
=
ventoy_initrd16_func
=
NULL
;
regcmd
=
grub_command_find
(
"linux16"
);
if
(
regcmd
)
{
ventoy_linux16_func
=
regcmd
->
func
;
regcmd
->
func
=
grub_cmd_linux
;
}
regcmd
=
grub_command_find
(
"initrd16"
);
if
(
regcmd
)
{
ventoy_initrd16_func
=
regcmd
->
func
;
regcmd
->
func
=
ventoy_cmd_initrd
;
}
return
0
;
}
static
grub_err_t
grub_cmd_unset_boot_opt
(
grub_command_t
cmd
__attribute__
((
unused
)),
int
argc
,
char
*
argv
[])
{
int
i
;
grub_command_t
regcmd
;
(
void
)
argc
;
(
void
)
argv
;
for
(
i
=
0
;
i
<
LINUX_MAX_ARGC
;
i
++
)
{
if
(
ventoy_linux_args
[
i
])
{
grub_free
(
ventoy_linux_args
[
i
]);
}
}
ventoy_debug
=
0
;
ventoy_linux_argc
=
0
;
ventoy_initrd_called
=
0
;
grub_memset
(
ventoy_linux_args
,
0
,
sizeof
(
char
*
)
*
LINUX_MAX_ARGC
);
if
(
ventoy_linux16_func
)
{
regcmd
=
grub_command_find
(
"linux16"
);
if
(
regcmd
)
{
regcmd
->
func
=
ventoy_linux16_func
;
}
ventoy_linux16_func
=
NULL
;
}
if
(
ventoy_initrd16_func
)
{
regcmd
=
grub_command_find
(
"initrd16"
);
if
(
regcmd
)
{
regcmd
->
func
=
ventoy_initrd16_func
;
}
ventoy_initrd16_func
=
NULL
;
}
return
0
;
}
static
grub_command_t
cmd_linux
,
cmd_initrd
,
cmd_linuxefi
,
cmd_initrdefi
;
static
grub_command_t
cmd_linux
,
cmd_initrd
,
cmd_linuxefi
,
cmd_initrdefi
;
static
grub_command_t
cmd_set_bootopt
,
cmd_unset_bootopt
,
cmd_extra_initrd_append
,
cmd_extra_initrd_reset
;
static
grub_command_t
cmd_set_bootopt
,
cmd_unset_bootopt
,
cmd_extra_initrd_append
,
cmd_extra_initrd_reset
;
...
...
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