Next Previous Contents

## 4. Getting started

This chapter describes the necessary installation steps to develop for opie.

It includes the installation and specialities of several crosscompilers followed by a quick introduction into the necessary arm kernel installation and compilation.

You may want to test / debug your own programs on your x86 host, instead of try and error search on the handheld. This is possible using the Trolltech QVFB tool. The installation and usage of this tool is described at the end of this chapter. This is the reason, why you have to prepare the `qt2opie-emb and opie-emb` versions (see further below).

After that is done, the installation, configuration and compilation of QTE and OPIE (embedded and arm) is discussed to prepare the reader to write his own applications and share the opie community.

Before this is executed, we will go through some automation scripts to make live easier, if the first try does not work (very likely this will happen).

The content of this chapter may sound very boaring, but the steps described here are absolutely necessary to get success developing your own stuff. So follow the sections step by step and prepare everything to go ahead.

## 4.1 Installing and preparing a cross compiler

The author assumes that you are using a linux machine for OPIE development. Using "Redmond products" is not the scope of this document (and in fact I am not sure, if it is possible to do so, as I am a LinuxOnlyUser).

Before we start with the crosscompiler download and installation, we have to mention some important hints.

1. The crosscompiler has to be installed in its "native" directory. Native means here, that the compiler has to be located in the directory, where it has been compiled. You can find out the destination directory, using the cross-ldd (which will not work on a x86 machine). Just call the ldd shipped with the cross-compiler using the absolute path and let it call a binary. The error-message will contain the absolute path to the program used during compilation. If you have less space in that location, just set a convenient link.
2. The second item you may struggle on will occur, if the environment variable $LD_LIBRARY_PATH (or an entry in /etc/ld.so.conf) is set to the arm-cross-compiler lib dir, or your actual path ($PWD) is located in the cross-lib dir. In this case you may have strange error prints. E.g you may not be able to call "ls -ls", because the system takes the arm glibc, which is not executable. Assuming LD_LIBRARY_PATH and /etc/ld.so.conf is not set to $COMPILER_PATH/lib and it is necessary to link a lib in the cross-compilers lib directory, you have to do that from the directory below. Just use `"ln -s lib/libxxx.so.2.2.2 libxxx.so" (yes, no "lib/" header for the link)` to do that.
3. The last mentioned item leads to some elementary rules how to prepare your system for cross development. Never use /etc/ld.so.conf for cross-lib searching. If $LD_LIBRARY_PATH is used, be carefull using x86 commands. They may not work.

Additional to the "raw" cross-compiler you will need the arm libs and binutils. If we talk about cross-compiler in this document, we mean always "toolchain", which includes the compiler itself as well as the libs and binutils.

### Opie special extension

Also some "special" libs and include files are required for opie development. To collect them for e.g. the ipaq, go the described way.

- Create a dir `addopie/ipaq`.
- Find out, what (lib) is missing using the opie build error messages (arm).
- Install the required library on you iPaq if not yet installed. (use ipkgfind on hh.org to find the package).
- Copy the installed (lib) files from the ipaq into your `addopie/ipaq/lib` dir (create lib dir, if not existing). Set all required links.
- "Organize" the header files (same or similar should be installed on your linux-box). If not download the appropriate source files (use e.g. google to find them). Copy them into `addopie/ipaq/influce` dir (create include dir, if not existing).

I have packed some addons together (familiar 0.6.2 and opie 1.0.2) into a tarball. They should also work for familiar 0.7.1 and further opie version. If not, let me know and I will provide new ones. The tarball is downloadable from http://www.uv-ac.de/opiedev/addtchn_opie_0.1.1_arm.tgz approx. 650kByte.

The following listing contains the actual version of that directory (version is from 09.11.2003).

> `

>     drwxr-xr-x root/root         0 2003-11-08 21:49:22 include/
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 include/png.h -> libpng12/png.h
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 include/pngconf.h -> libpng12/pngconf.h
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 include/libpng -> libpng12
>     drwxr-xr-x root/root         0 2003-03-09 19:12:21 include/libpng12/
>     -rw-r--r-- root/root    136344 2003-03-09 19:12:21 include/libpng12/png.h
>     -rw-r--r-- root/root     40873 2003-03-09 19:12:21 include/libpng12/pngconf.h
>     -rw-r--r-- root/root      1258 2003-03-09 19:12:28 include/jconfig.h
>     -rw-r--r-- root/root     12458 2003-03-09 19:12:28 include/jmorecfg.h
>     -rw-r--r-- root/root     46205 2003-03-09 19:12:28 include/jpeglib.h
>     -rw-r--r-- root/root      7810 2003-03-09 19:15:47 include/zconf.h
>     -rw-r--r-- root/root     40898 2003-03-09 19:15:47 include/zlib.h
>     drwxr-xr-x root/root         0 2003-11-08 21:49:22 include/security/
>     -r--r--r-- root/root      2473 2003-11-08 21:49:22 include/security/_pam_aconf.h
>     -rw-r--r-- root/root      2847 2003-11-08 21:49:22 include/security/_pam_compat.h
>     -rw-r--r-- root/root      5809 2003-11-08 21:49:22 include/security/_pam_macros.h
>     -rw-r--r-- root/root     12301 2003-11-08 21:49:22 include/security/_pam_types.h
>     -rw-r--r-- root/root      3294 2003-11-08 21:49:22 include/security/pam_appl.h
>     -rw-r--r-- root/root      7250 2003-11-08 21:49:22 include/security/pam_client.h
>     -rw-r--r-- root/root      1147 2003-11-08 21:49:22 include/security/pam_filter.h
>     -rw-r--r-- root/root      1970 2003-11-08 21:49:22 include/security/pam_misc.h
>     -rw-r--r-- root/root      6451 2003-11-08 21:49:22 include/security/pam_modules.h
>     drwxr-xr-x root/root         0 2003-11-09 07:08:58 lib/
>     -rwxr-xr-x root/root    127368 2003-03-09 19:11:13 lib/libjpeg.so.62.0.0
>     -rwxr-xr-x root/root    195020 2003-03-09 19:11:20 lib/libpng.so.3.1.2.1
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libjpeg.so.62 -> libjpeg.so.62.0.0
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libjpeg.so -> libjpeg.so.62.0.0
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libpng.so.3 -> libpng.so.3.1.2.1
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libpng.so -> libpng.so.3.1.2.1
>     -rwxr-xr-x root/root     80382 2003-03-09 19:14:46 lib/libz.a
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libz.so.1 -> libz.so.1.1.2
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libz.so -> libz.so.1.1.2
>     -rwxr-xr-x root/root     69866 2003-03-09 19:14:46 lib/libz.so.1.1.2
>     -rwxr-xr-x root/root    328448 2003-03-11 20:37:36 lib/libfreetype.so.6.3
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libfreetype.so.6 -> libfreetype.so.6.3
>     lrwxrwxrwx root/root         0 2003-04-06 08:18:19 lib/libfreetype.so -> libfreetype.so.6.3
>     -rwxr-xr-x root/root     29820 2003-11-08 21:48:08 lib/libpam.so.0.72
>     -rwxr-xr-x root/root      7568 2003-11-08 21:48:21 lib/libpam_misc.so.0.72
>     drwxr-xr-x root/root         0 2003-11-08 21:54:30 lib/security/
>     -rwxr-xr-x root/root     45484 2003-11-08 21:54:30 lib/security/pam_unix.so
>     lrwxrwxrwx root/root         0 2003-11-09 07:08:42 lib/libpam.so -> libpam.so.0.72
>     lrwxrwxrwx root/root         0 2003-11-09 07:08:44 lib/libpam.so.0 -> libpam.so.0.72
>     lrwxrwxrwx root/root         0 2003-11-09 07:08:56 lib/libpam_misc.so -> libpam_misc.so.0.72
>     lrwxrwxrwx root/root         0 2003-11-09 07:08:58 lib/libpam_misc.so.0 -> libpam_misc.so.0.72

> `

