Skip to content

mstaz/backup_android_device_fairphone_fp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Device configuration for Fairphone 3

Device specifications

Basic Spec Sheet
CPU Octa-core 1.8 GHz Cortex-A53
CHIPSET Qualcomm SDM632 Snapdragon 632
GPU Adreno 506
Memory 4GB
Shipped Android Version 9.0 (Pie)
Internal Storage 64GB
microSD Up to 400GB (dedicated slot)
Battery 3000 mAh
Dimensions 158 x 71.8 x 9.89 mm
Display 2160 x 1080 pixels, 5.65-inch IPS LCD
Rear Camera 12 MP (f/1.8, 1/2.55", PDAF)
Front Camera 8 MP (f/2.0, 1/4", HDR)

Introduction

This is my first draft to build LineageOS 16 for the Fairphone 3. It's also my first time building LineageOS and it's been a while I last worked on Android platform development. So please forgive me any major mistakes 😊

I started with the base configuration of Motorola's SDM632 platform and used the river configuration as an example. Not sure if that makes sense but at least it's the same chipset.

Also I took some settings and the kernel from k4y0z's amazing work for porting TWRP to Fairphone 3:

Current Status

  • It builds successfully. ✔️
  • Device boots and adb can be accessed. ✔️
  • Bootanimation is shown. ✔️
  • LineageOS is booting completely. ✔️
  • Working things after quick test:
    • Display / Touchscreen ✔️
    • Sound ✔️
    • Bluetooth ✔️
    • Camera ✔️
    • Wi-Fi ✔️
    • NFC ✔️
    • Device encryption ✔️
    • Fingerprint sensor ✔️
    • LTE ✔️
    • GPS ✔️

Known Issues

These things are untested or known not to work:

  • Updater
  • Playing videos in fullscreen causing some overlay issue
  • Ear speaker, e.g. during phone calls

Kernel Source

Based on repository from k4y0z: https://github.com/chaosmaster/android_kernel_fairphone_sdm632

Added the qcom specific audio-kernel stuff in techpack/audio.

Also I read the kernel config from the stock firmware as base.

Find my fork here: https://github.com/mstaz/android_kernel_fairphone_sdm632

How to compile

  • Follow the first steps for setting up the LineageOS build system as described e.g. here.
  • Before downloading the source code using repo sync, create a local manifest file in the top of the source tree using
mkdir -p .../lineageos/.repo/local_manifests
cat <<EOF > .../lineageos/.repo/local_manifests/roomservice.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="mstaz/android_device_fairphone_fp3" path="device/fairphone/fp3" remote="github" />
  <project name="mstaz/android_kernel_fairphone_sdm632" path="kernel/fairphone/sdm632" remote="github" />
  <project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
  <project name="LineageOS/android_external_bson" path="external/bson" remote="github" />
  <project name="LineageOS/android_system_qcom" path="system/qcom" remote="github" />
</manifest>
EOF

This is a temporary hack while we are working outside of the LineageOS repositories.

  • Do repo sync -c to download all needed project repositories.
  • Extract proprietary files.
    • I used stock 110 release firmware dump from k4y0z.
    • The files are compressed with brotli.
      • Install it if necessary, e.g. with sudo apt-get install brotli
      • Extract *.br files with: brotli -d *.br
      • The *.dat files then need to be converted to *.img files with sdat2img tool which comes with LOS.
vendor/lineage/build/tools/sdat2img.py system.transfer.list system.new.dat system.img
vendor/lineage/build/tools/sdat2img.py vendor.transfer.list vendor.new.dat vendor.img
vendor/lineage/build/tools/sdat2img.py product.transfer.list product.new.dat product.img
  • Mount system and vendor image and run the script on the folder:
sudo mount -o ro,loop system.img tmp
sudo mount -o ro,loop vendor.img tmp/vendor
cd .../lineageos/device/fairphone/fp3
./extract-files.sh .../tmp
  • If file access permissions are missing change it before calling extract_files.sh, e.g. with chown (don't flash image files anymore after that):
# Replace user with your user name.
sudo chown -R user:user tmp
  • Then do
. build/envsetup.sh
brunch fp3 eng

How to flash

First both slots need to have success state. See HOW TO for flashing GSI images for that.

Flashing the package with TWRP seems to cause some problems yet.

So far I flash the images with fastboot. system.img is not copied to output root folder so I take it from the packaging subfolder.

fastboot flash system out/target/product/fp3/obj/PACKAGING/target_files_intermediates/lineage_fp3-target_files-eng.ms/IMAGES/system.img
fastboot flash vendor out/target/product/fp3/vendor.img
fastboot flash product out/target/product/fp3/product.img
fastboot flash boot out/target/product/fp3/boot.img
fastboot flash dtbo out/target/product/fp3/dtbo.img

Boot into TWRP and disable verity:

adb disable-verity

Unfortunately sometimes for some reason AVB immediately switches back to the other slot and prevents it from booting. Booting any image (even TWRP) failes with following message:

Downloading 'boot.img'
OKAY [  1.006s]
booting
FAILED (status read failed (No such device))
Finished. Total time: 7.387s

Slot is switched to the other one then. Maybe it's connected to rollback protection. However I'm not sure yet how this can be solved. Sometimes re-flashing vbmeta images worked. Sometimes I needed to completely flash stock back to both slots and get them successfully booted first. Sometimes even that doesn't work immediately.

About

Android / LineageOS 16 device tree for Fairphone 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published