void set_p2u(int mode) { if(mode == 1) { if(strlen(g_CMDLINE) + strlen(" printk.disable_uart=1") + 1 > sizeof(g_CMDLINE)) { printf("command line is too long, will not set printk_on\n"); fastboot_info("command line is too long, will not set printk_on"); } else { sprintf(g_CMDLINE, "%s %s", g_CMDLINE, "printk.disable_uart=0"); fastboot_info("printk to uart is on!"); } } else if(mode == 2) { if(strlen(g_CMDLINE) + strlen(" printk.disable_uart=1") + 1 > sizeof(g_CMDLINE)) { printf("command line is too long, will not set printk_off\n"); fastboot_info("command line is too long, will not set printk_off"); } else { sprintf(g_CMDLINE, "%s %s", g_CMDLINE, "printk.disable_uart=1"); fastboot_info("printk to uart is off!"); } } }
void tboot_config_keywords(void) { int i; if (!tboot_config) { pr_error("tboot config wasn't init.\n"); return; } fastboot_info("\n"); fastboot_info("Keyword Current value\n"); fastboot_info("---------------------------------\n"); for (i = 0; tc_keys[i]; i++) { char *buf; int len = 0; int left = 0; if (asprintf(&buf, "%-20s%s\n", tc_keys[i], tboot_config_get(tc_keys[i])) == -1) continue; fastboot_info(buf); free(buf); } fastboot_info("\n"); fastboot_okay(""); }
int fastboot_oem_lock(const char *arg, void *data, unsigned sz) { int ret = B_OK; char msg[128] = {0}; int inFactory = 0; int requireConfirmation = 0; ret = sec_is_in_factory(&inFactory); if (ret) return ret; requireConfirmation = inFactory ? 0 : 1; lock_warranty(); while(1) { if(mtk_detect_key(MT65XX_MENU_SELECT_KEY) || !requireConfirmation) //VOL_UP { fastboot_info("Start lock flow\n"); //Invoke security check after confiming "yes" by user ret = fastboot_oem_lock_chk(); if(ret != B_OK) { sprintf(msg, "\nlock failed - Err:0x%x \n", ret); video_printf("lock failed...return to fastboot in 3s\n"); mdelay(3000); fastboot_boot_menu(); fastboot_fail(msg); } else { video_printf("lock Pass...return to fastboot in 3s\n"); mdelay(3000); fastboot_boot_menu(); fastboot_okay(""); } break; } else if(mtk_detect_key(MT65XX_MENU_OK_KEY))//VOL_DOWN { video_printf("return to fastboot in 3s\n"); mdelay(3000); fastboot_boot_menu(); fastboot_okay(""); break; } else { //If we press other keys, discard it. } } return ret; }
void cmd_oem_p2u(const char *arg, void *data, unsigned sz) { if(!strncmp(arg, " on", strlen(" on"))) { has_set_p2u = 1; } else if(!strncmp(arg, " off", strlen(" off"))) { has_set_p2u = 2; } else { has_set_p2u = 0; fastboot_info("unknown argument"); } fastboot_okay(""); }
void cmd_continue(const char *arg, void *data, unsigned sz) { g_boot_mode = NORMAL_BOOT; if(has_set_p2u) { set_p2u(has_set_p2u); fastboot_info("phone will continue boot up after 5s..."); fastboot_okay(""); mdelay(5000); } else { fastboot_okay(""); } udc_stop(); mtk_wdt_init(); //re-open wdt /*Will not return*/ boot_linux_from_storage(); }
void fastboot_oem_query_lock_state(const char *arg, void *data, unsigned sz) { #define LKS_RESP_MAX_SIZE 64 int ret = B_OK; int lock_state; char msg[LKS_RESP_MAX_SIZE] = {0}; ret = sec_query_device_lock(&lock_state); if (ret != B_OK) { snprintf(msg, LKS_RESP_MAX_SIZE, "cannot get lks (ret = 0x%x)", ret); msg[LKS_RESP_MAX_SIZE - 1] = '\0'; /* prevent msg from not being ended with '\0'*/ fastboot_fail(msg); } else { snprintf(msg, LKS_RESP_MAX_SIZE, "lks = %d", lock_state); msg[LKS_RESP_MAX_SIZE - 1] = '\0'; /* prevent msg from not being ended with '\0'*/ fastboot_info(msg); fastboot_okay(""); } }
void cmd_getvar(const char *arg, void *data, unsigned sz) { struct fastboot_var *var; char response[MAX_RSP_SIZE]; if(!strcmp(arg, "all")){ for (var = varlist; var; var = var->next){ snprintf(response, MAX_RSP_SIZE,"\t%s: %s", var->name, var->value); fastboot_info(response); } fastboot_okay("Done!!"); return; } for (var = varlist; var; var = var->next) { if (!strcmp(var->name, arg)) { fastboot_okay(var->value); return; } } fastboot_okay(""); }