Fairphone 2 and CyanogenMod / LineageOS

Three messages up :wink:

The current problem I have is that the device doesn’t boot but doesn’t show any error, even with adb logcat… So I have no idea what the problem is…


Thank you very much :wink: Sorry for unnecessary questions. Will follow with interest, and see if I can help in any way.

Hello everyone,

I recently purchased a FP2 and I’m quite satisfied with it. However, I would like to see a running port of CM as I used it in the past with other devices and liked it very much. Currently I’m running Fairphone Open OS 16.07.1 but not 100% happy with stock Android OS, so I think having the ability to install alternative, stable OSs would make FP2 a better, longer-lasting device and more open to community contributions (which personally I think it’s very relevant step to make this a fairer, sustainable phone).

At the moment I’m downloading the repositories (it will still take a few hours) and following steps from the wiki. I’m running Linux Rebecca 17 on my computer. I’m also reading some documentation on building/porting CM to get familiar with the processes involved in the meanwhile. For a start I would like to perform all steps to get to the current state (boot.img not working), from that point I could do some additional testing/debugging maybe…

I’m familiar with computers and development but never ported CM for any device. Still I would like to give it a try. I’m aware this is now in a very early stage and far from having a stable working OS, but I’m optimistic we could see a running CM over Fairphone in the near future if the project gets enough momentum and more people gets involved with it.


Yeah, welcome to the (small) club of people trying to get a working CM :smiley:
If you have any questions, don’t hesitate! I think @Roboe start to have a good expertise in Android in general and Cyanogen in particular.
It is the first time I cook rom too, it take a bit of time to start understanding how it works, but at the end it is pretty clear :slight_smile:


Welcome to the crowd!

Currently, @NicoM and I followed almost all the steps of the Porting CM article on CyanogenMod wiki. We are currently using a precompiled kernel, and the device configuration needs to be merged somehow with a Qualcomm general msm8974 config. The wiki post Nico did is a great knowledge base to start with.

I’m right now in a personal situation that doesn’t allow me to work on the port, but I’ll be happy to solve any doubd you’d have, if I have the knowledge to, and to bring ideas for anything. Just drop me a message, :wink:

PD: I check GitHub every night, so your pull requests are welcome!


OK, so I finished syncing the repos and I was about to launch a build.

As far as I see the idea behind is to take a device with same hardware as a starting point for the CM build, in this case the MSM8974AB. I see this referenced on many places as the FP2 SoC…

However, my device reports this:

$ cat /proc/cpuinfo | grep Hardware                                
Hardware    : Qualcomm MSM8974PRO-AA

Should I trust Android’s info or the spec sheets? I see this model is also used on the OnePlus X and is actually not the same chip as the AB. It would be something in between the snapdragon 800 and 801 series (CPU from the 800 and GPU from the 801) but it’s not very well documented. Would this have any implications with the build?

PS: I just came over this thread and I see I’m not the first to realize :confused:

1 Like

I suppose there’s no problem at all, it’s the same family after all, and Qualcomm distribute the same code on CodeAurora for msm8974.

1 Like

I think HTC M8 is a better fit than the OnePlus X because it has dual SIM support


OK, I started a build now…

I will let you know once done.


Hi guys,

So after some problems setting the build environment I successfully ran my first build. Repo sync is incredibly slow and unstable from my home network so I finally decided to run the build on a hosted server I have around.

Followed all steps from @NicoM’s wiki and finally got the build.

Now I’m wondering how to properly flash the resulting .img files as I’m pretty new to android’s partitions, filesystems and boot process in general. Is it necessary to flash the recovery.img? I’m currently using TWRP, can’t I just keep this? Or do I specifically need the one from CM?

I tried to use this commands (no recovery.img flashed):

fastboot flash boot boot.img
fastboot flash userdata userdata.img
fastboot flash system system.img
fastboot reboot

Is this correct or am I missing something? How do you guys flash these files?

Boot didn’t work as expected and adb logcat shows only “waiting for device”.


Your commands are right I think. And I have the same result, the boot doesn’t work and doesn’t show any errors, this is the big problem actually :-/

1 Like

The adb logcat not working may be caused by adb authentication (enabled by default). If the RSA key of the computer is not known (and it’s not since we just flashed with a fresh build) adb connection won’t work. adb Auth can be overriden adding this to default.prop:


I will try to manually regenerate the boot.img with this modification and give it another try. Maybe then we could see the boot logs…


I already try it too and it didn’t work for me but I hope I did something wrong!

Isn’t there a possibility to let the kernel post a log using the usb portst? One could also try to debug the image in a virtual machine.


I also didn’t manage to make it work yet. I don’t know if there’s another way to debug the generated boot.img, but some virtual device/emulator would be useful for sure.

