yashsingh1/xdaforums huggingface dataset:
[Google Pixel 6 Pro] capntrips:
I ported the relevant segments of avbtool and distilled the modifications to vbmeta to the bare minimum. It does not patch the authentication block or sign the image. Generating FEC codes is optional. You can find the build in the git repo:

Releases · capntrips/HashtreePatcher

Hashtree Patcher is an Android command-line tool that patches vendor_dlkm and vbmeta for booting without disabling verity. - capntrips/HashtreePatcher

github.com

Use vbmeta from stock and vendor_dlkm from the kernel. Both will be patched in place.

Note: This is only useful if you don't have verity disabled.

For FEC support, you can find prebuilt versions of the fec binary here. It's optional, but long term, it's probably advisable.

Here are the sha256sums for SP2A.220505.002 and Kirisakura 2.4.0, both for oriole, from the alpha02 build:

b47cf7b49c4b38374bf45ee3fb6e8fe6531ec42d9a5caf4ce7e63929a7cbc5b5 vendor_dlkm.img
2139e200534f75f2d159aeea6b74e3526a7008a57235a7d934c1bffcf74eb0c9 vbmeta.img
[Google Pixel 6 Pro] swieder711:
I have hashtreepatcher-alph02, vbmeta.img from stock and vendor_dlkm.img from the Kiri 2.4 kernel all in a folder on my Windows machine.

Do I run hashtreepatcher directly on my Pixel 6 Pro or some other way?
[Google Pixel 6 Pro] capntrips:
adb push hashtreepatcher /data/local/tmp
adb push fec /data/local/tmp
adb push vendor_dlkm.img /data/local/tmp
adb push vbmeta.img /data/local/tmp
adb shell
cd /data/local/tmp
chmod +x hashtreepatcher
chmod +x fec
./hashtreepatcher vendor_dlkm.img vbmeta.img
exit
adb pull /data/local/tmp/vendor_dlkm.img vendor_dlkm-patched.img
adb pull /data/local/tmp/vbmeta.img vbmeta-patched.img
[Google Pixel 6 Pro] swieder711:
This is super helpful.

Edit1: Once I pull the modified files then do I flash them via Fastboot?

fastboot flash vbmeta vbmeta-patched.img

fastboot flash vendor_dlkm vendor_dlkm-patched.img

Edit2: Just confirming that line 2 is this for Pixel 6P

adb push fec-arm64 /data/local/tmp

Do I need to rename fec-arm64 to fec?

Edit3: Here are the results from running hashtreepatcher

$ ./hashtreepatcher2 vendor_dlkm.img vbmeta.img

- Patching complete

Hashtree descriptor:

Image Size: 44224512 bytes

Tree Offset: 44224512

Tree Size: 352256 bytes

Data Block Size: 4096 bytes

Hash Block Size: 4096 bytes

FEC num roots: 0

FEC offset: 0

FEC size: 0 bytes

Hash Algorithm: sha256

Partition Name: vendor_dlkm

Salt: dcfdb868e3aef90f102187d66b9cd2c71589a8b0f0035387940a2ca364d8cd05

Root Digest: 6dd4ee4ec76f02c778d56c5d43a08cdb8fb20f8db3b0ee3d04bf1728c6627b06

Flags: 0

Thanks for holding my hand through this. I am ready to flash the patched files and then try to Flash Kiri 2.4 kernel. Should the phone be in fastboot or fastbootd mode?
[Google Pixel 6 Pro] noidea24:
i followed al

