Handhelds.org splash banner Handhelds.org logo by Chrysovalandes Sophocleous
Building X for Handhelds

Building TinyX (Xipaq, Xfbdev) for Handhelds

Get the toolchain, X sources and kernel source trees

This instant, support is currently set up to cross-compile an fbdev server for an iPAQ H3600 using the Compaq touchscreen driver. Next on the list is further work on the touchscreen driver so that it can be completely generic across platforms.

Here is a summary of the process:

  1. Get and install a cross compilation tool chain. While native compilation is certainly possible, since the X code is easy to cross compile and one's x86 system is generally faster than native for the iPAQ handheld. The directions below presume you are using the CRL toolchain; you will have to make modifications to the cookbook below when using other toolchains.
  2. The X cross compilation system was updated after XFree86 4.2 shipped. The directions below are for this new system. To set up the cross tools appropriately, some links need to be added to /skiff/local/bin.
    #
    # This stuff is required for the Cross Compile Environment.
    #
    cd /skiff/local/bin
    
    for i in *; do 
       if [ $i !=  ${i/arm-linux-/} ]; then
            ln -s $i ${i/arm-linux-/} 
       fi
    done
    
    ln -s arm-linux-gcc cc
                        
  3. Get and setup a kernel source pool: you need the device driver header files to build against to get the touch screen driver definition. To get the source tree correctly configured, you need to execute the following commands (presuming you put your kernel source into /skiff/src/linux).
    cp /skiff/src/linux/kernel/arch/arm/def-configs/h3600  /skiff/src/linux/kernel/.config 
    cd /skiff/src/linux/kernel
    make oldconfig

    By making links into the cross compilation environment, you can arrange to use the kernel headers from the source pool, though you can copy the header files needed from our pool manually (note we still plan to complete the reorganization of the driver, which will remove this dependency and make the touch screen interface generic).

    #
    # Move these out of the way as they are supplied by the kernel.
    # The kernel header files distributed in the toolchain are quite obsolete
    # and you cannot successfully build against them.
    #
    if [ -d /skiff/local/arm-linux/include/linux && \
        ! -d /skiff/local/arm-linux/include/linux.old ]; then
        mv /skiff/local/arm-linux/include/linux /skiff/local/arm-linux/include/linux.old
    fi
    if [ -d /skiff/local/arm-linux/include/asm && \
        ! -d /skiff/local/arm-linux/include/asm.old ]; then
        mv /skiff/local/arm-linux/include/asm /skiff/local/arm-linux/include/asm.old
    fi
    # now create the links
    
    ln -s /skiff/src/linux/kernel/include/linux /skiff/local/arm-linux/include/linux
    ln -s /skiff/src/linux/kernel/include/asm /skiff/local/arm-linux/include/asm
    
                        
  4. Get a copy of the XFree86 CVS pool. I highly recommend using the cvsup tool for maintaining your shadow of the CVS pool (depending on how much you ask for, it can be as much as 500 megabytes), as it is much more efficient than a simple checkout. Using cvsup, it is entirely feasible to keep up with XFree86 development via a dialup line once an initial repository has been established. The instructions here presume XFree86 CVS, and in general are likely to track the development CVS rather than the less frequent releases.
  5. Read the XFree86 installation directions to get an overview of how configuration of the X distribution works.
  6. Set up your host.def file to specify which X server will be built.

The xc/config/cf/host.def file determines what server gets built.

The current host.def file I use is:

/*
 * This configuration file contains additional configuration needed
 * to cross compile X for the Compaq iPAQ handheld computer.
 * To use this, add the following to host.def:
   #define KDriveXServer YES
   #define XiPAQH3000Server YES
 */
#define KDriveXServer              YES
#define KdriveServerExtraDefines -DITSY -DMAXSCREENS=2
#define TinyXServer                YES
#define CrossCompiling             YES
#define TouchScreen                YES
#define ItsyCompilerBug            YES
#undef BuildRandR
#define BuildRandR                 YES
#define BuildXInputLib             YES
#define ProjectRoot                /usr/X11R6
#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
#define XipaqServer                YES
                

This tells the X configuration stuff to build the kdrive server (Keith's frame buffer driver, TinyX). It does *NOT* use the XFree86 configuration file found in desktop servers.

The configuration information for the iPAQ is found in the iPAQH3600.cf file in the xc/config/cf directory for the older version of cross compilation; this is not used by the new version implemented by Egbert Eich, where the information is passed in on the "make World CROSSCOMPILEDIR=/skiff/local/bin": (e.g. the cross compile paths and the like). The TouchScreen option compiles support for the touchscreen in the iPAQH3600: I will eventually clean up the header files so that iPAQ H3600 specific information does not appear in the X sources; this is the only thing at all specific to the iPAQ left; the server should run on any fbdev driver. The Xipaq server adds several drivers for PCMCIA graphics card.The RandR extension is built given the above configuration file. The CrossCompiling define tells the configuration file to use the information found in cross.def and cross.rules: if you do not use the handhelds.org toolchain, you'll have to customize the cross.def file appropriately.

To to customize for other targets, you may to replace the host.def file with one of your own, and you may need to modify the kdrive.cf file (which is what includes the iPAQH3600.cf file).

Build X

cd xc; make World CROSSCOMPILEDIR=/skiff/local/bin
                

The CROSSCOMPILEDIR directive tells X where to find its cross compilation binaries.

Native builds should be similar to the above, without all the horsing around; but much slower.

The Server and Libraries

The server used on the iPAQ handhelds is Xipaq, which will be in xc/programs/Xserver after make World completed; it also builds an Xfbdev server just for use on frame buffers.

Modified Tuesday, May 28, 2002 by Jim.Gettys@hp.com


$Id: building-x.html,v 1.11 2003/07/19 00:22:29 pb Exp $