[Google Pixel Guides, News, & Discussion] NZedPred:
I decided to put together a guide on how to build TWRP from source, having successfully built it myself and restored a few of the goodies that disappeared in the 3.3.1-0 release (e.g. install kernel). Also, marlin (Pixel XL) has had a few advancements over sailfish (Pixel), so this is a way to get back on par even if unofficially.

Whilst I'll go into a good level of detail, this will not be a hand-holding guide. You are expected to be able to use the Linux command line, and tools such as Git and repo.

Download sources

This guide is based upon building from the Minimal TWRP sources, which are based upon a subset of Omnirom. At the time of writing, the latest branch is twrp-9.0 (Pie). (If you are reading this some months after I have written this guide, check for later branches.) Follow this link for the repo, and the instructions:

https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-9.0

Firstly, create a folder to put this in, e.g. $HOME/twrp-minimal-omni, and change to that directory. Then execute the following for a shallow clone (to save space...):

repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0

Before doing the repo sync, we will need a few extra repositories to be downloaded. Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="android_device_google_marlin" path="device/google/marlin" remote="TeamWin" revision="android-9.0" />
<project path="hardware/qcom/bootctrl" name="platform/hardware/qcom/bootctrl" groups="pdk-qcom" remote="aosp" />
<project path="hardware/qcom/msm8998" name="platform/hardware/qcom/msm8998" groups="qcom_msm8998,pdk-qcom" remote="aosp" />
</manifest>

android_device_google_marlin - contains the configuration and build instructions for marlin and sailfish

hardware/qcom/bootctrl - this is part of AOSP, and is required for building TWRP

hardware/qcom/msm8998 - extra chipset stuff that is required for marlin/sailfish

You can do a repo sync now to download the sources.

Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom is not necessary) drivers for the latest Pie release here:

https://developers.google.com/android/drivers#sailfishpq3a.190801.002

Extract the files into the same folder as you created, and execute e.g as follows, and follow the prompts:

./extract-google_devices-sailfish.sh

The binaries will be extracted into a vendor/google-devices/ sub-folder. Do not rename the sub-folder - the configuration looks for exactly this path.

You now have all of the source files needed.

Do the build

We then more-or-less follow the instructions as per the original minimal manifest page:

export ALLOW_MISSING_DEPENDENCIES=true
. build/envsetup.sh
lunch omni_sailfish-eng
mka bootimage

The boot image will be created at out/target/product/sailfish/boot.img.

Use fastboot boot out/target/product/sailfish/boot.img to test it in fastboot mode on your device.

Hope this helps someone out there!

XDA:DevDB Information

Building TWRP for Sailfish, Tool/Utility for the Google Pixel

Contributors

NZedPred

Version Information

Status: Stable

Created 2020-01-03

Last Updated 2020-04-26