diff --git a/handbook/authors.sgml b/handbook/authors.sgml index ed824afd93..82d9643450 100644 --- a/handbook/authors.sgml +++ b/handbook/authors.sgml @@ -1,342 +1,296 @@ - + -"> - -"> - -"> - -"> - -"> - -"> - -"> - -"> - -"> - -"> - -"> - "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> "> diff --git a/handbook/basics.sgml b/handbook/basics.sgml index 9b550d497d..a41df338ca 100644 --- a/handbook/basics.sgml +++ b/handbook/basics.sgml @@ -1,96 +1,96 @@ - + Unix Basics The online manual

The most comprehensive documentation on FreeBSD is in the form of man pages. Nearly every program on the system comes with a short reference manual explaining the basic operation and various arguments. These manuals can be view with the man command. Use of the man command is simple: man command where command is the name of the command you wish to learn about. For example, to learn more about ls command type: % man ls

The online manual is divided up into numbered sections: User commands System calls and error numbers Functions in the C libraries Device drivers File formats Games and other diversions Miscellaneous information System maintenance and operation commands in some cases, the same topic may appear in more than one section of the on-line manual. For example, there is a chmod user command and a chmod() system call. In this case, you can tell the man command which one you want by specifying the section: % man 1 chmod which will display the manual page for the user command chmod. References to a particular section of the on-line manual are traditionally placed in parenthesis in written documentation, so chmod(1) refers to the chmod user command and chmod(2) refers to the system call.

