|
|
Log in / Subscribe / Register

Jolla and Mer

By Jake Edge
May 7, 2014

Embedded Linux Conference

As David Greaves held up a phone to begin his Embedded Linux Conference talk, he said that it would be no surprise that phone was not running Windows Mobile or iOS—the surprise is that it is not running Android either. In fact he was holding up the Qt/Wayland/systemd/Btrfs phone, which is better known as the Jolla phone. In reality, though, it is really a "Linux phone", he said, unlike Android-based phones.

Greaves started out at British Telecom, then worked on Maemo, and then its successor, MeeGo. The latter has been shut down, but Nokia and, especially, Intel did an awful lot of work in creating MeeGo. Two guys (he and Carsten Munk) looked at MeeGo and saw much that was useful there, so they founded the Mer project, he said. MeeGo was a bit over-ambitious, though, so Mer slimmed down MeeGo's 1500 packages to around 300.

[David Greaves]

That's the background for the Jolla (which Greaves pronounced as "Yah-La", which contrasts with our last attempt at capturing the pronunciation) phone. But he stressed that he was not giving a "pitch for Jolla", who he works for now. He is proud of what the team of 90 people has done in less than a year, in hardware design, and the development of an operating system and user interface, but the fact that Jolla has "proven" the Mer approach is also important.

One thing that Greaves's talk did not do was to dispel the murkiness around the boundaries and capabilities of the various components. Projects like Mer, Nemo Mobile, Sailfish OS, and the Jolla phone have been talked about over the years, but it is (and always has been) a bit unclear where one project stops and the next starts up. Part of that is likely caused by the overlap in participants among those projects, but it does, at times, get rather confusing.

In any case, Sailfish OS can (obviously) run on Jolla devices, but it can also run on the Galaxy S3 and the Nexus 4. That is part of the Sailfish for Android project. Support for more devices is in the works using the Hardware Adaption Development Kit (HADK or "haddock" following the nautical theme). The idea is that any device that is rootable and will run CyanogenMod will also be able to run Sailfish OS. That will allow many more folks to try out the phone operating system without buying any new hardware.

Technology

The user interface (UI) is important, Greaves said, and "a good place to start" looking at the technology used in Mer/Sailfish OS. The UI is based on Qt 5.2 and Qt Modeling Language (QML, the JavaScript-based UI language for Qt). Qt was chosen for a number of reasons: it performs well, is open source, is not Java-based, and it has a huge developer base. In addition, the existence of QML played a role in that decision because it allows rapid UI development, he said.

QtWayland replaces Android's SurfaceFlinger as the compositor for Sailfish OS. It is not currently using the Android HWcomposer (for 2D graphics) "strenuously", but there are plans to do more of that. The performance of QtWayland is "pretty damn good". Wayland was chosen because it is not difficult to work with and it meshes well with the Android shared-buffers approach, he said. In the end, the developers don't really notice Wayland at all, since QtWayland basically handles that interaction for them.

One area where Qt has problems is its size. It it is a "big piece of software", which means it eats up a fair amount of phone resources. But Qt 5.2 has started modularizing Qt, so that only certain parts need to be included.

Another technology used in Mer/Sailfish OS is systemd, which has "been quite polarizing" in the open-source world. There is something of a love it or hate it attitude about systemd, but they came down on the "love it" side, Greaves said. There were times where "we swore a little bit" at systemd, but by and large it served their needs well.

Systemd is "really fast", predictable, and well-documented, he said. The Journal is "a good fit for us" as well. There have been some issues with user sessions, but part of that may be that the version of systemd was adopted "a long time ago in systemd time". In fact, the biggest problem they have run into with systemd is its rapid development pace and how closely tied it is to newer kernel versions. He hopes that Debian adopting systemd will help alleviate some of those problems in the future.

For Sailfish OS, there is a mix of systemd and Android init code. In fact, the Android init is being run as a service under systemd. The uevent data from Android is being interpreted by udev rules and mount units are created from the Android rc files. Jolla is still exploring how to manage the "mix of two worlds", he said.

