Installing OxygenOS on the Google Pixel/Pixel XL

This is a guide on how to install OxygenOS on the Google Pixel with a resized system partition.

BEFORE WE START I'D LIKE TO THANK NYAN SATAN FOR LETTING ME USE THEIR WEBSITE AS A TEMPLATE

I am NOT responsible for any damage caused to you or your device, everything you do is on you, I'm just writing the guide

Getting started

First off, you need to have TWRP downloaded for your Google Pixel along with GNU parted which can be found here
You also need platform-tools for ADB and fastboot which can be found here
When you have those downloaded, boot TWRP and push parted (replace parted with the path to the executable) to /sbin with

./adb push parted /sbin/parted

then open a shell with

./adb shell

and set it as executable with

cd /sbin && chmod 777 parted


Partitioning

Now comes the fun part, resizing the system partitions to fit the OxygenOS system image.
First, run parted with

./parted /dev/block/sda

then list your partition table with

print

I am using a 32GB Pixel (sailfish), your partition size may vary depending on your device size, in my case it looks like this

Stock Google Pixel partitions

Now start with deleting system_a and system_b, for me these are partitions 33 and 34

rm 33

rm 34

for the partitions to be recreated with more space you also need to delete userdata and reserve0 (make sure your data is backed up)

rm 35

rm 36

verify all of the partitions are deleted with print and then proceed

Now time to make new partitions, first start by typing

mkpart

now it will ask for a name

Partition name? system_a

now it will ask for the filesystem, for system_a it is ext4

File system type? ext4

then it will ask for the start, this is the end of the previous partition, in my case it's 930

Start? 930

and now it will ask for the end, here I will use 3.1GB as it is a working combo and higher capacities can brick your Pixel
so do start + 3100, for me this is 930 + 3100 which equals 4030

End? 4030

type yes and ignore to any messages parted gives you which are warnings and not errors, do NOT type yes if it talks about sectors being moved.

Now let's do it again for system_b

mkpart

Partition name? system_b

it will ask for the filesystem again, for system_b it is ext2

File system type? ext2

this time the start is the end of system_a, for me this is 4030

Start? 4030

now I will add 3100 to the start so I will do 4030 + 3100 which equals 7130 and that will be the end of system_b

End? 7130

again, same warnings as last time

Now we will create the final partition, we will stretch this one out across the final space as it's the users data partition

mkpart

Partition name? userdata

the filesystem for userdata is ext4

File system type? ext4

same again for the start of the new partition, for me this is 7130

Start? 7130

for the end take your devices internal storage size and minus the end of the last partition, for me this is 32000 - 7130 which equals 24870

End? 24870

and we won't remake reserve0 as it's just reserved space and won't be needed any more.

Now we need to name the partitions so the bootloader can find them

name 33

Name? system_a

name 34

Name? system_b

name 35

Name? userdata

If everything went well you'll have a partition table which looks something like this.

Edited Google Pixel partitions

Now you'll notice that we're missing msftdata, we can add that back to system_a and userdata with a simple command.

set PARTNUMBER msftdata on

now let's do that for the partitions mentioned above

set 33 msftdata on

set 35 msftdata on

If all has gone well your partitions should look something like this

Finished Pixel partitions

And you're done!
Reboot into TWRP and if everything went well you can format data and wipe system just fine
Continue to part 2 to install OxygenOS
> Part 2: Installing OxygenOS