Meego – a first stroll

I was curious about the current state of MeeGo so i decided to have a look at the handset image that was released last Monday (v1.1). The image can be run inside QEMU or inside a chroot environment using Xephyr. I decided to go with the QEMU solution.
The setup is outlined here: wiki.meego.com/MeeGo_SDK_with_QEMU.

When QEMU is running, the emulated system can be accessed by SSH. So lets see what processes make up a Meego system (i have added some annotations; standard marks processes also found on a typical linux desktop).


[meego@localhost ~]$ ps -Hef
UID PID PPID C STIME TTY TIME CMD
# various kernel threads
root 2 0 0 07:53 ? 00:00:00 [kthreadd]
root 3 2 0 07:53 ? 00:00:00 [ksoftirqd/0]
root 4 2 0 07:53 ? 00:00:00 [migration/0]
root 5 2 0 07:53 ? 00:00:00 [watchdog/0]
root 6 2 0 07:53 ? 00:00:00 [events/0]
root 7 2 0 07:53 ? 00:00:00 [khelper]
root 8 2 0 07:53 ? 00:00:00 [async/mgr]
root 9 2 0 07:53 ? 00:00:00 [pm]
root 10 2 0 07:53 ? 00:00:00 [sync_supers]
root 11 2 0 07:53 ? 00:00:00 [bdi-default]
root 12 2 0 07:53 ? 00:00:00 [kblockd/0]
root 13 2 0 07:53 ? 00:00:00 [kacpid]
root 14 2 0 07:53 ? 00:00:00 [kacpi_notify]
root 15 2 0 07:53 ? 00:00:00 [kacpi_hotplug]
root 16 2 0 07:53 ? 00:00:00 [ata_aux]
root 17 2 0 07:53 ? 00:00:00 [ata_sff/0]
root 18 2 0 07:53 ? 00:00:00 [khubd]
root 19 2 0 07:53 ? 00:00:00 [kseriod]
root 20 2 0 07:53 ? 00:00:00 [kmmcd]
root 21 2 0 07:53 ? 00:00:00 [cfg80211]
root 22 2 0 07:53 ? 00:00:00 [kondemand/0]
root 23 2 0 07:53 ? 00:00:00 [kswapd0]
root 24 2 0 07:53 ? 00:00:00 [aio/0]
root 25 2 0 07:53 ? 00:00:00 [crypto/0]
root 33 2 0 07:53 ? 00:00:00 [scsi_eh_0]
root 34 2 0 07:53 ? 00:00:00 [scsi_eh_1]
root 37 2 0 07:53 ? 00:00:00 [kpsmoused]
root 38 2 0 07:53 ? 00:00:00 [usbhid_resumer]
root 39 2 0 07:53 ? 00:00:00 [l2cap]
root 40 2 0 07:53 ? 00:00:00 [krfcommd]
root 42 2 0 07:53 ? 00:00:00 [kjournald]
root 69 2 0 07:53 ? 00:00:00 [flush-8:0]
# the init process, sysvinit-2.86 (standard)
root 1 0 0 07:53 ? 00:00:00 init [5]
# hotplug support (standard)
root 72 1 0 07:53 ? 00:00:00 /sbin/udevd -d
# system instance of the dbus-daemon, broadcasts system events (standard)
dbus 256 1 0 07:53 ? 00:00:00 dbus-daemon --system --fork
# network connection management, see http://connman.net/
root 273 1 0 07:53 ? 00:00:00 /usr/sbin/connmand -W nl80211,wext
# access to hw sensors
root 275 1 0 07:53 ? 00:00:00 /usr/sbin/sensord
# http://meego.gitorious.org/meego-middleware/timed/
root 279 1 0 07:53 ? 00:00:00 /usr/bin/timed
# system and kernel logging (standard)
root 281 1 0 07:53 ? 00:00:00 /sbin/syslogd -m 0
root 287 1 0 07:53 ? 00:00:00 /sbin/klogd -x
# wifi connection management (standard)
root 293 1 0 07:53 ? 00:00:00 /sbin/wpa_supplicant -u
# ACPID events (standard)
root 297 1 0 07:53 ? 00:00:00 /usr/sbin/acpid
# the ssh session i am currently using
root 308 1 0 07:53 ? 00:00:00 /usr/sbin/sshd
root 513 308 0 07:54 ? 00:00:00 sshd: meego [priv]
meego 515 513 0 07:54 ? 00:00:00 sshd: meego@pts/0
meego 516 515 0 07:54 pts/0 00:00:00 -bash
meego 923 516 0 08:06 pts/0 00:00:00 ps -feH
root 314 1 0 07:53 tty1 00:00:00 /sbin/mingetty --noclear tty1
root 316 1 0 07:53 ttyS0 00:00:00 /sbin/agetty -L 115200 ttyS0 vt100
# bonjour/zeroconf service discovery (standard)
avahi 322 1 0 07:53 ? 00:00:00 avahi-daemon: running [linux.local]
avahi 323 322 0 07:53 ? 00:00:00 avahi-daemon: chroot helper
# telephony support http://ofono.org
root 328 1 0 07:53 ? 00:00:00 /usr/sbin/ofonod
# bluetooth device management (standard)
root 338 1 0 07:53 ? 00:00:00 /usr/sbin/bluetoothd
# user/session handling http://www.freedesktop.org/wiki/Software/ConsoleKit (standard)

