SODP General Treble Build Guidance

Sjll

Recognized Developer
Jun 4, 2017
378
393
83
Chongqing
SODP General Treble ROM Build Guidance

I'm so sorry, I don‘t have enough time to build a treble ROM every week, I decide to write this guide.​

Support devices:
Xperia X, Xperia X Performance, Xperia X Compact
Xperia XZ, Xperia XZs. Xpeira XZ Premium

Principle
SODP team has done everything to Go treble on AOSP Pie. So if you want to go treble, you need only to do a little work.The key is to enable VNDK and provide a Vendor partition.
As is known to us, there are many partitions exist in our devices. But not all of them are necessary for AOSP. 300KB disk space is enough for our AOSP cache partiton, but sony give us more than 300MB. It's a waste of disk space. Besides, all of these devices I mentioned support Qnovo charging technology, there is a partition in our phone named Qnovo for this stock function. It about 10~30MB. But we don't need it on AOSP. So we can use these two partition to Go Treble.

How to go treble
We need to use cache partition as vendor partition and Qnovo partition as cache partition.
I'll take Maple as an example. How to modify devices tree to support treble.
Enable VNDK
Maple's Devices tree: Link
We need to add vndk modules config in device.mk. See picture.


Add new partition table config
Yoshino's Devices tree: Link
First Step:
For maple, we need to add partition table config in BoardConfig.mk..
Notice: Because Yoshino platform has 3 devices. XZ1 and XZ1C has a vendor partition. The partition table config is in devices's BoardConfig.mk. For tone and loire platform, all of their devices has the same partition table. Their partition table config is in platform devices tree's PlatformConfig.mk.
The cache and vendor partitions' size shoud depend on phone's actual size. You can use my config. I had set it smaller than actual size.

See picture:


Second Step:
For maple, we need to modified fstab in Yoshino platform device tree, the path is: rootdir/vendor/etc/fstab_legacy.yoshino.
See picture:


Third Step:
We need to modified selinux policy in Yoshino platform device tree, the path is: sepolicy_platform/file_contexts.
See picture:


Fifth Step:
To avoid SELinux policy errors and fail to boot, we'd better to set selinux=permissive in BoardConfig.mk or PlatformConfig.mk.


Modify kernel fstab config
For maple the path is arch/arm64/boot/dts/qcom/msm8998-yoshino-maple_common.dtsi
Notice: For tone and loire platform, you need to find the platform common config in the same floder, like msm8996-tone-common.dtsi, msm8952-loire-common.dtsi
You need to set right vendor path and status, just like configs of system and oem partition




After doing this, you can build a treble ROM

By Sjll
2019.2.15
 
Last edited:

LSS4181

Senior Member
Mar 13, 2012
371
110
63
Say, what does Qnovo really do on our devices? Since you stated that we don't need it on AOSP... does it mean it's not supported on AOSP, or it has little impact on charging?

Since I'm testing eXistenZ for the time being (until we were able to get upstream fixes for current Treble-related issues), I'm afraid I might have broken Qnovo if I did a wipe with your version of TWRP recovery (since you pointed Qnovo partition as cache). good side is that it can backup OEM partition which is very helpful...
 

Sjll

Recognized Developer
Jun 4, 2017
378
393
83
Chongqing
Say, what does Qnovo really do on our devices? Since you stated that we don't need it on AOSP... does it mean it's not supported on AOSP, or it has little impact on charging?

Since I'm testing eXistenZ for the time being (until we were able to get upstream fixes for current Treble-related issues), I'm afraid I might have broken Qnovo if I did a wipe with your version of TWRP recovery (since you pointed Qnovo partition as cache). good side is that it can backup OEM partition which is very helpful...
I guess Qnovo is a partition to save Qnovo charging program's data. We don't need it on AOSP. It may be a data or cache partition for Qnovo. Never worried about Qnovo is broken. If you use flashtool, you will find there is a opinion for Qnovo in WIPE menu, it could be erasable
 
  • Like
Reactions: LSS4181

LSS4181

