English

Fairphone 2 and CyanogenMod / LineageOS

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

This last post should be in:
/Software/Developing/B2G beta (formerly Firefox OS)
Could any mod shift it?

My post? I don’t think it should. I could have explained myself bad, but I’m trying to build CyanogenMod, not B2G. The FxOS/B2G mention is because it is based on (the low level layer of) Android and both build processes have similarities (one being the blob dependencies to fully work).

I hope more peple who are able to work on a CM port will help you and push it further. I don’t want to lose CM when switching to a FP2, so I rely on guys like you and I want to thank you for your initial work here.

2 Likes

OK, my fault! The missing words were: “with this knowledge we can try to built CM”

3 Likes

You are right! I missed that words, :slight_smile:

Edit: I edited that post. Hope it’s more clear now.

I’m stuck with this error:

JarJar: /home/debian/Workspace/fairphone/cm12_fp2/out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-jarjar.jar
host SharedLib: libjavacrypto_32 (/home/debian/Workspace/fairphone/cm12_fp2/out/host/linux-x86/obj32/lib/libjavacrypto.so)
target SharedLib: libandroid_runtime (/home/debian/Workspace/fairphone/cm12_fp2/out/target/product/FP2/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so)
target Symbolic: bluetooth.default (/home/debian/Workspace/fairphone/cm12_fp2/out/target/product/FP2/symbols/system/lib/hw/bluetooth.default.so)
frameworks/base/core/jni/android_view_Surface.cpp:404: error: undefined reference to 'android::uirenderer::AnimationContext::AnimationContext(android::uirenderer::renderthread::TimeLord&)'
frameworks/base/core/jni/android_view_Surface.cpp:431: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::syncAndDrawFrame(long long, long long, float)'
frameworks/base/core/jni/android_view_Surface.cpp:425: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::updateSurface(android::sp<ANativeWindow> const&)'
frameworks/base/core/jni/android_view_Surface.cpp:412: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::RenderProxy(bool, android::uirenderer::RenderNode*, android::uirenderer::IContextFactory*)'
frameworks/base/core/jni/android_view_Surface.cpp:413: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::loadSystemProperties()'
frameworks/base/core/jni/android_view_Surface.cpp:414: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::setSwapBehavior(android::uirenderer::renderthread::SwapBehavior)'
frameworks/base/core/jni/android_view_Surface.cpp:415: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::initialize(android::sp<ANativeWindow> const&)'
frameworks/base/core/jni/android_view_Surface.cpp:418: error: undefined reference to 'android::uirenderer::renderthread::RenderProxy::setup(int, int, android::uirenderer::Vector3 const&, float, unsigned char, unsigned char)'
frameworks/base/core/jni/android/graphics/Paint.cpp:809: error: undefined reference to 'android::uirenderer::Blur::convertRadiusToSigma(float)'
collect2: error: ld returned 1 exit status
build/core/shared_library_internal.mk:68: recipe for target '/home/debian/Workspace/fairphone/cm12_fp2/out/target/product/FP2/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so' failed
make: *** [/home/debian/Workspace/fairphone/cm12_fp2/out/target/product/FP2/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory '/home/debian/Workspace/fairphone/cm12_fp2'

#### make failed to build some targets (09:40 (mm:ss)) ####

I honestly don’t know where’s the error. Any ideas to try?

1 Like

wow! that is the best news i heard since FP2 came out! soooo nice to see, finally it is ging on! keep it up!

2 Likes