Introduction to XFree86

XFree86 is a freely redistributable open-source implementation of the X Window System. XFree86 provides a client/server interface between display hardware (the mouse, keyboard, and video displays) and the desktop environment, while also providing both the windowing infrastructure and a standardized application interface (API).

Package Information

Additional Downloads

XFree86 Dependencies




Linux-PAM-0.80; the following packages are included in the XFree86 package, however they are updated more often than the XFree86 package and are highly recommended: expat-1.95.8, FreeType-2.1.10, Fontconfig-2.3.2.



If you choose not to install expat, FreeType2, and Fontconfig, the host.def file below will have to be modified to instruct XFree86 to build them.

Download Instructions

There are several files that need to be fetched from the download location:

  • XFree86-4.5.0-src-1.tgz

  • XFree86-4.5.0-src-2.tgz

  • XFree86-4.5.0-src-3.tgz

  • XFree86-4.5.0-src-4.tgz

  • XFree86-4.5.0-src-5.tgz

  • XFree86-4.5.0-src-6.tgz

  • XFree86-4.5.0-src-7.tgz

The first three packages are the XFree86 programs, the fourth and fifth are fonts, the sixth is normal documentation, and the seventh is hardcopy documentation. There are also two packages doctools-1.3.x.tgz, which contain programs to regenerate hardcopy documentation, and utils-1.1.x.tgz, which contain GNU TAR and zlib which are already installed on an LFS system.

To check your downloads for integrity, download the SUMS.md5sum file. Then:

md5sum -c SUMS.md5sum

The only errors you should see are for README, doctools-1.3.x.tgz, utils-1.1.x.tgz and XFree86-xtest-4.0.x.tar.bz2 files if you did not download them.

Kernel Configuration

If you have an Intel P6 (Pentium Pro, Pentium II and later), it is recommended that you compile MTRR (Memory Type Range Registers) support into the kernel. The kernel can map Cyrix and AMD CPUs to the MTRR interface, so selecting this option is useful for those processors also. This option is found in the "Processor type and features" menu. It can increase performance of image write operations 2.5 times or more on PCI or AGP video cards.

In the "Character Devices" section, enable AGP Support and select the chipset support on your motherboard. If you do not know the chipset, you may select all the chip types at the expense of extra kernel size. You can usually determine your motherboard's chipset by running the command lspci, a program from the PCI Utilities-2.1.11 package.

In the "Character Devices" section, disable Direct Rendering Manager unless you have a Direct Rendering Infrastructure (DRI) supported video card. A complete list of DRI supported video cards can be found at http://dri.sourceforge.net in the Status section. Currently, supported cards include those from 3dfx (Voodoo, Banshee), 3Dlabs, ATI (Rage Pro, Rage 128, Radeon 7X00, Radeon 2), Intel (i810, i815), and Matrox (G200, G400, G450).

Additionally NVidia provides their own closed source binary drivers, which do not make use of DRI. If you intend to use these drivers, do not enable DRI.

If you made any changes to the kernel configuration, recompile and install the new kernel.

Installation of XFree86

Setting Up a Shadow Directory

When building XFree86, you should create a shadow directory of symbolic links for the compiled code. To do that, first make lndir. Starting from the xc directory:

pushd config/util &&
make -f Makefile.ini lndir

Now, as the root user:

cp -v lndir /usr/bin/

And back as an unprivileged user:


Now create the shadow tree:

mkdir ../xcbuild &&
cd ../xcbuild &&
lndir ../xc

Creating 'host.def'

Although XFree86 will compile without a host.def file, the following file is recommended for customizing the installation. Start from the xcbuild directory.



The host.def file is a C file, not the usual configuration file. If you make any changes, be sure the comment characters (/* and */) are balanced. Most of the entries in the file below are commented out with the default settings shown.

cat > config/cf/host.def << "EOF"
/* Begin XFree86 host.def file */

/* System Related Information.  If you read and configure only one
 * section then it should be this one.  The Intel architecture defaults
 * are set for a i686 and higher.  Axp is for the Alpha architecture
 * and Ppc is for the Power PC.  Note that there have been reports that
 * the Ppc optimization line causes segmentation faults during build.
 * If that happens, try building without the DefaultGcc2PpcOpt line. */

/* #define DefaultGcc2i386Opt  -O2 -fomit-frame-pointer -march=i686 */
/* #define DefaultGcc2AxpOpt   -O2 -mcpu=ev6 */
/* #define DefaultGcc2PpcOpt   -O2 -mcpu=750 */

/* The following definitions are normally set properly by XFree86's
 * scripts. You can uncomment them if you want to make sure. *********/

/* #define HasMTRRSupport      YES  */ /* Enabled in kernel; */
                                       /* see kernel docs */
/* #define HasMMXSupport        NO  */ /* Any i586 or above */
/* #define HasKatmaiSupport     NO  */ /* PIII SSE instructions */
/* #define Has3DNowSupport      NO  */ /* AMD instructions */

/* This setting reduces compile time a little by omitting rarely used
 * input devices.  You can find the complete list in
 * config/cf/xfree86.cf *********************************************/

