[OnePlus 5 ROMs, Kernels, Recoveries, & Other Devel] vczilla:
*Second draft, better but not there yet son*

Well ain't it exiting folks? My first post on XDA after having lurked in the shadows forever, a pitiful creature not used to the light shone bright.

Anyways the reason why these roms steadfastly refuse to boot when used with Dual Boot Patcher is due to a major change Oreo introduced regarding the way partitions are mounted by init.

Indeed some vital partitions like system , vendor or odm can be mounted early by init.

Instead of parsing a classic file based fstab, init can oarse a device tree backed fstab entry to mount these partitions early

If y'all want more details just have a read at that ****:

****s://source.android.com/devices/architecture/kernel/modular-kernels#mounting-partitions-early-first-stage-mount

Anyways to get them pesky Oreo ROMs to dual boot the device tree needs to be cleansed of these entries.

Long story short on android device trees are either partition backed or basically appended to the boot.img.

Turns out that magiskboot can extract this all important device tree binary or btb file.

The relevant command would be :

/data/magisk/magiskboot --extract boot.img

You then end up with three files: kernel, ramdisk.cpio and dtb.

So now you need to patch out them entries from the dtb files one way or another, by force if necessary.

The way I went about it is that I installed the device-tree-compiler package on GNURoot Debian ( look it up on Google Play ).

Then to decompile your dtb file you'd run this baby:

dtc -O dts -I dtb -o dt.txt dtb

Open the thus produced dt.txt with a text editor and find an entry looking like this:

{
firmware {
android {
compatible = "android,firmware";
fstab {
compatible = "android,fstab";
system {
compatible = "android,system";
dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/system";
type = "ext4";
mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
fsmgr_flags = "wait,verify";
};
};
};
};
};

Remove it with extreme prejudice if possible.

If you'll notice in passing the last flag: "verify", that's the one

magisk and SuperSU are getting rid of to nuke dm-verity back to hell. And both actually support patching it out from an device tree backed fstab , hence why Oreo boots as a primary rom even when rooted.

To recompile your modified device-tree use this one liner:

dtc -O dtb -I dts -o dtb dt.txt

On to phase 2:

we need to add an entry back to our good old fstab file.

Let's extract it from our boot image:

/data/magisk/magiskboot --cpio-extract ramdisk.cpio fstab.qcom fstab.qcom

Then you know the drill, open it with a text editor and add this line:

( note that XDA Labs is messing up the way this post was formatted, duplicating the following line and omitting the following one about adding the fstab back to the boot.img. It's probably on the booze again. )

/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait

Just have a look at the fstab.qcom file on your root partition.

So let's put it back in our ramdisk:

/data/magisk/magiskboot --cpio-add ramdisk.cpio 0640 fstab.qcom fstab.qcom

Then let's repack our boot.img:

/data/magisk/magiskboot --repack boot.img

Finally grab the just produced newboot.img, insert it back in your rom flashable zip ( where you got it from in the first place ).

Patch it with DPB, flash it, flash gapps, flash the latest available SuperSU ( presently 2.82 SR5 ).

Then reboot.

And pray.

( Well it's not for the faint of heart I guess but we're really men over here so we donmanly things, well probably except for those of us who are women obviously. )

Can't hear you pray!