been trying to get this thing to boot for three days, i finally got the device to boot with these instructions but without touchscreen response :(.

all these commands completed successfully.

flashed the pulled patched images in fastbootd.

reboot to bootloader and flashed the kernel.

IT ACTUALLY BOOTED. this is the first time ive been able to boot.

went to unlock the phone, touchscreen is unresponsive. phone isnt frozen, it just doesnt respond to touch.
[Google Pixel 6 Pro] capntrips:
Yes, though you will need to reboot into fastbootd for vendor_dlkm:

fastboot reboot fastboot

Yes, the file must be called fec and it must be in your working directory when you call hashtreepatcher. You can tell if it worked if the output doesn't have all zeroes for the FEC fields.

Note: If you patch vendor_dlkm a second time, be sure to push a fresh copy, as hashtreepatcher will happy keep appending more and more hashtree footers to the file. I have no idea if that affects anything, but it will at least keep getting needlessly larger.

fastbootd only for vendor_dlkm.

Sounds like your vendor_dlkm didn't flash properly. Be sure to install it from fastbootd (which I see you did), or just update the zip with the patched one and let some kernel manager flash it.

What version of Magisk are you using? Do you have verity disabled?
[Google Pixel 6 Pro] noidea24:
Sorry about the post, chromium acting funny.

My problem might be that I didn't have fec in the Tmp directory when running hashtreepatcher.

But as soon as the fec file is present, hashtreepatcher fails out and I get a "unable to open vendor_dlkm.img"

I thought it was a bad download or I had the wrong fec, so I tried the standard (non64) and it's the same error.
[Google Pixel 6 Pro] capntrips:
fec should be optional. I'll run a few tests to be sure it still works without in the latest build.

The bit about vendor_dlkm.img is a bug. I copy and pasted that section and forgot to update the error message. It is trying to open a file named fec.bin that should have been created by the fec command but wasn't. I'll bet the file doesn't have execute permissions. Try:

chmod +x fec

I'll bet that fixes it. I'll try to get a new version that fixes the bug in the error message and checks for the permissions on the fec binary and the exit status of the command out in the next day or so.
[Google Pixel 6 Pro] noidea24:
yep, chmod fec did fix the patching process. however i still didnt have any touch once i got back up and running.

flashing back to stock again, ill hit your PM later so i dont clutter your thread, its 3am here.
[Google Pixel 6 Pro] Nezorflame:
@capntrips thanks, your method worked!

Just to be clear - we should repeat that now every time we decide to upgrade the kernel / update the ROM, right?
[Google Pixel 6 Pro] capntrips:
Anytime you flash vbmeta or vendor_dlkm, as they have to stay synchronized.
[Google Pixel 6 Pro] swieder711:
Just want to confirm that once the files are patched, then we do the following from our PCs

With fastboot running

fastboot flash vbmeta vbmeta-patched.img

With fastbootd running

fastboot flash vendor_dlkm vendor_dlkm-patched.img

renamed fec-arm64 to fec and ran hashtreepatcher on some fresh imgs. Got the following

raven:/data/local/tmp # ./hashtreepatcher vendor_dlkm.img vbmeta.img

- Patching complete

Hashtree descriptor:

Image Size: 44224512 bytes

Tree Offset: 44224512

Tree Size: 352256 bytes

Data Block Size: 4096 bytes

Hash Block Size: 4096 bytes

FEC num roots: 2

FEC offset: 44576768

FEC size: 360448 bytes

Hash Algorithm: sha256

Partition Name: vendor_dlkm

Salt: dcfdb868e3aef90f102187d66b9cd2c71589a8b0f0035387940a2ca364d8cd05

Root Digest: 6dd4ee4ec76f02c778d56c5d43a08cdb8fb20f8db3b0ee3d04bf1728c6627b06

Flags: 0

Flashed the patched files to my P6P. Took awhile for the phone to boot, but had no touchscreen response. Tried putting back the unpatched files and phone went into a boot loop. Seems to be the same problem as @noidea24

Doing a flash-all nowipe to bring the phone back to life.
[Google Pixel 6 Pro] capntrips:
Probably unnecessary to mention, but don't get fixated on those two and forget to install the powerhint module and flash the boot, dtbo, and vendor_boot images. The easiest way is probably to drop the patched vendor_dlkm image in the AK3 zip, flash the zip, then just flash vbmeta on reboot.
[Google Pixel 6 Pro] swieder711:
I have powerhint_p6.zip dated 12/11/2021. I thought this now gets installed when the Kiri 2.4 kernel is flashed.

I didnt realize that I also need to flash boot (Magisk canary), dtbo, and vendor_boot images. Is the syntax the same:

fastboot flash boot boot-canary.img

fastboot flash dtbo dtbo.img (stock?)

fastboot flash vendor_boot vendor_boot.img (stock?)

Do you think this will fix the loss of touchscreen?
[Google Pixel 6 Pro] capntrips:
If you're installing the kernel with the AK3 zip, then yes, the powerhint module is installed automatically. My point was just to ensure you aren't forgetting to install the rest of the kernel (the AK3 zip comes with the powerhint module, the kernel image (which AK3 packs with your ramdisk into a boot image via magiskboot), and the dtbo, vendor_boot, and vendor_dlkm images).

If you're getting the loss of touchscreen, I'm guessing there's a disconnect between the kernel in the boot image and the vendor_dlkm image.

You've got the right commands, but you mention stock. Each of those images should come from the kernel, not from stock. If you're installing these manually, rather than from the AK3 zip, be sure to see the manual installation instructions.
[Google Pixel 6 Pro] swieder711:
I have not gotten to Flash the Kiri 2.4 kernel yet. After flashing the patched vbmeta.img and vendor_dlkm.img and reboot, I lost touchscreen.

I usually flash the kernel thru Franco Kernel Mgr.

Any suggestions on what to try to get the touchscreen working?
[Google Pixel 6 Pro] capntrips:
Flash the kernel through FKM, then on reboot flash the patched vbmeta and vendor_dlkm images.

You can save a step if you drop the patched vendor_dlkm in the kernel zip before flashing it in FKM. You'll still have to manually flash the patched vbmeta image, however.
[Google Pixel 6 Pro] capntrips:
I didn't mean to hijack this thread when I posted that binary. If anyone has any additional questions about Hashtree Patcher, let's take it to a new thread.
[Google Pixel 6 Pro] swieder711:
I flashed the Kiri 2.4 kernel via FKM then rebooted in fastboot.

I flashed the patched vbmeta then rebooted to fastbootd and flashed the patched vendor_dlkm.

Rebooted the phone and it is stuck in a bootloop. Shows the "Google" banner and then reboots.

Going back to stock kernel via flash-nowipe for now. Happy to try more testing if you have other suggestions.
[Google Pixel 6 Pro] capntrips:
My best guess is there was a mismatch between the versions of the vbmeta and vendor_dlkm images.

Since booting into fastbootd to flash vendor_dlkm hoses ramoops, it makes it a bit tricky to diagnose. The simplest method would be to grab a copy of the Kiri boot image patched with Magisk 24.3 stable, then repeat the same process above (with the latest canary), but when it bootloops, boot into the 24.3 patched image and grab the ramoops.
[Google Pixel 6 Pro] swieder711:
GOT IT WORKING! Running Magisk Canary 24313 with Kiri kernel 2.4-stable-fixed.

Join this thread for what I did with @capntrips great work!

https://xdaforums.com/t/dev-hashtree-patcher.4450635/
[Google Pixel 6 Pro] noidea24:
This.

Preciate the summarized guide, it's up and booting.

Love y'all and love the work.
[Google Pixel 6 Pro] Piliip:
I REALLY wouldn't recommend flashing a custom kernel which isn't for your own device....
[Google Pixel 6 Pro] prokiller1199:
Still having issues of magisk being detected in this App. I wonder if OP is kindly enough to help me check on these logs. Much appreciate! I am not sure what is being detected, glad if someone can explain or guide me through what is all these vbmeta/vendor thingy.

UPDATE:

After flashing this zip and it is working now. Many many thanks!!!
[Google Pixel 6 Pro] swieder711:
Did you use the fixed version of 2.4 kernel?
[Google Pixel 6 Pro] prokiller1199:
after I use then it works!
[Google Pixel 6 Pro] cabagekiller:
Hey man I just want to say thank you for taking the time to make this legit kernel. I know a lot of people just come here with issues but I just wanted to thank you.
[Google Pixel 6 Pro] Freak07:
Thank you very much for the kind words. It´s greatly appreciated.

Also thank you very much for the generous donation!
[Google Pixel 6 Pro] reddvilzz:
Hi, I'm new and I was trying to flash the kernel using version 2.4.0 for Pixel 6 with the manual instructions, flashed the magisk module for manual instruction, using Magisk 24.3, after doing it my phone stuck on bootloop, and using FKM ends up the same.

How can I know if my phone running Android 12L or 12.1.0? I'm on 12 (SP2A.220505.002) if that helps. And using Renovate Ice Magisk Module.

Am I on the wrong version?
[Google Pixel 6 Pro] bLack_Q:
12L / 12.1.0 = same

Version should be fine.
[Google Pixel 6 Pro] capntrips:
The issue is discussed quite a bit over the last few pages, but your issue is likely related to dm-verity. The simplest solution is to roll back to Magisk 24.3 stable. I did a bit of testing and it seems you can flash vbmeta with --disable-verity (but not --disable-verification) to work around the issue without wiping data, if you prefer to use Magisk 24303+.
[Google Pixel 6 Pro] reddvilzz:
I've managed to install the kernel following your hashtree patcher guide using Magisk 24.3 stable version. Do I missed out anything by not using the latest canary Magisk?

If I update to the latest canary of Magisk, do I need to install the kernel again following everything from the hashtree thread? Or just patching the boot.img from the kernel using the latest Magisk will suffice?
[Google Pixel 6 Pro] capntrips:
If you used Hashtree Patcher, you don't have to use Magisk 24.3. Magisk 24.3 strips avb from fstab, so vbmeta and the hashtree aren't even used. Here are the release notes for 24315, but there's nothing too exciting in there. If everything works for you, I can't say there's any specific reason to upgrade.

Edit: If you want to take the OTA through System Update (see here), you will probably want to be on the latest canary, at least until the next stable release.

You should be able to just do a direct install in Magisk. The only time you'll have to redo that whole operation (assuming you upgrade to Magisk 24303+) will be if you upgrade your OS or kernel.
[Google Pixel 6 Pro] reddvilzz:
Direct install in the meaning of installing the zip using Magisk itself?
[Google Pixel 6 Pro] capntrips:
In the Magisk app, one of the installation methods is Direct Install, as opposed to patching an image and flashing it in fastboot (which would also work, but requires more steps).
[Google Pixel 6 Pro] reddvilzz:
Ah okay thank you very much for the help.
[Google Pixel 6 Pro] wbgenetic:
Hey yall. Kirisakura for Android 13?

Flashwd the 13 via the beta Chan and can't play with the kirisakura now 😭
[Google Pixel 6 Pro] Utini:
I am not sure if its kernel related but generally people on stock dont seem to have this problem:

My phone stops video recording because it gets too hot after 5:42min. 4k/60fps with H264 and also H265.
[Google Pixel 6 Pro] Freak07:
can´t do anything about it. it depends a lot on ambient temperature and the temp of the phone when video recording is started and other factors.

I have no problems taking longer videos, but that experience may vary based on ambient temp, whether the sun is directly hitting the phone, screen brightness, signal strength etc. basically every factor that makes the phone draw more power or contributes to more heat.

It´ll happen on stock too.
[Google Pixel 6 Pro] Utini:
Oh okay, thanks. So I guess for the event I jave to record today I will go for:

4k

60fps

Airplane mode

Low screen brightness
[Google Pixel 6 Pro] Freak07:
the display falls back to 60fps automatically when launching the camera app.

but airplane mode and lower screen brightness is a good idea. google already restricts max cpufreqs and uses a few other "tricks" during video recording so the phone builds up heat slower. but even with those tricks it can overheat.

4k video recording is generally tricky even with none flagship SoCs. lots of reports around of phones overheating e.g. pixel 5.

For pixel 6 check here.

Worst case is if there´s already something "wrong" when the video recording is being started and the phone is already warm/hot. for example an app hogging CPU in background like in this case.

Another good idea is to take your case off if you´re willing to do that as cases tend to trap heat and prevent dissipation.
[Google Pixel 6 Pro] Utini:
Thanks, you are amazing.

Yes I was already afraid that Bellroy Leather Case might be counter productive in terms of cooling :S
[Google Pixel 6 Pro] swieder711:
Now that the June update is out and TopJohn said that Magisk V25.0 is coming soon, I hope to avoid the whole hashtree patch process with the next version of this kernel (fingers crossed).
[Google Pixel 6 Pro] Freak07:
Magisk won't change its course unfortunately. I asked topjohnwu and for reasons that are understandable and very valid from magisks perspective (but unfortunate for us flashing kernels on p6 devices) the behaviour recently introduced in the canary will not be changed again.

Hashtree patcher might be included in the kernel.zip though, so everything is done automatically. Depending on when that is ready everyone has to adjust and do it manually for now, but I'll mention the current state in the release post.
[Google Pixel 6 Pro] Ghisy:
To be sure: it only concerns those who haven't disabled verity and such? Although I'm not entirely sure what this hashtree patching does...
[Google Pixel 6 Pro] Hecke92:
Can I use this kernel with the newest update released today? Thanks
[Google Pixel 6 Pro] Freak07:
Yes the issue with magisk canary only affects those that run with verity/verification enabled and did not disable those flags.

No source pushed yet from googles side. If you don´t want to face any issue wait until I updated the kernel for June stable release :)
[Google Pixel 6 Pro] Ghisy:
Gotcha, thanks! My 6 Pro is on Magisk stable and has had verity/verification disabled since the beginning.
[Google Pixel 6 Pro] Freak07:
I assume the touchscreen will need the updated drivers that were needed for QPR beta builds before.