In the meanwhile I managed to have the repos synced on my desktop, so now I can do builds and deploy faster. I’m trying to play around with different .mk files and following the CM porting tutorial from scratch to get an idea of what we’re actually doing :smiley:

I’m also looking at the Fairphone Open OS source as I think we could get some valuable info from there for the CM build.

@NicoM, @Roboe: Which prebuilt kernel are you using in this blobs folder? Did you extract it from the device? Did you also try to build from source? Could it be broken?

I’m also concerned about the partition scheme. I could not get a clear picture of which partitions and filesystems currently exist on the device. I read this should be on /proc/mtd or /proc/emmc, but neither of them exist on my device… I could however get some info from /proc/partitions and /proc/last_kmsg. Then I compared this to the recovery.fstab generated by extract-files.sh and it doesn’t make much sense to me.

I think we should take a closer look to the files generated by extract-files.sh as there’s a lot of stuff there that might be breaking the boot.


So after several tries with re-assembling different boot.img files (for example I tried to use the kernel from FP Open an re-assemble the image) still couldn’t make it work. I found out several things tough:

  • After running a build I tried to run the images with emulator. This complained that system.img uses yaffs2 filesystem. I read yaffs2 is used in older devices and newer ones use ext4 (see more later on this post). I tried to move it into a ext4 filesystem and reassemble the image. emulator does not complain anymore but the system still doesn’t boot. I’m not familiar with AOSP debug, but this tool could help us with debugging the build.

  • Then I tried to use stock boot.img from FP Open with the system.img I built. Not surprisingly, the system doesn’t work but it restarts itself after a few seconds into recovery mode. When I use the boot.img from my build it justs gets stuck on the Fairphone logo screen (no reboot). This tells me somehow our boot.img breaks even before trying to load system.img, maybe?

  • I also tried to build with brunch fp2 instead of breakfast m8 and mka. This generates a cm-12.1-xxxxxxxx-UNOFFICIAL-fp2.zip file which contains all the image files and would allow to install from the recovery or the Updater app without using fastboot. This complained about a wrong recovery.fstab and exited with error (the file syntax in this file is not even correct). In my previous post I assumed this file was generated by extract-files.sh, but I realized later it comes from @Roboe’s git repo. Then I extracted the recovery.fstab from FP Open OS recovery.img and and it looks completely different:

    mount point fstype device [device2] [length=]

    /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
    /dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered wait,check
    /dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,check,length=-16384
    /dev/block/mmcblk1p1 /sdcard vfat nosuid,nodev,barrier=1,data=ordered,nodelalloc wait
    /dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
    /dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
    /dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults
    /dev/block/platform/msm_sdcc.1/by-name/bootselect /bootselect emmc defaults defaults

  • I used this file and the build was successful and the zip generated. However, when I try to install the zip from recovery it complains about:

This package is for device fp2; this device is FP2.

  • I’m wondering if the device name we use could be also breaking things, but not really sure how to change this. FP Open uses “FP2” as device name instead.

  • Looking closer to the recovery.fstab extracted from FP Open in I see it uses ext4 for the system, cache and data partitions. Then there’s four emmc partitions: boot, bootselect, recovery and misc. I’m wondering if the problem might be related to the fact we’re not using the right filesystems/partition layout for our images.

I’m afraid I don’t have the knowledge to go much further, as I see many variables and steps that could affect the resulting images and many of these I don’t completely understand. Hopefully someone else with more experience can provide insight on any of these.


What makes me sad a little is the missing support from Fairphone officials that should also be interested in another working alternative operating system :-/.

Great work so far, thank you so much!


Great tries, @E150!
I’ll check those points today, once I have my laptop at hand, :wink:

1 Like


First of all thanks for the great work you are doing!
I don’t have any experience with building roms, but I would like to contribute if I can. I will set up my build environment this evening so I can try to compile the image myself. This way at least I could help testing.


I get your point and I think some support from Fairphone would certainly speed up things. However, from my understanding Fairphone as a company can’t focus their business on creating AND maintaining 4 or 5 different OS for a single device. It’s already great that they released the code for the Fairphone Open OS and delivering regular updates for both the standard and Open Android versions…

This is already a big step forward. We can use this as a reference to build a CM port (which is indeed based on Android). Actually is one of the things I’m currently looking at. Take in account that most manufacturers don’t even provide any source or proprietary binaries, and as far as I know CM images have been always built and maintained by the CM community, not the manufacturers.

I think it’s not that they’re not interested, it’s just that they cannot afford to hire a whole team of developers to port every ROM out there to the FP2. It’s just a too big investment in time, work and money for something that maybe only a few users would potentially use.

From my perspective I think the work has to be done now by the community. If eventually we manage to have a more or less stable CM running on the FP2 we could attract more developers, users and the company itself into it, but I would not expect it to be the other way around.