Kdrive, formerly known as TinyX, is a trimmed down X server written by Keith Packard, and also used in some Linux distributions targeted to handhelds, internet appliances and similar. Michael Fratoni has built kdrive servers that will work on Red Hat 8.0, as well as slimmed down rpm packages for Red hat 7.3 and 8.0. (UPDATE 2003/07/29: Added a paragraph on how to build Kdrive from stock Red Hat RPMs. See below)
Mandatory disclaimer
The information on this page is a cut-and-paste summary of what passed on the RULE mailing list between November 2002 and January 2003. Any error w.r.t the mailing list is my (M.Fioretti) fault only. This page will eventually become a useful resource for everybody who needs kdrive. In its current form, however, is little more than a draft, which needs review by Michael Fratoni and by all the RULE mailing list members. Of course, pointers to other kdrive resources online are much appreciated.
Pros and cons of kdrive
It does have a much smaller memory footprint, so in many cases it gives all and only the really needed features at a much smaller price. A partial top output from the first trials made with kdrive gives:
792 mfratoni 15 0 22756 22M 12384 S 15.3 59.8 1:19 mozilla-bin 720 root 15 0 7192 3600 1148 S 10.0 9.5 0:27 X
On the cons side, it doesn’t use the xfs font server, and doesn’t support true type fonts. Also, kdrive servers don’t use a config file. All options must be passed on the command line, or from inside the startx script. Michael also reports that the kdrive servers must be suid root to work, which is not a good thing. Maybe it is possible to use the old wrapper that X used for this purpose, but this has not been investigated yet
How to try the servers
If you just want to try the servers, grab one (hopefully compatable with your video hardware) there was one at http://www.tuxfan.homeip.net:8080/rule/XFree86/kdrive/8.0/
Install the server in /usr/X11R6/bin/ and then:
chmod 4711 (server) ln -s (server) X startx
The last step (creating the link) must be executed manually even in one builds and installs the XFree packages. Since, as already said, kdrive does not use configuration files at all, options can be passed to the server on the command line. If you create a link from /usr/X11R6/bin/X to the server you want to start, options can also be set in the /usr/X11R6/bin/startx script as “server options”. A working example of startx file, used by Michael on his laptop with an Xchips server, is available at http://www.tuxfan.homeip.net:8080/rule/XFree86/kdrive/startx
The (only??) line to customize is (to start in 800×600 mode, and emulate a 3 button mouse) this:
defaultserverargs="-screen 800x600x24 -2button
Richard Kweskin reports that “”after installing slinky-v0.3.5 with Redhat 8.0, using the XFree86 packages from slinky, just by replacing /usr/X11R6/bin/XFree86 with /usr/X11R6/bin/Xvesa from Michael’s servers and altering startx as Michael says, it works on two different boxes I have. One has graphics card S3 ViRGE (pci with 2MB memory), the other graphics card S3 Vision 968 (pci with 2MB memory.) The latter was not supported by XFree 4.2.0 but was said (on XFree web site) to possibly be supported by XFree86 4.2.1.”
How to build kdrive from source
Here are the steps that Michael Fratoni used to build kdrive. He installed the XFree86.src.rpm from the Red Hat 8.0 release to avoid downloading the source. Then I unziped, extracted the tar archive and changed firectory to /path/to/archive/xc/config/cf/. He then created a ‘host.def’ file containing what follows:
#define KDriveXServer YES #define TinyXServer YES #define XvesaServer YES #define ProjectRoot /usr/X11R6 #define BuildLBX YES #define BuildDBE YES #define KdriveServerExtraDefines -DPIXPRIV #define BuildRandR YES #define BuildXInputLib YES #define Freetype2Dir $(TOP)/extras/freetype2 #define Freetype2LibDir $(TOP)/exports/lib #define BuildXTrueType YES #define BuildScreenSaverExtYES #define BuildScreenSaverLibrary YES #define SharedLibXss YES #define ServerXdmcpDefines #define XfbdevServer YES
and executed the following commands:
cd ../../ make World cp programs/Xserver/Xfbdev [to the target system]/usr/X11r6/bin/
(in this case, the target system already had the full stock glibc and XFree86 packages installed). The defines above could probably use some work, but they did allow to build the servers. The only thing used at that stage were the server binaries. The next move would be to build everything again, but linking against uClibc, make an rpm package for both Xfree86 and uClibc, and test it on a slinky install.
How to build Kdrive from stock Red Hat RPMs
So far (see next paragraph) the procedure to build Kdrive was to make it a subpackage of Xfree86, This means rebuilding all of XFree86 just to make a small change in TinyX. On a slow machine, this can take several hours. Michael Fratoni has now worked out the following procedure to create a source rpm that builds just TinyX. (Even on an i586, this takes less than 15 minutes)
Install the stock XFree86 source rpm from the Red Hat 9 disks. (You should be doing this as a normal user, not root. If you need help setting up a non-root rpm build environment, see: http://www.tuxfan.homeip.net:8080/hack.html )
Install: http://www.tuxfan.homeip.net:8080/rule/XFree86/kdrive/9/XFree86-TinyX-4.3.0-7RULE.nosrc.rpm (The package contains nothing but a .spec file, it uses the stock XFree86 source to build.)
Build the TinyX package (again, as user)
rpmbuild -bb ${your_rpm_build_dir}/SPECS/XFree86-TinyX.spec
Rebuilding with this my spec file causes the rpmbuild process to unpack the sources and apply all the XFree86 patches, then replaces the host.def file with one that causes only TinyX to be built ( By using #define BuildServersOnly YES).
Now, modifying the TinyX build options is as simple as editing the spec file in the section where we write out the new host.def file, then rebuilding the package.
How to build kdrive RPM packages from XFree sources
RPM packages for Red Hat have actually been built for slinky, and they seem to work well. They are about half the size of the stock rpms. They also offer about half the functionality of the stock rpms.. These packages use the stock XFree.org 4.2.0 source, and are then patched to 4.2.1
during the build. (There was no full source for 4.2.1 posted, only a patch) file. Here is a little bit of size comparison:
5.3M XFree86-4.2.1-3RULE.i386.rpm 11M ../../devel/dist-8.0/stock/RedHat/RPMS/XFree86-4.2.0-72.i386.rpm 1.4M XFree86-libs-4.2.1-3RULE.i386.rpm 2.2M ../../devel/dist-8.0/stock/RedHat/RPMS/XFree86-libs-4.2.0-72.i386.rpm
In general, if you want to build rpm packages yourself, there are nosource rpm packages available. To begin with, you need the (3) X420src* packages from ftp://xfree86.org/pub/XFree86/4.2.0/source/ Then, you can build the packages using http://www.tuxfan.homeip.net:8080/rule/XFree86/XFree86-4.2.1-11RULE.nosrc.rpm . Remember, the nosrc package contains only the specfile, patches, and some source. It contains NONE of the XFree86.org source. Once you have the packages and nosource rpm, move everything to your rpm build environment SOURCES/ directory. Then, run ‘rpmbuild -bb XFree86.spec’ in that directory.The rpmbuild process will patch the source to 4.2.1, and build the xfree86 rpms, which will include the kdrive servers.
You’ll end up with minimal X packages. You can then install them, create a link to the server for your card (cd /usr/X11R6/bin; ln -s servers/? X
) Where ? is the name of the correct server. startx should then bring up an xsession. I’m using the Xfbdev server, which works much better than either the Xchips server or the Xvesa server on my hardware. Using the Xfbdev server requires making the framebuffer device available at boot time. I do it by adding vga=788
(for 800×600) to lilo.conf.
After the packages build, the resulting installation of XFree86 takes about 30M of disk space, and seems to run fine on my laptop with 40M of RAM. It actually is quite responsive running several small apps Slinky and Kdrive The package list for slinky uses the stock XFree packages, and
should satisfy all dependencies. It installs things you do not need with the kdrive server. For example, you can stop the xfs font server, and remove the package, kdrive doesn’t use it. The XFree source rpm put together installs a smaller X overall, with far fewer dependencies. It’s a big download, and takes some time to compile on a slower machine.
Michael tested kdrive on a slinky install on a P100 laptop, including base packages, network, laptop, web/communications, and ssh package sets. Disk usage was about 319M:
[root@conundrum root]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda2 2.7G 314M 2.3G 12% / none 18M 0 18M 0% /dev/shm /dev/hda1 95M 4.7M 87M 6% /boot
Then, he built and installed Xfree packages, plus fontconfig, freetype and fluxbox.
[root@conundrum root]# rpm -ivh XFree86-4.2.1-3RULE.i386.rpm XFree86-libs-4.2.1-3RULE.i386.rpm XFree86-tools-4.2.1-3RULE.i386.rpm XFree86-base-fonts-4.2.1-3RULE.i386.rpm XFree86-75dpi-fonts-4.2.1-3RULE.i386.rpm XFree86-font-utils-4.2.1-3RULE.i386.rpm XFree86-truetype-fonts-4.2.1-3RULE.i386.rpm XFree86-twm-4.2.1-3RULE.i386.rpm XFree86-xauth-4.2.1-3RULE.i386.rpm freetype-2.1.2-7.i386.rpm fontconfig-2.0-3.i386.rpm fluxbox-0.1.12-1.i386.rpm
After install and removal of the .rpm files, it looks like the X packages account for ~ 34M of disk usage. (348M v. 314M on /):
[root@conundrum root]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda2 2.7G 348M 2.2G 13% / none 18M 0 18M 0% /dev/shm /dev/hda1 95M 4.7M 87M 6% /boot
Creation of a link to the X server was necessary;
ln -s /usr/X11R6/bin/servers/Xfbdev /usr/X11R6/bin/X
Available servers for kdrive were:
# ls /usr/X11R6/bin/servers/ Xchips Xfbdev Xi810 Xigs Xmach64 Xsavage Xsis530 Xtrident Xtrio Xvesa
Right after that, a .xinitrc file was created to load the desktop (in the users /home directory), and the server was started:
[mfratoni@conundrum mfratoni]$ echo exec /usr/X11R6/bin/fluxbox > .xinitrc [mfratoni@conundrum mfratoni]$ startx
It took no more than 3 or 4 seconds to start up and have the fluxbox window manager running.
Documentation and online resources
“man Xkdrive” should provide some info and pointers to other man pages. there is a thread on the Xpert list about “ways to reduce the size of X”. Other online resources are:
- http://village.flashnet.it/users/fn048069/files/config/host.def
- http://www.pps.jussieu.fr/~jch/software/kdrive.html
- http://www.xfree86.org/pipermail/xpert/2001-March/006945.html
Pingback: RULE presentation at Linux@Work 2003, Tuscany | Run Up to date Linux Everywhere