Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 1995 15:43:27 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, jkh@time.cdrom.com
Cc:        current@freefall.FreeBSD.org
Subject:   Re: Of slices and boot code..
Message-ID:  <199508220543.PAA25256@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>By "current boot code" I meant "not a 3 stage boot."  I was under the
>impression that cramped space in the current set would preclude the
>addition of slice-aware code to it.

It already passes the slice number to the kernel, but the kernel ignores
it.  I forget why.  It may be just because you would need to create all
device nodes for all slices in case someone boots from one.

The boot code is missing only support for parsing slice numbers and for
booting from extended partitions, e.g., sd(0,s5,a)/kernel.  Supporting
booting from 30 different slices would require a lot of device nodes.

Here are my diffs to implement looking at and reporting the slice number
in the kernel.  The diffs also remove the kludges to support the current
bogus floppy minor numbering.  The floppy driver, MAKDEV, and everyone's
/dev/fd?* need to be updated before the kludges can be removed.

Bruce

*** autoconf.c~	Mon Jul 17 15:15:30 1995
--- autoconf.c	Sat Aug 19 07:27:15 1995
***************
*** 48,54 ****
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/buf.h>
! #include <sys/dkstat.h>
  #include <sys/conf.h>
  #include <sys/dmap.h>
  #include <sys/reboot.h>
--- 48,55 ----
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/buf.h>
! #include <sys/disklabel.h>
! #include <sys/diskslice.h>
  #include <sys/conf.h>
  #include <sys/dmap.h>
  #include <sys/reboot.h>
***************
*** 57,62 ****
--- 58,67 ----
  #include <machine/md_var.h>
  #include <machine/pte.h>
  
+ int find_cdrom_root __P((void));
+ void configure_start __P((void));
+ void configure_finish __P((void));
+ 
  static void setroot(void);
  
  /*
***************
*** 259,269 ****
        {'s','d'},      /* 4 = sd -- new SCSI system */
  };
  
- #define	PARTITIONMASK	0x7
- #define	PARTITIONSHIFT	3
- #define FDUNITSHIFT     6
- #define RAW_PART        2
- 
  /*
   * Attempt to find the device from which we were booted.
   * If we can do so, and not instructed not to do so,
--- 264,269 ----
***************
*** 272,308 ****
  static void
  setroot()
  {
! 	int  majdev, mindev, unit, part, adaptor;
! 	dev_t temp = 0, orootdev;
! 	struct swdevt *swp;
! 
! /*printf("howto %x bootdev %x ", boothowto, bootdev);*/
! 	if (boothowto & RB_DFLTROOT ||
! 	    (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
  		return;
! 	majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
  	if (majdev > sizeof(devname) / sizeof(devname[0]))
  		return;
! 	adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
! 	unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
! 	if (majdev == FDMAJOR) {
! 		part = RAW_PART;
! 		mindev = unit << FDUNITSHIFT;
! 	}
! 	else {
! 		part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
! 		mindev = (unit << PARTITIONSHIFT) + part;
! 	}
! 	orootdev = rootdev;
! 	rootdev = makedev(majdev, mindev);
! 	/*
! 	 * If the original rootdev is the same as the one
! 	 * just calculated, don't need to adjust the swap configuration.
! 	 */
! 	if (rootdev == orootdev)
  		return;
! 	printf("changing root device to %c%c%d%c\n",
! 		devname[majdev][0], devname[majdev][1],
! 		mindev >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
! 		part + 'a');
  }
--- 272,304 ----
  static void
  setroot()
  {
! 	int majdev, mindev, adaptor, controller, unit, slice, part;
! 	dev_t newrootdev;
! 	char partname[2];
! 	char *sname;
! 
! 	if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != B_DEVMAGIC)
  		return;
! 	majdev = B_TYPE(bootdev);
  	if (majdev > sizeof(devname) / sizeof(devname[0]))
  		return;
! 	adaptor = B_ADAPTOR(bootdev);
! 	controller = B_CONTROLLER(bootdev);
! 	unit = B_UNIT(bootdev);
! #if 1
! 	slice = (adaptor << 4) | controller;	/* XXX */
! #else
! 	slice = COMPATIBILITY_SLICE;
! #endif
! 	part = B_PARTITION(bootdev);
! 	if (majdev == FDMAJOR && slice == COMPATIBILITY_SLICE)
! 		part = RAW_PART;	/* XXX */
! 	mindev = dkmakeminor(unit, slice, part);
! 	newrootdev = makedev(majdev, mindev);
! 	if (newrootdev == rootdev)
  		return;
! 	rootdev = newrootdev;
! 	sname = dsname("", unit, slice, part, partname);
! 	printf("changing root device to %c%c%s%s\n",
! 		devname[majdev][0], devname[majdev][1], sname, partname);
  }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508220543.PAA25256>