[TOOL][TREBLE] PARTY v0.5 - Vendor Partition Manager 2018.08.31

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
- P A R T Y -
Android Partition Treblerizer

A tool able to seamlessly create / remove the vendor partition from within TWRP

INTRODUCTION

This was my weekend project. The creation of a tool able to create and remove the vendor partition from TWRP, so a computer was not required. The idea came to me las weekend when I was travelling and I couldn't test some roms since I didn't had the right partition configuration and no computer on hand. So I created this TWRP flashable ZIP that can create and remove the Vendor partition from the system or userdata partitions without a computer and without wiping the files in the mother partition in the recommended configuration.

The tool will try to resize the mother partition without wiping it, both when creating and removing the vendor partition. Nonetheless it can be done only when the mother partition is ext4, only when the vendor partition is at the end of the mother partition, and when the mother partition is not encrypted. The recommended configuration is what you get when selecting the first choice in every option: splitting 512 MB from the end of the system partition. A reboot is required after patching the partition table since the kernel has to reload it before doing any other thing.

REQUIREMENTS

Due to the use of a key detection binary, it is compatible only with ARM and ARM64 devices running TWRP. So far I have tested it in the Axon 7 but It should work in any compatible device. I made it this way so other legacy devices could transition to Treble ROMs + GSI, and Android Pie. Please let me know about other devices using this tool!!!!!

INSTALLATION

WARNING, THIS SOFTWARE COULD WIPE ALL THE DATA IN YOUR DEVICE, INCLUDING THE INTERNAL STORAGE.
IT REQUIRES TWRP CUSTOM RECOVERY IN AN UNLOCKED DEVICE, OTHERWISE YOUR DEVICE COULD BE BRICKED.
!!! Whatever you do, it is at your own risk !!!

Either for creating or removing a vendor partition,, follow these steps:

1. Download the TWRP ZIP tool to your External SD card.
2. Boot to TWRP recovery, under Install, flash the ZIP file as any other ROM or MOD file to execute the tool.
3. Reboot to recovery again to ensure the changes are applied properly.
4. In some cases you will need to format the mother partition after adding or removing the vendor partition next to it.

CREATE A VENDOR PARTITION:

So far these are the available options:
  • Mother partition selection: system / userdata
  • Split position: Splitting from the end / start of the mother partition.
  • Vendor partition size: 512 / 800 MB

REMOVE THE VENDOR PARTITION:

Should a Vendor module already exists, Party offers to remove it, returning to a Non-Treble partition table. It will return the space to the mother partition, system or userdata. So, older non Treble ROMs could be flashed after the mandatory reboot.


DOWNLOAD

Party_v0.5_ARM_20180831.zip


SOURCES
C'mon, it is a script!!! the sources are inside the zip. Use them in your projects but don't forget to give credit to the source !!!

CREDITS
@someone755 for the keycheck binary
@Zackptg5 for the V4A install script that inspired my version.
 
Last edited:

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
Just in case you want to use this tool for preparing the partition table for flashing some common sets of ROMs:

The The first Treble ROMs made by NFound splits 800MB of Vendor partition from the beginning of the data partition. You can do it using a Computer and flashing the EDL package or you can use this tool from TWRP.

The Unofficial LOS 15.1 20180810 splits 512MB of vendor partition from the end of the system partition. The new Unofficial LOS 16.0 ROMs requires a vendor partition using this scheme. The benefit of this configuration is that the user data is not formatted or modified and system partition is resized without losing any data.

In case you want to return to a previous non-treble rom, you just need to run this tool from TWRP and seamlessly remove the vendor partition.
 
Last edited:

christoophat

Senior Member
May 20, 2011
1,214
377
83
SoCal
Thanks yet again oki, for all the great tools you bring us for our phones.
Question: If you were to choose, which vendor part version would you recommend people create to prepare for upcoming Treble releases, the 800 MB or the 512 version?
Also , since I & others already have the NFound method installed, is there a need/benefit to convert over to the other one?
 
  • Like
Reactions: SilentEYE

amphi66

Senior Member
Dec 17, 2010
1,022
320
113
PacNW
Thanks, this is great!
Not mentioned in your Procedure: are there any prerequistes, such as having a specific ROM, TWRP, bootloader, or ??? already installed?