It´s getting late here and usually google is pushing the source somewhere during nighttime in my timezone. I´ll try to get the kernel updated as soon as possible once I know it´s stable.

I wish everybody a great day/evening.
[Google Pixel 6 Pro] Jerreth:
i have been reading over all the info in here about the canary magisk issues, is there any big reason to be on canary? i am confused i suppose by all the info in here about it, i do understand how to get my phone on canary successfully but should i is the second question lol

thanks in advance.
[Google Pixel 6 Pro] Lughnasadh:
I don't see a reason (unless you are on the A13 betas) and it sounds like John will update Magisk to Stable 25 in the near future. However, if some of the Canary changes are incorporated in Stable 25, users of custom kernels may want to be wary of that unless using the Hashtree Patcher or disabling verity & verification. See this thread and Hashtree Patcher thread for more info on that.
[Google Pixel 6 Pro] prokiller1199:
Just now I tried disable verity & verification flags, it then requires full wipe. Luckily dirty flash back without disable those flags works. My files is safe. Thank god!

For now, I cant do full wipe yet. Will do in future.
[Google Pixel 6 Pro] Lughnasadh:
Excellent work by both you and @capntrips 👍

PSA: Magisk 25 has been released to the pubic Beta channel and Canary channel.

Of note and particular interest to this discussion, the changelog includes this...

