Subject: port-i386/2009: kernel always tries to change root device
To: None <gnats-bugs@NetBSD.ORG>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: netbsd-bugs
Date: 02/01/1996 13:09:36
>Number:         2009
>Category:       port-i386
>Synopsis:       kernel always tries to change root device
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb  1 07:35:04 1996
>Last-Modified:
>Originator:     Lennart Augustsson
>Organization:
CS at Chalmers University of Technology
>Release:        NetBSD 1.1 current, 1996 Jan 31
>Environment:
System: NetBSD calvin.cs.chalmers.se 1.1A NetBSD 1.1A (CALVIN) #29: Thu Feb 1 12:52:52 MET 1996 augustss@calvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/CALVIN i386


>Description:
	When booting the kernel always tries to change the root device
	with setroot() (in arch/i386/i386/autoconf.c) even if the
	config file tells it where it should be.

>How-To-Repeat:
	I have the following setup:
	Boot manager and Windize (yuck!) on target 0 on SCSI
	and NetBSD on target 1 on SCSI.
	When booting the kernel tries to change root device to
	the Windoze disk and fails (of course).
	Here's the relevant part of my config file:

config          netbsd  root on sd0 swap on sd0
...
sd0     at scsibus0 target 1 lun 0      # SCSI disk drives
sd1     at scsibus0 target 0 lun 0      # SCSI disk drives

	Notice how the config line asks for root on sd0, but
	the kernel still tries to move it to sd1. :-(
	
>Fix:
This patch adds the option USECONFIGROOT which when set will
disable setroot.

*** /sys/arch/i386/i386/autoconf.c.old	Sun Jan  7 22:39:23 1996
--- /sys/arch/i386/i386/autoconf.c	Sun Jan  7 22:40:59 1996
***************
*** 140,145 ****
--- 140,146 ----
   */
  setroot()
  {
+ #if !defined(USECONFIGROOT)
  	int  majdev, mindev, unit, part, adaptor;
  	dev_t temp, orootdev;
  	struct swdevt *swp;
***************
*** 188,191 ****
--- 189,193 ----
  	if (temp == dumpdev)
  		dumpdev = swdevt[0].sw_dev;
  #endif
+ #endif /* USECONFIGROOT */
  }
>Audit-Trail:
>Unformatted: