Difference between revisions of "TomTom"

From Navit's Wiki
Jump to: navigation, search
(SDL)
(Porting libraries)
Line 19: Line 19:
  
 
===zlib===
 
===zlib===
 +
Get the zlib source from http://sourceforge.net/projects/libpng/files/zlib/. zlib's configure script does not support selecting the host system via --host, so we need to set a few environment variables by hand before we can compile zlib:
  
===libxml2===
+
export CC=arm-linux-gcc
 +
export CXX=arm-linux-g++
 +
export LD=arm-linux-ld
 +
export NM="arm-linux-nm -B"
 +
export AR="arm-linux-ar -r"
 +
export RANLIB=arm-linux-ranlib
 +
export STRIP=arm-linux-strip
 +
export OBJCOPY=arm-linux-objcopy
 +
export LN_S="ln -s"
 +
 
 +
Now we can configure, make and install:
 +
 
 +
./configure --prefix=$PREFIX
 +
make
 +
make install
 +
 
 +
Before proceeding, we need to reset AR because the "-r" switch is needed only be zlib and will cause conflicts compiling the other libraries:
  
===libfontconfig===
+
export AR=arm-linux-ar
  
===SDL===
+
===libxml2===
The recipe for compiling libSDL is based mainly on http://www.opentom.org/LibSDL and http://www.opentom.org/Talk:LibSDL. Unfortunalety we can't compile libSDL out of the box, because the "fbcon" driver which we will use on TomTom relies on the presence of a virtual console, which is not present on TomTom Linux. Therefore, we have to patch the SDL source, using this patch:
+
This one is rather straightforward. Simply download the source from ftp://xmlsoft.org/libxml2/, configure, make and install:
  
http://tracks.yaina.de/source/sdl-fbcon-notty.patch
+
./configure --prefix=$PREFIX --host=arm-linux
 +
make
 +
make install
  
After applying the patch, configure (disabling most of the unneeded drivers), make and install:
+
===libpng===
 +
The libpng source can be downloaded from http://sourceforge.net/projects/libpng/files/. I recommend using libpng-1.2.xx - I have tried 1.4.xx before but that one didn't work. Configure, make and install:
  
  ./configure --prefix=$PREFIX --host=arm-linux \
+
  ./configure --prefix=$PREFIX --host=arm-linux
  --disable-audio --disable-joystick --disable-cdrom --disable-video-x11 \
 
  --disable-x11-vm --disable-dga --disable-video-x11-dgamouse \
 
  --disable-video-x11-xv --disable-video-x11-xinerama --disable-video-directfb \
 
  --enable-video-fbcon CFLAGS="$CFLAGS -DFBCON_NOTTY"
 
 
  make
 
  make
 
  make install
 
  make install
  
The "-DFBCON_NOTTY" invokes the patch mentioned above and removes fbcon's dependence on a virtual console. If you like, you can also compile the test applications, as these are quite useful for testing whether libSDL works:
+
===libjpeg===
 +
Get the libjpeg source from http://sourceforge.net/projects/libjpeg/files/ - the current version (which worked for me) should be 6b. Configure, make and install:
  
cd test
 
 
  ./configure --prefix=$PREFIX --host=arm-linux
 
  ./configure --prefix=$PREFIX --host=arm-linux
 
  make
 
  make
 
  make install
 
  make install
  
===SDL_Image===
+
===libfontconfig===
 +
fontconfig can be obtained from http://fontconfig.org/release/. This one is again very simple:
  
===tslib===
+
./configure --prefix=$PREFIX --host=arm-linux --with-arch=arm
 +
make
 +
make install
  
 
===glib===
 
===glib===
Line 54: Line 73:
  
 
  glib_cv_long_long_format=ll
 
  glib_cv_long_long_format=ll
 +
glib_cv_stack_grows=no
 
  glib_cv_uscore=no
 
  glib_cv_uscore=no
 
  ac_cv_func_posix_getgrgid_r=yes
 
  ac_cv_func_posix_getgrgid_r=yes
 
  ac_cv_func_posix_getpwuid_r=yes
 
  ac_cv_func_posix_getpwuid_r=yes
glib_cv_stack_grows=no
 
  
 
Make this file read-only to keep configure from overwriting it, configure, make and install.
 
Make this file read-only to keep configure from overwriting it, configure, make and install.
Line 63: Line 82:
 
  chmod a-w tomtom.cache
 
  chmod a-w tomtom.cache
 
  ./configure --prefix=$PREFIX --host=arm-linux --cache-file=tomtom.cache
 
  ./configure --prefix=$PREFIX --host=arm-linux --cache-file=tomtom.cache
 +
make
 +
make install
 +
 +
