Making unofficial and custom /e/OS builds for `lilac` and `z3tc`

Making unofficial and custom /e/OS Builds

[Edit 07/27/2023] Added the different patch file needed for Android T builds

I will no longer be making unofficial and custom builds once /e/OS v1.13 builds are available. The aim of this post is to document how I make my unofficial / custom builds of /e/OS for Sony Xperia XZ1 Compact (lilac) and Z3 Tablet Compact (z3tc & z3tcw), to help anyone else who wants to carry on making these builds for future /e/ versions.

I build on Linux machines, either

  • locally on a 2010 MacBook Pro, with 16GB RAM, and a 500GB SSD, running Linux Mint 21
  • OR in a cloud server, running the latest UBUNTU LTS release (currently 22.04)

The only thing I do differently between the two platforms is to change the location of the volumes passed to Docker: on the local machine they are all subdirectories of my home directory (i.e. /home/pete/srv/); on the cloud server, where I am logged in as root, they are at /srv/.

I use Docker because

  • it is the officially recommended way and it ‘just works’ ™
  • the only change I make to ‘standard’ /e/OS is to patch the Trebuchet launcher so it can be used as launcher / homescreen, and I can apply that patch easily using a before.sh userscript.

If you are already using Docker, and know your way around local manifests and userscripts then all you need to know is the content of the manifests, userscripts, and patch file, and the docker run commands I use for building each device

Userscripts and patch file

  • before.sh: to be placed in the /srv/userscripts directory
#!/bin/bash

##########################################################
# Apply the Trebuchet fix patch in packages/apps/Trebuchet
#
# This file should be copied to `/srv/userscripts/before.sh`
# before running Docker
##########################################################

cd packages/apps/Trebuchet

git reset --hard

echo ">> [$(date)] Applying the Trebuchet fix patch"

git apply /root/userscripts/eos-Trebuchet-fix.patch

cd ../../../
#########################################################
From 46ea4cf1806dcd70cdf9dc699fb04d704a1b01b1 Mon Sep 17 00:00:00 2001
From: Pete Fotheringham <petefoth@e.email>
Date: Thu, 19 Jan 2023 18:32:19 +0000
Subject: [PATCH] Add back HOME category intent.

---
 AndroidManifest.xml                    | 1 +
 quickstep/AndroidManifest-launcher.xml | 1 +
 2 files changed, 2 insertions(+)

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d6160e18c8..9ee92d71ac 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,6 +61,7 @@
             android:enabled="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.HOME" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.MONKEY"/>
                 <category android:name="android.intent.category.LAUNCHER_APP" />
diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml
index ffca79c788..ae804d2cdc 100644
--- a/quickstep/AndroidManifest-launcher.xml
+++ b/quickstep/AndroidManifest-launcher.xml
@@ -57,6 +57,7 @@
             android:enabled="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.HOME" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.MONKEY"/>
                 <category android:name="android.intent.category.LAUNCHER_APP" />
-- 
GitLab
From 34c371d8484b05b86e330e172aefb3cba322ca72 Mon Sep 17 00:00:00 2001
From: Pete Fotheringham <petefoth@e.email>
Date: Thu, 27 Jul 2023 06:31:56 +0000
Subject: [PATCH] Add back HOME category intent

---
 AndroidManifest.xml                    | 1 +
 quickstep/AndroidManifest-launcher.xml | 1 +
 2 files changed, 2 insertions(+)

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9fd4ce3f98..64b71c68c9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -63,6 +63,7 @@
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.intent.action.SHOW_WORK_APPS" />
                 <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.HOME" />
                 <category android:name="android.intent.category.MONKEY"/>
                 <category android:name="android.intent.category.LAUNCHER_APP" />
             </intent-filter>
diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml
index 3469d3be52..047d1b7201 100644
--- a/quickstep/AndroidManifest-launcher.xml
+++ b/quickstep/AndroidManifest-launcher.xml
@@ -58,6 +58,7 @@
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.intent.action.SHOW_WORK_APPS" />
+                <category android:name="android.intent.category.HOME" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.MONKEY"/>
                 <category android:name="android.intent.category.LAUNCHER_APP" />
--
2.34.1

Manifests

lilac - building /e/OS S / Lineage 19.1

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
      <!-- SONY -->
      <project name="whatawurst/android_kernel_sony_msm8998" path="kernel/sony/msm8998" remote="github" revision="lineage-19.1" />
      <project name="whatawurst/android_device_sony_yoshino-common" path="device/sony/yoshino-common" remote="github" revision="lineage-19.1" />
      <project name="whatawurst/android_device_sony_lilac" path="device/sony/lilac" remote="github" revision="lineage-19.1" />

      <!-- blobs for lilac -->
      <project name="whatawurst/android_vendor_sony_lilac" path="vendor/sony/lilac" remote="github" revision="lineage-19.1" />
      <project name="whatawurst/android_vendor_sony_yoshino-common" path="vendor/sony/yoshino-common" remote="github" revision="lineage-19.1" />
</manifest>

The same manifest can be used to buld /eOS/ T / Lineage 20.0’ when it is released: just change the revision to “lineage-20”,or remove it, and let Docker work out which revision to use

z3tc/z3tcw - building /e/OS R / Lineage 18.1

<?xml version="1.0" encoding="UTF-8"?>

<manifest>

<!-- Remotes -->
  <remote name="gitlab" fetch="https://gitlab.com/" />


  <!-- Devices -->
  <project name="sony_scorpion/android_device_sony_z3tcw"
           path="device/sony/z3tcw"
           remote="gitlab" />

  <project name="sony_scorpion/android_device_sony_z3tc"
           path="device/sony/z3tc"
           remote="gitlab" />

  <project name="sony_scorpion/android_device_sony_shinano-common"
          path="device/sony/shinano-common"
          remote="gitlab" />

  <project name="sony_scorpion/android_device_sony_msm8974-common"
          path="device/sony/msm8974-common"
          remote="gitlab" />

  <project name="LineageOS/android_device_sony_common" path="device/sony/common" remote="github" revision="lineage-18.1" />

  <!-- Hardware -->

  <project name="LineageOS/android_hardware_broadcom_fm" path="hardware/broadcom/fm" remote="github" revision="lineage-18.1" />
  <project name="LineageOS/android_hardware_sony_timekeep" path="hardware/sony/timekeep" remote="github" revision="lineage-18.1" />
  <project name="LineageOS/android_hardware_sony_thermanager" path="hardware/sony/thermanager" remote="github" revision="lineage-18.1" />
  <project name="LineageOS/android_hardware_sony_macaddrsetup" path="hardware/sony/macaddrsetup" remote="github" revision="lineage-18.1" />


  <!-- Kernel -->
  <project name="sony_scorpion/android_kernel_sony_msm8974"
         path="kernel/sony/msm8974"
         remote="gitlab" />

  <!-- Vendor -->
  <project name="sony_scorpion/android_vendor_sony"
           path="vendor/sony"
           remote="gitlab" />
</manifest>

docker run... commands

  • These commands are for my cloud builds, where the volumes passed to docker are at /srv/. For local builds, I change /srv/ to /home/pete/srv/, e.g. -v "/home/pete/srv/src:/srv/src" \
  • I use release tags (e.g. v-1.12.3-s) rather than branch names (e.g. v-1-s) because I am aiming to use the same code as the official releases. Using the branch name would pick up the latest code in that branch, which may have changed since the official release.

lilac

docker run \
  -v "/srv/src:/srv/src" \
  -v "/srv/zips:/srv/zips" \
  -v "/srv/logs:/srv/logs" \
  -v "/srv/cache:/srv/ccache" \
  -v "/srv/keys:/srv/keys" \
  -v "/srv/local_manifests:/srv/local_manifests" \
  -v "/srv/userscripts:/srv/userscripts" \
  -e "SIGN_BUILDS=true" \
  -e "INCLUDE_PROPRIETARY=false" \
  -e "RELEASE_TYPE=CUSTOM" \
  -e "CLEAN_AFTER_BUILD=true" \
  -e "BRANCH_NAME=v1.12.3-r" \
  -e "DEVICE_LIST=z3tc,z3tcw" \
  -e "REPO=https://gitlab.e.foundation/e/os/releases.git" \
  registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community

Once v1.nn-t builds are officially released, the same command should work just by changing the BRANCH_NAME value to e,.g. v1.13.t

z3tc/z3tcw

docker run \
  -v "/srv/src:/srv/src" \
  -v "/srv/zips:/srv/zips" \
  -v "/srv/logs:/srv/logs" \
  -v "/srv/cache:/srv/ccache" \
  -v "/srv/keys:/srv/keys" \
  -v "/srv/local_manifests:/srv/local_manifests" \
  -v "/srv/userscripts:/srv/userscripts" \
  -e "SIGN_BUILDS=true" \
  -e "INCLUDE_PROPRIETARY=false" \
  -e "RELEASE_TYPE=CUSTOM" \
  -e "CLEAN_AFTER_BUILD=true" \
  -e "BRANCH_NAME=v1.12.3-r" \
  -e "DEVICE_LIST=z3tc,z3tcw" \
  -e "REPO=https://gitlab.e.foundation/e/os/releases.git" \
  registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community

I will use the commands to make v1.13 builds once the official builds have been released, and I will edit this post if I have got any of the commands or manifests wrong.

I usually work in a screen session, so that the build is not interrupted if I log out of the ssh session: I can re-login, and type screen -dr to reattach to the session wher Docker is running

Example build run session

  • With all the manifests in /srv/local_manifests and before.sh and eos-Trebuchet-fix.patch in /srv/userscripts
  • Not having previously run the /e/ Dcoker image on this machine
