home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / faqs / comp / answers / 386bsd-faq / part4 < prev    next >
Encoding:
Internet Message Format  |  1997-10-14  |  58.2 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news-out.internetmci.com!newsfeed.internetmci.com!206.229.87.25!news-peer.sprintlink.net!news-sea-19.sprintlink.net!news-in-west.sprintlink.net!news.sprintlink.net!Sprint!204.248.21.3!neonramp.com!cynjut.neonramp.com!cynjut.neonramp.com!not-for-mail
  2. From: burgess@cynjut.neonramp.com (Dave Burgess)
  3. Newsgroups: comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd.announce,comp.answers,news.answers,comp.unix.openbsd.announce
  4. Subject: [comp.unix.bsd] NetBSD, FreeBSD, and OpenBSD FAQ (Part 4 of 10)
  5. Supersedes: <386bsd-faq-4-875343603@cynjut.neonramp.com>
  6. Followup-To: comp.unix.bsd.netbsd.misc
  7. Date: 13 Oct 1997 02:00:14 -0500
  8. Organization: Dave's House in Omaha
  9. Lines: 1513
  10. Approved: news-answers-request@MIT.Edu,cgd@sun-lamp.cs.berkeley.edu
  11. Expires: 10/31/97 01:00:03 CDT
  12. Message-ID: <386bsd-faq-4-876726003@cynjut.neonramp.com>
  13. References: <386bsd-faq-1-876726003@cynjut.neonramp.com>
  14. Reply-To: burgess@cynjut.neonramp.com (BSD FAQ Maintainer)
  15. NNTP-Posting-Host: cynjut.neonramp.com
  16. Keywords: FAQ 386bsd NetBSD FreeBSD !Linux
  17. X-Posting-Frequency: Posted on/about the 13th and the 27th of every month.
  18. Xref: senator-bedfellow.mit.edu comp.unix.bsd.netbsd.announce:559 comp.unix.bsd.freebsd.announce:730 comp.answers:28473 news.answers:114365
  19.  
  20. Posted-By: auto-faq 3.1.1.2
  21. Archive-name: 386bsd-faq/part4
  22.  
  23. Section 3.    (Kernel Building and Maintenance)
  24.  
  25. 3.0    System Internals
  26.     
  27.     One of the interesting aspects of *BSD is the fact that it comes 
  28.     with the complete source.  This allows you to make changes to the 
  29.     system, recompile, and test out your new ideas.  This section of 
  30.     the FAQ describes many of the different aspects of this endeavor 
  31.     and common problems and pitfalls that are encountered.  Kevin Lahey 
  32.     provided the substantial portion of this section.  You can contact 
  33.     him via E-Mail at (kml@rokkaku.atl.ga.us) or contact Dave Burgess 
  34.     (burgess@cynjut.neonramp.com).
  35.  
  36. 3.1    Kernel
  37.  
  38. 3.1.1    How do I build a kernel?
  39.  
  40.     The kernel can be compiled in a variety of ways to support different 
  41.     devices and configurations.  Compilation is controlled by a config 
  42.     file that specifies the characteristics of the kernel.  A set of 
  43.     different config files is located in /sys/i386/conf or 
  44.     /sys/arch/i386/conf.  The configuration file names are in upper case.
  45.  
  46.     To build a particular kernel (in this example, we use the GENERICISA
  47.     configuration file in NetBSD or FreeBSD):
  48.  
  49.     % cd /sys/i386/conf
  50.     % config GENERICISA
  51.     % cd /sys/compile/GENERICISA
  52.     % make depend
  53.     % make
  54.  
  55.     In NetBSD, since there are multiple architectures supported, there
  56.     is an architecture line in the middle of the path to these files.
  57.     See the build.kernel script in section 3.8 for more information.
  58.  
  59.     Remember, when structures in the kernel change, there are some
  60.     programs (ps, top, etc.) that will cease to work correctly.  You
  61.     will need to recompile these programs as well as the new kernel.
  62.     You need to do the following to make sure that your programs get
  63.     updated as well as the kernel:
  64.  
  65.     cd /usr/src/include
  66.     make install
  67.     cd /usr/src/lib/libkvm
  68.     make clean && make && make install
  69.     cd /usr/src/bin/ps
  70.     make clean && make && make install
  71.     cd /usr/src/...
  72.     
  73.  
  74. 3.1.1.1 Why does the kernel code for NetBSD still use the old K&R style
  75.     declarations when the ANSI declarations are SO much better?
  76. 3.1.1.2    How do I port NetBSD to another platform?
  77.  
  78.     We still use the old style K&R definitions easier, because 
  79.     bringing up a new port on a foreign machine with a brain-damaged 
  80.     compiler can be impossible, or at least very difficult,
  81.     if you don't do it this way.  Remember, NetBSD is multi-platform, 
  82.     and tries to make it as easy as possible to port.  Which means 
  83.     building pieces of the system with someone else's compiler.
  84.  
  85.  
  86. 3.1.2    I want to do one of the following things:
  87.     * add a device not in the distributed kernel (third com
  88.       port, additional disk or tape, line printer driver, etc).
  89.     * use a patch from the net or the patchkit to fix a kernel bug.
  90.     * add another swap device.
  91.     * recompile the kernel to remove extraneous devices so that
  92.       it takes up less space.
  93.     * configure more pseudo-terminals to allow for more xterms
  94.       or network logins.
  95.     
  96.     You're going to have to recompile the kernel after you modify the 
  97.     config file.  See section 3.2 below for more information about the 
  98.     config file in general.
  99.     
  100.  
  101. 3.1.3    I want to build and profile a kernel.  What do I need to do?
  102.  
  103.     Step 1 is to build a profiled kernel:
  104.  
  105.         cd /sys/arch/<X>/conf
  106.         config -p CONFIG.FILE.OF.YOUR.CHOICE
  107.         cd /sys/arch/<X>/compile/CONFIG.FILE.OF.YOUR.CHOICE
  108.         make depend
  109.         make
  110.         <install the kernel and reboot>
  111.  
  112.     Step 2 is to start the profiling process:
  113.  
  114.         log in
  115.         su to root
  116.         kgmon -r -h
  117.         kgmon -b
  118.  
  119.     Step 3 is to run the application in question
  120.  
  121.     Step 4 is to stop the profile:
  122.  
  123.         kgmon -h
  124.         kgmon -p  (this produces the gmon.out file, which is the
  125.                 profiles kernel information)
  126.  
  127.     Step 5 is to analyze the output:
  128.  
  129.         gprof /{kernel name} gmon.out > profile
  130.  
  131.     which produces a hierarchical call graph as well as flat
  132.     profile.  The flat profile is easiest to use for beginners,
  133.     although both are good information sources for kernel code
  134.     performance.
  135.  
  136.     
  137. 3.1.4    Now that I have a kernel, how do I install it?
  138.  
  139.     Your kernel is called /kernel or /netbsd.  Copy the new kernel
  140.     from /sys/compile/GENERICISA/(whatever) to /, assuming that it 
  141.     is in that directory.  If you really screw up the new kernel, 
  142.     you want to have something to fall back on, so be sure to 
  143.     save /kernel to /kernel.old before copying in a new kernel.  
  144.  
  145.  
  146. 3.1.5    My system is complaining about stray interrupt 7.  Is my machine 
  147.     going to explode or anything?
  148.  
  149.     No.  They are caused by lots of things.  They are, as far as
  150.     anyone that should be expected to know about this stuff, harmless.
  151.     There are ramifications on them being there, but for MOST users
  152.     they do not pose a real threat to your operations.  For those of
  153.     you that are doing REALLY interrupt intensive stuff, you may want
  154.     to grab a technical reference and figure out why the 8259 is not
  155.     getting reset correctly.
  156.  
  157.     In spite of the number of times this has come up (and people have
  158.     even referenced this section) there are still at least two 
  159.     questions on the net about this.  A memorable one was a guy who
  160.     was just vehement that the stray int 7 was what was keeping his
  161.     system from booting.  In fact, he went so far as to say that this
  162.     document was practically worthless because I didn't tell him how
  163.     to fix it.  Of course, once he configured his hard drive controller 
  164.     so that it was on the right interrupt, his booting problem went 
  165.     away.  I have said it before and I will say it again.  For MOST 
  166.     users they do not pose a real threat to your operations.
  167.     I have heard of three people (out of at least 2000) that have
  168.     actually have problems so bad that they couldn't proceed.  They
  169.     bought new computers, and the problem went away.
  170.  
  171.     These stray interrupts are caused by something in the PC.  
  172.     I have yet to see a convincing explanation of precisely what,
  173.     but they are definitely caused by something.  There are four
  174.     ways to deal with this problem.
  175.  
  176.     1)  Ignore them.  They are spurious and do not effect the
  177.     operation of your computer.
  178.  
  179.     2)  Implement the lpt driver.  This way, the driver traps 
  180.     (the lpt driver expects IRQ 7) and then quietly discards them.  
  181.     That is why when folks implement the lpt driver the 'problem' 
  182.     goes away.  The computer is taught how to ignore them.
  183.  
  184.     3)  Do what the original 386bsd code did.  Comment out the
  185.     diagnostic and associated code that tries to deal with them so
  186.     you don't see the error message.
  187.  
  188.     4)  Buy a new computer that doesn't cause this problem.   It is a
  189.     known hardware problem with the 8259 being reset incorrectly in
  190.     hardware.
  191.  
  192.     Kalevi Suominen (jks@geom.helsinki.fi) offers this technical
  193.     explanation of the 'stray interrupt 7' phenomenon.
  194.  
  195.     In the section of the Intel Peripheral Handbook dealing with
  196.     the 8259A there is a description of the 6-step interrupt
  197.     sequence for an 80x86 system (and 7-step for an MCS-80/85),
  198.     and then the following paragraph:
  199.  
  200.     "If no interrupt request is present at step 4 of either sequence
  201.     (i.e., the request was too short in duration) the 8259A will
  202.     issue an interrupt level 7. Both the vectoring bytes and the CAS
  203.     lines will look like an interrupt level 7 was requested."
  204.  
  205.     This explains how some transient disturbances or improperly
  206.     functioning adapter cards could trigger a stray interrupt 7
  207.     in a system operating in the *level* interrupt mode (such as
  208.     a PS/2 with MCA): An interrupt request will disappear as soon
  209.     as the interrupt line goes inactive.
  210.  
  211.     That such interrupts may also occur in a system operating in
  212.     the *edge* triggered mode (such as an ordinary PC/AT with ISA)
  213.     is a little harder to see. Yet it is possible - even without
  214.     malfunctioning hardware - because masking an interrupt request
  215.     will hide its presence from the 8259A as well:
  216.  
  217.  
  218.         1. The interrupt flag (IF) of the 80x86 is reset either 
  219.         directly (e.g., by a "cli" instruction) or because an 
  220.         interrupt handler is entered. In the latter case the 
  221.         corresponding in-service (IS) bit of the 8259A is set 
  222.         (effectively blocking interrupts of lower priority).
  223.  
  224.         2. The 8259A receives an unmasked interrupt request (IRQn), 
  225.         and, in case an interrupt is being served and has higher 
  226.         priority than IRQn, the IS bit of the 8259A is reset by 
  227.         an end of interrupt (EOI) command. (These steps may occur 
  228.         in either order.) If IRQn has higher priority (e.g. IRQ0), 
  229.         no EOI is necessary.
  230.  
  231.         3. The 8259A activates the interrupt (INT) line to the 80x86
  232.            (which will ignore it - for the moment).
  233.  
  234.         4. The interrupt mask (IM) bit of the 8259A for IRQn is set.
  235.         (A little late, though. The sequence has already started.)
  236.  
  237.         5. The interrupt flag (IF) of the 80x86 is set (either 
  238.         directly, or as a consequence of e.g. an "iret" instruction).
  239.  
  240.         6. The 80x86 will now acknowledge the INT request by activating
  241.            the INTA line of the 8259A.
  242.  
  243.         7. The 8259A will not see the masked IRQn and will continue
  244.            by issuing a spurious interrupt of level 7 instead.
  245.  
  246.  
  247.     The original interrupt request (IRQn) will not be lost, however.
  248.     It is preserved by the associated edge sense latch of the 8259A,
  249.     and will be acted on after the IM bit has been reset again.
  250.  
  251.     The net result is that a single interrupt request will be
  252.     delivered *twice* to the 80x86: first as a stray interrupt 7
  253.     and later as the proper interrupt. In particular, it is perfectly
  254.     safe to ignore the stray interrupt (other than sending an EOI).
  255.     It is just the ghost of an aborted interrupt sequence: the system
  256.     was not prepared for it yet.
  257.  
  258.     Bill Roman provides this update, which is so technical I can't
  259.     even figure out what to cut out or how to repackage it so it
  260.     makes sense to people like me.  As an interesting aside, he is
  261.     also a Linux user; thereby proving that I'll accept help the FAQ
  262.     from everyone:
  263.  
  264.     First of all, Kalevi Suominen's explanation is correct, but 
  265.     requires just a little more explanation.  Step 4 in the data 
  266.     book concerns the 8259's detection of INTA (interrupt 
  267.     acknowledge) asserted by the processor.  This means that the 
  268.     processor has detected INT (interrupt request) asserted by the 
  269.     8259, the previous instruction has ended, and the interrupt 
  270.     enable flag is true.  The processor has begun its interrupt 
  271.     processing, and the 8259 *must* supply a vector; there is no way 
  272.     for it to tell the processor "never mind".
  273.  
  274.     INTA causes the 8259 to examine the currently asserted interrupt 
  275.     requests and return the vector corresponding to the highest 
  276.     current request.  If there is no longer any interrupt request 
  277.     asserted, it supplies vector 7 as a default.  (Intel calls this 
  278.     "DEFAULT IR7" later in the data book.)
  279.  
  280.     There is thus a race condition between deassertion of an interrupt 
  281.     request and interrupt servicing by the processor.  An interrupt 
  282.     request which is removed will not always cause DEFAULT IR7 -- 
  283.     only if the request is deasserted after the processor has 
  284.     detected INT and irrevocably decided to act on it, but before 
  285.     the 8259 has detected INTA and prioritized its interrupts.
  286.  
  287.     It is easy to see how this could happen when the 8259 is in 
  288.     level triggered mode, but it is counterintuitive that it should 
  289.     happen in edge triggered mode.  To understand this, it is 
  290.     necessary to look at Intel's "Priority Cell--Simplified Logic 
  291.     Diagram" (figure 9 in a 1991 databook I have at hand).  The edge 
  292.     sense latch output is gated by the request; if the request is 
  293.     latched, then deasserted, the 8259 no longer sees it.  There 
  294.     must be a reason Intel did it this way, but it's sure not 
  295.     evident to me.
  296.  
  297.     The data book provides a little more information in a later 
  298.     section titled "Edge and Level Triggered Modes".  The most 
  299.     important point is that the corresponding bit in the In Service 
  300.     Register is *not* set when the 8259 generates a DEFAULT IR7.  If 
  301.     the IRQ 7 interrupt service routine sees this condition (i.e., 
  302.     is entered and ISR bit 7 is zero) it should simply execute an 
  303.     interrupt return instruction without sending an End of 
  304.     Interrupt (EOI) command to the 8259.  Also, the IRQ 7 interrupt 
  305.     service routine can be reentered due to this condition.  Intel 
  306.     recommends that the interrupt service routine keep track of 
  307.     whether it is currently active so this can be detected.
  308.  
  309.     I don't think that changing the interrupt mask bit can cause the 
  310.     problem, especially if it is changed while the interrupt flag is 
  311.     clear.  As I mentioned, the problem occurs only when the actual 
  312.     interrupt acknowledge process has begun, which can't happen while 
  313.     IF is clear.
  314.  
  315.     What can generate DEFAULT IR7 is a device driver that doesn't mask 
  316.     off its device's interrupt (either in the 8259 or in the device 
  317.     itself) while it is performing operations which can cause the 
  318.     device to deassert its interrupt request.  For example: imagine 
  319.     a hypothetical device with an interrupt status register.  This 
  320.     register latches all the device's status which could cause an 
  321.     interrupt, and clears this status when it is read.  If the 
  322.     processor begins executing the instruction which reads this 
  323.     register just as a status bit is set, the device will assert 
  324.     and deassert the request within the space of that instruction.  
  325.     On an x86 architecture processor I have worked with, this did 
  326.     indeed generate a DEFAULT IR7.  All device drivers should make 
  327.     sure that the device's interrupt request is disabled while the 
  328.     device is being serviced.  A well-behaved device will never 
  329.     deassert its request without explicit software action.
  330.  
  331.     This leaves only the poor folks who have had to buy new computers 
  332.     to get rid of the problem.  My suspicion in this case is that 
  333.     crosstalk on the mainboard is causing glitches on interrupt 
  334.     request lines.  Remember that the f**king wizards at IBM made 
  335.     the request lines active high instead of active low with a 
  336.     pull-up (which would have allowed wire-or interrupt sharing).  
  337.     Some devices (some serial port cards, I believe) use a 
  338.     tri-state driver to drive the request high, but disable the 
  339.     driver entirely when the request is deasserted, counting on a 
  340.     weak pull-down.  This leaves interrupt request lines floating, 
  341.     although the 8259 has the inputs enabled.  This is all 
  342.     conjecture, though.  
  343.  
  344.     Provided by: Bill Roman  (roman@songdog.eskimo.com)
  345.  
  346.  
  347. 3.1.6    I keep getting "wd0c: extra interrupt".  What does it mean?
  348.  
  349.     It means that the drive was already processing a command 
  350.     (active) when it received an interrupt from the system telling 
  351.     it to see if it had anything to do.  This is mostly harmless 
  352.     but could indicate that the drive/controller is having problems 
  353.     if the message appears often.
  354.  
  355.     
  356. 3.1.7    I keep getting silo overflow messages, but the system doesn't
  357.     seem to mind.  Is there a problem?
  358.  
  359.     Not exactly.  This simply means that the First in first out
  360.     buffer is getting too full.  I markedly reduced the incidence 
  361.     of silo overflows on my system by editing dev/isa/com.c to 
  362.     change the FIFO threshold from 8 to 4 characters.  This way, the
  363.     buffer gets more attention and reduces the chance of overflowing
  364.     the buffer.
  365.  
  366.     Another possibility is caused when you are using internet over 
  367.     a telephone line via SLIP or PPP.  You might have an unbuffered
  368.     UART on your serial port, like the 8250 or the 16450. With the
  369.     introduction of the IBM PS/2 systems the first 16550 UART's were
  370.     shipped to provide a 16 byte buffer. But unfortunately the buffering
  371.     of the original 16550 did not work. The problem was solved with
  372.     the improved 16550A UART. If you run MSD (under MSDOS!), an
  373.     application that comes with MS-Windows, you can determine the UART
  374.     type of your serial ports (by choosing COMS). The UART type is also
  375.     showed when your UNIX boots up.
  376.     
  377.     To solve the `silo overflow' problem you can by a Multi/IO card 
  378.     with a `real' 16550A, or a card with an extra serial port, like 
  379.     the HAYES ESP card. The Hayes card has a DOSSETUP utility to 
  380.     configure its port address and IRQ. The port address can be 
  381.     chosen between 180H and 380H, the IRQ address 3, 4, 5 or 9. 
  382.     Normally COM1 (tty00) and COM2 (tty01) claim IRQ 3 and 4. So
  383.     you can choose (for example) IRQ 9 for the Hayes ESP card.  
  384.     Then you have to add the appropriate lines in your kernel 
  385.     configuration:
  386.  
  387.            options COM_HAYESP
  388.    
  389.            device        com0    at isa? port "IO_COM1" irq 4
  390.            device        com1    at isa? port "IO_COM2" irq 3
  391.            # com2: Hayes ESP serial port
  392.            device        com2    at isa? port "IO_COM3" irq 9
  393.    
  394.     For more information on com ports in general, try this URL:
  395.  
  396.         http://comminfo.com/pages/ctsfaq01.htm#q6.
  397.  
  398.  
  399. 3.1.8    I found a bug in the kernel.  How do I report it?
  400.  
  401.     Both NetBSD and FreeBSD include a facility called 'bugfiler'.  
  402.     While the instructions are included in both system, there is 
  403.     still some apparent confusion about when to use (and when to
  404.     NOT use) bugfiler.
  405.  
  406.     Jordan K. Hubbard (jkh@whisker.lotus.ie)  provides us with this
  407.     short article for FreeBSD.
  408.  
  409.     To send bug reports, you want to use the sendbug(1) command.
  410.     The entire package for sending and filing these bugs is known 
  411.     as "the bugfiler", which is where the confusion stepped in, 
  412.     but sendbug is definitely the command you want to use.
  413.  
  414.     Second, it doesn't take a "net connection" to use sendbug, 
  415.     since all it does is package up your "bug report form" and mail 
  416.     it to us; no direct Internet connectivity is required, just mail.
  417.  
  418.     So if you can send Internet mail you can use sendbug, or you can 
  419.     also send mail to the `FreeBSD-bugs@freefall.cdrom.com' address 
  420.     (do NOT send it to FreeBSD.cdrom.com since it will BOUNCE, this 
  421.     is not the place to send bugs to, just to ftp stuff from!).
  422.  
  423.     NetBSD has a similar facility, but has a different program and
  424.     host for bug reports.  The program for NetBSD is called send-pr
  425.     and is slightly different in several respects.  It is part of
  426.     the GNATS system, which the NetBSD core developers started using
  427.     in February of 1994.  It is recommended that NetBSD users see the 
  428.     man page on send-pr before filing bug reports.
  429.  
  430.     For getting information from GNATS, see the file doc/BUGS.
  431.  
  432.     There is a email interface to the NetBSD PR database.  To query 
  433.     the database send mail to "query-pr@gnats.netbsd.org".  The mail 
  434.     server will send a bug database listing back to the user.
  435.  
  436.     There are several flags that are useful to send to the mail server.
  437.     The flags are entered in the "Subject" line:
  438.       --summary    Display an one-line entry for each bug
  439.       --full     Display the full entry for each bug    
  440.       --help    Display a help string containing the rest of the flags.
  441.       PR        The Problem Report number of a particular bug
  442.  
  443.     For example, to send a query about all the bugs:
  444.       $ Mail -s "--summary" query-pr@gnats.netbsd.org < /dev/null
  445.  
  446.     If you want to know more about a particular bug, let's say bug 40:
  447.       $ Mail -s "--full 40" query-pr@gnats.netbsd.org < /dev/null
  448.  
  449.  
  450.     John Conklin is trying to get a page set up at the NetBSD WWW site
  451.     (www.netbsd.org) that will allow people to interactively query the 
  452.     bug database.  It should be operational soon.
  453.  
  454.  
  455. 3.2    What exactly is this config file, anyway?  What are all of these 
  456.     cryptic notations?
  457.  
  458.     The config file is the list of all of the optional (and settings
  459.     for the mandatory) parts of the kernel.  If the system is made
  460.     up of static object files which don't change, then all you
  461.     should ever need to do is modify the config file, reconfigure
  462.     the kernel objects, and relink.  Since both NetBSD and FreeBSD
  463.     are distributed with source, these files are recompiled and a
  464.     kernel is constructed.  Some of these have been deprecated, and
  465.     may not be in use for a particular version of the system
  466.     (i.e. ISO9660 and CD9660 are the same, CD9660 being the newer
  467.     version). 
  468.     
  469.  
  470. 3.2.1    Okay, fine.  Why shouldn't I just add every device I can find to
  471.     the kernel, so I'll never have to recompile this again?
  472.  
  473.     Because it takes up space.  The kernel is wired into memory, so 
  474.     every byte it uses comes out of the pool of memory for everything 
  475.     else.  It can't page out sections that aren't in use.  If your 
  476.     kernel is larger than 640K, then it can't be loaded.  You'll need 
  477.     to use Julian Elischer's bootblocks to put it in high memory, which 
  478.     seem to be fairly complex.  Installing them (once they are 
  479.     compiled) is as easy as using disklabel.
  480.  
  481.     Newer versions of the *BSD kith provide the capability to build
  482.     a kernel that is larger than 640K.  Complete instructions are
  483.     provided in the appropriate systems.
  484.  
  485.  
  486. 3.2.2    What should I remove from the kernel?
  487.  
  488.     What do you need?  If you only have an SCSI controller, you don't 
  489.     need the wd0 device;  if you have another kind of disk controller, 
  490.     you don't need sd0.  Unless you actually HAVE more than one Ethernet 
  491.     controller, you should comment out all but one of them.  If you don't 
  492.     have an ethernet controller, you don't need any of the controllers or 
  493.     NFS compiled in.   Without a CD-ROM, ISOFS is kind of pointless.  Just 
  494.     look at what you have and think about what you really need.
  495.  
  496.  
  497. 3.2.3    I can't get enough remote login sessions or xterm sessions.  I also
  498.     can only get four sessions working at a time.  What can I do?
  499.  
  500.     Increase the count of pseudo-terminals --
  501.  
  502.     pseudo-device    pty    12  # or whatever
  503.  
  504.     Every pseudo terminal should have a /dev/pty* entry.  If you have 12
  505.     pseudo terminals, you should also have at least 12 pty devices in the
  506.     /dev directory.  The MAKEDEV script in /dev will create as many pseudo-
  507.     terminals as you tell it to.
  508.  
  509.  
  510. 3.2.4    How do I get ddb, the kernel debugger, compiled into the kernel
  511.     and running?
  512.  
  513.     If you are using older versions of the 386BSD family, you will
  514.     need to add a line in your config file that looks like this:
  515.  
  516.     device-pseudo    ddb
  517.  
  518.     If you are using a more recent version (the division is pretty
  519.     unclear about when the switch was made) and do not have any
  520.     device-pseudo entries, you will need to add the line:
  521.  
  522.     options     DDB
  523.  
  524.     to your config file.
  525.  
  526.     Build the kernel, then run dbsym on it:
  527.  
  528.     % dbsym ./kernel
  529.  
  530.     Install it and go for it.  Ctl-Alt-Esc drops you into the debugger.
  531.  
  532.     Note: DDB as shipped originally is a memory hog, and it is very
  533.     difficult to get a kernel small enough with enough fun things in it
  534.     to debug in 640K
  535.  
  536.     On the NetBSD-sparc system, the L1-A is used by the the DDB
  537.     routines to drop you into the debugger.
  538.  
  539.  
  540. 3.2.5    I'm getting all kinds of errors when I try to build a new
  541.     version of GCC.  How can I upgrade GCC to the most current version?
  542.  
  543.     Yes, this will happen on most architectures on the first compile
  544.     of src/gnu/usr.bin/gcc/libgcc.  As was stated in the mailing
  545.     list before, when you get to this error:
  546.       1) run a 'make' in the gcc directory.  It will error out (most
  547.          likely) on libgcc.
  548.       1) Do a 'make install' at this point to install at least gcc, 
  549.          cpp, and cc1.
  550.       2) go back and compile in src/gnu/usr.bin/gcc/ WITHOUT doing 
  551.          a "make clean"
  552.       3) install everything in src/gnu/usr.bin/gcc
  553.  
  554.  
  555. 3.2.6    Can I patch the current running OS image?
  556.  
  557.     In general, I think, the answer is no.  The prevailing philosophy 
  558.     seems to be that one should use sysctl for such things, but that 
  559.     requires that one has already compiled in the ability to change 
  560.     the specific variable in question.  (I discovered this when I 
  561.     wanted to patch tickadj at runtime; I added it to kernfs, and 
  562.     when I offered the patches (which are quite small) I was told 
  563.     sysctl was the `correct' way.  What's incorrect about /kern was 
  564.     never quite explained; the closest anyone came was to invoke 
  565.     internationalization concerns.  Of course, using /kern also 
  566.     requires having compiled in support for tweaking the variable 
  567.     you want to change.)
  568.  
  569.     Besides, unless you've patched securelevel, I don't think there 
  570.     is any good way to twiddle variables in the running kernel.  
  571.     /dev/{,k}mem are, I believe, read-only once init sets securelevel 
  572.     to 1.
  573.  
  574.     If you need to know more about the sysctl command, try 
  575.     "sysctl -a | more" to get a list of the parameters that can be
  576.     modified while the system is running.
  577.  
  578.  
  579. 3.2.7    Can I have more than one config file?  Should I rename it to something
  580.     else?  Any other hints?  
  581.  
  582.     You can create as many (or as few) config files as you desire.  The 
  583.     system, once the patchkit is applied, will have between 10 and 15, 
  584.     each of which implements certain functions or features.  In addition, 
  585.     the normal place for the patchkit to make changes to the config files 
  586.     is in the GENERICISA file.  Since this file should remain unchanged 
  587.     and available, it is always a good idea to copy this file to a 
  588.     meaningful name and modify that file.  In other words, change every 
  589.     reference in 3.1.1 from GENERICISA to HAL (or whatever you call your 
  590.     system).
  591.  
  592.     One final note.  Every /sys/compile directory takes up 800K or so;
  593.     you might want to watch to see how big these all get.
  594.  
  595.  
  596. 3.2.8    I have been getting a lot of "virtual memory exhausted" errors when 
  597.     I am compiling a program with a really big static array.  I have 
  598.     128Meg of memory and 8Gig of swap.  How can this be happening?
  599.  
  600.     If you are using Csh, you can simply unlimit your processes in 
  601.     your system level /etc/csh.cshrc file or your personal .cshrc 
  602.     file.  You can also modify your kernel so that the
  603.     amount of memory available is less limiting.  J"org Wunsch 
  604.     (j@tcd-dresden.de) provides us with this brief description:
  605.  
  606.     From a recent posting regarding the problem how much virtual 
  607.     memory one could get.
  608.  
  609.     | On the other hand, i've also changed the definitions you
  610.     | mentioned. But i didn't like to modify the header files, and
  611.     | actually, modifying the values is as easy as:
  612.     | 
  613.     | options        "DFLDSIZ='(16 * 1024 * 1024)'"
  614.     | options        "MAXDSIZ='(64 * 1024 * 1024)'"
  615.     | 
  616.     | Include the above lines into your kernel's config file, reconfig
  617.     | and rebuild it.
  618.     | 
  619.  
  620.     This has been reported to work well for NetBSD, but causes
  621.     problems in the mkdep step of the kernel compile in FreeBSD.
  622.     Check the FreeBSD Web Site for a more definitive answer.
  623.     <Insert address of pointer here>.
  624.  
  625.     This is just a hint for those people poking around with compiling
  626.     large source files. Especially, due to some gcc problems with large
  627.     static arrays, compiling X applications with huge bitmaps would
  628.     cause virtual memory trouble. Increasing the limits (o'course, as
  629.     long as the h/w resources suffice) could help there.
  630.  
  631.     The default definitions for the above parameters are found in
  632.     /usr/include/machine/vmparam.h.
  633.  
  634.  
  635. 3.2.8.1    I am running NetBSD and really DO have 128 Meg of memory; but the 
  636.     generic kernel only sees the first 64Meg.  How can I fix this?
  637.  
  638.     The EXTMEM_SIZE entry needs to be set for your system.  I'm
  639.     completely clear on the concept, but it goes something like
  640.     this:
  641.  
  642.     The value of EXTMEM_SIZE needs to be set to the number of bytes
  643.     in the extended memory range for your system.  Since this
  644.     excludes the first Meg of memory, the value for the machine
  645.     above would be 127 * 1024, for a grand total of 130048.  Once
  646.     you reset that, you will need to either get the -current sources
  647.     (which will do the following for you) or you need to set NKPDE
  648.     to something larger than 12.  For 128Meg, 16 seems to be a
  649.     reasonable number; for 256Meg, 20 would probably work, with 24
  650.     being adequate for 512Meg.
  651.  
  652.     Both of these can be set in the source, or you can use the
  653.     "options" method listed in the last paragraph.
  654.  
  655.  
  656. 3.2.8.2    How do I dedicate 16Meg of memory to nothing but disk buffers?
  657.  
  658.     Set BUFPAGES to the number of 4K buffers you want to allocate.
  659.     For 16Meg, you would use "options    BUFPAGES=4096".
  660.     
  661.  
  662. 3.2.9    Where can I learn more about all this?
  663.  
  664.     We've skipped over a lot of details here;  the straight dope comes 
  665.     from "Building Berkeley UNIX Kernels with Config", by Samuel J. 
  666.     Leffler and Michael J. Karels. 
  667.  
  668.  
  669. 3.3    Other kernel related kind of questions.
  670. 3.3.1    Has the method for system call changed in NetBSD?  
  671.  
  672.     Q.  Is there something special with the order I need to update 
  673.     binaries and libraries in?  If I drop in the new libc, everything 
  674.     gives me a bus error.  Both shared and static do this.
  675.  
  676.     A.  On the port-i386 list, Charles Hannum discussed changing the 
  677.     system call mechanism (doing it via an INT instead of a call 
  678.     gate).  Looking at src/lib/libc/arch/i386/sys/syscall.S, it looks 
  679.     like this change is in.   Your binaries are (if you are using an 
  680.     old kernel) probably crashing at each system call now.
  681.  
  682.     So.. first compiling a new kernel with COMPAT_10 in it should make 
  683.     your newly linked binaries work, I guess (have not recompiled since 
  684.     the update myself yet). Also don't forget that you need to use 
  685.     config.new now.
  686.  
  687.     So, the answer is Yes, the mechanism for system calls has
  688.     changed, but the old method (using a call gate) is still
  689.     available by specifying COMPAT_10 in your configuration file.
  690.  
  691.  
  692. 3.3.2    Does anyone have a system building script that takes things like 
  693.     building a new config and multiple config files into account?
  694.  
  695.     The program I use to rebuild my kernel is available from 
  696.     http://cynjut.neonramp.com/build-kernel
  697.     
  698.  
  699. 3.3.3    How do I upgrade from my release version of NetBSD (and
  700.     probably FreeBSD) to the '-current' development sources?
  701.     
  702.     Your best method _by far_ would to to pull down a snapshot
  703.     (assuming one exists for your arch) & install all except the etc
  704.     tarfile, then diff the etc tarfile contents with your setup to
  705.     check for any updates you should make.
  706.  
  707.     If you really want to do it the hard way, here is your map.
  708.     
  709.     # Remember to make yourself a new config (not config.old) kernel 
  710.     # config file.
  711.     #
  712.     # This means any old config file you may have had from
  713.     # V1.1 needs to have the mainbus changes made. See GENERICADP and look
  714.     # for the isa0,eisa0,pci0 at root add the mainbus0 stuff and attached
  715.     # your buses to it.  For updates to V1.2, you will need to make
  716.     # certain the COMPAT_* options are correct.
  717.     #
  718.     # Make sure you have COMPAT_11 as part of your kernel config 
  719.     # options.
  720.     #
  721.     # This assumes that the -current source is in /usr/src
  722.  
  723.     (cd /usr/src/usr.sbin/config ; make && make install && make cleandir)
  724.  
  725.     # if you don't do this, config of your kernel config file will
  726.     # fail with errors in files.i386
  727.  
  728.     (cd /usr/src/gnu/usr.bin/gas ; make && make install && make cleandir)
  729.  
  730.     # if you don't do this, you won't be able to build locore.s, with
  731.     # errors about cpuid instruction not found
  732.  
  733.     (cd /sys/arch/i386/conf ; config BCC13)
  734.     (cd /sys/arch/i386/compile/BCC13 ; make depend && make)
  735.  
  736.     # copy  new kernel to /, and boot off it
  737.         
  738.     (cd /usr/src/share/mk ; make install)
  739.  
  740.     # if you don't do this, you'll get errors building gcc, when it
  741.     # doesn't know how to make the manual pages (don't know how to 
  742.     # make gcc.0)
  743.     #
  744.     # Rebuild yacc first or the yacc from v1.1 dies on Error Code 1 when
  745.     # it hits %expect 34 in /usr/src/gnu/gcc/common/c-parse.y. The
  746.     # new yacc included with V1.1B handles it, build and install it
  747.     # before it gets used in the gcc building.
  748.     #
  749.     # ***
  750.     #
  751.     (cd /usr/src/usr.bin/yacc; make && make install && make cleandir)
  752.     #
  753.     # The build now uses a new tsort option (-q) when it gets to the 
  754.     # point of 'building standard cc1 library'. At this point if using 
  755.     # the tsort that comes with V1.1 it dies on a Error 1 and no 
  756.     # obvious explanation. Going to the common sub-directory under 
  757.     # gcc (ie.  /usr/src/gnu/usr.bin/gcc/common)
  758.     # and typing 'make' will reveal the full error.
  759.     #
  760.     (cd /usr/src/usr.bin/tsort; make && make install && make cleandir)
  761.     #
  762.     #
  763.     cd /usr/src/gnu/usr.bin/gcc
  764.     make
  765.     #
  766.     # Build will die here on libgcc
  767.     #
  768.     (cd cc; make install)
  769.     (cd cc1; make install)
  770.     (cd cc1obj; make install)
  771.     (cd cc1plus; make install)
  772.     (cd cpp; make install)
  773.     (cd g++; make install)
  774.     (cd libgcc; make; make install)
  775.     (cd libobjc; make; make install)
  776.     (cd /usr/src/gnu/usr.bin/gcc ; make && make install && make cleandir)
  777.     #
  778.     # Bernd Wiserner says that the ld.so that will be built next will
  779.     # work only with libc.so.12.0, not with libc.so.12.3
  780.     # His instructions to make a working ld.so follow:
  781.     # Do NOT run ldconfig while doing the folowing 5 lines ...
  782.     #
  783.     (cd /usr/src/include ; make && make includes)
  784.     #
  785.     cp -p /usr/libexec/ld.so /usr/libexec/ld.so.good
  786.     (cd /usr/src/gnu/usr.bin/ld ; make && make install && make cleandir)
  787.     cp -p /usr/libexec/ld.so.good /usr/libexec/ld.so
  788.     #
  789.     # Then build ld.so again ...
  790.     (cd /usr/src/gnu/usr.bin/ld ; make && make install && make cleandir)  
  791.     # Thanks, Bernd...
  792.     
  793.     # And now the libraries
  794.     (cd /usr/src/lib ; make && make install && make cleandir)
  795.             
  796.     (cd /usr/src/bin/sh ; make && make install &&  make cleandir)
  797.             
  798.     # and now back to the beginning and make the world
  799.     #
  800.     (cd /usr/src/bin ; make && make install && make cleandir)
  801.     (cd /usr/src/sbin ; make && make install && make cleandir)
  802.             
  803.     mkdir /usr/share/doc/usd/13.viref
  804.     # otherwise "make install" in /usr/src/usr.bin will fail because
  805.     # the destination directory doesn't exist - from Tom Thai
  806.          
  807.     # if you're using the obj directory hierarchy, use the
  808.     # initscan.c from the obj directory, otherwise use the initscan.c
  809.     # that was created here.
  810.     
  811.     cd /usr/src/usr.bin/lex
  812.     if test -d /usr/src/usr.bin/lex/obj ; then
  813.                cp initscan.c obj/scan.c
  814.     else
  815.                cp initscan.c scan.c
  816.     fi
  817.     
  818.     # if you don't, then lex won't be built
  819.             
  820.     (cd /usr/src/usr.bin ; make && make install && make cleandir)
  821.     (cd /usr/src/usr.sbin ; make && make install && make cleandir)
  822.     (cd /usr/src/libexec ; make && make install && make cleandir)
  823.     (cd /usr/src/gnu ; make && make install && make cleandir)
  824.     (cd /usr/src/share ; make && make install && make cleandir)
  825.           
  826.     mkdir /usr/share/doc/usd/30.rogue /usr/share/doc/usd/31.trek
  827.     # otherwise "make install" in /usr/src/games might fail
  828.     # if the dirs weren't already there
  829.           
  830.     (cd /usr/src/games ; make && make install && make cleandir)
  831.     
  832.  
  833. 3.3.4    Is there a Makefile that does all that happy world-building
  834.     stuff?
  835.  
  836.     There is one in the /usr/src directory.  Unfortunately, it
  837.     seldom gets sent down unless you are using sup to get -current.
  838.     If you need it for NetBSD, you can FTP to ftp.netbsd.org and 
  839.     get it from the src archive.
  840.  
  841.     ftp://ftp.netbsd.org/pub/NetBSD-current/src/Makefile
  842.  
  843.     The same can be said for FreeBSD and OpenBSD, but obviously you
  844.     will need to get it from their FTP sites; not NetBSD's.
  845.     
  846.  
  847. 3.3.5    Can NetBSD do cross compilation?
  848.  
  849.     Sure.  Check out the cross-compiling howto for MacBSD for an
  850.     example.  All of the NetBSD ports should be capable of doing
  851.     'pretty much' the same thing.
  852.  
  853.     You can find Colin Wood's MacBSD cross compilation howto at 
  854.     the following URL:
  855.  
  856.     http://www.macbsd.com/macbsd/howto/cc-HOWTO
  857.  
  858. 3.3.6    My network memory seems to be leaking.  The numbers just keep
  859.     increasing slowly over time.  Is there a problem I need to worry
  860.     about?
  861.  
  862.     Probably not.  When the system starts, the kernel malloc pool is
  863.     not backed by real memory.  As these pages are allocated, real
  864.     memory is assigned to them, increasing your memory usage.  As
  865.     these pages are released, they are returned to the malloc pool,
  866.     but the memory is never returned to the system.  Eventually,
  867.     your malloc area will reach a point of statis, where new pages
  868.     are not needed from real memory; the releases to the malloc area
  869.     should cover the new pages needed.
  870.  
  871.  
  872. 3.4    X11/XFree86/XS3
  873. 3.4.1    What options should I define to get the X extensions included?
  874.  
  875.     Once you have applied the patch kit, the only thing left to do is to
  876.     modify the config file to include the following line:
  877.  
  878.     options    XSERVER, UCONSOLE
  879.  
  880.     recompile the kernel and the kernel should support X.
  881.  
  882. 3.4.2    Where can I get the FAQ for 'X'?
  883.  
  884.     Steve Kotsopoulos' general 'X on Intel-based Unix' FAQ
  885.     available by anonymous ftp from export.lcs.mit.edu in 
  886.     /contrib/faq/Intel-Unix-X-faq. 
  887.  
  888.  
  889. 3.4.3    Why does X drop characters when using xdm?   When I run xdm 
  890.     from the console, it keeps losing keystrokes and the shift keys 
  891.     don't always work.  Why?
  892.  
  893.         You need to run xdm with the -nodaemon flag.  The reason is
  894.         xdm normally detaches from the keyboard.  This allows other
  895.         processes (like getty) to return to reading from the keyboard.
  896.         A race condition results, where some keystrokes are sent to
  897.         xdm and others are sent to other processes.  Using the
  898.         -nodaemon flag causes xdm to stay attached to the keyboard
  899.         so no other process can use it.  This answer comes from Michael 
  900.         C. Newell (root@wanderer.nsi.nasa.gov)
  901.  
  902.     This bit of trivia is also covered in detail in the X FAQ and 
  903.     the README that accompanies XFree86.
  904.  
  905.  
  906. 3.4.4    What can I do to figure out why 'X' doesn't work with NetBSD?
  907.  
  908.     The best way to debug problems with starting 'X' is to redirect
  909.     the output of the 'startx' program to a file:
  910.  
  911.     % startx >& startx.log       # csh
  912.     % startx 2>&1 > startx.log # sh
  913.  
  914.     With the output from this, the problems should be fairly easy to
  915.     identify and (hopefully) fix.
  916.  
  917.  
  918. 3.4.5    Under NetBSD and FreeBSD, xlock (or any other program that uses
  919.     passwords) fails to validate user passwords. Anyone know why? 
  920.  
  921.     OK, first off, make sure you're using the latest version of 
  922.     xlock. If you've pulled it out of the /ports/ distribution then 
  923.     you've got version 1.14. This is woefully ancient, so get the 
  924.     latest, which at the time of writing is 2.7 (just do an archie 
  925.     search for 'xlockmore-2.7' to find it).
  926.  
  927.     Get this, compile it up and *make sure it's setuid root*. So, 
  928.     after you've copied it into /usr/X11R6/bin or wherever, do the 
  929.     following:
  930.  
  931.         # chown root.wheel ./xlock
  932.         # chmod 4755 ./xlock
  933.  
  934.     After that, it should work fine. The problem is that without 
  935.     being setuid root xlock cannot read the real system passwords. 
  936.     If you look in /etc/passwd you'll see that the passwords are 
  937.     all '*'d out, because FreeBSD and NetBSD use shadow passwords.
  938.  
  939.     That's what worked for me. A couple of other suggestions were 
  940.     raised last time this problem cropped up:
  941.  
  942.       o If you're using a pre-compiled xlock then it might have 
  943.       been linked against the USA encryption libraries. If you're 
  944.       outside the States then the encryption libraries are different, 
  945.       and a US xlock will not be able to read the passwords. The fix 
  946.       is to get the sources and recompile.
  947.  
  948.       o If you've compiled it from source, made it setuid root, and 
  949.       it still doesn't work, someone suggested changing the size of 
  950.       the constant PASSLENGTH in xlock.c from '20' to '40'. I haven't 
  951.       had to do this, and in v2.7 it's '64' anyway, so it shouldn't 
  952.       be a problem.
  953.  
  954.  
  955. 3.5    I want to run 'XYZA'  which is  dynamically linked and from 'some 
  956.     other operating system'.  What special things do I have to do to 
  957.     get it working?
  958.  
  959.     For NetBSD:
  960.     Assuming you are trying to simulate a SVR4 system, you want to 
  961.     create the '/emul/svr4' directory.  You will also want to ensure
  962.     the "COMPAT_SVR4" option is in your kernel config file.  This
  963.     option will change in 1.3-current and later, so be sure to check
  964.     out the config files included with those versions to ensure you
  965.     have the right options.
  966.  
  967.     Note that there are known problems when trying to run a
  968.     staically linked Linux ELF executable and you have SVR4
  969.     emulation built into your kernel.  THe problem is the order in
  970.     which ELF executables are processed through the kernel tables.
  971.     The SVR4 emulation gets processed first, thus causing the LInux
  972.     ELF executable to be improperly processed.  This may cause
  973.     certain Linux static ELF executables to fail under the *BSD
  974.     systems.  The way to fix this is to remove SVR4 emulation from
  975.     the kernel or switch to a real SVR4 executable.
  976.  
  977.     Also note that newer versions of NetBSD do not make a
  978.     distinction between Linux ELF executables and SVR4 ELF
  979.     executables.  The only difference (from the 1.3 kernel's
  980.     viewpoint) is whether they are 32 or 64 bit ELF executables.
  981.  
  982.     With this accomplished, you will need to copy several files into
  983.     the emulation directoy.  A live example might be best at this
  984.     point.  Most of this information is include in the
  985.     'compat_linux(8)' manpage.
  986.  
  987.     First, set up the '/emul/linux' directory.  Within this
  988.     directory (and virtually all of the emulation directories) you
  989.     will need the following:
  990.  
  991.         etc/    (the emulated /etc directory)
  992.         lib/    (the emulated /lib directory)
  993.         usr/    (the emulated /usr directory)
  994.  
  995.     From there, the simplest way to populate these directories is to
  996.     use a program like 'cpio' or 'tar' to build an archive.  Having
  997.     a linux machine available will greatly simplify this.  Copy
  998.     (basically everything from the Linux (or whatever) /etc and /lib
  999.     directories.
  1000.  
  1001.     Any executables that you need from the Linux system should then
  1002.     be copied into an appropriate place in the usr/ directory.  For
  1003.     example, when creating the Linux Doom system on NetBSD, you need
  1004.     to have the following files (which should all come from the
  1005.     Linux Doom distribution).
  1006.  
  1007.     usr/X11R6/lib
  1008.         libX11.so.6.0
  1009.  
  1010.     usr/bin:
  1011.         as86
  1012.         ld86
  1013.  
  1014.     usr/games/doom
  1015.         README.linuxx
  1016.         doom1.wad
  1017.         linuxxdoom
  1018.         sndserver.old
  1019.  
  1020.     With Doom specifically, you may need to set 'DOOMWAD' (or
  1021.     whatever it is) to usr/games/doom for it to work correctly.  
  1022.  
  1023.     In addition to the 'X' version, the native version should also
  1024.     work (with recent versions of NetBSD (1.1+)
  1025.  
  1026.     It is generally accepted that NetBSD's emulation of the other
  1027.     systems is pretty close *except for* sound.  The audio drivers
  1028.     in NetBSD are not a robust (yet) as they probably should be.
  1029.     Don't be surprised if sound emulation works badly, if at all,
  1030.     for any of the other operating systems emulation works for.
  1031.  
  1032.     The good news is that work under way (early 1997) in the
  1033.     -current version of NetBSD (pre 1.3) should fix most of this.
  1034.     The sound subsystem has been modified so that machine
  1035.     independent components are seperated from the machine dependent
  1036.     stuff, and each of the machine dependent parts is getting a
  1037.     facelist.  Ultimately, the NetBSD sounds system should be 100%
  1038.     compatible with the one from FreeBSD (that was the design goal)
  1039.     and probably Linux as well. 
  1040.  
  1041.  
  1042. 3.6    You promised to talk about timezones below.  Are you going to?
  1043.  
  1044.     >I've seen lots of stuff about timezone's being a bit dodgy,
  1045.     >especially with most European timezones changing over to DST on 
  1046.     >the 27th March.  I must say that that was NOT the case for me - 
  1047.     >pumpy (the author's system) is running off the 
  1048.     >/usr/share/zoneinfo/GB-Eire timezone file, (symbolically) linked 
  1049.     >to /etc/localtime, the CMOS clock is running off GMT, and the 
  1050.     >kernel is compiled with "timezone 0".
  1051.  
  1052.     For a full discussion of this problem, check out the
  1053.     'options(4)' manpage.  It describes the DST and TIMEZONE options
  1054.     in detail.
  1055.  
  1056.     In newer kernels, the problems are far less dramatic than they
  1057.     used to be (see below):
  1058.  
  1059.     The problems with timezones and real-time clocks is that most
  1060.     386 hardware is just stupid.  It doesn't recognize DST, even
  1061.     when told to.  It can't use network system time during DST
  1062.     because it makes all the PC clocks off by an hour.  
  1063.  
  1064.     For machines that dual boot DOS and *BSD, one of the simplest
  1065.     solutions involves using a program called 'clock372' from
  1066.     Simtelnet (the exact site is not available).  After you install
  1067.     it, you add a couple of lines to your DOS CONFIG.SYS and set the
  1068.     hardware clock to DST.  From there, you build a kernel with DST
  1069.     and TIMEZONE set to 0 and your whole system "just works".
  1070.  
  1071.     In older kernels the following works:
  1072.  
  1073.     I use /usr/share/zoneinfo/MET as /etc/localtime and have the 
  1074.     kernel configured as
  1075.  
  1076.         timezone        -1 dst 4
  1077.  
  1078.     (My wife is running DOS on this machine for doom sometimes ;-)
  1079.  
  1080.     I set this strange dst value after diging in some old ultrix(?) 
  1081.     man pages.  There were several dst-changing-method listed and 4 
  1082.     was the code for the central europe one.
  1083.  
  1084.     This gave me an idea... I use an Ultrix box every day, so why not...
  1085.  
  1086.     Now, I don't know how closely this applies to NetBSD since 
  1087.     Ultrix is based on a much older version of BSD, and this isn't 
  1088.     for the kernel config, but for an envar of timezone values, but 
  1089.     it's at least somewhat enlightening on possible meanings for 
  1090.     these things.  Could someone in the know shed light on how 
  1091.     accurately this models the timezone stuff in the kernel config?  
  1092.     When I did "man timezone" this is what I got (portion of this 
  1093.     quoted from the DEC MIPS Ultrix 4.3a timezone(3) manpage, 
  1094.     slightly hacked by me (Michael L. VanLoon (michaelv@iastate.edu))
  1095.  
  1096.  
  1097.          STD offset [DST [offset][,start[/time],end[/time]]]
  1098.  
  1099.          the components of the string have the following meaning:
  1100.  
  1101.     STD and DST    Three or more characters that are the 
  1102.             designation for the standard (STD) or 
  1103.             summer (DST) time zone. Only STD is required; 
  1104.             if DST is missing, then summer time does not apply 
  1105.             in this locale. Upper- and lowercase letters are 
  1106.             explicitly allowed.  Any characters except a 
  1107.             leading colon (:), digits, comma (,), minus (-), 
  1108.             plus (+), and ASCII NUL are allowed.
  1109.  
  1110.          offset        Indicates the value to be added to the local 
  1111.             time to arrive at Coordinated Universal Time. The 
  1112.             offset has the form:
  1113.  
  1114.             hh[:mm[:ss]]
  1115.  
  1116.             The minutes (mm) and seconds (ss) are optional. 
  1117.             The hour (hh) is required and may be a single 
  1118.             digit.    The offset following STD is required. If 
  1119.             no offset follows DST, summer time is assumed to 
  1120.             be one hour ahead of standard time.  One or more 
  1121.             digits may be used; the value is always
  1122.             interpreted as a decimal number.  The hour must 
  1123.             be between 0 and 24, and the minutes (and
  1124.             seconds) - if present - between zero and 59. If 
  1125.             preceded by a "-", the time zone is east of the 
  1126.             Prime Meridian; otherwise it is west (which may
  1127.             be indicated by an optional preceding "+").
  1128.  
  1129.      start and end    Indicates when to change to and back from summer
  1130.                  time. Start describes the date when the change
  1131.             from standard to summer time occurs and end 
  1132.             describes the date when the change back
  1133.             happens.  The format of start and end must be
  1134.             one of the following:
  1135.  
  1136.             Jn    The Julian day n (1 < n < 365). Leap
  1137.                 days are not counted.  That is, in all
  1138.                 years, including leap years, February
  1139.                 28 is day 59 and March 1 is day 60.  It
  1140.                 is impossible to explicitly refer to
  1141.                 the occasional February 29.
  1142.  
  1143.             n    The zero-based Julian day (0 < n <
  1144.                 365).  Leap days are counted, and it is    
  1145.                 possible to refer to February 29.
  1146.  
  1147.             Mm.n.d    The nth d day of month m (1 < n < 5, 
  1148.                 0 < d < 6, 1 < m < 12).  When n is 5 it 
  1149.                 refers to the last d day of month m.
  1150.                 Day 0 is Sunday.
  1151.  
  1152.                  time    The time field describes the time when,
  1153.                 in current time, the change to or from
  1154.                 summer time occurs. Time has the same
  1155.                 format as offset except that no leading
  1156.                 sign (a minus (-) or a plus (+) sign)
  1157.                 is allowed. The default, if time is not
  1158.                 given, is 02:00:00.
  1159.  
  1160.     As an example of the previous format, if the TZ environment
  1161.     variable had the value EST5EDT4,M4.1.0,M10.5.0 it would    describe 
  1162.     the rule, which went into effect in 1987, for the Eastern time
  1163.     zone in the USA.  Specifically, EST would be the designation for
  1164.     standard time, which is 5 hours behind GMT.  EDT would be the 
  1165.     designation for DST, which is 4 hours behind GMT.  DST starts
  1166.     on the first Sunday in April and ends on the last Sunday in
  1167.     October.  In both cases, since the time was not specified, the
  1168.     change to and from DST would occur at the default time of 2:00 AM.
  1169.  
  1170.     The timezone call remains for compatibility reasons only; it is 
  1171.     impossible to reliably map timezone's arguments (zone, a
  1172.     `minutes west of GMT' value and DST, a `daylight saving time in
  1173.     effect' flag) to a time zone abbreviation.
  1174.  
  1175.  
  1176. 3.6.1    How do you change the timezone on NetBSD (FreeBSD also?)?
  1177.  
  1178.     Relink /etc/localtime.  This will correct the difference from
  1179.     GMT (or its trendy equivelant) to your local timezone.  In
  1180.     addition, the kernel needs to be modified to take the clock
  1181.     time in your CMOS into account.  Since most folks that run DOS
  1182.     prefer to have their clocks set to local time, the timezone
  1183.     hack was introduced to allow the kernel to adjust the CMOS
  1184.     clock time to GMT.  Once GMT has been computed, the
  1185.     /etc/localtime file can be referenced to determine the
  1186.     corrected local time.
  1187.  
  1188.     All generic kernels are built using the offset from California
  1189.     (why is anyone's guess:-) so just about everyone's clock will
  1190.     be off by their timezone offset from Berkeley.
  1191.  
  1192.     Also, it may pay to actually copy the correct timezone file
  1193.     rather than link it.  That way, you clock will be correct even
  1194.     in single users mode (when the /usr partition is not even
  1195.     mounted.  The disadvantage of this is that anytime the timezone
  1196.     file gets updated, you will need to make certain that the file
  1197.     is copied into the /etc directory.
  1198.  
  1199.  
  1200. 3.6.2    The translation between seconds-since-the-epoch and date
  1201.     differs by about 18 seconds between BSD and other Unixes when
  1202.     running ntp; why?
  1203.  
  1204.     See ntp FAQ. Apparently, the time correction takes leap seconds
  1205.     into account twice.  The timezone files in our system take the 
  1206.     leap seconds into account in the kernel, and nntp takes the
  1207.     same 18 leap seconds into account when syncing the time.
  1208.     Because of that, the time will appear to be off by eighteen
  1209.     seconds.  (Henning Schulzrinne)
  1210.  
  1211.  
  1212. 3.7    How can I implement CVS to track MY changes to the kernel source
  1213.     tree, yet still follow the -current development tree?
  1214.  
  1215.     I'll append the scripts I use, but be warned, they may bite you if 
  1216.     you are careless...
  1217.  
  1218.     The main reason I use cvs import is to handle updates from the 
  1219.     ``vendor''.  The best way I've found is to import _exactly_ what 
  1220.     was shipped.  This means unconfigured, and I put config.h, etc, 
  1221.     in .cvsignore.  If I have to modify configure.in then obviously 
  1222.     I commit them :-)
  1223.  
  1224. #!/bin/sh
  1225. # This is a shell archive.
  1226. # remove everything above the "#!/bin/sh" line
  1227. # and feed to /bin/sh
  1228. # Use -c option to overwrite existing files
  1229. #
  1230. # Contents: 
  1231. #    README.import
  1232. #    import.sh
  1233. #    prune.sh
  1234. #
  1235. # packed by: <sjg@zen.void.oz.au> on Sat Jun 17 20:00:34 EST 1995
  1236. #
  1237. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  1238. if test -f README.import -a x$1 != x-c ; then
  1239.   echo shar: Will not over-write existing file \"README.import\"
  1240. else
  1241.   echo shar: Extracting \"README.import\" \(2902 characters\)
  1242.   sed 's/^X//' >README.import << '!EOF'
  1243. XThe following may be of use to others wanting to use CVS to merge
  1244. XNetBSD sources with local changes but are not confident that they have
  1245. Xinterpreted the documentation accurately.
  1246. X
  1247. XMuch thanks to Chris Demetriou (cgd) for taking the time to spell out
  1248. Xthe steps he used when merging NetBSD sources without which I might
  1249. Xnot have taken the plunge myself :-) The following is based on Chris'
  1250. Xtips, though of course any errors are mine.
  1251. X
  1252. XOk.  My NetBSD sources are kept in usr.src, if NetBSD is all
  1253. Xyou use CVS for you might want to simply call it src.
  1254. X
  1255. XI unpack tar files and/or sup into a directory /d2/current.
  1256. X
  1257. XTo import the entire tree I:
  1258. X
  1259. Xcd /d2/current/src
  1260. X
  1261. Xcvs import "-I! " -m "from netbsd-current as of 950508" usr.src NetBSD \
  1262. XNetBSD-950508 > /tmp/cvs.out 2>&1
  1263. X
  1264. XWhere:
  1265. Xusr.src        is the repository where the imported data goes (so set it
  1266. X        according to your own needs), 
  1267. XNetBSD        is a vendor tag.
  1268. XNetBSD-950508    is a release tag (there can be multiple release tags given).
  1269. X
  1270. XI use "-I! " as otherise some files that you need (like
  1271. Xbin/csh/USD.doc/csh.a) will be ignored..  The space after the ! is
  1272. Xneeded.
  1273. X
  1274. XIt takes quite a while.  It is a good idea to save the output to a file.
  1275. X
  1276. XAt the end you may well get a message like:
  1277. X
  1278. X    cvs checkout -jNetBSD:yesterday -jNetBSD usr.src
  1279. X
  1280. XThis means there were some conflicts between your local sources and
  1281. Xthe import.  So I do what it says - but not in my working tree.
  1282. X
  1283. Xcd /d2/tmp
  1284. Xcvs checkout -jNetBSD:yesterday -jNetBSD usr.src > /tmp/merge.out 2>&1
  1285. X
  1286. XYou can then go find all the files with conflicts.
  1287. XEither grep '^C' /tmp/merge.out or find usr.src -name '.#*' -print
  1288. XGo edit them to resolce the conflicts.  This is usually obvious.
  1289. X
  1290. XWhen happy. 
  1291. X
  1292. Xcd /d2/tmp/usr.src
  1293. Xcvs commit -m"merged local changes with NetBSD-950508"
  1294. Xcd ..
  1295. Xrm -rf usr.src
  1296. X
  1297. XOk. Now if you are brave you can:
  1298. X
  1299. Xcd /usr.src (or whereever your working sources are)
  1300. Xcvs update
  1301. X
  1302. XFinally, you should occasionally make sure you remove old files.
  1303. X
  1304. XI use a script to do this.  It does a diff between files on the NetBSD
  1305. Xbranch looking for the latest release tag (eg. NetBSD-950508). 
  1306. XIf cvs diff remports that a file does not have that tag, it is because
  1307. Xit was not present in the import (ie removed). 
  1308. X
  1309. XThe command sequence is:
  1310. X
  1311. Xcvs diff -s -r NetBSD -r NetBSD-950508 > /tmp/prune.out 2>&1
  1312. X
  1313. X# check that all went well...
  1314. Xcat /tmp/prune.out | awk '/Diffing/ { dir=$NF } 
  1315. X/NetBSD-/ { file=$NF; print dir "/" file }'  > /tmp/pruned
  1316. X
  1317. Xcat /tmp/pruned | xargs cvs tag -d NetBSD
  1318. Xcat /tmp/pruned | xargs rm -f
  1319. Xcat /tmp/pruned | xargs cvs delete
  1320. X
  1321. XNote that this is a slow process on a 486DX33!  So don't plan on
  1322. Xmerging everything very often.  Folk who mainly hack the kernel can do
  1323. Xsrc/sys more frequently.  The sequence is analogous eg.
  1324. X
  1325. Xcd /d2/current/src/sys
  1326. X
  1327. Xcvs import "-I! " -m "from netbsd-current as of 950508" usr.src/sys NetBSD \
  1328. XNetBSD-950508 > /tmp/cvs.out 2>&1
  1329. X
  1330. Xetc.
  1331. X
  1332. XHope this helps.
  1333. X
  1334. X--sjg
  1335. !EOF
  1336.   if test 2902 -ne `wc -c < README.import`; then
  1337.     echo shar: \"README.import\" unpacked with wrong size!
  1338.   fi
  1339.   
  1340. fi
  1341. if test -f import.sh -a x$1 != x-c ; then
  1342.   echo shar: Will not over-write existing file \"import.sh\"
  1343. else
  1344.   echo shar: Extracting \"import.sh\" \(290 characters\)
  1345.   sed 's/^X//' >import.sh << '!EOF'
  1346. X:
  1347. Xtoday=`date '+%y%m%d'`
  1348. X
  1349. Xrep=${1:-usr.src}
  1350. X
  1351. X# -I! doesn't work, it needs a space after the !
  1352. Xcvs import "-I! " -m "from netbsd-current as of $today" $rep NetBSD NetBSD-$today
  1353. X
  1354. X# cd somewhere
  1355. X# cvs checkout -jNetBSD:yesterday -jNetBSD usr.src > /tmp/cvs.out 2>&1
  1356. X# merge changes and commit
  1357. !EOF
  1358.   if test 290 -ne `wc -c < import.sh`; then
  1359.     echo shar: \"import.sh\" unpacked with wrong size!
  1360.   fi
  1361.   chmod +x import.sh
  1362. fi
  1363. if test -f prune.sh -a x$1 != x-c ; then
  1364.   echo shar: Will not over-write existing file \"prune.sh\"
  1365. else
  1366.   echo shar: Extracting \"prune.sh\" \(491 characters\)
  1367.   sed 's/^X//' >prune.sh << '!EOF'
  1368. X:
  1369. Xthen=${1:-`date '+%y%m%d'`}
  1370. XTF=/tmp/prune.$$
  1371. XTF2=/tmp/prune2.$$
  1372. X#S=-s
  1373. XS=
  1374. X
  1375. Xcase `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac
  1376. X
  1377. Xask () { echo $N "${2:-$1?} "$C; read $1; }
  1378. X  
  1379. Xcvs diff $S -r NetBSD -r NetBSD-$then > $TF 2>&1 || cat $TF >&2
  1380. X
  1381. Xcat $TF | awk '/Diffing/ { dir=$NF } /NetBSD-/ { file=$NF; print dir "/" file }' > $TF2
  1382. X
  1383. Xcat $TF2
  1384. Xask proceed
  1385. Xcase "$proceed" in
  1386. X[yY]*)
  1387. Xcat $TF2 | xargs cvs tag -d NetBSD
  1388. Xcat $TF2 | xargs rm -f
  1389. Xcat $TF2 | xargs cvs delete
  1390. X;;
  1391. Xesac
  1392. Xrm -f $TF $TF2
  1393. !EOF
  1394.   if test 491 -ne `wc -c < prune.sh`; then
  1395.     echo shar: \"prune.sh\" unpacked with wrong size!
  1396.   fi
  1397.   chmod +x prune.sh
  1398. fi
  1399. exit 0
  1400.  
  1401.  
  1402.  
  1403. 3.8    Optional Op-codes for NetBSD, FreeBSD, and other systems.
  1404.  
  1405.     MNEMONIC    INSTRUCTION
  1406.     ----------------------------------
  1407.     AAC        Alter All Commands
  1408.     AAR        Alter At Random
  1409.     AB        Add Backwards
  1410.     AFVC        Add Finagle's Variable Constant
  1411.     AIB        Attack Innocent Bystander
  1412.     AWTT        Assemble With Tinker Toys
  1413.     BAC        Branch to Alpha Centauri
  1414.     BAF        Blow All Fuses
  1415.     BAFL        Branch And Flush
  1416.     BBIL        Branch on Blown Indicator Light
  1417.     BBT        Branch on Binary Tree
  1418.     BBW        Branch Both Ways
  1419.     BCF        Branch and Catch Fire
  1420.     BCIL        Branch Creating Infinite Loop
  1421.     BDC        Break Down and Cry
  1422.     BDT        Burn Data Tree
  1423.     BEW        Branch Either Way
  1424.     BF        Belch Fire
  1425.     BH        Branch and Hang
  1426.     BOB        Branch On Bug
  1427.     BOD        Beat On the Disk
  1428.     BOI        Bite Operator Immediately
  1429.     BPDI        Be Polite, Don't Interrupt
  1430.     BPO        Branch on Power Off
  1431.     BRSS        Branch on Sunspot
  1432.     BST        Backspace and Stretch Tape
  1433.     BW        Branch on Whim
  1434.     CDC        Close Disk Cover
  1435.     CDIOOAZ        Calm Down, It's Only Ones and Zeros
  1436.     CEMU        Close Eyes and Monkey with User space
  1437.     CH        Create Havoc
  1438.     CLBR        Clobber Register
  1439.     CM        Circulate Memory
  1440.     CML        Compute Meaning of Life
  1441.     COLB        Crash for Operators Lunch Break
  1442.     CPPR        Crumple Printer Paper and Rip
  1443.     CRASH        Continue Running After Stop or Halt
  1444.     CRB        Crash and Burn
  1445.     CRN        Convert to Roman Numerals
  1446.     CS        Crash System
  1447.     CSL        Curse and Swear Loudly
  1448.     CU        Convert to Unary
  1449.     CVG        Convert to Garbage
  1450.     CWOM        Complement Write-Only Memory
  1451.     CZZC        Convert Zone to Zip Code
  1452.     DBZ        Divide By Zero
  1453.     DC        Divide and Conquer
  1454.     DMNS        Do what I Mean, Not what I Say
  1455.     DMPK        Destroy Memory Protect Key
  1456.     DPMI        Declare Programmer Mentally Incompetent
  1457.     DPR        Destroy Program
  1458.     DTC        Destroy This Command
  1459.     DTE        Decrement Telephone Extension
  1460.     DTVFL        Destroy Third Variable From Left
  1461.     DW        Destroy World
  1462.     ECO        Electrocute Computer Operator
  1463.     EFD        Emulate Frisbee Using Disk Pack
  1464.     EIAO        Execute In Any Order
  1465.     EIOC        Execute Invalid Opcode
  1466.     ENF        Emit Noxious Fumes
  1467.     EO        Execute Operator
  1468.     EROS        Erase Read-Only Storage
  1469.     FLI        Flash Lights Impressively
  1470.     FSM        Fold, Spindle and Mutilate
  1471.     GCAR        Get Correct Answer Regardless
  1472.     GDP        Grin Defiantly at Programmer
  1473.     GFM        Go Forth and Multiply
  1474.     IAE        Ignore All Exceptions
  1475.     IBP        Insert Bug and Proceed
  1476.     ISC        Insert Sarcastic Comments
  1477.     JTZ        Jump to Twilight Zone
  1478.     LCC        Load and Clear Core
  1479.     MAZ        Multiply Answer by Zero
  1480.     MLR        Move and Lose Record
  1481.     MWAG        Make Wild-Assed Guess
  1482.     MWT        Malfunction Without Telling
  1483.     OML        Obey Murphy's Laws
  1484.     PD        Play Dead
  1485.     PDSK        Punch Disk
  1486.     PEHC        Punch Extra Holes on Cards
  1487.     POCL        Punch Out Console Lights
  1488.     POPI        Punch Operator Immediately
  1489.     RA        Randomize Answer
  1490.     RASC        Read And Shred Card
  1491.     RCB        Read Command Backwards
  1492.     RD        Reverse Directions
  1493.     RDA        Refuse to Disclose Answer
  1494.     RDB        Run Disk Backwards
  1495.     RIRG        Read Inter-Record Gap
  1496.     RLI        Rotate Left Indefinitely
  1497.     ROC        Randomize Opcodes
  1498.     RPB        Read, Print and Blush
  1499.     RPM        Read Programmer's Mind
  1500.     RSD        On Read Error Self-Destruct
  1501.     RWCR        Rewind Card Reader
  1502.     SAI        Skip All Instructions
  1503.     SAS        Sit and Spin
  1504.     SCCA        Short Circuit on Correct Answer
  1505.     SFH        Set Flags to Half mast
  1506.     SLMTU=x        SLIP MTU size
  1507.     SLP        Sharpen Light Pen
  1508.     SPS        Set Panel Switches
  1509.     SPSW        Scramble Program Status Word
  1510.     SQPC        Sit Quietly and Play with your Crayons
  1511.     SRDR        Shift Right Double Ridiculous
  1512.     STA        Store Anywhere
  1513.     TARC        Take Arithmetic Review Course
  1514.     TPF        Turn Power Off
  1515.     TPN        Turn Power On
  1516.     UCB        Uncouple CPU and Branch
  1517.     ULDA        Unload Accumulator
  1518.     UP        Understand Program
  1519.     WBT        Water Binary Tree
  1520.     WHFO        Wait Until Hell Freezes Over
  1521.     WI        Write Illegibly
  1522.     WSWW        Work in Strange and Wondrous Ways
  1523.     XSP        Execute Systems Programmer
  1524.     ZAR        Zero Any Register
  1525.  
  1526.     If you have gotten this far, you deserved some humor.
  1527.  
  1528. -- 
  1529. Dave Burgess                   Network Engineer - Nebraska On-Ramp, Inc.
  1530. *bsd FAQ Maintainer / SysAdmin for the NetBSD system in my spare bedroom
  1531. "Just because something is stupid doesn't mean there isn't someone that 
  1532. doesn't want to do it...."
  1533.