This is fine if you know the name of the command and simply wish to know how to use it, but what if you cannot recall the command name? You can use man to search for keywords in the command descriptions by using the -k switch: % man -k mail With this command you will be presented with a list of commands that have the keyword `mail' in their descriptions. This is actually functionally equivalent to using the apropos command.

So, you are looking at all those fancy commands in - /usr/bin but don't even have the faintest idea + /usr/bin but do not even have the faintest idea what most of them actually do? Simply do a % cd /usr/bin; man -f * or % cd /usr/bin; whatis * which does the same thing. GNU Info files

FreeBSD includes many applications and utilities produced by the Free Software Foundation (FSF). In addition to man pages, these programs come with more extensive hypertext documents called info files which can be viewed with the info command or, if you installed emacs, the info mode of emacs. To use the info(1) command, simply type: % info For a brief introduction, type h. For a quick command reference, type ?. diff --git a/handbook/booting.sgml b/handbook/booting.sgml index 723f0a9da1..1091e85947 100644 --- a/handbook/booting.sgml +++ b/handbook/booting.sgml @@ -1,173 +1,173 @@ 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 + will not compile under FreeBSD itself because it is written for 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 its case. Netboot 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 root filesystems: UFS This is the most normal type of root filesystem. It can reside on a floppy or on hard disk. MSDOS - While this is technically possible, it isn't particular useful, + While this is technically possible, it is not 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 + Now you run FreeBSD diskless, even though you do not 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 0900c30f34..07bf2223e9 100644 --- a/handbook/contrib.sgml +++ b/handbook/contrib.sgml @@ -1,370 +1,370 @@ - + 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 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 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! + Toshiba XM3401B CDROM drive. It has been most useful! Thanks to Chuck Robey <chuckr@eng.umd.edu> who contributed 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. Thanks go to Ernst Winter <ewinter@lobo.muc.de>, for contributing a 2.88 MB floppy drive to the project. Hopefully, this will increase the pressure for rewriting the floppy disk driver. ;-) Also see for a list of people who have donated funding or services to the FreeBSD Project. The FreeBSD core team

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

These are the people who have commit privileges and do the work on FreeBSD source tree. All core team members are also developers. &a.torstenb; &a.gclarkii; &a.adam; &a.dufault; &a.uhclem; &a.julian; &a.sef; &a.se; &a.fenner; &a.jfieber; &a.lars; &a.tg; &a.graichen; &a.rgrimes; &a.hsu; &a.ugen; &a.gj; &a.ljo; &a.erich; &a.smace; &a.amurai; &a.markm; &a.olah; &a.wpaul; &a.jmacd; &a.jdp; &a.mpp; &a.dfr; &a.csgr; &a.martin; &a.paul; &a.roberto; &a.dima; &a.wosch; &a.ats; &a.karl; &a.pst; &a.guido; &a.swallace; &a.nate; &a.jmz; 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> Alex Nash <nash@mcs.com> Andreas Klemm <andreas@knobel.GUN.de> Andrew Gordon <andrew.gordon@net-tel.co.uk> Andrew Herbert <andrew@werple.apana.org.au> Andrew McRae <amcrae@cisco.com> Andrew Moore <alm@FreeBSD.org> Anthony Yee-Hang Chan <yeehang@netcom.com> Bernd Rosauer <br@netland.inka.de> Bob Wilcox <bob@obiwan.uucp> Brent J. Nordquist <nordquist@platinum.com> 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> Christian Haury <Christian.Haury@sagem.fr> 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> Daniel Baker <dbaker@crash.ops.neosoft.com> Daniel M. Eischen <deischen@iworks.InterWorks.org> 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> Doug Ambrisko <ambrisko@ambrisko.roble.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> Greg Ungerer <gerg@stallion.oz.au> Harlan Stenn <Harlan.Stenn@pfcs.com> 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 FitzGibbon <james@nexis.net> James da Silva <jds@cs.umd.edu> et al Janusz Kokot <janek@gaja.ipan.lublin.pl> Javier Martin Rueda <jmrueda@diatel.upm.es> Jian-Da Li <jdli@FreeBSD.csie.NCTU.edu.tw> Jim Wilson <wilson@moria.cygnus.com> John Hay - <jhay@mikom.csir.co.za> John Perry <perry@vishnu.alias.net> 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> 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 Masafumi Nakane <max@sfc.wide.ad.jp> Matt Thomas <thomas@lkg.dec.com> Michael Elbel <me@FreeBSD.ORG> Michael Smith <msmith@atrad.adelaide.edu.au> Mike Peck <mike@binghamton.edu> MITA Yoshio <mita@iis.u-tokyo.ac.jp> NIIMI Satoshi <sa2c@and.or.jp> Nisha Talagala <nisha@cs.berkeley.edu> Nobuhiro Yasutomi <nobu@psrc.isac.co.jp> Nobuyuki Koganemaru <kogane@kces.koganemaru.co.jp> Noritaka Ishizumi <graphite@taurus.bekkoame.or.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> Richard Wiwatowski <rjwiwat@adelaide.on.neti> Rob Shady <rls@id.net> Rob Snow <rsnow@txdirect.net> Robert Sanders <rsanders@mindspring.com> 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> Yoshiro Mihira <sanpei@yy.cs.keio.ac.jp> 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> Poul-Henning Kamp<phk@FreeBSD.ORG> 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 84308b472e..f03afa5b09 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... + be most welcome. And do not 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 c8fc80b5cd..d14991490c 100644 --- a/handbook/current.sgml +++ b/handbook/current.sgml @@ -1,166 +1,164 @@ - + 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 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 +of FreeBSD-current available, but only because we are interested in +getting something tested, not because we are in the business of +providing binary releases of current. If we do not offer, please do not 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 + experimental system software. This is not because we are mean and + nasty people who do not like helping people out (we would not even be + doing FreeBSD if we were), it is literally because we cannot answer + 400 messages a day and actually work on FreeBSD! I am 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 the &a.current, you - won't see the comments that people are making about the + mailing lists. This is not just a good idea, it is + essential. If you are not on the &a.current, you + will not 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 + entry for each change as it is made along with any pertinent information on possible side-effects. - To join these lists, send mail to - and say: + To join these lists, send mail to &a.majordomo and specify: 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 + you to grab the entire collection once and then only what has 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: We also 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, + If you are 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 the &a.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 + Be active! If you are 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 ccac5b7db6..322d58b3ea 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 +two can communicate (unless you have an internal modem, which does not 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 /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 +If your kernel does not recognize all of your serial ports, you will 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/conf/options and in /sys/arch/conf/options.arch, with arch for example being i386] for more information on configuring and building kernels. You may have to -unpack the kernel source distribution if haven't installed the system +unpack the kernel source distribution if have not 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 +Create a kernel configuration file for your system (if you have not 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 +You can comment-out or completely remove lines for devices you do not 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 +cannot 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 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 +special files can read & write on them - you probably do not 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 +directory that yo will 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 +The downside is that the system does not know what a user's true data +rate is, so full-screen programs like Emacs will not 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 +particular speed, you probably will not need to make any changes to /etc/gettytab. Matching-Speed Config

-You'll need to setup an entry in /etc/gettytab to give +You will 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 +If you have a higher speed modem, you will probably need to add an entry +in /etc/gettytab; here is 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. 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 +If you have a slow CPU or a heavily loaded system and you dobnot 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 +You will need to either modify existing lines in /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 signaling 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 +Since there is no 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 +non-volatile RAM, you will 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 2: Do not 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) + Switch 8: Do not 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 +For a locked-speed configuration, you will 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 +For a variable-speed configuration, you will 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 +bit on the remote system. If you do not 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 -If you dial but the modem on the FreeBSD system won't answer, make +If you dial but the modem on the FreeBSD system will not answer, make sure that the modem is configured to answer the phone when Acknowledgments

Thanks to these people for comments and advice: &a.kelly for a number of good suggestions diff --git a/handbook/diskless.sgml b/handbook/diskless.sgml index 0f76bd2e15..ddb73768d2 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/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 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 + machines. Prior versions do not 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 e0da456634..125365cca7 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 + the same time. When that happens, it means the DMA will not 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 + reserve a buffer in an area below 16Meg that also does not 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 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 d3620c108e..66a9c9c44d 100644 --- a/handbook/eresources.sgml +++ b/handbook/eresources.sgml @@ -1,366 +1,362 @@ - + 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 the &a.doc 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 +always guarantee that we will 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-emulation Emulation of other systems such as Linux/DOS/Windows 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 +To subscribe to a list, send mail to &a.majordomo and include 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 +Again, we would like to request that you keep discussion in the technical mailing +lists on a technical track. If you are only interested in the "high points" +then it is 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 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

Other Unix newsgroups of interest

X-Window system

World Wide Web servers

diff --git a/handbook/esdi.sgml b/handbook/esdi.sgml index ee14bdb91d..2d45d19ec5 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 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. + drives I have 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 flat cable edge connector that carries the command and status signals from the controller to the 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 flat cable edge connector that carries the data to and from the drive. This cable is radially connected, so each drive has its 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 its 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 farthest end of the command cable has its 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 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 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 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 does not use the BIOS after its kernel has started. 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 + While on the subject of translations, I have 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 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 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 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 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 show stopper, - because it didn't give me an option to disable spare sectoring. + because it did not 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 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/handbook.sgml b/handbook/handbook.sgml index d398fc248c..e6ab8f4c7e 100644 --- a/handbook/handbook.sgml +++ b/handbook/handbook.sgml @@ -1,163 +1,167 @@ - + %authors; + + +%lists; + %sections; ]> FreeBSD Handbook <author> <name>The FreeBSD Documentation Project</name> </author> <date>May 15, 1996</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 &a.doc The latest version of this document is always available from the <url url="http://www.FreeBSD.ORG/" name="FreeBSD World Wide Web server">. It may also be downloaded in ascii, LaTeX, postscript or HTML from the <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/docs" name="FreeBSD FTP server"> or one of the numerous <ref id="mirrors" name="mirror sites">. </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; "as; <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 you wish to provide other people with dialup connections to 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; &stable; &synching; &submitters; &troubleshooting; &kerneldebug; &linuxemu; <chapt><heading>FreeBSD internals</heading> &booting; &memoryuse; &dma; <!-- ************************************************************ --> <part><heading>Appendices</heading> &mirrors; &bibliography; &eresources; &contrib; &pgpkeys; <!-- &glossary; --> </book> </linuxdoc> diff --git a/handbook/history.sgml b/handbook/history.sgml index 3ba3113621..d247053f6e 100644 --- a/handbook/history.sgml +++ b/handbook/history.sgml @@ -1,116 +1,116 @@ -<!-- $Id: history.sgml,v 1.13 1996-01-31 14:26:07 mpp Exp $ --> +<!-- $Id: history.sgml,v 1.14 1996-05-16 23:17:59 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 +around this time, though they did not 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 +just was not 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 +It did not 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 +accounts, people are pretty happy with it. We will 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 +general health, a migration to 2.2 will then begin in early Q2 of 1996 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 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 +Individuals who hae 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 08b45b6353..405b49f09f 100644 --- a/handbook/hw.sgml +++ b/handbook/hw.sgml @@ -1,266 +1,266 @@ -<!-- $Id: hw.sgml,v 1.20 1996-05-09 23:04:43 mpp Exp $ --> +<!-- $Id: hw.sgml,v 1.21 1996-05-16 23:18:01 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 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 the &a.questions (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 + configurations with the following components. I cannot 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 + server and workstation systems. If you are 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 is worth + the extra cost. If you are 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 and have heard mixed reports - some say it's a fine MB, others - say that it's measurably slower than the Triton. The only undisputed + motherboard and have heard mixed reports - some say it is a fine MB, others + say that it is measurably slower than the Triton. The only undisputed advantage it offers is 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. <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 will 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 easily 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 + you are putting together an NFS or NEWS server that will be doing a lot of multiuser disk I/O. <sect2><heading>CDROM drives</heading> <p>My SCSI preferences extend to SCSI CDROM drives as well, and the <htmlurl url="http://www.toshiba.com" name="Toshiba"> XM-3501B (now released in a caddy-less model called the XM-5401B) drive has always - performed well for me. Generally speaking, most SCSI CDROM drives I've - seen have been of pretty solid construction (probably because they don't + performed well for me. Generally speaking, most SCSI CDROM drives I have + seen have been of pretty solid construction (probably because they do not occupy the lower end of the market, due to their higher price) and you - probably won't go wrong with an HP or NEC SCSI CDROM drive either. + probably will not go wrong with an HP or NEC SCSI CDROM drive either. <sect2><heading>Tape drives</heading> <p>I've had pretty good luck with both <htmlurl url="http://www.Exabyte.COM:80/Products/8mm/8505XL/Rfeatures.html" name="8mm drives"> from <htmlurl url="http://www.exabyte.com" name="Exabyte"> and <htmlurl url="http://www-dmo.external.hp.com:80/tape/_cpb0001.htm" name="4mm (DAT)"> drives from <htmlurl url="http://www.hp.com" name="HP">. - <p>For backup purposes, I'd have to give the higher recommendation to the + <p>For backup purposes, I would have to give the higher recommendation to the Exabyte due to the more robust nature (and higher storage capacity) of 8mm tape. <sect2><heading>Video Cards</heading> <p>If you can also afford to buy a commercial X server for US$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 + liking, you certainly cannot 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 pretty fast cards as well, 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 + any less than U.S. $2,500 for a 21" monitor if that is 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 chip and other cards using it, such as the Zynx ZX342 or DEC DE435, will generally work as well. <sect2><heading>Serial</heading> - <p>If you're looking for high-speed serial networking solutions, then + <p>If you are looking for high-speed serial networking solutions, then <htmlurl url="http://www.dgii.com/" name="Digi International"> makes the <htmlurl url="http://www.dgii.com/prodprofiles/profiles-prices/digiprofiles/digispecs/sync570.html" name="SYNC/570"> 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. <p>Multiport card options are somewhat more numerous, though it has to be said that FreeBSD's support for <htmlurl url="http://www.cyclades.com/" name="Cyclades">'s products is probably the tightest, primarily as a result of that company's committment to making sure that we are adequately supplied - with evaluation boards and technical specs. I've heard that the Cyclom-16Ye - offers the best price/performance, though I've not checked the prices lately. - Other multiport cards I've heard good things about are the BOCA and AST + with evaluation boards and technical specs. I have heard that the Cyclom-16Ye + offers the best price/performance, though I have not checked the prices lately. + Other multiport cards I have heard good things about are the BOCA and AST cards, and <htmlurl url="http://www.stallion.com/" name="Stallion Technologies"> apparently offers an unofficial driver for their cards at <htmlurl url="ftp://ftp.stallion.com/drivers/unsupported/freebsd/stalbsd-0.0.4.tar.gz" name="this"> location. <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 + fairly anemic, however, so I am 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. <sect2><heading>Video</heading> - <p>For video capture, there's really only once choice - the + <p>For video capture, there is really only once choice - the <htmlurl url="http://www.matrox.com/" name="Matrox"> <htmlurl url="http://www.matrox.com/imgweb/meteor.htm" name="Meteor"> card. FreeBSD also supports the older video spigot card from Creative Labs, but those are getting somewhat difficult to find and the Meteor is a more current generation frame-grabber with a higher-speed PCI interface. I use one for broadcasting video on the MBONE and it works quite well! <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> &uart; &sio; <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> <sect><heading>* Other<label id="hw:other"></heading> <sect1><heading>* PCMCIA</heading> diff --git a/handbook/install.sgml b/handbook/install.sgml index 00aa268583..5b03aad80f 100644 --- a/handbook/install.sgml +++ b/handbook/install.sgml @@ -1,816 +1,816 @@ -<!-- $Id: install.sgml,v 1.28 1996-05-16 20:20:57 jkh Exp $ --> +<!-- $Id: install.sgml,v 1.29 1996-05-16 23:18:01 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 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 four 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 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 AIC7850 on-board 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>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 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 DC21040/DC21041/DC21140 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>Fujitsu MB86960A/MB86965A <item>Intel EtherExpress <item>Intel EtherExpress Pro/100B 100Mbit. <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>3Com 3C590, 3C595 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 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>Digiboard Sync/570i high-speed sync serial card. <item>Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound, Gravis UltraSound MAX and Roland MPU-401 sound cards. </itemize> FreeBSD does not currently support IBM's microchannel (MCA) bus. <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, 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 + as we have no hand or say in how they are 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 running + the ``makeflp.bat'' command. [NOTE: If you are running FreeBSD 2.1-RELEASE and have 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! + Before removing the CD again, also note that it is necessary to first + type: <tt>umount /cdrom</tt>. Do not 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 simply because you enjoy doing things the hard way, you must first prepare some floppies for the install. The first floppy that you will 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 is 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 + using ordinary DOS or UFS (if you are 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 + directory. If you are 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 + command. If you are 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 + of improperly formatted media, which is why I am 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 + If you are creating the floppies from another FreeBSD machine, + a format is still not a bad idea though you do nott 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, as the following sequence of commands (for a 3.5" 1.44MB floppy disk) illustrates: <tscreen><verb> fdformat -f 1440 fd0.1440 disklabel -w -r fd0.1440 floppy3 newfs -t 2 -u 18 -l 1 -i 65536 /dev/rfd0 (Use "fd0.1200" and "floppy5" for 5.25" 1.2MB disks). </verb></tscreen> Then you can mount and write to them like any other file system. After you have 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 the &a.doc;. 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 Novice, Custom or Express install, depending on whether or not you would like the installation to help you through a typical installation, give you a high degree of control over each step of the installation or simply whizz through it (using reasonable defaults when possible) as fast as possible. If you've never used FreeBSD before then the Novice installation method is most recommended. <item>The final configuration 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> <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. <bf>Can I mount my MS-DOS extended partitions?</bf> Yes. DOS extended partitions are mapped in at the end of the other ``slices'' in FreeBSD, e.g. your D: drive might be /dev/sd0s5, your E: drive /dev/sd0s6, and so on. This example assumes, of course, that your extended partition is on SCSI drive 0. For IDE drives, substitute ``wd'' for ``sd'' appropriately. You otherwise mount extended partitions exactly like you would mount any other DOS drive, e.g.: <tscreen><verb> mount -t msdos /dev/sd0s5 /dos_d </verb></tscreen> <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. BSDI has also donated their DOS emulator to the BSD world and this is slowly being ported to FreeBSD-current. Send mail to the &a.emulation if you're interested in joining this effort! In the interim, there is a nice application available in the <ref id="ports" name="The Ports Collection"> called pcemu which allows you to run many basic MS-DOS text-mode binaries by entirely emulating an 8088 CPU. diff --git a/handbook/kerberos.sgml b/handbook/kerberos.sgml index 3f183539ad..1a5eea48a0 100644 --- a/handbook/kerberos.sgml +++ b/handbook/kerberos.sgml @@ -1,480 +1,480 @@ -<!-- $Id: kerberos.sgml,v 1.6 1996-01-03 13:13:16 gclarkii Exp $ --> +<!-- $Id: kerberos.sgml,v 1.7 1996-05-16 23:18:02 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>Kerberos<label id="kerberos"></heading> <p><em>Contributed by &a.markm; (based on contribution by &a.md;).</em> Kerberos is a network add-on system/protocol that allows users to authenticate themselves through the services of a secure server. Services such as remote login, remote copy, secure inter-system file copying and other high-risk tasks are made considerably safer and more controllable. The following instructions can be used as a guide on how to set up Kerberos as distributed for FreeBSD. However, you should refer to the relevant manual pages for a complete description. In FreeBSD, the Kerberos is not that from the original 4.4 BSD, distribution, but eBones, which had been previously ported to FreeBSD 1.1.5.1, and was sourced from outside the USA/Canada, and is thus available to system owners outside those countries. For those needing to get a legal foreign distribution of this software, please <em>DO NOT</em> get it from a USA or Canada site. You will get that site in <em>big</em> trouble! A legal copy of this is available from <tt>skeleton.mikom.csir.co.za</tt>, which is in South Africa. <sect1> <heading>Creating the initial database</heading> <p>This is done on the Kerberos server only. First make sure that your - don't have any old Kerberos databases around. You should change to the + do not have any old Kerberos databases around. You should change to the directory <tt>/etc/kerberosIV</tt> and check that only the following files are present: <tscreen><verb> grunt# cd /etc/kerberosIV grunt# ls README krb.conf krb.realms </verb></tscreen> <p>If any additional files (such as <tt>principal.*</tt> or <tt>master_key</tt>) exist, then use the <tt>kdb_destroy</tt> command to destroy the old Kerberos database, of if Kerberos is not running, simply delete the extra files with <tt>rm</tt>. You should now edit the <tt>krb.conf</tt> and <tt>krb.realms</tt> files to define your Kerberos realm. In this case the realm will be <it>GRONDAR.ZA</it> and the server is <it>grunt.grondar.za</it>. We edit or create the <tt>krb.conf</tt> file: <tscreen><verb> grunt# cat krb.conf GRONDAR.ZA GRONDAR.ZA grunt.grondar.za admin server CS.BERKELEY.EDU okeeffe.berkeley.edu ATHENA.MIT.EDU kerberos.mit.edu ATHENA.MIT.EDU kerberos-1.mit.edu ATHENA.MIT.EDU kerberos-2.mit.edu ATHENA.MIT.EDU kerberos-3.mit.edu LCS.MIT.EDU kerberos.lcs.mit.edu TELECOM.MIT.EDU bitsy.mit.edu ARC.NASA.GOV trident.arc.nasa.gov </verb></tscreen> <p>In this case, the other realms do not need to be there. They are here as an example of how a machine may be made aware of multiple realms. You may wish to not include them for simplicity. The first line names the realm in which this system works. The other lines contain realm/host entries. The first item on a line is a realm, and the second is a host in that realm that is acting as a ``key distribution centre''. The words ``admin server'' following a hosts name means that host also provides an administrative database server. For further explanation of these terms, please consult the Kerberos man pages. Now we have to add <it>grunt.grondar.za</it> to the <it>GRONDAR.ZA</it> realm and also add an entry to put all hosts in the <it>.grondar.za</it> domain in the <it>GRONDAR.ZA</it> realm. The <tt>krb.realms</tt> file would be updated as follows: <tscreen><verb> grunt# cat krb.realms grunt.grondar.za GRONDAR.ZA .grondar.za GRONDAR.ZA .berkeley.edu CS.BERKELEY.EDU .MIT.EDU ATHENA.MIT.EDU .mit.edu ATHENA.MIT.EDU </verb></tscreen> <p>Again, the other realms do not need to be there. They are here as an example of how a machine may be made aware of multiple realms. You may wish to remove them to simplify things. The first line puts the <it>specific</it> system into the named realm. The rest of the lines show how to default systems of a particular subdomain to a named realm. - Now we're ready to create the database. This only needs to run on + Now we are ready to create the database. This only needs to run on the Kerberos server (or Key Distribution Centre). Issue the <tt>kdb_init</tt> command to do this: <tscreen><verb> grunt# kdb_init Realm name [default ATHENA.MIT.EDU ]: GRONDAR.ZA You will be prompted for the database Master Password. It is important that you NOT FORGET this password. Enter Kerberos master key: </verb></tscreen> <p>Now we have to save the key so that servers on the local machine can pick it up. Use the <tt>kstash</tt> command to do this. <tscreen><verb> grunt# kstash Enter Kerberos master key: Current Kerberos master key version is 1. Master key entered. BEWARE! </verb></tscreen> <p>This saves the encrypted master password in <tt>/etc/kerberosIV/master_key</tt>. <sect1> <heading>Making it all run</heading> <p>Two principals need to be added to the database for <it>each</it> system that will be secured with Kerberos. Their names are <tt>kpasswd</tt> and <tt>rcmd</tt> These two principals are made for each system, with the instance being the name of the individual system. These daemons, <tt>kpasswd</tt> and <tt>rcmd</tt> allow other systems to change Kerberos passwords and run commands like <tt>rcp</tt>, <tt>rlogin</tt> and <tt>rsh</tt>. Now lets add these entries: <tscreen><verb> grunt# kdb_edit Opening database... Enter Kerberos master key: Current Kerberos master key version is 1. Master key entered. BEWARE! Previous or default values are in [brackets] , enter return to leave the same, or new value. Principal name: passwd Instance: grunt <Not found>, Create [y] ? y Principal: passwd, Instance: grunt, kdc_key_ver: 1 New Password: <---- enter RANDOM here Verifying password New Password: <---- enter RANDOM here Random password [y] ? y Principal's new key version = 1 Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ? Max ticket lifetime (*5 minutes) [ 255 ] ? Attributes [ 0 ] ? Edit O.K. Principal name: rcmd Instance: grunt <Not found>, Create [y] ? Principal: rcmd, Instance: grunt, kdc_key_ver: 1 New Password: <---- enter RANDOM here Verifying password New Password: <---- enter RANDOM here Random password [y] ? Principal's new key version = 1 Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ? Max ticket lifetime (*5 minutes) [ 255 ] ? Attributes [ 0 ] ? Edit O.K. Principal name: <---- null entry here will cause an exit </verb></tscreen> <sect1> <heading>Creating the server file</heading> <p>We now have to extract all the instances which define the services on each machine. For this we use the <tt>ext_srvtab</tt> command. This will create a file which must be copied or moved <it>by secure means</it> to each Kerberos client's /etc/kerberosIV directory. This file must be present on each server and client, and is crucial to the operation of Kerberos. <tscreen><verb> grunt# ext_srvtab grunt Enter Kerberos master key: Current Kerberos master key version is 1. Master key entered. BEWARE! Generating 'grunt-new-srvtab'.... </verb></tscreen> <p>Now, this command only generates a temporary file which must be renamed to <tt>srvtab</tt> so that all the server can pick it up. Use the <tt>mv</tt> command to move it into place on the original system: <tscreen><verb> grunt# mv grunt-new-srvtab srvtab </verb></tscreen> <p>If the file is for a client system, and the network is not deemed safe, then copy the <tt><client>-new-srvtab</tt> to removable media and transport it by secure physical means. Be sure to rename it to <tt>srvtab</tt> in the client's <tt>/etc/kerberosIV</tt> directory, and make sure it is mode 600: <tscreen><verb> grumble# mv grumble-new-srvtab srvtab grumble# chmod 600 srvtab </verb></tscreen> <sect1> <heading>Populating the database</heading> <p>We now have to add some user entries into the database. First lets create an entry for the user <it>jane</it>. Use the <tt>kdb_edit</tt> command to do this: <tscreen><verb> grunt# kdb_edit Opening database... Enter Kerberos master key: Current Kerberos master key version is 1. Master key entered. BEWARE! Previous or default values are in [brackets] , enter return to leave the same, or new value. Principal name: jane Instance: <Not found>, Create [y] ? y Principal: jane, Instance: , kdc_key_ver: 1 New Password: <---- enter a secure password here Verifying password New Password: <---- re-enter the password here Principal's new key version = 1 Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ? Max ticket lifetime (*5 minutes) [ 255 ] ? Attributes [ 0 ] ? Edit O.K. Principal name: <---- null entry here will cause an exit </verb></tscreen> <sect1> <heading>Testing it all out</heading> <p>First we have to start the Kerberos daemons. NOTE that if you have correctly edited your <tt>/etc/sysconfig</tt> then this will happen automatically when you reboot. This is only necessary on the Kerberos server. Kerberos clients will automagically get what they need from the <tt>/etc/kerberosIV</tt> directory. <tscreen><verb> grunt# kerberos & grunt# Kerberos server starting Sleep forever on error Log file is /var/log/kerberos.log Current Kerberos master key version is 1. Master key entered. BEWARE! Current Kerberos master key version is 1 Local realm: GRONDAR.ZA grunt# kadmind -n & grunt# KADM Server KADM0.0A initializing Please do not use 'kill -9' to kill this job, use a regular kill instead Current Kerberos master key version is 1. Master key entered. BEWARE! </verb></tscreen> <p>Now we can try using the <tt>kinit</tt> command to get a ticket for the id <it>jane</it> that we created above: <tscreen><verb> grunt$ kinit jane MIT Project Athena (grunt.grondar.za) Kerberos Initialization for "jane" Password: </verb></tscreen> <p>Try listing the tokens using <tt>klist</tt> to see if we really have them: <tscreen><verb> grunt$ klist Ticket file: /tmp/tkt245 Principal: jane@GRONDAR.ZA Issued Expires Principal Apr 30 11:23:22 Apr 30 19:23:22 krbtgt.GRONDAR.ZA@GRONDAR.ZA </verb></tscreen> <p>Now try changing the password using <tt>passwd</tt> to check if the kpasswd daemon can get authorization to the Kerberos database: <tscreen><verb> grunt$ passwd realm GRONDAR.ZA Old password for jane: New Password for jane: Verifying password New Password for jane: Password changed. </verb></tscreen> <sect1> <heading>Adding <tt>su</tt> privileges</heading> <p>Kerberos allows us to give <it>each</it> user who needs root privileges their own <it>separate</it> <tt>su</tt>password. We could now add an id which is authorized to <tt>su</tt> to <it>root</it>. This is controlled by having an instance of <it>root</it> associated with a principal. Using <tt>kdb_edit</tt> we can create the entry <it>jane.root</it> in the Kerberos database: <tscreen><verb> grunt# kdb_edit Opening database... Enter Kerberos master key: Current Kerberos master key version is 1. Master key entered. BEWARE! Previous or default values are in [brackets] , enter return to leave the same, or new value. Principal name: jane Instance: root <Not found>, Create [y] ? y Principal: jane, Instance: root, kdc_key_ver: 1 New Password: <---- enter a SECURE password here Verifying password New Password: <---- re-enter the password here Principal's new key version = 1 Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ? Max ticket lifetime (*5 minutes) [ 255 ] ? 12 <--- Keep this short! Attributes [ 0 ] ? Edit O.K. Principal name: <---- null entry here will cause an exit </verb></tscreen> <p>Now try getting tokens for it to make sure it works: <tscreen><verb> grunt# kinit jane.root MIT Project Athena (grunt.grondar.za) Kerberos Initialization for "jane.root" Password: </verb></tscreen> <p>Now we need to add the user to root's <tt>.klogin</tt> file: <tscreen><verb> grunt# cat /root/.klogin jane.root@GRONDAR.ZA </verb></tscreen> <p>Now try doing the <tt>su</tt>: <tscreen><verb> [jane@grunt 10407] su Password: grunt# </verb></tscreen> and take a look at what tokens we have: <tscreen><verb> grunt# klist Ticket file: /tmp/tkt_root_245 Principal: jane.root@GRONDAR.ZA Issued Expires Principal May 2 20:43:12 May 3 04:43:12 krbtgt.GRONDAR.ZA@GRONDAR.ZA </verb></tscreen> <sect1> <heading>Using other commands</heading> <p>In an earlier example, we created a principal called <tt>jane</tt> with an instance <tt>root</tt>. This was based on a user with the same name as the principal, and this is a Kerberos default; that a <em><principal>.<instance></em> of the form <em><username>.</em><tt>root</tt> will allow that <em><username></em> to <tt>su</tt> to root if the necessary entries are in the <tt>.klogin</tt> file in <tt>root</tt>'s home directory: <tscreen><verb> grunt# cat /root/.klogin jane.root@GRONDAR.ZA </verb></tscreen> <p>Likewise, if a user has in their own home directory lines of the form: <tscreen><verb> [jane@grunt 10543] cat ~/.klogin jane@GRONDAR.ZA jack@GRONDAR.ZA </verb></tscreen> <p>This allows anyone in the <em>GRONDAR.ZA</em> realm who has authenticated themselves to <em>jane</em> or <em>jack</em> (via <tt>kinit</tt>, see above) access to <tt>rlogin</tt> to <em>jane</em>'s account or files on this system (<em>grunt</em>) via <tt>rlogin</tt>, <tt>rsh</tt> or <tt>rcp</tt>. For example, Jane now logs into another system, using Kerberos: <tscreen><verb> [jane@grumble 573] kinit MIT Project Athena (grunt.grondar.za) Password: [jane@grumble 574] rlogin grunt Last login: Mon May 1 21:14:47 from grumble Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 [jane@grunt 10567] </verb></tscreen> <p>Or Jack logs into Jane's account on the same machine (Jane having set up the <tt>.klogin</tt> file as above, and the person in charge of Kerberos having set up principal <em>jack</em> with a null instance: <tscreen><verb> [jack@grumble 573] kinit [jack@grumble 574] rlogin grunt -l jane MIT Project Athena (grunt.grondar.za) Password: Last login: Mon May 1 21:16:55 from grumble Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 [jane@grunt 10578] </verb></tscreen> diff --git a/handbook/kernelconfig.sgml b/handbook/kernelconfig.sgml index 2f28a0377f..1f25828a5b 100644 --- a/handbook/kernelconfig.sgml +++ b/handbook/kernelconfig.sgml @@ -1,1258 +1,1258 @@ -<!-- $Id: kernelconfig.sgml,v 1.11 1996-05-15 15:17:26 jfieber Exp $ --> +<!-- $Id: kernelconfig.sgml,v 1.12 1996-05-16 23:18:03 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<label id="kernelconfig:building"></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 + different hardware, it is 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. + changes you have made to differentiate it from GENERIC. - If you've build a kernel under SunOS or some other BSD + If you have 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 + to you. If you are 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 + you will 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 + When you are 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 + <quote><em/Note:/ If you have 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. <p>The kernel is currently being moved to a better organization of the option handling. Traditionally, each option in the config file was simply converted into a <tt>-D</tt> switch for the <tt>CFLAGS</tt> line of the kernel Makefile. Naturally, this caused a creaping optionism, with nobody really knowing which option has been referenced in what files. <p>In the new scheme, every <tt>#ifdef</tt> that is intended to be dependant upon an option gets this option out of an <tt>opt_<em>foo</em>.h</tt> declaration file created in the compile directory by <tt>config</tt>. The list of valid options - for <tt>config</tt> lives in two files: options that don't + for <tt>config</tt> lives in two files: options that do nott depend on the architecture are listed in <tt>/sys/conf/options</tt>, architecture-dependant ones in <tt>/sys/<em>arch</em>/conf/options.<em>arch</em></tt>, with <em>arch</em> being for example <tt>i386</tt>. <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 + the kernel, so it is 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> + <tt>-D</tt> switch, do not 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 + you are 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 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 co-processor emulation routines that come with FreeBSD are <em>not</em> very accurate. If you do not have a 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 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 + speed. If you use X Windows, you will 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 + apply (if you have a SCSI hard drive, you will 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> 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). </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 + drives, you can ignore this, otherwise you will 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. + devices, you will 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 + comment out all of these lines. Otherwise, you will 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 + NE2000) you will 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 + support, you will 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 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> + login port. It is 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 + lines are included in the GENERIC kernel, you will 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> + only exists if you have 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 + description, you have 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 the &a.questions 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 + <p>If you have 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 b683f49707..bdde6a41dd 100644 --- a/handbook/kerneldebug.sgml +++ b/handbook/kerneldebug.sgml @@ -1,424 +1,424 @@ -<!-- $Id: kerneldebug.sgml,v 1.9 1996-03-14 02:52:06 adam Exp $ --> +<!-- $Id: kerneldebug.sgml,v 1.10 1996-05-16 23:18:04 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 -d</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 + Here is 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 this, it's a real-world error + numbered for reference. Despite this, it is 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.) + (I do not have a new core dump handy <g>, my kernel + did not panic for ia rather long time.) From looking at the code in source line 403, - there's a high probability that either the pointer + there is 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! + it, and it is therefore not compiled using <tt>config -g</tt>? + Not everything is lost here. Do not panic! Of course, you still need to enable crash dumps. See above - on the options you've got in order to do this. + on the options you have to specify 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 + there (but <em>do not</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 + <tt>-g</tt> option will not change anything for the generated + code, so you will 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 + If you need to do low-level debugging on your kernel, there is + 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 + There is 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 + <bf>Note:</bf> this is different from <tt>gdb</tt>'s `next' statement, it is 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> 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 need a short command summary, simply type <tscreen><verb> help </verb></tscreen> - However, it's highly recommended to have a printed copy of the + However, it is 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 + Remember that it is 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/linuxemu.sgml b/handbook/linuxemu.sgml index 794cc03901..57205608c5 100644 --- a/handbook/linuxemu.sgml +++ b/handbook/linuxemu.sgml @@ -1,661 +1,661 @@ -<!-- $Id: linuxemu.sgml,v 1.3 1996-05-16 22:50:29 mpp Exp $ --> +<!-- $Id: linuxemu.sgml,v 1.4 1996-05-16 23:18:05 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <chapt><heading>Linux Emulation<label id="linuxemu"></heading> <p><em>Contributed by &a.brian and &a.rich;</em> <sect><heading>How to install the Linux emulator</heading> -<p>Linux emulation in FreeBSD has reached a point where it's possible +<p>Linux emulation in FreeBSD has reached a point where it is possible to run a large fraction of Linux binaries in both a.out and ELF format. The linux emulation in the -STABLE branch is capable of running Linux DOOM and Mathematica; the version present in FreeBSD-CURRENT is vastly more capable and runs all these as well as Quake, Abuse, IDL, netrek for Linux and a whole host of other programs. There are some Linux-specific operating system features that are not supported on FreeBSD. Linux binaries will not work on FreeBSD if they use the Linux /proc filesystem (which is different from the optional FreeBSD /proc filesystem) or i386-specific calls, such as enabling virtual 8086 mode. <p>To tell whether your kernel is configured for Linux compatibility simply run any Linux binary. If it prints the error message <verb> linux-executable: Exec format error. Wrong Architecture. </verb> then you do not have linux compatibility support and you need to configure and install a new kernel. Depending on which version of FreeBSD you are running, how you get Linux-emulation up will vary slightly: <sect1><heading>Installing Linux Emulation in 2.1-STABLE</heading> <p>The GENERIC kernel in 2.1-stable is not configured for linux compatibility so you you must reconfigure your kernel for it. There are two ways to do this: 1. linking the emulator statically in the kernel itself and 2. configuring your kernel to dynamically load the linux loadable kernel module (LKM). <p>To enable the emulator, add the following to your configuration file (c.f. /sys/i386/conf/LINT): <tscreen> <verb> options "COMPAT_LINUX" </verb> </tscreen> If you want to run doom or other applications that need shared memory also add the following. <tscreen> <verb> options SYSVSHM </verb> </tscreen> The linux system calls require 4.3 BSD system call compatibility. So make sure you have the following. <tscreen> <verb> options "COMPAT_43" </verb> </tscreen> If you prefer to statically link the emulator in the kernel rather than use the loadable kernel module (LKM), then add <tscreen> <verb> options LINUX </verb> </tscreen> Then run config and install the new kernel as described in the <ref id="kernelconfig:config" name="Configuration File"> section. If you decide to use the LKM you must also install the loadable module. A mismatch of versions between the kernel and loadable module can cause the kernel to crash, so the safest thing to do is to reinstall the LKM when you install the kernel. <tscreen> <verb> cd /usr/src/lkm/linux make all install </verb> </tscreen> Once you have installed the kernel and the LKM, you can invoke <tscreen> <verb> linux </verb> </tscreen> as root to load the LKM. To see whether the LKM is loaded, run <tscreen> <verb> modstat </verb> </tscreen> which should produce output something like this. <tscreen> <verb> Type Id Off Loadaddr Size Info Rev Module Name EXEC 0 3 f0baf000 0018 f0bb4000 1 linux_emulator </verb> </tscreen> You can cause the LKM to be loaded when the system boots in either of two ways. On FreeBSD-CURRENT and FreeBSD-STABLE enable it in /etc/sysconfig <tscreen> <verb> linux=YES </verb> </tscreen> by changing it from NO to YES. FreeBSD 2.1 RELEASE and earlier do not have such a line and on those you will need to edit /etc/rc.local to add the following line. <tscreen> <verb> linux </verb> </tscreen> <sect1><heading>Installing Linux Emulation in 2.2-CURRENT</heading> <p>In -current it is no longer necessary to specify options "LINUX" or options "COMPAT_LINUX". Linux emulation is done with an LKM (``Loadable Kernel Module'') so it can be installed on the fly without -having to reboot. You'll need the following things in your startup files, +having to reboot. You will need the following things in your startup files, however: <enum> <item> In <tt>/etc/sysconfig</tt>, you need the following line: <verb> linux=YES </verb> <item> This, in turn, triggers the following action in <tt>/etc/rc.i386</tt>: <verb> # Start the Linux binary emulation if requested. if [ "X${linux}" = X"YES" ]; then echo -n ' '; linux # XXX BOGUS - Linux script shouldn't make any output on success fi </verb> </enum> -<p>If you want to verify it's running, <tt>modstat</tt> will do that: +<p>If you want to verify it is running, <tt>modstat</tt> will do that: <tscreen> <verb> % modstat Type Id Off Loadaddr Size Info Rev Module Name EXEC 0 4 f09e6000 001c f09ec010 1 linux_mod % </verb> </tscreen> However, there have been reports that this fails on some FreeBSD-current systems. If for some reason you cannot load the linux LKM, then statically link the emulator in the kernel by adding <tscreen> <verb> options LINUX </verb> </tscreen> to your kernel config file. Then run config and install the new kernel as described in <ref id="kernelconfig:building" name="Building and Installing a Custom Kernel">. <sect1><heading>Installing Linux Runtime Libraries</heading> <sect2><heading>Installing using the linux_lib port</heading> -<p>Most linux applications use shared libraries, so you're still not -done untill you install the shared libraries. It's possible to do -this by hand, however, it's vastly simpler to just grab the +<p>Most linux applications use shared libraries, so you are still not +done untill you install the shared libraries. It is possible to do +this by hand, however, it is vastly simpler to just grab the <tt>linux_lib</tt> port: <tscreen> <verb> % cd /usr/ports-current/emulators/linux_lib % make all install </verb> </tscreen> and you should have a working linux emulator. Legend (and the mail archives :-) seems to hold that Linux emulation works best with linux binaries linked against the ZMAGIC libraries; QMAGIC libraries (such as those used in Slackware V2.0) may tend to give the Linuxulator heartburn. As of this writing (March 1996) ELF emulation is still in the formulative stages but seems to work pretty well. Also, expect some programs to complain about incorrect minor versions. In -general this doesn't seem to be a problem. +general this does not seem to be a problem. <sect2><heading>Installing libraries manually</heading> <p>If you don't have the ``ports'' distribution, you can install the -libraries by hand instead. You'll need the Linux shared libraries +libraries by hand instead. You will need the Linux shared libraries that the program depends on and the runtime linker. Also, you will need to create a "shadow root" directory, /compat/linux, for Linux libraries on your FreeBSD system. Any shared libraries opened by Linux programs run under FreeBSD will look in this tree first. So, if a Linux program loads, for example, /lib/libc.so, FreeBSD will first try to open /compat/linux/lib/libc.so, and if that does not exist then it will try /lib/libc.so. Shared libraries should be installed in the shadow tree /compat/linux/lib rather than the paths that the Linux ld.so reports. FreeBSD-current works slightly differently with respect to /compat/linux. On -current, all files, not just libraries, are searched for from the ``shadow root'' /compat/linux. Generally, you will need to look for the shared libraries that Linux binaries depend on only the first few times that you install a Linux program on your FreeBSD system. After a while, you will have a sufficient set of Linux shared libraries on your system to be able to run newly imported Linux binaries without any extra work. <sect2><heading>How to install additional shared libraries</heading> <p>What if you install the linux_lib port and your application still complains about missing shared libraries? How do you know which shared libraries Linux binaries need, and where to get them? Basically, there are 2 possibilities (when following these instructions: you will need to be root on your FreeBSD system to do the necessary installation steps). <p>If you have access to a Linux system, see what shared libraries it needs, and copy them to your FreeBSD system. Example: you have just ftp'ed the Linux binary of Doom. Put it on the Linux system you have access to, and check which shared libraries it needs by running `ldd linuxxdoom': <verb> % ldd linuxxdoom libXt.so.3 (DLL Jump 3.1) => /usr/X11/lib/libXt.so.3.1.0 libX11.so.3 (DLL Jump 3.1) => /usr/X11/lib/libX11.so.3.1.0 libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29 </verb> <p>You would need go get all the files from the last column, and put them under /compat/linux, with the names in the first column as symbolic links pointing to them. This means you eventually have these files on your FreeBSD system: <verb> /compat/linux/usr/X11/lib/libXt.so.3.1.0 /compat/linux/usr/X11/lib/libXt.so.3 -> libXt.so.3.1.0 /compat/linux/usr/X11/lib/libX11.so.3.1.0 /compat/linux/usr/X11/lib/libX11.so.3 -> libX11.so.3.1.0 /compat/linux/lib/libc.so.4.6.29 /compat/linux/lib/libc.so.4 -> libc.so.4.6.29 </verb> <p>Note that if you already have a Linux shared library with a matching major revision number to the first column of the 'ldd' -output, you won't need to copy the file named in the last column to +output, you will not need to copy the file named in the last column to your system, the one you already have should work. It is advisable to copy the shared library anyway if it is a newer version, though. You can remove the old one, as long as you make the symbolic link point to the new one. So, if you have these libraries on your system: <verb> /compat/linux/lib/libc.so.4.6.27 /compat/linux/lib/libc.so.4 -> libc.so.4.6.27 </verb> and you find a new binary that claims to require a later version according to the output of ldd: <verb> libc.so.4 (DLL Jump 4.5pl26) -> libc.so.4.6.29 </verb> -If it's only one or two versions out of date in the in the trailing -digit then don't worry about copying /lib/libc.so.4.6.29 too, because +If it is only one or two versions out of date in the in the trailing +digit then do not worry about copying /lib/libc.so.4.6.29 too, because the program should work fine with the slightly older version. However, if you like you can decide to replace the libc.so anyway, and that should leave you with: <verb> /compat/linux/lib/libc.so.4.6.29 /compat/linux/lib/libc.so.4 -> libc.so.4.6.29 </verb> <p>Please note that the symbolic link mechanism is <em>only</em> needed for Linux binaries, the FreeBSD runtime linker takes care of -looking for matching major revision numbers itself, you don't need to +looking for matching major revision numbers itself, you do not need to worry about that. <sect2><heading>Configuring the ld.so -- for FreeBSD-current only</heading> <p>This section applies only to FreeBSD-current only. Those running FreeBSD-stable should skip this section. <p>Finally, if you run FreeBSD-current you must make sure that you have the Linux runtime linker and its config files on your system. You should copy these files from the Linux system to their appropriate place on your FreeBSD system (to the /compat/linux tree): <verb> /compat/linux/lib/ld.so /compat/linux/etc/ld.so.config </verb> -<p>If you don't have access to a Linux system, you should get the +<p>If you do nott have access to a Linux system, you should get the extra files you need from various ftp sites. Information on where to -look for the various files is appended below. For now, let's assume +look for the various files is appended below. For now, let us assume you know where to get the files. <p> Retrieve the following files (all from the same ftp site to avoid any version mismatches), and install them under /compat/linux (i.e. /foo/bar is installed as /compat/linux/foo/bar): <verb> /sbin/ldconfig /usr/bin/ldd /lib/libc.so.x.y.z /lib/ld.so </verb> -<p>ldconfig and ldd don't necessarily need to be under /compat/linux, +<p>ldconfig and ldd do not necessarily need to be under /compat/linux, you can install them elsewhere in the system too. Just make sure they -don't conflict with their FreeBSD counterparts. A good idea would be +do not conflict with their FreeBSD counterparts. A good idea would be to install them in /usr/local/bin as ldconfig-linux and ldd-linux. <p> Create the file /compat/linux/etc/ld.so.conf, containing the directories in which the Linux runtime linker should look for shared libs. It is a plain text file, containing a directory name on each line. /lib and /usr/lib are standard, you could add the following: <verb> /usr/X11/lib /usr/local/lib </verb> <p>When a linux binary opens a library such as /lib/libc.so the emulator maps the name to /compat/linux/lib/libc.so internally. All linux libraries should be installed under /compat/linux (e.g. /compat/linux/lib/libc.so, /compat/linux/usr/X11/lib/libX11.so, etc.) in order for the emulator to find them. <p>Those running FreeBSD-current should run the Linux ldconfig program. <verb> % cd /compat/linux/lib % /compat/linux/sbin/ldconfig </verb> -<p>Ldconfig is statically linked, so it doesn't need any shared +<p>Ldconfig is statically linked, so it does not need any shared libraries to run. It creates the file /compat/linux/etc/ld.so.cache which contains the names of all the shared libraries. It should rerun to recreate this file whenever you install additional shared libraries. On FreeBSD-stable do not install /compat/linux/etc/ld.so.cache or run ldconfig becuase in FreeBSD-stable the syscalls are implemented -differently and ldconfig isn't needed or used. +differently and ldconfig is not needed or used. <p>You should now be set up for Linux binaries which only need a shared libc. You can test this by running the Linux ldd on itself. Suppose that you have it installed as ldd-linux, it should produce something like: <verb> % ldd-linux `which ldd-linux` libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29 </verb> <p>This being done, you are ready to install new Linux binaries. Whenever you install a new Linux program, you should check if it needs shared libraries, and if so, whether you have them installed in the /compat/linux tree. To do this, you run the Linux version ldd on the new program, and watch its output. ldd (see also the manual page for ldd(1)) will print a list of shared libraries that the program depends on, in the form majorname (jumpversion) => fullname. <p>If it prints "not found" in stead of fullname it means that you need an extra library. Which library this is, is shown in majorname, which will be of the form libXXXX.so.N You will need to find a libXXXX.so.N.mm on a Linux ftp site, and install it on your system. The XXXX (name) and N (major revision number) should match; the minor number(s) mm are less important, though it is advised to take the most recent version. <sect1><heading>Configuring the host name resolver</heading> <p>If DNS does not work or you get the messages <tscreen> <verb> resolv+: "bind" is an invalid keyword resolv+: "hosts" is an invalid keyword </verb> </tscreen> then you need to configure a /compat/linux/etc/host.conf file containing: <tscreen> <verb> order hosts, bind multi on </verb> </tscreen> where the order here specifies that /etc/hosts is searched first and -DNS is searched second. When /compat/linux/etc/host.conf isn't +DNS is searched second. When /compat/linux/etc/host.conf is not installed linux applications find FreeBSD's /etc/host.conf and complain about the incompatible FreeBSD syntax. You should remove `bind,' if you have not configured a name-server using the /etc/resolv.conf file. <p>Lastly, those who run FreeBSD-stable need to set an the RESOLV_HOST_CONF environment variable so that applications will know how to search the host tables. If you run FreeBSD-current you can skip this. For the /bin/csh shell use: <verb> setenv RESOLV_HOST_CONF /compat/linux/etc/host.conf </verb> For /bin/sh use: <verb> RESOLV_HOST_CONF=/compat/linux/etc/host.conf; export RESOLV_HOST_CONF </verb> <sect1><heading>Finding the necessary files</heading> <p>Note: the information below is valid as of the time this document was written, but certain details such as names of ftp sites, directories and distribution names may have changed by the time you read this. <p>Linux is distributed by several groups that make their own set of binaries that they distribute. Each distribution has its own name, like ``Slackware'' or ``Yggdrasil''. The distributions are available on a lot of ftp sites. Sometimes the files are unpacked, and you can get the individual files you need, but mostly they are stored in distribution sets, usually consisting of subdirectories with gzipped tar files in them. The primary ftp sites for the distributions are: <verb> sunsite.unc.edu:/pub/Linux/distributions tsx-11.mit.edu:/pub/linux/distributions </verb> <p> Some European mirrors: <verb> ftp.luth.se:/pub/linux/distributions ftp.demon.co.uk:/pub/linux/distributions src.doc.ic.ac.uk:/packages/linux/distributions </verb> -<p>For simplicity, let's concentrate on Slackware here. This +<p>For simplicity, let us concentrate on Slackware here. This distribution consists of a number of subdirectories, containing -separate packages. Normally, they're controlled by an install +separate packages. Normally, they are controlled by an install program, but you can retrieve files "by hand" too. First of all, you will need to look in the "contents" subdir of the distribution. You will find a lot of small text files here describing the contents of the separate packages. The fastest way to look something up is to retrieve all the files in the contents subdirectory, and grep through them for the file you need. Here is an example of a list of files that you might need, and in which contents-file you will find it by grepping through them: <tabular ca=ll> Library <colsep>Package <rowsep> ld.so <colsep>ldso <rowsep> ldconfig <colsep>ldso <rowsep> ldd <colsep>ldso <rowsep> libc.so.4 <colsep>shlibs <rowsep> libX11.so.6.0 <colsep>xf_lib <rowsep> libXt.so.6.0 <colsep>xf_lib <rowsep> libX11.so.3 <colsep>oldlibs <rowsep> libXt.so.3 <colsep>oldlibs <rowsep> </tabular> <p>So, in this case, you will need the packages ldso, shlibs, xf_lib and oldlibs. In each of the contents-files for these packages, look for a line saying ``PACKAGE LOCATION'', it will tell you on which `disk' the package is, in our case it will tell us in which subdirectory we need to look. For our example, we would find the following locations: <tabular ca=ll> Package <colsep>Location <rowsep> ldso <colsep>diska2 <rowsep> shlibs <colsep>diska2 <rowsep> oldlibs <colsep>diskx6 <rowsep> xf_lib <colsep>diskx9 <rowsep> </tabular> <p>The locations called ``diskXX'' refer to the ``slakware/XX'' subdirectories of the distribution, others may be found in the ``contrib'' subdirectory. In this case, we could now retrieve the packages we need by retrieving the following files (relative to the root of the Slackware distribution tree): <tscreen> <verb> slakware/a2/ldso.tgz slakware/a2/shlibs.tgz slakware/x6/oldlibs/tgz slakware/x9/xf_lib.tgz </verb> </tscreen> <p>Extract the files from these gzipped tarfiles in your <tt>/compat/linux</tt> directory (possibly omitting or afterwards removing files you don't need), and you are done. <p><bf>See also:</bf> <verb> ftp.freebsd.org:pub/FreeBSD/2.0.5-RELEASE/xperimnt/linux-emu/README /usr/src/sys/i386/ibcs2/README.iBCS2 </verb> <sect><heading>How to Install Mathematica on FreeBSD<label id="mathematica"></heading> <p><em>Contributed by &a.rich and &a.chuck</em> This document shows how to install the Linux binary distribution of Mathematica 2.2 on FreeBSD 2.1. <p>Mathematica supports Linux but not FreeBSD as it stands. So once you have configured your system for Linux compatibility you have most of what you need to run Mathematica. <p>For those who already have the student edition of Mathematica for DOS the cost of upgrading to the Linux version at the time this was written, March 1996, was $45.00. It can be ordered directly from Wolfram at (217) 398-6500 and paid for by credit card. <sect1><heading>Unpacking the Mathematica distribution</heading> <p>The binaries are currently distributed by Wolfram on CDROM. The CDROM has about a dozen tar files, each of which is a binary distribution for one of the supported architectures. The one for Linux is named LINUX.TAR. You can, for example, unpack this into /usr/local/Mathematica: <verb> cd /usr/local mkdir Mathematica cd Mathematica tar -xvf /cdrom/LINUX.TAR </verb> <sect1><heading>Obtaining your Mathematica Password</heading> <p>Before you can run Mathematica you will have to obtain a password from Wolfram that corresponds to your `machine ID.' <p>Once you have installed the linux compatibility runtime libraries and unpacked the mathematica you can obtain the `machine ID' by running the program `mathinfo' in the Install directory: <verb> % cd /usr/local/Mathematica/Install % mathinfo LINUX: 'ioctl' fd=5, typ=0x89(), num=0x27 not implemented richc.isdn.bcm.tmc.edu 9845-03452-90255 % </verb> So, for example, the `machine ID' of `richc' is '9845-03452-90255'. You can ignore the message about the ioctl that is not implemented. It won't prevent Mathematica from running in any way and you can safely ignore it, though you will see the message every time you run Mathematica. <p>When you register with Wolfram, either by email, phone or fax, you'll give them the 'machine ID' and they will respond with a corresponding password consisting of groups of numbers. You need to add them both along with the machine name and license number in your mathpass file. You can do this by invoking: <verb> cd /usr/local/Mathematica/Install math.install </verb> It will ask you to enter your license number and the Wolfram supplied password. If you get them mixed up or for some reason the math.install fails, That's OK, because you can simply edit the file 'mathpass' in this same directory to correct the info manually. <p>After getting past the password, math.install will ask you if you accept their canned install defaults, or if you want to use your own. If you are like us and distrust all install programs, you probably want to specify the actual directories. Beware. Although the math.install program asks you to specify directories, it won't create them for you, so you should perhaps have a second window open with another shell so that you can create them before you give them to the install program. Or, if it fails, you can create the directories and then restart the math.install program. The directories we chose to create beforehand and specify to math.install were: <verb> /usr/local/Mathematica/bin for binaries /usr/local/Mathematica/man/man1 for man pages /usr/local/Mathematica/lib/X11 for the XKeysymb file </verb> You can also tell it to use /tmp/math.record for the system record file, where it puts logs of sessions. After this math.install will continue on to unpacking things and placing everything where it should go. <p>The Mathematica Notebook feature is included separately, as the X Front End, and you have to install it separately. To get the X Front End stuff correctly installed, cd into the /usr/local/Mathematica/FrontEnd directory and executed the ./xfe.install shell script. You'll have to tell it where to put things, but you don't have to create any directories because it uses all the same directories that had been created for math.install. When it finished, there should be a new shell script in /usr/local/Mathematica/bin called "mathematica". <p>Lastly, you need to modify each of the shell scripts that Mathematica has installed. At the beginning of every shell script in /usr/local/Mathematica/bin add the following line: <verb> XKEYSYMDB=/usr/local/Mathematica/lib/X11/XKeysymDB; export XKEYSYMDB </verb> This tells Mathematica were to find it's own version of the key mapping file XKeysymDB. Without this you will get pages of error messages about missing key mappings. On FreeBSD-stable you need to add the following as well: <verb> RESOLV_HOST_CONF=/compat/linux/etc/host.conf; export RESOLV_HOST_CONF </verb> This tells Mathematica to use the linux version of host.conf. This file has a different syntax from FreeBSD's host.conf, so you'll get an error message about /etc/host.conf if you leave this out. <p>You might want to also modify your /etc/manpath.config file to read the new man directory, and you may need to edit your .cshrc file to add <verb> /usr/local/Mathematica/bin </verb> to your path. <p>That's about all it takes, With this you should be able to type "mathematica" and get a really slick looking Mathematica Notebook screen up. Mathematica has included the Motif user interfaces, but it's compiled in statically, so you don't need the Motif libraries. Good luck doing this yourself! <sect1><heading>Bugs</heading> <p>The Notebook front end is known to hang sometimes when reading notebook files with an error messages similar to: <verb> File .../Untitled-1.mb appears to be broken for OMPR.257.0 </verb> We haven't found the cause for this, but it only affects the Notebook's X window front end, not the mathematica engine itself. So the command line interface invoked by 'math' is unaffected by this bug. <sect1><heading>Acknowledgments</heading> <p>A well-deserved thanks should go to &a.sos; and &a.peter; who made linux emulation what it is today, and Michael Smith who drove these two guys like dogs to get it to the point where it runs Linux binaries better than linux! :-) diff --git a/handbook/lists.sgml b/handbook/lists.sgml new file mode 100644 index 0000000000..a3703f9481 --- /dev/null +++ b/handbook/lists.sgml @@ -0,0 +1,57 @@ +<!-- $Id: lists.sgml,v 1.1 1996-05-16 23:18:06 mpp Exp $ --> +<!-- The FreeBSD Documentation Project --> + +<!-- +Names and email address of contributing authors and CVS committers +and some of the common FreeBSD mailing lists. Use these +entities when referencing people or mailing lists. Please +note the use of single +and double quotes. +--> + +<!ENTITY a.announce "FreeBSD announcments mailing list + <tt><htmlurl url='mailto:freebsd-announce@FreeBSD.ORG' + name='<freebsd-announce@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.doc "FreeBSD documentation project mailing list + <tt><htmlurl url='mailto:freebsd-doc@FreeBSD.ORG' + name='<freebsd-doc@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.bugs "FreeBSD problem reports mailing list + <tt><htmlurl url='mailto:freebsd-doc@FreeBSD.ORG' + name='<freebsd-doc@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.current "FreeBSD-current mailing list + <tt><htmlurl url='mailto:freebsd-current@FreeBSD.ORG' + name='<freebsd-current@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.emulation "FreeBSD-emulation mailing list + <tt><htmlurl url='mailto:freebsd-emulation@FreeBSD.ORG' + name='<freebsd-emulation@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.fs "FreeBSD filesystem project mailing list + <tt><htmlurl url='mailto:freebsd-fs@FreeBSD.ORG' + name='<freebsd-fs@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.hackers "FreeBSD technical discussions mailing list + <tt><htmlurl url='mailto:freebsd-hackers@FreeBSD.ORG' + name='<freebsd-hackers@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.ports "FreeBSD ports mailing list + <tt><htmlurl url='mailto:freebsd-ports@FreeBSD.ORG' + name='<freebsd-ports@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.questions "FreeBSD general questions mailing list + <tt><htmlurl url='mailto:freebsd-questions@FreeBSD.ORG' + name='<freebsd-questions@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.scsi "FreeBSD SCSI subsystem mailing list + <tt><htmlurl url='mailto:freebsd-questions@FreeBSD.ORG' + name='<freebsd-questions@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.stable "FreeBSD-stable mailing list + <tt><htmlurl url='mailto:freebsd-questions@FreeBSD.ORG' + name='<freebsd-questions@FreeBSD.ORG>'></tt>"> + +<!ENTITY a.majordomo "<tt><htmlurl url='mailto:majordomo@FreeBSD.ORG' + name='<majordomo@FreeBSD.ORG>'></tt>"> diff --git a/handbook/memoryuse.sgml b/handbook/memoryuse.sgml index a54eb68f6f..b1f43002a3 100644 --- a/handbook/memoryuse.sgml +++ b/handbook/memoryuse.sgml @@ -1,50 +1,50 @@ -<!-- $Id: memoryuse.sgml,v 1.6 1996-01-31 19:02:59 mpp Exp $ --> +<!-- $Id: memoryuse.sgml,v 1.7 1996-05-16 23:18:06 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>PC memory utilization<label id="memoryuse"></heading> <p><em>Contributed by &a.joerg;.<newline> 16 Apr 1995.</em> <em>A short description of how FreeBSD uses the memory on the i386 platform</em> The boot sector will be loaded at <tt>0:0x7c00</tt>, and relocates itself immediately to <tt>0x7c0:0</tt>. (This is nothing magic, just an adjustment for the <tt>%cs</tt> selector, done by an <tt>ljmp</tt>.) It then loads the first 15 sectors at <tt>0x10000</tt> (segment BOOTSEG in the biosboot Makefile), and sets up the stack to work below <tt>0x1fff0</tt>. After this, it jumps to the entry of boot2 within that code. I.e., it -jumps over itself and the (dummy) partition table, and it's going to +jumps over itself and the (dummy) partition table, and it is going to adjust the %cs selector---we are still in 16-bit mode there. boot2 asks for the boot file, and examines the <tt>a.out</tt> header. It masks the file entry point (usually <tt>0xf0100000</tt>) by <tt>0x00ffffff</tt>, and loads the file there. Hence the usual load point is 1 MB (<tt>0x00100000</tt>). During load, the boot code toggles back and forth between real and protected mode, to use the BIOS in real mode. The boot code itself uses segment selectors <tt>0x18</tt> and <tt>0x20</tt> for <tt>%cs</tt> and <tt>%ds/%es</tt> in protected mode, and <tt>0x28</tt> to jump back into real mode. The kernel is finally started with <tt>%cs</tt> <tt>0x08</tt> and <tt>%ds/%es/%ss</tt> <tt>0x10</tt>, which refer to dummy descriptors covering the entire address space. The kernel will be started at its load point. Since it has been linked for another (high) address, it will have to execute PIC until the page table and page directory stuff is setup properly, at which point paging will be enabled and the kernel will finally run at the address for which it was linked. <em>Contributed by &a.davidg;.<newline> 16 Apr 1995.</em> The physical pages immediately following the kernel BSS contain proc0's page directory, page tables, and upages. Some time later when the VM system is initialized, the physical memory between <tt>0x1000-0x9ffff</tt> and the physical memory after the kernel (text+data+bss+proc0 stuff+other misc) is made available in the form of general VM pages and added to the global free page list. diff --git a/handbook/nfs.sgml b/handbook/nfs.sgml index 1aa3c1b1d4..c203eb2d38 100644 --- a/handbook/nfs.sgml +++ b/handbook/nfs.sgml @@ -1,86 +1,86 @@ -<!-- $Id: nfs.sgml,v 1.5 1996-01-22 17:44:30 roberto Exp $ --> +<!-- $Id: nfs.sgml,v 1.6 1996-05-16 23:18:07 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>NFS<label id="nfs"></heading> <p><em>Contributed by &a.john;.</em> Certain Ethernet adapters for ISA PC systems have limitations which can lead to serious network problems, particularly with NFS. This difficulty is not specific to FreeBSD, but FreeBSD systems are affected by it. The problem nearly always occurs when (FreeBSD) PC systems are networked with high-performance workstations, such as those made by Silicon Graphics, Inc., and Sun Microsystems, Inc. The NFS mount will work fine, and some operations may succeed, but suddenly the server will seem to become unresponsive to the client, even though requests to and from other systems continue to be processed. This happens to the client system, whether the client is the FreeBSD system or the workstation. On many systems, there is no way to shut down the client gracefully once this problem has manifested itself. The only solution is often to reset the client, because the NFS situation cannot be resolved. Though the "correct" solution is to get a higher performance and capacity Ethernet adapter for the FreeBSD system, there is a simple workaround that will allow satisfactory operation. If the FreeBSD system is the SERVER, include the option "-w=1024" on the mount from the client. If the FreeBSD system is the CLIENT, then mount the NFS file system with the option "-r=1024". These options may be specified using the fourth field of the fstab entry on the client for automatic mounts, or by using the "-o" parameter of the mount command for manual mounts. It should be noted that there is a different problem, sometimes mistaken for this one, when the NFS servers and clients are on different networks. If that is the case, make CERTAIN that your routers are routing the -necessary UDP information, or you won't get anywhere, no matter +necessary UDP information, or you will not get anywhere, no matter what else you are doing. In the following examples, "fastws" is the host (interface) name of a high-performance workstation, and "freebox" is the host (interface) name of a FreeBSD system with a lower-performance Ethernet adapter. Also, "/sharedfs" will be the exported NFS filesystem (see "man exports"), and "/project" will be the mount point on the client for the exported file system. In all cases, note that additional options, such as "hard" or "soft" and "bg" may be desirable in your application. Examples for the FreeBSD system ("freebox") as the client: in <tt>/etc/fstab</tt> on freebox: fastws:/sharedfs /project nfs rw,-r=1024 0 0 as a manual mount command on freebox: mount -t nfs -o -r=1024 fastws:/sharedfs /project Examples for the FreeBSD system as the server: in <tt>/etc/fstab</tt> on fastws: freebox:/sharedfs /project nfs rw,-w=1024 0 0 as a manual mount command on fastws: mount -t nfs -o -w=1024 freebox:/sharedfs /project Nearly any 16-bit Ethernet adapter will allow operation without the above restrictions on the read or write size. For anyone who cares, here is what happens when the failure occurs, which also explains why it is unrecoverable. NFS typically works with a "block" size of 8k (though it may do fragments of smaller sizes). Since the maximum Ethernet packet is around 1500 bytes, the NFS "block" gets split into multiple Ethernet packets, even though it is still a single unit to the upper-level code, and must be received, assembled, and ACKNOWLEDGED as a unit. The high-performance workstations can pump out the packets which comprise the NFS unit one right after the other, just as close together as the standard allows. On the smaller, lower capacity cards, the later packets overrun the earlier packets of the same unit before they can be transferred to the host and the unit as a whole cannot be reconstructed or acknowledged. As a result, the workstation will time out and try again, but it will try again with the entire 8K unit, and the process will be repeated, ad infinitum. By keeping the unit size below the Ethernet packet size limitation, we ensure that any complete Ethernet packet received can be acknowledged individually, avoiding the deadlock situation. Overruns may still occur when a high-performance workstations is slamming data out to a PC system, but with the better cards, such overruns are not guaranteed on NFS "units". When an overrun occurs, the units affected will be retransmitted, and there will be a fair chance that they will be received, assembled, and acknowledged. diff --git a/handbook/nutshell.sgml b/handbook/nutshell.sgml index f80d31774d..6f0b063db7 100644 --- a/handbook/nutshell.sgml +++ b/handbook/nutshell.sgml @@ -1,151 +1,151 @@ -<!-- $Id: nutshell.sgml,v 1.8 1996-01-31 14:26:12 mpp Exp $ --> +<!-- $Id: nutshell.sgml,v 1.9 1996-05-16 23:18:07 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 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 + be done with a commercial UNIX product then it is 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 4d2f8453b0..41be861cb5 100644 --- a/handbook/porting.sgml +++ b/handbook/porting.sgml @@ -1,1105 +1,1105 @@ -<!-- $Id: porting.sgml,v 1.19 1996-05-09 23:04:48 mpp Exp $ --> +<!-- $Id: porting.sgml,v 1.20 1996-05-16 23:18:08 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 +of FreeBSD's growth and of great usefulness to those who would not 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 +of what is 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-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 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 + conditional compilation based upon what version of UNIX it is 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>. + <tt>2</tt>. In earlier versions, it is <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 + shared library options when using `<tt>ld</tt>') then it is OK to use <tt>__FreeBSD__</tt> and `<tt>#if __FreeBSD__ > 1</tt>' to detect a FreeBSD 2.x system. 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 + screwed up and used it in the wrong place does not 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. + cases, it is not enough, but we will 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 + change something, you will 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.19 1996-05-09 23:04:48 mpp Exp $ + # $Id: porting.sgml,v 1.20 1996-05-16 23:18:08 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 + <p>See if you can figure it out. Do not 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 + file here, unless, of course, it is 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 + <p>Now that you are 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 the &a.ports;. 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 + <p>Ok, so it was not that simple, and the port required some + modifications to get it to work. In this section, we will 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 + <p>But do not worry if you do not 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 + default target, and you cannot 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 + `<tt>make</tt>', let us 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 + <p>If you cannot 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 the &a.ports 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 + <tt>${DISTDIR}</tt>. Do not 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 + make as it does not 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>${DISTNAME}${EXTRACT_SUFX}</tt> - by default which, if it's a normal tarball, is going to be + by default which, if it is 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</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. <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>)! + location. Do not 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. + if they cannot 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 + <p>Do not 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, + it is 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. + your ports tree to build and install it if it is 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, + case it is 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. + ports tree to build and install it if it is 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. + your ports tree to build and install it if it is 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. + your ports tree to build and install it if it is 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 + <p>If there is a dependency that does not 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 + <p>If the port uses imake but does not 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 + project will not be held accountable of violating them by redistributing the source or compiled binaries either via ftp or CD-ROM. If in doubt, please contact the &a.ports;. <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 + at least be able to make a port, so do not 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. + and 2, should not 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 + <p>Here is 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 + <p>Do not 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 + that are not 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: + compression. Here is 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. + does not say `not stripped', it is stripped. <sect3> <heading>Install additional documentation</heading> <p>If your software has some documentation other than the standard man and info pages that you think is useful for the user, install it under <tt>${PREFIX}/share/doc</tt>. This can be done, like the previous item, in the <tt>post-install</tt> target. <p>Create a new directory for your port. The directory name should reflect what the port is. This usually means <tt>${PKGNAME}</tt> minus the version part. However, if you think the user might want different versions of the port to be installed at the same time (e.g., tcl/tk), you can use the whole <tt>${PKGNAME}</tt>. <p>Make the installation dependent to the variable <tt>NOPORTDOCS</tt> so that users can disable it in <tt>/etc/make.conf</tt>, like this: <tscreen><verb> post-install: .if !defined(NOPORTDOCS) mkdir -p ${PREFIX}/share/doc/xv cp ${WRKSRC}/docs/xvdocs.ps ${PREFIX}/share/doc/xv .endif </verb></tscreen> - <p>Don't forget to add them to <tt>pkg/PLIST</tt> too! (Don't + <p>Do not forget to add them to <tt>pkg/PLIST</tt> too! (Do not worry about <tt>NOPORTDOCS</tt> here; there is currently no way for the packages to read variables from <tt>/etc/make.conf</tt>.) <sect3> <heading>DIST_SUBDIR</heading> - <p>Don't let your port clutter <tt>/usr/ports/distfiles</tt>. If + <p>Do not let your port clutter <tt>/usr/ports/distfiles</tt>. If your port requires a lot of files (including patchfiles) to be fetched, or contains a file that has a name that might conflict with other ports (e.g., `Makefile'), set <tt>${DIST_SUBDIR}</tt> to the name of the port (<tt>${PKGNAME}</tt> without the version part should work fine). This will change <tt>${DISTDIR}</tt> from the default <tt>/usr/ports/distfiles</tt> to <tt>/usr/ports/distfiles/${DIST_SUBDIR}</tt>, and in effect puts everything that is required for your port into that subdirectory. <p>It will also look at the subdirectory with the same name on the backup master site at <tt>ftp.freebsd.org</tt>. (Setting <tt>${DISTDIR}</tt> explicitly in your Makefile will not accomplish this, so please use <tt>${DIST_SUBDIR}</tt>.) <p>Note this does not affect the <tt>${MASTER_SITES}</tt> you define in your Makefile. <sect3> <heading>Custom utilities</heading> - <p>Don't rely on custom utilities in your local configure + <p>Do not 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. + least you will have given the user some idea of what is 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 + <p>Do not 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>. (The value of this variable will be set to <tt>${LOCALBASE}</tt> (default <tt>/usr/local</tt>), unless <tt>${USE_IMAKE}</tt> or <tt>${USE_X11}</tt> is set, in which case it will be <tt>${X11BASE}</tt> (default <tt>/usr/X11R6</tt>).) <p>Not hard-coding `<tt>/usr/local</tt>' or `<tt>/usr/X11R6</tt>' anywhere in the source will make the port much more flexible and able to cater to the needs of other sites. For X ports that use imake, this is automatic; otherwise, this can often be done by simply replacing the occurrences of `<tt>/usr/local</tt>' (or - `<tt>/usr/X11R6</tt>' for X ports that don't use imake) in the + `<tt>/usr/X11R6</tt>' for X ports that do not use imake) in the various scripts/Makefiles in the port to read `<tt>${PREFIX}</tt>', as this variable is automatically passed down to every stage of the build and install processes. <p>The variable <tt>${PREFIX}</tt> can be reassigned in your Makefile or in the user's environment. However, it is strongly discouraged for individual ports to set this variable explicitly - in the Makefiles. (If your port is an X port but doesn't use + in the Makefiles. (If your port is an X port but does not use imake, set <tt>USE_X11=yes</tt>; this is quite different from setting <tt>PREFIX=/usr/X11R6</tt>.) <p>Also, refer to programs/files from other ports with the variables mentioned above, not explicit pathnames. For instance, if your port requires a macro <tt>PAGER</tt> to be the full pathname of <tt>less</tt>, use the compiler flag: `<tt>-DPAGER=\"${PREFIX}/bin/less\"</tt>' (or `<tt>-DPAGER=\"${LOCALBASE}/bin/less\"</tt>' if this is an X port), instead of `<tt>-DPAGER=\"/usr/local/bin/less\"</tt>'. This way it will have a better chance of working if the system administrator has moved the whole `/usr/local' tree somewhere else. <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 + 2.1.0-950726-SNAP, so do not be alarmed if it does not 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 + screw up the user's machine ("Help, xinit does not 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 + <p>Do ask us questions if you have any trouble! Do not 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.19 1996-05-09 23:04:48 mpp Exp $ - [ ^^^^ don't worry about this...it will be automatically filled in by CVS when - it is committed to our repository] + # $Id: porting.sgml,v 1.20 1996-05-16 23:18:08 mpp Exp $ + [ ^^^^ do not 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, and then MASTER_SITES, and optionally EXTRACT_SUFX or DISTFILES] DISTNAME= xdvi PKGNAME= xdvi-pl18 CATEGORIES+= printing - [don't forget the trailing slash ("/")!] + [do not 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 + original porter reasonably promptly. If you really do not 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] + [this section is for other standard bsd.port.mk variables that do not 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> + <heading>That is 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 + <p>Well, now that you know how to do a port, let us 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/ports.sgml b/handbook/ports.sgml index 2a6aa9fe2e..239275077e 100644 --- a/handbook/ports.sgml +++ b/handbook/ports.sgml @@ -1,237 +1,237 @@ -<!-- $Id: ports.sgml,v 1.9 1996-05-09 23:04:49 mpp Exp $ --> +<!-- $Id: ports.sgml,v 1.10 1996-05-16 23:18:10 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>The Ports collection<label id="ports"></heading> <p><em>Contributed by &a.gpalmer; and &a.jkh;.</em> Unfortunately, there are more variations of UN*X than most people know of, and hence not all software for UN*X available on the Internet will work on all versions of UN*X (in fact, I can guarantee it!). Hence, some software needs modifications to work under some UN*Xs. The process of making those modifications is known as ``porting'' and the result known as a ``port'' (not to be confused with the sockets on the back of your computer!). <sect1><heading>What is the FreeBSD Ports Collection?</heading> <p> When 2.0 was released, the FreeBSD Project decided to attempt to automate the process of ``porting'' such software to FreeBSD, and the result is the Ports Collection. The general idea was that a combination of various programming tools already available in the base FreeBSD installation would allow you to simply type `make' for a given port and have the underlying ports mechanism automatically fetch the port from a FreeBSD mirror site, apply any special configuration knowledge to it and then build it to result in a fully working version of the program. The ports collection itself normally doesn't have any of the original source code necessary for the compilation in the tree, just those shell scripts, Makefiles and source code ``diffs'' that are necessary to configure and compile the program under FreeBSD. This keeps the entire system down to a manageable size, with the current system having over 300 ports in the master source tree and yet taking up less than twenty megabytes. <sect1><heading>How does the system compile with no source code?</heading> <p> The Makefile for a port automatically looks in a central location on your system (usually /usr/ports/distfiles, though this value can be customized) for the associated set of original distribution files that have been ``ported''. Those not found locally are searched for -wherever they're generally provided on the Internet. If you have a -CDROM distribution of FreeBSD then you've already got them available +wherever they are generally provided on the Internet. If you have a +CDROM distribution of FreeBSD then you already have them available on your CD for ease of use. See <ref id="ports:cd" name="Compiling ports from CD"> if you have such a CDROM distribution, otherwise skip to <ref id="ports:inet" name="Compiling ports using an Internet connection">. <sect1><heading>Compiling ports from CDROM<label id="ports:cd"></heading> <p>The ports collection is easy to use from CDROM, and all you need to do is to create a "link tree" to it using the <tt>lndir(1)</tt> command that comes with the <em>XFree86</em> distribution. Find a location with some free space and create a directory there, and make a symbolic link from <tt>/usr/ports</tt> to that directory. Then invoke the <tt>lndir(1)</tt> command with the full pathname of the ``ports'' directory on the CDROM as an argument (this might be, for example, something like: <tt>lndir /cdrom/ports</tt>). Then you can build ports directly off the CDROM by -building them in the link tree you've created. +building them in the link tree you have created. -Note that there are some ports for which we can't provide the original +Note that there are some ports for which we cannot provide the original source in the CDROM due to licensing limitations. In that case, -you'll need to look at the next section (<ref id="ports:inet" +you will need to look at the next section (<ref id="ports:inet" name="Compiling ports using an Internet connection">). <sect1><heading>Compiling ports using an Internet connection<label id="ports:inet"></heading> <p> The ports collection can also use an auto-fetch system to keep your ports collection source tree up to date, updating the central ``distfiles'' version for you the next time you compile the port. - Of course, this assumes you have a permanent network link or don't -mind heavy usage of your telephone. If you don't want heavy network + Of course, this assumes you have a permanent network link or do not +mind heavy usage of your telephone. If you do not want heavy network usage when you compile your ports tree, you can pre-fetch the necessary tarballs beforehand and put them into /usr/ports/distfiles by hand. A good way to see what files a port is going to need is to cd to that ports' directory and do a <tt>make fetch-list</tt> to see what it does. The output of <tt>make fetch-list</tt> can also be used as a shell script to fetch the ports' tarballs at a well-connected machine. You can also chose to get the source files either from the master FTP site as defined in the relevant Makefile (in the MASTER_SITES line), or some FreeBSD mirror site also carrying a set of distfiles, as does the master FTP site on ftp.FreeBSD.org (aka ftp.cdrom.com) in the directory <tt>/pub/FreeBSD/distfiles</tt>. Note that the files in that directory are not guaranteed to be kept up to date - this is a -volunteer project! We can't make any guarantees about the mirror -sites either - they are obviously under independent control and don't +volunteer project! We canno make any guarantees about the mirror +sites either - they are obviously under independent control and do not even have to mirror the distfiles directory. If you have a non-permanent link, you can fetch all the distfiles by going to the top of the tree and typing ``make fetch''. -<sect1><heading>It doesn't work?!</heading> +<sect1><heading>It does not work?!</heading> <p>Oh. You can do one of four (4) things : <enum> <item> Fix it yourself. Technical details can be found in <ref id="porting" name="Porting applications">. <item> Gripe. This is done by e-mail *ONLY*! The people at Walnut Creek are in no way responsible for the functionality (or lack thereof) of the FreeBSD system as a whole, and especially the ports system, which - is mainly contributed by 3rd parties. (If you don't believe me, check + is mainly contributed by 3rd parties. (If you do not believe me, check the catalogue, especially the line saying "We cannot offer tech-support on this product") - The e-mail address is Ports@FreeBSD.org. Please include details of + The e-mail address is the &a.ports;. Please include details of the port, where you got both the port source & distfile(s) from, and what the error was. - Note: At time of writing, lang/Sather doesn't seem to work on Pentium + Note: At time of writing, lang/Sather does not seem to work on Pentium machines due to the Intel Curse (aka the Floating Point Division Bug). - Please don't tell us about this - gripe to Intel instead - it's their + Please do not tell us about this - gripe to Intel instead - it is their bug! <item> Forget it. This is the easiest for most - very few of the programs in ports can be classified as `essential'! <item> Grab the pre-compiled package from a ftp server. The ``master'' package collection is in: ftp://ftp.FreeBSD.org/pub/FreeBSD/packages/ though check your local mirror first, please! These are more likely to work (on the whole) than trying to compile from source, and a lot faster! Use the <tt>pkg_add(1)</tt> or <tt>pkg_manage(1)</tt> program to install them to your system. </enum> -<sect1><heading>I've ported a program and I want to make a port out of it. What now?</heading> +<sect1><heading>I have ported a program and I want to make a port out of it. What now?</heading> <p> See the <ref id="porting:starting" name="guidelines"> that contain details of the procedure and structure involved. -<sect1><heading>I've got a good port, what now?</heading> +<sect1><heading>I have got a good port, what now?</heading> <p>Upload the fixed version to <tt>ftp://freefall.cdrom.com/pub/incoming</tt> or <tt>ftp://ftp.FreeBSD.org/pub/FreeBSD/incoming</tt> and send e-mail to the &a.ports with the filename and details. Someone on the all-volunteer `ports committee' will (hopefully) look it over and commit it to the ports collection if they like the looks of it. -<sect1><heading>I want to leave the compile going overnight, but some ports don't like this.</heading> +<sect1><heading>I want to leave the compile going overnight, but some ports do not like this.</heading> <p> There is a way around this. Before starting the compilation, type: <verb> setenv BATCH yes # (if you use csh/tcsh) or BATCH=yes; export BATCH # (for sh/bash) </verb> This should skip ports which need user interaction to build. To compile those ports left out by doing the above, using a different login shell (or unsetting the above BATCH variable), set the INTERACTIVE variable instead (you can use the same statements as above except replace ``BATCH'' with ``INTERACTIVE'') and re-run make. This should now compile only those ports which will definitely ask for user interaction. <sect1><heading>The ports collection is weak. What can I do to help?</heading> <p> First read the bsd.port.mk file (which may be found in /usr/share/mk/) and the associated bsd.port.subdir.mk file. A lot of the weirdness can be explained properly in there (most of the current weirdness is due to the lack of assumptions about anything, which is necessary due to the generic nature of these files). Also check that you have an up-to-date copy, as the file can change from minute to minute. The most up-to-date copy can be found in: <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src/share/mk"> If you find that you still need to go in there and alter things, -by all means do so, and then send the diffs to ports@FreeBSD.org if -you'd like them to be a part of the default distribution. Please also +by all means do so, and then send the diffs to the &a.ports if +you would like them to be a part of the default distribution. Please also remember that any changes must respect backwards-compatibility with any and all older Makefiles, unless you want a real nightmare of /usr/ports munging ahead of you! Large scale changes will generally not be warmly welcomed unless all the existing makefiles work without alteration. Sorry! <sect1><heading>This FAQ is weak. What can I do?</heading> -<p> Send changes to ports@FreeBSD.org. Changes are most welcome! +<p> Send changes to the &a.ports;. Changes are most welcome! This FAQ is also very green and should be considered no more than a `good start' for now. Authors? You can come out of hiding any time now! :-) <sect1><heading>How do I get more information on all the ports?</heading> <p> One good method is to cd to the top of the ports tree (say /usr/ports) and type: <verb> make print-index </verb> This will print a summary of all ports in the tree. -<sect1><heading>I've heard of a new checksum system. What is this for?</heading> +<sect1><heading>I have heard of a new checksum system. What is this for?</heading> <p> For various reasons, when using FTP over the Internet to obtain the source code, you may not always end up with the same copy of the code that the original porter worked from, and this can lead to problems. So a simple checksumming system has been employed to try and highlight problems in this area. To check the entire system, go to the top of the ports tree (defaults to /usr/ports) and type <verb> make checksum </verb> This will give a report on the validity of the files you have FTP'd. If some are missing, the system will attempt to retrieve them before running the checksum routine. The same technique can be applied to a single port. The system will complain if there is no pre-computed checksum available for that port. Not all ports currently have checksums, but this should be cured soon. - Some older versions of the system don't recognize the ``checksum'' + Some older versions of the system do not recognize the ``checksum'' target. In that case, try the command <verb> make check-md5 </verb> (``check-md5'' was the pre-cursor to the ``checksum'' target). If neither work, get the latest copies of bsd.port.mk and bsd.port.subdir.mk from <url url="ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src/share/mk"> and install them in /usr/share/mk. This will get you the latest version of the ports system. diff --git a/handbook/ppp.sgml b/handbook/ppp.sgml index 7129475533..faa1016578 100644 --- a/handbook/ppp.sgml +++ b/handbook/ppp.sgml @@ -1,373 +1,373 @@ -<!-- $Id: ppp.sgml,v 1.6 1995-12-04 17:58:46 jfieber Exp $ --> +<!-- $Id: ppp.sgml,v 1.7 1996-05-16 23:18:11 mpp Exp $ --> <!-- The FreeBSD Documentation Project --> <sect><heading>Setting up kernel PPP<label id="ppp"></heading> <p><em>Contributed by &a.gena;.</em> Before you start setting up PPP on your machine make sure that pppd is located in /usr/sbin and directory /etc/ppp exists. pppd can work in two modes: <enum> <item> as a "client" , i.e. you want to connect your machine to outside world via PPP serial connection or modem line. <item> as a "server" , i.e. your machine is located on the network and used to connect other computers using PPP. </enum> In both cases you will need to set up an options file (<tt>/etc/ppp/options</tt> or <tt>~/.ppprc</tt> if you have more then one user on your machine that uses PPP). You also will need some modem/serial software ( preferably kermit ) so you can dial and establish connection with remote host. <sect1><heading>Working as a PPP client</heading> <p>I used the following <tt>/etc/ppp/options</tt> to connect to CISCO terminal server PPP line. <verb> crtscts # enable hardware flow control modem # modem control line noipdefault # remote PPP server must supply your IP address. # if the remote host doesn't send your IP during IPCP # negotiation , remove this option passive # wait for LCP packets domain ppp.foo.com # put your domain name here :<remote_ip> # put the IP of remote PPP host here # it will be used to route packets via PPP link # if you didn't specified the noipdefault option # change this line to <local_ip>:<remote_ip> defaultroute # put this if you want that PPP server will be your # default router </verb> To connect: <enum> <item> Dial to the remote host using kermit ( or other modem program ) enter your user name and password ( or whatever is needed to enable PPP on the remote host ) <item> Exit kermit. ( without hanging up the line ) <item> enter: <verb> /usr/src/usr.sbin/pppd.new/pppd /dev/tty01 19200 </verb> ( put the appropriate speed and device name ) </enum> Now your computer is connected with PPP. If the connection fails for some reasons you can add the "debug" option to the <tt>/etc/ppp/options</tt> file and check messages on the console to track the problem Following <tt>/etc/ppp/pppup</tt> script will make all 3 stages automatically: <verb> #!/bin/sh ps ax |grep pppd |grep -v grep pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing pppd, PID=' ${pid} kill ${pid} fi ps ax |grep kermit |grep -v grep pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing kermit, PID=' ${pid} kill -9 ${pid} fi ifconfig ppp0 down ifconfig ppp0 delete kermit -y /etc/ppp/kermit.dial pppd /dev/tty01 19200 </verb> <tt>/etc/ppp/kermit.dial</tt> is kermit script that dials and makes all necessary authorization on the remote host. ( Example of such script is attached to the end of this document ) Use the following <tt>/etc/ppp/pppdown</tt> script to disconnect the PPP line: <verb> #!/bin/sh pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'` if [ X${pid} != "X" ] ; then echo 'killing pppd, PID=' ${pid} kill -TERM ${pid} fi ps ax |grep kermit |grep -v grep pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing kermit, PID=' ${pid} kill -9 ${pid} fi /sbin/ifconfig ppp0 down /sbin/ifconfig ppp0 delete kermit -y /etc/ppp/kermit.hup /etc/ppp/ppptest </verb> Check if PPP is still running (<tt>/usr/etc/ppp/ppptest</tt>): <verb> #!/bin/sh pid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'` if [ X${pid} != "X" ] ; then echo 'pppd running: PID=' ${pid-NONE} else echo 'No pppd running.' fi set -x netstat -n -I ppp0 ifconfig ppp0 </verb> Hangs up modem line (<tt>/etc/ppp/kermit.hup</tt>): <verb> set line /dev/tty01 ; put your modem device here set speed 19200 set file type binary set file names literal set win 8 set rec pack 1024 set send pack 1024 set block 3 set term bytesize 8 set command bytesize 8 set flow none pau 1 out +++ inp 5 OK out ATH0\13 echo \13 exit </verb> <sect1><heading>Working as a PPP server</heading> <p><tt>/etc/ppp/options</tt>: <verb> crtscts # Hardware flow control netmask 255.255.255.0 # netmask ( not required ) 192.114.208.20:192.114.208.165 # ip's of local and remote hosts # local ip must be different from one # you assigned to the ethernet ( or other ) # interface on your machine. # remote IP is ip address that will be # assigned to the remote machine domain ppp.foo.com # your domain passive # wait for LCP modem # modem line </verb> Following <tt>/etc/ppp/pppserv</tt> script will enable ppp server on your machine <verb> #!/bin/sh ps ax |grep pppd |grep -v grep pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing pppd, PID=' ${pid} kill ${pid} fi ps ax |grep kermit |grep -v grep pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing kermit, PID=' ${pid} kill -9 ${pid} fi # reset ppp interface ifconfig ppp0 down ifconfig ppp0 delete # enable autoanswer mode kermit -y /etc/ppp/kermit.ans # run ppp pppd /dev/tty01 19200 </verb> Use this <tt>/etc/ppp/pppservdown</tt> script to stop ppp server: <verb> #!/bin/sh ps ax |grep pppd |grep -v grep pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing pppd, PID=' ${pid} kill ${pid} fi ps ax |grep kermit |grep -v grep pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing kermit, PID=' ${pid} kill -9 ${pid} fi ifconfig ppp0 down ifconfig ppp0 delete kermit -y /etc/ppp/kermit.noans </verb> Following kermit script will enable/disable autoanswer mode on your modem (<tt>/etc/ppp/kermit.ans</tt>): <verb> set line /dev/tty01 set speed 19200 set file type binary set file names literal set win 8 set rec pack 1024 set send pack 1024 set block 3 set term bytesize 8 set command bytesize 8 set flow none pau 1 out +++ inp 5 OK out ATH0\13 inp 5 OK echo \13 out ATS0=1\13 ; change this to out ATS0=0\13 if you want to disable ; autoanswer mod inp 5 OK echo \13 exit </verb> This <tt>/etc/ppp/kermit.dial</tt> script is used for dialing and authorizing on remote host. You will need to customize it for your needs. -Put your login and password in this script , also you'll need +Put your login and password in this script , also you will need to change input statement depending on responses from your modem and remote host. <verb> ; ; put the com line attached to the modem here: ; set line /dev/tty01 ; ; put the modem speed here: ; set speed 19200 set file type binary ; full 8 bit file xfer set file names literal set win 8 set rec pack 1024 set send pack 1024 set block 3 set term bytesize 8 set command bytesize 8 set flow none set modem hayes set dial hangup off set carrier auto ; Then SET CARRIER if necessary, set dial display on ; Then SET DIAL if necessary, set input echo on set input timeout proceed set input case ignore def \%x 0 ; login prompt counter goto slhup :slcmd ; put the modem in command mode echo Put the modem in command mode. clear ; Clear unread characters from input buffer pause 1 output +++ ; hayes escape sequence input 1 OK\13\10 ; wait for OK if success goto slhup output \13 pause 1 output at\13 input 1 OK\13\10 if fail goto slcmd ; if modem doesn't answer OK, try again :slhup ; hang up the phone clear ; Clear unread characters from input buffer pause 1 echo Hanging up the phone. output ath0\13 ; hayes command for on hook input 2 OK\13\10 if fail goto slcmd ; if no OK answer, put modem in command mode :sldial ; dial the number pause 1 echo Dialing. output atdt9,550311\13\10 ; put phone number here assign \%x 0 ; zero the time counter :look clear ; Clear unread characters from input buffer increment \%x ; Count the seconds input 1 {CONNECT } if success goto sllogin reinput 1 {NO CARRIER\13\10} if success goto sldial reinput 1 {NO DIALTONE\13\10} if success goto slnodial reinput 1 {\255} if success goto slhup reinput 1 {\127} if success goto slhup if < \%x 60 goto look else goto slhup :sllogin ; login assign \%x 0 ; zero the time counter pause 1 echo Looking for login prompt. :slloop increment \%x ; Count the seconds clear ; Clear unread characters from input buffer output \13 ; ; put your expected login prompt here: ; input 1 {Username: } if success goto sluid reinput 1 {\255} if success goto slhup reinput 1 {\127} if success goto slhup if < \%x 10 goto slloop ; try 10 times to get a login prompt else goto slhup ; hang up and start again if 10 failures :sluid ; ; put your userid here: ; output ppp-login\13 input 1 {Password: } ; ; put your password here: ; output ppp-password\13 input 1 {Entering SLIP mode.} echo quit :slnodial echo \7No dialtone. Check the telephone line!\7 exit 1 ; local variables: ; mode: csh ; comment-start: "; " ; comment-start-skip: "; " ; end: </verb> <!-- ################################################################### Gennady B. Sorokopud ( gena@NetVision.net.il ) 24/10/94 12:00 --> diff --git a/handbook/printing.sgml b/handbook/printing.sgml index ac5cbd8394..215693b7d3 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.5 1996-01-31 19:03:00 mpp Exp $ + $Id: printing.sgml,v 1.6 1996-05-16 23:18:12 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 + In order to use printers with FreeBSD, you will need to set them up to work with the Berkeley line printer spooling - system, also known as the LPD spooling system. It's the + system, also known as the LPD spooling system. It iss 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 + If you are 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 + <p> LPD controls everything about a host's printers. It is 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. + find jobs they have 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 + <p> If you are 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 + format the printer will understand. You will not 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 + your system. By setting up the spooling system, you will 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 + <p> To use printers with the LPD spooling system, you will 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 + If you are 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 + Although this section is called ``Simple Printer Setup,'' it is 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 + If you have 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 + to send data back to the computer. And FreeBSD does not 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 + they need not 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 has 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 + <item>If you do not 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 + faster most of the time. It is 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 + If you are 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: + Here is an outline of the steps involved: <enum> <item>Configure your kernel, if necessary, for the port - you're using for the printer; section <ref + you are 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 + if you are 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 + or parallel port if your kernel is not already configured for one. - To find out if the kernel you're currently using supports a serial + To find out if the kernel you are 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. + serial port you are 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 + a serial or parallel port, you will still need a software interface through which programs running on the system - can send and receive data. That's what entries in the + can send and receive data. That is 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 + <p> When you are 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 is ready for data. <item>The <em/polled/ method directs the operating - system to repeatedly ask the printer if it's ready + system to repeatedly ask the printer if it is 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 + or add an <tt/lpt0/ entry. If you are 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/ 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 + <item>If you want polled mode, do not 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 + successfully send data to your printer. It is a lot easier to debug printer communication and the spooling system separately. - To test the printer, we'll send some text to it. For + To test the printer, we will 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 + we will 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 + language, I am 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 + plain text, and that is the kind of printer language for 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 + <em/carefully/ as you cannot edit a line once + you have pressed RETURN or ENTER. When you have 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 + You should see something print. Do not 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 + Here is 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 + If this step does not 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. + You should see something print. Do not worry if the + text does not look right; we will 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 + and you have been able to send some simple data to the + printer. Now, we are 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 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 + printers, cannot 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. + sections assumes that if you are installing such a printer + you will 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 + same assumption. If you are 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 + <em/and/ print plain text jobs, you are 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="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 + printer. It really does not 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 + do not 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 + Also, it is 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 + Once you have 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 + <tt/lp/, it is 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 + way of debugging the simple printer setup, so we will 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>. Here is 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 + reside until they are 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 + it is customary to put these directories under + <tt>/var/spool</tt>. It is 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 + It is also customary to make the directory with a name + that is 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 + LPD. We will 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 + <em/Note:/ If you are concerned about the privacy of jobs that users print, you might want to protect the spooling - directory so it's not publicly accessible. Spooling + directory so it is 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: + one else. We will 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/, + If you do not 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 + In our running example, let us 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 + If you do not 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. + currently does not exist in FreeBSD. - If the printer you're installing is connected to a + If the printer you are 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 + <tt>/etc/printcap</tt> file; you do not 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 + Let us add to our example printer on the sixth serial + port. We will set the bps rate to 38400. For the flag + bits, we will set the TANDEM, ANYP, LITOUT, FLUSHO, and + PASS8 flags. For the local mode bits, we will 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 + <p> We are 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, 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 + First, let uss 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 + <tt/if/ capability in <tt>/etc/printcap</tt>. We will 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. + <p> You have 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 + order, since we still have 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 + argument. Again, if you are 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 + of the program. If you are 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 + If the printer did not 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 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./ + <tag/It worked, after awhile; or, it did not eject a full sheet./ The printer printed the above, but it sat for awhile 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 + internal buffer. It is 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 + does not 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 + You have 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 + page for the next character to print. That is 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: + Here is 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 + <p> Here is 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 + Here is 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 + Packard LaserJet 3Si named <tt/teak/. It is 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 + While printing, the printer did nott print a few 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 problem is that the printer cannot keep up with the speed at which the computer sends data over a - serial line. (This problem shouldn't occur with + serial line. (This problem should not 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 + <item>If the printer does not 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 + you are debugging in the <tt>/etc/printcap</tt> file. + For example, here is 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 + If you do not 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 + <p> This section tells you how to use printers you have 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 + There is 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 + remove, and check on jobs for various printers. If you do not 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 + you do not 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 + printer named <tt/lp/ when there is 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 + shows the queue for the printer named <tt/bamboo/. Here is 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 + you will 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 + job. It is 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 + <tt/lpr/ command. The third job came from user mary; it is 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 + generate a detailed long listing. Here is 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, + <em/Note:/ If you are 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 + files in the job. Use these options if the job does not 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 + These options apply to every file in the job, so you cannot 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 + <em/Note:/ Do not 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 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 + Here is 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, + <tag/-s/ Do not 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 + If you are 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 + It saves time as well since LPD will not 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 + the original files directly, you cannot modify or remove them until they have been printed. - <em/Note:/ If you're printing to a remote printer, LPD + <em/Note:/ If you are 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. + remote. It is 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 + first file of the job, or ``stdin'' if you are 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 + <p> As an administrator for your printers, you have 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 + <em/stopped/, it will not 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 + disabled queue, in which case it will 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 + Occasionally, the files that make up a job are not 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 + activity. This command finds files that do not 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 + This command is useful while you are testing a new printer or filter installation: disable the queue and - submit jobs as root. Other users won't be able to + submit jobs as root. Other users will not be able to 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. + but the printer will not print anything until it is 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/ + cannot 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 + job and will not 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 + this command, you cannot 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 + you do not 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. + available; when they are not, they are 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 + accounting, but that is 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: + Here is what you will 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 + this section to get an understanding of what is 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 + (or other language-based printers) which cannot directly print plain text. Section <ref 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. + section if you do not 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 + LPD: output filters. Unless you are 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 + on what is 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 + plain text by default, and it is the text filter's job to make sure backspaces, tabs, or other special - characters don't confuse the printer. + characters do not confuse the printer. - If you're in an environment where you have to account + If you are 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 + For example, ditroff typesetting data cannot 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 + <item>The <em/output filter/ is used only if there is 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 + If the filter failed to print the file and does not 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 + If you are shopping for filters, see if they are 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 + <p> If you are 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 + text to your printer, then you do not 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 + text jobs to the printer, then you are 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 + those are not 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 + If you have 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 + specify the pathname to the <tt/psif/ program that is 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 parallel PostScript printer (and therefore - can't use two-way communication with the printer, which + cannot 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 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, + you would 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 + it is printing a PostScript file. If it is 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 + Here is 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 + # It is 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 + That is 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 + first thing you will 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 + from TeX, we cannot 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 + it for us. Now, each time we get a DVI file, we are 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 + conversion filter is in order. If you have 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 + suppose you would 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. + they they are specialized programs that only LPD will + run; regular users should not 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 + In our example, we will add the DVI conversion filter to + the entry for the printer named <tt/bamboo/. Here is 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: + <tt>/usr/local/libexec/psdf</tt>. Here is 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="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 + <p> Since there is 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 + Here is 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: + on a parallel port, we would 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 + That is it. Here is 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 + Here is an example that might make old hands at FORTRAN + blush. It is a FORTRAN-text filter for any printer that + can directly print plain text. We will 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> + And we will 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 + Here is one final, somewhat complex example. We will 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 + since <tt/dvilj2p/ cannot read from standard input. It + wants to work with a filename. What iss 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 + cannot 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 + but it will not 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 + filters to do their work, especially since there is (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 +# and exit 2. Exiting with 2 tells LPD to do not 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. +# Make sure we are 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 +# Convert and print. Return value from dvilj2p does not 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 + use. If your users are not particularly computer literate, having to specify a filter option will become - annoying. What's worse, though, is that an incorrectly + annoying. What is 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 + want to try having the text filter (since it is the default filter) detect the type of file it has been 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 + Of course, it will 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 + filter that we have 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 + you are 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 + <item>LPD does not 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 + <item>LPD does not pass the user's login or host to + the filter, so it is 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 + Do not be seduced by an output filter's simplicity. If + you would like each file in a job to start on a different page + an output filter <em/will not 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 + page. (But it is 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 + does not 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 + itself. When LPD's done running other filters, it will restart the output filter by sending SIGCONT to it. - If there's an output filter but <em/no/ text filter and + If there is 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/, 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 + quick-and-dirty output filter but do not 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 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 + sequences to a printer, it is 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 have <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 + identify to whom jobs belong after they are printed. They are 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 + drawback to a header page is that it is 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 have a PostScript printer, you'll need an + text. If you have a PostScript printer, you will 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 + You are 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 + Here is 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 + Here is 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 + user, host, and job. Here is 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 have <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 + that could do accounting, and it is not 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 + has no idea whom to charge for printer use. It is 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 + they did not print. Basically, <tt/lpr -h/ will be the preferred option of environmentally-minded users, but you - can't offer any incentive to use it. + cannot offer any incentive to use it. - It's <em/still not enough/ to have each of the filters + It is <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 + output filter is not 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). + conversion. It is suited for header pages and plain + text jobs (when there is 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/ + filter still does not know what accounting file to use + (it is 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 + cannot 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 + Let us 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: +# whatever size paper you are 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 +% Make sure we do not 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 +% That is 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 + and then print the user's job. Here is 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 + As we have 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 + they would not 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 + basis, you will 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 + job with <tt/lpr -h/, then LPD will not 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 have 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. + <tt/psof/ does not 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. + of LPD you have enabled. - If you're using a printer with a network interface that's + If you are using a printer with a network interface that is 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, + That is it. You do not 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 + Here is an example. The host rose has two printers, + <tt/bamboo/ and <tt/rattan/. We will enable users on the + host orchid to print to those printers. Here is 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 + for the printer <tt/teak/; we have 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 is local; it is 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 + you are 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 + newlines, and more. But there is no way to specify a + connection to a printer that is 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 + conversion filters. Here is 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 + 5100. The host name of the printer is scrivener. Here is 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 + with the <tt/-#/ option, they will see <tscreen><verb> lpr: multiple copies are not allowed </verb></tscreen> - Note that if you've set up access to a printer remotely + Note that if you have 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> + Here is 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 + hearty, so we will allow multiple copies, but the laser + printer <tt/bamboo/'s a bit more delicate, so we will 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 + host orchid's <tt>/etc/printcap</tt> (and while we are at + it, let us 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 + <tt/lpr -#/, but that still does not prevent users from running <tt/lpr/ multiple times, or from submitting the 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 + access to your printers, if you feel it is appropriate (see section <ref name="Printers Installed on Remote Hosts" id="printing:advanced:network:rm">). - For example, we'll let anyone access the printer + For example, we will 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> + <tt/bamboo/. Here is 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 + Let us 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 + files users can submit to print. After all, there is 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. + there is 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. + for this capability, there will 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 + LPD will not refuse a file that is larger than the limit you + place on a printer. Instead, it will 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 + Let us 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 + to be large, we will limit them to five megabytes. We will 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 + you have set up access to your printers remotely, remote + users will not get those limits. You will 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 + There is 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 + For example, here is 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 + This lets you insure that remote users will not fill your filesystem. You can also use it to give a certain - priority to local users: they'll be able to queue jobs + priority to local users: they will 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 + For example, let us 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: + for this printer; here is <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 + capability. We will 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 + from their own departmental systems. If you would 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, + break down. You have 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 + Well, the bad news is the LPD spooling system does not 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 + or query the printer for pages printed. You cannot 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 + possibly because it is 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 + because it is 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 + When you are 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: + You will 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/ + only if there is 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. + smith on host gamma. Without, they are 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/ 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 + If, at your site, host does not 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 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 + how many lines per page your printer supports. Do not 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 + If you are 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 + information based on that value <em/only/. There is 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 + <p> If you have been reading straight through this manual, by now + you have 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: + Unfortunately, I have located only <em/two/ alternatives---and + they are 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 + name="ftp://ftp.iona.ie/pub/plp">. There is 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 + It is 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 have assisted in + <p> I would 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 1a454f4425..b30b4d0797 100644 --- a/handbook/relnotes.sgml +++ b/handbook/relnotes.sgml @@ -1,593 +1,593 @@ -<!-- $Id: relnotes.sgml,v 1.10 1996-02-02 05:27:27 wosch Exp $ --> +<!-- $Id: relnotes.sgml,v 1.11 1996-05-16 23:18:14 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 + We have 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 + you are 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 + We have 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 + have not 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 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: Søren 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 command. Bug reports will be dutifully filed by our - faithful bug-filer program and you can be sure that we'll + faithful bug-filer program and you can be sure that we will 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 + anyone wishing to do so. Send mail to &a.majordomo + 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 38367cd2bc..590cc94ea6 100644 --- a/handbook/routing.sgml +++ b/handbook/routing.sgml @@ -1,279 +1,279 @@ -<!-- $Id: routing.sgml,v 1.2 1996-01-31 14:26:16 mpp Exp $ --> +<!-- $Id: routing.sgml,v 1.3 1996-05-16 23:18:15 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 + refers to the first ethernet card in the machine. You will 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 + Let us 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. 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 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 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 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 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 propagation. <!-- <sect1><heading>Multicast Routing</heading> --> <sect1><heading>Troubleshooting</heading> <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 b9d5faade4..0b27a84cfc 100644 --- a/handbook/scsi.sgml +++ b/handbook/scsi.sgml @@ -1,796 +1,796 @@ -<!-- $Id: scsi.sgml,v 1.13 1996-04-19 21:50:32 asami Exp $ --> +<!-- $Id: scsi.sgml,v 1.14 1996-05-16 23:18:16 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 + single-ended signals, carried on 50 wires. (If you do not know what + single-ended means, do not 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 + rule: do no 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 its 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..). + not relevant (do not 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 traveling over your SCSI bus, you - don't want signals echoing back. + do not 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 + carefully store them. 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 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 its 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, its 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 its 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 its 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 + Right.. All is well now?! No, it is not. 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. + Newer kernels usually do not 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 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 its 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 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 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 its 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 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 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, + that device. If your device does not 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 + If it probes but just does not 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 9e6d3c0790..74469e9397 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 +password; we will 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 +present them back to you so you do not 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. 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 a SLIP client