"Magisk no longer patches fstabs in most scenarios, which means AVB will remain intact; some custom kernels rely on AVB being stripped out for them by Magisk."

This new kernel release couldn't have come at a better time 🙂👍 (of course heed @Freak07 note about not using Canary 24303/Beta 25 and later at this time to avoid potential issues... until tested).
[Google Pixel 6 Pro] scott.hart.bti:
@Freak07 you spoil us! Freaking legend! 👍
[Google Pixel 6 Pro] russian392:
Just to confirm a few things:

1) Should we use magisk 25? Or is 24 still working fine?

2) For the OTA update method, magisk uninstall, restore images, ota update, then should I install magisk or install kernel 3.0? I am assuming that After the ota installs we can just flash the kernel in a EXKM or whatever and be done with the update process right?
[Google Pixel 6 Pro] xflowy:
getting a bootloop on v3 with magisk 24.3 stable. anyone else?
[Google Pixel 6 Pro] scloutkst:
Running a 6 pro with 24.3 stable. No issues so far. Flashed with no problem.
[Google Pixel 6 Pro] Freak07:
I don't have problems using latest canary.

Might be that you need to use canary or beta if you keep verity/verification enabled with the updated zip. I don't have the possibility to test all conditions on my own end.

I know it works fine with latest canary with vbmeta flags disabled on own end.

