website/docs/guide/difference-with-magisk.md
Although KernelSU and Magisk modules have many similarities, there are inevitably some differences due to their completely different implementation mechanisms. If you want your module to work on both Magisk and KernelSU, it's essential to understand these differences.
/data/adb/modules./system in a systemless way through modules.Before understanding the differences, it's important to know how to identify whether your module is running in KernelSU or Magisk. You can use the environment variable KSU to differentiate it in all places where you can run module scripts (customize.sh, post-fs-data.sh, service.sh). In KernelSU, this environment variable will be set to true.
Here are some differences:
meta-overlayfs), while Magisk has mounting built into its core. KernelSU requires installing a metamodule to enable module mounting..replace method. Instead, you need to create a same-named file with mknod filename c 0 0 to delete the corresponding file./data/adb/ksu/bin/busybox, while in Magisk it is at /data/adb/magisk/busybox. Note that this is an internal behavior of KernelSU and may change in the future!.replace files, but it supports the REMOVE and REPLACE variables to remove or replace files and folders.boot-completed stage to run scripts after the boot process is finished.post-mount stage to run scripts after module mounting is complete.