The user has to extract it to a newly created dir e.g. addopie/ipaq on the opie source dir level and set an environment variable ADDOPIE appropriately (done by the further down described scripts). `tar xvfz addtch_opie_0.1.1_arm.tgz -C /where/yourAddopieDirIs/ipaq` will extract the additional stuff into the addopie/ipaq dir. Use ipaq or sharp to probably differ library versions.

Hint
Because the sharp toolchain is the only compiler compiling a native qt-embedded for zaurus use, you should use this compiler suite, if you plan to develop for the openzaurus project.

Before that is possible, you have to install the cross compiler (toolchain). The next sections explain the installation of several free available toolchains.

As we will use some environment variables later to automize the build process of arm binaries we will introduce the first one here. $COMPILER_PATH points to the base dir of the compiler suite. As all described toolchains use different base dirs, we will describe the definition of the $COMPILER_PATH in every toolchain section.

Before we describe the tested toolchains, here is a quick overview, which toolchain fits your needs.

- sharp SDK
  The sharp SDK is the only one which can be used for the sharp zaurus target.
- hh skiff toolchain
  The skiff toolchain shows some ANSI C errors during the opie build process, that were not solvable from me until now. Nevertheless, I will go on to investigate that.
  NoteWrite me, if you know what is the problem.
- hh gcc-2.95.3 toolchain
  The 2953 toolchain (so called from here) is working when developing for the IPAQ. It is not usable for the zaurus, as some special include files are missing.
- suse 7.3 toolchain
  The SuSE7.3 toolchain shows soem errors during qte build process. I will go on to investigate that.
  NoteWrite me, if you know what is the problem.
- lisa netwinder toolchain
  The netwinder toolchain is working when developing for the IPAQ. It is not usable for the zaurus, as some sharp special include files are missing.
- Several gcc 3.2 toolkits
  They are described here, as they are they are able to compile the PXA kernels (gcc 2.x are not). This toolchains will be standard in the near future for development. But as it is still an unstable state and you have to use glibc 2.3.x, which has a total different interface, than the glibc-2.2.x versions, opie development (and familiar) stay on 2.95.x at the moment.

Important kdevelop hint
As kdevelop standardly uses `arm-linux-cpp` as the C-preprocessor you sould set a link in your the compilers bin dir, if necessary. A `ln -s cpp arm-linux-cpp` should do it.

### Sharp SDK

Since the Sharp Zaurus came to the market, Sharp supports the community with development tools for that target. As the Zaurus uses the sa11xx processor (as also the IPAQ), we can use that SDK for both platforms (IPAQ and Zaurus).

You can download some rpm packages from

http://www.zaurus.com/dev/tools/other.htm.

You should create your own sharpdevtools dir and place the downloads there.

1. Cross Compiler (gcc)
2. Libraries (glibc)
3. Utility Tools (other than gcc)
4. Header Files

The result are 4 rpm-packages, that can be installed using `rpm -ivh binutils-cross-arm-2.11.2-0.i386.rpm` an so on for all 4 packages.

The packages are installed to /opt/Embedix/tools. The directory ./arm-linux contains all binutils, includes and libraries, while ./bin contains the arm-linux compiler suite and ./lib the arm-gcc-lib. The directory ./arm-linux/bin contains links to the arm-compiler suite using the standard names (without arm-linux extension) and some additional stuff.

The $COMPILER_PATH is `/opt/Embedix/tools` (see also here).

### Handhelds skiff toolchain

Before you go ahead, you should know, that the skiff toolchain is not able to compiler opie itself, as the linker does not recognise some used linker commands.

You can download the skiff-toolchain from http://handhelds.org/download/toolchain/.

You should create your own hhtools dir and place the downloads there.

1. arm-linux-toolchain-current.tar.gz

