This is still a WIP. Don't expect it to work.
Make sure you use Linux. If you have Windows, use WSL.
kernel (zImage) and device tree blob (dt.img) are already compiled
source: MOTO-M8916/android_kernel_motorola_msm8916
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
mkdir ~/OrangeFox_sync
cd ~/OrangeFox_sync
git clone https://gitlab.com/OrangeFox/sync.git
cd ~/OrangeFox_sync/sync/
./orangefox_sync.sh --branch 12.1 --path ~/fox_12.1
cd ~/fox_12.1
git clone -b orangefox-12.1 https://github.com/ItsPi3141-Surnia/orangefox_device_motorola_surnia.git device/motorola/surnia/
git clone https://github.com/ItsPi3141-Surnia/kernel_motorola_msm8916 ./kernel/motorola/msm8916 -b twrp --depth=1
rm -rf ./device/qcom/common
git clone https://github.com/TeamWin/android_device_qcom_common ./device/qcom/common -b android-9.0
cp ./device/motorola/surnia/files/device_qcom_common_cryptfs-hw_Android.bp ./device/qcom/common/cryptfs_hw/Android.bp
cp ~/fox_12.1/device/motorola/surnia/patches ~/fox_12.1 -r
cp ~/fox_12.1/device/motorola/surnia/patch.sh ~/fox_12.1
. ~/fox_12.1/patch.sh
export ALLOW_MISSING_DEPENDENCIES=true
export FOX_BUILD_DEVICE=surnia
export LC_ALL="C"
. ./build/envsetup.sh
. ./device/motorola/surnia/vendorsetup.sh
Tip
If you change variables in vendorsetup.sh, make sure you execute it again
lunch twrp_surnia-eng
mka adbd recoveryimage
rm -rf out/target/product/surnia/root/vendor