<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN">

<article>
<title> README for XFree86 on FreeBSD
<author>Rich Murphey, David Dawes
<date>8 November 1998

<toc>
 
<sect>What and Where is XFree86?

<p>
XFree86 is a port of X11R6.3 that supports several versions of
Intel-based Unix.  It is derived from X386 1.2, which was the X server
distributed with X11R5.  This release consists of many new features
and performance improvements as well as many bug fixes.

For further details about this release, including installation instructions,
please refer to the <htmlurl name="Release Notes" url="RELNOTES.html">.

See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">.

Binaries for XFree86 on FreeBSD 2.2.x and 3.0 are available from:

<htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/current/binaries/"
url="ftp://ftp.XFree86.org/pub/XFree86/current/binaries/">
<p>

Send email to <em/Rich-Murphey@Rice.edu/ or <em/XFree86@XFree86.org/
if you have comments or suggestions about this file and we'll revise
it.


<sect>FreeBSD 3.0 and ELF<p>

The FreeBSD-3.0 binary distribution is ELF only.  The Xbin.tgz tarball
contains a.out libraries for compatibility purposes.


<sect>Installing The Display Manager (xdm)
<p>
The display manager makes your PC look like an X terminal.  That is, it
presents you with a login screen that runs under X.

The easiest way to automatically start the display manager on boot is to
add a line in <tt>/etc/ttys</tt> to start it on one of the unoccupied
virtual terminals:

<tscreen><verb>
 ttyv4	"/usr/X11R6/bin/xdm -nodaemon" xterm	on secure
</verb></tscreen>

You should also make sure that <tt>/usr/X11R6/bin/X</tt> is a symbolic
link to the Xserver that matches your video card or edit the file
Xservers in <tt>/usr/X11R6/lib/X11/xdm</tt> to specify the pathname of
the X server.

The change to <tt>/etc/ttys</tt> won't take effect until you either
reboot or ``<tt/kill -HUP 1/'' to force initd to reread
<tt>/etc/ttys</tt>.  You can also test the display manager manually by
loging in as root on the console and typing ``<tt/xdm -nodaemon/''.

 
<sect>Configuring X for Your Hardware
<p>
The <tt/XF86Config/ file tells the X server what kind of monitor, video card
and mouse you have.  You <em/must/ create it to tell the server what
specific hardware you have.

It is strongly recommended that you read through the <htmlurl
name="QuickStart guide" url="QuickStart.html">, and use either
the `XF86Setup' utility (which requires the VGA16 server to be installed),
or the `xf86config' utility to generate an XF86Config file.

