This chapter contains a graphical user environment.
There are two packages in BLFS that implement the X Window System: Xorg and XFree86. These packages are quite similar. In fact, the base system of Xorg is XFree86-4.4.0RC2. The primary difference as of this writing is the license provisions of the packages. For someone building a package for their own use, these issues are not significant. Most large commercial distributions have decided to use the Xorg package, but several still use XFree86.
A second reason for the forking of X packages is the stated goals of the developers. Some developers were unhappy with the administration and progress of XFree86. X.org's future plans include significant improvements to the internals of the system and more frequent releases.
XFree86 continues to be a solid, conservative application with excellent driver support.
Both Xorg and XFree86 can be installed in the same way, but this section will provide a slightly different and more current variation for installation.
Xorg is a freely redistributable open-source implementation of the X Window System. This application 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).
Download (FTP): ftp://ftp.opengroup.org/pub/x.org/pub/X11R6.8.2/src-single/X11R6.8.2-src.tar.bz2
Download MD5 sum: 8131cd7ea1e4566e6e05c438a93fcfe1
Download size: 43 MB
Estimated disk space required: 655 MB
Estimated build time: 17.8 SBU
As an alternative to downloading the entire source tree in a single file, there are several files that need to be fetched from the download location (directory /pub/x.org/pub/X11R6.8.2/src/):
X11R6.8.2-src1.tar.gz
X11R6.8.2-src2.tar.gz
X11R6.8.2-src3.tar.gz
X11R6.8.2-src4.tar.gz
X11R6.8.2-src5.tar.gz
X11R6.8.2-src6.tar.gz
X11R6.8.2-src7.tar.gz
The first package contains the Xorg libraries and support programs, the second contains standard X programs, the third contains the X server, the fourth and fifth are fonts, the sixth is normal documentation, and the seventh is hardcopy documentation.
To check your file for integrity, download the md5sums file. Then:
md5sum -c md5sums
The package (or all seven packages) should give an OK status.
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.
If you build Xorg in a chroot environment, make sure the kernel version of the base system and the target system are the same.
Xorg insists on putting its boot and profile scripts into the /etc directory even if specifically told not to compile anything Xprint server or client related (see host.def below). The following command will suppress any such modifications:
sed -i '/^SUBDIRS =/s/ etc$//' programs/Xserver/Xprint/Imakefile
When building Xorg, 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 lndir /usr/bin/
And back as a regular user:
popd
Now create the shadow tree:
mkdir ../xcbuild &&
cd ../xcbuild &&
lndir ../xc
The next step is to create the config/cf/host.def file. The documentation for Xorg indicates that the application will build without a host.def file, but the included libraries for Fontconfig and FreeType2 do not build properly on a base LFS system. Therefore, you must specify that these libraries, as well as others, should be imported from the system.
config/cf/host.def is a C file, not a shell script. Ensure the comments delimited by /* ... */ are balanced when modifying the file.
cat > config/cf/host.def << "EOF" /* Begin Xorg 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. AMD64 is for the Opteron processor. * 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 -fno-strength-reduce \ -fno-strict-aliasing -march=i686 */ /* #define DefaultGccAMD64Opt -O2 -fno-strength-reduce \ -fno-strict-aliasing */ /* #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 */ /* #define DefaultGcc2PpcOpt -O2 -mcpu=750 */ #define HasFreetype2 YES #define HasFontconfig YES #define HasExpat YES #define HasLibpng YES #define HasZlib YES /* * Which drivers to build. When building a static server, each of * these will be included in it. When building the loadable server * each of these modules will be built. * #define XF86CardDrivers mga glint nv tga s3virge sis rendition \ neomagic i740 tdfx savage \ cirrus vmware tseng trident chips apm \ GlideDriver fbdev i128 \ ati AgpGartDrivers DevelDrivers ark \ cyrix siliconmotion vesa vga \ XF86OSCardDrivers XF86ExtraCardDrivers */ /* * Select the XInput devices you want by uncommenting this. * #define XInputDrivers mouse keyboard acecad calcomp citron \ digitaledge dmc dynapro elographics \ microtouch mutouch penmount spaceorb \ summa wacom void magictouch aiptek */ /* Most installs will only need this */ #define XInputDrivers mouse keyboard /* Disable building Xprint server and clients until we get them figured * out but build Xprint libraries to allow precompiled binaries such as * Acrobat Reader to run. */ #define XprtServer NO #define BuildXprintClients NO /* End Xorg host.def file */ EOF
There are several other options that you may want to consider. A well documented example file is config/cf/xorgsite.def.
Install Xorg by running the following commands:
sed -i -e "s@^#include <linux/config.h>@/* & */@" \
`grep -lr linux/config.h *` &&
( make World 2>&1 | tee xorg-compile.log && exit $PIPESTATUS )
Again as the root user:
make install &&
make install.man &&
ln -sf ../X11R6/bin /usr/bin/X11 &&
ln -sf ../X11R6/lib/X11 /usr/lib/X11 &&
ln -sf ../X11R6/include/X11 /usr/include/X11
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 occurences. If you desire, just remove (comment) the line in the appropriate video driver file if you customized host.def.
( make World 2>&1 | tee xorg-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 comand 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 Xorg, 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 -sf ../X11R6/bin /usr/bin/X11
ln -sf ../X11R6/lib/X11 /usr/lib/X11
ln -sf ../X11R6/include/X11 /usr/include/X11
These commands are present to enable other (broken) packages to build against Xorg, 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."
Edit /etc/ld.so.conf and add /usr/X11R6/lib. Run:
ldconfig
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 xorg.conf file with:
cd ~
Xorg -configure
The screen will go black and you may hear some clicking of the monitor. This command will create a file, xorg.conf.new in your home directory.
Edit xorg.conf.new to suit your system. The details of the file are located in the xorg.conf man page. 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". Specify the Device parameter to "/dev/input/mice" and Protocol to "auto" to set up your mouse. You may also 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 16. In the SubSection for your default depth, add a modes line such as: Modes "1280x1024" "1024x768". The first mode listed will normally be the starting resolution.
Test the system with:
X -config ~/xorg.conf.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, take a look at /var/log/Xorg.0.log to see what went wrong.
Move the configuration file to its final location:
mv ~/xorg.conf.new /etc/X11/xorg.conf
Create .xinitrc:
cat > ~/.xinitrc << "EOF" # Begin .xinitrc file xterm -g 80x40+0+0 & xclock -g 100x100-0+0 & twm EOF
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, Xorg creates the directory /tmp/.ICE-unix if it does not exist. If this directory is not owned by root, Xorg 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 Xorg 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 EOF
Start X with:
startx
to get a basic functional X Window System.
At this point, you should check out the section called “X Window System Components”.
For a list of the package contents and a description of the commands, see the sections in the XFree86 Contents and Descriptions.