Contributed by &a.asami;8 Aug 1995. The following is one way to set up a FreeBSD machine for SLIP on a static host network. For dynamic hostname assignments (i.e., your address changes each time you dial up), you probably need to do something much fancier. First, determine which serial port your modem is connected to. I have a symbolic link /dev/modem -> cuaa1, and only use the modem name in my configuration files. It can become quite cumbersome when you need to fix a bunch of files in /etc and .kermrc's all over the system! (Note that /dev/cuaa0 is COM1, cuaa1 is COM2, etc.) Make sure you have pseudo-device sl 1 in your kernel's config file. It is included in the GENERIC kernel, -so this won't be a problem unless you deleted it. +so this will not be a problem unless you deleted it. Things you have to do only once

Add your home machine, the gateway and nameservers to your /etc/hosts file. Mine looks like this: 127.0.0.1 localhost loghost 136.152.64.181 silvia.HIP.Berkeley.EDU silvia.HIP silvia 136.152.64.1 inr-3.Berkeley.EDU inr-3 slip-gateway 128.32.136.9 ns1.Berkeley.edu ns1 128.32.136.12 ns2.Berkeley.edu ns2 By the way, silvia is the name of the car that I had when I was - back in Japan (it's called 2?0SX here in U.S.). + back in Japan (it is called 2?0SX here in U.S.). Make sure you have "hosts" before "bind" in your /etc/host.conf. Otherwise, funny things may happen. Edit the file /etc/sysconfig. Set your hostname by editing the line that says: hostname=myname.my.domain You should give it your full Internet hostname. Add sl0 to the list of network interfaces by changing the line that says: network_interfaces="lo0" to: network_interfaces="lo0 sl0" Set the startup flags of sl0 by adding a line: ifconfig_sl0="inet ${hostname} slip-gateway netmask 0xffffff00 up" Designate the default router by changing the line: defaultrouter=NO to: defaultrouter=slip-gateway Make a file /etc/resolv.conf which contains: domain HIP.Berkeley.EDU nameserver 128.32.136.9 nameserver 128.32.136.12 As you can see, these set up the nameserver hosts. Of course, the actual domain names and addresses depend on your environment. Set the password for root and toor (and any other accounts that - doesn't have a password). Use passwd, don't edit the /etc/passwd + does not have a password). Use passwd, do not edit the /etc/passwd or /etc/master.passwd files! Reboot your machine and make sure it comes up with the correct hostname. Making a SLIP connection

Dial up, type "slip" at the prompt, enter your machine name and password. The things you need to enter depends on your environment. I use kermit, with a script like this: # kermit setup set modem hayes set line /dev/modem set speed 115200 set parity none set flow rts/cts set terminal bytesize 8 set file type binary # The next macro will dial up and login define slip dial 643-9600, input 10 =>, if failure stop, - output slip\x0d, input 10 Username:, if failure stop, - output silvia\x0d, input 10 Password:, if failure stop, - output ***\x0d, echo \x0aCONNECTED\x0a (of course, you have to change the hostname and password to fit yours). Then you can just type "slip" from the kermit prompt to get connected. Note: leaving your password in plain text anywhere in the - filesystem is generally a BAD idea. Do it at your own risk. I'm + filesystem is generally a BAD idea. Do it at your own risk. I am just too lazy. Leave the kermit there (you can suspend it by "z") and as root, type slattach -h -c -s 115200 /dev/modem if you are able to "ping" hosts on the other side of the router, - you are connected! If it doesn't work, you might want to try "-a" + you are connected! If it does not work, you might want to try "-a" instead of "-c" as an argument to slattach. How to shutdown the connection

Type "kill -INT `cat /var/run/slattach.modem.pid`" (as root) to kill slattach. Then go back to kermit ("fg" if you suspended it) and exit from it ("q"). The slattach man page says you have to use "ifconfig sl0 down" to - mark the interface down, but this doesn't seem to make any + mark the interface down, but this does not seem to make any difference for me. ("ifconfig sl0" reports the same thing.) Some times, your modem might refuse to drop the carrier (mine often does). In that case, simply start kermit and quit it again. It usually goes out on the second try. Troubleshooting -

