Fairphone 2 and CyanogenMod / LineageOS

Hope a cyanogenmod dev bought a Fairphone…

4 Likes

There is a device that uses the same chipset as the FP2: the HTC One M8.

https://wiki.cyanogenmod.org/w/M8_Info

There is already an Cyanogenmod 13 build for this device so I think chances are high that one day we will see a CM13 build for the FP2 ;-).

oh btw: The Ubuntu Port seems to be based on a CyanogenMod 12.1 port! Just read that here:

4 Likes

That’s my biggest hope, really… FP2 + CM would be THE killer combination for me :).

7 Likes

Hmm can someone explain “for dummies” why cyanogenmod can’t be installed on the FP2? what would happen if flashed?

Since the hardware of every device is different, you need an image specially built for the device, including the needed drivers etc.
So you won’t have any image to flash, since there is simply no image for FP2. And if you flash an image for another device, your FP will very likely be bricked.

1 Like

I think the main issue is a legal problem. Fairphone hardware is not 100% open-source. Some drivers are proprietary. The consequence is that it is not legal to build and share and images who include this parts…

:expressionless:

It is why this thread is discuting how to compiling a blob free variant (without proprietary parts).

It is probably also why there still not have ready builds of CM.

I think that’s not the problem. I only wanted to point out in that thread you linked that “just copy and pasting” files will not work. Some of the code from the FP2 bin-blob tarball is being used in the build process. A CM port is still possible and some tried a bit already. And maybe that’s best that can happen to the FP2 anyway. But I don’t know anything about CM.

1 Like

Definitely no. If you look at other devices support by CM, you will see that they also need these proprietary drivers etc. but projects (like CM) don’t seem to care about this too much about the legal issues and just distribute these parts as well. And so far, nobody seems to have sued them or it just didn’t happen in the public.

I assume the reason is mainly because simply nobody has taken the effort to port it, although it shouldn’t be too difficult. Someone just has to do it.

5 Likes

Nice! There is hope in this case!

…If someone do the job :slight_smile:

2 Likes

My girlfriend just choose against FP2 because there is no cyanogenmod firmware and I told here how the world works: you get updates till the next model…

never trust a hardware vendor, when I did, i got burned.

@poelzi Ditch her :wink:

As for myself I am also waiting on an android alternative for the FP2

1 Like

I am running Cyanogenmod CM13 on My Google Nexus 9 tablet, with the minimalist nano version of Opengapps. This is in many ways superiors to FP2 OS. Ideally, I would have on my phone Cyanogenmod with the extras features created for the FP (edge swipe, recent/most used apps etc…)

3 Likes

I agree with freibadschwimmer: After being on cyanogen for years (since cm7), I was shocked about how little you can customize and how much data you have to give away (cmod contains a very user friendly way to restrict app permissions).
After installing gravitybox and xprivacy to the open source version it is getting closer, but I still dont understand why fairphone uses its own aosp “fork”. With cmod all the non device specific details get handled by a huge community. Fairphone developers could concentrate on the device specific issues.
And don’t even get me started on the security issues still open in the fairphone OS or Android 6 support…

I guess in the end it comes down to one thing though: Legal issues with the closed source binary drivers… I do think even that could be solved somehow though. Fairphone gave us the opensource version, so how hard can it be to get that kind of support in cmod?

Still hoping here!

8 Likes

Hi all,

it’s been a while since I’ve last posted here - I cancelled my FP2 preorder because my old phone still works. So from a ecological perspective it doesn’t make much sense to buy a new phone then (even if it’s produced “fair”).
But i’m still interested in the project and once my old phone dies, I’ll most probably buy a Fairphone.

Regarding the CyanogenMod discussion I’d like to add a few points.


Official OSes vs. community projects

Please stop asking the Fairphone Devs to officially create a port of CyanogenMod for FP2 - they almost certainly can’t, because of legal reasons. Licensing of the SoC vendors tends to be really strict in general, so you can’t blame Fairphone for that.
CyanogenMod has always been a community project, there has never been any support by SoC vendors or phone manufacturers for a port (at least I never heard of any support).
The only chance I see to make CyanogenMod happen on FP2 is that members of this (great!) community get their hands dirty and start hacking! (And this is the main point of free software, actually…)

Starting a port

(the following parts could later be turned into a wiki-post for easier collaborative editing)

Things may look complicated at the beginning, but there are a lot of technically skilled people here that should be able to create a port together.
I’m not a CyanogenMod developer myself, but there is plenty of documentation available, which helps to set up a build environment on Linux.

I started with the Build HowTo for the HTC One M8 (which uses the same SoC as FP2, this might come in handy later)

On a Debian/Ubuntu System:

# Install dependencies (on a 64-bit build machine)
sudo apt-get install repo android-tools-adb android-tools-fastboot ccache bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev
# configure git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
# prepare source directory
mkdir cm12_fp2
cd cm12_fp2
repo init -u https://github.com/CyanogenMod/android.git -b cm-12.1
repo sync

