v01i002: Kernel configuration files, version 2, Part01/01

David H. Brierley dave at galaxia.Newport.RI.US
Mon Feb 11 13:19:54 AEST 1991


Submitted-by: Mark Dapoz <hybrid!mdapoz>
Posting-number: Volume 1, Issue 2
Archive-name: kconfig2/part01

This stuff has been kicking around my machine for a while so now is a good
time to package it up and release it.  I've cleaned up the conf.c source a 
bit and also added the source for linesw.c.  The README file also has a bit 
more of an explanation of what some of the parameters in the conf.c actually 
do.  It provides basically the same function as my previous release, it's 
just a bit cleaner that's all.  Please post this to the comp.sources.3b1 
newsgroup, thanks,
		-mark

--- snip --- snip --- snip --- snip --- snip --- snip --- snip --- snip ---

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by mdapoz at hybrid on Wed Jan 30 01:32:02 EST 1991
# Contents:  README.conf conf.c id.c name.c Makefile space.h.patch linesw.c
 
echo x - README.conf
sed 's/^@//' > "README.conf" <<'@//E*O*F README.conf//'

This shar file contains the following files:

-rw-r--r--  1 mdapoz  staff       317 Jan 28 01:51 Makefile
-rw-r--r--  1 mdapoz  staff      2942 Jan 29 03:28 README.conf
-rw-r--r--  1 mdapoz  staff      9095 Jan 29 03:26 conf.c
-rw-r--r--  1 mdapoz  staff        64 Jan 28 01:51 id.c
-rw-r--r--  1 mdapoz  staff      1288 Jan 29 03:28 linesw.c
-rw-r--r--  1 mdapoz  staff       158 Jan 28 01:51 name.c
-rw-r--r--  1 mdapoz  staff      1226 Jan 29 03:26 space.h.patch

In order to rebuild conf.o, you must create the following directory heirarchy 
in some suitable locaton for source code (eg. /usr/src/uts/kern):

@./sys: contains a copy of the /usr/include/sys directory from the 3.51
       development set

@./cf:  contains the ifile.0407 file from the kernel .o distribution

You must then apply a patch to space.h using the following command:

		patch -p0 < space.h.patch

You can then rebuild the kernel using the makefile provided.


Here's a quick and dirty summary of some of the parameters which you may want
to tune in conf.c:

Parameter	Default Value	Purpose
--------------	-------------	----------------------------------------------
HDPRECOMP0	0x20		Cylinder at which the device driver for the
				hard drive turns on write precompensation
				for the first hard drive.

HDPRECOMP1	0x20		Same as HDPRECOMP0 except for the second
				hard drive.

NMOUNT		8		The number of mount points for filesystems.
				Each mounted partition requires a mount point
				entry.

MAXUP		24		The maximum number of processes that any
				individual uid can have.

The following parameters have an upper and lower bound.  The system will
pick a value somewhere between these bounds based on the amount of memory
available.  Be careful not to increase too many lower bounds too much since
evil things may happen :-)

NINODE		80		Lower bound for the size of the inode cache.
				You may want to increase this if you have a
				lot of files being opened and closed (ahhh,
				shades of news systems :-)
NINODEHI	400		Upper bound for the size of the inode cache

NFILE		80		Lower bound on the size of the file table.
				This determines the maximum number of files
				that can be open in the system at any time.
NFILEHI		300		Upper bound on the number of open files.

NTEXT		24		Lower bound on the number of process text
				structures available.  This parameter determines
				how many different text (program) images can
				be present at any time.
NTEXTHI		75		Upper bound on text structures.

NPROC		30		Lower bound on the number of processes slots
				that are available.  Each process in the
				system requires one process slot entry.
				Keep NPROC >= NTEXT!
NPROCHI		100		Upper bound on process slots.
				Keep NPROCHI >= NTEXTHI!

NCLIST		32		Lower bound on the number of clist structures
				available in the kernel.  Clists are used for
				character based i/o on devices.  Read a unix
				kernel book for more info.
