Subject: Confusion about autoconfig, GENERIC kernel, /etc/dtab, usw
Index:	sys/autoconfig,pdpuba,pdp 2.11BSD

Description:
	These are several small changes intended to clarify aspects
	of the 'autoconfig' program and GENERIC	kernel which were
	pointed out as being confusing and/or ill documented.

	The biggest change (which i thought was long overdue) is to
	move the XXauto.c routines out of the /sys/pdpuba directory
	in with the 'autoconfig' program itself.  In the old location
	the implication was that changing the 'probe routine' (XXauto.c)
	would trigger a rebuild of 'autoconfig'.  Also, the man page
	for autoconfig(8) was updated to reflect the fact that autoconfig
	must be run only by 'init'.

	The GENERIC kernel wouldn't fit using the distributed Make.sunix
	file - this was annoying since the dist kit obviously has a
	GENERIC kernel on it.   Also, a reminder is added to both
	the pdpstand/README and the pdpstand/Makefile to install a
	'generic' version of /etc/dtab when building a GENERIC boot tape.

	Updated too was the conf/README file (to give more details on
	adjusting the overlay structure of a kernel after running 'config').

	Overall this update merely cleans up some of the confusing or
	misleading things present in the system.

Repeat-By:
	Examinination of the existing documentation, makefiles and
	README files.
