diff --git a/ChangeLog b/ChangeLog index 92e80305b..bd673b7e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-01-15 OKUJI Yoshinori + + * 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 * docs/prog-ref.texi (LBA mode disk I/O): Added a footnote about diff --git a/NEWS b/NEWS index c8c9580ec..fc728c53f 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/docs/tutorial.texi b/docs/tutorial.texi index 1079f23c8..4f7cbd45f 100644 --- a/docs/tutorial.texi +++ b/docs/tutorial.texi @@ -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 diff --git a/docs/user-ref.texi b/docs/user-ref.texi index 0039bcd5f..2713c333e 100644 --- a/docs/user-ref.texi +++ b/docs/user-ref.texi @@ -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} diff --git a/stage2/builtins.c b/stage2/builtins.c index 8bf7a453c..e419e7a63 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -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." };