English

Getting Linux on Fairphone 3 : DTS / Hardware specification

Hello, I am trying to port PostmarketOS to the Fairphone 3 device. This is not base on android but pure Linux so to boot the device I need to have a working dts (device tree).

Thanks to the official release code I can read the dts file for Android and this give a lot of intel. Sadly there are 15k lines to read and for the port a lot of naming and values have to change.

The PostmarketOS community is very helpful, I want to know if anyone here have some insight or are trying the same endeavor. Knowing more about the hardware would help a lot (GPIO usage and such) so if any technical staff could give some information this would make the port way faster.

Thanks

7 Likes

I’m tagging @z3ntu here, he ported PostmarketOS to the FP2.

I’ve looked a bit into the device tree when we tried to get the FP3 to boot with anything else but stock:

this is a lot to read and a number of failed attempts, but eventually led to a rooted device and the ability to run a self compiled kernel – it’s not a stock kernel of course, as all those qualcom specific patches are needed (including device drivers) to talk to the phones chips.

the phone doesn’t just run linux, it also runs firmware code in a secure enclave “above” the linux kernel, and some of the hardware (modem and such) needs proprietary user space programs to use and run signed servlets in this secure environment. the qualcom linux drivers are mostly just stubs that allow userspace programs to talk with these firmware applets ( screen/display, wifi, modems, …) – but it’s possible that a minimal linux will run without (serial console, USB, flash memory access)

it’s a bit of a mess – most of the relevant dtb tree entries are also related to these qualcomm patches – but I’m no dtb expert.

I haven’t ever managed to compile a working kernel with the compilation tools that come with the kernel, only with the android tools which override some options regarding which device tree files to use

that thread linked above has all the gory details, including how to compile the “stock” kernel correctly - looking into that should tell you which dts files are actually being used and with which options.

problem is that both dtb and a dtb overlay files are being generated and I haven’t fully understood how :wink:

1 Like

I knew about this thread, most of the information here is irrelevant to me. I already extracted dtb/dts from official code and boot images.

My problem is even tinkering with gpios and memory allocation the kernel will not even start to boot and directly go back to fastboot. It is likely something hits a secured location, but not knowing if it is from gpio, memory or an other configuration makes it very hard to go forward.

Added that some of the problems might be outside device tree and more in driver/firmware this is very complex to untangle. I hope to find someone with the knowledge to just boot anything (no USB, no peripheral, just bare minimum is enough). I am not sure if Fairphone’s technical staff check this forum.

Also notes that other sdm632/msm8953 devices boots OK with the postmarketOS mainline linux.

Why don’t you start from a known working - selfcompiled - linux/dtb/dts combination as published by fairphone (with a minimal userspace /ramdisk for debugging) and then just figure out the diff to the mainline linux kernel of the same kernel version? that should make it more easy to apply the same patches + device tree changes to your kernel version of choice

also you can check the git log - using these kernel sources as suggested in

maybe that has some hints

I already have this as reference as well as TWRP (feels like dts is the same).

I got my first postmarketOS mainline kernel boot so I started pushing the code here : https://github.com/Corentin-pro/linux/tree/fairphone-fp3

You will see the dts is very much different, people from postmarketOS also told me not to follow downstream (changes from vanilla Linux) too much anyway. So knowing more about the hardware would help a lot. (like why did I add to reserved the GPIOs 0-3 and 135-139 to be able to boot. I had to blindly test by dichotomy to find them).

2 Likes

If anyone has information about the screen I would love to have technical documentation.