This contains all necessary parts of a toolchain. Unpack it, where you have space enough. `tar xvfz arm-linux-toolchain-current.tar.gz` and set a link from your root dir `ln -s /opt/armtoolchain/hh/skiff /skiff` (assuming you unpacked the tar.gz archive to /opt/armtoolchain/hh).

The $COMPILER_PATH is `/skiff/local` (see also here).

### Suse 7.3 toolchain

You can download the suse-toolchain (rpm) from

ftp://ftp.suse.com/pub/suse/i386/7.3/suse/d4/.

You should create your own suse dir and place the downloads there.

1. cross-arm-binutils
2. cross-arm-gcc
3. cross-arm-glibc
4. cross-arm-lx_suse
5. cross-arm-termcap

The result are 5 rpm-packages, that can be installed using `rpm -ivh cross-arm-binutils.rpm` an so on for all packages.

The packages are installed to /opt/cross. The directory ./arm-linux contains all binutils, includes and libraries, while ./bin contains the arm-linux compiler suite and ./lib the arm-gcc-lib. The directory ./arm-linux/bin contains links to the arm-compiler suite using the standard names (without arm-linux extension) and some additional stuff.

The $COMPILER_PATH is `/opt/cross` (see also here).

### Handhelds cross-gcc-2.95.3

You can download the handhelds-toolchain from http://handhelds.org/download/toolchain/.

You should create your own hhtools dir and place the downloads there.

1. cross-2.95.3.tar.bz2

This contains all necessary parts of a toolchain. Unpack it, where you have space enough. `bunzip2 cross-2.95.3.tar.bz2;tar xvf cross-2.95.3.tar` and set a link from the dir /usr/local, where the native compiler path is located (see above). `ln -s /opt/armtoolchain/hh /usr/local/arm` (assuming you unpacked the tar archive to /opt/armtoolchain/hh - resulting in a subdirectory 2.95.3).

The $COMPILER_PATH is `/usr/local/arm/2.95.3` (see also here).

### OpenZaurus cross-gcc-3.2 (for H5400 and iPaq 3970 use / XSCALE )

This toolchain is the only one described here which is able to compile the kernel-sources for XSCALE Processors (H5400, IPAQ3970, SL5600).

You can download the handhelds-toolchain from http://openzaurus.org/official/toolchain/.

You should create your own openzaurustools dir and place the downloads there.

1. cross-3.2-oz-2.tar.bz2

This contains all necessary parts of a toolchain. Unpack it, where you have space enough. `bunzip2 cross-3.2-oz-2.tar.bz2;tar xvf cross-3.2-oz-2.tar` and set a link from the dir /usr/local, where the native compiler path is located (see above). `ln -s /opt/armtoolchain/oz/32 /usr/local/arm/3.2` (assuming you unpacked the tar archive to /opt/armtoolchain/oz - resulting in a subdirectory 3.2).

The $COMPILER_PATH is `/usr/local/arm/3.2` (see also here).

### Handhelds cross-gcc-3.2 (for H5400 and iPaq 3970 use / XSCALE )

This toolchain is the only one described here which is able to compile the kernel-sources for XSCALE Processors (H5400, IPAQ3970).

You can download the handhelds-toolchain from http://handhelds.org/download/toolchain/.

You should create your own hh32 dir and place the downloads there.

1. arm-linux-gcc-3.2.3-pre+binutils-2.13.1-030331.tgz
2. arm-linux-glibc-2.3.1.tgz

This contains all necessary parts of a toolchain. Unpack it, where you have space enough. `tar xvfz arm-linux-gcc-3.2.3-pre+binutils-2.13.1-030331.tgz;tar xvfz arm-linux-glibc-2.3.1.tgz` and set a link from the dir /usr/local, where the native compiler path is located (see above). `ln -s /opt/armtoolchain/hh/32 /usr/local/arm/3.2` (assuming you unpacked the tar archive to /opt/armtoolchain/hh - resulting in a subdirectory 3.2).

The $COMPILER_PATH is `/usr/local/arm/3.2` (see also here).

### Netwinder toolchain (LISA Developer CD)

I am still using the netwinder toolchain, which was shipped from LISA with the first preinstalled IPAQ 3630 PDAs on the developer CD. This toolchain works fine, but is a little antiquated.

It still is based on gcc 2.95.1. My installation is a little strange. The COMPILER_PATH is /usr/local/arm-linux. Beside the bin, lib, ... dirs it contains a subdir arm-linux, which contains additionally all includes, libs, etc ...

Additional libs/include (as the above described addtch*.tgz) have to be installed to /usr/local/arm-linux.

The netwinder page was off the internet for a while, but is back right now. You can find the compiler and the binutils, and glibc here http://www.netwinder.org/tools.html.

Important Hint : Dont load the armv4l packages from the netgwinder page. They are for native arm development and will overwrite your i386 compiler suite when installed via rpm.

The $COMPILER_PATH is `/usr/local/arm-linux` (see also here).

## 4.2 Preparing the environment scripts

The scope of this section is to automize the build process using the powerfull linux shell utilities. It assumes, that you are using /bin/bash as your standard shell. If not, you have to adopt the used scripts to your needs.

The next subsection will describe the general features of this approach. The following chapters will show the scripts for the different toolchains, as well as the script for x11- and QT-embedded use (which is infact something like a cross-environment).

The handbook will provide you with the scripts for all discussed toolchains. As you select only one toolchain above, you have to select only one toochain script.

All scripts are downloadable from this page ( see downloads ).

### General method

The method is based on using different environment variables for different purposes. The result will be an interactive shell script requesting the needed configuration parameters, setting the appropriate environment variables and starting the build process from inside the script (where the environment variables are available).

The scripts name scheme is `.goqtopiexxxrc` where xxx is e.g. `armsharp` to describe the arm target and the sharp compiler.

The scripts described here can also be used to switch your shell environment to e.g. `Arm-Development`. To have easy access, you may want to modify your (and roots) `.bashrc` script. Insert some alias lines into the `.bashrc` with the following structure.

