(2020/02/02)

Sony Xperia XZ1 Compact (lilac)

Android Open Source Project (AOSP)

Prepare LXC

lxc-create -n aosp -t download
sed -i "s/lxc.net.0.type = empty/lxc.net.0.type = none/g" /var/lib/lxc/aosp/config

mv /var/lib/lxc/aosp /home/eric/aosp
ln -s /home/eric/aosp /var/lib/lxc/aosp
lxc-start  -n aosp
lxc-attach -n aosp

echo 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' >> /root/.bashrc && exit
lxc-attach -n aosp

Install Dependencies

dpkg --add-architecture i386
apt-get update
apt-get install openjdk-8-jdk repo
apt-get install bison g++-multilib git gperf libxml2-utils make zlib1g-dev:i386 \
                zip liblz4-tool libncurses5 libssl-dev bc flex rsync

Prepare Sources

su -l ubuntu
export branch=android-10.0.0_r21
git config --global user.email "[email protected]"
git config --global user.name "local"

mkdir ~/android
cd ~/android
repo init -u https://android.googlesource.com/platform/manifest -b $branch

cd .repo
git clone https://github.com/sonyxperiadev/local_manifests
cd local_manifests
git checkout $branch
cd ../..
repo sync
./repo_update.sh

Rebuild Kernel (optional)

Currently required, due to [Yoshino][Lilac] Kernel 4.14 bootloops.:

cd kernel/sony/msm-4.14/kernel/
git checkout b5b8742^
cd -

Build

source build/envsetup.sh && lunch
make -j$(nproc)

Flash

fastboot flash oem SW_binaries_for_Xperia_Android_10*.img

fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash userdata userdata.img

Sony Xperia XZ1 Compact (lilac)

Lineage OS

Prepare LXC

lxc-create -n lineage -t ubuntu

sed -i "s/lxc.net.0.type = empty/lxc.net.0.type = none/g" /var/lib/lxc/lineage/config

lxc-start  -n lineage
lxc-attach -n lineage

echo 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' >> /root/.bashrc && exit
lxc-attach -n lineage

apt-get update && apt-get upgrade
apt-get install bc bison bsdmainutils build-essential curl flex gcc-multilib \
    git g++-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline6-dev \
    lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev \
    libwxgtk3.0-dev libxml2 libxml2-utils lzop make openjdk-8-jdk pngcrush repo \
    rsync schedtool squashfs-tools xsltproc zip zlib1g-dev

Setup Build Environment

su -l ubuntu

git config --global user.email "[email protected]"
git config --global user.name "Build User"

repo init -u git://github.com/LineageOS/android.git -b lineage-15.0
mkdir .repo/local_manifests
cat > .repo/local_manifests/roomservice.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <!-- SONY -->
  <project name="LineageOS/android_hardware_sony_macaddrsetup" path="hardware/sony/macaddrsetup" remote="github" />
  <project name="LineageOS/android_hardware_sony_thermanager" path="hardware/sony/thermanager" remote="github" />
  <project name="LineageOS/android_hardware_sony_timekeep" path="hardware/sony/timekeep" remote="github" />
  <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
  <project name="LineageOS/android_device_sony_common" path="device/sony/common" remote="github" />
  <project name="cryptomilk/android_kernel_sony_msm8998" path="kernel/sony/msm8998" remote="github" />
  <project name="cryptomilk/android_device_sony_common-treble" path="device/sony/common-treble" remote="github" />
  <project name="cryptomilk/android_device_sony_yoshino" path="device/sony/yoshino" remote="github" />
  <project name="cryptomilk/android_device_sony_lilac" path="device/sony/lilac" remote="github" />
  <!--<project name="cryptomilk/proprietary_vendor_sony_lilac" path="vendor/sony/lilac" remote="github" />-->
</manifest>
EOF

repo sync

Build

source build/envsetup.sh
lunch lineage_lilac-userdebug
make -j8 bacon