Recovery 流程

recovery::

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

system/core/rootdir/init.rc
1 service pre-recovery /system/bin/uncrypt
class main
disabled
oneshot

bootable/recovery/uncrypt/uncrypt.c
1 int main(int argc, char** argv)
2 reboot_to_recovery();
1 reboot_to_recovery
2 property_set("sys.powerctl", "reboot,recovery");


system/core/rootdir/init.rc
1 on property:sys.powerctl=*
powerctl ${sys.powerctl}

system/core/init/keywords.h
1 KEYWORD(powerctl, COMMAND, 1, do_powerctl)

system/core/init/builtins.c
1 int do_powerctl(int nargs, char **args)
2 cmd = ANDROID_RB_RESTART2;
return android_reboot(cmd, 0, reboot_target);

system/core/libcutils/android_reboot.c
1 int android_reboot(int cmd, int flags UNUSED, char *arg)
2 ret = syscall(__NR_reboot,LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,LINUX_REBOOT_CMD_RESTART2, arg);

bionic/libc/arch-arm/syscalls/__reboot.S
1 #include <private/bionic_asm.h>
1 ldr r7, =__NR_reboot

bionic/libc/include/sys/glibc-syscalls.h
1 #define SYS_reboot __NR_reboot

kernel-3.10/kernel/sys.c
1 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,void __user *, arg)
2 kernel_restart(buffer);
1 void kernel_restart(char *cmd)
2 machine_restart(cmd);

kernel-3.10/arch/arm/kernel/process.c
1 void machine_restart(char *cmd)
2 arm_pm_restart(reboot_mode, cmd);

kernel-3.10/drivers/misc/mediatek/mach/mt6580/core.c
1 DT_MACHINE_START(MT6580_DT, "MT6580")
2 .restart = arm_machine_restart,

1 void arm_machine_restart(char mode, const char *cmd)
2 arch_reset(mode, cmd);

kernel-3.10/drivers/misc/mediatek/mach/system.c
1 void arch_reset(char mode, const char *cmd)
2 rtc_mark_recovery();

kernel-3.10/drivers/misc/mediatek/rtc/mtk_rtc_common.c
1 void rtc_mark_recovery(void)
2 hal_rtc_mark_mode("recv");

kernel-3.10/drivers/misc/mediatek/rtc/mt6580/mtk_rtc_hal.c
1 rtc_write(RTC_PDN1, pdn1 | RTC_PDN1_FAC_RESET);

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wilber_bai@hotmail.com

文章标题:Recovery 流程

文章字数:323

本文作者:风沉殇史

发布时间:2017-12-12, 12:12:12

最后更新:2018-06-21, 16:20:40

原始链接:http://wilber.win/posts/a4ad8f66/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