`alias qtopienetwinder='/bin/bash --rcfile ~/.goqtopiearmnetwinderrc'`. The full script extension is presented here. If done so and logged off/on again, you can enter `qtopienetwinder` to switch to netwinder envrionment. Your terminal will change the prompt to inform you which environment is active.

Included in that scripts we find the extra include paths and extra lib paths. We use

- EXTRA_INC_PATH
  The extra include path used in our tutorial. This path is copied into CXXFLAGS_EXTRA and CFLAGS_EXTRA used during opie development.
- EXTRA_LIB_PATH
  The extra library path used in our tutorial. This path is copied into LDFLAGS_EXTRA and LFLAGS_EXTRA used during opie development.

So far everything is prepared to go ahead with the definition of the compiler environment scripts (which are commented and describe themselves). As an example for arm cross compilation only the sharp script is printed here.

All the other arm scripts look very similar. You can download them (see here).

### Sharp

This subsection shows the script `.goqtopiearmsharprc`. In principle it defines some "SEARCH PATH" and the c

#!/bin/bash # # .goqtopiearmsharprc # 11.10.03 - sc V0.1.6 # 09.11.03 - sc V0.1.7 # ------------------------------------------------- # sets some Environment variables for QT OPIE # Crosscompiling (arm) # ------------------------------------------------- TEMPFILE="$HOME/_sharpprep.tmp"

if [ -e $TEMPFILE ];then . $TEMPFILE fi

# PATHs ..... # Compiler-Path is the directory, where your Cross-compiler # is located. It is used to find the compiler includes. COMPILER_PATH=$TCDPATH/Embedix/tools # Kernel-Path is the directory, where your ARM-Kernel # is located. It is used to find the kernel includes and libraries. # Note !!! If you are using different kernelversions (like me) # set a link to the destination kernel. By changing the link # you can easily change the kernel-version. KERNEL_PATH=$TCDPATH/linux-arm-kernel # QVFB_PATH is the directory, where the QT-Framebuffer is located. QVFB_PATH=$TCDPATH/bin # QTDIR is the directory, where the QT-ARM-Directory is located. QTDIR=$TCDPATH/qt2opie-sharp # QPEDIR is the directory, where the QPE-ARM-Directory is located. QPEDIR=$TCDPATH/opie-sharp OPIEDIR=$TCDPATH/opie-sharp ADDOPIE=$TCDPATH/addopie/sharp # PATH has to be added by QTDIR QVFB and COMPILER-PATH bins. PATH=$QTDIR/bin:$QVFB_PATH:$COMPILER_PATH/bin:$PATH # MANPATH has to be added by QTDIR mans. MANPATH=$QTDIR/man:$MANPATH export COMPILER_PATH KERNEL_PATH export QTDIR PATH MANPATH QVFB_PATH export QPEDIR OPIEDIR ADDOPIE UICPATH=$QTDIR/bin UIC=$QTDIR/bin/uic export UICPATH UIC

# ------------------------------------------------- # QTLINKLOCATION ..... export QTLINKBASE=$TCDPATH

# ------------------------------------------------- # Extensions ..... # Extensions maybe used, if you run self-created Makefiles to # compile for ARM and EMB / QT. _EXT=arm.o SO_EXT=arm.so LIB_EXT=arm.so HEADER_EXT=arm.h CPP_EXT=arm.cpp export _EXT SO_EXT LIB_EXT HEADER_EXT CPP_EXT

# ------------------------------------------------- # Include PATHs ..... # INCLUDE-PATHs are used to add extra include paths EXTRA_INC_PATH="-I$QTDIR/include \ -I$OPIEDIR/include \ -I$KERNEL_PATH/include \ -I$COMPILER_PATH/include \ -I$TCDPATH/include/sharp \ -I/usr/local/include-arm" # CXXFLAGS_EXTRA and CFLAGS_EXTRA are used during # OPIE compilation itself CXXFLAGS_EXTRA=$EXTRA_INC_PATH CFLAGS_EXTRA=$EXTRA_INC_PATH

# Libnrary PATHs ..... # LIBRARY-PATHs are used to add extra library paths EXTRA_LIB_PATH="-L$QTDIR/lib \ -L$OPIEDIR/lib \ -L$KERNEL_PATH/lib \ -L$COMPILER_PATH/lib \ -L$TCDPATH/lib/sharp \ -L/usr/local/lib-arm" # LDFLAGS_EXTRA and LFLAGS_EXTRA are used during # OPIE linking itself LDFLAGS_EXTRA=$EXTRA_LIB_PATH LFLAGS_EXTRA=$EXTRA_LIB_PATH

export EXTRA_INC_PATH EXTRA_LIB_PATH export CXXFLAGS_EXTRA CFLAGS_EXTRA LDFLAGS_EXTRA LFLAGS_EXTRA

# ------------------------------------------------- # Installation PATHs ..... # Install-PATHs are used to define the installation PATH # for self created libs (used for qt/emb/arm) LIB_INST_PATH=/usr/local/lib-arm INC_INST_PATH=/usr/local/include-arm export LIB_INST_PATH INC_INST_PATH

# ------------------------------------------------- # Programs ..... # some Makefiles use the follwing Environment variables # to find the right compiler / linker CC=arm-linux-gcc CXX=arm-linux-g++ CCX=arm-linux-gcc CXXX=arm-linux-g++ COMPILER=arm-linux-gcc LINKER=arm-linux-ld # the strip-program (strips down the size of the binary # deleting all debug-information) STRIP_PROG=$COMPILER_PATH/bin/strip # some Makefiles use the follwing Environment variable # to define a preprocessor PREPROCESSCMD="$COMPILER -E" export STRIP_PROG COMPILER LINKER PREPROCESSCMD CC CXX CCX CXXX

# ------------------------------------------------- # Libraries ..... # define extra libraries XT_LIB="-lqte -lqpe -lopie" KDEVXT_LIB="-lopie" export XT_LIB KDEVXT_LIB

