Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

way to build riru into a rom directly via aosp build process #237

Closed
itmayi opened this issue Jul 7, 2021 · 3 comments
Closed

way to build riru into a rom directly via aosp build process #237

itmayi opened this issue Jul 7, 2021 · 3 comments

Comments

@itmayi
Copy link

itmayi commented Jul 7, 2021

is there plan or a way to build riru into a rom as part of the compilation process.it would be great if riru can work without magisk,i think

@RikkaW
Copy link
Member

RikkaW commented Jul 7, 2021

If you know how Riru works and is familiar with framework development, this will be very simple. However, I'm curious about why you want this.

@itmayi
Copy link
Author

itmayi commented Jul 7, 2021

yeah,the reason is i do not want magisk to modify my phone's boot partition, and i'm reading the code and trying to strip the code related about magisk in it. what confuse me is the ro.dalvik.vm.native.bridge is reset to 0 after boot ? (after installation, getprop cmd return 0)

@RikkaW
Copy link
Member

RikkaW commented Jul 7, 2021

what confuse me is the ro.dalvik.vm.native.bridge is reset to 0 after boot ? (after installation, getprop cmd return 0)

It is reset after the system server is started (this part is done in "rirud" and "rirud_java"), or anyone can simply detect Riru by checking this prop.


What Riru do in short:

  1. Modify ro.dalvik.vm.native.bridge to libriruloader.so, so that zygote will "dlopen" it
  2. Load modules
  3. Manage to "hook" nativeForkAnd..and related functions (see jni_hooks.cpp)
  4. Call module functions in nativeForkAnd.. and related functions

Since you can modify the framework codes, steps 1 and 3 are necessary to you.

What you need to do is:

  1. Find somewhere to load the modules
  2. Call module functions in "nativeForkAnd.. functions"(platform/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp)

@RikkaW RikkaW closed this as completed Jul 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants