- frameworks/base/core/java/android/os/Power.java android_os_Power_reboot()
- frameworks/base/core/jni/android_os_Power.cpp
reboot() - bionic/libc/unistd/reboot.c
reboot(__reboot) - bionic/libc/arch-arm/syscalls/__reboot.S
- kernel/arch/sh/kernel/reboot.c
struct machine_ops machine_ops = {
.power_off = native_machine_power_off,
.shutdown = native_machine_shutdown,
.restart = native_machine_restart,
.halt = native_machine_halt,
} - bionic/libc/include/sys/linux-syscalls.h
#define __NR_reboot (__NR_SYSCALL_BASE + 88) - ./arch/arm/kernel/calls.S
__NR_reboot 就是系统函数sys_reboot - ./kernel/sys.c
kernel_restart
{
kernel_restart_prepare(cmd);
if (!cmd)
printk(KERN_EMERG "Restarting system.\n");
else
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
kmsg_dump(KMSG_DUMP_RESTART);
machine_restart(cmd);
}
void kernel_restart_prepare(char *cmd)
{
blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
system_state = SYSTEM_RESTART;
usermodehelper_disable();
device_shutdown();
syscore_shutdown();
}
void kernel_power_off(void)
{
kernel_shutdown_prepare(SYSTEM_POWER_OFF);
if (pm_power_off_prepare)
pm_power_off_prepare();
disable_nonboot_cpus();
syscore_shutdown();
printk(KERN_EMERG "Power down.\n");
kmsg_dump(KMSG_DUMP_POWEROFF);
machine_power_off();
} - kernel/arch/arm/kernel/process.c
void machine_shutdown(void)
{
#ifdef CONFIG_SMP
smp_send_stop();
#endif
}
void machine_halt(void)
{
machine_shutdown();
while (1);
}
void machine_power_off(void)
{
machine_shutdown();
if (pm_power_off)
pm_power_off();
}
void machine_restart(char *cmd)
{
machine_shutdown();
arm_pm_restart(reboot_mode, cmd);
} - If you would like to trace power_off
kernel/driver/mfd/xxxx_poweroff.c
You will see:
pm_power_off=xxxx_poweroff
2012年6月1日 星期五
android reboot process
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言