About Blog Projects Papers Contact

I said I'd never blog

DeforaOS, NetBSD, reverse-engineering and stuff
The DeforaOS smartphone environment
Blog post by khorben
on Saturday, June 12 2010, 21:46

Member of

I'll change my habits a bit here, and write a personal note about what I've been working on recently. Some of you may know about it already, since I have begun to announce it, but probably to a smaller audience this far [1].

It's probably relevant to begin with some background information about all this, although even then it's difficult to know where to start.

Reinventing the wheel
For some reason I found the urge to start an Operating System project of my own, which began with a modified version of Debian GNU/Linux [2]. This goes as far back as 2001, which may seem like yesterday to many experienced UNIX users, but was just a year after my first installation of a distribution on my own computer. This turned into a LFS-based project [3], before becoming the DeforaOS project as it is today [4], with more or less the goal to re-implement a complete kernel and user environment.

That is to say, you may see a pattern here, and remind me that such time may be better spent improving the existing projects. While I would definitely agree that many Open Source projects need help (quite logically, otherwise I wouldn't have started my own), I will briefly summarize the reasons behind my choices:
  • I am having fun, and learning in the process;
  • back then, I did not have the technical means (eg cheap Internet access), let alone political power to influence much of the things I really wanted;
  • with my projects evolving, I stuck with this work and choices rather than give it all up;
  • frankly I still do not see myself having any political power now in the community, to do what I really want anyway;
  • last but not least, I am essentially trying to implement a different design, which I believe is worth a try.
Of course this doesn't mean that I always make the same choices as a professional [5]. This experience has always been useful, even though a compromise in design I made to implement a working solution unfortunately hasn't succeeded to date [6]. But I have then been focusing a full year on the hackable:1 project instead [7], with a few releases along the way.

The Openmoko Freerunner
This is clearly another illustration of the "reinventing the wheel" approach. Why go all the way and create an Open Source smartphone from scratch [8]? It sure must be tedious, and from my experience and the information I have obtained in the process, I can say it sure was. And I can't say it was a clear, undisputed success either.

I'll be honest: I never liked the device itself. I found it ugly and bulky at best. I encountered the most annoying hardware bugs and subsequent frustration rushes. No need to mention the community fragmentation, which didn't help either. But today still, it sure has its uses, and is actually useful in plenty of ways.

Coding again
Burning out, having new opportunities, I parted ways and resumed work as a security consultant instead [9]. I could afford to take a first break in far-away land (thanks a.) and have fun creating software again, rather than feel like a packaging robot for what seemed to me as being broken code anyway.

I could manage to get a few bugs fixed in my current Operating System of choice (NetBSD [10]), and then turn a few more sub-projects of DeforaOS to be good enough that I began to (finally) use many of them on a daily basis.

The motive(s)
Owning a Sharp Zaurus [11] for a few years, I had already been thinking about an embedded version of the desktop environment while writing it. But I could do better; I could take my revenge on the Openmoko Freerunner instead. Still bitter from the outcome of my efforts while working with the device, I was convinced that I could do better. Be it true or not, as always there is only one way to know: trying it hard, whatever the reason.

After a quick glance at the Openmoko community, to no surprise I found its activity to be declining. Maybe this is not true and I was simply expecting it, but I think it's fair to say that the hardware is aging. Nonetheless, combined with hackable:1 it has the advantage to easily letting me run my own native environment. This is certainly not true of the more popular mobile platforms.

Trying a different way
As mentioned, I thought I could turn this phone into something more useful than it already was. This was based on the following assumptions, based on my personal appreciation:
  • the existing projects are over-engineered;
  • they have no global coherence concerning usability;
  • they are often developed as regular applications, regardless of the hardware constraints.
Better then, some interesting and unusual features of the hardware are available and documented [12], some of which could turn into interesting security developments. I cannot pretend to have actually been able to do better, or implement all these fancy features, especially within this other month break; but here is where I am now.

The DeforaOS embedded desktop environment
First, I have spent some time improving and adapting my existing desktop applications to fit the Freerunner. I won't copy and paste what I have already written about it [13]. Instead, here is a summary of its current status:
  • neither hardware buttons are required (nor currently used) for regular operation, as everything can be done on-screen;
  • both panels are fully functional, with an integrated application launcher, and displaying the clock, hardware status (including registration, signal level and operator) and of course an application switcher;
  • the on-screen keyboard is fast, although definitely not finger-friendly at the moment (xkbd embedded in the panel), and will be re-implemented from scratch;
  • the contextual menus (as offered through a Gtk+ extension) could be more intuitively found;
  • the file manager is functional, but could be better integrated with the freedesktop.org standards;
  • the clipboard and drag&drop features from the same project could be improved as well;
  • the homescreen functionality cannot be enabled at the moment due to how matchbox-window-manager handles it;
  • DeforaOS' own window manager is not mature enough to be used instead at this point;
  • the latest versions of the web browser cannot be packaged on hackable:1 at the moment, as it depends on a more recent version of WebKit.
I think this reflects quite well what is to be expected there.
The DeforaOS smartphone environment
Meanwhile, I have implemented a complete telephony application from scratch [14]. The design goals were:
  • use Gtk+ and the glib libraries in C, and only relying on them and DeforaOS' libDesktop;
  • embed the GSM daemon directly inside it;
  • implement the core application with all the required functionality built-in (eg contacts, messages, phone calls, preferences...)
  • let this application be as reactive as possible (eg single process)
  • extend it through optional plug-ins;
  • support hardware modems as broken as on the Openmoko Freerunner.
It's still far from being eligible as a regular mobile phone sold with a contract, but as of today this first set of goals was mostly met. Some essential features are still missing:
  • adding, editing and deleting contacts;
  • maintaining a phone log;
  • sending DTMF codes during calls;
  • storing the messages sent;
  • support for delivery reports;
  • preferences dialogs;
  • entering the PUK/PIN2/PUK2 codes;
  • switching to data mode;
  • call forwarding...
Most of them are not challenging anymore, and are just a matter of taking a few hours this and there to get them done.
Where is gets interesting
One of the first parts I believe I should emphasize in this post is the plug-in support. First, it allows full integration with the actual, underlying hardware platform with all the code clearly separated. This is the case on the Openmoko, where:
  • a first plug-in takes care of supporting profiles, by requesting a ring tone, triggering the vibrator and so on;
  • the hardware plug-in catches these events and turns the relevant components on and off.
Secondly, it allows extending the functionality in lots of different ways, from PulseAudio support to DBUS and potentially FSO integration [15], without mentioning webcams, GPS positioning [16] and then more.

And there's more.

SMS encryption
One of the first additional security features I have been thinking about is SMS encryption [17]. While not being specific to the Freerunner, it is certainly an interesting platform for such a feature. My current implementation, while not being cryptographically strong at the moment, can already be demonstrated as a working Proof-of-Concept [18].

More than that, it is maybe time to think about a common, interoperable way to implement this feature. It looks like things could be moving towards this direction, with new projects emerging like TextSecure [19].

Cell tracking and geotagging
Not unlike some other phones, but probably in a more accessible way, the Freerunner supports an "engineering mode". It is basically a monitoring mode [20][21], much like the one on your regular 802.11abgn wireless card (except you can't sniff traffic, yet [22][23][24]).

While not being as featureful and polished as kismet [25], my current implementation (couple of days old) can already illustrate this concept.

The future
With a project as promising as Osmocombb [26] able to run on the Freerunner, I can only let you guess where all of this can be going. There are still many things to be done with this hardware, and of course I am also hoping to run my software on other devices as well, like the ones from ROAD [27], GizmoForYou [28], Nokia [29], Glofiish [30], HTC [31] and Palm [32] among others.

If you would feel interested in any of this, do not hesitate to let me know [33]. Better, you can use the development infrastructure directly [34]. I will welcome your feedback and ideas, free patches and hardware, consider contracted projects.

Thank yous
To conclude, I have omitted one of the reasons behind all of this in this post. I had the pleasure to be invited to the Nokia Hackfest in Berlin mid-March this year [35], and then be honoured with a free N97 and N900 device. They have both proven very helpful while developing this software already.

Of course there's a number of people and projects who are also a great help to me every day. I can only hope to be helpful to you, too. Cheers!

[1] http://www.defora.org/os/news/3363/Introducing-the-DeforaOS-smartphone
[2] http://www.debian.org/
[3] http://www.linuxfromscratch.org/
[4] http://www.defora.org/
[5] http://people.defora.org/~khorben/cv.en.html
[6] http://runningbear.org/
[7] http://trac.hackable1.org/
[8] http://www.openmoko.org/
[9] http://www.duekin.com/
[10] http://www.netbsd.org/
[11] http://www.trisoft.de/slc3200.htm
[12] http://wiki.openmoko.org/wiki/Neo_1973_and_Neo_FreeRunner_gsm_modem
[13] http://www.defora.org/os/news/3362/DeforaOS-as-an-embedded-desktop-environment
[14] http://www.defora.org/os/project/3343/Phone
[15] http://www.freesmartphone.org/
[16] http://realtimeblog.free.fr/
[17] http://www.cryptosms.org/
[18] http://www.passageenseine.org/hackevents/confidences-par-sms
[19] http://www.whispersys.com/
[20] http://nobbi.com/monitor/index.html
[21] http://www.gnokii.org/screenshots.shtml
[22] http://www.gnuradio.org/
[23] http://cryptome.org/jya/crack-a5.htm
[24] http://reflextor.com/trac/a51
[25] http://www.kismetwireless.net/
[26] http://bb.osmocom.org/
[27] http://www.road.de/
[28] http://www.gizmoforyou.net/
[29] http://www.nokia.com/
[30] http://www.glofiish.com/
[31] http://www.htc.com/
[32] http://www.palm.com/
[33] http://people.defora.org/~khorben/place/wiki/13/Contact
[34] http://www.defora.org/os/project/bug_list/3343/Phone
[35] http://www.youtube.com/watch?v=5jW3VDqvzLs

Come back...

Creative Commons License RSS