NCLISTHI	150		Upper bound on the number of clists.

Enjoy....  Mark Dapoz	( mdapoz%hybrid at cs.toronto.edu  or
  			  ...uunet!mnetor!hybrid!mdapoz)
@//E*O*F README.conf//
chmod u=rw,g=r,o=r README.conf
 
echo x - conf.c
sed 's/^@//' > "conf.c" <<'@//E*O*F conf.c//'
#sccs	"@(#)uts/kern:conf.c	1.1"

/* 
   This is a hand built version of conf.c for use with the unix-pc 3.51m 
   kernel .o files provided by AT&T.  With this file and the kernel .o files,
   you will be able to fully reconfigure your 3B1 kernel without being 
   restricted to the options provided by ktune(7).

   WARNING: do *NOT* attempt to rebuild your kernel if you are unsure of
   the effects of changes in this file.  You can easily cause damage to
   data on your system.

   Disclaimer: The information presented in this file has been derived 
   only from work performed by the author and is in no way based on any
   AT&T and/or Convergent Technologies documents or code.  All information
   was obtained using files available on the stock AT&T unix-pc version
   3.51 base and development set.

   Mark Dapoz	( mdapoz%hybrid at cs.toronto.edu  or
  		  ...uunet!mnetor!hybrid!mdapoz)

   Mon Jan 28 02:57:24 EST 1991
*/
    
#define	KERNEL				/* indicate it's kernel code */

		/* the following params define general purpose configuation */
#define	DEBUGGER	0		/* kernel debugger loaded */
#undef	BASSLOCKING			/* no Bass locking in this kernel */
#define	NERR		4		/* number of error slots in kernel */
#define	MESG		0		/* no message ipc mechanism in kernel */
#define	SEMA		0		/* no semaphore ipc mech in kernel */
#define	SHMEM		0		/* no shared memory ipc mech in kernel*/
#define	PLP_0		1		/* parallel line printer is supported */
#undef	PRF_0
#define	DISK_0		1		/* this is assigned to gd_cnt */
#define	NSER		1		/* intel 8274 serial driver present */
#define	NCON 		1		/* console handler driver present */
#define	NSY 		1		/* tty handler driver present */
#define	NMM 		1		/* memory device driver present */
#define	NPH		1		/* on board modem driver present */
#define	NLP		PLP_0		/* printer driver present */
#define	HDPRECOMP0	0x20		/* precomp cylinder for hard drives */
#define	HDPRECOMP1	0x20
#define	HDPRECOMP2	0x00		/* third and fourth drives are */
#define	HDPRECOMP3	0x00		/* currently not supported by gd */
#undef	NOSTREAMS			/* streams are supported */
#undef	SLAN_0				/* ...but no network card */
#define	NSWBUF		12
#define	ROOTDEV		makedev(0,2)	/* device number of root filesystem */
#define	PIPEDEV		makedev(0,2)	/* device number of pipe device */
#define	SWAPDEV		makedev(0,1)	/* device number of swapping device */
#define	NSWAP		8000		/* size of swap space (in 1K blocks) */

		/* the following params define the tulo structure */
#define	NBUF		25		/* number of system buffers */
#define	NINODE		80		/* number of resident inodes */
#define	NFILE		80		/* number of concurrent open files */
#define	NPROC		30		/* number of concurrent process */
#define	NTEXT		24		/* number of text structures in kernel*/
#define	NCLIST		32		/* number of clist buffers available */
#define	NPBUF		4		/* number of buffer headers available */
#define	NCALL		16		/* number of callouts in kernel */

		/* the following params define the tuhi structure */
#define	NBUFHI		100		/* max system buffers available */
#define	NINODEHI	400		/* max number of resident inodes */
#define	NFILEHI		300		/* max concurrent open files */
#define	NPROCHI		100		/* max concurrent process */
#define	NTEXTHI		75		/* max text structures in kernel */
#define	NCLISTHI	150		/* max clist buffers available */
#define	NPBUFHI		16		/* max buffer headers available */
#define	NCALLHI		32		/* max callouts in kernel */

		/* the following params define the v structure */
