[GUIDE][Project Treble] Manual - Create Vendor Partition for PT GSI ROM MI3/MI4

Search This thread

Dzol Cp

Senior Member
Jan 5, 2012
1,559
4,147
TB/BF Penang
PHP:
#include  
/* 
 * Your warranty is now void. 
 * 
 * I am not responsible for bricked devices
 * Do With Your Own Risk
 * If you put blamed on me?
 * I will laugh at you. 
 * YOU HAVE BEEN WARNED!
 */

Hello Guys, in order to make our Cancro successfully flash GSI Treble Rom, we need to do some of the modification to the internal memory and system space and also create a new partition for vendor image. As we all know there is bunch of guide and tutorial for system partition for MI3 and the very famous and easy is just using script to flash via recovery, and you done. So today im going to lead you to extend your system partition to 2GB, and creating new vendor partition. I tested it on MI3W 16GB and 64GB.


REQUIREMENTS


LET'S BEGIN

  1. Reboot to recovery and connect your phone to Window
  2. Open a cmd window (or terminal, if you're using linux), and connect through adb by typing;
    adb devices enter
    adb shell enter

    Code:
    adb devices
    
    adb shell
  3. If everything is fine and you get a shell input (#), start parted by typing;
    parted /dev/block/mmcblk0 enter
    print enter

    Code:
    parted /dev/block/mmcblk0
    
    print


    U9SpaR.jpg


  4. Output of "print" should be something like this


    37YIbc.jpg


  5. Remove partition 23 24 25
    rm 23 enter
    rm 24 enter
    rm 25 enter

    Code:
    rm 23
    
    rm 24
    
    rm 25


    SoqMyg.jpg


  6. If you get an error message when rm 25 like this


    8eHXDB.jpg



    • name 25 cache
    • type quit enter
    • reboot recovery on phone
    • connect to adb again
    • repeat #2 , #3 command
    • type print enter
    • type rm 25

  7. And now we are going to create 2GB system partition and vendor partition and rename it
    mkpartfs primary ext2 403 2403 enter
    mkpartfs primary ext2 2403 2453 enter
    mkpartfs primary ext2 2453 2653 enter
    mkpartfs primary ext2 2653 62.5G enter * for 64GB if * 16GB mkpartfs primary ext2 2653 15.8GB

    name 23 system enter
    name 24 cache enter
    name 25 vendor enter
    name 26 userdata enter

    Code:
    mkpartfs primary ext2 403 2403
    
    mkpartfs primary ext2 2403 2453
    
    mkpartfs primary ext2 2453 2653
    
    mkpartfs primary ext2 2653 62.5G

    Code:
    name 23 system
    
    name 24 cache
    
    name 25 vendor
    
    name 26 userdata
    
    quit


    SSIAuX.jpg


  8. After renaming and type quit and dont close the cmd and still on shell ~#


    Dd1LrY.jpg


  9. Now we are going to convert all newly partition 23 24 25 26 from ext2 to ext4
    tune2fs -j /dev/block/mmcblk0p23 enter
    e2fsck -fDp /dev/block/mmcblk0p23 enter
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p23 enter
    e2fsck -fDp /dev/block/mmcblk0p23 enter

    tune2fs -j /dev/block/mmcblk0p24 enter
    e2fsck -fDp /dev/block/mmcblk0p24 enter
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24 enter
    e2fsck -fDp /dev/block/mmcblk0p24 enter

    tune2fs -j /dev/block/mmcblk0p25 enter
    e2fsck -fDp /dev/block/mmcblk0p25 enter
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p25 enter
    e2fsck -fDp /dev/block/mmcblk0p25 enter

    tune2fs -j /dev/block/mmcblk0p26 enter
    e2fsck -fDp /dev/block/mmcblk0p26 enter
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p26 enter
    e2fsck -fDp /dev/block/mmcblk0p26 enter


    Code:
    tune2fs -j /dev/block/mmcblk0p23
    
    e2fsck -fDp /dev/block/mmcblk0p23
    
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p23
    
    e2fsck -fDp /dev/block/mmcblk0p23
    
    
    tune2fs -j /dev/block/mmcblk0p24
    
    e2fsck -fDp /dev/block/mmcblk0p24
    
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24
    
    e2fsck -fDp /dev/block/mmcblk0p24
    
    
    tune2fs -j /dev/block/mmcblk0p25
    
    e2fsck -fDp /dev/block/mmcblk0p25
    
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p25
    
    e2fsck -fDp /dev/block/mmcblk0p25
    
    
    tune2fs -j /dev/block/mmcblk0p26
    
    e2fsck -fDp /dev/block/mmcblk0p26
    
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p26
    
    e2fsck -fDp /dev/block/mmcblk0p26
    
    exit


    zVQXdK.jpg


  10. Go back to parted to check whether it's applied;
    parted /dev/block/mmcblk0 enter
    print enter

    Code:
    parted /dev/block/mmcblk0
    
    print
  11. Your partition should be like this, if you follow my calculation.


    RKlEEK.jpg


  12. Also can follow this calculation for 1.5 GB system partition.


    POCW9Z.png


  13. CONGRATS!! You have success parted your system partition, now you can disable your MI3/MI4 connection from WINDOWS.
  14. Make sure that you still on that CWM Recovery, copy MIUI 10 EU ROM to internal memory, flash it via CWM, wait till your MI3 load till startup wizard. Install MIUI 10 via CWM and reboot around 10 to 20 minutes, pls make sure that your battery is up to 50% above.
  15. Reboot to fastboot and flash TWRP Treble 3.2.3.0 and now you can easily flash GSI ROM type Arm A Only.

Now you already have a system partition 2GB and vendor partition, that enough for flashing GSI Image, Thanks for following my guide.


Reference link


Cancro ROM Group

Group rules:
  1. English only.(You can use the translator to communicate.
  2. Respect developers and administrators.
  3. Please do not send spam.
  4. Do not send stickers continuously.

Channel: @cancro ROM
CN Group: @cancro Group
https://t.me/micancro



Contributor
 

Attachments

  • photo_2018-12-14_01-02-47.jpg
    photo_2018-12-14_01-02-47.jpg
    25.2 KB · Views: 447
  • photo_2018-12-14_08-49-13.jpg
    photo_2018-12-14_08-49-13.jpg
    32.9 KB · Views: 439
  • photo_2018-12-14_08-49-16.jpg
    photo_2018-12-14_08-49-16.jpg
    116.5 KB · Views: 384
  • photo_2018-12-14_08-49-15.jpg
    photo_2018-12-14_08-49-15.jpg
    105.3 KB · Views: 368
Last edited:

Stickman89

Inactive Recognized Developer
Apr 5, 2007
1,618
2,428
Milton Keynes
@Dzol Cp - Can you issue the following commands whilst you're in 'TWRP recovery' on your 16GB Xiaomi Mi3 that has a 2GB vendor partition....

Or anyone else for that matter...

Code:
adb shell
busybox fdisk -l /dev/block/mmcblk0

I would like to see your partition layout in blocks, the above command will output that information. Paste the partition table printed out in shell here, as I need this information to create a script that will benefit us all in the future.

Thanks.

stickman89

---------- Post added at 09:17 PM ---------- Previous post was at 08:57 PM ----------

Anyone with a 64GB cancro device, if you could post your partition table resulting from the above command before and after ammending vendor to 2GB; then I can also create a script for you too. Thanks.
 
Last edited:

Dzol Cp

Senior Member
Jan 5, 2012
1,559
4,147
TB/BF Penang
@Dzol Cp - Can you issue the following commands whilst you're in 'TWRP recovery' on your 16GB Xiaomi Mi3 that has a 2GB vendor partition....

Or anyone else for that matter...

Code:
adb shell
busybox fdisk -l /dev/block/mmcblk0

I would like to see your partition layout in blocks, the above command will output that information. Paste the partition table printed out in shell here, as I need this information to create a script that will benefit us all in the future.

Thanks.

stickman89

---------- Post added at 09:17 PM ---------- Previous post was at 08:57 PM ----------

Anyone with a 64GB cancro device, if you could post your partition table resulting from the above command before and after ammending vendor to 2GB; then I can also create a script for you too. Thanks.

Alright bro, will post for you asap. Now my current system is 1.5GB and only 200MB of vendor partition, are you sure that you need all info for 2GB vendor partition,
? in that case, so i need to repartition for 2GB vendor, bc vendor image just around 170MB (lot of space wasted), just give me sometime.
 

Stickman89

Inactive Recognized Developer
Apr 5, 2007
1,618
2,428
Milton Keynes
Alright bro, will post for you asap. Now my current system is 1.5GB and only 200MB of vendor partition, are you sure that you need all info for 2GB vendor partition,
? in that case, so i need to repartition for 2GB vendor, bc vendor image just around 170MB (lot of space wasted), just give me sometime.

That's fine. The 1.5GB partition table will do. Just use the commands I mentioned above... No point modifying your partitions further, especially if you're happy with your current table. Someone else can always provide their partition table for a 2GB allocation later.

If you've done it for both your 16GB and 64GB, then if you could provide the output for both that'd be useful.

Thanks.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    PHP:
    #include  
    /* 
     * Your warranty is now void. 
     * 
     * I am not responsible for bricked devices
     * Do With Your Own Risk
     * If you put blamed on me?
     * I will laugh at you. 
     * YOU HAVE BEEN WARNED!
     */

    Hello Guys, in order to make our Cancro successfully flash GSI Treble Rom, we need to do some of the modification to the internal memory and system space and also create a new partition for vendor image. As we all know there is bunch of guide and tutorial for system partition for MI3 and the very famous and easy is just using script to flash via recovery, and you done. So today im going to lead you to extend your system partition to 2GB, and creating new vendor partition. I tested it on MI3W 16GB and 64GB.


    REQUIREMENTS


    LET'S BEGIN

    1. Reboot to recovery and connect your phone to Window
    2. Open a cmd window (or terminal, if you're using linux), and connect through adb by typing;
      adb devices enter
      adb shell enter

      Code:
      adb devices
      
      adb shell
    3. If everything is fine and you get a shell input (#), start parted by typing;
      parted /dev/block/mmcblk0 enter
      print enter

      Code:
      parted /dev/block/mmcblk0
      
      print


      U9SpaR.jpg


    4. Output of "print" should be something like this


      37YIbc.jpg


    5. Remove partition 23 24 25
      rm 23 enter
      rm 24 enter
      rm 25 enter

      Code:
      rm 23
      
      rm 24
      
      rm 25


      SoqMyg.jpg


    6. If you get an error message when rm 25 like this


      8eHXDB.jpg



      • name 25 cache
      • type quit enter
      • reboot recovery on phone
      • connect to adb again
      • repeat #2 , #3 command
      • type print enter
      • type rm 25

    7. And now we are going to create 2GB system partition and vendor partition and rename it
      mkpartfs primary ext2 403 2403 enter
      mkpartfs primary ext2 2403 2453 enter
      mkpartfs primary ext2 2453 2653 enter
      mkpartfs primary ext2 2653 62.5G enter * for 64GB if * 16GB mkpartfs primary ext2 2653 15.8GB

      name 23 system enter
      name 24 cache enter
      name 25 vendor enter
      name 26 userdata enter

      Code:
      mkpartfs primary ext2 403 2403
      
      mkpartfs primary ext2 2403 2453
      
      mkpartfs primary ext2 2453 2653
      
      mkpartfs primary ext2 2653 62.5G

      Code:
      name 23 system
      
      name 24 cache
      
      name 25 vendor
      
      name 26 userdata
      
      quit


      SSIAuX.jpg


    8. After renaming and type quit and dont close the cmd and still on shell ~#


      Dd1LrY.jpg


    9. Now we are going to convert all newly partition 23 24 25 26 from ext2 to ext4
      tune2fs -j /dev/block/mmcblk0p23 enter
      e2fsck -fDp /dev/block/mmcblk0p23 enter
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p23 enter
      e2fsck -fDp /dev/block/mmcblk0p23 enter

      tune2fs -j /dev/block/mmcblk0p24 enter
      e2fsck -fDp /dev/block/mmcblk0p24 enter
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24 enter
      e2fsck -fDp /dev/block/mmcblk0p24 enter

      tune2fs -j /dev/block/mmcblk0p25 enter
      e2fsck -fDp /dev/block/mmcblk0p25 enter
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p25 enter
      e2fsck -fDp /dev/block/mmcblk0p25 enter

      tune2fs -j /dev/block/mmcblk0p26 enter
      e2fsck -fDp /dev/block/mmcblk0p26 enter
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p26 enter
      e2fsck -fDp /dev/block/mmcblk0p26 enter


      Code:
      tune2fs -j /dev/block/mmcblk0p23
      
      e2fsck -fDp /dev/block/mmcblk0p23
      
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p23
      
      e2fsck -fDp /dev/block/mmcblk0p23
      
      
      tune2fs -j /dev/block/mmcblk0p24
      
      e2fsck -fDp /dev/block/mmcblk0p24
      
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24
      
      e2fsck -fDp /dev/block/mmcblk0p24
      
      
      tune2fs -j /dev/block/mmcblk0p25
      
      e2fsck -fDp /dev/block/mmcblk0p25
      
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p25
      
      e2fsck -fDp /dev/block/mmcblk0p25
      
      
      tune2fs -j /dev/block/mmcblk0p26
      
      e2fsck -fDp /dev/block/mmcblk0p26
      
      tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p26
      
      e2fsck -fDp /dev/block/mmcblk0p26
      
      exit


      zVQXdK.jpg


    10. Go back to parted to check whether it's applied;
      parted /dev/block/mmcblk0 enter
      print enter

      Code:
      parted /dev/block/mmcblk0
      
      print
    11. Your partition should be like this, if you follow my calculation.


      RKlEEK.jpg


    12. Also can follow this calculation for 1.5 GB system partition.


      POCW9Z.png


    13. CONGRATS!! You have success parted your system partition, now you can disable your MI3/MI4 connection from WINDOWS.
    14. Make sure that you still on that CWM Recovery, copy MIUI 10 EU ROM to internal memory, flash it via CWM, wait till your MI3 load till startup wizard. Install MIUI 10 via CWM and reboot around 10 to 20 minutes, pls make sure that your battery is up to 50% above.
    15. Reboot to fastboot and flash TWRP Treble 3.2.3.0 and now you can easily flash GSI ROM type Arm A Only.

    Now you already have a system partition 2GB and vendor partition, that enough for flashing GSI Image, Thanks for following my guide.


    Reference link


    Cancro ROM Group

    Group rules:
    1. English only.(You can use the translator to communicate.
    2. Respect developers and administrators.
    3. Please do not send spam.
    4. Do not send stickers continuously.

    Channel: @cancro ROM
    CN Group: @cancro Group
    https://t.me/micancro



    Contributor
    3
    RESERVED FOR SCREENSHOT


    2GB PARTITION

    DSqzyg.png


    1.5GB PARTITION

    LyEG3N.png

    2
    @Dzol Cp - Can you issue the following commands whilst you're in 'TWRP recovery' on your 16GB Xiaomi Mi3 that has a 2GB vendor partition....

    Or anyone else for that matter...

    Code:
    adb shell
    busybox fdisk -l /dev/block/mmcblk0

    I would like to see your partition layout in blocks, the above command will output that information. Paste the partition table printed out in shell here, as I need this information to create a script that will benefit us all in the future.

    Thanks.

    stickman89

    ---------- Post added at 09:17 PM ---------- Previous post was at 08:57 PM ----------

    Anyone with a 64GB cancro device, if you could post your partition table resulting from the above command before and after ammending vendor to 2GB; then I can also create a script for you too. Thanks.
    1
    Great Guide, but how to copy the vendor files in the new Vendor partition, how to extract them from MIUI?
    1
    May i know what's the most stable treble rom ur using rn?
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