tutorial: how to run X (with touch) on omap
David Cohen
david.cohen at indt.org.br
Tue Nov 16 14:23:26 CST 2004
Hi all!
I've made this tutorial about how to embbed the X with touchscreen
support (using the tslib) on OMAP platform. I hope it helps someone that
has doubt about it.
BR,
David Cohen
david.cohen at indt.org.br
10LE - Laboratorio de Linux Embarcado (Embbeded Linux Lab)
-------------- next part --------------
HOW TO MAKE THE OMAP RUN X WITH TOUCHSCREEN SUPPORT
This tutorial was made to help everyone that wants to make his OMAP run X with the touchscreen. We'll assume that you have a minimal experience with Linux and OMAP platform, your OMAP is running a kernel that already has a touchscreen driver and this touchscreen use the tslib (default for 2.6 kernel) and the root filesystem is on a desktop (on the /armfs_debian directory) and is mounted by nfs. And all this is already working well.
In this tutorial, all the commands on part 1 and 2 are made on desktop shell and the part 3 is made on OMAP shell.
Contents:
1 BUILDING THE TSLIB AND XSERVER (AND THEIR DEPENDENCES)
1.1 SCRATCHBOX
1.2 ZLIB
1.3 TSLIB
1.4 XLIBS
1.5 XSERVER
2 COPYING FILES TO THE OMAP FILESYSTEM
3 CONFIGURING THE OMAP TO RUNNING X WITH TOUCHSCREEN
3.1 SETTING UP TS.CONF
3.2 SETTING UP ENVIRONMENT VARIABLES
3.3 CALIBRATING THE TOUCHSCREEN
3.4 FINNISHING INSTALATION
4 FURTHER READING
5 AUTHOR
6 CHANGES
----------
1 BUILDING THE TSLIB AND XSERVER (AND THEIR DEPENDENCES)
The firs step is to build the zlib, tslib, xlibs and Xserver. We will use the scratchbox to help us with the cross compiling.
-----
1.1 SCRATCHBOX
If you don't have the scratchbox installed and don't know how to do it, you can take a look at the "Setting up the OMAP1710 H3" tutorial. Its reference is on the bottom of this turorial (part 4). But if you already have the scratchbox, so we need to configure the scratchbox to ARM/GLIBC options.
Type this command to start a scratchbox shell:
$ scratchbox
Follow these steps to configure the scratchbox to ARM/GLIBC options:
[sbox-: ~] > sbox-config -ct ARM-GLIBC
Available compilers:
0) arm-gcc-3.3.2-uclibc-snapshot-20040229
1) arm-linux-gcc-3.3_3.3.4-glibc-2.3.2.ds1
2) host-gcc
Enter compiler number: 1
Available CPU-transparency methods:
sbrsh
qemu-arm
qemu-ppc
Enter method name (qemu-arm): qemu-arm
Available devkits:
debian
Enter list of devkit names (none): debian
[sbox-: ~] > sbox-config -st ARM-GLIBC
[sbox-ARM-GLIBC: ~] > sbox-config -cc
-----
1.2 ZLIB
The zlib is a xlibs dependence. We have to download and install it:
[sbox-ARM-GLIBC: ~] > wget http://www.gzip.org/zlib/zlib-1.2.1.tar.bz2
[sbox-ARM-GLIBC: ~] > tar -xjvf zlib-1.2.1.tar.bz2
[sbox-ARM-GLIBC: ~] > cd zlib-1.2.1
[sbox-ARM-GLIBC: ~/zlib-1.2.1] > ./configure --prefix=/usr
[sbox-ARM-GLIBC: ~/zlib-1.2.1] > make install
[sbox-ARM-GLIBC: ~/zlib-1.2.1] > cd ..
-----
1.3 TSLIB
We have to download and instaling the tslib following these steps:
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:cvs at pubcvs.arm.linux.org.uk:/mnt/src/cvsroot login
Logging in to :pserver:cvs at pubcvs.arm.linux.org.uk:2401/mnt/src/cvsroot
CVS password: <Enter>
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:cvs at pubcvs.arm.linux.org.uk:/mnt/src/cvsroot co tslib
[sbox-ARM-GLIBC: ~] > cd tslib
Now we have to configure and build the tslib:
[sbox-ARM-GLIBC: ~/tslib] > ./autogen.sh
[sbox-ARM-GLIBC: ~/tslib] > ./configure --prefix=/usr --host=arm-linux-gnu
Edit the file config.h and comment the line "#define malloc rpl_malloc" to avoid this option:
"#define malloc rpl_malloc" -> "//#define malloc rpl_malloc"
[sbox-ARM-GLIBC: ~/tslib] > make
[sbox-ARM-GLIBC: ~/tslib] > make install
[sbox-ARM-GLIBC: ~/tslib] > cd ..
-----
1.4 XLIBS
The xlibs are dependences for the Xserver. We have to download and instaling it.
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:anoncvs at freedesktop.org:/cvs/ login
Logging in to :pserver:anoncvs at freedesktop.org:2401/cvs
CVS password: <Enter>
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:anoncvs at freedesktop.org:/cvs/ co xlibs
<It will take some time>
[sbox-ARM-GLIBC: ~] cd xlibs
Now you have to build these libs below:
Randr
Render
XExtensions
FixesExt
DamageExt
Xproto
xtrans
Xfont
Xau
CompositeExt
ResourceExt
RecordExt
Xdmcp
XCalibrateExt
X11
Xext
All you must to do is repeat the following commands changing the <lib> name for one lib in the list, keeping the same order that is displayed (from Randr to Xext):
[sbox-ARM-GLIBC: ~/xlibs] > cd <lib>
[sbox-ARM-GLIBC: ~/xlibs/<lib>] > ./autogen.sh --prefix=/usr --host=arm-linux-gnu
[sbox-ARM-GLIBC: ~/xlibs/<lib>] > make install
[sbox-ARM-GLIBC: ~/xlibs/<lib<] > cd ..
-----
1.5 XSERVER
And finally, follow theses commands to build and install the Xserver with framebuffer support. The target will be called Xfbdev.
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:anoncvs at pdx.freedesktop.org:/cvs/xserver login
Logging in to :pserver:anoncvs at pdx.freedesktop.org:2401/cvs/xserver
CVS password: <Enter>
[sbox-ARM-GLIBC: ~] > cvs -d :pserver:anoncvs at pdx.freedesktop.org:/cvs/xserver co xserver
<It will take some time>
[sbox-ARM-GLIBC: ~] > cd xserver
[sbox-ARM-GLIBC: ~/xserver] > ./autogen.sh
[sbox-ARM-GLIBC: ~/xserver] > ./configure --prefix=/usr --host=arm-linux-gnu --disable-glx --disable-dri --disable-ipv6 --disable-xglserver --disable-xglxserver --disable-xsdlserver --disable-xwinserver --disable-xnestserver
[sbox-ARM-GLIBC: ~/xserver] > make install
----------
2 COPYING FILES TO THE OMAP FILESYSTEM
In this step, we have to copy some compiled files to the filesystem (as it was said before, the root OMAP filesystem is on /armfs_debian).
Type this command to exit the scratchbox
[sbox-ARM-GLIBC: ~/xserver] > exit
Now, we'll copy the libs and the X to the OMAP filesystem
$ sudo cp -a /scratchbox/users/<omap_user>/targets/ARM-GLIBC/usr/lib/libts*so* /armfs_debian/usr/lib
$ sudo cp -a /scratchbox/users/<omap_user>/targets/ARM-GLIBC/usr/lib/ts /armfs_debian/usr/lib
$ sudo cp -a /scratchbox/users/<omap_user>/targets/ARM-GLIBC/usr/lib/libX*so* /armfs_debian/usr/lib
$ sudo cp -a /scratchbox/users/<omap_user>/targets/ARM-GLIBC/usr/lib/libfontcache*so* /armfs_debian/usr/lib
$ sudo cp -a /scratchbox/users/<omap_user>/targets/ARM-GLIBC/usr/bin/Xfbdev /armfs_debian/usr/X11R6/bin
$ sudo cp -a /scratchbox/users/<omap_user>/home/<omap_user>/tslib/tests/.libs/ts_calibrate /armfs_debian/usr/X11R6/bin
$ sudo cp -a /scratchbox/users/<omap_user>/home/<omap_user>/tslib/etc/ts.conf /armfs_debian/etc/ts.conf
----------
3 CONFIGURING THE OMAP TO RUNNING X WITH TOUCHSCREEN
The next steps are setting up the ts.conf and environment variables, calibrating the touchscreen and finnishing instalation. All those steps will be made on OMAP shell.
-----
3.1 SETTING UP TS.CONF
The OMAP platform uses the event layer for the touchscreen. So, we just need to edit the "/etc/ts.conf" file and uncomment the line "# module_raw input":
"# module_raw input" -> "module_raw input"
-----
3.2 SETTING UP ENVIRONMENT VARIABLES
We need to set up 2 variables: TSLIB_DEVICE and TSLIB_CONFFILE. The TSLIB_DEVICE is the device that the tslib will read datas from touchscreen, and the TSLIB_CONFFILE is the absolute PATH fot the ts.conf:
TSLIB_TSDEVICE=/dev/input/event1
TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_TSDEVICE TSLIB_CONFFILE
We can put it on the /etc/profile and the environment variables will always be read at the boot time.
-----
3.3 CALIBRATING THE TOUCHSCREEN
The data sent by the touchscreen device isn't proportional to the lcd. So, we need to calibrate it. All we need to do is execute the ts_calibrate and follow its instructions on the OMAP's lcd. After that, the /etc/pointercal will be create with calibrate data.
-----
3.4 FINNISHING INSTALATION
The last step is make the OMAP Linux knows those libraries that we copied before. Just type the ldconfig command:
# ldconfig
And have fun! :) Just type the Xfbdev commmand to run the X.
----------
4 FURTHER READING
- "Setting up the OMAP1710 H3" -> http://linux.omap.com/pub/documentation/omap_1710v1.4.txt
----------
5 AUTHORS
16. Nov 2004
10LE - Laboratorio de Linux Embarcado (Embedded Linux Lab)
David Cohen <david.cohen at indt.org.br>
----------
6 CHANGES
16. Nov 2004 - Carlos Aguiar <carlos.aguiar at indt.org.br>
- Fixed some wrong paths and file names
More information about the Linux-omap-open-source
mailing list