diff --git a/ChangeLog b/ChangeLog index c93ae50b3..aa1746cf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-06-23 OKUJI Yoshinori + + * 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 * docs/tutorial.texi: Fixed some typos and syntax errors. diff --git a/NEWS b/NEWS index 55da3e982..0333a1e07 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ New in 0.5.96 - XXXX-XX-XX: * New commands, "reboot" and "halt". * New command, "hiddenmenu". You can hide the menu interface by default 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: * NetBSD ELF kernel support is added. You have to specify the new option diff --git a/stage2/boot.c b/stage2/boot.c index e73dc9509..831e41849 100644 --- a/stage2/boot.c +++ b/stage2/boot.c @@ -38,7 +38,8 @@ static struct mod_list mll[99]; */ 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; 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 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); dest += 4; diff --git a/stage2/builtins.c b/stage2/builtins.c index f4e8f7957..1da6d6cdd 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -1932,39 +1932,51 @@ static int kernel_func (char *arg, int flags) { int len; - char *kernel_arg = arg; kernel_t suggested_type = KERNEL_TYPE_NONE; + unsigned long load_flags = 0; - /* If the option `--type=TYPE' is specified, convert the string to - a kernel type. */ - if (grub_memcmp (arg, "--type=", 7) == 0) + /* Deal with GNU-style long options. */ + while (1) { - arg += 7; - - 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 + /* If the option `--type=TYPE' is specified, convert the string to + a kernel type. */ + if (grub_memcmp (arg, "--type=", 7) == 0) { - errnum = ERR_BAD_ARGUMENT; - return 1; + arg += 7; + + 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. */ mb_cmdline = (char *) MB_CMDLINE_BUF; @@ -1975,8 +1987,8 @@ kernel_func (char *arg, int flags) } /* Copy the command-line to MB_CMDLINE. */ - grub_memmove (mb_cmdline, kernel_arg, len + 1); - kernel_type = load_image (kernel_arg, mb_cmdline, suggested_type); + grub_memmove (mb_cmdline, arg, len + 1); + kernel_type = load_image (arg, mb_cmdline, suggested_type, load_flags); if (kernel_type == KERNEL_TYPE_NONE) return 1; @@ -1989,13 +2001,14 @@ static struct builtin builtin_kernel = "kernel", kernel_func, 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" "line is passed verbatim as the \"kernel command line\". Any modules" " 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" " \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and" - " \"multiboot\"." + " \"multiboot\". The option --no-mem-option tells GRUB not to pass a" + " Linux's mem option automatically." }; diff --git a/stage2/shared.h b/stage2/shared.h index 0945c34e0..2b52e12d0 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -795,7 +795,14 @@ void copy_current_part_entry (char *buf); #ifndef STAGE1_5 void bsd_boot (kernel_t type, int bootdev, char *arg) __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_initrd (char *initrd); #endif