[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

Now that’s a funny bug :smiley: thanks for your update
Do you know if it is officially OK to provide our builds publicly ?

1 Like

Soo I went ahead and flashed everything on the phone without waiting for custom recoveries (because why the hell not ?). I flashed the version I was talking about in my antepenultimate post, and so far everything seems to be working quite well (apart… you know… from the obvious lack of apps).

  • Wifi OK
  • Bluetooth OK
  • Camera OK
  • SMS OK
  • Keyboard still can’t do gesture typing OK
  • Ugly “no sim card” icon OK
  • Only red led notifications OK
  • Fairphone apps work well (FairphoneLauncher3, PrivacyIndex, Updater)

Terminal emulator says I don’t have a SU binary. adb root works though, and I can adb shell su which shows a root shell prompt but no command works (it just hangs). Can’t wait to share :slight_smile:

Btw does anyone know if it is possible to erase userdata and cache from fastboot without having to flash them (I guess it’s with the -w option) ? I don’t want to have to share userdata.img and cache.img but I had to flash them in order for the phone to boot correctly.

1 Like

Ok,

I have done:
Deleting all files in ~/fairphone_os/out/target/product/FP2
(Not anything in it’s subfolders!)

then:

cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libart.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libloc_ds_api.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libmdmdetect.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libOmxVdecHevc.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libOmxVdec.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libwpa_client.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
cp vendor/qcom/proprietary/target/product/FP2/obj/lib/libart-compiler.so ./vendor/qcom/proprietary/target/product/FP2/system/vendor/lib/
source build/envsetup.sh
make -j8

It now gave me a system.img of 430.2 MB.

Klaus, if you should find some minutes to give it a last try, you have the link to the file. :wink:

Just a tip, jochensp’s command line works directly in a shell, no need to copy-paste it every time modifying the lib !

My working version with all these libs included weighs 431MB, don’t you want to try flashing yours (provided the build actually showed it succeeded) ? :slight_smile:

I don’t have a Fairphone, yet, so I can’t flash it myself! :frowning:

My order number is somewhere in the 11.000’s. Jochen’s command did not work, somehow. So I split it up to see where the error is. Like this, there wasn’t any.

Did you run a repository sync today? I did not, maybe this explains the difference in file size. And: I didn’t delete the subfolders, resulting in a complilation being ready after like 5 minutes.

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  
adbd
healthd
security_boot_check
ueventd
watchdogd

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.

2 Likes

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?

Thanks!

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.