diff --git a/FAQ/freebsd-faq.sgml b/FAQ/freebsd-faq.sgml index a6493dd8b8..52b28ae723 100644 --- a/FAQ/freebsd-faq.sgml +++ b/FAQ/freebsd-faq.sgml @@ -1,2555 +1,2555 @@
Frequently Asked Questions for FreeBSD 2.X <author>The FreeBSD FAQ Team, <tt/FAQ@FreeBSD.ORG/ -<date> $Id: freebsd-faq.sgml,v 1.31 1996-01-28 16:59:05 jfieber Exp $ +<date> $Id: freebsd-faq.sgml,v 1.32 1996-01-31 14:25:49 mpp Exp $ <abstract> This is the FAQ for FreeBSD systems version 2.X All entries are assumed to be relevant to FreeBSD 2.0.5+, unless otherwise noted. Any entries with a <XXX> are under construction. </abstract> <toc> <sect> <heading>Preface</heading> <p> Welcome to the FreeBSD 2.X FAQ ! This document tries to answer some of the most frequently asked questions about FreeBSD 2.X (or later, unless specifically indicated). If there's something you're having trouble with and you just don't see it here, then please send mail to: <url url="mailto:questions@FreeBSD.ORG" name="FreeBSD-questions Mailing list"> or to <url url="mailto:faq@FreeBSD.ORG" name="FreeBSD FAQ mailing list"> The latest released version is FreeBSD 2.1.0R. FreeBSD-current refers to the future FreeBSD 2.2. The 2.1 release has been issued from a special branch of the -current sources and is intended as a even more stable version of 2.0.5. There are regular snapshots extracted from 2.2-CURRENT. Check on <tt>ftp.FreeBSD.ORG</tt> in <tt>/pub/FreeBSD/*-SNAP*</tt>. This version of the FAQ uses the <tt>linuxdoc-sgml</tt> utility written for Linux by Matt Welsh. The initial SGML translation was made by Ollivier Robert <url url="mailto:roberto@FreeBSD.ORG" name="roberto@FreeBSD.ORG"> Some of the instructions here will also refer to auxiliary utilities in the <tt>/usr/share/FAQ/Text</tt> directory. If you do not have this directory, or if it does not contain the file that you want, you are probably using a version of FreeBSD prior to 2.0.5R. In this case, install the FreeBSD sources and look in <tt>/usr/src/share/FAQ/Text</tt> (instead of <tt>/usr/share/FAQ</tt>). CDROM purchasers and net folks who've grabbed the FreeBSD 2.X ``<tt/srcdist/'' will have these files. If you don't have the source distribution, then you can either grab the whole thing from: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current" name="FreeBSD-current base directory"> Or you can grab only those files you're interested in straight out of the FreeBSD-current distribution in: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src" name="FreeBSD-current src directory"> <sect1> <heading>What is FreeBSD?</heading> <p> FreeBSD 2.X is a UN*X type operating system based on U.C. Berkeley's 4.4BSD-lite release for the i386 platform. It is also based indirectly on William Jolitz's port of U.C. Berkeley's Net/2 to the i386, 386BSD. There have been many additions and bug fixes made throughout the entire system, some of the highlights of which are: <itemize> <item>More robust and extensive PC device support <item>System V-style IPC, messaging and semaphores <item>Shared Libraries <item>Much improved virtual memory code <item>Better console driver support <item>Network booting (diskless) support <item>YP support <item>Full support of the PCI bus <item>Loadable kernel modules <item>Serial Console Support <item>Merged VM/Buffer Cache <item>On demand PPP <item>Sync PPP <item>Improved SCSI support </itemize> <sect1> <heading>What do I need to run FreeBSD?</heading> <p> You'll need a 386 or better PC, with 4 Mo or more of RAM and at least 60 MB of hard disk space. It can run with a low end MDA card but to run X11R6, a VGA or better video card is needed. See the section on <ref id="hardware" name="Hardware compatibility"> <sect1> <heading>Where can I get FreeBSD</heading> <p> The distribution is available via anonymous ftp from: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/" name="FreeBSD home directory"> For the current release, 2.1.0R, look in: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/2.1.0-RELEASE/" name="FreeBSD 2.1.0-RELEASE"> FreeBSD is also available via CDROM, from the following place(s): Walnut Creek CDROM<newline> 4041 Pike Lane, Suite D-386<newline> Concord, CA 94520 USA<newline> Orders: (800)-786-9907<newline> Questions: (510)-674-0783<newline> FAX: (510)-674-0821<newline> email: <url url="mailto:orders@cdrom.com" name="WC Orders address"> <newline> WWW: <url url="http://www.cdrom.com/" name="WC Home page"><newline> In Australia, you may find it at the following: Advanced MM Distributors<newline> 45 Elstone Ave<newline> Airport West VIC 3042<newline> Voice: +61 3 374-1410<newline> Fax: +61 3 338-7411 fax<newline> CDROM Support BBS<newline> 17 Irvine St<newline> Peppermint Grove WA 6011<newline> Voice: +61 9 385-3793<newline> Fax: +61 9 385-2360<newline> <sect1> <heading>What are the FreeBSD mailing lists, and how can I get on them?</heading> <p> The following mailing lists are provided for FreeBSD users and developers. For more information, send to <majordomo@FreeBSD.ORG> and include a single line saying ``help'' in the body of your message. <descrip> <tag/announce/ For announcements about or on FreeBSD. <tag/hackers/ Useful for persons wishing to work on the internals. <tag/questions/ General questions on FreeBSD. <tag/bugs/ Where bugs should be sent. <tag/SCSI/ Mailing list for SCSI developers. <tag/current/ This is the mailing list for communications between the developers and users of freebsd-current. It also carries announcements and discussions on current. <tag/security/ For issues dealing with system security. <tag/platforms/ Deals with ports to non-Intel platforms <tag/ports/ Discussion of <tt>/usr/ports/???</tt> <tag/fs/ Discussion of FreeBSD Filesystems <tag/hardware/ Discussion on hardware requirements for FreeBSD. <tag/committers/ CVS commit messages for -current users <tag/chat/ What does not belong elsewhere, general chat, fun. <tag/hubs/ This the mailing-list for all of the generous people who manage the ``regional'' part of the <tt/freebsd.org/ domain. <tag/users-groups/ This is the mailing list for the coordinators from each of the local area Users Groups to - dicuss matters with each other and a designated individual + discuss matters with each other and a designated individual from the Core Team. This mail list should be limited to meeting synopsis and coordination of projects that span User Groups </descrip> <p> The FreeBSD-commit list has been broken up into groups dealing with different areas of interest. Please see the FreeBSD mailing list FAQ in: <url url="http://www.freebsd.org/How/handbook/eresources:mail.html" name="Handbook s section on mailing-lists"> <p> Example: <p> To subscribe to the <tt/questions/ list, you'll to send a message containing the following command in the <bf/body/ of the message, the subject is ignored: <verb> subscribe questions john.smith@foo.bar (John Smith) </verb> <p> To unsubscribe, it is as easy. Just remember to send your request to <url url="mailto:Majordomo@FreeBSD.ORG" name="The mail administrator"> - <bf/not/ to the list itself. The last thing the subscribred + <bf/not/ to the list itself. The last thing the subscribed users want to see is administrative requests... <sect1> <heading>What are the various FreeBSD news groups?</heading> <p> There are two newsgroups currently dedicated to FreeBSD: <descrip> <tag/comp.unix.bsd.freebsd.announce/ For announcements <tag/comp.unix.bsd.freebsd.misc/ General discussion </descrip> The following newsgroups may also be of interest to general BSD enthusiasts: <descrip> <tag><tt/comp.unix.bsd/</tag> General BSD topics </descrip> To setup/run your own News server or just reading Usenet News, you may have a look at various packages already ported for FreeBSD 2.X in <tt>/usr/ports/news</tt>. You'll find Cnews, INN, Trn, TIN and others there. For French-speaking people, the <tt/fr.comp.os.bsd/ group is for you. Ask your system administrator if you don't receive this group. </sect1> <sect1> <heading>Books on FreeBSD</heading> <p> There currently aren't any books written specifically for FreeBSD, although some people are supposedly working on some. The FreeBSD Documentation Project exists, you may contact (or better join them) on the <tt>doc</tt> mailing list: <url url="mailto:doc@FreeBSD.ORG" name="<doc@FreeBSD.ORG>">. A FreeBSD ``handbook'' is being created, and can be found as: <url url="http://www.freebsd.org/How/handbook/" name="FreeBSD's Handbook"> Note that this is a work in progress, and so parts may be incomplete. However, as FreeBSD 2.X is based upon Berkeley 4.4BSD-Lite, most of the 4.4BSD manuals are applicable to FreeBSD 2.X. O'Reilly and Associates publishes these manuals: 4.4BSD System Manager's Manual <newline> By Computer Systems Research Group, UC Berkeley <newline> 1st Edition June 1994, 804 pages <newline> ISBN: 1-56592-080-5 <NEWLINE> 4.4BSD User's Reference Manual <newline> By Computer Systems Research Group, UC Berkeley <newline> 1st Edition June 1994, 905 pages <newline> ISBN: 1-56592-075-9 <NEWLINE> 4.4BSD User's Supplementary Documents <newline> By Computer Systems Research Group, UC Berkeley <newline> 1st Edition July 1994, 712 pages <newline> ISBN: 1-56592-076-7 <NEWLINE> 4.4BSD Programmer's Reference Manual <newline> By Computer Systems Research Group, UC Berkeley <newline> 1st Edition June 1994, 886 pages <newline> ISBN: 1-56592-078-3 <NEWLINE> 4.4BSD Programmer's Supplementary Documents <newline> By Computer Systems Research Group, UC Berkeley <newline> 1st Edition July 1994, 596 pages <newline> ISBN: 1-56592-079-1 <NEWLINE> A description of these can be found via WWW as: <url url="http://gnn.com/gnn/bus/ora/category/bsd.html" name="4.4BSD books description"> A good book on system administration is: Evi Nemeth, Garth Snyder, Scott Seebass & Trent R. Hein,<newline> ``Unix System Administration Handbook'', Prentice-Hall, 1995<newline> ISBN: 0-13-151051-7<newline> <bf/NOTE/ make sure you get the second edition, with a red cover, instead of the first edition. This book covers the basics, as well as TCP/IP, DNS, NFS, SLIP/PPP, sendmail, INN/NNTP, printing, etc.. It's expensive (approx. US$45-$55), but worth it. It also includes a CDROM with the sources for various tools; most of these, however, are also on the FreeBSD 2.1.0R CDROM (and the FreeBSD CDROM often has newer versions). <sect1> <heading>Other sources of information.</heading> <p> One good source of additional information is the ``[comp.unix.bsd] NetBSD, FreeBSD, and 386BSD (0.1) FAQ''. Much of the information is relevant to FreeBSD, and this FAQ is posted around twice a month to the following newsgroups: <verb> comp.unix.bsd.netbsd.announce comp.unix.bsd.freebsd.announce comp.answers news.answers </verb> If you have WWW access, the FreeBSD home page is at: <url url="http://www.freebsd.org/" name="Main FreeBSD page"> The FreeBSD handbook has a pretty complete bibliography, look at: <url url="http://www.FreeBSD.ORG/How/handbook/bibliography.html" name="Bibliography"> <sect> <heading>FreeBSD goals</heading> <p> <sect1> <heading>Copyrights</heading> <p> The goals of the FreeBSD Project are to provide software that may be used for any purpose and without strings attached. Many of us have a significant investment in the code (and project) and would certainly not mind a little financial renumeration now and then, but we're definitely not prepared to insist on it. We believe that our first and foremost "mission" is to provide code to any and all comers, and for whatever purpose, so that the code gets the widest possible use and provides the widest possible benefit. This is, I believe, one of the most fundamental goals of Free Software and one that we enthusiastically support. That code in our source tree which falls under the GNU Public License (GPL) or GNU Library Public License (GLPL) comes with slightly more strings attached, though at least on the side of enforced access rather than the usual opposite. Due to the additional complexities that can evolve in the commercial use of GPL software, - we do, however, endevor to replace such software with submissions + we do, however, endeavor to replace such software with submissions under the more relaxed BSD copyright whenever possible. <sect> <heading>Installation</heading> <p> <sect1> <heading>How do I install FreeBSD?</heading> <p> <bf/IMPORTANT NOTE/ if you are installing 2.1.0R from tape, see the question titled, <ref id="install-tape" name="Help! I can't install from tape!"> Installation instructions can be found as: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/2.1.0-RELEASE/INSTALL" name="INSTALL from 2.1.0R"> Release notes are also available as: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/2.1.0-RELEASE/RELNOTES" name="RELNOTES from 2.1.0R"> On the CDROM, the following files are in the top-most directory: <verb> INSTALL -- Installation instructions README.TXT -- Basic README file RELNOTES -- Release notes </verb> <sect1> <heading>I have only 4 MB of memory in this machine. Can I install FreeBSD 2.1.0 ?</heading> <p> FreeBSD 2.1.0 does not install with 4 MB. To be exact: it does not install with 640 kB base + 3 MB extended memory. If your motherboard can remap some of the ``lost'' memory out of the 640kB to 1MB region, then you may still be able to get FreeBSD 2.1.0 up. Try to go into your BIOS setup and look for a ``remap'' option. Enable it. You may also have to disable ROM shadowing. It may be easier to get 4 more MB just for the install. Build a custom kernel with only the options you need and then get the 4 MB out again. You may also install 2.0.5 and then upgrade your system to 2.1.0 with the ``upgrade'' option of the 2.1.0 installation program. After the installation, if you build a custom kernel, it will run - in 4 MB. Someone has even succeded in booting with 2 MB (the + in 4 MB. Someone has even succeeded in booting with 2 MB (the system was almost unusable though :-)) <sect1> <heading>Help! I have no space! Do I need to delete everything first?</heading> <p> If your machine is already running DOS and has little or no free space available for FreeBSD's installation, all is not lost! You may find the ``<tt/FIPS/'' utility, provided in the <tt>tools/</tt> subdirectory on the FreeBSD CDROM or on the various FreeBSD ftp sites, to be quite useful. FIPS allows you to split an existing DOS partition into two pieces, preserving the original partition and allowing you to install onto the second free piece. You first ``defrag'' your DOS partition, using the DOS 6.xx <tt/DEFRAG/ utility or the Norton Disk tools, then run <tt/FIPS/. It will prompt you for the rest of the information it needs. Afterwards, you can reboot and install FreeBSD on the new free slice. See the Distributions menu for an estimation of how much free space you'll need for the kind of installation you want. <sect1> <heading>I have installed Windows 95 on to my home PC, and I want to also install FreeBSD.</heading> <p> Install Windows 95 first, after that FreeBSD. FreeBSD's boot manager will then manage to boot Win95 and FreeBSD. <sect1> <heading>Can I use compressed DOS filesystems from FreeBSD?</heading> <p> No. If you are using a utility such as Stacker(tm) or DoubleSpace(tm), FreeBSD will only be able to use whatever portion of the filesystem you leave uncompressed. The rest of the filesystem will show up as one large file (the stacked/dblspaced file!). <bf/DO NOT REMOVE THAT FILE!/ You will probably regret it greatly! It is probably better to create another uncompressed DOS primary partition and use this for communications between DOS and FreeBSD. <sect1> <heading>Can I mount my DOS extended partitions?</heading> <p> This feature isn't in FreeBSD 2.1 but should be in 2.2. We've laid all the groundwork for making this happen, now we just need to do the last 1% of the work involved. <sect1> <heading>Can I run DOS binaries under FreeBSD?</heading> <p> Not yet! We'd like to add support for this someday, but are still lacking anyone to actually do the work. Ongoing work with Linux's <tt/DOSEMU/ utility may bring this much closer to being a reality sometime soon. Send mail to <url url="mailto:hackers@freebsd.org" name="The FreeBSD hackers list"> if you're interested in joining this effort! However, there is a neat utility called ``<tt/pcemu/'' in the ports collection which emulates an 8088 and enough BIOS services to run DOS text mode applications. It requires the X Window System (provided as XFree86 3.1.2). <sect1> <heading>Help! I can't install from tape! The install fails with a ``record too big'' error!<label id="install-tape"></heading> <p> If you are installing 2.1.0R from tape, you must create the tape using a tar blocksize of 10 (5120 bytes). The default tar blocksize is 20 (10240 bytes), and tapes created using this default size cannot be used to install 2.1.0R; with these tapes, you will get an error that complains about the record size being too big. <sect1> <heading>I want to install FreeBSD onto a SCSI disk that has more than 1024 cylinders. How do I do it?</heading> <p> This depends. If you don't have DOS (or another operating system) on the system, you can just keep the drive in native mode and simply make sure that your root partition is below 1024 so the BIOS can boot the kernel from it. It you also have DOS/some other OS on the drive then your best bet is to find out what parameters that it thinks you have before installing FreeBSD. When FreeBSD's installation procedure prompts you for these values, you should then enter them rather than simply going with the defaults. There is a freely available utility distributed with FreeBSD called ``<tt/pfdisk/'' (located in the <tt>tools/dos-tools</tt> subdirectory) which can be used for this purpose. <sect1> <heading>I want to install my laptop with PLIP (Parallel Line IP). How's the cable ? <p> Connect the two computers using a Laplink parallel cable to use this feature: <verb> +----------------------------------------+ |A-name A-End B-End Descr. Port/Bit | +----------------------------------------+ |DATA0 2 15 Data 0/0x01 | |-ERROR 15 2 1/0x08 | +----------------------------------------+ |DATA1 3 13 Data 0/0x02 | |+SLCT 13 3 1/0x10 | +----------------------------------------+ |DATA2 4 12 Data 0/0x04 | |+PE 12 4 1/0x20 | +----------------------------------------+ |DATA3 5 10 Strobe 0/0x08 | |-ACK 10 5 1/0x40 | +----------------------------------------+ |DATA4 6 11 Data 0/0x10 | |BUSY 11 6 1/0x80 | +----------------------------------------+ |GND 18-25 18-25 GND - | +----------------------------------------+ </verb> <sect1> <heading>When I boot FreeBSD it says ``Missing Operating System''.</heading> <p> See question above. This is classically a case of FreeBSD and DOS or some other OS conflicting over their ideas of disk geometry. You will have to reinstall FreeBSD, but obeying the instructions given above will almost always get you going. <sect1> <heading>When I install the boot manager and try to boot FreeBSD for the first time, it just comes back with the boot manager prompt again.</heading> <p> This is another symptom of the problem described in the preceding question. Your BIOS geometry and FreeBSD geometry settings do not agree! If your controller or BIOS supports cylinder translation (often marked as ``>1GB drive support''), try toggling its setting and reinstalling FreeBSD. <sect1> <heading>I'm having lots of trouble trying to disklabel a new SCSI drive.</heading> <p>I have made an entry in <tt>/etc/disktab</tt>, but when I try to label the drive the following happens: <verb> mips# disklabel -w /dev/sd1 sea32550N disklabel: ioctl DIOCWDINFO: Operation not supported by device </verb> What am I doing wrong? Answer:<newline> Doing this using <tt/disklabel/ (and <tt/fdisk/) is probably harder than using <tt/sysinstall/. The following should work to put FreeBSD-2.1.0 on the whole of an <bf/empty/ disk assuming that the <tt/disktab/ entry is correct. <verb> disklabel -r -w /dev/rsd1 sea32550N ^^ ^ </verb> The first <tt/-r/ is essential for writing new labels and using the raw device instead of the block device is good technique. To be ``empty'' the disk should have 0's at critical points on the first two sectors. In particular, the 2 byte signature at the end of the first sector must not be <tt/0xaa55/ or the disk will be interpreted as having a slice (partition) table and it will be difficult to write to it where you want unless the slice table is initialized correctly. All bootable hard disks will have the <tt/0xaa55/ signature so they won't be empty. Empty disks may be created by copying zeros over the first 2 sectors: <verb> dd if=/dev/zero of=/dev/rsd1 bs=1k count=1 </verb> Note that this will (appear to) destroy all data on the disk. The above is not the best method. Normally you will have a slice table or a label that you want to preserve or modify slightly. This can be done using <verb> fdisk -u /dev/rsd1 # install or change slice table disklabel -r -w sd1 sea32550N # install label ^no /dev/r </verb> <tt/fdisk/ is unintuitive and has poor error handling so it is difficult to change slice tables using it. However, to install a new slice table on an empty drive you just have to accept all the defaults except for ``n'' to write at the end. Note that the <tt/sd1/ drive in the above is different from <tt>/dev/rsd1</tt>. <tt/disklabel/ modifies path names that don't start with a slash by prefixing <tt>/dev/r</tt> and suffixing the ``raw'' partition letter. <tt/sd1/ thus means <tt>/dev/rsd1c</tt>, i.e., the ``<tt/c/'' partition on the first BSD slice on drive <tt/sd1/, i.e., the whole of the first BSD slice on drive sd1, while <tt>/dev/rsd1</tt> is the whole of drive sd1. Thus ``<tt>disklabel ... sd1</tt>'' will fail if there is no FreeBSD slice, while ``<tt>disklabel /dev/rsd1</tt>'' will print the in-core label for the whole drive. Oops, this assumes that slices are enabled by the 0xaa55 signature. If slices aren't enabled, then /dev/rsd1c means the whole drive. In practice, slices have to be enabled to make the disk bootable. If there are no BSD slices, then <tt>/dev/rsd1c</tt> will be empty instead of unconfigured and attempts to label <tt/sd1/ will fail with a bogus error message about <tt>/dev/rsd1c</tt> not existing. <tt>/dev/sd1</tt> didn't exist in previous versions of FreeBSD or 386BSD so your ``<tt>disklabel -w /dev/sd1 ...</tt>'' would have printed a less confusing error message before failing. <verb> The disklabel I'm trying is sea32550N|Seagate 32550N:\ :ty=winchester:dt=SCSI:se#512:nc#3510:nt#11:ns#108:\ :rm#7200:\ :pa#2433024:oa#0:ta=4.2BSD:\ :pc#4169880:oc#0: </verb> Note that <tt/ns/ has to be < 64 in the slice table. I would use <tt/nt#22:ns#54/. This only matters if you don't accept <tt/fdisk/'s default (bogus) slice table. You have to use a valid table if you want multiple slices, or the first slice starting at a nonzero offset. Starting a nonempty slice at offset 0 is invalid so <tt/sysinstall/ doesn't support creating such slices. <sect1> <heading>I have an IDE drive with lots of bad blocks on it and FreeBSD doesn't seem to install properly.</heading> <p> FreeBSD's bad block (the ``<tt/bad144/'' command) handling is still not 100% (to put it charitably) and it must unfortunately be said that if you've got an IDE or ESDI drive with lots of bad blocks, then FreeBSD is probably not for you! That said, it does work on thousands of IDE based systems, so you'd do well to try it first before simply giving up. IDE drives are <em/supposed/ to come with built-in bad-block remapping; if you have documentation for your drive, you may want to see if this feature has been disabled on your drive. However, ESDI, RLL, and ST-506 drives normally do not do this. <sect1> <heading>I have 32MB of memory, should I expect any special problems?<label id="bigram"></heading> <p> No. FreeBSD 2.X comes with bounce buffers which allows your bus mastering controller access to greater than 16MB. <sect1> <heading>My network card keeps getting errors like, ``<tt/ed1: timeout/''. What's going on?</heading> <p> This is usually caused by an interrupt conflict (e.g., two boards using the same IRQ). FreeBSD prior to 2.0.5R used to be tolerant of this, and the network driver would still function in the presence of IRQ conflicts. However, with 2.0.5R and later, IRQ conflicts are no longer tolerated. <sect1> <heading>Do I need to install the complete sources?</heading> <p> In general, no. However, we would strongly recommend that you install, at a minimum, the ``<tt/base/'' source kit, which includes several of the files mentioned here, and the ``<tt/sys/'' (kernel) source kit, which includes sources for the kernel. There is nothing in the system which requires the presence of the sources to operate, however, except for the kernel-configuration program <tt/config(8)/. With the exception of the kernel sources, our build structure is set up so that you can read-only mount the sources from elsewhere via NFS and still be able to make new binaries. (Because of the kernel-source restriction, we recommend that you not mount this on <tt>/usr/src</tt> directly, but rather in some other location with appropriate symbolic links to duplicate the top-level structure of the source tree.) Having the sources on-line and knowing how to build a system with them will make it much easier for you to upgrade to future releases of FreeBSD. <sect1> <heading>DES encryption software can not be exported from the United States. If I live outside the US, how can I encrypt passwords?</heading> <p> If it is not absolutely imperative that you use DES style encryption, you can use FreeBSD's default encryption for even <bf/better/ security, and with no export restrictions. FreeBSD 2.0's password default scrambler is now <bf/MD5/-based, and is more CPU-intensive to crack with an automated password cracker than DES. Since the DES encryption algorithm cannot legally be exported from the US, non-US users should not download this software (as part of the <tt/secrdist/ from US FTP sites. There is however a replacement libcrypt available, based on sources written in Australia by David Burren. This code is now available on some non-US FreeBSD mirror sites. Sources for the unencumbered libcrypt, and binaries of the programs which use it, can be obtained from the following FTP sites: <descrip> <tag/South Africa/ <tt>ftp://ftp.internat.freebsd.org/pub/FreeBSD</tt><newline> <tt>ftp://storm.sea.uct.ac.za/pub/FreeBSD</tt> <tag/Brazil/ <tt>ftp://ftp.iqm.unicamp.br/pub/FreeBSD</tt> <tag/Finland/ <tt>ftp://nic.funet.fi/pub/unix/FreeBSD/eurocrypt</tt> </descrip> The non-US <tt/securedist/ can be used as a direct replacement for the encumbered US <tt/securedist/. This <tt/securedist/ package is installed the same way as the US package (see installation notes for details). If you are going to install DES encryption, you should do so as soon as possible, before installing other software. Non-US users should please not download any encryption software from the USA. This can get the maintainers of the sites from which the software is downloaded into severe legal difficulties. A non-US distribution of Kerberos is also being developed, and current versions can generally be obtained by anonymous FTP from <tt>braae.ru.ac.za</tt>. There is a mailing list for the discussion of non-US encryption software. For more information, send an email message with a single line saying ``<tt/help/'' in the body of your message to <tt><majordomo@braae.ru.ac.za></tt>. </sect1> </sect> <sect> <heading>Hardware compatibility <label id="hardware"></heading> <p> <sect1> <heading>What kind of hard drives does FreeBSD run on?</heading> <p> FreeBSD supports ST-506 (sometimes called ``MFM''), RLL, and ESDI drives, which are usually connected to WD-1002, WD-1003, or WD-1006/7 controllers (although clones should also work). FreeBSD also supports IDE and SCSI hard drives. <sect1> <heading>What SCSI controllers are supported?</heading> <p> FreeBSD supports the following SCSI controllers: <descrip> <tag/Adaptec/ AH-152x Series <ISA> <newline> AH-154x Series <ISA> <newline> AH-174x Series <EISA> <newline> Sound Blaster SCSI (AH-152x compat) <ISA> <newline> AH-2742/2842 Series <ISA/EISA> <newline> AH-2820/2822/2825 Series (Narrow/Twin/Wide) <VLB> <newline> AH-294x and aic7870 MB controllers (Narrow/Twin/Wide) <PCI><newline> AH-394x (Narrow/Twin/Wide) <tag/Buslogic/ BT-445 Series <VLB> (but see section <ref id="bigram" name="on 32 MB machines">) <newline> BT-545 Series <ISA> <newline> BT-742 Series <EISA><newline> BT-747 Series <EISA><newline> BT-946 Series <PCI> <newline> BT-956 Series <PCI> <newline> <tag/Future Domain/ TMC-950 Series <ISA> <newline> <tag/PCI Generic/ NCR 53C81x based controllers <PCI> <newline> NCR 53C82x based controllers <PCI> <newline> NCR 53C860/75 based controllers <PCI> <newline> <tag/ProAudioSpectrum/ Zilog 5380 based controllers <ISA> <newline> Trantor 130 based controllers <ISA> <newline> <tag/DTC/ DTC 3290 EISA SCSI in AHA-154x emulation.<newline> <tag/Seagate/ ST-01/02 Series <ISA><newline> <tag/UltraStor/ UH-14f Series <ISA><newline> UH-24f Series <EISA> <newline> UH-34f Series <VLB><newline> <tag/Western Digital/ WD7000 <ISA> <No scatter/gather> </descrip> <sect1> <heading>What CD-ROM drives are supported by FreeBSD?</heading> <p> Any SCSI drive connected to a supported controller. <itemize> <item>Mitsumi LU002 (8bit), LU005 (16bit) and FX001D (16bit 2x Speed). <item>Sony CDU 31/33A<newline> <item>Sound Blaster Non-SCSI CD-ROM<newline> <item>Matsushita/Panasonic CD-ROM<newline> <item>ATAPI compatible IDE CD-ROMs (should be considered <bf/experimental/) </itemize> All non-SCSI cards are known to be extremely slow compared to SCSI drives. <sect1> <heading>What multi-port serial cards are supported by FreeBSD?</heading> <p> <itemize> <item>AST/4 in shared IRQ mode, <item>ARNET 8 port in shared IRQ mode, - <item>BOCA 4/8/16 port cards inshared IRQ mode, + <item>BOCA 4/8/16 port cards in shared IRQ mode, <item>Cyclades 8/16 port <Alpha>, <item>Cronyx/Sigfgma multiport sync/async, <item>RISCom/8 multiport card, <item>STB 4 port i shared IRQ mode, </itemize> Some unnamed clone cards have also been known to work, especially those that claim to be AST compatible. - A Dibiboard driver is currently in alpha stage. If you want to + A Digiboard driver is currently in alpha stage. If you want to test it, take the file in <url url="ftp://freefall.FreeBSD.ORG/pub/incoming" name="the incoming directory"> Check the <tt/sio(4)/ man page to get more information on configuring such cards. <sect1> <heading>Does FreeBSD support the AHA-2xxx SCSI adapters from Adaptec?</heading> <p> FreeBSD supports the AHA-2xxx line of disks. The GPL portions of the old drivers have been re-written and now it is fully under the Berkeley style copyright. <sect1> <heading>I have a Mumbleco bus mouse. Is it supported and if so, how do I set it up for XFree86?</heading> <p> FreeBSD supports the Logitech and ATI Inport bus mice. You need to add the following line to the kernel config file and recompile for the Logitech and ATI mice: <verb> device mse0 at isa? port 0x23c tty irq5 vector mseintr </verb> <sect1> <heading>I have a PS/2 mouse (``keyboard'' mouse) (Alternatively: I have a laptop with a track-ball mouse). How do I use it?</heading> <p> You'll have to add the following lines to your kernel configuration file and recompile: <verb> device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr # Options for psm: options PSM_NO_RESET #don't reset mouse hardware (some laptops) </verb> <p> See <url url="http://www.freebsd.org/handbook/kernelconfig.html" name="configuring the kernel"> if you've no experience with building kernels. Once you have a kernel detecting psm0 correctly at boot time, make sure that an entry for psm0 exists in /dev. You can do this by typing: <verb> cd /dev; sh MAKEDEV psm0 </verb> When logged in as root. <p> Note: Some PS/2 mouse controllers have a problem where the presence of the psm0 driver will cause the keyboard to lock up (which is why this driver is not present by default in the GENERIC kernel). This can sometimes be fixed by bouncing the NumLock key during the boot process. The real fix is, of course, to merge the PS/2 mouse driver with syscons. Any volunteers? :) <sect1> <heading>What types of tape drives are supported under FreeBSD?</heading> <p> FreeBSD supports SCSI, QIC-02 and QIC-40/80 (Floppy based) tape drives. This includes 8-mm (aka Exabyte) and DAT drives. <sect1> <heading>What sound cards are supported by FreeBSD?</heading> <p> FreeBSD supports the SoundBlaster, SoundBlaster Pro, SoundBlaster 16, Pro Audio Spectrum 16, AdLib and Gravis UltraSound sound cards. There is also limited support for MPU-401 and compatible MIDI cards. The SoundBlaster 16 ASP cards are not yet supported. The Microsoft Sound System is also supported. <bf/NOTE/ This is only for sound! This driver does not support CD-ROMs, SCSI or joysticks on these cards. <sect1> <heading>What network cards does FreeBSD support?</heading> <p> There is support for the following cards: <descrip> <tag/``de'' driver/ DEC DC21x40 and compatible PCI controllers<newline> (including 21140 100bT cards) <newline> <tag/``ed'' driver/ NE2000 and 1000<newline> WD/SMC 8003, 8013 and Elite Ultra (8216)<newline> 3Com 3c503 <newline> And clones of the above <newline> <tag/``le'' driver/ DEC EtherWORKS II and EtherWORKS III controllers. <newline> <tag/``ie'' driver/ AT&T EN100/StarLAN 10 <newline> 3COM 3c507 Etherlink 16/TP<newline> NI5210 <newline> <tag/``is'' driver/ Isolan AT 4141-0 <newline> Isolink 4110 <newline> <tag/``el'' driver/ 3com 3c501 (does not support Multicast or DMA) <tag/``eg'' driver/ 3com 3c505 Etherlink/+ <tag/``ze'' driver/ IBM PCMCIA credit card adapter <tag/``lnc'' drive/ Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL)(*) <tag/``ep'' driver/ 3com 3c509 <tag/``ix'' driver/ Intel InterExpress <tag/``cx'' driver/ Cronyx/Sigma multiport Sync/Async (Cisco and PPP framing) <tag/``zp'' driver/ 3Com PCMCIA Etherlink III (aka 3c589) <tag/``fea'' driver/ DEC DEFEA EISA FDDI controller <tag/``fpa'' driver/ DEC DEFPA PCI FDDI controller <tag/``fe'' driver/ Fujitsu MB86960A/MB86965A Ethernet cards </descrip> - <bf/NOTE/ PCMCIA ethernet cards from IBM and National + <bf/NOTE/ PCMCIA Ethernet cards from IBM and National Semiconductor. <bf/NOTE/ Drivers marked with (*) are known to have problems. <bf/NOTE/ We also support TCP/IP over parallel lines. At this point - we are incompatiable with other versions, but we hope to correct + we are incompatible with other versions, but we hope to correct this in the near future. <sect1> <heading>I have a 386/486sx/486SLC machine without a math co-processor. Will this cause me any problems?</heading> <p> Generally no, but there are circumstances where you will take a hit, either in performance or accuracy of the math emulation code (see the section <ref id="emul" name="on FP emulation">). In particular, drawing arcs in X will be VERY slow. It is highly recommended that you buy a math co-processor; it's well worth it. <bf/NOTE/ Some math co-processors are better than others. It pains us to say it, but nobody ever got fired for buying Intel. Unless you're sure it works with FreeBSD, beware of clones. <sect1> <heading>What other devices does 2.X support?</heading> <p> Here is a listing of drivers that do not fit into any of the above areas. <descrip> <tag><tt/b004.c/</tag> - Driver for B004 compatiable Transputer boards <newline> + Driver for B004 compatible Transputer boards <newline> <tag>``ctx'' driver</tag> Driver for CORTEX-I Frame grabber <newline> <tag>``gp'' driver</tag> Driver for National Instruments AT-GPIB and<newline> AT-GPIB/TNT boards <tag>``pca'' driver</tag> Driver for PC speakers to allow the playing of audio files <tag>``spigot'' driver</tag> Driver for the Creative Labs Video Spigot <tag>``gsc'' driver</tag> Driver for the Genuis GS-4500 Hand scanner <tag>``joy'' driver</tag> Driver for a joystick <tag/``labpc'' driver/ Driver for National Instrument's Lab-PC and Lab-PC+ <tag/``uart'' driver/ Stand-alone 6850 UART for MIDI <tag/``nic'' driver/ Dr Neuhaus NICCY 3008, 3009 & 5000 ISDN cards <tag/``psm'' driver/ PS/2 mouse port <tag><tt/tw.c/</tag> Driver for the X-10 POWERHOUSE <newline> </descrip> <sect1> <heading>I am about to buy a new machine to run FreeBSD on and want an idea of what other people are running. Is there list of other systems anywhere?</heading> <p> Yes. Please look at the file <tt>Systems.FAQ</tt>. This file is a listing of hardware that people are running in their machines. Please note, this is a raw listing of equipment that other users have sent in, and does not constitute any kind of endorsement by the FreeBSD Project. <sect1> <heading>I have a lap-top with power management. Can FreeBSD take advantage of this?</heading> <p> Yes it can on certain machines. Please look in the <tt/LINT/ kernel config file under <tt/APM/. <sect> <heading>Commercial Applications</heading> <p> <bf/NOTE/ This section is still very sparse, though we're hoping, of course, that companies will add to it! :) The FreeBSD group has no financial interest in any of the companies listed here but simply lists them as a public service (and feels that commercial interest in FreeBSD can have very positive effects on FreeBSD's long-term viability). We encourage commercial software vendors to send their entries here for inclusion. <sect1> <heading>Where can I get Motif for FreeBSD?</heading> <p> Contact the following company: Lasermoon Ltd<newline> 2a Beaconsfield Road<newline> Fareham, Hants<newline> England. PO16 0QB<newline> Phone: +44 (01) 329 834944<newline> FAX: +44 (0) 329 825936<newline> Email: <url url="mailto:info@lasermoon.co.uk" name="Info Address"> <sect1> <heading>Are there any commercial X servers for some of the high-end graphics cards like the Matrox or #9 I-128, or offering 8/16/24 bit deep pallettes?<label id="xinside"></heading> <p> Yes, X Inside Incorporated sells their Accelerated-X product for FreeBSD and other Intel based systems. This high performance X Server offers easy configuration, support for multiple concurrent video boards and is distributed in binary form only. Price is $99.50 (promotional price for Linux/FreeBSD version) for the 1.1 version, which is available now. This product is for FreeBSD 1.1 and runs under 2.0 with the FreeBSD 1.1 compatibility libs (``<tt/compat1xdist/''). <descrip> <tag/More info/ <url url="http://www.xinside.com/" name="X inside WWW page"> <tag/or/ <url url="ftp://ftp.xinside.com/accelx/1.1/prodinfo.txt" name="Products information"> <tag/or/ <url url="mailto:info@xinside.com" name="Info E-mail address"> <tag/or/ phone +1 (303) 298-7478. </descrip> <sect1> <heading>Are there any Database systems for FreeBSD?</heading> <p> Yes! Conetic Software Systems has ported their C/base and C/books - datebase systems to FreeBSD 2.0.5 and higher. + database systems to FreeBSD 2.0.5 and higher. <descrip> <tag/For more information/ <url url="http://www.conetic.com/" name="Conetic Software Systems"> <tag/or mail/ <url url="mailto:info@conetic.com" name="Information E-mail address"> </descrip> <sect1> <heading>Any other applications I might be interested in?</heading> <p> RenderMorphics, Ltd. sells a high-speed 3D rendering package for FreeBSD called ``Reality Lab'' (tm). Send email to <url url="mailto:info@render.com" name="info@render.com"> or call: +44(0)71-251-4411 / FAX: +44(0)71-251-0939 This package is also for FreeBSD 1.1.5 but has been tested and shown to run under FreeBSD 2.0 with the ``<tt/compat1xdist/'' installed. Thanks must be extended to all of these companies for showing enough faith in FreeBSD to port their products to it. While we get no direct benefit from the sales of these products, the indirect benefits of FreeBSD proving itself to be a successful platform for such commercial interests will be immense! We wish these companies every measure of success, and can only hope that others are encouraged to follow suit. </sect1> <sect> <heading>User Applications</heading> <sect1> <heading>I want to run X, how do I go about it?</heading> <p> First, get the XFree86(tm) distribution of X11R6 from <tt/XFree86.cdrom.com/ The version you want for FreeBSD 2.X and later is <tt/XFree86 3.1.1/. Follow the instructions for installation carefully. You may then wish to read the documentation for the <tt/ConfigXF86/ tool, which assists you in configuring XFree86(tm) for your particular graphics card/mouse/etc. You may also wish to investigate the Xaccel server, which is available at a very reasonable price. See section <ref id="xinside" name="on Xaccel"> for more details. <sect1> <heading>I've been trying to run ghostscript on a 386 (or 486sx) with no math co-processor and I keep getting errors. What's up?<label id="emul"></heading> <p> You will need to add the alternate math emulator to your kernel, you do this by adding the following to your kernel config file and it will be compiled in. <verb> options GPL_MATH_EMULATE </verb> <bf/NOTE/ You will need to remove the <tt/MATH_EMULATE/ option when you do this. <sect1> <heading>I want all this neat software, but I haven't got the space or CPU power to compile it all myself. Is there any way of getting binaries?</heading> <p> Yes. We support the concept of a ``package'', which is essentially a gzipped binary distribution with a little extra intelligence embedded in it for doing any custom installation - work required. Packages can also be installed or deinstalled + work required. Packages can also be installed or uninstalled again easily without having to know the gory details. CDROM people will have a <tt>packages/</tt> directory on their CD, others can get the currently available packages from: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages" name="FreeBSD's packages"> Note that all ports may not be available as packages, and that new packages are constantly being added. It is always a good idea to check periodically to see which packages are available. A <tt/README/ file in the packages directory provides more details on the care and feeding of the package software, so no explicit details will be given here. <sect1> <heading>I'm trying to get a SCO/iBCS2 application to run, it keeps bombing about <tt/socksys/. How do I set this up ?</heading> <p> You first need to edit the <tt>/etc/sysconfig</tt> in the last section to change the following variable to <tt/YES/: <code> # Set to YES if you want ibcs2 (SCO) emulation loaded at startup ibcs2=NO </code> It will load the <tt/ibcs2/ kernel module at startup. You'll then need to set up /compat/ibcs2/dev to look like: <code> lrwxr-xr-x 1 root wheel 9 Oct 15 22:20 X0R@ -> /dev/null lrwxr-xr-x 1 root wheel 7 Oct 15 22:20 nfsd@ -> socksys -rw-rw-r-- 1 root wheel 0 Oct 28 12:02 null lrwxr-xr-x 1 root wheel 9 Oct 15 22:20 socksys@ -> /dev/null crw-rw-rw- 1 root wheel 41, 1 Oct 15 22:14 spx </code> You just need socksys to go to <tt>/dev/null</tt> to fake the open & close. The code in -current will handle the rest. This is much cleaner than the way it was done before. If you want the <tt/spx/ driver for a local socket X connection, define <tt/SPX_HACK/ when you compile the system. <sect> <heading>Miscellaneous Questions</heading> <p> <sect1> <heading>Why does FreeBSD consume far more swap space than Linux?</heading> <p> It doesn't. You might mean ``why does my swap seem full?''. If that is what you really meant, it's because putting stuff in swap rather than discarding it makes it faster to recover than if the pager had to go through the file system to pull in clean (unmodified) blocks from an executable. The actual amount of dirty pages that you can have in core at once is not reduced; the clean pages are displaced as necessary. <sect1> <heading>Hey! Chmod doesn't change the file permissions of symlinked files! What's going on?</heading> <p> You have to use either ``<tt/-H/'' or ``<tt/-L/'' together with the ``<tt/-R/'' option to make this work. See the <tt/chmod(1)/ and <tt/symlink(7)/ man pages for more info. <bf/WARNING/ the ``<tt/-R/'' option does a <bf/RECURSIVE/ <tt/chmod/. Be careful about specifying directories or symlinks to directories to <tt/chmod/. If you want to change the permissions of a directory referenced by a symlink, use <tt/chmod(1)/ without any options and follow the symlink with a trailing slash (``<tt>/</tt>''). For example, if ``<tt/foo/'' is a symlink to directory ``<tt/bar/'', and you want to change the permissions of ``<tt/foo/'' (actually ``<tt/bar/''), you would do something like: <verb> chmod 555 foo/ </verb> With the trailing slash, <tt/chmod/ will follow the symlink, ``<tt/foo/'', to change the permissions of the directory, ``<tt/bar/''. <sect1> <heading>How do I mount a CDROM? I've tried using <tt/mount(8)/, but it keeps on giving me an error like, ``<tt>/dev/cd0a on /mnt: Incorrect super block.</tt>''</heading> <p> You have to tell <tt/mount(8)/ the type of the device that you want to mount. By default, <tt/mount(8)/ will assume the filesystem is of type ``<tt/ufs/''. You want to mount a CDROM filesystem, and you do this by specifying the ``<tt/-t cd9660/'' option to <tt/mount(8)/. This does, of course, assume that the CDROM contains an ISO 9660 filesystem, which is what most CDROMs have. As of 1.1R, FreeBSD also understands the Rock Ridge (long filename) extensions. As an example, if you want to mount the CDROM device, ``<tt>/dev/cd0c</tt>'', under <tt>/mnt</tt>, you would execute: <verb> mount -t cd9660 /dev/cd0c /mnt </verb> Note that your device name (``<tt>/dev/cd0c</tt>'' in this example) could be different, depending on the CDROM interface. Note that the ``<tt/-t cd9660/'' option just causes the ``<tt/mount_cd9660/'' command to be executed, and so the above example could be shortened to: <verb> mount_cd9660 /dev/cd0c /mnt </verb> <sect1> <heading>When I try to mount a CDROM, I get a ``Device not configured'' error. What's going on?</heading> <p> This generally means that there is no CDROM in the CDROM drive. Feed the drive something. <sect1> <heading>My programs occasionally die with ``Signal 11'' errors. What's going on?</heading> <p> This can be caused by bad hardware (memory, motherboard, etc.). Try running a memory-testing program on your PC. Note that, even though every memory testing program you try will report your memory as being fine, it's possible for slightly marginal memory to pass all memory tests, yet fail under operating conditions (such as during busmastering DMA from a SCSI controller like the Adaptec 1542). <sect1> <heading>Help, some of my X Window menus and dialog boxes don't work right! I can't select them.</heading> <p> Try turning off the Num Lock key. If your Num Lock key is on by default at boot-time, you may add the following line in the ``<tt/Keyboard/'' section of the <tt/XF86config/ file. <verb> # Let the server do the NumLock processing. This should only be required # when using pre-R6 clients ServerNumLock </verb> <sect1> <heading>How do I access the virtual consoles?</heading> <p> If the console is not currently displaying X Window, just press Alt-F1 to Alt-F12. <bf/NOTE/ the default FreeBSD installation has only three (3) virtual consoles enabled, and so only Alt-F1, Alt-F2, and Alt-F3 will work to switch between three virtual consoles. If you want to increase this number, see the next question. If the console is currently displaying X Window, you can use Ctrl-Alt-F1, etc. to switch to a virtual console. Note, however, that once you've switched away from X Window to a virtual terminal, you use only the Alt- function key to switch to another virtual terminal or back to X Window. You do not also press the Ctrl key; the Ctrl-Alt-function key combination is used only when switching from X Window to a virtual terminal. <sect1> <heading>How do I increase the number of virtual consoles?</heading> <p> Edit <tt>/etc/ttys</tt> and add entries for ``<tt/ttyv4/'' to ``<tt/ttyvc/'' after the comment on ``Virtual terminals'' (delete the leading whitespace in the following example): <verb> # Edit the existing entry for ttyv3 in /etc/ttys and change # "off" to "on". ttyv3 "/usr/libexec/getty Pc" cons25 on secure ttyv4 "/usr/libexec/getty Pc" cons25 on secure ttyv5 "/usr/libexec/getty Pc" cons25 on secure ttyv6 "/usr/libexec/getty Pc" cons25 on secure ttyv7 "/usr/libexec/getty Pc" cons25 on secure ttyv8 "/usr/libexec/getty Pc" cons25 on secure ttyv9 "/usr/libexec/getty Pc" cons25 on secure ttyva "/usr/libexec/getty Pc" cons25 on secure ttyvb "/usr/libexec/getty Pc" cons25 on secure </verb> Use as many or as few as you want. The more virtual terminals you have, the more resources that are used; this can be important if you have 8MB RAM or less. You may also want to change the ``<tt/secure/'' to ``<tt/insecure/''. <bf/IMPORTANT NOTE/ if you want to run X Window, you <bf/MUST/ leave a virtual terminal unused (or turned off). For example, if you want to attach a virtual terminal to all of your twelve Alt-function keys, you can only attach virtual terminals to eleven of them. The last must be left unused, because X Windows will use it, and you will use the last Alt-function key to switch back to X Window (after you have switched from X Window to a virtual console via a Ctrl-Alt-function key). The easiest way to do this is to disable a console by turning it off. For example, if you have a keyboard with twelve function keys, you would change settings for virtual terminal 12 from: <verb> ttyvb "/usr/libexec/getty Pc" cons25 on secure </verb> to: <verb> ttyvb "/usr/libexec/getty Pc" cons25 off secure </verb> If your keyboard has only ten function keys, you would end up with: <verb> ttyv9 "/usr/libexec/getty Pc" cons25 off secure ttyva "/usr/libexec/getty Pc" cons25 off secure ttyvb "/usr/libexec/getty Pc" cons25 off secure </verb> (You could also just delete these lines.) Once you have edited <tt>/etc/ttys</tt>, the next step is to make sure that you have enough virtual terminal devices. The easiest way to do this is: <verb> cd /dev ./MAKEDEV vty12 # For 12 devices </verb> Next, the easiest (and cleanest) way to activate the virtual consoles is to reboot. However, if you really don't want to reboot, you can just shut down X Window and execute (as <tt/root/): <verb> kill -HUP 1 </verb> It's imperative that you completely shut down X Window if it is running, before running this command. If you don't, your system will probably appear to hang/lock up after executing the kill command. <sect1> <heading>I've heard of something called FreeBSD-current. How do I run it, and where can I get more information?</heading> <p> Read this: <url url="http://www.freebsd.org/How/handbook/current.html" - name="Handook's section of FreeBSD-CURRENT"> + name="Handbook's section of FreeBSD-CURRENT"> it will tell you all you need to know. <sect1> <heading>What is this thing called ``<tt/sup/'', and how do I use it?</heading> <p> SUP stands for Software Update Protocol, and was developed by CMU for keeping their development trees in sync. We use it to keep remote sites in sync with our central development sources. - Unless you have direct internet connectivity, and don't care too + Unless you have direct Internet connectivity, and don't care too much about the cost/duration of the sessions, you shouldn't use sup. For those ``low/expensive-bandwidth'' applications, we have developed <tt/CTM/, see the section <ref id="ctm" name="on CTM"> for more about that. - To use it, you need to have direct internet connectivity (not + To use it, you need to have direct Internet connectivity (not just mail or news). First, pick up the <tt/sup.tgz/ package from: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages/sup.tgz" name="The SUP package"> Second, read the <url url="http://www.freebsd.org/How/handbook/sup.html" name="Handbook's section on SUP"> This file describes how to setup sup on your machine. You may also want to look at <tt>/usr/src/share/examples/sup/*-supfile</tt>, or you may grab updated supfiles from: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FAQ/extras" name="Updated SUP files"> which are a set of supfiles for supping from <tt/FreeBSD.ORG/. <sect1> - <heading>Has anyone done any temperature testing while running FreeBSD? I know linux runs cooler than dos, but have never seen a mention of FreeBSD. It seems to run really hot</heading> + <heading>Has anyone done any temperature testing while running FreeBSD? I know Linux runs cooler than dos, but have never seen a mention of FreeBSD. It seems to run really hot</heading> <p> No, but we have done numerous taste tests on blindfolded volunteers who have also had 250 micrograms of LSD-25 administered beforehand. 35% of the volunteers said that FreeBSD tasted sort of orange, whereas Linux tasted like purple haze. Neither group mentioned any particular variances in temperature that I can remember. We eventually had to throw the results of this survey out entirely anyway when we found that too many volunteers were wandering out of the room during the tests, thus skewing the results. I think most of the volunteers are at Apple now, working on their new ``scratch and sniff'' GUI. It's a funny old business we're in! Seriously, Linux use the ``<tt/HALT/'' instruction when the - system is idle thus lowering its energy comsumption and therefore + system is idle thus lowering its energy consumption and therefore the heat it generates. <sect1> <heading>Is there anything "odd" that FreeBSD does when compiling the kernel which would cause the memory to make a scratchy sound? When compiling (and for a brief moment after recognizing the floppy drive upon startup, as well), a strange scratchy sound emanates from what appears to be the memory banks.</heading> <p> Yes! You'll see frequent references to ``daemons'' in the BSD documentation, and what most people don't know is that this refers to genuine, non-corporeal entities that now possess your computer. The scratchy sound coming from your memory is actually high-pitched whispering exchanged among the daemons as they best decide how to deal with various system administration tasks. If the noise gets to you, a good ``<tt>fdisk /mbr</tt>'' from DOS will get rid of them, but don't be surprised if they react adversely and try to stop you. In fact, if at any point during the exercise you hear the satanic voice of Bill Gates coming from the built-in speaker, take off running and don't ever look back! Freed from the counterbalancing influence of the BSD daemons, the twin demons of DOS and Windows are often able to re-assert total control over your machine to the eternal damnation of your soul. Given a choice, I think I'd prefer to get used to the scratchy noises, myself! <sect1> <heading>How do I create customized installation disks that I can give out to other people at my site?</heading> <p> The entire process of creating installation disks and source and binary archives is automated by various targets in <tt>/usr/src/release/Makefile</tt>. The information there should be enough to get you started. <sect1> <heading>How do I re-build my system without clobbering the existing installed binaries?</heading> <p> If you define the environment variable <tt/DESTDIR/ while running ``<tt/make world/'' or ``<tt/make install/'', the newly-created binaries will be deposited in a directory tree identical to the installed one, rooted at <tt>${DESTDIR}</tt>. Some random combination of shared libraries modifications and program rebuilds can cause this to fail in ``<tt/make world/'', however. <sect1> <heading>When my system booted, it told me that ``(bus speed defaulted)''. What does that mean?</heading> <p> The Adaptec 1542 SCSI host adapters allow the user to configure their bus access speed in software. Previous versions of the 1542 driver tried to determine the fastest usable speed and set the adapter to that. We found that this breaks some users' systems, so you now have to define the ``<tt/TUNE_1542/'' kernel configuration option in order to have this take place. Using it on those systems where it works may make your disks run faster, but on those systems where it doesn't, your data could be corrupted. <sect1> <heading>I would like to track changes to current and do not have net access. Is there any way besides downloading the whole tree?<label id="ctm"></heading> <p> Yes, you can use the <tt/CTM/ facility. Check out the <url url="http://www.freebsd.org/How/handbook/handbook/ctm.html" name="Handbook's section on for CTM"> for more information. <sect1> <heading>How do I split up large binary files into smaller 240k files like the distribution does?</heading> <p> Newer BSD based systems have a ``<tt/-b/'' option to split that - allows them to split files on arbitary byte bondaries. + allows them to split files on arbitrary byte boundaries. Here is an example from <tt>/usr/src/Makefile</tt>. <verb> bin-tarball: (cd ${DISTDIR}; \ tar cf - . \ gzip --no-name -9 -c | \ split -b 240640 - \ ${RELEASEDIR}/tarballs/bindist/bin_tgz.) </verb> <sect1> <heading><XXX> I've had a couple of system panics and would like to be able browse the system dumps. The normal kernel is stripped and I don't want to run a bloated kernel. What can I do?</heading> <sect1> <heading>I've got this neato kernel extension I just know everyone will will want. How do I get it included into the distribution?</heading> <p> - Please take a look at the FAQ for submiting code to FreeBSD at: + Please take a look at the FAQ for submitting code to FreeBSD at: <url url="http://www.FreeBSD.ORG/How/handbook/submitters.html" - name="Handbbook's section on how to submit code">. + name="Handbook's section on how to submit code">. And thanks for the thought. </sect1> <sect> <heading>Kernel Configuration</heading> <p> <sect1> <heading>Ok, so how DO I compile my own kernel, anyway?<label id="make-kernel"></heading> <p> Before you can compile a kernel, you need either the complete <tt/srcdist/ or, at the minimum, the <tt/kerndist/ loaded on your system. This provides the necessary sources for building the kernel, as we have a policy of <bf/NOT/ shipping our kernels in linkable object form as most commercial UNIX vendors do. Shipping the source takes a bit more space, but it also means that you can refer to the actual kernel sources in case of difficulty or to further your understanding of what's <bf/actually/ happening. Anyway, to answer the question, once you have the <tt/kerndist/ or <tt/srcdist/ loaded, do this: <enum> <item> <tt>cd /usr/src/sys/i386/conf</tt> <item> <tt/cp GENERIC MYKERNEL/ <item> <tt/vi MYKERNEL/ <item> <tt/config MYKERNEL/ <item> <tt>cd ../../compile/MYKERNEL</tt> <item> <tt/make depend/ <item> <tt/make all/ <item> <tt/make install/ <item> <tt/reboot/ </enum> Step 2 may not be necessary if you already have a kernel configuration file from a previous release of FreeBSD 2.X. - simply bring your old one over and check it carefully for any drivers that may have changed boot syntax or been rendered obsolete. A good kernel config file to look into is <tt/LINT/, which contains entries for <bf/all/ possible kernel options and documents them fairly well. The <tt/GENERIC/ kernel config file is used to build the initial release you probably loaded (unless you upgraded in-place) and contains entries for the most common configurations. It's a pretty good place to start from. If you don't need to make any changes to <tt/GENERIC/, you can also skip step 3, where you customize the kernel for your configuration. Step 7 should only be undertaken if step 6 succeeds. This will copy the new kernel image to <tt>/kernel</tt> and <bf/BACK UP YOUR OLD ONE IN/ <tt>/kernel.old</tt>! It's very important to remember this in case the new kernel fails to work for some reason - you can still select <tt>/kernel.old</tt> at the boot prompt to boot the old one. When you reboot, the new kernel will boot by default. If the compile in 6 falls over for some reason, then it's recommended that you start from step 4 but substitute <tt/GENERIC/ for <tt/MYKERNEL/. If you can generate a <tt/GENERIC/ kernel, then it's likely something in your special configuration file that's bad (or you've uncovered a bug!). If the build of the <tt/GENERIC/ kernel does <bf/NOT/ succeed, then it's very likely that your sources are somehow corrupted. Finally, if you need to see your original boot messages again to compile a new kernel that's better tailored to your hardware, try the <tt/dmesg(8)/ command. It should print out all the boot-time messages printed by your old kernel, some of which may be quite helpful in configuring the new one. <sect1> - <heading>I don't understand, I have removed <tt/npx0/ from my kernel configuration file as I don't have a mathematic coprocessor but it keeps bombing saying that <tt/_hw_float/ is missing.</heading> + <heading>I don't understand, I have removed <tt/npx0/ from my kernel configuration file as I don't have a mathematic co-processor but it keeps bombing saying that <tt/_hw_float/ is missing.</heading> <p> The <tt/npx0/ is <bf/MANDATORY/. Even if you don't have a - mathematic coprocessor, you <bf/must/ include the <tt/npx0/ + mathematic co-processor, you <bf/must/ include the <tt/npx0/ device. <sect1> <heading>When I compile a kernel with multi-port serial code, it tells me that only the first port is probed and the rest skipped due to interrupt conflicts. How do I fix this?</heading> <p> The problem here is that FreeBSD has code built-in to keep the kernel from getting trashed due t hardware or software conflicts. The way to fix this is to leave out the IRQ settings on other ports besides the first. Here is a example: <verb> # # Multiport high-speed serial line - 16550 UARTS # device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr </verb> <sect1> <heading>FreeBSD is supposed to come with support for QIC-40/80 drives but when I look, I can't find it.</heading> <p> You need to uncomment the following line in the generic config file (or add it to your config file), add a ``<tt/flags 0x1/'' on the <tt/fdc/ line and recompile. <verb> controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 flags 0x1 vector fdintr disk fd0 at fdc0 drive 0 ^^^^^^^^^ disk fd1 at fdc0 drive 1 #tape ft0 at fdc0 drive 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ </verb> Next, you create a device called <tt>/dev/ft0</tt> by going into <tt>/dev</tt> and run the following command: <verb> sh MAKEDEV ft0 </verb> for the first device. <tt/ft1/ for a second one and so on. You will have a device called <tt>/dev/ft0</tt>, which you can write to through a special program to manage it called ``<tt/ft/'' - see the man page on <tt/ft/ for further details. Versions previous to <tt/-current/ also had some trouble dealing - wiht bad tape media; if you have trouble where <tt/ft/ seems to + with bad tape media; if you have trouble where <tt/ft/ seems to go back and forth over the same spot, try grabbing the latest version of <tt/ft/ from <tt>/usr/src/sbin/ft</tt> in <tt/-current/ and try that. <sect1> <heading>Does FreeBSD support IPC primitives like those in System V?</heading> <p> Yes, FreeBSD supports System V-style IPC. This includes shared memory, messages and semaphores. You need to add the following lines to your kernel config to enable them. <verb> options SYSVSHM options "SHMMAXPGS=64" # 256Kb of sharable memory options SYSVSEM # enable for semaphores options SYSVMSG # enable for messaging </verb> Recompile and install. <sect1> <heading>I have 128 MB of RAM but it seems that the system use only the first 64 MB. What's going on ?</heading> <p> Due to the manner in which FreeBSD gets the memory size from the BIOS, it can only detect 16 bits worth of Kbytes in size (65535 Kbytes = 64MB). If you have more than 64MB, FreeBSD will only see the first 64MB. To work around this problem, you need to use the kernel option specified below. There is a way to get complete memory information from the BIOS, but we don't have room in the bootblocks to do it. Someday when lack of room in the bootblocks is fixed, we'll use the extended BIOS functions to get the full memory information...but for now we're stuck with the kernel option. <code> options "MAXMEM=<n>" </code> Where <tt/n/ is your memory in Kilobytes. For a 128 MB machine, you'd want to use <tt/131072/ <sect1> <heading>Sometimes my FreeBSD 2.0 reboots saying: ``Panic: kmem_map (or mb_map) too small !''. <p> The panic indicates that the system ran out of virtual memory for network buffers (specifically, mbuf clusters). You can increase - the amount of VM avaliable for mbuf clusters by adding: + the amount of VM available for mbuf clusters by adding: <code> options "NMBCLUSTERS=<n>" </code> to your kernel config file, where <n> is a number in the range 512-4096, depending on the number of concurrent TCP connections you need to support. I'd recommend trying 2048 - this should get rid of the panic completely. You can monitor the number of mbuf clusters allocated/in use on the system with <tt/netstat -m/. <sect1> <heading>Will FreeBSD ever support other architectures?</heading> <p> Several different groups have expressed interest in working on multi-architecture support for FreeBSD. If you are interested in doing so, please contact the developers at <tt><platforms@FreeBSD.ORG></tt> for more information on our strategy for porting. <sect1> <heading>I just wrote a device driver for a Foobar Systems, Inc. Integrated Adaptive Gronkulator card. How do I get the appropriate major numbers assigned?</heading> <p> This depends on whether or not you plan on making the driver publicly available. If you do, then please send us a copy of the driver source code, plus the appropriate modifications to <tt>files.i386</tt>, a sample configuration file entry, and the appropriate <tt>MAKEDEV</tt> code to create any special files your device uses. If you do not, or are unable to because of licensing restrictions, then character major number 32 and block major number 8 have been reserved specifically for this purpose; please use them. In any case, we'd appreciate hearing about your driver on <tt><hackers@FreeBSD.ORG></tt>. </sect1> <sect> <heading>System Administration</heading> <sect1> <heading>Hmm, where are my familiar BSD system files ? What's this <tt>/etc/sysconfig</tt> thing?</heading> <p> As for 2.0.5R, the primary configuration file is <tt>/etc/sysconfig</tt>. All the options are to be specified in this one and the other one (<tt>/etc/rc</tt> and <tt>/etc/netstart</tt>) just include it. Look in the <tt>/etc/sysconfig</tt> file and change the value to match your system. This file is filled with comments to show what to put in there. The <tt>/etc/rc.local</tt> is here as always and is the place to put additional services like <tt/INN/ or a <tt/http/ server. The <tt>/etc/rc.serial</tt> is for serial port initialization - (e.g. locking the port characterictics, and so on.). + (e.g. locking the port characteristics, and so on.). The <tt>/etc/rc.i386</tt> is for Intel-specifics setting like the iBCS2 emulation. Starting with 2.1.0R, you can have "local" startup files in a directory specified in <tt>/etc/sysconfig</tt>: <verb> # Location of local startup files. local_startup=/usr/local/etc/rc.local.d </verb> Each file ending in <tt/.sh/ will be executed in alphabetic order. If you want to have a proper order without changing all the file names, you can use a scheme similar to the following with digits prepended to each file name to insure order: <verb> 10news.sh 15httpd.sh 20ssh.sh </verb> It can be seen as ugly (or SysV :-)) but it provides a simple and regular scheme for locally-added packages without resorting to magical editing of <tt>/etc/rc.local</tt>. <sect1> <heading>How do I add a user easily? I read the man page and am more confused than ever!</heading> <p> Use the <tt/adduser/ command. There is another package called ``<tt/new-account/'' also written in Perl by Ollivier Robert. Ask <tt><roberto@FreeBSD.ORG></tt> about it. It is currently under further development. <sect1> <heading>I'm trying to use my printer and keep running into problems. I tried looking at <tt>/etc/printcap</tt>, but it's close to useless. Any ideas?</heading> <p> Please have a look at the section of the Handbook on printing. It should cover most of your problem. See <url url="http://www.freebsd.org/How/handbook/printing.html" name="Handbook's section on printing"> </sect1> <sect1> <heading>My keyboard mappings are wrong for my system. How can I fix them?</heading> <p> The kbdcontrol program has an option to load a keyboard map file. Under <tt>/usr/share/syscons/keymaps</tt> are a number of map files. Choose the one relevant to your system and load it. <verb> kbdcontrol -l uk.iso </verb> Both the <tt>/usr/share/syscons/keymaps</tt> and the <tt/.kbd/ extension are assumed by <tt/kbdcontrol(1)/. This can be configured in <tt>/etc/sysconfig</tt>. See the appropriate comments in tis file. In 2.0.5R and later, everything related to text fonts, keyboard mapping is in <tt>/usr/share/examples/syscons</tt>. The following mappings are currently supported: <itemize> <item>Danish (both ISO and cp865), <item>French (ISO only), <item>German (both ISO and cp850), <item>Russian, <item>Swedish (both ISO and cp850), <item>U.K. (both ISO and cp850), <item>Spain, <item>U.S.A. (ISO only), <item>Dvorak US. </itemize> </sect1> <sect1> <heading>Why do I get a ``CMAP busy panic during boot just after installing a new kernel?</heading> <p> The logic that attempts to detect an out of data <tt>/var/db/kvm_*.db</tt> files sometimes fails and using a mismatched file can sometimes lead to panics. If this happens, reboot single-user and do: <verb> rm /var/db/kvm_*.db </verb> <sect1> <heading>I'm trying to use quotas for my users and it keeps bombing...</heading> <p> <enum> <item>Don't turn on quotas on '/', <item>Put the quota file on the file system that the quotas are to be enforced on. ie: <verb> FS QUOTA FILE /usr /usr/admin/quotas /home /home/admin/quotas ... </verb> </enum> <sect> <heading>Networking</heading> <sect1> <heading>Where can I get information booting FreeBSD ``diskless'', that is booting and running a FreeBSD box from a server rather than having a local disk?</heading> <p> Please read the diskless section in the Handbook. It is in <tt>/usr/share/doc/handbook</tt> or use the following WWW link: <url url="http://www.FreeBSD.ORG/How/handbook/diskless.html" name="Handbook's section on diskless boot"> <sect1> <heading>I've heard that you can use a FreeBSD box as a dedicated network router - is there any easy support for this?</heading> <p> Internet standards and good engineering practice prohibit us from providing packet forwarding by default in FreeBSD. You can however enable this feature by changing the following variable to <tt/YES/ in <tt>/etc/sysconfig</tt>: <verb> # If you want this host to be a gateway, set to YES. gateway=YES </verb> This option will put the <tt/sysctl/ variable <tt/net.inet.ip.forwarding/ to <tt/1/. In most cases, you will also need to run a routing process to tell other systems on your network about your router; FreeBSD comes with the standard BSD routing daemon <tt/routed(8)/, or for more complex situations you may want to try <em/GaTeD/ (available by FTP from <tt/ftp.gated.Merit.EDU/) which supports FreeBSD as of 3_5Alpha7. It is our duty to warn you that, even when FreeBSD is configured in this way, it does not completely comply with the Internet standard requirements for routers; however, it comes close enough for ordinary usage. <sect1> <heading>Does FreeBSD support SLIP and PPP?</heading> <p> Yes. See the man pages for <tt/slattach(8)/ and/or <tt/pppd(8)/ if you're using FreeBSD to connect to another site. If you're using FreeBSD as a server for other machines, look at the man page for <tt/sliplogin(8)/. You can also have a look at the SLIP/PPP/Use PPP sections of the handbook in <tt>/usr/share/doc/handbook</tt> or use the following links: <url url="http://www.FreeBSD.ORG/How/handbook/slips.html" name="Handbook's section on SLIP (server side)"> <url url="http://www.FreeBSD.ORG/How/handbook/slipc.html" name="Handbook's section on SLIP (client side)"> <url url="http://www.FreeBSD.ORG/How/handbook/ppp.html" name="Handbook's section on PPP (kernel version)"> <url url="http://www.FreeBSD.ORG/How/handbook/userppp.html" name="Handbook's section on SLIP (user-mode version)"> <sect1> <heading>How do I get my network set up? I don't see how to make my <tt>/dev/ed0</tt> device!</heading> <p> In the Berkeley networking framework, network interfaces are only directly accessible by kernel code. Please see the <tt>/etc/netstart</tt> file and the manual pages for the various network programs mentioned there for more information. If this leaves you totally confused, then you should pick up a book describing network administration on another BSD-related operating system; with few significant exceptions, administering networking on FreeBSD is basically the same as on SunOS 4.0 or Ultrix. <sect1> <heading>How can I setup Ethernet aliases ? It always says: ``File exists''.</heading> <p> Add ``<tt/netmask 0xffffffff/'' to your <tt/ifconfig/ command-line like the following: <verb> ifconfig ed0 alias 204.141.95.2 netmask 0xffffffff </verb> <sect1> <heading>How do I get my 3C503 to use the other network port?</heading> <p> If you want to use the other ports, you'll have to specify an additional parameter on the <tt/ifconfig(1)/ command line. The default port is ``<tt/link0/''. To use the AUI port instead of the BNC one, use ``<tt/link2/''. <sect1> <heading>I'm having problems with NFS to/from FreeBSD and my Wuffotronics Workstation / generic NFS appliance, where should I look first?</heading> <p> Certain PC network cards are better than others (to put it mildly) and can sometimes cause problems with network intensive applications like NFS. See <url url="http://www.freebsd.org/How/handbook/nfs.html" name="Handbook's section NFS"> for more information on this topic. <sect1> <heading>Why can't I NFS-mount from a Linux box?</heading> <p> Some versions of the Linux NFS code only accept mount requests - from a priviledged port; try + from a privileged port; try <verb> mount -o -P linuxbox:/blah /mnt </verb> <sect1> <heading>Why can't I NFS-mount from a Sun box?</heading> <p> Sun workstations running SunOS 4.X only accept mount requests - from a priviledged port; try + from a privileged port; try <verb> mount -o -P sunbox:/blah /mnt </verb> - <sect1><heading>I'm having problems with my NeXTStep machines and other FreeBSD ones accross PPP</heading> + <sect1><heading>I'm having problems with my NeXTStep machines and other FreeBSD ones across PPP</heading> <p> - Try disabling the TCP extentions in <tt>/etc/sysconfig</tt> by + Try disabling the TCP extensions in <tt>/etc/sysconfig</tt> by changing the following variable to NO: <verb> tcp_extensions=NO </verb> <sect1> <heading>I want to enable IP multicast support on my FreeBSD box, how do I do it? (Alternatively: What the heck IS multicasting and what applications make use of it?)</heading> <p> Multicast host operations are fully supported in FreeBSD 2.0 by default. If you want your box to run as a multicast router, you will need to load the <tt/ip_mroute_mod/ loadable kernel module and run <tt/mrouted/. For more information: <verb> Product Description Where --------------- ----------------------- --------------------------------------- faq.txt Mbone FAQ ftp.isi.edu:/mbone/faq.txt imm/immserv IMage Multicast ftp.hawaii.edu:/paccom/imm.src.tar.Z for jpg/gif images. nv Network Video. ftp.parc.xerox.com: /pub/net-reseach/exp/nv3.3alpha.tar.Z vat LBL Visual Audio Tool. ftp.ee.lbl.gov: /conferencing/vat/i386-vat.tar.Z wb LBL White Board. ftp.ee.lbl.gov: /conferencing/wb/i386-wb.tar.Z mmcc MultiMedia Conference ftp.isi.edu: Control program /confctrl/mmcc/mmcc-intel.tar.Z rtpqual Tools for testing the ftp.psc.edu:/pub/net_tools/rtpqual.c quality of RTP packets. vat_nv_record Recording tools for vat ftp.sics.se:archive/vat_nv_record.tar.Z and nv. </verb> </sect1> <sect1> <heading>The 2.1.0R release notes speaks of network card based on the DEC PCI chipset, what are they ?</heading> <p> Here is a list compiled by Glen Foster <tt/<gfoster@driver.nsta.org>/: <code> Vendor Model - -------------------------------------------------------- ASUS PCI-L101-TB Accton ENI1203 Cogent EM960PCI Compex ENET32-PCI D-Link DE-530 DEC DE435 Danpex EN-9400P3 JCIS Condor JC1260 Linksys EtherPCI Mylex LNP101 SMC EtherPower 10/100 (Model 9332) SMC EtherPower (Model 8432) TopWare TE-3500P Zynx ZX342 </code> <sect> <heading>Serial Communications</heading> <p> This section answers common questions about serial communications with FreeBSD. <sect1> <heading>How do I tell if FreeBSD found my serial ports or modem cards?</heading> <p> As the FreeBSD kernel boots, it will probe for the serial ports in your system for which the kernel was configured. You can either watch your system closely for the messages it prints or run the command <verb> dmesg | grep sio </verb> after your system's up and running. Here's some example output from the above command: <verb> sio0 at 0x3f8-0x3ff irq 4 on isa sio0: type 16550A sio1 at 0x2f8-0x2ff irq 3 on isa sio1: type 16550A </verb> This shows two serial ports. The first is on irq 4, is using port address <tt/0x3f8/, and has a 16550A-type UART chip. The second uses the same kind of chip but is on irq 3 and is at port address <tt/0x2f8/. Internal modem cards are treated just like serial ports---except that they always have a modem ``attached'' to the port. The <tt/GENERIC/ kernel includes support for two serial ports using the same irq and port address settings in the above example. If these settings aren't right for your system, or if you've added modem cards or have more serial ports than your kernel is configured for, just reconfigure your kernel. See section <ref id="make-kernel" name="about building a kernel"> for more details. <sect1> <heading>Hey, I just upgraded to 2.0.5 and my <tt/tty0X/ are missing!</heading> <p> Don't worry, they have been merged with the <tt/ttydX/ devices. You'll have to change old configuration files. <sect1> <heading>How do I access the serial ports once FreeBSD is running?</heading> <p> The third serial port, <tt/sio2/ (known as COM3 in DOS), is on <tt>/dev/cuaa2</tt> for dial-out devices, and on <tt>/dev/ttyd2</tt> for dial-in devices. What's the difference between these two classes of devices? You use <tt/ttydX/ for dial-ins. When opening <tt>/dev/ttydX</tt> in blocking mode, a process will wait for the corresponding <tt/cuaaX/ device to become inactive, and then wait for the carrier detect line to go active. When you open the <tt/cuaaX/ device, it makes sure the serial port isn't already in use by the <tt/ttydX/ device. If the port's available, it ``steals'' it from the <tt/ttydX/ device. Also, the <tt/cuaXX/ device doesn't care about carrier detect. With this scheme and an auto-answer modem, you can have remote users log in and you can still dialout with the same modem and the system will take care of all the conflicts. <sect1> <heading>How do I configure the kernel for my multiport serial card?</heading> <p> Again, the section on kernel configuration provides information about configuring your kernel. For a multiport serial card, place an <tt/sio/ line for each serial port on the card in the kernel configuration file. But place the irq and vector specifiers on only one of the entries. All of the ports on the card should share one irq. For consistency, use the last serial port to specify the irq. Also, specify the <tt/COM_MULTIPORT/ option. The following example is for an AST 4-port serial card on irq 7: <verb> options "COM_MULTIPORT" device sio4 at isa? port 0x2a0 tty flags 0x781 device sio5 at isa? port 0x2a8 tty flags 0x781 device sio6 at isa? port 0x2b0 tty flags 0x781 device sio7 at isa? port 0x2b8 tty flags 0x781 irq 7 vector siointr </verb> The flags indicate that the master port has minor number 7 (<tt/0x700/), diagnostics enabled during probe (<tt/0x080/), and all the ports share an irq (<tt/0x001/). <sect1> <heading>I have two multiport serial cards that can share irqs. Can FreeBSD handle this?</heading> <p> Not yet. You'll have to use a different irq for each card. <sect1> <heading>What's the difference between <tt/ttyd1/, <tt/ttyid1/, and <tt/ttyld1/? Or, how can I set the default serial parameters for a port?</heading> <p> The <tt/ttydX/ (or <tt/cuaaX/) device is the regular device you'll want to open for your applications. When a process opens the device, it'll have a default set of terminal I/O settings. You can see these settings with the command <verb> stty -a -f /dev/ttyd1 </verb> When you change the settings to this device, the settings are in effect until the device is closed. When it's reopened, it goes back to the default set. To make changes to the default set, you can open and adjust the settings of the ``initial state'' device. For example, to turn on <tt/CLOCAL/ mode, 8 bits, and <tt>XON/XOFF</tt> flow control by default for ttyd5, do: <verb> stty -f /dev/ttyid5 clocal cs8 ixon ixoff </verb> A good place to do this is in <tt>/etc/rc.serial</tt>. Now, an application will have these settings by default when it opens <tt/ttyd5/. It can still change these settings to its liking, though. You can also prevent certain settings from being changed by an application by making adjustments to the ``lock state'' device. For example, to lock the speed of <tt/ttyd5/ to 57600 bps, do <verb> stty -f /dev/ttyld5 57600 </verb> Now, an application that opens <tt/ttyd5/ and tries to change the speed of the port will be stuck with 57600 bps. Naturally, you should make the initial state and lock state devices writable only by <tt/root/. The <tt/MAKEDEV/ script does <bf/NOT/ do this when it creates the device entries. <sect1> <heading>How can I enable dialup logins on my modem?</heading> <p> So you want to become an Internet service provider, eh? First, - you'll need one or more modems that can autoanswer. Your modem + you'll need one or more modems that can auto-answer. Your modem will need to assert carrier-detect when it detects a carrier and not assert it all the time. It will need to hang up the phone and reset itself when the data terminal ready (<tt/DTR/) line goes from on to off. It should probably use <tt>RTS/CTS</tt> flow control or no local flow control at all. Finally, it must use a constant speed between the computer and itself, but (to be nice to your callers) it should negotiate a speed between itself and the remote modem. For many Hayes command-set--compatible modems, this command will make these settings and store them in nonvolatile memory: <verb> AT &ero;C1 &ero;D3 &ero;K3 &ero;Q6 S0=1 &ero;W </verb> See the section <ref id="direct-at" name="on sending AT commands"> below for information on how to make these settings without resorting to an MS-DOS terminal program. Next, make an entry in <tt>/etc/ttys</tt> for the modem. This file lists all the ports on which the operating system will await logins. Add a line that looks something like this: <verb> ttyd1 "/usr/libexec/getty std.57600" dialup on insecure </verb> This line indicates that the second serial port (<tt>/dev/ttyd1</tt>) has a modem connected running at 57600 bps and no parity (<tt/std.57600/, which comes from the file <tt>/etc/gettytab</tt>). The terminal type for this port is ``dialup.'' The port is ``on'' and is ``insecure''---meaning root logins on the port aren't allowed. For dialin ports like this one, use the <tt/ttydX/ entry. It's common practice to use ``dialup'' as the terminal type. Many users set up in their .profile or .login files a prompt for the actual terminal type if the starting type is dialup. The example shows the port as insecure. To become root on this port, you have to login as a regular user, then ``<tt/su/'' to <tt/root/. If you use ``secure'' then <tt/root/ can login in directly. After making modifications to <tt>/etc/ttys</tt>, you need to send a hangup or <tt/HUP/ signal to the <tt/init/ process: <verb> kill -1 1 </verb> This forces the init process to reread <tt>/etc/ttys</tt>. The init process will then start getty processes on all ``on'' ports. You can find out if logins are available for your port by typing <verb> ps -ax | grep '[t]tyd1' </verb> You should see something like: <verb> 747 ?? I 0:00.04 /usr/libexec/getty std.57600 ttyd1 </verb> <sect1> <heading>How can I make my spare computer a dumb terminal connected to my FreeBSD box?</heading> <p> If you're using another computer as a terminal into your FreeBSD system, get a null modem cable to go between the two serial ports. If you're using an actual terminal, see its accompanying instructions. Then, modify <tt>/etc/ttys</tt>, like above. For example, if you're hooking up a WYSE-50 terminal to the fifth serial port, use an entry like this: <verb> ttyd4 "/usr/libexec/getty std.38400" wyse50 on secure </verb> This example shows that the port on <tt>/dev/ttyd4</tt> has a wyse50 terminal connected at 38400 bps with no parity (<tt/std.38400/ from <tt>/etc/gettytab</tt>) and <tt/root/ logins are allowed (secure). <sect1> <heading>Why can't I run <tt/tip/ or <tt/cu/?</heading> <p> On your system, the programs <tt/tip/ and <tt/cu/ are probably executable only by <tt/uucp/ and group <tt/dialer/. You can use the group <tt/dialer/ to control who has access to your modem or remote systems. Just add yourself to group dialer. Alternatively, you can let everyone on your system run <tt/tip/ and <tt/cu/ by typing: <verb> chmod 4511 /usr/bin/tip </verb> You don't have to run this command for <tt/cu/, since <tt/cu/ is just a hard link to <tt/tip/. <sect1> <heading>My stock Hayes modem isn't supported---what should I do?</heading> <p> Actually, the man page for <tt/tip/ is out of date. There is a generic Hayes dialer already built in. Just use ``<tt/at=hayes/'' in your <tt>/etc/remote</tt> file. The Hayes driver isn't smart enough to recognize some of the advanced features of newer modems---messages like <tt/BUSY/, <tt/NO DIALTONE/, or <tt/CONNECT 115200/ will just confuse it. You should turn those messages off when you use <tt/tip/ (using <tt/ATX0&W/). Also, the dial timeout for <tt/tip/ is 60 seconds. Your modem should use something less, or else tip will think there's a communication problem. Try <tt/ATS7=45&W/. Actually, as shipped <tt/tip/ doesn't yet support it fully. The solution is to edit the file <tt/tipconf.h/ in the directory <tt>/usr/src/usr.bin/tip/tip</tt> Obviously you need the source distribution to do this. Edit the line ``<tt/#define HAYES 0/'' to ``<tt/#define HAYES 1/''. Then ``<tt/make/'' and ``<tt/make install/''. Everything works nicely after that. <sect1> <heading>How am I expected to enter these AT commands without resorting to some DOS-based terminal program?<label id="direct-at"></heading> <p> Make what's called a ``<tt/direct/'' entry in your <tt>/etc/remote</tt> file. For example, if your modem's hooked up to the first serial port, <tt>/dev/cuaa0</tt>, then put in the following line: <verb> cuaa0:dv=/dev/cuaa0:br#19200:pa=none </verb> Use the highest bps rate your modem supports in the br capability. Then, type ``<tt/tip cuaa0/'' and you'll be connected to your modem. If there is no <tt>/dev/cuaa0</tt> on your system, do this: <verb> cd /dev MAKEDEV cuaa0 </verb> <p> Or use cu as root with the following command: <verb> cu -l``line'' -s``speed'' </verb> with line being the serial port (e.g.<tt>/dev/cuaa0</tt>) and speed being the speed (e.g.<tt>57600</tt>). When you done entering the AT commands hit <tt>~.</tt> to exit. <sect1> <heading>Why doesn't the <tt/@/ sign for the phone number capability work?</heading> <p> The <tt/@/ sign in the pn capability tells tip to look in <tt>/etc/phones</tt> for a phone number. But the <tt/@/ sign is also a special character in capability files like <tt>/etc/remote</tt>. Escape it with a backslash: <verb> pn=\@ </verb> <sect1> <heading>How can I dial a phone number on the command line?</heading> <p> Put what's called a ``<tt/generic/'' entry in your <tt>/etc/remote</tt> file. For example: <verb> tip115200|Dial any phone number at 115200 bps:\ :dv=/dev/cuaa0:br#115200:at=hayes:pa=none:du: tip57600|Dial any phone number at 57600 bps:\ :dv=/dev/cuaa0:br#57600:at=hayes:pa=none:du: </verb> Then you can things like ``<tt/tip -115200 5551234/''. If you prefer <tt/cu/ over <tt/tip/, use a generic cu entry: <verb> cu115200|Use cu to dial any number at 115200bps:\ :dv=/dev/cuaa1:br#57600:at=hayes:pa=none:du: </verb> and type ``<tt/cu 5551234 -s 115200/''. <sect1> <heading>Great---but how can I do that without having to specify the bps rate on the command line?</heading> <p> Put in an entry for <tt/tip1200/ or <tt/cu1200/, but go ahead and use whatever bps rate is appropriate with the br capability. <tt/tip/ thinks a good default is 1200 bps which is why it looks for a ``<tt/tip1200/'' entry. You don't have to use 1200 bps, though. <sect1> <heading>I want separate entries for various hosts I access through a terminal server, but I don't want to type ``<tt/CONNECT <host>/'' each time once I'm connected. Can <tt/tip/ do that for me?</heading> <p> Yes. Use the <tt/cm/ capability. For example, these entries in <tt>/etc/remote</tt>: <verb> pain|pain.deep13.com|Forrester's machine:\ :cm=CONNECT pain\n:tc=deep13: muffin|muffin.deep13.com|Frank's machine:\ :cm=CONNECT muffin\n:tc=deep13: deep13:Gizmonics Institute terminal server:\ :dv=/dev/cua02:br#38400:at=hayes:du:pa=none:pn=5551234: </verb> will let you type ``<tt/tip pain/'' or ``<tt/tip muffin/'' to connect to the hosts pain or muffin; and ``<tt/tip deep13/'' to get to the terminal server. <sect1> <heading>My university has 42 billion students but only 4 modem lines. Can tip automatically try each line?</heading> <p> Sure. Make an entry for your university in <tt>/etc/remote</tt> and use <tt>\@</tt> for the <tt/pn/ capability: <verb> big-university:\ :pn=\@:tc=dialout dialout:\ :dv=/dev/cuaa3:br#9600:at=courier:du:pa=none: </verb> Then, list the phone numbers for the university in <tt>/etc/phones</tt>: <verb> big-university 5551111 big-university 5551112 big-university 5551113 big-university 5551114 </verb> <tt/tip/ will try each one in the listed order, then give up. If you want to keep retrying, run <tt/tip/ in a while loop. <sect1> <heading>How come I have to hit CTRL+P twice to send CTRL+P once?</heading> <p> CTRL+P is the default ``force'' character, used to tell <tt/tip/ that the next character is literal data. You can set the force character to any other character with the <tt/~s/ escape, which means ``set a variable.'' Type ``<tt/~sforce=<single-char>/'' followed by a newline. <tt/<single-char>/ is any single character. If you leave out <tt/<single-char>/, then the force character is the nul character, which you can get by typing CTRL+2 or CTRL+SPACE. A pretty good value for <tt/<single-char>/ is SHIFT+CTRL+6, which I've seen only used on some terminal servers. You can have the force character be whatever you want by specifying the following in your <tt>$HOME/.tiprc</tt> file: <verb> force=<single-char> </verb> <sect1> <heading>Suddenly everything I type is all UPPER CASE. What gives?</heading> <p> You must've pressed CTRL+A, <tt/tip/'s ``raise character,'' specially designed for people with broken caps-lock keys. Use <tt/~s/ as above and set the variable ``raisechar'' to something reasonable. In fact, you can set it to the same as the force character, if you never expect to use either of these features. Here's a sample .tiprc file perfect for Emacs users who need to type CTRL+2 and CTRL+A a lot: <verb> force=^^ raisechar=^^ </verb> The ^^ is SHIFT+CTRL+6. <sect1> <heading>How can I do file transfers with <tt/tip/?</heading> <p> If you're talking to another UNIX system, you can send and receive files with <tt/~p/ (put) and <tt/~t/ (take). These commands run ``<tt/cat/'' and ``<tt/echo/'' on the remote system to accept and send files. The syntax is: <verb> ~p <local-file> [<remote-file>] ~t <remote-file> [<local-file>] </verb> There's no error checking, so you probably should use another protocol, like zmodem. <sect1> <heading>Okay, how can I run zmodem with <tt/tip/?</heading> <p> To receive files, start the sending program on the remote end. Then, type ``<tt/~C rz/'' to begin receiving them locally. To send files, start the receiving program on the remote end. Then, type ``<tt/~C sz <files>/'' to send them to the remote system. </sect> <sect> <heading>ACKNOWLEDGMENTS</heading> <p> <code> If you see a problem with this FAQ, or wish to submit an entry, please mail us at <FAQ@FreeBSD.ORG>. We appreciate your feedback, and cannot make this a better FAQ without your help! FreeBSD Core Team </code> <descrip> <tag/Ollivier Robert/ FreeBSD FAQ maintenance man <tag/Gary Clark II/ FreeBSD Doc Team <tag/Jordan Hubbard/ Janitorial services (I don't do windows) <tag/Garrett Wollman/ Networking and formatting <tag/Jim Lowe/ Multicast information <tag/The FreeBSD Team/ Kvetching, moaning, submitting data </descrip> And to any others we've forgotten, apologies and heartfelt thanks! </article> diff --git a/handbook/authors.sgml b/handbook/authors.sgml index c38a552b17..d90d8c91e0 100644 --- a/handbook/authors.sgml +++ b/handbook/authors.sgml @@ -1,281 +1,281 @@ -<!-- $Id: authors.sgml,v 1.15 1996-01-20 16:19:17 jfieber Exp $ --> +<!-- $Id: authors.sgml,v 1.16 1996-01-31 14:25:56 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- -Names and email address of contributing authors and CVS commiters. Use these +Names and email address of contributing authors and CVS committers. Use these entities when referencing people. Please not the use of single and double quotes. --> <!ENTITY a.asami "Satoshi Asami <tt><htmlurl url='mailto:asami@FreeBSD.ORG' name='<asami@FreeBSD.ORG>'></tt>"> <!ENTITY a.awebster "Andrew Webster <tt><htmlurl url='mailto:awebster@dataradio.com' name='<awebster@dataradio.com>'></tt>"> <!ENTITY a.davidg "David Greenman <tt><htmlurl url='mailto:davidg@FreeBSD.ORG' name='<davidg@FreeBSD.ORG>'></tt>"> <!ENTITY a.dufault "Peter Dufault <tt><htmlurl url='mailto:dufault@FreeBSD.ORG' name='<dufault@FreeBSD.ORG>'></tt>"> <!ENTITY a.gclarkii "Gary Clark II <tt><htmlurl url='mailto:gclarkii@FreeBSD.ORG' name='<gclarkii@FreeBSD.ORG>'></tt>"> <!ENTITY a.gena "Gennady B. Sorokopud <tt><htmlurl url='mailto:gena@NetVision.net.il' name='<gena@NetVision.net.il>'></tt>"> <!ENTITY a.ghelmer "Guy Helmer <tt><htmlurl url='mailto:ghelmer@alpha.dsu.edu' name='<ghelmer@alpha.dsu.edu>'></tt>"> <!ENTITY a.gpalmer "Gary Palmer <tt><htmlurl url='mailto:gpalmer@FreeBSD.ORG' name='<gpalmer@FreeBSD.ORG>'></tt>"> <!ENTITY a.gryphon "Coranth Gryphon <tt><htmlurl url='mailto:gryphon@healer.com' name='<gryphon@healer.com>'></tt>"> <!ENTITY a.jehamby "Jake Hamby <tt><htmlurl url='mailto:jehamby@lightside.com' name='<jehamby@lightside.com>'></tt>"> <!ENTITY a.jfieber "John Fieber <tt><htmlurl url='mailto:jfieber@FreeBSD.ORG' name='<jfieber@FreeBSD.ORG>'></tt>"> <!ENTITY a.jkh "Jordan Hubbard <tt><htmlurl url='mailto:jkh@FreeBSD.ORG' name='<jkh@FreeBSD.ORG>'></tt>"> <!ENTITY a.joerg "Jörg Wunsch <tt><htmlurl url='mailto:joerg@FreeBSD.ORG' name='<joerg@FreeBSD.ORG>'></tt>"> <!ENTITY a.john "John Lind <tt><htmlurl url='mailto:john@starfire.MN.ORG' name='<john@starfire.MN.ORG>'></tt>"> <!ENTITY a.kelly "Sean Kelly <tt><htmlurl url='mailto:kelly@fsl.noaa.gov' name='<kelly@fsl.noaa.gov>'></tt>"> <!ENTITY a.md "Mark Dapoz <tt><htmlurl url='mailto:md@bsc.no' name='<md@bsc.no>'></tt>"> <!ENTITY a.nik "Nik Clayton <tt><htmlurl url='mailto:nik@blueberry.co.uk' name='<nik@blueberry.co.uk>'></tt>"> <!ENTITY a.phk "Poul-Henning Kamp <tt><htmlurl url='mailto:phk@FreeBSD.ORG' name='<phk@FreeBSD.ORG>'></tt>"> <!ENTITY a.paul "Paul Richards <tt><htmlurl url='mailto:paul@FreeBSD.ORG' name='<paul@FreeBSD.ORG>'></tt>"> <!ENTITY a.rgrimes "Rodney Grimes <tt><htmlurl url='mailto:rgrimes@FreeBSD.ORG' name='<rgrimes@FreeBSD.ORG>'></tt>"> <!ENTITY a.uhclem "Frank Durda IV <tt><htmlurl url='mailto:uhclem@FreeBSD.ORG' name='<uhclem@FreeBSD.ORG>'></tt>"> <!ENTITY a.whiteside "Don Whiteside <tt><htmlurl url='mailto:whiteside@acm.org' name='<whiteside@acm.org>'></tt>"> <!ENTITY a.wilko "Wilko Bulte <tt><htmlurl url='mailto:wilko@yedi.iaf.nl' name='<wilko@yedi.iaf.nl>'></tt>"> <!ENTITY a.wollman "Garrett Wollman <tt><htmlurl url='mailto:wollman@FreeBSD.ORG' name='<wollman@FreeBSD.ORG>'></tt>"> <!ENTITY a.peter "Peter Wemm <tt><htmlurl url='mailto:peter@FreeBSD.ORG' name='<peter@FreeBSD.ORG>'></tt>"> <!ENTITY a.dyson "John Dyson <tt><htmlurl url='mailto:dyson@FreeBSD.ORG' name='<dyson@FreeBSD.ORG>'></tt>"> <!ENTITY a.ache "Andrey A. Chernov <tt><htmlurl url='mailto:ache@FreeBSD.ORG' name='<ache@FreeBSD.ORG>'></tt>"> <!ENTITY a.gibbs "Justin T. Gibbs <tt><htmlurl url='mailto:gibbs@FreeBSD.ORG' name='<gibbs@FreeBSD.ORG>'></tt>"> <!ENTITY a.pst "Paul Traina <tt><htmlurl url='mailto:pst@FreeBSD.ORG' name='<pst@FreeBSD.ORG>'></tt>"> <!ENTITY a.sos "Søren Schmidt <tt><htmlurl url='mailto:sos@FreeBSD.ORG' name='<sos@FreeBSD.ORG>'></tt>"> <!ENTITY a.nate "Nate Williams <tt><htmlurl url='mailto:nate@FreeBSD.ORG' name='<nate@FreeBSD.ORG>'></tt>"> <!ENTITY a.karl "Karl Strickland <tt><htmlurl url='mailto:karl@FreeBSD.ORG' name='<karl@FreeBSD.ORG>'></tt>"> <!ENTITY a.csgr "Geoff Rehmet <tt><htmlurl url='mailto:csgr@FreeBSD.ORG' name='<csgr@FreeBSD.ORG>'></tt>"> <!ENTITY a.ats "Andreas Schulz <tt><htmlurl url='mailto:ats@FreeBSD.ORG' name='<ats@FreeBSD.ORG>'></tt>"> <!ENTITY a.rich "Rich Murphey <tt><htmlurl url='mailto:rich@FreeBSD.ORG' name='<rich@FreeBSD.ORG>'></tt>"> <!ENTITY a.jvh "Johannes Helander <tt><htmlurl url='mailto:jvh@FreeBSD.ORG' name='<jvh@FreeBSD.ORG>'></tt>"> <!ENTITY a.proven "Chris Provenzano <tt><htmlurl url='mailto;proven@FreeBSD.ORG' name='<proven@FreeBSD.ORG>'></tt>"> <!ENTITY a.guido "Guido van Rooij <tt><htmlurl url='mailto;guido@FreeBSD.ORG' name='<guido@FreeBSD.ORG>'></tt>"> <!ENTITY a.hsu "Jeffrey Hsu <tt><htmlurl url='mailto;hsu@FreeBSD.ORG' name='<hsu@FreeBSD.ORG>'></tt>"> <!ENTITY a.bde "Bruce Evans <tt><htmlurl url='mailto;bde@FreeBSD.ORG' name='<bde@FreeBSD.ORG>'></tt>"> <!ENTITY a.sef "Sean Eric Fagan <tt><htmlurl url='mailto;sef@FreeBSD.ORG' name='<sef@FreeBSD.ORG>'></tt>"> <!ENTITY a.se "Stefan Esser <tt><htmlurl url='mailto;se@FreeBSD.ORG' name='<se@FreeBSD.ORG>'></tt>"> <!ENTITY a.torstenb "Torsten Blum <tt><htmlurl url='mailto;torstenb@FreeBSD.ORG' name='<torstenb@FreeBSD.ORG>'></tt>"> <!ENTITY a.julian "Julian Elischer <tt><htmlurl url='mailto;julian@FreeBSD.ORG' name='<julian@FreeBSD.ORG>'></tt>"> <!ENTITY a.dfr "Doug Rabson <tt><htmlurl url='mailto;dfr@FreeBSD.ORG' name='<dfr@FreeBSD.ORG>'></tt>"> <!ENTITY a.martin "Martin Renters <tt><htmlurl url='mailto;martin@FreeBSD.ORG' name='<martin@FreeBSD.ORG>'></tt>"> <!ENTITY a.swallace "Steven Wallace <tt><htmlurl url='mailto;swallace@FreeBSD.ORG' name='<swallace@FreeBSD.ORG>'></tt>"> <!ENTITY a.ljo "L Jonas Olsson <tt><htmlurl url='mailto;ljo@FreeBSD.ORG' name='<ljo@FreeBSD.ORG>'></tt>"> <!ENTITY a.dima "Dima Ruban <tt><htmlurl url='mailto;dima@FreeBSD.ORG' name='<dima@FreeBSD.ORG>'></tt>"> <!ENTITY a.lars "Lars Fredriksen <tt><htmlurl url='mailto;lars@FreeBSD.ORG' name='<lars@FreeBSD.ORG>'></tt>"> <!ENTITY a.jmz "Jean-Marc Zucconi <tt><htmlurl url='mailto;jmz@FreeBSD.ORG' name='<jmz@FreeBSD.ORG>'></tt>"> <!ENTITY a.ugen "Ugen J.S.Antsilevich <tt><htmlurl url='mailto;ugen@FreeBSD.ORG' name='<ugen@FreeBSD.ORG>'></tt>"> <!ENTITY a.wpaul "Bill Paul <tt><htmlurl url='mailto;wpaul@FreeBSD.ORG' name='<wpaul@FreeBSD.ORG>'></tt>"> <!ENTITY a.amurai "Atsushi Murai <tt><htmlurl url='mailto;amurai@FreeBSD.ORG' name='<amurai@FreeBSD.ORG>'></tt>"> <!ENTITY a.jmacd "Joshua Peck Macdonald <tt><htmlurl url='mailto;jmacd@FreeBSD.ORG' name='<jmacd@FreeBSD.ORG>'></tt>"> <!ENTITY a.olah "Andras Olah <tt><htmlurl url='mailto;olah@FreeBSD.ORG' name='<olah@FreeBSD.ORG>'></tt>"> <!ENTITY a.roberto "Ollivier Robert <tt><htmlurl url='mailto;roberto@FreeBSD.ORG' name='<roberto@FreeBSD.ORG>'></tt>"> <!ENTITY a.markm "Mark Murray <tt><htmlurl url='mailto;markm@FreeBSD.ORG' name='<markm@FreeBSD.ORG>'></tt>"> <!ENTITY a.gj "Gary Jennejohn <tt><htmlurl url='mailto;gj@FreeBSD.ORG' name='<gj@FreeBSD.ORG>'></tt>"> <!ENTITY a.mpp "Mike Pritchard <tt><htmlurl url='mailto;mpp@FreeBSD.ORG' name='<mpp@FreeBSD.ORG>'></tt>"> <!ENTITY a.smace "Scott Mace <tt><htmlurl url='mailto;smace@FreeBSD.ORG' name='<smace@FreeBSD.ORG>'></tt>"> <!ENTITY a.erich "Eric L. Hernes <tt><htmlurl url='mailto;erich@FreeBSD.ORG' name='<erich@FreeBSD.ORG>'></tt>"> <!ENTITY a.graichen "Thomas Graichen <tt><htmlurl url='mailto;graichen@FreeBSD.ORG' name='<graichen@FreeBSD.ORG>'></tt>"> <!ENTITY a.adam "Adam David <tt><htmlurl url='mailto;adam@FreeBSD.ORG' name='<adam@FreeBSD.ORG>'></tt>"> <!ENTITY a.tg "Thomas Gellekum <tt><htmlurl url='mailto;tg@FreeBSD.ORG' name='<tg@FreeBSD.ORG>'></tt>"> <!ENTITY a.jdp "John Polstra <tt><htmlurl url='mailto;jdp@FreeBSD.ORG' name='<jdp@FreeBSD.ORG>'></tt>"> <!ENTITY a.jlrobin "James L. Robinson <tt><htmlurl url='mailto;jlrobin@FreeBSD.ORG' name='<jlrobin@FreeBSD.ORG>'></tt>"> <!ENTITY a.jmb "Jonathan M. Bresler <tt><htmlurl url='mailto:jmb@FreeBSD.ORG' name='<jmb@FreeBSD.ORG>'></tt>"> diff --git a/handbook/booting.sgml b/handbook/booting.sgml index c7e46b52f8..774c606431 100644 --- a/handbook/booting.sgml +++ b/handbook/booting.sgml @@ -1,173 +1,173 @@ <!-- This is a SGML version of the text on FreeBSD boot procedures made by Poul-Henning Kamp <phk@FreeBSD.ORG> This conversion has been made by Ollivier Robert. - $Id: booting.sgml,v 1.8 1995-10-22 00:41:56 jfieber Exp $ + $Id: booting.sgml,v 1.9 1996-01-31 14:25:57 mpp Exp $ <!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN"> <article> <title>Boot overview Poul-Henning Kamp, v1.1, April 26th Booting FreeBSD is essentially a three step: Load the kernel, determine the root filesystem and initialize user-land things. This leads to some interesting possibilities as shown below... --> The FreeBSD Booting Process

Contributed by &a.phk;. v1.1, April 26th. Booting FreeBSD is essentially a three step: Load the kernel, determine the root filesystem and initialize user-land things. This leads to some interesting possibilities shown below. Loading a kernel

We presently have three basic mechanisms for loading the kernel as described below: They all pass some information to the kernel to help the kernel decide what to do next. Biosboot Biosboot is our ``bootblocks'', it consists of two files, which will be installed in the first 8Kbytes of the floppy or hard-disk slice to be booted from. Biosboot can load a kernel from a FreeBSD filesystem. Dosboot Dosboot was written by DI. Christian Gusenbauer, and is unfortunately at this time one of the few pieces of code that isn't compilable under FreeBSD itself because it is written for - MicroSoft compilers. + Microsoft compilers. Dosboot will boot the kernel from a MS-DOS file or from a FreeBSD filesystem partition on the disk. It attempts to negotiate with the various and strange kinds of memory manglers that lurk in high memory on MS/DOS systems and usually wins them for it's case. Netboot - Netboot will try to find a supported ethernet card, and use + Netboot will try to find a supported Ethernet card, and use BOOTP, TFTP and NFS to find a kernel file to boot. Determine the root filesystem

Once the kernel is loaded and the boot-code jumps to it, the kernel will initialize itself, trying to determine what hardware is present and so on, and then it needs to find a root filesystem. - Presently we support the following types of rootfilesystems: + Presently we support the following types of root filesystems: UFS This is the most normal type of root filesystem. It can reside on - a floppy or on harddisk. + a floppy or on hard disk. MSDOS While this is technically possible, it isn't particular useful, because of ``FAT'' filesystems inability to make links, device nodes and such ``UNIXisms''. MFS This is actually a UFS filesystem which has been compiled into the kernel. That means that the kernel does not really need any disks/floppies or other HW to function. CD9660 This is for using a CD-ROM as root filesystem. NFS This is for using a fileserver as root filesystem, basically making it a diskless machine. Initialize user-land things

To get the user-land going, when the kernel has finished initialization, it will create a process with ``/sbin/init''. You can substitute any program for /sbin/init, as long as you keep in mind that: there is no stdin/out/err unless you open it yourself, if you exit, the machine panics, signal handling is special for ``/stand/sysinstall'' program on the installation floppy. Interesting combinations

Boot a kernel with a MFS in it with a special /sbin/init which... mounts your /C: Attaches C:/freebsd.fs on /dev/vn0 mounts /dev/vn0 as /rootfs makes symlinks /rootfs/bin -> /bin /rootfs/etc -> /etc /rootfs/sbin -> /sbin (etc...) Now you run FreeBSD without repartitioning your hard disk... server:˜you/FreeBSD as /nfs, chroots to /nfs and executes /sbin/init there Now you run FreeBSD diskless, even though you don't control the NFS server... /dev/rwd0 and writes it to a remote tape station or fileserver. Now you finally got that backup you should have made a year ago... E -- Acts as a firewall/web-server/what do I know... This is particular interesting since you can boot from a write- protected floppy, but still write to your root filesystem... diff --git a/handbook/contrib.sgml b/handbook/contrib.sgml index ebb73911b7..f975f78c8b 100644 --- a/handbook/contrib.sgml +++ b/handbook/contrib.sgml @@ -1,346 +1,346 @@ - + FreeBSD contributor list Derived software contributors

This software was originally derived from William F. Jolitz's 386BSD release 0.1, though almost none of the original 386BSD specific code remains. This software has - been essentially reimplemented from the 4.4 BSD Lite + been essentially re-implemented from the 4.4 BSD Lite release provided by the Computer Science Research Group (CSRG) at the University of California, Berkeley and associated academic contributors. There are also portions of NetBSD that have been integrated into FreeBSD as well, and we would therefore like to thank all the contributors to NetBSD for their work. Despite some occasionally rocky moments in relations between the two groups, we both want essentially the same thing: More BSD based operating systems on people's computers! We wish the NetBSD group every success in their endeavors. Hardware contributors

A special thank-you to Walnut Creek CDROM for providing the Pentium P5-90 and 486/DX2-66 EISA/VL systems that are being used for our development work, to say nothing of the network access and other donations of hardware resources. It would have been impossible to do this release without their support. TRW Financial Systems, Inc. provided 130 PCs, three 68 GB - fileservers, twelve ethernets, two routers and an ATM + fileservers, twelve Ethernets, two routers and an ATM switch for debugging the diskless code. They also keep a couple of FreeBSD hackers alive and busy. Thanks! Thanks also to Dermot McDonnell for his donation of a Toshiba XM3401B CDROM drive. It's been most useful! Thanks to Chuck Robey <chuckr@eng.umd.edu> who's been contributing his floppy tape streamer for experimental work. Thanks to Larry Altneu <larry@ALR.COM>, and to Wilko Bulte <wilko@yedi.iaf.nl>, for providing us with a Wangtek and an Archive QIC-02 tape drive, in order to give us the hardware to improve the wt driver. The FreeBSD core team

(in alphabetical order by first name): &a.ache &a.bde &a.davidg &a.wollman &a.gpalmer &a.joerg &a.dyson &a.jkh &a.gibbs &a.peter &a.phk &a.rich &a.asami &a.sos The FreeBSD Developers -

These are the people who have commit privs and do the work on +

These are the people who have commit privileges and do the work on FreeBSD source tree. All core team members are also developers. &a.paul; &a.gibbs; &a.pst; &a.nate; &a.karl; &a.csgr; &a.ats; &a.jvh; &a.proven; &a.guido; &a.martin; &a.hsu; &a.sef; &a.se; &a.torstenb; &a.dfr; &a.gclarkii; &a.swallace; &a.ljo; &a.dima; &a.lars; &a.jmz; &a.ugen; &a.dufault; &a.wpaul; &a.amurai; &a.jmacd; &a.jfieber; &a.olah; &a.roberto; &a.markm; &a.gj; &a.mpp; &a.rgrimes; &a.smace; &a.erich; &a.graichen; &a.adam; &a.tg; &a.uhclem; &a.jdp; Who is responsible for what

Additional FreeBSD contributors

(in alphabetical order by first name): Adam Glass <glass@postgres.berkeley.edu> Adrian T. Filipi-Martin <atf3r@agate.cs.virginia.edu> Akito Fujita <fujita@zoo.ncl.omron.co.jp> Alain Kalker <A.C.P.M.Kalker@student.utwente.nl> Andras Olah <olah@cs.utwente.nl> Andreas Klemm <andreas@knobel.GUN.de> Andrew Herbert <andrew@werple.apana.org.au> Andrew Moore <alm@FreeBSD.org> Anthony Yee-Hang Chan <yeehang@netcom.com> Bill Fenner <fenner@parc.xerox.com> Bob Wilcox <bob@obiwan.uucp> Brian Clapper <bmc@telebase.com> Brian Tao <taob@gate.sinica.edu.tw> Charles Hannum <mycroft@ai.mit.edu> Chet Ramey <chet@odin.INS.CWRU.Edu> Chris G. Demetriou <cgd@postgres.berkeley.edu> Chris Stenton <jacs@gnome.co.uk> Chris Torek <torek@ee.lbl.gov> Christian Gusenbauer <cg@fimp01.fim.uni-linz.ac.at> Christoph Robitschko <chmr@edvz.tu-graz.ac.at> Chuck Hein <chein@cisco.com> Chuck Robey <chuckr@Glue.umd.edu> Cornelis van der Laan <nils@guru.ims.uni-stuttgart.de> Craig Struble <cstruble@vt.edu> Cristian Ferretti <cfs@riemann.mat.puc.cl> Curt Mayer <curt@toad.com> Danny J. Zerkel <dzerkel@feephi.phofarm.com> Dave Burgess <burgess@hrd769.brooks.af.mil> Dave Chapeskie <dchapes@zeus.leitch.com> Dave Rivers <rivers@ponds.uucp> David Dawes <dawes@physics.su.OZ.AU> David O'Brien <obrien@cs.ucdavis.edu> Dean Huxley <dean@fsa.ca> Dirk Froemberg <dirk@hal.in-berlin.de> Don Whiteside <dwhite@anshar.shadow.net> Donald Burr <d_burr@ix.netcom.com> Eric L. Hernes <erich@lodgenet.com> Frank Bartels <knarf@camelot.de> Frank Maclachlan <fpm@crash.cts.com> Frank Nobis <fn@trinity.radio-do.de> Gary A. Browning <gab10@griffcd.amdahl.com> Gene Stark <stark@cs.sunysb.edu> Havard Eidnes <Havard.Eidnes@runit.sintef.no> Hideaki Ohmon <ohmon@sfc.keio.ac.jp> Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp> Holger Veit <Holger.Veit@gmd.de> Ishii Masahiro, R. Kym Horsell J.T. Conklin <jtc@cygnus.com> James Clark <jjc@jclark.com> James da Silva <jds@cs.umd.edu> et al Janusz Kokot <janek@gaja.ipan.lublin.pl> Javier Martin Rueda <jmrueda@diatel.upm.es> Jim Wilson <wilson@moria.cygnus.com> Josh MacDonald <jmacd@uclink.berkeley.edu> Juergen Lock <nox@jelal.hb.north.de> Julian Stacey <stacey@guug.de> (fallback: <julian@meepmeep.pcs.com>) Keith Bostic <bostic@toe.CS.Berkeley.EDU> Keith Moore <?> Kirk McKusick <mckusick@mckusick.com> Kurt Olsen <kurto@tiny.mcs.usu.edu> L Jonas Olsson <ljo@po.cwru.edu> Lars Fredriksen <fredriks@mcs.com> Lucas James <Lucas.James@ldjpc.apana.org.au> Marc Frajola <marc@dev.com> Marc Ramirez <mrami@mramirez.sy.yale.edu Marc van Kempen <wmbfmk@urc.tue.nl> Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu> Martin Birgmeier Martin Renters <martin@innovus.com> Matt Thomas <thomas@lkg.dec.com> Michael Elbel <me@freebsd.org> Michael Smith <msmith@atrad.adelaide.edu.au> Mike Pritchard <mpp@mpp.minn.net> NIIMI Satoshi <sa2c@and.or.jp> Nate Williams <nate@FreeBSD.org> Nobuhiro Yasutomi <nobu@psrc.isac.co.jp> Nobuyuki Koganemaru <kogane@kces.koganemaru.co.jp> Paul Kranenburg <pk@cs.few.eur.nl> Paul Mackerras <paulus@cs.anu.edu.au> Philippe Charnier <charnier@lirmm.fr> Richard Stallman <rms@gnu.ai.mit.edu> Rob Shady <rls@id.net> Rob Snow <rsnow@txdirect.net> Sascha Wildner <swildner@channelz.GUN.de> Scott Blachowicz <scott@sabami.seaslug.org> Serge V. Vakulenko <vak@zebub.msk.su> Stephen McKay <syssgm@devetir.qld.gov.au> Steve Gerakines <steve2@genesis.tiac.net> Steve Passe <smp@csn.net> Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp> Terry Lambert <terry@lambert.org> Terry Lee <terry@uivlsi.csl.uiuc.edu> Theo Deraadt <deraadt@fsa.ca> Thomas Gellekum <thomas@ghpc8.ihf.rwth-aachen.de> Tom Samplonius <tom@misery.sdf.com> Torbjorn Granlund <tege@matematik.su.se> Werner Griessl <werner@btp1da.phy.uni-bayreuth.de> Wes Santee <wsantee@wsantee.oz.net> Wolfgang Stanglmeier <wolf@kintaro.cologne.de> Wolfram Schneider <wosch@cs.tu-berlin.de> Yuval Yarom <yval@cs.huji.ac.il> Yves Fonk <yves@cpcoup5.tn.tudelft.nl> 386BSD Patch kit patch contributors

(in alphabetical order by first name): Adam Glass <glass@postgres.berkeley.edu> Adrian Hall <adrian@ibmpcug.co.uk> Andrey A. Chernov <ache@astral.msk.su> Andrew Herbert <andrew@werple.apana.org.au> Andrew Moore <alm@netcom.com> Andy Valencia <ajv@csd.mot.com> <jtk@netcom.com> Arne Henrik Juul <arnej@Lise.Unit.NO> Bakul Shah <bvs@bitblocks.com> Barry Lustig <barry@ictv.com> Bob Wilcox <bob@obiwan.uucp> Branko Lankester Brett Lymn <blymn@mulga.awadi.com.AU> Charles Hannum <mycroft@ai.mit.edu> Chris G. Demetriou <cgd@postgres.berkeley.edu> Chris Torek <torek@ee.lbl.gov> Christoph Robitschko <chmr@edvz.tu-graz.ac.at> Daniel Poirot <poirot@aio.jsc.nasa.gov> Dave Burgess <burgess@hrd769.brooks.af.mil> Dave Rivers <rivers@ponds.uucp> David Dawes <dawes@physics.su.OZ.AU> David Greenman <davidg@Root.COM> Eric J. Haug <ejh@slustl.slu.edu> Felix Gaehtgens <felix@escape.vsse.in-berlin.de> Frank Maclachlan <fpm@crash.cts.com> Gary A. Browning <gab10@griffcd.amdahl.com> Geoff Rehmet <csgr@alpha.ru.ac.za> Goran Hammarback <goran@astro.uu.se> Guido van Rooij <guido@gvr.win.tue.nl> Guy Harris <guy@auspex.com> Havard Eidnes <Havard.Eidnes@runit.sintef.no> Herb Peyerl <hpeyerl@novatel.cuc.ab.ca Holger Veit <Holger.Veit@gmd.de> Ishii Masahiro, R. Kym Horsell J.T. Conklin <jtc@cygnus.com> Jagane D Sundar < jagane@netcom.com > James Clark <jjc@jclark.com> James Jegers <jimj@miller.cs.uwm.edu> James W. Dolter James da Silva <jds@cs.umd.edu> et al Jay Fenlason <hack@datacube.com> Jim Wilson <wilson@moria.cygnus.com> Jörg Lohse <lohse@tech7.informatik.uni-hamburg.de> Jörg Wunsch <joerg_wunsch@uriah.heep.sax.de> John Dyson - <formerly dyson@ref.tfs.com> John Polstra <jdp@polstra.com> John Woods <jfw@eddie.mit.edu> Jordan K. Hubbard <jkh@whisker.hubbard.ie> Julian Elischer <julian@dialix.oz.au> Julian Stacey <stacey@guug.de> (fallback: <julian@meepmeep.pcs.com>) Karl Lehenbauer <karl@NeoSoft.com> <karl@one.neosoft.com> Keith Bostic <bostic@toe.CS.Berkeley.EDU> Ken Hughes Kent Talarico <kent@shipwreck.tsoft.net> Kevin Lahey <kml%rokkaku.UUCP@mathcs.emory.edu> <kml@mosquito.cis.ufl.edu> Marc Frajola <marc@dev.com> Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu> Martin Renters <martin@innovus.com> Michael Galassi <nerd@percival.rain.com> Mike Durkin <mdurkin@tsoft.sf-bay.org> Nate Williams <nate@bsd.coe.montana.edu> Nick Handel <nhandel@NeoSoft.com> <nick@madhouse.neosoft.com> Pace Willisson <pace@blitz.com> Paul Kranenburg <pk@cs.few.eur.nl> Paul Mackerras <paulus@cs.anu.edu.au> Paul Popelka <paulp@uts.amdahl.com> Peter da Silva <peter@NeoSoft.com> Phil Sutherland <philsuth@mycroft.dialix.oz.au> Ralf Friedl <friedl@informatik.uni-kl.de> Rick Macklem <root@snowhite.cis.uoguelph.ca> Robert D. Thrush <rd@phoenix.aii.com> Rodney W. Grimes <rgrimes@cdrom.com> Rog Egge <?> Sascha Wildner <swildner@channelz.GUN.de> Scott Burris <scott@pita.cns.ucla.edu> Scott Reynolds <scott@clmqt.marquette.mi.us> Sean Eric Fagan <sef@kithrup.com> Simon J Gerraty <sjg@melb.bull.oz.au> <sjg@zen.void.oz.au> Stephen McKay <syssgm@devetir.qld.gov.au> Terry Lambert <terry@icarus.weber.edu> Terry Lee <terry@uivlsi.csl.uiuc.edu> Warren Toomey <wkt@csadfa.cs.adfa.oz.au> Wiljo Heinen <wiljo@freeside.ki.open.de> William Jolitz <withheld> Wolfgang Solfrank <ws@tools.de> Wolfgang Stanglmeier <wolf@dentaro.GUN.de> Yuval Yarom <yval@cs.huji.ac.il> diff --git a/handbook/ctm.sgml b/handbook/ctm.sgml index a1d16c236c..27edac44a4 100644 --- a/handbook/ctm.sgml +++ b/handbook/ctm.sgml @@ -1,199 +1,199 @@ CTM

Contributed by &a.phk;. Updated 16-Mar-1995. Why should I use

. What do I need to use

You will need two things: The ``/usr/src/usr.sbin/ if you have a copy of the source online. If you are running a pre-2.0 version of FreeBSD, you can fetch the current The ``deltas'' you feed FTP the relevant directory and fetch the /etc/aliases if you want to have the process run in a fully automated fashion. Check the Starting off with

Before you can start using Using

To apply the deltas, simply say cd /where/ever/you/want/the/stuff ctm -v -v /where/you/store/your/deltas/src-cur.* Future plans for

Tons of them: Make local modifications to the tree possible. One way to do it could be this:

When foo/bar.c'', it would first check for the existence of foo/bar.c#CTM If this file exists, the delta is applied to it instead. This way the foo/bar.c file can be edited to suit local needs. Make a ``restore file(s)'' option to ctm -r src/sys/i386/wd.c /here/are/my/deltas/src-cur.* would restore Clean up the options to The bad news is that I am very busy, so any help in doing this will be most welcome. And don't forget to tell me what you want also... Miscellaneous stuff

All the ``DES infected'' (e.g. export controlled) source is not included. You will get the ``international'' version only. If sufficient interest appears, we will set up a ``Thanks!

diff --git a/handbook/current.sgml b/handbook/current.sgml index 0bd4900b8d..02ee6a3190 100644 --- a/handbook/current.sgml +++ b/handbook/current.sgml @@ -1,166 +1,166 @@ - + Staying current with FreeBSD

Contributed by &a.jkh;. What is FreeBSD-current?

FreeBSD-current is, quite literally, nothing more than a daily snapshot of the working sources for FreeBSD. These include work in progress, experimental changes and transitional mechanisms that may or may not be present in the next official release of the software. While many of us compile almost daily from FreeBSD-current sources, -there are periods of time when the sources are literally uncompilable. +there are periods of time when the sources are literally un-compilable. These problems are generally resolved as expeditiously as possible, but whether or not FreeBSD-current sources bring disaster or greatly desired functionality can literally be a matter of which part of any given 24 hour period you grabbed them in! Under certain circumstances we will sometimes make binaries for parts of FreeBSD-current available, but only because we're interested in getting something tested, not because we're in the business of providing binary releases of current. If we don't offer, please don't ask! It takes far too much time to do this as a general task. Who needs FreeBSD-current?

FreeBSD-current is made generally available for 3 primary interest groups: Members of the FreeBSD group who are actively working on some part of the source tree and for whom keeping `current' is an absolute requirement. Members of the FreeBSD group who are active testers, willing to spend time working through problems in order to ensure that FreeBSD-current remains as sane as possible. These are also people who wish to make topical suggestions on changes and the general direction of FreeBSD. Peripheral members of the FreeBSD (or some other) group who merely wish to keep an eye on things and use the current sources for reference purposes (e.g. for reading, not running). These people also make the occasional comment or contribute code. What is FreeBSD-current NOT?

A fast-track to getting pre-release bits because you heard there's some cool new feature in there and you want to be the first on your block to have it. A quick way of getting bug fixes. In any way ``officially supported'' by us. We do our best to help people genuinely in one of the 3 ``legitimate'' FreeBSD-current categories, but we simply do not have the time to help every person who jumps into FreeBSD-current with more enthusiasm than knowledge of how to deal with experimental system software. This is not because we're mean and nasty people who don't like helping people out (we wouldn't even be doing FreeBSD if we were), it's literally because we can't answer 400 messages a day and actually work on FreeBSD! I'm sure that, if given the choice between having us answer lots of questions or continuing to improve FreeBSD, most of you would vote for us improving it. Using FreeBSD-current

Join the freebsd-current and cvs-all mailing lists. This is not just a good idea, it's essential. If you aren't on freebsd-current, you won't see the comments that people are making about the current state of the system and thus will probably end up stumbling over a lot of problems that others have already found and solved. Even more importantly, you will miss out on potentially critical information (e.g. ``Yo, Everybody! Before you rebuild /usr/src, you must rebuild the kernel or your system will crash horribly!"). The cvs-all mailing list will allow you to see the commit log entry for each change as it's made along with any pertinent information on possible side-effects. To join these lists, send mail to `majordomo@FreeBSD.ORG' and say: subscribe current subscribe cvs-all In the body of your message. Optionally, you can also say `help' and Majordomo will send you full help on how to subscribe and unsubscribe to the various other mailing lists we support. Grab the sources from ftp.FreeBSD.ORG. You can do this in three ways: Using the CTM facility described below. Unless you have a good TCP/IP connection at a flat rate, this is the way to do it. Use the CMU `sup' program (Software Update Protocol), also described below. This is the second most recommended method, since it allows you to grab the entire collection once and then only what's changed from then on. Many people run sup from cron and keep their sources up-to-date automatically. Use ftp. The source tree for FreeBSD-current is always "exported" on: ftp.FreeBSD.ORG:~ftp/pub/FreeBSD/FreeBSD-current We use `wu-ftpd' which allows compressed/tar'd grabbing of whole trees. e.g. you see: usr.bin/lex You can do: ftp> cd usr.bin ftp> get lex.tar.Z And it will get the whole directory for you as a compressed tar file. Essentially, if you need rapid on-demand access to the source and communications bandwidth is not a consideration, use sup or ftp. Otherwise, use CTM. If you're grabbing the sources to run, and not just look at, then grab all of current, not just selected portions. The reason for this is that various parts of the source depend on updates elsewhere, and trying to compile just a subset is almost guaranteed to get you into trouble. Before compiling current, read the Makefile in /usr/src carefully. You should at least run a `make world' the first time through as part of the upgrading process. Reading freebsd-hackers will keep you up-to-date on other bootstrapping procedures that sometimes become necessary as we move towards the next release. Be active! If you're running FreeBSD-current, we want to know what you have to say about it, especially if you have suggestions for enhancements or bug fixes. Suggestions with accompanying code are received most enthusiastically! diff --git a/handbook/dialup.sgml b/handbook/dialup.sgml index 9170e3238c..10dd5d9276 100644 --- a/handbook/dialup.sgml +++ b/handbook/dialup.sgml @@ -1,810 +1,810 @@ Dialup access

Contributed by &a.ghelmer;. This document provides suggestions for configuring a FreeBSD system to handle dialup modems. This document is written based on the author's experience with FreeBSD versions 1.0, 1.1, and 1.1.5.1 (and experience with dialup modems on other UNIX-like operating systems); however, this document may not answer all of your questions or provide examples specific enough to your environment. The author cannot be responsible if you damage your system or lose data due to attempting to follow the suggestions here. Prerequisites

To begin with, the author assumes you have some basic knowledge of FreeBSD. You need to have FreeBSD installed, know how to edit files in a UNIX-like environment, and how to look up manual pages on the system. As discussed below, you'll need certain versions of FreeBSD, and knowledge of some terminology & modem and cabling. FreeBSD Version

First, it is assumed that you are using FreeBSD version 1.1 or higher (including versions 2.x). FreeBSD version 1.0 included two different serial drivers, which complicates the situation. Also, the serial device driver (Terminology

A quick rundown of terminology: If you need more information about these terms and data communications in general, the author remembers reading that External vs. Internal Modems

External modems seem to be more convenient for dialup, because external modems often can be semi-permanently configured via parameters stored in non-volatile RAM and they usually provide lighted indicators that display the state of important RS-232 signals. Blinking lights impress visitors, but lights are also very useful to see whether a modem is operating properly. Internal modems usually lack non-volatile RAM, so their configuration may be limited only to setting DIP switches. If your internal modem has any signal indicator lights, it is probably difficult to view the lights when the system's cover is in place. Modems and Cables

A background knowledge of these items is assumed You know how to connect your modem to your computer so that the two can communicate (unless you have an internal modem, which doesn't need such a cable) You are familiar with your modem's command set, or know where to look up needed commands You know how to configure your modem (probably via a terminal communications program) so you can set the non-volatile RAM parameters The first, connecting your modem, is usually simple - most straight-through serial cables work without any problems. You need to have a cable with appropriate connectors (DB-25 or DB-9, male or female) on each end, and the cable must be a DCE-to-DTE cable with these signals wired: Transmitted Data ( Received Data ( Request to Send ( Clear to Send ( Data Set Ready ( Data Terminal Ready ( Carrier Detect ( Signal Ground ( FreeBSD needs the Serial Interface Considerations

FreeBSD supports NS8250-, NS16450-, NS16550-, and NS16550A-based EIA RS-232C (CCITT V.24) communications interfaces. The 8250 and 16450 devices have single-character buffers. The 16550 device provides a 16-character buffer, which allows for better system performance. (Bugs in plain 16550's prevent the use of the 16-character buffer, so use 16550A's if possible). Because single-character-buffer devices require more work by the operating system than the 16-character-buffer devices, 16550A-based serial interface cards are much prefered. If the system has many active serial ports or will have a heavy load, 16550A-based cards are better for low-error-rate communications. Quick Overview

Here is the process that FreeBSD follows to accept dialup logins. A /dev/ttyd0, for our example). The command 4850 ?? I 0:00.09 /usr/libexec/getty V19200 ttyd0 When a user dials the modem's line and the modems connect, the /usr/bin/login, which completes the login by asking for the user's password and then starting the user's shell. Let's dive into the configuration... Kernel Configuration

FreeBSD kernels typically come prepared to search for four serial ports, known in the PC-DOS world as /sbin/dmesg command to replay the kernel's boot messages. In particular, look for messages that start with the characters /usr/sbin/dmesg | grep 'sio' For example, on a system with four serial ports, these are the serial-port specific kernel boot messages: sio0 at 0x3f8-0x3ff irq 4 on isa sio0: type 16550A sio1 at 0x2f8-0x2ff irq 3 on isa sio1: type 16550A sio2 at 0x3e8-0x3ef irq 5 on isa sio2: type 16550A sio3 at 0x2e8-0x2ef irq 9 on isa sio3: type 16550A If your kernel doesn't recognize all of your serial ports, you'll probably need to configure a custom FreeBSD kernel for your system. Please see the BSD System Manager's Manual chapter on ``Building Berkeley Kernels with Config'' [the source for which is in /usr/src/share/doc/smm] and ``FreeBSD Configuration Options'' [in /sys/doc/options.doc] for more information on configuring and building kernels. You may have to unpack the kernel source distribution if haven't installed the system sources already (srcdist/srcsys.?? in FreeBSD 1.1, srcdist/sys.?? in FreeBSD 1.1.5.1, or the entire source distribution in FreeBSD 2.0) to be able to configure and build kernels. Create a kernel configuration file for your system (if you haven't already) by /sys/i386/conf. Then, if you are creating a new custom configuration file, copy the file GENERICAH (or GENERICBT, if you have a BusTek SCSI controller on FreeBSD 1.x) to device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr You can comment-out or completely remove lines for devices you don't have. If you have a multiport serial board, such as the Boca Board BB2016, please see the can't share interrupts on ISA-bus PCs (multiport boards have on-board electronics that allow all the 16550A's on the board to share one or two interrupt request lines). When you are finished adjusting the kernel configuration file, use the program Device Special Files

Most devices in the kernel are accessed through ``device special files'', which are located in the /dev directory. The /dev/ttyd? (dial-in) and /dev/cua0? (call-out) devices. On FreeBSD version 1.1.5 and higher, there are also initialization devices (/dev/ttyid? and /dev/cuai0?) and locking devices (/dev/ttyld? and /dev/cual0?). The initialization devices are used to initialize communications port parameters each time a port is opened, such as crtscts for modems which use -CTS/RTS signalling for flow control. The locking devices are +CTS/RTS signaling for flow control. The locking devices are used to lock flags on ports to prevent users or programs changing certain parameters; see the manual pages Making Device Special Files

A shell script called /dev directory manages the device special files. (The manual page for /dev and issue the command /dev/ttyd? device special files, but also creates the /dev/cua0? (and all of the initializing and locking special files under FreeBSD 1.1.5 and up) and removes the hardwired terminal special file /dev/tty0?, if it exists. After making new device special files, be sure to check the permissions on the files (especially the /dev/cua* files) to make sure that only users who should have access to those device special files can read & write on them - you probably don't want to allow your average user to use your modems to dialout. The default permissions on the /dev/cua* files should be sufficient: crw-rw---- 1 uucp dialer 28, 129 Feb 15 14:38 /dev/cua01 crw-rw---- 1 uucp dialer 28, 161 Feb 15 14:38 /dev/cuai01 crw-rw---- 1 uucp dialer 28, 193 Feb 15 14:38 /dev/cual01 These permissions allow the user Configuration Files

There are three system configuration files in the /etc directory that you'll probably need to edit to allow dialup access to your FreeBSD system. The first, /etc/gettytab, contains configuration information for the /usr/libexec/getty daemon. Second, /etc/ttys holds information that tells /sbin/init what /etc/rc.serial script if you have FreeBSD 1.1.5.1 or higher; otherwise, you can initialize ports in the /etc/rc.local script. There are two schools of thought regarding dialup modems on UNIX. One group likes to configure their modems and system so that no matter at what speed a remote user dials in, the local computer-to-modem RS-232 interface runs at a locked speed. The benefit of this configuration is that the remote user always sees a system login prompt immediately. The downside is that the system doesn't know what a user's true data rate is, so full-screen programs like Emacs won't adjust their screen-painting methods to make their response better for slower connections. The other school configures their modems' RS-232 interface to vary its speed based on the remote user's connection speed. For example, V.32bis (14.4 Kbps) connections to the modem might make the modem run its RS-232 interface at 19.2 Kbps, while 2400 bps connections make the modem's RS-232 interface run at 2400 bps. Because <Enter> key until they see a recognizable prompt. If the data rates don't match, /etc/gettytab

/etc/gettytab is a Locked-Speed Config

If you are locking your modem's data communications rate at a particular speed, you probably won't need to make any changes to /etc/gettytab. Matching-Speed Config

You'll need to setup an entry in /etc/gettytab to give # # Fast dialup terminals, 2400/1200/300 rotary (can start either way) # D2400|d2400|Fast-Dial-2400:\ :nx=D1200:tc=2400-baud: 3|D1200|Fast-Dial-1200:\ :nx=D300:tc=1200-baud: 5|D300|Fast-Dial-300:\ :nx=D2400:tc=300-baud: If you have a higher speed modem, you'll probably need to add an entry in /etc/gettytab; here's an entry you could use for a 14.4 Kbps modem with a top interface speed of 19.2 Kpbs: # # Additions for a V.32bis Modem # um|V300|High Speed Modem at 300,8-bit:\ :nx=V19200:tc=std.300: un|V1200|High Speed Modem at 1200,8-bit:\ :nx=V300:tc=std.1200: uo|V2400|High Speed Modem at 2400,8-bit:\ :nx=V1200:tc=std.2400: up|V9600|High Speed Modem at 9600,8-bit:\ :nx=V2400:tc=std.9600: uq|V19200|High Speed Modem at 19200,8-bit:\ :nx=V9600:tc=std.19200: On FreeBSD 1.1.5 and later, this will result in 8-bit, no parity connections. Under FreeBSD 1.1, add std. entries at the top of the file for 8 bits, no parity; otherwise, the default is 7 bits, even parity. The example above starts the communications rate at 19.2 Kbps (for a V.32bis connection), then cycles through 9600 bps (for V.32), 2400 -bps, 1200 bps, 300 bps, and back to 19.2 Kbps. Communcations rate +bps, 1200 bps, 300 bps, and back to 19.2 Kbps. Communications rate cycling is implemented with the # # Additions for a V.32bis or V.34 Modem # Starting at 57.6 Kpbs # vm|VH300|Very High Speed Modem at 300,8-bit:\ :nx=VH57600:tc=std.300: vn|VH1200|Very High Speed Modem at 1200,8-bit:\ :nx=VH300:tc=std.1200: vo|VH2400|Very High Speed Modem at 2400,8-bit:\ :nx=VH1200:tc=std.2400: vp|VH9600|Very High Speed Modem at 9600,8-bit:\ :nx=VH2400:tc=std.9600: vq|VH57600|Very High Speed Modem at 57600,8-bit:\ :nx=VH9600:tc=std.57600: If you have a slow CPU or a heavily loaded system and you don't have 16550A-based serial ports, you may receive sio ``silo'' errors at 57.6 Kbps. /etc/ttys

/etc/ttys is the list of /etc/ttys also provides security information to /etc/ttys or add new lines to make ttyd0 "/usr/libexec/getty xxx" dialup on The first item in the above line is the device special file for this entry - /dev/ttyd0 is the file that this "/usr/libexec/getty (secure, but it should only be used for terminals which are physically secure (such as the system console). The default terminal type (/etc/ttys, you may send the kill -1 1 to send the signal. If this is your first time setting up the system, though, you may want to wait until your modem(s) are properly -configured and connected before signalling Locked-Speed Config

For a locked-speed configuration, your ttyd0 "/usr/libexec/getty std.19200" dialup on If your modem is locked at a different data rate, substitute the appropriate name for the std. entry for /etc/gettytab for your modem's data rate. Matching-Speed Config

In a matching-speed configuration, your /etc/gettytab. For example, if you added the above suggested entry for a matching-speed modem that starts at 19.2 Kbps (the ttyd0 "/usr/libexec/getty V19200" dialup on /etc/rc.serial or /etc/rc.local

High-speed modems, like V.32, V.32bis, and V.34 modems, need to use hardware (RTS/CTS) flow control. You can add /etc/rc.serial on FreeBSD 1.1.5.1 and up, or /etc/rc.local on FreeBSD 1.1, to set the hardware flow control flag in the FreeBSD kernel for the modem ports. For example, on a sample FreeBSD 1.1.5.1 system, /etc/rc.serial reads: #!/bin/sh # # Serial port initial configuration stty -f /dev/ttyid1 crtscts stty -f /dev/cuai01 crtscts which sets the # Set serial ports to use RTS/CTS flow control stty -f /dev/ttyd0 crtscts stty -f /dev/ttyd1 crtscts stty -f /dev/ttyd2 crtscts stty -f /dev/ttyd3 crtscts Since there isn't an initialization device special file on FreeBSD 1.1, one has to just set the flags on the sole device special file and hope the flags aren't cleared by a miscreant. Modem Settings

If you have a modem whose parameters may be permanently set in non-volatile RAM, you'll need to use a terminal program (such as Telix under PC-DOS or Disable XON/XOFF flow control Quiet mode (no result codes) No command echo Please read the documentation for your modem to find out what commands and/or DIP switch settings you need to give it. For example, to set the above parameters on a USRobotics Sportster 14,400 external modem, one could give these commands to the modem: ATZ AT&C1&D2&H1&I0&R2&W You might also want to take this opportunity to adjust other settings in the modem, such as whether it will use V.42bis and/or MNP5 compression. The USR Sportster 14,400 external modem also has some DIP switches that need to be set; for other modems, perhaps you can use these settings as an example: Switch 1: UP - DTR Normal Switch 2: Don't care (Verbal Result Codes/Numeric Result Codes) Switch 3: UP - Suppress Result Codes Switch 4: DOWN - No echo, offline commands Switch 5: UP - Auto Answer Switch 6: UP - Carrier Detect Normal Switch 7: UP - Load NVRAM Defaults Switch 8: Don't care (Smart Mode/Dumb Mode) Result codes should be disabled/suppressed for dialup modems to avoid problems that can occur if Locked-speed Config

For a locked-speed configuration, you'll need to configure the modem to maintain a constant modem-to-computer data rate independent of the communications rate. On a USR Sportster 14,400 external modem, these commands will lock the modem-to-computer data rate at the speed used to issue the commands: ATZ AT&B1&W Matching-speed Config

For a variable-speed configuration, you'll need to configure your modem to adjust its serial port data rate to match the incoming call rate. On a USR Sportster 14,400 external modem, these commands will lock the modem's error-corrected data rate to the speed used to issue the commands, but allow the serial port rate to vary for non-error-corrected connections: ATZ AT&B2&W Checking the Modem's Configuration

Most high-speed modems provide commands to view the modem's current operating parameters in a somewhat human-readable fashion. On the USR Sportster 14,400 external modems, the command Troubleshooting

Here are a few steps you can follow to check out the dialup modem on your system. Checking out the FreeBSD system

Hook up your modem to your FreeBSD system, boot the system, and, if your modem has status indication lights, watch to see whether the modem's 114 ?? I 0:00.10 /usr/libexec/getty V19200 ttyd0 115 ?? I 0:00.10 /usr/libexec/getty V19200 ttyd1 If you see something different, like this: 114 d0 I 0:00.10 /usr/libexec/getty V19200 ttyd0 ^^ and the modem hasn't accepted a call yet, this means that /etc/ttys to see if there are any mistakes there. Also, check the log file /var/log/messages to see if there are any log messages from /etc/ttys and /etc/gettytab, as well as the appropriate device special files /dev/ttyd?, for any mistakes, missing entries, or missing device special files. Try Dialing In

Try dialing into the system; be sure to use 8 bits, no parity, 1 stop bit on the remote system. If you don't get a prompt right away, or get garbage, try pressing <Enter> about once per second. If you still don't see a BREAK. If you are using a high-speed modem to do the dialing, try dialing again after locking the dialing modem's interface speed (via AT&B1 on a USR Sportster, for example). If you still can't get a /etc/gettytab again and double-check that The initial capability name specified in /etc/ttys for the line matches a name of a capability in /etc/gettytab - Each Each Each If you dial but the modem on the FreeBSD system won't answer, make sure that the modem is configured to answer the phone when describing your modem and your problem, and the good folks on the list will try to help. -Acknowledgements +Acknowledgments

Thanks to these people for comments and advice: diff --git a/handbook/diskless.sgml b/handbook/diskless.sgml index 3c2111ef85..0f76bd2e15 100644 --- a/handbook/diskless.sgml +++ b/handbook/diskless.sgml @@ -1,153 +1,153 @@ - + Diskless operation

Contributed by &a.martin;. netboot.com/netboot.rom allow you to boot your FreeBSD machine over the network and run FreeBSD without having a disk on your client. Under 2.0 it is now possible to have local swap. Swapping over NFS is also still supported. Supported Ethernet cards include: Western Digital/SMC 8003, 8013, 8216 and compatibles; NE1000/NE2000 and compatibles (requires recompile) Setup Instructions

Find a machine that will be your server. This machine will require enough disk space to hold the FreeBSD 2.0 binaries and have bootp, tftp and NFS services available. Tested machines: HP9000/8xx running HP-UX 9.04 or later (pre 9.04 doesn't work) - Sun/Solaries 2.3. (you may need to get + Sun/Solaris 2.3. (you may need to get bootp) Set up a bootp server to provide the client with IP, gateway, netmask. diskless:\ :ht=ether:\ :ha=0000c01f848a:\ :sm=255.255.255.0:\ :hn:\ :ds=192.1.2.3:\ :ip=192.1.2.4:\ :gw=192.1.2.5:\ :vm=rfc1048: Set up a TFTP server (on same machine as bootp server) to provide booting information to client. The name of this file is cfg.X.X.X.X (or /tftpboot/cfg.X.X.X.X, it will try both) where X.X.X.X is the IP address of the client. The contents of this file can be any valid netboot commands. Under 2.0, netboot has the following commands: help - print help list ip - print/set client's IP address server - print/set bootp/tftp server address netmask - print/set netmask hostname - print/set hostname kernel - print/set kernel name -rootfs - print/set rootfilesystem -swapfs - print/set swapfilesystem +rootfs - print/set root filesystem +swapfs - print/set swap filesystem swapsize - set diskless swapsize in Kbytes diskboot - boot from disk autoboot - continue boot process A typical completely diskless cfg file might contain: rootfs 192.1.2.3:/rootfs/myclient swapfs 192.1.2.3:/swapfs swapsize 20000 hostname myclient.mydomain A cfg file for a machine with local swap might contain: rootfs 192.1.2.3:/rootfs/myclient hostname myclient.mydomain Ensure that your NFS server has exported the root (and swap if applicable) filesystems to your client, and that the client has root access to these filesystems A typical /etc/exports file on FreeBSD might look like: /rootfs/myclient -maproot=0:0 myclient.mydomain /swapfs -maproot=0:0 myclient.mydomain And on HP-UX: /rootfs/myclient -root=myclient.mydomain /swapfs -root=myclient.mydomain If you are swapping over NFS (completely diskless configuration) create a swap file for your client using touch. If your swapfs command has the argument /swapfs as in the example above, the swapfile for myclient will be called /swapfs/swap.X.X.X.X where X.X.X.X is the client's IP addr, eg: # touch /swapfs/swap.192.1.2.4 Unpack the root filesystem in the directory the client will use for its root filesystem (/rootfs/myclient in the example above). On HP-UX systems: The server should be running HP-UX 9.04 or later for HP9000/800 series machines. Prior versions don't allow the creation of device files over NFS. When extracting /dev in /rootfs/myclient, beware that some systems (HPUX) will not create device files that FreeBSD is happy with. You may have to go to single user mode on the first bootup (press control-c during the bootup phase), cd /dev and do a "sh ./MAKEDEV all" from the client to fix this. Run netboot.com on the client or make an EPROM from the netboot.rom file Using Shared / and /usr filesystems

At present there isn't an officially sanctioned way of doing this, although I have been using a shared /usr filesystem and individual / filesystems for each client. If anyone has any suggestions on how to do this cleanly, please let me and/or the core group know. Compiling netboot for specific setups

Netboot can be compiled to support NE1000/2000 cards by changing the configuration in /sys/i386/boot/netboot/Makefile. See the comments at the top of this file. diff --git a/handbook/dma.sgml b/handbook/dma.sgml index 9b96da980c..e0da456634 100644 --- a/handbook/dma.sgml +++ b/handbook/dma.sgml @@ -1,511 +1,511 @@ - + DMA: What it is and how it works

Copyright © 1995 &a.uhclem;, All Rights Reserved. 18 October 1995. Direct Memory Access (DMA) is a method of allowing data to be moved from one location to another in a computer without intervention from the central processor (CPU). The way that the DMA function is implemented varies between computer architectures, so this discussion will limit itself to the implementation and workings of the DMA subsystem on the IBM Personal Computer (PC), the IBM PC/AT and all of its successors and clones. The PC DMA subsystem is based on the Intel 8237 DMA controller. The 8237 contains four DMA channels that can be programmed independently and any of the channels may be active at any moment. These channels are numbered 0, 1, 2 and 3. Starting with the PC/AT, IBM added a second 8237 chip, and numbered those channels 4, 5, 6 and 7. The original DMA controller (0, 1, 2 and 3) moves one byte in each transfer. The second DMA controller (4, 5, 6, and 7) moves 16-bits in each transfer. The two controllers are identical and the difference in transfer size is caused by the way the second controller is wired into the system. The 8237 has two electrical signals for each channel, named DRQ and -DACK. There are additional signals with the names HRQ (Hold Request), HLDA (Hold Acknowledge), -EOP (End of Process), and the bus control signals -MEMR (Memory Read), -MEMW (Memory Write), -IOR (I/O Read), and -IOW (I/O Write). The 8237 DMA is known as a ``fly-by'' DMA controller. This means that the data being moved from one location to another does not pass through the DMA chip and is not stored in the DMA chip. Subsequently, the DMA can only transfer data between an I/O port and a memory address, but not between two I/O ports or two memory locations. Note: The 8237 does allow two channels to be connected together to allow memory-to-memory DMA operations in a non-``fly-by'' mode, but nobody in the PC industry uses this scarce resource this way since it is faster to move data between memory locations using the CPU. In the PC architecture, each DMA channel is normally activated only when the hardware that uses that DMA requests a transfer by asserting the DRQ line for that channel. A Sample DMA transfer

Here is an example of the steps that occur to cause a DMA transfer. In this example, the floppy disk controller (FDC) has just read a byte from a diskette and wants the DMA to place it in memory at location 0x00123456. The process begins by the FDC asserting the DRQ2 signal to alert the DMA controller. The DMA controller will note that the DRQ2 signal is asserted. The DMA controller will then make sure that DMA channel 2 has been programmed and is enabled. The DMA controller also makes sure that none of the other DMA channels are active or have a higher priority. Once these checks are complete, the DMA asks the CPU to release the bus so that the DMA may use the bus. The DMA requests the bus by asserting the HRQ signal which goes to the CPU. The CPU detects the HRQ signal, and will complete executing the current instruction. Once the processor has reached a state where it can release the bus, it will. Now all of the signals normally generated by the CPU (-MEMR, -MEMW, -IOR, -IOW and a few others) are placed in a tri-stated condition (neither high or low) and then the CPU asserts the HLDA signal which tells the DMA controller that it is now in charge of the bus. Depending on the processor, the CPU may be able to execute a few additional instructions now that it no longer has the bus, but the CPU will eventually have to wait when it reaches an instruction that must read something from memory that is not in the internal processor cache or pipeline. Now that the DMA ``is in charge'', the DMA activates its -MEMR, -MEMW, -IOR, -IOW output signals, and the address outputs from the DMA are set to 0x3456, which will be used to direct the byte that is about to transferred to a specific memory location. The DMA will then let the device that requested the DMA transfer know that the transfer is commencing. This is done by asserting the -DACK signal, or in the case of the floppy disk controller, -DACK2 is asserted. The floppy disk controller is now responsible for placing the byte to be transferred on the bus Data lines. Unless the floppy controller needs more time to get the data byte on the bus (and if the peripheral needs more time it alerts the DMA via the READY signal), the DMA will wait one DMA clock, and then de-assert the -MEMW and -IOR signals so that the memory will latch and store the byte that was on the bus, and the FDC will know that the byte has been transferred. Since the DMA cycle only transfers a single byte at a time, the FDC now drops the DRQ2 signal, so that the DMA knows it is no longer needed. The DMA will de-assert the -DACK2 signal, so that the FDC knows it must stop placing data on the bus. The DMA will now check to see if any of the other DMA channels have any work to do. If none of the channels have their DRQ lines asserted, the DMA controller has completed its work and will now tri-state the -MEMR, -MEMW, -IOR, -IOW and address signals. Finally, the DMA will de-assert the HRQ signal. The CPU sees this, and de-asserts the HOLDA signal. Now the CPU activates its -MEMR, -MEMW, -IOR, -IOW and address lines, and it resumes executing instructions and accessing main memory and the peripherals. For a typical floppy disk sector, the above process is repeated 512 times, once for each byte. Each time a byte is transferred, the address register in the DMA is incremented and the counter that shows how many bytes are to be transferred is decremented. When the counter reaches zero, the DMA asserts the EOP signal, which indicates that the counter has reached zero and no more data will be transferred until the DMA controller is reprogrammed by the CPU. This event is also called the Terminal Count (TC). There is only one EOP signal, because only one DMA channel can be active at any instant. If a peripheral wants to generate an interrupt when the transfer of a buffer is complete, it can test for its -DACK signal and the EOP signal both being asserted at the same time. When that happens, it means the DMA won't transfer any more information for that peripheral without intervention by the CPU. The peripheral can then assert one of the interrupt signals to get the processors' attention. The DMA chip itself is not capable of generating an interrupt. The peripheral and its associated hardware is responsible for generating any interrupt that occurs. It is important to understand that although the CPU always releases the bus to the DMA when the DMA makes the request, this action is invisible to both applications and the operating systems, except for slight changes in the amount of time the processor takes to execute instructions when the DMA is active. Subsequently, the processor must poll the peripheral, poll the registers in the DMA chip, or receive an interrupt from the peripheral to know for certain when a DMA transfer has completed. DMA Page Registers and 16Meg address space limitations

You may have noticed earlier that instead of the DMA setting the address lines to 0x00123456 as we said earlier, the DMA only set 0x3456. The reason for this takes a bit of explaining. When the original IBM PC was designed, IBM elected to use both DMA and interrupt controller chips that were designed for use with the 8085, an 8-bit processor with an address space of 16 bits (64K). Since the IBM PC supported more than 64K of memory, something had to be done to allow the DMA to read or write memory locations above the 64K mark. What IBM did to solve this problem was to add a latch for each DMA channel, that holds the upper bits of the address to be read to or written from. Whenever a DMA channel is active, the contents of that latch is written to the address bus and kept there until the DMA operation for the channel ends. These latches are called ``Page Registers''. So for our example above, the DMA would put the 0x3456 part of the address on the bus, and the Page Register for DMA channel 2 would put 0x0012xxxx on the bus. Together, these two values form the complete address in memory that is to be accessed. Because the Page Register latch is independent of the DMA chip, the area of memory to be read or written must not span a 64K physical boundary. If the DMA accesses memory location 0xffff, the DMA will then increment the address register and it will access the next byte at 0x0000, not 0x10000. The results of letting this happen are probably not intended. Note: ``Physical'' 64K boundaries should not be confused with 8086-mode 64K ``Segments'', which are created by adding a segment register with an offset register. Page Registers have no address overlap. To further complicate matters, the external DMA address latches on the PC/AT hold only eight bits, so that gives us 8+16=24 bits, which means that the DMA can only point at memory locations between 0 and 16Meg. For newer computers that allow more than 16Meg of memory, the PC-compatible DMA cannot access locations above 16Meg. To get around this restriction, operating systems will reserve a buffer in an area below 16Meg that also doesn't span a physical 64K boundary. Then the DMA will be programmed to read data to that buffer. Once the DMA has moved the data into this buffer, the operating system will then copy the data from the buffer to the address where the data is really supposed to be stored. When writing data from an address above 16Meg to a DMA-based peripheral, the data must be first copied from where it resides into a buffer located below 16Meg, and then the DMA can copy the data from the buffer to the hardware. In FreeBSD, these reserved buffers are called ``Bounce Buffers''. In the MS-DOS world, they are sometimes called ``Smart Buffers''. DMA Operational Modes and Settings

The 8237 DMA can be operated in several modes. The main ones are: Block/Demand Once the DMA acquires the system bus, an entire block of data is transferred, up to a maximum of 64K. If the peripheral needs additional time, it can assert the READY signal. READY should not be used excessively, and for slow peripheral transfers, the Single Transfer Mode should be used instead. The difference between Block and Demand is the once a Block transfer is started, it runs until the transfer count reaches zero. DRQ only needs to be asserted until -DACK is asserted. Demand Mode will transfer one more bytes until DRQ is de-asserted, then when DRQ is asserted later, the transfer resumes where it was suspended. Older hard disk controllers used Demand Mode until CPU speeds increased to the point that it was more efficient to read the data using the CPU. Cascade This mechanism allows a DMA channel to request the bus, but then the attached peripheral device is responsible for placing addressing information on the bus. This is also known as ``Bus Mastering''. When a DMA channel in Cascade Mode receives control of the bus, the DMA does not place addresses and I/O control signals on the bus like it normally does. Instead, the DMA only asserts the -DACK signal for this channel. Now it is up to the device connected to that DMA channel to provide address and bus control signals. The peripheral has complete control over the system bus, and can do reads and/or writes to any address below 16Meg. When the peripheral is finished with bus, it de-asserts the DRQ line, and the DMA controller can return control to the CPU or to some other DMA channel. Cascade Mode can be used to chain multiple DMA controllers together, and this is exactly what DMA Channel 4 is used for in the PC. When a peripheral requests the bus on DMA channels 0, 1, 2 or 3, the slave DMA controller asserts HLDREQ, but this wire is actually connected to DRQ4 on the primary DMA controller. The primary DMA controller then requests the bus from the CPU using HLDREQ. Once the bus is granted, -DACK4 is asserted, and that wire is actually connected to the HLDA signal on the slave DMA controller. The slave DMA controller then transfers data for the DMA channel that requested it, or the slave DMA may grant the bus to a peripheral that wants to perform its own bus-mastering. Because of this wiring arrangement, only DMA channels 0, 1, 2, 3, 5, 6 and 7 are usable on PC/AT systems. Note: DMA channel 0 was reserved for refresh operations in early IBM PC computers, but is generally available for use by peripherals in modern systems. When a peripheral is performing Bus Mastering, it is important that the peripheral transmit data to or from memory constantly while it holds the system bus. If the peripheral cannot do this, it must release the bus frequently so that the system can perform refresh operations on memory. Since memory read and write cycles ``count'' as refresh cycles (a refresh cycle is actually an incomplete memory read cycle), as long as the peripheral controller continues reading or writing data to sequential memory locations, that action will refresh all of memory. Bus-mastering is found in some SCSI adapters and other high-performance peripheral cards. Autoinitialize This mode causes the DMA to perform Byte, Block or Demand transfers, but when the DMA transfer counter reaches zero, the counter and address is set back to where they were when the DMA channel was originally programmed. This means that as long as the device requests transfers, they will be granted. It is up to the CPU to move new data into the fixed buffer ahead of where the DMA is about to transfer it for output operations, and read new data out of the buffer behind where the DMA is writing on input operations. This technique is frequently used on audio devices that have small or no hardware ``sample'' buffers. There is additional CPU overhead to manage this ``circular'' buffer, but in some cases this may be the only way to eliminate the latency that occurs when the DMA counter reaches zero and the DMA stops until it is reprogrammed. Programming the DMA

The DMA channel that is to be programmed should always be ``masked'' before loading any settings. This is because the hardware might assert DRQ, and the DMA might respond, even though not all of the parameters have been loaded or updated. Once masked, the host must specify the direction of the transfer (memory-to-I/O or I/O-to-memory), what mode of DMA operation is to be used for the transfer (Single, Block, Demand, Cascade, etc), and finally the address and length of the transfer are loaded. The length that is loaded is one less than the amount you expect the DMA to transfer. The LSB and MSB of the address and length are written to the same 8-bit I/O port, so another port must be written to first to guarantee that the DMA accepts the first byte as the LSB and the second byte as the MSB. Then, be sure to update the Page Register, which is external to the DMA and is accessed through a different set of I/O ports. Once all the settings are ready, the DMA channel can be un-masked. That DMA channel is now considered to be ``armed'', and will respond when DRQ is asserted. - Refer to a hardware databook for precise programming + Refer to a hardware data book for precise programming details for the 8237. You will also need to refer to the I/O port map for the PC system. This map describes where the DMA and Page Register ports are located. A complete table is located below. DMA Port Map

All systems based on the IBM-PC and PC/AT have the DMA hardware located at the same I/O ports. The complete list is provided below. Ports assigned to DMA Controller #2 are undefined on non-AT designs. 0x00 - 0x1f DMA Controller #1 (Channels 0, 1, 2 and 3)

DMA Address and Count Registers 0x00 write Channel 0 starting address 0x00 read Channel 0 current address 0x02 write Channel 0 starting word count 0x02 read Channel 0 remaining word count 0x04 write Channel 1 starting address 0x04 read Channel 1 current address 0x06 write Channel 1 starting word count 0x06 read Channel 1 remaining word count 0x08 write Channel 2 starting address 0x08 read Channel 2 current address 0x0a write Channel 2 starting word count 0x0a read Channel 2 remaining word count 0x0c write Channel 3 starting address 0x0c read Channel 3 current address 0x0e write Channel 3 starting word count 0x0e read Channel 3 remaining word count DMA Command Registers 0x10 write Command Register 0x10 read Status Register 0x12 write Request Register 0x12 read - 0x14 write Single Mask Register Bit 0x14 read - 0x16 write Mode Register 0x16 read - 0x18 write Clear LSB/MSB Flip-Flop 0x18 read - 0x1a write Master Clear/Reset 0x1a read Temporary Register 0x1c write Clear Mask Register 0x1c read - 0x1e write Write All Mask Register Bits 0x1e read - 0xc0 - 0xdf DMA Controller #2 (Channels 4, 5, 6 and 7)

DMA Address and Count Registers 0xc0 write Channel 4 starting address 0xc0 read Channel 4 current address 0xc2 write Channel 4 starting word count 0xc2 read Channel 4 remaining word count 0xc4 write Channel 5 starting address 0xc4 read Channel 5 current address 0xc6 write Channel 5 starting word count 0xc6 read Channel 5 remaining word count 0xc8 write Channel 6 starting address 0xc8 read Channel 6 current address 0xca write Channel 6 starting word count 0xca read Channel 6 remaining word count 0xcc write Channel 7 starting address 0xcc read Channel 7 current address 0xce write Channel 7 starting word count 0xce read Channel 7 remaining word count DMA Command Registers 0xd0 write Command Register 0xd0 read Status Register 0xd2 write Request Register 0xd2 read - 0xd4 write Single Mask Register Bit 0xd4 read - 0xd6 write Mode Register 0xd6 read - 0xd8 write Clear LSB/MSB Flip-Flop 0xd8 read - 0xda write Master Clear/Reset 0xda read Temporary Register 0xdc write Clear Mask Register 0xdc read - 0xde write Write All Mask Register Bits 0xde read - 0x80 - 0x9f DMA Page Registers

0x87 r/w DMA Channel 0 0x83 r/w DMA Channel 1 0x81 r/w DMA Channel 2 0x82 r/w DMA Channel 3 0x8b r/w DMA Channel 5 0x89 r/w DMA Channel 6 0x8a r/w DMA Channel 7 0x8f Refresh diff --git a/handbook/eresources.sgml b/handbook/eresources.sgml index b826329cd9..649aaaf69d 100644 --- a/handbook/eresources.sgml +++ b/handbook/eresources.sgml @@ -1,363 +1,363 @@ - + Resources on the Internet

Contributed by &a.jkh;.

The rapid pace of FreeBSD progress makes print media impractical as a means for following the latest developments. Electronic resources are the best, if not often the only way stay informed of the latest advances. Since FreeBSD is a volunteer effort, the user community itself also generally serves as a `technical support department' of sorts, with electronic mail and Usenet news being the most effective way of reaching that community. The most important points of contact with the FreeBSD user community are outlined below. If you are aware of other resources not mentioned here, please send them to doc@freebsd.org so that they may also be included. Mailing lists

Though many of the FreeBSD development members read USENET, we cannot always guarantee that we'll get to your questions in a timely fashion (or at all) if you post them only to one of the comp.unix.bsd.freebsd.* groups. By addressing your questions to the appropriate mailing list you will reach both us and a concentrated FreeBSD audience, invariably assuring a better (or at least faster) response.

The charters for the various lists are given at the bottom of this document. Please read the charter before joining a list since we must strive to keep the signal to noise ratio of the lists high, especially in the technical ones. Archives are kept for all of the mailing lists and can be searched using the the . The keyword searchable archive offers an excellent way of finding answers to frequently asked questions and should be consulted before posting a question. List summary

General lists: The following are general lists which anyone is free to join: List Purpose ---------------------------------------------------------------------- freebsd-announce Important events and project milestones freebsd-bugs Bug reports freebsd-chat Non-technical items related to the FreeBSD community freebsd-current Discussion concerning the use of FreeBSD-current freebsd-stable Discussion concerning the use of FreeBSD-stable freebsd-isp Issues for Internet Service Providers using FreeBSD freebsd-policy General policy issues and suggestions freebsd-questions User questions Technical lists: The following lists are for technical discussion. You should read the charter carefully before joining one, keeping any messages sent to a list within the scope of the guidelines. List Purpose ---------------------------------------------------------------------- freebsd-doc The FreeBSD Documentation project freebsd-fs Filesystems freebsd-hackers General technical discussion freebsd-hardware General discussion of hardware for running FreeBSD freebsd-multimedia Multimedia discussion freebsd-platforms Concerning ports to non-Intel architecture platforms freebsd-ports Discussion of the ports collection freebsd-security Security issues freebsd-scsi The SCSI subsystem Limited lists: The following lists require approval to join, though anyone is free to send suggestions and comments to them. It is a good idea establish a presence in the technical lists before asking to join one of these limited lists. List Purpose ---------------------------------------------------------------------- freebsd-admin Administrative issues freebsd-arch Architecture and design discussions freebsd-core FreeBSD core team freebsd-install Installation development freebsd-user-groups User group coordination CVS lists: The following lists are for people interested in seeing the log messages for changes to various areas of the source tree. List name Source area Area Description (source for) ---------------------------------------------------------------------- cvs-CVSROOT /usr/src/[A-Z]* Top level /usr/src file changes cvs-all /usr/src All changes to the tree (superset) cvs-bin /usr/src/bin System binaries cvs-etc /usr/src/etc System files cvs-games /usr/src/games Games cvs-gnu /usr/src/gnu GPL'd utilities cvs-include /usr/src/include Include files cvs-kerberosIV /usr/src/kerberosIV Kerberos encryption code cvs-lib /usr/src/lib System libraries cvs-libexec /usr/src/libexec System binaries cvs-ports /usr/ports Ported software cvs-sbin /usr/src/sbin System binaries cvs-share /usr/src/share System shared files cvs-sys /usr/src/sys Kernel cvs-usrbin /usr/src/usr.bin Use binaries cvs-usrsbin /usr/src/usr.sbin System binaries How to subscribe

All mailing lists live on FreeBSD.ORG, so to post to a given list you simply mail to listname@FreeBSD.ORG. It will then be redistributed to mailing list members world-wide. To subscribe to a list, send mail to: majordomo@FreeBSD.ORG And include the keyword subscribe [] In the body of your message. For example, to subscribe yourself to freebsd-announce, you'd do: % mail majordomo@FreeBSD.ORG subscribe freebsd-announce ^D If you want to subscribe yourself under a different name, or submit a subscription request for a local mailing list (note: this is more efficient if you have several interested parties at one site, and highly appreciated by us!), you would do something like: % mail majordomo@FreeBSD.ORG subscribe freebsd-announce local-announce@somesite.com ^D Finally, it is also possible to unsubscribe yourself from a list, get a list of other list members or see the list of mailing lists again by sending other types of control messages to majordomo. For a complete list of available commands, do this: % mail majordomo@FreeBSD.ORG help ^D Again, we'd like to request that you keep discussion in the technical mailing lists on a technical track. If you're only interested in the "high points" then it's suggested that you join freebsd-announce, which is intended only for infrequent traffic. List charters

Administrative issues Important events / milestones This is the mailing list for people interested only in occasional announcements of significant freebsd events. This includes announcements about snapshots and other releases. It contains announcements of new FreeBSD capabilities. It may contain calls for volunteers etc. This is a low volume list. Architecture and design discussions This is the mailing list for people discussing FreeBSD architectural issues. It is a closed list, and not for general subscription. Bug reports This is the mailing list for reporting bugs in FreeBSD Whenever possible, bugs should be submitted using "send-pr". Non technical items related to the community This list contains the overflow from the other lists about non-technical, social information. It includes discussion about whether Jordan looks like a toon ferret or not, whether or not to type in capitals, who is drinking too much coffee, where the best beer is brewed, who is brewing beer in their basement, and so on. Occasional announcements of important events (such as upcoming parties, weddings, births, new jobs, etc) can be made to the technical lists, but the follow ups should be directed to this -chat list. FreeBSD core team This is an internal mailing list for use by the core members. Discussions about the use of FreeBSD-current This is the mailing list for users of freebsd-current. It includes warnings about new features coming out in -current that will affect the users, and instructions on steps that must be taken to remain -current. Anyone running "current" must subscribe to this list. Discussions about the use of FreeBSD-current This is the digest version of the freebsd-current mailing list. The digest consists of all messages sent to freebsd-current bundled together and mailed out as a single message. The average digest size is about 40kB. Discussions about the use of FreeBSD-stable This is the mailing list for users of freebsd-stable. It includes warnings about new features coming out in -stable that will affect the users, and instructions on steps that must be taken to remain -stable. Anyone running ``stable'' should subscribe to this list. Documentation project This mailing list belongs to the FreeBSD Doc Project and is for the discussion of documentation related issues and projects. Filesystems Discussions concerning FreeBSD filesystems. Technical discussions This is a forum for technical discussions related to FreeBSD. This is the primary technical mailing list. It is for individuals actively working on FreeBSD, to bring up problems or discuss alternative solutions. Individuals interested in following the technical discussion are also welcome. Technical discussions This is the digest version of the freebsd-hackers mailing list. The digest consists of all messages sent to freebsd-hackers bundled together and mailed out as a single message. The average digest size is about 40kB. General discussion of FreeBSD hardware General discussion about the types of hardware that FreeBSD runs on, various problems and suggestions concerning what to buy or avoid. Installation discussion This mailing list is for discussing FreeBSD installation development for the future releases. Issues for Internet Service Providers This mailing list is for discussing topics relevant to Internet -Serivce Providers (ISPs) using FreeBSD. +Service Providers (ISPs) using FreeBSD. Multimedia discussions This is a forum about multimedia applications using FreeBSD. Discussion center around multimedia applications, their installation, their development and their support within FreeBSD Porting to Non-Intel platforms Cross-platform freebsd issues, general discussion and proposals for non-Intel FreeBSD ports. Policy issues and suggestions This is a forum for policy discussions related to FreeBSD. This includes where FreeBSD is going, how to set up a consortium, whether or not and how to make FreeBSD pay for itself, how to attract more users, and so on. When a topic relates directly to FreeBSD but has little or no technical content then it should be sent to this list. Discussion of "ports" Discussions concerning FreeBSD's "ports collection" (/usr/ports), proposed ports, modifications to ports collection infrastructure and general coordination efforts. User questions This is the mailing list for questions about FreeBSD. You should not send "how to" questions to the technical lists unless you consider the question to be pretty technical. User questions This is the digest version of the freebsd-questions mailing list. The digest consists of all messages sent to freebsd-questions bundled together and mailed out as a single message. The average digest size is about 40kB. SCSI subsystem This is the mailing list for people working on the scsi subsystem for FreeBSD. Security issues FreeBSD computer security issues (DES, Kerberos, known security holes and fixes, etc). User Group Coordination List This is the mailing list for the coordinators from each of the local area Users Groups to discuss matters with each other and a designated individual from the Core Team. This mail list should be limited to meeting synopsis and coordination of projects that span User Groups. Usenet newsgroups

In addition to two FreeBSD specific newsgroups, there are many others in which FreeBSD is discussed or are otherwise relevant to FreeBSD users. are available for some of these newsgroups from courtesy of Warren Toomey <wkt@cs.adfa.oz.au>. BSD specific newsgroups

comp.unix.bsd.freebsd.announce comp.unix.bsd.freebsd.misc Other Unix newsgroups of interest

comp.unix comp.unix.questions comp.unix.admin comp.unix.programmer comp.unix.shell comp.unix.user-friendly comp.security.unix comp.sources.unix comp.unix.advocacy comp.unix.misc comp.os.386bsd.announce comp.os.386bsd.apps comp.os.386bsd.bugs comp.os.386bsd.development comp.os.386bsd.misc comp.os.386bsd.questions comp.bugs.4bsd comp.bugs.4bsd.ucb-fixes comp.unix.bsd X-Window system

comp.windows.x.i386unix comp.windows.x comp.windows.x.apps comp.windows.x.announce comp.windows.x.intrinsics comp.windows.x.motif comp.windows.x.pex comp.emulators.ms-windows.wine World Wide Web servers

diff --git a/handbook/esdi.sgml b/handbook/esdi.sgml index 7ced7a26f3..3251187472 100644 --- a/handbook/esdi.sgml +++ b/handbook/esdi.sgml @@ -1,421 +1,421 @@ - + Using ESDI hard disks

Copyright © 1995, &a.wilko;.24 September 1995. ESDI is an acronym that means Enhanced Small Device Interface. It is loosely based on the good old ST506/412 interface originally devised by Seagate Technology, the makers of the first affordable 5.25" winchester disk. The acronym says Enhanced, and rightly so. In the first place the speed of the interface is higher, 10 or 15 Mbits/second instead of the 5 Mbits/second of ST412 interfaced drives. Secondly some higher level commands are added, making the ESDI interface somewhat 'smarter' to the operating system driver writers. It is by no means as smart as SCSI by the way. ESDI - is standardised by ANSI. + is standardized by ANSI. Capacities of the drives are boosted by putting more sectors on each track. Typical is 35 sectors per track, high capacity drives I've seen were up to 54 sectors/track. Although ESDI has been largely obsoleted by IDE and SCSI interfaces, the availability of free or cheap surplus drives makes them ideal for low (or now) budget systems. Concepts of ESDI

Physical connections

The ESDI interface uses two cables connected to each drive. - One cable is a 34 pin flatcable edge connector that carries + One cable is a 34 pin flat cable edge connector that carries the command and status signals from the controller to the - drive and viceversa. The command cable is daisy chained + drive and vice-versa. The command cable is daisy chained between all the drives. So, it forms a bus onto which all drives are connected. - The second cable is a a 20 pin flatcable edge connector that + The second cable is a a 20 pin flat cable edge connector that carries the data to and from the drive. This cable is radially connected, so each drive has it's own direct connection to the controller. To the best of my knowledge PC ESDI controllers are limited to using a maximum of 2 drives per controller. This is compatibility feature(?) left over from the WD1003 standard that reserves only a single bit for device addressing. Device addressing

On each command cable a maximum of 7 devices and 1 controller can be present. To enable the controller to uniquely identify which drive it addresses, each ESDI device is equipped with jumpers or switches to select the devices address. On PC type controllers the first drive is set to address 0, the second disk to address 1. Always make sure you set each disk to an unique address! So, on a PC with it's two drives/controller maximum the first drive is drive 0, the second is drive 1. Termination

The daisy chained command cable (the 34 pin cable remember?) needs to be terminated at the last drive on the chain. For this purpose ESDI drives come with a termination resistor network that can be removed or disabled by a jumper when it is not used. So, one and only one drive, the one at - the fartest end of the command + the farthest end of the command cable has it's terminator installed/enabled. The controller automatically terminates the other end of the cable. Please note that this implies that the controller must be at one end of the cable and not in the middle. Using ESDI disks with FreeBSD

Why is ESDI such a pain to get working in the first place? People who tried ESDI disks with FreeBSD are known to have developed a profound sense of frustration. A combination of factors works against you to produce effects that are hard to understand when you have never seen them before. This has also led to the popular legend ESDI and FreeBSD is a plain NO-GO. The following sections try to list all the pitfalls and solutions. ESDI speed variants

- As briefly mentioned before, ESDI comes in two speed flavours. + As briefly mentioned before, ESDI comes in two speed flavors. The older drives and controllers use a 10 Mbits/second data transfer rate. Newer stuff uses 15 Mbits/second. It is not hard to imagine that 15 Mbits/second drive cause problems on controllers laid out for 10 Mbits/second. As always, consult your controller and drive documentation to see if things match. Stay on track

Mainstream ESDI drives use 34 to 36 sectors per track. Most (older) controllers cannot handle more than this number of sectors. Newer, higher capacity, drives use higher numbers of sectors per track. For instance, I own a 670 Mb drive that has 54 sectors per track. In my case, the controller could not handle this number of sectors. It proved to work well except that it only used 35 sectors on each track. This meant losing a - lot of diskspace. + lot of disk space. Once again, check the documentation of your hardware for more info. Going out-of-spec like in the example might or might not work. Give it a try or get another more capable controller. Hard or soft sectoring

Most ESDI drives allow hard or soft sectoring to be selected using a jumper. Hard sectoring means that the drive will produce a sector pulse on the start of each new sector. The controller uses this pulse to tell when it should start to write or read. Hard sectoring allows a selection of sector size (normally 256, 512 or 1024 bytes per formatted sector). FreeBSD uses 512 byte sectors. The number of sectors per track also varies while still using the same number of bytes per formatted sector. The number of unformatted bytes per sector varies, dependent on your controller it needs more or less overhead bytes to work correctly. Pushing more sectors on a track of course gives you more usable space, but might give problems if your controller needs more bytes than the drive offers. In case of soft sectoring, the controller itself determines where to start/stop reading or writing. For ESDI hard sectoring is the default (at least on everything I came across). I never felt the urge to try soft sectoring. In general, experiment with sector settings before you install FreeBSD because you need to re-run the low-level format after each change. Low level formatting

ESDI drives need to be low level formatted before they are usable. A reformat is needed whenever you figgle with the number of sectors/track jumpers or the physical orientation of the drive (horizontal, vertical). So, first think, then format. The format time must not be underestimated, for big disks it can take hours. After a low level format, a surface scan is done to find and flag bad sectors. Most disks have a manufacturer bad block list listed on a piece of paper or adhesive sticker. In addition, on most disks the list is also written onto the disk. Please use the manufacturer's list. It is much easier to remap a defect now than after FreeBSD is installed. Stay away from low-level formatters that mark all sectors of a track as bad as soon as they find one bad sector. Not only does this waste space, it also and more importantly causes you grief with bad144 (see the section on bad144). Translations

Translations, although not exclusively a ESDI-only problem, might give you real trouble. - Translations come in multiple flavours. Most of them + Translations come in multiple flavors. Most of them have in common that they attempt to work around the limitations posed upon disk geometries by the original IBM PC/AT design (thanks IBM!). First of all there is the (in)famous 1024 cylinder limit. For a system to be able to boot, the stuff (whatever operating system) must be in the first 1024 cylinders of a disk. Only 10 bits are available to encode the cylinder number. For the number of sectors the limit is 64 (0-63). When you combine the 1024 cylinder limit with the 16 head limit (also a design feature) you max out at fairly limited disk sizes. To work around this problem, the manufacturers of ESDI PC controllers added a BIOS prom extension on their boards. This BIOS extension handles disk I/O for booting (and for some operating systems all disk I/O) by using translation. For instance, a big drive might be presented to the system as having 32 heads and 64 sectors/track. The result is that the number of cylinders is reduced to something below 1024 and is therefore usable by the system without problems. It is noteworthy to know that FreeBSD after it's kernel has started no longer uses the BIOS. More on this later. A second reason for translations is the fact that most older system BIOSes could only handle drives with 17 sectors per track (the old ST412 standard). Newer system BIOSes usually have a user-defined drive type (in most cases this is drive type 47). Whatever you do to translations after reading this document, keep in mind that if you have multiple operating systems on the same disk, all must use the same translation While on the subject of translations, I've seen one controller type (but there are probably more like this) offer the option to logically split a drive in multiple partitions as a BIOS option. I had select 1 drive == 1 partition because this - controller wrote this info onto the disk. On powerup it + controller wrote this info onto the disk. On power-up it read the info and presented itself to the system based on the info from the disk. Spare sectoring

Most ESDI controllers offer the possibility to remap bad sectors. During/after the low-level format of the disk bad sectors are marked as such, and a replacement sector is put in place (logically of course) of the bad one. In most cases the remapping is done by using N-1 sectors on - each track for actual datastorage, and sector N itself is + each track for actual data storage, and sector N itself is the spare sector. N is the total number of sectors physically available on the track. The idea behind this is that the operating system sees a 'perfect' disk without bad sectors. In the case of FreeBSD this concept is not usable. The problem is that the translation from bad to good is performed by the BIOS of the ESDI controller. FreeBSD, being a true 32 bit operating system, does not use the BIOS after it has been booted. Instead, it has device drivers that talk directly to the hardware. So: don't use spare sectoring, bad block remapping or whatever it may be called by the controller manufacturer when you want to use the disk for FreeBSD. Bad block handling

The preceding section leaves us with a problem. The controller's bad block handling is not usable and still FreeBSD's filesystems assume perfect media without any flaws. To solve this problem, FreeBSD use the bad144 tool. Bad144 (named after a Digital Equipment standard for bad block handling) scans a FreeBSD slice for bad blocks. Having found these bad blocks, it writes a table with the offending block numbers to the end of the FreeBSD slice. When the disk is in operation, the disk accesses are checked - against the table read from the disk. Whenever a blocknumber + against the table read from the disk. Whenever a block number is requested that is in the bad144 list, a replacement block (also from the end of the FreeBSD slice) is used. In this way, the bad144 replacement scheme presents 'perfect' media to the FreeBSD filesystems. There are a number of potential pitfalls associated with the use of bad144. First of all, the slice cannot have more than 126 bad sectors. If your drive has a high number of bad sectors, you might need to divide it into multiple FreeBSD slices each containing less than 126 bad sectors. Stay away from low-level format programs that mark every sector of a track as bad when they find a flaw on the track. As you can imagine, the 126 limit is quickly reached when the low-level format is done this way. Second, if the slice contains the root filesystem, the slice should be within the 1024 cylinder BIOS limit. During the boot process the bad144 list is read using the BIOS and this only succeeds when the list is within the 1024 cylinder limit. Note that the restriction is not that only the root filesystem must be within the 1024 cylinder limit, but rather the entire slice that contains the root filesystem. Kernel configuration

ESDI disks are handled by the same wddriver as IDE and ST412 MFM disks. The wd driver should work for all WD1003 compatible interfaces. Most hardware is jumperable for one of two different I/O address ranges and IRQ lines. This allows you to have two wd type controllers in one system. When your hardware allows non-standard strappings, you can use these with FreeBSD as long as you enter the correct info into the kernel config file. An example from the kernel config file (they live in /sys/i386/conf BTW). # First WD compatible controller controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr disk wd0 at wdc0 drive 0 disk wd1 at wdc0 drive 1 # Second WD compatible controller controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 Particulars on ESDI hardware

Adaptec 2320 controllers

- I succesfully installed FreeBSD onto a ESDI disk controlled by a + I successfully installed FreeBSD onto a ESDI disk controlled by a ACB-2320. No other operating system was present on the disk. To do so I low level formatted the disk using NEFMT.EXE (ftpable from www.adaptec.com) and answered NO to the question whether the disk should be formatted with a spare sector on each track. The BIOS on the ACD-2320 was disabled. I used the 'free configurable' option in the system BIOS to allow the BIOS to boot it. Before using NEFMT.EXE I tried to format the disk using the - ACB-2320 BIOS builtin formatter. This proved to be a showstopper, + ACB-2320 BIOS builtin formatter. This proved to be a show stopper, because it didn't give me an option to disable spare sectoring. With spare sectoring enabled the FreeBSD installation process broke down on the bad144 run. Please check carefully which ACB-232xy variant you have. The x is either 0 or 2, indicating a controller without or with a floppy controller on board. The y is more interesting. It can either be a blank, a "A-8" or a "D". A blank indicates a plain 10 Mbits/second controller. An "A-8" indicates a 15 Mbits/second controller capable of handling 52 sectors/track. A "D" means a 15 Mbits/second controller that can also handle drives with > 36 sectors/track (also 52 ?). All variations should be capable of using 1:1 interleaving. Use 1:1, FreeBSD is fast enough to handle it. Western Digital WD1007 controllers

- I succesfully installed FreeBSD onto a ESDI disk controlled by a + I successfully installed FreeBSD onto a ESDI disk controlled by a WD1007 controller. To be precise, it was a WD1007-WA2. Other variations of the WD1007 do exist. To get it to work, I had to disable the sector translation and the WD1007's onboard BIOS. This implied I could not use the low-level formatter built into this BIOS. Instead, I grabbed WDFMT.EXE from www.wdc.com Running this formatted my drive just fine. Ultrastor U14F controllers

According to multiple reports from the net, Ultrastor ESDI boards work OK with FreeBSD. I lack any further info on particular settings. Further reading

If you intend to do some serious ESDI hacking, you might want to have the official standard at hand: The latest ANSI X3T10 committee document is: Enhanced Small Device Interface (ESDI) [X3.170-1990/X3.170a-1991] [X3T10/792D Rev 11] On Usenet the newsgroup is a noteworthy place to look for more info. The World Wide Web (WWW) also proves to be a very handy info source: For info on Adaptec ESDI controllers see . For info on Western Digital controllers see . Thanks to...

Andrew Gordon for sending me an Adaptec 2320 controller and ESDI disk for testing. diff --git a/handbook/firewalls.sgml b/handbook/firewalls.sgml index eed8599f83..efa4dde884 100644 --- a/handbook/firewalls.sgml +++ b/handbook/firewalls.sgml @@ -1,525 +1,525 @@ - + Firewalls

Contributed by &a.gpalmer;.4th of October 1995 Firewalls are an area of increasing interest for people who are connected to the Internet, and are even finding applications on private networks to provide enhanced security. This section will hopefully explain what firewalls are, how to use them, and how to use -the facilities provided in the FreeBSD kernel to impliment them. +the facilities provided in the FreeBSD kernel to implement them. Note: People often think that having a firewall between your companies internal network and the ``Big Bad Internet'' will solve all your security problems. It may help, but a poorly setup firewall system is more of a security risk than not having one at all. A firewall can only add another layer of security to your systems, but they will not be able to stop a really determined hacker from penetrating your internal network. If you let internal security lapse because you believe your firewall to be impenetrable, you have just made the hackers job that bit easier. What is a firewall?

There are currently two distinct types of firewalls in common use on the Internet today. The first type is more properly called a packet filtering router, where the kernel on a multi-homed machine chooses whether to forward or block packets based on a set of rules. The second type, known as proxy servers, rely on daemons to provide authentication and to forward packets, possibly on a multi-homed machine which has kernel packet forwarding disabled.

Sometimes sites combine the two types of firewalls, so that only a certain machine (known as a bastion host) is allowed to send packets through a packet filtering router onto an internal network. Proxy services are run on the bastion host, which are generally more secure than normal authentication mechanisms.

FreeBSD comes with a kernel packet filter (known as IPFW), which is what the rest of this section will concentrate on. Proxy servers can be built on FreeBSD from third party software, but there -is such a vareity of proxy servers available that it would be +is such a variety of proxy servers available that it would be impossible to cover them in this document. Packet filtering routers

A router is a machine which forwards packets between two or more networks. A packet filtering router has an extra piece of code in it's kernel, which compares each packet to a list of rules before deciding if it should be forwarded or not. Most modern IP routing software has packet filtering code in it, which defaults to forwarding all packets. To enable the filters, you need to define a set of rules for the filtering code, so that it can decide if the packet should be allowed to pass or not.

To decide if a packet should be passed on or not, the code looks through it's set of rules for a rule which matches the contents of this packets headers. Once a match is found, the rule action is obeyed. The rule action could be to drop the packet, to forward the packet, or even to send an ICMP message back to the originator. Only the first match counts, as the rules are searched in order. Hence, the list of rules can be referred to as a ``rule chain''.

The packet matching criteria varies depending on the software used, but typically you can specify rules which depend on the source IP address of the packet, the destination IP address, the source port number, the destination port number (for protocols which support ports), or even the packet type (UDP, TCP, ICMP, etc). Proxy servers

Proxy servers are machines which have had the normal system daemons (telnetd, ftpd, etc) replaced with special servers. These servers are called proxy servers as they normally only allow onward connections to be made. This enables you to run (for example) a proxy telnet server on your firewall host, and people can telnet in to your firewall from the outside, go through some authentication mechanism, and then gain access to the internal network (alternatively, proxy servers can be used for signals coming from the internal network and heading out).

Proxy servers are normally more secure than normal servers, and often have a wider variety of authentication mechanisms available, including ``one-shot'' password systems so that even if someone manages to discover what password you used, they will not be able to use it to gain access to your systems as the password instantly expires. As they do not actually give users access to the host machine, it becomes a lot more difficult for someone to install backdoors around your security system.

Proxy servers often have ways of restricting access further, so that only certain hosts can gain access to the servers, and often they can be set up so that you can limit which users can talk to which destination machine. Again, what facilities are available depends largely on what proxy software you choose. What does IPFW allow me to do?

IPFW, the software supplied with FreeBSD, is a packet filtering and accounting system which resides in the kernel, and has a user-land control utility, ipfw(8). Together, they allow you to define and query the rules currently used by the kernel in its routing decisions.

There are two related parts to IPFW. The firewall section allows you to perform packet filtering. There is also an IP accounting section which allows you to track usage of your router, based on similar rules to the firewall section. This allows you to see (for example) how much traffic your router is getting from a certain machine, or how much WWW (World Wide Web) traffic it is forwarding.

As a result of the way that IPFW is designed, you can use IPFW on non-router machines to perform packet filtering on incoming and outgoing connections. This is a special case of the more general use of IPFW, and the same commands and techniques should be used in this situation. Enabling IPFW on FreeBSD

As the main part of the IPFW system lives in the kernel, you will need to add one or more options to your kernel configuration file, depending on what facilities you want, and recompile your kernel. See for more details on how to recompile your kernel.

There are currently three kernel configuration options relevant to IPFW: syslogd(8). Without this option, even if you specify that packets should be logged in the filter rules, nothing will happen. Configuring IPFW

The configuration of the IPFW software is done through the ipfw(8) utility. The syntax for this command looks quite complicated, but it is relatively simple once you understand it's structure.

There are currently two different command line formats for the utility, depending on what you are doing. The first form is used when adding/deleting entries from the firewall or accounting chains, or when clearing the counters for an entry on the accounting chain. The second form is used for more general actions, such as flushing the rule chains, listing the rule chains or setting the default policy. Altering the IPFW rules

The syntax for this form of the command is: ipfw [-n] command action protocol addresses

There is one valid flag when using this form of the command: The command given can be shortened to the shortest unique form. The valid commands are: If no command is given, it will default addfirewall or addaccounting depending on the arguments given.

Currently, the firewall support in the kernel applies a set of weights to the rule being added. This means that the rules will not be evaluated in the order that they are given to the system. The weighting system is designed so that rules which are very specific are evaluated first, and rules which cover very large ranges are evaluated last. In other words, a rule which applies to a specific port on a specific host will have a higher priority than a rule which applies to that same port, but on a range of hosts, or that host on a range of ports.

The weighting system is not perfect, however, and can lead to problems. The best way to see what order it has put your rules in is to use the list command, as that command lists the rules in the order that they are evaluated, not the order that they were fed to the system.

The actions available depend on which rule chain the entry is destined for. For the firewall chain, valid actions are: reject, but also log the packet details. deny, but also log the packet details. accept. For the accounting chain, valid actions are: -

Each action will be recognized by the shortest unambigious +

Each action will be recognized by the shortest unambiguous prefix. The protocols which can be specified are:

The address specification is: [from <address/mask>[port]] [to <address/mask>[port]] [via <interface>]

You can only specify port in conjunction with protocols which support ports (UDP, TCP and SYN).

The order of the from, to, and via keywords is unimportant. Any of them can be omitted, in which case a default entry for that keyword will be supplied which matches everything.

The via is optional and may specify the IP address or domain name of a local IP interface, or an interface name (e.g. ed0) to match only packets coming through this interface. The keyword via can be substituted by on, for readability reasons.

The syntax used to specify an <address/mask> is: <address> or <address>/mask-bits or <address>:mask-pattern

A valid hostname may be specified in place of the IP address. mask-bits is a decimal number representing how many bits in the address mask should be set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any address in a class C subnet (in this case, 192.216.222) to be matched. mask-pattern is an IP address which will be logically AND'ed with the address given. The keyword any may be used to specify ``any IP address''.

The port numbers to be blocked are specified as: port[,port[,port[...]]] to specify either a single port or a list of ports, or port:port to specify a range of ports. The name of a service (from /etc/services) can be used instead of a numeric port value. Listing/flushing the IPFW rules

The syntax for this form of the command is: ipfw [-ans] command [argument]

There are three valid flags when using this form of the command: -s. -a to see accounting counters. The short form listing is incompatible with the input syntax used by the ipfw(8) utility. The command given can be shortened to the shortest unique form. The valid commands are: -s flag is -given, the format is compatable with the command line syntax. +given, the format is compatible with the command line syntax. The list and flush commands may optionally be passed an argument to specify which chain to flush. Valid arguments are:

The policy command can be given one of two arguments: As usual, the arguments can be shortened to the shortest unique form (in this case, the first letter). Example commands for ipfw

This command will deny all packets from the host evil.hacker.org to the telnet port of the host nice.people.org by being forwarded by the router: ipfw addf deny tcp from evil.hacker.org to nice.people.org telnet

The next example denies and logs any TCP traffic from the entire hacker.org network (a class C) to the nice.people.org machine (any port). ipfw addf ldeny tcp from evil.hacker.org/24 to nice.people.org If you do not want people sending X sessions to your internal network (a subnet of a class C), the following command will do the necessary filtering: ipfw addf deny syn to my.org/28 6000 To allow access to the SUP server on sup.FreeBSD.ORG, use the following command: ipfw addf accept syn to sup.FreeBSD.ORG supfilesrv To see the accounting records: ipfw -sa list accounting or in the short form ipfw -sa l a Building a packet filtering firewall

Note: The following suggestions are just that: suggestions. The requirements of each firewall are different and I cannot tell you how to build a firewall to meet your particular requirements.

When initially setting up your firewall, unless you have a test bench setup where you can configure your firewall host in a controlled environment, I strongly recommend you use the logging version of the commands and enable logging in the kernel. This will allow you to quickly identify problem areas and cure them without too much disruption. Even after the initial setup phase is complete, I recommend using the logging for of `deny' as it allows tracing of possible attacks and also modification of the firewall rules if your requirements alter. Note: If you use the logging versions of the -accept command, it can generate large ammounts +accept command, it can generate large amounts of log data as one log line will be generated for every packet that passes through the firewall, so large ftp/http transfers, etc, will really slow the system down. It also increases the latencies on those packets as it requires more work to be done by the kernel before the packet can be passed on. syslogd with also start using up a lot more processor time as it logs all the extra data to disk, and it could quite easily fill the partition /var/log is located on.

As currently supplied, FreeBSD does not have the ability to load firewall rules at boot time. My suggestion is to put a call to a shell script in the /etc/netstart script. Put the call early enough in the netstart file so that the firewall is configured before any of the IP interfaces are configured. This means that there is no window during which time your network is open.

The actual script used to load the rules is entirely up to you. There is currently no support in the ipfw utility for loading multiple rules in the one command. The system I use is to use the command: # ipfw list to write a list of the current rules out to a file, and then use a text editor to prepend ``ipfw '' before all the lines. This will allow the script to be fed into /bin/sh and reload the rules into the kernel. Perhaps not the most efficient way, but it works.

The next problem is what your firewall should actually DO! -This is largely dependant on what access to your network you want to +This is largely dependent on what access to your network you want to allow from the outside, and how much access to the outside world you want to allow from the inside. Some general rules are: Block all incoming access to ports below 1000 for TCP. This is -where most of the security sensitive services are, like finger, smtp +where most of the security sensitive services are, like finger, SMTP (mail) and telnet. Block incoming SYN connections to ports between 1001 and 1024 (this will allow internal users to rsh/rlogin to the outside). If you do not want to allow rsh/rlogin connections from the inside to the outside, then extend the above suggestion to cover ports 1-1024. Block all incoming UDP traffic. There are very few useful services that travel over UDP, and what useful traffic there is is normally a security threat (e.g. Suns RPC and NFS protocols). This has its disadvantages also, since UDP is a connectionless protocol, -denying incoming UDP traffic also blocks the replies to outoing UDP +denying incoming UDP traffic also blocks the replies to outgoing UDP traffic. This can cause a problem for people (on the inside) using external archie (prospero) servers. If you want to allow access to archie, you'll have to allow packets coming from ports 191 and 1525 to any internal UDP port through the firewall. ntp is another service you may consider allowing through, which comes from port 123. Block traffic to port 6000 from the outside. Port 6000 is the port used for access to X11 servers, and can be a security threat -(especially if people are in the habbit of doing xhost + on +(especially if people are in the habit of doing xhost + on their workstations). X11 can actually use a range of ports starting at 6000, the upper limit being how many X displays you can run on the machine. The upper limit as defined by RFC 1700 (Assigned Numbers) is 6063. Check what ports any internal servers use (e.g. SQL servers, etc). It's probably a good idea to block those as well, as they normally fall outside the 1-1024 range specified above. -

Of course, if you want to make sure that no un-authorised traffic +

Of course, if you want to make sure that no un-authorized traffic gets through the firewall, change the default policy to ``deny''. This will mean that any traffic which is allowed through has to be specified explicitly in an ``accept'' or ``allow'' filter rule. Which ports you allow through is again something that you will have to decide for yourself. If you do set the default policy to be deny, you will probably want to install proxy servers, as no traffic will be able to get OUT either unless you allow TCP SYN connections going form the inside out.

As I said above, these are only guidelines. You will have to decide what filter rules you want to use on your firewall yourself. I cannot accept ANY responsibility if someone breaks into your network, even if you follow the advice given above. diff --git a/handbook/handbook.sgml b/handbook/handbook.sgml index 539a296e82..f9893c731b 100644 --- a/handbook/handbook.sgml +++ b/handbook/handbook.sgml @@ -1,157 +1,157 @@ - + %authors; %sections; ]> FreeBSD Handbook <author> <name>The FreeBSD Documentation Project</name> </author> <date>December 21, 1995</date> <abstract>Welcome to FreeBSD! This handbook covers the installation and day to day use of <bf>FreeBSD Release 2.1.0</bf>. This manual is a <bf>work in progress</bf> and is the work of many individuals. Many sections do not yet exist and some of those that do exist need to be updated. If you are interested in helping with this project, send email to the FreeBSD Documentation Project mailing list <tt><htmlurl url="mailto:doc@freebsd.org" name="<doc@freebsd.org>"></tt>. The latest version of this document is always available from the <url url="http://www.freebsd.org/" name="FreeBSD World Wide Web server">. </abstract> <toc> <!-- ************************************************************ --> <part><heading>Basics</heading> <chapt><heading>Introduction</heading> <p>FreeBSD is a 4.4 BSD Lite based operating system for Intel architecture (x86) based PCs. For an overview of FreeBSD, see <ref id="nutshell" name="FreeBSD in a nutshell">. For a history of the project, read <ref id="history" name="a brief history of FreeBSD">. To see a description of the latest release, read <ref id="relnotes" name="about the current release">. If you're interested in contributing something to the FreeBSD project (code, equipment, sacks of unmarked bills), please see about <ref id="submitters" name="contributing to FreeBSD">. &nutshell; &history; &goals; &relnotes; &install; &basics; <chapt><heading>Installing applications</heading> <sect><heading>* Installing packages</heading> &ports; <!-- ************************************************************ --> <part><heading>System Administration</heading> &kernelconfig; <chapt><heading>Users, groups and security</heading> &crypt; &skey; &kerberos; &firewalls; &printing; <chapt><heading>The X-Window System</heading> <p>Pending the completion of this section, please refer to documentation supplied by the <url url="http://www.xfree86.org/" name="The XFree86 Project, Inc">. &hw; <!-- ************************************************************ --> <part><heading>Network Communications</heading> <chapt><heading>Basic Networking</heading> <sect><heading>* Ethernet basics</heading> <sect><heading>* Serial basics</heading> <sect><heading>* Hardwired Terminals</heading> &dialup; <chapt><heading>PPP and SLIP</heading> - <p>If your connection to the internet is through a modem, or + <p>If your connection to the Internet is through a modem, or you wish to provide other people with dialup connections to - the internet using FreeBSD, you have the option of using PPP + the Internet using FreeBSD, you have the option of using PPP or SLIP. Furthermore, two varieties of PPP are provided: <em>user</em> (sometimes referred to as iijppp) and <em>kernel</em>. The procedures for configuring both types of PPP, and for setting up SLIP are described in this chapter. &userppp; &ppp; &slipc; &slips; <chapt><heading>Advanced networking</heading> &routing; &nfs; &diskless; <sect><heading>* Yellow Pages/NIS</heading> <sect><heading>* ISDN</heading> <chapt><heading>* Mail</heading> <!-- ************************************************************ --> <part><heading>Advanced topics</heading> ¤t; &ctm; ⊃ &submitters; &troubleshooting; &kerneldebug; <chapt><heading>FreeBSD internals</heading> &booting; &memoryuse; &dma; <!-- ************************************************************ --> <part><heading>Appendices</heading> &mirrors; &bibliography; &eresources; &contrib; <!-- &glossary; --> </book> </linuxdoc> diff --git a/handbook/history.sgml b/handbook/history.sgml index ad45f5def2..3ba3113621 100644 --- a/handbook/history.sgml +++ b/handbook/history.sgml @@ -1,116 +1,116 @@ -<!-- $Id: history.sgml,v 1.12 1995-12-29 01:27:38 jkh Exp $ --> +<!-- $Id: history.sgml,v 1.13 1996-01-31 14:26:07 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>A brief history of FreeBSD<label id="history"></heading> <p><em>Contributed by &a.jkh;</em>. The FreeBSD project had its genesis in the early part of 1993, partially as an outgrowth of the "Unofficial 386BSD Patchkit" by the patchkit's last 3 coordinators: Nate Williams, Rod Grimes and myself. David Greenman and Julian Elischer were also lurking in the background around this time, though they didn't come fully into the project until a month or two after it was more or less officially launched. Our original goal was to produce an intermediate snapshot of 386BSD in order to fix a number of problems with it that the patchkit mechanism just wasn't capable of solving. Some of you may remember the early working title for the project being "386BSD 0.5" or "386BSD Interim" in reference to that fact. 386BSD was Bill Jolitz's operating system, which had been up to that point suffering rather severely from almost a year's worth of neglect. As the patchkit swelled ever more uncomfortably with each passing day, we were in unanimous agreement that something had to be done and decided to try and assist Bill by providing this interim "cleanup" snapshot. Those plans came to a rude halt when Bill Jolitz suddenly decided to withdraw his sanction from the project and without any clear indication of what would be done instead. It didn't take us long to decide that the goal remained worthwhile even without Bill's support, and so we adopted the name "FreeBSD", which was coined by David Greenman. Our initial objectives were set after consulting with the system's current users, and once it became clear that the project was on the road to perhaps even becoming a reality, I contacted Walnut Creek CDROM with an eye towards improving FreeBSD's distribution channels for those many unfortunates without easy access to the Internet. Walnut Creek CDROM not only supported the idea of distributing FreeBSD on CD but went so far as to provide the project with a machine to work on and a fast Internet connection. Without Walnut Creek CDROM's almost unprecedented degree of faith in what was, at the time, a completely unknown project, it is quite unlikely that FreeBSD would have gotten as far, as fast, as it has today. The first CDROM (and general net-wide) distribution was FreeBSD 1.0, released in December of 1993. This was based on the 4.3 BSD Lite ("Net/2") tape from U.C. Berkeley, with many components also provided by 386BSD and the Free Software Foundation. It was a fairly reasonable success for a first offering, and we followed it with the highly successful FreeBSD 1.1 release in May of 1994. Around this time, some rather unexpected storm clouds formed on our horizon as Novell and U.C. Berkeley settled their long-running lawsuit over the legal status of the Berkeley Net/2 tape. A condition of that settlement was U.C. Berkeley's concession that large parts of Net/2 were "encumbered" code and the property of Novell, who had in turn acquired it from AT&T some time previously. What Berkeley got in return was Novell's "blessing" that the 4.4 Lite release, when it was finally released, would be declared unencumbered and all existing Net/2 users would be strongly encouraged to switch. This included us, and we were given until the end of July 1994 to stop shipping our own Net/2 based product. Under the terms of that agreement, we were allowed one last release before the deadline and that became FreeBSD 1.1.5.1, the culmination of our year's work with Net/2 and generally considered by many to be a significant project milestone for stability and general performance.. We then set about the arduous task of literally re-inventing ourselves with a completely new and rather incomplete set of 4.4 Lite bits. The "Lite" releases were light in part because Berkeley's CSRG had removed large chunks of code required for actually constructing a bootable running system (due to various legal requirements) and the fact that the Intel port of 4.4 was highly incomplete. It took us until December of 1994 to make this transition, and in January of 1995 we released FreeBSD 2.0 to the net and on CDROM. Despite being still more than a little rough around the edges, the release was a significant success and has since been followed by the more robust and easier to install FreeBSD 2.0.5 release in June of 1995. <em>Where to from here?</em> We just released FreeBSD 2.1.0 on November 19th, 1995 and, by all accounts, people are pretty happy with it. We'll therefore continue with the 2.1-STABLE branch of FreeBSD (which actually began with 2.0.5) well into Q1 of 1996 with at least one additional release: FreeBSD 2.1.1. A 2.1.2 release may follow 2.1.1, though this will depend heavily on the status of FreeBSD 2.2 in Q2 of 1996. 2.2 is our development branch, where long term projects for everything from NFS v3 to PCCARD support are currently taking place. Preliminary timelines suggest that development in 2.2 will begin slowing down and early release engineering simulations (2.2 SNAPshots) started in Q1 of 1996. Given a favorable prognosis for 2.2's general health, a migration to 2.2 will then begin in early Q2 of '96 and a new 2.3 branch created for next-generation development. Around the time that 2.2-RELEASE is produced (late Q2 1996), the 2.1.x lineage will also be phased out. We also intend to focus on any remaining areas of weakness, like documentation or missing drivers, and steadily increase the overall quality and feature set of the system well into 1996 and beyond. Now might also be a good time to note that the development of FreeBSD is <em>not</em> a closed process, despite some popular misconceptions to the contrary, and anyone is free to contribute code or ideas. Once a contributor has established a reasonable track record for reliability, we generally, in fact, give them write access to the project's CVS repository, where their changes can propagate automatically to other users of FreeBSD. Our -centralised development model is designed for the convenience of the +centralized development model is designed for the convenience of the <em>users</em> of FreeBSD, who are thereby provided with an easy way of tracking one central code base, not to keep potential contributors out! Individuals who've shown a consistent and significant dedication to the project are even often asked to join the FreeBSD core team to help in setting the project's overall directions and goals, so truly no part of the project is closed to additional members. All we ask of those wishing for closer ties to this project is some of the same dedication its current members have to its continued success! diff --git a/handbook/hw.sgml b/handbook/hw.sgml index d408a73066..3bd2b919f3 100644 --- a/handbook/hw.sgml +++ b/handbook/hw.sgml @@ -1,422 +1,422 @@ -<!-- $Id: hw.sgml,v 1.11 1995-12-11 15:09:13 jkh Exp $ --> +<!-- $Id: hw.sgml,v 1.12 1996-01-31 14:26:08 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN"> --> <chapt><heading>PC Hardware compatibility<label id="hw"></heading> <p>Issues of hardware compatibility are among the most troublesome in the computer industry today and FreeBSD is by no means immune to trouble. In this respect, FreeBSD's - advantage of being able to run on inexpensive commidity PC + advantage of being able to run on inexpensive commodity PC hardware is also its liability when it comes to support for the amazing variety of components on the market. While it would be impossible to provide a exhaustive listing of hardware that FreeBSD supports, this section serves as a catalog of the device drivers included with FreeBSD and the hardware each drivers supports. Where possible and appropriate, notes about specific products are included. As FreeBSD is a volunteer project without a funded testing department, we depend on you, the user, for much of the information contained in this catalog. If you have direct experience of hardware that does or does not work with FreeBSD, please let us know by sending email to <tt>doc@freebsd.org</tt>. Questions about supported hardware should be directed to <tt>questions@freebsd.org</tt> (see <ref id="eresources:mail" name="Mailing Lists"> for more information). When submitting information or asking a question, please remember to specify exactly what version of FreeBSD you are using and include as many details of your hardware as possible. <sect><heading>Sample Configurations<label id="hw:configs"></heading> <p>The following list of sample hardware configurations by no means constitutes an endorsement of a given hardware vendor or product by <em>The FreeBSD Project</em>. This information is provided only as a public service and merely catalogs some of the experiences that various individuals have had with different hardware combinations. Your mileage may vary. Slippery when wet. Beware of dog. <sect1><heading>Jordan's Picks</heading> <p>I have had fairly good luck building workstation and server configurations with the following components. I can't guarantee that you will too, nor that any of the companies here will remain "best buys" forever. I will try, when I can, to keep this list up-to-date but cannot obviously guarantee that it will be at any given time. <sect2><heading>Motherboards</heading> <p>The <htmlurl url="http://asustek.asus.com.tw/" name="ASUS"> <htmlurl url="http://asustek.asus.com.tw/FTP/ASUS/Info/Spec/pi-p55tp4xe.txt" name="P55TP4XE"> motherboard appears to be a good choice for mid-to-high range Pentium server and workstation systems. If you're really looking for performance, be also sure to get the <htmlurl url="http://asustek.asus.com.tw/Products/TB/mem-0002.html" name="pipelined burst cache module">. I feel that it's worth the extra cost. If you're looking for a 486 class motherboard, you might also investigate ASUS's <htmlurl url="http://asustek.asus.com.tw/FTP/ASUS/Info/Spec/pvi-486sp3.txt" name="486SP3G"> offering. NOTE: The Intel <htmlurl url="http://asustek.asus.com.tw/Products/TB/triton-intro.html" name="Triton"> chipset based motherboards do not offer memory parity logic, making it almost impossible to detect when a memory error has occurred. Those wishing to build highly fault-tolerant systems may therefore want to wait for Intel's newest generation of motherboards based on the Orion chipset or investigate ASUS's SiS chipset based motherboard, the <htmlurl url="http://asustek.asus.com.tw/FTP/ASUS/Info/Spec/pi-p55sp4.txt" name="P55SP4">. I have no personal experience with this motherboard, but have heard good things about it and will note that it has the advantage of being available <em>now</em>. <sect2><heading>Disk Controllers</heading> <p>This one is a bit trickier, and while I used to recommend the <htmlurl url="http://www.buslogic.com" name="Buslogic"> controllers unilaterally for everything from ISA to PCI, now I tend to lean towards the <htmlurl url="http://www.adaptec.com" name="Adaptec"> 1542CF for ISA, Buslogic Bt747c for EISA and Adaptec 2940 for PCI. I've currently heard nothing about Buslogic's new Bt-930 controller but would welcome any reports on its performance. <sect2><heading>Disk drives</heading> - <p>In this particular game of russian roulette, I'll make few specific + <p>In this particular game of Russian roulette, I'll make few specific recommendations except to say "SCSI over IDE whenever you can afford it." Even in small desktop configurations, SCSI often makes more sense since it allows you to migrate drives from server to desktop as falling drive prices make it economical to do so. If you have more than one machine to administer then think of it not simply as storage, think of it as a food chain. <p>I do not currently see SCSI WIDE drives as a necessary expense unless you're putting together an NFS or NEWS server that will be doing a lot of multiuser disk I/O. <sect2><heading>Video Cards</heading> <p>If you can also afford to buy a commercial X server for $99 from <htmlurl url="http://www.xinside.com/" name="X Inside"> then I can heartily recommend the <htmlurl url="http://www.matrox.com/" name="Matrox"> <htmlurl url="http://www.matrox.com/mgaweb/brochure.htm" name="Millenium"> card. If free X servers are more to your liking, you certainly can't go wrong with one of <htmlurl url="http://www.nine.com/" name="Number 9's"> cards. Their S3 Vision 868 and 968 based cards (the 9FX series) are no slouches either, and are supported by <htmlurl url="http://www.xfree86.org" name="XFree86">'s S3 server. <sect2><heading>Monitors</heading> <p>I have had very good luck with the <htmlurl url="http://cons3.sel.sony.com/SEL/ccpg/display/ms17se2.html" name="Sony Multiscan 17SE monitors">, as have I with the Viewsonic offering in the same (trinitron) tube. For larger than 17", all I can recommend at the time of this writing is to not spend any less than U.S. $2,500 for a 21" monitor if that's what you really need. There are good monitors available in the >=20" range and there are also cheap monitors in the >=20" range. Unfortunately, none are both cheap and good! <sect2><heading>Networking</heading> <p>I can recommend the <htmlurl url="http://www.smc.com/" name="SMC"> Ultra 16 controller for any ISA application and the SMC EtherPower or Compex ENET32 cards for any serious PCI based networking. Both of - the PCI cards are based around DEC's DC21041 ethernet controller + the PCI cards are based around DEC's DC21041 Ethernet controller chip and other cards using it, such as the Zynx ZX342 or DEC DE435, will generally work as well. <p>If you're looking for high-speed serial networking solutions, then <htmlurl url="http://www.digiboard.com/" name="Digi International"> makes the <htmlurl url="http://www.digiboard.com/prodprofiles/profiles-prices/arnetprofiles/sync570i.html" name="SYNC 570i"> series, with drivers now in FreeBSD-current. <htmlurl url="http://www.etinc.com" name="Emerging Technologies"> also manufactures a board with T1/E1 capabilities, using software they provide. <sect2><heading>Audio</heading> <p>I currently use the <htmlurl url="http://www.gravis.com/" name="Gravis"> Ultrasound MAX due to its high sound quality and full-duplex audio capabilities (dual DMA channels). Support for Windows NT and OS/2 is fairly anemic, however, so I'm not sure that I can recommend it as an all-around card for a machine that will be running both FreeBSD and NT or OS/2. In such a scenario, I might recommend the <htmlurl url="http://www.creaf.com/" name="Creative Labs"> AWE32 instead. <sect><heading>Core/Processing<label id="hw:core"></heading> <sect1><heading>Motherboards, busses, and chipsets</heading> <sect2><heading>* ISA</heading> <sect2><heading>* EISA</heading> <sect2><heading>* VLB</heading> <sect2><heading>PCI</heading> <p><em>Contributed by &a.rgrimes;.<newline>25 April 1995.</em></p> <p>Of the Intel PCI chip sets, the following list describes various types of known-brokenness and the degree of breakage, listed from worst to best. </p> <p><descrip> <tag>Mercury:</tag> Cache coherency problems, especially if there are ISA bus masters behind the ISA to PCI bridge chip. Hardware flaw, only known work around is to turn the cache off. <tag>Saturn-I <em>(ie, 82424ZX at rev 0, 1 or 2)</em>:</tag> Write back cache coherency problems. Hardware flaw, only known work around is to set the external cache to write-through mode. Upgrade to Saturn-II. <tag>Saturn-II <em>(ie, 82424ZX at rev 3 or 4)</em>:</tag> Works fine, but many MB manufactures leave out the external dirty bit SRAM needed for write back operation. Work arounds are either run it in write through mode, or get the dirty bit SRAM installed. (I have these for the ASUS PCI/I-486SP3G rev 1.6 and later boards). <tag>Neptune:</tag> Can not run more than 2 bus master devices. Admitted Intel design flaw. Workarounds include do not run more than 2 bus masters, special hardware design to replace the PCI bus arbiter (appears on Intel Altair board and several other Intel server group MB's). And of course Intel's official answer, move to the Triton chip set, we ``fixed it there''. <tag>Triton:</tag> No known cache coherency or bus master problems, chip set does not implement parity checking. Workaround for parity issue. Wait for Triton-II. <tag>Triton-II:</tag> Unknown, not yet shipping. </descrip> </p> <sect1><heading>* CPUs/FPUs</heading> <sect1><heading>* Memory</heading> <sect1><heading>* BIOS</heading> <sect><heading>Input/Output Devices<label id="hw:io"></heading> <sect1><heading>* Video cards</heading> <sect1><heading>* Sound cards</heading> <sect1><heading>Serial ports and multiport cards</heading> <p>The <tt>sio</tt> driver provides support for NS8250-, NS16450-, NS16550 and NS16550A-based EIA RS-232C (CCITT V.24) communications interfaces. Several multiport cards are supported as well. See the <tt>sio(4)</tt> manual page for detailed technical documentation. <sect2><heading>Digiboard PC/8</heading> <p><em>Contributed by &a.awebster;.<newline>26 August 1995.</em> Here is a config snippet from a machine with digiboard PC/8 with 16550. It has 8 modems connected to these 8 lines, and they work just great. Do not forget to add <tt>options "COM_MULTIPORT"</tt> or it will not work very well! <tscreen><verb> device sio4 at isa? port 0x100 tty flags 0xb05 device sio5 at isa? port 0x108 tty flags 0xb05 device sio6 at isa? port 0x110 tty flags 0xb05 device sio7 at isa? port 0x118 tty flags 0xb05 device sio8 at isa? port 0x120 tty flags 0xb05 device sio9 at isa? port 0x128 tty flags 0xb05 device sio10 at isa? port 0x130 tty flags 0xb05 device sio11 at isa? port 0x138 tty flags 0xb05 irq 9 vector siointr </verb></tscreen> The trick in setting this up is that the MSB of the flags represent the last SIO port, in this case 11 so flags are 0xb05. <sect2><heading>Boca 16</heading> <p><em>Contributed by &a.whiteside;.<newline>26 August 1995.</em> The procedures to make a Boca 16 pord board with - FreeBSD are pretty straighforward, but you will need + FreeBSD are pretty straightforward, but you will need a couple things to make it work: <enum> <item>You either need the kernel sources installed so you can recompile the necessary options or you will need someone else to compile it for you. The 2.0.5 default kernel does <bf>not</bf> come with multiport support enabled and you will need to add a device entry for each port anyways. </item> <item>Two, you will need to know the interrupt and IO setting for your Boca Board so you can set these options properly in the kernel.</item> </enum> One important note - the actual UART chips for the Boca 16 are in the connector box, not on the internal board itself. So if you have it unplugged, probes of those ports will fail. I have never tested booting with the box unplugged and plugging it back in, and I suggest you do not either. If you do not already have a custom kernel configuration file set up, refer to <ref id="kernelconfig" name="Kernel Configuration"> for - general procedurs. The following are the specifics + general procedures. The following are the specifics for the Boca 16 board and assume you are using the kernel name MYKERNEL and editing with vi. <enum> <item>Add the line <tscreen><verb> options "COM_MULTIPORT" </verb></tscreen> to the config file. </item> <item>Where the current <tt>device sio <em>xxx</em></tt> lines are, you will need to add 16 more devices. <em>Only the last device includes the interrupt vector for the board</em>. (See the <tt>sio(4)</tt> manual page for detail as to why.) The following example is for a Boca Board with an interrupt of 3, and a base IO address 100h. The - IO address for Each port is +8 hexidecimal from + IO address for Each port is +8 hexadecimal from the previous port, thus the 100h, 108h, 110h... addresses. <tscreen><verb> device sio1 at isa? port 0x100 tty flags 0x1005 device sio2 at isa? port 0x108 tty flags 0x1005 device sio3 at isa? port 0x110 tty flags 0x1005 device sio4 at isa? port 0x118 tty flags 0x1005 [...] device sio15 at isa? port 0x170 tty flags 0x1005 device sio16 at isa? port 0x178 tty flags 0x1005 irq 3 vector siointr </verb></tscreen> The flags entry <em>must</em> be changed from this example unless you are using the exact same sio assignments. Flags are set according to 0x<em>MYY</em> where <em>M</em> indicates the minor number of the master port (the last port on a Boca 16) and <em>YY</em> indicates if FIFO is enabled or disabled(enabled), IRQ sharing is used(yes) and if there is an AST/4 compatible IRQ control register(no). In this example, <tscreen><verb> flags 0x1005 </verb></tscreen> indicates that the master port is sio16. If I added another board and assigned sio17 through sio28, the flags for all 16 ports on <em>that</em> board would be 0x1C05, where 1C indicates the minor number of the master port. Do not change the 05 setting.</item> <item>Save and complete the kernel configuration, recompile, install and reboot. Presuming you have successfully installed the recompiled kernel and have it set to the correct address and IRQ, your boot message should indicate the successful probe of the Boca ports as follows: (obviously the sio numbers, IO and IRQ could be different) <tscreen><verb> sio1 at 0x100-0x107 flags 0x1005 on isa sio1: type 16550A (multiport) sio2 at 0x108-0x10f flags 0x1005 on isa sio2: type 16550A (multiport) sio3 at 0x110-0x117 flags 0x1005 on isa sio3: type 16550A (multiport) sio4 at 0x118-0x11f flags 0x1005 on isa sio4: type 16550A (multiport) sio5 at 0x120-0x127 flags 0x1005 on isa sio5: type 16550A (multiport) sio6 at 0x128-0x12f flags 0x1005 on isa sio6: type 16550A (multiport) sio7 at 0x130-0x137 flags 0x1005 on isa sio7: type 16550A (multiport) sio8 at 0x138-0x13f flags 0x1005 on isa sio8: type 16550A (multiport) sio9 at 0x140-0x147 flags 0x1005 on isa sio9: type 16550A (multiport) sio10 at 0x148-0x14f flags 0x1005 on isa sio10: type 16550A (multiport) sio11 at 0x150-0x157 flags 0x1005 on isa sio11: type 16550A (multiport) sio12 at 0x158-0x15f flags 0x1005 on isa sio12: type 16550A (multiport) sio13 at 0x160-0x167 flags 0x1005 on isa sio13: type 16550A (multiport) sio14 at 0x168-0x16f flags 0x1005 on isa sio14: type 16550A (multiport) sio15 at 0x170-0x177 flags 0x1005 on isa sio15: type 16550A (multiport) sio16 at 0x178-0x17f irq 3 flags 0x1005 on isa sio16: type 16550A (multiport master) </verb></tscreen> If the messages go by too fast to see, <tt>dmesg > more</tt> will show you the boot messages.</item> - <item>Next, apprepriate entries in <tt>/dev</tt> for the devices + <item>Next, appropriate entries in <tt>/dev</tt> for the devices must be made using the <tt>/dev/MAKEDEV</tt> script. After becoming root: <tscreen> # cd /dev<newline> # ./MAKEDEV tty1<newline> # ./MAKEDEV cua1<newline> <em>(everything in between)</em><newline> # ./MAKEDEV ttyg<newline> # ./MAKEDEV cuag </tscreen> If you do not want or need callout devices for some reason, you can dispense with making the <tt>cua*</tt> devices.</item> <item>If you want a quick and sloppy way to make sure the devices are working, you can simply plug a modem into each port and (as root) <tt>echo at > ttyd*</tt> for each device you have made. You <em>should</em> see the RX lights flash for each working port.</item> </enum> <sect1><heading>* Parallel ports</heading> <sect1><heading>* Modems</heading> <sect1><heading>* Network cards</heading> <sect1><heading>* Keyboards</heading> <sect1><heading>* Mice</heading> <sect1><heading>* Other</heading> <sect><heading>Storage Devices<label id="hw:storage"></heading> &esdi; &scsi; <sect1><heading>* Disk/tape controllers</heading> <sect2><heading>* SCSI</heading> <sect2><heading>* IDE</heading> <sect2><heading>* Floppy</heading> <sect1><heading>* Hard drives</heading> <sect1><heading>* Tape drives</heading> <sect1><heading>* CD-ROM drives</heading> <sect1><heading>* Other</heading> <sect1><heading>* Adding and reconfiguring disks</heading> <sect1><heading>* Tapes and backups</heading> <sect1><heading>* Serial ports</heading> <sect1><heading>* Sound cards</heading> <sect1><heading>* PCMCIA</heading> <sect1><heading>* Other<label id="hw:other"></heading> diff --git a/handbook/install.sgml b/handbook/install.sgml index 3d2b0ec972..d5166cda3c 100644 --- a/handbook/install.sgml +++ b/handbook/install.sgml @@ -1,877 +1,877 @@ -<!-- $Id: install.sgml,v 1.21 1995-12-21 16:10:22 jfieber Exp $ --> +<!-- $Id: install.sgml,v 1.22 1996-01-31 14:26:09 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <!DOCTYPE linuxdoc PUBLIC '-//FreeBSD//DTD linuxdoc//EN'> --> <chapt><heading>Installing FreeBSD<label id="install"></heading> <p>So, you would like to try out FreeBSD on your system? This section is a quick-start guide for what you need to do. FreeBSD can be installed from a variety of media including CD-ROM, floppy disk, magnetic tape, an MS-DOS partition, and if you have a network connection, via anonymous ftp or NFS. Regardless of the installation media you choose, you can get started by downloading the <bf>installation disk</bf> as described below. Booting your computer with disk will provide important information about compatibility between FreeBSD and your hardware which could dictate which installation options are possible. It can also provide early clues to compatibility problems that could prevent FreeBSD running on your system at all. If you plan on installing via anonymous FTP, then this installation disk is all you need to download. For more information on obtaining the FreeBSD distribution itself, please see <ref id="mirrors" name="Obtaining FreeBSD"> in the Appendix. So, to get the show on the road, follow these steps: <enum> <item>Review the <ref id="install:hw" name="supported configurations"> section of this installation guide to be sure that your hardware is supported by FreeBSD. It may be helpful to make a list of any special cards you - have installed, such as SCSI controllers, ethernet + have installed, such as SCSI controllers, Ethernet adapters or sound cards. This list should include relevant configuration parameters such as interrupts (IRQ) and IO port addresses. </item> <item>Download the <url url="ftp://ftp.freebsd.org/pub/FreeBSD/2.1.0-RELEASE/floppies/boot.flp" name="installation boot disk image"> file to your hard drive, and be sure to tell your browser to <em>save</em> rather than <em>display</em>. <bf>Note:</bf> This disk image can be used for <em>both</em> 1.44 megabyte 3.5 inch floppy disks and 1.2 megabyte 5.25 inch floppy disks.</item> <item>Make the installation boot disk from the image file: <itemize> <item>If you are using MS-DOS download <url url="ftp://ftp.freebsd.org/pub/FreeBSD/tools/dos-tools/rawrite.exe" name="rawrite.exe">, then run it: <tscreen><verb> C:\> rawrite </verb></tscreen> The program will prompt you for the floppy drive containing the disk you want to write to (A: or B:) and the name of the file to put on disk (boot.flp). </item> <item>If you are using a UNIX system: <tscreen> % dd if=boot.flp of=<em>disk_device</em> </tscreen> where <em>disk_device</em> is the <tt>/dev</tt> entry for the floppy drive. On FreeBSD systems, this is <tt>/dev/fd0</tt> for the A: drive and <tt>/dev/fd1</tt> for the B: drive. </item> </itemize> </item> <item>With the installation disk in the A: drive, reboot your computer. You should get a boot prompt something like this: <tscreen> >> FreeBSD BOOT ...<newline> Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.<newline> Usage: [[hd(1,a)]/kernel][-abcCdhrsv]<newline> Use ? for file list or press Enter for defaults<newline> Boot: </tscreen> If you do <em>not</em> type anything, FreeBSD will automatically boot with its default configuration after a delay of about five seconds. As FreeBSD boots, it probes your computer to determine what hardware is installed. The results of this probing is displayed on the screen. </item> <item>When the booting process is finished, The main FreeBSD installation menu will be displayed.</item> </enum> <p><bf>If something goes wrong...</bf> <p>Due to limitations of the PC architecture, it is impossible for probing to be 100 percent reliable. In the event that your hardware is incorrectly identified, or that the probing causes your computer to lock up, first check the <ref id="install:hw" name="supported configurations"> section of this installation guide to be sure that your hardware is indeed supported by FreeBSD. <p>If your hardware is supported, reset the computer and when the <tt>Boot:</tt> prompt comes up, type <bf>-c</bf>. This puts FreeBSD into a configuration mode where you can supply hints about your hardware. The FreeBSD kernel on the installation disk is configured assuming that most hardware devices are in their factory default configuration in terms of IRQs, IO addresses and DMA channels. If your hardware has been reconfigured, you will most likely need to use the <bf>-c</bf> option at boot to tell FreeBSD where things are. <p>It is also possible that a probe for a device not present will cause a later probe for another device that is present to fail. In that case, the probes for the conflicting driver(s) should be disabled. <p>In the configuration mode, you can: <itemize> <item>List the device drivers installed in the kernel.</item> <item>Disable device drivers for hardware not present in your system.</item> <item>Change the IRQ, DRQ, and IO port addresses used by a device driver.</item> </itemize> <p>While at the <tt>config></tt> prompt, type <tt>help</tt> for more information on the available commands. After adjusting the kernel to match how you have your hardware configured, type <tt>quit</tt> at the <tt>config></tt> prompt to continue booting with the new settings. After FreeBSD has been installed, changes made in the configuration mode will be permanent so you do not have to reconfigure every time you boot. Even so, it is likely that you will want to build a custom kernel to optimize the performance of your system. See <ref id="kernelconfig" name="Kernel configuration"> for more information on creating custom kernels. <sect><heading>Supported Configurations<label id="install:hw"></heading> <p>FreeBSD currently runs on a wide variety of ISA, VLB, EISA and PCI bus based PC's, ranging from 386sx to Pentium class machines (though the 386sx is not recommended). Support for generic IDE or ESDI drive configurations, various SCSI controller, network and serial cards is also provided. A minimum of five megabytes of RAM is required to run FreeBSD. To run the X-window system, eight megabytes of RAM is the recommended minimum. - Following is a list of all disk controllers and ethernet + Following is a list of all disk controllers and Ethernet cards currently known to work with FreeBSD. Other configurations may very well work, and we have simply not received any indication of this. <sect1><heading>Disk Controllers</heading> <p> <itemize> <item>WD1003 (any generic MFM/RLL) <item>WD1007 (any generic IDE/ESDI) <item>IDE <item>ATA <item>Adaptec 152x series ISA SCSI controllers <item>Adaptec 154x series ISA SCSI controllers <item>Adaptec 174x series EISA SCSI controller in standard and enhanced mode. <item>Adaptec 274x/284x/2940/3940 (Narrow/Wide/Twin) series EISA/VLB/PCI SCSI controllers <item>Adaptec <!-- AIC-6260 and - actually not working, joerg --> AIC-6360 based boards, which includes the AHA-152x and SoundBlaster SCSI cards. <bf>Note:</bf> You cannot boot from the SoundBlaster cards as they have no on-board BIOS, which is necessary for mapping the boot device into the system BIOS I/O vectors. They are perfectly usable for external tapes, CDROMs, etc, however. The same goes for any other AIC-6x60 based card without a boot ROM. Some systems DO have a boot ROM, which is generally indicated by some sort of message when the system is first powered up or reset. Check your system/board documentation for more details. <item>Buslogic 545S & 545c <bf>Note:</bf> that Buslogic was formerly known as "Bustek". <item>Buslogic 445S/445c VLB SCSI controller <item>Buslogic 742A/747S/747c EISA SCSI controller. <item>Buslogic 946c PCI SCSI controller <item>Buslogic 956c PCI SCSI controller <item>NCR 53C810/53C815/53C825/53C860/53C875 PCI SCSI controller. <item>NCR5380/NCR53400 (``ProAudio Spectrum'') SCSI controller. <item>DTC 3290 EISA SCSI controller in 1542 emulation mode. <item>UltraStor 14F/24F/34F SCSI controllers. <item>Seagate ST01/02 SCSI controllers. <item>Future Domain 8xx/950 series SCSI controllers. <item>WD7000 SCSI controllers. </itemize> With all supported SCSI controllers, full support is provided for SCSI-I & SCSI-II peripherals, including Disks, tape drives (including DAT) and CD ROM drives. The following CD-ROM type systems are supported at this time: <itemize> - <item>Soundblaster SCSI and ProAudio Spectrum SCSI (<tt>cd</tt>) + <item>SoundBlaster SCSI and ProAudio Spectrum SCSI (<tt>cd</tt>) <item>Mitsumi (all models) proprietary interface (<tt>mcd</tt>) <item>Matsushita/Panasonic (Creative) CR-562/CR-563 proprietary interface (<tt>matcd</tt>) <item>Sony proprietary interface (<tt>scd</tt>) <item>ATAPI IDE interface (experimental and should be considered ALPHA quality!) (<tt>wcd</tt>) </itemize> <sect1><heading>Ethernet cards</heading> <p> <itemize> <item>Allied-Telesis AT1700 and RE2000 cards - <item>SMC Elite 16 WD8013 ethernet interface, and + <item>SMC Elite 16 WD8013 Ethernet interface, and most other WD8003E, WD8003EBT, WD8003W, WD8013W, WD8003S, WD8003SBT and WD8013EBT based clones. SMC Elite Ultra is also supported. <item>DEC EtherWORKS III NICs (DE203, DE204, and DE205) <item>DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422) <item>DEC DC21140/DC21141 based NICs: <itemize> <item>ASUS PCI-L101-TB <item>Accton ENI1203 <item>Cogent EM960PCI <item>Compex CPXPCI/32C <item>D-Link DE-530 <item>DEC DE435 <item>Danpex EN-9400P3 <item>JCIS Condor JC1260 <item>Linksys EtherPCI <item>Mylex LNP101 <item>SMC EtherPower 10/100 (Model 9332) <item>SMC EtherPower (Model 8432) <item>Zynx ZX342 </itemize> <item>DEC FDDI (DEFPA/DEFEA) NICs <item>Fujitsu FMV-181 and FMV-182 <item>Intel EtherExpress <item>Isolan AT 4141-0 (16 bit) <item>Isolink 4110 (8 bit) <item>Novell NE1000, NE2000, and NE2100 ethernet interface. <item>3Com 3C501 cards <item>3Com 3C503 Etherlink II <item>3Com 3c505 Etherlink/+ <item>3Com 3C507 Etherlink 16/TP <item>3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III <item>Toshiba ethernet cards <item>PCMCIA ethernet cards from IBM and National Semiconductor are also supported. </itemize> - <p><em>Note:</em> FreeBSD does not currently suppport + <p><em>Note:</em> FreeBSD does not currently support PnP (plug-n-play) features present on some ethernet cards. If your card has PnP and is giving you problems, try disabling its PnP features. <sect1><heading>Miscellaneous devices</heading> <p> <itemize> <item>AST 4 port serial card using shared IRQ. <item>ARNET 8 port serial card using shared IRQ. <item>BOCA IOAT66 6 port serial card using shared IRQ. <item>BOCA 2016 16 port serial card using shared IRQ. <item>Cyclades Cyclom-y Serial Board. <item>STB 4 port card using shared IRQ. <item>SDL Communications Riscom/8 Serial Board. <item>Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound, Gravis UltraSound MAX and Roland MPU-401 sound cards. </itemize> FreeBSD currently does not support IBM's microchannel (MCA) bus, but support is apparently close to materializing. Details will be posted as the situation develops. <sect><heading>Preparing for the installation</heading> <p>There are a number of different methods by which FreeBSD can be installed. The following describes what preparation needs to be done for each type. <sect1><heading>Before installing from CDROM</heading> <p>If your CDROM is of an unsupported type, such as an IDE CDROM, then please skip to <ref id="install:msdos" name="MS-DOS Preparation">. There is not a lot of preparatory work that needs to be done to successfully install from one of Walnut Creek's FreeBSD CDROMs (other CDROM distributions may work as well, though we cannot say for certain as we have no hand or say in how they're created). You can either boot into the CD installation directly from DOS using Walnut Creek's supplied ``install.bat'' batch file or you can make a boot floppy with the ``makeflp.bat'' command [NOTE: If you're using an IDE CDROM, use the inst_ide.bat or atapiflp.bat batch files instead]. For the easiest interface of all (from DOS), type ``view''. This will bring up a DOS menu utility that leads you through all the available options. If you are creating the boot floppy from a UNIX machine, see <ref id="install" name="the beginning of this guide"> for examples. of how to create the boot floppy. Once you have booted from DOS or floppy, you should then be able to select CDROM as the media type in the Media menu and load the entire distribution from CDROM. No other types of installation media should be required. After your system is fully installed and you have rebooted from the hard disk, you can mount the cdrom at any time by typing: <tt>mount /cdrom</tt> Before removing the CD again, also note that it's necessary to first type: <tt>umount /cdrom</tt>. Don't just remove it from the drive! <quote><bf>Special note:</bf> Before invoking the installation, be sure that the CDROM is in the drive so that the install probe can find it. This is also true if you wish the CDROM to be added to the default system configuration automatically during the install (whether or not you actually use it as the installation media). </quote> Finally, if you would like people to be able to FTP install FreeBSD directly from the CDROM in your machine, you will find it quite easy. After the machine is fully installed, you simply need to add the following line to the password file (using the vipw command): <tscreen><verb> ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent </verb></tscreen> Anyone with network connectivity to your machine (and permission to log into it) can now chose a Media type of FTP and type in: <tt>ftp://<em>your machine</em></tt> after picking ``Other'' in the ftp sites menu. <sect1><heading>Before installing from Floppy</heading> <p>If you must install from floppy disks, either due to unsupported hardware or just because you enjoy doing things the hard way, you must first prepare some floppies for the install. The first floppy you'll need in addition to the boot.flp image is ``floppies/root.flp'', which is somewhat special in that it's not a DOS filesystem floppy at all, but rather a floppy "image" (it's actually a gzip'd cpio file). You can create this floppy in the same way that you created the boot floppy <ref id="install" name="the beginning of this guide">. Once this floppy is made, you can go on to make the distribution set floppies using ordinary DOS or UFS (if you're preparing the floppies on another FreeBSD machine) formatted diskettes. You will need, at minimum, as many 1.44MB or 1.2MB floppies as it takes to hold all files in the bin (binary distribution) directory. If you're preparing these floppies under DOS, then THESE floppies *must* be formatted using the MS-DOS FORMAT command. If you're using Windows, use the Windows File Manager format command. Do <em>not</em> trust Factory Preformatted floppies! Format them again yourself, just to make sure. Many problems reported by our users in the past have resulted from the use of improperly formatted media, which is why I'm taking such special care to mention it here! If you're creating the floppies from another FreeBSD machine, a format is still not a bad idea though you don't need to put a DOS filesystem on each floppy. You can use the `disklabel' and `newfs' commands to put a UFS filesystem on them instead, like so: <tscreen><verb> disklabel -w -r fd0 floppy3 (use floppy5 for 1.2MB disks) newfs /dev/rfd0 </verb></tscreen> Then you can mount and write to them like any other file system. After you have DOS formatted the floppies, you will need to copy the files onto them. The distribution files are split into chunks conveniently sized so that 5 of them will fit on a conventional 1.44MB floppy. Go through all your floppies, packing as many files as will fit on each one, until you have got all the distributions you want packed up in this fashion. Each distribution should go into a subdirectory on the floppy, e.g.: <bf>a:\bin\bin.aa</bf>, <bf>a:\bin\bin.ab</bf>, and so on. Once you come to the Media screen of the install, select ``Floppy'' and you will be prompted for the rest. <sect1><heading>Before installing from a MS-DOS partition<label id="install:msdos"></heading> <p>To prepare for installation from an MS-DOS partition, copy the files from the distribution into a directory called <tt>C:\FREEBSD</tt>. The directory tree structure of the CDROM must be partially reproduced within this directory so we suggest using the DOS <tt>xcopy</tt> command. For example, to prepare for a minimal installation of FreeBSD: <tscreen><verb> C> MD C:\FREEBSD C> XCOPY /S E:\DISTS\BIN C:\FREEBSD\BIN\ C> XCOPY /S E:\FLOPPIES C:\FREEBSD\FLOPPIES\ </verb></tscreen> assuming that <tt>C:</tt> is where you have free space and <tt>E:</tt> is where your CDROM is mounted. Note that you need the <tt>FLOPPIES</tt> directory because the <tt>root.flp</tt> image is needed during an MS-DOS installation. For as many `DISTS' you wish to install from MS-DOS (and you have free space for), install each one under <tt>C:\FREEBSD</tt> - the <tt>BIN</tt> dist is only the minimal requirement. If you have room on your MS-DOS partition for all the distributions, you could replace the last line above with: <tscreen><verb> C> XCOPY /S E:\DISTS C:\FREEBSD\ </verb></tscreen> which would copy all the subdirectories of <tt>E:\DISTS</tt> to <tt>C:\FREEBSD</tt>. <sect1><heading>Before installing from QIC/SCSI Tape</heading> <p>Installing from tape is probably the easiest method, short of an on-line install using FTP or a CDROM install. The installation program expects the files to be simply tar'ed onto the tape, so after getting all of the files for distribution you are interested in, simply tar them onto the tape with a command like: <tscreen> cd /freebsd/distdir<newline> tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2 </tscreen> Make sure that the `floppies/' directory is one of the ``dists'' given above, since the installation will look for `floppies/root.flp' on the tape. When you go to do the installation, you should also make sure that you leave enough room in some temporary directory (which you will be allowed to choose) to accommodate the <bf>full</bf> contents of the tape you have created. Due to the non-random access nature of tapes, this method of installation requires quite a bit of temporary storage. You should expect to require as much temporary storage as you have stuff written on tape. <quote><bf>Note:</bf> When going to do the installation, the tape must be in the drive <em>before</em> booting from the boot floppy. The installation probe may otherwise fail to find it.</quote> <sect1><heading>Before installing over a network</heading> <p>You can do network installations over 3 types of communications links: <descrip> <tag>Serial port</tag> SLIP or PPP <tag>Parallel port</tag> PLIP (laplink cable) <tag>Ethernet</tag> A standard ethernet controller (includes some PCMCIA). </descrip> SLIP support is rather primitive, and limited primarily to hard-wired links, such as a serial cable running between a laptop computer and another computer. The link should be hard-wired as the SLIP installation does not currently offer a dialing capability; that facility is provided with the PPP utility, which should be used in preference to SLIP whenever possible. If you are using a modem, then PPP is almost certainly your only choice. Make sure that you have your service provider's information handy as you will need to know it fairly soon in the installation process. You will need to know, at the minimum, your service provider's IP address and possibly your own (though you can also leave it blank and allow PPP to negotiate it with your ISP). You also need to know how to use the various ``AT commands'' to dial the ISP with your particular modem as the PPP dialer provides only a very simple terminal emulator. If a hard-wired connection to another FreeBSD (2.0R or later) machine is available, you might also consider installing over a ``laplink'' parallel port cable. The data rate over the parallel port is much higher than what is typically possible over a serial line (up to 50k/sec), thus resulting in a quicker installation. Finally, for the fastest possible network installation, an ethernet adaptor is always a good choice! FreeBSD supports most common PC ethernet cards, a table of supported cards (and their required settings) is provided in <ref id="install:hw" name="Supported Hardware">. If you are using one of the supported PCMCIA ethernet cards, also be sure that it is plugged in <em>before</em> the laptop is powered on! FreeBSD does not, unfortunately, currently support hot insertion of PCMCIA cards. You will also need to know your IP address on the network, the netmask value for your address class, and the name of your machine. Your system administrator can tell you which values to use for your particular network setup. If you will be referring to other hosts by name rather than IP address, you will also need a name server and possibly the address of a gateway (if you are using PPP, it is your provider's IP address) to use in talking to it. If you do not know the answers to all or most of these questions, then you should really probably talk to your system administrator <em>first</em> before trying this type of installation. Once you have a network link of some sort working, the installation can continue over NFS or FTP. <sect2><heading>Preparing for NFS installation</heading> <p>NFS installation is fairly straight-forward: Simply copy the FreeBSD distribution files you want onto a server somewhere and then point the NFS media selection at it. If this server supports only ``privileged port'' access (as is generally the default for Sun workstations), you will need to set this option in the Options menu before installation can proceed. If you have a poor quality ethernet card which suffers from very slow transfer rates, you may also wish to toggle the appropriate Options flag. In order for NFS installation to work, the server must support subdir mounts, e.g., if your FreeBSD 2.1 distribution directory lives on: <bf>ziggy:/usr/archive/stuff/FreeBSD</bf> Then ziggy will have to allow the direct mounting of <bf>/usr/archive/stuff/FreeBSD</bf>, not just <bf>/usr</bf> or <bf>/usr/archive/stuff</bf>. In FreeBSD's <bf>/etc/exports</bf> file, this is controlled by the ``<tt>-alldirs</tt>'' option. Other NFS servers may have different conventions. If you are getting `Permission Denied' messages from the server then it is likely that you do not have this enabled properly. <sect2><heading>Preparing for FTP Installation</heading> <p>FTP installation may be done from any mirror site containing a reasonably up-to-date version of FreeBSD 2.1. A full menu of reasonable choices from almost anywhere in the world is provided by the FTP site menu. If you are installing from some other FTP site not listed in this menu, or you are having troubles getting your name server configured properly, you can also specify your own URL by selecting the ``Other'' choice in that menu. A URL can also be a direct IP address, so the following would work in the absence of a name server: <tscreen><verb> ftp://192.216.222.4/pub/FreeBSD/2.1.0-RELEASE </verb></tscreen> There are two FTP installation modes you can use: <descrip> <tag>FTP Active</tag> For all FTP transfers, use ``Active'' mode. This will not work through firewalls, but will often work with older ftp servers that do not support passive mode. If your connection hangs with passive mode (the default), try active! <tag>FTP Passive</tag> For all FTP transfers, use ``Passive'' mode. This allows the user to pass through firewalls that do not allow incoming connections on random port addresses. </descrip> <quote><bf>Note:</bf> ACTIVE AND PASSIVE MODES ARE NOT THE SAME AS A `PROXY' CONNECTION, WHERE A PROXY FTP SERVER IS LISTENING ON A DIFFERENT PORT!</quote> In such instances, you should specify the URL as something like: <tscreen><verb> ftp://foo.bar.com:1234/pub/FreeBSD </verb></tscreen> Where ``1234'' is the port number of the proxy ftp server. <sect><heading>Installing FreeBSD</heading> <p>Once you have taken note of the appropriate preinstallation steps, you should be able to install FreeBSD without any further trouble. Should this not be true, then you may wish to go back and re-read the relevant preparation section above for the installation media type you are trying to use, perhaps there is a helpful hint there that you missed the first time? If you are having hardware trouble, or FreeBSD refuses to boot at all, read the Hardware Guide provided on the boot floppy for a list of possible solutions. The FreeBSD boot floppy contains all the on-line documentation you should need to be able to navigate through an installation and if it does not then we would like to know what you found most confusing. Send your comments to <htmlurl url="mailto:doc@freebsd.org" name="doc@freebsd.org">. It is the objective of the FreeBSD installation program (sysinstall) to be self-documenting enough that painful ``step-by-step'' guides are no longer necessary. It may take us a little while to reach that objective, but that is the objective! Meanwhile, you may also find the following ``typical installation sequence'' to be helpful: <enum> <item>Boot the boot floppy. After a boot sequence which can take anywhere from from 30 seconds to 3 minutes, depending on your hardware, you should be presented with a menu of initial choices. If the floppy does not boot at all, or the boot hangs at some stage, go read the Q&A section of the Hardware Guide for possible causes. <item>Press F1. You should see some basic usage instructions on the menu system and general navigation. If you have not used this menu system before then PLEASE read this thoroughly! <item>Select the Options item and set any special preferences you may have. <item>Select a Custom or Express install, depending on whether or not you would like the installation to give you a high degree of control over each step of the - installation or simply lead you through it, chosing + installation or simply lead you through it, choosing reasonable defaults when possible. See details on both installation types below. - <item>The Configure menu choice allows you to furthur + <item>The Configure menu choice allows you to further configure your FreeBSD installation by giving you menu-driven access to various system defaults. Some items, like networking, may be especially important if you did a CDROM/Tape/Floppy installation and have not yet configured your network interfaces (assuming you have any). Properly configuring such interfaces here will allow FreeBSD to come up on the network when you first reboot from the hard disk. </enum> <sect1><heading>Express installation</heading> <p>The express installation is not too much different than the Custom one except that it leads you through the required stages in the proper order and presents you with various helpful prompts along the way. <enum> <item>The first step is the `Partition Editor', which allows you to chose how your drives will be used for FreeBSD. If you are dedicating an entire drive to FreeBSD, the `A' command is probably all you need to type here. <item>Next, with the `Label Editor', you can specify how the space in any allocated FreeBSD partitions should be used by FreeBSD, or where to mount a non-FreeBSD partition (such as DOS). If you want the standard layout, simply type `A' here. <item>Next, the `Distributions' menu allows you to specify which parts of FreeBSD you wish to load. A good choice is ``User'' for a small system or ``Developer'' for someone wanting a bit more out of FreeBSD. If none of the existing collections sound applicable, select Custom. <item>Next, the `Media' menu allows you to specify what kind of media you wish to install from. If a desired media choice is found and configured automatically then this menu will simply return, otherwise you will be asked for additional details on the media device type. <item>Finally, you will be prompted to commit all of these actions at once (nothing has been written to your disk so far, nor will it until you give the final confirmation). All new or changed partition information will be written out, file systems will - be created and/or non-destructively labelled + be created and/or non-destructively labeled (depending on how you set their newfs flags in the Label Editor) and all selected distributions will be extracted. </enum> At this point, you are generally done with the sysinstall utility and can select the final `Quit'. If you are running it as an installer (e.g., before the system is all the way up) then the system will now reboot after you press return one last time. If you selected the boot manager option, you will see a small boot menu with an `F?' prompt. Press the function key for BSD (it will be shown) and you should boot up into FreeBSD off the hard disk. If this fails to happen for some reason, see the Q&A section of the Hardware Guide for possible clues! <sect1><heading>Custom installation</heading> <p>You can do anything you like in this menu without altering your system <em>except</em> for ``Commit'', which will perform any requests to alter your system you may have made. Some of the menu options will also - have direct `Write' commands available for commiting an + have direct `Write' commands available for committing an operation immediately, but they should only be used if you are absolutely sure it is necessary. It is generally better to make your changes and then commit them all at once so that you are left with the option of changing your mind up to the very last minute. If you are confused at any point, the F1 key usually pulls up the right information for the screen you are in. <sect><heading>MS-DOS user's Questions and Answers</heading> <p>Many FreeBSD users wish to install FreeBSD on PCs inhabited by MS-DOS. Here are some commonly asked questions about installing FreeBSD on such systems. <p><bf>Help! I have no space! Do I need to delete everything first?</bf> If your machine is already running MS-DOS and has little or no free space available for FreeBSD's installation, all is not lost! You may find the FIPS utility, provided in the <tt>tools</tt> directory on the FreeBSD CDROM or on the various FreeBSD ftp sites, to be quite useful. FIPS allows you to split an existing MS-DOS partition into two pieces, preserving the original partition and allowing you to install onto the second free piece. You first defragment your MS-DOS partition, using the DOS 6.xx DEFRAG utility or the Norton Disk tools, then run FIPS. It will prompt you for the rest of the information it needs. Afterwards, you can reboot and install FreeBSD on the new free slice. See the <em>Distributions</em> menu for an estimation of how much free space you will need for the kind of installation you want. <bf>Can I use compressed MS-DOS filesystems from FreeBSD?</bf> No. If you are using a utility such as Stacker(tm) or DoubleSpace(tm), FreeBSD will only be able to use whatever portion of the filesystem you leave uncompressed. The rest of the filesystem will show up as one large file (the stacked/dblspaced file!). <bf>Do not remove that file!</bf> You will probably regret it greatly! It is probably better to create another uncompressed MS-DOS primary partition and use this for communications between MS-DOS and FreeBSD. <!-- XXX Status??? <bf>Can I mount my MS-DOS extended partitions?</bf> This feature is not in FreeBSD 2.0.5 but should be in 2.1. We have laid all the groundwork for making this happen, now we just need to do the last 1 percent of the work involved. --> <bf>Can I run MS-DOS binaries under FreeBSD?</bf> Not yet! We would like to add support for this someday, but are still lacking anyone to actually do the work. Ongoing work with Linux's DOSEMU utility may bring this much closer to being a reality sometime soon. Send mail to hackers@freebsd.org if you're interested in joining this effort! However, there is a nice application available in the <ref id="ports" name="The Ports Collection"> called pcemu, that allows you to run many basic MS-DOS text-mode binaries by entirely emulating an 8088 CPU. diff --git a/handbook/kernelconfig.sgml b/handbook/kernelconfig.sgml index 1e5fd9cea4..bd9406ad38 100644 --- a/handbook/kernelconfig.sgml +++ b/handbook/kernelconfig.sgml @@ -1,1243 +1,1243 @@ -<!-- $Id: kernelconfig.sgml,v 1.7 1996-01-20 06:28:11 nate Exp $ --> +<!-- $Id: kernelconfig.sgml,v 1.8 1996-01-31 14:26:10 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <!DOCTYPE linuxdoc PUBLIC '-//FreeBSD//DTD linuxdoc//EN'> --> <chapt><heading>Configuring the FreeBSD Kernel<label id="kernelconfig"></heading> <p><em>Contributed by &a.jehamby;.<newline>6 October 1995.</em> This large section of the handbook discusses the basics of building your own custom kernel for FreeBSD. This section is appropriate for both novice system administrators and those with advanced Unix experience. <sect><heading>Why build a custom kernel?</heading> <p>Building a custom kernel is one of the most important rites of passage every Unix system administrator must learn. This process, while time-consuming, will provide many benefits to your FreeBSD system. Unlike the GENERIC kernel, which must support every possible SCSI and network card, along with tons of other rarely used hardware support, a custom kernel only contains support for <em>your</em> PC's hardware. This has a number of benefits: <itemize> <item>It will take less time to boot because it does not have to spend time probing for hardware which you do not have. <item>A custom kernel often uses less memory, which is important because the kernel is the one process which must always be present in memory, and so all of that unused code ties up pages of RAM that your programs would otherwise be able to use. Therefore, on a system with limited RAM, building a custom kernel is of critical importance. <item>Finally, there are several kernel options which you can tune to fit your needs, and device driver support for things like sound cards which you can include in your kernel but are <em>not</em> present in the GENERIC kernel. </itemize></p> <sect><heading>Building and Installing a Custom Kernel</heading> <p>First, let us take a quick tour of the kernel build directory. All directories mentioned will be relative to the main <tt>/usr/src/sys</tt> directory, which is also accessible through <tt>/sys</tt>. There are a number of subdirectories here representing different parts of the kernel, but the most important, for our purposes, are <tt>i386/conf</tt>, where you will edit your custom kernel configuration, and <tt>compile</tt>, which is the staging area where your kernel will be built. Notice the logical organization of the directory tree, with each supported device, filesystem, and option in its own subdirectory. Also, anything inside the <tt>i386</tt> directory deals with PC hardware only, while everything outside the <tt>i386</tt> directory is common to all platforms which FreeBSD could potentially be ported to. <quote><em/Note:/ If there is <em>not</em> a <tt>/usr/src/sys</tt> directory on your system, then the kernel source has not been been installed. Follow the instructions for installing packages to add this package to your system.</quote> Next, move to the <tt>i386/conf</tt> directory and copy the GENERIC configuration file to the name you want to give your kernel. For example: <tscreen><verb> # cd /usr/src/sys/i386/conf # cp GENERIC MYKERNEL </verb></tscreen> Traditionally, this name is in all capital letters and, if you are maintaining multiple FreeBSD machines with different hardware, it's a good idea to name it after your machine's hostname. We will call it MYKERNEL for the purpose of this example. <quote><em/Note:/ You must execute these and all of the following commands under the root account or you will get ``permission denied'' errors.</quote> Now, edit MYKERNEL with your favorite text editor. If you're just starting out, the only editor available will probably be <tt>vi</tt>, which is too complex to explain here, but is covered well in many books in the <ref id="bibliography" name="bibliography">. Feel free to change the comment lines at the top to reflect your configuration or the changes you've made to differentiate it from GENERIC. If you've build a kernel under SunOS or some other BSD operating system, much of this file will be very familiar to you. If you're coming from some other operating system such as DOS, on the other hand, the GENERIC configuration file might seem overwhelming to you, so follow the descriptions in the <ref id="kernelconfig:config" name="Configuration File"> section slowly and carefully. <quote><em/Note:/ If you are trying to upgrade your kernel from an older version of FreeBSD, you will probably have to get a new version of <tt>config(8)</tt> from the same place you got the new kernel sources. It is located in <tt>/usr/src/usr.sbin</tt>, so you'll need to download those sources as well. Re-build and install it before running the next commands.</quote> When you're finished, type the following to compile and install your kernel: <tscreen><verb> # /usr/sbin/config MYKERNEL # cd ../../compile/MYKERNEL # make depend # make # make install </verb></tscreen> The new kernel will be copied to the root directory as <tt>/kernel</tt> and the old kernel will be moved to <tt>/kernel.old</tt>. Now, shutdown the system and reboot to use your kernel. In case something goes wrong, there are some <ref id="kernelconfig:trouble" name= "troubleshooting"> instructions at the end of this document. Be sure to read the section which explains how to recover in case your new kernel <ref id="kernelconfig:noboot" name="does not boot">. <quote><em/Note:/ If you've added any new devices (such as sound cards) you may have to add some <ref id="kernelconfig:nodes" name="device nodes"> to your <tt>/dev</tt> directory before you can use them.</quote> <sect><heading>The Configuration File<label id="kernelconfig:config"></heading> <p>The general format of a configuration file is quite simple. Each line contains a keyword and one or more arguments. For simplicity, most lines only contain one argument. Anything following a <tt>#</tt> is considered a comment and ignored. The following sections describe each keyword, generally in the order they are listed in GENERIC, although some related keywords have been grouped together in a single section (such as Networking) even though they are actually scattered throughout the GENERIC file. An exhaustive list of options and more detailed explanations of the device lines is present in the LINT configuration file, located in the same directory as GENERIC. If you are in doubt as to the purpose or necessity of a line, check first in LINT. <sect1><heading>Mandatory Keywords</heading> <p>These keywords are required in every kernel you build. <descrip> <tag>machine ``i386''</tag> <p>The first keyword is <tt>machine</tt>, which, since FreeBSD only runs on Intel 386 and compatible chips, is i386. <quote><em>Note:</em> that any keyword which contains numbers used as text must be enclosed in quotation marks, otherwise <tt>config</tt> gets confused and thinks you mean the actual number 386.</quote> <tag>cpu ``<em>cpu_type</em>''</tag> <p>The next keyword is <tt>cpu</tt>, which includes support for each CPU supported by FreeBSD. The possible values of <tt><em>cpu_type</em></tt> include: <itemize> <item>I386_CPU <item>I486_CPU <item>I586_CPU </itemize> and multiple instances of the <tt>cpu</tt> line may be present with different values of <tt><em>cpu_type</em></tt> as are present in the GENERIC kernel. For a custom kernel, it is best to specify only the cpu you have. If, for example, you have an Intel Pentium, use <tt>I586_CPU</tt> for <tt><em>cpu_type</em></tt>. <tag>ident <em>machine_name</em></tag> <p>Next, we have <tt>ident</tt>, which is the identification of the kernel. You should change this from GENERIC to whatever you named your kernel, in this example, MYKERNEL. The value you put in <tt>ident</tt> will print when you boot up the kernel, so it's useful to give a kernel a different name if you want to keep it separate from your usual kernel (if you want to build an experimental kernel, for example). Note that, as with <tt>machine</tt> and <tt> cpu</tt>, enclose your kernel's name in quotation marks if it contains any numbers. Since this name is passed to the C compiler as a <tt>-D</tt> switch, don't use names like <tt> DEBUG</tt>, or something that could be confused with another machine or CPU name, like <tt>vax</tt>. <tag>maxusers <em>number</em></tag> <p>This file sets the size of a number of important system tables. This number is supposed to be roughly equal to the number of simultaneous users you expect to have on your machine. However, under normal circumstances, you will want to set <tt>maxusers</tt> to at least four, especially if you're using X Windows or compiling software. The reason is that the most important table set by <tt>maxusers</tt> is the maximum number of processes, which is set to <bf><tt>20 + 16 * maxusers</tt></bf>, so if you set <tt>maxusers</tt> to one, then you can only have 36 simultaneous processes, including the 18 or so that the system starts up at boot time, and the 15 or so you will probably create when you start X Windows. Even a simple task like reading a <tt>man</tt> page will start up nine processes to filter, decompress, and view it. Setting <tt>maxusers</tt> to 4 will allow you to have up to 84 simultaneous processes, which should be enough for anyone. If, however, you see the dreaded ``proc table full'' error when trying to start another program, or are running a server with a large number of simultaneous users (like Walnut Creek CDROM's FTP site), you can always increase this number and rebuild. <quote><em/Note:/ <tt>maxuser</tt> does <em>not</em> limit the number of users which can log into your machine. It simply sets various table sizes to reasonable values considering the maximum number of users you will likely have on your system and how many processes each of them will be running. One keyword which <em>does</em> limit the number of simultaneous <em>remote logins</em> is <ref id="kernelconfig:ptys" name="pseudo-device pty 16">.</quote> <tag>config <em>kernel_name</em> root on <em>root_device</em></tag> <p>This line specifies the location and name of the kernel. Traditionally the kernel is called <tt>vmunix</tt> but in FreeBSD, it is aptly named <tt>kernel</tt>. You should always use <tt>kernel</tt> for <em>kernel_name</em> because changing it will render numerous system utilities inoperative. The second part of the line specifies the disk and partition where the root filesystem and kernel can be found. Typically this will be <tt>wd0</tt> for systems with non-SCSI drives, or <tt>sd0</tt> for systems with SCSI drives. </descrip> <sect1><heading>General Options</heading> <p>These lines provide kernel support for various filesystems and other options. <descrip> <label id="kernelconfig:mathemu"> <tag>options MATH_EMULATE</tag> <p>This line allows the kernel to simulate a math - coprocessor if your computer does not have one (386 + co-processor if your computer does not have one (386 or 486SX). If you have a Pentium, a 486DX, or a 386 or 486SX with a separate 387 or 487 chip, you can comment this line out. - <quote><em>Note:</em> The normal math coprocessor + <quote><em>Note:</em> The normal math co-processor emulation routines that come with FreeBSD are <em>not</em> very accurate. If you do not have a - math coprocessor, and you need the best accuracy, + math co-processor, and you need the best accuracy, I recommend that you change this option to <tt>GPL_MATH_EMULATE</tt> to use the superior GNU math support, which is not included by default for licensing reasons.</quote> <tag>options ``COMPAT_43''</tag> <p>Compatibility with BSD 4.3. Leave this in; some programs will act strangely if you comment this out. <tag>options BOUNCE_BUFFERS</tag> <p>ISA devices and EISA devices operating in an ISA - compatibilty mode can only perform DMA (Direct + compatibility mode can only perform DMA (Direct Memory Access) to memory below 16 megabytes. This option enables such devices to work in systems with more than 16 megabytes of memory. <tag>options UCONSOLE</tag> <p>Allow users to grab the console, useful for X Windows. For example, you can create a console xterm by typing <tt>xterm -C</tt>, which will display any `write', `talk', and other messages you receive, as well as any console messages sent by the kernel. <tag>options SYSVSHM</tag> <p>This option provides for System V shared memory. The most common use of this is the XSHM extension in X Windows, which many graphics-intensive programs (such as the movie player XAnim, and Linux DOOM) will automatically take advantage of for extra speed. If you use X Windows, you'll definitely want to include this. <tag>options SYSVSEM</tag> <p>Support for System V semaphores. Less commonly used but only adds a few hundred bytes to the kernel. <tag>options SYSVMSG</tag> <p>Support for System V messages. Again, only adds a few hundred bytes to the kernel. <quote><em/Note:/ The <tt>ipcs(1)</tt> command will tell will list any processes using using each of these System V facilities.</quote> </descrip> <sect1><heading>Filesystem Options</heading> <p>These options add support for various filesystems. You must include at least one of these to support the device you boot from; typically this will be <tt>FFS</tt> if you boot from a hard drive, or <tt>NFS</tt> if you are booting a diskless workstation from Ethernet. You can include other commonly-used filesystems in the kernel, but feel free to comment out support for filesystems you use less often (perhaps the MS-DOS filesystem?), since they will be dynamically loaded from the Loadable Kernel Module directory <tt>/lkm</tt> the first time you mount a partition of that type. <descrip> <tag>options FFS</tag> <p>The basic hard drive filesystem; leave it in if you boot from the hard disk. <tag>options NFS</tag> <p>Network Filesystem. Unless you plan to mount partitions from a Unix file server over Ethernet, you can comment this out. <tag>options MSDOSFS</tag> <p>MS-DOS Filesystem. Unless you plan to mount a DOS formatted hard drive partition at boot time, you can safely comment this out. It will be automatically loaded the first time you mount a DOS partition, as described above. Also, the excellent <tt>mtools</tt> software (in the ports collection) allows you to access DOS floppies without having to mount and unmount them (and does not require MSDOSFS at all). <tag>options ``CD9660''</tag> <p>ISO 9660 filesystem for CD-ROMs. Comment it out if you do not have a CD-ROM drive or only mount data CD's occasionally (since it will be dynamically loaded the first time you mount a data CD). Audio CD's do not need this filesystem. <tag>options PROCFS</tag> <p>Process filesystem. This is a pretend filesystem mounted on /proc which allows programs like <tt>ps(1)</tt> to give you more information on what processes are running. <tag>options MFS</tag> <p>Memory-mapped file system. This is basically a RAM disk for fast storage of temporary files, useful if you have a lot of swap space that you want to take advantage of. A perfect place to mount an MFS partition is on the <tt>/tmp</tt> directory, since many programs store temporary data here. To mount an MFS RAM disk on <tt>/tmp</tt>, add the following line to <tt>/etc/fstab</tt> and then reboot or type <tt>mount /tmp</tt>: <tscreen><verb> /dev/wd1s2b /tmp mfs rw 0 0 </verb></tscreen> <quote><em/Note:/ Replace the <tt>/dev/wd1s2b</tt> with the name of your swap partition, which will be listed in your <tt>/etc/fstab</tt> as follows: <tscreen><verb> /dev/wd1s2b none swap sw 0 0 </verb></tscreen> </quote> <quote><em/Note:/ <!-- MFS is currently a bit limited (for example, I noticed that two programs ca not access the <tt>/tmp</tt> device simultaneously). As such, you may want to avoid it for now. --> Also, the <tt>MFS</tt> filesystem can <em>not</em> be dynamically loaded, so you <em>must</em> compile it into your kernel if you want to experiment with it.</quote> <tag>options QUOTA</tag> <p>Enable disk quotas. If you have a public access system, and do not want users to be able to overflow the <tt>/home</tt> partition, you can establish disk quotas for each user. This code is a little buggy, so do not enable it unless you have to. View the manual page for <tt>quota(1)</tt> to learn more about disk quotas. </descrip> <sect1><heading>Basic Controllers and Devices</heading> <p>These sections describe the basic disk, tape, and CD-ROM controllers supported by FreeBSD. There are separate sections for <ref id="kernelconfig:scsi" name="SCSI"> controllers and <ref id="kernelconfig:network" name="network"> cards. <descrip> <tag>controller isa0</tag> <p>All PC's supported by FreeBSD have one of these. If you have an IBM PS/2 (Micro Channel Architecture), then you cannot run FreeBSD at this time. <tag>controller pci0</tag> <p>Include this if you have a PCI motherboard. This enables auto-detection of PCI cards and gatewaying from the PCI to the ISA bus. <tag>controller fdc0</tag> <p>Floppy drive controller: <tt>fd0</tt> is the ``A:'' floppy drive, and <tt>fd1</tt> is the ``B:'' drive. <tt>ft0</tt> is a QIC-80 tape drive attached to the floppy controller. Comment out any lines corresponding to devices you do not have. <quote><em/Note:/ QIC-80 tape support requires a separate filter program called <tt>ft(8)</tt>, see the manual page for details.</quote> <tag>controller wdc0</tag> <p>This is the primary IDE controller. <tt>wd0</tt> and <tt>wd1</tt> are the master and slave hard drive, respectively. <tt>wdc1</tt> is a secondary IDE controller where you might have a third or fourth hard drive, or an IDE CD-ROM. Comment out the lines which do not apply (if you have a SCSI hard drive, you'll probably want to comment out all six lines, for example). <tag>controller wcd0<label id="kernelconfig:atapi"></tag> <p>This device provides IDE CD-ROM support. Be sure to leave <tt>wdc1</tt> uncommented if your CD-ROM is on its own controller card. To use this, you must also include the line <tt>options ATAPI</tt>. <tag>device npx0 at isa? port ``IO_NPX'' irq 13 vector npxintr</tag> <p><tt>npx0</tt> is the interface to the floating point math unit in FreeBSD, either the hardware co-processor or the software math emulator. It is <em/NOT/ optional. <tag>device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr</tag> <p>Wangtek and Archive QIC-02/QIC-36 tape drive support <tag>Proprietary CD-ROM support</tag> <p>The following drivers are for the so-called <em>proprietary</em> CD-ROM drives. These drives have their own controller card or might plug into a sound card - such as the Soundblaster 16. They are <em>not</em> + such as the SoundBlaster 16. They are <em>not</em> IDE or SCSI. Most older single-speed and double-speed CD-ROMs use these interfaces, while newer quad-speeds are likely to be <ref id="kernelconfig:atapi" name="IDE"> or <ref id="kernelconfig:scsi" name="SCSI">. <descrip> <tag>device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr</tag> <p>Mitsumi CD-ROM (LU002, LU005, FX001D). <tag>device scd0 at isa? port 0x230 bio</tag> <p>Sony CD-ROM (CDU31, CDU33A). <tag>controller matcd0 at isa? port ? bio</tag> <p>Matsushita/Panasonic CD-ROM (sold by Creative - Labs for Soundblaster). + Labs for SoundBlaster). </descrip> </descrip> <sect1><heading>SCSI Device Support<label id="kernelconfig:scsi"></heading> <p>This section describes the various SCSI controllers and devices supported by FreeBSD. <descrip> <tag>SCSI Controllers</tag> <p>The next ten or so lines include support for different kinds of SCSI controllers. Comment out all except for the one(s) you have: <descrip> <tag>controller bt0 at isa? port ``IO_BT0'' bio irq ? vector btintr</tag> <p>Most Buslogic controllers <tag>controller uha0 at isa? port ``IO_UHA0'' bio irq ? drq 5 vector uhaintr</tag> <p>UltraStor 14F and 34F <tag>controller ahc0</tag> <p>Adaptec 274x/284x/294x <tag>controller ahb0 at isa? bio irq ? vector ahbintr</tag> <p>Adaptec 174x <tag>controller aha0 at isa? port ``IO_AHA0'' bio irq ? drq 5 vector ahaintr</tag> <p>Adaptec 154x <tag>controller aic0 at isa? port 0x340 bio irq 11 vector aicintr </tag> <p>Adaptec 152x and sound cards using Adaptec AIC-6360 (slow!) <tag>controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr </tag> <p>ProAudioSpectrum cards using NCR 5380 or Trantor T130 <tag>controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr</tag> <p>Seagate ST01/02 8 bit controller (slow!) <tag>controller wds0 at isa? port 0x350 bio irq 15 drq 6 vector wdsintr</tag> <p>Western Digital WD7000 controller <tag>controller ncr0</tag> <p>NCR 53C810 and 53C825 PCI SCSI controller </descrip> <tag>options ``SCSI_DELAY=15''</tag> <p>This causes the kernel to pause 15 seconds before probing each SCSI device in your system. If you only have IDE hard drives, you can ignore this, otherwise you'll probably want to lower this number, perhaps to 5 seconds, to speed up booting. Of course if you do this, and FreeBSD has trouble recognizing your SCSI devices, you'll have to raise it back up. <tag>controller scbus0</tag> <p>If you have any SCSI controllers, this line provides generic SCSI support. If you do not have SCSI, you can comment this, and the following three lines, out. <tag>device sd0</tag> <p>Support for SCSI hard drives. <tag>device st0</tag> <p>Support for SCSI tape drives. <tag>device cd0</tag> <p>Support for SCSI CD-ROM drives. <p>Note that the number <bf>0</bf> in the above entries is slightly misleading: all these devices are automatically configured as they are found, regardless of how many of them are hooked up to the SCSI bus(es), and which target IDs they have. If you want to ``wire down'' specific target IDs to particular devices, refer to the appropriate section of the LINT kernel config file. </descrip> <sect1><heading>Console, Bus Mouse, and X Server Support</heading> <p>You must choose one of these two console types, and, if you plan to use X Windows, enable the XSERVER option and optionally, a bus mouse or PS/2 mouse device. <descrip> <tag>device sc0 at isa? port ``IO_KBD' tty irq 1 vector scintr</tag> <p><tt>sc0</tt> is the default console driver, which resembles an SCO console. Since most full-screen programs access the console through a terminal database library like <em>termcap</em>, it should not matter much whether you use this or <tt>vt0</tt>, the VT220 compatible console driver. When you log in, set your TERM variable to ``scoansi'' if full-screen programs have trouble running under this console. <tag>device vt0 at isa? port ``IO_KBD'' tty irq 1 vector pcrint</tag> <p>This is a VT220-compatible console driver, backwards compatible to VT100/102. It works well on some laptops which have hardware incompatibilities with <tt>sc0</tt>. Also, set your TERM variable to ``vt100'' or ``vt220'' when you log in. This driver might also prove useful when connecting to a large number of different machines over the network, where the <em>termcap</em> or <em>terminfo</em> entries for the <tt>sc0</tt> device are often not available -- ``vt100'' should be available on virtually any platform. <descrip> <tag>options ``PCVT_FREEBSD=210''</tag> <p>Required with the <tt>vt0</tt> console driver. <tag>options XSERVER</tag> <p>This includes code required to run the <tt>XFree86</tt> X Window Server. </descrip> <tag>device mse0 at isa? port 0x23c tty irq 5 vector ms</tag> <p>Use this device if you have a Logitech or ATI InPort bus mouse card. <quote><em/Note:/ If you have a serial mouse, ignore these two lines, and instead, make sure the appropriate <ref id="kernelconfig:serial" name="serial"> port is enabled (probably COM1).</quote> <tag>device psm0 at isa? port ``IO_KBD'' conflicts tty irq 12 vector psmintr</tag> <p>Use this device if your mouse plugs into the PS/2 mouse port. </descrip> <sect1><heading>Serial and Parallel Ports</heading> <p>Nearly all systems have these. If you are attaching a printer to one of these ports, the <ref id="printing" name="Printing"> section of the handbook is very useful. If you are using modem, <ref id="dialup" name="Dialup access"> provides extensive detail on serial port configuration for use with such devices. <descrip> <tag>device sio0 at isa? port ``IO_COM1'' tty irq 4 vector siointr<label id="kernelconfig:serial"></tag> <p><tt>sio0</tt> through <tt>sio3</tt> are the four serial ports referred to as COM1 through COM4 in the MS-DOS world. Note that if you have an internal modem on COM4 and a serial port at COM2 you will have to change the IRQ of the modem to 2 (for obscure technical reasons IRQ 2 = IRQ 9) in order to access it from FreeBSD. If you have a multiport serial card, check the manual page for <tt>sio(4)</tt> for more information on the proper values for these lines. Some video cards (notably those based on S3 chips) use IO addresses of the form <tt>0x*2e8</tt>, and since many cheap serial cards do not fully decode the 16-bit IO address space, they clash with these cards, making the COM4 port practically unavailable. Each serial port is required to have a unique IRQ (unless you are using one of the multiport cards where shared interrupts are supported), so the default IRQs for COM3 and COM4 cannot be used. <tag>device lpt0 at isa? port? tty irq 7 vector lptintr</tag> <p><tt>lpt0</tt> through <tt>lpt2</tt> are the three printer ports you could conceivably have. Most people just have one, though, so feel free to comment out the other two lines if you do not have them. </descrip> <sect1><heading>Networking<label id="kernelconfig:network"></heading> <p>FreeBSD, as with Unix in general, places a <em>big</em> emphasis on networking. Therefore, even if you do not have an Ethernet card, pay attention to the mandatory options and the dial-up networking support. <descrip> <tag>options INET</tag> Networking support. Leave it in even if you do not plan to be connected to a network. Most programs require at least loopback networking (i.e. making network connections within your PC) so this is essentially mandatory. <tag>Ethernet cards</tag> <p>The next lines enable support for various Ethernet cards. If you do not have a network card, you can comment out all of these lines. Otherwise, you'll want to leave in support for your particular Ethernet card(s): <descrip> <tag>device de0</tag> <p>Digital Equipment DC21040 PCI Ethernet adapter <tag>device cx0 at isa? port 0x240 net irq 15 drq 7 vector cxintr</tag> <p>Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) <tag>device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr</tag> <p>Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 <tag>device el0 at isa? port 0x300 net irq 9 vector elintr</tag> <p>3Com 3C501 (slow!) <tag>device eg0 at isa? port 0x310 net irq 5 vector egintr</tag> <p>3Com 3C505 <tag>device ep0 at isa? port 0x300 net irq 10 vector epintr</tag> <p>3Com 3C509 (buggy) <tag>device fe0 at isa? port 0x240 net irq ? vector feintr</tag> <p>Fujitsu MB86960A/MB86965A Ethernet <tag>device fea0 at isa? net irq ? vector feaintr</tag> <p>DEC DEFEA EISA FDDI adapter <tag>device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr</tag> <p>AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210 <tag>device ix0 at isa? port 0x300 net irq 10 iomem 0xd0000 iosiz 32768 vector ixintr</tag> <p>Intel EtherExpress 16 <tag>device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr</tag> <p>Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) <tag>device lnc0 at isa? port 0x300 net irq 10 drq 0 vector lncintr</tag> <p>Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL) <tag>device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr</tag> <p>IBM/National Semiconductor PCMCIA ethernet controller. <tag>device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr</tag> <p>3Com PCMCIA Etherlink III </descrip> <quote><em/Note:/ With certain cards (notably the NE2000) you'll have to change the port and/or IRQ since there is no ``standard'' location for these cards.</quote> <tag>pseudo-device loop</tag> <p><tt>loop</tt> is the generic loopback device for TCP/IP. If you telnet or FTP to <em>localhost</em> (a.k.a. <tt>127.0.0.1</tt>) it will come back at you through this pseudo-device. Mandatory. <tag>pseudo-device ether</tag> <p><tt>ether</tt> is only needed if you have an Ethernet card and includes generic Ethernet protocol code. <tag>pseudo-device sl <em>number</em></tag> <p><tt>sl</tt> is for SLIP (Serial Line Internet Protocol) support. This has been almost entirely supplanted by PPP, which is easier to set up, better suited for modem-to-modem connections, as well as more powerful. The <em>number</em> after <tt>sl</tt> specifies how many simultaneous SLIP sessions to support. This handbook has more information on setting up a SLIP <ref id="slipc" name="client"> or <ref id="slips" name="server">. <tag>pseudo-device ppp <em>number</em></tag> <p><tt>ppp</tt> is for kernel-mode PPP (Point-to-Point Protocol) support for dial-up Internet connections. There is also version of PPP implemented as a user application that uses the <tt>tun</tt> and offers more flexibility and features such as demand dialing. If you still want to use this PPP driver, read the <ref id="ppp" name="kernel-mode PPP"> section of the handbook. As with the <tt>sl</tt> device, <em>number</em> specifies how many simultaneous PPP connections to support. <tag>pseudo-device tun <em>number</em></tag> <p><tt>tun</tt> is used by the user-mode PPP software. This program is easy to set up and very fast. It also has special features such as automatic dial-on-demand. The number after <tt>tun</tt> specifies the number of simultaneous PPP sessions to support. See the <ref id="userppp" name="user-mode PPP"> section of the handbook for more information. <tag>pseudo-device bpfilter <em>number</em></tag> <p>Berkeley packet filter. This pseudo-device allows network interfaces to be placed in promiscuous mode, capturing every packet on a broadcast network (e.g. an ethernet). These packets can be captured to disk and/or examined with the <tt>tcpdump(1)</tt> program. Note that implementation of this capability can seriously compromise your overall network security. The <em>number</em> after bpfilter is the number of interfaces that can be examined simultaneously. Optional, not recommended except for those who are fully aware of the potential pitfalls. Not all network cards support this capability. </descrip> <sect1><heading>Sound cards</heading> <p>This is the first section containing lines that are not in the GENERIC kernel. To include sound card support, you'll have to copy the appropriate lines from the LINT kernel (which contains support for <em>every</em> device) as follows: <descrip> <tag>controller snd0</tag> <p>Generic sound driver code. Required for all of the following sound cards except <tt>pca</tt>. <tag>device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr</tag> <p>ProAudioSpectrum digital audio and MIDI. <tag>device sb0 at isa? port 0x220 irq 7 conflicts drq 1 vector sbintr</tag> <p>SoundBlaster digital audio. - <quote><em/Note:/ If your Soundblaster is on a + <quote><em/Note:/ If your SoundBlaster is on a different IRQ (such as 5), change <tt>irq 7</tt> to, for example, <tt>irq 5</tt> and remove the <tt>conflicts</tt> keyword. Also, you must add the line: <tt>options ``SBC_IRQ=5''</tt></quote> <tag>device sbxvi0 at isa? drq 5</tag> <p>SoundBlaster 16 digital 16-bit audio. <quote><em/Note:/ If your SB16 is on a different 16-bit DMA channel (such as 6 or 7), change the <tt>drq 5</tt> keyword appropriately, and then add the line: <tt>options "SB16_DMA=6"</tt></quote> <tag>device sbmidi0 at isa? port 0x330</tag> <p>SoundBlaster 16 MIDI interface. If you have a SoundBlaster 16, you must include this line, or the kernel will not compile. <tag>device gus0 at isa? port 0x220 irq 10 drq 1 vector gusintr</tag> <p>Gravis Ultrasound. <tag>device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr</tag> <p>Microsoft Sound System. <tag>device opl0 at isa? port 0x388 conflicts</tag> <p>AdLib FM-synthesis audio. Include this line for AdLib, SoundBlaster, and ProAudioSpectrum users, if you want to play MIDI songs with a program such as <tt>playmidi</tt> (in the ports collection). <tag>device mpu0 at isa? port 0x330 irq 6 drq 0</tag> <p>Roland MPU-401 stand-alone card. <tag>device uart0 at isa? port 0x330 irq 5 vector ``m6850intr''</tag> <p>Stand-alone 6850 UART for MIDI. <tag>device pca0 at isa? port ``IO_TIMER1'' tty<label id="kernelconfig:pcaudio"></tag> <p>Digital audio through PC speaker. This is going to be very poor sound quality and quite CPU-intensive, so you have been warned (but it does not require a sound card). </descrip> <quote><em/Note:/ There is some additional documentation in <tt>/usr/src/sys/i386/isa/sound/sound.doc</tt>. Also, if you add any of these devices, be sure to create the sound <ref id="kernelconfig:nodes" name="device nodes">.</quote> <sect1><heading>Pseudo-devices</heading> <p>Pseudo-device drivers are parts of the kernel that act like device drivers but do not correspond to any actual hardware in the machine. The <ref id="kernelconfig:network" name="network-related"> pseudo-devices are in that section, while the remainder are here. <descrip> <tag>pseudo-device gzip</tag> <p><tt>gzip</tt> allows you to run FreeBSD programs that have been compressed with <tt>gzip</tt>. The programs in <tt>/stand</tt> are compressed so it is a good idea to have this option in your kernel.</p> <tag>pseudo-device log</tag> <p><tt>log</tt> is used for logging of kernel error messages. Mandatory. <tag>pseudo-device pty <em>number</em><label id="kernelconfig:ptys"></tag> <p><tt>pty</tt> is a ``pseudo-terminal'' or simulated login port. It's used by incoming <bf>telnet</bf> and <bf>rlogin</bf> sessions, xterm, and some other applications such as emacs. The <em>number</em> indicates the number of <tt>pty</tt>s to create. If you need more than GENERIC default of 16 simultaneous xterm windows and/or remote logins, be sure to increase this number accordingly, up to a maximum of 64. <tag>pseudo-device snp <em>number</em></tag> <p>Snoop device. This pseudo-device allows one terminal session to watch another using the <tt>watch(8)</tt> command. Note that implementation of this capability has important security and privacy implications. The <em>number</em> after snp is the total number of simultaneous snoop sessions. Optional. <tag>pseudo-device vn</tag> <p>Vnode driver. Allows a file to be treated as a device after being set up with the <tt>vnconfig(8)</tt> command. This driver can be useful for manipulating floppy disk images and using a file as a swap device (e.g. an MS Windows swap file). Optional. </descrip> <sect1><heading>Joystick, PC Speaker, Miscellaneous</heading> <p>This section describes some miscellaneous hardware devices supported by FreeBSD. Note that none of these lines are included in the GENERIC kernel, you'll have to copy them from this handbook or the LINT kernel (which contains support for <em>every</em> device): <descrip> <tag>device joy0 at isa? port ``IO_GAME''</tag> <p>PC joystick device. <tag>pseudo-device speaker</tag> <p>Supports IBM BASIC-style noises through the PC speaker. Some fun programs which use this are <tt>/usr/sbin/spkrtest</tt>, which is a shell script that plays some simple songs, and <tt>/usr/games/piano</tt> which lets you play songs using the keyboard as a simple piano (this file only exists if you've installed the <em>games</em> package). Also, the excellent text role-playing game NetHack (in the ports collection) can be configured to use this device to play songs when you play musical instruments in the game. <p>See also the <ref id="kernelconfig:pcaudio" name="pca0"> device. </descrip> <sect><heading>Making Device Nodes<label id="kernelconfig:nodes"></heading> <p>Almost every device in the kernel has a corresponding ``node'' entry in the <tt>/dev</tt> directory. These nodes look like regular files, but are actually special entries into the kernel which programs use to access the device. The shell script <tt>/dev/MAKEDEV</tt>, which is executed when you first install the operating system, creates nearly all of the device nodes supported. However, it does not create <em>all</em> of them, so when you add support for a new device, it pays to make sure that the appropriate entries are in this directory, and if not, add them. Here is a simple example: Suppose you add the IDE CD-ROM support to the kernel. The line to add is: <tscreen><verb> controller wcd0 </verb></tscreen> This means that you should look for some entries that start with <tt>wcd0</tt> in the <tt>/dev</tt> directory, possibly followed by a letter, such as `c', or preceded by the letter 'r', which means a `raw' device. It turns out that those files are not there, so I must change to the <tt>/dev</tt> directory and type: <tscreen><verb> # sh MAKEDEV wcd0 </verb></tscreen> When this script finishes, you will find that there are now <tt>wcd0c</tt> and <tt>rwcd0c</tt> entries in <tt>/dev</tt> so you know that it executed correctly. For sound cards, the command: <tscreen><verb> # sh MAKEDEV snd0 </verb></tscreen> creates the appropriate entries. Follow this simple procedure for any other non-GENERIC devices which do not have entries. <quote><em/Note:/ All SCSI controllers use the same set of <tt>/dev</tt> entries, so you do not need to create these. Also, network cards and SLIP/PPP pseudo-devices do not have entries in <tt>/dev</tt> at all, so you do not have to worry about these either.</quote> <sect><heading>If Something Goes Wrong<label id="kernelconfig:trouble"></heading> <p>There are four categories of trouble that can occur when building a custom kernel. They are: <descrip> <tag>Config command fails</tag> <p>If the <tt>config</tt> command fails when you give it your kernel description, you've probably made a simple error somewhere. Fortunately, <tt>config</tt> will print the line number that it had trouble with, so you can quickly skip to it with <tt>vi</tt>. For example, if you see: <tscreen><verb> config: line 17: syntax error </verb></tscreen> you can skip to the problem in <tt>vi</tt> by typing ``17G'' in command mode. Make sure the keyword is typed correctly, by comparing it to the GENERIC kernel or another reference. <tag>Make command fails</tag> <p>If the <tt>make</tt> command fails, it usually signals an error in your kernel description, but not severe enough for <tt>config</tt> to catch it. Again, look over your configuration, and if you still cannot resolve the problem, send mail to <tt><htmlurl url="mailto:questions@freebsd.org" name="questions@FreeBSD.ORG"></tt> with your kernel configuration, and it should be diagnosed very quickly. <tag>Kernel will not boot<label id="kernelconfig:noboot"></tag> <p>If your new kernel does not boot, or fails to recognize your devices, do not panic! Fortunately, BSD has an excellent mechanism for recovering from incompatible kernels. Simply type the name of the kernel you want to boot from (i.e. ``kernel.old'') at the FreeBSD boot prompt instead of pressing return. When reconfiguring a kernel, it is always a good idea to keep a kernel that is known to work on hand. After booting with a good kernel you can check over your configuration file and try to build it again. One helpful resource is the <tt>/var/log/messages</tt> file which records, among other things, all of the kernel messages from every successful boot. Also, the <tt>dmesg(8)</tt> command will print the kernel messages from the current boot. <quote><em/Note:/ If you are having trouble building a kernel, make sure to keep a GENERIC, or some other kernel that is known to work on hand as a different name that will not get erased on the next build. You cannot rely on <tt>kernel.old</tt> because when installing a new kernel, <tt>kernel.old</tt> is overwritten with the last installed kernel which may be non-functional. Also, as soon as possible, move the working kernel to the proper ``kernel'' location or commands such as <tt>ps(1)</tt> will not work properly. The proper command to ``unlock'' the kernel file that <tt>make</tt> installs (in order to move another kernel back permanently) is: <tscreen><verb> # chflags noschg /kernel </verb></tscreen> And, if you want to ``lock'' your new kernel into place, or any file for that matter, so that it cannot be moved or tampered with: <tscreen><verb> # chflags schg /kernel </verb></tscreen> </quote> <tag>Kernel works, but <tt>ps</tt> does not work any more!</tag> <p>If you've installed a different version of the kernel from the one that the system utilities have been built with, for example, an experimental ``2.2.0'' kernel on a 2.1.0-RELEASE system, many system-status commands like <tt>ps(1)</tt> and <tt>vmstat(8)</tt> will not work any more. You must recompile the <tt>libkvm</tt> library as well as these utilities. This is one reason it is not normally a good idea to use a different version of the kernel from the rest of the operating system. </descrip> diff --git a/handbook/kerneldebug.sgml b/handbook/kerneldebug.sgml index 9a425bcb28..6de50a5f04 100644 --- a/handbook/kerneldebug.sgml +++ b/handbook/kerneldebug.sgml @@ -1,424 +1,424 @@ -<!-- $Id: kerneldebug.sgml,v 1.6 1996-01-03 11:10:30 gclarkii Exp $ --> +<!-- $Id: kerneldebug.sgml,v 1.7 1996-01-31 14:26:11 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <chapt><heading>Kernel Debugging<label id="kerneldebug"></heading> <p><em>Contributed by &a.paul; and &a.joerg;</em> <sect><heading>Debugging a kernel crash dump with kgdb</heading> <p>Here are some instructions for getting kernel debugging working on a crash dump, it assumes that you have enough swap space for a crash dump. If you have multiple swap partitions and the first one is too small to hold the dump, you can configure your kernel to use an alternate dump device (in the <tt>config kernel</tt> line), or you can specify an alternate using the dumpon(8) command. Dumps to non-swap devices, tapes for example, are currently not supported. Config your kernel using <tt>config -g</tt>. See <ref id="kernelconfig" name="Kernel Configuration"> for details on configuring the FreeBSD kernel. Use the <tt>dumpon(8)</tt> command to tell the kernel where to dump to (note that this will have to be done after configuring the partition in question as swap space via <tt>swapon(8)</tt>). This is normally arranged via <tt>/etc/sysconfig</tt> and <tt>/etc/rc</tt>. Alternatively, you can hard-code the dump device via the `dump' clause in the `config' line of your kernel config file. This is deprecated, use only if you want a crash dump from a kernel that crashes during booting. <em><bf>Note:</bf> In the following, the term `<tt>kgdb</tt>' refers to <tt>gdb</tt> run in `kernel debug mode'. This can be accomplished by either starting the <tt>gdb</tt> with the option <tt>-k</tt>, or by linking and starting it under the name <tt>kgdb</tt>. This is not being done by default, however.</em> When the kernel has been built make a copy of it, say <tt>kernel.debug</tt>, and then run <tt>strip -x</tt> on the original. Install the original as normal. You may also install the unstripped kernel, but symbol table lookup time for some programs will drastically increase, and since the whole kernel is loaded entirely at boot time and cannot be swapped out later, several megabytes of physical memory will be wasted. If you are testing a new kernel, for example by typing the new kernel's name at the boot prompt, but need to boot a different one in order to get your system up and running again, boot it only into single user state using the <tt>-s</tt> flag at the boot prompt, and then perform the following steps: <tscreen><verb> fsck -p mount -a -t ufs # so your file system for /var/crash is writable savecore -N /kernel.panicked /var/crash exit # ...to multi-user </verb></tscreen> This instructs <tt>savecore(8)</tt> to use another kernel for symbol name extraction. It would otherwise default to the currently running kernel and most likely not do anything at all since the crash dump and the kernel symbols differ. Now, after a crash dump, go to <tt>/sys/compile/WHATEVER</tt> and run <tt>kgdb</tt>. From <tt>kgdb</tt> do: <tscreen><verb> symbol-file kernel.debug exec-file /var/crash/kernel.0 core-file /var/crash/vmcore.0 </verb></tscreen> and voila, you can debug the crash dump using the kernel sources just like you can for any other program. Here's a script log of a <tt>kgdb</tt> session illustrating the procedure. Long lines have been folded to improve readability, and the lines are numbered for reference. Despite of this, it's a real-world error trace taken during the development of the pcvt console driver. <tscreen><verb> 1:Script started on Fri Dec 30 23:15:22 1994 2:uriah # cd /sys/compile/URIAH 3:uriah # kgdb kernel /var/crash/vmcore.1 4:Reading symbol data from /usr/src/sys/compile/URIAH/kernel...done. 5:IdlePTD 1f3000 6:panic: because you said to! 7:current pcb at 1e3f70 8:Reading in symbols for ../../i386/i386/machdep.c...done. 9:(kgdb) where 10:#0 boot (arghowto=256) (../../i386/i386/machdep.c line 767) 11:#1 0xf0115159 in panic () 12:#2 0xf01955bd in diediedie () (../../i386/i386/machdep.c line 698) 13:#3 0xf010185e in db_fncall () 14:#4 0xf0101586 in db_command (-266509132, -266509516, -267381073) 15:#5 0xf0101711 in db_command_loop () 16:#6 0xf01040a0 in db_trap () 17:#7 0xf0192976 in kdb_trap (12, 0, -272630436, -266743723) 18:#8 0xf019d2eb in trap_fatal (...) 19:#9 0xf019ce60 in trap_pfault (...) 20:#10 0xf019cb2f in trap (...) 21:#11 0xf01932a1 in exception:calltrap () 22:#12 0xf0191503 in cnopen (...) 23:#13 0xf0132c34 in spec_open () 24:#14 0xf012d014 in vn_open () 25:#15 0xf012a183 in open () 26:#16 0xf019d4eb in syscall (...) 27:(kgdb) up 10 28:Reading in symbols for ../../i386/i386/trap.c...done. 29:#10 0xf019cb2f in trap (frame={tf_es = -260440048, tf_ds = 16, tf_\ 30:edi = 3072, tf_esi = -266445372, tf_ebp = -272630356, tf_isp = -27\ 31:2630396, tf_ebx = -266427884, tf_edx = 12, tf_ecx = -266427884, tf\ 32:_eax = 64772224, tf_trapno = 12, tf_err = -272695296, tf_eip = -26\ 33:6672343, tf_cs = -266469368, tf_eflags = 66066, tf_esp = 3072, tf_\ 34:ss = -266427884}) (../../i386/i386/trap.c line 283) 35:283 (void) trap_pfault(&frame, FALSE); 36:(kgdb) frame frame->tf_ebp frame->tf_eip 37:Reading in symbols for ../../i386/isa/pcvt/pcvt_drv.c...done. 38:#0 0xf01ae729 in pcopen (dev=3072, flag=3, mode=8192, p=(struct p\ 39:roc *) 0xf07c0c00) (../../i386/isa/pcvt/pcvt_drv.c line 403) 40:403 return ((*linesw[tp->t_line].l_open)(dev, tp)); 41:(kgdb) list 42:398 43:399 tp->t_state |= TS_CARR_ON; 44:400 tp->t_cflag |= CLOCAL; /* cannot be a modem (:-) */ 45:401 46:402 #if PCVT_NETBSD || (PCVT_FREEBSD >= 200) 47:403 return ((*linesw[tp->t_line].l_open)(dev, tp)); 48:404 #else 49:405 return ((*linesw[tp->t_line].l_open)(dev, tp, flag)); 50:406 #endif /* PCVT_NETBSD || (PCVT_FREEBSD >= 200) */ 51:407 } 52:(kgdb) print tp 53:Reading in symbols for ../../i386/i386/cons.c...done. 54:$1 = (struct tty *) 0x1bae 55:(kgdb) print tp->t_line 56:$2 = 1767990816 57:(kgdb) up 58:#1 0xf0191503 in cnopen (dev=0x00000000, flag=3, mode=8192, p=(st\ 59:ruct proc *) 0xf07c0c00) (../../i386/i386/cons.c line 126) 60: return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p)); 61:(kgdb) up 62:#2 0xf0132c34 in spec_open () 63:(kgdb) up 64:#3 0xf012d014 in vn_open () 65:(kgdb) up 66:#4 0xf012a183 in open () 67:(kgdb) up 68:#5 0xf019d4eb in syscall (frame={tf_es = 39, tf_ds = 39, tf_edi =\ 69: 2158592, tf_esi = 0, tf_ebp = -272638436, tf_isp = -272629788, tf\ 70:_ebx = 7086, tf_edx = 1, tf_ecx = 0, tf_eax = 5, tf_trapno = 582, \ 71:tf_err = 582, tf_eip = 75749, tf_cs = 31, tf_eflags = 582, tf_esp \ 72:= -272638456, tf_ss = 39}) (../../i386/i386/trap.c line 673) 73:673 error = (*callp->sy_call)(p, args, rval); 74:(kgdb) up 75:Initial frame selected; you cannot go up. 76:(kgdb) quit 77:uriah # exit 78:exit 79: 80:Script done on Fri Dec 30 23:18:04 1994 </verb></tscreen> Comments to the above script: <descrip> <tag/line 6:/ This is a dump taken from within DDB (see below), hence the panic comment ``because you said to!'', and a rather long stack trace; the initial reason for going into DDB has been a page fault trap though. <tag/line 20:/ This is the location of function <tt>trap()</tt> in the stack trace. <tag/line 36:/ Force usage of a new stack frame; this is no longer necessary now. The stack frames are supposed to point to the right locations now, even in case of a trap. (I don't have a new core dump handy <g>, my kernel didn't panic for rather long.) From looking at the code in source line 403, there's a high probability that either the pointer access for ``tp'' was messed up, or the array access was out of bounds. <tag/line 52:/ The pointer looks suspicious, but happens to be a valid address. <tag/line 56:/ However, it obviously points to garbage, so we have found our error! (For those unfamiliar with that particular piece of code: <tt>tp->t_line</tt> refers to the line discipline of the console device here, which must be a rather small integer number.) </descrip> <sect><heading>Post-mortem analysis of a dump</heading> <p>What do you do if a kernel dumped core but you did not expect it, and it's therefore not compiled using <tt>config -g</tt>? Not everything is lost here. Don't panic! Of course, you still need to enable crash dumps. See above on the options you've got in order to do this. Go to your kernel compile directory, and edit the line containing <tt>COPTFLAGS?=-O</tt>. Add the <tt>-g</tt> option there (but <em>don't</em> change anything on the level of optimization). If you do already know roughly the probable location of the failing piece of code (e.g., the <tt>pcvt</tt> driver in the example above), remove all the object files for this code. Rebuild the kernel. Due to the time stamp change on the Makefile, there will be some other object files rebuild, for example <tt>trap.o</tt>. With a bit of luck, the added <tt>-g</tt> option won't change anything for the generated code, so you'll finally get a new kernel with similar code to the faulting one but some debugging symbols. You should at least verify the old and new sizes with the <tt>size(1)</tt> command. If there is a mismatch, you probably need to give up here. Go and examine the dump as described above. The debugging symbols might be incomplete for some places, as can be seen in the stack trace in the example above where some functions are displayed without line numbers and argument lists. If you need more debugging symbols, remove the appropriate object files and repeat the <tt>kgdb</tt> session until you know enough. All this is not guaranteed to work, but it will do it fine in most cases. <sect><heading>On-line kernel debugging using DDB</heading> <p>While <tt>kgdb</tt> as an offline debugger provides a very high level of user interface, there are some things it cannot do. The most important ones being breakpointing and single-stepping kernel code. If you need to do low-level debugging on your kernel, there's an on- line debugger available called DDB. It allows to setting breakpoints, single-steping kernel functions, examining and changing kernel variables, etc. However, it cannot not access kernel source files, and only has access to the global and static symbols, not to the full debug information like <tt>kgdb</tt>. To configure your kernel to include DDB, add the option line <tscreen><verb> options DDB </verb></tscreen> to your config file, and rebuild. (See <ref id="kernelconfig" name="Kernel Configuration"> for details on configuring the FreeBSD kernel. Note that if you have an older version of the boot blocks, your debugger symbols might not be loaded at all. Update the boot blocks, the recent ones do load the DDB symbols automagically.) Once your DDB kernel is running, there are several ways to enter DDB. The first, and earliest way is to type the boot flag <tt>-d</tt> right at the boot prompt. The kernel will start up in debug mode and enter DDB prior to any device probing. Hence you are able to even debug the device probe/attach functions. The second scenario is a hot-key on the keyboard, usually Ctrl-Alt-ESC. For syscons, this can be remapped, and some of the distributed maps do this, so watch out. There's an option available for serial consoles that allows the use of a serial line BREAK on the console line to enter DDB (``<tt>options BREAK_TO_DEBUGGER</tt>'' in the kernel config file). It is not the default since there are a lot of crappy serial adapters around that gratuitously generate a BREAK condition for example when pulling the cable. The third way is that any panic condition will branch to DDB if the kernel is configured to use it. For this reason, it is not wise to configure a kernel with DDB for a machine running unattended. The DDB commands roughly resemble some <tt>gdb</tt> commands. The first you probably need is to set a breakpoint: <tscreen><verb> b function-name b address </verb></tscreen> Numbers are taken hexadecimal by default, but to make them distinct from symbol names, hexadecimal numbers starting with the letters <tt>a</tt>-<tt>f</tt> need to be preceded with <tt>0x</tt> (for other numbers, this is optional). Simple expressions are allowed, for example: <tt>function-name + 0x103</tt>. To continue the operation of an interrupted kernel, simply type <tscreen><verb> c </verb></tscreen> To get a stack trace, use <tscreen><verb> trace </verb></tscreen> Note that when entering DDB via a hot-key, the kernel is currently servicing an interrupt, so the stack trace might be not of much use for you. If you want to remove a breakpoint, use <tscreen><verb> del del address-expression </verb></tscreen> The first form will be accepted immediately after a breakpoint hit, and deletes the current breakpoint. The second form can remove any breakpoint, but you need to specify the exact address, as it can be obtained from <tscreen><verb> show b </verb></tscreen> To single-step the kernel, try <tscreen><verb> s </verb></tscreen> This will step into functions, but you can make DDB trace them until the matching return statement is reached by <tscreen><verb> n </verb></tscreen> <bf>Note:</bf> this is different from <tt>gdb</tt>'s `next' statement, it's like <tt>gdb</tt>'s `finish'. To examine data from memory, use (for example): <tscreen><verb> x/wx 0xf0133fe0,40 x/hd db_symtab_space x/bc termbuf,10 x/s stringbuf </verb></tscreen> for word/halfword/byte access, and hexadecimal/decimal/character/ string display. The number after the comma is the object count. To display the next 0x10 items, simply use <tscreen><verb> x ,10 </verb></tscreen> - Similiarly, use + Similarly, use <tscreen><verb> x/ia foofunc,10 </verb></tscreen> to disassemble the first 0x10 instructions of <tt>foofunc</tt>, and display them along with their offset from the beginning of <tt>foofunc</tt>. To modify the memory, use the write command: <tscreen><verb> w/b termbuf 0xa 0xb 0 w/w 0xf0010030 0 0 </verb></tscreen> The command modifier (<tt>b</tt>/<tt>h</tt>/<tt>w</tt>) specifies the size of the data to be written, the first following expression is the address to write to, the remainder is interpreted as data to write to successive memory locations. If you need to know the current registers, use <tscreen><verb> show reg </verb></tscreen> Alternatively, you can display a single register value by e.g. <tscreen><verb> p $eax </verb></tscreen> and modify it by <tscreen><verb> set $eax new-value </verb></tscreen> Should you need to call some kernel functions from DDB, simply say <tscreen><verb> call func(arg1, arg2, ...) </verb></tscreen> The return value will be printed. For a <tt>ps(1)</tt> style summary of all running processes, use <tscreen><verb> ps </verb></tscreen> Now you have now examined why your kernel failed, and you wish to reboot. Remember that, depending on the severity of previous malfunctioning, not all parts of the kernel might still be working as expected. Perform one of the following actions to shut down and reboot your system: <tscreen><verb> call diediedie() </verb></tscreen> will cause your kernel to dump core and reboot, so you can later analyze the core on a higher level with kgdb. This command usually must be followed by another `<tt>continue</tt>' statement. There is now an alias for this: `<tt>panic</tt>'. <tscreen><verb> call boot(0) </verb></tscreen> might be a good way to cleanly shut down the running system, <tt>sync()</tt> all disks, and finally reboot. As long as the disk and file system interfaces of the kernel are not damaged, this might be a good way for an almost clean shutdown. <tscreen><verb> call cpu_reset() </verb></tscreen> is the final way out of disaster and almost the same as hitting the Big Red Button. - If you nead a short command summary, simply type + If you need a short command summary, simply type <tscreen><verb> help </verb></tscreen> However, it's highly recommended to have a printed copy of the <tt>ddb(4)</tt> manual page ready for a debugging session. Remember that it's hard to read the on-line manual while single-stepping the kernel. <sect><heading>Debugging a console driver</heading> <p>Since you need a console driver to run DDB on, things are more complicated if the console driver itself is failing. You might remember the use of a serial console (either with modified boot blocks, or by specifying <tt><bf>-h</bf></tt> at the <tt>Boot:</tt> prompt), and hook up a standard terminal onto your first serial port. DDB works on any configured console driver, of course also on a serial console. diff --git a/handbook/nutshell.sgml b/handbook/nutshell.sgml index 1cc4d41ffa..f80d31774d 100644 --- a/handbook/nutshell.sgml +++ b/handbook/nutshell.sgml @@ -1,151 +1,151 @@ -<!-- $Id: nutshell.sgml,v 1.7 1995-12-19 09:22:23 gclarkii Exp $ --> +<!-- $Id: nutshell.sgml,v 1.8 1996-01-31 14:26:12 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>FreeBSD in a nutshell<label id="nutshell"></heading> <p>FreeBSD is a state of the art operating system for personal computers based on the Intel CPU architecture, which includes the 386, 486 and Pentium processors (both SX and DX versions). Intel compatible CPUs from AMD and Cyrix are supported as well. FreeBSD provides you with many advanced features previously available only on much more expensive computers. These features include: <itemize> <item><bf>Preemptive multitasking</bf> with dynamic priority adjustment to ensure smooth and fair sharing of the computer between applications and users.</item> <item><bf>Multiuser</bf> access means that many people can use a FreeBSD system simultaneously for a variety of things. System peripherals such as printers and tape drives are also properly SHARED BETWEEN ALL users on the system.</item> <item>Complete <bf>TCP/IP networking</bf> including SLIP, PPP, NFS and NIS support. This means that your FreeBSD machine can - interoperate easily with other systems as well act as an enterprise + inter-operate easily with other systems as well act as an enterprise server, providing vital functions such as NFS (remote file access) and e-mail services or putting your organization on the Internet with WWW, ftp, routing and firewall (security) services.</item> <item><bf>Memory protection</bf> ensures that applications (or users) cannot interfere with each other. One application crashing will not affect others in any way.</item> <item>FreeBSD is a <bf>32-bit</bf> operating system and was designed as such from the ground up.</item> <item>The industry standard <bf>X Window System</bf> (X11R6) provides a graphical user interface (GUI) for the cost of a common VGA card and monitor and comes with full sources.</item> <item><bf>Binary compatibility</bf> with many programs built for SCO, BSDI, NetBSD, Linux and 386BSD.</item> <item>Hundreds of <bf>ready-to-run</bf> applications are available from the FreeBSD <bf>ports</bf> and <bf>packages</bf> collection. Why search the net when you can find it all right here?</item> <item>Thousands of additional and <bf>easy-to-port</bf> applications available on the Internet. FreeBSD is source code compatible with most popular commercial Unix systems and thus most applications require few, if any, changes to compile.</item> <item>Demand paged <bf>virtual memory</bf> and `merged VM/buffer cache' design efficiently satisfies applications with large appetites for memory while still maintaining interactive response to other users.</item> <item><bf>Shared libraries</bf> (the Unix equivalent of MS-Windows DLLs) provide for efficient use of disk space and memory.</item> <item>A full compliment of <bf>C</bf>, <bf>C++</bf> and <bf>Fortran</bf> development tools. Many additional languages for advanced research and development are also available in the ports and packages collection.</item> <item><bf>Source code</bf> for the entire system means you have the greatest degree of control over your environment. Why be locked into a proprietary solution and at the mercy of your vendor when you can have a truly Open System?</item> <item>Extensive <bf>on-line documentation</bf>.</item> <item><bf>And many more!</bf></item> </itemize> FreeBSD is based on the BSD 4.4-lite release from Computer Systems Research Group (CSRG) at the University of California at Berkeley, and carries on the distinguished tradition of BSD systems development. In addition to the fine work provided by CSRG, the FreeBSD Project has put in many thousands of hours in fine tuning the system for maximum performance and reliability in real-life load situations. As many of the commercial giants struggle to field PC operating systems with such features, performance and reliability, FreeBSD can offer them <bf>now</bf>! The applications to which FreeBSD can be put are truly limited only by your own imagination. From software development to factory automation, inventory control to azimuth correction of remote satellite antennae; if it can be done with a commercial UNIX product then it's more than likely that you can do it with FreeBSD, too! FreeBSD also benefits significantly from the literally thousands of high quality applications developed by research centers and universities around the world, often available at little to no cost. Commercial applications are also available and appearing in greater numbers every day. Because the source code for FreeBSD itself is generally available, the system can also be customized to an almost unheard of degree for special applications or projects, and in ways not generally possible with operating systems from most major commercial vendors. Here is just a sampling of some of the applications in which people are currently using FreeBSD: <itemize> <item><bf>Internet Services:</bf> The robust TCP/IP networking built into FreeBSD makes it an ideal platform for a variety of Internet services such as: <itemize> <item>FTP servers</item> <item>World Wide Web servers</item> <item>Gopher servers</item> <item>Electronic Mail servers</item> <item>USENET News</item> <item>Bulletin Board Systems</item> <item>And more...</item> </itemize> You can easily start out small with an inexpensive 386 class PC and upgrade as your enterprise grows.</item> <item><bf>Education:</bf> Are you a student of computer science or a related engineering field? There is no better way of learning about operating systems, computer architecture and networking than the hands on, under the hood experience that FreeBSD can provide. A number of freely available CAD, mathematical and graphic design packages also make it highly useful to those who's primary interest in a computer is to get <em>other</em> work done!</item> <item><bf>Research:</bf> With source code for the entire system available, FreeBSD is an excellent platform for research in operating systems as well as other branches of computer science. FreeBSD's freely available nature also makes it possible for remote groups to collaborate on ideas or shared development without having to worry about special licensing agreements or limitations on what may be discussed in open forums.</item> <item><bf>Networking:</bf> Need a new router? A name server (DNS)? A firewall to keep people out of your internal network? FreeBSD can easily turn that unused 386 or 486 PC sitting in the corner into an advanced router with sophisticated packet filtering capabilities. </item> <item><bf>X Window workstation:</bf> FreeBSD is a fine choice for an inexpensive X terminal solution, either using the freely available XFree86 server or one of the excellent commercial servers provided by X Inside. Unlike an X terminal, FreeBSD allows many applications to be run locally, if desired, thus relieving the burden on a central server. FreeBSD can even boot "diskless", making individual workstations even cheaper and easier to administer.</item> <item><bf>Software Development:</bf> The basic FreeBSD system comes with a full compliment of development tools including the renowned GNU C/C++ compiler and debugger. </item> </itemize> FreeBSD is available in both source and binary form on CDROM and via anonymous ftp. See <ref id="mirrors" name="Obtaining FreeBSD"> for more details. diff --git a/handbook/porting.sgml b/handbook/porting.sgml index 734e9506cb..00b106ebc8 100644 --- a/handbook/porting.sgml +++ b/handbook/porting.sgml @@ -1,1041 +1,1041 @@ -<!-- $Id: porting.sgml,v 1.12 1996-01-28 16:36:24 jfieber Exp $ --> +<!-- $Id: porting.sgml,v 1.13 1996-01-31 14:26:13 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect1><heading>Porting an existing piece of free software<label id="porting"></heading> <p><em>Contributed by &a.jkh;, &a.gpalmer; and &a.asami;.<newline>19 August 1995.</em> <p>The porting of freely available software, while perhaps not as gratifying as developing your own from scratch, is still a vital part of FreeBSD's growth and of great usefulness to those who wouldn't otherwise know where to turn for it. All ported software is organized into a carefully organized hierarchy know as ``the ports collection''. The collection enables a new user to get a quick and complete overview of what's available for FreeBSD in an easy-to-compile form. It also saves considerable space by not actually containing the the majority of the sources being ported, but merely those differences required for running under FreeBSD. <p>What follows are some guidelines for creating a new port for FreeBSD 2.x . The <tt>${..}</tt> variable names you will -see in this document all refer to various user-overridable defaults +see in this document all refer to various user-overrideable defaults used (and documented) by <tt>/usr/share/mk/bsd.port.mk</tt>. Please refer to that file for more details on the inner workings of the ports collection. <sect2> <heading>Before Starting the Port<label id="porting:starting"></heading> - <p>Note: Only a fraction of the overridable variables are + <p>Note: Only a fraction of the overrideable variables are mentioned in this document. Most (if not all) are documented at the start of the <tt>bsd.port.mk</tt> file which can be found in <tt>/usr/share/mk</tt>. This file uses a non-standard tab setting. <tt>Emacs</tt> should recognize the setting on loading the file. <tt>vi</tt> or <tt>ex</tt> can be set to using the correct value by typing `<tt>:set tabstop=4</tt>' once the file has been loaded. <p>You may come across code that needs modifications or conditional compilation based upon what version of UNIX it's running under. If you need to make such changes to the code for conditional compilation, make sure you make the changes as general as possible so that we can back-port code to FreeBSD 1.x systems and cross-port to other BSD systems such as 4.4BSD from CSRG, BSD/386, 386BSD and NetBSD. <p>The preferred way to tell 4.3BSD/Reno and newer versions of the BSD code apart is by using the `<tt>BSD</tt>' macro defined in <tt><sys/param.h></tt>. Hopefully that file is already included; if not, add the code: <tscreen><verb> #ifdef _HAVE_PARAM_H #include <sys/param.h> #endif </verb></tscreen> to the proper place in the <tt>.c</tt> file and add <tt>-D_HAVE_PARAM_H</tt> to the <tt>CFLAGS</tt> in the Makefile. Then, you may use: <tscreen><verb> #if (defined(BSD) && (BSD >= 199103)) </verb></tscreen> to detect if the code is being compiled on a 4.3 Net2 code base or newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD, BSD/386 1.1 and below). Use: <tscreen><verb> #if (defined(BSD) && (BSD >= 199306)) </verb></tscreen> to detect if the code is being compiled on a 4.4 code base or newer (e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or above). <p>Use sparingly: <itemize> <item><tt>__FreeBSD__</tt> is defined in all versions of FreeBSD. Use it if the change you are making ONLY affects FreeBSD. Porting gotchas like the use of <tt>sys_errlist[]</tt> vs <tt>strerror()</tt> are Berkeleyisms, not FreeBSD changes. <item>In FreeBSD 2.x, <tt>__FreeBSD__</tt> is defined to be <tt>2</tt>. In earlier versions, it's <tt>1</tt>. <item>If you need to tell the difference between a FreeBSD 1.x system and a FreeBSD 2.x system, usually the right answer is to use the <tt>BSD</tt> macros described above. If there actually is a FreeBSD specific change (such as special shared library options when using `<tt>ld</tt>') then it's OK to use <tt>__FreeBSD__</tt> and `<tt>#if __FreeBSD__ > 1</tt>' to detect a FreeBSD 2.x system. - If you need more granduarity in detecting FreeBSD systems since + If you need more granularity in detecting FreeBSD systems since 2.0-RELEASE you can use the following: <tscreen><verb> #if __FreeBSD__ >= 2 #include <osreldate.h> # if __FreeBSD_version >= 199504 /* 2.0.5+ release specific code here */ # endif #endif </verb></tscreen> <tt>__FreeBSD_version</tt> values: <tscreen><verb> 2.0-RELEASE: 199411 2.1-current's: 199501, 199503 2.0.5-RELEASE: 199504 2.1.0-RELEASE: 199511 2.2-current before 2.1: 199508 2.2-current as 10 Jan 1996: 199512 (will certainly be bumped) </verb></tscreen> The pattern is the year followed by the month. </itemize> <p>In the dozens of ports that have been done, there have only been one or two cases where <tt>__FreeBSD__</tt> should have been used. Just because an earlier port screwed up and used it in the wrong place doesn't mean you should do so too. <sect2> <heading>Quick Porting</heading> <p>This section tells you how to do a quick port. In many cases, it is not enough, but we'll see. <p>First, get the original tarball and put it into <tt>${DISTDIR}</tt>, which defaults to <tt>/usr/ports/distfiles</tt>. <p>Note: The following assumes that the software compiled out-of-the-box, i.e., there was absolutely no change required for the port to work on your FreeBSD box. If you needed to change something, you'll have to refer to the next section too. <sect3> <heading>Writing the Makefile</heading> <p>The minimal <tt>Makefile</tt> would look something like this: <tscreen><verb> # New ports collection makefile for: oneko # Version required: 1.1b # Date created: 5 December 1994 # Whom: asami # - # $Id: porting.sgml,v 1.12 1996-01-28 16:36:24 jfieber Exp $ + # $Id: porting.sgml,v 1.13 1996-01-31 14:26:13 mpp Exp $ # DISTNAME= oneko-1.1b CATEGORIES+= games MASTER_SITES= ftp://ftp.cs.columbia.edu/archives/X11R5/contrib/ MAINTAINER= asami@FreeBSD.ORG USE_IMAKE= yes .include <bsd.port.mk> </verb></tscreen> <p>See if you can figure it out. Don't worry about the contents of the <tt>$Id$</tt> line, it will be filled in automatically by CVS when the port is imported to our main ports tree. <sect3> <heading>Writing the description files</heading> <p>There are three required description files that are required for any port, whether they actually package or not. They are <tt>COMMENT</tt>, <tt>DESCR</tt>, and <tt>PLIST</tt>, and reside in the <tt>pkg</tt> subdirectory. <sect4> <heading>COMMENT</heading> <p>This is the one-line description of the port. It is recommended to not have the name of the package at the beginning, as in: <tscreen><verb> A cat chasing a mouse all over the screen </verb></tscreen> <sect4> <heading>DESCR</heading> <p>This is a longer description of the port. One to a few paragraphs concisely explaining what the port does is sufficient. Note: This is <em>not</em> a manual nor an in-depth description on how to use or compile the port. In particular, please do not just copy the <tt>README</tt> file here, unless, of course, it's a concise description of the port. <p>It is recommended that you sign the name at the end of this file, as in: <tscreen><verb> This is a port of oneko, in which a cat chases a poor mouse all over the screen. : (etc.) - Satoshi asami@cs.berkeley.edu </verb></tscreen> <sect4> <heading>PLIST</heading> <p>This file lists all the files installed by the port. It is also called the `packing list' because the package is generated by packing the files listed here. The pathnames are relative to the installation prefix (usually <tt>/usr/local</tt> or <tt>/usr/X11R6</tt>). <p>Here is a small example: <tscreen><verb> bin/oneko man/man1/oneko.1.gz lib/X11/app-defaults/Oneko lib/X11/oneko/cat1.xpm lib/X11/oneko/cat2.xpm lib/X11/oneko/mouse.xpm </verb></tscreen> <sect3> <heading>Creating the checksum file</heading> <p>Just type `<tt>make makesum</tt>'. The ports make rules will automatically generate the file <tt>files/md5</tt>. <sect3> <heading>Testing the port</heading> <p>You should make sure that the port rules do exactly what you want it to do, including packaging up the port. Try doing `<tt>make install</tt>', `<tt>make package</tt>' and then `<tt>pkg_delete -d <pkgname></tt>' and see if all the files are correctly deleted. Then do a `<tt>pkg_add <pkgname>.tgz</tt>' and see if everything re-appears and works correctly. <sect3> <heading>Submitting the port</heading> <p>Now that you're happy with your port, the only thing remaining is to put it in the main FreeBSD ports tree and make everybody else happy about it too. To accomplish this, pack the necessary files (everything described in this section -- in particular do <em>not</em> include the original source tarball or the `<tt>work</tt>' subdirectory) into a <tt>.tar.gz</tt> file, stick it in the directory <tscreen><verb> ftp://ftp.freebsd.org/pub/FreeBSD/incoming/ </verb></tscreen> and send mail to <tt>ports@freebsd.org</tt>. We will take a look, get back to you if necessary, and put it in the tree. Your name will also appear in the list of `Additional FreeBSD contributors' on the FreeBSD Handbook and other files. Isn't that great?!? <tt>:)</tt> <sect2> <heading>Slow Porting</heading> <p>Ok, so it wasn't that simple, and the port required some modifications to get it to work. In this section, we'll explain, step by step, how to modify it to get it to work with the ports paradigm. <sect3> <heading>How things work</heading> <p>First, this is the sequence of events which occurs when the user first types `<tt>make</tt>' in your port's directory, and you may find that having <tt>bsd.port.mk</tt> in another window while you read this really helps to understand it. <p>But don't worry if you don't really understand what <tt>bsd.port.mk</tt> is doing, not many people do... <tt>:></tt> <enum> <item>The fetch target is run. The fetch target is responsible for making sure that the tarball exists locally in <tt>${DISTDIR}</tt>. If fetch cannot find the required files in <tt>${DISTDIR}</tt> it will look up the ftp-URL <tt>${MASTER_SITES}</tt>, which is set in the Makefile. It will then attempt to fetch the named distribution file with <tt>${NCFTP}</tt>, assuming that the requesting site has direct access to the Internet. If that succeeds, it will save the file in <tt>${DISTDIR}</tt> for future use and proceed. <item>The extract target is run. It looks for your ports' distribution file in <tt>${DISTDIR}</tt> (typically a gzip'd tarball) and unpacks it into a temporary subdirectory specified by <tt>${WRKDIR}</tt> (defaults to <tt>work</tt>). <item>The patch target is run. First, any patches defined in <tt>${PATCHFILES}</tt> are applied. Second, if any patches are found in <tt>${PATCHDIR}</tt> (defaults to the <tt>patches</tt> subdirectory), they are applied at this time in alphabetical order. <item>The configure target is run. This can do any one of many different things. <enum> <item>If it exists, <tt>scripts/configure</tt> is run. <item>If <tt>${HAS_CONFIGURE}</tt> or <tt>${GNU_CONFIGURE}</tt> is set, <tt>${WRKSRC}/configure</tt> is run. <item>If <tt>${USE_IMAKE}</tt> is set, <tt>${XMKMF}</tt> (default: `<tt>xmkmf -a</tt>') is run. </enum> <item>The build target is run. This is responsible for descending into the ports' private working directory (<tt>${WRKSRC}</tt>) and building it. If <tt>${USE_GMAKE}</tt> is set, GNU <tt>make</tt> will be used, otherwise the system <tt>make</tt> will be used. </enum> <p>The above are the default actions. In addition, you can define targets `<tt>pre-<something></tt>' or `<tt>post-<something></tt>', or put scripts with those names, in the <tt>scripts</tt> subdirectory, and they will be run before or after the default actions are done. <p>For example, if you have a <tt>post-extract</tt> target defined in your Makefile, and a file <tt>pre-build</tt> in the <tt>scripts</tt> subdirectory, the <tt>post-extract</tt> target will be called after the regular extraction actions, and the <tt>pre-build</tt> script will be executed before the default build rules are done. It is recommended that you use Makefile targets if possible, because it will be easier for someone to figure out what kind of non-default action the port requires. <p>The default actions are done by the <tt>bsd.port.mk</tt> targets `<tt>do-<something></tt>'. For example, the commands to extract a port are in the target `<tt>do-extract</tt>'. If you are not happy with the default target, and you can't fix it by redefining the `<tt>do-<something></tt>' target in your Makefile. <p>Note that the `main' targets (e.g., <tt>extract</tt>, <tt>configure</tt>, etc.) do nothing more than make sure all the stages up to that one is completed and call the real targets or scripts, and they are not intended to be changed. If you want to fix the extraction, fix <tt>do-extract</tt>, but never ever touch <tt>extract</tt>! <p>Now that you understand what goes on when the user types `<tt>make</tt>', let's go through the recommended steps to create the perfect port. <sect3> <heading>Getting the original sources</heading> <p>Get the original sources (normally) as a compressed tarball (<tt><foo>.tar.gz</tt> or <tt><foo>.tar.Z</tt>) and copy it into <tt>${DISTDIR}</tt>. Always use <em>mainstream</em> sources when and where you can. <p>If you can't find a ftp site that is well-connected to the net, or can only find sites that have irritatingly non-standard formats, we can `house' it ourselves by putting it on <tscreen><verb> ftp://freefall.freebsd.org/pub/FreeBSD/LOCAL_PORTS/ </verb></tscreen> as the last resort. Send mail to <tt>ports@freebsd.org</tt> if you are not sure what to do. <p>If your port requires some additional `patches' that are available on the Internet, fetch them too and put them in <tt>${DISTDIR}</tt>. Don't worry if they come from site other than where you got the the main source tarball, we have a way to handle these situations (see the description of <tt>${PATCHFILES}</tt> below). <sect3> <heading>Modifying the port</heading> <p>Unpack a copy of the tarball in a private directory and make whatever changes are necessary to get the port to compile properly under the current version of FreeBSD. Keep <em>careful track</em> of everything you do, as you will be automating the process shortly. Everything, including the deletion, addition or modification of files should be doable using an automated script or patch file when your port is finished. <p>If your port requires significant user interaction/customization to compile or install, you should take a look at one of Larry Wall's classic Configure scripts and perhaps do something similar yourself. The goal of the new ports collection is to make each port as `plug-and-play' as possible for the end-user while using a minimum of disk space. <sect3> <heading>Patching</heading> <p>In the preparation of the port, files that have been added or changed can be picked up with a recursive diff for later feeding to patch. This is the easiest kind of change to make as it doesn't involve any mucking around with configuration files. Each set of patches you wish to apply should be collected into a file named `<tt>patch-<xx></tt>' where <tt><xx></tt> denotes the sequence in which the patches will be applied -- these are done in <em>alphabetical order</em>, thus `<tt>aa</tt>' first, `<tt>ab</tt>' second and so on. These files should be stored in <tt>${PATCHDIR}</tt>, from where they will be automatically applied. All patches should be relative to <tt>${WRKSRC}</tt> (generally the directory your port's tarball unpacks itself into, that being where the make is done). To make fixes and upgrades easier you should avoid having more than one patch fix the same file (e.g., patch-aa and patch-ab both changing <tt>${WRKSRC}</tt>/foobar.c). <sect3> <heading>Configuring</heading> <p>Include any additional customization commands to your <tt>configure</tt> script and save it in the `<tt>scripts</tt>' subdirectory. As mentioned above, you can also do this as Makefile targets and/or scripts with the name <tt>pre-configure</tt> or <tt>post-configure</tt>. <sect3> <heading>Handling user input</heading> <p>If your port requires user input to build, configure or install, then set <tt>IS_INTERACTIVE</tt> in your Makefile. This will allow `overnight builds' to skip your port if the user sets the variable <tt>BATCH</tt> in his environment (and if the user sets the variable <tt>INTERACTIVE</tt>, then <em>only</em> those ports requiring interaction are built). <sect2> <heading>Configuring the Makefile</heading> <p>Configuring the Makefile is pretty simple, and again we suggest that you look at existing examples before starting. Consider the following problems in sequence as you design your new Makefile: <sect3> <heading>The original source</heading> <p>Does it live in <tt>${DISTDIR}</tt> as a standard gzip'd tarball? If so, you can go on to the next step. If not, you should look at overriding any of the <tt>${EXTRACT_CMD}</tt>, <tt>${EXTRACT_BEFORE_ARGS}</tt>, <tt>${EXTRACT_AFTER_ARGS}</tt>, <tt>${EXTRACT_SUFX}</tt>, or <tt>${DISTFILE}</tt> variables, depending on how alien a format your port's distribution file is. (The most common case is `<tt>EXTRACT_SUFX=.tar.Z</tt>', when the tarball is condensed by regular compress, not gzip.) <p>In the worst case, you can simply create your own `<tt>do-extract</tt>' target to override the default, though this should be rarely, if ever, necessary. <sect3> <heading>DISTNAME</heading> <p>You should set <tt>${DISTNAME}</tt> to be the base name of your port. The default rules expect the distribution file list (<tt>${DISTFILES}</tt>) to be named <tt>${DISTFILE}${EXTRACT_SUFX}</tt> by default which, if it's a normal tarball, is going to be something like: <tscreen><verb> foozolix-1.0.tar.gz </verb></tscreen> for a setting of `<tt>DISTNAME=foozolix-1.0</tt>'. The default rules also expect the tarball(s) to extract into a subdirectory called <tt>work/${DISTNAME}</tt>, e.g. <tscreen><verb> work/foozolix-1.0/ </verb></tscreen> All this behavior can be overridden, of course, it simply represents the most common time-saving defaults. For a port requiring multiple distribution files, simply set <tt>${DISTFILES}</tt> explicitly. If only a subset of <tt>${DISTFILES}</tt> are actual extractable archives, then set them up in <tt>${EXTRACT_ONLY}</tt>, which will override the <tt>${DISTFILES}</tt> list when it comes to extraction, and the rest will be just left in <tt>${DISTDIR}</tt> for later use. <sect3> <heading>CATEGORIES and KEYWORDS</heading> <p>When a package is created, it is put under <tt>/usr/ports/packages/All</tt> and links are made from one or more subdirectories of <tt>/usr/ports/packages</tt>. The names of these subdirectories are specified by the variable <tt>${CATEGORIES}</tt>. It is intended to make life easier for the user when he is wading through the pile of packages on the ftp site or the CD-ROM. Please take a look at the existing categories (some of them have different names from subdirectories of <tt>/usr/ports</tt>) and pick the ones that are suitable for your port. If your port truly belongs to something that is different from all the existing ones, you can even create a new category name. <p>If you want to add more information than just the category names, add them to <tt>${KEYWORDS}</tt>. The value of this variable defaults to that of <tt>${CATEGORIES}</tt>. This is currently used only as a field of the <tt>/usr/ports/INDEX</tt> file. <sect3> <heading>MASTER_SITES</heading> <p>If you have a ftp-URL pointing at the the original tarball, record the directory containing the tarball in <tt>${MASTER_SITES}</tt>. This will provide a backup site, as well as a direct pointer to the original source location. Don't forget the trailing slash (<tt>/</tt>)! <p>The make macros will try to use this specification for grabbing the distribution file with <tt>${NCFTP}</tt> if they can't find it already on the system. <p>It is recommended that you put multiple sites on this list, preferably from different continents. This will safeguard against wide-area network problems, and we are even planning to add support for automatically determining the closest master site and fetching from there! <sect3> <heading>PATCHFILES</heading> <p>If your port requires some additional patches that are available by ftp, set <tt>${PATCHFILES}</tt> to the names of the files and <tt>${PATCH_SITES}</tt> to the URL of the directory that contains them (the format is the same as <tt>${MASTER_SITES}</tt>). <p>If the patch is not relative to the top of the source tree (i.e., <tt>${WKRSRC}</tt>) because it contains some extra pathnames, set <tt>${PATCH_DIST_STRIP}</tt> accordingly. For instance, if all the pathnames in the patch has an extra `<tt>foozolix-1.0/</tt>' in front of the filenames, then set `<tt>PATCH_DIST_STRIP=-p1</tt>'. <p>Don't worry if the patches are compressed, they will be decompressed automatically if the filenames end with `<tt>.gz</tt>' or `<tt>.Z</tt>'. <sect3> <heading>MAINTAINER</heading> <p>Set your mail-address here. Please. <tt>:)</tt> <sect3> <heading>Dependencies</heading> <p>Many ports depend on other ports. There are five variables that you can use to ensure that all the required bits will be on the user's machine. <sect4> <heading>LIB_DEPENDS</heading> <p>This variable specifies the shared libraries this port depends on. It is a list of `<tt>lib:dir</tt>' pairs where <tt>lib</tt> is the name of the shared library, and <tt>dir</tt> is the directory in which to find it in case it's not available. For example, <tscreen><verb> LIB_DEPENDS= tcl\\.7\\.:${PORTSDIR}/lang/tcl </verb></tscreen> will check for a shared tcl library with major version 7, and descend into the <tt>lang/tcl</tt> subdirectory of your ports tree to build and install it if it's not found. Note that the <tt>lib</tt> part is just an argument given to `<tt>ldconfig -r | grep</tt>', so periods should be escaped by two backslashes like in the example above. <sect4> <heading>RUN_DEPENDS</heading> <p>This variable specifies executables this port depends on during run-time. It is a list of `<tt>exec:dir</tt>' pairs where <tt>exec</tt> is the name of the executable, and <tt>dir</tt> is the directory in which to find it in case it's not available. For example, <tscreen><verb> RUN_DEPENDS= wish:${PORTSDIR}/x11/tk </verb></tscreen> will check for an executable called `<tt>wish</tt>', and descend into the <tt>x11/tk</tt> subdirectory of your ports tree to build and install it if it's not found. The dependency is checked from within the <tt>install</tt> target. Also, the name of the dependency is put in to the package so that <tt>pkg_add</tt> will automatically install it if it is not on the user's system. <sect4> <heading>BUILD_DEPENDS</heading> <p>This variable specifies executables this port requires to build. Like <tt>RUN_DEPENDS</tt>, it is a list of `<tt>exec:dir</tt>' pairs. For example, <tscreen><verb> BUILD_DEPENDS= unzip:${PORTSDIR}/archivers/unzip </verb></tscreen> will check for an executable called `<tt>unzip</tt>', and descend into the <tt>archivers/unzip</tt> subdirectory of your ports tree to build and install it if it's not found. Note that `build' here means everything from extracting to compilation. The dependency is checked from within the <tt>extract</tt> target. <sect4> <heading>FETCH_DEPENDS</heading> <p>This variable specifies executables this port requires to fetch. Like the previous two, it is a list of `<tt>exec:dir</tt>' pairs. For example, <tscreen><verb> FETCH_DEPENDS= ncftp2:${PORTSDIR}/net/ncftp2 </verb></tscreen> will check for an executable called `<tt>ncftp2</tt>', and descend into the <tt>net/ncftp2</tt> subdirectory of your ports tree to build and install it if it's not found. The dependency is checked from within the <tt>fetch</tt> target. <sect4> <heading>DEPENDS</heading> <p>If there is a dependency that doesn't fall into either of the above four categories, or your port requires to have the source of the other port extracted (i.e., having them installed is not enough), then use this variable. This is just a list of directories, as there is nothing to check, unlike the previous two. <sect3> <heading>Building mechanisms</heading> <p>If your package uses GNU <tt>make</tt>, set `<tt>USE_GMAKE=yes</tt>'. If your package uses GNU <tt>configure</tt>, set `<tt>GNU_CONFIGURE=yes</tt>'. If you want to override the default GNU <tt>configure</tt> arguments from `<tt>--prefix=${PREFIX}</tt>' to something else, set those arguments in <tt>${CONFIGURE_ARGS}</tt>. <p>If your package uses <tt>imake</tt> (e.g. is an X application that has an <tt>Imakefile</tt>), then set `<tt>USE_IMAKE=yes</tt>'. This will cause the configure stage to automatically do an <tt>xmkmf -a</tt>. If the `<tt>-a</tt>' flag is a problem for your port, set `<tt>XMKMF=xmkmf</tt>'. <p>If your port's source Makefile has something else than `<tt>all</tt>' as the main build target, set <tt>${ALL_TARGET}</tt> accordingly. Same goes for `<tt>install</tt>' and <tt>${INSTALL_TARGET}</tt>. <sect3> <heading>NO_INSTALL_MANPAGES</heading> <p>If the port uses imake but doesn't understand the `<tt>install.man</tt>' target, `<tt>NO_INSTALL_MANPAGES=yes</tt>' should be set. In addition, the author of the original port should be shot. <sect2> <heading>Licensing Problems</heading> <p>Some software packages have restrictive licenses or are in violation to the law (PKP's patent on public key crypto, ITAR (export of crypto software) to name just two of them). What we can do with them vary a lot, depending on the exact wordings of the respective licenses. <p>Note that it is your responsibility as a porter to read the licensing terms of the software and make sure that the FreeBSD project won't held accountable of violating them by redistributing the source or compiled binaries either via ftp or CD-ROM. If in doubt, please contact <tt>ports@freebsd.org</tt>. <p>We usually get around this problem by setting <tt>${NO_PACKAGE}</tt> in the Makefile, and not putting the distfile up for ftp. However, for most cases, you should at least be able to make a port, so don't let the license scare you away! <p>Note: The GNU General Public License (GPL), both version 1 and 2, shouldn't be a problem for ports. <p>Note: If you are a committer, make sure you update the <tt>ports/LEGAL</tt> file too. <sect2> <heading>* Upgrading</heading> <p>This section is still under construction, sorry. <sect2> <heading>Do's and Dont's</heading> <p>Here's a list of common do's and dont's that you encounter during the porting process. <sect3> <heading>WRKDIR</heading> <p>Don't leave anything valuable lying around in the `<tt>work</tt>' subdirectory, `<tt>make clean</tt>' will <em>nuke</em> it completely! If you need auxiliary files that aren't scripts or patches, put them in the subdirectory `<tt>files</tt>' and use the <tt>post-extract</tt> target to copy them to the `<tt>work</tt>' subdirectory. <sect3> <heading>Package information</heading> <p>Do install package information, i.e., the three files in <tt>pkg</tt>. Note that these files are not used only for packaging anymore, and are <em>mandatory</em> now, even if <tt>${NO_PACKAGE}</tt> is set. <sect3> <heading>Compress manpages, strip binaries</heading> <p>Do compress manpages and strip binaries. If the original source already does that, fine; otherwise, you can add a <tt>post-install</tt> rule to do it yourself. Make sure that you check the variable <tt>NOMANCOMPRESS</tt> that the user can set in <tt>/etc/make.conf</tt> to disable man page compression. Here's an example: <tscreen><verb> post-install: strip ${PREFIX}/bin/xdl .if !defined(NOMANCOMPRESS) gzip -9nf ${PREFIX}/man/man1/xdl.1 .endif </verb></tscreen> <p>Use the <tt>file</tt> command on the installed executable to check whether the binary is stripped or not. If it doesn't say `not stripped', it is stripped. <sect3> <heading>Custom utilities</heading> <p>Don't rely on custom utilities in your local configure script or anything -- they may not be there on the user's system! If you really need something else to be installed before you can work, detect this from your configure script, print a helpful message and exit with a non-zero status! At least you'll have given the user some idea of what's needed. If the custom utility or package is actually part of the ports tree, this should be dealt by the dependency mechanism of ports. <p>Actually, if this utility is not part of the ports tree you should probably make a port of this utility (this is how many of the ports made it into the tree!). Depending on something that is not part of the main FreeBSD distribution or the ports tree is a bad idea, and the user should be able to go to any subdirectory of <tt>/usr/ports</tt> and type `<tt>make</tt>' and have that port, as well as everything it requires, built automatically. <sect3> <heading>Feedback</heading> <p>Do send applicable changes/patches to the original author/maintainer for inclusion in next release of the code. This will only make your job that much easier for the next release. <sect3> <heading>RCS strings</heading> <p>Don't put RCS strings in patches. CVS will mangle them when we put the files into the ports tree, and when we check them out again, they will come out different and the patch will fail. RCS strings are surrounded by dollar (`<tt>$</tt>') signs, and typically start with `<tt>$Id</tt>' or `<tt>$RCS</tt>'. <sect3> <heading>Recursive diff</heading> <p>Using the recurse (`<tt>-r</tt>') option to <tt>diff</tt> to generate patches is fine, but please take a look at the resulting patches to make sure you don't have any unnecessary junk in there. In particular, diffs between two backup files, Makefiles when the port uses imake or GNU configure, etc., are unnecessary and should be deleted. Also, if you had to delete a file, then you can do it in the <tt>post-extract</tt> target rather than as part of the patch. <sect3> <heading>PREFIX</heading> <p>Do try to make your port install relative to <tt>${PREFIX}</tt> in your Makefiles. This will normally be set to <tt>/usr/local</tt>, or <tt>/usr/X11R6</tt> if <tt>${USE_IMAKE}</tt> or <tt>${USE_X11}</tt> is set, though it can be reassigned in your Makefile or in the users environment, if need be. <p>Not hard-coding <tt>/usr/local</tt> anywhere in your installation will make the port much more flexible and cater to the needs of other sites. Note that this doesn't count for package `packing list' files since they have their own scheme for relocating themselves and can be left independent of <tt>${PREFIX}</tt> unless the package is one that hard-codes itself to a compiled-in location. <sect3> <heading>Subdirectories</heading> <p>Try to let the port put things in the right subdirectories of <tt>${PREFIX}</tt>. Some ports lump everything and put it in the subdirectory with the port's name, which is incorrect. Also, many ports put everything except binaries, header files and manual pages in the a subdirectory of `<tt>lib</tt>', which does not bode well with the BSD paradigm. Many of the files should me moved to one of the following: `<tt>etc</tt>' (setup/configuration files), `<tt>libexec</tt>' (executables started internally), `<tt>sbin</tt>' (executables for superusers/managers) or `<tt>share</tt>' (architecture independent files). See <tt>hier(7)</tt> for details, the rule governing <tt>/usr</tt> pretty much applies to <tt>/usr/local</tt> too. <sect3> <heading>ldconfig</heading> <p>If your port installs a shared library, add a <tt>post-install</tt> target to your Makefile that runs `<tt>/sbin/ldconfig -m</tt>' on the directory where the new library is installed (usually <tt>${PREFIX}/lib</tt>) to register it into the shared library cache. <p>Also, add an <tt>@exec</tt> line to your <tt>pkg/PLIST</tt> file so that a user who installed the package can start using the shared library immediately. This line should immediately follow the line for the shared library itself, as in: <tscreen><verb> lib/libtcl.so.7.3 @exec /sbin/ldconfig -m %D/lib </verb></tscreen> <p>Note: the `-m' option is new since 2.0.5 and 2.1.0-950726-SNAP, so don't be alarmed if it doesn't work on your machine. <p>Never, ever, <em>ever</em> add a line that says `<tt>ldconfig</tt>' without any arguments to your Makefile or pkg/PLIST. This will reset the shared library cache to the contents of <tt>/usr/lib</tt> only, and will royally screw up the user's machine ("Help, xinit doesn't run anymore after I install this port!"). Anybody who does this will be shot and cut into 65,536 pieces by a rusty knife and have his liver chopped out by a bunch of crows and will eternally rot to death in the deepest bowels of hell (not necessarily in that order).... <sect3> <heading>If you are stuck....</heading> <p>Do look at existing examples and the <tt>bsd.port.mk</tt> file before asking us questions! <tt>;)</tt> <p>Do ask us questions if you have any trouble! Don't just beat your head against a wall! <tt>:)</tt> <sect2> <heading>A Sample Makefile</heading> <p>Here is a sample Makefile that you can use to create a new port. Make sure you remove all the extra comments (ones between brackets)! <p>It is recommended that you follow this format (ordering of variables, etc.). Not all of the existing Makefiles are in this format (mostly old ones), but we are trying to uniformize how they look. This format is designed so that the most important information is easy to locate. <tscreen><verb> [the header...just to make it easier for us to identify the ports] # New ports collection makefile for: xdvi # Version required: 2.2 [things like "1.5alpha" are fine here too] # Date created: 26 May 1995 [this is the person who did the original port to FreeBSD, in particular, the person who wrote this Makefile] # Whom: Satoshi Asami <asami@FreeBSD.ORG> # - # $Id: porting.sgml,v 1.12 1996-01-28 16:36:24 jfieber Exp $ + # $Id: porting.sgml,v 1.13 1996-01-31 14:26:13 mpp Exp $ [ ^^^^ don't worry about this...it will be automatically filled in by CVS when it is committed to our repository] # [section to describe the package itself and main ftp site - DISTNAME is always first, followed by PKGNAME (if necessary), CATEGORIES, KEYWORDs (if necessary) and then MASTER_SITES, and optionally EXTRACT_SUFX or DISTFILES] DISTNAME= xdvi PKGNAME= xdvi-pl18 CATEGORIES+= printing [don't forget the trailing slash ("/")!] MASTER_SITES= ftp://crl.dec.com/pub/X11/contrib/applications/ [set this if the source is not in the standard ".tar.gz" form] EXTRACT_SUFX= .tar.Z [section for distributed patches -- can be empty] PATCH_SITES= ftp://ftp.sra.co.jp/pub/X11/japanese/ PATCHFILES= xdvi-18.patch1.gz xdvi-18.patch2.gz [maintainer; *mandatory*! This is the person (preferably with commit privileges) who a user can contact for questions and bug reports - this person should be the porter or someone who can forward questions to the original porter reasonably promptly. If you really don't want to have your address here, set it to "ports@FreeBSD.ORG".] MAINTAINER= asami@FreeBSD.ORG [dependencies -- can be empty] RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript LIB_DEPENDS= Xpm\\.4\\.:${PORTSDIR}/graphics/xpm [this section is for other standard bsd.port.mk variables that don't belong to any of the above] [If it extracts to a directory other than ${DISTNAME}...] WRKSRC= ${WRKDIR}/xdvi-new [If it asks questions during configure, build, install...] IS_INTERACTIVE= yes [If it requires "configure" in the distributed source directory to be run...] HAS_CONFIGURE= yes [If it requires GNU make, not /usr/bin/make, to build...] USE_GMAKE= yes [If it is an X application and requires "xmkmf -a" to be run...] USE_IMAKE= yes [et cetera.] [non-standard variables to be used in the rules below] MY_FAVORITE_RESPONSE= "yeah, right" [then the special rules, in the order they are called] pre-fetch: i go fetch something, yeah post-patch: i need to do something after patch, great pre-install: and then some more stuff before installing, wow [and then the epilogue] .include <bsd.port.mk> </verb></tscreen> <sect2> <heading>Package Names</heading> <p>The following are the conventions you should follow in naming your packages. This is to have our package directory easy to scan, as there are already lots and lots of packages and users are going to turn away if they hurt their eyes! <p>If your <tt>${DISTNAME}</tt> does not look like `<tt><name>-<version.string.numbers></tt>', set <tt>${PKGNAME}</tt> to something in that format. <enum> <item>The `<tt><name></tt>' part should be all lowercases, except for a really large package (with lots of programs in it). Things like XFree86 (yes there really is a package of it, check it out) and ImageMagick fall into this category. Otherwise, convert the name (or at least the first letter) to lowercase. If the software in question really is called that way, you can have numbers, hyphens and underscores in the name too. <item>The version string should be a period-separated list of integers and single lowercase alphabets. The only exception is the string `pl' (meaning `patchlevel'), which can be used <em>only</em> when there are no major and minor version numbers in the software. </enum> <p>Here are some (real) examples on how to convert a <tt>${DISTNAME}</tt> into a suitable <tt>${PKGNAME}</tt>: <tscreen><verb> DISTNAME PKGNAME Reason mule-2.2.2 mule-2.2.2 no prob at all XFree86-3.1.2 XFree86-3.1.2 ditto EmiClock-1.0.2 emiclock-1.0.2 no uppercase names for single programs gmod1.4 gmod-1.4 need hyphen after `<name>' xmris.4.02 xmris-4.02 ditto rdist-1.3alpha rdist-1.3a no strings like `alpha' allowed es-0.9-beta1 es-0.9b1 ditto v3.3beta021.src jpeg-5a what the heck was that anyway? ;) tvtwm tvtwm-pl11 version string always required piewm piewm-1.0 ditto xvgr-2.10pl1 xvgr-2.10.1 `pl' allowed only when no maj/minor numbers </verb></tscreen> <p>If there is absolutely no trace of version information in the original source and it is unlikely that the original author will ever release another version, just set the version string to `1.0' (like the piewm example above). Otherwise, ask the original author or use the date string (`yy.mm.dd') as the version. <sect2> <heading>That's It, Folks!</heading> <p>Boy, this sure was a long tutorial, wasn't it? Thanks for following us to here, really. <p>Well, now that you know how to do a port, let's go at it and convert everything in the world into ports! That is the easiest way to start contributing to the FreeBSD Project! <tt>:)</tt> diff --git a/handbook/printing.sgml b/handbook/printing.sgml index aa56d9147e..d4f7f40c74 100644 --- a/handbook/printing.sgml +++ b/handbook/printing.sgml @@ -1,3876 +1,3876 @@ <!-- This is an SGML document in the linuxdoc DTD describing Printing with FreeBSD. By Sean Kelly, 1995. - $Id: printing.sgml,v 1.3 1995-12-04 17:58:47 jfieber Exp $ + $Id: printing.sgml,v 1.4 1996-01-31 14:26:14 mpp Exp $ The FreeBSD Documentation Project <!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN"> <article> <title> Printing with FreeBSD <author> Sean Kelly <tt/kelly@fsl.noaa.gov/ <date> 30 September 1995, (c) 1995 <abstract> This document describes printing with FreeBSD. It tells how to set up printer hardware, how to configure FreeBSD to use printers, and how to control the print queue and print a variety of file formats. </abstract> <toc> --> <chapt><heading>Printing<label id="printing"></heading> <p><em>Contributed by &a.kelly;<newline>30 September 1995</em> In order to use printers with FreeBSD, you'll need to set them up to work with the Berkeley line printer spooling system, also known as the LPD spooling system. It's the standard printer control system in FreeBSD. This section introduces the LPD spooling system, often simply called LPD. If you're already familiar with LPD or another printer spooling system, you may wish to skip to section <ref id="printing:intro:setup" name="Setting up the spooling system">. <sect><heading>What the Spooler Does<label id="printing:intro:spooler"></heading> <p> LPD controls everything about a host's printers. It's responsible for a number of things: <itemize> <item>It controls access to attached printers and printers attached to other hosts on the network. <item>It enables users to submit files to be printed; these submissions are known as <em/jobs/. <item>It prevents multiple users from accessing a printer at the same time by maintaining a <em/queue/ for each printer. <item>It can print <em/header pages/ (also known as <em/banner/ or <em/burst/ pages) so users can easily find jobs they've printed in a stack of printouts. <item>It takes care of communications parameters for printers connected on serial ports. <item>It can send jobs over the network to another LPD spooler on another host. <item>It can run special filters to format jobs to be printed for various printer languages or printer capabilities. <item>It can account for printer usage. </itemize> Through a configuration file, and by providing the special filter programs, you can enable the LPD system to do all or some subset of the above for a great variety of printer hardware. <sect><heading>Why You Should Use the Spooler<label id="printing:intro:why"></heading> <p> If you're the sole user of your system, you may be wondering why you should bother with the spooler when you don't need access control, header pages, or printer accounting. While it's possible to enable direct access to a printer, you should use the spooler anyway since <itemize> <item>LPD prints jobs in the background; you don't have to wait for data to be copied to the printer. <item>LPD can conveniently run a job to be printed through filters to add date/time headers or convert a special file format (such as a TeX DVI file) into a format the printer will understand. You won't have to do these steps manually. <item>Many free and commercial programs that provide a print feature usually expect to talk to the spooler on your system. By setting up the spooling system, you'll more easily support other software you may later add or already have. </itemize> <sect><heading>Setting Up the Spooling System<label id="printing:intro:setup"></heading> <p> To use printers with the LPD spooling system, you'll need to set up both your printer hardware and the LPD software. This document describes two levels of setup: <itemize> <item>See section <ref name="Simple Printer Setup" id="printing:simple"> to learn how to connect a printer, tell LPD how to communicate with it, and print plain text files to the printer. <item>See section <ref name="Advanced Printer Setup" id="printing:advanced"> to find out how to print a variety of special file formats, to print header pages, to print across a network, to control access to printers, and to do printer accounting. </itemize> <sect><heading>Simple Printer Setup<label id="printing:simple"></heading> <p> This section tells how to configure printer hardware and the LPD software to use the printer. It teaches the basics: <itemize> <item>Section <ref id="printing:hardware" name="Hardware Setup"> gives some hints on connecting the printer to a port on your computer. <item>Section <ref id="printing:software" name="Software Setup"> shows how to setup the LPD spooler configuration file <tt>/etc/printcap</tt>. </itemize> If you're setting up a printer that uses a network protocol to accept data to print instead of a serial or parallel interface, see <ref id="printing:advanced:network:net-if" name="Printers With Networked Data Stream Interaces">. Although this section is called ``Simple Printer Setup,'' it's actually fairly complex. Getting the printer to work with your computer and the LPD spooler is the hardest part. The advanced options like header pages and accounting are fairly easy once you get the printer working. <sect1><heading>Hardware Setup<label id="printing:hardware"></heading> <p> This section tells about the various ways you can connect a printer to your PC. It talks about the kinds of ports and cables, and also the kernel configuration you may need to enable FreeBSD to speak to the printer. If you've already connected your printer and have successfully printed with it under another operating system, you can probably skip to section <ref id="printing:software" name="Software Setup">. <sect2><heading>Ports and Cables<label id="printing:ports"></heading> <p> Nearly all printers you can get for a PC today support one or both of the following interfaces: <itemize> <item><em/Serial/ interfaces use a serial port on your computer to send data to the printer. Serial interfaces are common in the computer industry and cables are readily available and also easy to construct. Serial interfaces sometimes need special cables and might require you to configure somewhat complex communications options. <item><em/Parallel/ interfaces use a parallel port on your computer to send data to the printer. Parallel interfaces are common in the PC market. Cables are readily available but more difficult to construct by hand. There are usually no communications options with parallel interfaces, making their configuration exceedingly simple. <p> Parallel interfaces are sometimes known as ``Centronics'' interfaces, named after the connector type on the printer. </itemize> In general, serial interfaces are slower than parallel interfaces. Parallel interfaces usually offer just one-way communication (computer to printer) while serial gives you two-way. Many newer parallel ports can also receive data from the printer, but only few printers need to send data back to the computer. And FreeBSD doesn't support two-way parallel communication yet. Usually, the only time you need two-way communication with the printer is if the printer speaks PostScript. PostScript printers can be very verbose. In fact, PostScript jobs are actually programs sent to the printer; they needn't produce paper at all and may return results directly to the computer. PostScript also uses two-way communication to tell the computer about problems, such as errors in the PostScript program or paper jams. Your users may be appreciative of such information. Furthermore, the best way to do effective accounting with a PostScript printer requires two-way communication: you ask the printer for its page count (how many pages it's printed in its lifetime), then send the user's job, then ask again for its page count. Subtract the two values and you know how much paper to charge the user. So, which interface should you use? <itemize> <item>If you need two-way communication, use a serial port. FreeBSD does not yet support two-way communication over a parallel port. <item>If you don't need two-way communication and can pick parallel or serial, prefer the parallel interface. It keeps a serial port free for other peripherals---such as a terminal or a modem---and is faster most of the time. It's also easier to configure. <item>Finally, use whatever works. </itemize> <sect2><heading>Parallel Ports<label id="printing:parallel"></heading> <p> To hook up a printer using a parallel interface, connect the Centronics cable between the printer and the computer. The instructions that came with the printer, the computer, or both should give you complete guidance. Remember which parallel port you used on the computer. The first parallel port is /dev/lpt0 to FreeBSD; the second is /dev/lpt1, and so on. <sect2><heading>Serial Ports<label id="printing:serial"></heading> <p> To hook up a printer using a serial interface, connect the proper serial cable between the printer and the computer. The instructions that came with the printer, the computer, or both should give you complete guidance. If you're unsure what the ``proper serial cable'' is, you may wish to try one of the following alternatives: <itemize> <item>A <em/modem/ cable connects each pin of the connector on one end of the cable straight through to its corresponding pin of the connector on the other end. This type of cable is also known as a DTE-to-DCE cable. <item>A <em/null-modem/ cable connects some pins straight through, swaps others (send data to receive data, for example), and shorts some internally in each connector hood. This type of cable is also known as a DTE-to-DTE cable. <item>A <em/serial printer/ cable, required for some unusual printers, is like the null modem cable, but sends some signals to their counterparts instead of being internally shorted. </itemize> You should also set up the communications parameters for the printer, usually through front-panel controls or DIP switches on the printer. Choose the highest bps (bits per second, sometimes <em/baud rate/) rate that both your computer and the printer can support. Choose 7 or 8 data bits; none, even, or odd parity; and 1 or 2 stop bits. Also choose a flow control protocol: either none, or XON/XOFF (also known as <em/in-band/ or <em/software/) flow control. Remember these settings for the software configuration that follows. <sect1><heading>Software Setup<label id="printing:software"></heading> <p> This section describes the software setup necessary to print with the LPD spooling system in FreeBSD. Here's an outline of the steps involved: <enum> <item>Configure your kernel, if necessary, for the port you're using for the printer; section <ref id="printing:kernel" name="Kernel Configuration"> tells you what you need to do. <item>Set the communications mode for the parallel port, if you're using a parallel port; section <ref id="printing:parallel-port-mode" name = "Setting the Communication Mode for the Parallel Port"> gives details. <item>Test if the operating system can send data to the printer. Section <ref id="printing:testing" name="Checking Printer Communications"> gives some suggestions on how to do this. <item>Set up LPD for the printer by modifying the file <tt>/etc/printcap</tt>. Section <ref id="printing:printcap" name="The /etc/printcap File"> shows you how. </enum> <sect2><heading>Kernel Configuration<label id="printing:kernel"></heading> <p> The operating system kernel is compiled to work with a specific set of devices. The serial or parallel interface for your printer is a part of that set. Therefore, it might be necessary to add support for an additional serial or parallel port if your kernel isn't already configured for one. To find out if the kernel you're currently using supports a serial interface, type <tscreen> <tt>dmesg | grep sio</tt><it/N/ </tscreen> where <it/N/ is the number of the serial port, starting from zero. If you see output similar to the following <tscreen><verb> sio2 at 0x3e8-0x3ef irq 5 on isa sio2: type 16550A </verb></tscreen> then the kernel supports the port. To find out if the kernel supports a parallel interface, type <tscreen> <tt>dmesg | grep lpt</tt><it/N/ </tscreen> where <it/N/ is the number of the parallel port, starting from zero. If you see output similar to the following <tscreen><verb> lpt0 at 0x378-0x37f on isa </verb></tscreen> then the kernel supports the port. You might have to reconfigure your kernel in order for the operating system to recognize and use the parallel or serial port you're using for the printer. To add support for a serial port, see the section on kernel configuration. To add support for a parallel port, see that section <em/and/ the section that follows. <sect3><heading>Adding <tt>/dev</tt> Entries for the Ports <label id="printing:dev-ports"></heading> <p> Even though the kernel may support communication along a serial or parallel port, you'll still need a software interface through which programs running on the system can send and receive data. That's what entries in the <tt>/dev</tt> directory are for. <bf>To add a <tt>/dev</tt> entry for a port:</bf> <enum> <item>Become root with the <tt/su/ command. Enter the root password when prompted. <item>Change to the <tt>/dev</tt> directory: <tscreen><verb> cd /dev </verb></tscreen> <item>Type <tscreen> <tt> ./MAKEDEV</tt> <it/port/ </tscreen> where <it/port/ is the device entry for the port you want to make. Use <tt/lpt0/ for the first parallel port, <tt/lpt1/ for the second, and so on; use <tt/ttyd0/ for the first serial port, <tt/ttyd1/ for the second, and so on. <item>Type <tscreen> <tt>ls -l</tt> <it/port/ </tscreen> to make sure the device entry got created. </enum> <sect3><heading>Setting the Communication Mode for the Parallel Port <label id="printing:parallel-port-mode"></heading> <p> When you're using the parallel interface, you can choose whether FreeBSD should use interrupt-driven or polled communication with the printer. <itemize> <item>The <em/interrupt-driven/ method is the default with the GENERIC kernel. With this method, the operating system uses an IRQ line to determine when - the printer's ready for data. + the printer is ready for data. <item>The <em/polled/ method directs the operating system to repeatedly ask the printer if it's ready for more data. When it responds ready, the kernel sends more data. </itemize> The interrupt-driven method is somewhat faster but uses up a precious IRQ line. You should use whichever one works. You can set the communications mode in two ways: by configuring the kernel or by using the <tt/lptcontrol/ program. <bf>To set the communications mode by configuring the kernel:</bf> <enum> <item>Edit your kernel configuration file. Look for or add an <tt/lpt0/ entry. If you're setting up the second parallel port, use <tt/lpt1/ instead. Use <tt/lpt2/ for the third port, and so on. <itemize> <item>If you want interrupt-driven mode, add the <tt/irq/ - specifer: + specifier: <tscreen> <tt>device lpt0 at isa? port? tty irq <it/N/ vector lptintr</tt> </tscreen> where <it/N/ is the IRQ number for your computer's parallel port. <item>If you want polled mode, don't add the <tt/irq/ specifier: <tscreen> <tt>device lpt0 at isa? port? tty vector lptintr</tt> </tscreen> </itemize> <item>Save the file. Then configure, build, and install the kernel, then reboot. See <ref id="kernelconfig" name="kernel configuration"> for more details. </enum> <bf>To set the communications mode with <tt/lptcontrol/:</bf> <itemize> <item> Type <tscreen> <tt>lptcontrol -i -u <it/N/</tt> </tscreen> to set interrupt-driven mode for <tt/lpt<it/N//. <item> Type <tscreen> <tt>lptcontrol -p -u <it/N/</tt> </tscreen> to set polled-mode for <tt/lpt<it/N//. </itemize> You could put these commands in your <tt>/etc/rc.local</tt> file to set the mode each time your system boots. See lptcontrol(8) for more information. <sect3><heading>Checking Printer Communications<label id="printing:testing"></heading> <p> Before proceeding to configure the spooling system, you should make sure the operating system can successfully send data to your printer. It's a lot easier to debug printer communication and the spooling system separately. To test the printer, we'll send some text to it. For printers that can immediately print characters sent to them, the program <tt/lptest/ is perfect: it generates all 96 printable ASCII characters in 96 lines. For a PostScript (or other language-based) printer, we'll need a more sophisticated test. A small PostScript program, such as the following, will suffice: <code> %!PS 100 100 moveto 300 300 lineto stroke 310 310 moveto /Helvetica findfont 12 scalefont setfont (Is this thing working?) show showpage </code> <em/Note:/ When this document refers to a printer language, I'm assuming a language like PostScript, and not Hewlett Packard's PCL. Although PCL has great functionality, you can intermingle plain text with its escape sequences. PostScript cannot directly print plain text, and that's the kind of printer language for - which we must make special accomodations. + which we must make special accommodations. <sect4><heading>Checking a Parallel Printer<label id="printing:checking:parallel"></heading> <p> This section tells you how to check if FreeBSD can communicate with a printer connected to a parallel port. <bf>To test a printer on a parallel port:</bf> <enum> <item>Become root with <tt/su/. <item>Send data to the printer. <itemize> <item>If the printer can print plain text, then use <tt/lptest/. Type: <tscreen> <tt>lptest > /dev/lpt<it/N/</tt> </tscreen> where <it/N/ is the number of the parallel port, starting from zero. <item>If the printer understands PostScript or other printer language, then send a small program to the printer. Type <tscreen> <tt>cat > /dev/lpt<it/N/</tt> </tscreen> Then, line by line, type the program <em/carefully/ as you can't edit a line once you've pressed RETURN or ENTER. When you've finished entering the program, press CONTROL+D, or whatever your end of file key is. <p> Alternatively, you can put the program in a file and type <tscreen> <tt>cat <it/file/ > /dev/lpt<it/N/</tt> </tscreen> where <it/file/ is the name of the file containing the program you want to send to the printer. </itemize> </enum> You should see something print. Don't worry if the text doesn't look right; we'll fix such things later. <sect4><heading>Checking a Serial Printer<label id="printing:checking:serial"></heading> <p> This section tells you how to check if FreeBSD can communicate with a printer on a serial port. <bf>To test a printer on a serial port:</bf> <enum> <item>Become root with <tt/su/. <item>Edit the file <tt>/etc/remote</tt>. Add the following entry: <tscreen> <tt>printer:dv=/dev/<it/port/:br#<it/bps-rate/:pa=<it/parity/</tt> </tscreen> where <it/port/ is the device entry for the serial port (<tt/ttyd0/, <tt/ttyd1/, etc.), <it/bps-rate/ is the bits-per-second rate at which the printer communicates, and <it/parity/ is the parity required by the printer (either <tt/even/, <tt/odd/, <tt/none/, or <tt/zero/). <p> Here's a sample entry for a printer connected via a serial line to the third serial port at 19200 bps with no parity: <code> printer:dv=/dev/ttyd2:br#19200:pa=none </code> <item>Connect to the printer with <tt/tip/. Type: <tscreen><verb> tip printer </verb></tscreen> If this step doesn't work, edit the file <tt>/etc/remote</tt> again and try using <tt>/dev/cuaa<it/N/</tt> instead of <tt>/dev/ttyd<it/N/</tt>. <item>Send data to the printer. <itemize> <item>If the printer can print plain text, then use <tt/lptest/. Type: <tscreen><verb> ~$lptest </verb></tscreen> <item>If the printer understands PostScript or other printer language, then send a small program to the printer. Type the program, line by line, <em/very carefully/ as backspacing or other editing keys may be significant to the printer. You may also need to type a special end-of-file key for the printer so it knows it received the whole program. For PostScript printers, press CONTROL+D. <p> Alternatively, you can put the program in a file and type <tscreen> <tt>˜><it/file/</tt> </tscreen> where <it/file/ is the name of the file containing the program. After <tt/tip/ sends the file, press any required end-of-file key. </itemize> </enum> You should see something print. Don't worry if the text doesn't look right; we'll fix that later. <sect2><heading>Enabling the Spooler: The <tt>/etc/printcap</tt> File <label id="printing:printcap"></heading> <p> At this point, your printer should be hooked up, your kernel configured to communicate with it (if necessary), and you've been able to send some simple data to the printer. Now, we're ready to configure LPD to control access to your printer. You configure LPD by editing the file <tt>/etc/printcap</tt>. The LPD spooling system reads this file each time the spooler is used, so updates to the file take immediate effect. The format of the <tt/printcap/ file is straightforward. Use your favorite text editor to make changes to <tt>/etc/printcap</tt>. The format is identical to other capability files like <tt>/usr/share/misc/termcap</tt> and <tt>/etc/remote</tt>. For complete information about the format, see the cgetent(3). The simple spooler configuration consists of the following steps: <enum> <item>Pick a name (and a few convenient aliases) for the printer, and put them in the <tt>/etc/printcap</tt> file; see <ref id="printing:naming" name="Naming the Printer">. <item>Turn off header pages (which are on by default) by inserting the <tt/sh/ capability; see <ref id="printing:no-header-pages" name="Suppressing Header Pages">. <item>Make a spooling directory, and specify its location with the <tt/sd/ capability; see <ref id="printing:spooldir" name="Making the Spooling Directory">. <item>Set the <tt>/dev</tt> entry to use for the printer, and note it in <tt>/etc/printcap</tt> with the <tt/lp/ capability; see <ref id="printing:device" name="Identifying the Printer Device">. Also, if the - printer's on a serial port, set up the communication + printer is on a serial port, set up the communication parameters with the <tt/fs/, <tt/fc/, <tt/xs/, and <tt/xc/ capabilities; see <ref id="printing:commparam" name="Configuring Spooler Communications Parameters">. <item>Install a plain text input filter; see <ref id="printing:textfilter" name="Installing the Text Filter"> <item>Test the setup by printing something with the <tt/lpr/ command; see <ref id="printing:trying" name="Trying It Out"> and <ref id="printing:troubleshooting" name="Troubleshooting">. </enum> <em/Note:/ Language-based printers, such as PostScript printers, can't directly print plain text. The simple setup outlined above and described in the following sections assumes that if you're installing such a printer you'll print only files that the printer can understand. Users often expect that they can print plain text to any of the printers installed on your system. Programs that interface to LPD to do their printing usually make the same assumption. If you're installing such a printer and want to be able to print jobs in the printer language <em/and/ print plain text jobs, you're strongly urged to add an additional step to the simple setup outlined above: install an automatic plain-text--to--PostScript (or other printer language) conversion program. Section <ref - id="printing:advanced:if-conversion" name="Accomodating + id="printing:advanced:if-conversion" name="Accommodating Plain Text Jobs on PostScript Printers"> tells how to do this. <sect3><heading>Naming the Printer<label id="printing:naming"></heading> <p> The first (easy) step is to pick a name for your printer. It really doesn't matter whether you choose functional or whimsical names since you can also provide a number aliases for the printer. At least one of the printers specified in the <tt>/etc/printcap</tt> should have the alias <tt/lp/. This is the default printer's name. If users don't have the PRINTER environment variable nor specify a printer name on the command line of any of the LPD commands, then <tt/lp/ will be the default printer they get to use. Also, it's common practice to make the last alias for a printer be a full description of the printer, including make and model. Once you've picked a name and some common aliases, put them in the <tt>/etc/printcap</tt> file. The name of the printer should start in the leftmost column. Separate each alias with a vertical bar and put a colon after the last alias. In the following example, we start with a skeletal <tt>/etc/printcap</tt> that defines two printers (a Diablo 630 line printer and a Panasonic KX-P4455 PostScript laser printer): <code> # # /etc/printcap for host rose # rattan|line|diablo|lp|Diablo 630 Line Printer: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: </code> In this example, the first printer is named <tt/rattan/ and has as aliases <tt/line/, <tt/diablo/, <tt/lp/, and <tt/Diablo 630 Line Printer/. Since it has the alias <tt/lp/, it's also the default printer. The second is named <tt/bamboo/, and has as aliases <tt/ps/, <tt/PS/, <tt/S/, <tt/panasonic/, and <tt/Panasonic KX-P4455 PostScript v51.4/. <sect3><heading>Suppressing Header Pages<label id="printing:no-header-pages"></heading> <p> The LPD spooling system will by default print a <em/header page/ for each job. The header page contains the user name who requested the job, the host from which the job came, and the name of the job, in nice large letters. Unfortunately, all this extra text gets in the way of debugging the simple printer setup, so we'll suppress header pages. To suppress header pages, add the <tt/sh/ capability to the entry for the printer in <tt>/etc/printcap</tt>. Here's the example <tt>/etc/printcap</tt> with <tt/sh/ added: <code> # # /etc/printcap for host rose - no header pages anywhere # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh: </code> Note how we used the correct format: the first line starts in the leftmost column, and subsequent lines are indented with a single TAB. Every line in an entry except the last ends in a backslash character. <sect3><heading>Making the Spooling Directory<label id="printing:spooldir"></heading> <p> The next step in the simple spooler setup is to make a <em/spooling directory/, a directory where print jobs reside until they're printed, and where a number of other spooler support files live. Because of the variable nature of spooling directories, it's customary to put these directories under <tt>/var/spool</tt>. It's not necessary to backup the contents of spooling directories, either. Recreating them is as simple as running <tt/mkdir/. It's also customary to make the directory with a name that's identical to the name of the printer, as shown below: <tscreen> <tt>mkdir /var/spool/<it>printer-name</it></tt> </tscreen> However, if you have a lot of printers on your network, you might want to put the spooling directories under a single directory that you reserve just for printing with LPD. We'll do this for our two example printers <tt/rattan/ and <tt/bamboo/: <tscreen><verb> mkdir /var/spool/lpd mkdir /var/spool/lpd/rattan mkdir /var/spool/lpd/bamboo </verb></tscreen> <em/Note:/ If you're concerned about the privacy of jobs that users print, you might want to protect the spooling directory so it's not publicly accessible. Spooling directories should be owned and be readable, writable, and searchable by user daemon and group daemon, and no one else. We'll do this for our example printers: <tscreen><verb> chown daemon.daemon /var/spool/lpd/rattan chown daemon.daemon /var/spool/lpd/bamboo chmod 770 /var/spool/lpd/rattan chmod 770 /var/spool/lpd/bamboo </verb></tscreen> Finally, you need to tell LPD about these directories using the <tt>/etc/printcap</tt> file. You specify the pathname of the spooling directory with the <tt/sd/ capability: <code> # # /etc/printcap for host rose - added spooling directories # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo: </code> Note that the name of the printer starts in the first column but all other entries describing the printer should be indented with a tab and each line escaped with a backslash. If you don't specify a spooling directory with <tt/sd/, the spooling system will use <tt>/var/spool/lpd</tt> as a default. <sect3><heading>Identifying the Printer Device<label id="printing:device"></heading> <p> In section <ref id="printing:dev-ports" name="Adding /dev Entries for the Ports">, we identified which entry in the <tt>/dev</tt> directory FreeBSD will use to communicate with the printer. Now, we tell LPD that information. When the spooling system has a job to print, it will open the specified device on behalf of the filter program (which is responsible for passing data to the printer). List the <tt>/dev</tt> entry pathname in the <tt>/etc/printcap</tt> file using the <tt/lp/ capability. In our running example, let's assume that <tt/rattan/ is on the first parallel port, and <tt/bamboo/ is on a sixth serial port; here are the additions to <tt>/etc/printcap</tt>: <code> # # /etc/printcap for host rose - identified what devices to use # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5: </code> If you don't specify the <tt/lp/ capability for a printer in your <tt>/etc/printcap</tt> file, LPD uses <tt>/dev/lp</tt> as a default. <tt>/dev/lp</tt> currently doesn't exist in FreeBSD. If the printer you're installing is connected to a parallel port, skip to the section <ref name="Installing the Text Filter" id="printing:textfilter">. Otherwise, be sure to follow the instructions in the next section. <sect3><heading>Configuring Spooler Communication Parameters<label id="printing:commparam"></heading> <p> For printers on serial ports, LPD can set up the bps rate, parity, and other serial communication parameters on behalf of the filter program that sends data to the printer. This is advantageous since <itemize> <item>It lets you try different communication parameters by simply editing the <tt>/etc/printcap</tt> file; you don't have to recompile the filter program. <item>It enables the spooling system to use the same filter program for multiple printers which may have different serial communication settings. </itemize> The following <tt>/etc/printcap</tt> capabilities control serial communication parameters of the device listed in the <tt/lp/ capability: <descrip> <tag/<tt>br#<it/bps-rate/</tt>/ Sets the communications speed of the device to <it/bps-rate/, where <it/bps-rate/ can be 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, or 38400 bits-per-second. <tag/<tt>fc#<it/clear-bits/</tt>/ Clears the flag bits <it/clear-bits/ in the <tt/sgttyb/ structure after opening the device. <tag/<tt>fs#<it/set-bits/</tt>/ Sets the flag bits <it/set-bits/ in the <tt/sgttyb/ structure. <tag/<tt>xc#<it/clear-bits/</tt>/ Clears local mode bits <it/clear-bits/ after opening the device. <tag/<tt>xs#<it/set-bits/</tt>/ Sets local mode bits <it/set-bits/. </descrip> For more information on the bits for the <tt/fc/, <tt/fs/, <tt/xc/, and <tt/xs/ capabilities, see the file <tt>/usr/include/sys/ioctl_compat.h</tt>. When LPD opens the device specified by the <tt/lp/ capability, it reads the flag bits in the <tt/sgttyb/ structure; it clears any bits in the <tt/fc/ capability, then sets bits in the <tt/fs/ capability, then applies the resultant setting. It does the same for the local mode bits as well. Let's add to our example printer on the sixth serial port. We'll set the bps rate to 38400. For the flag bits, we'll set the TANDEM, ANYP, LITOUT, FLUSHO, and PASS8 flags. For the local mode bits, we'll set the LITOUT and PASS8 flags: <tscreen><verb> bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000c1:xs#0x820: </verb></tscreen> <sect3><heading>Installing the Text Filter<label id="printing:textfilter"></heading> <p> We're now ready to tell LPD what text filter to use to send jobs to the printer. A <em/text filter/, also known as an <em/input filter/, is a program that LPD runs when it has a job to print. When LPD runs the text filter for a printer, it sets the filter's standard input to the job to print, and its standard output to the printer device specified with the <tt/lp/ capability. The filter is expected to read the job from - standard input, peform any necessary translation for the + standard input, perform any necessary translation for the printer, and write the results to standard output, which will get printed. For more information on the text filter, see section <ref id="printing:advanced:filters" name="Filters">. For our simple printer setup, the text filter can be a small shell script that just executes <tt>/bin/cat</tt> to send the job to the printer. FreeBSD comes with another filter called <tt/lpf/ that handles backspacing and underlining for printers that might not deal with such character streams well. And, of course, you can use any other filter program you want. The filter <tt/lpf/ is described in detail in section <ref id="printing:advanced:lpf" name="lpf: a Text Filter">. First, let's make the shell script <tt>/usr/local/libexec/if-simple</tt> be a simple text filter. Put the following text into that file with your favorite text editor: <code> #!/bin/sh # # if-simple - Simple text input filter for lpd # Installed in /usr/local/libexec/if-simple # # Simply copies stdin to stdout. Ignores all filter arguments. /bin/cat &ero;&ero; exit 0 exit 2 </code> Make the file executable: <tscreen><verb> chmod 555 /usr/local/libexec/if-simple </verb></tscreen> And then tell LPD to use it by specifying it with the <tt/if/ capability in <tt>/etc/printcap</tt>. We'll add it to the two printers we have so far in the example <tt>/etc/printcap</tt>: <code> # # /etc/printcap for host rose - added text filter # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\ :if=/usr/local/libexec/if-simple: </code> <sect3><heading>Trying It Out<label id="printing:trying"></heading> <p> You've reached the end of the simple LPD setup. Unfortunately, congratulations are not quite yet in order, since we've still got to test the setup and correct any problems. To test the setup, try printing something. To print with the LPD system, you use the command <tt/lpr/, which submits a job for printing. You can combine <tt/lpr/ with the <tt/lptest/ program, introduced in section <ref id="printing:testing" name="Checking Printer Communications"> to generate some test text. <bf>To test the simple LPD setup:</bf> <p> Type: <tscreen> <tt>lptest 20 5 | lpr -P<it/printer-name/</tt> </tscreen> where <it/printer-name/ is a the name of a printer (or an alias) specified in <tt>/etc/printcap</tt>. To test the default printer, type <tt/lpr/ without any <tt/-P/ argument. Again, if you're testing a printer that expects PostScript, send a PostScript program in that language instead of using <tt/lptest/. You can do so by putting the program in a file and typing <tt/lpr <it/file//. For a PostScript printer, you should get the results of the program. If you're using <tt/lptest/, then your results should look like the following: <tscreen><verb> !"#$%&ero;'()*+,-./01234 "#$%&ero;'()*+,-./012345 #$%&ero;'()*+,-./0123456 $%&ero;'()*+,-./01234567 %&ero;'()*+,-./012345678 </verb></tscreen> To further test the printer, try downloading larger programs (for language-based printers) or running <tt/lptest/ with different arguments. For example, <tt/lptest 80 60/ will produce 60 lines of 80 characters each. If the printer didn't work, see the next section, <ref id="printing:troubleshooting" name="Troubleshooting">. <sect3><heading>Troubleshooting<label id="printing:troubleshooting"></heading> <p> After performing the simple test with <tt/lptest/, you - might've gotten one of the following results instead of + might have gotten one of the following results instead of the correct printout: <descrip> <tag/It worked, after awhile; or, it didn't eject a full sheet./ The printer printed the above, but it sat for awhile - and did nothing. In fact, you might've needed to + and did nothing. In fact, you might have needed to press a PRINT REMAINING or FORM FEED button on the printer to get any results to appear. If this is the case, the printer was probably waiting to see if there was any more data for your job before it printed anything. To fix this problem, you can have the text filter send a FORM FEED character (or whatever is necessary) to the printer. This is usually sufficient to have the printer immediately print any text remaining in its internal buffer. It's also useful to make sure each print job ends on a full sheet, so the next job doesn't start somewhere on the middle of the last page of the previous job. The following replacement for the shell script <tt>/usr/local/libexec/if-simple</tt> prints a form feed after it sends the job to the printer: <code> #!/bin/sh # # if-simple - Simple text input filter for lpd # Installed in /usr/local/libexec/if-simple # # Simply copies stdin to stdout. Ignores all filter arguments. # Writes a form feed character (\f) after printing job. /bin/cat &ero;&ero; printf "\f" &ero;&ero; exit 0 exit 2 </code> <tag/It produced the ``staircase effect.''/ You got the following on paper: <tscreen><verb> !"#$%&ero;'()*+,-./01234 "#$%&ero;'()*+,-./012345 #$%&ero;'()*+,-./0123456 </verb></tscreen> You've become another victim of the <em/staircase effect/, caused by conflicting interpretations of what characters should indicate a new-line. UNIX-style operating systems use a single character: ASCII code 10, the line feed (LF). MS-DOS, OS/2, and others uses a pair of characters, ASCII code 10 <em/and/ ASCII code 13 (the carriage return or CR). Many printers use the MS-DOS convention for representing new-lines. When you print with FreeBSD, your text used just the line feed character. The printer, upon seeing a line feed character, advanced the paper one line, but maintained the same horizontal position on the page for the next character to print. That's what the carriage return is for: to move the location of the next character to print to the left edge of the paper. Here's what FreeBSD wants your printer to do: <tscreen><verb> Printer received CR Printer prints CR Printer received LF Printer prints CR + LF </verb></tscreen> Here are some ways to achieve this: <itemize> <item>Use the printer's configuration switches or control panel to alter its interpretation of these characters. Check your printer's manual to find out how to do this. <p> <em/Note:/ If you boot your system into other operating systems besides FreeBSD, you may have to <em/reconfigure/ the printer to use a an interpretation for CR and LF characters that those other operating systems use. You might prefer one of the other solutions, below. <item>Have FreeBSD's serial line driver automatically convert LF to CR+LF. Of course, this works with printers on serial ports <em/only/. To enable this feature, set the CRMOD bit in <tt/fs/ capability in the <tt>/etc/printcap</tt> file for the printer. <item>Send an <em/escape code/ to the printer to have it temporarily treat LF characters differently. Consult your printer's manual for escape codes that your printer might support. When you find the proper escape code, modify the text filter to send the code first, then send the print job. <p> Here's an example text filter for printers that understand the Hewlett-Packard PCL escape codes. This filter makes the printer treat LF characters as a LF and CR; then it sends the job; then it sends a form feed to eject the last page of the job. It should work with nearly all Hewlett Packard printers. <code> #!/bin/sh # # hpif - Simple text input filter for lpd for HP-PCL based printers # Installed in /usr/local/libexec/hpif # # Simply copies stdin to stdout. Ignores all filter arguments. # Tells printer to treat LF as CR+LF. Writes a form feed character # after printing job. printf "\033&ero;k2G" &ero;&ero; cat &ero;&ero; printf "\f" &ero;&ero; exit 0 exit 2 </code> Here's an example <tt>/etc/printcap</tt> from a host called orchid. It has a single printer attached to its first parallel port, a Hewlett Packard LaserJet 3Si named <tt/teak/. It's using the above script as its text filter: <code> # # /etc/printcap for host orchid # teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sh:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif: </code> </itemize> <tag/It overprinted each line./ The printer never advanced a line. All of the lines of text were printed on top of each other on one line. This problem is the ``opposite'' of the staircase effect, described above, and is much rarer. Somewhere, the LF characters that FreeBSD uses to end a line are being treated as CR characters to return the print location to the left edge of the paper, but not also down a line. Use the printer's configuration switches or control panel to enforce the following interpretation of LF and CR characters: <tscreen><verb> Printer received CR Printer prints CR Printer received LF Printer prints CR + LF </verb></tscreen> <tag/The printer lost characters./ While printing, the printer didn't print a few - characters in each line. The problem might've + characters in each line. The problem might have gotten worse as the printer ran, losing more and more characters. The problem is that the printer can't keep up with the speed at which the computer sends data over a serial line. (This problem shouldn't occur with printers on parallel ports.) There are two ways to overcome the problem: <itemize> <item>If the printer supports XON/XOFF flow control, have FreeBSD use it by specifying the TANDEM bit in the <tt/fs/ capability. <item>If the printer supports carrier flow control, specify the MDMBUF bit in the <tt/fs/ capability. Make sure the cable connecting the printer to the computer is correctly wired for carrier flow control. <item>If the printer doesn't support any flow control, use some combination of the NLDELAY, TBDELAY, CRDELAY, VTDELAY, and BSDELAY bits in the <tt/fs/ capability to add appropriate delays to the stream of data sent to the printer. </itemize> <tag/It printed garbage./ The printer printed what appeared to be random garbage, but not the desired text. This is usually another symptom of incorrect communications parameters with a serial printer. Double-check the bps rate in the <tt/br/ capability, and the parity bits in the <tt/fs/ and <tt/fc/ capabilities; make sure the printer is using the same settings as specified in the <tt>/etc/printcap</tt> file. <tag/Nothing happened./ If nothing happened, the problem is probably within FreeBSD and not the hardware. Add the log file (<tt/lf/) capability to the entry for the printer you're debugging in the <tt>/etc/printcap</tt> file. For example, here's the entry for <tt/rattan/, with the <tt/lf/ capability: <tscreen><verb> rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple:\ :lf=/var/log/rattan.log </verb></tscreen> Then, try printing again. Check the log file (in our example, <tt>/var/log/rattan.log</tt>) to see any error messages that might appear. Based on the messages you see, try to correct the problem. If you don't specify a <tt/lf/ capability, LPD uses <tt>/dev/console</tt> as a default. </descrip> <sect><heading>Using Printers<label id="printing:using"></heading> <p> This section tells you how to use printers you've setup with FreeBSD. Here's an overview of the user-level commands: <descrip> <tag/<tt/lpr// Print jobs <tag/<tt/lpq// Check printer queues <tag/<tt/lprm// Remove jobs from a printer's queue </descrip> There's also an administrative command, <tt/lpc/, described in the section <ref id="printing:lpc" name="Administrating the LPD Spooler">, used to control printers and their queues. All three of the commands <tt/lpr/, <tt/lprm/, and <tt/lpq/ accept an option ``<tt/-P/ <it/printer-name/'' to specify on which printer/queue to operate, as listed in the <tt>/etc/printcap</tt> file. This enables you to submit, remove, and check on jobs for various printers. If you don't use the <tt/-P/ option, then these commands use the printer specified in the PRINTER environment variable. Finally, if you don't have a PRINTER environment variable, these commands default to the printer named <tt/lp/. Hereafter, the terminology <em/default printer/ means the printer named in the PRINTER environment variable, or the printer named <tt/lp/ when there's no PRINTER environment variable. <sect1><heading>Printing Jobs<label id="printing:lpr"></heading> <p> To print files, type <tscreen> <tt>lpr <it/filename.../</tt> </tscreen> This prints each of the listed files to the default printer. If you list no files, <tt/lpr/ reads data to print from standard input. For example, this command prints some important system files: <tscreen><verb> lpr /etc/host.conf /etc/hosts.equiv </verb></tscreen> To select a specific printer, type <tscreen> <tt>lpr -P <it/printer-name/ <it/filename.../</tt> </tscreen> This example prints a long listing of the current directory to the printer named <tt/rattan/: <tscreen><verb> ls -l | lpr -P rattan </verb></tscreen> Because no files were listed for the <tt/lpr/ command, <tt/lpr/ read the data to print from standard input, which was the output of the <tt/ls -l/ command. The <tt/lpr/ command can also accept a wide variety of options to control formatting, apply file conversions, generate multiple copies, and so forth. For more information, see the section <ref id="printing:lpr:options" name="Printing Options">. <sect1><heading>Checking Jobs<label id="printing:lpq"></heading> <p> When you print with <tt/lpr/, the data you wish to print is put together in a package called a <em/print job/, which is sent to the LPD spooling system. Each printer has a queue of jobs, and your job waits in that queue along with other jobs from yourself and from other users. The printer prints those jobs in a first-come, first-served order. To display the queue for the default printer, type <tt/lpq/. For a specific printer, use the <tt/-P/ option. For example, the command <tscreen><verb> lpq -P bamboo </verb></tscreen> shows the queue for the printer named <tt/bamboo/. Here's an example of the output of the <tt/lpq/ command: <tscreen><verb> bamboo is ready and printing Rank Owner Job Files Total Size active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes 2nd kelly 10 (standard input) 1635 bytes 3rd mary 11 ... 78519 bytes </verb></tscreen> This shows three jobs in the queue for <tt/bamboo/. The first job, submitted by user kelly, got assigned <em/job number/ 9. Every job for a printer gets a unique job number. Most of the time you can ignore the job number, but you'll need it if you want to cancel the job; see section <ref id="printing:lprm" name="Removing Jobs"> for details. Job number nine consists of two files; multiple files given on the <tt/lpr/ command line are treated as part of a single job. It's the currently active job (note the word <tt/active/ under the ``Rank'' column), which means the printer should be currently printing that job. The second job consists of data passed as the standard input to the <tt/lpr/ command. The third job came from user mary; it's a much larger job. The pathname of the files she's trying to print is too long to fit, so the <tt/lpq/ command just shows three dots. The very first line of the output from <tt/lpq/ is also useful: it tells what the printer is currently doing (or at least what LPD thinks the printer is doing). The <tt/lpq/ command also support a <tt/-l/ option to generate a detailed long listing. Here's an example of <tt/lpq -l/: <tscreen><verb> waiting for bamboo to become ready (offline ?) kelly: 1st [job 009rose] /etc/host.conf 73 bytes /etc/hosts.equiv 15 bytes kelly: 2nd [job 010rose] (standard input) 1635 bytes mary: 3rd [job 011rose] /home/orchid/mary/research/venus/alpha-regio/mapping 78519 bytes </verb></tscreen> <sect1><heading>Removing Jobs<label id="printing:lprm"></heading> <p> If you change your mind about printing a job, you can remove the job from the queue with the <tt/lprm/ command. Often, you can even use <tt/lprm/ to remove an active job, but some or all of the job might still get printed. To remove a job from the default printer, first use <tt/lpq/ to find the job number. Then type <tscreen> <tt/lprm <it/job-number// </tscreen> To remove the job from a specific printer, add the <tt/-P/ option. The following command removes job number 10 from the queue for the printer <tt/bamboo/: <tscreen><verb> lprm -P bamboo 10 </verb></tscreen> The <tt/lprm/ command has a few shortcuts: <descrip> <tag/lprm -/ Removes all jobs (for the default printer) belonging to you. <tag/lprm <it/user// Removes all jobs (for the default printer) belonging to <it/user/. The superuser can remove other users' jobs; you can remove only your own jobs. <tag/lprm/ With no job number, user name, or ``<tt/-/'' appearing on the command line, <tt/lprm/ removes the currently active job on the default printer, if it belongs to you. The superuser can remove any active job. </descrip> Just use the <tt/-P/ option with the above shortcuts to operate on a specific printer instead of the default. For example, the following command removes all jobs for the current user in the queue for the printer named <tt/rattan/: <tscreen><verb> lprm -P rattan - </verb></tscreen> <em/Note:/ If you're working in a networked environment, <tt/lprm/ will let you remove jobs only from the host from which the jobs were submitted, even if the same printer is available from other hosts. The following command sequence demonstrates this: <code> rose% lpr -P rattan myfile rose% rlogin orchid orchid% lpq -P rattan Rank Owner Job Files Total Size active seeyan 12 ... 49123 bytes 2nd kelly 13 myfile 12 bytes orchid% lprm -P rattan 13 rose: Permission denied orchid% logout rose% lprm -P rattan 13 dfA013rose dequeued cfA013rose dequeued rose% </code> <sect1><heading>Beyond Plain Text: Printing Options<label id="printing:lpr:options"></heading> <p> The <tt/lpr/ command supports a number of options that control formatting text, converting graphic and other file formats, producing multiple copies, handling of the job, and more. This section describes the options. <sect2><heading>Formatting and Conversion Options<label id="printing:lpr:options:format"></heading> <p> The following <tt/lpr/ options control formatting of the files in the job. Use these options if the job doesn't contain plain text or if you want plain text formatted through the <tt/pr/ utility. For example, the following command prints a DVI file (from the TeX typesetting system) named <tt/fish-report.dvi/ to the printer named <tt/bamboo/: <tscreen><verb> lpr -P bamboo -d fish-report.dvi </verb></tscreen> These options apply to every file in the job, so you can't mix (say) DVI and ditroff files together in a job. Instead, submit the files as separate jobs, using a different conversion option for each job. <em/Note:/ All of these options except <tt/-p/ and <tt/-T/ require conversion filters installed for the destination printer. For example, the <tt/-d/ option requires the DVI conversion filter. Section <ref id="printing:advanced:convfilters" name="Conversion Filters"> gives details. <descrip> <tag/<tt/-c// Print cifplot files. <tag/<tt/-d// Print DVI files. <tag/<tt/-f// Print FORTRAN text files. <tag/<tt/-g// Print plot data. <tag/<tt/-i <it/number/// Indent the output by <it/number/ columns; if you omit <it/number/, indent by 8 columns. This option works only with certain conversion filters. <em/Note:/ Don't put any space between the <tt/-i/ and the number. <tag/<tt/-l// Print literal text data, including control characters. - <tag/<tt/-n// Print ditroff (device indepdendent troff) data. + <tag/<tt/-n// Print ditroff (device independent troff) data. <tag/-p/ Format plain text with <tt/pr/ before printing. See pr(1) for more information. <tag/<tt/-T <it/title/// Use <it/title/ on the <tt/pr/ header instead of the file name. This option has effect only when used with the <tt/-p/ option. <tag/<tt/-t// Print troff data. <tag/<tt/-v// Print raster data. </descrip> Here's an example: this command prints a nicely formatted version of the <tt/ls/ manual page on the default printer: <tscreen><verb> zcat /usr/share/man/man1/ls.1.gz | troff -t -man | lpr -t </verb></tscreen> The <tt/zcat/ command uncompresses the source of the <tt/ls/ manual page and passes it to the <tt/troff/ command, which formats that source and makes GNU troff output and passes it to <tt/lpr/, which submits the job to the LPD spooler. Because we used the <tt/-t/ option to <tt/lpr/, the spooler will convert the GNU troff output into a format the default printer can understand when it prints the job. <sect2><heading>Job Handling Options<label id="printing:lpr:options:job-handling"></heading> <p> The following options to <tt/lpr/ tell LPD to handle the job specially: <descrip> <tag/-# <it/copies// Produce a number of <it/copies/ of each file in the job instead of just one copy. An administrator may disable this option to reduce printer wear-and-tear and encourage photocopier usage. See section <ref id="printing:advanced:restricting:copies" name="Restricting Multiple Copies">. <p> This example prints three copies of <tt/parser.c/ followed by three copies of <tt/parser.h/ to the default printer: <tscreen><verb> lpr -#3 parser.c parser.h </verb></tscreen> <tag/-m/ Send mail after completing the print job. With this option, the LPD system will send mail to your account when it finishes handling your job. In its message, it will tell you if the job completed successfully or if there was an error, and (often) what the error was. <tag/-s/ Don't copy the files to the spooling directory, but make symbolic links to them instead. If you're printing a large job, you probably want to use this option. It saves space in the spooling directory (your job might overflow the free space on the filesystem where the spooling directory resides). It saves time as well since LPD won't have to copy each and every byte of your job to the spooling directory. There is a drawback, though: since LPD will refer to the original files directly, you can't modify or remove them until they have been printed. <em/Note:/ If you're printing to a remote printer, LPD will eventually have to copy files from the local host to the remote host, so the <tt/-s/ option will save space only on the local spooling directory, not the remote. It's still useful, though. <tag/-r/ Remove the files in the job after copying them to the spooling directory, or after printing them with the <tt/-s/ option. Be careful with this option! </descrip> <sect2><heading>Header Page Options<label id="printing:lpr:options:misc"></heading> <p> These options to <tt/lpr/ adjust the text that normally appears on a job's header page. If header pages are suppressed for the destination printer, these options have no effect. See section <ref name="Header Pages" id="printing:advanced:header-pages"> for information about setting up header pages. <descrip> <tag/-C <it/text// Replace the hostname on the header page with <it/text/. The hostname is normally the name of the host from which the job was submitted. <tag/-J <it/text// Replace the job name on the header page with <it/text/. The job name is normally the name of the first file of the job, or ``stdin'' if you're printing standard input. <tag/-h/ Do not print any header page. <em/Note:/ At some sites, this option may have no effect due to the way header pages are generated. See <ref name="Header Pages" id="printing:advanced:header-pages"> for details. </descrip> <sect1><heading>Administrating Printers<label id="printing:lpc"></heading> <p> As an administrator for your printers, you've had to install, set up, and test them. Using the <tt/lpc/ command, you can interact with your printers in yet more ways. With <tt/lpc/, you can <itemize> <item>Start and stop the printers <item>Enable and disable their queues <item>Rearrange the order of the jobs in each queue. </itemize> First, a note about terminology: if a printer is <em/stopped/, it won't print anything in its queue. Users can still submit jobs, which will wait in the queue until the printer is <em/started/ or the queue is cleared. If a queue is <em/disabled/, no user (except root) can submit jobs for the printer. An <em/enabled/ queue allows jobs to be submitted. A printer can be <em/started/ for a disabled queue, in which case it'll continue to print jobs in the queue until the queue is empty. In general, you have to have root privileges to use the <tt/lpc/ command. Ordinary users can use the <tt/lpc/ command to get printer status and to restart a hung printer only. Here is a summary of the <tt/lpc/ commands. Most of the commands takes a <it/printer-name/ argument to tell on which printer to operate. You can use <tt/all/ for the <it/printer-name/ to mean all printers listed in <tt>/etc/printcap</tt>. <descrip> <tag/<tt/abort <it/printer-name/// Cancel the current job and stop the printer. Users can still submit jobs if the queue's enabled. <tag/<tt/clean <it/printer-name/// Remove old files from the printer's spooling directory. Occasionally, the files that make up a job aren't properly removed by LPD, particularly if there have been errors during printing or a lot of administrative activity. This command finds files that don't belong in the spooling directory and removes them. <tag/<tt/disable <it/printer-name/// Disable queuing of new jobs. If the printer's started, it will continue to print any jobs remaining in the queue. The superuser (root) can always submit jobs, even to a disabled queue. This command is useful while you're testing a new printer or filter installation: disable the queue and submit jobs as root. Other users won't be able to - submit jobs until you complete your testing and reenable + submit jobs until you complete your testing and re-enable the queue with the <tt/enable/ command. <tag/<tt/down <it/printer-name/ <it/message.../// Take a printer down. Equivalent to <tt/disable/ followed by <tt/stop/. The <it/message/ appears as the printer's status whenever a user checks the printer's queue with <tt/lpq/ or status with <tt/lpc status/. <tag/<tt/enable <it/printer-name/// Enable the queue for a printer. Users can submit jobs but the printer won't print anything until it's started. <tag/<tt/help <it/command-name/// Print help on the command <it/command-name/. With no <it/command-name/, print a summary of the commands available. <tag/<tt/restart <it/printer-name/// Start the printer. Ordinary users can use this command if some extraordinary circumstance hangs LPD, but they can't start a printer stopped with either the <tt/stop/ or <tt/down/ commands. The <tt/restart/ command is equivalent to <tt/abort/ followed by <tt/start/. <tag/<tt/start <it/printer-name/// Start the printer. The printer will print jobs in its queue. <tag/<tt/stop <it/printer-name/// Stop the printer. The printer will finish the current job and won't print anything else in its queue. Even though the printer is stopped, users can still submit jobs to an enabled queue. <tag/<tt/topq <it/printer-name/ <it/job-or-username.../// Rearrange the queue for <it/printer-name/ by placing the jobs with the listed <it/job/ numbers or the jobs belonging to <it/username/ at the top of the queue. For this command, you can't use <tt/all/ as the <it/printer-name/. <tag/<tt/up <it/printer-name/// Bring a printer up; the opposite of the <tt/down/ command. Equivalent to <tt/start/ followed by <tt/enable/. </descrip> <tt/lpc/ accepts the above commands on the command line. If you don't enter any commands, <tt/lpc/ enters an interactive mode, where you can enter commands until you type <tt/exit/, <tt/quit/, or end-of-file. <sect><heading>Advanced Printer Setup<label id="printing:advanced"></heading> <p> This section describes filters for printing specially formatted files, header pages, printing across networks, and restricting and accounting for printer usage. <sect1><heading>Filters<label id="printing:advanced:filter-intro"></heading> <p> Although LPD handles network protocols, queuing, access control, and other aspects of printing, most of the <em/real/ work happens in the <em/filters/. Filters are programs that communicate with the printer and handle its device dependencies and special requirements. In the simple printer setup, we installed a plain text filter---an extremely simple one that should work with most printers (section <ref id="printing:textfilter" name="Installing the Text Filter">). However, in order to take advantage of format conversion, printer accounting, specific printer quirks, and so on, you should understand how filters work. It will ultimately be the filter's responsibility to handle these aspects. And the bad news is that most of the time <em/you/ have to provide filters yourself. The good news is that many are generally available; when they're not, they're usually easy to write. Also, FreeBSD comes with one, <tt>/usr/libexec/lpr/lpf</tt>, that works with many printers that can print plain text. (It handles backspacing and tabs in the file, and does accounting, but that's about all it does.) There are also several filters and filter components in the FreeBSD ports collection. Here's what you'll find in this section: <itemize> <item>Section <ref id="printing:advanced:filters" name="How Fitlers Work">, tries to give an overview of a filter's role in the printing process. You should read this section to get an understanding of what's happening ``under the hood'' when LPD uses filters. This knowledge could help you anticipate and debug problems you might encounter as you install more and more filters on each of your printers. <item>LPD expects every printer to be able to print plain text by default. This presents a problem for PostScript (or other language-based printers) which can't directly print plain text. Section <ref - id="printing:advanced:if-conversion" name="Accomodating + id="printing:advanced:if-conversion" name="Accommodating Plain Text Jobs on PostScript Printers"> tells you what you should do to overcome this problem. I recommend reading this section if you have a PostScript printer. <item>PostScript is a popular output format for many programs. Even some people (myself included) write PostScript code directly. But PostScript printers are expensive. Section <ref id="printing:advanced:ps" name="Simulating PostScript on Non-PostScript Printers"> tells how you can further modify a printer's text filter to accept and print PostScript data on a <em/non-PostScript/ printer. I recommend reading this section if you don't have a PostScript printer. <item>Section <ref id="printing:advanced:convfilters" name="Conversion Filters"> tells about a way you can automate the conversion of specific file formats, such as graphic or typesetting data, into formats your printer can understand. After reading this section, you should be able to set up your printers such that users can type <tt/lpr -t/ to print troff data, or <tt/lpr -d/ to print TeX DVI data, or <tt/lpr -v/ to print raster image data, and so forth. I recommend reading this section. <item>Section <ref id="printing:advanced:of" name="Output Filters"> tells all about a not often used feature of LPD: output filters. Unless you're printing header pages (see <ref id="printing:advanced:header-pages" name="Header Pages">), you can probably skip that section altogether. <item>Section <ref id="printing:advanced:lpf" name="lpf: a Text Filter"> describes <tt/lpf/, a fairly complete if simple text filter for line printers (and laser printers that act like line printers) that comes with FreeBSD. If you need a quick way to get printer accounting working for plain text, or if you have a printer which emits smoke when it sees backspace characters, you should definitely consider <tt/lpf/. </itemize> <sect2><heading>How Filters Work<label id="printing:advanced:filters"></heading> <p> As mentioned before, a filter is an executable program started by LPD to handle the device-dependent part of communicating with the printer. When LPD wants to print a file in a job, it starts a filter program. It sets the filter's standard input to the file to print, its standard output to the printer, and its standard error to the error logging file (specified in the <tt/lf/ capability in <tt>/etc/printcap</tt>, or <tt>/dev/console</tt> by default). Which filter LPD starts and the filter's arguments depend on what's listed in the <tt>/etc/printcap</tt> file and what arguments the user specified for the job on the <tt/lpr/ command line. For example, if the user typed <tt/lpr -t/, LPD would start the troff filter, listed in the <tt/tf/ capability for the destination printer. If the user wanted to print plain text, it would start the <tt/if/ filter (this is mostly true: see <ref id="printing:advanced:of" name="Output Filters"> for details). There are three kinds filters you can specify in <tt>/etc/printcap</tt>: <itemize> <item>The <em/text filter/, confusingly called the <em/input filter/ in LPD documentation, handles regular text printing. Think of it as the default filter. LPD expects every printer to be able to print plain text by default, and it's the text filter's job to make sure backspaces, tabs, or other special characters don't confuse the printer. If you're in an environment where you have to account for printer usage, the text filter must also account for pages printed, usually by counting the number of lines printed and comparing that to the number of lines per page the printer supports. The text filter is started with the following argument list: <tscreen> <tt>[-c] -w<it/width/ -l<it/length/ -i<it/indent/ -n <it/login/ -h <it/host/ <it/acct-file/</tt> </tscreen> where <descrip> <tag/<tt/-c// appears if the job's submitted with <tt/lpr -l/ <tag/<tt/<it/width/// is the value from the <tt/pw/ (page width) capability specified in <tt>/etc/printcap</tt>, default 132 <tag/<tt/<it/length/// is the value from the <tt/pl/ (page length) capability, default 66 <tag/<tt/<it/indent/// is the amount of the indentation from <tt/lpr -i/, default 0 <tag/<tt/<it/login/// is the account name of the user printing the file <tag/<tt/<it/host/// is the host name from which the job was submitted <tag/<tt/<it/acct-file/// is the name of the accounting file from the <tt/af/ capability. </descrip> <item>A <em/conversion filter/ converts a specific file format into one the printer can render onto paper. For example, ditroff typesetting data can't be directly printed, but you can install a conversion filter for ditroff files to convert the ditroff data into a form the printer can digest and print. Section <ref id="printing:advanced:convfilters" name="Conversion Filters"> tells all about them. Conversion filters also need to do accounting, if you need printer accounting. Conversion filters are started with the following arguments: <tscreen> <tt>-x<it/pixel-width/ -y<it/pixel-height/ -n <it/login/ -h <it/host/ <it/acct-file/</tt> </tscreen> where <it/pixel-width/ is the value from the <tt/px/ capability (default 0) and <it/pixel-height/ is the value from the <tt/py/ capability (default 0). <item>The <em/output filter/ is used only if there's no text filter, or if header pages are enabled. In my experience, output filters are rarely used. Section <ref id="printing:advanced:of" name="Output Filters"> describe them. There are only two arguments to an output filter: <tscreen> <tt>-w<it/width/ -l<it/length/</tt> </tscreen> which are identical to the text filters <tt/-w/ and <tt/-l/ arguments. </itemize> Filters should also <em/exit/ with the following exit status: <descrip> <tag/exit 0/ If the filter printed the file successfully. <tag/exit 1/ If the filter failed to print the file but wants LPD to try to print the file again. LPD will restart a filter if it exits with this status. <tag/exit 2/ If the filter failed to print the file and doesn't want LPD to try again. LPD will throw out the file. </descrip> The text filter that comes with the FreeBSD release, <tt>/usr/libexec/lpr/lpf</tt>, takes advantage of the page width and length arguments to determine when to send a form feed and how to account for printer usage. It uses the login, host, and accounting file arguments to make the accounting entries. If you're shopping for filters, see if they're LPD-compatible. If they are, they must support the argument lists described above. If you plan on writing filters for general use, then have them support the same argument lists and exit codes. <sect2><heading>Accommodating Plain Text Jobs on PostScript Printers <label id="printing:advanced:if-conversion"></heading> <p> If you're the only user of your computer and PostScript (or other language-based) printer, and you promise to never send plain text to your printer and to never use features of various programs that will want to send plain text to your printer, then you don't need to worry about this section at all. But, if you would like to send both PostScript and plain text jobs to the printer, then you're urged to augment your printer setup. To do so, we have the text filter detect if the arriving job is plain text or PostScript. All PostScript jobs must start with <tt/%!/ (for other printer languages, see your printer documentation). If those are the first two characters in the job, we have PostScript, and can pass the rest of the job directly. If those aren't the first two characters in the file, then the filter will convert the text into PostScript and print the result. How do we do this? If you've got a serial printer, a great way to do it is to install <tt/lprps/. <tt/lprps/ is a PostScript printer filter which performs two-way communication with the printer. It updates the printer's status file with verbose information from the printer, so users and administrators can see exactly what the state of the printer is (such as ``toner low'' or ``paper jam''). But more importantly, it includes a program called <tt/psif/ which detects whether the incoming job is plain text and calls <tt/textps/ (another program that comes with <tt/lprps/) to convert it to PostScript. It then uses <tt/lprps/ to send the job to the printer. <tt/lprps/ should be part of the FreeBSD ports collection (see <ref id="ports" name="The Ports Collection">); if not, it should be shortly. You can fetch, build and install it yourself, of course. After installing <tt/lprps/, just specify the pathname to the <tt/psif/ program that's part of <tt/lprps/. If you installed <tt/lprps/ from the ports collection, use the following in the serial PostScript printer's entry in <tt>/etc/printcap</tt>: <tscreen><verb> :if=/usr/local/libexec/psif: </verb></tscreen> You should also specify the <tt/rw/ capability; that tells LPD to open the printer in read-write mode. - If you have a parralel PostScript printer (and therefore + If you have a parallel PostScript printer (and therefore can't use two-way communication with the printer, which <tt/lprps/ needs), you can use the following shell script as the text filter: <code> #!/bin/sh # # psif - Print PostScript or plain text on a PostScript printer # Script version; NOT the version that comes with lprps # Installed in /usr/local/libexec/psif # read first_line first_two_chars=`expr "$first_line" : '\(..\)'` if [ "$first_two_chars" = "%!" ]; then # # PostScript job, print it. # echo $first_line &ero;&ero; cat &ero;&ero; printf "\004" &ero;&ero; exit 0 exit 2 else # # Plain text, convert it, then print it. # ( echo $first_line; cat ) | /usr/local/bin/textps &ero;&ero; printf "\004" &ero;&ero; exit 0 exit 2 fi </code> In the above script, <tt/textps/ is a program we installed separately to convert plain text to PostScript. You can use any text-to-PostScript program you wish. The FreeBSD ports collection (see <ref id="ports" name="The Ports Collection">) includes a full featured text-to-PostScript program called <tt/a2ps/ that you might want to investigate. <sect2><heading>Simulating PostScript on Non-PostScript Printers <label id="printing:advanced:ps"></heading> <p> PostScript is the <it/de facto/ standard for high quality typesetting and printing. PostScript is, however, an <em/expensive/ standard. Thankfully, Alladin - Enterprises has a free PostScript workalike called + Enterprises has a free PostScript work-alike called <it/Ghostscript/ that runs with FreeBSD. Ghostscript can read most PostScript files and can render their pages onto a variety of devices, including many brands of non-PostScript printers. By installing Ghostscript and using a special text filter for your printer, you can make your non-PostScript printer act like a real PostScript printer. Ghostscript should be in the FreeBSD ports collection, if you'd like to install it from there. You can fetch, build, and install it quite easily yourself, as well. To simulate PostScript, we have the text filter detect if it's printing a PostScript file. If it's not, then the filter will pass the file directly to the printer; otherwise, it will use Ghostscript to first convert the file into a format the printer will understand. Here's an example: the following script is a text filter for Hewlett Packard DeskJet 500 printers. For other printers, substitute the <tt/-sDEVICE/ argument to the <tt/gs/ (Ghostscript) command. (Type <tt/gs -h/ to get a list of devices the current installation of Ghostscript supports.) <code> #!/bin/sh # # ifhp - Print Ghostscript-simulated PostScript on a DesJet 500 # Installed in /usr/local/libexec/hpif # # Treat LF as CR+LF: # printf "\033&ero;k2G" || exit 2 # # Read first two characters of the file # read first_line first_two_chars=`expr "$first_line" : '\(..\)'` if [ "$first_two_chars" = "%!" ]; then # # It's PostScript; use Ghostscript to scan-convert and print it # /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \ &ero;&ero; exit 0 else # # Plain text or HP/PCL, so just print it directly; print a form # at the end to eject the last page. # echo $first_line &ero;&ero; cat &ero;&ero; printf "\f" &ero;&ero; exit 2 fi exit 2 </code> Finally, you need to notify LPD of the filter via the <tt/if/ capability: <tscreen><verb> :if=/usr/local/libexec/hpif: </verb></tscreen> That's it. You can type <tt/lpr plain.text/ and <tt/lpr whatever.ps/ and both should print successfully. <sect2><heading>Conversion Filters<label id="printing:advanced:convfilters"></heading> <p> After completing the simple setup described in <ref name="Simple Printer Setup" id="printing:simple">, the first thing you'll probably want to do is install conversion filters for your favorite file formats (besides plain ASCII text). <sect3><heading>Why Install Conversion Filters?</heading> <p> Conversion filters make printing various kinds of files easy. As an example, suppose we do a lot of work with the TeX typesetting system, and we have a PostScript printer. Every time we generate a DVI file from TeX, we can't print it directly until we convert the DVI file into PostScript. The command sequence goes like this: <tscreen><verb> dvips seaweed-analysis.dvi lpr seaweed-analysis.ps </verb></tscreen> By installing a conversion filter for DVI files, we can skip the hand conversion step each time by having LPD do it for us. Now, each time we get a DVI file, we're just one step away from printing it: <tscreen><verb> lpr -d seaweed-analysis.dvi </verb></tscreen> We got LPD to do the DVI file conversion for us by specifying the <tt/-d/ option. Section <ref id="printing:lpr:options:format" name="Formatting and Conversion Options"> lists the conversion options. For each of the conversion options you want a printer to support, install a <em/conversion filter/ and specify its pathname in <tt>/etc/printcap</tt>. A conversion filter is like the text filter for the simple printer setup (see section <ref id="printing:textfilter" name="Installing the Text Filter">) except that instead of printing plain text, the filter converts the file into a format the printer can understand. <sect3><heading>Which Conversions Filters Should I Install? </heading> <p> You should install the conversion filters you expect to use. If you print a lot of DVI data, then a DVI conversion filter is in order. If you've got plenty of troff to print out, then you probably want a troff filter. The following table summarizes the filters that LPD works with, their capability entries for the <tt>/etc/printcap</tt> file, and how to invoke them with the <tt/lpr/ command: <code> /etc/printcap File type Capability lpr option ------------ ------------- ---------- cifplot cf -c DVI df -d plot gf -g ditroff nf -n FORTRAN text rf -f troff tf -t raster vf -v plain text if none, -p, or -l </code> In our example, using <tt/lpr -d/ means the printer needs a <tt/df/ capability in its entry in <tt>/etc/printcap</tt>. Despite what others might contend, formats like FORTRAN text and plot are probably obsolete. At your site, you can give new meanings to these or any of the formatting options just by installing custom filters. For example, suppose you'd like to directly print Printerleaf files (files from the Interleaf desktop publishing program), but will never print plot files. You could install a Printerleaf conversion filter under the <tt/gf/ capability and then educate your users that <tt/lpr -g/ mean ``print Printerleaf files.'' <sect3><heading>Installing Conversion Filters</heading> <p> Since conversion filters are programs you install outside of the base FreeBSD installation, they should probably go under <tt>/usr/local</tt>. The directory <tt>/usr/local/libexec</tt> is a popular location, since they they're specialized programs that only LPD will run; regular users shouldn't ever need to run them. To enable a conversion filter, specify its pathname under the appropriate capability for the destination printer in <tt>/etc/printcap</tt>. In our example, we'll add the DVI conversion filter to the entry for the printer named <tt/bamboo/. Here's the example <tt>/etc/printcap</tt> file again, with the new <tt/df/ capability for the printer <tt/bamboo/ <code> # # /etc/printcap for host rose - added df filter for bamboo # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:rw:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: </code> The DVI filter is a shell script named <tt>/usr/local/libexec/psdf</tt>. Here's that script: <code> #!bin/sh # # DVI to PostScript printer filter # Installed in /usr/local/libexec/psdf # # Invoked by lpd when user runs lpr -d # exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" </code> This script runs <tt/dvips/ in filter mode (the <tt/-f/ argument) on standard input, which is the job to print. It then starts the PostScript printer filter <tt/lprps/ (see section <ref id="printing:advanced:if-conversion" - name="Accomodating Plain Text Jobs on PostScript + name="Accommodating Plain Text Jobs on PostScript Printers">) with the arguments LPD passed to this script. <tt/lprps/ will use those arguments to account for the pages printed. <sect3><heading>More Conversion Filter Examples</heading> <p> Since there's no fixed set of steps to install conversion filters, let me instead provide more examples. Use these as guidance to making your own filters. Use them directly, if appropriate. This example script is a raster (well, GIF file, actually) conversion filter for a Hewlett Packard LaserJet III-Si printer: <code> #!/bin/sh # # hpvf - Convert GIF files into HP/PCL, then print # Installed in /usr/local/libexec/hpvf PATH=/usr/X11R6/bin:$PATH; export PATH giftopnm | ppmtopgm | pgmtopbm | pbmtolj -resolution 300 \ && exit 0 \ || exit 2 </code> It works by converting the GIF file into a portable anymap, converting that into a portable graymap, converting that into a portable bitmap, and converting that into LaserJet/PCL-compatible data. Here's the <tt>/etc/printcap</tt> file with an entry for a printer using the above filter: <code> # # /etc/printcap for host orchid # teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sh:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif:\ :vf=/usr/local/libexec/hpvf: </code> The following script is a conversion filter for troff data from the groff typesetting system for the PostScript printer named <tt/bamboo/: <code> #!/bin/sh # # pstf - Convert groff's troff data into PS, then print. # Installed in /usr/local/libexec/pstf # exec grops | /usr/local/libexec/lprps "$@" </code> The above script makes use of <tt/lprps/ again to handle the communication with the printer. If the printer were on a parallel port, we'd use this script instead: <code> #!/bin/sh # # pstf - Convert groff's troff data into PS, then print. # Installed in /usr/local/libexec/pstf # exec grops </code> That's it. Here's the entry we need to add to <tt>/etc/printcap</tt> to enable the filter: <tscreen><verb> :tf=/usr/local/libexec/pstf: </verb></tscreen> Here's an example that might make old hands at FORTRAN blush. It's a FORTRAN-text filter for any printer that can directly print plain text. We'll install it for the printer <tt/teak/: <code> #!/bin/sh # # hprf - FORTRAN text filter for LaserJet 3si: # Installed in /usr/local/libexec/hprf # printf "\033&ero;k2G" &ero;&ero; fpr &ero;&ero; printf "\f" &ero;&ero; exit 0 exit 2 </code> And we'll add this line to the <tt>/etc/printcap</tt> for the printer <tt/teak/ to enable this filter: <tscreen><verb> :rf=/usr/local/libexec/hprf: </verb></tscreen> Here's one final, somewhat complex example. We'll add a DVI filter to the LaserJet printer <tt/teak/ introduced earlier. First, the easy part: updating <tt>/etc/printcap</tt> with the location of the DVI filter: <tscreen><verb> :df=/usr/local/libexec/hpdf: </verb></tscreen> Now, for the hard part: making the filter. For that, we need a DVI-to-LaserJet/PCL conversion program. The FreeBSD ports collection (see <ref id="ports" name="The Ports Collection">) has one: <tt/dvi2xx/ is the name of the package. Installing this package gives us the program we need, <tt/dvilj2p/, which converts DVI into LaserJet IIp, LaserJet III, and LaserJet 2000 compatible codes. <tt/dvilj2p/ makes the filter <tt/hpdf/ quite complex since <tt/dvilj2p/ can't read from standard input. It wants to work with a filename. What's worse, the filename has to end in <tt/.dvi/ so using <tt>/dev/fd/0</tt> for standard input is problematic. We can get around that problem by linking (symbolically) a temporary file name (one that ends in <tt/.dvi/) to <tt>/dev/fd/0</tt>, thereby forcing <tt/dvilj2p/ to read from standard input. The only other fly in the ointment is the fact that we can't use /tmp for the temporary link. Symbolic links are owned by user and group <tt/bin/. The filter runs as user <tt/daemon/. And the <tt>/tmp</tt> directory has the sticky bit set. The filter can create the link, but it won't be able clean up when done and remove it since the link will belong to a different user. Instead, the filter will make the symbolic link in the current working directory, which is the spooling directory (specified by the <tt/sd/ capability in <tt>/etc/printcap</tt>). This is a perfect place for filters to do their work, especially since there's (sometimes) more free disk space in the spooling directory than under <tt>/tmp</tt>. Here, finally, is the filter: <code> #!/bin/sh # # hpdf - Print DVI data on HP/PCL printer # Installed in /usr/local/libexec/hpdf PATH=/usr/local/bin:$PATH; export PATH # # Define a function to clean up our temporary files. These exist # in the current directory, which will be the spooling directory # for the printer. # cleanup() { rm -f hpdf$$.dvi } # # Define a function to handle fatal errors: print the given message # and exit 2. Exiting with 2 tells LPD to don't try to reprint the # job. # fatal() { echo "$@" 1>&ero;2 cleanup exit 2 } # # If user removes the job, LPD will send SIGINT, so trap SIGINT # (and a few other signals) to clean up after ourselves. # trap cleanup 1 2 15 # # Make sure we're not colliding with any existing files. # cleanup # # Link the DVI input file to standard input (the file to print). # ln -s /dev/fd/0 hpdf$$.dvi || fatal "Cannot symlink /dev/fd/0" # # Make LF = CR+LF # printf "\033&ero;k2G" || fatal "Cannot initialize printer" # # Convert and print. Return value from dvilj2p doesn't seem to be # reliable, so we ignore it. # dvilj2p -M1 -q -e- dfhp$$.dvi # # Clean up and exit # cleanup exit 0 </code> <sect3><heading>Automated Conversion: An Alternative To Conversion Filters <label id="printing:advanced:autoconv"></heading> <p> All these conversion filters accomplish a lot for your printing environment, but at the cost forcing the user to specify (on the <tt/lpr/ command line) which one to use. If your users aren't particularly computer literate, having to specify a filter option will become annoying. What's worse, though, is that an incorrectly specified filter option may run a filter on the wrong type of file and cause your printer to spew out hundreds of sheets of paper. Rather than install conversion filters at all, you might want to try having the text filter (since it's the default filter) detect the type of file it's asked to print and then automatically run the right conversion filter. Tools such as <tt/file/ can be of help here. Of course, it'll be hard to determine the differences between <em/some/ file types---and, of course, you can still provide conversion filters just for them. The FreeBSD ports collection has a text filter that performs automatic conversion called <tt/apsfilter/. It can detect plain text, PostScript, and DVI files, run the proper conversions, and print. <sect2><heading>Output Filters<label id="printing:advanced:of"></heading> <p> The LPD spooling system supports one other type of filter that we've not yet explored: an output filter. An output filter is intended for printing plain text only, like the text filter, but with many simplifications. If you're using an output filter but no text filter, then <itemize> <item>LPD starts an output filter once for the entire job instead of once for each file in the job. <item>LPD doesn't make any provision to identify the start or the end of files within the job for the output filter. <item>LPD doesn't pass the user's login or host to the filter, so it's not intended to do accounting. In fact, it gets only two arguments: <tscreen> <tt>-w<it/width/ -l<it/length/</tt> </tscreen> where <it/width/ is from the <tt/pw/ capability and <it/length/ is from the <tt/pl/ capability for the printer in question. </itemize> Don't be seduced by an output filter's simplicity. If you'd like each file in a job to start on a different page an output filter <em/won't work/. Use a text filter (also known as an input filter); see section <ref id="printing:textfilter" name="Installing the Text Filter">. Furthermore, an output filter is actually <em/more complex/ in that it has to examine the byte stream being sent to it for special flag characters and must send signals to itself on behalf of LPD. However, an output filter is <em/necessary/ if you want header pages and need to send escape sequences or other initialization strings to be able to print the header page. (But it's also <em/futile/ if you want to charge header pages to the requesting user's account, since LPD doesn't give any user or host information to the output filter.) On a single printer, LPD allows both an output filter and text or other filters. In such cases, LPD will start the output filter to print the header page (see section <ref id="printing:advanced:header-pages" name="Header Pages">) only. LPD then expects the output filter to <em/stop itself/ by sending two bytes to the filter: ASCII 031 followed by ASCII 001. When an output filter sees these two bytes (031, 001), it should stop by sending SIGSTOP to itself. When LPD's done running other filters, it'll restart the output filter by sending SIGCONT to it. If there's an output filter but <em/no/ text filter and LPD is working on a plain text job, LPD uses the output filter to do the job. As stated before, the output filter will print each file of the job in sequence with no intervening form feeds or other paper advancement, and this is probably <em/not/ what you want. In almost all cases, you need a text filter. - The program <tt/lpf/, whch we introduced earlier as a text + The program <tt/lpf/, which we introduced earlier as a text filter, can also run as an output filter. If you need a quick-and-dirty output filter but don't want to write the byte detection and signal sending code, try <tt/lpf/. You can also wrap <tt/lpf/ in a shell script to handle any - intialization codes the printer might require. + initialization codes the printer might require. <sect2><heading><tt/lpf/: a Text Filter<label id="printing:advanced:lpf"></heading> <p> The program <tt>/usr/libexec/lpr/lpf</tt> that comes with FreeBSD binary distribution is a text filter (input filter) that can indent output (job submitted with <tt/lpr -i/), allow literal characters to pass (job submitted with <tt/lpr -l/), adjust the printing position for backspaces and tabs in the job, and account for pages printed. It can also act like an output filter. <tt/lpf/ is suitable for many printing environments. And although it has no capability to send initialization sequences to a printer, it's easy to write a shell script to do the needed initialization and then execute <tt/lpf/. In order for <tt/lpf/ to do page accounting correctly, it needs correct values filled in for the <tt/pw/ and <tt/pl/ capabilities in the <tt>/etc/printcap</tt> file. It uses these values to determine how much text can fit on a page and how many pages were in a user's job. For more information on printer accounting, see <ref id="printing:advanced:acct" name="Accounting for Printer Usage">. <sect1><heading>Header Pages<label id="printing:advanced:header-pages"></heading> <p> If you've got <em/lots/ of users, all of them using various printers, then you probably want to consider <em/header pages/ as a necessary evil. Header pages, also known as <em/banner/ or <em/burst pages/ identify to whom jobs belong after they're printed. They're usually printed in large, bold letters, perhaps with decorative borders, so that in a stack of printouts they stand out from the real documents that comprise users' jobs. They enable users to locate their jobs quickly. The obvious drawback to a header page is that it's yet one more sheet that has to be printed for every job, their ephemeral usefulness lasting not more than a few minutes, ultimately finding themselves in a recycling bin or rubbish heap. (Note that header pages go with each job, not each file in a job, so the paper waste might not be that bad.) The LPD system can provide header pages automatically for your printouts <em/if/ your printer can directly print plain text. If you've got a PostScript printer, you'll need an external program to generate the header page; see <ref id="printing:advanced:header-pages:ps" name="Header Pages on PostScript Printers">. <sect2><heading>Enabling Header Pages<label id="printing:advanced:header-pages:enabling"></heading> <p> In the <ref id="printing:simple" name="Simple Printer Setup">, we turned off header pages by specifying <tt/sh/ (meaning ``suppress header'') in the <tt>/etc/printcap</tt> file. To enable header pages for a printer, just remove the <tt/sh/ capability. Sounds too easy, right? You're right. You <em/might/ have to provide an output filter to send initialization strings to the printer. Here's an example output filter for Hewlett Packard PCL-compatible printers: <code> #!/bin/sh # # hpof - Output filter for Hewlett Packard PCL-compatible printers # Installed in /usr/local/libexec/hpof printf "\033&ero;k2G" || exit 2 exec /usr/libexec/lpr/lpf </code> Specify the path to the output filter in the <tt/of/ capability. See <ref id="printing:advanced:of" name="Output Filters"> for more information. Here's an example <tt>/etc/printcap</tt> file for the printer <tt/teak/ that we introduced earlier; we enabled header pages and added the above output filter: <code> # # /etc/printcap for host orchid # teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif:\ :vf=/usr/local/libexec/hpvf:\ :of=/usr/local/libexec/hpof: </code> Now, when users print jobs to <tt/teak/, they get a header page with each job. If users want to spend time searching for their printouts, they can suppress header pages by submitting the job with <tt/lpr -h/; see <ref id="printing:lpr:options:misc" name="Header Page Options"> for more <tt/lpr/ options. <tt/Note:/ LPD prints a form feed character after the header page. If your printer uses a different character or sequence of characters to eject a page, specify them with the <tt/ff/ capability in <tt>/etc/printcap</tt>. <sect2><heading>Controlling Header Pages<label id="printing:advanced:header-pages:controlling"></heading> <p> By enabling header pages, LPD will produce a <em/long header/, a full page of large letters identifying the user, host, and job. Here's an example (kelly printed the job named outline from host rose): <tscreen><verb> k ll ll k l l k l l k k eeee l l y y k k e e l l y y k k eeeeee l l y y kk k e l l y y k k e e l l y yy k k eeee lll lll yyy y y y y yyyy ll t l i t l oooo u u ttttt l ii n nnn eeee o o u u t l i nn n e e o o u u t l i n n eeeeee o o u u t l i n n e o o u uu t t l i n n e e oooo uuu u tt lll iii n n eeee r rrr oooo ssss eeee rr r o o s s e e r o o ss eeeeee r o o ss e r o o s s e e r oooo ssss eeee Job: outline Date: Sun Sep 17 11:04:58 1995 </verb></tscreen> LPD appends a form feed after this text so the job starts on a new page (unless you've got <tt/sf/ (suppress form feeds) in the destination printer's entry in <tt>/etc/printcap</tt>). If you prefer, LPD can make a <em/short header/; specify <tt/sb/ (short banner) in the <tt>/etc/printcap</tt> file. The header page will look like this: <tscreen><verb> rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 </verb></tscreen> Also by default, LPD prints the header page first, then the job. To reverse that, specify <tt/hl/ (header last) in <tt>/etc/printcap</tt>. <sect2><heading>Accounting for Header Pages<label id="printing:advanced:header-pages:accounting"></heading> <p> Using LPD's built-in header pages enforces a particular paradigm when it comes to printer accounting: header pages must be <em/free of charge/. Why? Because the output filter is the only external program that will have control when the header page is printed that could do accounting, and it isn't provided with any <em/user or host/ information or an accounting file, so it has no idea whom to charge for printer use. It's also not enough to just ``add one page'' to the text filter or any of the conversion filters (which do have user and host information) since users can suppress header pages with <tt/lpr -h/. They could still be charged for header pages they didn't print. Basically, <tt/lpr -h/ will be the preferred option of environmentally-minded users, but you can't offer any incentive to use it. It's <em/still not enough/ to have each of the filters generate their own header pages (thereby being able to charge for them). If users wanted the option of suppressing the header pages with <tt/lpr -h/, they will still get them and be charged for them since LPD does not pass any knowledge of the <tt/-h/ option to any of the filters. So, what are your options? You can <itemize> <item>Accept LPD's paradigm and make header pages free. <item>Install an alternative to LPD, such as LPDng or PLP. Section <ref name="Alternatives to the Standard Spooler" id="printing:lpd-alternatives"> tells more about other spooling software you can substitute for LPD. <item>Write a <em/smart/ output filter. Normally, an output filter isn't meant to do anything more than initialize a printer or do some simple character conversion. It's suited for header pages and plain text jobs (when there's no text (input) filter). But, if there is a text filter for the plain text jobs, then LPD will start the output filter only for the header pages. And the output filter can parse the header page text that LPD generates to determine what user and host to charge for the header page. The only other problem with this method is that the output filter still doesn't know what accounting file to use (it's not passed the name of the file from the <tt/af/ capability), but if you have a well-known accounting file, you can hard-code that into the output filter. To facilitate the parsing step, use the <tt/sh/ (short header) capability in <tt>/etc/printcap</tt>. Then again, all that might be too much trouble, and users will certainly appreciate the more generous system administrator who makes header pages free. </itemize> <sect2><heading>Header Pages on PostScript Printers<label id="printing:advanced:header-pages:ps"></heading> <p> As described above, LPD can generate a plain text header page suitable for many printers. Of course, PostScript can't directly print plain text, so the header page feature of LPD is useless---or mostly so. One obvious way to get header pages is to have every conversion filter and the text filter generate the header page. The filters should should use the user and host arguments to generate a suitable header page. The drawback of this method is that users will always get a header page, even if they submit jobs with <tt/lpr -h/. Let's explore this method. The following script takes three arguments (user login name, host name, and job name) and makes a simple PostScript header page: <code> #!/bin/sh # # make-ps-header - make a PostScript header page on stdout # Installed in /usr/local/libexec/make-ps-header # # # These are PostScript units (72 to the inch). Modify for A4 or # whatever size paper you're using: # page_width=612 page_height=792 border=72 # # Check arguments # if [ $# -ne 3 ]; then echo "Usage: `basename $0` <user> <host> <job>" 1>&ero;2 exit 1 fi # # Save these, mostly for readability in the PostScript, below. # user=$1 host=$2 job=$3 date=`date` # # Send the PostScript code to stdout. # exec cat <<EOF %!PS % % Make sure we don't interfere with user's job that will follow % save % % Make a thick, unpleasant border around the edge of the paper. % $border $border moveto $page_width $border 2 mul sub 0 rlineto 0 $page_height $border 2 mul sub rlineto currentscreen 3 -1 roll pop 100 3 1 roll setscreen $border 2 mul $page_width sub 0 rlineto closepath 0.8 setgray 10 setlinewidth stroke 0 setgray % % Display user's login name, nice and large and prominent % /Helvetica-Bold findfont 64 scalefont setfont $page_width ($user) stringwidth pop sub 2 div $page_height 200 sub moveto ($user) show % % Now show the boring particulars % /Helvetica findfont 14 scalefont setfont /y 200 def [ (Job:) (Host:) (Date:) ] { 200 y moveto show /y y 18 sub def } forall /Helvetica-Bold findfont 14 scalefont setfont /y 200 def [ ($job) ($host) ($date) ] { 270 y moveto show /y y 18 sub def } forall % % That's it % restore showpage EOF </code> Now, each of the conversion filters and the text filter can call this script to first generate the header page, and then print the user's job. Here's the DVI conversion filter from earlier in this document, modified to make a header page: <code> #!/bin/sh # # DVI to PostScript printer filter # Installed in /usr/local/libexec/psdf # # Invoked by lpd when user runs lpr -d # orig_args="$@" fail() { echo "$@" 1>&ero;2 exit 2 } while getopts "x:y:n:h:" option; do case $option in x|y) ;; # Ignore n) login=$OPTARG ;; h) host=$OPTARG ;; *) echo "LPD started `basename $0` wrong." 1>&ero;2 exit 2 ;; esac done [ "$login" ] || fail "No login name" [ "$host" ] || fail "No host name" ( /u/kelly/freebsd/printing/filters/make-ps-header $login $host "DVI File" /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args </code> Notice how the filter has to parse the argument list in order to determine the user and host name. The parsing for the other conversion filters is identical. The text filter takes a slightly different set of arguments, though (see section <ref id="printing:advanced:filters" name="How Filters Work">). As we've mentioned before, the above scheme, though fairly simple, disables the ``suppress header page'' option (the <tt/-h/ option) to <tt/lpr/. If users wanted to save a tree (or a few pennies, if you charge for header pages), they wouldn't be able to do so, since every filter's going to print a header page with every job. To allow users to shut off header pages on a per-job basis, you'll need to use the trick introduced in section <ref id="printing:advanced:header-pages:accounting" name="Accounting for Header Pages">: write an output filter that parses the LPD-generated header page and produces a PostScript version. If the user submits the job with <tt/lpr -h/, then LPD won't generate a header page, and neither will your output filter. Otherwise, your output filter will read the text from LPD and send the appropriate header page PostScript code to the printer. If you've got a PostScript printer on a serial line, you can make use of <tt/lprps/, which comes with an output filter, <tt/psof/, which does the above. Note that <tt/psof/ doesn't charge for header pages. <sect1><heading>Networked Printing<label id="printing:advanced:network-printers"></heading> <p> FreeBSD supports networked printing: sending jobs to remote printers. Networked printing generally refers to two different things: <itemize> <item>Accessing a printer attached to a remote host. You install a printer that has a conventional serial or parallel interface on one host. Then, you set up LPD to enable access to the printer from other hosts on the network. Section <ref id="printing:advanced:network:rm" name="Printers Installed on Remote Hosts"> tells how to do this. <item>Accessing a printer attached directly to a network. The printer has a network interface in addition (or in place of) a more conventional serial or parallel interface. Such a printer might work as follows: <itemize> <item>It might understand the LPD protocol and can even queue jobs from remote hosts. In this case, it acts just like a regular host running LPD. Follow the same procedure in section <ref id="printing:advanced:network:rm" name="Printers Installed on Remote Hosts"> to set up such a printer. <item>It might support a data stream network connection. In this case, you ``attach'' the printer to one host on the network by making that host responsible for spooling jobs and sending them to the printer. Section <ref id="printing:advanced:network:net-if" name="Printers with Networked Data Stream Interfaces"> gives some suggestions on installing such printers. </itemize> </itemize> <sect2><heading>Printers Installed on Remote Hosts<label id="printing:advanced:network:rm"></heading> <p> The LPD spooling system has built-in support for sending jobs to other hosts also running LPD (or are compatible with LPD). This feature enables you to install a printer on one host and make it accessible from other hosts. It also works with printers that have network interfaces that understand the LPD protocol. To enable this kind of remote printing, first install a printer on one host, the <em/printer host/, using the simple printer setup described in <ref id="printing:simple" name="Simple Printer Setup">. Do any advanced setup in <ref id="printing:advanced" name="Advanced Printer Setup"> that you need. Make sure to test the printer and see if it works with the features of LPD you've enabled. If you're using a printer with a network interface that's compatible with LPD, then the <em/printer host/ in the discussion below is the printer itself, and the <em/printer name/ is the name you configured for the printer. See the documentation that accompanied your printer and/or printer-network interface. Then, on the other hosts you want to have access to the printer, make an entry in their <tt>/etc/printcap</tt> files with the following: <enum> <item>Name the entry anything you want. For simplicity, though, you probably want to use the same name and aliases as on the printer host. <item>Leave the <tt/lp/ capability blank, explicitly (<tt/:lp=:/). <item>Make a spooling directory and specify its location in the <tt/sd/ capability. LPD will store jobs here before they get sent to the printer host. <item>Place the name of the printer host in the <tt/rm/ capability. <item>Place the printer name on the <em/printer host/ in the <tt/rp/ capability. </enum> That's it. You don't need to list conversion filters, page dimensions, or anything else in the <tt>/etc/printcap</tt> file. Here's an example. The host rose has two printers, <tt/bamboo/ and <tt/rattan/. We'll enable users on the host orchid to print to those printers. Here's the <tt>/etc/printcap</tt> file for orchid (back from section <ref id="printing:advanced:header-pages:enabling" name="Enabling Header Pages">). It already had the entry for the printer <tt/teak/; we've added entries for the two printers on the host rose: <code> # # /etc/printcap for host orchid - added (remote) printers on rose # # # teak is local; it's connected directly to orchid: # teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/ifhp:\ :vf=/usr/local/libexec/vfhp:\ :of=/usr/local/libexec/ofhp: # # rattan is connected to rose; send jobs for rattan to rose: # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :lp=:rm=rose:rp=rattan:sd=/var/spool/lpd/rattan: # # bamboo is connected to rose as well: # bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo: </code> Then, we just need to make spooling directories on orchid: <tscreen><verb> mkdir -p /var/spool/lpd/rattan /var/spool/lpd/bamboo chmod 770 /var/spool/lpd/rattan /var/spool/lpd/bamboo chown daemon.daemon /var/spool/lpd/rattan /var/spool/lpd/bamboo </verb></tscreen> Now, users on orchid can print to <tt/rattan/ and <tt/bamboo/. If, for example, a user on orchid typed <tscreen><verb> lpr -P bamboo -d sushi-review.dvi </verb></tscreen> the LPD system on orchid would copy the job to the spooling directory <tt>/var/spool/lpd/bamboo</tt> and note that it was a DVI job. As soon as the host rose has room in its <tt/bamboo/ spooling directory, the two LPDs would transfer the file to rose. The file would wait in rose's queue until it was finally printed. It would be converted from DVI to PostScript (since bamboo is a PostScript printer) on rose. <sect2><heading>Printers with Networked Data Stream Interfaces<label id="printing:advanced:network:net-if"></heading> <p> Often, when you buy a network interface card for a printer, you can get two versions: one which emulates a spooler (the more expensive version), or one which just lets you send data to it as if you were using a serial or parallel port (the cheaper version). This section tells how to use the cheaper version. For the more expensive one, see the previous section <ref name="Printers Installed on Remote Hosts" id="printing:advanced:network:rm">. The format of the <tt>/etc/printcap</tt> file lets you specify what serial or parallel interface to use, and (if you're using a serial interface), what baud rate, whether to use flow control, delays for tabs, conversion of newlines, and more. But there's no way to specify a connection to a printer that's listening on a TCP/IP or other network port. To send data to a networked printer, you need to develop a communications program that can be called by the text and conversion filters. Here's one such example: the script <tt/netprint/ takes all data on standard input and sends it to a network-attached printer. We specify the hostname of the printer as the first argument and the port number to which to connect as the second argument to <tt/netprint/. Note that this supports one-way communication only (FreeBSD to printer); many network printers support two-way communication, and you might want to take advantage of that (to get printer status, perform accounting, etc.). <code> #!/usr/bin/perl # # netprint - Text filter for printer attached to network # Installed in /usr/local/libexec/netprint # $#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>"; $printer_host = $ARGV[0]; $printer_port = $ARGV[1]; require 'sys/socket.ph'; ($ignore, $ignore, $protocol) = getprotobyname('tcp'); ($ignore, $ignore, $ignore, $ignore, $address) = gethostbyname($printer_host); $sockaddr = pack('S n a4 x8', &ero;AF_INET, $printer_port, $address); socket(PRINTER, &ero;PF_INET, &ero;SOCK_STREAM, $protocol) || die "Can't create TCP/IP stream socket: $!"; connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; while (<STDIN>) { print PRINTER; } exit 0; </code> We can then use this script in various filters. Suppose we had a Diablo 750-N line printer connected to the network. The printer accepts data to print on port number 5100. The host name of the printer is scrivener. Here's the text filter for the printer: <code> #!/bin/sh # # diablo-if-net - Text filter for Diablo printer `scrivener' listening # on port 5100. Installed in /usr/local/libexec/diablo-if-net # exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100 </code> <sect1><heading>Restricting Printer Usage<label id="printing:advanced:restricting"></heading> <p> This section gives information on restricting printer usage. The LPD system lets you control who can access a printer, both locally or remotely, whether they can print multiple copies, how large their jobs can be, and how large the printer queues can get. <sect2><heading>Restricting Multiple Copies<label id="printing:advanced:restricting:copies"></heading> <p> The LPD system makes it easy for users to print multiple copies of a file. Users can print jobs with <tt/lpr -#5/ (for example) and get five copies of each file in the job. Whether this is a good thing is up to you. If you feel multiple copies cause unnecessary wear and tear on your printers, you can disable the <tt/-#/ option to <tt/lpr/ by adding the <tt/sc/ capability to the <tt>/etc/printcap</tt> file. When users submit jobs with the <tt/-#/ option, they'll see <tscreen><verb> lpr: multiple copies are not allowed </verb></tscreen> Note that if you've set up access to a printer remotely (see section <ref name="Printers Installed on Remote Hosts" id="printing:advanced:network:rm">), you need the <tt/sc/ capability on the remote <tt>/etc/printcap</tt> files as well, or else users will still be able to submit multiple-copy jobs by using another host. Here's an example. This is the <tt>/etc/printcap</tt> file for the host rose. The printer <tt/rattan/ is quite hearty, so we'll allow multiple copies, but the laser printer <tt/bamboo/'s a bit more delicate, so we'll disable multiple copies by adding the <tt/sc/ capability: <code> # # /etc/printcap for host rose - restrict multiple copies on bamboo # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:rw:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: </code> Now, we also need to add the <tt/sc/ capability on the host orchid's <tt>/etc/printcap</tt> (and while we're at it, let's disable multiple copies for the printer <tt/teak/): <code> # # /etc/printcap for host orchid - no multiple copies for local # printer teak or remote printer bamboo teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sd=/var/spool/lpd/teak:mx#0:sc:\ :if=/usr/local/libexec/ifhp:\ :vf=/usr/local/libexec/vfhp:\ :of=/usr/local/libexec/ofhp: rattan|line|diablo|lp|Diablo 630 Line Printer:\ :lp=:rm=rose:rp=rattan:sd=/var/spool/lpd/rattan: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo:sc: </code> By using the <tt/sc/ capability, we prevent the use of <tt/lpr -#/, but that still doesn't prevent users from running <tt/lpr/ multiple times, or from submitting the - same file mutliple times in one job like this: + same file multiple times in one job like this: <tscreen><verb> lpr forsale.sign forsale.sign forsale.sign forsale.sign forsale.sign </verb></tscreen> There are many ways to prevent this abuse (including ignoring it) which you are free to explore. <sect2><heading>Restricting Access To Printers<label id="printing:advanced:restricting:access"></heading> <p> You can control who can print to what printers by using the UNIX group mechanism and the <tt/rg/ capability in <tt>/etc/printcap</tt>. Just place the users you want to have access to a printer in a certain group, and then name that group in the <tt/rg/ capability. Users outside the group (including root) will be greeted with <tscreen><verb> lpr: Not a member of the restricted group </verb></tscreen> if they try to print to the controlled printer. As with the <tt/sc/ (suppress multiple copies) capability, you need to specify <tt/rg/ on remote hosts that also have access to your printers, if you feel it's appropriate (see section <ref name="Printers Installed on Remote Hosts" id="printing:advanced:network:rm">). For example, we'll let anyone access the printer <tt/rattan/, but only those in group <tt/artists/ can use <tt/bamboo/. Here's the familiar <tt>/etc/printcap</tt> for host rose: <code> # # /etc/printcap for host rose - restricted group for bamboo # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:rw:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: </code> Let's leave the other example <tt>/etc/printcap</tt> file (for the host orchid) alone. Of course, anyone on orchid can print to <tt/bamboo/. It might be the case that we only allow certain logins on orchid anyway, and want them to have access to the printer. Or not. <em/Note:/ there can be only one restricted group per printer. <sect2><heading>Controlling Sizes of Jobs Submitted<label id="printing:advanced:restricting:sizes"></heading> <p> If you have many users accessing the printers, you probably need to put an upper limit on the sizes of the files users can submit to print. After all, there's only so much free space on the filesystem that houses the spooling directories, and you also need to make sure there's room for the jobs of other users. LPD enables you to limit the maximum byte size a file in a job can be with the <tt/mx/ capability. The units are in BUFSIZ blocks, which are 1024 bytes. If you put a zero for this capability, there'll be no limit on file size. Note that the limit applies to <em/files/ in a job, and <em/not/ the total job size. LPD won't refuse a file that's larger than the limit you place on a printer. Instead, it'll queue as much of the file up to the limit, which will then get printed. The rest will be discarded. Whether this is correct behavior is up for debate. Let's add limits to our example printers <tt/rattan/ and <tt/bamboo/. Since those artists' PostScript files tend to be large, we'll limit them to five megabytes. We'll put no limit on the plain text line printer: <code> # # /etc/printcap for host rose # # # No limit on job size: # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: # # Limit of five megabytes: # bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:mx#5000:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:rw:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: </code> Again, the limits apply to the local users only. If you've set up access to your printers remotely, remote users won't get those limits. You'll need to specify the <tt/mx/ capability in the remote <tt>/etc/printcap</tt> files as well. See section <ref name="Printers Installed on Remote Hosts" id="printing:advanced:network:rm"> for more information on remote printing. There's another specialized way to limit job sizes from remote printers; see section <ref id="printing:advanced:restricting:remote" name="Restricting Jobs from Remote Printers">. <sect2><heading>Restricting Jobs from Remote Printers<label id="printing:advanced:restricting:remote"></heading> <p> The LPD spooling system provides several ways to restrict print jobs submitted from remote hosts: <descrip> <tag/Host restrictions/ You can control from which remote hosts a local LPD accepts requests with the files <tt>/etc/hosts.equiv</tt> and <tt>/etc/hosts.lpd</tt>. LPD checks to see if an incoming request is from a host listed in either one of these files. If not, LPD refuses the request. The format of these files is simple: one host name per line. Note that the file <tt>/etc/hosts.equiv</tt> is also used by the ruserok(3) protocol, and affects programs like <tt/rsh/ and <tt/rcp/, so be careful. For example, here's the <tt>/etc/hosts.lpd</tt> file on the host rose: <code> orchid violet madrigal.fishbaum.de </code> This means rose will accept requests from the hosts orchid, violet, and madrigal.fishbaum.de. If any other host tries to access rose's LPD, LPD will refuse them. <tag/Size restrictions/ You can control how much free space there needs to remain on the filesystem where a spooling directory resides. Make a file called <tt/minfree/ in the spooling directory for the local printer. Insert in that file a number representing how many disk blocks (512 bytes) of free space there has to be for a remote job to be accepted. This lets you insure that remote users won't fill your filesystem. You can also use it to give a certain priority to local users: they'll be able to queue jobs long after the free disk space has fallen below the amount specified in the <tt/minfree/ file. For example, let's add a <tt/minfree/ file for the printer <tt/bamboo/. We examine <tt>/etc/printcap</tt> to find the spooling directory for this printer; here's <tt/bamboo/'s entry: <tscreen><verb> bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:mx#5000:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:rw:mx#5000:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: </verb></tscreen> The spooling directory is the given in the <tt/sd/ capability. We'll make three megabytes (which is 6144 disk blocks) the amount of free disk space that must exist on the filesystem for LPD to accept remote jobs: <tscreen><verb> echo 6144 > /var/spool/lpd/bamboo/minfree </verb></tscreen> <tag/User restrictions/ You can control which remote users can print to local printers by specifying the <tt/rs/ capability in <tt>/etc/printcap</tt>. When <tt/rs/ appears in the entry for a locally-attached printer, LPD will accept jobs from remote hosts <em/if/ the user submitting the job also has an account of the same login name on the local host. Otherwise, LPD refuses the job. This capability is particularly useful in an environment where there are (for example) different departments sharing a network, and some users transcend departmental boundaries. By giving them accounts on your systems, they can use your printers from their own departmental systems. If you'd rather allow them to use <em/only/ your printers and not your compute resources, you can give them ``token'' accounts, with no home directory and a useless shell like <tt>/usr/bin/false</tt>. </descrip> <sect1><heading>Accounting for Printer Usage<label id="printing:advanced:acct"></heading> <p> So, you need to charge for printouts. And why not? Paper and ink cost money. And then there are maintenance costs---printers are loaded with moving parts and tend to break down. You've examined your printers, usage patterns, and maintenance fees and have come up with a per-page (or per-foot, per-meter, or per-whatever) cost. Now, how do you actually start accounting for printouts? Well, the bad news is the LPD spooling system doesn't provide much help in this department. Accounting is highly dependent on the kind of printer in use, the formats being printed, and <em/your/ requirements in charging for printer usage. To implement accounting, you have to modify a printer's text filter (to charge for plain text jobs) and the conversion filters (to charge for other file formats), to count pages or query the printer for pages printed. You can't get away with using the simple output filter, since it cannot do accounting. See section <ref name="Filters" id="printing:advanced:filter-intro">. Generally, there are two ways to do accounting: <itemize> <item><em/Periodic accounting/ is the more common way, possibly because it's easier. Whenever someone prints a job, the filter logs the user, host, and number of pages to an accounting file. Every month, semester, year, or whatever time period you prefer, you collect the accounting files for the various printers, tally up the pages printed by users, and charge for usage. Then you truncate all the logging files, starting with a clean slate for the next period. <item><em/Timely accounting/ is less common, probably because it's more difficult. This method has the filters charge users for printouts as soon as they use the printers. Like disk quotas, the accounting is immediate. You can prevent users from printing when their account goes in the red, and might provide a way for users to check and adjust their ``print quotas.'' But this method requires some database code to track users and their quotas. </itemize> The LPD spooling system supports both methods easily: since you have to provide the filters (well, most of the time), you also have to provide the accounting code. But there is a bright side: you have enormous flexibility in your accounting methods. For example, you choose whether to use periodic or timely accounting. You choose what information to log: user names, host names, job types, pages printed, square footage of paper used, how long the job took to print, and so forth. And you do so by modifying the filters to save this information. <sect2><heading>Quick and Dirty Printer Accounting</heading> <p> FreeBSD comes with two programs that can get you set up with simple periodic accounting right away. They are the text filter <tt/lpf/, described in section <ref id="printing:advanced:lpf" name="lpf: a Text Filter">, and <tt/pac/, a program to gather and total entries from printer accounting files. As mentioned in the section on filters (<ref id="printing:advanced:filters" name="Filters">), LPD starts the text and the conversion filters with the name of the accounting file to use on the filter command line. The filters can use this argument to know where to write an accounting file entry. The name of this file comes from the <tt/af/ capability in <tt>/etc/printcap</tt>, and if not specified as an absolute path, is relative to the spooling directory. LPD starts <tt/lpf/ with page width and length arguments (from the <tt/pw/ and <tt/pl/ capabilities). <tt/lpf/ uses these arguments to determine how much paper will be used. After sending the file to the printer, it then writes an accounting entry in the accounting file. The entries look like this: <tscreen><verb> 2.00 rose:andy 3.00 rose:kelly 3.00 orchid:mary 5.00 orchid:mary 2.00 orchid:zhang </verb></tscreen> You should use a separate accounting file for each printer, as <tt/lpf/ has no file locking logic built into it, and two <tt/lpf/s might corrupt each other's entries if they were to write to the same file at the same time. A easy way to insure a separate accounting file for each printer is to use <tt/af=acct/ in <tt>/etc/printcap</tt>. Then, each accounting file will be in the spooling directory for a printer, in a file named <tt/acct/. When you're ready to charge users for printouts, run the <tt/pac/ program. Just change to the spooling directory for the printer you want to collect on and type <tt/pac/. You'll get a dollar-centric summary like the following: <code> Login pages/feet runs price orchid:kelly 5.00 1 $ 0.10 orchid:mary 31.00 3 $ 0.62 orchid:zhang 9.00 1 $ 0.18 rose:andy 2.00 1 $ 0.04 rose:kelly 177.00 104 $ 3.54 rose:mary 87.00 32 $ 1.74 rose:root 26.00 12 $ 0.52 total 337.00 154 $ 6.74 </code> These are the arguments <tt/pac/ expects: <descrip> <tag/<tt/-P<it/printer/// Which <it/printer/ to summarize. This option works only if there's an absolute path in the <tt/af/ capability in <tt>/etc/printcap</tt>. <tag/<tt/-c// Sort the output by cost instead of alphabetically by user name. <tag/<tt/-m// Ignore host name in the accounting files. With this option, user smith on host alpha is the same user smith on host gamma. Without, they're different users. <tag/<tt/-p<it/price/// Compute charges with <it/price/ dollars per page or per foot instead of the price from the <tt/pc/ - capabilty in <tt>/etc/printcap</tt>, or two cents (the + capability in <tt>/etc/printcap</tt>, or two cents (the default). You can specify <it/price/ as a floating point number. <tag/<tt/-r// Reverse the sort order. <tag/<tt/-s// Make an accounting summary file and truncate the accounting file. <tag/<tt/<it/names.../// Print accounting information for the given user <it/names/ only. </descrip> In the default summary that <tt/pac/ produces, you see the number of pages printed by each user from various hosts. If, at your site, host doesn't matter (because users can use any host), run <tt/pac -m/, to produce the following summary: <code> Login pages/feet runs price andy 2.00 1 $ 0.04 kelly 182.00 105 $ 3.64 mary 118.00 35 $ 2.36 root 26.00 12 $ 0.52 zhang 9.00 1 $ 0.18 total 337.00 154 $ 6.74 </code> To compute the dollar amount due, <tt/pac/ uses the <tt/pc/ capability in the <tt>/etc/printcap</tt> file (default of 200, or 2 cents per page). Specify, in hundreths of cents, the price per page or per foot you want to charge for printouts in this capability. You can override this value when you run <tt/pac/ with the <tt/-p/ option. The units for the <tt/-p/ option are in dollars, - though, not hundreths of cents. For example, + though, not hundredths of cents. For example, <tscreen><verb> pac -p1.50 </verb></tscreen> makes each page cost one dollar and fifty cents. You can really rake in the profits by using this option. Finally, running <tt/pac -s/ will save the summary information in a summary accounting file, which is named the same as the printer's accounting file, but with <tt/_sum/ appended to the name. It then truncates the accounting file. When you run <tt/pac/ again, it rereads the summary file to get starting totals, then adds information from the regular accounting file. <sect2><heading>How Can You Count Pages Printed?</heading> <p> In order to perform even remotely accurate accounting, you need to be able to determine how much paper a job uses. This is the essential problem of printer accounting. For plain text jobs, the problem's not that hard to solve: you count how many lines are in a job and compare it to how many lines per page your printer supports. Don't forget to take into account backspaces in the file which overprint lines, or long logical lines that wrap onto one or more additional physical lines. The text filter <tt/lpf/ (introduced in <ref id="printing:advanced:lpf" name="lpf: a Text Filter">) takes into account these things when it does accounting. If you're writing a text filter which needs to do accounting, you might want to examine <tt/lpf/'s source code. How do you handle other file formats, though? Well, for DVI-to-LaserJet or DVI-to-PostScript conversion, you can have your filter parse the diagnostic output of <tt/dvilj/ or <tt/dvips/ and look to see how many pages were converted. You might be able to do similar things with other file formats and conversion programs. But these methods suffer from the fact that the printer may not actually print all those pages. For example, it could jam, run out of toner, or explode---and the user would still get charged. So, what can you do? There is only one <em/sure/ way to do <em/accurate/ accounting. Get a printer that can tell you how much paper it uses, and attach it via a serial line or a network connection. Nearly all PostScript printers support this notion. Other makes and models do as well (networked Imagen laser printers, for example). Modify the filters for these printers to get the page usage after they print each job and have them log accounting information based on that value <em/only/. There's no line counting nor error-prone file examination required. Of course, you can always be generous and make all printouts free. <sect><heading>Alternatives to the Standard Spooler<label id="printing:lpd-alternatives"></heading> <p> If you've been reading straight through this manual, by now you've learned just about everything there is to know about the LPD spooling system that comes with FreeBSD. You can probably appreciate many of its shortcomings, which naturally leads to the question: ``What other spooling systems are out there (and work with FreeBSD)?'' Unfortunately, I've located only <em/two/ alternatives---and they're almost identical to each other! They are: <descrip> <tag/PLP, the Portable Line Printer Spooler System/ PLP was based on software developed by Patrick Powell and then maintained by an Internet-wide group of developers. The main site for the software is at <htmlurl url="ftp://ftp.iona.ie/pub/plp" name="ftp://ftp.iona.ie/pub/plp">. There's also a <htmlurl url="http://www.iona.ie:8000/www/hyplan/jmason/plp.html" name="web page">. It's quite similar to the BSD LPD spooler, but boasts a host of features, including: <itemize> <item>Better network support, including built-in support for networked printers, NIS-maintained printcaps, and NFS-mounted spooling directories <item>Sophisticated queue management, allowing multiple printers on a queue, transfer of jobs between queues, and queue redirection <item>Remote printer control functions <item>Prioritization of jobs <item>Expansive security and access options </itemize> <tag/LPRng/ LPRng, which purportedly means ``LPR: the Next Generation'' is a complete rewrite of PLP. Patrick Powell and Justin Mason (the principal maintainer of PLP) collaborated to make LPRng. The main site for LPRng is <htmlurl url="ftp://dickory.sdsu.edu/pub/LPRng" name="ftp://dickory.sdsu.edu/pub/LPRng">. </descrip> <sect><heading>Acknowledgments</heading> - <p> I'd like to thank the following people who've assisted in + <p> I'd like to thank the following people who have assisted in the development of this document: <descrip> <tag/Daniel Eischen <tt/<deischen@iworks.interworks.org>// For providing a plethora of HP filter programs for perusal. <tag/Jake Hamby <tt/<jehamby@lightside.com>// For the Ghostscript-to-HP filter. <tag/My wife, Mary Kelly <tt/<urquhart@argyre.colorado.edu>// For allowing me to spend more time with FreeBSD than with her. </descrip> diff --git a/handbook/relnotes.sgml b/handbook/relnotes.sgml index 1fe377c268..32be98a896 100644 --- a/handbook/relnotes.sgml +++ b/handbook/relnotes.sgml @@ -1,593 +1,593 @@ -<!-- $Id: relnotes.sgml,v 1.8 1995-12-07 13:22:16 jkh Exp $ --> +<!-- $Id: relnotes.sgml,v 1.9 1996-01-31 14:26:15 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <!DOCTYPE linuxdoc PUBLIC '-//FreeBSD//DTD linuxdoc//EN'> <linuxdoc><book><chapt>foo --> <sect><heading>About the current release<label id="relnotes"></heading> <p>FreeBSD is a freely available, full source 4.4 BSD Lite based release for Intel i386/i486/Pentium (or compatible) based PC's. It is based primarily on software from U.C. Berkeley's CSRG group, with some enhancements from NetBSD, 386BSD, and the Free Software Foundation. Since our release of FreeBSD 2.0 one year ago, the performance, feature set, and stability of FreeBSD has improved dramatically. The largest change is a revamped VM system with a merged VM/file buffer cache that not only increases performance, but reduces FreeBSD's memory footprint, making a 5MB configuration a more acceptable minimum. Other enhancements include full NIS client and server support, transaction TCP support, dial-on-demand PPP, an improved SCSI subsystem, early ISDN support, support for FDDI and Fast Ethernet (100Mbit) adapters, improved support for the Adaptec 2940 (WIDE and narrow) and many hundreds of bug fixes. We've also taken the comments and suggestions of many of our users to heart and have attempted to provide what we hope is a more sane and easily understood installation process. Your feedback on this (constantly evolving) process is especially welcome! In addition to the base distributions, FreeBSD offers a new ported software collection with some 350 commonly sought-after programs. The list of ports ranges from http (WWW) servers, to games, languages, editors and almost everything in between. The entire ports collection requires only 10MB of storage, all ports being expressed as ``deltas'' to their original sources. This makes it much easier for us to update ports, and greatly reduces the disk space demands made by the older 1.0 ports collection. To compile a port, you simply change to the directory of the program you wish to install, type make and let the system do the rest. The full original distribution for each port you build is retrieved dynamically off of CDROM or a local ftp site, so you need only enough disk space to build the ports you want. (Almost) every port is also provided as a pre-compiled "package" which can be installed with a simple command (pkg_add) by those who do not wish to compile their own ports from source. A number of additional documents which you may find very helpful in the process of installing and using FreeBSD may now also be found in the <bf>/usr/share/doc</bf> directory. You may view the manuals with any HTML capable browser with the following URLs: <descrip> <tag>The FreeBSD handbook</tag> <htmlurl url="file:/usr/share/doc/handbook/handbook.html"> <tag>The FreeBSD FAQ</tag> <htmlurl url="file:/usr/share/doc/FAQ/freebsd-faq.html"> </descrip> You can also visit the master (and most frequently updated) copies at <htmlurl url="http://www.freebsd.org" name="http://www.freebsd.org">. The core of FreeBSD does not contain DES code which would inhibit its being exported outside the United States. There is an add-on package to the core distribution, for use only in the United States, that contains the programs that normally use DES. The auxiliary packages provided separately can be used by anyone. A freely (from outside the U.S.) exportable European distribution of DES for our non-U.S. users also exists and is described in the <htmlurl url="../FAQ/freebsd-faq.html" name="FreeBSD FAQ">. If password security for FreeBSD is all you need, and you have no requirement for copying encrypted passwords from different hosts (Suns, DEC machines, etc) into FreeBSD password entries, then FreeBSD's MD5 based security may be all you require! We feel that our default security model is more than a match for DES, and without any messy export issues to deal with. If you're outside (or even inside) the U.S., give it a try! <![ IGNORE [ <p>Since our first release of FreeBSD 1.0 nearly two years ago, FreeBSD has changed dramatically. Since release 2.0, FreeBSD has been based on the Berkeley BSD 4.4-lite code rather than the Net2 code used for previous versions. In addition to clearing the legal issues that surrounded the Net2 code, the port to 4.4 has also brought in numerous new features, filesystems and enhanced driver support. Since our release of FreeBSD 2.0 in November of 1994, the performance, feature set, and stability of FreeBSD has improved dramatically. The largest change is a revamped Virtual Memory (VM) system with a merged virtual memory and file buffer cache. This increases performance while reducing FreeBSD's memory footprint, making a system with 4 megabytes of RAM a more acceptable minimum. Other enhancements include full NIS client and server support, transaction TCP support, dial on demand PPP, an improved SCSI subsystem, early support for ISDN, support for FDDI and 100Mbit Fast Ethernet adapters, improved support for the Adaptec 2940 and hundreds of bug fixes. We've also taken the comments and suggestions of many of our users to heart and have attempted to provide what we hope is a more sane and easily understood installation process. Your feedback on this constantly evolving process is especially welcome! In addition to the base distributions, FreeBSD offers a new ported software collection with some 270 commonly sought-after programs. The list of ports ranges from World Wide Web (http) servers, to games, languages, editors and almost everything in between. The entire ports collection requires only 10MB of storage because each port contains only the changes required for the source code to compile on FreeBSD and the information necessary to automatically retrieve the original sources. The original distribution for each port you build is automatically retrieved off of CD-ROM or a via anonymous ftp, so you need only enough disk space to build the ports you want. Each port is also provided as a pre-compiled package which can be installed with the <tt>pkg_add(1)</tt> command for those who do not wish to compile their own ports from source. See <ref id="ports" name="The Ports Collection"> for a more complete description. <!-- XXX make xref For a list of contributors and a general project description, please see the file "CONTRIB.FreeBSD" which should be bundled with your binary distribution. Also see the "REGISTER.FreeBSD" file for information on registering with the "Free BSD user counter". This counter is for ALL freely available variants of BSD, not just FreeBSD, and we urge you to register yourself with it. --> The core of FreeBSD does not contain DES code which would inhibit its being exported outside the United States. An add-on package, for use only in the United States, contains the programs that normally use DES. The auxiliary packages provided separately can be used by anyone. A freely exportable European distribution of DES for our non-U.S. users also exists and is described in the <url url="http://www.freebsd.org/FAQ" name="FreeBSD FAQ">. If password security for FreeBSD is all you need, and you have no requirement for copying encrypted passwords from other hosts using DES into FreeBSD password entries, then FreeBSD's MD5 based security may be all you require. We feel that our default security model is more than a match for DES, and without any messy export issues to deal with. FreeBSD 2.0.5 represents the culmination of 2 years of work and many thousands of man hours put in by an international development team. We hope you enjoy it! <sect1><heading>New feature highlights</heading> <p>The following features were added or substantially improved between the release of 2.0 and this 2.0.5 release. In order to facilitate better communication, the person, or persons, responsible for each enhancement is noted. Any questions regarding the new functionality should be directed to them first. <sect2><heading>Kernel</heading> <p> <descrip> <tag>Merged VM-File Buffer Cache</tag> A merged VM/buffer cache design greatly enhances overall system performance and makes it possible to do a number of more optimal memory allocation strategies that were not possible before. Owner: David Greenman (davidg@FreeBSD.org) and John Dyson (dyson@implode.root.com) <tag>Network PCB hash optimization</tag> For systems with a great number of active TCP connections (WEB and ftp servers, for example), this greatly speeds up the lookup time required to match an incoming packet up to its associated connection. Owner: David Greenman (davidg@FreeBSD.org) <tag>Name cache optimization</tag> The name-cache would cache all files of the same name to the same bucket, which would put for instance all ".." entries in the same bucket. We added the parent directory version to frustrate the hash, and improved the management of the cache in various other ways while we were at it. Owner: Poul-Henning Kamp (phk@FreeBSD.org) David Greenman (davidg@FreeBSD.org) <tag>Less restrictive swap-spaces</tag> The need to compile the names of the swap devices into the kernel has been removed. Now <tt>swapon(8)</tt> will accept any block devices, up to the maximum number of swap devices configured in the kernel. Owner: Poul-Henning Kamp (phk@FreeBSD.org) David Greenman (davidg@FreeBSD.org) <tag>Hard Wired SCSI Devices</tag> Prior to 2.0.5, FreeBSD performed dynamic assignment of unit numbers to SCSI devices as they were probed, allowing a SCSI device failure to possibly change unit number assignment. This could cause filesystems other disks in the system to be incorrectly mounted, or not mounted at all. Hard wiring allows static allocation of unit numbers (and hence device names) to scsi devices based on SCSI ID and bus. SCSI configuration occurs in the kernel config file. Samples of the configuration syntax can be found in the <tt>scsi(4)</tt> man page or the LINT kernel config file. Owner: Peter Dufault (dufault@hda.com) Sources involved: <tt>sys/scsi/*</tt> <tt>usr.sbin/config/*</tt> <tag>Slice Support</tag> FreeBSD now supports a <em>slice</em> abstraction which enhances FreeBSD's ability to share disks with other operating systems. This support will allow FreeBSD to inhabit DOS extended partitions. Owner: Bruce Evans (bde@FreeBSD.org) Sources involved: <tt>sys/disklabel.h</tt> <tt>sys/diskslice.h</tt> <tt>sys/dkbad.h</tt> <tt>kern/subr_diskslice.c</tt> <tt>kern/subr_dkbad.c</tt> <tt>i386/isa/diskslice_machdep.c</tt> <tt>i386/isa/wd.c</tt> <tt>scsi/sd.c</tt> <tt>dev/vn/vn.c</tt> <tag>Support for Ontrack Disk Manager Version 6.0</tag> Support has been added for disks which use Ontrack Disk Manager. The fdisk program does <em>not</em> know about it however, so make all changes using the install program on the boot.flp or the Ontrack Disk Manager tool under MS-DOS. Owner: Poul-Henning Kamp (phk@FreeBSD.org) <tag>Bad144 is back and working</tag> Bad144 works again, though the semantics are slightly different than before in that the bad-spots are kept relative to the slice rather than absolute on the disk. Owner: Bruce Evans (bde@FreeBSD.org) Poul-Henning Kamp (phk@FreeBSD.org) </descrip> <sect2><heading>New device support</heading> <sect3><heading>SCSI and CDROM devices</heading> <p><descrip> <tag>Matsushita/Panasonic (Creative) CD-ROM driver</tag> The Matsushita/Panasonic CR-562 and CR-563 drives are now supported when connected to a Sound Blaster or 100% compatible host adapter. Up to four host adapters are supported for a total of 16 CD-ROM drives. The audio functions are supported with the Karoke variable speed playback. Owner: Frank Durda IV (bsdmail@nemesis.lonestar.org) Sources involved: <tt>isa/matcd</tt> <tag>Adaptec 2742/2842/2940 SCSI driver</tag> The original 274x/284x driver has evolved considerably since the 2.0 release of FreeBSD. We now offer full support for the 2940 series as well as the Wide models of these cards. The arbitration bug that caused problems with fast devices has been corrected and <em>experimental</em> tagged queuing support has been added (kernel option <tt>AHC_TAGENABLE</tt>). John Aycock has also released the sequencer code under a Berkeley style copyright making the driver entirely clean of the GPL. Owner: Justin Gibbs (gibbs@FreeBSD.org) Sources involved: <tt>isa/aic7770.c</tt> <tt>pci/aic7870.c</tt> <tt>i386/scsi/*</tt> <tt>sys/dev/aic7xxx/*</tt> <tag>NCR5380/NCR53400 SCSI (ProAudio Spectrum) driver</tag> Owner: core Submitted by: Serge Vakulenko (vak@cronyx.ru) Sources involved: <tt>isa/ncr5380.c</tt> <tag>Sony CDROM driver</tag> Owner: core Submitted by: Mikael Hybsch (micke@dynas.se) Sources involved: <tt>isa/scd.c</tt> </descrip> <sect3><heading>Serial devices</heading> <p><descrip> <tag>SDL Communications Riscom/8 Serial Board Driver</tag> Owner: Andrey Chernov (ache@FreeBSD.org) Sources involved: <tt>isa/rc.c</tt> <tt>isa/rcreg.h</tt> <tag>Cyclades Cyclom-y Serial Board Driver</tag> Owner: Bruce Evans (bde@FreeBSD.org) Submitted by: Andrew Werple (andrew@werple.apana.org.au) and Heikki Suonsivu (hsu@cs.hut.fi) Obtained from: NetBSD Sources involved: <tt>isa/cy.c</tt> <tag>Cronyx/Sigma sync/async serial driver</tag> Owner: core Submitted by: Serge Vakulenko Sources involved: <tt>isa/cronyx.c</tt> </descrip> <sect2><heading>Networking</heading> <p><descrip> <tag>Diskless booting</tag> Diskless booting in 2.0.5 is much improved over previous releases. The boot program is in <tt>src/sys/i386/boot/netboot</tt>, and can be run from an MS-DOS system or burned into an EPROM. WD, SMC, 3COM and Novell ethernet cards are currently supported. Local swapping is also supported. <tag>DEC DC21140 Fast Ethernet driver</tag> This driver supports any of the numerous NICs using the DC21140 chipset including the 100Mb DEC DE-500-XA and SMC 9332. Owner: core Submitted by: Matt Thomas (thomas@lkg.dec.com) Sources involved: <tt>pci/if_de.c</tt> <tt>pci/dc21040.h</tt> <tag>DEC FDDI (DEFPA/DEFEA) driver</tag> Owner: core Submitted by: Matt Thomas (thomas@lkg.dec.com) Sources involved: <tt>pci/if_pdq.c</tt> <tt>pci/pdq.c</tt> <tt>pci/pdq_os.h</tt> <tt>pci/pdqreg.h</tt> <tag>3Com 3c505 (Etherlink/+) NIC driver</tag> Owner: core Submitted by: Dean Huxley (dean@fsa.ca) Obtained from: NetBSD Sources involved: <tt>isa/if_eg.c</tt> <tag>Fujitsu MB86960A family of NICs driver</tag> Owner: core Submitted by: M.S. (seki@sysrap.cs.fujitsu.co.jp) Sources involved: <tt>isa/if_fe.c</tt> <tag>Intel EtherExpress driver</tag> Owner: Rodney W. Grimes (rgrimes@FreeBSD.org) Sources involved: <tt>isa/if_ix.c</tt> <tt>isa/if_ixreg.h</tt> <tag>3Com 3c589 driver</tag> Owner: core Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp), Seiji Murata (seiji@mt.cs.keio.ac.jp) and Noriyuki Takahashi (hor@aecl.ntt.jp) Sources involved: <tt>isa/if_zp.c</tt> <tag>IBM Credit Card Adapter driver</tag> Owner: core Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp), Sources involved: <tt>isa/pcic.c</tt> <tt>isa/pcic.h</tt> <tag>EDSS1 and 1TR6 ISDN interface driver</tag> Owner: core Submitted by: Dietmar Friede (dfriede@drnhh.neuhaus.de) and Juergen Krause (jkr@saarlink.de) Sources involved: <tt>gnu/isdn/*</tt> </descrip> <sect2><heading>Miscellaneous drivers</heading> <p><descrip> <tag>Joystick driver</tag> Owner: Jean-Marc Zucconi (jmz@FreeBSD.org) Sources involved: <tt>isa/joy.c</tt> <tag>National Instruments ``LabPC'' driver</tag> Owner: Peter Dufault (dufault@hda.com) Sources involved: <tt>isa/labpc.c</tt> <tag>WD7000 driver</tag> Owner: Olof Johansson (offe@ludd.luth.se) <tag>Pcvt Console driver</tag> Owner: Jörg Wunsch (joerg@FreeBSD.org) Submitted by: Hellmuth Michaelis (hm@altona.hamburg.com) Sources involved: <tt>isa/pcvt/*</tt> <tag>BSD-audio emulator for VAT driver</tag> Owner: Amancio Hasty (ahasty@FreeBSD.org) and Paul Traina (pst@FreeBSD.org) Sources involved: <tt>isa/sound/vat_audio.c</tt> <tt>isa/sound/vat_audioio.h</tt> <tag>National Instruments AT-GPIB and AT-GPIB/TNT GPIB driver</tag> Owner: core Submitted by: Fred Cawthorne (fcawth@delphi.umd.edu) Sources involved: <tt>isa/gpib.c</tt> <tt>isa/gpib.h</tt> <tt>isa/gpibreg.h</tt> <tag>Genius GS-4500 hand scanner driver</tag> Owner: core Submitted by: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de) Sources involved: <tt>isa/gsc.c</tt> <tt>isa/gscreg.h</tt> <tag>CORTEX-I Frame Grabber</tag> Owner: core Submitted by: Paul S. LaFollette, Jr. ( Sources involved: <tt>isa/ctx.c</tt> <tt>isa/ctxreg.h</tt> <tag>Video Spigot video capture card</tag> Owner: Jim Lowe </descrip> <sect1><heading>Experimental features</heading> <p><descrip> <tag>UNIONFS and LFS</tag> The unionfs and LFS file systems are known to be severely broken in FreeBSD 2.0.5. This is in part due to old bugs that we haven't had time to resolve yet and the need to update these file systems to deal with the new VM system. We hope to address these issues in a later release of FreeBSD. <tag>iBCS2 Support</tag> FreeBSD now supports running iBCS2 compatible binaries. Currently SCO UNIX 3.2.2 and 3.2.4, and ISC 2.2 COFF are supported. The iBCS2 emulator is in its early stages and has not been extensively tested, but it is functional. Most of SCO's 3.2.2 binaries work, as does an old - INFORMIX-2.10 for SCO. Further testing is nessesary + INFORMIX-2.10 for SCO. Further testing is necessary to complete this project. There is also work under way for ELF and XOUT loaders, and most of the svr4 syscall wrappers are written. Owner: Soren Schmidt (sos) and Sean Eric Fagan (sef) Sources involved: <tt>sys/i386/ibcs2/*</tt> and misc kernel changes. </descrip> <!-- <sect1><heading>Reporting problems, making suggestions, submitting code</heading> <p>Your suggestions, bug reports and contributions of code are always valued - please do not hesitate to report any problems you may find (preferably with a fix attached if you can!). The preferred method to submit bug reports from a machine - with internet mail connectivity is to use the send-pr + with Internet mail connectivity is to use the send-pr command. Bug reports will be dutifully filed by our - faithful bugfiler program and you can be sure that we'll + faithful bug-filer program and you can be sure that we'll do our best to respond to all reported bugs as soon as possible. If, for some reason, you are unable to use the send-pr command to submit a bug report, you can try to send it to: <tscreen>bugs@FreeBSD.org</tscreen> Otherwise, for any questions or suggestions, please send mail to: <tscreen>questions@FreeBSD.org</tscreen> Additionally, being a volunteer effort, we are always happy to have extra hands willing to help - there are already far more enhancements to be done than we can ever manage to do by ourselves! To contact us on technical matters, or with offers of help, you may send mail to: <tscreen>hackers@FreeBSD.org</tscreen> Since these mailing lists can experience significant amounts of traffic, if you have slow or expensive mail access and you are only interested in keeping up with significant FreeBSD events, you may find it preferable to subscribe to: <tscreen>announce@FreeBSD.org</tscreen> All but the freebsd-bugs groups can be freely joined by anyone wishing to do so. Send mail to MajorDomo@FreeBSD.org and include the keyword `help' on a line by itself somewhere in the body of the message. This will give you more information on joining the various lists, accessing archives, etc. There are a number of mailing lists targeted at special interest groups not mentioned here, so send mail to majordomo and ask about them! --> ]]> diff --git a/handbook/routing.sgml b/handbook/routing.sgml index 19f6643c2e..38367cd2bc 100644 --- a/handbook/routing.sgml +++ b/handbook/routing.sgml @@ -1,279 +1,279 @@ -<!-- $Id: routing.sgml,v 1.1 1995-10-07 04:31:41 jfieber Exp $ --> +<!-- $Id: routing.sgml,v 1.2 1996-01-31 14:26:16 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <!DOCTYPE linuxdoc PUBLIC '-//FreeBSD//DTD linuxdoc//EN'> --> <sect><heading>Gateways and routes<label id="routing"></heading> <p><em>Contributed by &a.gryphon;.<newline>6 October 1995.</em> For one machine to be able to find another, there must be a mechanism in place to describe how to get from one to the other. This is called Routing. A ``route'' is a defined pair of addresses: a <bf>destination</bf> and a <bf>gateway</bf>. The pair indicates that if you are trying to get to this <em>destination</em>, send along through this <em>gateway</em>. There are three types of destinations: individual hosts, subnets, and ``default''. The ``default route'' is used if none of the other routes apply. We will talk a little bit more about default routes later on. There are also three types of gateways: individual hosts, interfaces (also called ``links''), and ethernet hardware addresses. <sect1><heading>An example</heading> <p>To illustrate different aspects of routing, we will use the following example which is the output of the command <tt>netstat -r</tt>: <tscreen><verb> Destination Gateway Flags Refs Use Netif Expire default outside-gw UGSc 37 418 ppp0 localhost localhost UH 0 181 lo0 test0 0:e0:b5:36:cf:4f UHLW 5 63288 ed0 77 10.20.30.255 link#1 UHLW 1 2421 foobar.com link#1 UC 0 0 host1 0:e0:a8:37:8:1e UHLW 3 4601 lo0 host2 0:e0:a8:37:8:1e UHLW 0 5 lo0 => host2.foobar.com link#1 UC 0 0 224 link#1 UC 0 0 </verb></tscreen> The first two lines specify the default route (which we will cover in the next section) and the <tt>localhost</tt> route. The interface (<tt>Netif</tt> column) that it specifies to use for <tt>localhost</tt> is <tt>lo0</tt>, also known as the loopback device. This says to keep all traffic for this destination internal, rather than sending it out over the LAN, since it will only end up back where it started anyway. The next thing that stands out are the ``<tt>0:e0:...</tt>'' addresses. These are ethernet hardware addresses. FreeBSD will automatically identify any hosts (<tt>test0</tt> in the example) on the local ethernet and add a route for that host, directly to it over the ethernet interface, <tt>ed0</tt>. There is also a timeout (<tt>Expire</tt> column) associated with this type of route, which is used if we fail to hear from the host in a specific amount of time. In this case the route will be automatically deleted. These hosts are identified using a mechanism known as RIP (Routing Information Protocol), which figures out routes to local hosts based upon a shortest path determination. FreeBSD will also add subnet routes for the local subnet (<tt>10.20.30.255</tt> is the broadcast address for the subnet <tt>10.20.30</tt>, and <tt>foobar.com</tt> is the domain name associated with that subnet). The designation <tt>link#1</tt> refers to the first ethernet card in the machine. You'll notice no additional interface is specified for those. Both of these groups (local network hosts and local subnets) have their routes automatically configured by a daemon called <tt>routed</tt>. If this is not run, then only routes which are statically defined (ie. entered explicitly) will exist. The <tt>host1</tt> line refers to our host, which it knows by ethernet address. Since we are the sending host, FreeBSD knows to use the loopback interface (<tt>lo0</tt>) rather than sending it out over the ethernet interface. The two <tt>host2</tt> lines are an example of what happens when we use an ifconfig alias (see the section of ethernet for reasons why we would do this). The <tt>=></tt> symbol after the <tt>lo0</tt> interface says that not only are we using the loopback (since this is address also refers to the local host), but specifically it is an alias. Such routes only show up on the host that supports the alias; all other hosts on the local network will simply have a <tt>link#1</tt> line for such. The final line (destination subnet <tt>224</tt>) deals with MultiCasting, which will be covered in a another section. The other column that we should talk about are the <tt>Flags</tt>. Each route has different attributes that are described in the column. Below is a short table of some of these flags and their meanings: <descrip> <tag/U/ <bf/Up:/ The route is active. <tag/H/ <bf/Host:/ The route destination is a single host. <tag/G/ <bf/Gateway:/ Send anything for this destination on to this remote system, which will figure out from there where to send it. <tag/S/ <bf/Static:/ This route was configured manually, not automatically generated by the system. <tag/C/ <bf/Clone:/ Generates a new route based upon this route for machines we connect to. This type of route is normally used for local networks. <tag/W/ <bf/WasCloned/ Indicated a route that was auto-configured based upon a local area network (Clone) route. <tag/L/ <bf/Link:/ Route involves references to ethernet hardware. </descrip> <sect1><heading>Default routes</heading> <p>When the local system needs to make a connection to remote host, it checks the routing table to determine if a known path exists. If the remote host falls into a subnet that we know how to reach (Cloned routes), then the system checks to see if it can connect along that interface. If all known paths fail, the system has one last option: the <bf>default</bf> route. This route is a special type of gateway route (usually the only one present in the system), and is always marked with a ``<tt>c</tt>'' in the flags field. For hosts on a local area network, this gateway is set to whatever machine has a direct connection to the outside world (whether via PPP link, or your hardware device attached to a dedicated data line). If you are configuring the default route for a machine which itself is functioning as the gateway to the outside world, then the default route will be the gateway machine at your Internet Service Provider's (ISP) site. Let's look at an example of default routes. This is a common configuration: <tscreen><verb> [Local2] <--ether--> [Local1] <--PPP--> [ISP-Serv] <--ether--> [T1-GW] </verb></tscreen> The hosts <tt>Local1</tt> and <tt>Local2</tt> are at your site, with the formed being your PPP connection to your ISP's Terminal Server. Your ISP has a local network at their site, which has, among other things, the server where you connect and a hardware device (T1-GW) attached - to the ISP's internet feed. + to the ISP's Internet feed. The default routes for each of your machines will be: <tscreen><verb> host default gateway interface ---- --------------- --------- Local2 Local1 ethernet Local1 T1-GW PPP </verb></tscreen> A common question is ``Why (or how) would we set the T1-GW to be the default gateway for Local1, rather than the ISP server it is connected to?''. Remember, since the PPP interface is using an address on the ISP's local network for your side of the connection, routes for any other machines on the ISP's local network will be automatically generated. Hence, you will already know how to reach the T1-GW machine, so there is no need for the intermediate step of sending traffic to the ISP server. As a final note, it is common to use the address ``<tt>...1</tt>'' as the gateway address for your local network. So (using the same example), if your local class-C address space was <tt>10.20.30</tt> and your ISP was using <tt>10.9.9</tt> then the default routes would be: <tscreen><verb> Local2 (10.20.30.2) --> Local1 (10.20.30.1) Local1 (10.20.30.1, 10.9.9.30) --> T1-GW (10.9.9.1) </verb></tscreen> <sect1><heading>Dual homed hosts</heading> <p>There is one other type of configuration that we should cover, and that is a host that sits on two different networks. Technically, any machine functioning as a gateway (in the example above, using a PPP connection) counts as a dual-homed host. But the term is really only used to refer to a machine that sits on two local-area networks. In one case, the machine as two ethernet cards, each - having an address on the seperate subnets. Alternately, + having an address on the separate subnets. Alternately, the machine may only have one ethernet card, and be using ifconfig aliasing. The former is used if two physically separate ethernet networks are in use, the latter if there is one physical network segment, but two logically - seperate subnets. + separate subnets. Either way, routing tables are set up so that each subnet knows that this machine is the defined gateway (inbound route) to the other subnet. This configuration, with the machine acting as a Bridge between the two subnets, is often used when we need to implement packet filtering or firewall security in either or both directions. - <sect1><heading>Routing propogation</heading> + <sect1><heading>Routing propagation</heading> <p>We have already talked about how we define our routes to the outside world, but not about how the outside world finds us. We already know that routing tables can be set up so that all traffic for a particular address space (in our examples, a class-C subnet) can be sent to a particular host on that network, which will forward the packets inbound. When you get an address space assigned to your site, your service provider will set up their routing tables so that all traffic for your subnet will be sent down your PPP link to your site. But how do sites across the country know to send to your ISP? There is a system (much like the distributed DNS information) that keeps track of all assigned address-spaces, and defines their point of connection to the Internet Backbone. The ``Backbone'' are the main - trunk lines that carry internet traffic across the + trunk lines that carry Internet traffic across the country, and around the world. Each backbone machine has a copy of a master set of tables, which direct traffic for a particular network to a specific backbone carrier, and from there down the chain of service providers until it reaches your network. It is the task of your service provider to advertise to the backbone sites that they are the point of connection (and thus the path inward) for your site. This is known - as route propogation. + as route propagation. <!-- <sect1><heading>Multicast Routing</heading> --> <sect1><heading>Troubleshooting</heading> - <p>Sometimes, there is a problem with routing propogation, + <p>Sometimes, there is a problem with routing propagation, and some sites are unable to connect to you. Perhaps the most useful command for trying to figure out where a routing is breaking down is the <tt>traceroute(8)</tt> command. It is equally useful if you cannot seem to make a connection to a remote machine (ie. <tt>ping(8)</tt> fails). The <tt>traceroute(8)</tt> command is run with the name of the remote host you are trying to connect to. It will show the gateway hosts along the path of the attempt, eventually either reaching the target host, or terminating because of a lack of connection. For more information, see the manual page for <tt>traceroute(8)</tt>. diff --git a/handbook/scsi.sgml b/handbook/scsi.sgml index 947d627f8b..532b8cea38 100644 --- a/handbook/scsi.sgml +++ b/handbook/scsi.sgml @@ -1,798 +1,798 @@ -<!-- $Id: scsi.sgml,v 1.10 1995-12-04 17:58:50 jfieber Exp $ --> +<!-- $Id: scsi.sgml,v 1.11 1996-01-31 14:26:17 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <!-- <title>An introduction to SCSI and its use with FreeBSD (c) 1995, Wilko Bulte, Sun Sep 3 17:14:48 MET DST 1995 Copyright 1995, Wilko C. Bulte, Arnhem, The Netherlands This document attempts to describe the background of SCSI, its (mis)use with FreeBSD and some common pitfalls. --> What is SCSI?

Copyright © 1995, &a.wilko;.3 September 1995. SCSI is an acronym for Small Computer Systems Interface. It is an ANSI standard that has become one of the leading I/O buses in the computer industry. The foundation of the SCSI standard was laid by Shugart Associates (the same guys that gave the world the first mini floppy disks) when they introduced the SASI bus (Shugart Associates Standard Interface). After some time an industry effort was started to come to a more strict standard allowing devices from different vendors to work together. This effort was recognized in the ANSI SCSI-1 standard. The SCSI-1 standard (approx 1985) is now more or less obsolete. The current standard is SCSI-2 (see ), with SCSI-3 on the drawing boards. In addition to a physical interconnection standard, SCSI defines a logical (command set) standard to which disk devices must adhere. This standard is called the Common Command Set (CCS) and was developed more or less in parallel with ANSI SCSI-1. SCSI-2 includes the (revised) CCS as part of the standard itself. The commands are dependent on the type of device at hand. It does not make much sense of course to define a Write command for a scanner. The SCSI bus is a parallel bus, which comes in a number of variants. The oldest and most used is an 8 bit wide bus, with single-ended signals, carried on 50 wires. (If you don't know what single-ended means, don't worry, that is what this document is all about.) Modern designs also use 16 bit wide buses, with differential signals. This allows transfer speeds of 20Mbytes/second, on cables lengths of up to 25 meters. SCSI-2 allows a maximum bus width of 32 bits, using an additional cable. Of course the SCSI bus not only has data lines, but also a number of control signals. A very elaborate protocol is part of the standard to allow multiple devices to share the bus in an efficient manner. In SCSI-2, the data is always checked using a separate parity line. In pre-SCSI-2 designs parity was optional. In SCSI-3 even faster bus types are introduced, along with a serial SCSI bus that reduces the cabling overhead and allows a higher maximum bus length. As you could have guessed from the description above, SCSI devices are intelligent. They have to be to adhere to the SCSI standard (which is over 2 inches thick BTW). So, for a hard disk drive for instance you do not specify a head/cylinder/sector to address a particular block, but simply the number of the block you want. Elaborate caching schemes, automatic bad block replacement etc are all made possible by this 'intelligent device' approach. On a SCSI bus, each possible pair of devices can communicate. Whether their function allows this is another matter, but the standard does not restrict it. To avoid signal contention, the 2 devices have to arbitrate for the bus before using it. The philosophy of SCSI is to have a standard that allows older-standard devices to work with newer-standard ones. So, an old SCSI-1 device should normally work on a SCSI-2 bus. I say Normally, because it is not absolutely sure that the implementation of an old device follows the (old) standard closely enough to be acceptable on a new bus. Modern devices are usually more well-behaved, because the standardization has become more strict and is better adhered to by the device manufacturers. Generally speaking, the chances of getting a working set of devices on a single bus is better when all the devices are SCSI-2 or newer. This does not imply that you have to dump all your old stuff when you get that shiny 2Gb disk: I own a system on which a pre-SCSI-1 disk, a SCSI-2 QIC tape unit, a SCSI-1 helical scan tape unit and 2 SCSI-1 disks work together quite happily. Components of SCSI

As said before, SCSI devices are smart. The idea is to put the knowledge about intimate hardware details onto the SCSI device itself. In this way, the host system does not have to worry about things like how many heads are hard disks has, or how many tracks there are on a specific tape device. If you are curious, the standard specifies commands with which you can query your devices on their hardware particulars. The advantage of intelligent devices is obvious: the device drivers on the host can be made in a much more generic fashion, there is no longer a need to change (and qualify!) drivers for every odd new device that is introduced. For cabling and connectors there is a golden rule: get good stuff. With bus speeds going up all the time you will save yourself a lot of grief by using good material. So, gold plated connectors, shielded cabling, sturdy connector hoods with strain reliefs etc are the way to go. Second golden rule: don't use cables longer than necessary. I once spent 3 days hunting down a problem with a flaky machine only to discover that shortening the SCSI bus by 1 meter solved the problem. And the original bus length was well within the SCSI specification. SCSI bus types

From an electrical point of view, there are two incompatible bus types: single-ended and differential. This means that there are two different main groups of SCSI devices and controllers, which cannot be mixed on the same bus. It is possible however to use special converter hardware to transform a single-ended bus into a differential one (and vice versa). The differences between the bus types are explained in the next sections. In lots of SCSI related documentation there is a sort of jargon in use to abbreviate the different bus types. A small list: FWD: Fast Wide Differential FND: Fast Narrow Differential SE: Single Ended FN: Fast Narrow etc. With a minor amount of imagination one can usually imagine what is meant. Wide is a bit ambiguous, it can indicate 16 or 32 bit buses. As far as I know, the 32 bit variant is not (yet) in use, so wide normally means 16 bit. Fast means that the timing on the bus is somewhat different, so that on a narrow (8 bit) bus 10 Mbytes/sec are possible instead of 5 Mbytes/sec for 'slow' SCSI. More on this later. It should be noted that the data lines > 8 are only used for data transfers and device addressing. The transfers of commands and status messages etc are only performed on the lowest 8 data lines. The standard allows narrow devices to operate on a wide bus. The usable bus width is negotiated between the devices. You have to watch your device addressing closely when mixing wide and narrow. Single ended buses

A single-ended SCSI bus uses signals that are either 5 Volts or 0 Volts (indeed, TTL levels) and are relative to a COMMON ground reference. A singled ended 8 bit SCSI bus has approximately 25 ground lines, who are all tied to a single `rail' on all devices. A standard single ended bus has a maximum length of 6 meters. If the same bus is used with fast-SCSI devices, the maximum length allowed drops to 3 meters. Fast-SCSI means that instead of 5Mbytes/sec the bus allows 10Mbytes/sec transfers. Please note that this means that if some devices on your bus use 'fast' to communicate your bus must adhere to the length restrictions for fast buses! It is obvious that with the newer fast-SCSI devices the bus length can become a real bottleneck. This is why the differential SCSI bus was introduced in the SCSI-2 standard. For connector pinning and connector types please refer to the SCSI-2 standard (see ) itself, connectors etc are listed there in painstaking detail. Beware of devices using non-standard cabling. For instance Apple uses a 25pin D-type connecter (like the one on serial ports and parallel printers). Considering that the official SCSI bus needs 50 pins you can imagine the use of this connector needs some 'creative cabling'. The reduction of the number of ground wires they used is a bad idea, you better stick to 50 pins cabling in accordance with the SCSI standard. Differential buses

A differential SCSI bus has a maximum length of 25 meters. Quite a difference from the 3 meters for a single-ended fast-SCSI bus. The idea behind differential signals is that each bus signal has it's own return wire. So, each signal is carried on a (preferably twisted) pair of wires. The voltage difference between these two wires determines whether the signal is asserted or de-asserted. To a certain extent the voltage difference between ground and the signal wire pair is not relevant (don't try 10 kVolts though..). It is beyond the scope of this document to explain why this differential idea is so much better. Just accept that electrically seen the use of differential signals gives a much better noise margin. You will normally find differential buses in use for inter-cabinet connections. Because of the lower cost single ended is mostly used for shorter buses like inside cabinets. There is nothing that stops you from using differential stuff with FreeBSD, as long as you use a controller that has device driver support in FreeBSD. As an example, Adaptec marketed the AH1740 as a single ended board, whereas the AH1744 was differential. The software interface to the host is identical for both. Terminators

Terminators in SCSI terminology are resistor networks that are used to get a correct impedance matching. Impedance matching is important to get clean signals on the bus, without reflections or ringing. If you once made a long distance telephone call on a bad line you probably know what reflections - are. With 20Mbytes/sec travelling over your SCSI bus, you + are. With 20Mbytes/sec traveling over your SCSI bus, you don't want signals echoing back. Terminators come in various incarnations, with more or less sophisticated designs. Of course, there are internal and external variants. Almost every SCSI device comes with a number of sockets in which a number of resistor networks can (must be!) installed. If you remove terminators from a device, carefully store 'm. You will need them when you ever decide to reconfigure your SCSI bus. There is enough variation in even these simple tiny things to make finding the exact replacement a frustrating business. There are also SCSI devices that have a single jumper to enable or disable a built-in terminator. There are special terminators you can stick onto a flat cable bus. Others look like external connectors, or a connector hood without a cable. So, lots of choice as you can see. There is much debate going on if and when you should switch from simple resistor (passive) terminators to active terminators. Active terminators contain slightly more elaborate circuit to give cleaner bus signals. The general consensus seems to be that the usefulness of active termination increases when you have long buses and/or fast devices. If you ever have problems with your SCSI buses you might consider trying an active terminator. Try to borrow one first, they reputedly are quite expensive. Please keep in mind that terminators for differential and single-ended buses are not identical. You should not mix the two variants. OK, and now where should you install your terminators? This is by far the most misunderstood part of SCSI. And it is by far the simplest.. The rule is: every SCSI bus has 2 (two) terminators, one at each end of the bus. So, two and not - one or three or whatever. Do yourself a favour and stick to + one or three or whatever. Do yourself a favor and stick to this rule. It will save you endless grief, because wrong termination has the potential to introduce highly mysterious bugs. A common pitfall is to have an internal (flat)cable in a machine and also an external cable attached to the controller. It seems almost everybody forgets to remove the terminators from the controller. The terminator must now be on the last external device, and not on the controller! In general, every reconfiguration of a SCSI bus must pay attention to this. What I did myself is remove all terminators from my SCSI devices and controllers. I own a couple of external terminators, for both the Centronics-type external cabling and for the internal flat cable connectors. This makes reconfiguration much easier. Terminator power

The terminators discussed in the previous chapter need power to operate properly. On the SCSI bus, a line is dedicated to this purpose. So, simple huh? Not so. Each device can provide it's own terminator power to the terminator sockets it has on-device. But if you have external terminators, or when the device supplying the terminator power to the SCSI bus line is switched off you are in trouble. The idea is that initiators (these are devices that initiate actions on the bus, a discussion follows) must supply terminator power. All SCSI devices are allowed (but not required) to supply terminator power. To allow for switched-off devices on a bus, the terminator power must be supplied to the bus via a diode. This prevents the backflow of current to switched-off devices. To prevent all kinds of nastiness, the terminator power is usually fused. As you can imagine, fuses might blow. This can, but does not have to, lead to a non functional bus. If multiple devices supply terminator power, a single blown fuse will not put you out of business. A single supplier with a blown fuse certainly will. Clever external terminators sometimes have a LED indication that shows whether terminator power is present. In newer designs auto-restoring fuses that 'reset' themselves after some time are sometimes used. On modern devices, sometimes integrated terminators are used. These things are special purpose integrated circuits that can be dis/en-abled with a control pin. It is not necessary to physically remove them from a device. You may find them on newer host adapters, sometimes they even are software configurable, using some sort of setup tool. Consult you documentation! Device addressing

Because the SCSI bus is, ehh, a bus there must be a way to distinguish or address the different devices connected to it. This is done by means of the SCSI or target ID. Each device has a unique target ID. You can select the ID to which a device must respond using a set of jumpers, or a dip switch, or something similar. Consult the documentation of your device for more information. Beware of multiple devices configured to use the same ID. Chaos normally reigns in this case. For an 8 bit bus, a maximum of 8 targets is possible. The maximum is 8 because the selection is done bitwise using the 8 data lines on the bus. For wide this increases to the number of data lines. The higher the SCSI target ID, the higher the priority the devices has. When it comes to arbitration between devices that want to use the bus at the same time, the device that has the highest SCSI ID will win. This also means that the SCSI host adapter usually uses target ID 7 (for narrow buses). For a further subdivision, the standard allows for Logical Units or LUNs for short. A single target ID may have multiple LUNs. For example, a tape device including a tape changer may have LUN 0 for the tape device itself, and LUN 1 for the tape changer. In this way, the host system can address each of the parts of the tape unit as desired. Bus layout

SCSI buses are linear. So, not shaped like Y-junctions, star topologies, cobwebs or whatever else people might want to invent. You might notice that the terminator issue discussed earlier becomes rather hairy if your bus is not linear.. The electrical characteristics, it's noise margins and ultimately the reliability of it all are tightly related to linear bus rule. Stick to the linear bus rule! Using SCSI with FreeBSD

About translations, BIOSes and magic...

As stated before, you should first make sure that you have a electrically sound bus. When you want to use a SCSI disk on your PC as boot disk, you must aware of some quirks related to PC BIOSes. The PC BIOS in it's first incarnation used a low level physical interface to the hard disk. So, you had to tell the BIOS (using a setup tool or a BIOS built-in setup) how your disk physically looked like. This involved stating number of heads, number of cylinders, number of sectors per track, obscure things like precompensation and reduced write current cylinder etc. One might be inclined to think that since SCSI disks are smart you can forget about this. Alas, the arcane setup issue is still present today. The system BIOS needs to know how to access your SCSI disk with the head/cyl/sector method in order to load the FreeBSD kernel during boot. The SCSI host adapter or SCSI controller you have put in your AT/EISA/PCI/whatever bus to connect your disk therefore has it's own on-board BIOS. During system startup, the SCSI BIOS takes over the hard disk interface routines from the system BIOS. To fool the system BIOS, the system setup is normally set to No hard disk present. Obvious, isn't it? The SCSI BIOS itself presents to the system a so called translated drive. This means that a fake drive table is constructed that allows the PC to boot the drive. This translation is often (but not always) done using a pseudo drive with 64 heads and 32 sectors per track. By varying the number of cylinders, the SCSI BIOS adapts to the actual drive size. It is useful to note that 32 * 64 / 2 = the size of your drive in megabytes. The division by 2 is to get from disk blocks that are normally 512 bytes in size to Kbytes. Right.. All is well now?! No, it isn't. The system BIOS has another quirk you might run into. The number of cylinders of a bootable hard disk cannot be greater than 1024. Using the translation above, this is a show-stopper for disks greater than 1 Gb. With disk capacities going up all the time this is causing problems. Fortunately, the solution is simple: just use another translation, e.g. with 128 heads instead of 32. In most cases new SCSI BIOS versions are available to upgrade older SCSI host adapters. Some newer adapters have an option, in the form of a jumper or software setup selection, to switch the translation the SCSI BIOS uses. It is very important that all operating systems on the disk use the same translation to get the right idea about where to find the relevant partitions. So, when installing FreeBSD you must answer any questions about heads/cylinders etc using the translated values your host adapter uses. Failing to observe the translation issue might lead to un-bootable systems or operating systems overwriting each others partitions. Using fdisk you should be able to see all partitions. You might have heard some talk of 'lying' devices? Older FreeBSD kernels used to report the geometry of SCSI disks when booting. An example from one of my systems: aha0 targ 0 lun 0: sd0: 636MB (1303250 total sec), 1632 cyl, 15 head, 53 sec, bytes/sec 512 Newer kernels usually don't report this information.. e.g. (bt0:0:0): "SEAGATE ST41651 7574" type 0 fixed SCSI 2 sd0(bt0:0:0): Direct-Access 1350MB (2766300 512 byte sectors) Why has this changed? This info is retrieved from the SCSI disk itself. Newer disks often use a technique called zone bit recording. The idea is that on the outer cylinders of the drive there is more space so more sectors per track can be put on them. This results in disks that have more tracks on outer cylinders than on the inner cylinders and, last but not least, have more capacity. You can imagine that the value reported by the drive when inquiring about the geometry now becomes suspect at best, and nearly always misleading. When asked for a geometry , it is nearly always better to supply the geometry used by the BIOS, or if the BIOS is never going to know about this disk, (e.g. it is not a booting disk) to supply a - ficticious geometry that is convenient. + fictitious geometry that is convenient. SCSI subsystem design

FreeBSD uses a layered SCSI subsystem. For each different controller card a device driver is written. This driver knows all the intimate details about the hardware it controls. The driver has a interface to the upper layers of the SCSI subsystem through which it receives it's commands and reports back any status. On top of the card drivers there are a number of more generic drivers for a class of devices. More specific: a driver for tape devices (abbreviation: st), magnetic disks (sd), cdroms (cd) etc. In case you are wondering where you can find this stuff, it all lives in /sys/scsi. See the man pages in section 4 for more details. The multi level design allows a decoupling of low-level bit banging and more high level stuff. Adding support for another - piece of hardware is a much more managable problem. + piece of hardware is a much more manageable problem. Kernel configuration

Dependent on your hardware, the kernel configuration file must contain one or more lines describing your host adapter(s). This includes I/O addresses, interrupts etc. Consult the man page for your adapter driver to get more info. Apart from that, check out /sys/i386/conf/LINT for an overview of a kernel config file. LINT contains every possible option you can dream of. It does not imply LINT will actually get you to a working kernel at all. Although it is probably stating the obvious: the kernel config file should reflect your actual hardware setup. So, interrupts, I/O addresses etc must match the kernel config file. During system boot messages will be displayed to indicate whether the configured hardware was actually found. An example loosely based on the FreeBSD 2.0.5-Release kernel config file LINT with some added comments (between []): # SCSI host adapters: `aha', `ahb', `aic', `bt', `nca' # # aha: Adaptec 154x # ahb: Adaptec 174x # ahc: Adaptec 274x/284x/294x # aic: Adaptec 152x and sound cards using the Adaptec AIC-6360 (slow!) # bt: Most Buslogic controllers # nca: ProAudioSpectrum cards using the NCR 5380 or Trantor T130 # uha: UltraStore 14F and 34F # sea: Seagate ST01/02 8 bit controller (slow!) # wds: Western Digital WD7000 controller (no scatter/gather!). # [For an Adaptec AHA274x, 284x etc controller] controller ahc0 at isa? bio irq ? vector ahcintr # port??? iomem? [For an Adaptec AHA174x controller] controller ahb0 at isa? bio irq ? vector ahbintr [For an Ultrastor adapter] controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr # Map SCSI buses to specific SCSI adapters controller scbus0 at ahc0 controller scbus2 at ahb0 controller scbus1 at uha0 # The actual SCSI devices disk sd0 at scbus0 target 0 unit 0 [SCSI disk 0 is at scbus 0, LUN 0] disk sd1 at scbus0 target 1 [implicit LUN 0 if omitted] disk sd2 at scbus1 target 3 [SCSI disk on the uha0] disk sd3 at scbus2 target 4 [SCSI disk on the ahb0] tape st1 at scbus0 target 6 [SCSI tape at target 6] device cd0 at scbus? [the first ever CDROM found, no wiring] The example above tells the kernel to look for a ahc (Adaptec 274x) controller, then for an Adaptec 174x board, and so on. The lines following the controller specifications tell the kernel to configure specific devices but only attach them when they match the target ID and LUN specified on the corresponding bus. Wired down devices get 'first shot' at the unit numbers so the first non 'wired down' device, is allocated the unit number one greater than the highest 'wired down' unit number for that kind of device. So, if you had a SCSI tape at target ID 2 it would be configured as st2, as the tape at target ID 6 is wired down to unit number 1. Note that wired down devices need not be found to get their unit number. The unit number for a wired down device - is reserved for thet device, even if it is turned off at boot + is reserved for that device, even if it is turned off at boot time. This allows the device to be turned on and brought on-line at a later time, without rebooting. Notice that a device's unit number has no relationship with it's target ID on the SCSI bus. Below is another example of a kernel config file as used by FreeBSD version < 2.0.5. The difference with the first example is that devices are not 'wired down'. 'Wired down' means that you specify which SCSI target belongs to which device. A kernel built to the config file below will attach the first SCSI disk it finds to sd0, the second disk to sd1 etc. If you ever removed or added a disk, all other devices of the same type (disk in this case) would 'move around'. This implies you have to change /etc/fstab each time. Although the old style still works, you are strongly recommended to use this new feature. It will save you a lot of grief whenever you shift your hardware around on the SCSI buses. So, when you re-use your old trusty config file after upgrading from a pre-FreeBSD2.0.5.R system check this out. [driver for Adaptec 174x] controller ahb0 at isa? bio irq 11 vector ahbintr [for Adaptec 154x] controller aha0 at isa? port "IO_AHA0" bio irq 11 drq 5 vector ahaintr [for Seagate ST01/02] controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr controller scbus0 device sd0 [support for 4 SCSI harddisks, sd0 up sd3] device st0 [support for 2 SCSI tapes] [for the cdrom] device cd0 #Only need one of these, the code dynamically grows Both examples support SCSI disks. If during boot more devices of a specific type (e.g. sd disks) are found than are configured in the booting kernel, the system will simply allocate more devices, incrementing the unit number starting at the last number 'wired down'. If there are no 'wired down' devices then counting starts at unit 0. Use man 4 scsi to check for the latest info on the SCSI subsystem. For more detailed info on host adapter drivers use eg man 4 aha for info on the Adaptec 154x driver. Tuning your SCSI kernel setup

Experience has shown that some devices are slow to respond to INQUIRY commands after a SCSI bus reset (which happens at Boot time). An INQUIRY command is sent by the kernel on boot to see what kind of device (disk, tape, cdrom etc) is connected to a specific target ID. This process is called device probing by the way. To work around this problem, FreeBSD allows a tunable delay time before the SCSI devices are probed following a SCSI bus reset. You can set this delay time in your kernel configuration file using a line like: options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device This line sets the delay time to 15 seconds. On my own system I had to use 3 seconds minimum to get my trusty old CDROM drive to be recognized. Start with a high value (say 30 seconds or so) when you have problems with device recognition. If this helps, tune it back until it just stays working. Rogue SCSI devices

Although the SCSI standard tries to be complete and concise, it is a complex standard and implementing things correctly is no easy task. Some vendors do a better job then others. This is exactly where the 'rogue' devices come into view. Rogues are devices that are recognized by the FreeBSD kernel as behaving slightly (...) non-standard. Rogue devices are reported by the kernel when booting. An example for two of my cartridge tape units: Feb 25 21:03:34 yedi /386bsd: ahb0 targ 5 lun 0: Feb 25 21:03:34 yedi /386bsd: st0: Tandberg tdc3600 is a known rogue Mar 29 21:16:37 yedi /386bsd: aha0 targ 5 lun 0: Mar 29 21:16:37 yedi /386bsd: st1: Archive Viper 150 is a known rogue For instance, there are devices that respond to all LUNs on a certain target ID, even if they are actually only one device. It is easy to see that the kernel might be fooled into believing that there are 8 LUNs at that particular target ID. The confusion this causes is left as an exercise to the reader. The SCSI subsystem of FreeBSD recognizes devices with bad habits by looking at the INQUIRY response they send when probed. Because the INQUIRY response also includes the version number of the device firmware, it is even possible that for different firmware versions different workarounds are used. This scheme works fine, but keep in mind that it of course only works for devices that are KNOWN to be weird. If you are the first to connect your bogus Mumbletech SCSI cdrom you might be the one that has to define which workaround is needed. Busmaster host adapters

Most, but not all, SCSI host adapters are bus mastering controllers. This means that they can do I/O on their own without putting load onto the host CPU for data movement. This is of course an advantage for a multitasking operating system like FreeBSD. It must be noted however that there might be some rough edges. For instance an Adaptec 1542 controller can be set to use different transfer speeds on the host bus (ISA or AT in this case). The controller is settable to different rates because not all motherboards can handle the higher speeds. Problems like hangups, bad data etc might be the result of using a higher data transfer rate then your motherboard can stomach. The solution is of course obvious: switch to a lower data transfer rate and try if that works better. In the case of a Adaptec 1542, there is an option that can be put into the kernel config file to allow dynamic determination of the right, read: fastest feasible, transfer rate. This option is disabled by default: options "TUNE_1542" #dynamic tune of bus DMA speed Check the man pages for the host adapter that you use. Or better still, use the ultimate documentation (read: driver source). Tracking down problems

The following list is an attempt to give a guideline for the most common SCSI problems and their solutions. It is by no means complete. Check for loose connectors and cables. - Check and doublecheck the location and number of your terminators. + Check and double check the location and number of your terminators. Check if your bus has at least one supplier of terminator power (especially with external terminators. Check if no double target IDs are used. Check if at least one device provides terminator power to the bus. Check if all devices to be used are powered up. Make a minimal bus config with as little devices as possible. If possible, configure your host adapter to use slow bus speeds. If you can compile a kernel, make one with the SCSIDEBUG option, and try accessing the device with debugging turned on for that device. If your device doesn't even probe at startup, you may have to define the address of the device that is failing, and the desired debug level in /sys/scsi/scsidebug.h. If it probes but just doesn't work, you can use the scsi(8) command to dynamically set a debug level to it in a running kernel (if SCSIDEBUG is defined). This will give you COPIOUS debugging output with which to confuse the gurus. see man 4 scsi for more exact information. Also look at man 8 scsi. Further reading

If you intend to do some serious SCSI hacking, you might want to have the official standard at hand: Approved American National Standards can be purchased from ANSI at 11 West 42nd Street, 13th Floor, New York, NY 10036, Sales Dept: (212) 642-4900. You can also buy many ANSI standards and most committee draft documents from Global Engineering Documents, 15 Inverness Way East, Englewood, CO 80112-5704, Phone: (800) 854-7179, Outside USA and Canada: (303) 792-2181, FAX: (303) 792- 2192. Many X3T10 draft documents are available electronically on the SCSI BBS (719-574-0424) and on the ncrinfo.ncr.com anonymous ftp site. Latest X3T10 committee documents are: AT Attachment (ATA or IDE) [X3.221-1994] (Approved) ATA Extensions (ATA-2) [X3T10/948D Rev 2i] Enhanced Small Device Interface (ESDI) [X3.170-1990/X3.170a-1991] (Approved) Small Computer System Interface - 2 (SCSI-2) [X3.131-1994] (Approved) SCSI-2 Common Access Method Transport and SCSI Interface Module (CAM) [X3T10/792D Rev 11] Other publications that might provide you with additional information are: "SCSI: Understanding the Small Computer System Interface", written by NCR Corporation. Available from: Prentice Hall, Englewood Cliffs, NJ, 07632 Phone: (201) 767-5937 ISBN 0-13-796855-8 "Basics of SCSI", a SCSI tutorial written by Ancot Corporation Contact Ancot for availability information at: Phone: (415) 322-5322 Fax: (415) 322-0455 "SCSI Interconnection Guide Book", an AMP publication (dated 4/93, Catalog 65237) that lists the various SCSI connectors and suggests cabling schemes. Available from AMP at (800) 522-6752 or (717) 564-0100 "Fast Track to SCSI", A Product Guide written by Fujitsu. Available from: Prentice Hall, Englewood Cliffs, NJ, 07632 Phone: (201) 767-5937 ISBN 0-13-307000-X "The SCSI Bench Reference", "The SCSI Encyclopedia", and the "SCSI Tutor", ENDL Publications, 14426 Black Walnut Court, Saratoga CA, 95070 Phone: (408) 867-6642 "Zadian SCSI Navigator" (quick ref. book) and "Discover the Power of SCSI" (First book along with a one-hour video and tutorial book), Zadian Software, Suite 214, 1210 S. Bascom Ave., San Jose, CA 92128, (408) 293-0800 On Usenet the newsgroups and are noteworthy places to look for more info. You can also find the SCSI-Faq there, which is posted periodically. Most major SCSI device and host adapter suppliers operate ftp sites and/or BBS systems. They may be valuable sources of information about the devices you own. diff --git a/handbook/skey.sgml b/handbook/skey.sgml index 4b33dec279..9e6d3c0790 100644 --- a/handbook/skey.sgml +++ b/handbook/skey.sgml @@ -1,302 +1,302 @@ - + S/Key

Contributed by &a.wollman;25 September 1995.

S/Key is a one-time password scheme based on a one-way hash function (in our version, this is MD4 for compatibility; other versions have used MD5 and DES-MAC). S/Key has been a standard part of all FreeBSD distributions since version 1.1.5, and is also implemented on a large and growing number of other systems. S/Key is a registered trademark of Bell Communications Research, Inc.

There are three different sorts of passwords which we will talk about in the discussion below. The first is your usual UNIX-style or Kerberos password; we'll call this a ``UNIX password''. The second sort is the one-time password which is generated by the S/Key `The secret password does not necessarily have anything to do with your UNIX password (while they can be the same, this is not recommended). While UNIX passwords are limited to eight characters in length, your S/Key secret password can be as long as you like; I use seven-word phrases. In general, the S/Key system operates completely independently of the UNIX password system.

There are in addition two other sorts of data involved in the S/Key system; one is called the ``seed'' or (confusingly) ``key'', and consists of two letters and five digits, and the other is the ``iteration count'' and is a number between 100 and 1. S/Key constructs a one-time password from these components by concatenating the seed and the secret password, then applying a one-way hash (the RSA Data Security, Inc., MD4 secure hash function) iteration-count times, and turning the result into six short English words. The `There are four programs involved in the S/Key system which we will discuss below. The `/etc/skeykeys file and prints out the invoking user's current iteration count and seed. Finally, the `There are four different sorts of operations we will cover. The first is using the `Secure connection initialization

To initialize S/Key, change your password, or change your seed while logged in over a secure connection (e.g., on the console of a machine), use the ` $ keyinit Updating wollman: ) these will not appear if you Old key: ha73895 ) have not used S/Key before Reminder - Only use this method if you are directly connected. If you are using telnet or rlogin exit with no password and use keyinit -s. Enter secret password: ) I typed my pass phrase here Again secret password: ) I typed it again ID wollman s/key is 99 ha73896 ) discussed below SAG HAS FONT GOUT FATE BOOM )

There is a lot of information here. At the `Enter secret password:' prompt, you should enter some password or phrase (I use phrases of minimum seven words) which will be needed to generate login keys. The line starting `ID' gives the parameters of your particular S/Key instance: your login name, the iteration count, and seed. When logging in with S/Key, the system will remember these parameters and present them back to you so you don't have to remember them. The last line gives the particular one-time password which corresponds to those parameters and your secret password; if you were to re-login immediately, this one-time password is the one you would use. Insecure connection initialization

To initialize S/Key or change your password or seed over an insecure connection, you will need to already have a secure connection to some place where you can run the ` $ keyinit -s Updating wollman: Old key: kh94741 -Reminder you need the 6 english words from the skey command. +Reminder you need the 6 English words from the skey command. Enter sequence count from 1 to 9999: 100 ) I typed this Enter new key [default kh94742]: s/key 100 kh94742 To accept the default seed (which the `keyinit' program confusingly calls a `key'), press return. Then move over to your secure connection or S/Key desk accessory, and give it the same parameters: $ key 100 kh94742 Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: ) I typed my secret password HULL NAY YANG TREE TOUT VETO Now switch back over to the insecure connection, and copy the one-time password generated by ` s/key access password: HULL NAY YANG TREE TOUT VETO ID wollman s/key is 100 kh94742 HULL NAY YANG TREE TOUT VETO The rest of the description from the previous section applies here as well. Diversion: a login prompt

Before explaining how to generate one-time passwords, we should go over an S/Key login prompt: $ telnet himalia Trying 18.26.0.186... Connected to himalia.lcs.mit.edu. Escape character is '^]'. s/key 92 hi52030 Password: Note that, before prompting for a password, the login program prints out the iteration number and seed which you will need in order to generate the appropriate key. You will also find a useful feature (not shown here): if you press return at the password prompt, the login program will turn echo on, so you can see what you are typing. This can be extremely useful if you are attempting to type in an S/Key by hand, such as from a printout.

If this machine were configured to disallow UNIX passwords over a connection from my machine, the prompt would have also included the annotation `(s/key required)', indicating that only S/Key one-time passwords will be accepted. Generating a single one-time password

Now, to generate the one-time password needed to answer this login prompt, we use a trusted machine and the ` $ key 92 hi52030 ) pasted from previous section Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: ) I typed my secret password ADEN BED WOLF HAW HOT STUN And in the other window: s/key 92 hi52030 ) from previous section Password: (turning echo on) Password:ADEN BED WOLF HAW HOT STUN Last login: Wed Jun 28 15:31:00 from halloran-eldar.l [etc.] This is the easiest mechanism Generating multiple one-time passwords

Sometimes we have to go places where no trusted machines or connections are available. In this case, it is possible to use the ` $ key -n 25 57 zz99999 Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: 33: WALT THY MALI DARN NIT HEAD 34: ASK RICE BEAU GINA DOUR STAG [...] 56: AMOS BOWL LUG FAT CAIN INCH 57: GROW HAYS TUN DISH CAR BALM The `Restricting use of UNIX passwords

The configuration file /etc/skey.access can be used to configure restrictions on the use of UNIX passwords based on the host name, user name, terminal port, or IP address of a login session. The complete format of the file is documented in the If there is no /etc/skey.access file (which is the default state as FreeBSD is shipped), then all users will be allowed to use UNIX passwords. If the file exists, however, then all users will be required to use S/Key unless explicitly permitted to do otherwise by configuration statements in the Here is a sample configuration file which illustrates the three most common sorts of configuration statements: permit internet 18.26.0.0 255.255.0.0 permit user jrl permit port ttyd0 The first line (`The second line (`The third line (` Setting up FreeBSD as a SLIP Server Guy Helmer, v1.0, 15 May 1995 --> Setting up a SLIP server -

Contribudted by &a.ghelmer;. +

Contributed by &a.ghelmer;. v1.0, 15 May 1995. This document provides suggestions for setting up SLIP Server services on a FreeBSD system, which typically means configuring your system to automatically startup connections upon login for remote SLIP clients. The author has written this document based on his experience; however, as your system and needs may be different, this document may not answer all of your questions, and the author cannot be responsible if you damage your system or lose data due to attempting to follow the suggestions here. This guide was originally written for SLIP Server services on a FreeBSD 1.x system. It has been modified to reflect changes in the pathnames and the removal of the SLIP interface compression flags in early versions of FreeBSD 2.X, which appear to be the only major changes between FreeBSD versions. If you do encounter mistakes in this document, please email the author with enough information to help correct the problem. Prerequisites

This document is very technical in nature, so background knowledge is required. It is assumed that you are familiar with the TCP/IP network protocol, and in particular, network and node addressing, network address masks, subnetting, routing, and routing protocols, such as RIP. Configuring SLIP services on a dial-up server requires a knowledge of these concepts, and if you are not familiar with them, please read a copy of either Craig Hunt's TCP/IP Network Administration published by O'Reilly & Associates, Inc. (ISBN Number 0-937175-82-X), or Douglas Comer's books on the TCP/IP protocol. It's further assumed that you have already setup your modem(s) and configured the appropriate system files to allow logins through your modems. If you haven't prepared your system for this yet, please see the tutorial for configuring dialup services; if you have a World-Wide Web browser available, browse the list of tutorials at http://www.freebsd.org/; otherwise, check the place where you found this document for a document named Quick Overview

In its typical configuration, using FreeBSD as a SLIP server works as follows: a SLIP user dials up your FreeBSD SLIP Server system and logs in with a special SLIP login ID that uses /usr/sbin/sliplogin as the special user's shell. The /etc/sliphome/slip.hosts to find a matching line for the special user, and if it finds a match, connects the serial line to an available SLIP interface and then runs the shell script /etc/sliphome/slip.login to configure the SLIP interface. An Example of a SLIP Server Login

For example, if a SLIP user ID were Shelmerg, /etc/master.passwd would look something like this (except it would be all on one line): Shelmerg:password:1964:89::0:0:Guy Helmer - SLIP: /usr/users/Shelmerg:/usr/sbin/sliplogin and, when sliplogin will search /etc/sliphome/slip.hosts for a line that had a matching user ID; for example, there may be a line in /etc/sliphome/slip.hosts that reads: Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp /etc/sliphome/slip.login like this: /etc/sliphome/slip.login 0 19200 Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp If all goes well, /etc/sliphome/slip.login will issue an ifconfig for the SLIP interface to which slip.login) to set the local IP address (dc-slip), remote IP address (sl-helmer), network mask for the SLIP interface (0xfffffc00), and any additional flags (autocomp). If something goes wrong, /var/log/messages (see the manual pages for syslogd(8) and syslog.conf(5), and perhaps check /etc/syslog.conf to see to which files syslogd is logging). OK, enough of the examples -- let's dive into setting up the system. Kernel Configuration

FreeBSD's default kernels usually come with two SLIP interfaces defined (sl0 and sl1); you can use netstat -i to see whether these interfaces are defined in your kernel. Sample output from netstat -i: Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll ed0 1500 0.0.c0.2c.5f.4a 291311 0 174209 0 133 ed0 1500 138.247.224 ivory 291311 0 174209 0 133 lo0 65535 79 0 79 0 0 lo0 65535 loop localhost 79 0 79 0 0 sl0* 296 0 0 0 0 0 sl1* 296 0 0 0 0 0 The sl0 and sl1 interfaces shown in netstat -i's output indicate that there are two SLIP interfaces built into the kernel. (The asterisks after the sl0 and sl1 indicate that the interfaces are ``down''.) However, FreeBSD's default kernels do not come configured to forward packets (ie, your FreeBSD machine will not act as a router) due to Internet RFC requirements for Internet hosts (see RFC's 1009 [Requirements for Internet Gateways], 1122 [Requirements for Internet Hosts -- Communication Layers], and perhaps 1127 [A Perspective on the Host Requirements RFCs]), so if you want your FreeBSD SLIP Server to act as a router, you'll have to add the line sysctl -w net.inet.ip.forwarding = 0 to your rc.local file. You'll notice that near the end of the default kernel configuration file (/sys/i386/conf/GENERIC) is a line that reads: pseudo-device sl 2 which is the line that defines the number of SLIP devices available in the kernel; the number at the end of the line is the maximum number of SLIP connections that may be operating simultaneously. Please refer to for help in reconfiguring your kernel. Sliplogin Configuration

As mentioned earlier, there are three files in the /etc/sliphome directory that are part of the configuration for /usr/sbin/sliplogin (see sliplogin(8) for the actual manual page for sliplogin): slip.hosts, which defines the SLIP users & their associated IP addresses; slip.login, which usually just configures the SLIP interface; and (optionally) slip.logout, which undoes slip.login's effects when the serial connection is terminated. slip.hosts Configuration

/etc/sliphome/slip.hosts contains lines which have at least four items, separated by whitespace: SLIP user's login ID Local address (local to the SLIP server) of the SLIP link Remote address of the SLIP link Network mask The local and remote addresses may be host names (resolved to IP addresses by /etc/hosts or by the domain name service, depending on your specifications in /etc/host.conf), and I believe the network mask may be a name that can be resolved by a lookup into /etc/networks. On a sample system, /etc/sliphome/slip.hosts looks like this: ----- begin /etc/sliphome/slip.hosts ----- # # login local-addr remote-addr mask opt1 opt2 # (normal,compress,noicmp) # Shelmerg dc-slip sl-helmerg 0xfffffc00 autocomp ----- end /etc/sliphome/slip.hosts ------ At the end of the line is one or more of the options. normal - no header compression compress - compress headers autocomp - compress headers if the remote end allows it noicmp - disable ICMP packets (so any ``ping'' packets will be dropped instead of using up your bandwidth) Note that section and/or consult your IP network manager. If you are going to use a separate subnet for your SLIP clients, you will need to allocate the subnet number out of your assigned IP network number and assign each of your SLIP client's IP numbers out of that subnet. Then, you will probably either need to configure a static route to the SLIP subnet via your SLIP server on your nearest IP router, or install gated on your FreeBSD SLIP server and configure it to talk the appropriate routing protocols to your other routers to inform them about your SLIP server's route to the SLIP subnet. Otherwise, if you will use the ``proxy ARP'' method, you will need to assign your SLIP client's IP addresses out of your SLIP server's Ethernet subnet, and you'll also need to adjust your /etc/sliphome/slip.login and /etc/sliphome/slip.logout scripts to use arp(8) to manage the proxy-ARP entries in the SLIP server's ARP table. slip.login Configuration

The typical /etc/sliphome/slip.login file looks like this: ----- begin /etc/sliphome/slip.login ----- #!/bin/sh - # # @(#)slip.login 5.1 (Berkeley) 7/1/90 # # generic login file for a slip line. sliplogin invokes this with # the parameters: # 1 2 3 4 5 6 7-n # slipunit ttyspeed loginname local-addr remote-addr mask opt-args # /sbin/ifconfig sl$1 inet $4 $5 netmask $6 ----- end /etc/sliphome/slip.login ----- This slip.login file merely ifconfig's the appropriate SLIP interface with the local and remote addresses and network mask of the SLIP interface. If you have decided to use the ``proxy ARP'' method (instead of using a separate subnet for your SLIP clients), your /etc/sliphome/slip.login file will need to look something like this: ----- begin /etc/sliphome/slip.login for "proxy ARP" ----- #!/bin/sh - # # @(#)slip.login 5.1 (Berkeley) 7/1/90 # # generic login file for a slip line. sliplogin invokes this with # the parameters: # 1 2 3 4 5 6 7-n # slipunit ttyspeed loginname local-addr remote-addr mask opt-args # /sbin/ifconfig sl$1 inet $4 $5 netmask $6 # Answer ARP requests for the SLIP client with our Ethernet addr /usr/sbin/arp -s $5 00:11:22:33:44:55 pub ----- end /etc/sliphome/slip.login for "proxy ARP" ----- The additional line in this slip.login, arp -s $5 00:11:22:33:44:55 pub, creates an ARP entry in the SLIP server's ARP table. This ARP entry causes the SLIP server to respond with the SLIP server's Ethernet MAC address whenever a another IP node on the Ethernet asks to speak to the SLIP client's IP address. When using the example above, be sure to replace the Ethernet MAC address (00:11:22:33:44:55) with the MAC address of your system's Ethernet card, or your ``proxy ARP'' will definitely not work! You can discover your SLIP server's Ethernet MAC address by looking at the results of running netstat -i; the second line of the output should look something like: ed0 1500 0.2.c1.28.5f.4a 191923 0 129457 0 116 ^^^^^^^^^^^^^^^ which indicates that this particular system's Ethernet MAC address is 00:02:c1:28:5f:4a -- the periods in the Ethernet MAC address given by netstat -i must be changed to colons and leading zeros should be added to each single-digit hexadecimal number to convert the address into the form that arp(8) desires; see the manual page on arp(8) for complete information on usage. Note that when you create /etc/sliphome/slip.login and /etc/sliphome/slip.logout, the ``execute'' bit (ie, chmod 755 /etc/sliphome/slip.login /etc/sliphome/slip.logout) must be set, or sliplogin will be unable to execute it. slip.logout Configuration

/etc/sliphome/slip.logout isn't strictly needed (unless you are implementing ``proxy ARP''), but if you decide to create it, this is an example of a basic slip.logout script: ----- begin /etc/sliphome/slip.logout ----- #!/bin/sh - # # slip.logout # # logout file for a slip line. sliplogin invokes this with # the parameters: # 1 2 3 4 5 6 7-n # slipunit ttyspeed loginname local-addr remote-addr mask opt-args # /sbin/ifconfig sl$1 down ----- end /etc/sliphome/slip.logout ----- If you are using ``proxy ARP'', you'll want to have /etc/sliphome/slip.logout remove the ARP entry for the SLIP client: ----- begin /etc/sliphome/slip.logout for "proxy ARP" ----- #!/bin/sh - # # @(#)slip.logout # # logout file for a slip line. sliplogin invokes this with # the parameters: # 1 2 3 4 5 6 7-n # slipunit ttyspeed loginname local-addr remote-addr mask opt-args # /sbin/ifconfig sl$1 down # Quit answering ARP requests for the SLIP client /usr/sbin/arp -d $5 ----- end /etc/sliphome/slip.logout for "proxy ARP" ----- The arp -d $5 removes the ARP entry that the ``proxy ARP'' slip.login added when the SLIP client logged in. It bears repeating: make sure /etc/sliphome/slip.logout has the execute bit set for after you create it (ie, chmod 755 /etc/sliphome/slip.logout). Routing Considerations

If you are not using the ``proxy ARP'' method for routing packets between your SLIP clients and the rest of your network (and perhaps the Internet), you will probably either have to add static routes to your closest default router(s) to route your SLIP client subnet via your SLIP server, or you will probably need to install and configure gated on your FreeBSD SLIP server so that it will tell your routers via appropriate routing protocols about your SLIP subnet. Static Routes

Adding static routes to your nearest default routers can be troublesome (or impossible, if you don't have authority to do so...). If you have a multiple-router network in your organization, some routers, such as Cisco and Proteon, may not only need to be configured with the static route to the SLIP subnet, but also need to be told which static routes to tell other routers about, so some expertise and troubleshooting/tweaking may be necessary to get static-route-based routing to work. Running gated

An alternative to the headaches of static routes is to install gated on your FreeBSD SLIP server and configure it to use the appropriate routing protocols (RIP/OSPF/BGP/EGP) to tell other routers about your SLIP subnet. ftp.gated.cornell.edu in the directory /pub/gated; I believe the current version as of this writing is gated-R3_5Alpha_8.tar.Z, which includes support for FreeBSD ``out-of-the-box''. Complete information and documentation on gated is available on the Web starting at http://www.gated.cornell.edu/. Compile and install it, and then write a /etc/gated.conf file to configure your gated; here's a sample, similar to what the author used on a FreeBSD SLIP server: ----- begin sample /etc/gated.conf for gated version 3.5Alpha5 ----- # # gated configuration file for dc.dsu.edu; for gated version 3.5alpha5 # Only broadcast RIP information for xxx.xxx.yy out the ed Ethernet interface # # # tracing options # traceoptions "/var/tmp/gated.output" replace size 100k files 2 general ; rip yes { interface sl noripout noripin ; interface ed ripin ripout version 1 ; traceoptions route ; } ; # # Turn on a bunch of tracing info for the interface to the kernel: kernel { traceoptions remnants request routes info interface ; } ; # # Propagate the route to xxx.xxx.yy out the Ethernet interface via RIP # export proto rip interface ed { proto direct { xxx.xxx.yy mask 255.255.252.0 metric 1; # SLIP connections } ; } ; # # Accept routes from RIP via ed Ethernet interfaces import proto rip interface ed { all ; } ; ----- end sample /etc/gated.conf ----- The above sample gated.conf file broadcasts routing information regarding the SLIP subnet xxx.xxx.yy via RIP onto the Ethernet; if you are using a different Ethernet driver than the /var/tmp/gated.output for debugging gated's activity; you can certainly turn off the tracing options if gated works OK for you. You'll need to change the xxx.xxx.yy's into the network address of your own SLIP subnet (be sure to change the net mask in the proto direct clause as well). When you get gated built and installed and create a configuration file for it, you'll need to run gated in place of routed on your FreeBSD system; change the routed/gated startup parameters in /etc/netstart as appropriate for your system. Please see the manual page for gated for information on gated's command-line parameters. -Acknowledgements +Acknowledgments

Thanks to these people for comments and advice regarding this tutorial: diff --git a/handbook/submitters.sgml b/handbook/submitters.sgml index 532a4dd3cc..509a8c6931 100644 --- a/handbook/submitters.sgml +++ b/handbook/submitters.sgml @@ -1,422 +1,422 @@ - + Contributing to FreeBSD

Contributed by &a.jkh;.

So you want to contribute something to FreeBSD? That's great! We can always use the help, and FreeBSD is one of those systems that relies on the contributions of its user base in order to survive. Your contributions are not only appreciated, they're vital to FreeBSD's continued growth!

Contrary to what some people might also have you believe, you don't need to be a hot-shot programmer or a close personal friend of the FreeBSD core team in order to have your contributions accepted. The FreeBSD Project's development is done by a large and growing number of international contributors who's ages and areas of technical expertise vary greatly, and there is always more work to be done than there are people available to do it.

Since the FreeBSD project is responsible for an entire operating system environment (and its installation) rather than just a kernel or a few scattered utilities, our "TODO" list also spans a very wide range of tasks, from documentation, beta testing and presentation to highly specialized types of kernel development. No matter what your skill level, there's almost certainly something you can do to help the project! -

Commmercial entities engaged in FreeBSD-related enterprises are -also encouraged to contact us. Need a special extention to make your +

Commercial entities engaged in FreeBSD-related enterprises are +also encouraged to contact us. Need a special extension to make your product work? You'll find us receptive to your requests, given that they aren't too outlandish. Working on a value-added product? Please let us know! We may be able to work cooperatively on some aspect of it. The free software world is challenging a lot of existing assumptions about how software is developed, sold, and maintained throughout its life cycle, and we urge you to at least give it a second look. What's needed

The following list of tasks and sub-projects represents something of an amalgam of the various core team TODO lists and user requests we've collected over the last couple of months. Where possible, tasks have been ranked by degree of urgency. If you're interested in working on one of the tasks you see here, send mail to the coordinator listed by clicking on their names. If no coordinator has been appointed, maybe you'd like to volunteer? Urgently needed

The following tasks are considered to be urgent, usually because they represent something that is badly broken: Fix the DOS file system. Coordinator: . Fix the union file system. Coordinator: Not urgently needed

The following tasks need to be done, but not with any particular urgency: Put something here. Would be nice to have

The following tasks are purely cosmetic or represent such an investment of work that it's not likely that anyone will get them done anytime soon:

The first 20 items are from Terry Lambert <terry@lambert.org> Ability to make BIOS calls from protected mode using V86 mode on the processor and return the results via a mapped interrupt IPC mechanism to the protected mode caller. Drivers built into the kernel that use the BIOS call mechanism to allow them to be independent of the actual underlying hardware the same way that DOS is independent of the underlying hardware. This includes NetWork and ASPI drivers loaded in DOS prior to BSD being loaded by a DOS-based loader program, which means potential polling, which means DOS-not-busy interrupt generation for V86 machines by the protected mode kernel. An image format that allows tagging of such drivers data and text areas in the default kernel executable so that that portion of the kernel address space may be recovered at a later time, after hardware specific protected mode drivers have been loaded -and activated. This includes seperation of BIOS based drivers +and activated. This includes separation of BIOS based drivers from each other, since it is better to run with a BIOS based driver in all cases than to not run at all. Abstraction of the bus interface mechanism. Currently, PCMCIA, EISA, and PCI busses are assumed to be bridged from ISA. This is not something which should be assumed. A configuration manager that knows about PNP events, including power management events, insertion, extraction, and bus (PNP ISA and PCMCIA bridging chips) vs. card level event management. A topological sort mechanism for assigning reassignable addresses that do not collide with other reassignable and non-reassignable device space resource usage by fixed devices. A registration based mechanism for hardware services registration. Specifically, a device centric registration mechanism for timer and sound and other system critical service providers. Consider Timer2 and Timer0 and speaker services as one example of a single -monithic service provider. +monolithic service provider. -A kernel exported symbol space in the kernel data space acessable +A kernel exported symbol space in the kernel data space accessible by an LKM loader mechanism that does relocation and symbol space manipulation. The intent of this interface is to support the ability to demand load and unload kernel modules. NetWare Server (protected mode ODI driver) loader and subservices to allow the use of ODI card drivers supplied with network cards. The same thing for NDIS drivers and NetWare SCSI drivers. An "upgrade system" option that works on Linux boxes instead of just previous rev FreeBSD boxes. Splitting of the console driver into abstraction layers, both to make it easier to port and to kill the X and ThinkPad and PS/2 mouse and LED and console switching and bouncing NumLock problems once and for all. Other kernel emulation environments for other foreign drivers as opportunity permits. SCO and Solaris are good candidates, followed by UnixWare, etc. Processor emulation environments for execution of foreign binaries. This is easier than it sounds if the system call interface doesn't change much. Streams to allow the use of commercial streams drivers. Kernel multithreading (requires kernel preemption). Symmetric Multiprocessing with kernel preemption (requires kernel preemption). A concerted effort at support for portable computers. This is somewhat handled by changing PCMCIA bridging rules and power management event handling. But there are things like detecting internal vs. external display and picking a different screen -resoloution based on that fact, not spinning down the disk if +resolution based on that fact, not spinning down the disk if the machine is in dock, and allowing dock-based cards to disappear without affecting the machines ability to boot (same issue for PCMCIA). Reorganization of the source tree for multiple platform ports. A "make world" that "makes the world" (rename the current one to "make regress" if that's all it is good for). -A 4M (preferrably smaller!) memory footprint. +A 4M (preferably smaller!) memory footprint. How to contribute

Contributions to the system generally fall into one or more of the following 6 categories: Bug reports and general commentary

If you have a bug to report or a suggestion to make: An idea or suggestion of general technical interest should be mailed to . Likewise, people with an interest in such things (and a tolerance for a high volume of mail!) may subscribe to the hackers mailing list by sending mail to . See for more information about this and other mailing lists. An actual bug report should be filed by using the send-pr(1) program. This will prompt you for various fields to fill in. Simply go to the fields surrounded by <>'s and fill in your own information in place of what's suggested there. You should receive confirmation of your bug report and a tracking number. Keep this tracking number and use it in any subsequent correspondence. If you do not receive confirmation in a timely fashion (3 days to a week, depending on your email connection) or are, for some reason, unable to use the send-pr(1) command, then you may also file a bug report by sending mail to . Changes to the documentation

Changes to the documentation are overseen by the FreeBSD Documentation Project, which can be reached at . This does not generally include changes to manual pages, which should be considered under the category of "changes to existing source code." Changes to existing source code

An addition or change to the existing source code is a somewhat trickier affair and depends a lot on how far out of date you are with the current state of the core FreeBSD development. There is a special on-going release of FreeBSD known as ``FreeBSD-current'' which is made available in a variety of ways for the convenience of developers working actively on the system. See for more information about getting and using FreeBSD-current. Working from older sources unfortunately means that your changes may sometimes be too obsolete or too divergent for easy re-integration into FreeBSD. Chances of this can be minimized somewhat by subscribing to the <announce@freebsd.org> and <current@freebsd.org> mailing lists, where discussions on the current state of the system take place. Assuming that you can manage to secure fairly up-to-date sources to base your changes on, the next step is to produce a set of diffs to send to the FreeBSD maintainers. This is done with the diff(1) command, with the `context diff' form being preferred. For example: diff -c oldfile newfile or diff -c -r olddir newdir would generate such a set of context diffs for the given source file or directory hierarchy. See the man page for diff(1) for more details. Once you have a set of diffs (which you may test with the patch(1) command), you should bundle them up in an email message and send it, along with a brief description of what the diffs are for, to . Someone will very likely get back in touch with you in 24 hours or less, assuming of course that your diffs are interesting! :-) If your changes don't express themselves well as diffs alone (e.g. you've perhaps added, deleted or renamed files as well) then you may be better off bundling any new files, diffs and instructions for deleting/renaming others into a tar file and running the uuencode(1) program on it before sending the output of that to . See the man pages on tar(1) and uuencode(1) for more information on bundling files this way. If your change is of a potentially sensitive nature, e.g. you're unsure of copyright issues governing its further distribution or you're simply not ready to release it without a tighter review first, then you should send it to rather than <hackers@freebsd.org>. The core mailing list reaches a much smaller group of people who do much of the day-to-day work on FreeBSD. Note that this group is also very busy and so you should only send mail to them in cases where mailing to hackers is truly impractical. Contributions of new code

In the case of a significant contribution of a large body work, or the addition of an important new feature to FreeBSD, it becomes almost always necessary to either send changes as uuencoded tar files or upload them to our ftp site . When working with large amounts of code, the touchy subject of copyrights also invariably comes up. Acceptable copyrights for code included in FreeBSD are: The BSD copyright. This copyright is most preferred due to its ``no strings attached'' nature and general attractiveness to commercial enterprises. Far from discouraging such commercial use, the FreeBSD Project actively encourages such participation by commercial interests who might eventually be inclined to invest something of their own into FreeBSD. The GNU Public License, or ``GPL''. This license isn't quite as popular with us due to the amount of extra effort demanded of anyone using the code for commercial purposes, but given the sheer quantity of GPL'd code we currently require (compiler, assembler, text formatter, etc) it would be silly to refuse additional contributions under this license. Code under the GPL also goes into a different part of the tree, that being /sys/gnu or /usr/src/gnu, and is therefore easily identifiable to anyone for whom the GPL presents a problem.

Contributions coming under any other type of copyright must be carefully reviewed before their inclusion into FreeBSD will be considered. Contributions for which particularly restrictive commercial copyrights apply are generally rejected, though the authors are always encouraged to make such changes available through their own channels. To place a ``BSD-style'' copyright on your work, include the following text at the very beginning of every source code file you wish to protect, replacing the text between the `%%' with the appropriate information. Copyright (c) %%proper_years_here%% %%your_name_here%%, %%your_state%% %%your_zip%%. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: This product includes software developed by %%your_name_here%%. 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY %%your_name_here%% ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL %%your_name_here%% BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - $Id: submitters.sgml,v 1.14 1996-01-05 08:47:37 jkh Exp $ + $Id: submitters.sgml,v 1.15 1996-01-31 14:26:19 mpp Exp $ For your convenience, a copy of this text can be found in /usr/share/examples/etc/bsd-style-copyright. &porting; Contributions of money, hardware or Internet access

We're always very happy to accept donations to further the cause of the FreeBSD Project and, in a volunteer effort like ours, a little can go a long way! Donations of hardware are also very important to expanding our list of supported peripherals since we generally lack the funds to buy such items ourselves. Donating funds

While the FreeBSD Project is not a 501(C3) (non-profit) corporation and hence cannot offer special tax incentives for any donations made, any such donations will be gratefully accepted on behalf of the project by FreeBSD, Inc.

FreeBSD, Inc. was founded in early 1995 by &a.jkh and &a.davidg with the goal of furthering the aims of the FreeBSD Project and giving it a minimal corporate presence. Any and all funds donated (as well as any profits that may eventually be realized by FreeBSD, Inc.) will be used exclusively to further the project's goals. Please make any checks payable to FreeBSD, Inc., sent in care of the following address: FreeBSD, Inc. 246 Park St. Clyde CA, 94520 Wire transfers may also be sent directly to: Bank Of America Concord Main Office P.O. Box 37176 San Francisco CA, 94137-5176 Routing #: 121-000-358 Account #: 01411-07441 (FreeBSD, Inc.) If you do not wish to be listed in our `donors' section, please specify this in a note accompanying your donation. Thanks! Donating hardware -

Donations of hardware in any of the 3 following catagories are also gladly +

Donations of hardware in any of the 3 following categories are also gladly accepted by the FreeBSD Project: General purpose hardware such as disk drives, memory or complete systems should be sent to the FreeBSD, Inc. address listed in the donating funds section. Hardware for which ongoing compliance testing is desired. We are currently trying to put together a testing lab of all components that FreeBSD supports so that proper regression testing can be done with each new release. We are still lacking many important pieces (network cards, motherboards, etc) and if you'd like to make such a donation, please contact &a.davidg for information on which items are still required. Hardware currently unsupported by FreeBSD for which you'd like to see such support added. Please contact the before sending such items as we'll need to find a developer willing to take on the task before we can accept delivery of them. -Donating internet access +Donating Internet access

We can always use new mirror sites for FTP, WWW or sup. If you'd like to be such a mirror, please contact for more information. diff --git a/handbook/userppp.sgml b/handbook/userppp.sgml index 955f6ec48d..0373ea63fe 100644 --- a/handbook/userppp.sgml +++ b/handbook/userppp.sgml @@ -1,363 +1,363 @@ - + Setting up user PPP

Contributed by &a.nik; 28 July 1995. -

User PPP was intruduced to FreeBSD in release 2.0.5 as an - addition to the exisiting kernel implementation of PPP. So, +

User PPP was introduced to FreeBSD in release 2.0.5 as an + addition to the existing kernel implementation of PPP. So, what is different about this new PPP that warrants its addition? To quote from the manual page: This is a user process PPP software package. Normally, PPP is implemented as a part of the kernel (e.g. as managed by pppd) and it's thus somewhat hard to debug and/or modify its behavior. However, in this implementation PPP is done as a user process with the help of the tunnel device driver (tun). In essence, this means that rather than running a PPP daemon, the ppp program can be run as and when desired. No PPP interface needs to be compiled into the kernel, as the program can use the generic tunnel device to to get data into and out of the kernel. From here on out, user ppp will be referred to as simply as ppp unless a distinction need to be made be it and any other PPP client/server software. Unless otherwise stated, all commands in this section should be executed as root. Parts in this section marked with an asterisk (*) are incomplete. Comments and suggestions are appreciated and should be submitted to &a.nik;. Thanks to Rob Snow <rsnow@txdirect.net> who proved to be a mine of useful information when I was first experimenting with user ppp. Before you start

This document assumes you're in roughly this position: You have an account with an Internet Service Provider (ISP) which lets you use PPP. Further, you have a modem (or other device) connected and configured correctly which allows you to connect to your ISP. You are going to need the following information to hand: IP address of your ISP's gateway Your ISP's netmask setting - IP adresses of one or more nameservers + IP addresses of one or more nameservers If your ISP allocates you a static IP address and/or hostname then you will need that as well. If not, you will need to know from what range of IP addresses your allocated IP address will fall in. If you do not have any of this information then contact your ISP and make sure they provide it to you. As well as this, you may need the files required to recompile your kernel. Check for more information on how to acquire these. In addition, I've assumed that because your connection to the Internet is not full time you are not running a name server (named(8)). Building a ppp ready kernel

As the description states, ``ppp'' uses the kernel ``tun'' device. It is necessary to make sure that your kernel has support for this device compiled in. To check this, go to your kernel compile directory (probably /sys/i386/conf) and examine your kernel configuration file. It needs to have the line pseudo-device tun 1 in it somewhere. The stock GENERIC kernel has this as standard, so if you have not installed a custom kernel you don't have to change anything. If your kernel configuration file does not have this line in it then you should add the line, re-compile and then re-install the kernel. Boot from this new kernel. Check the tun device

My experiences with ppp have only been with one ``tun'' device (tun0). If you have used more (i.e., a number other than `1' in the pseudo-device line in the kernel configuration file) then alter all references to ``tun0'' below to reflect whichever device number you are using. The easiest way to make sure that the tun0 device is configured correctly is to re-make it. To this end, execute the following commands: # cd /dev # ./MAKEDEV tun0 PPP Configuration

The meat of the problem. Confusingly, it appears that both user ppp and pppd (the kernel level implementation of PPP) both assume configuration files kept in /etc/ppp. However, the sample configuration files provided are good for user ppp, so keep them around for reference. The easiest way to do this is: # cd /etc # mv ppp ppp.orig # mkdir ppp Configuring ppp requires that you edit somewhere between one and three files, depending on your requirements. What you put in them depends to some extent on whether your ISP allocates IP addresses statically (i.e., you get given one IP address, and always use that one) or dynamically (i.e., your IP address can be different during different PPP sessions). However, there are a few things that you should do first, regardless of whether you are using static or dynamic IP addresses. Configure the resolver(5)

The resolver is the part of the networking system that turns IP addresses into hostnames. It can be configured to look for maps that describe IP to hostname mappings in one of two places. The first is a file called /etc/hosts (man 5 hosts). The second is the Internet Domain Name Service, a distributed data base, the discussion of which is beyond the realm of this document. The resolver is a set of system calls that do the mappings, and you have to tell them where to get their information from. You do this by editing the file /etc/host.conf. Do not call this file /etc/hosts.conf (note the extra ``s'') as the results can be confusing. This file should contain the following two lines, hosts bind which instruct the resolver to look in the file /etc/hosts first, and then to consult the DNS if the name was not found in the /etc/hosts file. It's probably a good idea to make sure you are not running the ``named'' service. Check your /etc/sysconfig file for the line that refers to ``namedflags'', and make sure the line reads namedflags="NO" Create the /etc/hosts(5) file

This file should contain the IP addresses and names of machines on your network. At a bare minimum it should contain entries for the machine which will be running ppp. Assuming that you're machine is called foo.bar.com with the IP address 10.0.0.1, /etc/hosts should contain: 127.0.0.1 localhost 10.0.0.1 foo.bar.com foo The first line defines the alias ``localhost'' as a synonym for the current machine. Regardless of your own IP address, the IP address for this line should always be 127.0.0.1. The second line maps the name ``foo.bar.com'' (and the shorthand ``foo'') to the IP address 10.0.0.1. If your provider allocates you a static IP address then use this in place of 10.0.0.1. Create the /etc/resolv.conf file

/etc/resolv.conf contains some extra information required when you are not running a nameserver. It points the resolver routines at real nameservers, and specifies some other information. At the very least, /etc/resolv.conf should contain one line with a nameserver which can be queried. You should enter this as an IP address. My /etc/resolv.conf contains: nameserver 158.152.1.193 nameserver 158.152.1.65 Which are Demon Internet's two nameservers. Add as many ``nameserver'' lines as your ISP provides nameservers. PPP and static IP addresses

Probably the easiest to configure for. You will need to create three files in the /etc/ppp directory. The first of these is ppp.conf. It should look similar to the example below. Note that lines that end in a ``:'' start in column 1, all other lines should be indented as shown. /etc/ppp/ppp.conf 1 default: 2 set device /dev/cuaa0 3 set speed 9600 4 disable lqr 5 deny lqr 6 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATE1Q0 OK-AT-OK \\dATDT\\T TIMEOUT 40 CONNECT" 7 provider: 8 set phone 01234567890 9 set login "TIMEOUT 10 gin:-BREAK-gin: foo word: bar col: ppp" 10 set timeout 120 11 set ifaddr x.x.x.x y.y.y.y Don't include the line numbers, they're just for this discussion. /dev/cuaa0 and COM2: is /dev/cuaa1. chat(8) language. Check the manual page for information on the features of this language. J. Random Provider login: foo password: bar protocol: ppp You will need to alter this script to suit your own needs. It is written in the chat(8) language. Now you have to edit the file /etc/ppp/ppp.linkup: x.x.x.x: add 0 0 HISADDR Replace x.x.x.x with your IP address as before. This file is used to automatically add a default route from your ISP (who's address is automatically inserted with the HISADDR macro) to you. Finally, you can create the file /etc/ppp/ppp.secret, which sets some passwords to prevent people messing around with ppp on your system. You may or may not want to do this, depending on how many people have access to your ppp system. PPP and Dynamic IP configuration

If you service provider does not assign static IP numbers, ppp can be configured to negotiate the local address. This is done by specifying 0 as the local IP address: set ifaddr 0 0 See the ppp(8) manual page for more detailed information. Final system configuration

You now have PPP configured, but there's a few more things to do before it's ready to work. They all involve editing the /etc/sysconfig file. Working from the top down in this file, make sure the ``hostname='' line is set, e.g., hostname=foo.bar.com Look for the network_interfaces variable, and make sure the tun0 device is added to the list. My line looks like network_interfaces="lo0 tun0 ep0" but I have an ethernet card (ep0) to configure as well. Now add an ifconfig line for the tun0 device. It should look something like ifconfig_tun0="inet foo.bar.com y.y.y.y netmask 0xffffffff" as before, change ``foo.bar.com'' to be your hostname, y.y.y.y is the IP address of your providers gateway, and 0xffffffff is the netmask they provided you with (in hexadecimal). Two common values for the netmask are 255.255.255.255 = 0xffffffff 255.255.255.0 = 0xffffff00 Set the routed flags to ``-s'' with the line routedflags=-s It's probably worth your while ensuring that the ``sendmail_flags'' line does not include the ``-q'' option, otherwise sendmail will attempt to do a network lookup every now and then, possibly causing your machine to dial out. My sendmail line looks like sendmail_flags="-bd" The upshot of this is that I must force sendmail to re-examine the mailqueue whenever I have the PPP link up, by typing # /usr/sbin/sendmail -q That should be about all you need to do to get PPP working with a static IP address. All that's left is to reboot the machine. During startup the tun0 device should be detected, and two lines like the following should be printed, tun0: flags=51 mtu 1500 inet x.x.x.x --> y.y.y.y netmask 0xffffffff At this point, it should all be working. You can now either type # ppp and then ``dial provider'' to start the PPP session, or, if you want ppp to establish sessions automatically when there is outbound traffic, type # ppp -auto provider This line could be added to your /etc/rc.local file.