Skip to content

Commit 2cbf613

Browse files
committed
Revert "use apd to run system"
This reverts commit 1022687.
1 parent 1022687 commit 2cbf613

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

kernel/patch/android/userd.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#define AP_LOG_DIR AP_DIR "log/"
4444
#define AP_MAGISKPOLICY_PATH AP_BIN_DIR "magiskpolicy"
4545
#define MAGISK_SCTX "u:r:magisk:s0"
46-
#define APD_BIN "/data/adb/apd"
46+
#define USER_INIT_SH_PATH "/dev/user_init.sh"
4747

4848
#include "gen/user_init.c"
4949

@@ -57,21 +57,21 @@ static const char ORIGIN_RC_FILES[][64] = {
5757
static const char user_rc_data[] = { //
5858
"\n"
5959
"on early-init\n"
60-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s early-init\n"
60+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s early-init\n"
6161
"on init\n"
62-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s init\n"
62+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s init\n"
6363
"on late-init\n"
64-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s late-init\n"
64+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s late-init\n"
6565
"on post-fs-data\n"
66-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s post-fs-data\n"
66+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s post-fs-data\n"
6767
"on nonencrypted\n"
68-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s services\n"
68+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s services\n"
6969
"on property:vold.decrypt=trigger_restart_framework\n"
70-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s services\n"
70+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s services\n"
7171
"on property:sys.boot_completed=1\n"
72-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s boot-completed\n"
73-
" exec -- " SUPERCMD " su exec " APD_BIN " -s %s uid-listener &\n"
72+
" exec -- " SUPERCMD " su exec " USER_INIT_SH_PATH " %s boot-completed\n"
7473
" rm " REPLACE_RC_FILE "\n"
74+
" rm " USER_INIT_SH_PATH "\n"
7575
" exec -- " SUPERCMD " su -c \"mv -f " DEV_LOG_DIR " " AP_LOG_DIR "\"\n"
7676
""
7777
};
@@ -122,6 +122,11 @@ static loff_t kernel_write_file(const char *path, const void *data, loff_t len,
122122
return off;
123123
}
124124

125+
static void pre_user_exec_init()
126+
{
127+
log_boot("event: %s\n", EXTRA_EVENT_PRE_EXEC_INIT);
128+
kernel_write_file(USER_INIT_SH_PATH, user_init, sizeof(user_init), 0700);
129+
}
125130

126131
static void pre_init_second_stage()
127132
{
@@ -157,6 +162,7 @@ static void handle_before_execve(hook_local_t *hook_local, char **__user u_filen
157162
if (!first_user_init_executed) {
158163
first_user_init_executed = 1;
159164
log_boot("exec first user init: %s\n", filename);
165+
pre_user_exec_init();
160166
}
161167

162168
if (!init_second_stage_executed) {

0 commit comments

Comments
 (0)