Porting LineageOS to FP2

The files I am using:
.repo/local_manifests/fp2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote fetch="https://github.com/" name="github2" />
  <project name="chrmhoffmann/android_device_fairphone_FP2" path="device/fairphone/FP2" remote="github2" revision="cm-14.1" />
  <project name="chrmhoffmann/android_kernel_fairphone_msm8974" path="kernel/fairphone/msm8974" remote="github2" revision="cm-14.1" />
  <project name="chrmhoffmann/proprietary_vendor_fairphone" path="vendor/fairphone/FP2" remote="github2" revision="cm-14.1" />
</manifest>

docker-manual-lineageos-14.1.sh:

#!/bin/bash

echo """
RUN
export USE_CCACHE=1
export CCACHE_DIR=/var/ccache
export USER=\$(whoami)
export WITH_SU=true

source build/envsetup.sh

breakfast FP2 eng
mka bacon
# or
mka bootimage
"""

DOCKER_IMAGE="z3ntu/android-n-build-env"
MOUNTS="-v /mnt/1tb/lineageos-14.1/:/var/android -v /mnt/500gb/ccache/:/var/ccache/"

echo "Pulling down docker image."
sudo docker pull $DOCKER_IMAGE

sudo docker run --rm --net=host $MOUNTS -i -t $DOCKER_IMAGE /bin/bash

You can leave out the ccache stuff if you want

1 Like

Hi, first of all, thanks for the great work and showing that an alternative OS works on the FP2.
On the weekend I installed your lineageos version on my FP2 expecting some troubles, but against my expectations I didnā€™t run into much troubles.
The installation process was straight forward and worked very well.

Iā€™m very happy now, to have a nearly actual android based system on my FP2, what is providing more flexiblity according to managing app restrictions and providing more time using my FP2 until it needs to be connected to a charger again.

Two things are NOT working for me until now:

  1. Using apps like ControlDNLA or DroidUPNP (or naim app to manage a naim device like muso) to control a UPNP device does not work. From my point of view there is no UPNP support implemented/activated at all?!
  2. When charging my FP2 there is no LED indication at all. Possibly I didnā€™t find the necessary configuration yet. (The LED works pretty well e.g. as notification for a new email or an alarm.)

Thank you

I can confirm 2.
I donā€™t know if itā€™s a matter of configuration or a bug.

Something broke my cameraā€¦ I last used it on Saturday where it workedā€¦ (btw reboot doesnā€™t help)