Mer/Sailfish OS uses Btrfs for storing data. No partitions are used; Btrfs's dynamic subvolumes are used instead. Snapshots are used to restore the factory settings, but those settings are old at this point, so Jolla is looking into updating that snapshot. In addition, it is looking at using snapshots for features like rolling back unwanted changes and for easy backups.

For handling the network, ConnMan is used. They ran into some problems using it, but writing ifup/ifdown scripts would have been far worse, he said. A recent upgrade to a newer version of ConnMan has helped, too. There are some difficult issues around network handling, no matter what solution is used. The rules for choosing when to use various data sources (3G, WiFi, etc.) and when to switch between them are rather complicated. For phone features, oFono was used, while PulseAudio handled the audio path; both worked quite well, with few problems, he said.

Libhybris

System-on-Chip (SoC) makers typically only create board support packages (BSPs) for Android. "Open hardware is great", Greaves said, but there is not much of it around. Instead there are a bunch of user-space blobs for various pieces such as the camera and haptic feedback. All of those blobs use the Bionic C library, but Sailfish OS (and many other Linux systems) use glibc. Hybris (or libhybris) is meant to bridge that gap.

The idea is to allow Bionic-using code to co-exist with glibc-using code in the same process address space. It required wrappers around Bionic functions and some name mangling (prepending "android_" on Bionic functions for example). It was done with relatively few patches (around ten) to Bionic, he said, mostly for functionality like POSIX threads, errno, hardware vs. software floating point, and so on.

Using libhybris means that, for example, the Android EGL and GLES libraries can be used by glibc applications. Then it is just a matter of "rinse and repeat" to get wrappers for other Android libraries, like Gralloc, NFC, OpenCL, Camera, and so on. Greaves said that the project(s) will be trying to make libhybris work for any device that has a CyanogenMod build.

The rest of the phone is a "fairly standard Linux stack". It uses Git for phone backups, though some tweaks were made to handle videos since "Git-committing videos is not a bright idea". It uses RPM as its package manager, and Gstreamer for multimedia content. It uses the Linux kernel, too, of course, though the project doesn't do much with it: "if it boots and runs the hardware", it gets left alone.

If you build it ...

The Mer project has a Platform SDK that is used to build it. Mer "didn't want to have to worry" about which tool versions were installed on the builder's system, so it includes all of the right versions to be used inside of a chroot(). It uses Scratchbox2 for cross-compilation support. Scratchbox2 is "sane, sensible, and usable", Greaves said, which is quite a departure from the earlier Scratchbox. It is so much different (and better) that he wishes it had been given a new name.

Packages can be created easily. Typically it requires some minor tweaks to an existing package spec file. The result of the build is an RPM file that can be installed on the device. There is some LD_PRELOAD trickery in Scratchbox2 to invoke the cross-compiler (using Lua to do pattern-matching), all of which is "a little ugly", but makes it "seamless to the developer", he said.

The SDK can run in a virtual machine, which allows Windows and Mac users to use it. There are a small number of people in the company and project, so porting all of the tools to multiple platforms is not a viable solution. Virtualization solves that problem, he said.

Jolla and Mer use the Open Build Service (OBS), which is an "incredibly powerful build system", he said. Mer focuses on trying to enable vendors to make products, and OBS fits right into that model. Someone can submit a package to OBS and it will automatically build versions for multiple architectures.

It is not just packages that are built that way, though. The latest development tree of Mer and Sailfish OS are built regularly, typically driven by Git commits. The automated system will invoke mic (originally, the Moblin Image Creator—and the reason Mer had to start with an "M", he said with a chuckle) to create an image that can be flashed onto a device for testing.

Working in the open

Mer and Jolla came out of Maemo and MeeGo, which taught them a lot about working in the open. In the MeeGo days, some of the now-Jolla folks sometimes gave Nokia and Intel a hard time about not working more in the open. But now, those folks appreciate the problem from the other side. It's a hard problem and they are trying to learn from the mistakes that have been made in the past.

