Hack-A-N900/Development Notes
N900 Development Notes
Not meant as a public resources. Just cluttered notes (meaning written in a hurry) that src, cyphunk are sharing with each other for remote collaboration on a project.
SDK Types
Nokia have switch mental frames of thought for how they want to develop their phones and the result is a few different paths one must choose from.
- Maemo Scratchbox
- Maemo MADDE
- Meego SDK
We have tried all 3 but are currently using MADDE which appears to have better Qt Creator integration than Scratchbox does. Also the Meego SDK is specific to n900 phones running Meego, which is not officially support yet. It works, but not well on 64 bit workstations.
Installing MADDE
Download and Install
There is one decent installation document[1] but it links to two different installers. Before getting to the installation steps the it links first to the "Nokia Qt SDK (Release Candidate)" installer but in the actual installation directions it tells you to download an install shell script from "MADDE downloads" in step 1. Both might work but we are using the "Nokia Qt SDK (Release Candidate)" installer http://www.forum.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-907413e525fb/Nokia_Qt_SDK.html
We installed this to ~/nokiaqtsdk, with the default setup. We checked the box to overwrite Qt Creator settings. After completed we created a local link to the QtCreator in the SDK so that we dont get mixed up with the various SDK's weve installed:
ln -s ~/nokiaqtsdk/QtCreator/bin/qtcreator ~/bin/qtcreator_nokiaqtsdk ln -s ~/nokiaqtsdk/Maemo/4.6.2/bin/mad ~/bin/mad_nokiaqtsdk ln -s ~/nokiaqtsdk/Maemo/4.6.2/bin/mad-admin ~/bin/mad-admin_nokiaqtsdk
Configure
After installation we used the "QtCreator integration for Linux" guide[2]. This will let you deploy applications to either the emulator or phone. For now lets just get the emulator working. Specifically we did the following (more details in the linked guide) from within the qtcreator_nokiaqtsdk:
Tools -> Options -> Qt4 -> Qt Versions
Make certain you have the following entries:
Version name: Simulator Qt for GCC (Nokia Qt SDK) qmake location: /home/user/nokiaqtsdk/Simulator/Qt/gcc/bin/qmake Version name: Qt for Fremantle PR1.2 Devices (Nokia Qt SDK) qmake location: /home/user/nokiaqtsdk/Maemo/4.6.2/targets/fremantle-1030/bin/qmake
The "Debugging helper" status might show a red "X". If it does, click the "Rebuild" button for both of the above entries. This should be enough to start building example projects.
Compile Hello World
Simple example (src[3]). The following will create a hello world qt creator project called qthello in the current directory:
$ mad_nokiaqtsdk pscreate -l $ mad_nokiaqtsdk pscreate -t qt_simple qthello
Open the qthello project in QtCreator. When you open it the first time, and when you create new projects for that matter, it will ask you to setup the targets. Be sure that you enable it for both "Qt for Fremantle PR1.2 Devices (Nokia Qt SDK)" and "Simulator Qt for GCC (Nokia Qt SDK)". Now compile and run with the Simulator selected as the target and you should see your app show up in a Nokia N900 like window.
Installing libraries
There are the nokia closed-source libraries and other libraries from the community that you might want to use in your application. For example, I would like to use TpSession[4] which is an abstraction for the TelepathyQt4 API letting one manage sms's, phone calls, etc.
In MADDE
To install TpSession to your MADDE SDK you need to install TelepathyQt4 on your workstation, apt-get install libtelepathy-qt4-dev. Then compile TpSession (git clone https://vcs.maemo.org/git/tpsession) for your workstation and/or target. Then you have to copy the lib to the root dir of your target and add the location to the INCLUDES of the .pro file for the project. (thread discussion with more details[5]). Command log for using lib on local emulator:
sudo apt-get install libtelepathy-qt4-dev libsqlite3-dev git clone https://vcs.maemo.org/git/tpsession cd tpsession/tpsession-0.1/ find ./ -name Makefile -exec rm -f {} \; qmake && make && make install
Might need to edit the INCLUDES in projects .pro file. For using on a target you need to install the nokia closed source libs and recompile tpsession for the phone and then:
cp tpsession/libtpsession.so* <target_working_lib_dir>
For now we have tested this only with the local emulator.
In Scratchbox
Same steps as for MADDE except that you will need to install the nokia libs which you have to agreed to a ALU for. See steps 7 through 7.2 at http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation#Installing_Maemo_5_SDK_on_x86-32_Debian_based_distribution
Qt API's
Saving Application Settings
Missing MADDE libs
The freemantel sysroot in madde sdk is missing some of the libs. hence the name "slim". In paticular it was missing some of the telepathy-qt4 components i wanted. Others have discussed two methods for solving this. 1. copy from scratchbox sdk. 2. install lib directly on n900 and copy from there to madde, and then from your local includes as well. I introduce a 3rd, I hope more logical approach. Copy from the scratchbox deb (so that you can avoid installing scratchbox).
$ wget --mirror --no-parent --no-host-directories --cut-dirs=5 --accept *armel.deb -e robots=off http://repository.maemo.org/extras-devel/pool/fremantle-1.2/free/t/telepathy-qt4/ for i in *.deb; do dpkg-deb --extract $i `echo -n $i | sed 's/.deb//'`; done
There are two revisions for each package and to determine which one the MADDE SDK required we can compare some of the telepathy files already installed in the slim sysrootm. For example, the telepathy lib is already installed and if we compare the file size with the downloaded packages we can see that we need revision2:
$ ls -l ~/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/libtelepathy-qt4.so.0.0.0 -rw-r--r-- 2 user user 2646296 2010-10-11 08:42 libtelepathy-qt4.so.0.0.0 $ ls -l ./libtelepathy-qt4-0_0.2.0-1maemo5_armel/usr/lib/libtelepathy-qt4.so.0.0.0 -rw-r--r-- 1 user user 2648944 2010-02-08 20:39 libtelepathy-qt4.so.0.0.0 $ ls -l ./libtelepathy-qt4-0_0.2.0-2maemo5_armel/usr/lib/libtelepathy-qt4.so.0.0.0 -rw-r--r-- 1 user user 2646296 2010-04-13 19:58 libtelepathy-qt4.so.0.0.0
telepathy-qt4/libtelepathy-qt4-dev_0.2.0-2maemo5_armel$ cp -r ./usr/include/telepathy-1.0/TelepathyQt4 /home/user/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/telepathy-1.0/.
$ cp ./libtelepathy-qt4-0_0.2.0-1maemo5_armel/usr/lib/libtelepathy-qt4.so.0* /home/user/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/. $ cp ./libtelepathy-qt4-dev_0.2.0-2maemo5_armel/usr/lib/libtelepathy-qt4.a /home/user/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/.
to install tpsessions open tpsession.pro root and add this: LIBS += -L/home/user/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/
comparing symbol tables $ ./symbtblcmp.pl objdump tpsession/tpsession-0.1/tpsession/libtpsession.so.0.1.0 ~/nokiaqtsdk/Maemo/4.6.2/targets/fremantle-1030/bin/objdump ~/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/libtpsession.so.0.1.0