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

XFree86 Dependencies




Linux-PAM-; the following packages are included in the XFree86 package, however they are updated more often than the XFree86 package and are highly recommended: expat-2.0.0, 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.

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/XFree86

Download Instructions

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

  • XFree86-4.6.0-src-1.tgz

  • XFree86-4.6.0-src-2.tgz

  • XFree86-4.6.0-src-3.tgz

  • XFree86-4.6.0-src-4.tgz

  • XFree86-4.6.0-src-5.tgz

  • XFree86-4.6.0-src-6.tgz

  • XFree86-4.6.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.

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.2.3 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

Glibc build fix

Xfree86 may have a problem with sys/kd.h installed with some recent versions of Glibc. This has recently been fixed in LFS SVN. Execute the following commands to work around a broken kd.h file. The grep command is to ensure the modification is only made if it is needed. Run these commands from within the xc folder:

grep "__undef_LINUX" \
    /usr/include/sys/kd.h 2>&1 > /dev/null || \
    sed -i.bak '/X.h/i #include <linux/types.h>' \

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:

make -C config/util -f Makefile.ini lndir

Now create the shadow tree:

mkdir ../xcbuild &&
cd ../xcbuild &&
../xc/config/util/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 */

/* 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 \
                         v4l vesa vga \
                         dummy XF86OSCardDrivers XF86ExtraCardDrivers

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

/* Uncomment the following define if you'd like
 * xdm to use Linux-PAM
#define HasPam                  YES


#define SystemManDirectory        /usr/share/man
#define DocDir                    /usr/share/doc/xfree86-4.6.0

/* Installation prefix. The default is to install into /usr/X11R6. If you
 * would like to install into /usr, uncomment these options. */

/* #define ProjectRoot            /usr */
/* #define LinkGLToUsrLib         NO   */
/* #define LinkGLToUsrInclude     NO   */

/* End XFree86 host.def file */

Edit the file for your hardware and desires. You can find more options by reading the other files in xc/config/cf and on the wiki. http://wiki.linuxfromscratch.org/blfs/wiki/XFree86-4.6.0

Build Commands

Install XFree86 by running the following commands:

sed -i 's:^.*asm.*$:# define PAGE_MASK   (~(getpagesize() - 1)):' \
    ../xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c &&
sed -i -e "s@^#include <linux/config.h>@/* & */@" \
    `grep -lr linux/config.h ../xc` &&
( make World 2>&1 | tee xfree-compile.log && exit $PIPESTATUS )

This package does not come with a test suite.

Now, as the root user:

make install &&
make install.man

If you installed XFree86 into the default prefix, /usr/X11R6, make these symlinks to work around some applications which look for things in the wrong place. As root:

ln -v -s ../X11R6/bin /usr/bin/X11 &&
ln -v -s ../X11R6/lib/X11 /usr/lib/X11 &&
ln -v -s ../X11R6/include/X11 /usr/include/X11

The XFree86 fonts have been installed outside of Fontconfig's default search path of /usr/share/fonts. In order for Fontconfig to find the installed TrueType fonts, you should make symlinks to their directories. If you installed XFree86 with the prefix /usr, omit /X11R6 from the following commands. As root:

install -d -m755 /usr/share/fonts &&
ln -svn /usr/X11R6/lib/X11/fonts/OTF /usr/share/fonts/X11-OTF &&
ln -svn /usr/X11R6/lib/X11/fonts/TTF /usr/share/fonts/X11-TTF

XFree86 installs the XRender and XExtensions extension libraries but does not install the corresponding pkg-config files. Create the files with these commands. If you installed XFree86 with the prefix /usr, omit /X11R6 from the paths. As root:

cat > /usr/X11R6/lib/pkgconfig/xrender.pc << "EOF"

Name: Xrender
Description: X Render Library
Version: 0.8.3
Cflags: -I${includedir} -I/usr/X11R6/include
Libs: -L${libdir} -lXrender  -L/usr/X11R6/lib -lX11


cat > /usr/X11R6/lib/pkgconfig/xextensions.pc << "EOF"

Name: XExtensions
Description: Sundry X extension headers
Version: 1.0.1
Cflags: -I${includedir}


You should now continue on to the X Window System Components section to complete the configuration of XFree86.

Command Explanations

sed -i 's:^.*asm.* ... fbdevhw.c: This sed fixes a problem compiling against headers from kernels newer than linux-2.6.8.

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 World 2>&1 | tee xfree-compile.log && exit $PIPESTATUS ): This command runs multiple Makefiles to completely rebuild the system. 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 -s ...: 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.


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 (if you install into /usr/X11R6) 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 2007-01-18 13:38:19 -0600