Fairphone 3 (FP3)



  • This is a port for the Fairphone 3.
    Currently only the GSI (Generic System Image) -way is working.

    Sources

    Status

    Working

    • Actors: Manual brightness
    • Actors: Vibration
    • Actors: Notification LED
    • Camera: Photo
    • Camera: Video
    • Camera: Switch between back and front camera
    • Cellular: Data connection
    • Cellular: Incoming, outgoing calls
    • Cellular: PIN unlock
    • Cellular: Voice in calls
    • Endurance: Battery lifetime > 24h from 100%
    • GPU: Boot into UI
    • GPU: Hardware video decoding
    • Misc: AppArmor patches applied to kernel (Kernel 4.9)
    • Misc: Battery percentage
    • Misc: Offline charging
    • Misc: Online charging
    • Misc: Shutdown / Reboot
    • Network: Bluetooth
    • Network: WiFi
    • Network: Flight mode
    • Sensors: Fingerprint reader
    • Sensors: Proximity
    • Sensors: Rotation
    • Sensors: Touchscreen
    • Sensors: GPS
    • Sound: Loudspeaker
    • Sound: Microphone
    • Sound: Volume control

    Working with additional steps

    • Camera: Flashlight, with gst-droid patched camera app not needed anymore
    • Cellular: Carrier info, signal strength
      • Data-Connection is not displayed, but there
    • Misc: SD card detection and access
      • It is there but gets not displayed in Filebrowser
        But one can access it over /media/phablet/<sdcard-name>
    • Network: Hotspot
      • also no display feedback, but it is there, after some de-/activation action 😉

    Not working

    • Actors: Torchlight
    • USB: MTP access

    Not tested

    • Cellular: MMS in, out
    • Cellular: SMS in, out
    • Cellular: Change audio routings
    • Endurance: No reboot needed for 1 week
    • Misc: Anbox patches applied to kernel
    • Misc: Recovery image
    • Misc: Reset to factory defaults
    • Misc: RTC time is used after reboot
    • Sensors: Automatic brightness
    • Sound: Earphones
    • USB: ADB access
    • USB: External monitor - only for devices that support it

    How to build

    • create halium folder and cd into it
    • initialize the halium 9.0 repo: repo init -u https://github.com/Halium/android -b halium-9.0 --depth=1 (creates a hidden .repo folder, in case if you are wondering)
    • do: repo sync -c -j [number of parallel jobs]
      ** make sure that the bionic folder is synced (this somehow missing repo caused builderrors and a headache for me)
    • add manifest file fairphone_FP3.xml to halium/devices/manifests
    • missing exfat modules: cd into kernel/fairphone/sdm632 and do: git submodule update --init --recursive
    • do: ./halium/devices/setup FP3
    • modify kernel config: halium/halium-boot/check-kernel-config kernel/fairphone/sdm632/arch/arm64/configs/lineageos_FP3_defconfig -w
      • most of these changes should already be in the kernel source, but there my be changes in the meantime
    • check again without -w parameter
    • add fixup mountpoints for FP3, I am not sure if this is really needed:
        "FP3")
            sed -i \
                -e 's block/mmcblk0p30 mmcblk0p30 ' \
                -e 's block/mmcblk0p31 mmcblk0p31 ' \
                -e 's block/bootdevice/by-name/vendor_a mmcblk0p32 ' \
                -e 's block/bootdevice/by-name/product_a mmcblk0p60 ' \
                -e 's block/bootdevice/by-name/vendor_b mmcblk0p33 ' \
                -e 's block/bootdevice/by-name/product_b mmcblk0p61' \
                -e 's block/mmcblk0p62 mmcblk0p62 ' \
                -e 's block/mmcblk0p34 mmcblk0p34 ' \
                "$@"
            ;;
    
    • apply hybris patches: hybris-patches/apply-patches.sh --mb
    • build:
      I used a little bash script, you can also execute each command individually in the terminal
      #!/bin/sh
      
      # prepare 
      # using python 3 caused builderrors, perhaps there is an environment variable for this??
      sudo ln -sf python2 /usr/bin/python
      
      # when using zsh shell you will likely need this two commands
      setopt shwordsplit
      export LC_ALL=C 
      
      # build
      export USE_HOST_LEX=yes
      source build/envsetup.sh
      breakfast FP3
      mka halium-boot
      #mka systemimage
      
      # revert python 
      sudo ln -sf python3 /usr/bin/python
      
      Of course, you could also build the systemimage, but I could not get it to work/boot yet.
      It takes ~1h on an Intel i7 9750H (@45W) ;-).

    How to flash

    Prepare

    Build or download the halium-boot image.
    Get TWRP for Fairphone 3.
    Get a ubports GSI.
    Unlock your phone, see: https://www.fairphone.com/en/bootloader-unlocking-code-for-fairphone-3/
    You will need the android tools "fastboot" and "adb".

    Flash

    • Boot the phone into bootloader/fastboot by pressing power + volume-down buttons until it reboots. Or just reboot and click a volume button within 5 seconds and select the bootloader.
    • Flash halium-boot image: $ fastboot flash boot halium-boot.img
    • Boot your downloaded TWRP image temporarly: $ fastboot boot [twrp-image.img]
    • In TWRP go to ADVANCED and Select "ADB Sideload". Activate sideload.
    • in Terminal: adb sideload [ubports_gsi.zip]
    • Wait until it finished, then reboot system.

    Troubleshooting

    In case something wents wrong, you should be prepared to be able to flash a working android image. I used the /e/ OS images for this case.
    Look here: https://community.e.foundation/t/how-to-flash-e-os-on-fairphone-3-using-debian-based-gnu-linux/15498

    Known Issues

    • There are some graphics-glitches (black bars flashing up here and there).
      • Much less with latest GSI v10
    • Inititally the scaling is very small, this leads to some unwanted effects. Morph Browser, websites are always in Desktop Mode
      • Fix: Make the system writable and change/add following properties in /etc/ubuntu-touch-session.d:
        GRID_UNIT_PX=21
        QTWEBKIT_DPR=2.0
        FORM_FACTOR=handset
    • In the app overview (swipe from the left) it is hard to grab the app, to close it by swiping it up or down. fixed with GSI v10
    • The settings app crashs, when opening the memory-overview in the Info-area.
    • With Erfan's GSI (v9) webapps crash on start fixed with GSI v10


  • Great this phone got ported!



  • I assume, the first todo will be about: "How to create a GSI with a more recent rootfs".
    Long story short: I did try. But lost functionality. So I wonder if there are neccessary patches which should be applyed to the rootfs.

    For Example:
    I just took the system.img from erfans GSI builds, created a rootfs image out of the latest android9 build (https://ci.ubports.com/job/xenial-mainline-edge-android9-rootfs/) (using halium-install and taking the created image out of the hidden temporary folder), and created GSI with this tool: https://github.com/erfanoabdi/ubport_GSI.

    I also tried some builds from here: https://mrcyjanek.net/ci/view/ubports-gsi/
    But they are also not very up to date...

    After flashing multiple times (>15) I ended up with the phone in a corrupted state and needed to flash eOS again, to start from scratch.

    I also managed to get my own built system-image running with this GSI method, but as I needed to comment out the WiFi part to make it compile, WiFi was missing.

    The best I could get, was a rootfs build form the 28th of September, but there the display-backgroundlight, could not be controlled and the display could not be turned of. Maybe this was a sideeffect of the whole multiple flashing.

    Currently I am back at Erfan's GSI v9, evaluating it.



  • Somehow I managed to build a more recent working GSI zip for arm64:
    https://drive.google.com/file/d/1L_fA1W1D9xWO2OqmnimvHdLWEdRN1api/view?usp=sharing

    Camera does not work in this version, so far...



  • I updated the start-post.
    With the latest GSI v10 from Erfan, the phone gets very usable. I don't know of a real issue so far.


Log in to reply