[TOOL][7870] Universal repartition script for vendor support

Search This thread
  • Like
Reactions: Gamer4Life

Firngrod

Member
Jan 31, 2023
25
9
Hi, and thanks for this script, it's helped me a lot with my phone! However, I do have a suggestion:
At some point in time, probably when first vendorizing my phone, I have run another vendorizer partitioning script. For whatever reason, I have run it multiple times, and since that script didn't check for existing vendor partition, I have ended up with multiple vendor partitions.
This script does check for existing vendor partition, but only for ONE partition. WIth multiple vendor partitions, it bugs out and does not delete the existing partitions, just adds another one. So I would like to suggest the following changes to the repartition.sh script:
Diff:
36c36
< VENDOR=`$SGDISK --print $DISK | grep VENDOR | awk '{printf $1}'`
---
> VENDOR=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
53,54c55,56
<     if [ ! -z $VENDOR ]; then   
<         VENDORPART=`$SGDISK --print $DISK | grep VENDOR | awk '{printf $1}'`
---
>     while [ ! -z $VENDOR ]; do   
>         VENDORPART=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
56c58,59
<     fi
---
>     VENDOR=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
>     done
 

Firngrod

Member
Jan 31, 2023
25
9
Did you test your script? Then I would suggest to upload the new file as @Astrako is not active here. (Your usecase might be also solved with the newer repartition script from Astrako)
Yes, I have tested this, it's how I got rid of my duplicate vendor partitions.

The post you link to is older that this one, so this appears to be the newer version. I just took a look at the code of that one. It is much simpler and will just add a vendor partition if none exists, whereas the one from this post will create vendor if it doesn't exist, and resize if it does. I could upload a version with my changes, it might help some people. I'll see about it when I get time.
 
  • Like
Reactions: Hanululu

Hanululu

Member
Sep 2, 2019
17
1
I could upload a version with my changes, it might help some people. I'll see about it when I get time.
Just something to be aware of: For me the script didnt reduce the size of the vendor partition.

I was using the script from this thread with slightly different values
SYSTEMSIZE=2500
VENDORSIZE=160
CACHESIZE=32
ODMSIZE=16 # New ODM partition size for those devices having it. Mod this value at your own risk