If it doesn't work, feel free to ask me. The things that people +

If it does not work, feel free to ask me. The things that people tripped over so far: Not using "-c" or "-a" in slattach (I have no idea why this can be fatal, but adding this flag solved the problem for at least one person) Using "s10" instead of "sl0" (might be hard to see the difference on some fonts. Try "ifconfig sl0" to see your interface status. I get: silvia# ifconfig sl0 sl0: flags=10 inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00 Also, netstat -r will give the routing table, in case you get the "no route to host" messages from ping. Mine looks like: silvia# netstat -r Routing tables Destination Gateway Flags Refs Use IfaceMTU Rtt Netmasks: (root node) (root node) Route Tree for Protocol Family inet: (root node) => default inr-3.Berkeley.EDU UG 8 224515 sl0 - - localhost.Berkel localhost.Berkeley UH 5 42127 lo0 - 0.438 inr-3.Berkeley.E silvia.HIP.Berkele UH 1 0 sl0 - - silvia.HIP.Berke localhost.Berkeley UGH 34 47641234 lo0 - 0.438 (root node) (this is after transferring a bunch of files, your numbers should be smaller). diff --git a/handbook/slips.sgml b/handbook/slips.sgml index 3f6c2b919d..3156e98b46 100644 --- a/handbook/slips.sgml +++ b/handbook/slips.sgml @@ -1,502 +1,502 @@ Setting up a SLIP server

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 +It is 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 +modems. If you have not 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. +OK, enough of the examples -- let us 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 +router, you will 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 +You will 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 +Ethernet subnet, and you will 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 +/etc/sliphome/slip.logout is not 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 +If you are using ``proxy ARP'', you will 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...). +troublesome (or impossible, if you do not 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 +here is 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 +gated works OK for you. You will 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 +configuration file for it, you will 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. Acknowledgments

Thanks to these people for comments and advice regarding this tutorial: diff --git a/handbook/stable.sgml b/handbook/stable.sgml index f9b3c8f3be..0ca1f74526 100644 --- a/handbook/stable.sgml +++ b/handbook/stable.sgml @@ -1,109 +1,108 @@ - + Staying stable with FreeBSD

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

FreeBSD-stable is our development branch for a more low-key and conservative set of changes intended for our next mainstream release. Changes of an experimental or untested nature do not go into this branch (see ). Who needs FreeBSD-stable? -

If you're a commercial user or someone who puts maximum stability of +

If you are a commercial user or someone who puts maximum stability of their FreeBSD system before all other concerns, you should consider tracking -stable. This is especially true if you've installed the most +stable. This is especially true if you have installed the most recent release ( at the time of this writing) since the stable branch is effectively a bug-fix stream relative to the previous release.

Please note that the stable tree endevors, above all, to be fully compilable and stable at all times, but we do occasionally make mistakes (these are still active sources with quickly-transmitted updates, after all). We also do our best to thoroughly test fixes in current before bringing them into stable, but sometimes our tests fail to catch every case. If something breaks for you in stable, please let us know immediately! (see next section). Using FreeBSD-stable

Join the freebsd-stable mailing list. This will keep you informed of build-dependencies that may appear in stable or any other issues requring special attention. Developers will also make announcements in this mailing list when they are contemplating some contraversal fix or update, giving the users a chance to respond if they have any issues to raise concerning the proposed change. - To join this list, send mail to and say: + To join this list, send mail to &a.majordomo and say: subscribe freebsd-stable 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 + you to grab the entire collection once and then only what has 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-stable is always "exported" on:

We also 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. Before compiling stable, 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-stable will keep you up-to-date on other bootstrapping procedures that sometimes become necessary as we move towards the next release. diff --git a/handbook/submitters.sgml b/handbook/submitters.sgml index 606f330d9c..b1d8203dd2 100644 --- a/handbook/submitters.sgml +++ b/handbook/submitters.sgml @@ -1,512 +1,511 @@ - + Contributing to FreeBSD

Contributed by &a.jkh;. -

So you want to contribute something to FreeBSD? That's great! +

So you want to contribute something to FreeBSD? That is 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 +to survive. Your contributions are not only appreciated, they are vital to FreeBSD's continued growth! -

Contrary to what some people might also have you believe, you don't +

Contrary to what some people might also have you believe, you do not 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 +skill level, there is almost certainly something you can do to help the project!

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 +product work? You will find us receptive to your requests, given that +they are not 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 +What is 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 +we have collected over the last couple of months. Where possible, tasks +have been ranked by degree of urgency. If you are 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? +appointed, maybe you would like to volunteer? High priority tasks

The following tasks are considered to be urgent, usually because they represent something that is badly broken or sorely needed: 3-stage boot issues. Overall coordination: &a.hackers

Autodetect memory over 64MB properly. Move userconfig (-c) into 3rd stage boot. Do WinNT compatible drive tagging so that the 3rd stage can provide an accurate mapping of BIOS geometries for disks. Filesystem problems. Overall coordination: &a.fs Fix the MSDOS file system. Clean up and document the nullfs filesystem code. Coordinator: &a.gibbs Fix the union file system. Coordinator: &a.dyson Fix the LFS file system. Coordinator: &a.dyson Implement kernel and user vm86 support. Coordinator: &a.hackers Implement Int13 vm86 disk driver. Coordinator: &a.hackers SCSI driver issues. Overall coordination: &a.hackers

Support tagged queuing generically. Requires a rewrite of how we do our command queing, but we need this anyway to for prioritized I/O (CD-R writers/scanners). Better error handling (Busy status and retries). Merged Scatter-Gather list creation code. Kernel issues. Overall coordination: &a.hackers

Complete the eisaconf conversion of all existing drivers. Change all interrupt routines to take a (void *) instead of using unit numbers. Merge EISA/PCI/ISA interrupt registration code. Split PCI/EISA/ISA probes out from drivers like bt742a.c (WIP) Fix the syscons ALT-TAB/vt switching hangs. Coordinator: &a.sos Mouse support for syscons. Merged keyboard code for all console drivers. Rewrite the Intel Etherexpress 16 driver. Merge the 3c509 and 3c590 drivers (essentially provide a PCI probe for ep.c). Support Adaptec 3985 (first as a simple 3 channel SCSI card) Coordinator: &a.gibbs Support Advansys SCSI controller products. Coordinator: &a.gibbs Medium priority tasks

The following tasks need to be done, but not with any particular urgency: DOS emulator (for DOS executables) Coordinator: Port AFS (Andrew File System) to FreeBSD Coordinator: MCA support? This should be finalized one way or the other. Full LKM based driver support/Configuration Manager.

Devise a way to do all LKM registration without ld. This means some kind of symbol table in the kernel. Write a configuration manager (in the 3rd stage boot?) that probes your hardware in a sane manner, keeps only the LKMs required for your hardware, etc. PCMCIA/PCCARD. Coordinator: &a.phk Reliable operation of the pcic driver. Recognizer and handler for sio.c Recognizer and handler for ed.c Recognizer and handler for ep.c User-mode recognizer and handler. Advanced Power Management. Coordinator: &a.phk APM sub-driver. IDE/ATA disk sub-driver. syscons/pcvt sub-driver. Low priority tasks

The following tasks are purely cosmetic or represent such an -investment of work that it's not likely that anyone will get them done +investment of work that it is 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 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 monolithic service provider. 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 +This is easier than it sounds if the system call interface does not 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 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). +to "make regress" if that is all it is good for). 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 the &a.hackers;. 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 - . + &a.majordomo;. 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 + what is 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 the &a.bugs;. Changes to the documentation

Changes to the documentation are overseen by the &a.doc;. 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 &a.announce and the &a.current 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 the &a.hackers;. 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) + If your changes do not express themselves well as diffs alone + (e.g. you have 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 the &a.hackers;. 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, + you are unsure of copyright issues governing its further distribution + or you are simply not ready to release it without a tighter review first, then you should send it to rather than the &a.hackers 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. New code or major value-added packages

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 + The GNU Public License, or ``GPL''. This license is not 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.26 1996-05-09 23:32:44 jkh Exp $ + $Id: submitters.sgml,v 1.27 1996-05-16 23:18:20 mpp Exp $ For your convenience, a copy of this text can be found in /usr/share/examples/etc/bsd-style-copyright. &porting; Money, Hardware or Internet access -

We're always very happy to accept donations to further the cause of +

We are 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 section, please specify this when making your donation. Thanks! Donating hardware

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 +motherboards, etc) and if you would 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 +Hardware currently unsupported by FreeBSD for which you would 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 +such items as we will need to find a developer willing to take on the task before we can accept delivery of them. 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 +If you would like to be such a mirror, please contact for more information. Donors Gallery

The FreeBSD Project is indebted to the following donors and would like to publically thank them here! has generously donated funding to the further development of FreeBSD in Japan has graciously donated a portion of their profits from the sale of their FreeBSD for PC98'ers CD, a port of FreeBSD to the NEC PC98. has donated almost more than we can say (see the document for more details). - In particular, we'd like to thank them for the hardware used for + In particular, we would like to thank them for the hardware used for freefall.FreeBSD.ORG, our primary development machine, and for thud.FreeBSD.ORG, our testing and build box. We are also indebted to them for funding various contributors over the years and providing us with unrestricted use of their T1 connection to the Internet. diff --git a/handbook/sup.sgml b/handbook/sup.sgml index f6e7adad27..78bd12931a 100644 --- a/handbook/sup.sgml +++ b/handbook/sup.sgml @@ -1,132 +1,132 @@ - + SUP

Contributed by &a.jkh; and &a.gclarkii;. SUP is a network based software update tool developed at CMU. The purpose of this document is get the beginner up and running with sup. Getting setup

Starting with FreeBSD 2.1, sup is supplied as part of the base system and no separate installation is required. SUP gets the information it needs to run from a configuration file called a supfile. This file should be found in /usr/share/examples/sup/standard-supfile for the standard distributions. This file tells sup what collections it will be updating and/or installing and where they go. This supfile will sup the current source collection. For ports please have a look at /usr/share/examples/sup/ports-supfile. If you are interested in obtaining the cvs files that make up the source tree, refer to /usr/share/examples/sup/cvs-supfile. If you would rather track changes to the -stable release, refer to /usr/share/examples/sup/stable-supfile instead. -If you're inside the United States, you may also uncomment +If you are inside the United States, you may also uncomment the `secure' and `eBones' collection lines to grab the DES code. -If you're outside the +If you are outside the U.S., you should NOT sup this code from sup.FreeBSD.ORG as this will violate U.S. export restrictions. Instead you should use the secure-supfile found within the above directory. This will connect you to the international sup site that contains a secure distribution. Any distributions you do not wish to receive can be commented out with a # at the beginning of the distribution line. Please consult the file /usr/share/examples/sup/README for a list of alternate sup servers. The default sup server (sup.FreeBSD.ORG) listed in the above example files is currently overloaded and any traffic that can be transfered to a different host will help relieve some of the strain. -Once this is setup, you're ready to go. To start sup type: +Once this is setup, you are ready to go. To start sup type: sup supfile If you wish to see what sup is doing "verbosely", give it the -v option, like so: sup -v supfile -Thats all there is to it! Remember that if you're running current, +Thats all there is to it! Remember that if you are running current, which is what you will have if you sup with the standard-supfile, please join the &a.current mailing list. You should also be sure to read for important information on just what we can and cannot do for you as a -current user. If you are using the stable-supfile, please join the &a.stable mailing list and read . Description of FreeBSD SUP distributions

For the main FreeBSD distribution using the standard-supfile: src-base: /usr/src/... misc files at the top of /usr/src src-bin: /usr/src/bin user and system binaries src-secure: /usr/src/secure DES Sources (US/Canada ONLY) src-eBones: /usr/src/eBones Kerberos and DES (US/Canada ONLY) src-etc: /usr/src/etc system files src-games: /usr/src/games games src-gnu: /usr/src/gnu sources under the GNU Public License src-include: /usr/src/include include files src-sys: /usr/src/sys kernel sources src-lib: /usr/src/lib libraries src-libexec: /usr/src/libexec system binaries src-share: /usr/src/share various shared resources src-sbin: /usr/src/sbin single user system binaries src-usrbin: /usr/src/usr.bin user binaries src-usrsbin: /usr/src/usr.sbin system binaries

For the international FreeBSD distribution using the secure-supfile: src-secure: /usr/src/secure DES Sources src-eBones: /usr/src/eBones Kerberos and DES

And for the ports collection: ports-base: /usr/ports/... misc files at the top of /usr/ports ports-archivers: /usr/ports/archivers archiving tools ports-audio: /usr/ports/audio sound support ports-benchmarks: /usr/ports/benchmarks benchmarks ports-cad: /usr/ports/cad CAD tools ports-comms: /usr/ports/comms communication software ports-databases: /usr/ports/databases databases ports-devel: /usr/ports/devel development utilities ports-editors: /usr/ports/editors editors ports-emulators: /usr/ports/emulators emulators for other OSes ports-games: /usr/ports/games games ports-graphics: /usr/ports/graphics various graphics utilities ports-japanese: /usr/ports/japanese Japanese software. ports-lang: /usr/ports/lang programming languages ports-mail: /usr/ports/mail mail software ports-math: /usr/ports/math numerical computation software ports-misc: /usr/ports/misc miscellaneous utilities ports-net: /usr/ports/net networking software ports-news: /usr/ports/news USENET news software ports-plan9: /usr/ports/plan9 various programs from Plan9 ports-print: /usr/ports/print printing software ports-russian: /usr/ports/russian Russian software ports-security: /usr/ports/security ``security'' utilities, for better or for worse ports-shells: /usr/ports/shells various UN*X shells ports-sysutils: /usr/ports/sysutils system utilities ports-www: /usr/ports/www software related to the world wide web ports-x11: /usr/ports/x11 X11 software

If you want to keep updated on the original source of the ports, you can also add this to your supfile. But note that this collection is enormous, and unless you are an ftp site mirroring the -entire FreeBSD tree (but can't use ``mirror'' for some reason), you +entire FreeBSD tree (but cannot use ``mirror'' for some reason), you (and us) are much better off not using sup to collect these: ports-distfiles: /usr/ports/distfiles original tarballs diff --git a/handbook/troubleshooting.sgml b/handbook/troubleshooting.sgml index 128d7cfed3..7d0b372188 100644 --- a/handbook/troubleshooting.sgml +++ b/handbook/troubleshooting.sgml @@ -1,69 +1,69 @@ - + Troubleshooting

The following tips and tricks may help you turn a failing (or failed) installation attempt into a success. Please read them carefully. Hardware conflict or misconfiguration

Problem: A device is conflicting with - another or doesn't match the kernel's compiled-in IRQ or + another or does not match the kernel's compiled-in IRQ or address. Cause: While most device drivers in FreeBSD are now smart enough to match themselves to your hardware settings dynamically, there are a few that still require fairly rigid configuration parameters to be - compiled in (and matched by the hardware) before they'll - work. We're working hard to eliminate as many of these - last hold-outs as we can, but it's not always as easy as + compiled in (and matched by the hardware) before they will + work. We are working hard to eliminate as many of these + last hold-outs as we can, but it is not always as easy as it looks. Solution: There are several possible solutions. The first, and easiest, is to boot the kernel with the -c flag. When you see the initial boot prompt (from floppy or hard disk), type: /kernel -c This will boot just past the memory sizing code and then drop into a dynamic kernel configuration utility. Type `?' at the prompt to see a list of commands. You can use this utility to reset the IRQ, memory address, IO address or a number of other device configuration parameters. You can also disable a device - entirely if it's causing problems for other devices you'd + entirely if it is causing problems for other devices you would much rather have work. Another solution is, obviously, to remove the offending hardware or simply strip the system down to the bare essentials until the problem (hopefully) goes away. Once - you're up, you can do the same thing mentioned + you are up, you can do the same thing mentioned above---compile a kernel more suited to your hardware, or incrementally try to figure out what it was about your - original hardware configuration that didn't work. + original hardware configuration that did not work. When I boot for the first time, it still looks for /386bsd!

Cause: You still have the old FreeBSD 1.x boot blocks on your boot partition. Solution: You should re-enter the installation process, invoke the (F)disk editor and chose the (W)rite option. - This won't hurt an existing installation and will make + This will not hurt an existing installation and will make sure that the new boot blocks get written to the drive. - If you're installing for the first time, don't forget to + If you are installing for the first time, do not forget to (W)rite out your new boot blocks! :-) diff --git a/handbook/userppp.sgml b/handbook/userppp.sgml index 0373ea63fe..b332c53dd4 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 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, + it is 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: +

This document assumes you are 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 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 + In addition, I have 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. + have not installed a custom kernel you do not 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'' + It is 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 + which will be running ppp. Assuming that your 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. + Do not include the line numbers, they are 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 +

You now have PPP configured, but there are a few more things to do before + it is 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 + It is 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 + IP address. All that is 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.