[Android Q&A, Help & Troubleshooting] jtpiano:
This thread assumes there is no ROM released for recovery and you need to start from scratch to build a recovery.

After doing a lot of searching I have put together of list of items needed to build your own partition.xml file based on your specific device.

#1 A rooted phone is a must! You need to be able to backup all partitions including the partition table. Using DD is your friend here.

To build the partition.xml file you'll need the to know the following items at a minimum-

1 partition label

2 size in kb

3 type

There are other parameters such as bootable, readonly and filename but for purposes of this post we'll only work with the first three

You can use a variety of commands to get the partition label and size. e.g.-

# cat /proc/partition

# mount

# df

# parted /dev/block/mmcblk0

# ls -l /dev/block/platform/"some number".sdhci/by-name

Probably the most useful command will come from parted. (Assuming you already have it installed in your system. How to install it is another topic I won't cover here to keep this topic on track)

root@BLU_STUDIO_C_5_5_LTE:/system/bin # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
Model: MMC H8G1e (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 67.1MB 134MB 67.1MB fat16 modem
2 134MB 135MB 524kB sbl1
3 135MB 135MB 524kB sbl1bak
4 135MB 136MB 1049kB aboot
5 136MB 137MB 1049kB abootbak
6 137MB 138MB 524kB rpm
7 138MB 138MB 524kB rpmbak
8 138MB 139MB 786kB tz
9 139MB 140MB 786kB tzbak
10 140MB 141MB 1049kB pad
11 141MB 143MB 1573kB modemst1
12 143MB 144MB 1573kB modemst2
13 144MB 145MB 1049kB misc
14 145MB 145MB 1024B fsc
15 145MB 145MB 8192B ssd
16 145MB 156MB 10.5MB splash
17 201MB 201MB 32.8kB DDR
18 201MB 203MB 1573kB fsg
19 203MB 203MB 16.4kB sec
20 203MB 237MB 33.6MB boot
21 237MB 2334MB 2097MB ext4 system
22 2334MB 2367MB 33.6MB ext4 persist
23 2367MB 2401MB 33.6MB ext4 apedata
24 2401MB 2669MB 268MB ext4 cache
25 2669MB 2703MB 33.6MB recovery
26 2703MB 2704MB 1049kB devinfo
27 2751MB 2752MB 524kB keystore
28 2752MB 2819MB 67.1MB oem
29 2819MB 2820MB 524kB config
30 2820MB 7818MB 4999MB ext4 userdata

You can see we can get the start, end and total size of each partition as well as the partition names.

Now we need to translate partition names into the "type" value in our partition.xml file. (Where type="some long string of numbers with dashes in between") Here is the list I have come up with so far assuming we have a GPT partition structure in our device. Always verify these values for your specific device! You have been warned.

098DF793-D712-413D-9D4E-89D711772228	rpm
0A288B1F-22C9-E33B-8F5D-0E81686A68CB	modemst2
20117f86-E985-4357-B9EE-374BC1D8487D	boot, recovery
20A0C19C-286A-42FA-9CE7-F64C3226A794	DDR
2C86E742-745E-4FDD-BFD8-B6A7AC638772	ssd
400FFDCD-22E0-47E7-9A23-F16ED9382388	aboot
57B90A16-22C9-E33B-8F5D-0E81686A68CB	fsc
638FF8E2-22C9-E33B-8F5D-0E81686A68CB	fsg
A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4	tz
D4E0D938-B7FA-48C1-9D21-BC5ED5C4B203	dbi or sdi depending on device
DEA0BA2C-CBDD-4805-B4F9-F428251C3E98	sbl1
EBBEADAF-22C9-E33B-8F5D-0E81686A68CB	modemst1
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7	modem, pad, system, userdata, persist, cache

You can get these values from using the gptfdisk binary as seen in this post

xdaforums.com/showpost.php?p=33358988&postcount=2 (Thanks to E:V:A)

or head on down to the spoiler section here and you can see what the labels look like- (Partition GUID Code)

https://translate.google.com/transl...ersion/index.php?t552073-420.html&prev=search

Lastly my assumption is that if the partition size is not evenly divisible by 1024 you would round up to the next nearest kb value.

33.6MB=33600kb

33600/1024=34406.4 (cant have a partial kb left over so round up)

34407

33.6MB=34407kb. Let's plug this vaule into our xml file

size_in_kb="34407"

I'm new at this. If ANY of this is wrong please comment and correct. I hope this will help! :D