*BSD News Article 81657


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!serv.hinet.net!news.uoregon.edu!arclight.uoregon.edu!news-peer.gsl.net!news.gsl.net!howland.erols.net!cs.utexas.edu!news.sprintlink.net!news-stk-200.sprintlink.net!neonramp.com!cynjut.neonramp.com!cynjut.neonramp.com!not-for-mail
From: burgess@cynjut.neonramp.com (Dave Burgess)
Newsgroups: comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd.announce,comp.answers,news.answers
Subject: [comp.unix.bsd] NetBSD, FreeBSD, and 386BSD (0.1) FAQ (Part 4 of 10)
Supersedes: <386bsd-faq-4-846396003@cynjut.neonramp.com>
Followup-To: comp.unix.bsd.netbsd.misc
Date: 27 Oct 1996 01:00:12 -0600
Organization: Dave's House in Omaha
Lines: 1898
Approved: news-answers-request@MIT.Edu,cgd@sun-lamp.cs.berkeley.edu
Expires: 11/14/96 01:00:02 CDT
Message-ID: <386bsd-faq-4-846399602@cynjut.neonramp.com>
References: <386bsd-faq-1-846399602@cynjut.neonramp.com>
Reply-To: burgess@cynjut.neonramp.com (386bsd FAQ Maintainer)
NNTP-Posting-Host: cynjut.neonramp.com
Keywords: FAQ 386bsd NetBSD FreeBSD !Linux
X-Posting-Frequency: Posted on/about the 13th and the 27th of every month.
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.netbsd.announce:286 comp.unix.bsd.freebsd.announce:376 comp.answers:20088 news.answers:78360

Posted-By: auto-faq 3.1.1.2
Archive-name: 386bsd-faq/part4

Section 3.	(Kernel Building and Maintenance)

3.0	System Internals
	
	One of the interesting aspects of *BSD is the fact that it comes 
	with the complete source.  This allows you to make changes to the 
	system, recompile, and test out your new ideas.  This section of 
	the FAQ describes many of the different aspects of this endeavor 
	and common problems and pitfalls that are encountered.  Kevin Lahey 
	provided the substantial portion of this section.  You can contact 
	him via E-Mail at (kml@rokkaku.atl.ga.us) or contact Dave Burgess 
	(burgess@cynjut.neonramp.com).

3.1	Kernel

3.1.1	How do I build a kernel?

	The kernel can be compiled in a variety of ways to support different 
	devices and configurations.  Compilation is controlled by a config 
	file that specifies the characteristics of the kernel.  A set of 
	different config files is located in /sys/i386/conf or 
	/sys/arch/i386/conf.  The configuration file names are in upper case.

	To build a particular kernel (in this example, we use the GENERICISA
	configuration file in NetBSD or FreeBSD):

	% cd /sys/i386/conf
	% config GENERICISA
	% cd /sys/compile/GENERICISA
	% make depend
	% make

	In NetBSD, since there are multiple architectures supported, there
	is an architecture line in the middle of the path to these files.
	See the build.kernel script in section 3.8 for more information.

	Remember, when structures in the kernel change, there are some
	programs (ps, top, etc.) that will cease to work correctly.  You
	will need to recompile these programs as well as the new kernel.
	You need to do the following to make sure that your programs get
	updated as well as the kernel:

	cd /usr/src/include
	make install
	cd /usr/src/lib/libkvm
	make clean && make && make install
	cd /usr/src/bin/ps
	make clean && make && make install
	cd /usr/src/...
	

3.1.1.1 Why does the kernel code for NetBSD still use the old K&R style
	declarations when the ANSI declarations are SO much better?
3.1.1.2	How do I port NetBSD to another platform?

	We still use the old style K&R definitions easier, because 
	bringing up a new port on a foreign machine with a brain-damaged 
	compiler can be impossible, or at least very difficult,
	if you don't do it this way.  Remember, NetBSD is multi-platform, 
	and tries to make it as easy as possible to port.  Which means 
	building pieces of the system with someone else's compiler.


3.1.2	I want to do one of the following things:
	* add a device not in the distributed kernel (third com
	  port, additional disk or tape, line printer driver, etc).
	* use a patch from the net or the patchkit to fix a kernel bug.
	* add another swap device.
	* recompile the kernel to remove extraneous devices so that
	  it takes up less space.
	* configure more pseudo-terminals to allow for more xterms
	  or network logins.
	
	You're going to have to recompile the kernel after you modify the 
	config file.  See section 3.2 below for more information about the 
	config file in general.
	

3.1.3	I don't have the source distribution -- how can I rebuild the
	kernel?

	There are reference sites available, as well as the 'good 
	net-neighbor' policy, whereby you could make arrangements 
	with a net neighbor to use a large local machine as a Network 
	File System (NFS), or allow you to compile a new kernel on 
	their machine and transfer it to yours.


3.1.4	Now that I have a kernel, how do I install it?

	Your kernel is called /kernel or /netbsd.  Copy the new kernel
	from /sys/compile/GENERICISA/(whatever) to /, assuming that it 
	is in that directory.  This is relatively straightforward; there 
	are a couple of things to remember, though.  First, if you 
	really screw up the new kernel, you want to have something to 
	fall back on, so be sure to save /kernel to /kernel.old before 
	copying in a new kernel.  Second, if you just copy the new 
	kernel over the currently running kernel, funny things can 
	happen.  Be sure to move aside the currently running kernel 
	before copying over the new one.  

	There are folks that have reported that overwriting their
	current kernel has never caused them any real problems.  On the  
	other hand, if the old kernel was working and the new one 
	doesn't, and you have made changes that require that old 
	kernel, it should be available to the system, and saving it 
	to /kernel.alt or /kernel.old are reasonable things to do.

	If you are really paranoid, you can mount a new fixit floppy 
	and replace its kernel with the one you just built, and then
	boot from the fixit floppy to make sure everything will work.
	This is a pretty good idea if you are making radical changes or
	if you are unsure about your changes.
  

3.1.5	After installing the patchkit and recompiling the kernel with the
	option "WD8013", I am no longer able to reboot the machine.  A
	cold boot (power on) runs fine, but after a reboot no boot drive
	is found by the BIOS.  Besides having a 16-bit WD/SMC Ethernet
	card installed the machines try to boot using either a Adaptec
	1742 or 1542 SCSI board to boot from.

	This answer was provided by Hellmuth Michaelis (hm@hcshh.hcs.de)
	and by Rodney Grimes (rgrimes@acacia).

	Remove "option WD8013" from the config files and recompile and
	reinstall the kernel. 

	The reason that option WD8013 often causes this reboot problem is 
	this:
	
	There is a requirement that all memory within a 128k bank in the
	0xA0000 to 0xFFFFF region be either 16-bit or 8-bit.  On a cold 
	boot, the WD8013 boards are reset to 8-bit mode, the POST
	(Power On Self Test) passes without error.  NetBSD comes up, the 
	if_we.c driver places the WD8013 in 16-bit mode.  Now on a soft boot
	when the BIOS runs some quick POST tests it finds a problem in the 
	0xA000 to 0xF000 region.  You probably get a "beep-beep" when this
	happens.  It means you have a memory size conflict.
	The machine has been mis-configured.
	
	This is a little known fact about 16-bit vs 8-bit option cards.
	It has caused more than one person to go crazy tracking down
	what they swear is a bug in the program.  It is not, it is a
	flaw in the design of the ISA bus.  The signal MEMCS16- must be 
	returned the same for every 128k block of memory:
	
 		A0000-BFFFF	Must all be either 8-bit or 16-bit.
 		B0000-CFFFF	Must all be either 8-bit or 16-bit.
 		D0000-FFFFF	Must all be either 8-bit or 16-bit.
	
	In your particular configuration (WD8013 @ cc000) I suspect that
	you have another board in the B0000-CFFFFF region that is 8-bit, 
	i.e.  your Adaptec has an 8-bit BIOS on it!
	
	Try moving the board to the 0xD0000 region and see if it works 
	there, you may still have a problem as many modern system BIOSes
	are now 8-bit.  If your system BIOS is 8-bit, try shadowing the
	system BIOS region at 0xF0000 to 0xFFFFF, this effectively turns 
	it into a 16-bit BIOS.  

	Do not attempt to shadow the WD8013, it will cause you many
	headaches.  In fact, it sometimes helps to turn on BIOS shadowing. 
	Some BIOSes allow to copy ROM contents to unused RAM pages for 
	selected 16KB-regions. While it is generally a good idea to turn 
	BIOS shadowing off, I have also observed that sometimes it helps to 
	turn shadowing of true ROM regions on. 