#define	NMOUNT		8		/* number of mount points */
#define	NSABUF		0
#define	MAXUP		24		/* maximum processes per user */
#define	SMAPSIZ		75
#define	NHBUF		16		/* hashbuf, must be a power of 2 */

#define	NSERBUF		400		/* max chars in a tty buffer, mul of 4*/
#define	NTTYHOG		1024		/* max outstanding chars in tty buf */
#define	NLBDRV		5		/* number of block loadable dev drv */
#define	NLCDRV		14		/* number of char loadable dev drv */

#define	NDL		400		/* number of display list items */
#define	PXMEMSIZE	(256*1024)	/* pixel memory size (in virt space) */
#define	NWINDOWS	12		/* number of windows (12) */
#define	FMEMSIZE	(64*1024)	/* font memory size (in virt space) */
#define	NOL		(NWINDOWS*40)	/* num of obscured pieces per system */

#include "sys/space.h"

/*
 * Declaration of block device switch. Each entry (row) is
 * the only link between the main unix code and the driver.
 */

		/* block device driver entry point declarations */
#if DISK_0 > 0		/* block driver for disk */
extern gdopen(), gdclose(), gdread(), gdwrite(), gdioctl(), gdstrategy(); 
#define	gdprint		nulldev
#else
#define	gdopen		nodev
#define	gdclose		nodev
#define	gdread		nodev
#define	gdwrite		nodev
#define	gdioctl		nodev
#define	gdstrategy	nodev
#define	gdprint		nulldev
#endif

struct bdevsw bdevsw[] = {
	{ gdopen, gdclose, gdstrategy, gdprint}, /*0*/
	{ nodev,  nodev,   nodev,      nulldev}, /*1*/
	{ nodev,  nodev,   nodev,      nulldev}, /*2*/
	{ nodev,  nodev,   nodev,      nulldev}, /*3*/
	{ nodev,  nodev,   nodev,      nulldev}  /*4*/
};

/*
 * Character device switch.
 */

		/* character device driver entry point declarations */
#if NSER > 0		/* intel 8274 serial chip handler */
extern seropen(), serclose(), serread(), serwrite(), serioctl();
#else
#define	seropen		nulldev
#define	serclose	nulldev
#define	serread		nodev
#define	serwrite	nodev
#define	serioctl	nodev
#endif

#if NCON > 0		/* console handler */
extern conopen(), conclose(), conread(), conwrite(), conioctl();
#else
#define	conopen		nulldev
#define	conclose	nulldev
#define	conread		nodev
#define	conwrite	nodev
#define	conioctl	nodev
#endif

#if NSY > 0		/* tty handler (ie. /dev/tty) */
extern syopen(), syread(), sywrite(), syioctl();
#define	syclose		nulldev
#else
#define	syopen		nulldev
#define	syclose		nulldev
#define	syread		nodev
#define	sywrite		nodev
#define	syioctl		nodev
#endif

#if NMM > 0		/* memory device handler */
extern mmread(), mmwrite();
#define	mmopen		nulldev
#define	mmclose		nulldev
#define	mmioctl		nodev
#else
#define	mmopen		nulldev
#define	mmclose		nulldev
#define	mmread		nodev
#define	mmwrite		nodev
#define	mmioctl		nodev
#endif

#if NERR > 0		/* error device handler */
extern errread(), errwrite();
#define	erropen		nulldev
#define	errclose	nulldev
#define	errioctl	nodev
#else
#define	erropen		nulldev
#define	errclose	nulldev
#define	errread		nodev
#define	errwrite	nodev
#define	errioctl	nodev
#endif

#if NLP  > 0		/* printer handler */
extern lpopen(), lpclose(), lpwrite(), lpioctl();
#define	lpread		nodev
#else
#define	lpopen		nodev
#define	lpclose		nodev
#define	lpread		nodev
#define	lpwrite		nodev
#define	lpioctl		nodev
#endif

