Moving root under 4.2BSD

John P. Linderman jpl at allegra.UUCP
Wed Apr 18 05:41:25 AEST 1984


We are running (or attempting to run) 4.2, and decided to move root off
our (RP06) drive 0 to separate it from /usr and to get it onto a faster
device.  For the most part, this was a simple modification to our config
files, specifying root on hp1 instead of hp0.  However, the change is not
"complete" until the boot procedures are changed to pull vmunix off the
new root device.  I was unable to find instructions for doing this, but
in /sys/stand/boot.c, the string "xx(0,0)vmunix" is wired into the code
(see below).  We could have changed this to be "xx(2,0)vmunix", but on
three different machines, we boot from three different units, so it
seemed more satisfactory to piggy-back the number in with the device
type in register 10.  This involved the addition of 8 lines to boot.c:

		0,0,		/* 13 = rx */
		'r','l',	/* 14 = rl */
	};
+	#define	TYPEMASK 0x0f   /* Mask out all but index into type table */
+	#define	TYPESHIFT 4	/* Shift out type table index (leaving unit select) */

	char line[100] = "xx(0,0)vmunix";
+	/* Offsets:       01234567 */
+	#define	BOOTUNIT     3		/* Character to change to modify boot unit */

	int	retry = 0;

	main()
	{
		register howto, devtype;	/* howto=r11, devtype=r10 */
		int io;

	#ifdef lint
		howto = 0; devtype = 0;
	#endif
		printf("\nBoot\n");
	#ifdef JUSTASK
		howto = RB_ASKNAME|RB_SINGLE;
	#else
		if ((howto&RB_ASKNAME)==0) {
+			io = devtype >> TYPESHIFT;
+			devtype &= TYPEMASK;
+			if ((io < 0) || (io > 9)) io = 0;
+			line[BOOTUNIT] += io;
			if (devtype>=0 && devtype<sizeof(devname)/2
			    && devname[devtype][0]) {

We then changed several of the boot files in /sys/floppy to include
the unit number.  For example, we changed defboo.cmd as follows:

< LOAD BOOT^M
< D/G B 0		! BOOT PARAMETERS: MULTI USER AFTER CHECK^M
< D/G A 0		! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)^M
< START 2^M
-------------------------------------------
> LOAD BOOT^M
> D/G B 0		! BOOT PARAMETERS: MULTI USER AFTER CHECK^M
> D/G A 20		! UNIT (2) & DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)^M
> START 2^M

Sometimes the command to set register 10 is slightly different, as in
/sys/floppy/hpmboo.cmd:

> LOAD BOOT^M
> D R10 20		! UNIT 2, DEVICE CHOICE 0=HP^M
> D R11 0		! 0= AUTOBOOT^M
> START 2^M

In all cases, one must be careful to include the trailing ^M on all lines.
(It is shown here as two characters, but is a single CTRL-M in reality.)
These changes should be entirely backward compatible, because
register 10 is set to the device select code in the boot commands,
and the higher order 0's will leave the "xx(0" unchanged unless
the unit number is explicitly included.

John P. Linderman  Root Boot Institute  allegra!jpl



More information about the Comp.unix.wizards mailing list