3.1.6	My system is complaining about stray interrupt 7.  Is my machine 
	going to explode or anything?

	No.  They are caused by lots of things.  They are, as far as
	anyone that should be expected to know about this stuff, harmless.
	There are ramifications on them being there, but for MOST users
	they do not pose a real threat to your operations.  For those of
	you that are doing REALLY interrupt intensive stuff, you may want
	to grab a technical reference and figure out why the 8259 is not
	getting reset correctly.

	In spite of the number of times this has come up (and people have
	even referenced this section) there are still at least two 
	questions on the net about this.  A memorable one was a guy who
	was just vehement that the stray int 7 was what was keeping his
	system from booting.  In fact, he went so far as to say that this
	document was practically worthless because I didn't tell him how
	to fix it.  Of course, once he configured his hard drive controller 
	so that it was on the right interrupt, his booting problem went 
	away.  I have said it before and I will say it again.  For MOST 
	users they do not pose a real threat to your operations.
	I have heard of three people (out of at least 2000) that have
	actually have problems so bad that they couldn't proceed.  They
	bought new computers, and the problem went away.

	These stray interrupts are caused by something in the PC.  
	I have yet to see a convincing explanation of precisely what,
	but they are definitely caused by something.  There are four
	ways to deal with this problem.

	1)  Ignore them.  They are spurious and do not effect the
	operation of your computer.

	2)  Implement the lpt driver.  This way, the driver traps 
	(the lpt driver expects IRQ 7) and then quietly discards them.  
	That is why when folks implement the lpt driver the 'problem' 
	goes away.  The computer is taught how to ignore them.

	3)  Do what the original 386bsd code did.  Comment out the
	diagnostic and associated code that tries to deal with them so
	you don't see the error message.

	4)  Buy a new computer that doesn't cause this problem.   It is a
	known hardware problem with the 8259 being reset incorrectly in
	hardware.

	Kalevi Suominen (jks@geom.helsinki.fi) offers this technical
	explanation of the 'stray interrupt 7' phenomenom.

	In the section of the Intel Peripheral Handbook dealing with
	the 8259A there is a description of the 6-step interrupt
	sequence for an 80x86 system (and 7-step for an MCS-80/85),
	and then the following paragraph:

	"If no interrupt request is present at step 4 of either sequence
	(i.e., the request was too short in duration) the 8259A will
	issue an interrupt level 7. Both the vectoring bytes and the CAS
	lines will look like an interrupt level 7 was requested."

	This explains how some transient disturbances or improperly
	functioning adapter cards could trigger a stray interrupt 7
	in a system operating in the *level* interrupt mode (such as
	a PS/2 with MCA): An interrupt request will disappear as soon
	as the interrupt line goes inactive.

	That such interrupts may also occur in a system operating in
	the *edge* triggered mode (such as an ordinary PC/AT with ISA)
	is a little harder to see. Yet it is possible - even without
	malfunctioning hardware - because masking an interrupt request
	will hide its presence from the 8259A as well:


	    1. The interrupt flag (IF) of the 80x86 is reset either 
	    directly (e.g., by a "cli" instruction) or because an 
	    interrupt handler is entered. In the latter case the 
	    corresponding in-service (IS) bit of the 8259A is set 
	    (effectively blocking interrupts of lower priority).

	    2. The 8259A receives an unmasked interrupt request (IRQn), 
	    and, in case an interrupt is being served and has higher 
	    priority than IRQn, the IS bit of the 8259A is reset by 
	    an end of interrupt (EOI) command. (These steps may occur 
	    in either order.) If IRQn has higher priority (e.g. IRQ0), 
	    no EOI is necessary.

	    3. The 8259A activates the interrupt (INT) line to the 80x86
   	    (which will ignore it - for the moment).

	    4. The interrupt mask (IM) bit of the 8259A for IRQn is set.
	    (A little late, though. The sequence has already started.)

	    5. The interrupt flag (IF) of the 80x86 is set (either 
	    directly, or as a consequence of e.g. an "iret" instruction).

	    6. The 80x86 will now acknowledge the INT request by activating
   	    the INTA line of the 8259A.

	    7. The 8259A will not see the masked IRQn and will continue
   	    by issuing a spurious interrupt of level 7 instead.


	The original interrupt request (IRQn) will not be lost, however.
	It is preserved by the associated edge sense latch of the 8259A,
	and will be acted on after the IM bit has been reset again.

	The net result is that a single interrupt request will be
	delivered *twice* to the 80x86: first as a stray interrupt 7
	and later as the proper interrupt. In particular, it is perfectly
	safe to ignore the stray interrupt (other than sending an EOI).
	It is just the ghost of an aborted interrupt sequence: the system
	was not prepared for it yet.


3.1.7	I keep getting "wd0c: extra interrupt".  What does it mean?

	It means that the drive was already processing a command 
	(active) when it recieved an interrupt from the system telling 
	it to see if it had anything to do.  This is mostly harmless 
	but could indicate that the drive/controller is having problems 
	if the message appears often.

	
3.1.8	I keep getting silo overflow messages, but the system doesn't
	seem to mind.  Is there a problem?

	Not exactly.  This simply means that the First in first out
	buffer is getting too full.  I markedly reduced the incidence 
	of silo overflows on my system by editing dev/isa/com.c to 
	change the FIFO threshold from 8 to 4 characters.  This way, the
	buffer gets more attention and reduces the chance of overflowing
	the buffer.


3.1.9	I found a bug in the kernel.  How do I report it?

	Both NetBSD and FreeBSD include a facility called 'bugfiler'.  
	While the instructions are included in both system, there is 
	still some apparent confusion about when to use (and when to
	NOT use) bugfiler.

	Jordan K. Hubbard (jkh@whisker.lotus.ie)  provides us with this
	short article for FreeBSD.

	To send bug reports, you want to use the sendbug(1) command.
	The entire package for sending and filing these bugs is known 
	as "the bugfiler", which is where the confusion stepped in, 
	but sendbug is definately the command you want to use.

	Second, it doesn't take a "net connection" to use sendbug, 
	since all it does is package up your "bug report form" and mail 
	it to us; no direct internet connectivity is required, just mail.

	So if you can send internet mail you can use sendbug, or you can 
	also send mail to the `FreeBSD-bugs@freefall.cdrom.com' address 
	(do NOT send it to FreeBSD.cdrom.com since it will BOUNCE, this 
	is not the place to send bugs to, just to ftp stuff from!).

	NetBSD has a similar facility, but has a different program and
	host for bug reports.  The program for NetBSD is called send-pr
	and is slightly different in several respects.  It is part of
	the GNATS system, which the NetBSD core developers started using
	in February of 1994.  It is recommended that NetBSD users see the 
	man page on send-pr before filing bug reports.

	For getting information from GNATS, see the file doc/BUGS.

	There is a email interface to the NetBSD PR database.  To query 
	the database send mail to "query-pr@gnats.netbsd.org".  The mail 
	server will send a bug database listing back to the user.

	There are several flags that are useful to send to the mail server.
	The flags are entered in the "Subject" line:
	  --summary	Display an one-line entry for each bug
	  --full 	Display the full entry for each bug	
	  --help	Display a help string containing the rest of the flags.
	  PR		The Problem Report number of a particular bug

	For example, to send a query about all the bugs:
	  $ Mail -s "--summary" query-pr@gnats.netbsd.org < /dev/null

	If you want to know more about a particular bug, let's say bug 40:
	  $ Mail -s "--full 40" query-pr@gnats.netbsd.org < /dev/null


	John Conklin is trying to get a page set up at the NetBSD WWW site
	(www.netbsd.org) that will allow people to interactively query the 
	bug database.  It should be operational soon.


3.1.10	Can someone please give a reasonably clear set of instructions 
	as to how to get a "current" version of NetBSD running?

	First, you will need to get the new files into your source
	directory.  You can either use the most recently released set of
	sources (for an upgrade) or you can start following -current.
	Either way, you can use the instructions to build the world (at
	the end of this section of the FAQ).

	And Theo Deraadt provides this guidance when you get an error
	like "init_main.o: Undefined symbol _pdevinit referenced from
	text segment."

	You need to
		(1) install new config
		(2) make clean
		(3) re-config your kernel
	then this goes away


3.2	What exactly is this config file, anyway?  What are all of these 
	cryptic notations?

	The config file is the list of all of the optional (and settings
	for the mandatory) parts of the kernel.  If the system is made
	up of static object files which don't change, then all you
	should ever need to do is modify the config file, reconfigure
	the kernel objects, and relink.  Since both NetBSD and FreeBSD
	are distributed with source, these files are recompiled and a
	kernel is constructed.  Some of these have been deprecated, and
	may not be in use for a particular version of the system
	(i.e. ISO9660 and CD9660 are the same, CD9660 being the newer
	version).  This is a list of the compile options and
	a very brief explanation of what they are used for:


	ACCOUNTING		# process accounting
	ADOSFS			# AmigaDOS file system
	CCITT			# CCITT X.25
	CCITT,LLC,HDLC	 	# CCITT protocol suite
	CD9660			# ISO 9660 (CDROM) filesystem w/ RockRidge
	COMDEF_SPEED=x		# default baud on the scn chips
	COMPAT_09		# compatibility with NetBSD 0.9
	COMPAT_10		# compatability with NetBSD 1.0
	COMPAT_43		# 4.3 BSD compatible system calls
	COMPAT_44		# compatibility with 4.4BSD binaries
	COMPAT_HPUX		# HP-UX Binary compatibility (see note)
	COMPAT_IBCS2		# Intel Binary Compatibility (see note)
	COMPAT_LINUX 		# Linux Binary Compatibility (see note)
	COMPAT_FREEBSD 		# FreeBSD Binary Compatibility (see note)
	COMPAT_NOLABEL		# default partitioning for unlabeled disks
	COMPAT_NOMID		# allow nonvalid machine id executables
				# (specifically NetBSD, 386BSD, and BSDI)
	COMPAT_OHPUX		# Needed at least through HP-UX 7.05 (see note)
	COMPAT_SUNOS		# Support to run Sun (m68k) executables
	COMPAT_SVR4		# System V R4 compatibility (see note)
	COMPAT_ULTRIX		# compatibility with ULTRIX binaries (see note)
	(NOTE:  Several of these options include the ability to run both
	        statically and dynamically linked binaries.  Obviously, 
		you can't run M680*0 binaries on am i386, but the OS
		level support is there.  See Section 3.n for more
		information on dynamically linked executables and the
		emulation modes.)
	CONFIG_NEW		# Use config.new stuff
	DDB			# Kernel debugger
	DEBUG			# extra kernel debugging support
	DEC_2000_300 		# Jensen: 2000/300
	DEC_2100_A50 		# Avanti: AlphaStation 400 4/233
	DEC_3000_300 		# Pelican family: 3000/300*
	DEC_3000_500 		# 3000/[4-9]00
	DEVPAGER		# device pager (mapped devices)
	DEV_RTC 		# /dev/rtc access to hardware clock
	DIAGNOSTIC		# Add additional error checking code
	DIRECTED_BROADCAST	# Broadcast across subnets
	DST=x			# daylight savings rules (for param.c)
	DUMMY_NOPS		# Sometimes results in a faster machines
	EON			# ISO CLNL over IP
	ETHER 			# Ethernet, probably needed
	FASTLINKS		# fast symbolic links in FFS
	FDESC			# user file descriptor filesystem
	FFS			# Berkeley fast file system
	FIFO			# FIFO operations on vnodes
	FPCOPROC		# Support for MC68881/MC68882
	FPSP			# MC68040 floating point support
	GATEWAY			# IP packet forwarding
	GDB			# support for normal gdb
	GENERIC			# Mini-root boot support
	GRF_A2024		# Support for the A2024
	GRF_AGA			# AGA Chip Set
	GRF_CL5426 		# Cirrus board support (not yet)
	GRF_ECS			# Enhanced Chip Set
	GRF_NTSC		# NTSC
	GRF_PAL			# PAL
	I386_CPU 		# CPU classes; at least one is REQUIRED
	I486_CPU 		# cpu type
	INET			# IP prototol stack support
	INSECURE 		# Xfree86 requirement
	ISO			# ISO Networking support
	ISOFS			# ISO-9660 w/ RockRidge
	KERNFS			# kernel data-structure filesystem
	KFONT_8X11		# 8x11 font
	KFONT_8x8 		# Use 8x8 font instead of 8x11
	KGDB			# support for kernel gdb
	KGDBDEV=x		# device for kernel gdb
	KGDBRATE=x		# kernel gdb port rate (default 9600)
	KTRACE			# Add kernel tracing system call
	LFS			# Log-based filesystem (still experimental)
	LKM			# loadable kernel modules
	LOFS			# Loop-back filesystem
	M68020			# support for 020/851
	M68030			# support for 030
	M68040			# support for 040
	MACHINE_NONCONTIG	# temporary kluge to allow for
				# non-contguous memory (on PC)
	MAPPEDCOPY		# use page mapping for large copyin/copyout
	MATH_EMULATE		# DX maths emulation
	MC68030			# Includes the 020+851
	MFS			# Memory based filesystem
	MROUTING		# Multicast routing support
	MSDOSFS			# MS-DOS filesystem
	MULTICAST		# Multicast support
	NFS			# Sun NFS-compatible filesystem
	NFSCLIENT		# Network File System client
	NFSSERVER		# Network File System server
	NFS_BOOT_RWSIZE=1024	# Size of NFS boot
	NKMEMCLUSTERS=x		# Size of kernel malloc area
	NS			# Xerox XNS
	NSIP			# XNS over IP
	NULLFS			# Loopback filesystem
	PANICBUTTON		# Two fast <reset>s on console dump kernel
	PANICWAIT		# Require keystroke to dump/reboot
	PCVT_NETBSD 		# Pseudo Console VT220 support
	PCVT_NOFASTSCROLL	# Disable fast scrolling on pcvt's
	PORTAL			# Portal filesystem
	PROCFS			# /proc filesystem
	QUOTA			# file system quotas
	RAMD_ADR=x		# Adr of the boot strap ram disk
	RAMD_SIZE=x		# Size of the boot strap ram disk
	RCONSOLE		# fast rasterop console
	RETINACONSOLE		# enable code to allow retina to be console
	RETINA_SPEED_HACK 	# enable fast scroll code, may not work
	SBPRO			# Sound Blaster Pro support
	SCSI			# Support for SCSI disks
	SCSIDEBUG		# Add SCSI debugging statements
	SHMMAXPGS=x		# 1024 pages is the default
	SWAPPAGER		# Pager for swap device
	SYSCALL_DEBUG		# debug all syscalls.
	SYSVMSG			# System V messages
	SYSVSEM			# System V like semaphores
	SYSVSHM			# System V shared memory
	TCP_COMPAT_42		# compatibility with 4.2BSD TCP/IP
	TIMEZONE=x		# minutes west of GMT (for param.c)
	TPIP			# ARGO TP networking support
	UCONSOLE		# Anyone can do TIOCCONS
	UMAPFS			# uid/gid remapping filesystem
	UNION			# Union filesystem
	USER_LDT 		# user-settable LDT; used by WINE
	VNODEPAGER		# Pager for vnodes
	XSERVER			# Xserver support
	

3.2.1	Okay, fine.  Why shouldn't I just add every device I can find to
	the kernel, so I'll never have to recompile this again?

	Because it takes up space.  The kernel is wired into memory, so 
	every byte it uses comes out of the pool of memory for everything 
	else.  It can't page out sections that aren't in use.  If your 
	kernel is larger than 640K, then it can't be loaded.  You'll need 
	to use Julian Elischer's bootblocks to put it in high memory, which 
	seem to be fairly complex.  Installing them (once they are 
	compiled) is as easy as using disklabel.

	Newer versions of the *BSD kith provide the capability to build
	a kernel that is larger than 640K.  Complete instructions are
	provided in the appropriate systems.


3.2.2	What should I remove from the kernel?

	What do you need?  If you only have an SCSI controller, you don't 
	need the wd0 device;  if you have another kind of disk controller, 
	you don't need sd0.  Unless you actually HAVE more than one Ethernet 
	controller, you should comment out all but one of them.  If you don't 
	have an ethernet controller, you don't need any of the controllers or 
	NFS compiled in.   Without a CD-ROM, ISOFS is kind of pointless.  Just 
	look at what you have and think about what you really need.


3.2.3	I can't get enough remote login sessions or xterm sessions.  I also
	can only get four sessions working at a time.  What can I do?

	Increase the count of pseudo-terminals --

	pseudo-device	pty	12  # or whatever

	Every pseudo terminal should have a /dev/pty* entry.  If you have 12
	pseudo terminals, you should also have at least 12 pty devices in the
	/dev directory.  The MAKEDEV script in /dev will create as many pseudo-
	terminals as you tell it to.


3.2.4	How do I get ddb, the kernel debugger, compiled into the kernel
	and running?

	If you are using older versions of the 386BSD family, you will
	need to add a line in your config file that looks like this:

	device-pseudo	ddb

	If you are using a more recent version (the division is pretty
	unclear about when the switch was made) and do not have any
	device-pseudo entries, you will need to add the line:

	options 	DDB

	to your config file.

	Build the kernel, then run dbsym on it:

	% dbsym ./kernel

	Install it and go for it.  Ctl-Alt-Esc drops you into the debugger.

	Note: DDB as shipped originally is a memory hog, and it is very
	difficult to get a kernel small enough with enough fun things in it
	to debug in 640K

	On the NetBSD-sparc system, the L1-A is used by the the DDB
	routines to drop you into the debugger.


3.2.5	I'm getting all kinds of errors when I try to build a new
	version of GCC.  How can I upgrade GCC to the most current version?

	Yes, this will happen on most architectures on the first compile
	of src/gnu/usr.bin/gcc/libgcc.  As was stated in the mailing
	list before, when you get to this error:
	  1) run a 'make' in the gcc directory.  It will error out (most
	     likely) on libgcc.
	  1) Do a 'make install' at this point to install at least gcc, 
	     cpp, and cc1.
	  2) go back and compile in src/gnu/usr.bin/gcc/ WITHOUT doing 
	     a "make clean"
	  3) install everything in src/gnu/usr.bin/gcc


3.2.6	Can I patch the current running OS image?

	In general, I think, the answer is no.  The prevailing philosophy 
	seems to be that one should use sysctl for such things, but that 
	requires that one has already compiled in the ability to change 
	the specific variable in question.  (I discovered this when I 
	wanted to patch tickadj at runtime; I added it to kernfs, and 
	when I offered the patches (which are quite small) I was told 
	sysctl was the `correct' way.  What's incorrect about /kern was 
	never quite explained; the closest anyone came was to invoke 
	internationalization concerns.  Of course, using /kern also 
	requires having compiled in support for tweaking the variable 
	you want to change.)

	Besides, unless you've patched securelevel, I don't think there 
	is any good way to twiddle variables in the running kernel.  
	/dev/{,k}mem are, I believe, read-only once init sets securelevel 
	to 1.
				Der Mouse
				(mouse@collatz.mcrcim.mcgill.edu)

	If you need to know more about the sysctl command, try 
	"sysctl -a | more" to get a list of the parameters that can be
	modified while the system is running.