A tester flashed on latest canary 24316 with vbmeta flags enabled as well without issues.

Do you have vbmeta flags for verity/verification disabled or enabled running magisk stable?

Nice, thanks for the reports. Verity/verification flags enabled or disabled?
[Google Pixel 6 Pro] shizonic:
Just flashed 3.0.0 and magisk 25001. Everything works fine, including my banking apps. Great work. Thank you.
[Google Pixel 6 Pro] scloutkst:
Apologies. Im not sure. Been so long since we had to manually mess with this since android 12 launched.

All I have done is patch the boot file, and flashed it via fastboot. Rebooted and flashed the kernel. So whichever way it turns out without any extra intervention.

Is it enabled then? Again my apologies.
[Google Pixel 6 Pro] xflowy:
sorry im a little noobish but thats the thing you (can) disable when rooting the first time, right? and if you disable it, it wipes the phone. but you only have to do it once and it stays that way, right? that i did, when i rooted month ago.

or do i need to redo it every time i upgrade flash a new factory image? :/

edit: everything worked with magisk beta 25.
[Google Pixel 6 Pro] Lughnasadh:
For OTA updates, if you are running a custom kernel you will have to manually restore all 4 of the stock mages the kernel modifies because Magisk won't restore all of them. If you don't you will fail the PRE-OTA verification checks and the update will fail.