#define XInputDrivers                 mouse void

/* VIDEO DRIVERS ****************************************************/

/* If you are sure you only want the drivers for one or a few video
 * cards, you can delete the drivers you do not want. ***************/

#define XF86CardDrivers  mga glint nv tga s3 s3virge sis rendition \
                         neomagic i740 tdfx savage \
                         cirrus vmware tseng trident chips apm \
                         GlideDriver fbdev i128 nsc \
                         ati i810 DevelDrivers ark \
                         cyrix siliconmotion \
                         vesa vga \
                         dummy XF86OSCardDrivers XF86ExtraCardDrivers

/* USER AND SYSTEM DEFAULT PATHS *************************************/

/* These settings set the PATH variables used by xdm. See README for */
/* detailed description and modify the following as per your need. ***/

/* #define DefaultSystemPath \
       /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin */
/* #define DefaultUserPath /usr/bin:/bin:/usr/X11R6/bin */

/* FONT SERVER AND LIBRARY SETTINGS **********************************/

/* These settings are the defaults  **********************************/

/* #define BuildFontServer       YES  */ /*For Ghostscript Print Server*/
/* #define SharedLibFont         YES  */
/* #define CompressAllFonts      YES  */
/* #define GzipFontCompression   YES  */

/* These settings ensure we use our libraries ************************/
#define HasFreetype2             YES
#define HasFontconfig            YES
#define HasExpat                 YES
#define HasLibpng                YES
#define HasZlib                  YES

/* The font path can be redefined in the XF86Config file *************/

#define DefaultFontPath          $(FONTDIR)/misc/,$(FONTDIR)/75dpi/,\

/* INTERNATIONAL FONTS.  Change to YES if you need any of them.  These
 * are the defaults. **************************************************/

/* #define BuildCyrillicFonts            NO  */
/* #define BuildArabicFonts              NO  */
/* #define BuildISO8859_6Fonts           NO  */
/* #define BuildGreekFonts               NO  */
/* #define BuildISO8859_7Fonts           NO  */
/* #define BuildHebrewFonts              NO  */
/* #define BuildISO8859_8Fonts           NO  */
/* #define BuildKOI8_RFonts              NO  */
/* #define BuildJapaneseFonts            NO  */
/* #define BuildJISX0201Fonts            NO  */
/* #define BuildKoreanFonts              NO  */
/* #define BuildChineseFonts             NO  */

/* DOCUMENTATION SETTINGS ********************************************/

/* These setting are the defaults. ***********************************/

/* #define BuildLinuxDocHtml        NO  */  /* X Docs in Html format */
/* #define BuildLinuxDocPS          NO  */  /* PostScript format */
/* #define BuildAllSpecsDocs        NO  */  /* Various docs */
/* #define BuildHtmlManPages        NO  */

/* GENERAL SETTINGS: You generally want to leave these alone when
 * building X on an LFS system ***************************************/

#define GccWarningOptions         -pipe /* Speed up compiles */
#define TermcapLibrary            -lncurses
#define XprtServer                YES /* Needed by realplayer */
#define XnestServer               YES
#define XAppLoadDir               EtcX11Directory/app-defaults
#define VarLibDir                 /var/lib
#define XFree86Devel               NO
#define FSUseSyslog               YES
#define ThreadedX                 YES
#define HasPam                     NO
#define SystemManDirectory        /usr/share/man /*Instead of /usr/man*/
#define HasLibCrypt               YES
#define InstallXinitConfig        YES
#define InstallXdmConfig          YES
#define ForceNormalLib            YES
#define BuildSpecsDocs             NO

/* End XFree86 host.def file */

Edit the file for your hardware and desires.

Build Commands

Install XFree86 by running the following commands:

patch -Np1 -i ../XFree86-4.5.0-kernel_headers-1.patch &&
sed -i -e "s@^#include <linux/config.h>@/* & */@" \
    `grep -lr linux/config.h *` &&
( make WORLDOPTS="" World 2>&1 | \
    tee xfree-compile.log && exit $PIPESTATUS )

Now, as the root user:

make install &&
make install.man &&
ln -v -sf ../X11R6/bin /usr/bin/X11 &&
ln -v -sf ../X11R6/lib/X11 /usr/lib/X11 &&
ln -v -sf ../X11R6/include/X11 /usr/include/X11

Command Explanations

sed -i -e "s@^#include <linux/config.h>@...: The Linux-Libc-Headers package installed in LFS installs a /usr/include/linux/config.h file which is not compatible with userspace applications. The recommended fix for applications including this file is to remove it (see linux-libc-headers FAQ). The sed uses grep -lr to replace all occurrences. If you desire, just remove (comment) the line in the appropriate video driver file if you customized host.def.

( make WORLDOPTS="" World 2>&1 | tee xfree-compile.log && exit $PIPESTATUS ): This command runs multiple Makefiles to completely rebuild the system. WORLDOPTS="" disables the default setting to continue after encountering an error. 2>&1 redirects error messages to the same location as standard output. The tee command allows viewing of the output while logging the results to a file. The parentheses around the command runs the entire command in a subshell and finally the exit $PIPESTATUS ensures the result of the make is returned as the result and not the result of the tee command.



