[Magisk] remoh:
I was able to change the kernel name on my Redmi Note 9 Pro running LineageOS 20.

Now it passes basic and device on play integrity again, still using play integrity fix 14.6 and my own PIF.

To share my experiences and make it easier for other i wrote a short howto.

THIS ONLY APPLIES TO: Redmi Note 9 Pro on LineageOS 20 !!!

It may/should work this way for other devices or roms, but be careful

What you need​

- platform-tools

SDK Platform Tools release notes | Android Studio | Android Developers

Android SDK Platform-Tools is a component for the Android SDK.

developer.android.com

- magisk tools (magiskboot)

Magisk Tools

The Magic Mask for Android

topjohnwu.github.io

I used a windows port, because i did all on windows: https://github.com/svoboda18/magiskboot/releases

- Hex editor

I used frhed - it free to use and was available in my portable apps suite

- boot image with kernel

In my case miatoll lineageos downloads https://download.lineageos.org/devices/miatoll/builds - file "boot.img"

Part A - create a boot image with modified kernel string:​

Put the "boot.img" file into the extracted folder of magisk tools / magiskboot

To let magiskboot unpack the image just run:

magiskboot unpack boot.img

After this you will find some files in the folder, including "kernel".

Open the "kernel" file with your hex editor and search for "lineageos".

In my case it was found 5 times. But be careful, the first two times the name was part of a path (easily the by surrounding folder path /lib/firmware/updates/4.14.320-lineageos-g....).

Do only change the name when it is not part of a path. In my case that was 3 times.

I changed only some letters and not delete ones so avoid changing the lenght of the file. So for example change "lineageos" to "leeeegeos"

Save the file with the same name (overwrite).

Now you can repack the boot.img, run:

magiskboot repack boot.img boot-new.img

"boot-new.img" was now created an contains the kernel with the modified string. We will need this file later.

Part B - connect to your phone with adb/fastboot:​

First enable USB debugging on your phone.

Connect your phone with USB cable to your PC, maybe wait some minutes to let the system install drivers.

Unpack the platform-tools

Check if the phone is properly connected, run:

adb devices

This may bring up a pop up on your phone to allow your pc to connect, apply here

Now we can reboot to bootloader, run:

adb reboot bootloader

Your phone will reboot, now we can check if it is available for fastboot, run:

fastboot devices

This should show your phone connected.

Part C - test and flash the new boot image containing the modified kernel:​

Now we can flash the image, but to be sure to not screw up your phone you can use fastboot to boot the image by loading it from your hard disk to the phone without flashing it.

Copy the "boot-new.img" file to the folder that contains adb and fastboot.

Now we can boot the phone with the boot image (including the modified kernel) without flashing it, run:

fastboot boot boot-new.img

Your phone will boot up. Check if you can see the modified kernel name.

If all is good we can flash the kernel. First we reboot to bootloader again, run:

adb reboot bootloader

wait a minute, after that run

fastboot flash boot boot-new.img

In my case the first run failed with "Writing 'boot' FAILED (Status read failed (Too many links))".

I just ran the command again, crossed fingers and it worked :D

If you get OKAY back, reboot the phone by running:

fastboot reboot

Now hopefully the phone boot up with the modified kernel

Part D - reflash magisk:​

Since we changed the boot image magisk has to be flashed again, i suppose it is known how to do this.