[Xperia Z1 Compact Android Development] munjeni:
How to build lineage 15.0

Prereg:

Ubuntu 16 64bit , 8gb ram, 4gb swap

Reguired packages (copy line by line):

sudo -i
apt update
apt install openjdk-8-jdk
apt install e2fsck resize2fs git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

Install repo:

mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
ln -s ~/bin/repo /usr/bin/repo

Add local manifest and sync source tree:

MY_FOLDER="/home/`users`/Desktop/android/lineage"
mkdir -p $MY_FOLDER
cd $MY_FOLDER
echo "" > .repo/local_manifests/roomservice.xml
gedit .repo/local_manifests/roomservice.xml

now put this into roomservice.xml opened by gedit and save it:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="SuperLamic/proprietary_vendor_sony" path="vendor/sony" revision="gps" />
<project name="munjeni/android_kernel_sony_msm8974" path="kernel/sony/msm8974" revision="lineage_15.0_r1" />
<project name="munjeni/android_device_sony_amami" path="device/sony/amami" revision="lineage-15.0_r1" />
<project name="LineageOS/android_device_sony_common" path="device/sony/common" remote="github" />
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="LineageOS/android_external_stlport" path="external/stlport" />
<project name="sonyxperiadev/boringssl-compat" path="external/sony/boringssl-compat" remote="github" revision="master" />
</manifest>

now sync source tree:

repo init -u git://github.com/LineageOS/android.git -b lineage-15.0
repo sync --force-sync

Lineage need some patches, aply it:

chmod a+x $MY_FOLDER/device/sony/amami/patches/romgen_lp.sh

cd device/qcom/common
patch -p1 < $MY_FOLDER/device/sony/amami/patches/device_qcom_common.patch
cd ../../..

cd external/libnfc-nxp
patch -p1 < $MY_FOLDER/device/sony/amami/patches/external_libnfc-nxp.patch
cd ../..

cd hardware/qcom/audio-caf/msm8974
patch -p1 < $MY_FOLDER/device/sony/amami/patches/hardware_qcom_audio-caf_msm8974.patch
cd ../../../..

cd hardware/qcom/gps
patch -p1 < $MY_FOLDER/device/sony/amami/patches/hardware_qcom_gps.patch
cd ../../..

cd hardware/qcom/keymaster
patch -p1 < $MY_FOLDER/device/sony/amami/patches/hardware_qcom_keymaster.patch
cd ../../..

cd packages/apps/Camera2
patch -p1 < $MY_FOLDER/device/sony/amami/patches/packages_apps_Camera2.patch
cd ../../..

cd packages/apps/Nfc
patch -p1 < $MY_FOLDER/device/sony/amami/patches/packages_apps_Nfc.patch
cd ../../..

cd system/bt
patch -p1 < $MY_FOLDER/device/sony/amami/patches/system_bt.patch
cd ../..

cd vendor/sony
git apply $MY_FOLDER/device/sony/amami/patches/vendor_sony.patch
cd ../..

You are ready to build now:

source build/envsetup.sh
lunch 16
breakfast amami
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx6G"
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx6144m"
croot
brunch amami

Make system.img:

make systemimage

Now make otapackage.zip:

$MY_FOLDER/device/sony/amami/patches/romgen_lp.sh $MY_FOLDER/out/target/product/amami 1 1

Done! Enjoy!