(Original are 4096, 512, 64, 128.
As is used in the flashing process several scripts, i can't tell, if this or the older one created the vendor partition, But when trying to shrink i made sure the partitions were all mountable and with size of non-zero)
 

Firngrod

Member
Jan 31, 2023
25
9
Just something to be aware of: For me the script didnt reduce the size of the vendor partition.

I was using the script from this thread with slightly different values
SYSTEMSIZE=2500
VENDORSIZE=160
CACHESIZE=32
ODMSIZE=16 # New ODM partition size for those devices having it. Mod this value at your own risk

(Original are 4096, 512, 64, 128.
As is used in the flashing process several scripts, i can't tell, if this or the older one created the vendor partition, But when trying to shrink i made sure the partitions were all mountable and with size of non-zero)
The script with or without my changes? I'm asking because a lack of ability to change the vendor partition size was my symptom from having multiple vendor partitions. The recovery tool only saw the first partition which was never changed, and every run I just added a new partition which ate more and more of my usable space. You could check this by booting to recovery, opening a terminal (Under advanced in TWRP) and typing
Bash:
sgdisk --print --pretend /dev/block/mmcblk0
There should be 24 partitions, with number 20 being the VENDOR partition.

Your recovery may use a different partitioner than sgdisk. Mileage may vary. As long as you --pretend and only ever --print anyway, no harm should come to your device.
EDIT: I have 24 partitions, you might have more or less, I don't know. There should only be one VENDOR though.
EDIT2: The device might also be placed differently in the file system on your device/bootloader. You should be able to locate it by running something like df and looking at the output.
 
Last edited:
  • Wow
Reactions: Hanululu

Firngrod

Member
Jan 31, 2023
25
9
Well, i didn't use your addition. And I have 4 vendor partitions... thanks...
Hey, that's not too bad. I had 19 or something.
Well, from our talks here, my impression is that you should be capable of updating the script with the changes from my diff. Basically, when looking for the partition, we only register the first one matching, and when deleting it in order to remake it, we keep deleting the first partition called VENDOR until there are no more.
Let me know how it goes. I will probably upload a patched version tonight when I'm off from work and the kids are asleep.
 
  • Like
Reactions: Hanululu

Tahir Jamil

Member
May 8, 2021
41
6
Hi I have Samsung m20 but its system partition size is 3.4 gb 😐😐 and this zip also doesn't work on my device please someone can help? I need 4 GB system
 
  • Angry
Reactions: Hanululu

Hanululu

Member
Sep 2, 2019
17
1
Hi I have Samsung m20 but its system partition size is 3.4 gb 😐😐 and this zip also doesn't work on my device please someone can help? I need 4 GB system
Please be clear about what you mean by "doesn't work" - it should not work as the main post says: "Supported devices" - your device is not included. Add screenshots and error messages. Do you have a custom recovery installed? If not, start with that and check the forum for your device: https://forum.xda-developers.com/c/samsung-galaxy-m20.8714/
 

Hanululu

Member
Sep 2, 2019
17
1
I will probably upload a patched version tonight when I'm off from work and the kids are asleep.
Deleting worked, and shrinking too, thanks. Here the script I used first (and later one with smaller sizes for shrinking). Yeah, nice!!
 

Attachments

  • fixed-universal7870_repartitioner_V1.0.zip
    553.3 KB · Views: 56

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    UNIVERSAL REPARTITION SCRIPT FOR THE 7870

    DISCLAIMER
    • I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed. Please do some research if you have any concerns about features included in this ROM before flashing it! YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
    • Flashing this script will delete system, vendor, cache and data partitions (including internal storage) so make a good backup first!

    FEATURES
    • Supported devices: A3 2017, A6 2018, J6 2018, J5 2017, J7 2016, J7 2017, J7 Nxt and J7 Prime
    • It can be flashed being in stock or modded partitions
    • It will set 4096Mb for SYSTEM, 512Mb for VENDOR, 64Mb for CACHE and 128Mb for ODM in devices that support it. You can mod these values in repartition.sh script, and set the values you want.
    • CAUTION: FLASHING IT WILL DELETE SYSTEM, VENDOR, CACHE AND ALSO DATA PARTITION, so internal storage will be wiped too!
    • To revert, best way is to flash your device PIT file in ODIN
    • Remember: FLASH AT YOUR OWN RISK!

    INSTRUCTIONS
    • Remember, your internal storage will be wiped flashing this!
    • Highly recommended to use an updated recovery
    • Flash the attached zip file. The script itself will reboot the phone in recovery once done
    • Now in recovery again, wipe system, cache and vendor and format data
    • That's all!

    SUPPORT

    CREDITS
    18
    How to set different partition sizes?

    Open universal7870_repartitioner_V1.0.zip, and extract repartition.sh file. Then open it with a text editor and locate these lines:

    SYSTEMSIZE=4096
    VENDORSIZE=512
    CACHESIZE=64

    If you wan to change, for example, SYSTEM partition size, then mod SYSTEMSIZE and set a value in Mb. If you want 2gb, then put SYSTEMSIZE=2048

    Once modded, add again repartition.sh to universal7870_repartitioner_V1.0.zip and flash it in recovery. Remember that every time you flash it, your internal stogare will be deleted.
    6
    I am seeing butter s20 experience now!!!!!!!

    UNIVERSAL REPARTITION SCRIPT FOR THE 7870

    DISCLAIMER
    • I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed. Please do some research if you have any concerns about features included in this ROM before flashing it! YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
    • Flashing this script will delete system, vendor, cache and partitions (including internal storage) so make a good backup first!

    FEATURES
    • Supported devices: A3 2017, A6 2018, J6 2018, J5 2017, J7 2016, J7 2017, J7 Nxt and J7 Prime
    • It can be flashed being in stock or modded partitions
    • It will set 4096Mb for SYSTEM, 512Mb for VENDOR, 64Mb for CACHE and 128Mb for ODM in devices that support it. You can mod these values in repartition.sh script, and set the values you want.
    • CAUTION: FLASHING IT WILL DELETE SYSTEM, VENDOR, CACHE AND ALSO DATA PARTITION, so internal storage will be wiped too!
    • To revert, best way is to flash your device PIT file in ODIN
    • Remember: FLASH AT YOUR OWN RISK!

    INSTRUCTIONS
    • Remember, your internal storage will be wiped flashing this!
    • Highly recommended to use an updated recovery
    • Flash the attached zip file. The script itself will reboot the phone in recovery once done
    • Now in recovery again, wipe system, cache and vendor and format data
    • That's all!

    SUPPORT

    CREDITS
    • @Davinash97 for ideas and tips




    KEEP IT SAR, YOU'RE THE GUARDIAN ANGEL OF EXYNOS 7870:cool:
    3
    Hi, and thanks for this script, it's helped me a lot with my phone! However, I do have a suggestion:
    At some point in time, probably when first vendorizing my phone, I have run another vendorizer partitioning script. For whatever reason, I have run it multiple times, and since that script didn't check for existing vendor partition, I have ended up with multiple vendor partitions.
    This script does check for existing vendor partition, but only for ONE partition. WIth multiple vendor partitions, it bugs out and does not delete the existing partitions, just adds another one. So I would like to suggest the following changes to the repartition.sh script:
    Diff:
    36c36
    < VENDOR=`$SGDISK --print $DISK | grep VENDOR | awk '{printf $1}'`
    ---
    > VENDOR=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
    53,54c55,56
    <     if [ ! -z $VENDOR ]; then   
    <         VENDORPART=`$SGDISK --print $DISK | grep VENDOR | awk '{printf $1}'`
    ---
    >     while [ ! -z $VENDOR ]; do   
    >         VENDORPART=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
    56c58,59
    <     fi
    ---
    >     VENDOR=`$SGDISK --print $DISK | grep VENDOR | head -1 | awk '{printf $1}'`
    >     done
    2
    can i use this on samsung j7 pro j730GM variant ? plz reply