For Jolla, there are (at least) two pieces to the problem: working with its upstream (Mer) and collaborating with other vendors on new devices. Jolla's internal policies are geared toward the way it works, some of which may or may not mesh well with open-source projects and Mer in particular. For example, all commits must refer to or close a bug number (as the bug tracker is also used as a task tracker). There is an automated process that adds the commit message to the bug tracker, but that isn't particularly useful for Mer, which has a public bugzilla.

Jolla has an internal open-source policy as well. To start with, employees should participate in open-source projects as themselves, rather than as representatives of Jolla. But not all employees came from an open-source background, so some amount of education is needed. Policies covering interactions with projects is part of that as well. Helping to create those policies sometimes made Greaves feel like Bill & Ted: "Be excellent to each other", he said with a laugh.

The Mer project consolidates all of the open-source work that Jolla does (much of the UI layer is still closed). The Mer project's vision is "to make it easy to make devices". That explains what the project is doing and why, he said. For example, there is no UI for Mer. Nemo Mobile was a project started to create the middleware and UI for Mer, but most who are using Mer also use the middleware, so the middleware has been moved into Mer. That means that Nemo Mobile is just UI now, which shrinks it down considerably and, he hopes, makes it more accessible as a community project.

From the Mer project's point of view, the Jolla device is "huge credibility shot" for the project. But Mer works with others too, including Ubuntu and Intel on libhybris. Mer aspires to be more than just code, because "code is not enough". For devices to be easier to make, it requires best-practices documentation in lots of areas: quality assurance, how to do releases, how to manage regressions, building images, handling source repositories, bug tracking, and more.

But, the Jolla phone has shown that the Mer approach works. It took around nine months for 90 people to deliver a working phone with a brand new UI. Others can do the same.

All of the projects would love to have more participants, he said. For example, the camera does not currently work on Sailfish for Android on the Galaxy S3, but Ubuntu got the camera working for Ubuntu Touch, so "come help make it work". In addition, phone platforms are really just 3G data platforms with a touchscreen and some other interesting hardware; phones are not the only things that can be created on such a platform.

While Mer-based devices may not be free-software compliant (because of the binary blobs), Mer will be ready when free drivers come along. It doesn't make sense to wait for those drivers and then to start working on phones and other devices, he said. In that scenario, devices that are free-software-only will have fallen way too far behind.


Index entries for this article
ConferenceEmbedded Linux Conference/2014


to post comments

Jolla and Mer

