summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrnordier <rnordier@FreeBSD.org>1999-02-26 14:57:17 +0000
committerrnordier <rnordier@FreeBSD.org>1999-02-26 14:57:17 +0000
commit1e2759ad39aaac6ac5ae052dc0b048fff233632d (patch)
tree71e32bc88445568c6239810c6d83a1ffb3bf89ed
parentc17b4c476c5727a6c2b93447d3ea72b73468846a (diff)
downloadFreeBSD-src-1e2759ad39aaac6ac5ae052dc0b048fff233632d.zip
FreeBSD-src-1e2759ad39aaac6ac5ae052dc0b048fff233632d.tar.gz
Finish implementing "setdrv" option. This is intended to be used
(with care) in those instances where boot0 is not passed the correct drive number by the PC BIOS. (The symptoms are a "F5 Drive 0" line, even though the current drive is drive 0.)
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.810
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.c7
2 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/boot0cfg/boot0cfg.8 b/usr.sbin/boot0cfg/boot0cfg.8
index e949cc7..bb73d75 100644
--- a/usr.sbin/boot0cfg/boot0cfg.8
+++ b/usr.sbin/boot0cfg/boot0cfg.8
@@ -22,7 +22,7 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id: boot0cfg.8,v 1.1.1.1 1999/02/21 21:23:42 rnordier Exp $
+.\" $Id: boot0cfg.8,v 1.2 1999/02/22 09:36:54 rnordier Exp $
.\"
.Dd February 21, 1999
.Dt BOOT0CFG 8
@@ -101,7 +101,7 @@ the conventional (CHS) interface, when accessing disk-related BIOS
services. The default is
.Sq nopacket .
.It setdrv
-Causes the drive containing the disk to be referenced using drive
+Forces the drive containing the disk to be referenced using drive
number definable by means of the -d option. The default is
.Sq nosetdrv .
.It update
@@ -131,7 +131,7 @@ option may cause
.Sq boot0
to fail, depending on the nature of BIOS support.
.Pp
-The
+Use of the
.Sq setdrv
-option is presently implemented
-.Dq syntactically but not semantically .
+option with an incorrect -d operand may cause the MBR to be written
+to the wrong disk. Be careful!
diff --git a/usr.sbin/boot0cfg/boot0cfg.c b/usr.sbin/boot0cfg/boot0cfg.c
index 67d0c88..20fdcc3 100644
--- a/usr.sbin/boot0cfg/boot0cfg.c
+++ b/usr.sbin/boot0cfg/boot0cfg.c
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: boot0cfg.c,v 1.1.1.1 1999/02/21 21:23:42 rnordier Exp $";
+ "$Id: boot0cfg.c,v 1.2 1999/02/22 09:36:54 rnordier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -44,6 +44,7 @@ static const char rcsid[] =
#define MBRSIZE 512 /* master boot record size */
+#define OFF_DRIVE 0x1ba /* offset: setdrv drive */
#define OFF_FLAGS 0x1bb /* offset: option flags */
#define OFF_TICKS 0x1bc /* offset: clock ticks */
#define OFF_PTBL 0x1be /* offset: partition table */
@@ -154,6 +155,8 @@ main(int argc, char *argv[])
errx(1, "%s: bad magic", bpath);
memcpy(buf + OFF_PTBL, part, sizeof(part));
}
+ if (d_arg != -1)
+ buf[OFF_DRIVE] = d_arg;
if (o_flag) {
buf[OFF_FLAGS] &= o_and;
buf[OFF_FLAGS] |= o_or;
@@ -185,7 +188,7 @@ main(int argc, char *argv[])
part[i].dp_size);
}
printf("\n");
- printf("drive=0x0 options=");
+ printf("drive=0x%x options=", buf[OFF_DRIVE]);
for (i = 0; i < nopt; i++) {
if (i)
printf(",");
OpenPOWER on IntegriCloud