docker run \
  -v "/srv/src:/srv/src" \
  -v "/srv/zips:/srv/zips" \
  -v "/srv/logs:/srv/logs" \
  -v "/srv/cache:/srv/ccache" \
  -v "/srv/keys:/srv/keys" \
  -v "/srv/local_manifests:/srv/local_manifests" \
  -v "/srv/userscripts:/srv/userscripts" \
  -e "SIGN_BUILDS=true" \
  -e "INCLUDE_PROPRIETARY=false" \
  -e "RELEASE_TYPE=CUSTOM" \
  -e "CLEAN_AFTER_BUILD=true" \
  -e "BRANCH_NAME=v1.12.3-r" \
  -e "DEVICE_LIST=z3tc,z3tcw" \
  -e "REPO=https://gitlab.e.foundation/e/os/releases.git" \
  registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community
Unable to find image 'registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community' locally
community: Pulling from e/os/docker-lineage-cicd
f0412dfb1aae: Pull complete
e92a267d16b3: Pull complete
69493f02aa21: Pull complete
f025552bbcca: Pull complete
0315bf175e6f: Pull complete
59617273dec4: Pull complete
480b9bb10350: Pull complete
197cfaaff5c5: Pull complete
be5195f969a4: Pull complete
23c7ac5f05d1: Pull complete
5dc3f680a4f1: Pull complete
05130a1ce50d: Pull complete
1fa3ee3e0bfb: Pull complete
1c0b17f2a274: Pull complete
2a826e95e4fd: Pull complete
0bec12d64b88: Pull complete
1907fc0336ef: Pull complete
67f20e66809e: Pull complete
78ceefabeef1: Pull complete
4759170c9732: Pull complete
b4a1848e25a2: Pull complete
33c66aa510d4: Pull complete
4f4fb700ef54: Pull complete
43d94d9b7c2e: Pull complete
Digest: sha256:37207237470f791904e4e998c559be047622003c8da7783ce2bd746738cf071c
Status: Downloaded newer image for registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community
Set cache size limit to 50.0 GB
>> [Wed Jul  5 14:26:09 UTC 2023] Branch:  v1.12.3-r
>> [Wed Jul  5 14:26:09 UTC 2023] Devices: z3tc,z3tcw,
>> [Wed Jul  5 14:26:09 UTC 2023] (Re)initializing branch repository
>> [Wed Jul  5 14:26:13 UTC 2023] Branch name v1.12.3-r is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'
>> [Wed Jul  5 14:26:22 UTC 2023] Copying '/srv/local_manifests/*.xml' to '.repo/local_manifests/'
>> [Wed Jul  5 14:26:22 UTC 2023] Syncing branch repository
>> [Wed Jul  5 14:45:06 UTC 2023] Setting "CUSTOM" as release type
>> [Wed Jul  5 14:45:06 UTC 2023] Adding OTA URL overlay (for custom URL )
>> [Wed Jul  5 14:45:06 UTC 2023] Adding keys path (/srv/keys)
>> [Wed Jul  5 14:45:06 UTC 2023] Preparing build environment
>> [Wed Jul  5 14:45:06 UTC 2023] Running before.sh
HEAD is now at a033a6822 Merge remote-tracking branch 'origin/lineage-18.1' into v1-r
>> [Wed Jul  5 14:45:07 UTC 2023] Applying the Trebuchet fix patch
>> [Wed Jul  5 14:45:07 UTC 2023] Starting build for z3tc, v1.12.3-r branch
>> [Wed Jul  5 14:45:07 UTC 2023] ANDROID_JACK_VM_ARGS=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G
>> [Wed Jul  5 14:45:07 UTC 2023] Switch to Python2
>> [Wed Jul  5 16:15:56 UTC 2023] Moving build artifacts for z3tc to '/srv/zips/z3tc'
>> [Wed Jul  5 16:16:00 UTC 2023] Finishing build for z3tc
>> [Wed Jul  5 16:16:00 UTC 2023] Cleaning source dir for device z3tc
>> [Wed Jul  5 16:16:25 UTC 2023] Switch back to Python3
>> [Wed Jul  5 16:16:25 UTC 2023] Starting build for z3tcw, v1.12.3-r branch
>> [Wed Jul  5 16:16:25 UTC 2023] ANDROID_JACK_VM_ARGS=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G
>> [Wed Jul  5 16:16:25 UTC 2023] Switch to Python2

I keeps all my manifests in this codeberg git repository, but the files there may change in future in ways that may stop them working with /e/OS. The code in this thread should continue to work unless something changes in /e/OS (or the upstream LineageOS4microG) which breaks them

Making more customised builds

I used to make custom builds with more changes (e.g. replacing /e/'s forked apps with their upstream originals). To do that I used @steadfasterX’s android_vendor_e and extendrom projects. If you want to go down that route, then both projects have excellent, easy-to-follow documentation.

Good luck, and have fun!

6 Likes

Which branch are you building? If it’s v1-s try building for v1-t instead. It’s a long time since I built lineage-19.1 and it could have gone out of date. Just remove the revision="lineage-19.1" from the manifest, and it should pick up the 20.0 instead

I used the lineage-20 sources

OK. I don’t have a hardware/sony/amplifier in my 20.0 source tree. Where (which git repo) did you get it from?

I removed the hardware sony folder and now it started building. I needed the hardware sony files for a sony device I build lately. For Samsung devices one need the samsung hardware folder for most devices, but Sony seems to be different

1 Like