Aiming for a 10 year life-cycle for smartphones

May 26, 20176 min. read

Samsung Galaxy SII (i9100) running postmarketOS

Introduction post to postmarketOS, a touch-optimized, pre-configured Alpine Linux with own packages, that can be installed on smartphones. (Not usable for most people yet!)

Minimalistic Linux distributions run fine on ten year old PCs.

It is 2017. Pick an average PC from 2007 and install a minimal Linux based operating system. You will be able to do basic computing tasks (eg. surfing the web, reading E-Mails, listening to music, chatting) just like on an expensive modern PC. You will even get security updates, so your old computer is protected, just like as a new one.

Why are Android/Linux phones different?

Androids architecture is based on forking (one might as well say copy-pasting) the entire code-base for each and every device and Android version. And then working on that independent, basically instantly incompatible version. Especially adding device-specific drivers plays an important role.

This workflow makes it next to impossible to patch all Android devices with security updates in time or at all (Stagefright vulnerabilities for example rendered one billion devices vulnerable). And even if the vendor provides updates, it will only be for a limited time and then you must buy a new device to get security updates or the latest Android version. How convenient!

Alright, so there is the LineageOS community, which provides weekly updates for an impressive number of smartphones. They provide a practical solution today, and we are very grateful for that. However, such Android based projects will always run behind Google and the phone industry, fixing only symptoms but never the root-cause.

This is just the tip of the iceberg. Android has way more problems, read Cascardo's GNU on Smartphones (part II) for more nightmares.

We can fix this as a community.

Here is the solution: Bend an existing Linux distribution to run on smartphones. Apply all necessary changes as small patches and upstream them, where it makes sense.

Of course we are not the only ones, that came to this conclusion - especially in the last few weeks with the Halium project rising (greetings!). We are all-in for working together — sharing udev rules, merging Android kernels together, whatever makes sense!

Unlocking encrypted rootfs via telnet

postmarketOS architecture

We're working on an Alpine Linux based distribution called postmarketOS where each phone will have only one unique package — all other packages are shared among all devices.

These device-$vendor-$name packages contain a so-called /etc/deviceinfo file, which describes what makes the device special: SD card availability, which flash software to use and other information. The file format is not stable yet, and once we have common kernels for multiple devices, We'd like to include the required modules and dtb name.

And just to make it clear, postmarketOS does not fit the Halium model, as it avoids the Android build system entirely and does not run any part of the Android userspace next to its more or less typical Linux userspace. (At least not in the regular install, but it could come at some point in the future as optional compatibility layer for Android applications if someone wants to work on it.)

pmbootstrap

Technical details incoming! If you're not into that, skip this section.

Alpine Linux is really small. A base installation is only about 6 MB in size and takes not more than a few seconds to extract! Thanks to this characteristic, we can have a bootstrap program that abstracts everything in chroots and therefore basically runs on top of any Linux distribution, which has Python 3 and the openssl command line program available.

Consequently, the host system does not get touched when installing the required programs (fastboot etc.) and your distribution doesn't even need to have them packaged.

Quick feature rundown:

* x86_64/armhf: Example architectures for host/target. The code is generic, so it should work with any architectures supported by Alpine Linux.

Future goals and where you could help

Rough direction of where we'd like postmarketOS to head to. In case you're a hacker who wants to help, feel free to do so. But please write into the tracker before starting serious work. This way we can make sure, that we do not have redundant work.

Devices

Pick an old Android device, that you don't need anymore and start porting postmarketOS for it. It should be pretty straight forward. One device-* package, one for the kernel, calibrate the touchscreen, and the demos should more or less work already!

If you're feeling adventurous, try a non-Android device. How about iPhones?

Drivers

Make the following peripherals work:

In most cases, the drivers are already provided by the Android/LineageOS kernels, that we currently use and only need to be configured in the userspace (for example with udev rules).

The long time goal is using the mainline kernel.

Phone interface

postmarketOS is developed in the spirit of regular Linux distributions, so there's no problem in having multiple phone interfaces (just like Plasma/GNOME/XFCE/...) and let the user choose.

See the current status in #62.

Security

Great care has been taken to make pmbootstrap safe, as it will run on productive systems of postmarketOS developers. This is not the case for postmarketOS in its current proof-of-concept state (Weston runs as root, ...) so we must work on that before it can be used in real life. Even better would be privilege separation throughout the entire OS.

This post was originally published here. It has been slightly modified to remove outdated information and to reflect the community efforts.

Photos

postmarketOS demos menuFirefox running in XWaylandhtop in two weston-terminalsWeston smoke demolg-mako: colors are red, but weston-editor works due to the bigger screen size