So first you would want to manually flash the 4 stock images, then go through the Install to inactive slot procedure (make sure you read instructions on how to properly do that). After that you should be updated and rooted and then you can flash the kernel.

But honestly, the Install to Inactive slot method can be hit or miss. Better off updating via flash-all in my opinion.
[Google Pixel 6 Pro] Psfanboy88:
Updated this way to retain root and my data. Flashed the Kernel afterward with FKM. I didn’t disable any Magisk Modules. Works fine.

Use the latest Magisk Stable (in my case, I keep the app "hidden" / renamed)

Used the full firmware zip, extracted to the same folder as the latest Platform Tools (S:\platform-tools)

Extracted the new boot.img

Copied new boot.img to the phone

Patched the new boot.img with Magisk Stable

Renamed Magisk'd boot.img so I know what version of firmware it's for

Copied the Magisk'd boot.img back to the computer

Disabled all my Magisk Modules

Removed the "-w " from the flash-all.bat

Re-edited the flash-all.bat to verify I saved it with the "-w " taken out

Open a Command Prompt, navigated to S:\platform-tools

adb reboot bootloader

flash-all.bat

Let phone boot, unlock it, check that it's working, allow the update process to finish (gave it five minutes or so)

adb reboot bootloader

fastboot flash boot kernel.img (renamed Magisk'd boot.img)

fastboot reboot

Unlock, check everything's working

Re-enabled the most basic Magisk Modules which I was sure wouldn't cause a critical issue

Reboot, unlock, made sure everything's working

Source: https://xdaforums.com/t/june-2022-u...central-repository-of-relevant-links.4352027/
[Google Pixel 6 Pro] russian392:
Did you reflash the manual install required dtbo/vendor_boot and vendor_dlkm?

NVM. This is the guide to do it all, thanks.

@Freak07

Did this list. Using old magisk 24.3 24300. No issues.
[Google Pixel 6 Pro] swieder711:
Another success story. Dirty flashed the June update. Installed Magisk v25.0 and then used FKM to install Kiri 3.0 stable. Took 15 minutes for the whole process. Everything went as smooth as butter.

Also, Root not detected by any of my apps.
[Google Pixel 6 Pro] bleez99:
I just want to triple confirm.

A full flash, which I always do, verity not touched and currently enabled on my phone (using the default command line provided minus the -w flag and --skip-reboot) will work fine with Magisk 23.0 stable.

I pre patch the new boot image and pull it down before flashing, my standard procedure. ( I add --skip-reboot to the command line and after flashing I put the rooted image on prior to rebooting.

Correct? No surprises needed.
[Google Pixel 6 Pro] bleez99:
I was asking before I make a move. :)

@Freak07 @jcp2 @roirraW "edor" ehT

Out of paranoia...