第二种会去读smem
unsigned check_reboot_mode(void)
{
unsigned mode[2] = {0, 0};
unsigned int mode_len = sizeof(mode);
unsigned smem_status;
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
&mode, mode_len );
if(smem_status)
{
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode/n");
return 0;
}
return mode[0];
}
unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int len)
{
struct smem_alloc_info *ainfo;
unsigned *dest = buf;
unsigned src;
unsigned size;
if (((len & 0x3) != 0) || (((unsigned)buf & 0x3) != 0))
return 1;
if (type < SMEM_FIRST_VALID_TYPE || type > SMEM_LAST_VALID_TYPE)
return 1;
/* TODO: Use smem spinlocks */
ainfo = &smem->alloc_info[type];
if (readl(&ainfo->allocated) == 0)
return 1;
if ((size = readl(&ainfo->size)) != (unsigned)len)
return 1;
src = MSM_SHARED_BASE + readl(&ainfo->offset);
for (; size > 0; src += 4, size -= 4)
*(dest++) = readl(src);
return 0;
}
这个文章只解释如何进入recovery。
Android recovery 和reboot(2)
内容版权声明:除非注明,否则皆为本站原创文章。