Fairphone 2 and CyanogenMod / LineageOS

That should do it (<yoursourcedir>/.repo/local_manifests/fp2.xml):

<?xml version="1.0" encoding="UTF-8"?>
  <project name="Roboe/android_device_fairphone_fp2" path="device/fairphone/fp2" remote="github" revision="cm-12.1" />
  <project name="Roboe/android_kernel_fairphone_fp2" path="kernel/fairphone/fp2" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-12.1" />

I come back with some news, thanks for your post it got me interested in init.recovery.*.rc that seemed to be missing (because that’s the files that are use for correct initialization, and I linked it to your watchdog issue thanks to this).

Turns out the main problem was copying the init.recovery.usb.rc from fposos in the correct location for me, now I have a working recovery (yes so far it did not work once for me ^^’). THAT FEELS GREAT (even if it’s just the start !)

I started my own repo from scratch in order to understand how CM works and incorporate FPOpenOS 16.09’s blobs and dt.img but I’d be willing to do a pull request on @Roboe’s repo.

Anyone else got news ?

#### make completed successfully ####

Ok, now we are talking, CM, :wink:

brunch fp2 doesn’t work for some reason (what’s bacon, anyway? Is that the task that package the ROM in a flashable zip?), but lunch cm_fp2-userdebug && mka finally worked, :slight_smile:

Debug, debug!

Edit: Yes, bacon task is just for that (plus other fancy things): http://teamuscellular.com/Forum/topic/7110-rom-cyanogenmod-11-sch-r760/#comment-133621

Edit 2:

This error seems to be related somehow in fact with the lack of recovery folder (librecovery_updater_msm module) on device/qcom/common, as accurately @z3ntu commented on GitHub.

Edit 3: Ups, I think that was my fault, :see_no_evil:: https://github.com/Roboe/android_device_fairphone_fp2/blob/13b44eb6428d3555f26291dd1517dd12e074b8b6/BoardConfig.mk#L118 (But… but I had a reason!)

Trying a build with that line commented out.

Edit 4:

