bmax121 / APatch

The patching of Android kernel and Android system
GNU General Public License v3.0
4.31k stars 323 forks source link

Replacing Kernel Modules [ Pre-Init Trigger ] #670

Open hopez13 opened 2 weeks ago

hopez13 commented 2 weeks ago

Is your feature request related to a problem?/你的请求是否与某个问题相关?

On GKI (Generic Kernel Image) devices, kernel modules .ko are dynamically loaded by the Android init process from the vendor/lib/modules directory. This directory is part of the read-only vendor partition within the super image. As a result, replacing or adding new modules can be a complex and cumbersome task.

I intend to replace some of the built-in modules with custom versions. To achieve this, I planned to use an overlay with the apatch module to modify the vendor/lib/modules directory. However, I encountered an issue where the overlay is applied after Android init has already loaded the original modules, causing my custom modules to not be loaded as intended.

Describe the solution you'd like/描述你想要的解决方案

To address this issue, we need a mechanism that triggers before the Android init process. This will enable us to replace or overlay the default modules in the vendor/lib/modules directory with our custom modules before they are loaded.

Describe alternatives you've considered/描述您考虑过的备选方案

No

Additional context/其他信息

No