When you run the `XF86Setup' utility, do NOT touch the mouse until
you are finished with mouse set up.
Otherwise, the VGA16 server and the mouse device driver may get
confused and you may experience mouse and/or keyboard input problems.

If you are running ``<tt/moused/'' (see the man page for <tt/moused(8)/)
in FreeBSD versions 2.2.1 or later,
you MUST specify <tt>SysMouse</tt> as the mouse protocol type 
and <tt>/dev/sysmouse</tt> as the mouse device name,
regardless of the brand and model of your mouse.

If you are NOT running ``<tt/moused/'', you need to know the interface
type of your mouse, <tt>/dev</tt> entry and the protocol type to use.

The interface type can be determined by looking at the connector 
of the mouse.
The serial mouse has a D-Sub female 9- or 25-pin connector.
The bus mouse has either a D-Sub male 9-pin connector 
or a round DIN 9-pin connector.
The PS/2 mouse is equipped with a small, round DIN 6-pin connector.
The USB mouse has a flat rectangular connector.
Some mice come with adapters with which the connector can 
be converted to another.  If you are to use such an adapter,
remember the connector at the very end of the mouse/adapter pair is 
what matters.

The next thing to decide is a <tt>/dev</tt> entry for the given interface.
For the bus and PS/2 mice, there is little choice: 
the bus mouse always use <tt>/dev/mse0</tt>,
and the PS/2 mouse is always at <tt>/dev/psm0</tt>.
You can attach multiple USB mice to your system or to your USB hub.
They are accessible as <tt>/dev/ums0</tt>, <tt>/dev/ums1</tt>,...
There may be more than one serial port to which the serial
mouse can be attached.  Many people often assign the first, built-in 
serial port <tt>/dev/cuaa0</tt> to the mouse.

If you are not sure which serial device your mouse is plugged into, 
the easiest way to find out the device is to
use ``<tt/cat/'' or ``<tt/kermit/'' to look at the output of the
mouse.  Connect to it and just make sure that it generates output when
the mouse is moved or clicked:

<tscreen><verb>
 % cat < /dev/tty00
</verb></tscreen>

If you can't find the right mouse device then use ``<tt/dmesg|grep
sio/'' to get a list of serial devices that were detected upon booting:

<tscreen><verb>
 % dmesg|grep sio
 sio0 at 0x3f8-0x3ff irq 4 on isa
</verb></tscreen>

Then double check the <tt>/dev</tt> entries corresponding to these
devices.  Use the script <tt>/dev/MAKEDEV</tt> to create entries if
they don't already exist:

<tscreen><verb>
 % cd /dev
 % sh MAKEDEV tty00
</verb></tscreen>

You may want to create a symbolic link <tt>/dev/mouse</tt>
pointing to the real port to which the mouse is connected, so that you
can easily distinguish which is your ``mouse'' port later.

The next step is to guess the appropriate protocol type for the mouse.
In FreeBSD 2.2.6 or later, the X server may be able to automatically 
determine the appropriate protocol type, unless your mouse is of a
relatively old model.
Use the ``<tt/Auto/'' protocol in these versions.

In other versions of FreeBSD or if the ``<tt/Auto/'' protocol
doesn't work in 2.2.6, you have to guess a protocol type and try.

There is rule of thumb:

<enum>
<item>The bus mice always use the ``<tt>BusMouse</tt>''
protocol regardless of the brand of the mouse.
<item>The ``<tt>PS/2</tt>'' protocol should always be specified for 
the PS/2 mouse regardless of the brand of the mouse.
<quote>
<bf/NOTE:/ There are quite a few PS/2 mouse protocols listed in the man page
for <tt>XF86Config</tt>.  But, ``<tt>PS/2</tt>'' is the only PS/2 mouse 
protocol type useful in <tt>XF86Config</tt> for FreeBSD.
The other PS/2 mouse protocol types are not supported in FreeBSD.
FreeBSD version 2.2.6 and later directly support 
these protocol types in the PS/2 mouse driver <tt/psm/ and it is not
necessary to tell the X server which PS/2 mouse protocol type is to 
be used; ``<tt/Auto/'' should work, otherwise use ``<tt>PS/2</tt>''.
</quote>
<item>You must specify the ``<tt>Auto</tt>'' protocol for the USB mouse.
<quote>
<bf/NOTE:/ Other XFree86 document may mention ``<tt>Usb</tt>'' as one of 
keywords for the mouse protocol.  This keyword is not necessary, thus, not 
supported in FreeBSD.  Be sure to use ``<tt>Auto</tt>'' for the USB
mouse.
</quote>
<item>The ``<tt>Logitech</tt>'' protocol is for old mouse models 
from Logitech.
Modern Logitech mice use either the ``<tt>MouseMan</tt>''
or ``<tt>Microsoft</tt>'' protocol.
<item>Most 2-button serial mice support the ``<tt>Microsoft</tt>'' protocol.
<item>3-button serial mice may work with the ``<tt>MouseSystems</tt>''
protocol. If it doesn't, it may work with the ``<tt>Microsoft</tt>''
protocol although the third (middle) button won't function.
3-button serial mice may also work with the ``<tt>MouseMan</tt>''
protocol under which the third button may function as expected.
<item>3-button serial mice may have a small switch to choose between ``MS''
and ``PC'', or ``2'' and ``3''.
``MS'' or ``2'' usually mean the ``<tt>Microsoft</tt>'' protocol.
``PC'' or ``3'' will choose the ``<tt>MouseSystems</tt>'' protocol.
<item>If the serial mouse has a roller or a wheel, it may be compatible 
with the ``<tt>IntelliMouse</tt>'' protocol.
</enum>

<sect>Running X
<p>
8mb of memory is a recommended minimum for running X.  The server,
window manager, display manager and an xterm take about 8Mb of virtual
memory themselves.  Even if their resident set size is smaller, on a
8Mb system that leaves very space for other applications such as gcc
that expect a few meg free.  The R6 X servers may work with 4Mb of
memory, but in practice compilation while running X can take 5 or 10
times as long due to constant paging.

The easiest way for new users to start X windows is to type
``<tt>startx >&amp; startx.log</tt>''.  Error messages are lost unless
you redirect them because the server takes over the screen.

To get out of X windows, type: ``<tt/exit/'' in the console xterm.
You can customize your X by creating <tt/.xinitrc/, <tt/.xserverrc/,
and <tt/.twmrc/ files in your home directory as described in the <em/xinit/
and <em/startx/ man pages.

 

<sect>Rebuilding Kernels for X
<p>

The GENERIC FreeBSD kernels support XFree86
without any modifications required.  You do not need to make any changes
to the GENERIC kernel or any kernel configuration which is a superset.

For a general description of BSD kernel configuration get <url
name="smm.02.config.ps.Z"
url="ftp://gatekeeper.dec.com/pub/BSD/manuals/smm.02.config.ps.Z">.
It is a ready-to-print postscript copy of the kernel configuration
chapter from the system maintainers manual.

If you do decide to reduce your kernel configuration file, do not
remove the line below (in <tt>/sys/arch/i386/conf</tt>).  It
is required for X support:

<tscreen><verb>
 options		UCONSOLE		#X Console support
</verb></tscreen>

The generic FreeBSD kernels are configured
by default with the syscons driver.  To configure your kernel similarly
it should have a line like this in <tt>/usr/src/sys/i386/conf/GENERIC</tt>:

<tscreen><verb>
 device		sc0	at isa? tty
</verb></tscreen>

The above example is for FreeBSD version 3.1 or later.  If you are running
earlier versions, use the following line instead.

<tscreen><verb>
 device		sc0	at isa? port "IO_KBD" tty irq 1 vector scintr
</verb></tscreen>

The number of virtual consoles can be set using the MAXCONS option:

<tscreen><verb>
 options		"MAXCONS=4"		#4 virtual consoles
</verb></tscreen>

Otherwise, the default without a line like this is 16.  You must have more
VTs than gettys as described in the end of section 3, and 4 is a reasonable
minimum.

The server supports two console drivers: syscons and pcvt.
The syscons driver is the default in FreeBSD 1.1.5 and higher.  They are
detected at runtime and no configuration of the server itself is required.

If you intend to use pcvt as the console driver, be sure to include the
following option in your kernel configuration file.

<tscreen><verb>
 options		XSERVER			#Xserver
</verb></tscreen>

The number of virtual consoles in pcvt can be set using the following
option:

<tscreen><verb>
 options		"PCVT_NSCREENS=10"	#10 virtual consoles
</verb></tscreen>

The bus mouse driver and the PS/2 mouse driver may not be included, or
may be included but disabled in your kernel.  If you intend to use
these mice, verify the following lines in the kernel configuration file:

<tscreen><verb>
 device		mse0	at isa? port 0x23c tty irq 5
 device		psm0	at isa? tty irq 12
</verb></tscreen>

The above example is for FreeBSD version 3.1 or later.  If you are running
earlier versions, use the following lines instead.

<tscreen><verb>
 device		mse0	at isa? port 0x23c tty irq 5 vector mseintr
 device		psm0	at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr
</verb></tscreen>

The <tt/mse0/ device is for the bus mouse and the <tt/psm/ device is 
for the PS/2 mouse.  Your bus mouse interface card may allow you to 
change IRQ and the port address.  Please refer to the manual of 
the bus mouse and the manual page for <tt/mse(4)/ for details.
There is no provision to change IRQ and the port address of the
PS/2 mouse.

The XFree86 servers include support for the MIT-SHM extension.  The
GENERIC kernel does not support this, so if you want to make use of
this, you will need a kernel configured with SYSV shared memory
support.  To do this, add the following line to your kernel config
file:

<tscreen><verb>
 options		SYSVSHM			# System V shared memory
 options		SYSVSEM			# System V semaphores
 options		SYSVMSG			# System V message queues
</verb></tscreen>

If you are using a SoundBlaster 16 on IRQ 2 (9), then you need a patch for
sb16_dsp.c.  Otherwise a kernel configured with the SoundBlaster driver will
claim interrupt 9 doesn't exist and X server will lock up.

S3 cards and serial port COM 4 cannot be installed together on a
system because the I/O port addresses overlap.


<sect>Building X Clients
<p>

The easiest way to build a new client (X application) is to use
<tt/xmkmf/ if an <tt/Imakefile/ is included with it.  Type ``<tt/xmkmf -a/''
to create the Makefiles, then type ``<tt/make/''.  Whenever you install
additional man pages you should update <tt/whatis.db/ by running
``<tt>makewhatis /usr/X11R6/man</tt>''.

<bf/Note:/ Starting with XFree86 2.1 and FreeBSD 1.1, the symbol
<bf/__386BSD__/ no longer gets defined either by the compiler or via the
X config files for FreeBSD systems.  When porting clients to BSD
systems, make use of the symbol <bf/BSD/ for code which is truly
BSD-specific.  The value of the symbol can be used to distinguish
different BSD releases.  For example, code specific to the Net-2 and
later releases can use:

<tscreen>
#if (BSD >= 199103)
</tscreen>

To ensure that this symbol is correctly defined, include
<tt>&lt;sys/param.h&gt;</tt> in the source that requires it.  Note that
the symbol <bf/CSRG_BASED/ is defined for *BSD systems in XFree86 3.1.1
and later.  This should be used to protect the inclusion of
<tt>&lt;sys/param.h&gt;</tt>.

For code that really is specific to a particular i386 BSD port, use
<bf/__FreeBSD__/ for FreeBSD, <bf/__NetBSD__/ for NetBSD,
<bf/__OpenBSD__/ for OpenBSD,
<bf/__386BSD__/ for 386BSD, and <bf/__bsdi__/ for BSD/386.


<sect> Thanks
<p>
Many thanks to:
  <itemize>
<item><bf/Pace Willison/  for providing initial *BSD support.
<item><bf/Amancio Hasty/ for 386BSD kernel and S3 chipset support.
<item><bf/David Greenman, Nate Williams, Jordan Hubbard/ for FreeBSD
       kernel support.  
<item><bf/Rod Grimes/, <bf/Jordan Hubbard/ and <bf/Jack Velte/ for
       the use of Walnut Creek Cdrom's hardware. 
<item><bf/Orest Zborowski/, <bf/Simon Cooper/ and <bf/Dirk Hohndel/ for ideas from the Linux distribution.
</itemize>

<verb>
$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/FreeBSD.sgml,v 3.31 2000/03/31 22:55:36 dawes Exp $ 





$XConsortium: FreeBSD.sgml /main/12 1996/10/28 05:43:08 kaleb $
</verb>

</article>
