[RULE] kdrive update
Richard Kweskin
rkwesk at mail.ariadne-t.gr
Tue Oct 14 16:52:06 EEST 2003
Hello All
Presented here for the list to see is a draft of an updated documentation on kdrive. Hence introduction and observations you have already seen, plus additions:
Richard
==========================================
The RULE kdrive resource page
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 and 9 as well as slimmed down rpm packages for
Red hat 7.3, 8.0 and 9.
Mandatory disclaimer
The information on this page has been updated October 2003 from an earlier draft and the RULE mailing list. Of course, pointers to other kdrive resources online are much appreciated. It remains a work in progress and subsequent discussion through the list will always yield the best results.
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:
-PRE
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
-/PRE
Even when xkb has been added (unlike the above example) and is running a setup using two character sets, us and el (which is used for modern Greek) the memory footprint has only grown a tolerable amount.
713 root 15 0 10412 8876 924 S 3,2 14,3 5:51 0 X
620 rkwesk 15 0 20060 18M 8712 S 27,1 30,3 5:51 0 MozillaFirebird
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 startup 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
The Slinky iso contains the rpm (look for TinyX, the older name) that will install the servers and a script that makes the necessary adjustments to a previous XFree86 install. Also, a manual method exists if you just want to try the servers, grab one (hopefully
compatable with your video hardware, often Xvesa) here:
http://www.tuxfan.homeip.net:8080/rule/XFree86/kdrive/9/
Install the server in /usr/X11R6/bin/ and then:
-PRE
chmod 4711 (server)
ln -s (server) X
startx
-/PRE
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 800x600 mode,color depth is 24
and emulate a 3 button mouse) this:
-PRE
defaultserverargs="-screen 800x600x24 -2button
-/PRE
XKB
kdrive is very versatile and if additional features are desired they need only be compiled in. One of these is xkb, the extended keyboard. For those users who desire additional character sets, e.g. Richard Kweskin uses English and modern Greek, kdrive with xkb provides it just as with XFree86. However, as mentioned above, kdrive does not use a config file. A workable solution used by Richard Kweskin is to run a short script invoking setxkbmap, after kdrive has started, with the line:
exec /usr/bin/X11/setxkbmap -v 1 -model pc105 -layout us,el -option -option grp:alt_shift_toggle
-v 1 prevents confusing messages, an empty -option before the next prevents merging of previous options and the last -option enables a keyboard toggle between the two character sets. See man setxkbmap for more detail.
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:
-PRE
#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 BuildScreenSaverExt YES
#define BuildScreenSaverLibrary YES
#define SharedLibXss YES
#define ServerXdmcpDefines
#define XfbdevServer YES
-/PRE
and executed the following commands:
-PRE
cd ../../
make World
cp programs/Xserver/Xfbdev [to the target system]/usr/X11r6/bin/
-/PRE
(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)
-PRE
rpmbuild -bb ${your_rpm_build_dir}/SPECS/XFree86-TinyX.spec
-/PRE
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:
-PRE
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
-/PRE
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
800x600) 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 testedkdrive on a slinky install on a P100 laptop,
including base packages, network, laptop, web/communications,
and ssh package sets. Disk usage was about 319M.
-PRE
[root at 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
-/PRE
Then, he built and installed Xfree packages, plus
fontconfig, freetype and fluxbox.
-PRE
[root at 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
-/PRE
After install and removal of the .rpm files, it looks like the
X packages account for ~ 34M of disk usage. (348M v. 314M on
/):
-PRE
[root at 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
-/PRE
Create a link to the X server needed;
-PRE
ln -s /usr/X11R6/bin/servers/Xfbdev /usr/X11R6/bin/X
-/PRE
Available servers for kdrive were:
-PRE
# ls /usr/X11R6/bin/servers/
Xchips Xfbdev Xi810 Xigs Xmach64 Xsavage Xsis530 Xtrident Xtrio Xvesa
-/PRE
Right after that, a .xinitrc file was created to load the
desktop (in the users /home directory), and the server was started:
-PRE
[mfratoni at conundrum mfratoni]$ echo exec /usr/X11R6/bin/fluxbox > .xinitrc
[mfratoni at conundrum mfratoni]$ startx
-/PRE
It took no more than 3 or 4 seconds to start up and have the
fluxbox
Documentation and online resources
"man Xkdrive" should provide some info and pointers to
other man pages.
A thread on the Xpert list about "ways to reduce the size of
X": http://www.xfree86.org/pipermail/xpert/2002-November/thread.html
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
_______________________________________________
Original home page of the RULE project: www.rule-project.org
Original Rule Development Site http://savannah.gnu.org/projects/rule/
Original RULE mailing list: Rule-list at nongnu.org, hosted at http://mail.nongnu.org/mailman/listinfo/rule-list
This full static mirror of the Run Up to Date Linux Everywhere Project mailing list, originally hosted at http://lists.hellug.gr/mailman/listinfo/rule-list, is kept online by Free Software popularizer, researcher and trainer Marco Fioretti. To know how you can support this archive, and Marco's work in general, please click here