tiann / KernelSU

A Kernel based root solution for Android
https://kernelsu.org
GNU General Public License v3.0
10.17k stars 1.67k forks source link

Should we cover how to utilize dynamic systems (DSU) to extract boot image as an alternative method for LKM installation? #1970

Closed rowheel closed 2 months ago

rowheel commented 2 months ago

Describe your problem.

There are devices that are GKI-compatible but the OEM doesn't officially provide stock ROMs anymore (i.e. 2024 OnePlus).

To use KernelSU on those devices, the user would have to grab stock ROMs from 3rd-party websites. However, it's not a long-term solution to rely on 3rd-party services to provide stock ROMs.

There's another option that doesn't rely on such websites. Namely, after unlocking the BL, sideload a userdebug GSI image to DSU and reboot the device to DSU. There, adb shell would be running as root, and it'd be greenlight to dump any partition out to the PC.

Should we cover how to utilize dynamic systems (DSU) to extract boot image as an alternative method for LKM installation?

tiann commented 2 months ago

You can use fastboot boot kernelsu-xxx.img to boot and install directly: https://kernelsu.org/guide/installation.html#get-the-official-firmware

rowheel commented 2 months ago

You can use fastboot boot kernelsu-xxx.img to boot and install directly: https://kernelsu.org/guide/installation.html#get-the-official-firmware

The official KernelSU boot image is great, but the patchset level may not be up-to-date, and if the stock ROM patchset level is newer than what KernelSU provides (which is just the case for OnePlus after OTA), booting KernelSU image will fail due to anti rollback mechanism kicks in.

Have tested that on my own device.

That's why I believe we might need to cover the usage of DSU as an alternative method.

tiann commented 2 months ago

Use fastboot boot (not fastboot flash boot) to temporarily boot your device, and then use the temporary root to install LKM mode.

If you need the stock boot image, you can use temporary root to directly dd extract, without the need for DSU."

rowheel commented 2 months ago

Use fastboot boot (not fastboot flash boot) to temporarily boot your device, and then use the temporary root to install LKM mode.

If you need the stock boot image, you can use temporary root to directly dd extract, without the need for DSU."

You mentioned the need to fastboot boot, but that's not going to happen if the KernelSU boot image has got older patchset level than stock boot (after OTA).

You might want to experiment that on your own device.

Just for your heads up:

As of Aug. 13, the lastest ColorOS 14 release has got their patchset level bumped to Jun. 5, whereas the v1.0.1 release of KernelSU only provides images with patchset up to May.

Quote from current KernelSU documentation:

Newer Android devices may have anti-rollback mechanisms in place that do not allow flashing a boot image with an old security patch level. For example, if your device kernel is 5.10.101-android12-9-g30979850fc20, it's security patch level is 2023-11; even if you flash the kernel corresponding to the KMI, if the security patch level is older than 2023-11 (such as 2023-06), then it may cause bootloop.

I will start drafting a guide to utilize userdebug GSI on DSU for assisting LKM installation of KernelSU in one week or later.

Will initiate a PR once it's done. :)

tiann commented 2 months ago

I use a Xiaomi device, and it works well. I'm not sure what happened with OnePlus.

rowheel commented 2 months ago

I use a Xiaomi device, and it works well. I'm not sure what happened with OnePlus.

Anti-rollback mechanism. Followed the same protocol that Google Pixel has implemented.

(So you finally passed the Xiaomi Entrance Exam? Congratulations.)