[Google Pixel Guides, News, & Discussion] NZedPred:
Building other recoveries - Orangefox

Orangefox

Quick guide for the impatient

Create a folder that will be your OrangeFox folder, and change into it. All commands below will be relative to this folder.

# Initialize the repo
repo init --depth=1 -u https://gitlab.com/OrangeFox/Manifest.git -b fox_9.0
# Create local manifests folder
mkdir .repo/local_manifests
# Create the local manifest for sailfish/marlin - use gedit, kate, leafpad, whatever your text editor is
gedit .repo/local_manifests/orangefox-marlin.xml

After the last command, the text editor window will open. Paste the following content into it.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="TeamWin" fetch="https://github.com/TeamWin" review="https://gerrit.twrp.me" />
<project name="external_magisk-prebuilt" path="external/magisk-prebuilt" remote="TeamWin" revision="master" />
<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>

Then save and close the editor, and continue with the following commands.

# Sync the repos
repo sync -j8

Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom aren't 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 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.

At the time of writing, there is a bug that prevents the FB2PNG module building (I think this is FrameBuffer2PNG - screenshots). Edit the file as below

# Edit sailfish config
gedit device/google/marlin/sailfish/BoardConfig.mk
# Edit marlin config
gedit device/google/marlin/marlin/BoardConfig.mk

Around line 204, change

TW_INCLUDE_FB2PNG := [U]true[/U]

to

TW_INCLUDE_FB2PNG := [U]false[/U]

Now continue to build as normal

. build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
# For building sailfish use this line
lunch omni_sailfish-eng
# For building marlin use this line
lunch omni_marlin-eng
mka bootimage

NOTE: If you are building for sailfish, don't run the lunch omni_marlin-eng line. Also, you may get an error "Your device can't be found in device sources..". That's actually OK, it's just because there isn't a folder called device/google/sailfish. If the error bothers you, just create the folder and re-run the lunch command (and ignore the warning about device/google/sailfish/omni.dependencies file not found).

This will create a fastboot bootable image in the $OUT folder called boot.img. You can try booting it with your device in fastboot mode:

fastboot boot $OUT/boot.img

There are also a number of environment variables that OrangeFox has available. I haven't really tested whether or not they are necessary. Will update this post after I do some investigation.