void platform_error_handler(void) { /* if log is disabled, re-init log port and enable it */ if (log_status() == 0) { mtk_uart_init(UART_SRC_CLK_FRQ, CFG_LOG_BAUDRATE); log_ctrl(1); } print("%s preloader fatal error...\n", MOD); sec_util_brom_download_recovery_check(); /* enter emergency download mode */ #if CFG_EMERGENCY_DL_SUPPORT platform_emergency_download(CFG_EMERGENCY_DL_TIMEOUT_MS); #endif while(1); }
void sec_boot_check (void) { //if(CFG_STORAGE_DEVICE == NAND) { #if SEC_ENV_ENABLE U32 g_verify_time_begin = get_timer (0);; U32 g_verify_time_end; U32 ret = 0; BOOL sw_secure_boot_support = FALSE; /* --------------------- */ /* init image auth key */ /* --------------------- */ if (SEC_OK != img_auth_init()) { SMSG("[%s] IMAGE Auth Key Init Fail\n",MOD); ret = ERR_IMG_INIT_KEY_FAIL; goto _fail; } if ((secroimg != NULL)&&(SW_SUPPORT_ENABLE == (secroimg->m_andro.sw_sec_boot.flashtool_unlock_support))) { sw_secure_boot_support = TRUE; } else { if(FALSE == seclib_sec_boot_enabled(TRUE)) { SMSG("[%s] Don't check\n",MOD); return ; } } if (SEC_OK != sec_boot_img_check(sw_secure_boot_support, secroimg->m_andro.sw_sec_boot.boot_chk_2nd_loader, SBOOT_PART_UBOOT)) { goto _fail; } if (SEC_OK != sec_boot_img_check(sw_secure_boot_support, secroimg->m_andro.sw_sec_boot.boot_chk_logo, SBOOT_PART_LOGO)) { goto _fail; } #if VERIFY_PART_CUST if (SEC_OK != sec_boot_img_check(TRUE, SW_SEC_BOOT_CHECK_IMAGE, VERIFY_PART_CUST_NAME)) { goto _fail; } #endif /* calculate verification time */ g_verify_time_end = get_timer (g_verify_time_begin); SMSG ("\n[%s] Consume (%d) ms\n", MOD, g_verify_time_end); return ; _fail : SMSG ("[%s] Fail (0x%x)\n",MOD,ret); ASSERT(0); _brom_recovery_check : SMSG ("[%s] Fail (0x%x)\n",MOD,ret); sec_util_brom_download_recovery_check(); #endif // SEC_ENV_ENABLE } // if(CFG_STORAGE_DEVICE == NAND) }