[Meizu Pro 5 Guides, News, & Discussion] sHR00m:
Ubuntu Touch is a fascinating android-alternative and still under active community development. Meizu Pro 5 was (and still is) one of its flagships. The current RC branch however requires a bigger system partition.

16.04 Stable can be installed on the stock partition but RC can not.

This tutorial assumes that you have a version of Ubuntu Touch already installed (for example via this TWRP backup image). It will not work like this without that.

I used 16.04/Stable. I am mentioning how to back up your userdata but this tutorial will by no means fully restore your old system! Also I am not responsible for any possible errors or data loss!

Alright, lets get started.

Download the ubuntu recovery image here:

We need that later. Put it on your external sd.

We next need to flash TWRP, from here:

This should work over fastboot:

# fastboot flash recovery TWRP_3.0_m86_patched_st0rm77.img
# fastboot reboot

However, in my case the phone didn't want to make contact. I am not sure if this was an error on my end or a bug in Ubuntu Touch.

You can alternatively boot into (ubuntu) recovery annd open an adb shell from your computer:

adb shell

Then type:

DEV=$(ls /dev/block/platform/*/by-name/recovery); echo $DEV

Upload TWRP to your device via adb, by executing from your computer:

adb push TWRP_3.0_m86_patched_st0rm77.img .

Then flash the recovery using dd:

dd of=$DEV if=/TWRP_3.0_m86_patched_st0rm77.img

Boot into TWRP recovery.

*Optional: Make now a backup of your userdata on your *external* SD.

Next open an adb shell from your computer:

adb shell

/external_sd # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1899196 24 1899172 0% /dev
tmpfs 1899196 56 1899140 0% /tmp
/dev/block/sda43 507848 28872 468492 6% /cache
/dev/block/sda44 56111432 3905764 52189284 7% /data
/dev/block/sda44 56111432 3905764 52189284 7% /sdcard
/dev/block/mmcblk0p1 7798784 7798784 0 100% /external_sd

Unmount the /dev/block/sda partitions:

/external_sd # umount /data
/external_sd # umount /sdcard
/external_sd # umount /cache

Create an image of your current system and put it on your external sd:

~ # dd if=/dev/block/sda41 of=/external_sd/system.img
5242880+0 records in
5242880+0 records out
2684354560 bytes (2.5GB) copied, 542.923623 seconds, 4.7MB/s

And the same of custom.img:

~ # dd if=/dev/block/sda42 of=/external_sd/custom.img
1048576+0 records in
1048576+0 records out
536870912 bytes (512.0MB) copied, 138.687865 seconds, 3.7MB/s

Then we mount said system image:

~ # mount /external_sd/system.img /system/ -o loop

As well as these:

~ # mount -t proc proc /system/proc
~ # mount -t sysfs sys /system/sys
~ # mount -o bind /dev /system/dev

And chroot into your current ubuntu touch environment:

~ # chroot /system/ /bin/bash
bash: groups: command not found
bash: lesspipe: command not found
bash: dircolors: command not found

Then we make sure we actually use the fdisk from util-linux and not that of busybox:

root@localhost:/# fdisk -V
fdisk from util-linux 2.27.1

And fire it up:

root@localhost:/# fdisk /dev/block/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).
GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).

Check the current table:

Command (m for help):

p

The relevant partitions:

Device Start End Sectors Size Type	code	Name
dev/block/sda41 65536 720895 655360 2.5G Microsoft basic data	0700	system
dev/block/sda42 720896 851967 131072 512M Microsoft basic data	0700	custom
dev/block/sda43 851968 983039 131072 512M Microsoft basic data	0700	cache
dev/block/sda44 983040 15267834 14284795 54.5G Microsoft basic data	0700	userdata

We now just delete them:

Command (m for help): d
Partition number (1-3,21-33,41-44, default 44): 41

Partition 41 has been deleted.

Command (m for help): d
Partition number (1-3,21-33,42-44, default 44): 42

Partition 42 has been deleted.

Command (m for help): d
Partition number (1-3,21-33,43,44, default 44): 43

Partition 43 has been deleted

Command (m for help): d
Partition number (1-3,21-33,44, default 44): 44

Partition 44 has been deleted.

And recreate them:

Command (m for help): n
Partition number (4-20,34-128, default 4): 41
First sector (6-15267834, default 55808): 65536
Last sector, +sectors or +size{K,M,G,T,P} (65536-15267834, default 15267834): 1638399

Created a new partition 41 of type 'Linux filesystem' and of size 6 GiB.

Command (m for help): n
Partition number (4-20,34-40,42-128, default 4): 42
First sector (6-15267834, default 1638400): 1638400
Last sector, +sectors or +size{K,M,G,T,P} (1638400-15267834, default 15267834): 1769471

Created a new partition 42 of type 'Linux filesystem' and of size 512 MiB.

Command (m for help): n
Partition number (4-20,34-40,43-128, default 4): 43
First sector (6-15267834, default 1769472): 1769472
Last sector, +sectors or +size{K,M,G,T,P} (1769472-15267834, default 15267834): 2293775

Created a new partition 43 of type 'Linux filesystem' and of size 2 GiB.

Command (m for help): n
Partition number (4-20,34-40,44-128, default 4): 44
First sector (6-15267834, default 2294016): 2293776
Last sector, +sectors or +size{K,M,G,T,P} (2293776-15267834, default 15267834): 15267824

Created a new partition 44 of type 'Linux filesystem' and of size 49.5 GiB.

The table should look exactly like this:

Command (m for help): p
Disk /dev/block/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: 00042021-0408-4601-9DCC-A8C51255994F

Device Start End Sectors Size Type
/dev/block/sda1 1024 1279 256 1M Microsoft basic data
/dev/block/sda2 1280 1343 64 256K Microsoft basic data
/dev/block/sda3 1344 1407 64 256K Microsoft basic data
/dev/block/sda21 2048 3071 1024 4M Microsoft basic data
/dev/block/sda22 3072 5119 2048 8M Microsoft basic data
/dev/block/sda23 5120 5631 512 2M Microsoft basic data
/dev/block/sda24 5632 6655 1024 4M Microsoft basic data
/dev/block/sda25 6656 7679 1024 4M Microsoft basic data
/dev/block/sda26 7680 13823 6144 24M Microsoft basic data
/dev/block/sda27 13824 22015 8192 32M Microsoft basic data
/dev/block/sda28 22016 30207 8192 32M Microsoft basic data
/dev/block/sda29 30208 35327 5120 20M Microsoft basic data
/dev/block/sda30 35328 40447 5120 20M Microsoft basic data
/dev/block/sda31 40448 45567 5120 20M Microsoft basic data
/dev/block/sda32 45568 50687 5120 20M Microsoft basic data
/dev/block/sda33 50688 55807 5120 20M Microsoft basic data
/dev/block/sda41 65536 1638399 1572864 6G Linux filesystem
/dev/block/sda42 1638400 1769471 131072 512M Linux filesystem
/dev/block/sda43 1769472 2293775 524304 2G Linux filesystem
/dev/block/sda44 2293776 15267824 12974049 49.5G Linux filesystem

Next we change the partition type to "Microsoft basic data":

Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 41

Partition type (type L to list all types):L

....

11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

The exact number can vary between versions!

Partition type (type L to list all types): 11

Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.

Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 42
Partition type (type L to list all types): 11

Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.

Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 43
Partition type (type L to list all types): 11

Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.

Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 44
Partition type (type L to list all types): 11

Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.

Check again with "p", if the types are correct.

Make sure there are no errors:

Command (m for help): v
No errors detected.
Header version: 1.0
Using 20 out of 128 partitions.
A total of 11396 free sectors is available in 4 segments (the largest is 38 MiB).

Now we add the partition names. For that we first change to expert mode:

Command (m for help): x

Then

Expert command (m for help): n

Select partition

Partition number (1-3,21-33,41-44, default 44): 41

Insert name

New name: system

Partition name changed from '' to 'system'.

Repeat for the other partitions:

Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 42

New name: custom

Partition name changed from '' to 'custom'.

Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 43

New name: cache

Partition name changed from '' to 'cache'.

Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 44

New name: userdata

Partition name changed from '' to 'userdata'.

Leave expert mode:

Expert command (m for help): r

And write the changes:

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.

This step should not require a reboot unless fdisk specifically says so. If it does, reboot to recovery and restart the adb shell.

So far, so good.

Now we install the filesystems:

~ # mke2fs -t ext4 -m 0 /dev/block/sda41
~ # mke2fs -t ext4 -m 0 /dev/block/sda43
~ # mke2fs -t ext4 -m 0 /dev/block/sda44

And leave chroot (only if you didn't reboot after fdisk).

root@localhost:/# exit

exit

Now we rewrite the custom.img backup:

~ # cd /external_sd/

/external_sd # ls
TWRP cache.img custom.img system.img

/external_sd # dd if=./custom.img of=/dev/block/sda42

Reboot recovery and *optional* restore the userdata backup.

Next we hit the Install button, click on "install image" and install the ubuntu-linux recovery image from our sd.

You should now be set, to use the ubtouch installer, from here:

Manually select Meizu Pro 5 and select 16.04/rc with the options: No fastboot, no data wipe.

Happy nerding!

Resources relied upon:

https://blog.matt.wf/flash-your-recovery-image-via-adb-shell-on-android/

https://wiki.ubuntuusers.de/Howto/Installation_Ubuntu_Touch_auf_MEIZU_PRO_5/

https://xdaforums.com/meizu-pro-5/d...hedst0rm77-t3469296/post68868682#post68868682

https://ubuntu-touch.io/de_DE/get-ut