[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

I am still interested in the official one but if you get the ok of FP for sharing I would be very interested in trying out as well :smile: since my compilation did not succeed as written earlier…
To have (working) root would be nice of course but maybe this could be added later.

Just for clarification: If you take out your userdata.img and cache.img what would be needed to be put in its place - something I could back-up from my phone already?

In any case, great thanks to all of you having (tried to) compile(d) the sources into a (more or less) working build!

I am trying to see under which conditions I can get root permissions :

$ adb shell ls /sbin
opendir failed, Permission denied

$ adb shell su -c ls /sbin  

So the phone is indeed rooted. That said it is still unavailable from within a terminal emulator.

About your userdata/cache question I’m not 100% sure myself but just wiping the partitions already present should be enough, you wouldn’t even need to flash them (now that would be great). For now everything has been working like a charm ! I’ll explore a bit then try to make more sophisticated builds if I feel like it (but having a custom recovery would be much better… we could simply flash the su zip and be done with it).

I had no problems using adb she’ll and using so in this Shell. Did work fine, I could execute commands like expected. Right now I’m not in the position to flash, due to the weak old phone I put a few apps I don’t need a backup for on the new phone, so it’s semi productive now :smile: as soon as I have root on stock this will be the main phone… So either I get a recovery going or fairphonians will be faster…

BTW, fastboot flash -w should do the job. It only touches boot.img, recovery.img and system

1 Like

Yeah I don’t either, that said you cannot use su from within the phone (I even went so far as to copy the su binary to a place accessible by the phone’s terminal emulator, and there is a check, not every uid can use the embedded su). So the adb shell has root access (which is great), but not the apps.

Thanks for your fastboot advice !

Also, I found out the hard way :smile: that the bootloader is your friend for flashing after having flashed a rom that won’t boot. Adb logcat showed the problems while booting, and reboot bootloader took me back to the bootloader for flashing the next ROM…

I have resynced the repo, did everything again, but the system.img has the same size. To be precise, it has a size of

451076060 Bytes (430,2MIB)

Arvil, how many Bytes exactly do you have?

It probably depends on how you make MB out of it. :wink:

451055580, the difference doesn’t matter much anyway (there are tiny variations from build to build that depend on the host, depending for example on the username and hostname)

The official answer has to be No, this is not allowed because your ROM contains the non open source blobs and that those restrict you from doing so. That said we are investigating how to help the community. One option would be to let the end user download and install the blobs. We can investigate more solutions provided those are … provided.


A post was merged into an existing topic: FP2 root or not root? How?

Yeah that’s pretty much what I feared. Thanks for your swift answer. I know it’s probably not FP pushing for such restrictive EULAs but god damn that’s infuriating, it’s like being back to the computing stone age, with stones running Android. And with “open it, it’s yours” written on the cover to make things worse.

I look forward to your proposals for solutions.

1 Like

Compiling the code worked like a charm for me. You just have to follow the instructions exactly as they are written there.

You really do need Ubuntu LTS, or at least something with an old version of gcc.

If your main operating system is different, the easiest thing to do would be to boot an Ubuntu LTS live image and compile everything from there. I did something more complicated: I installed Ubuntu in a VM (the LTS version has upstart and refuses to work with modern systemd distributions) and compiled everything inside an NFS share. Then I entered the NFS share, reran “. build/envsetup.sh” and choosecombo, and flashed it from there. Anyway, it works perfectly so far :slight_smile:

Hi all,

I found out that location services don’t work in my self compiled image. Mozilla Stumbler finds and connects to 4 satellites indoors, but it still reports my position as unknown. It also fails to detect any cell phone towers or WiFi access points, while I am connected to both WiFi and mobile network.

Can anyone test their own images and let me know?


Do you think a Docker image would be a good solution to achieve the same with less overhead and performance penalty? A docker image could use the LTS Ubuntu version and automatically run all the steps necessary to build. That would probably avoid headaches for many people.

I am not sure how docker works regarding init systems - chroot didn’t work, and I am not too optimistic about docker, but it might work. In fact, it could be a very good idea that would save people from a lot of headaches. I might give it a go later today if I have time, but if anyone wants to try, please give it a go and let me know!

Unfortunately I don’t have enough space on my computer to try it. It should be pretty straightforward though. I don’t see a reason why it would not work.

I’m indoors, but I’ll try this in the middle of the afternoon and edit my post

I did not leave compiling as of yet, but concentrated on recovery. As twrp is very demanding (for me), I started manipulating the stock recovery. I deactivated zip verification and added busybox and a link to fstab. I successfully flashed SuperSu (on stock ROM). TiBu and a few other apps are happy now. Besides me


@lklaus awesome! Are you allowed to share a howto? :slight_smile: I rooted it once with KingRoot and replaced it with superSU, but since then I reflashed and reverted to factory settings, so I’m really not sure I want to install KingRoot on the thing again…

Also there are official Docker images for Ubuntu 14.04 so it’s entirely possible to make a docker image ready to use for compiling Fairphone: https://hub.docker.com/_/ubuntu/ - I’ll have to wait for someone else to do it though :frowning:

Also, could someone be kind enough to check if location services work with a self-compiled image? If something is broken in the code, it should be noticed and fixed earlier rather than later…

I’ve tried it, it took some time to fix (but maybe that’s because it’s kind of indoors…) but got a fix anyway.

Nice to see the successful bootups!

Regarding the sharing issue: Did someone try to compile a build completely without the blobs? If this works and the so-compiled build boots up at least into recovery, the blobs could be simply inserted afterwards in a flashable ZIP (probably, once the sh issue is solved).