AUG
11
2008

Getting KDE on an n810.

Since Nokia will be giving 100 n810 devices tomorrow at the Embedded and Mobile day at Akademy, I thought it would be a good idea to describe a bit how you can get KDE working on your brand-new device. Since it is already quite some weeks ago I first did this, I might be missing some crucial steps, so if you have any questions after reading this/playing with your n810, feel free to ask me, I'll be at Akademy for the entire week. Writing this I've discovered how bad I am at writing any kind of howto/documentation, but hopefully it will still be a bit helpfull, and else you should just ignore it :)

So, the first step on getting KDE compiled to run it on your n810 would be to get scratchbox and the maemo SDK from maemo.org by just following the install instructions.

Next you'll need to get all the dependencies of kde installed. To get Qt you'll need to add some extra repositories to your /etc/apt/sources.list, namely:

deb http://qt4.garage.maemo.org/ diablo user
deb http://repository.maemo.org/extras/ diablo free non-free
deb http://repository.maemo.org/extras-devel/ diablo free non-free
deb http://qt4.garage.maemo.org/ diablo extras

With these two sources added you should now be able to install Qt and cmake packages (as well as several other kde dependencies that I no longer remember; hopefully cmake will tell you what you are missing when you're compiling some module). In addition to dependencies that are already packaged I also had to compile some libraries that weren't already packaged (or perhaps they are packaged in some repository and I just didn't find the correct repository). It appears that for some reason I also compiled my own CMake CVS version, but I doubt that is needed as the packaged cmake 2.6 should be new enough to build kde. Among the packages I installed manually are at least boost, shared-mime-info (I think the packaged one wasn't new enough for kde), poppler, taglib and xine, although some of those libraries are probably only required for some kde modules, not if you only want kdelibs/pimlibs/base. Compiling anything in scratchbox is quite straight-forward as all the cross-compiling is handled transparantly, and even things like configure checks by running a program work just fine by internally using qemu to run the ARM executables. One of the more annoying things you'll likely encounter is that this qemu method doesn't always work correctly. qdbuscpp2xml for example doesn't seem to work correctly. It should probably be possible to somehow also get a 'native' x86 version working, but what I found easier to do to is to simply run the correct qdbuscpp2xml commands manually everytime the build stops because qdbuscpp2xml failed (you'll probably want to run make with VERBOSE=1 for that). Besides that I think you shouldn't encounter many problems compiling a basic kde system (parts of kdesupport, kdelibs, kdepimlibs and kdebase).

For most stuff I think using trunk should be just fine, there are however some things where you'll need some patches to it (alternatively you could also use my branch of kdelibs and kdebase at branches/work/soc-plasma-sff). I think at least the patches in r826076 and r843252 will be needed to be able to compile all of kdebase (although the later is not needed if you don't want to have sound or can figure out a way to get xcb compiled/installed). I think most other changes in that branch are mainly needed when compiling kde for an openmoko phone, and so aren't needed (but won't harm either). r844884 is also quite important if you want to run any application that links to libkjs. Without it your application won't do anything as some instruction in the static initializers of libkjs will take indefinetely.

Okay, now you should have build and installed a basic kde system, and now it is time to get it running on your device. Let's assume you installed all the stuff you compiled to /opt/kde4, you than should copy that entire directory to your device. There won't be enough space for it on the root filesystem, so you can either copy it to somewhere in your internal storage card, or use a mini-sd card for it. By default the internal storage and/or your sd card will probably have vfat on it, and since I'm not sure if kde supports being installed on a vfat device, it would probably be safest to first reformat the storage you're going to use to ext3 or something like that. To copy stuff you can either use your usb cable (your n810 will look like a mass storage device for your computer), or use scp or rsync to copy the files over the wifi connection (that option however does require you to first install an ssh server as there isn't one by default). After installing kde you'll have to make a symlink from (in this example) /opt/kde4 to whereever you copied your files, which could be something like /media/mmc1/kde4. You'll also need to install all the required packages if you don't want to get library not found errors when starting kde applications. You might need to add more sources on you n810 than you needed to add in the scratchbox environment, as by default a lot less repositories are used.

To install packages (and probably also to create that /opt/kde4 symlink) you might need to have root access to your device. Getting root access is normally done by executing 'sudo gainroot', although this requires you to first use the flasher application that is also used to flash a new image, to put your device in R&D mode.

When you'll be compiling your own code (or perhaps also in one of the base modules) the compile errors you'll most likely encounter are caused by the fact that on ARM targets qreal is not a double like on x86, but a float. This normally doesn't cause problems, but in constructs like qMax(qreal-variable, 0.0) you will be mixing a float and a double and g++ won't be able to figure out which template instantiation to use. In these cases you will have to add an explicit qreal(0.0) cast to the double literal.

Okay, I hope I haven't confused you all too much and you actually could get something usefull out of this braindump, although I fear it might not make much sense in all places, and probably I've also forgotten some important things, so if you have any questions just shout and hopefully I'll be able to help you (and I think there are also some nokia guys to help with problems with the devices).