[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

You are right. One would have to configure the container to have access to USB. It’s probably possible, I don’t know how.

But you can easily install fastboot on your host operating system (it is available for Linux, Windows, etc) and flash from there. Incidentally that’s what I did half an hour ago.

1 Like

In case anyone else had the same problem, what I did to fix it was open the id_rsa.pub file and copy it from my text editor instead of pasting the results of “cat id_rsa.pub”.

But at the same time I also poked around my account on the website and added a user name, that might have been what actually fixed it.

It seems it’s starting to work! These are the steps I took.

After repo sync, fetch the superuser-related patches from Fairphone’s Gerrit and add Superuser:

# Apply pending Superuser patches
repo download fp2-dev/device/qcom/sepolicy 5
repo download fp2-dev/device/fairphone_devices/sepolicy 6
repo download fp2-dev/device/fairphone_devices/fairphone 7
repo download fp2-dev/platform/frameworks/base 8
repo download fp2-dev/platform/packages/apps/Settings 9
repo download fp2-dev/platform/system/core 10
repo download fp2-dev/platform/system/extras 11

# Add local manifest for Superuser's su
mkdir -p .repo/local_manifests
wget -O .repo/local_manifests/superuser.xml https://raw.githubusercontent.com/wvengen/Superuser/feature/try-fix-aosp-build/local_manifest.xml
repo sync -c package/apps/Superuser package/apps/Widgets

Then edit system/core/rootdir/init.rc and add after the existing imports:

import /init.superuser.rc

edit: editing init.rc may not be necessary, patch 7 seems to add it already.
Then continue to build and upload.
When you have installed Superuser with package name com.koushikdutta.superuser, it may just work.

I’m curious to hear if this works for anyone else.

2 Likes

I’m glad to hear it works for you. I got familiar with this missing import aswell :relieved: Saying I see you are making the same steps I have done right one week before :slightly_smiling:
Since it is not easy to understand short-held compiling questions, I wasn’t sure about your knowledge-level. My build is running right now, and if it works, I’ll have a one-build solution with TWRP and Superuser-embedded all-at-once. We’ll see…

@xaxa great, let’s see!

This does not yet include the Superuser app. It would be useful to have it installed in the system image, and it would be good for security (or any app using the same id could obtain root when it’s not installed).
It seems that currently only su in the shell works, not from apps :frowning: I guess it’s a permissions/user/selinux problem (selinux line + Permission denied for opening local socket).

Does anyone here (running their own version of android) experience the random reboots everybody is discussing here:

2 Likes

When I try to compile, I get the following error:

[code]out/host/linux-x86/bin/checkpolicy: loading policy configuration from out/target/product/generic/obj/ETC/sepolicy_intermediates/policy.conf
external/sepolicy/radio.te:33:ERROR ‘unknown type persist_file’ at token ‘;’ on line 3850:
allow radio persist_file:dir search;

checkpolicy: error(s) encountered while parsing configuration
external/sepolicy/Android.mk:121: recipe for target ‘out/target/product/generic/obj/ETC/sepolicy_intermediates/sepolicy’ failed
make: *** [out/target/product/generic/obj/ETC/sepolicy_intermediates/sepolicy] Error [/code]

When I then do cd external/sepolicy/; git checkout cae72b60bc2e4f5509c08232f211044af7eb375d and try to compile again

clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1

My build (host) system is Arch Linux.

no, I don’t

1 Like

That won’t make any difference.

That is indeed a necessary step to do (I thought I mentioned that above). :slight_smile:

Ok, first try and first successful make ! Instead of a make -j8 I tried a simple make. It tooks about 6 hours to build but I have a fully functional Fairphone Open Source OS on my FP2 now.
Thanks a lot everybody for all the tips.

6 Likes

I didn’t see where you mentioned it before (this forum layout is confusing :slight_smile:

Sometimes there’s issues with copy/pasting adding weird line breaks, depending on where you copy/paste from so I thought I’d mention that too. (I’ve had that issue before when adding keys to my authorized_keys file.)

I just have deleted my whole branch yesterday :confused: and now i need a halfway latest FFOS Image which is working. Can someone please send me a build from the last week? Downloadspeed 200kps sucks for another buildingstart. Would be great! :slightly_smiling: jom

Obviously a new version of FPOS has been released today. Would you guys know if the sources are updated as well, i.e. would it make sense to download and compile again?

And would I still need to apply the Unified NLP patches to have network-based location on a Google-free FPOSOS?

1 Like

I have to admit that I didn’t check myself, but I would assume that you can answer your questions by looking at their gerrit… Afaik some pull requests have still been open.

Thank you!!! sigh If only I understood more about Geerit & co…

I tried cloning the fairphone osos repos as described in the build instructions, but the given http-address 404s and the ssh-address gives “Permission denied” although i did add my key in gerrit. Does anyone know where else i can get the sources?

If you are running Ubuntu 16.04 which uses OpenSSH 7 then you will need to add a .ssh/config file with the gerrit host to allow the right cypher: http://www.openssh.com/legacy.html

For Example:

user@skylake:~/fairphone_os$ repo init -u ssh://code.fairphone.com:29418/fp2-dev/manifest -b fp2-sibon
Unable to negotiate with 37.187.31.110 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

Edit needed:

user@skylake:~$ cat .ssh/config
Host code.fairphone.com
KexAlgorithms +diffie-hellman-group1-sha1

1 Like

@tom.longshine did you also do a ssh-add on your private key?

elajoie@skylake:~$ ssh-add .ssh/id_rsa
Identity added: .ssh/id_rsa (.ssh/id_rsa)

Thanks for your help, but i already did allow the legacy cypher. ssh-add is just for the ssh-agent and didn’t have an effect.

@tom.longshine Have you tried looking at debugging?

This setting enables level 3 debugging:

elajoie@skylake:~$ cat .ssh/config
Host code.fairphone.com KexAlgorithms +diffie-hellman-group1-sha1 LogLevel DEBUG3