Fix:
	Move the autoconfig routines into the /sys/autoconfig directory:

		cd /sys/autoconfig
		mv ../pdpuba/*auto* .
		mv ../pdp/cnauto.c .
		make tags

	Then apply the patch included below.
--------------------------------------------------------------------------
*** /usr/src/sys/conf/Make.sunix.old	Sun Nov 11 17:49:30 1990
--- /usr/src/sys/conf/Make.sunix	Sat Nov 30 11:12:25 1991
***************
*** 45,63 ****
  	mch_dump.o mch_dzpdma.o mch_fpsim.o mch_profile.o mch_start.o \
  	mch_trap.o mch_vars.o mch_xxx.o conf.o ioconf.o boot.o
  
! BASE=	br.o dh.o dhu.o dkbad.o dr.o dz.o hk.o init_sysent.o kern_clock.o \
  	kern_descrip.o kern_mman.o kern_proc.o kern_sig.o kern_subr.o \
  	kern_synch.o lp.o machdep.o ra.o ram.o rk.o rl.o rx.o si.o \
  	subr_rmap.o subr_xxx.o sys_inode.o sys_pipe.o trap.o tty.o \
  	tty_conf.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o \
  	ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_namei.o \
! 	ufs_subr.o vm_proc.o vm_sched.o vm_swap.o vm_swp.o vm_text.o xp.o
! OV1=	kern_prot.o sys_generic.o ufs_syscalls.o mem.o
  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
! OV3=	clock.o cons.o init_main.o kern_pdp.o kern_rtp.o kern_time.o \
  	kern_xxx.o machdep2.o quota_sys.o subr_prf.o sys_process.o \
  	syscalls.o ufs_mount.o
! OV4=	tty_pty.o quota_kern.o quota_subr.o quota_ufs.o subr_log.o
  OV5=	ht.o tm.o ts.o
  OV6=	tmscp.o
  
--- 45,64 ----
  	mch_dump.o mch_dzpdma.o mch_fpsim.o mch_profile.o mch_start.o \
  	mch_trap.o mch_vars.o mch_xxx.o conf.o ioconf.o boot.o
  
! BASE=	br.o dh.o dhu.o dkbad.o dr.o dz.o init_sysent.o kern_clock.o \
  	kern_descrip.o kern_mman.o kern_proc.o kern_sig.o kern_subr.o \
  	kern_synch.o lp.o machdep.o ra.o ram.o rk.o rl.o rx.o si.o \
  	subr_rmap.o subr_xxx.o sys_inode.o sys_pipe.o trap.o tty.o \
  	tty_conf.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o \
  	ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_namei.o \
! 	ufs_subr.o vm_sched.o vm_swp.o vm_text.o xp.o
! OV1=	sys_generic.o ufs_syscalls.o mem.o
  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
! OV3=	clock.o cons.o kern_pdp.o kern_rtp.o kern_time.o \
  	kern_xxx.o machdep2.o quota_sys.o subr_prf.o sys_process.o \
  	syscalls.o ufs_mount.o
! OV4=	hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
! 	quota_ufs.o subr_log.o vm_swap.o vm_proc.o
  OV5=	ht.o tm.o ts.o
  OV6=	tmscp.o
  
*** /usr/src/sys/conf/README.old	Mon May  2 11:17:34 1988
--- /usr/src/sys/conf/README	Sat Nov 30 11:33:16 1991
***************
*** 6,14 ****
--- 6,37 ----
  run the script "./config", giving it the file name as an argument.  Config
  will create a directory ../machinename and will copy or create the necessary
  files in it.
+ 	When creating a GENERIC system remember to copy /sys/pdpdist/dtab
+ to /etc/dtab before creating the dump(8) of the root filesystem.  This is
+ so 'autoconfig' will find the tape and disc devices when the GENERIC kernel
+ is booted.
  	You will probably need to change the overlay definitions in the
  Makefile, if you are going to run an overlaid kernel, but most of the work
  of configuring a system will be done.
+ 	OVERLAY notes: Almost none of the CONF modules can be placed in 
+ overlays.  In general assembly language modules (source files ending in .s) 
+ may not be placed in overlays because they do not observe the overlay calling 
+ sequence used by the .c modules.  Other than that restriction modules may 
+ be placed in overlays in any order subject to the size constraints mentioned
+ below.  It is a good idea to attempt to group modules which call each other
+ in the same overlay when possible, this saves overlay switching overhead.
+ It is a very good idea to keep the frequently/constantly called modules
+ (such as ufs_namei.o or tty.o) in the BASE segment.  If the system has
+ a large amount of memory and swapping does not occur often then the swap
+ (vm_swap.o, etc) modules are good candidates for being placed in overlays.
+ Maximum size of the BASE is 56kb, maximum size of each overlay segment
+ is 8kb - the 'checksys' program will warn of segments (root/base, overlays 
+ and data) which are too large.  There is a limit of 15 overlays at present, 
+ however there is a lower limit on the size of a kernel which may be loaded.  
+ /boot can not deal with kernels larger than about 192kb (sum of text and data)
+ because that is where /boot relocates himself to while loading /unix.  See
+ the comments in /sys/pdpstand/M.s for more information and a workaround
+ (which will not work with the 3Com ethernet board installed in the system).
  	There is one possible problem that you need to be aware of.  Running
  the shell script config generates the file localopts.h in the system include
  files directory, "../h".  If you change your configuration, config will
*** /usr/src/sys/autoconfig/Makefile.old	Tue Aug 14 16:57:37 1990
--- /usr/src/sys/autoconfig/Makefile	Sat Nov 30 14:43:28 1991
***************
*** 2,10 ****
  # Makefile for the system autoconfiguration program
  #
  DESTDIR=
- N=	../pdpif
- M=	../machine
- D=	../pdpuba
  
  OBJS=	attach.o do_config.o main.o read_dtab.o read_nlist.o uprobe.o	\
  	brauto.o cnauto.o dhauto.o dhuauto.o drauto.o dzauto.o		\
--- 2,7 ----
***************
*** 11,24 ****
  	hkauto.o htauto.o lpauto.o raauto.o rkauto.o rlauto.o siauto.o	\
  	tmauto.o tsauto.o xpauto.o rxauto.o dnauto.o tmsauto.o
  SRCS=	attach.c do_config.c main.c read_dtab.c read_nlist.c uprobe.c	\
! 	${D}/brauto.c ${M}/cnauto.c ${D}/dhauto.c ${D}/dhuauto.c	\
! 	${D}/drauto.c ${D}/dzauto.c ${D}/hkauto.c ${D}/htauto.c		\
! 	${D}/lpauto.c ${D}/raauto.c ${D}/rkauto.c ${D}/rlauto.c		\
! 	${D}/siauto.c ${D}/tmauto.c ${D}/tsauto.c ${D}/xpauto.c		\
! 	${D}/rxauto.c ${D}/dnauto.c ${D}/tmsauto.c
  
! VPATH=	.:../pdpif:../machine:../pdpuba
! CFLAGS=	-O -I. -I../h
  LFLAG=	-i
  
  autoconfig: ${OBJS}
--- 8,20 ----
  	hkauto.o htauto.o lpauto.o raauto.o rkauto.o rlauto.o siauto.o	\
  	tmauto.o tsauto.o xpauto.o rxauto.o dnauto.o tmsauto.o
  SRCS=	attach.c do_config.c main.c read_dtab.c read_nlist.c uprobe.c	\
! 	brauto.c cnauto.c dhauto.c dhuauto.c	\
! 	drauto.c dzauto.c hkauto.c htauto.c		\
! 	lpauto.c raauto.c rkauto.c rlauto.c		\
! 	siauto.c tmauto.c tsauto.c xpauto.c		\
! 	rxauto.c dnauto.c tmsauto.c
  
! CFLAGS=	-O -I. -I../h -I../pdpuba -I../pdp
  LFLAG=	-i
  
  autoconfig: ${OBJS}
*** /usr/src/sys/pdpstand/Makefile.old	Sun May 26 19:09:46 1991
--- /usr/src/sys/pdpstand/Makefile	Sun Nov 24 13:08:42 1991
***************
*** 4,9 ****
--- 4,13 ----
  #	Note that there are limitations on how large a program may
  #	be loaded along with all device drivers.  This is especially
  #	a problem with restor.  Programs should be <= 48K to be safe.
+ #
+ #	If a GENERIC kernel distribution is being created be sure
+ #	to install /sys/pdpdist/dtab (or /etc/dtab.save) as ${ROOT}/etc/dtab 
+ #	so that the GENERIC kernel can find the tape device.
  
  # DISK	which disk to take a root dump of for the distribution tape
  # TAPE	which tape to write the distribution on
*** /usr/src/sys/OTHERS/README.old	Sun Sep 22 16:14:06 1991
--- /usr/src/sys/OTHERS/README	Sat Nov 30 14:38:26 1991
***************
*** 9,19 ****
  STEP #1:
  --------
  	Install the source code in the proper directory.  A pdp MASSBUS
! driver would go in pdpmba, a pdp UNIBUS driver would go in pdpuba.  We'll
! use the versatec driver as an example.  Since it's a UNIBUS driver, we'll
! move vp.c into pdpuba.  If you're installing a driver from the OTHERS
! directory, or you've got a local work of art that you wish to use, there
! are a few things you should check so that it will work correctly with 2.11BSD:
  
  	Note, in the following examples, "XX" is the two or three letter
  	designation that device drivers under UNIX get assigned, e.g. "vp"
--- 9,21 ----
  STEP #1:
  --------
  	Install the source code in the proper directory.  A pdp MASSBUS
! driver would go in pdpmba, a pdp UNIBUS driver would go in pdpuba.  In
! reality (the present system) all drivers are in pdpuba regardless of
! being MASSBUS or UNIBUS.  We'll use the versatec driver as an example.  
! Since it's a UNIBUS driver, we'll move vp.c into pdpuba.  If you're installing 
! a driver from the OTHERS directory, or you've got a local work of art that 
! you wish to use, there are a few things you should check so that it will 
! work correctly with 2.11BSD:
  
  	Note, in the following examples, "XX" is the two or three letter
  	designation that device drivers under UNIX get assigned, e.g. "vp"
***************
*** 112,128 ****
  --------
  	Write some code that will attempt to "probe" the routine.  See any
  of the other device drivers for examples.  Install this code in the
! same directory, only call it "XXauto.c", where XX is the prefix for the
! driver.  In our example, we'll install it in "pdpuba/vpauto.c".  This is
! the code that is used by the auto configuration program to get to the
! device.  By convention, this routine must be named "XXprobe()".  It's also
! useful to check and see if any of the probe routines already written would
! be identical to your probe routine.  For example, the "xpauto.c" file
! contains the probe routine for several flavors of disk drive.  If you're
! porting a 4BSD driver, it probably already has a probe routine in it which
! may be close to what you want.  Also, in any case, rip the XXprobe stuff
! out of the main file ... it is never used by the kernel and it just wastes
! text space.
  
  STEP #3:
  --------
--- 114,135 ----
  --------
  	Write some code that will attempt to "probe" the routine.  See any
  of the other device drivers for examples.  Install this code in the
! "sys/autoconfig" directory, only call it "XXauto.c", where XX is
! the prefix for the driver.  In our example, we'll install it as
! "sys/autoconfig/vpauto.c".  This is the code that is used by the auto 
! configuration program to get to the device.  By convention, this routine 
! must be named "XXprobe()".  It's also useful to check and see if any of 
! the probe routines already written would be identical to your probe routine.
! For example, the "xpauto.c" file contains the probe routine for several 
! flavors of disk drive.  If you're porting a 4BSD driver, it probably 
! already has a probe routine in it which may be close to what you want.  
! Also, in any case, rip the XXprobe stuff out of the main file ... it is never 
! used by the kernel and it just wastes text space.
! 	Previously the XXauto.c files were kept in the same directory as
! the device drivers themselves.  This lead to the misleading assumption that 
! '/etc/autoconfig' would automatically be rebuilt if the probe routine in
! the XXauto.c files in sys/pdpuba were modified.  To clarify matters the 
! XXauto.c files were moved into the sys/autoconfig directory.
  
  STEP #3:
  --------
*** /usr/src/man/man8/autoconfig.8.old	Sat Jan 24 10:53:42 1987
--- /usr/src/man/man8/autoconfig.8	Sat Nov 30 11:41:52 1991
***************
*** 2,15 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)autoconfig.8	2.4 (Berkeley) 1/24/87
  .\"
! .TH AUTOCONFIG 8 "January 24, 1987"
  .UC 2
  .SH NAME
  autoconfig \- configure the running system to the hardware
  .SH SYNOPSIS
! .B autoconfig [ \-i ifile ] [ \-n nfile ] [ \-k kfile ] [ \-v ] [ \-c ]
  .SH DESCRIPTION
  .PP
  .I Autoconfig
--- 2,15 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)autoconfig.8	2.5 (Berkeley) 11/30/91
  .\"
! .TH AUTOCONFIG 8 "November 30, 1991"
  .UC 2
  .SH NAME
  autoconfig \- configure the running system to the hardware
  .SH SYNOPSIS
! .B "autoconfig [\-i ifile] [\-n nfile] [\-k kfile] [\-v] [\-c]"
  .SH DESCRIPTION
  .PP
  .I Autoconfig
***************
*** 23,30 ****
  .I /etc/dtab
  for a list of devices which may be on the system.
  It first verifies that the kernel has an attach routine
! for each device (and therefore has a device handler),
! and that either the kernel
  has a probe routine.
  It then checks each of these devices to see if it is present,
  and if it is,
--- 23,30 ----
  .I /etc/dtab
  for a list of devices which may be on the system.
  It first verifies that the kernel has an attach routine
! for each device (and therefore has a device handler)
! and that the kernel
  has a probe routine.
  It then checks each of these devices to see if it is present,
  and if it is,
***************
*** 82,87 ****
--- 82,94 ----
  and vectors initialized in the kernel;
  the kernel uses a root attach entry in the block device switch
  to allow disk drivers to do any probes necessary before autoconfiguration.
+ .PP
+ Must be run only by
+ .IR init (8).
+ There is a flag set in the kernel that autoconfig has already run, running
+ autoconfig a second time results in the error:
+ .TP
+ "namelist doesn't match running kernel."
  .SH FILES
  .ta 2i
  /etc/dtab	device table