# ------------------------------------------------- # Extra Options ..... # used extra options for your compiler # QWS_OPIE von sc wegen colorDialog, fileDialog, etc OPTIONS="-DQT_QWS_IPAQ -DQWS -DQWS_OPIE -fno-exceptions -fno-rtti -pipe" export OPTIONS

# set the prompt ... PS1="[QT-CDOPIESHARP]:\w\$ " ompiler name environment variables used by most makefiles. A trailing prompt definition allows the user to realize, which environment is actualy active.

The script is well documented (selfexplaining), so we do not explain it here more that that.

> `

>     #!/bin/bash
>     #
>     # .goqtopiearmsharprc
>     # 11.10.03 - sc V0.1.6
>     # 09.11.03 - sc V0.1.7
>     # -------------------------------------------------
>     # sets some Environment variables for QT OPIE
>     # Crosscompiling (arm)
>     # -------------------------------------------------
>     TEMPFILE="$HOME/_sharpprep.tmp"

>       if [ -e $TEMPFILE ];then
>         . $TEMPFILE
>       fi

>     # PATHs .....
>     # Compiler-Path is the directory, where your Cross-compiler
>     # is located. It is used to find the compiler includes.
>     COMPILER_PATH=$TCDPATH/Embedix/tools
>     # Kernel-Path is the directory, where your ARM-Kernel
>     # is located. It is used to find the kernel includes and libraries.
>     # Note !!! If you are using different kernelversions (like me)
>     # set a link to the destination kernel. By changing the link
>     # you can easily change the kernel-version.
>     KERNEL_PATH=$TCDPATH/linux-arm-kernel
>     # QVFB_PATH is the directory, where the QT-Framebuffer is located.
>     QVFB_PATH=$TCDPATH/bin
>     # QTDIR is the directory, where the QT-ARM-Directory is located.
>     QTDIR=$TCDPATH/qt2opie-sharp
>     # QPEDIR is the directory, where the QPE-ARM-Directory is located.
>     QPEDIR=$TCDPATH/opie-sharp
>     OPIEDIR=$TCDPATH/opie-sharp
>     ADDOPIE=$TCDPATH/addopie/sharp
>     # PATH has to be added by QTDIR QVFB and COMPILER-PATH bins.
>     PATH=$QTDIR/bin:$QVFB_PATH:$COMPILER_PATH/bin:$PATH
>     # MANPATH has to be added by QTDIR mans.
>     MANPATH=$QTDIR/man:$MANPATH
>     export COMPILER_PATH KERNEL_PATH
>     export QTDIR PATH MANPATH QVFB_PATH
>     export QPEDIR OPIEDIR ADDOPIE
>     UICPATH=$QTDIR/bin
>     UIC=$QTDIR/bin/uic
>     export UICPATH UIC

>     # -------------------------------------------------
>     # QTLINKLOCATION .....
>     export QTLINKBASE=$TCDPATH

>     # -------------------------------------------------
>     # Extensions .....
>     # Extensions maybe used, if you run self-created Makefiles to
>     # compile for ARM and EMB / QT.
>     _EXT=arm.o
>     SO_EXT=arm.so
>     LIB_EXT=arm.so
>     HEADER_EXT=arm.h
>     CPP_EXT=arm.cpp
>     export _EXT SO_EXT LIB_EXT HEADER_EXT CPP_EXT

>     # -------------------------------------------------
>     # Include PATHs .....
>     # INCLUDE-PATHs are used to add extra include paths
>     EXTRA_INC_PATH="-I$QTDIR/include \
>     -I$OPIEDIR/include \
>     -I$ADDOPIE/include \
>     -I$KERNEL_PATH/include \
>     -I$COMPILER_PATH/include \
>     -I$TCDPATH/include/sharp \
>     -I/usr/local/include-arm"
>     # CXXFLAGS_EXTRA and CFLAGS_EXTRA are used during
>     # OPIE compilation itself
>     CXXFLAGS_EXTRA=$EXTRA_INC_PATH
>     CFLAGS_EXTRA=$EXTRA_INC_PATH

>     # Libnrary PATHs .....
>     # LIBRARY-PATHs are used to add extra library paths
>     EXTRA_LIB_PATH="-L$QTDIR/lib \
>     -L$OPIEDIR/lib \
>     -L$ADDOPIE/lib \
>     -L$KERNEL_PATH/lib \
>     -L$COMPILER_PATH/lib \
>     -L$TCDPATH/lib/sharp \
>     -L/usr/local/lib-arm"
>     # LDFLAGS_EXTRA and LFLAGS_EXTRA are used during
>     # OPIE linking itself
>     LDFLAGS_EXTRA=$EXTRA_LIB_PATH
>     LFLAGS_EXTRA=$EXTRA_LIB_PATH

>     export EXTRA_INC_PATH EXTRA_LIB_PATH
>     export CXXFLAGS_EXTRA CFLAGS_EXTRA LDFLAGS_EXTRA LFLAGS_EXTRA

>     # -------------------------------------------------
>     # Installation PATHs .....
>     # Install-PATHs are used to define the installation PATH
>     # for self created libs (used for qt/emb/arm)
>     LIB_INST_PATH=/usr/local/lib-arm
>     INC_INST_PATH=/usr/local/include-arm
>     export LIB_INST_PATH INC_INST_PATH

>     # -------------------------------------------------
>     # Programs .....
>     # some Makefiles use the follwing Environment variables
>     # to find the right compiler / linker
>     CC=arm-linux-gcc
>     CXX=arm-linux-g++
>     CCX=arm-linux-gcc
>     CXXX=arm-linux-g++
>     COMPILER=arm-linux-gcc
>     LINKER=arm-linux-ld
>     # the strip-program (strips down the size of the binary
>     # deleting all debug-information)
>     STRIP_PROG=$COMPILER_PATH/bin/strip
>     # some Makefiles use the follwing Environment variable
>     # to define a preprocessor
>     PREPROCESSCMD="$COMPILER -E"
>     export STRIP_PROG COMPILER LINKER PREPROCESSCMD CC CXX CCX CXXX

>     # -------------------------------------------------
>     # Libraries .....
>     # define extra libraries
>     XT_LIB="-lqte -lqpe -lopie"
>     KDEVXT_LIB="-lopie"
>     export XT_LIB KDEVXT_LIB

>     # -------------------------------------------------
>     # Extra Options .....
>     # used extra options for your compiler
>     # QWS_OPIE von sc wegen colorDialog, fileDialog, etc
>     OPTIONS="-DQT_QWS_IPAQ -DQWS -DQWS_OPIE -fno-exceptions -fno-rtti -pipe"
>     export OPTIONS

>     # set the prompt ...
>     PS1="[QT-CDOPIESHARP]:\w\$ "

> `

