English

[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

Tags: #<Tag:0x00007f05e1e0ae00> #<Tag:0x00007f05e1e0a950>

Good descriptions. I hope someone can use them to help you better. If your phone accepts adb devices you could try adb logcat or adb shell afterwards to see what’s going on inside. Not sure about the default settings in the rom regarding usb debugging. I hope someone else can fill in the blanks here (build properties for debugging are set, right?).

The recovery looks broken, too.
at the bottom it says
“E:Can’t open /dev/block/platform/msm_sdcc.1/by-name/misc
(Permission denied)”

That’s actually nomal. I’ve had it from the start and everythings workd fine for me…

1 Like

Hei
As you can see from my other posts, something must have gone wrong. My system doesn’t start (yet fastboot mode and recovery seem to work).
How do I restart the compiling process with the Docker image? (best would be without downloading 30GB one more time)

You can get a shell inside the Docker image and work from there:

$ docker run -v $PATH_ON_HOST/:/var/fairphone_os/ -i -t jftr/fairphone2-build-env /bin/bash

$PATH_ON_HOST is where the repository is stored on your host.

Now you have a shell and can reset the repository and start over again. This probably works with the following command:

$ repo forall -vc "git reset --hard"

This resets all git repositories managed by repo. You might need to take some other steps to clean up. I don’t know what you’ve changed.

Yesterday I started building files again with a fresh Docker installation (on Debian Jessie 8.3):

Today I have the same results.
FP2 gets detected with fastboot -devices
fastboot flashall gives the error message
neither -p product specified nor ANDROID_PRODUCT_OUT set
after flashing system recovery boot one by one the phone still hangs on the Start Logo Screen.

If anyone wants to have a look at my image files for testing purposes I can upload them.
Any help on this is appreciated.

I have similar problems as @Bergziege:

I’ve compiled successfully on my own machine Ubuntu 14.04.3 LTS, though it took ~9 hours (2 CPU cores, 4GB RAM, 4GB Swap, used make -j4 instead of make -j8 according to this). Btw, I did compare the file sizes and had similar (but not identical) results (though my boot.img.nonsecure has exactly the same size as @lklaus’ and @Max_Sboot.img, which seems a bit odd to me - but okay)

Now, some days later, I wanted to flash this to my phone, but got major problems. My device got detected by fastboot (after having adjusted the udev-rules), so no problem there. But:

1. Try:

~/fairphone_os$ fastboot -w flashall
error: neither -p product specified nor ANDROID_PRODUCT_OUT set

I searched for this error and according to the results I tried the following:

  1. Tried to set the environment variable ANDROID_PRODUCT_OUT=~/fairphone_os/out/target/product/FP2 - didn’t work, got the same error after fastboot -w flashall
  2. Tried to put the same variable in .bashrc - again same result
  3. Tried
    ~/fairphone_os$ fastboot -w -p FP2 flashall
    and got this:
    error: could not load android-info.txt: No such file or directory
    The same error occured after executing the flash command in the directory ~/fairphone_os/out/target/product/FP2, where the file android-info.txt and all the images are definitely located.

2. Try:

According to this earlier post I tried:

~/fairphone_os/out/target/product/FP2$ fastboot flash recovery recovery.img
~/fairphone_os/out/target/product/FP2$ fastboot -w flash system system.img
~/fairphone_os/out/target/product/FP2$ fastboot reboot

with some hope first, but big failure afterwards:

  • Commands went through successfully! I unplugged the phone.
  • Phone rebooted, but stuck at FP-logo (same problem as @Bergziege had) and gets quite warm/hot (especially in the area above the battery)
  • After >30min (>1h in 2nd try) I hold the power button to power it off
  • Now the phone was dead (no reaction at all); only after connecting via USB the LED blinked and was then permanently on (sign for charging)
  • Only then did I see that the battery dropped down to 1% (from 70% at most 2 hours earlier)!!
  • Accessing the recovery worked, but it reacted quite slowly

Afterwards I tried to flash boot, cache and userdata in addition with the same results.

I’m a bit scared by the slow reaction, the temperature and (probably connected) the drop in battery charge (which in turn was obviously responsible for the phone not reacting at all while unplugged). I hope that the hardware is ok (in case my OS will boot some time in the future :sweat_smile:)

3. Try:

One remark from a link above:

suggests that the ./build/envsetup.sh step should have set up all this. I wonder whether this was messed up by not flashing directly after the build in the same terminal?! It seems to me that one has to run this before each flashing attempt (more precisely once in every new shell)?! Btw, is @dirkv’s comment related to this (which I wouldn’t understand because I’ve never cleared my /out-directory …)?

Anyway, the cited links more or less advise to run

~/fairphone_os$ ./build/envsetup.sh
~/fairphone_os$ lunch ...

but the lunch command seems to be suitable only for some other (in particular Nexus) devices. I guess, the choosecombo step is the FP-counterpart, so I ran:

~/fairphone_os$ ./build/envsetup.sh
~/fairphone_os$ choosecombo 1 FP2 2
~/fairphone_os$ fastboot -w flashall

which then was successful! After rebooting, however, my phone is again still stuck at FP-logo. I therefore now tend to believe that my self-compiled build is broken somehow. :disappointed_relieved:

Ah btw, maybe I should mention that I haven’t gone through the FP2 setup before (though I can’t really imagine why this should make a difference) - I immediately flashed the phone before doing anything else with it.

If someone has a any explanation or other ideas what to try next, please share! :slightly_smiling: My next step would be to start compilation again.

Any comments/answers are very appreciated - thanks a lot in advance!

1 Like

Hey,

just got my FF2 and it’s awesome.
I’ve now finished compiling FP2 OSOS. Before testing… Is it possible to get the stock FP2 OS (Onion) as an image file?

Hi,
yes, that is very possible. Check this post for details on how to download the ota update:


Helped me recover after wrecking the system :slight_smile:

Can you try again with the new blobs (2.0.1)? Extract them as described in the build instructions and then try a clean start:

$ rm -rf out
$ . ./build/envsetup.sh
$ choosecombo 1 FP2 2
$ mm -j 8
$ fastboot -w flashall

Thank you for your report.
I am a bit relieved, that it was not my fault.
I can confirm the battery drain.
Obviously something with the code is wrong.
So I guess re-compiling won’t help until something has been fixed there. (I compiled two times with the same result.)
Did you also use the Docker image or did you built “by yourself”?

Maybe someone would provide us with working images, even when Fairphone doesn’t want the users to share their builds, but then again, they can’t want users who have bricked phones as well.

Have you tried with the new blobs mentioned by @dirkv?

As I just used the Docker file and command without makine any specific changes, I don’t know which blobs were used.
How can I find out?

In that case you had the old blobs. I’ve only updated the Dockerfile an hour ago. The easiest thing is to download the new version manually and retry. To get the new files run these in the shell inside the Docker image:

$ wget -c http://code.fairphone.com/downloads/FP2/blobs/fp2-sibon-2.0.1-blobs.tgz
$ tar zxvf fp2-sibon-2.0.1-blobs.tgz
$ sh fp2-sibon-2.0.1-blobs.sh
1 Like

I also edited the version in the wiki at the top.

3 Likes

I don’t know if it was my fault, but now running the fresh Dockerfile with

docker run -v $whatever/:/var/fairphone_os/ jftr/fairphone2-build-env

results in

Digest: sha256:32da14885c6f6a480b2ffd49263994c3a24b06df0ad039934626b0920807a424
Status: Downloaded newer image for jftr/fairphone2-build-env:latest
/bin/sh: 1: [/bin/bash,: not found

@dirkv: Thanks for the quick answer. :+1: I’ll definitely try that as soon as I can (i.e. tonight or tomorrow). I’d be happy if you or somebody else could answer two short questions, though:

What’s the leading . for in here? Edit: Ok, seems to be a replacement for source. I was just confused by the appearance of two points. Sorry for the stupid question.

What does mm mean? Is it better to use this rather than make? Moreover, I really only have one CPU with two one-threaded kernels, so according to this recommendation make -j2 or make -j4 should be the fastest methods. Or is it save (and even faster?) to use make -j8?

Edit: mm seems to be used to only build all the modules in the current directory. However, when being executed from the ~/fairphone_os directory, this doesn’t make any difference to make, does it? Btw, I now used mm -j4. Still don’t know whether -j8 would have been better or faster. eoEdit

No, I built by myself, but we might have had the same flawed sources. Btw, there had been some problems with compiling earlier, but it seemed as if they were gone. Don’t know the cause of the issues back then, though. Anyway, I’ll just try building with the new blobs next. :relaxed:

A remark to this: I guess FP not only wants no users with bricked phones, but they also would want to let users share their builds, if they could, i.e. if there weren’t the legal issues.

Hm, no clue.

When I get a shell with the latest image, both /bin/bash and /bin/sh are available:

root@bc7988539cb5:/var/fairphone_os# which sh
/bin/sh
root@bc7988539cb5:/var/fairphone_os# which bash
/bin/bash

Can you please give some more information. At what point does it fail?

Regarding the problems with flashall. If you use flashall fastboot uses a fixed path to find the images. If you’re not on the buildhost, e.g because you use docker, then the the images will be searched at /out/target/product (from memory, I’m on the road and can’t check). That’s the reason you also need -p FP2 and the .txt file. Flashing the images separately does not need this special setup

(Verified with strace -e open fastboot …)

1 Like

I tried fastboot flashall when I used a root terminal and was in the folder path where the images are. (on two different computers, same result)