Can this be run from B35 Stock to then be 'Treble Ready'?
 

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
Thanks yet again oki, for all the great tools you bring us for our phones.
Question: If you were to choose, which vendor part version would you recommend people create to prepare for upcoming Treble releases, the 800 MB or the 512 version?
Also , since I & others already have the NFound method installed, is there a need/benefit to convert over to the other one?
The best configuration is splitting 512MB (more than enough) from the end of the system partition. That leaves 5.5GB for system, when usually it doesn't even reach 2GB. a 3GB system partition is considered large nowadays. 5.5GB is still overkill. I have even thought in creating a Treble A/B partitioning for seamless update. But let's first stabilize Treble A before thinking in more advanced configurations.
Thanks, this is great!
Not mentioned in your Procedure: are there any prerequistes, such as having a specific ROM, TWRP, bootloader, or ??? already installed?

Can this be run from B35 Stock to then be 'Treble Ready'?
The only prerequisite for this tool is having TWRP. It actually can be used in any legacy ARM device, not only the Axon 7, to create the vendor partition from system or data.

You can run it with any bootstack, even the old Nougat or MM bootstacks. The tool is bootstack agnostic. However, there is no point on having a vendor partition with a ROM requiring an old Nougat or MM bootstack, since they don't use it. Treble ROMs are all compiled using the Oreo B12 bootstack, and they won't boot with any other bootstack. This tool only prepares the partition table, the bootstack is another thing you must prepare before flashing any ROM.
 

Gachmuret

Senior Member
Jul 19, 2009
305
113
0
Hi @Oki
Thanks for your handful tool!

It states that it has found vendor partition before data partition (I had it installed with NFounds method)...

My question: Will deleting this vendor partition using your tool leave data as is or will it wipe the whole internal storage also?
 

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
Hi @Oki
Thanks for your handful tool!

It states that it has found vendor partition before data partition (I had it installed with NFounds method)...

My question: Will deleting this vendor partition using your tool leave data as is or will it wipe the whole internal storage also?
It will wipe data and internal storage since the split was done at the beginning of the userdata partition so it was easier to flash using the EDL method both in the 64 and 128GB Axon 7. Now with this tool there is no reason at all for splitting from the data partition. Those with the initial 800MB split will have to backup data and storage to recover those 800MB and transition to the 512MB vendor partition at the end of the system partition. I already did it so now I can go back and forth seamlessly without losing the internal storage.
 

roisuke

Member
Mar 13, 2016
34
20
0
Hello Oki, I'm planning on following the steps below to install the treblerized August build of los 15.1 and was wondering if your tool would make the process any easier or would it even be necessary? I'm currently on the non treble 7/23 build of 15.1. Also thanks for all your contributions to the Axon 7 community! :p

Coming from the July LOS builds, install of the 8/10 build was simple and no impact to my data:

1. Install TWRP 3.2.1-8-TREBLE (for decrypting data) or 3.2.3-0-axon7. Reboot.
2. Wipe system/cache/dalvik cache (and data if not using LOS).
3. Install 8/10 LOS build. This will partition Treble if it does not exist, otherwise I think it'll update it.
4. Install GApps.
5. (optional) Install Magisk 16.7 (SafetyNet fails, but I don't seem to have any issues otherwise).
6. Boot into ROM.

My most frustrating issue is the one I mentioned above, but I have yet to try anything other these LOS builds so far.
 

Masterjuggler

Senior Member
Dec 3, 2013
246
228
0
New Jersey
First, thanks Oki! This is a great addition to our tool set, and will make life much easier going back to stock.

I've been following the LOS threads and have been trying to keep up, so if these questions have been answered already please just point me in the right direction. There's a lot of information all over the place, and it's difficult to search for without already having a working understanding of it.

Now that we have a simple method of adding a vendor partition (acknowledging LOS having an already integrated treblerizer, but no return), are we now able to reliably flash standard GSIs? If not, what exactly is needed to make our phone compatible with standard GSIs?

The kernel still goes into the /boot, which would still be device-specific, so the way I understand it is that we still need the other device-specific stuff like DAC configs, which would then go into the /vendor? I take it this means the HALs (if that's what I'm talking about) are at a level above bootstack but below kernel?

If we were to go flashing GSIs now, would a lot of crap just be broken, or would it pretty much work save for the DAC? If broken, could we get it to just default to the SD820 integrated DAC? Are we (the xda community, developers, users, etc) able to make HALs that would accomplish getting audio to work properly in either case, or is this something that must be included in the ROM or kernel rather than /vendor?

If there is any interest, an FAQ on this might be a good idea, if one doesn't currently exist. We'd just need someone to maintain it. I'd be happy to do so, but obviously I'm currently terribly confused LOL, and definitely need to do a lot of required reading on this.
 

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
Hello Oki, I'm planning on following the steps below to install the treblerized August build of los 15.1 and was wondering if your tool would make the process any easier or would it even be necessary? I'm currently on the non treble 7/23 build of 15.1. Also thanks for all your contributions to the Axon 7 community! :p
LOS15.1 20180810 already creates the vendor partition, so no need for my tool for creating it. It is already an easy process when coming from a non-treble LOS15.1. In case you prefer to go back to the previous non-treble rom, then you will need PARTY. PARTY is also required to transition from the old 800MB vendor to the new location at the end of the system partition.
Now that we have a simple method of adding a vendor partition (acknowledging LOS having an already integrated treblerizer, but no return), are we now able to reliably flash standard GSIs? If not, what exactly is needed to make our phone compatible with standard GSIs?

The kernel still goes into the /boot, which would still be device-specific, so the way I understand it is that we still need the other device-specific stuff like DAC configs, which would then go into the /vendor? I take it this means the HALs (if that's what I'm talking about) are at a level above bootstack but below kernel?
All the hardware specific drivers are in the Kernel, but the configuration files and libraries are in the vendor partition in a treble rom. GSI use the available libraries, but they must ask for those entry points. So if a Vendor partition doesn't provide the GSI with the standard entry points along with the configs, then the specific hardware won't work. In our case the DAC is critical since most of us purchased the Axon 7 instead of the OP3 just because of the amazing sound of this device. The Vendor partition is the key, but it all depends on the device tree and ported vendor blobs.
If we were to go flashing GSIs now, would a lot of crap just be broken, or would it pretty much work save for the DAC? If broken, could we get it to just default to the SD820 integrated DAC? Are we (the xda community, developers, users, etc) able to make HALs that would accomplish getting audio to work properly in either case, or is this something that must be included in the ROM or kernel rather than /vendor?
Probably the future will be a Treble ROM for the Axon supporting the standard Qualcomm devices and some kind of patches for the GSI so we could enjoy the excellent DAC. The best would be if ZTE release an Android Pie update for us the same way it is going to happen for the OP3.
If there is any interest, an FAQ on this might be a good idea, if one doesn't currently exist. We'd just need someone to maintain it. I'd be happy to do so, but obviously I'm currently terribly confused LOL, and definitely need to do a lot of required reading on this.
You are very welcome to create answers or gather the answers in a central FAQ.

I have created this tool so the Treblerization of legacy devices could be easier and the Axon 7 could benefit of it too. This device has an amazing hardware configuration, the only problem is the software. It all depends on ZTE and the user base.
 
Last edited:

Masterjuggler

Senior Member
Dec 3, 2013
246
228
0
New Jersey
So other than the DAC config, is there anything else broken or preventing us from flashing GSIs? Put another way, what else would we need to port/create for /vendor in order to properly run a GSI? I'm sure if we create a vendor partition and just flash a GSI, /vendor will still be empty and useless until we do something with it.

Also, for anyone who cares about semantics, I am saying "we" because I would at some point like to learn more and also contribute to these projects. I don't have much time for the foreseeable future due to college starting again, but we have to remember it's not like developers are a certain breed that do nothing but unpaid work for us. It's everyone's responsibility to keep development alive.
 
  • Like
Reactions: jimhark and Orasion

Predatorhaze

Senior Member
Feb 18, 2016
1,191
208
0
Gelderland
So i flash this in twrp and can delete vendor partition?

---------- Post added at 06:44 AM ---------- Previous post was at 06:38 AM ----------

Well,after i flashed this... vendor is still here and twrp is unable to mount vendor...what to do now?
 

samo_lego

Member
Feb 19, 2018
47
12
0
Hi!

Of course you deserve the THANKS word, so I would start with that ... :p

My question is; I am running the treblerized version of AEX 5.8, provided by NFound, so my vendor partition is 800 mb one. Is it recommended to flash the PARTY to make it smaller (512 mb) or is this one just good enough?

Thanks.
 
  • Like
Reactions: Choobilsky

RedWave31

Senior Member
May 9, 2007
646
270
93
Is there ANY way this could be used to reduce the system partition to 2GB or 2.5GB like stated in another comment? And kill other ones?
- BT_Firmware : 1GB wasted
- Cache : 750mb wasted
- dev : 2GB wasted
- system : 4GB wasted
> 8GB that I can barely use, or that I should paste into, using root programs...

Thanks!
 

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
So i flash this in twrp and can delete vendor partition?

---------- Post added at 06:44 AM ---------- Previous post was at 06:38 AM ----------

Well,after i flashed this... vendor is still here and twrp is unable to mount vendor...what to do now?
I should have been removed. Could you please run PARTY and at the end do not reboot, open the terminal and type:
Code:
cp /tmp/Party.log /sdcard/
Then boot to system and share or send to me the Party.log file that should be in the internal storage so I could see what happened.

Thanks
Hi!

Of course you deserve the THANKS word, so I would start with that ... :p

My question is; I am running the treblerized version of AEX 5.8, provided by NFound, so my vendor partition is 800 mb one. Is it recommended to flash the PARTY to make it smaller (512 mb) or is this one just good enough?

Thanks.
800 is good to go, there is no need to recover that space unless you need those 800MB returned to your internal storage.

Dear @Oki, can i use this on any device? say i have an old xperia z ultra (togari) and i wanna trebelize it..
It should work. But creating the vendor partition is just one step. Be aware that the developers should do the hard work of splitting the ROM files and configuration from a single system image to a vendor and a system image, along with the changes in the kernel of the rom.

Is there ANY way this could be used to reduce the system partition to 2GB or 2.5GB like stated in another comment? And kill other ones?
- BT_Firmware : 1GB wasted
- Cache : 750mb wasted
- dev : 2GB wasted
- system : 4GB wasted
> 8GB that I can barely use, or that I should paste into, using root programs...

Thanks!
  • BT_firmware is only 1MB, not 1GB
  • Cache is in the same disk than data so it can be added to the main storage with some backup and repartitioning. We can recreate another cache partition from the system partition.
  • Not sure what partition are you referring to as "dev". Devinfo is only 4KB and Devcfg is 128KB.
So far the only partitions we can use to increase the storage userdata partition are in the /dev/block/sda disk. This is the stock partition table:
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1               6               7   8.0 KiB     FFFF  ssd
   2               8          204807   800.0 MiB   FFFF  cache
   3          204808          205063   1024.0 KiB  FFFF  misc
   4          205064          205191   512.0 KiB   FFFF  keystore
   5          205192          205223   128.0 KiB   FFFF  devcfg
   6          205224          205255   128.0 KiB   FFFF  fbop
   7          205256          205383   512.0 KiB   FFFF  frp
   8          205384          205511   512.0 KiB   FFFF  cryptkey
   9          205512        13944826   52.4 GiB    8300  userdata
As you can see only cache is there with enough space to consider it. The System disk is another interesting partition since the Treble A/B could be possible with some work:
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1               6             133   512.0 KiB   FFFF  rpm
   2             134             645   2.0 MiB     FFFF  tz
   3             646             773   512.0 KiB   FFFF  hyp
   4             774            1285   2.0 MiB     FFFF  fsg
   5            1286            1289   16.0 KiB    FFFF  sec
   6            1290            1417   512.0 KiB   FFFF  pmic
   7            1418           25737   95.0 MiB    0700  modem
   8           25738           29833   16.0 MiB    FFFF  dsp
   9           29834           30089   1024.0 KiB  FFFF  dip
  10           30090           38281   32.0 MiB    FFFF  mdtp
  11           38282           38537   1024.0 KiB  FFFF  aboot
  12           38538           54921   64.0 MiB    FFFF  boot
  13           54922         1627785   6.0 GiB     8300  system
  14         1627786         1644169   64.0 MiB    FFFF  recovery
  15         1644170         1644170   4.0 KiB     FFFF  devinfo
  16         1644171         1644426   1024.0 KiB  FFFF  bluetooth
  17         1644427         1644458   128.0 KiB   FFFF  lksecapp
  18         1644459         1644522   256.0 KiB   FFFF  keymaster
  19         1644523         1644586   256.0 KiB   FFFF  cmnlib
  20         1644587         1644650   256.0 KiB   FFFF  cmnlib64
  21         1644651         1644714   256.0 KiB   FFFF  apdp
  22         1644715         1644778   256.0 KiB   FFFF  msadp
  23         1644779         1644779   4.0 KiB     FFFF  dpo
  24         1644780         1653135   32.6 MiB    FFFF  splash
  25         1653136         1663375   40.0 MiB    FFFF  echarge
  26         1663376         1663887   2.0 MiB     FFFF  sti
  27         1663888         1663994   428.0 KiB   FFFF  last_parti
We have a total of 6.5GB in the /dev/block/sde disk that could be repartitioned to handle the Treble A/B configuration for seamless update in our Axon 7.
 
Last edited:

RedWave31

Senior Member
May 9, 2007
646
270
93
BT_firmware is only 1MB, not 1GB
Cache is in the same disk than data so it can be added to the main storage with some backup and repartitioning. We can recreate another cache partition from the system partition.
Not sure what partition are you referring to. Devinfo is only 4KB and Devcfg is 128KB.
This might be coming from an A2017 or A2017U. This is what appears on a A2017G:

Here is what I see using a root file explorer:


It doesnt seems to be SYMLINKS, since I only have a 52GB DATA partition, which would account for those 8GB missing + 2-4GB of system and a bit more.

Is there any way I could use the tool to modify partitions, or is that in ROMs as well?
- I know that If I go this route, I'll probably have to modify ZIP files for the rest of the device lifetime, but I'm ok with this...
- At the time of the Galaxy S2 (i9100) and HP Touchpad, we ended up removing the partition size files in ROMs and getting much, much more space.
 
Last edited:

Predatorhaze

Senior Member
Feb 18, 2016
1,191
208
0
Gelderland
i did a stock restore trough EDL miflash.But i used party zip when i had gsi firmware installed on system,and i did use remove vendor option,i think that was a problem..i had to full clean phone first i think
 

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
This might be coming from an A2017 or A2017U. This is what appears on a A2017G:

It doesnt seems to be SYMLINKS, since I only have a 52GB DATA partition, which would account for those 8GB missing + 2-4GB of system and a bit more.

Is there any way I could use the tool to modify partitions, or is that in ROMs as well?
- I know that If I go this route, I'll probably have to modify ZIP files for the rest of the device lifetime, but I'm ok with this...
- At the time of the Galaxy S2 (i9100) and HP Touchpad, we ended up removing the partition size files in ROMs and getting much, much more space.
The system reports logical sizes. A partition can appear to the system with a virtual size, the same way a VHD drive can have virtually 200TB when the image file is only 100MB in size, or compressed drivers storing virtually more space than the physical available space. The physical 1MB BT partition holds a vfat filesystem that wraps a 72MB firmware image (3 files) in a virtual 1GB partition. But the filesystem image is only 1MB.
dev is the device mount, it is a region in memory for communicating with the kernel through the fsnodes.
The other entries are mount points, some of them virtual or not corresponding to a physical partition.
Bottom line, that app provides you not with the physical partitioning of the device, but with a list of logical mount points and logical/virtual sizes.
 
Last edited:

Oki

Senior Member
Jul 6, 2006
1,009
1,858
0
East Coast
i did a stock restore trough EDL miflash.But i used party zip when i had gsi firmware installed on system,and i did use remove vendor option,i think that was a problem..i had to full clean phone first i think
No, it should work in any case. Please provide me with the log file so I could figure out what you have and why it didn't worked for you. It will also helps others. I am suspecting you could have 2 vendor partitions in two different disks, so when you remove one, the software will still detect the other one in the next run. This is just an hypothesis I would like to clarify. Since you already flashed an EDL package on top, then there is no way to see it now.

Please, if you or someone else encounter this situation, please let me know.
 
Last edited:
  • Like
Reactions: Predatorhaze