English

[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

That’s correct, that’s the way I did it

@USB-2 yes, the version from chainfire.

Hello,

thanks for the good guidance. I just hope there will also be a possibility to “just root” the FP2, without putting a new image on. Configuring the phone took quite a while and I don’t want to do that again. So basically I hope that the FP guys bring out a superSU.zip that works with FP2.

Cheers,
Georg

3 Likes

There you go, a basis to write your Dockerfile for the Fairphone build environment a Docker image with the Fairphone build environment.

Mind that I wasyou might not able to run this because of a kernel bug.

This, however, should be an easy start for anyone who wants to give it a try with docker (recap: this is useful to get the same build environment everywhere and has less overhead compared to virtual machines).


[Edit: Changed information to refer to pre-built Docker image on Docker hub]

4 Likes

In theory :slight_smile: this works without messing up your system. I had my system setup also, and didn’t want to redo all. If you flash recovery, it does not mess up the system. But I’m no expert for recovery, so I can’t say how good my patch for the recovery really is or whether it’s done with a sledgehammer… I wanted my phone setup as soon as possible, but also Fairphones description on how to root will be out rsn, as I understand

Maybe a stupid question - if I compile from source, would I have Android’s file system layout available before creating the images in a last step? So that I could manually do all the steps a given update.zip (such as SuperSu or OpenGAPPS) would do when ran from recovery? Or will I run into trouble with users, groups and permissions? (Obviously this post is inspired by the strange discussion on rooting…) Thank you a lot!

FYI: I yesterday got a reply from the technical support regarding my question about the release date of the Fairphone FOSS OS:

calculate within the first quarter of 2016. The software team is quite
busy these days. The best chance to get in touch with them is to be a
active member in the forum.

Thanks for your ideas. We currently
working on minor software fixes of the current FP2 release. Than we will
focus an updates and the open source tasks from our side.

If nothing happens till mid of February please remind me to pressure it a little!

4 Likes

I compiled Fairphone OS by following the instructions on http://code.fairphone.com
Took about 90min until it said everything was successful.

After fastboot flashall succeeded the phone restarted into recovery, NOT into the OS.

When I boot the phone now the following happens:

  1. short vibration
  2. fairphone splash screen shows
  3. popup in ubuntu that “Android” connected (because usb cable was connected)
  4. short vibration
  5. fairphone splash screen shows
  6. screen goes black
  7. recovery mode is active

At the bottom of the screen there is an error message:

E:Can't open /dev/block/platform/msm_sdcc.1/by-name/misc
(Permission denied)

I tried “wipe data/factory reset”, but it didn’t help. I have read that it only resets data, not the OS itself, but I tried it nonetheless.

In the recovery logs the error message from above appears several times.

How can I analyze/fix this?

The error itself is not a problem, it happens on stock and on my own build too. Have you tried flashing the images one by one ? On top of “flashall” (which I don’t use, I flash each image sequencially) I also flashed cache.img and userdata.img (just to be sure, it should be enough to wipe them but I did it anyway).

I flashed these images in sequence: boot, cache, persist, recovery, splash, system and userdata.
Still it won’t boot.
Can check additional logs? How do OS developers debug these errors?

Does the fact that I am still able to flash it mean that there is hope that the phone can eventually be rescued?

I can’t help you much for the first part without having the phone in front of me (there might be logs on the phone that you can retrieve while in recovery mode through adb yes).

For the second part, definitely. You will be able to flash a working ROM (sadly it’s currently a breach of license agreement to publish ROMs built with the binary blobs…) when you have one.

Two things
If you did not follow the thread here on the forum, chances are that libraries are missing. E.g. libart.so
Without this the system will not boot. You might be able to see this with adb logcat
Second, when flashing system it might be better to use -w for wiping. I guess you have no data on the system yet
The bootloaders part seems to be very stable, it’s not easy to totally brick the phone

1 Like

@lklaus I just found time to try your patch - sorry it took a while, I was trying to debug the location issue first.

Compilation fails, saying that it didn’t find recovery/root/sbin . However, I do see the sbin directory in out/target/product/FP2/recovery/root … ?

vivia@talos:~/fairphone_os$ ls -l ./out/target/product/FP2/recovery/root/sbin total 816 -rwxrwxr-x 1 vivia vivia 314196 Jan 8 18:06 adbd -rwxrwxr-x 1 vivia vivia 337260 Jan 8 18:06 healthd -rwx------ 1 vivia vivia 177928 Jan 8 18:06 security_boot_check lrwxrwxrwx 1 vivia vivia 7 Jan 8 18:06 ueventd -> ../init lrwxrwxrwx 1 vivia vivia 7 Jan 8 18:06 watchdogd -> ../init vivia@talos:~/fairphone_os$

It’s missing in recovery/root/sbin. And I think I did not touch this. Will check. I am just trying to get a pristine environment, but I’m fighting how to get single files back

More failure :frowning:
I removed that line and the image compiled successfully, I do see the out/target/product/FP2/recovery/root/sbin directory on the computer somehow. However, adb sideload fails to flash SuperSU: "E: Error in /sideload/package.zip (Status 255)"
And of course the phone doesn’t appear to be rooted.
The .zip file itself seems OK, I managed to extract it. Also, I did see the “SKIP Verifying package” message.

Hello Vivia , why are you sideloading the package and not “simply” including it in the original image?

Second question:
Because you are compiling your own version that version is also signed with the default keys used in the open source build.
if so why not sign the package to sideload with that key?

1 Like

@keesj: Hi, thanks a lot for your answer! The thing is, I’m a developer, but not an Android developer. How do I include the package in the original build? I unzip the files, but where do they have to be copied to? Are there any other files (Makefiles etc) that need to be changed to account for these changes?

Hi Vivia,

sorry, I forgot I included busybox. Which was compiled from my tries from having look at TWRP. I’m right now checking how to include busybox in this recovery in a sane way. Besides, I’m not really sure whether busybox really is needed. After a failed flash, it is helpful checking the log file from recovery. Just chose the first log file, and then it’s a bit complicated finding the relevant entries, First you find the start messages (including the failed mount of misc, for orientation), then there are lots of build.prop entries listed and then you find the exact reason why the install failed.
So, there are two possible things, either the mount of /system failed, or it says “update-binary: No such file or directory”. In the last case the busybox is necessary…
This would be interesting for me…

Thanks! Here’s the (hopefully) relevant section fro the log file:

[more things]
E:Can’t open /dev/block/platform/msm_sdcc.1/by-name/misc <-- you got that too, right?
(Permission denied)
locale is [en_US]
stage is []
reason is [(null)] <-- is that the real error message?
fb0 reports (possibly inaccurate):
[…]
Command: “/sbin/recovery”

av.offload.enable = true
(more stuff)

I understood that the build instructions are currently having errors/missing pieces of information (e.g. some .so need to move somewhere, the gcc version that was successfully tested). Solutions for this problems have been posted in this thread – that is already over 150 posts long. I’m confident that the Fairphone software team will improve the build instructions once they find time for it. Until then you probably will have to read through the whole thread to collect the different bits of helpfull informations to successfully build the Fairphone Open Source OS.

To make it easier for both, the interested community as well as the Fairphone developers, to find the relevant information I’d like to ask @keesj or @paulakreuzer or anybody else from the admin staff if it would be possible to wikify the top article. We could then collect all the additions for a successful build at one location and once the Fairphone devs have a bit more time they can transfer it over to the correct section at http://code.fairphone.com

Thanks! Simon

6 Likes

Hi vivia
No, this is still way down… There are literally pages of this assignment lines like you have on the last line of your quote…