You can find example scripts ...

- for embedded here
- for x11 here

## 4.3 Building a cross toolchain from source

Top be documented ... (will come up soon)

## 4.4 Installing and preparing the kernel

This section describes how to get an arm kernel ready for opie building. Handhelds.org describes, how to checkout the kernel from the hh.orgs cvs tree and how to configure it for the desired platform.

To get the last kernel sources onto your linux machine, follow the steps described below.

- prepare for checkout
  Using the bash, you have to enter `export CVSROOT=export CVSROOT=:pserver:anoncvs@cvs.handhelds.org:/cvs; cvs login;password : anoncvs`
- checkout the lastest kernel
  `cvs checkout linux/kernel`
- alternatively checkout the a special kernel (e.g. pxa 2.4.19)
  `export TAG=K2-4-19-rmk4-pxa2-hh10;cvs checkout -r $TAG linux/kernel`
- read the file linux/kernel/README.HANDHELDS
- prepare the kernel
  `cd linux/kernel;export kerneldir=$PWD; make xxxx_config`, where xxxx is the target platform. You may want to check, which platforms are possible. For this check $kerneldir/arch/arm/def-configs.
- build the kernel
  `make oldconfig; make dep; make zImage; make modules`. Note, that for the arm kernel zImage and bzImage are equal.

Now the kernel is ready to be used for opie development (it is not needed to create an ipkg). If you want to have further information, check