#if NPH > 0		/* on board modem handler */
extern phopen(), phclose(), phread(), phwrite(), phioctl();
#else
#define	phopen		nodev
#define	phclose		nodev
#define	phread		nodev
#define	phwrite		nodev
#define	phioctl		nodev
#endif

struct cdevsw cdevsw[] = {
	{ seropen, serclose, serread, serwrite, serioctl, NULL, NULL}, /*0*/
	{ conopen, conclose, conread, conwrite, conioctl, NULL, NULL}, /*1*/
	{ syopen,  syclose,  syread,  sywrite,  syioctl,  NULL, NULL}, /*2*/
	{ mmopen,  mmclose,  mmread,  mmwrite,  mmioctl,  NULL, NULL}, /*3*/
	{ gdopen,  gdclose,  gdread,  gdwrite,  gdioctl,  NULL, NULL}, /*4*/
	{ erropen, errclose, errread, errwrite, errioctl, NULL, NULL}, /*5*/
	{ lpopen,  lpclose,  lpread,  lpwrite,  lpioctl,  NULL, NULL}, /*6*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*7*/
	{ phopen,  phclose,  phread,  phwrite,  phioctl,  NULL, NULL}, /*8*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*9*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*10*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*11*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*12*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*13*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*14*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*15*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*16*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*17*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*18*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*19*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*20*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*21*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}, /*22*/
	{ nodev,   nodev,    nodev,   nodev,    nodev,    NULL, NULL}  /*23*/
};

int	bdevcnt=sizeof(bdevsw)/sizeof(bdevsw[0]); /* number of bdevsw entries */
int	cdevcnt=sizeof(cdevsw)/sizeof(cdevsw[0]); /* number of cdevsw entries */

dev_t rootdev=ROOTDEV;		/* device minor number of root filesystem */
dev_t pipedev=PIPEDEV;		/* device minor number of pipe device */
dev_t swapdev=SWAPDEV;		/* device minor number of swapping device */

struct	swdevt swdevt[]={	/* Swap device information (from BSD 4.1) */
	{	1, 0},		/* (device, freed) pair */
	{	0, 0},
};
int swplo=1;
int nswap=NSWAP;		/* size of swap space */
@//E*O*F conf.c//
chmod u=rw,g=r,o=r conf.c
 
echo x - id.c
sed 's/^@//' > "id.c" <<'@//E*O*F id.c//'
#sccs	"@(#)uts/kern:id.c	1.0"

static char SCCS_ID[] = "@(#) ";
@//E*O*F id.c//
chmod u=rw,g=r,o=r id.c
 
echo x - name.c
sed 's/^@//' > "name.c" <<'@//E*O*F name.c//'
#sccs	"@(#)uts/kern:name.c	1.0"

#define	NODE	"UNIXPC"
#define	VER	"3.51m"

#include "sys/utsname.h"

struct utsname utsname = { SYS, NODE, REL, VER, MACH };
@//E*O*F name.c//
chmod u=rw,g=r,o=r name.c
 
echo x - Makefile
sed 's/^@//' > "Makefile" <<'@//E*O*F Makefile//'
#sccs	"@(#)uts/kern:Makefile	1.0"

# workaround for System V make bug
SHELL	= /bin/sh
COPTS	= -O
CFLAGS 	= $(COPTS)
LIBS	= lib1 lib2 lib3 lib4

all:	UNIX3.51m

UNIX3.51m: $(LIBS) conf.o id.o linesw.o locore.o low.o name.o
	$(LD) -x -N cf/ifile.0407 -o UNIX3.51m low.o locore.o conf.o linesw.o \
		$(LIBS) name.o id.o
@//E*O*F Makefile//
chmod u=rw,g=r,o=r Makefile
 
