hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
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
#include <stdio.h>
#include "rkboot_control.h"
#include <string.h>
int main(int argc, char *argv[]){
    //1. bootsucceed
    //2. bootactivity
    //3. wipe_userdata reboot/ wipe_userdata
    if(argc == 1){
        printf("Error: bootcontrol parameter error.\n");
        printf("rkboot_control now.\n");
        printf("rkboot_control other.\n");
        printf("rkboot_control wipe_userdata.\n");
        printf("rkboot_control wipe_userdata reboot.\n");
        struct AvbABData info;
        readMisc(&info);
        display(info);
        return -1;
    }
 
    if(strcmp(argv[1], "now") == 0){
        printf("set now slot to succeed.\n");
        return setSlotSucceed();
    }else if(strcmp(argv[1], "other") == 0){
        printf("set other slot to activity.\n");
        return setSlotActivity();
    }else if(strcmp(argv[1], "wipe_userdata") == 0){
        printf("wipe_userdata.\n");
        if(argc == 3 && strcmp(argv[2], "reboot") == 0){
            return wipe_userdata(true);
        }else{
            return wipe_userdata(false);
        }
    }
    
    return 0;
}