From c65ae440c87eefc0da2a013fb254b8f8e4f7c154 Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 25 May 2002 11:33:47 +0000 Subject: [PATCH] 2002-05-25 Yoshinori K. Okuji * stage2/builtins.c (boot_func): Load the boot partition information, only if the address of the boot partition entry is set appropriately. (real_root_func): If ATTEMPT_MOUNT is false, call open_partition and if successful, call set_bootdev, to set the offset of the boot partition and the address of the boot paetition entry. IF ATTEMPT_MOUNT is false, don't set BOOTDEV. The BSD evil hack is useless with the command "rootnoverify" anyway. * stage2/disk_io.c (boot_part_addr): Initialized with zero explicitly, to emphasize that it is invalid. --- ChangeLog | 13 +++++++++++++ stage2/builtins.c | 34 ++++++++++++++++++++++------------ stage2/disk_io.c | 4 ++-- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0b0f04ec..85f877058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2002-05-25 Yoshinori K. Okuji + + * stage2/builtins.c (boot_func): Load the boot partition + information, only if the address of the boot partition entry is + set appropriately. + (real_root_func): If ATTEMPT_MOUNT is false, call open_partition + and if successful, call set_bootdev, to set the offset of the + boot partition and the address of the boot paetition entry. + IF ATTEMPT_MOUNT is false, don't set BOOTDEV. The BSD evil hack + is useless with the command "rootnoverify" anyway. + * stage2/disk_io.c (boot_part_addr): Initialized with zero + explicitly, to emphasize that it is invalid. + 2002-05-24 Yoshinori K. Okuji * stage2/builtins.c (real_root_func): New function. diff --git a/stage2/builtins.c b/stage2/builtins.c index 378a9c1fe..4c9a4e197 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -296,8 +296,9 @@ boot_func (char *arg, int flags) boot_drive = saved_drive; /* Copy the boot partition information to 0x7be-0x7fd, if - BOOT_DRIVE is a hard disk drive. */ - if (boot_drive & 0x80) + BOOT_DRIVE is a hard disk drive and the address of the boot + partition entry is set. */ + if ((boot_drive & 0x80) && boot_part_addr) { char *dst, *src; int i; @@ -3125,22 +3126,31 @@ real_root_func (char *arg, int attempt_mount) if (! open_device () && errnum != ERR_FSYS_MOUNT) return 1; } - + else + { + /* This is necessary, because the location of a partition table + must be set appropriately. */ + if (open_partition ()) + set_bootdev (0); + } + /* Clear ERRNUM. */ errnum = 0; saved_partition = current_partition; saved_drive = current_drive; - /* BSD and chainloading evil hacks !! */ - biasptr = skip_to (0, next); - safe_parse_maxint (&biasptr, &hdbias); - errnum = 0; - bootdev = set_bootdev (hdbias); - - /* Print the type of the filesystem. */ if (attempt_mount) - print_fsys_type (); - + { + /* BSD and chainloading evil hacks !! */ + biasptr = skip_to (0, next); + safe_parse_maxint (&biasptr, &hdbias); + errnum = 0; + bootdev = set_bootdev (hdbias); + + /* Print the type of the filesystem. */ + print_fsys_type (); + } + return 0; } diff --git a/stage2/disk_io.c b/stage2/disk_io.c index 12ca31f3e..e65865d87 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -1,7 +1,7 @@ /* disk_io.c - implement abstract BIOS disk input and output */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +85,7 @@ unsigned long current_partition; #ifndef STAGE1_5 /* The register ESI should contain the address of the partition to be used for loading a chain-loader when chain-loading the loader. */ -unsigned long boot_part_addr; +unsigned long boot_part_addr = 0; unsigned long boot_part_offset; #endif