[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

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_S’ boot.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 @anon41484458’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!