Important Note
You have to use a gcc 3.2 toolchain to compile the kernel for xscale use. As the toolchain on hh.org is linked against glibc-2.3.2, you will have problems to use the binutils on a glibc-2.2.5 machine (e.g. SuSE 8.1, Debian Woody). I tried to build the toolchain on my SuSE 8.1 against glibc 2.2.5 machine and failed ;-). Nevertheless, the binutils and the bootstrap (C, no C++) compiler worked, which is enough to get e.g. the pxa the kernel (3900) compiled. That rudimentary "toolchain" can be found on the DeveloperCD (called gcc-3.2.3-glibc-2.2) (see DeveloperCD.

See also http://handhelds.org/handhelds-faq/development.html

## 4.5 Downloading QT-Embedded

Now you have to download qte-2.3.7 from trolltechs web site.

See ftp://ftp.trolltech.com/qt/source/.

I use the qt-embedded-2.3.7.tar.gz.

Download and unpack it where you want (`tar xvfz qt-embedded-2.3.7.tar.gz`). The result is a directory qt-2.3.7.

## 4.6 Downloading OPIE

Get the opie sources via cvs. For that you have to create a directory (e.g. ./opiesrc), cd into there and enter the following commands (assuming, you have cvs installed).

> `

>             cvs -d:pserver:anoncvs@cvs.handhelds.org:/cvs login
>             passwd : anoncvs
>             cvs -d:pserver:anoncvs@cvs.handhelds.org:/cvs co opie

> `

Hint
A

> `

>             cvs -d:pserver:anoncvs@cvs.handhelds.org:/cvs co -r BRANCH_1_0 opie

> `

does downlaod a so called "tagged" version, which is normally more stable than the so called "HEAD"-Version, where all changes are applied to. At the moment 1_0 is the best solution to develop on.

Once opie is checked out to your machine, you can update it to the latest version calling

> `

>             cvs -d:pserver:anoncvs@cvs.handhelds.org:/cvs update

> `

Another Hint
Never "downgrade" by updateing to an older BRANCH. This will normally not work correctly.

Enter the resulting opie directory and set the OPIEDIR variable `export OPIEDIR=$PWD`

You may find more info here http://opie.handhelds.org/wiki/index.php?SourceCode.

## 4.7 Installing and preparing QT-Embedded

Now its time to prepare QTE for opie development.

First we have to apply all opie version related patches to QTE. For that `ls $OPIEDIR/qt` and find out which patches are available for your qte version (in this case 2.3.7). Apply them all using `cd $QTDIR;cd ..; cat $OPIEDIR/qt/qte235*.patch | patch -p0` assuming, you did download qte-2.3.7 (or older versions). Copy $OPIEDIR/qt/qconfig-qpe.h to $QTDIR/src/tools also.

HINT :
The qt-2.3.7 patch has to be done from "below" the qt-2.3.7 directory. This is the reason, why the directory has to be named "qt-2.3.7" exactly.

Now move or copy the directory ./qt-2.3.7 to ./qt-2.3.7-opie-emb. Enter that directory and set the QTDIR variable `export QTDIR=$PWD`. Copy the x11 `uic` program (attention : use always the qt2 version) into $QTDIR/bin, as uic is needed for the qte compilation process. Alternatively you may want to install uic2 to e.g. /usr/local/bin and set an appropriate PATH environment (so did I). You may find the uic in your qt2-x11 directory (if you still own a qt2-x11 version).

If not, you may want to download a statically linked version (no libqt.so.2.x (x-version) needed) from http://opie.net.wox.org/tools/.

Get the qt2-uic binary and copy it into $QTDIR/bin. Set a link `ln -s $QTDIR/bin/qt2-uic $QTDIR/bin/uic`. You may want to download a qt2-designer as well (for your own application development), as qt3 designer cannot be used at the moment.

Alternatively, you can to download a qt2-x11 version from trolltech and compile it for X11 use.

Copy the qconfig files to QTDIR now. A simple `cp $OPIEDIR/qt/qconfig*.h $QTDIR/src/tools` does that for you.

You find more info here http://opie.handhelds.org/wiki/index.php/BuildingQtForOpie.

Finally it is time to prepare the different QTE directories. As I assume you dont want to recompile qte always when changing between IPAQ, sharp or embedded environment, you have to prepare copies of the complete directory before and compile them for their target.

For that copy the complete qt-2.3.7-opie-emb dir to e.g. qt-2.3.7-opie-ipaq or/and qt-2.3.7-opie-sharp.

### Compilation script

Now we describe the script used for automated qte compilation. It is equal for all described qte-versions (emb, IPAQ, sharp).

It uses the above mentioned environment scripts as well as a temporary shell script created during the last qte compilation. This temporary script contains the input parameters of the last build approach. The script will suggest to use that variables, if you hit just enter at the input prompt.

The script is named `_makeqte.rc`. It requests the following inputs.

- clean
  If ansered "Y", `make clean` will be called to clean off all object files.
- configure (set automatically, when clean is selected)
  If ansered "Y", `./configure` will be called with the options entered below.
- select target
  The user may select embedded, IPAQ or zaurus use.
- select compiler (only if IPAQ or zaurus is selected)
  The user may select the compiler, he wants to use (which is installed on the system).
- configure options (only if configure was selected)
  The user has to enter the correct configure values for the target platform. At the moment the follwing options must be given.
  - embedded use
    -qconfig qpe -depths 4,16,24,32 \ -qvfb -system-jpeg -system-libpng -system-zlib -no-xft
  - ipaq use
    -qconfig qpe -depths 16,32 -xplatform linux-ipaq-g++ \ -no-qvfb -system-jpeg -system-libpng -system-zlib -vnc -no-xft
  - zaurus use
    -qconfig qpe -depths 16,32 -xplatform linux-sharp-g++ \ -no-qvfb -system-jpeg -system-libpng -system-zlib -vnc -no-xft
- the QTDIR (qte directory)
  Normally $PWD will be prepselected, which may be confirmed or changed.

Finally the script presents all selected parameters. The user has to decide, whether he wants to go ahead or not. In case of selecting "Y", all input parameters are stored in the temp file `_makeqte.tmp` to be available for the next _makeqte.rc call (as preselections).

The script _makeqte.rc has to be copied into all qt-2.3.7-* dirs and made executable.

You can find the scripts source code here

### Embedded version

Become superuser, change to `qt-2.3.7-opie-emb` dir and call

`./_makeqte.rc`.

The first time (when no _makeqte.tmp is existing), you have to answer some questions (see list in section compilation script). Select "e" (embedded) when asked.

Once through the questions, select "Y" to start the build process.

The first time you should select the option "CLEAN". This automatically selects "CONFIGURE". During the configure script, you are asked for confirmation of the QTE license. Confirm with "yes" and wait, until everything is finished.

Do not forget to set a link in /usr/lib (as root). This is important for the opie compilation process.
`cd /usr/lib;ln -s /usr/local/qt-vers/qt-2.3.7-opie-emb qt2opie-emb`

### IPAQ version

Become superuser, change to `qt-2.3.7-opie-ipaq` dir and call

`./_makeqte.rc`.

The first time (when no _makeqte.tmp is existing), you have to answer some questions (see list in section compilation script). Select "i" (IPAQ) when asked.

Once through the questions, select "Y" to start build process.

Then first time you should select the option "CLEAN". This automatically selects "CONFIGURE". During the configure script, you are asked for confirmation of the QTE license. Confirm with "yes" and wait, until everything is finished.

Hint
Dont be scared, when the compilation starts using `g++` instead of `arm-linux-g++`. The first part builded is moc. This is done using the x86 compiler.

Do not forget to set a link in /usr/lib (as root). This is important for the opie compilation process.
`cd /usr/lib;ln -s /usr/local/qt-vers/qt-2.3.7-opie-ipaq qt2opie-ipaq`

### Sharp version

The sharp version only will be compiled using the sharp zaurus SDK.

Become superuser, change to `qt-2.3.7-opie-sharp` dir and call

`./_makeqte.rc`.

The first time (when no _makeqte.tmp is existing), you have to answer some questions (see list in section compilation script). Select "z" (zaurus) when asked.

Hint
Use the sharp compiler suite, because some zaurus special include files are only included in this compiler suite. Alternatively, you have to organize a sharp extended kernel source.

Once through the questions, select "Y" to start build process.

Then first time you should select the option "CLEAN". This automatically selects "CONFIGURE". During the configure script, you are asked for confirmation of the QTE license. Confirm with "yes" and wait, until everything is finished.

Hint
Dont be scared, when the compilation starts using `g++` instead of `arm-linux-g++`. The first thing builded is moc. This is done using the x86 compiler.

Do not forget to set a link in /usr/lib (as root). This is important for the opie compilation process.
`cd /usr/lib;ln -s /usr/local/qt-vers/qt-2.3.7-opie-sharp qt2opie-sharp`

## 4.8 Installing and preparing OPIE

The same stragtegie as for QTE may now be done for OPIE.

We will use an automation script called _makeopie.rc, which follows the same strategy than _makeqte.rc used for qt-embedded compilation.

Important hint
You need some additional software to get opie compilable. `e2fsprogs` and `libpam` should be part of nearly every distribution. Above that I did not get xine to install and work on my SuSE 8.1 system. For this I had to switch opieplayer and opieplayer2 off during `make menuconfig` (multimedia). I will work on that and document it here, as soon as I am successfull. You may find more info here http://opie.handhelds.org/wiki/index.php?SourceCode.

### Compilation script

Here we describe the script used for automated opie compilation. It is equal for all three opie-versions.

It uses the above mentioned environment scripts as well as a temporary shell script created during the last opie compilation. This temporary script contains the input parameters of the last build approach. The script will suggest to use that variables, if you hit just enter at the input prompt.

The script is named `_makeopie.rc`. It requests the following inputs.

- clean
  If ansered "Y", `make clean` will be called to clean off all object files (important, if the already compiled embedded version is the basis of your arm try).
- menuconfig (set automatically, when clean is selected)
  If ansered "Y", `make menuconfig` will be called with the options entered below. important hint
  If you want to compile your fresh downloaded opie the first time, you must call make menuconfig to select a target machine. `BuildParameters->TargetMachine` lets you select from x11, ipaq, sharp at the moment. Select your target and exit confirming the question to store the configuration.
- clean-configs
  If ansered "Y", `make clean-configs` will be called to clean off all config files (may be necessary, if you changed the config tree (be menuconfig).
- select target
  The user may select x11, embedded, IPAQ or zaurus use. (This will only work, if the configuration supports the target (see important hint above).
- select compiler (only if IPAQ or zaurus is selected)
  The user may select the compiler, he wants to use (which is installed on the system).
- the QTDIR (qte directory)
  Normally $QTDIR will be prepselected, which may be confirmed or changed.

Finally the script presents all selected parameters. The user has to decide, whether he wants to go ahead or not. In case of selecting "Y", all input parameters are stored in the temp file `_makeopie.tmp` to be available for the next _makeopie.rc call (as preselections).

The script _makeopie.rc has to be copied into all opie-* dirs and made executable.

You can find the scripts source code here

### Embedded version

Become superuser, change to `opie-*-emb` and call

`./_makeopie.rc`.

The first time (when no _makeopie.tmp is existing), you have to answer some questions (see list in section compilation script). Select "e" (embedded) when asked.

Once through the questions, select "Y" to start build process.

The first time you should select the option CLEAN and MEUNCONFIG. Select whatever configuration you want (check always the build parameters) and store as standard config file. Make will be called. Wait, until everything is finished.

Do not forget to set a link in /usr/lib (as root). This is important for the user progs compilation processes.
`cd /usr/lib;ln -s /usr/local/opie-vers/opie_280603-099-emb opie-emb`

### IPAQ version

Become superuser, change to `opie-*-ipaq` and call

`./_makeopie.rc`.

The first time (when no _makeopie.tmp is existing), you have to answer some questions (see list in section compilation script). Select "i" (IPAQ) when asked.

Once through the questions, select "Y" to start build process.

The first time you should select the option CLEAN and MEUNCONFIG. Select whatever configuration you want (check always the build parameters) and store as standard config file. Make will be called. Wait, until everything is finished.

Do not forget to set a link in /usr/lib (as root). This is important for the user progs compilation processes.
`cd /usr/lib;ln -s /usr/local/opie-vers/opie_280603-099-ipaq opie-ipaq`

### Sharp version

The sharp version only will be compiled using the sharp zaurus SDK.

Become superuser, change to `opie-*-sharp` and call

`./_makeopie.rc`.

The first time (when no _makeopie.tmp is existing), you have to answer some questions (see list in section compilation script). Select "z" (zaurus) when asked.

Once through the questions, select "Y" to start build process.

The first time you should select the option CLEAN and MEUNCONFIG. Select whatever configuration you want (check always the build parameters) and store as standard config file. Make will be called. Wait, until everything is finished.

Do not forget to set a link in /usr/lib (as root). This is important for the user progs compilation processes.
`cd /usr/lib;ln -s /usr/local/opie-vers/opie_280603-099-sharp opie-sharp`

## 4.9 Using Framebuffer Device (QVFB)

If you want to debug your programs or just dont have a handheld available for test, you may want to run your programs on your LinuxHost.

Trolltech ships a tool called qvfb with all qt versions. This tool is used as a Vesa Framebuffer Simulation and is able to run qt-embedded programs under X.

This chapter describes, how to compile and use qvfb and how to use the tool for testing / debugging.

For detailed information regarding the use of qvfb, check the trolltech document page http://doc.trolltech.com/2.3/qvfb-qws.html or the 3.0 version instead.

### Compilation and installation

Even if qvfb is shipped and used with qt-embedded, you have to compile it using the "normal" X-Version of qt. I am using the qvfb shipped with qt-3.0.5 the last days but also older versions of qt worked.

To compile qvfb and install, follow the instructions (I assume you have the related QT-Version compiled for X11 use).

1. Set the QTDIR environment to the used qt-version.
   `export QTDIR=/whereYourQtVersionIs`
2. change to subdir qvfb and enter `make` (being superuser).
3. copy the result (qvfb) into /usr/local/bin (assuming your PATH shows there).

Alternatively, you can download a qt2-version static binary from http://opie.net.wox.org/tools/. Copy the result qvfb2 into your /usr/local/bin dir and set an appropriate link to qvfb.

### Run your own programs

Change to `qtopieemb` environment (LD_LIBRARY_PATH will be configured automatically to find qpe/opie libs).

Run `qvfb &` (may be you have to add `-depths 16` or similar). QVFB is started, a window (240x320) with a black background is shown on your screen.

If you just want to test your application start the embedded version using `/whereYourEmbeddedDirIs/yourapplication -qws`. The application is launched and uses the qvfb window for IO. If you are over the window with your mouse, the hosts mouse can be used to control your program.

### Run opie

If you are so far, you may want to run opie using qvfb. For this change to `qtopieemb` environment, cd to `$OPIEDIR/bin` and start `./qpe -qws`.

Opie will be started using the framebuffer and all applications are included.

Note
Not really all functions will work (e.g. qcop), because your host system does not support this functionality. Also not all applications are startable, which require that kind of stuff.

Next Previous Contents