[Magisk] topjohnwu:
2017.9.28 Magisk v14.1/14.2

Hot Fix: Magisk v14.2 is released to the beta channel to fix a critical issue that breaks 99% of the modules, please upgrade ASAP!

Here comes the long anticipated release - Official Pixel family support!

I spent full-time on Pixel (trust me, I didn't do any proper work at that time...), then I took a vacation for a week. That's why tons of Magisk Module repo requests are not addressed. Please pardon me and I will add them in the next few days :)

Welcome, Pixel!

Due to the unique partitioning of Pixel devices, a lot of changes has to be done. First, the kernel has to be patched to boot with initramfs under all circumstances. Then, we need to replace the init binary to handle whether boot into recovery or system, construct the rootfs, and mount system properly. Finally, to remove dm-verity on vendor, we would need to patch the fstab placed in the dtb. There are many other quirks such as A/B partition detection, file based encryption, and the fact that sepolicy is no longer placed in rootfs - it is either pre-compiled in vendor, or split as several CIL source files in system and vendor. With all the hassle overcome, a fully working Magisk build for Pixel is here!

Introduce MagiskInit

The essence of the Pixel support is the newly introduced MagiskInit tool. This binary will replace the original init binary in the initramfs, and bring the device up booting. For those who don't know, the ramdisk in Pixel boot images are for recovery, the actual rootfs is stored in the system partition. What MagiskInit will do is that it will parse the kernel cmdline, and once it detected the device is doing a normal bootup, it will

Clear everything in rootfs (except overlay directory)

Mount sysfs to construct our target system and vendor block nodes (using the proper slot)

Mount system, clone the root structure to the actual rootfs

Move everything in overlay directory to rootfs. This is used to add addition files such as the magisk init script and magisk binary.

Patch the rootfs files (init, init.rc etc.) for Magisk support

Mount vendor, check whether exists pre-compiled sepolicy, if yes load the policies into memory, if no compile the CIL files into memory

Patch the sepolicy rules, and dump as monolithic policy into rootfs

Call the original init binary to continue the boot process

In a nutshell, ramdisk patching for the Pixel devices is actually easier than the traditional devices - we add additional files into the overlay folder, replace the init binary with MagiskInit then voilà! MagiskInit will handle the cmdline parsing, partition mounting, construction of rootfs, overlay files, patch files, and patch sepolicy - we don't need to patch anything while installation, everything happens at boot time! For those who are worried, I cannot perceive any delays while booting after doing these changes to my Pixel XL, so this should not be a concern.

Magisk Module Template Update

A new template (versioned 1410) is now live. Mostly small changes for Pixel support.

It is still not the default branch since v14.1 is a beta release, 1410 (or newer if bugs found) will become the default once the code hits stable channel.

Pixel Exclusive Features

Surprise surprise! Thanks to the A/B partition of Pixel devices, we can actually receive and apply OTAs seamlessly using the stock OTA mechanism and preserve Magisk at the same time! More info in the next section.

New OTA Installation Tips

I had added a whole new section in Magisk Documentations with tutorials for applying OTAs on your device. The step-by-step guide with screenshots can be found in the Useful Links section in the OP.

The guides include the Pixel exclusive method, FlashFire method, and general guidelines for all other non-supported devices.

Miscellaneous

There are some changes to the Magic Mount mechanism - it no longer uses dummy directories (/dev/magisk/dummy) to construct dummy skeleton, it directly mounts a new tmpfs onto the target, and construct the structure in place. This will reduce A LOT of duplicate/meaningless mounts.

Due to the significant changes, it has to go through the beta channel before it can drop to the stable channel even though it was quite thoroughly tested. Please try out the new release, even if you're not using Pixel, since the changes might have some regression on traditional devices that I haven't discovered yet.

Enjoy :)