05-30 08:23:25.131   303  3047 D QCamera2HWI: [KPI Perf] int qcamera::QCamera2HardwareInterface::openCamera(hw_device_t**): E PROFILE_OPEN_CAMERA camera id 0
05-30 08:23:25.131   303  3047 E mm-camera-intf: mm_camera_open: dev name = /dev/video1, cam_idx = 1
05-30 08:23:25.132   307   307 E mm-camera: server_process_bind_hal_ds:112: Error in bind socket_fd=11 Address already in use 
05-30 08:23:25.132   307   307 E mm-camera: main: New session [1] creation failed with error
05-30 08:23:25.132   303  3047 E mm-camera-intf: mm_camera_open:  opened, break out while loop
05-30 08:23:25.132   303  3047 E mm-camera-intf: mm_camera_open: cannot open control fd of '/dev/video1' (Bad address)
05-30 08:23:25.132   303  3047 E mm-camera-intf: camera_open: mm_camera_open err = -1
05-30 08:23:25.132   303  3047 E QCamera2HWI: camera_open failed.
05-30 08:23:25.135   303  3047 E CameraFlashlight: Could not open camera 0: -19
05-30 08:23:25.135   303  3047 E CameraClient: initialize: Camera 0: unable to initialize device: No such device (-19)
05-30 08:23:25.135   303  3047 E CameraService: connectHelper: Could not initialize client from HAL module.
05-30 08:23:25.137  3266  3266 E CarrierConfigLoader: Cannot save config with null packageName or iccid.
05-30 08:23:25.147   303  3047 E CameraService: initializeShimMetadata: Error initializing shim metadata: Status(-8): '10: connectHelper:946: Failed to initialize camera "0": No such device (-19)'
05-30 08:23:25.161   303  2388 E CameraService: getCameraPriorityFromProcState: Received invalid process state -1 from ActivityManagerService!
05-30 08:23:25.215   303  2388 D QCamera2HWI: [KPI Perf] int qcamera::QCamera2HardwareInterface::openCamera(hw_device_t**): E PROFILE_OPEN_CAMERA camera id 0
05-30 08:23:25.215   303  2388 E mm-camera-intf: mm_camera_open: dev name = /dev/video1, cam_idx = 1
05-30 08:23:25.215   307   307 E mm-camera: server_process_bind_hal_ds:112: Error in bind socket_fd=11 Address already in use 
05-30 08:23:25.215   307   307 E mm-camera: main: New session [1] creation failed with error
05-30 08:23:25.216   303  2388 E mm-camera-intf: mm_camera_open:  opened, break out while loop
05-30 08:23:25.216   303  2388 E mm-camera-intf: mm_camera_open: cannot open control fd of '/dev/video1' (Bad address)
05-30 08:23:25.216   303  2388 E mm-camera-intf: camera_open: mm_camera_open err = -1
05-30 08:23:25.216   303  2388 E QCamera2HWI: camera_open failed.
05-30 08:23:25.216   303  2388 E CameraFlashlight: Could not open camera 0: -19
05-30 08:23:25.216   303  2388 E CameraClient: initialize: Camera 0: unable to initialize device: No such device (-19)
05-30 08:23:25.216   303  2388 E CameraService: connectHelper: Could not initialize client from HAL module.
05-30 08:23:25.222   303  2388 E CameraService: initializeShimMetadata: Error initializing shim metadata: Status(-8): '10: connectHelper:946: Failed to initialize camera "0": No such device (-19)'
05-30 08:23:25.222  5310  5310 E CAM_Util: exception trying to get camera characteristics
05-30 08:23:25.279   303  5422 E CameraService: connectLegacy: Camera HAL module version 100 too old for connectLegacy!
05-30 08:23:25.360   303  5423 D QCamera2HWI: [KPI Perf] int qcamera::QCamera2HardwareInterface::openCamera(hw_device_t**): E PROFILE_OPEN_CAMERA camera id 0
05-30 08:23:25.360   303  5423 E mm-camera-intf: mm_camera_open: dev name = /dev/video1, cam_idx = 1
05-30 08:23:25.361   307   307 E mm-camera: server_process_bind_hal_ds:112: Error in bind socket_fd=11 Address already in use 
05-30 08:23:25.361   307   307 E mm-camera: main: New session [1] creation failed with error
05-30 08:23:25.361   303  5423 E mm-camera-intf: mm_camera_open:  opened, break out while loop
05-30 08:23:25.361   303  5423 E mm-camera-intf: mm_camera_open: cannot open control fd of '/dev/video1' (Bad address)
05-30 08:23:25.361   303  5423 E mm-camera-intf: camera_open: mm_camera_open err = -1
05-30 08:23:25.361   303  5423 E QCamera2HWI: camera_open failed.
05-30 08:23:25.364   303  5423 E CameraFlashlight: Could not open camera 0: -19
05-30 08:23:25.364   303  5423 E CameraClient: initialize: Camera 0: unable to initialize device: No such device (-19)
05-30 08:23:25.364   303  5423 E CameraService: connectHelper: Could not initialize client from HAL module.
05-30 08:23:25.376  5310  6349 E CameraHolder: fail to connect Camera:-1, aborting.
05-30 08:23:25.376  5310  6349 E CAM_PhotoModule: Failed to open camera:0

actually, a non-working LED while charging would be a feature here. I donā€™t want my phone to shine while lying next to my bed at night.

I put a box of matches on it, does the job perfectly :wink: .

3 Likes

or turning it upside down, but maybe thatā€™s technically too challenging :sweat_smile:

6 Likes

Did anyone run into this problem (?):

Communication error with Jack server (56). Try 'jack-diagnose'
[ 52% 18607/35359] Building with Jack: /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/classes.jack
FAILED: /bin/bash -c "(rm -f /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/classes.jack ) && (rm -rf /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc ) && (mkdir -p /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/ ) && (mkdir -p /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc ) && (rm -f /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list ) && (touch /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list ) && (echo -n 'frameworks/support/compat/honeycomb/android/support/v4/app/ActivityCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/app/NotificationBuilderWithBuilderAccessor.java frameworks/support/compat/honeycomb/android/support/v4/app/NotificationCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/content/ContextCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/content/ExecutorCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/content/IntentCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/graphics/drawable/DrawableCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/graphics/drawable/DrawableWrapperHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/os/AsyncTaskCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/view/KeyEventCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/view/LayoutInflaterCompatHC.java frameworks/support/compat/honeycomb/android/support/v4/view/MenuItemCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/view/VelocityTrackerCompatHoneycomb.java frameworks/support/compat/honeycomb/android/support/v4/view/ViewCompatHC.java frameworks/support/compat/honeycomb/android/support/v4/view/ViewGroupCompatHC.java frameworks/support/compat/honeycomb/android/support/v4/widget/SearchViewCompatHoneycomb.java ' >> /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list ) && (if [ -d \"/var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/src\" ]; then find /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/src -name '*.java' >> /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list; fi ) && (tr ' ' '\\n' < /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list | build/tools/normalize_path.py | sort -u > /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list-uniq ) && (if [ -s /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list-uniq ] ; then export tmpEcjArg=\"@/var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list-uniq\"; else export tmpEcjArg=\"\"; fi;  JACK_VERSION=3.36.CANDIDATE /var/android/out/host/linux-x86/bin/jack @build/core/jack-default.args --verbose error -g -D jack.java.source.version=1.7  --classpath /var/android/out/target/common/obj/JAVA_LIBRARIES/sdk_v11_intermediates/classes.jack:/var/android/out/target/common/obj/JAVA_LIBRARIES/sdk_v11_intermediates/classes.jack:/var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-gingerbread_intermediates/classes.jack --import /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-gingerbread_intermediates/classes.jack  -D jack.import.resource.policy=keep-first -D jack.import.type.policy=keep-first -D jack.android.min-api-level=11  --output-jack /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/classes.jack   \$tmpEcjArg || ( rm -f /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/classes.jack ; exit 41 ) ) && (rm -f /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list ) && (mv /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc/java-source-list-uniq /var/android/out/target/common/obj/JAVA_LIBRARIES/android-support-compat-honeycomb_intermediates/jack-rsc.java-source-list )"
Communication error with Jack server (56). Try 'jack-diagnose'
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/var/android'