Posted May 8, 2014 7:51 UTC (Thu) by halla (subscriber, #14185) [Link]

Last year, we've worked on doing a calligra and poppler-based office document viewer app for Jolla -- the successor of FreOffice and Harmattan's Documents app we did for Nokia and the Meego tablet document viewer we did for Intel: there's a screenshot at http://kogmbh.com/news.html. We actually did it twice, once for Qt4 and then again for Qt5

It was a really good experience, working with Jolla and Sailfish. Jolla get sopen source and the development environment was much better than it was in the Nokia days. Plus, it was just plain fun to be involved!

Qt binary compatibility

Posted May 8, 2014 10:54 UTC (Thu) by tau (subscriber, #79651) [Link] (6 responses)

Hmm. I wonder how they plan to support the API and ABI evolution of Qt over the long term if they're going to have a Jolla app store. C++ and long-term binary compatibility are not a good combo. Just look at all the contortions HaikuOS has to go through in order to be binary-compatible with the prehistoric version of G++ that was used to build BeOS.

Of course, there IS a stable Linux C++ ABI these days, and has been for some time, so it might be possible, but you'd have to set up your build environment very carefully (static-link your STL implementation, for instance, so that moving to Clang and its libc++ implementation is possible further down the line), and then compel everyone in your app store to set it up in that way.

Or are Jolla applications restricted to being written in JavaScript? If so then this is yet another mobile platform that can be safely ignored.

Qt binary compatibility

Posted May 8, 2014 14:47 UTC (Thu) by Jonno (guest, #49613) [Link]

> Hmm. I wonder how they plan to support the API and ABI evolution of Qt over the long term if they're going to have a Jolla app store

All Qt 5.x releases will be 100% ABI compatible with all prior 5.x releases. API compatibility will not necessarily be 100%, but fairly close, and if you don't want to change the code at all you can always continue to compile against an old SDK.

When Qt 6.x eventually comes around it will be co-installable with 5.x, so 5.x applications will continue to work just fine.

If you use any non-Qt C or C++ library directly, you are on your own...

Qt binary compatibility

Posted May 9, 2014 0:19 UTC (Fri) by giraffedata (guest, #1954) [Link] (4 responses)

there IS a stable Linux C++ ABI these days, and has been for some time, so it might be possible, but you'd have to set up your build environment very carefully (static-link your STL implementation, for instance, so that moving to Clang and its libc++ implementation is possible further down the line),
I'm confused. Why does one have one's own STL implementation? Isn't it part of the standard C++ library? I thought STL as an independent entity was a historical thing.

Qt binary compatibility

Posted May 9, 2014 7:00 UTC (Fri) by halla (subscriber, #14185) [Link] (2 responses)

It's a moot point anyway. If you're coding for Sailfish, you're not using clang, you're not using stl. You're using the development environment provided by Jolla and Qt.

Qt binary compatibility

Posted May 9, 2014 8:35 UTC (Fri) by javispedro (guest, #83660) [Link] (1 responses)

Well, you are using the STL (or bits of it, even Qt is only to provide std::string / QString conversion). Fortunately ABI breaks on the STL have been very rare, with only C++11 changes being significant ( http://gcc.gnu.org/wiki/Cxx11AbiCompatibility ). And even then, gcc often decides to break compatibility with C++11 before breaking STL ABI. ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49561 ).

Qt binary compatibility

Posted May 9, 2014 9:38 UTC (Fri) by halla (subscriber, #14185) [Link]

I haven't checked recently, but I wouldn't be surprised if the Qt on Sailfish is compiled without things like QString::toStdString() -- that's a fairly sensible thing to do. After all, std::string is useless in the common run of things.

Qt binary compatibility

Posted May 9, 2014 12:28 UTC (Fri) by jwakely (subscriber, #60262) [Link]

Most people say "STL" when they mean "C++ standard library".

Sadly it seems that will always be the case.

Jolla and Mer

Posted May 8, 2014 18:00 UTC (Thu) by ncm (guest, #165) [Link] (1 responses)

This all seems much more mature than I had imagined. It makes skeptical me wonder what I'm missing. Were I to load this onto my Nexus <N>, what would I be giving up at this stage, aside from my precious, precious apps?

Can it coexist with the Android installation in a dual-boot, chroot, or some such arrangement? Given that it depends on a new-ish kernel for the benefit of systemd etc, can that same kernel run an Android userspace without compromise (e.g. battery life)? What are some examples of things it can (be made to) do that Android never will? Is there any prospect of running undemanding Android apps, someday, in some sort of jail?

Jolla and Mer

Posted May 9, 2014 17:15 UTC (Fri) by lbt (subscriber, #29672) [Link]

What you'd be giving up:

Some initial stability of course; Some hardware (eg camera, bluetooth) for a short while as we all just chip away at the HAL. https://wiki.merproject.org/wiki/Adaptations/libhybris for progress. Otherwise not much else.

Coexist as dual-boot:

Yes - we need to take the time to setup multiboot. It uses the stock android kernel rebuilt with minor config changes for linux userspace. Multiboot would kexec the vanilla kernel and should be stock.

Examples of things Android will never do:

Accept patches :)
Seriously though, this is a full gnu/linux stack. Run what you like. Python, ruby, perl, C++, C. Porting is usually fairly easy but you may hit libs that also need porting fairly soon.

Android apps in a jail:

Maybe ... :)

Jolla and Mer

Posted May 9, 2014 15:27 UTC (Fri) by Baylink (guest, #755) [Link] (5 responses)

SystemD is "well documented"

Um; where would that be?

I have 34 years experience with sysVinit; I have yet to find *any* documentation that I consider suitable both in depth and readable for systemD, assuming I can find any at all.

I invite pointers.

Jolla and Mer

Posted May 9, 2014 15:39 UTC (Fri) by peter-b (guest, #66996) [Link]

Where have you looked so far?

Jolla and Mer

Posted May 9, 2014 15:48 UTC (Fri) by dtlin (subscriber, #36537) [Link]

I've recently switched to Systemd init from sysvinit - Systemd definitely has a lot more standard documentation than sysvinit.

The main systemd manpage is a good overview of how everything fits together, and all the config files are based on .unit + additions, for example .service, .timer, etc.

Seriously, magnitudes better than man 5 inittab, which is also dependent on a lot of distro customizations. At least for now, all distros using Systemd are very close to mainline.

Jolla and Mer

Posted May 9, 2014 16:13 UTC (Fri) by raven667 (guest, #5198) [Link]

> SystemD is "well documented"

The description of "well documented" is the opinion of the Jolla and Mer developers, they didn't have to choose systemd and I think we can take their opinion at face value, for their purposes and with their experience they believe systemd to be well documented. I don't think you can argue that this opinion is not legitimately an opinion or is not legitimately their opinion so I'm not sure what purpose the scare quotes serve.

> I invite pointers.

I don't believe you https://lwn.net/Articles/589470/

I think you are just frustrated that after all these years of being an expert the world has changed and you are going to have to learn something new to keep your skills up to date and you want to rant about it.

Jolla and Mer

Posted May 9, 2014 23:20 UTC (Fri) by tomegun (subscriber, #56697) [Link] (1 responses)

Jolla and Mer

Posted May 10, 2014 5:11 UTC (Sat) by ncm (guest, #165) [Link]

Thanks, this will help me regain my skills.

Progress is like an unending series of small strokes. Keep up or give up, there's no middle ground. But that's not to say fads count as progress. Learning something else put you ahead of everybody who took up Java. (If you did take up Java, it might not be too late for you.)

Contributing as yourself

Posted May 11, 2014 13:32 UTC (Sun) by moltonel (subscriber, #45207) [Link]

> employees should participate in open-source projects as themselves, rather than as representatives of Jolla.

What's the idea behind this ? Why pass up on that "free" advertisement for Jolla amongst the developer community ?

I know I usually contribute as myself rather than using my company email, but it's just a matter of habit (plus the idea that I might not work in the same company forever), not company policy.

Jolla and Mer

Posted May 15, 2014 20:03 UTC (Thu) by landley (guest, #6789) [Link] (1 responses)

Your phone comes with a preinstalled OS, but this is a different one you can install on it aftermarket, with only a small chance of bricking it. This new OS only supports some of the hardware, but we've got this NDISwrapper shim that might let you use some the original OS's drivers. It provides a different and incompatible software ecosystem, although we're working on a Win-OS/2 layer that might provide partial compatibility with some of the apps of the original OS. If the stars align we may achieve third place market share by the end of the decade.

As long as we're back in the 90's, when do we have the "Android Refund Day" march and a series of antitrust trials about "cpu tax" and "bundling a ham sandwich"?

Rob

Jolla and Mer

Posted May 16, 2014 10:40 UTC (Fri) by lbt (subscriber, #29672) [Link]

Let me branch that and hack on it with you:

Your(?) phone comes with a preinstalled (and non-free) OS that you have very little influence over; but now there is a way to install a more open GNU/Linux one on it with the same low risk of bricking it as the widely used Cyanogenmod. This new approach to installing your favourite OS supports all of the hardware using the original OS's drivers by exposing the fairly stable Android API to you - but doesn't impose bionic. It provides the same widely used software ecosystem that all linux distros use, although we're encouraging a layer that might provide partial compatibility with some of the apps of the original OS. We'd like to eat too and hope you don't mind if we try to build a business around a more opensource mobile device - heck, we may even succeed!

Sadly our phones are where our PCs were back in the 90's, but instead of pushing for an "Android Refund Day" march and organising a series of antitrust trials about "cpu tax" and "bundling a ham sandwich" we went out and built a linux phone. It's not an easy road and we're certainly doing our best to continue to work as OSS community people even though we now get paid to write OSS.

:)

Hopefully I addressed some of your points? Sure the hybris shim is not as elegant as hardware with a native GNU libc driver; nor is it as open as hardware with OSS drivers. However - as I've said before: this is what we have to work with and what we've done opens up a huge new vista of hacking opportunities.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds