add --force into the command chainloader.

This commit is contained in:
okuji 2000-01-15 03:20:59 +00:00
parent 7692b3eab6
commit 18c2360755
5 changed files with 51 additions and 10 deletions

View file

@ -1,3 +1,12 @@
2000-01-15 OKUJI Yoshinori <okuji@gnu.org>
* stage2/builtins.c (chainloader_func): If --force is specified
in ARG, don't check for the signature.
* docs/tutorial.texi (Chain-loading): Added a caution about some
defective boot loaders and --force.
* docs/user-ref.texi (Command-line-specific commands): Added a
description about --force.
2000-01-11 OKUJI Yoshinori <okuji@gnu.org>
* docs/prog-ref.texi (LBA mode disk I/O): Added a footnote about

3
NEWS
View file

@ -27,6 +27,9 @@ New in 0.5.94:
filename from "/boot/grub/menu.lst" even if a Stage 1.5 is used.
* New program, ``grub-install''.
* The command "blocklist" prints the blocklist notation of a file.
* The command "chainloader" now accepts an option "--force", which is
required if you want to chain-load a boot loader defective in the
signature, such as SCO Unixware 7.1.
New in 0.5.93 - 1999-10-30:
* ELF format of FreeBSD kernel is supported.

View file

@ -367,6 +367,12 @@ grub> chainloader +1
Do not care about what @samp{+1} is. We describe it later in
@ref{Filesystem}. If this succeeds, run the command @command{boot}.
@strong{Caution:} Some boot loaders (such as the one in SCO Unixware
7.1) are defective in the signature, so you will have to specify the
option @option{--force} to @command{chainloader} for them. The option
might seem to solve your problem, but we strongly recommend reporting
the bug to the maintainer.
However, some tricks will be necessary if you have installed DOS or
Windows on a non-first hard disk, because they cannot boot any disks
except for the first one. The solution is to use the command

View file

@ -758,10 +758,13 @@ grub> cat /etc/fstab
@end example
@end deffn
@deffn Command chainloader file
@deffn Command chainloader [@option{--force}] file
Load @var{file} as a chain-loader. Like any other file loaded by the
filesystem code, it can use the blocklist notation to grab the first
sector of the current partition with @samp{+1}.
sector of the current partition with @samp{+1}. If you specify the
option @option{--force}, then load @var{file} forcibly, whether it has a
correct signature or not. This is required when you want to load a
defective boot loader, such as SCO Unixware 7.1.
@end deffn
@deffn Command configfile @var{file}

View file

@ -268,17 +268,35 @@ static struct builtin builtin_cat =
static int
chainloader_func (char *arg, int flags)
{
if (! grub_open (arg))
int force = 0;
char *file = arg;
/* If the option `--force' is specified? */
if (substring ("--force", arg) <= 0)
{
force = 1;
file = skip_to (0, arg);
}
/* Open the file. */
if (! grub_open (file))
{
kernel_type = KERNEL_TYPE_NONE;
return 1;
}
if (grub_read ((char *) BOOTSEC_LOCATION, SECTOR_SIZE) == SECTOR_SIZE
/* Read the first block. */
if (grub_read ((char *) BOOTSEC_LOCATION, SECTOR_SIZE) != SECTOR_SIZE)
{
grub_close ();
kernel_type = KERNEL_TYPE_NONE;
return 1;
}
/* If not loading it forcibly, check for the signature. */
if (! force
&& (*((unsigned short *) (BOOTSEC_LOCATION + BOOTSEC_SIG_OFFSET))
== BOOTSEC_SIGNATURE))
kernel_type = KERNEL_TYPE_CHAINLOADER;
else if (! errnum)
!= BOOTSEC_SIGNATURE))
{
grub_close ();
errnum = ERR_EXEC_FORMAT;
@ -287,6 +305,7 @@ chainloader_func (char *arg, int flags)
}
grub_close ();
kernel_type = KERNEL_TYPE_CHAINLOADER;
return 0;
}
@ -295,8 +314,9 @@ static struct builtin builtin_chainloader =
"chainloader",
chainloader_func,
BUILTIN_CMDLINE,
"chainloader FILE",
"Load the chain-loader FILE."
"chainloader [--force] FILE",
"Load the chain-loader FILE. If --force is specified, then load it"
" forcibly, whether the boot loader signature is present or not."
};