as promised here is my build guide and what i found out along the way:
- disclaimer: i did not flash the output of my build to a phone as i do not have an FP5, the primary goal was to get the build to run
- the guide was made on ubuntu 22.04 LTS, ubuntu is also used in the android docs so i went with it.
if you build this on another distribution, please report back if you did something different - the machine you use for building must be ‘amd64’, i tried building on ‘arm64’ but it did not work (there are prebuild binaries used for the build and they are compiled only for amd64). if you get this to run on arm64 please tell me how to do this
- build as normal user (non root), you only need root for the first step (and the optional second step). after that you can run the whole build as a non-privileged user
- have fun and please report back if you find any errors or have more information on what goes on during the build. we would like to understand more about how android / LineageOS is build
# 1. bring your system up to date und install needed packages
# (this needs root privileges, add 'sudo' if necessary)
apt update
apt upgrade --yes
apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick lib32readline-dev lib32z1-dev lib32ncurses5-dev libncurses5 libncurses5-dev libelf-dev liblz4-tool libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush python-is-python3 rsync schedtool squashfs-tools unzip wget xsltproc zip zlib1g-dev --yes
# 2. [optional] create a separate builduser
# skip this step if you want to use your already existing user
adduser builduser
su builduser
# 3. install 'adb' and 'fastboot'
# as far as i can tell not strictly necessary for building but used later to flashing the image to a device
cd ~
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip -d ~
cat >> ~/.profile << EOF
if [ -d "\$HOME/platform-tools" ] ; then
PATH="\$HOME/platform-tools:\$PATH"
fi
EOF
# 4. get the repo tool
# used for syncing all the source files to yor build machine
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
# 5. source this file so the $HOME/bin and $HOME/platform-tools folders will be searched for binaries
source ~/.profile
# 6. set your git info (if you want to commit changes to official repos, add your real user and mail here)
git config --global user.email "null@null.com"
git config --global user.name "null"
git lfs install
# 7. get the LineageOS repo
mkdir -p ~/android/lineage
cd ~/android/lineage
# the repo contains information about all the other software repos that are needed to build LineageOS
# uses 'lineage-20.0' branch
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs
# 8. sync all the source code to your build machine
# this takes some time (depending on your machine and internet connection)
# took me 30min to >60min on the machines i tested it
# also uses ~160GB on disk after it finishes
repo sync
# 9. create the FP5 config file
# since the FP5 is not an official LineageOS target yet, you need to add the config where to find kernel and device info etc.
cd ~/android/lineage
mkdir -p ~/android/lineage/.repo/local_manifests
# option 1: (choose this when getting started)
cat >> ~/android/lineage/.repo/local_manifests/roomservice.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="WeAreFairphone/android_device_fairphone_FP5" path="device/fairphone/FP5" remote="github" revision="staging/lineage-20" />
<project name="BLeQuerrec/proprietary_vendor_fairphone_FP5" path="vendor/fairphone/FP5" remote="github" revision="lineage-20" />
<project name="WeAreFairphone/android_kernel_fairphone_qcm6490" path="kernel/fairphone/qcm6490" remote="github" revision="staging/lineage-20" />
</manifest>
EOF
# option 2: uses the same XML as above but change the first project entry to: name="zalox/android_device_fairphone_FP5"
# see the open pull-request for the changes between the repos. once these changed in github are merged, just use the XML from above
# if unsure use option 1 to get started
# 10. source this to get the android build environment commands
source build/envsetup.sh
# 11. enable ccache to speed-up subsequent builds
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 100G
# 12. prepare build environment
# from the docs: Breakfast configures your build environment with the correct variables to create your device-specific rom
# this took me ~5min and used another 3GB on disk
breakfast FP5
# 13. change directory to the top of the tree
croot
# 14. build your image
# this took me about 4h on a Core-i7 with 4+4 CPU cores
# after it finished the total size used for the ~/android/lineage directory was ~280GB
# it's possible during the build more disk space is used so plan accordingly
brunch FP5
# 15. look at the generated files
# i did not flash this to a phone! use at your own risk
# for flashing maybe look at the LineageOS FP4 instructions!?
# and plase report back if you got an image to boot on an FP5
cd $OUT
thanks to @ochorocho for the XML and all the tips so far to get this working