When rebuilding XFree86, a separate command that may be used if only minor changes are made to the sources is make Everything. This does not automatically remove generated files and only rebuilds those files or programs that are out of date.

ln -v -sf ...: These commands are present to enable other (broken) packages to build against XFree86, even though the Filesystem Hierarchy Standard says: “In general, software must not be installed or managed via the above symbolic links. They are intended for utilization by users only.

Configuring XFree86

As the root user: Edit /etc/ld.so.conf and add /usr/X11R6/lib, then run:


Ensure /usr/X11R6/bin and /usr/X11R6/lib/pkgconfig are added to your PATH and PKG_CONFIG_PATH environment variables, respectively. Instructions for doing this are described in the section The Bash Shell Startup Files.

Create the XF86Config file with:

cd ~ &&
XFree86 -configure

The screen will go black and you may hear some clicking of the monitor. This command will create a file, XF86Config.new in your home directory.

Edit XF86Config.new to suit your system. The details of the file are located in the man page man XF86Config. Some things you may want to do are:

  • Section "Files". Change the order of the font paths searched. You may want to put 100dpi fonts ahead of 75dpi fonts if your system normally comes up closer to 100 dots per inch. You may want to remove some font directories completely.

  • Section "Module". If you are going to install NVidia drivers, remove the "dri" line.

  • Sections "InputDevice". You may want to change the keyboard autorepeat rate by adding Option "Autorepeat" "250 30".

  • Section "Monitor". Specify the VertRefresh and HorizSync values if the system does not automatically detect the monitor and its values.

  • Section "Device". You may want to set some of the options available for your selected video driver. A description of the driver parameters is in the man page for your driver.

  • Section "Screen". Add a DefaultDepth statement such as: DefaultDepth 24. In the SubSection for your default depth, add a modes line such as: Modes "1600x1200" "1280x1024" "1024x768". The first mode listed will normally be the starting resolution.

Test the system with:

XFree86 -xf86config ~/XF86Config.new

You will only get a gray background with an X-shaped mouse cursor, but it confirms the system is working. Exit with Control+Alt+Backspace. If the system does not work, examine /var/log/XFree86.0.log to see what went wrong.

As the root user: move the configuration file to its final location:

mv ~/XF86Config.new /etc/X11/XF86Config

Create .xinitrc:

cat > ~/.xinitrc << "EOF"
# Begin .xinitrc file
xterm  -g 80x40+0+0   &
xclock -g 100x100-0+0 &

This provides an initial screen with an xterm and a clock that is managed by a simple window manager, Tab Window Manager. For details of twm, see the man page.



When needed, XFree86 creates the directory /tmp/.ICE-unix if it does not exist. If this directory is not owned by root, XFree86 delays startup by a few seconds and also appends a warning to the logfile. This also affects startup of other applications. To improve performance, it is advisable to manually create the directory before XFree86 uses it. Add the file creation to /etc/sysconfig/createfiles that is sourced by the /etc/rc.d/init.d/cleanfs startup script.

cat >> /etc/sysconfig/createfiles << "EOF"
/tmp/.ICE-unix dir 1777 root root

Start X with:


to get a basic functional X Window System.

At this point, you should check out the section called “X Window System Components” for the necessary configuration to make X fully functional. Additionally, you can have a look at the section called “Additional X Window System Configuration” for information on fine tuning your X configuration.


The XFree86 package contains the X Window System for Linux (and other operating systems). It includes the X server, fonts, xterm, a simple window manager (twm), various utilities, video output drivers, and various input drivers including the mouse and keyboard.

XFree86 also contains libraries and header files for development of the X Window System programs.



The following lists are not comprehensive. The full list of programs is in /usr/X11R6/bin. For additional information about these programs, see the respective man page.

Installed Programs: XFree86, xf86config, xf86cfg, startx, xinit, twm, xterm, xwininfo, x11perf, xlsfonts, xvidtune, xload, xcalc, xclock, oclock, and xmodmap
Installed Libraries: libGL.so, libGLU.so, libSM.so, libXi.so, libXrender.so, libXt.so, and libXfont.so
Installed Directories: /usr/X11R6/ and /etc/X11/

Short Descriptions


is the X11R6 implementation of the X Window System server.


is an interactive program for generating an XF86Config file for use with XFree86 X servers.


is a tool to configure XFree86 that can be used to either write the initial configuration file or make customizations to the current configuration.


is a script to initialize the X session. It runs xinit.


is used to start the X Window System server.


(Tab Window Manager) is a window manager included with the X Window System.


is a terminal emulator for X.


is a window information utility for X.


is an X11 server performance test program.


is a program to list fonts available to the X server.


is a video mode tuner for XFree86.


is a system load average display for X.


is a scientific calculator for X.


is a clock programs for X.


is a clock programs for X.


is a utility for modifying keymaps and pointer button mappings in X.

Last updated on 2005-08-01 13:29:19 -0600