Senior Member
Mar 13, 2012
371
110
63
I guess Qnovo is a partition to save Qnovo charging program's data. We don't need it on AOSP. It maybe a data or cache partition for Qnovo. Never worried about Qnovo is broken. If you use flashtool, you will find there is a opinion for Qnovo in WIPE menu, it could be erasable
Thanks for pointing out... I use Flashtool but I didn't really pay attention to that (I only paid attention to userdata in the WIPE section since it's the only thing I might need to wipe under some circumstances)...

So that partition (Qnovo) is just like userdata and cache partition and can be used for other purposes as well... Yeah, this makes it a good candidate for cache (now the original cache partition has become vendor). That's good to hear.:)

EDIT: On the other hand... is it currently possible to do a stock-based bringup using this guide, if there are available kernel source targeting stock Pie ROM?
 
Last edited:

Sjll

Recognized Developer
Jun 4, 2017
378
393
83
Chongqing
I tried to do the build for x compact but it fails with unfinded files, what branch do I have to checkout? Pie-gsi?
You should modify the device tree based on SODP 9.0. The branch you checkout should according to the guidance on Sony developer website. Check your source code. If you do right steps, there is no error.
 

LSS4181

Senior Member
Mar 13, 2012
371
110
63
Is there any detailed requirements (Compiler versions, JDK versions, etc.) about building SODP? I've attempted a few times in the past but not successful.

I'm using Manjaro Linux (Arch-based) so some compilers might be newer than expected, but I had no problems compiling a working CarbonROM 6.1 (Oreo) build (and I've done that a few times already).

1. The SODP guide suggested using OpenJDK8, but AOSP is shipping with a pre-built JDK9 which is being used in the compilation process. During compilation the java compiler printed quite a few warnings and affected parts won't work when flashing the finished image (that simply FCs). With host OpenJDK8 (by changing Java path manually to it), however, some components simply don't compile (errors).
2. AOSP also shipped with an outdated flex that required LC_ALL=C, but on my system, LC_ALL=C won't fix the build issue and can only be fixed by building my own flex binary, or cherry-picking a fixed copy from LineageOS repo. (I've mentioned it here once)
3. When compiling native codes, a lot of warnings are generated which I think did affect some components (including Java ones that depended on them).

Sorry, no detailed logs yet, though I probably have already posted some warnings I encountered during build process back then when I was attempting to build one... I'll try it again some time and put some warnings here (not all, as it's too many and the text limit per post won't allow that much).

I also suspect the now-deprecated JACK Server might have helped preventing a good amount of warnings from happening when building Oreo.
 
Last edited:

nervousapp

Member
Jul 12, 2016
32
26
18
Hi all,

I have successfully built the kernel and the rom for X compact but it doesn't boot. When I go to recovery I have the following error :

E:[libfs_mgr]dt_fstab: Failed to find type for partition vendor

When I look to the recovery logs last_kmsg I have some errors :

Missing clock-frequency property

The AUX2 clock cannot be found

msm_iommu 1f0000.qcom,iommu: invalid ressource

i2c-msm-v2 7af8000.i2c: error probe() failed with err:-517

Bus driver not ready

No such file or directory on system/etc/init , product/etc/init , odm/etc/init , vendor/etc/init

Some Command write Permission denied
 

Sjll

Recognized Developer
Jun 4, 2017
378
393
83
Chongqing
Hi all,

I have successfully built the kernel and the rom for X compact but it doesn't boot. When I go to recovery I have the following error :

E:[libfs_mgr]dt_fstab: Failed to find type for partition vendor

When I look to the recovery logs last_kmsg I have some errors :

Missing clock-frequency property

The AUX2 clock cannot be found

msm_iommu 1f0000.qcom,iommu: invalid ressource

i2c-msm-v2 7af8000.i2c: error probe() failed with err:-517

Bus driver not ready

No such file or directory on system/etc/init , product/etc/init , odm/etc/init , vendor/etc/init

Some Command write Permission denied
Campare ur device tree with mine.
https://github.com/sjllls/device-sony-loire
https://github.com/sjllls/device-sony-suzu
 
  • Like
Reactions: nervousapp

nervousapp

Member
Jul 12, 2016
32
26
18
Succesfully built for x compact !!! It works with Pie GSI roms but get stuck at sony logo with Q GSI roms .... Is there a fix to do for that ? Also how do you compile twrp for the X ?
Thanks
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone