The Pinephone Pro, PostmarketOS, and Why Mainlining Phones is Important

Published 2022-09-07 on Anjan's Homepage

In #sxmo on OFTC, users often ask why the pinephone pro is less functional on postmarketOS than other distros. PostmarketOS uses a mainline pinephone pro kernel 1. There exists a heavily patched fork of the linux kernel called the megi kernel with broader support for the functionality of the pinephone pro 2. In this blog post, I will explain why postmarketOS has mainline-first approach.

Carrying around forks of the kernel is not sustainable as it becomes impossible to provide security patches after a short time. The only way to truly fix this for a device is mainlining it.

Moreover, I have ran into stability issues when using heavily forked kernels with postmarketOS. Recall that postmarketOS is aiming for a 10 year lifecycle for smartphones. Forked kernels are a hurdle we must overcome to achieve this goal.

It is often suggested that we use the megi forked kernel for the pinephone pro in the postmarketOS distro as a temporary solution. However, it is easy to underestimate how permanent a temporary solution can be - the heavily forked megi kernel for the original pinephone is used in postmarketOS and has not been upstreamed 3. PostmarketOS cannot change from the megi kernel to the upstream kernel for the original pinephone without losing functionality. Indeed, postmarketOS is trying to change the status quo where phones are a throwaway insecure mess cause the code is so heavily patched. Only shipping the mainline kernel creates pressure for someone to mainline the megi kernel patches.


PostmarketOS is the only linux distro I have used on my pinephone, pinephone pro, and android phones because of how well the distro is maintained. Indeed, the mainline-first approach encourages the community to enact best practices. If you are convinced of the importance of mainlining and postmarketOS’s approach, here is how you can help:

Help mainline the pinephone pro kernel

The megi kernel is not as bad as a typical downstream kernel. For example, megi’s kernel has a ~500k line diff and OnePlus 6’s downstream kernel has a ~5000k line diff 4. However, we should still work towards mainlining the megi kernel. Megi expressed in the past that he is not interested in mainlining because rebasing to the latest Linux release is less work for him. Megi’s work is valuable and a good start. I am thankful he is doing this work but we need to work as a community to make sure his work lives on forever.

There has been progress on mainlining the pinephone pro kernel! The pinephone pro device tree has been merged into the upstream linux kernel 5. If you want to help, please checkout the #cross-distro-kernel channel on the irc network and the gitlab 6. There are lots of people in #postmarketos-mainline channel on the oftc irc network to help you learn how to mainline. Maybe you can mainline other Android phones?

Buy functional mainlined devices

I have been daily driving the poco f1 with Sxmo for a couple months and it’s the perfect phone 7. You can also use the OnePlus 6/6T for similar support. These devices have proper mainline support in postmarketOS and can be obtained in Canada for 150 Canadian dollars. Optionally, you can donate the money saved from buying SDM845 devices to the developers making sure we have lots of mainline devices to use 8.


I appreciate megi’s work as a start but we need to mainline devices to have a polished experience long term. If postmarketOS merged heavily forked kernels for devices, a lot of work would need to be done to maintain those devices. More likely, we wouldn’t bother and have severely insecure devices after a couple years. The large initial investment of mainlining is worth it.

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~anjan/ [mailing list etiquette]

Articles from blogs I follow around the net

These articles/blogs do not represent my own opinions or views.

Notes from kernel hacking in Hare, part 1

One of the goals for the Hare programming language is to be able to write kernels, such as my Helios project. Kernels are complex beasts which exist in a somewhat unique problem space and have constraints that many userspace programs are not accustomed to. T…

via Drew DeVault's blog September 7, 2022

Linux machines that just work

In some sense, 2022 has been resembling the long-memed Year of the Linux Desktop. Although this sounds like some cult's prophetic rubbish, by looking at the success of the Linux desktop in very empirical terms an improvement of the last couple of year…

via TuxPhones - Linux phones, tablets and portable devices September 5, 2022

How to Build a Practical Household Bike Generator

We built a pedal-powered generator and controller, which is practical to use as an energy source and exercise machine in a household — and which you can integrate into a solar PV system. We provide detailed plans to build your own, using basic skills and …

via LOW←TECH MAGAZINE March 6, 2022

Generated by openring