root 352 1 0 07:53 ? 00:00:00 /usr/sbin/console-kit-daemon --no-daemon
# power management (standard)
root 448 1 0 07:54 ? 00:00:00 /usr/libexec/upowerd
# GPS, multiplexes the access to a GPS device
root 495 1 0 07:54 ? 00:00:00 /usr/libexec/gypsy-daemon --no-daemon
# X session launch utility
meego 741 1 0 07:57 ? 00:00:00 uxlaunch
root 743 741 0 07:57 ? 00:00:00 uxlaunch
# xserver (standard)
root 760 741 1 07:57 tty2 00:00:09 /usr/bin/Xorg :0 -nolisten tcp -dpi 120 -noreset
meego 772 741 1 07:57 ? 00:00:06 /usr/bin/mcompositor
meego 775 741 0 07:57 ? 00:00:00 /usr/bin/mthemedaemon
# the applaunchd helps to start applications faster with the help of boosters
# http://apidocs.meego.com/mtf/launcher.html

meego 776 741 0 07:57 ? 00:00:00 /usr/bin/applauncherd.bin
# boosters are pre-forked processes that are already initialized to some degree.
# if an app is started they load the app and start is main() function.

meego 788 776 0 07:57 ? 00:00:00 booster-m
meego 789 776 0 07:57 ? 00:00:00 booster-q
# handles prestarted applications http://apidocs.meego.com/mtf/prestart.html
meego 777 741 0 07:57 ? 00:00:00 /usr/bin/applifed
meego 778 741 0 07:57 ? 00:00:00 /usr/bin/mdecorator -remote-theme
# input method
meego 779 741 0 07:57 ? 00:00:01 /usr/bin/meego-im-uiserver -remote-theme
# input feedback deamon (audio/vibra) http://apidocs.meego.com/mtf/input_feedback.html
meego 780 741 0 07:57 ? 00:00:00 /usr/bin/meegofeedbackd
meego 781 741 0 07:57 ? 00:00:01 /usr/bin/sysuid -remote-theme
# dui => direct ui homescreen
meego 782 741 2 07:57 ? 00:00:15 /usr/bin/duihome --desktop -remote-theme
# QMF, process doing mail handling
meego 784 741 0 07:57 ? 00:00:00 /usr/bin/messageserver
meego 798 784 0 07:57 ? 00:00:00 [messageserver]
# crash handling
meego 785 741 0 07:57 ? 00:00:00 corewatcher-applet
# filesystem crawler
meego 786 741 0 07:57 ? 00:00:00 /usr/libexec/tracker-miner-fs
meego 762 1 0 07:57 ? 00:00:00 /usr/bin/ssh-agent
# user session instance of the dbus daemon, used for application IPC
meego 766 1 0 07:57 ? 00:00:00 dbus-daemon --fork --session --print-pid 9 --print
# user configuration, notifies apps about configuration changes (standard)
meego 769 1 0 07:57 ? 00:00:00 /usr/libexec/gconfd-2
# phone simulation, part of oFono
meego 793 1 0 07:57 ? 00:00:00 phonesim -p 12345 /usr/share/phonesim/default.xml
# system indexing, database daemon (standard)
meego 806 1 0 07:57 ? 00:00:00 /usr/libexec/tracker-store
# photo app that i've started earlier
meego 834 1 4 07:58 ? 00:00:18 meegophotos
# thumbnail service
meego 839 1 0 07:58 ? 00:00:03 /usr/libexec/tumblerd