echo x - space.h.patch
sed 's/^@//' > "space.h.patch" <<'@//E*O*F space.h.patch//'
*** sys/space.h~	Fri Aug  5 00:26:19 1988
--- sys/space.h	Sat Jan 19 02:43:32 1991
***************
*** 1,4
! #sccs	"@(#)uts/kern/sys:space.h	1.18"
  
  
  /*	Convergent Technologies - System V - May 1983	*/

--- 1,4 -----
! #sccs	"@(#)uts/kern/sys:space.h	1.19"
  
  
  /*	Convergent Technologies - System V - May 1983	*/
***************
*** 274,279
  		-1,0,8, 80*8,60, gfpintr, gfpstart,
  		FPMAXCYL, FPMAXBADBLK, NULL, NULL,0}
  };
  struct iobuf	gdutab[DISKS];
  struct iobuf	gdtab;
  #ifdef IOSTAT

--- 274,281 -----
  		-1,0,8, 80*8,60, gfpintr, gfpstart,
  		FPMAXCYL, FPMAXBADBLK, NULL, NULL,0}
  };
+ 				/* precomp cylinder for hard drives -md */
+ char gdhdprecomp[] = {HDPRECOMP0, HDPRECOMP1, HDPRECOMP2, HDPRECOMP3};
  struct iobuf	gdutab[DISKS];
  struct iobuf	gdtab;
  #ifdef IOSTAT
***************
*** 404,409
  #include "sys/wd.h"
  
  extern int khigh(),mscoord(), kbinit();	/* defaults for resident keyboard */
  
  int	(*ldmisc[])() = {
  	nulldev, nulldev, nulldev, nulldev, kbinit,

--- 406,412 -----
  #include "sys/wd.h"
  
  extern int khigh(),mscoord(), kbinit();	/* defaults for resident keyboard */
+ extern int nulldev();
  
  int	(*ldmisc[])() = {
  	nulldev, nulldev, nulldev, nulldev, kbinit,
@//E*O*F space.h.patch//
chmod u=rw,g=r,o=r space.h.patch
 
echo x - linesw.c
sed 's/^@//' > "linesw.c" <<'@//E*O*F linesw.c//'
#sccs	"@(#)uts/kern:linesw.c	1.0"

/* 
   linesw.c - line discipline switch table
*/
    
#include "sys/conf.h"

#define	TTY	1		/* tty line discipline present */

/*
 * Declaration of line discipline switch table.
 */

#if TTY > 0		/* tty line discipline */
extern ttopen(), ttclose(), ttread(), ttwrite(), ttioctl(), ttin(), ttout(); 
#define	ttmdm		nulldev
#else
#define	ttopen		nodev
#define	ttclose		nodev
#define	ttread		nodev
#define	ttwrite		nodev
#define	ttioctl		nodev
#define	ttin		nodev
#define	ttout		nodev
#define	ttmdm		nodev
#endif

extern	nulldev(), nodev();

struct linesw linesw[] = {
	{ ttopen, ttclose, ttread, ttwrite, ttioctl, ttin, ttout, ttmdm }, /*0*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*1*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*2*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*3*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*4*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*5*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*6*/
	{ nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev,  nodev }, /*7*/
	0
};

				/* number of linesw entries */
int	linecnt=(sizeof(linesw)/sizeof(linesw[0])-1); 
@//E*O*F linesw.c//
chmod u=rw,g=r,o=r linesw.c
 
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     82    473   3065 README.conf
    244   1374   9095 conf.c
      3      9     64 id.c
      8     22    158 name.c
     13     49    317 Makefile
     49    157   1226 space.h.patch
     44    183   1288 linesw.c
    443   2267  15213 total
!!!
wc  README.conf conf.c id.c name.c Makefile space.h.patch linesw.c | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0

-- 
David H. Brierley
Home: dave at galaxia.newport.ri.us; Work: dhb at quahog.ssd.ray.com
Send comp.sources.3b1 submissions to comp-sources-3b1 at galaxia.newport.ri.us
%% Can I be excused, my brain is full. **



More information about the Comp.sources.3b1 mailing list