Fairphone 2 and CyanogenMod / LineageOS

Great news :), WOW! Thanks @Avril!

2 Likes

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

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <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" />
</manifest>

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 ?

9 Likes
#### 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): teamuscellular.com

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:: android_device_fairphone_FP2/BoardConfig.mk at 13b44eb6428d3555f26291dd1517dd12e074b8b6 Ā· Roboe/android_device_fairphone_FP2 Ā· GitHub (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:

10 Likes

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.

9 Likes

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:

3 Likes
  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:

4 Likes

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.

2 Likes

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*
/system/lib/libEGL.so
/system/vendor/lib/egl/libEGL_adreno.so

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

EDIT : Also for LIBGLES*.so :

1|root@FP2:/ # find / -name libGLES*                                           
/system/lib/libGLES_trace.so
/system/lib/libGLESv1_CM.so
/system/lib/libGLESv2.so
/system/lib/libGLESv3.so
/system/vendor/lib/egl/libGLESv1_CM_adreno.so
/system/vendor/lib/egl/libGLESv2_adreno.so
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.

2 Likes

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.

2 Likes

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.

4 Likes

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 :

2 Likes