The last step pulls about 30G (yes gigabytes!) of source code, so this might take a while depending on your connection.

Now you can for example do a

source build/envsetup.sh
breakfast m8

to download all the files needed to build CM for the HTC One M8 (and analyze them later).

@keesj from Fairphone already did most of the work stated in the CM porting guide and you can download his work from github

# fetch Fairphone 2 specific files
git clone https://github.com/keesj/cm12-device-fairphone-fp2.git device/fairphone/FP2

Now you have everything to build and test a FP2 recovery image

source build/envsetup.sh
lunch cm_FP2-userdebug
make recoveryimage

Build errors

I encountered two error-messages during build.
If you get something like:

make: *** No rule to make target
'out/host/linux-x86/bin/dtbToolCM' needed by
'out/target/product/FP2/dt.img'.

use the following to fix the error (you probably need to run breakfast m8 before):

cp -r device/qcom/common/dtbtool device/fairphone/FP2/

If you get

chmod: cannot access 'out/target/product/FP2/dt.img': No such file or directory
make: *** [out/target/product/FP2/dt.img] Error 1

use

cp device/fairphone/FP2/blobs/dt.img out/target/product/FP2/

The makefiles probably need to be modified to handle the FP2 device tree correctly - I’m just starting to learn about the Anroid/CM build system.
After these fixes the recovery image builds fine for me.

The blob problem

The next steps of porting involve FP2 binary blobs. If you download the blobs from Fairphone (or any other manufacturer) you have to accept a license which prohibits redistribution of these blobs (and pretty much doing anything interesting with them).
This is why CM uses a trick: using a script called extract-files.sh, the blobs are extracted directly from the device, without the need to accept a license.

For new devices it’s necessary to tell the script which files it needs to fetch and put their location (on the phone) in a file called proprietary-files.txt
Since FP2 uses the same SoC as the HTC One M8, this list might be a good starting point:


As I said before, I don’t own a Fairphone 2, so I can’t assist any further, but I hope this might be a good starting point for a CM port. Once I have a FP2 I’ll happily join the effort!
Until then: Happy hacking - if you really want CM on the Fairphone you can do it!

Greetings
Zapp

20 Likes

How does CM handle that code needs to be linked? You can’t just copy the bin blob stuff around. Else every user will have to build his own CM image. That’s doesn’t make sense to me.

I was always hoping that one could “update” the Android parts “around” the SoC vendor/ODM parts. But at least from my experiences with the FP2 code, this is not possible (see the modified .so in my link).

1 Like

The blobs need to be copied before starting a build of the full system.

1 Like

I know that. But the normal users will not be able offer to so much cpu power and space to compile/download ~60-70G of code just to build a ROM for their phones. And the final build cannot be shared otherwise, or? Or do you want FP to offer the download for the CM rom?

First of all, there needs to be someone who’s able to produce a bootable image. If this is achieved, there will still be a lot of work to make this image usable. As I said before, I’m not a CM-dev, but I guess, depending on how many people are working together, this can take up to a few months. Until this point it doesn’t make sense for a “normal user” to install these images anyway.

If the port gets into a usable state it is possible to submit it as an official CM port. Once it gets accepted, the images will get hosted by CM and get published on the download page.

I don’t know if they are acting in a legal gray area, but apparently they are hosting the images…

But unfortunately the hard work needs to be done first, before discussing the possibility where to download the result.

Edit:
Out of curiosity I wanted to check whether the images from the CM download page contain blobs or not. They do! You can download a python script from github to access the file system of the images. The latest M8 image for example contains the files listed in common-proprietary-files.txt, linked in my previous post.

7 Likes

Did you try to build an image of Cyanogenmod for the Fairphone 2?
Or someone else?

1 Like

Just trying to revive the thread, Juan Gomez (atilag) from Mozilla did a blobfree Firefox OS (B2G) compilation for the FP2 which extracts blobs from the device before packing the fastboot images.

Due to the similarities between the build processes of CyanogenMod and B2G, because they share the same low level base of Android, I think a port of CM to the FP2 is viable, with the B2G port as an example.

The FP2 configs for B2G are here: https://github.com/mozilla-b2g/device-fairphone2
The list of blob-files needed are here (from FP2-1.2.8-gms, if I recall right): https://github.com/mozilla-b2g/device-fairphone2/blob/master/proprietary-files.txt

Now we have some right things to continue the @keesj’s initial work on the CM12 port. My machine is pretty slow, but, damned, I prefer having it burned down than not trying anything! :fire: :metal:

Edit: CM Recovery successfully compiled, :slight_smile:
Edit2: flashed. It works, yay!
Edit3: I’ve done a new extract-files.sh that seems to extract blobs, at least. I’m kind of improvising… never cooked roms before. See it here.
Edit4: I tried a full CM12 build today. Failed, of course, a lot of things have to be adjusted. I talked with Juan (I know him from some Mozilla meetups, and he has experience with CM ports) for generating an up-to-date blob-list. This is going to be funny, but slow. Should someone wants to help, message me, :wink:

23 Likes