add a new option --no-mem-option into the command kernel.
This commit is contained in:
parent
9a41c6b1d4
commit
f0ae3c922f
5 changed files with 68 additions and 32 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2000-06-23 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
* stage2/boot.c (load_image): Take an additional argument
|
||||||
|
LOAD_FLAGS.
|
||||||
|
If the kernel type is Linux and the bit
|
||||||
|
KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS is set, don't pass a
|
||||||
|
Linux's mem option automatically.
|
||||||
|
* stage2/shared.h (load_image): Added the new argument.
|
||||||
|
* stage2/builtins.c (kernel_func): If `--no-mem-option' is
|
||||||
|
specified, set the bit KERNEL_LOAD_NO_MEM_OPTION in LOAD_FLAGS,
|
||||||
|
otherwise, LOAD_FLAGS is zero.
|
||||||
|
|
||||||
2000-06-22 OKUJI Yoshinori <okuji@gnu.org>
|
2000-06-22 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
* docs/tutorial.texi: Fixed some typos and syntax errors.
|
* docs/tutorial.texi: Fixed some typos and syntax errors.
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -4,6 +4,8 @@ New in 0.5.96 - XXXX-XX-XX:
|
||||||
* New commands, "reboot" and "halt".
|
* New commands, "reboot" and "halt".
|
||||||
* New command, "hiddenmenu". You can hide the menu interface by default
|
* New command, "hiddenmenu". You can hide the menu interface by default
|
||||||
with this command.
|
with this command.
|
||||||
|
* You can specify `--no-mem-option' to the command "kernel", if you want
|
||||||
|
GRUB not to pass a Linux's mem option automatically.
|
||||||
|
|
||||||
New in 0.5.95 - XXXX-XX-XX:
|
New in 0.5.95 - XXXX-XX-XX:
|
||||||
* NetBSD ELF kernel support is added. You have to specify the new option
|
* NetBSD ELF kernel support is added. You have to specify the new option
|
||||||
|
|
|
@ -38,7 +38,8 @@ static struct mod_list mll[99];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
kernel_t
|
kernel_t
|
||||||
load_image (char *kernel, char *arg, kernel_t suggested_type)
|
load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
|
unsigned long load_flags)
|
||||||
{
|
{
|
||||||
int len, i, exec_type = 0, align_4k = 1;
|
int len, i, exec_type = 0, align_4k = 1;
|
||||||
kernel_t type = KERNEL_TYPE_NONE;
|
kernel_t type = KERNEL_TYPE_NONE;
|
||||||
|
@ -273,7 +274,8 @@ load_image (char *kernel, char *arg, kernel_t suggested_type)
|
||||||
|
|
||||||
/* Add a mem option automatically only if the user doesn't
|
/* Add a mem option automatically only if the user doesn't
|
||||||
specify it explicitly. */
|
specify it explicitly. */
|
||||||
if (! grub_strstr (src, "mem="))
|
if (! grub_strstr (src, "mem=")
|
||||||
|
&& ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION))
|
||||||
{
|
{
|
||||||
grub_memmove (dest, "mem=", 4);
|
grub_memmove (dest, "mem=", 4);
|
||||||
dest += 4;
|
dest += 4;
|
||||||
|
|
|
@ -1932,39 +1932,51 @@ static int
|
||||||
kernel_func (char *arg, int flags)
|
kernel_func (char *arg, int flags)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *kernel_arg = arg;
|
|
||||||
kernel_t suggested_type = KERNEL_TYPE_NONE;
|
kernel_t suggested_type = KERNEL_TYPE_NONE;
|
||||||
|
unsigned long load_flags = 0;
|
||||||
|
|
||||||
/* If the option `--type=TYPE' is specified, convert the string to
|
/* Deal with GNU-style long options. */
|
||||||
a kernel type. */
|
while (1)
|
||||||
if (grub_memcmp (arg, "--type=", 7) == 0)
|
|
||||||
{
|
{
|
||||||
arg += 7;
|
/* If the option `--type=TYPE' is specified, convert the string to
|
||||||
|
a kernel type. */
|
||||||
if (grub_memcmp (arg, "netbsd", 6) == 0)
|
if (grub_memcmp (arg, "--type=", 7) == 0)
|
||||||
suggested_type = KERNEL_TYPE_NETBSD;
|
|
||||||
else if (grub_memcmp (arg, "freebsd", 7) == 0)
|
|
||||||
suggested_type = KERNEL_TYPE_FREEBSD;
|
|
||||||
else if (grub_memcmp (arg, "openbsd", 7) == 0)
|
|
||||||
/* XXX: For now, OpenBSD is identical to NetBSD, from GRUB's
|
|
||||||
point of view. */
|
|
||||||
suggested_type = KERNEL_TYPE_NETBSD;
|
|
||||||
else if (grub_memcmp (arg, "linux", 5) == 0)
|
|
||||||
suggested_type = KERNEL_TYPE_LINUX;
|
|
||||||
else if (grub_memcmp (arg, "biglinux", 8) == 0)
|
|
||||||
suggested_type = KERNEL_TYPE_BIG_LINUX;
|
|
||||||
else if (grub_memcmp (arg, "multiboot", 9) == 0)
|
|
||||||
suggested_type = KERNEL_TYPE_MULTIBOOT;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
errnum = ERR_BAD_ARGUMENT;
|
arg += 7;
|
||||||
return 1;
|
|
||||||
|
if (grub_memcmp (arg, "netbsd", 6) == 0)
|
||||||
|
suggested_type = KERNEL_TYPE_NETBSD;
|
||||||
|
else if (grub_memcmp (arg, "freebsd", 7) == 0)
|
||||||
|
suggested_type = KERNEL_TYPE_FREEBSD;
|
||||||
|
else if (grub_memcmp (arg, "openbsd", 7) == 0)
|
||||||
|
/* XXX: For now, OpenBSD is identical to NetBSD, from GRUB's
|
||||||
|
point of view. */
|
||||||
|
suggested_type = KERNEL_TYPE_NETBSD;
|
||||||
|
else if (grub_memcmp (arg, "linux", 5) == 0)
|
||||||
|
suggested_type = KERNEL_TYPE_LINUX;
|
||||||
|
else if (grub_memcmp (arg, "biglinux", 8) == 0)
|
||||||
|
suggested_type = KERNEL_TYPE_BIG_LINUX;
|
||||||
|
else if (grub_memcmp (arg, "multiboot", 9) == 0)
|
||||||
|
suggested_type = KERNEL_TYPE_MULTIBOOT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errnum = ERR_BAD_ARGUMENT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* If the `--no-mem-option' is specified, don't pass a Linux's mem
|
||||||
|
option automatically. If the kernel is another type, this flag
|
||||||
|
has no effect. */
|
||||||
|
else if (grub_memcmp (arg, "--no-mem-option", 15) == 0)
|
||||||
|
load_flags |= KERNEL_LOAD_NO_MEM_OPTION;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
kernel_arg = skip_to (0, arg);
|
/* Try the next. */
|
||||||
|
arg = skip_to (0, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = grub_strlen (kernel_arg);
|
len = grub_strlen (arg);
|
||||||
|
|
||||||
/* Reset MB_CMDLINE. */
|
/* Reset MB_CMDLINE. */
|
||||||
mb_cmdline = (char *) MB_CMDLINE_BUF;
|
mb_cmdline = (char *) MB_CMDLINE_BUF;
|
||||||
|
@ -1975,8 +1987,8 @@ kernel_func (char *arg, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the command-line to MB_CMDLINE. */
|
/* Copy the command-line to MB_CMDLINE. */
|
||||||
grub_memmove (mb_cmdline, kernel_arg, len + 1);
|
grub_memmove (mb_cmdline, arg, len + 1);
|
||||||
kernel_type = load_image (kernel_arg, mb_cmdline, suggested_type);
|
kernel_type = load_image (arg, mb_cmdline, suggested_type, load_flags);
|
||||||
if (kernel_type == KERNEL_TYPE_NONE)
|
if (kernel_type == KERNEL_TYPE_NONE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -1989,13 +2001,14 @@ static struct builtin builtin_kernel =
|
||||||
"kernel",
|
"kernel",
|
||||||
kernel_func,
|
kernel_func,
|
||||||
BUILTIN_CMDLINE,
|
BUILTIN_CMDLINE,
|
||||||
"kernel [--type=TYPE] FILE [ARG ...]",
|
"kernel [--no-mem-option] [--type=TYPE] FILE [ARG ...]",
|
||||||
"Attempt to load the primary boot image from FILE. The rest of the"
|
"Attempt to load the primary boot image from FILE. The rest of the"
|
||||||
"line is passed verbatim as the \"kernel command line\". Any modules"
|
"line is passed verbatim as the \"kernel command line\". Any modules"
|
||||||
" must be reloaded after using this command. The option --type is used"
|
" must be reloaded after using this command. The option --type is used"
|
||||||
" to suggest what type of kernel to be loaded. TYPE must be either of"
|
" to suggest what type of kernel to be loaded. TYPE must be either of"
|
||||||
" \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and"
|
" \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and"
|
||||||
" \"multiboot\"."
|
" \"multiboot\". The option --no-mem-option tells GRUB not to pass a"
|
||||||
|
" Linux's mem option automatically."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -795,7 +795,14 @@ void copy_current_part_entry (char *buf);
|
||||||
#ifndef STAGE1_5
|
#ifndef STAGE1_5
|
||||||
void bsd_boot (kernel_t type, int bootdev, char *arg)
|
void bsd_boot (kernel_t type, int bootdev, char *arg)
|
||||||
__attribute__ ((noreturn));
|
__attribute__ ((noreturn));
|
||||||
kernel_t load_image (char *kernel, char *arg, kernel_t suggested_type);
|
|
||||||
|
/* Define flags for load_image here. */
|
||||||
|
/* Don't pass a Linux's mem option automatically. */
|
||||||
|
#define KERNEL_LOAD_NO_MEM_OPTION (1 << 0)
|
||||||
|
|
||||||
|
kernel_t load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
|
unsigned long load_flags);
|
||||||
|
|
||||||
int load_module (char *module, char *arg);
|
int load_module (char *module, char *arg);
|
||||||
int load_initrd (char *initrd);
|
int load_initrd (char *initrd);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue