[HTC 10 ROMs, Kernels, Recoveries, & Other Developm] nkk71:
No-kexec workaround (version 4)

As of this version you need to manually enable the no-kexec workaround.

Actually, depending on the developer, (s)he may have already enabled it. Nonetheless, you can still choose to override the settings:

Go to TWRP -> MultiROM -> Settings

and enable the No-KEXEC workaround option

once you do you'll also have the option for ADVanced settings, please see below for a detailed description, though in most cases the default should suffice.​

Explanation of the no-kexec workaround advanced options

(the Info page is supposed to provide the same information as here, but I haven't added that yet)

1- Use no-kexec only when needed

This should be the default for most users, the other options are more intended for advanced uses (kernel debugging, and such).

If MultiROM detects a kexec-hardboot enabled kernel in primary slot, it will use the standard kexec method to boot the secondary. If on the other hand it does not detect that the kernel supports kexec-hardboot then it will use the workaround.​

2- ... but also ask for confirmation before booting

Same as option 1 above, but in addition you will be presented with a confirmation message, if the workaround is about to be used: ​

3- Ask whether to kexec or use no-kexec on booting

If the kernel in primary slot does support kexec-hardboot'ing then you will be presented with a choice of which method to use

If the kernel does not support kexec-hardboot then you'll be informed as in option 2 above​

4- Always force using no-kexec workaround

Forces the no-kexec workaround to be used, even if the kernel in primary slot has kexec-hardboot support​

Options 2 and 3, always present the user with a GUI confirmation, whereas option 1 and 4 will act as instructed without prompting the user.
​

Visual feedback provided by the Booting... card

Regular kexec-hardboot boot

Booting using no-kexec-workaround

​

How does all this work, etc

The workaround:

MultiROM TWRP recovery works, and is able to flash ROMs to secondary

MultiROM in essence works (in particular, able to change the mount points during bootup)

what does

not work

is being able to use the secondary ROM's kernel (due to the lack of kexec-hardboot kernel and tools)

So how do we deal with booting any ROM if we can't use the proper kernel for the ROM?

Easy :eek: :

Upon selection of the ROM during MultiROM boot menu, we do the following:

"flash" secondary boot.img to primary partition slot

initiate a full reboot (secondary boot.img is in primary slot)

let the ROM auto-boot up on second boot

The good part:

It works.

.

Every secondary ROM has a boot.img file we can easily access to use the workaround; when you flash a ROM in MultiROM TWRP, not only are the "virtual" system, data, and cache partitions created, but also the boot.img.

The secondary ROMs' boot.img will be found /data/media/0/multirom/<name of rom>/boot.img or if it's on your external ext4 in the appropriate rom folder

We use that file and flash it to primary

real

boot

partition

and then upon second boot, the correct boot.img is in place for the correct ROM.

The bad part:

Unlike secondary ROMs, the primary ROM does not have a boot.img file... since it is the primary ROM, the boot.img should always be in the

real

boot

partition

, since MultiROM expects the primary kernel to have kexec-hardboot capability, but it does not, so I just go ahead and mess with your primary boot partition.

Since we have no "boot.img" file for the primary, my workaround makes a backup of the boot partition and names it primary_boot.img

In version 4 of the workaround, this backup is created and used only when booting a secondary ROM. When a secondary ROM is selected it's boot.img is flashed to primary slot, upon booting into the secondary ROM, the primary_boot.img is restored.

Long story short: the difference between kexec and no-kexec-workaround

Usual kexec-hardboot MultiROM

Select secondary ROM

MultiROM detects a boot.img

MultiROM reads the secondary boot.img into memory

MultiROM initiates a kexec second boot

but

into the secondary boot.img from above

MultiROM continues

No-kexec-workaround MultiROM

Select secondary ROM

MultiROM detects a boot.img

MultiROM

flashes

the secondary boot.img into the primary boot partition

MultiROM initiates a normal second boot

but

with the secondary boot.img in the real boot partition

MultiROM restores the primary_boot.img and continues as usual

so the difference is in point 3... whereas normal kexec'ing loads the secondary boot.img into memory and goes from there, the workaround, actually flashes it to the real primary boot partition... and continues normally from there

Devices using the no-kexec-workaround successfully

MultiROM threads for:

HTC One M7

HTC One M8

HTC One M9

.

Moto G 2015 by GtrCraft

Moto X Play by GtrCraft

OnePlus One (starting here) by KINGbabasula

OnePlus 3 by martinusbe

OnePlus X by martinusbe

Sony Xperia Z5 by Myself5

Sony Xperia L by STRYDER~007

Sony Xperia SP by Adrian DC

Xiaomi Redmi 2 by premaca

Wileyfox Swift by [MENTION=3849010]beroid[/MENTION]

.

(possibly Samsung Note 4, unsure if that was continued or not)

Others; unofficial builds? (if you are, kindly let me know, and I'll add you to the list)