Package Complete: /home/android/cyanogenmod/out/target/product/fp2/cm-12.1-20161016-UNOFFICIAL-fp2.zip
make: Leaving directory `/home/android/cyanogenmod'

#### make completed successfully (16:05 (mm:ss)) ####

Yay! :grinning:


How cool is THAT! So you now have a flashable zip for FP2 :)? Did you yet try to install and boot it?

Yes, I have a flashable zip, :slight_smile:
Didn’t tried it yet, though; it was late and I have to fetch somehow the file from @Arvil’s server to my computer yet.

I’ll update the fix to GitHub today (Edit: done) and update the wiki post. Later, I’ll try to boot the different partitions and see what works.

I compiled CM without blobs (blob-free), thus the system should spit out by ADB which blobs really need. This was on purpose: I don’t like the big list of blobs FP Open has (including libart.so (!) as a blob is just unacceptable for me), plus I aspire to make some blob-free CM zip we can distribute without any legal issue here, with some tool like the awesome B2G Intaller for any user to make it functional with a single click.

Later, we can try to submit the FP2 to be an official CM device, but that will be a long-term goal.


I don’t think it’s possible to submit FP2 as an official device because of our favourite blob license… See [HOWTO] ✏ Compiling Fairphone Open OS / Rooting for example…

CyanogenMod’s (OmniROM’s, SlimROM’s, AOKP’s) official supported devices don’t had a license which allow them to redistribute their proprietary blobs either. If that where the case, you would find device blobs on official repos. And you are obviously not. They operate in a legal vacuum (there is USA), because they extract blobs from physical devices, not accepting any license.

Anyway, submitting the FP2 to be an official CM device is not something we will do soon, and we will need a method for users to add their devices’s blobs to the blob-free distribution anyway, so we can have this discussion later on, once a working CM is ready, :wink:

  1. Trying to flash the generated zip via TWRP:
Can't install this package on top of incompatible data. Please try another package or run a factory reset
  1. boot.img still incomplete, so it doesn’t boot. (Anyone knows how a zImage works?)

  2. system image boots (with FPoOS boot.img). Then spit the below message through ADB and then reboots after some seconds:

CANNOT LINK EXECUTABLE DEPENDENCIES: library "libNimsWrap.so" not found

This was the expected behaviour, as I explained above this was a blob-free build. I’m going to push one by one the needed blobs and see what we’ve achieved, :wink:

Edit: Here is the adb logcat output after adding “libNimsWrap.so”.
(Edit: Oops, I booted without wiping data. Log could be adulterated)

Edit 2: A quick and dirty script to push blobs after flashing blob-free system.img:


IIRC the boot.img is a concatenation of the following parts :

  • The kernel zImage (z meaning it’s not using uBoot, else it would be uImage) which is basically the output of your kernel’s compilation
  • The initial ramdisk
  • The device tree (dt.img)

I managed to make the recovery work by using the zImage and dt.img from the FP Open OS I have on my phone by extracting them first with mkbootimg (I tried abootimg but it doesn’t support extracting the dt.img). If you want to debug your boot.img I’d advise you to try booting normally, then reboot into a working recovery and copy /proc/last_kmsg to your sd card (it’s pretty straightforward with TWRP) to analyse whatever output you get. Good job on managing to get adb logcat to work, I’m jealous ! :wink: (edit : woops read your message too fast !)

Now onto my issue, I’ve struggled since two days on a single error I seem to get whenever I’m using my manifest and repos or yours : build fails at hardware/qcom/mediadefault/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp with these errors (I truncated the build log since it happens to be VERY big) :


Errors start at error: 'VDEC_CODECTYPE_MVC' was not declared in this scope for easy ctrl+f. Could someone help me please ? Any idea ? I already tried make clean and make clobber before doing a complete build.


Also, as a separate post to separate notifications, this adb logcat seems to indicate you lack libEGL_*.so or libGLES*.so (per this logcat), this is what I found on my phone :

1|root@FP2:/ # find / -name libEGL*

I can extract and provide the following libEGL*.so if you need them.

EDIT : Also for LIBGLES*.so :

1|root@FP2:/ # find / -name libGLES*                                           
1 Like

blobs folder in my repo (better called in yours as prebuilts) have kernel and dt.img extracted with mkbootimg, :slight_smile:

Thank you for the hints and the boot.img dissection! :smiley:

Hmmm… let me take a look, that’s rather odd, I’ve never faced that error myself.


I pushed the rest of the blobs to test if it would boot and it didn’t… later, I realized data wasn’t formatted, but I haven’t more available time to keep testing, so I restored my FPoOS backup and continued with my life, :joy:

Let see if this afternoon I have some free time.

1 Like

Hey, as a general information, I’ve moved the repo to the WeAreFairphone organization at GitHub:

We can collaborate better there (accept PR, add collaborators, etc), and I can have my own fork for my tests.


Great ! Could you add me please ? This is my account :

Added. Head to https://github.com/WeAreFairphone or check your email to accept the invitation, :wink:

Then I’ll add you to the Builders team to give you access to both CM-related repositories, :slight_smile:

Thanks ! 20 characters

1 Like

I’ve just ran into this great response on StackExchange about boot.img unpacking and want to share it with you:

I’m currently comparing two boot.img's ramdisk, one from FP Open and the other from my CM build, to fix CM’s booting.


I’m trying to build with proprietary files (i.e. blobs) and the audio-effects.h error appears. Removing some system/lib/*.so blobs make the build success, but maybe there are some required blobs missing on the final build (in case it boots, which is probably not, :sweat:).

On the other hand, about the boot/recovery ramdisk, I’m having troubles finding which init.*.rc files should we include, and which should CM generate. Anyone…? Or should I have to use the trial and error method?

IIRC I solved the audio-effects error quite a lot of time ago without resorting to removing blobs but as usual dimwit me I forgot to mention how I did it. I can’t vouch this is a perfect fix but it will get you past this during the compilation.

I’ve submitted a pull request on Github on this topic that you might be interested in, accept it if it feels OK.

I am still figuring it out myself. The most useful I’ve found for now are the init.*.rc and ueventd.*.rc in these repos (mainly the first one) that are used to build the OneplusOne :



I’m going to keep studying the boot process further, then… and init itself

1 Like