3.2.6	Can I have more than one config file?  Should I rename it to something
	else?  Any other hints?  

	You can create as many (or as few) config files as you desire.  The 
	system, once the patchkit is applied, will have between 10 and 15, 
	each of which implements certain functions or features.  In addition, 
	the normal place for the patchkit to make changes to the config files 
	is in the GENERICISA file.  Since this file should remain unchanged 
	and available, it is always a good idea to copy this file to a 
	meaningful name and modify that file.  In other words, change every 
	reference in 3.1.1 from GENERICISA to HAL (or whatever you call your 
	system).

	One final note.  Every /sys/compile directory takes up 800K or so;
	you might want to watch to see how big these all get.



3.2.7	What is the meaning of the trap codes I get in panic messages?
	Sometimes this message appears in the form "trap type nn".

	That message means that the system received an unexpected (and
	unwanted) trap that probably indicates some form of kernel bug.
	These traps, are usually received from the kernel, in which case
	the trap.h definitions should be used.

	The number (which appears in place of "nn" above) is *NOT* the 
	i386 or i386 trap type, it is a BSD-defined trap type number.

	The definitions of the various trap types can be found in
	/usr/include/machine/trap.h.

	two of the more common ones are:
          9	T_PROTFLT	protection fault
				(The kernel tried executing code
				which was not noted as "executable".
				This happens if the kernel jumps to
				a bogus location.)
         12	T_PAGEFLT	page fault
				(The kernel tried to access a bogus
				area of memory.  This can happen if
				an invalid pointer is dereferenced.)


	This is a list of i386 trap codes (just to confuse the issue).

	Trap	0	Divide Error
			The DIV or IDIV instruction is executed with a 
			zero denominator or the quotient is too large 
			for the destination operand.
	
	Trap	1	Debug Exceptions
			Used in conjunction with DR6 and DR7. The 
			following flags need to be tested to determine 
			what caused the trap:
			
			BS=1				Single-step trap
			B0=1 AND (GE0=1 or LE0=1)	Breakpoint, DR0, 
							LEN0, R/W0
			B1=1 AND (GE1=1 or LE1=1)	Breakpoint, DR1, 
							LEN1, R/W1
			B2=1 AND (GE2=1 or LE2=1)	Breakpoint, DR2, 
							LEN2, R/W2
			B3=1 AND (GE3=1 or LE3=1)	Breakpoint, DR3, 
							LEN3, R/W3
			BD=1				Debug registers 
							not available, in 
							use by ICE-386
			BT=1				Task Switch
	
	Trap	2	NMI Interrupt
			On PC/AT systems, the NMI input to the CPU is 
			usually connected to the main memory parity 
			circuit.  By the time the error signal is 
			generated, the data may have already been used 
			in an instruction, so it isn't possible to 
			reliably recover.  

			And some not-so-common causes (from various 
			sources):

		  	-  PS50+ : I/O channel check, system watch-dog 
			timer time-out interrupt, DMA timer time-out 
			interrupt 

			-  parity errors on any 8-bit or 16-bit board 
			pulling the IOCHCK* line low 

		  	-  first generation of auto-switching EGA cards 
			used NMI to trap port access for CGA emulation 
			(e.g., ATI's EGA Wonder)
	
		  	-  Zeos Notebook low battery (perhaps other 
			battery-based computers)

	Trap	3	Breakpoint
			The result of executing an INT 3 instruction.  
			MS-DOS and Windows and some other non-386 systems 
			use this for debugging.  Code specific to the 
			i386 and later processors should use the 
			debugging features tied to Trap 1.
	
	Trap	4	INT0 Detected Overflow
			Occurs if an INT0 instruction is executed and 
			the overflow flag (OF) is currently set.
	
	Trap	5	BOUND Range Exceeded
			Occurs if the BOUND instruction is executed and 
			the array index points beyond the area of memory 
			containing the array being tested.
	
	Trap	6	Invalid Opcode
			The value read at CS:IP is not a valid opcode.
	
	
	Trap	7	Coprocessor Not Available
			This occurs if the processor fetches an 
			instruction that is for the coprocessor and no 
			coprocessor is present.
	
	
	Trap	8	Double Exception (Fault)
			An exception occurred while trying to execute 
			the handler for a prior exception.  Example, 
			an application causes a General Protection 
			Fault (13) and the area of memory where the GPF 
			handler should be is flagged not-present 
			(paged-out?).  The double-fault handler is 
			invoked in these conditions.  If a fault occurs u
			while trying to run the double-fault handler, a 
			triple-fault occurs and the CPU resets.
	
			The rules for deciding if a double-fault should 
			occur or if the two faults can be handled 
			serially are discussed in more detail in the 
			Intel song book.
	
	Trap	9	Coprocessor Segment Overrun
			A page or segment violation occurred while 
			transferring the middle part of a coprocessor 
			operand to the NPX.
	
	Trap	10	Invalid Task State Segment
			During a task switch, the new TSS was invalid.  
			Here is a table of conditions that Invalidate 
			the TSS:

			TSS id + EXT	The limit in the TSS descriptor 
					is < 103
			LTD id + EXT	Invalid LDT selector or LDT not 
					present
			SS id + EXT	Stack segment selector is outside 
					table limit
			SS id + EXT	Stack segment is not a writable 
					segment
			SS id + EXT	Stack segment DPL does not match 
					new CPL
			SS id + EXT	Stack segment selector RPL <> CPL
			CS id + EXT 	Code segment is outside table limit
			CS id + EXT	Code segment selector does not 
					refer to code segment
			CS id + EXT	DPL of non-conforming code 
					segment <> new CPL
			CS id + EXT	CPL of conforming code segment 
					greater than the new CPL 
			DS/ES/FS/GS id + EXT	DS, ES, FS or GS segment 
						selector is outside table 
						limits
			DS/ES/FS/FS id + EXT	DS, ES, FS, or GS is not 
						readable segment


	Trap	11	Segment Not Present
			Occurs when the "present" bit of a descriptor is 
			zero.  This can occur while loading any of these 
			segment registers CS, DS, ES, FS, or GS.  Loading 
			SS causes a Stack fault.  Also occurs when 
			attempting to use a gate descriptor that is 
			marked "not present", and if attempting to load 
			the LDT with an LLDT instruction.  Note that 
			loading the LDT during a task switch causes an 
			"invalid TSS" trap.

	Trap	12	Stack Fault
			A limit violation relating to an address 
			referenced off the SS register.  Includes POP, 
			PUSH, ENTER, and LEAVE opcodes, as well as 
			references such as MOV AX,[BP+8] (which has an 
			implied SS:).  Also causes by loading SS with a 
			descriptor that is marked "not present".

	Trap	13	General Protection Fault (GPF)
			America's Favorite: in the MS-Windows world, it 
			is known as the UAE error.  The instruction 
			tried to access data out of the bounds 
			designated by the descriptors.  The access that 
			failed can be a read, write or instruction fetch.  

			There are 15 classifications of GPFs:
			1.  Exceeding segment limit when using CS, DE, ES, 
			    FS or GS.
			2.  Exceeding segment limit when referencing a 
			    descriptor table.
			3.  Transferring control to a segment that is not 
			    executable.
			4.  Writing into a read-only data segment or into 
			    a code segment.
			5.  Reading from an execute-only segment.
			6.  Loading the SS register with a read-only 
			    descriptor (unless the selector comes from 
			    the TSS during a task switch, in which case a 
			    TSS exception occurs.)
			7.  Loading SS, DS, ES, FS or GS with the 
			    descriptor of a system segment.
			8.  Loading, DS, ES, FS or GS with the descriptor 
			    of an executable segment that is not also 
			    readable.
			9.  Loading SS with the descriptor of an 
			    executable segment.
			10. Accessing memory via, DS, ES, FS or GS when 
			    the segment register contains a null selector.
			11. Switching to a busy task.
			12. Violating privilege rules.
			13. Loading CR0 with a PG=1 and PE=0.
			14. Interrupt or exception via trap or interrupt 
			    gate from V86 mode to privilege level other 
			    than zero.
			15. Exceeding the instruction limit of 15 bytes 
			    (this can only occur if redundant prefixes 
			    are placed before an instruction).

			To determine which condition caused the trap, 
			you need the instruction, the contents of all 
			associated registers, particularly the segment 
			registers involved, then the various LDT, GDT 
			and page control tables.  Lots of common coding 
			errors cause the GPFs.  Even a stack imbalance 
			will usually show up as a GPF.   Even the
			following code segment will cause a GPF:
				
				MOV AX,7 
				MOV ES,AX or MOV AX,5 
				PUSH AX 
				POP DS 

			You can't use a segment register for "temporary 
			storage" of any old value the way you could on 
			the 8086.  The values loaded into the segment 
			registers are checked in protected mode.

	Trap	14	Page Fault
			The page directory or page table entry needed 
			for the address translation has a zero in the 
			present bit, or the current procedure does not 
			have sufficient privilege to access the 
			indicated page.

	Trap	15	(reserved)

	Trap	16	Coprocessor Error
			The coprocessor asserted the ERROR# input pin 
			on the 386 (internal on the 486)

	Trap	17	Alignment Check (486 and later)
			If enabled, this trap will occur if a data fetch 
			does not occur on a word boundary.  I don't know 
			of any software that activates this feature yet.  
			I have seen SCO UNIX get this error on early 
			Cyrix processors, even though SCO had not 
			enabled the feature.

	Trap	18-32	(reserved)

	[answered by 	Frank Durda IV <uhclem@nemesis.lonestar.org>	
	and jim mullens jcm@ornl.gov  -or- mullens@jamsun.ic.ornl.gov]
	
	------------------------------------------------------------------

3.2.8	I have been getting a lot of "virtual memory exhausted" errors when 
	I am compiling a program with a really big static array.  I have 
	128Meg of memory and 8Gig of swap.  How can this be happening?

	If you are using Csh, you can simply unlimit your processes in 
	your system level /etc/csh.cshrc file or your personal .cshrc 
	file.  You can also modify your kernel so that the
	amount of memory available is less limiting.  J"org Wunsch 
	(j@tcd-dresden.de) provides us with this brief description:

	From a recent posting i just made, regarding the problem how much
	virtual memory one could get.

	| On the other hand, i've also changed the definitions you
	| mentioned. But i didn't like to modify the header files, and
	| actually, modifying the values is as easy as:
	| 
	| options		"DFLDSIZ='(16 * 1024 * 1024)'"
	| options		"MAXDSIZ='(64 * 1024 * 1024)'"
	| 
	| Include the above lines into your kernel's config file, reconfig
	| and rebuild it.
	| 

	This is just a hint for those people poking around with compiling
	large source files. Especially, due to some gcc problems with large
	static arrays, compiling X applications with huge bitmaps would
	cause virtual memory trouble. Increasing the limits (o'course, as
	long as the h/w resources suffice) could help there.

	The default definitions for the above parameters are found in
	/usr/include/machine/vmparam.h.


3.2.9	Where can I learn more about all this?

	We've skipped over a lot of details here;  the straight dope comes from
	"Building Berkeley UNIX Kernels with Config", by Samuel J. Leffler and
	Michael J. Karels. 


3.2.10	Has the method for system call changed?  

	Q.  Is there something special with the order I need to update 
	binaries and libraries in?  If I drop in the new libc, everything 
	gives me a bus error.  Both shared and static do this.

	A.  On the port-i386 list, Charles Hannum discussed changing the 
	system call mechanism (doing it via an INT instead of a call 
	gate).  Looking at src/lib/libc/arch/i386/sys/syscall.S, it looks 
	like this change is in.   Your binaries are (if you are using an 
	old kernel) probably crashing at each system call now.

	So.. first compiling a new kernel with COMPAT_10 in it should make 
	your newly linked binaries work, I guess (have not recompiled since 
	the update myself yet). Also don't forget that you need to use 
	config.new now.

	So, the answer is Yes, the mechanism for system calls has
	changed, but the old method (using a call gate) is still
	available by specifying COMPAT_10 in your configuration file.


3.2.11	Does anyone have a system building script that takes things like 
	building a new config and multiple config files into account?

	This is the program that I use to rebuild my kernel.  See the note
	in the file about my 'test' program.  You may elect to build a
	new config every time, or not, depending on your requirements.


	#! /bin/sh
	#
	#  Script to rebuild the kernel.
	#
	if [ `whoami` != 'root' ] ; then
	  echo 'You must be root to successfully proceed from this point'
	  exit 1
	fi
	
	#
	#  Set up the environment
	#
	
	if [ X$MACHINE_ARCH = "X" ] ; then
	  MACHINE_ARCH=i386
	fi
	
	if [ -f /netbsd ] ; then
	  ARCHDIR='/arch'
	fi
	
	#
	# Rebuild Config
	#
	# I am using a modified test(1) that allows for file date comparisons.
	# You can either get my patches (if they aren't already included),
	# modify test() yourself, or get the GNU ShellUtils test(1) program.
	#
	
	if [ /usr/src/usr.sbin/config -ot /usr/sbin/config ] ; then
	  echo "Config Up To Date"
	else
	 cd /usr/src/usr.sbin/config
	 make clean
	 make depend
	 make
	 make install
	fi
	
	cd /sys
	make
	make install
	
	#
	# Modify the local Configuration File
	#
	echo `tput clr`
	cd /sys$ARCHDIR/i386/conf
	
	if [ "X$CONFIG_NAME" = "X" ]; then
	  CONFIG_NAME=GENERIC
	fi  
	
	if [ "X$1" = "X" ]; then
	  echo "Configuration Files available:"
	  ls [A-Z]*
	  echo " "
	  echo -n "Enter the name of the config file to use: "
	  read CONFIG_NAME
	  echo
	else
	  CONFIG_NAME=$1
	fi
	
	if [ ! -f $CONFIG_NAME ]; then
	  cp GENERIC $CONFIG_NAME
	fi
	
	echo "Modifying $CONFIG_NAME config file"
	echo -n "Press return to continue (q to quit) "
	read ans
	
	ans=`echo $ans | cut -c1 | tr 'QqYy' 'qqqq'`
	
	if [ "X$ans" = "Xq" ] ; then
	  exit 0
	fi
	
	vi $CONFIG_NAME
	
	#config.new $CONFIG_NAME
	config $CONFIG_NAME
	
	COMPILE_DIR=/sys$ARCHDIR/i386/compile/$CONFIG_NAME
	
	cd $COMPILE_DIR
	make depend
	make
	
	if [ $? -ge 1 ] ; then
	  echo "Errors encountered"
	else
	  if [ -f netbsd ] ; then
	    PROGNAME=netbsd
	  else
	    if [ -f freebsd ] ; then
	      PROGNAME=freebsd
	    else
	      PROGNAME=kernel
	    fi
	  fi
	  echo `tput clr`
	  echo ""
	  echo "  Manual Installation is recommended.  The following files should be"
	  echo "copied/linked/moved to the root directory.  The following steps are"
	  echo "suggested:"
	  echo ""
	  echo "	mv /$PROGNAME /$PROGNAME.old"
	  echo "	mv $COMPILE_DIR/$PROGNAME /$PROGNAME"
	  echo "	reboot"
	  echo ""
	  echo "Remember that the new kernel changes will not take place until you "
	  echo "re-boot the system."
	fi

	

3.2.12	How do I upgrade from my release version of NetBSD (and
	probably FreeBSD) to the '-current' development sources?

	These 'upgrading instructions' are from Alistair G. Crooks 
	(agc@uts.amdahl.com) Alistair G. Crooks) and were correct as of
	the 26th of June 1995:
 
	# Remember to make yourself a new config (not config.old) kernel 
	# config file.
	#
	# Make sure you have COMPAT_10 as part of your kernel config 
	# options.
	# This assumes that the -current source is in /usr/src

	(cd /usr/src/usr.sbin/config 
	make && make install && make cleandir)

	# if you don't do this, config of your kernel config file will
	# fail with errors in files.i386

	(cd /usr/src/gnu/usr.bin/gas ; make && make install && make cleandir)

	# if you don't do this, you won't be able to build locore.s, with
	# errors about cpuid instruction not found

	(cd /sys/arch/i386/conf ; config MYKERNEL)
	(cd /sys/arch/i386/compile/MYKERNEL ; make depend && make)

	# copy  new kernel to /, and boot off it
	
	(cd /usr/src/share/mk ; make install)

	# if you don't do this, you'll get errors building gcc, when it
	# doesn't know how to make the manual pages (don't know how to 
	# make gcc.0)
	
	(cd /usr/src/gnu/usr.bin/gcc2 ; make && make install && make cleandir)
	
	# Bernd Wiserner says that the ld.so that will be built next will
	# work only with libc.so.12.0, not with libc.so.12.3
	# His instructions to make a working ld.so follow:
	# Do NOT run ldconfig while doing the folowing 5 lines ...
	(cd /usr/src/include ; make && make install)
	cp -p /usr/libexec/ld.so /usr/libexec/ld.so.good
	(cd /usr/src/gnu/usr.bin/ld ; make && make install && make cleandir)
	cp -p /usr/libexec/ld.so.good /usr/libexec/ld.so
	(cd /usr/src/lib ; make && make install && make cleandir)
	# Then build ld.so again ...
	(cd /usr/src/gnu/usr.bin/ld ; make && make install && make cleandir)  
	# Thanks, Bernd...
	
	# it was at this stage that I got REALLY fed up with the
	# sh: warning: running as root with dot in PATH
	(cd /usr/src/bin/sh ; make && make install &&  make cleandir)
	
	# and now back to the beginning and make the world
	(cd /usr/src/bin ; make && make install && make cleandir)
	(cd /usr/src/sbin ; make && make install && make cleandir)
	
	mkdir /usr/share/doc/usd/13.viref
	# otherwise "make install" in /usr/src/usr.bin will fail because
	# the destination directory doesn't exist - from Tom Thai
	
	# if you're using the obj directory hierarchy, use the
	# initscan.c from the obj directory, otherwise use the initscan.c
	# that was created here.

	cd /usr/src/usr.bin/lex
	if test -d /usr/src/usr.bin/lex/obj ; then
	  cp initscan.c obj/scan.c
	else
	  cp initscan.c scan.c
	fi

	# if you don't, then lex won't be built
	
	(cd /usr/src/usr.bin ; make && make install && make cleandir)
	(cd /usr/src/usr.sbin ; make && make install && make cleandir)
	(cd /usr/src/libexec ; make && make install && make cleandir)
	(cd /usr/src/gnu ; make && make install && make cleandir)
	(cd /usr/src/share ; make && make install && make cleandir)
	
	mkdir /usr/share/doc/usd/30.rogue /usr/share/doc/usd/31.trek
	# otherwise "make install" in /usr/src/games will fail
	# actually, last time I tried this, the dirs were already there - agc
	
	(cd /usr/src/games ; make && make install && make cleandir)
	