===tslib===
 +
These instructions are based on http://www.opentom.org/Tslib. First, we need the tslib source from http://tslib.berlios.de/. Before compiling, we need to patch the source a bit: Open the file plugins/input-raw.c in the tslib source directory and search for EVIOCGRAB. You will find several occurences of EVIOCGRAB, each of them within some if-statement. Enclose these if-statements with #ifdef EVIOCGRAB ... #endif, so that you get something like this:
 +
 +
#ifdef EVIOCGRAB
 +
  if(...)
 +
  { ... EVIOCGRAB .... }
 +
#endif
 +
 +
You also need to edit the config file etc/ts.conf. Uncomment the line "module_raw h3600", so the file should look like this:
 +
 +
# Uncomment if you wish to use the linux input layer event interface
 +
# module_raw input
 +
 +
# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
 +
# module_raw collie
 +
 +
# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
 +
# module_raw corgi
 +
 +
# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
 +
# module_raw ucb1x00
 +
 +
# Uncomment if you're using an HP iPaq h3600 or similar
 +
module_raw h3600
 +
 +
# Uncomment if you're using a Hitachi Webpad
 +
# module_raw mk712
 +
 +
# Uncomment if you're using an IBM Arctic II
 +
# module_raw arctic2
 +
 +
module pthres pmin=1
 +
module variance delta=30
 +
module dejitter delta=100
 +
module linear
 +
 +
Finally, configure, make and install.
 +
 +
./configure --prefix=$PREFIX --host=arm-linux
 +
make
 +
make install
 +
 +
===SDL===
 +
The recipe for compiling libSDL is based mainly on http://www.opentom.org/LibSDL and http://www.opentom.org/Talk:LibSDL. First, get the source from http://www.libsdl.org/download-1.2.php. Unfortunalety we can't compile it out of the box, because the "fbcon" driver which we will use on TomTom relies on the presence of a virtual console, which is not present on TomTom Linux. Therefore, we have to patch the SDL source, using the patch from http://tracks.yaina.de/source/sdl-fbcon-notty.patch. After applying the patch, configure (disabling most of the unneeded drivers), make and install:
 +
 +
./configure --prefix=$PREFIX --host=arm-linux \
 +
  --disable-audio --disable-joystick --disable-cdrom --disable-video-x11 \
 +
  --disable-x11-vm --disable-dga --disable-video-x11-dgamouse \
 +
  --disable-video-x11-xv --disable-video-x11-xinerama --disable-video-directfb \
 +
  --enable-video-fbcon CFLAGS="$CFLAGS -DFBCON_NOTTY"
 +
make
 +
make install
 +
 +
The "-DFBCON_NOTTY" invokes the patch mentioned above and removes fbcon's dependence on a virtual console. If you like, you can also compile the test applications, as these are quite useful for testing whether libSDL works:
 +
 +
cd test
 +
./configure --prefix=$PREFIX --host=arm-linux
 +
make
 +
make install
 +
 +
===SDL_Image===
 +
This one is rather easy again. Get the source from http://www.libsdl.org/projects/SDL_image/, configure, make and install:
 +
 +
./configure --prefix=$PREFIX --host=arm-linux
 
  make
 
  make
 
  make install
 
  make install

Revision as of 21:17, 17 March 2010

Navit has not been successfully ported to TomTom yet. However, there is work in progress. I will scratch my experiences here and, hopefully, end up with some guide on porting Navit to TomTom.

TomTom hardware

Lots of information can be found at http://www.opentom.org.

Prerequisities

Before we can start, we need to set up a compiler toolchain targetting TomTom devices. TomTom provides a a pre-compiled compiler toolchain for Linux and Windows. It can be downloaded from TomTom's website: http://www.tomtom.com/page.php?Page=gpl. This file needs to be unpacked into /usr/local/cross.

In order to use the TomTom compiler and libraries, we need to set some environment variables:

export PREFIX=/usr/local/cross/gcc-3.3.4_glibc-2.3.2/arm-linux/sys-root
export CFLAGS="-mcpu=arm920t -O2 -I$PREFIX/include -I$PREFIX/usr/include"
export CPPFLAGS="-I$PREFIX/include -I$PREFIX/usr/include"
export LDFLAGS="-L$PREFIX/lib -L$PREFIX/usr/lib"

The toolchain is now ready for use.

Porting libraries

Several libraries need are needed by Navit and must be ported as well.

zlib

Get the zlib source from http://sourceforge.net/projects/libpng/files/zlib/. zlib's configure script does not support selecting the host system via --host, so we need to set a few environment variables by hand before we can compile zlib:

export CC=arm-linux-gcc
export CXX=arm-linux-g++
export LD=arm-linux-ld
export NM="arm-linux-nm -B"
export AR="arm-linux-ar -r"
export RANLIB=arm-linux-ranlib
export STRIP=arm-linux-strip
export OBJCOPY=arm-linux-objcopy
export LN_S="ln -s"

Now we can configure, make and install:

./configure --prefix=$PREFIX
make
make install

Before proceeding, we need to reset AR because the "-r" switch is needed only be zlib and will cause conflicts compiling the other libraries:

export AR=arm-linux-ar

libxml2

This one is rather straightforward. Simply download the source from ftp://xmlsoft.org/libxml2/, configure, make and install:

./configure --prefix=$PREFIX --host=arm-linux
make
make install

libpng

The libpng source can be downloaded from http://sourceforge.net/projects/libpng/files/. I recommend using libpng-1.2.xx - I have tried 1.4.xx before but that one didn't work. Configure, make and install:

./configure --prefix=$PREFIX --host=arm-linux
make
make install

libjpeg

Get the libjpeg source from http://sourceforge.net/projects/libjpeg/files/ - the current version (which worked for me) should be 6b. Configure, make and install:

./configure --prefix=$PREFIX --host=arm-linux
make
make install

libfontconfig

fontconfig can be obtained from http://fontconfig.org/release/. This one is again very simple:

./configure --prefix=$PREFIX --host=arm-linux --with-arch=arm
make
make install

glib

Cross compiling glib is a bit tricky. The configure script tries to probe some characteristics of the host machine by compiling a few test programs and running them - which will fail when a cross compiler is used. We therefore need to set the results of these tests by hand. In the glib source directory, create a file named tomtom.cache with the following contents:

glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_posix_getgrgid_r=yes
ac_cv_func_posix_getpwuid_r=yes

Make this file read-only to keep configure from overwriting it, configure, make and install.

chmod a-w tomtom.cache
./configure --prefix=$PREFIX --host=arm-linux --cache-file=tomtom.cache
make
make install

tslib

These instructions are based on http://www.opentom.org/Tslib. First, we need the tslib source from http://tslib.berlios.de/. Before compiling, we need to patch the source a bit: Open the file plugins/input-raw.c in the tslib source directory and search for EVIOCGRAB. You will find several occurences of EVIOCGRAB, each of them within some if-statement. Enclose these if-statements with #ifdef EVIOCGRAB ... #endif, so that you get something like this:

#ifdef EVIOCGRAB
  if(...)
  { ... EVIOCGRAB .... }
#endif

You also need to edit the config file etc/ts.conf. Uncomment the line "module_raw h3600", so the file should look like this:

# Uncomment if you wish to use the linux input layer event interface
# module_raw input

# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie

# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi

# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00

# Uncomment if you're using an HP iPaq h3600 or similar
module_raw h3600

# Uncomment if you're using a Hitachi Webpad
# module_raw mk712

# Uncomment if you're using an IBM Arctic II
# module_raw arctic2

module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

Finally, configure, make and install.

./configure --prefix=$PREFIX --host=arm-linux
make
make install

SDL

The recipe for compiling libSDL is based mainly on http://www.opentom.org/LibSDL and http://www.opentom.org/Talk:LibSDL. First, get the source from http://www.libsdl.org/download-1.2.php. Unfortunalety we can't compile it out of the box, because the "fbcon" driver which we will use on TomTom relies on the presence of a virtual console, which is not present on TomTom Linux. Therefore, we have to patch the SDL source, using the patch from http://tracks.yaina.de/source/sdl-fbcon-notty.patch. After applying the patch, configure (disabling most of the unneeded drivers), make and install:

./configure --prefix=$PREFIX --host=arm-linux \
 --disable-audio --disable-joystick --disable-cdrom --disable-video-x11 \
 --disable-x11-vm --disable-dga --disable-video-x11-dgamouse \
 --disable-video-x11-xv --disable-video-x11-xinerama --disable-video-directfb \
 --enable-video-fbcon CFLAGS="$CFLAGS -DFBCON_NOTTY"
make
make install

The "-DFBCON_NOTTY" invokes the patch mentioned above and removes fbcon's dependence on a virtual console. If you like, you can also compile the test applications, as these are quite useful for testing whether libSDL works:

cd test
./configure --prefix=$PREFIX --host=arm-linux
make
make install

SDL_Image

This one is rather easy again. Get the source from http://www.libsdl.org/projects/SDL_image/, configure, make and install:

./configure --prefix=$PREFIX --host=arm-linux
make
make install

Porting Navit

Installing Navit

We can now put the compiled libraries and the Navit executable, as well as some config files and, of course, some maps, to a TomTom device. Connect the TomTom device to your computer. You should see a new hard drive. In the following, let's assume this hard drive can be found in /media/TOMTOM. We then need two directories on the TomTom disk, navit and SDKRegistry. If they don't exist yet, create them:

cd /media/TOMTOM
mkdir -p navit
mkdir -p SDKRegistry

Within the navit directory, create the following directories: bin, lib, and share.

cd navit
mkdir -p bin
mkdir -p lib
mkdir -p share

Now these directories have to be filled with content. Place all the libraries you just compiled in the lib directory. Be aware that TomTom uses a FAT file system which isn't aware of symlinks, so you will have to copy / rename libraries instead of symlinking them. Next, copy the images used by Navit to display POIs, as well as the navit config file into the share folder:

cp $PREFIX/share/navit/xpm share/
cp $PREFIX/share/navit/navit.xml share/

Put the Navit executable into the bin folder:

cp $PREFIX/bin/navit bin/

In order to run Navit, we need to create a short wrapper script, which will set a few environment variables before running Navit. Create a file named navit-wrapper in the bin directory with the following contents:

#!/bin/sh

cd /mnt/sdcard

# Set some paths.
export PATH=$PATH:/mnt/sdcard/navit/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/sdcard/navit/lib
export HOME=/mnt/sdcard/
export NAVIT_LIBDIR=/mnt/sdcard/navit/lib/navit
export NAVIT_SHAREDIR=/mnt/sdcard/navit/share

# tslib requirements.
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb
export TSLIB_TSDEVICE=/dev/ts
export TSLIB_CALIBFILE=/mnt/sdcard/navit/ts/pointercal
export TSLIB_CONFFILE=/mnt/sdcard/navit/ts/ts.conf
export TSLIB_PLUGINDIR=/mnt/sdcard/navit/lib/ts

# SDL requirements.
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
export SDL_NOMOUSE=1
export SDL_FBDEV=/dev/fb
export SDL_VIDEODRIVER=fbcon

# Set language.
export LANG=en_US.utf8

# Run Navit.
/mnt/sdcard/navit/bin/navit /mnt/sdcard/navit/share/navit.xml 2>/mnt/sdcard/navit/navit.log

The first few lines tell Navit where it can find binaries, libraries, plugins and map icons. The middle part tells tslib which touchscreen device to use, and where to place calibration data. The following lines tell libSDL to use the touchscreen as mouse input, to hide the mouse pointer and to use the framebuffer. Finally, we set Navit's language and run the Navit executable. stderr is redirected into a log file, since there is usually no console available to view debugger output.

In order to start Navit from TomTom's graphical menu, we finally have to add a menu button. Create a file named navit.cap with the following contents in /media/TOMTOM/SDKRegistry:

Version|100|
AppName|navit-wrapper|
AppPath|/mnt/sdcard/navit/bin/|
AppIconFile|navit.bmp|
AppMainTitle|Navit|
AppPort||
COMMAND|CMD|hallo|navit.bmp|Navit|

In the same directory, place a simple 48 * 48 pixel, 24 bit bitmap file named navit.bmp with a fance Navit icon or whatever you like. If you are happy without such an icon, you can omit this step and delete the two "navit.bmp" entries from the file above:

Version|100|
AppName|navit-wrapper|
AppPath|/mnt/sdcard/navit/bin/|
AppIconFile||
AppMainTitle|Navit|
AppPort||
COMMAND|CMD|hallo||Navit|

Now all necessary files are on your TomTom device.

Configuring Navit

Before running Navit, we need to change some settings in the Navit config file, navit.xml, which we have placed in navit/share on the TomTom disk. Here are some settings which are rather useful:

<debug name="segv" level="0"/>

As long as you don't have gdb on your TomTom, set the segfault debugging level to 0, i.e. let Navit crash without printing a stack trace via gdb. Otherwise Navit will complain that gdb can't be found.

<graphics type="sdl"/>

Use libSDL for graphics output.

<gui type="internal" enabled="yes">

Use the internal GUI. This is most suitable for touchscreen devices.

<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="file:/dev/ttySAC2">

The TomTom GPS device can be found at the serial port /dev/ttySAC2. If you have already ported gpsd to your TomTom device, you can simply use gpsd.

Finally, enable the mapsets you wish to use. Remember that TomTom's disk will be mounted at /mnt/sdcard at runtime, so any maps you place in the navit/share/maps folder will appear in /mnt/sdcard/navit/share/maps.

Running Navit

Running Navit is as simple as a touch of a button. Disconnect your device properly from the computer and let it reboot. Touch the screen to enter the main manu. On the last page of the main menu, a new menu entry named "Navit" should be visible. Simply press the Navit button and wait for the Navit screen to appear. Have fun!