http://hoegsberg.blogspot.com/2008/02/building-and-installing-drmdrix-stack.htmlBuilding and installing the DRM/DRI/X stackWhen I work on the X
stack I typically compile and install all the
packages into an install prefix in my home directory, typically
In previous Fedora
releases, the xorg-x11-server-devel package was called
xorg-x11-server-sdk.
To bring up an X server with DRI, we'll need to clone the drm, mesa, xserver, xf86-input-evdev and a video driver repository. By default, git will check out the master branch when you clone, but if you want to try a different branch of a repository you have to say
after cloning to check out the intel-batchbuffer branch First step is building drm
The For the rest of the builds, we'll need this environment variable set:
Now that we have libdrm
built and installed we can build mesa. Mesa doesn't use automake and
doesn't come with an
Optionally, pass Now we can build the X server. The configure script doesn't pick a good default for the font path, and the X server is going to bitch about this when we try to start it. I find that it's easiest just to built in the couple of core fonts the X server needs:
With the X server installed in the prefix, we can start building drivers. The X server installs a couple of autoconf macros that aclocal needs to be pointed to, so for building drivers we need to set the ACLOCAL variable to:
Having set this, building
the intel and evdev drivers is easy:
To run the new server I
usually just cd to $HOME/src/xserver/hw/xfree86
as root and run the Xorg binary there, but first load the DRM modules
we compiled above. You typically need to unload the old versions first
and then load the ones you compiled (assuming intel hardware):
Second, remember to set
after changing to root so
the X server picks up the right libdrm. The X server will
use the system xorg.conf from /etc/X11 by
default, but that can be changed by passing an option to the X server
configure script or passing the -config option to the
server.
To actually launch applications under the server I typically just use a lame hack such as
or more often I just run the X server and applications from a remote login. Before running direct rendering OpenGL applications, you need to the path to the DRI drivers:
and voila, you can now run OpenGL applications on your very own, hand-built X/DRI/DRM stack. It's not terribly useful for daily use, but I find that it's the best set up for developing and tracking upstream development. 7 comments: |

Nice tutorial! X.org development environment is not the friendliest possible to set up from scratch.
I wonder if it is possible to easily run the whole gnome/KDE desktop from a distro on top of a custom installed X.org? It's easy enough to start gnome-session, but at least on Ubuntu that does not set up everything correctly.
Kristian,
The equivalent "autogen.sh" in mesa is `make configure'. This will run aclocal and autoconf (and anything else in the future which might be needed).
Also, if you're setting LD_LIBRARY_PATH, you should pick up the libGL in $HOME/install. In that case, LIBGL_DRIVERS_PATH should not be needed since the correct path is built into libglx and libGL, right? I imagine this is more of a hangover from when it was difficult to set the correct path in mesa.
Seppo,
One way to use a local Xorg is to point GDM at your new server. The files might be different in Ubuntu, but on my system, you can look at the file /usr/share/gdm/defaults.conf to see how things are set in the [servers] section. Then you can add a local setting in /etc/gdm/custom.conf:
[servers]
# set the default server
0=foo
[server-foo]
name=Local server
command=/your/local/Xorg [options]
flexible=true
You'd also want to make sure that you've set LD_LIBRARY_PATH ahead of time or just add the library path to /etc/ld.so.conf.
Thanks a lot for this detailed description. This will help me sort all the bits and pieces I got to know about X.org building in my head!
Hmm I'm having no joy once I get to building the xserver stage. It fails on configure step trying to link to the mesa src tree:
=/home/alex/src/xhacking/mesa.git/src/mesa/ is not a dir
symlink-mesa.sh src-dir dst-dir
src-dir: the Mesa source directory
dst-dir: the GL subdirectory of the Xserver modular tree
configure: error: Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.
I've tried several points in the checked out mesa tree. Where exactly is it expecting the config to point to?
Alex:
It's in /mesa/src
not /src/mesa
The src dir was my own... sorry for confusion
checking for GL... yes
=/home/alex/src/xhacking/mesa.git/src/ is not a dir
symlink-mesa.sh src-dir dst-dir
src-dir: the Mesa source directory
dst-dir: the GL subdirectory of the Xserver modular tree
configure: error: Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.
07:37 a...@malory/AMD Athlon(tm) 64 Processor 3400+ [xserver.git] >ls /home/alex/src/xhacking/mesa.git/src/
Makefile descrip.mms egl glu glut glw glx mesa
And if I use the top level of the mesa src tree I get the same warning:
checking for GL... yes
=/home/alex/src/xhacking/mesa.git/ is not a dir
symlink-mesa.sh src-dir dst-dir
src-dir: the Mesa source directory
dst-dir: the GL subdirectory of the Xserver modular tree
configure: error: Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.
It just seems the configure script is broken.
after configuring drm, mesa, and while going ahead with xserver I am facing this below.. tried many times..
Please help...
make[1]: Leaving directory `/root/xserver/randr'
Making all in render
make[1]: Entering directory `/root/xserver/render'
../doltcompile gcc -DHAVE_CONFIG_H -I. -I../include -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/root/install/include -I/usr/include/freetype2 -I/usr/include/pixman-1 -I../include -I../include -I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi -I../miext/shadow -I../miext/damage -I../render -I../randr -I../fb -g -O2 -MT glyph.lo -MD -MP -MF .deps/glyph.Tpo -c -o glyph.lo glyph.c
glyph.c:33:26: error: openssl/sha.h: No such file or directory
glyph.c: In function ‘HashGlyph’:
glyph.c:217: error: ‘SHA_CTX’ undeclared (first use in this function)
glyph.c:217: error: (Each undeclared identifier is reported only once
glyph.c:217: error: for each function it appears in.)
glyph.c:217: error: expected ‘;’ before ‘ctx’
glyph.c:220: warning: implicit declaration of function ‘SHA1_Init’
glyph.c:220: warning: nested extern declaration of ‘SHA1_Init’
glyph.c:220: error: ‘ctx’ undeclared (first use in this function)
glyph.c:224: warning: implicit declaration of function ‘SHA1_Update’
glyph.c:224: warning: nested extern declaration of ‘SHA1_Update’
glyph.c:232: warning: implicit declaration of function ‘SHA1_Final’
glyph.c:232: warning: nested extern declaration of ‘SHA1_Final’
make[1]: *** [glyph.lo] Error 1
make[1]: Leaving directory `/root/xserver/render'
make: *** [all-recursive] Error 1
Let me know if you need any further details..
Thanks,