3.2.13	Is there a Makefile that does all that happy world-building
	stuff?

	# makefile for building -current, based on build sequence from
	# Alistair G. Crooks (agc@uts.amdahl.com)
	# <sjg@zen.void.oz.au>

	# use this one to see what would be done.
	#MAKE=echo make
	MAKE=make

	all:	.all.done

	# dirs to be done _before_ we can boot a new kernel
	INIT_DIRS=usr.sbin/config.new gnu/usr.bin/gas

	.init.done:
		@set -x; for t in $(INIT_DIRS); do \
			f=`basename $$t`; test -f .$$f.done || {\
			(cd $$t; $(MAKE) && $(MAKE) install) && \
			touch .$$f.done || exit 1; }; \
		done
		touch $@


	.kernel.done:	.init.done
		@echo "You should"; echo "cd sys/arch/${MACHINE}/conf"
		@CONF=`uname -n | cut -d. -f1 | tr 'a-z' 'A-Z'`; \
	 	echo cp GENERIC $$CONF; echo vi $$CONF; echo config.new $$CONF;\
	 	echo cd ../compile/$$CONF; echo "make depend && make"
		@echo install the new kernel and reboot, then come here and 
		@echo touch $@

	# dirs to be done _after_ booting a new kernel
	PREP_DIRS=share/mk gnu/usr.bin/gcc2 include gnu/usr.bin/ld lib

	.prep.done:	.kernel.done
		@set -x; for t in $(PREP_DIRS); do \
			f=`basename $$t`; test -f .$$f.done || {\
			(cd $$t; $(MAKE) && $(MAKE) install) && \
			touch .$$f.done || exit 1; }; \
		done
		touch $@

	# dirs that should be re-built now that we have new libs
	CLEAN_DIRS=$(INIT_DIRS) gnu/usr.bin/gcc2 gnu/usr.bin/ld

	.cleandirs.done:	.prep.done
		@set -x; for t in $(CLEAN_DIRS); do \
			(cd $$t; $(MAKE) cleandir); \
		done
		touch $@

	# the rest...
	ALL_DIRS=bin sbin usr.bin usr.sbin libexec gnu share games

	.all.done:	.cleandirs.done
		@set -x; for t in $(ALL_DIRS); do \
			f=`basename $$t`; test -f .$$f.done || {\
			(cd $$t; $(MAKE) && $(MAKE) install) && \
			touch .$$f.done || exit 1; }; \
		done
		touch $@


