Remove All Ads from XDA

Project Treble for Xperia XZ [F8331/2] [Pie 9.0] [no repartitioning]

93 posts
Thanks Meter: 192
By local__hero, Member on 30th December 2018, 01:38 PM
Post Reply Email Thread
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)

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


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.
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.

  • 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

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
The Following 12 Users Say Thank You to local__hero For This Useful Post: [ View ] Gift local__hero Ad-Free
30th December 2018, 01:38 PM |#2  
OP Member
Thanks Meter: 192
Reporting bugs

Important: Read the bug list before posting. Anyone can add bugs to the list, just follow the rules.

DO NOT REPORT ISSUES WITH GSIs! Ask the GSI maintainer to fix them!

I will repeat the rules again here:

  • New bugs must include version where error popped up and which oem version you are using
  • Only reproducible errors
  • Should include adb logcat (linked in a pastebin service like
  • Must include clear description what is wrong
  • If it is a visual/SystemUI bug, only report it here
  • If it is an internal bug(e.g. fingerprint crashes device), report it to the Sony bugtracker as well!
  • Always try to fix the bug yourself first! Then submit a pull request to Sony
  • Must search if error has already been reported (bug tracker, this document, dev buglist)
  • If you've reported the issue somewhere else already and just want to track it here as well, add a link
  • Before reporting a bug, always make sure to isolate it. That means, wipe everything, install only the ROM without GApps and Magisk and see if the problem still exists. Only then report the bug!
The Following 2 Users Say Thank You to local__hero For This Useful Post: [ View ] Gift local__hero Ad-Free
30th December 2018, 01:38 PM |#3  
OP Member
Thanks Meter: 192
The Following 2 Users Say Thank You to local__hero For This Useful Post: [ View ] Gift local__hero Ad-Free
30th December 2018, 05:51 PM |#4  
josephnero's Avatar
Senior Member
Flag Sanford NC
Thanks Meter: 712
Actually this is awesome. Thanks
30th December 2018, 08:53 PM |#5  
Flag Augustów
Thanks Meter: 9
What about Oreo 8.1 ?
30th December 2018, 10:25 PM |#6  
DahakePL's Avatar
Recognized Contributor
Flag Kalisz
Thanks Meter: 2,137
Donate to Me
Originally Posted by piotr7543

What about Oreo 8.1 ?

It's legacy, not gonna be supported I guess
31st December 2018, 11:53 AM |#7  
Flag Augustów
Thanks Meter: 9
Havoc OS 2.0 working good: Calling Data Transmission NFC Camera (recording too) is working fine i do not test fingerprint.
1st January 2019, 04:58 AM |#8  
Senior Member
Commonwealth Quezon City Philippines
Thanks Meter: 90
magisk cant install
1st January 2019, 12:04 PM |#9  
Flag Augustów
Thanks Meter: 9
Yep unable to mount /vendor. And Havoc is working very good fingerprint, Wi-Fi works. No random reboots for now Thank you very much local__hero for this
The Following User Says Thank You to piotr7543 For This Useful Post: [ View ] Gift piotr7543 Ad-Free
3rd January 2019, 11:20 AM |#10  
Thanks Meter: 7
I want to say for the community out there curious as to what Project Treble is:

More ROMS for Xperia XZ ( as development just isn't what it used to be )

Long story:

PT is a new way for alternative ROM developers to make ROMS for a wider range of phones that support PT

PT acts like a middle man for the ROM and the Xperia allowing ( where developed) other phones to have the same ROM on it .

I'd seriously recommend giving this a try, instructions aren't hard if YOU READ THEM CORRECTLY

And it also gives Xperia users a bigger range of ROMS to experiment with, that's weren't specifically built for the XZ

It is to be noted, it's not perfect. And is in development and some featured aren't stable
The Following 2 Users Say Thank You to DarkPrinciple For This Useful Post: [ View ] Gift DarkPrinciple Ad-Free
3rd January 2019, 01:19 PM |#11  
Thanks Meter: 8
can you explain how to install and make functional magisk ?
The Following 2 Users Say Thank You to bobladure For This Useful Post: [ View ] Gift bobladure Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes