Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 1999 11:08:12 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        dcs@newsguy.com, tmb@rcru.rl.ac.uk
Cc:        current@FreeBSD.ORG
Subject:   Booting from 2nd IDE [Re: Experiences with aout-to-elf and new bootblocks]
Message-ID:  <99Jan22.110737est.40377@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
"Daniel C. Sobral" <dcs@newsguy.com> wrote:
>Well, kind of. You "hard code" the name wd2 in your kernel
>configuration file. [...] Ie, s/wd2/wd1/
> in your kernel configuration file (and rebuild :).
It was wd0 (the generic).  Making it wd2 didn't help.

Mark Blackman <tmb@rcru.rl.ac.uk> wrote:
>FWIW, I've done it under 2.2.7 by
>
>1) installing booteasy on both wd0 *AND* wd2
>2) altering the boot.config to
>   1:wd(2,a)kernel

This works for an a.out 3.0 kernel, but the old bootloader can't handle
ELF kernels, so this isn't a usable solution.

>3) compiling above kernel with
>   config          kernel  root on wd2
This made no difference.

Since typing on a keyboard is easier than opening the box, I wrote the
following kludge.  It builds a bitmap of IDE devices as it probes them
and then counts active IDE devices to work out the actual unit number.

Index: i386/autoconf.c
===================================================================
RCS file: /home/CVSROOT/./src/sys/i386/i386/autoconf.c,v
retrieving revision 1.110
diff -u -r1.110 autoconf.c
--- autoconf.c	1998/10/26 07:05:34	1.110
+++ autoconf.c	1999/01/21 23:18:18
@@ -433,6 +433,10 @@
 #define FDMAJOR 2
 #define FDUNITSHIFT     6
 
+/* KLUDGE for bios handling of multiple devices */
+#define	WDMAJOR 0
+int	wd_mask = 0;		/* mask of WD devices found during probe */
+
 /*
  * Attempt to find the device from which we were booted.
  * If we can do so, and not instructed not to do so,
@@ -467,6 +471,18 @@
 		slice = COMPATIBILITY_SLICE;
 		part = RAW_PART;
 		mindev = unit << FDUNITSHIFT;
+	} else if (majdev == WDMAJOR) {
+		/*
+		 * XXX kludge to handle holes in numbering
+		 */
+		for (part = 0, mindev = unit; part < 32 && mindev >= 0; part++)
+			if (wd_mask & (1 << part))
+				mindev--;
+		if (mindev == -1)
+			unit = part - 1;
+
+		part = B_PARTITION(bootdev);
+		mindev = dkmakeminor(unit, slice, part);
 	} else {
 		part = B_PARTITION(bootdev);
 		mindev = dkmakeminor(unit, slice, part);
Index: isa/wd.c
===================================================================
RCS file: /home/CVSROOT/./src/sys/i386/isa/wd.c,v
retrieving revision 1.186
diff -u -r1.186 wd.c
--- wd.c	1999/01/17 05:46:24	1.186
+++ wd.c	1999/01/21 23:18:18
@@ -223,6 +223,8 @@
 static struct buf rwdbuf[NWD];	/* buffers for raw IO */
 #endif
 
+extern int wd_mask;	/* This is a KLUDGE */
+
 static int wdprobe(struct isa_device *dvp);
 static int wdattach(struct isa_device *dvp);
 static void wdustart(struct disk *du);
@@ -551,6 +553,8 @@
 					  DEVSTAT_NO_ORDERED_TAGS,
 					  DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE);
 
+			/* KLUDGE: mark drive as present */
+			wd_mask |= 1 << lunit;
 		} else {
 			free(du, M_TEMP);
 			wddrives[lunit] = NULL;

-------------
This successfully allows me to boot from wd2.  I agree that it doesn't
address the general problem (in particular, it can't handle the case
where the BIOS doesn't see a device that the kernel probe does see,
and doesn't support SCSI).

Peter
--
Peter Jeremy (VK2PJ)                    peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St                          Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015                   Fax:   +61 2 9690 5982

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99Jan22.110737est.40377>