[Sony Xperia XZ ROMs, Kernels, Recoveries, & Other ] local__hero:
Project Treble for Xperia XZ

Hey everyone,

before the year ends, I have something quite neat for you. With this project, you can run (almost) any Generic System Image(GSI) on your Xperia XZ. This means you can test LineageOS, Havoc, Pixel Experience...

No repartitioning necessary! This method is re-using the oem partition.

What is Project Treble?

Understanding Project Treble and Android updates

Talkin’ Treble: How Android engineers are winning the war on fragmentation

What are GSIs?

Android Source: Generic System Image (GSI)

Downloads:

ROM: Download the latest aosp_f8331_*-TREBLE-NIGHTLY.zip from sx.ix5.org/files/builds/kagura/aosp/

TWRP: Download twrp-kagura-oem-to-vendor.img

How to install:

Back up your stuff

Wipe data and caches

Install the zip via TWRP (or unzip and install just the /boot and /vendor images via fastboot)

Install any GSI via "fastboot flash system your-gsi-image.img"

Fix /dsp labels: See DSP file relabeling for SODP

To use Magisk: Flash twrp-kagura-oem-to-vendor.img as recovery. Reboot into recovery and install Magisk like you usually would. If you want to go back to another ROM, you need to re-flash your old TWRP recovery as well.

Bugs: See post #2

DO NOT POST HERE FOR FLASHING HELP OR YOU WILL BE REPORTED. Read everything before posting.​

If you have questions, ask them in this thread: Xperia XZ Pie ROMs Questions and Answers Thread​

List of GSIs: phhusson's treble Generic System Image

Important: You need an A-Only, ARM64 GSI!

GSIs based on phhusson's work offer the best compatibility.

Magisk: For Magisk to work, you need to tweak your TWRP installation, since it doesn't know that we have shuffled /vendor to the oem partition. You need to change /oem to /vendor in TWRP's fstab file.

See above for a tweaked TWRP.

If you want to go back to any other AOSP-based ROM that is not a GSI, simply re-flash the regular oem image and install like you usually would.

For developers:

This method is repurposing the oem partition to hold /vendor and odm(blobs). There's 400mb of space on that partition and we are only using ~260mb for blobs, while vendor is only about 20-30mb.

Re-partitioning can be quite dangerous if you do not know what you are doing. This method should be safe for everyone.

I'll put up the sources shortly. They're based on the regular AOSP builds but need a few tweaks for compatibility.

Update: Sources are up now.

local_manifests

kernel (with patches)

sony's repo_update

ix5_repo_update: run ix5_repo_update.sh and then treble_repo_update.sh

You need to tweak the following:

Kernel dtsi to disable "odm" and load /vendor from "bootdevice/by-name/oem"

PlatformConfig on tone

device-sony-common:

adreno-symlinks branch

symlink from /vendor/odm/lib to /vendor/lib instead of from /odm/lib: Extra symlinks for build.prop and radio (aosp already symlinks /odm to /vendor/odm, but it omits build.prop and our radio folder)

Misc fixes

PRODUCT_FULL_TREBLE_OVERRIDE needs to be "true"

device-sony-tone: treble fixes:

Mount oem as /vendor in fstab

"TARGET_COPY_OUT_VENDOR := vendor" needs to be set

Set VNDK versions, and override properties that get set because the build system is made to believe our XZ shipped with Oreo

device/sony/odm with odm files

Unpack the oem blobs under device/sony/odm/odm and follow the README in device/sony/odm/README.

We need to put the odm files("blobs") somewhere. They get symlinked from /vendor/odm to /odm; both locations need to be accessible.

sepolicy: Use the broad-updates branch (it's kinda hack-ish now because /odm/pm-service is using /dev/binder, which messes with sepolicy). Sepolicy is on permissive for these builds because of that issue.

Tested:

AOSP Extended (calling works, bluetooth may crash)

Havoc (no calling, bluetooth may crash)

Camera should work everywhere

Bugs are the same as the regular AOSP builds, plus some more if the GSI is not built well or doesn't have tweaks for Sony devices.

Happy holidays, I hope you have fun with this!​

XDA:DevDB Information

Project Treble for Xperia XZ F8331/2, ROM for the Sony Xperia XZ

Contributors

local__hero

ROM OS Version: 9.x Pie

ROM Kernel: Linux 4.x

ROM Firmware Required: .184 or later stock firmware

Based On: AOSP

Version Information

Status: Nightly

Created 2018-12-30

Last Updated 2018-12-30