[OnePlus 2 Original Android Development] anupritaisno1:
Added recovery-fakecache.img

It'll be used for the upcoming incremental OTAs

A full explanation:

Incremental OTAs are computed on the /cache partition

Incremental OTAs often ask for a lot of space on /cache

Op2 doesn't have that much of space on /cache

Why incremental OTAs are computed on /cache and not on /system and /vendor (and boot) directly? Because if this were a stock ROM there is a likelihood of the user interrupting an incremental OTA so Google added a failsafe for this so that an interrupted incremental OTA can be resumed if the device was rebooted by the user. Can't be helped really

What we do? Create a fake cache partition large enough to hold these bits so that incremental OTAs can be flashed. After a lot of testing, 512 MB seems to be the optimal size for a fake cache

First we need to create the fake cache

Boot to TWRP and decrypt data

Make sure data is mounted

Run these commands in terminal by going to advanced > terminal

dd if=/dev/zero of=/data/fakecache bs=512M count=1
mke2fs /data/fakecache # type "yes" and hit enter to confirm

Note that TWRP is hardcoded to only accept /data/fakecache. Other filenames will be rejected when you flash the ROM

Reboot recovery after creating the fakecache

Now on every boot before you flash the ROM you have to run

mount /data/fakecache /cache

In TWRP's terminal

Go to mounts now and make sure there's a tick mark next to cache

If you accidentally flash the ROM and forgot to mount the fakecache before flashing you have to reboot recovery, mounting it after a failed flash won't work at all

The following additional directories will be added to the server:

full

incrementals

Full: for full zips, exactly the same as the release zip but won't contain backuptool so that incremental OTAs can be flashed

Incrementals: will have a filename glassrom-release-incremental-from-source-to-target.zip

Example current glassrom release is july release

The August release would be something like

glassrom-incremental-from-july-release-to-august-release.zip

The file naming for the full zips will be

glassrom-release-full-target.zip

Example August release would be glassrom-release-full-august.zip

Likewise if there is more than one build in a given month you might see something like

glassrom-incremental-from-august6-release-to-august9-release.zip in the incrementals and glassrom-release-full-august9.zip

What to do? First flash the full zip and chain the installation of each incremental zip. Note that you can't be on, say July release and upgrade to September release without flashing the August release

So if you want to go from July to September release (say), you'd probably go something like

backup-script.zip (will be provided)

glassrom-release-full-july.zip

glassrom-incremental-from-july-release-to-august-release.zip

glassrom-incremental-from-august-release-to-september-release.zip

.......

gen_verify.zip (optional, see FAQ)

restore-script.zip (will be provided)

Remember that the flash order matters and incremental OTAs can take up to 30 minutes to flash so the larger you make your flash chain the longer you'll have to wait

Myth: aren't full OTAs always better?

No, if you think so you're free to verify the hash of the system with a full OTA and an incremental one. They will match which means that the contents are exactly the same

FAQ: also do I need to change anything else?

You might want to go to TWRP > mount and tick mount system read-only if you're having problems flashing incremental OTAs.

Why do I need to flash the full zip everytime? Can't I just flash the incremental OTAs? ****** ROM allows me to do so with delta OTAs!

First off, incremental OTAs move blocks of data around instead of files and write/erase blocks instead of touching the filesystem. The incremental OTA system isn't even aware of the filesystem being used. This is because the only way to recreate the entire filesystem is to operate at a level below the filesystem. Doing something as simple as even mounting system will disturb the order of the blocks the way they appear to the incremental OTA patcher, even though the filesystem didn't change. So you need to flash the full zip and all incremental OTAs in a chain and you can't flash them directly

Wait! This is different from the Delta OTAs I've used! Stop messing around

Delta OTAs take an existing zip and create a new ROM zip out of it. Incremental OTAs patch your partitions live. Incremental OTAs are also much smaller than Delta OTAs

For comparison:

A "typical" incremental OTA: 8 mb (actual releases should be around 80-200)

It's Delta counterpart: 140 mb (actual releases would be 60-70% of the size of the new ROM)

What's the gen_verify.zip?

Used to verify if an incremental OTA chain (or a full OTA) was correctly flashed. The zip will return valid results and will only log errors and always report a success regardless of whether there is an error or not. It will show you verifying partition... Where partition can be boot, system, vendor or recovery. It will say failed for recovery, that is expected but it should show verified partition for every partition other than recovery. Has to be redownloaded for every new release. It will just verify the partitions and not write anything to any partition. The script will also always return success even if verification fails so read that the script's output actually reports that verification passes and not TWRP's output that the zip flashed successfully

Can I flash normal release zips and skip incrementals and still use this TWRP to flash?

Yes

What's the difference between this TWRP and recovery-vendor?

Nothing except the fakecache addition

Availability: sometimes lineage will make really huge changes that might make it impossible to upgrade through an incremental OTA so you shouldn't rely solely on incremental OTAs. Anything can happen. In such a case I can only say sorry and give you a full OTA

You have to store these incremental OTA files! Glassrom will delete old releases