What really surprised me is how much this system is like a linux desktop. Its using X, a full libc, the standard utilities, dbus etc… No stripped down libc, no busybox and no framebuffer. On one hand I quite like this but on the other I wonder how this translates to firmware size and memory consumption?

Posted in Linux, meego | Leave a comment

Ubuntu: headless install traps

Ubuntu can be installed headless using a serial console. A number of people have documented how to do it (for example http://zensonic.dk/?p=264). The theory looks simple, but in practice there are a few traps that can be really frustrating.

  • I’ve encountered a BIOS where the support for “keyboard USB legacy” was disabled by default. This prevented me from interacting with the installer. Using a PS2 keyboard (or an USB/PS2 adapter) might be something to try.
  • Make sure your serial cable is really a null modem.
  • Remember that when you change the console parameter to the kernel, the keyboard layout is english. Typing “console=ttyS0,115200n8 –” on your localized keyboard might result in something unexpected.
  • Try to boot into the installer with the least number of bootable devices attached. I’ve encounted problems with a fresh CF-card that had an empty partition that was marked bootable. The BIOS selected it instead of the USB-stick with the Ubuntu installer.
  • If you know that the BIOS is booting the wrong device you might be able to blindly change the boot-order. Many BIOS have a “quick boot selection” feature.
Posted in Uncategorized | Tagged , | Leave a comment

Podcasts: Scott Meyers on C++0x/Johan Bezem on Misra

Software Engineering radio recently had two episodes which are of particular interest to the C/C++ developer.

First Scott Meyers gives a nice high-level overview on the features of the upcoming C++0x standard covering Lambda expressions, Uniform initialization, Initializer lists, threading and Variadic templates amongst others. Wikipedia has a good article covering C++0x in more detail. The episode is quite entertaining not only because Scott is a good speaker but also because Markus, the host of the podcast (a Java-guy), apparently has several C++WTF moments. Link – Episode 159 C++0x.

The second episode is with Johan Bezem who is talking about MISRA which is a set of guidelines for C/C++ development promoting safety and reliability. MISRA was developed and still is mainly in use in the automotive industry. To be frank the episode isn’t as entertaining as the one with Scott but i finished it because it provides an interesting perspective on C development for small/deeply embedded systems. Link – Episode 152 MISRA.

Posted in C++, C++0x, Podcast | Leave a comment

Eclipse CDT language mappings

Eclipse/CDT fails to parse some file? You don”t see anything wrong with it, neither does the compiler? Still CDT underlines parts or all of a file to mark a parse error? The most probable cause is that your file has a file extension that CDT associates with the C language, but it contains some bits of C++.

To solve this problem the CDT offers a feature called language mapping which allows you to override the default for a given file type. This can be done for a single file, for the project or for the whole workspace.

For a single file, right click on a file in the project browser -> select Properties -> C/C++ General -> Language Mappings. The dialog also offers some shortcut to do it on project or workspace level.

Posted in C++, Eclipse | 1 Comment

Integrating the NetworkManager with aiccu

I am using the service of SixXS to connect my laptop with the IPv6 internet. They provide an utility called aiccu to setup the tunnel. Getting it to work is really painless. Just do an “apt-get install aiccu”, configure your SixXS username and password and your done.

The aiccu package provides a traditional startup script which is placed in /etc/init.d and is added to the different run levels. Files on the different levels are executed in alphabetical order. The name of the aiccu script ensures that it is run after the network has been brought up. So as long as the networking on your system is statically configured through /etc/network/interfaces everything is fine.

Unfortunately i am (as most probably other desktop users also) using the NetworkManager to handle my network connections. This means that at the time that the aiccu startup script is run there is no network available which will make the tunnel setup fail.

What i would like to do is to run the aiccu script every time the NetworkManager has established a connection so that the tunnel is re-established. Fortunately NetworkManager provides a way to do this. It will run (in alphabetical order) all the scripts placed in /etc/NetworkManager/dispatcher.d/. The scripts are passed two variables, the interface name and if it is going up or down. The scripts are run as root.

Copy this script to /etc/NetworkManager/dispatcher.d/99aiccu to integrate aiccu with the NetworkManager. It should work with KDE and Gnome.


#!/bin/bash

IF=$1
ACTION=$2

if [ "$ACTION" == "up" ]; then
/etc/init.d/aiccu restart
fi

if [ "$ACTION" == "down" ]; then
/etc/init.d/aiccu stop
fi

Posted in IPv6, Linux | 3 Comments

Kubuntu 9.10 DNS/network troubles

After installing Kubuntu 9.10 RC1 networking became kind of flaky. It somehow worked but everything was slow and unpredictable. It was most visible while browsing the web. Some pages where loading for ages (5+ minutes), some never finishing to load at all while others were just fine after some initial delay. This problem was not only visible in firefox but also in konqueror.

I started wireshark to have a look on what was actually going on. It showed that my computer was sending DNS queries to my local DSL router (SpeedPort W303V; an ISP provided blackbox). This DSL router also works as a local DNS-cache which it is advertising via DHCP. This explains why the DNS queries are sent to the DSL router. The traffic log showed further that requests for A records (IPv4) were properly answered but requests asking for AAAA records (IPv6) were never blessed with a reply. The missing answer was triggering some retry mechanism which was resending the AAAA record request a few times. Only after this mechanism timed out, the browser was actually starting to load a page.

This nicely explains why some pages were loading fine after some initial delay (all content on one server) while others were loading forever (complex sites were a lot of addresses need to be resolved to load all content). It also explains why firefox and konqueror were both affected, DNS resolving is typically handled by the libc.

The DNS cache in my DSL router is apparently not handling requests for IPv6 address records. So far i was not able to figure out what exactly has changed between Kubuntu 9.04 and 9.10. Just replacing the /etc/resolv.conf with a version pointing to an external DNS server solved the problem for now.

Apart from that Kubuntu 9.10 looks very promising. A lot of the KDE4 problems which plagued me in 9.04 are gone.

Posted in Kubuntu, Linux | Leave a comment

Adding new sites to the eclipse updater “hangs”

Just for the record: If adding a new site to your eclipse updater seems to hang/times out (entry is always “pending…”), its most probably not a problem with the update site itself but rather some firewall interfering. Make sure you have setup the appropriate proxies in eclipse (Window->Preferences->General->Network Connection).

Posted in C++, Eclipse | Leave a comment

Installing a gcc4.4 snapshot on Ubuntu

The upcoming gcc4.4 release adds a few more C++0x features (initializer lists, auto typed variables, defaulted and deleted functions, strongly typed enums, …) to the in this regard still very incomplete g++. To be able to play with it one has to compile a gcc-snapshot which turned out to be fairly easy.

  • Download a copy of the gcc-core and the gcc-g++ snapshot from here. I used gcc-core-4.4-20090306.tar.bz2 and gcc-g++-4.4-20090306.tar.bz2
  • Extract both archives into the same directory. tar xvjf gcc-core-4.4-20090306.tar.bz2 && tar xvjf gcc-g++-4.4-20090306.tar.bz2 && cd gcc-4.4-20090306
  • run configure ./configure --prefix=$SOMEPLACEBe sure not to overwrite your default gcc-installation. If anything is missing configure will complain.
  • On my Ubuntu system i had to install libmpfr-dev to proceed. sudo apt-get install libmpfr-dev
  • Now all it takes is time…make && make install

To use it just put $SOMEPLACE in front of your $PATH. If you are using it to compile code which uses C++0x features (which is the whole point) you have to add -std=c++0x to your compiler command line. Bonus: If you are using Eclipse/CDT you can start it with the modified path and the builder will pickup the new gcc just fine.

Posted in C++, C++0x | Leave a comment

Eclipse CDT 6 Milestone 5

The final release of CDT6 is still a few month ahead (scheduled for ~June) but there are already public milestone builds available. I haven’t played much with M5 but one thing that directly caught my attention is that you no longer have to manually setup all the include paths in your project. Eclipse will just use all the headers inside your workspace to resolve includes.

This is something i have been longing for for years. If you work inside a large projects tree with a lot of include directories (think public interfaces/private headers of N modules) its really painful to add all these to the project.

It will also enhance the out of the box experience for people importing their first project into eclipse. I know from experience that most people don’t know that they have to setup the include paths first (how should they? before CDT5 the default setup was not even outlining missing includes!). Without being able to resolve the includes the indexer will not work properly so all the advanced features are not available (go to definition, type hierarchy, global symbol lookup, macro expansion, include browser, etc…). Confronted with such a crippled project first timers might jump to the conclusion that eclipse has not much more to offer than their trusted editor of choice.

As always i am looking forward to the full release.

Posted in C++ | 1 Comment

Elegant human readable enums

While reading the source of some FOSS project i noticed that the authors have come up with a nice way to get human readable enums through the use of the “stringification feature” of the C/C++ preprocessor. The trick is that the members of the enum are declared through a macro which can be expanded in different ways.

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cassert>
  4. #include <time.h>
  5.  
  6. namespace MyStuff
  7. {
  8.     enum Things {
  9.         #define THING(X) X,
  10.         #include "things.def"
  11.         MAX_THINGS
  12.     };
  13.  
  14.     static const char* const ThingNames[] = {
  15.         #define THING(X) #X,
  16.         //             ^ preprocessor stringification
  17.         #include "things.def"
  18.         NULL
  19.     };
  20.  
  21.     const char *toString(Things t) {
  22.         assert(t >= 0 && t < MAX_THINGS);
  23.         return ThingNames[t];
  24.     }
  25. }
  26.  
  27. int main(int argc, char **argv)
  28. {
  29.     using namespace MyStuff;
  30.     std::srand(::time(NULL));
  31.     for (int i = 0; i < 4; ++i) {
  32.         Things aRandomThing =
  33.             static_cast<Things>(std::rand() % MAX_THINGS);
  34.         std::cout << toString(aRandomThing) << std::endl;
  35.     }
  36. }
  37.  

things.def:

  1.  
  2. #ifndef THING
  3. #define THING
  4. #endif
  5.  
  6. THING(CELLPHONE)
  7. THING(NOTEBOOK)
  8. THING(CUP_OF_TEA)
  9. THING(MOUSE)
  10.  
  11. #undef THING
  12.  

Time after time i am amazed what you can do with some of the advanced preprocessor features like “token pasting” or stringification.

Posted in C++ | Leave a comment