#### make failed to build some targets (06:49:44 (hh:mm:ss)) ####

Iā€™ve read somewhere this can be related to resources, but I think 8GB of ram 4GB of swap and 6x 2,4GHz cores would be enough.
Anyone any ideas?

Whatā€™s with all the compat-honeycomb libraries? I suppose they are not needed on Android 7?

According to this guide Jack tends to use up a lot of RAM.
I ran
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"

before building and it compiled fine.

2 Likes

That worked for me when I used Stuckiā€™s Docker image.

BTW, the Jack configuration is commented on every LOS build guide, not just for specific devices (see the template file)

1 Like

I forked @chrmhoffmannā€™s repos to the WeAreFairphone organization on Github. @snevas has added a build server so we will hopefully have our first builds from the repos at WeAreFairphone soon. :slight_smile:

Everything is set for you to better collaborate on the LineageOS port! :slight_smile:

Edit: Direct links: Kernel | device | blobs

8 Likes

Uh, I donā€™t like the duplication of device trees. Iā€™ll see later today if I merge both repos ā€”content is on different branches, after all. Or we can ditch the old one, it never worked, after allā€¦ :cry:

1 Like

New release available here: https://www.androidfilehost.com/?fid=889764386195904774

Changelog:

  • Removed ā€œdouble tapā€
  • Selection of LTE/4G in network settings fixed
  • SIM contacts import should work now (export is not supported currently in Lineage)
  • SIM card requested PIN code after flight mode fixed.
15 Likes

Wow, this is really amazing! Thanks @chrmhoffmann! :blush:
I tried it several times and it seems that Dual-SIM is now working reliably in combination with the flight mode. For me this Lineage Port is now near to perfect, I didnā€™t find major bugs, and an other cool thing: Random reboots are completely gone. I had ~ 2 reboot per week before. :wink:

1 Like

@roboe: @snevas and I decided to keep the repos for now because we feared that something would be lost if we delete it. If you say that no important work is gone forever if we delete it, you can remove the repos.

@chrmhoffmann Is there any chance that the whole community (you and everyone else) can work on one codebase together (rather than having to pull all commits you make into the WeAreFairphone repos)? We have a working build server set up (by @snevas) at the WeAreFairphone GH organization, which is triggered at every commit. No need to upload to AndroidFileHost then.

3 Likes

Just for info. The buildserver triggers from hooks when there are changes in the ā€œWeAreFairphone/android_device_fairphone_FP2ā€-repo and has the following manifest:

<manifest>
    <remote fetch="https://github.com/" name="github2" />
    <project name="WeAreFairphone/android_device_fairphone_FP2" path="device/fairphone/FP2" remote="github2" revision="cm-14.1" />
    <project name="WeAreFairphone/android_kernel_fairphone_msm8974" path="kernel/fairphone/msm8974" remote="github2" revision="cm-14.1" />
    <project name="WeAreFairphone/proprietary_vendor_fairphone" path="vendor/fairphone/FP2" remote="github2" revision="cm-14.1" />
    <project name="lineageos/android_device_qcom_common" path="device/qcom/common" remote="github2" revision="cm-14.1" />
</manifest>

Dear everybody,
first I want to say thank you and especially @chrmhoffmann for working hard on making FP2 and LineageOS compatible!
I am considering to get a fairphone atm and essentially for me the decision depends on a free OS working.

But there is one thing that is quite important to me: encryption. Are you currently considering to work on it? (Do you have any idea on what the problem is?) Or is it rather low priority so it probably wonā€™t be fixed soon?

Until LineageOS supports encryption and depending on your definition of a ā€œfree OSā€ you could probably check out Fairphone Open OS.
Itā€™s the Open Source sibling of the ā€œnormalā€ Fairphone OS, does not have Google services initially (if you want, you could install Open GApps or microG), and supports encryption.

1 Like

Hi @jooe,

there is already a free OS working: FP Open OS which is same as FP OS without Google and with Root (currently still based on Android 5.1 but Android 6 variant is coming very soon).

2 Likes