Difference between revisions of "Cross-compiling QT/embedded"

From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
 
Line 78: Line 78:
  
 
Then run /usr/local/bin/ts_calib, and follow directions. Presto!
 
Then run /usr/local/bin/ts_calib, and follow directions. Presto!
 +
 +
= Building the Qt/embedded =
 +
 +
Now comes the tough stuff.
 +
I got the QT 4.5.2 and the QT 4.6 embedded distributions. They both work on OABI. Instructions here are for 4.6
 +
 +
== Modifications required ==
 +
 +
=== Color Fix ===
 +
 +
First,  the colors will be all wrong unless we force them to the correct configuration. Edit the file src/gui/embedded/qscreenlinuxfb_qws.cpp and before the line that says
 +
grayscale = vinfo.grayscale;
 +
 +
add the following lines:
 +
 +
  diff qscreenlinuxfb_qws.cpp  qscreenlinuxfb_qws.cpp.~1~
 +
  321,323d320
 +
  <    // HACK Force the green length to 6:
 +
  <    vinfo.green.length=6;
 +
 +
=== Startup Fix ===
 +
 +
Got an "segmentation violation" on startup? You have two choices, one is to add -debug to the config and get a slow build. The other is to edit the file src/gui/embedded/qscreenlinuxfb_qws.cpp
 +
and avoid the call to useOffscreen():
 +
 +
taro:embedded> diff qscreenlinuxfb_qws.cpp qscreenlinuxfb_qws.cpp.~2~
 +
427c427
 +
<    canaccel = false; // useOffscreen();
 +
---
 +
>    canaccel = useOffscreen();

Revision as of 20:22, 20 January 2010

QT/Embedded for the TS-7290

It has been a major pain to get a proper version of QT/embedded working on the TS-7290. The blog at automon was quite helpful.

Yes, you want TSLIB, otherwise the cursor does not follow where you touch the screen.

Prerequisites

You first need a decent (i.e. correctly build) cross compiler. For OABI I used binutils-2.18 with gcc 4.1.2. For EABI I used binutils-2.20 and gcc-4.4.2

OABI

To make binutils, get the source, untar it, create a "build-arm-linux-gnu" subdirectory and execute:

../configure --target=arm-linux-gnu --prefix=/net/home/maurik/cross-compile/arm-linux-gnu --with-sysroot=/net/home/maurik/cross-compile/arm-linux-gnu --with-local-prefix=/net/home/maurik/cross-compile/arm-linux-gnu --disable-nls --with-gcc --with-gnu-as --with-gnu-ld
make
make install

To make your compiler, get the sources, untar, create "build-arm-linux-gnu" subdir and execute:

 ../configure --target=arm-linux-gnu --prefix=/net/home/maurik/cross-compile/arm-linux-gnu --with-sysroot=/net/home/maurik/cross-compile/arm-linux-gnu --with-local-prefix=/net/home/maurik/cross-compile/arm-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-shared --enable-c99 --enable-long-long --enable-languages=c,c++
make 
make install

NOTE: YOU MUST MAKE THESE ON AN i386 TYPE MACHINE. On the x86_64 you get a different puppy which may not work. (didn't for me....)

EABI

To make binutils, get the source, untar it, create a "build-arm-linux-gnu" subdirectory and execute:

../configure --target=arm-linux-gnueabi --prefix=/net/home/maurik/cross-compile/arm-linux-gnueabi --with-sysroot=/net/home/maurik/cross-compile/arm-linux-gnueabi --with-local-prefix=/net/home/maurik/cross-compile/arm-linux-gnueabi --with-gcc --with-gnu-as --with-gnu-ld
make
make install

To make your compiler, get the sources, untar, create "build-arm-linux-gnu" subdir and execute:

../configure --target=arm-linux-gnueabi --prefix=/net/home/maurik/cross-compile/arm-linux-gnueabi --with-sysroot=/net/home/maurik/cross-compile/arm-linux-gnueabi --with-local-prefix=/net/home/maurik/cross-compile/arm-linux-gnueabi --enable-shared --enable-threads=posix --enable-nls --without-included-gettext --enable-clocale=gnu --enable-symvers=gnu --enable-languages=c,c++ --enable-shared --enable-c99 --with-system-zlib --enable-mpfr --disable-libssp CCFLAGS=-m32
make 
make install

NOTE: YOU MUST MAKE THESE ON AN i386 TYPE MACHINE. On the x86_64 you get a different puppy which may not work. (didn't for me....)

Other prereq's

You also need to make a copy of the ARM boards system libraries and include files. For either OABI or EABI, boot your board and create a tar file of the system:

 cd /
 tar czf /net/home/maurik/tmp/arm_libs.tgz  /usr/lib /usr/include /lib

You can exclude the /lib/modules and other junk, but why bother. Expand this tar file in the appropriate sysroot (/net/home/maurik/cross-compile/arm-linux-gnueabi)

Now: very important you need to fix up all the links in .../usr/lib that point to /lib and instead should point to ../../lib

TSLIB

Get the TSLIB from SVN: (svn co svn://svn.berlios.de/tslib/trunk/tslib tslib ) or get it from http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2

You need a patch, since the TS board does not give pressure info: http://projects.linuxtogo.org/pipermail/openembedded-commits/2009-July/029934.html (I hand edited this in, instead of using the patch.)

Now run:

 ./autogen.sh
 ./configure CC=arm-linux-gcc CXX=arm-linux-g++ PLUGIN_DIR=/net/home/maurik/cross-compile/arm-linux-gnu/usr/local/plugin -prefix=/net/home/maurik/cross-compile/arm-linux-gnu/usr/local -host=arm-linux
 OR
 ./configure CC=arm-linux-gcc CXX=arm-linux-g++ PLUGIN_DIR=/net/home/maurik/cross-compile/arm-linux-gnueabi/plugin -prefix=/net/home/maurik/cross-compile/arm-linux-gnueabi/ -host=arm-linux
 make
 make install

And on the arm board, in the tslib directory run

  ./configure
  make 
  make install
  export TSLIB_CONFFILE=/usr/local/etc/ts.conf
  export TSLIB_CALIBFILE=/etc/pointercal
  export TSLIB_CONSOLEDEVICE=none
  export TSLIB_TSEVENTTYPE=H3600
  export TSLIB_FBDEVICE=/dev/fb0
  export TSLIB_TSDEVICE=/dev/input/event0
  export TSLIB_PLUGINDIR=/usr/local/lib/ts

Then run /usr/local/bin/ts_calib, and follow directions. Presto!

Building the Qt/embedded

Now comes the tough stuff. I got the QT 4.5.2 and the QT 4.6 embedded distributions. They both work on OABI. Instructions here are for 4.6

Modifications required

Color Fix

First, the colors will be all wrong unless we force them to the correct configuration. Edit the file src/gui/embedded/qscreenlinuxfb_qws.cpp and before the line that says

grayscale = vinfo.grayscale;

add the following lines:

 diff qscreenlinuxfb_qws.cpp  qscreenlinuxfb_qws.cpp.~1~ 
 321,323d320
 <     // HACK Force the green length to 6:
 <     vinfo.green.length=6;

Startup Fix

Got an "segmentation violation" on startup? You have two choices, one is to add -debug to the config and get a slow build. The other is to edit the file src/gui/embedded/qscreenlinuxfb_qws.cpp and avoid the call to useOffscreen():

taro:embedded> diff qscreenlinuxfb_qws.cpp qscreenlinuxfb_qws.cpp.~2~ 
427c427
<     canaccel = false; // useOffscreen();
---
>     canaccel = useOffscreen();