[RK3399][Android6.0] 系统重启支持恢复出厂设置参数

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

reboot的boot flag请看文章  [RK3399][Android6.0] 系统支持的重启模式 

注意到boot mode table中有对wipe data的支持(BOOT_WIPEDATA)

enum {
    BOOT_NORMAL = 0, /* normal boot */
    BOOT_LOADER,     /* enter loader rockusb mode */
    BOOT_MASKROM,    /* enter maskrom rockusb mode (not support now) */
    BOOT_RECOVER,    /* enter recover */
    BOOT_NORECOVER,  /* do not enter recover */
    BOOT_SECONDOS,   /* boot second OS (not support now)*/
    BOOT_WIPEDATA,   /* enter recover and wipe data. */
    BOOT_WIPEALL,    /* enter recover and wipe all data. */
    BOOT_CHECKIMG,   /* check firmware img with backup part(in loader mode)*/
    BOOT_FASTBOOT,   /* enter fast boot mode */
    BOOT_SECUREBOOT_DISABLE,
    BOOT_CHARGING,   /* enter charge mode */
    BOOT_MAX         /* MAX VALID BOOT TYPE.*/
};

rk对这个没有做全,只在uboot中(board_fbt_get_reboot_type())判断有没有wipe data的boot flag, 而在kernel中没有去记录保存下来.
下面是添加的改动,修改后就可以支持如下命令直接恢复出厂设置了.

reboot wipedata

kris@eco:~/rk3288/kernel$ g df arch/arm/mach-rockchip/common.c
diff --git a/arch/arm/mach-rockchip/common.c b/arch/arm/mach-rockchip/common.c
index 107b58c..01552f3 100755
--- a/arch/arm/mach-rockchip/common.c
+++ b/arch/arm/mach-rockchip/common.c
@@ -264,7 +264,10 @@ void rockchip_restart_get_boot_mode(const char *cmd, u32 *f
                else if (!strcmp(cmd, "charge")) {
                        *flag = SYS_LOADER_REBOOT_FLAG + BOOT_CHARGING;
                        *mode = BOOT_MODE_CHARGE;
-               }
+               } else if (!strcmp(cmd, "wipedata")) {
+                       *flag = SYS_LOADER_REBOOT_FLAG + BOOT_WIPEDATA;
+               }
        } else {

这样比文章 [RK3288][Android6.0] 调试笔记 — 命令行恢复出厂设置 的方式少执行一步了.

你可能感兴趣的:(子类__Other,子类__Recovery)