3.3	X11/XFree86/XS3
3.3.1	What options should I define to get the X extensions included?

	Once you have applied the patch kit, the only thing left to do is to
	modify the config file to include the following line:

	options	XSERVER, UCONSOLE
 
	recompile the kernel and the kernel should support X.

3.3.2	Where can I get the FAQ for 'X'?

	Steve Kotsopoulos' general 'X on Intel-based Unix' FAQ
	available by anonymous ftp from export.lcs.mit.edu in 
	/contrib/faq/Intel-Unix-X-faq. 


3.3.3	Why does X drop characters when using xdm?   When I run xdm 
	from the console, it keeps losing keystrokes and the shift keys 
	don't always work.  Why?

        You need to run xdm with the -nodaemon flag.  The reason is
        xdm normally detaches from the keyboard.  This allows other
        processes (like getty) to return to reading from the keyboard.
        A race condition results, where some keystrokes are sent to
        xdm and others are sent to other processes.  Using the
        -nodaemon flag causes xdm to stay attached to the keyboard
        so no other process can use it.  This answer comes from Michael 
        C. Newell (root@wanderer.nsi.nasa.gov)

	This bit of trivia is also covered in detail in the X FAQ and 
	the README that accompanies XFree86.


3.3.4	What does the error 'netscape: uname() failed; can't tell what
	system we're running on' from the BSDi version of 'netscape' 
	really mean?

	Netscape is a BSDI1.1 / 4.3BSD-net2 level binary.  BSDI uses a
	slightly different uname than NetBSD or FreeBSD.  There is a
	patch that has been successfully made to FreeBSD which gives
	them the same functionality as the BSDi uname() is generating.

	In case you were wondering, this is where the information is 
	used - this is a dump of the inital HTTP request packet that 
	Netscape sent when fetching http://home.netscape.com/

	GET / HTTP/1.0
	User-Agent: Mozilla/1.1N (X11; I; FreeBSD 2.0-BUILT-1995060 i386)
	Accept: */*
	Accept: image/gif
	Accept: image/x-xbitmap
	Accept: image/jpeg

	Without this patch, it includes this instead:
	User-Agent: Mozilla/1.1N (X11; I; BSD/386 uname failed)

	(If Netscape are logging this, I'd rather them know which were 
	FreeBSD users instead of mistakenly counting them as BSD/386 users.)


3.3.5	Under NetBSD and FreeBSD, xlock (or any other program that uses
	passwords) fails to validate user passwords. Anyone know why? 

	OK, first off, make sure you're using the latest version of 
	xlock. If you've pulled it out of the /ports/ distribution then 
	you've got version 1.14. This is woefully ancient, so get the 
	latest, which at the time of writing is 2.7 (just do an archie 
	search for 'xlockmore-2.7' to find it).

	Get this, compile it up and *make sure it's setuid root*. So, 
	after you've copied it into /usr/X11R6/bin or wherever, do the 
	following:

	    # chown root.wheel ./xlock
	    # chmod 4755 ./xlock

	After that, it should work fine. The problem is that without 
	being setuid root xlock cannot read the real system passwords. 
	If you look in /etc/passwd you'll see that the passwords are 
	all '*'d out, because FreeBSD and NetBSD use shadow passwords.

	That's what worked for me. A couple of other suggestions were 
	raised last time this problem cropped up:

	  o If you're using a pre-compiled xlock then it might have 
	  been linked against the USA encryption libraries. If you're 
	  outside the States then the encryption libraries are different, 
	  and a US xlock will not be able to read the passwords. The fix 
	  is to get the sources and recompile.

	  o If you've compiled it from source, made it setuid root, and 
	  it still doesn't work, someone suggested changing the size of 
	  the constant PASSLENGTH in xlock.c from '20' to '40'. I haven't 
	  had to do this, and in v2.7 it's '64' anyway, so it shouldn't 
	  be a problem.


3.4	Compiler and Library routines

	There are several questions that could probably be included
	here.  See also Section 4 for some of the more common 'missing
	modules' that also happen to be library routines.


3.4.1	Where is libcompat.a?

	The library libcompat.a is (working from memory here) completely
	deprecated in 386bsd and all of its descendents.  The only 
	exceptions might be the re_comp and re_exec routines, which 
	are discussed in detail in section 4.  In addition, things 
	will be added to libcompat.a as they are deprecated in the 
	newer versions of NetBSD and FreeBSD.  The getreuid() and 
	setreuid() stuff may be heading that way (if they aren't 
	there already.

	The easiest way around not having a libcompat.a is to simply link 
	it to a small library, since virtually every other function that
	is expected in libcompat.a is already include libc.a.


3.5	I want to run 'XYZA'  which is  dynamically linked and from 'some 
	other operating system'.  What special things do I have to do to 
	get it working?


	Assuming you are trying to simulate a SVR4 system, you want to 
	create the '/emul/svr4' directory.  You will also want to ensure
	the "COMPAT_SVR4" option is in your kernel config file.

	With this accomplished, you will need to copy several files into
	the emulation directoy.  A live example might be best at this
	point.  Most of this information is include in the
	'compat_linux(8)' manpage.

	First, set up the '/emul/linux' directory.  Within this
	directory (and virtually all of the emulation directories) you
	will need the following:

		etc/	(the emulated /etc directory)
		lib/	(the emulated /lib directory)
		usr/	(the emulated /usr directory)

	From there, the simplest way to populate these directories is to
	use a program like 'cpio' or 'tar' to build an archive.  Having
	a linux machine available will greatly simplify this.  Copy
	(basically everything from the Linux (or whatever) /etc and /lib
	directories.

	Any executables that you need from the Linux system should then
	be copied into an appropriate place in the usr/ directory.  For
	example, when creating the Linux Doom system on NetBSD, you need
	to have the following files (which should all come from the
	Linux Doom distribution).

	usr/X11R6/lib
		libX11.so.6.0

	usr/bin:
		as86
		ld86

	usr/games/doom
		README.linuxx
		doom1.wad
		linuxxdoom
		sndserver.old

	With Doom specifically, you may need to set 'DOOMWAD' (or
	whatever it is) to usr/games/doom for it to work correctly.  

	In addition to the 'X' version, the native version should also
	work (with recent versions of NetBSD (1.1+)


3.6	You promised to talk about timezones below.  Are you going to?

	>I've seen lots of stuff about timezone's being a bit dodgy,
	>especially with most European timezones changing over to DST on 
	>the 27th March.  I must say that that was NOT the case for me - 
	>pumpy (the author's system) is running off the 
	>/usr/share/zoneinfo/GB-Eire timezone file, (symbolically) linked 
	>to /etc/localtime, the CMOS clock is running off GMT, and the 
	>kernel is compiled with "timezone 0".

	I use /usr/share/zoneinfo/MET as /etc/localtime and have the 
	kernel configured as

		timezone        -1 dst 4

	(My wife is running DOS on this machine for doom sometimes ;-)

	I set this strange dst value after diging in some old ultrix(?) 
	man pages.  There were several dst-changing-method listed and 4 
	was the code for the central europe one.

	This gave me an idea... I use an Ultrix box every day, so why not...

	Now, I don't know how closely this applies to NetBSD since 
	Ultrix is based on a much older version of BSD, and this isn't 
	for the kernel config, but for an envar of timezone values, but 
	it's at least somewhat enlightening on possible meanings for 
	these things.  Could someone in the know shed light on how 
	accurately this models the timezone stuff in the kernel config?  
	When I did "man timezone" this is what I got (portion of this 
	quoted from the DEC MIPS Ultrix 4.3a timezone(3) manpage, 
	slightly hacked by me (Michael L. VanLoon (michaelv@iastate.edu))


		 STD offset [DST [offset][,start[/time],end[/time]]]

	     the components of the string have the following meaning:

	STD and DST	Three or more characters that are the 
			designation for the standard (STD) or 
			summer (DST) time zone. Only STD is required; 
			if DST is missing, then summer time does not apply 
			in this locale. Upper- and lowercase letters are 
			explicitly allowed.  Any characters except a 
			leading colon (:), digits, comma (,), minus (-), 
			plus (+), and ASCII NUL are allowed.

     	offset		Indicates the value to be added to the local 
			time to arrive at Coordinated Universal Time. The 
			offset has the form:

			hh[:mm[:ss]]

			The minutes (mm) and seconds (ss) are optional. 
			The hour (hh) is required and may be a single 
			digit.	The offset following STD is required. If 
			no offset follows DST, summer time is assumed to 
			be one hour ahead of standard time.  One or more 
			digits may be used; the value is always
			interpreted as a decimal number.  The hour must 
			be between 0 and 24, and the minutes (and
			seconds) - if present - between zero and 59. If 
			preceded by a "-", the time zone is east of the 
			Prime Meridian; otherwise it is west (which may
			be indicated by an optional preceding "+").

     start and end	Indicates when to change to and back from summer
     			time. Start describes the date when the change
			from standard to summer time occurs and end 
			describes the date when the change back
			happens.  The format of start and end must be
			one of the following:

			Jn	The Julian day n (1 < n < 365). Leap
				days are not counted.  That is, in all
				years, including leap years, February
				28 is day 59 and March 1 is day 60.  It
				is impossible to explicitly refer to
				the occasional February 29.

			n	The zero-based Julian day (0 < n <
				365).  Leap days are counted, and it is	
				possible to refer to February 29.

			Mm.n.d	The nth d day of month m (1 < n < 5, 
				0 < d < 6, 1 < m < 12).  When n is 5 it 
				refers to the last d day of month m.
				Day 0 is Sunday.

     			time	The time field describes the time when,
				in current time, the change to or from
				summer time occurs. Time has the same
				format as offset except that no leading
				sign (a minus (-) or a plus (+) sign)
				is allowed. The default, if time is not
				given, is 02:00:00.

	As an example of the previous format, if the TZ environment
	variable had the value EST5EDT4,M4.1.0,M10.5.0 it would	describe 
	the rule, which went into effect in 1987, for the Eastern time
	zone in the USA.  Specifically, EST would be the designation for
	standard time, which is 5 hours behind GMT.  EDT would be the 
	designation for DST, which is 4 hours behind GMT.  DST starts
	on the first Sunday in April and ends on the last Sunday in
	October.  In both cases, since the time was not specified, the
	change to and from DST would occur at the default time of 2:00 AM.

	The timezone call remains for compatibility reasons only; it is 
	impossible to reliably map timezone's arguments (zone, a
	`minutes west of GMT' value and DST, a `daylight saving time in
	effect' flag) to a time zone abbreviation.


3.6.1	How do you change the timezone on NetBSD (FreeBSD also?)?

	Relink /etc/localtime.  This will correct the difference from
	GMT (or its trendy equivelant) to your local timezone.  In
	addition, the kernel needs to be modified to take the clock
	time in your CMOS into account.  Since most folks that run DOS
	prefer to have their clocks set to local time, the timezone
	hack was introduced to allow the kernel to adjust the CMOS
	clock time to GMT.  Once GMT has been computed, the
	/etc/localtime file can be referenced to determine the
	corrected local time.

	All generic kernels are built using the offset from California
	(why is anyone's guess:-) so just about everyone's clock will
	be off by their timezone offset from Berkeley.

	Also, it may pay to actually copy the correct timezone file
	rather than link it.  That way, you clock will be correct even
	in single users mode (when the /usr partition is not even
	mounted.  The disadvantage of this is that anytime the timezone
	file gets updated, you will need to make certain that the file
	is copied into the /etc directory.


3.6.2	The translation between seconds-since-the-epoch and date
	differs by about 18 seconds between BSD and other Unixes when
	running ntp; why?

	See ntp FAQ. Apparently, the time correction takes leap seconds
	into account twice.  The timezone files in our system take the 
	leap seconds into account in the kernel, and nntp takes the
	same 18 leap seconds into account when syncing the time.
	Because of that, the time will appear to be off by eighteen
	seconds.  (Henning Schulzrinne)


3.7	How can I implement CVS to track MY changes to the kernel source
	tree, yet still follow the -current development tree?

	I'll append the scripts I use, but be warned, they may bite you if 
	you are careless...

	The main reason I use cvs import is to handle updates from the 
	``vendor''.  The best way I've found is to import _exactly_ what 
	was shipped.  This means unconfigured, and I put config.h, etc, 
	in .cvsignore.  If I have to modify configure.in then obviously 
	I commit them :-)

#!/bin/sh
# This is a shell archive.
# remove everything above the "#!/bin/sh" line
# and feed to /bin/sh
# Use -c option to overwrite existing files
#
# Contents: 
#	README.import
#	import.sh
#	prune.sh
#
# packed by: <sjg@zen.void.oz.au> on Sat Jun 17 20:00:34 EST 1995
#
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README.import -a x$1 != x-c ; then
  echo shar: Will not over-write existing file \"README.import\"
else
  echo shar: Extracting \"README.import\" \(2902 characters\)
  sed 's/^X//' >README.import << '!EOF'
XThe following may be of use to others wanting to use CVS to merge
XNetBSD sources with local changes but are not confident that they have
Xinterpreted the documentation accurately.
X
XMuch thanks to Chris Demetriou (cgd) for taking the time to spell out
Xthe steps he used when merging NetBSD sources without which I might
Xnot have taken the plunge myself :-) The following is based on Chris'
Xtips, though of course any errors are mine.
X
XOk.  My NetBSD sources are kept in usr.src, if NetBSD is all
Xyou use CVS for you might want to simply call it src.
X
XI unpack tar files and/or sup into a directory /d2/current.
X
XTo import the entire tree I:
X
Xcd /d2/current/src
X
Xcvs import "-I! " -m "from netbsd-current as of 950508" usr.src NetBSD \
XNetBSD-950508 > /tmp/cvs.out 2>&1
X
XWhere:
Xusr.src		is the repository where the imported data goes (so set it
X		according to your own needs), 
XNetBSD		is a vendor tag.
XNetBSD-950508	is a release tag (there can be multiple release tags given).
X
XI use "-I! " as otherise some files that you need (like
Xbin/csh/USD.doc/csh.a) will be ignored..  The space after the ! is
Xneeded.
X
XIt takes quite a while.  It is a good idea to save the output to a file.
X
XAt the end you may well get a message like:
X
X	cvs checkout -jNetBSD:yesterday -jNetBSD usr.src
X
XThis means there were some conflicts between your local sources and
Xthe import.  So I do what it says - but not in my working tree.
X
Xcd /d2/tmp
Xcvs checkout -jNetBSD:yesterday -jNetBSD usr.src > /tmp/merge.out 2>&1
X
XYou can then go find all the files with conflicts.
XEither grep '^C' /tmp/merge.out or find usr.src -name '.#*' -print
XGo edit them to resolce the conflicts.  This is usually obvious.
X
XWhen happy. 
X
Xcd /d2/tmp/usr.src
Xcvs commit -m"merged local changes with NetBSD-950508"
Xcd ..
Xrm -rf usr.src
X
XOk. Now if you are brave you can:
X
Xcd /usr.src (or whereever your working sources are)
Xcvs update
X
XFinally, you should occasionally make sure you remove old files.
X
XI use a script to do this.  It does a diff between files on the NetBSD
Xbranch looking for the latest release tag (eg. NetBSD-950508). 
XIf cvs diff remports that a file does not have that tag, it is because
Xit was not present in the import (ie removed). 
X
XThe command sequence is:
X
Xcvs diff -s -r NetBSD -r NetBSD-950508 > /tmp/prune.out 2>&1
X
X# check that all went well...
Xcat /tmp/prune.out | awk '/Diffing/ { dir=$NF } 
X/NetBSD-/ { file=$NF; print dir "/" file }'  > /tmp/pruned
X
Xcat /tmp/pruned | xargs cvs tag -d NetBSD
Xcat /tmp/pruned | xargs rm -f
Xcat /tmp/pruned | xargs cvs delete
X
XNote that this is a slow process on a 486DX33!  So don't plan on
Xmerging everything very often.  Folk who mainly hack the kernel can do
Xsrc/sys more frequently.  The sequence is analogous eg.
X
Xcd /d2/current/src/sys
X
Xcvs import "-I! " -m "from netbsd-current as of 950508" usr.src/sys NetBSD \
XNetBSD-950508 > /tmp/cvs.out 2>&1
X
Xetc.
X
XHope this helps.
X
X--sjg
!EOF
  if test 2902 -ne `wc -c < README.import`; then
    echo shar: \"README.import\" unpacked with wrong size!
  fi
  
fi
if test -f import.sh -a x$1 != x-c ; then
  echo shar: Will not over-write existing file \"import.sh\"
else
  echo shar: Extracting \"import.sh\" \(290 characters\)
  sed 's/^X//' >import.sh << '!EOF'
X:
Xtoday=`date '+%y%m%d'`
X
Xrep=${1:-usr.src}
X
X# -I! doesn't work, it needs a space after the !
Xcvs import "-I! " -m "from netbsd-current as of $today" $rep NetBSD NetBSD-$today
X
X# cd somewhere
X# cvs checkout -jNetBSD:yesterday -jNetBSD usr.src > /tmp/cvs.out 2>&1
X# merge changes and commit
!EOF
  if test 290 -ne `wc -c < import.sh`; then
    echo shar: \"import.sh\" unpacked with wrong size!
  fi
  chmod +x import.sh
fi
if test -f prune.sh -a x$1 != x-c ; then
  echo shar: Will not over-write existing file \"prune.sh\"
else
  echo shar: Extracting \"prune.sh\" \(491 characters\)
  sed 's/^X//' >prune.sh << '!EOF'
X:
Xthen=${1:-`date '+%y%m%d'`}
XTF=/tmp/prune.$$
XTF2=/tmp/prune2.$$
X#S=-s
XS=
X
Xcase `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac
X
Xask () { echo $N "${2:-$1?} "$C; read $1; }
X  
Xcvs diff $S -r NetBSD -r NetBSD-$then > $TF 2>&1 || cat $TF >&2
X
Xcat $TF | awk '/Diffing/ { dir=$NF } /NetBSD-/ { file=$NF; print dir "/" file }' > $TF2
X
Xcat $TF2
Xask proceed
Xcase "$proceed" in
X[yY]*)
Xcat $TF2 | xargs cvs tag -d NetBSD
Xcat $TF2 | xargs rm -f
Xcat $TF2 | xargs cvs delete
X;;
Xesac
Xrm -f $TF $TF2
!EOF
  if test 491 -ne `wc -c < prune.sh`; then
    echo shar: \"prune.sh\" unpacked with wrong size!
  fi
  chmod +x prune.sh
fi
exit 0



3.8	Optional Op-codes for NetBSD, FreeBSD, and other systems.

	MNEMONIC	INSTRUCTION
	----------------------------------
	AAC		Alter All Commands
	AAR		Alter At Random
	AB		Add Backwards
	AFVC		Add Finagle's Variable Constant
	AIB		Attack Innocent Bystander
	AWTT		Assemble With Tinker Toys
	BAC		Branch to Alpha Centauri
	BAF		Blow All Fuses
	BAFL		Branch And Flush
	BBIL		Branch on Blown Indicator Light
	BBT		Branch on Binary Tree
	BBW		Branch Both Ways
	BCF		Branch and Catch Fire
	BCIL		Branch Creating Infinite Loop
	BDC		Break Down and Cry
	BDT		Burn Data Tree
	BEW		Branch Either Way
	BF		Belch Fire
	BH		Branch and Hang
	BOB		Branch On Bug
	BOD		Beat On the Disk
	BOI		Bite Operator Immediately
	BPDI		Be Polite, Don't Interrupt
	BPO		Branch on Power Off
	BRSS		Branch on Sunspot
	BST		Backspace and Stretch Tape
	BW		Branch on Whim
	CDC		Close Disk Cover
	CDIOOAZ		Calm Down, It's Only Ones and Zeros
	CEMU		Close Eyes and Monkey with User space
	CH		Create Havoc
	CLBR		Clobber Register
	CM		Circulate Memory
	CML		Compute Meaning of Life
	COLB		Crash for Operators Lunch Break
	CPPR		Crumple Printer Paper and Rip
	CRASH		Continue Running After Stop or Halt
	CRB		Crash and Burn
	CRN		Convert to Roman Numerals
	CS		Crash System
	CSL		Curse and Swear Loudly
	CU		Convert to Unary
	CVG		Convert to Garbage
	CWOM		Complement Write-Only Memory
	CZZC		Convert Zone to Zip Code
	DBZ		Divide By Zero
	DC		Divide and Conquer
	DMNS		Do what I Mean, Not what I Say
	DMPK		Destroy Memory Protect Key
	DPMI		Declare Programmer Mentally Incompetent
	DPR		Destroy Program
	DTC		Destroy This Command
	DTE		Decrement Telephone Extension
	DTVFL		Destroy Third Variable From Left
	DW		Destroy World
	ECO		Electrocute Computer Operator
	EFD		Emulate Frisbee Using Disk Pack
	EIAO		Execute In Any Order
	EIOC		Execute Invalid Opcode
	ENF		Emit Noxious Fumes
	EO		Execute Operator
	EROS		Erase Read-Only Storage
	FLI		Flash Lights Impressively
	FSM		Fold, Spindle and Mutilate
	GCAR		Get Correct Answer Regardless
	GDP		Grin Defiantly at Programmer
	GFM		Go Forth and Multiply
	IAE		Ignore All Exceptions
	IBP		Insert Bug and Proceed
	ISC		Insert Sarcastic Comments
	JTZ		Jump to Twilight Zone
	LCC		Load and Clear Core
	MAZ		Multiply Answer by Zero
	MLR		Move and Lose Record
	MWAG		Make Wild-Assed Guess
	MWT		Malfunction Without Telling
	OML		Obey Murphy's Laws
	PD		Play Dead
	PDSK		Punch Disk
	PEHC		Punch Extra Holes on Cards
	POCL		Punch Out Console Lights
	POPI		Punch Operator Immediately
	RA		Randomize Answer
	RASC		Read And Shred Card
	RCB		Read Command Backwards
	RD		Reverse Directions
	RDA		Refuse to Disclose Answer
	RDB		Run Disk Backwards
	RIRG		Read Inter-Record Gap
	RLI		Rotate Left Indefinitely
	ROC		Randomize Opcodes
	RPB		Read, Print and Blush
	RPM		Read Programmer's Mind
	RSD		On Read Error Self-Destruct
	RWCR		Rewind Card Reader
	SAI		Skip All Instructions
	SAS		Sit and Spin
	SCCA		Short Circuit on Correct Answer
	SFH		Set Flags to Half mast
	SLMTU=x		SLIP MTU size
	SLP		Sharpen Light Pen
	SPS		Set Panel Switches
	SPSW		Scramble Program Status Word
	SQPC		Sit Quietly and Play with your Crayons
	SRDR		Shift Right Double Ridiculous
	STA		Store Anywhere
	TARC		Take Arithmetic Review Course
	TPF		Turn Power Off
	TPN		Turn Power On
	UCB		Uncouple CPU and Branch
	ULDA		Unload Accumulator
	UP		Understand Program
	WBT		Water Binary Tree
	WHFO		Wait Until Hell Freezes Over
	WI		Write Illegibly
	WSWW		Work in Strange and Wondrous Ways
	XSP		Execute Systems Programmer
	ZAR		Zero Any Register

	If you have gotten this far, you deserved some humor.

-- 
Dave Burgess  (The man of a thousand E-Mail addresses)
*bsd FAQ Maintainer / SysAdmin for the NetBSD system in my spare bedroom
"Just because something is stupid doesn't mean there isn't someone that 
doesn't want to do it...."