MTK6771/6761/6762 安卓主板 dconfig 控制 mrdump 开关去除 SOCID 绑定

[DESCRIPTION]
mrdump 如果设定为 dconfig 控制(参考【FAQ13786】ramdump 如何开启?),那么 boot_para.img 生成是需要绑定 SOCID,也就是说,这个 boot_para.img 只能下载到某一台手机上,其他手机无效。
有时需要放开这个设定,方法如下

[SOLUTION]
去除 SOCID 绑定:

  1. static int mrdump_get_socid_cert(void)
  2. {
  3. ......
  4. //uint32_t sec_ret = sec_img_auth_init (DCONFIG_PART, DCONFIG_1STIMG_NAME, GET_SOCID_FROM_CERT2); //============ 注释这行代码 ============
  5. uint32_t sec_ret = sec_img_auth_init (DCONFIG_PART, DCONFIG_1STIMG_NAME, 0); //============ 增加这行代码 ============
  6. if (sec_ret) {
  7. pal_log_err("%s: dconfig image auth init failed (0x%x) ", __func__, sec_ret);
  8. return MRDUMP_SEC_IMG_AUTH_INIT_ERROR;
  9. }
  10. #endif
  11. dconfig_hdr = malloc(DCONFIG_HEADER_SIZE + DCONFIG_PLENV_SIZE);
  12. if (dconfig_hdr == NULL) {
  13. pal_log_err("%s: not enough memory ", __func__);
  14. return MRDUMP_DCONFIG_MALLOC_ERROR;
  15. }
  16. len = mboot_common_load_part(DCONFIG_PART, DCONFIG_1STIMG_NAME, (unsigned long)dconfig_hdr);
  17. if (len <= 0) {
  18. pal_log_err("%s: partition_read failed, return value %d ", __func__, len);
  19. free(dconfig_hdr);
  20. return MRDUMP_MBOOT_LOAD_PART_ERROR;
  21. }
  22. #ifdef MTK_SECURITY_SW_SUPPORT
  23. sec_ret = sec_img_auth(dconfig_hdr, len);
  24. if (sec_ret) {
  25. pal_log_err("%s: dconfig image verify failed (0x%x) ", __func__, sec_ret);
  26. free(dconfig_hdr);
  27. return MRDUMP_DCONFIG_IMG_VERIFY_ERROR;
  28. }
  29. #if 0 //============ 注释这块代码 ============
  30. uint8_t socid_cert[SOC_ID_LEN] = {0};
  31. sec_ret = get_socid_cert(socid_cert, SOC_ID_LEN);
  32. if (sec_ret) {
  33. pal_log_err("%s: unable to get socid from certed image (0x%x) ", __func__, sec_ret);
  34. free(dconfig_hdr);
  35. return MRDUMP_DCONFIG_SOCID_CERT_ERROR;
  36. }
  37. if (strncmp((char *)socid_chip, (char *)socid_cert, SOC_ID_LEN) != 0) {
  38. pal_log_err("%s: socid mismatched ", __func__);
  39. free(dconfig_hdr);
  40. return MRDUMP_DCNFIG_SOCID_MISMATCH;
  41. }
  42. #endif //============ 注释这块代码 ============
  43. #endif
  44. ......
  45. }


如果想根据分区属性(是否是 secboot,是否是 unlock)判断是否需要开 mrdump,可以增加修改:

  1. static int mrdump_get_socid_cert(void)
  2. {
  3. uint8_t *dconfig_hdr = NULL;
  4. uint8_t *plenv = NULL;
  5. int len = 0;

  6. #ifdef MTK_SECURITY_SW_SUPPORT
  7. #if 1 //============ 增加这块代码 ============
  8. unsigned int policy_entry_idx = 0;
  9. unsigned int img_auth_required = 0;

  10. seclib_image_buf_init();
  11. policy_entry_idx = get_policy_entry_idx(“boot_para”);
  12. img_auth_required = get_vfy_policy(policy_entry_idx);
  13. seclib_image_buf_free();
  14. if (!img_auth_required) /* 这个 img_auth_required 只有 chip secboot、unlock 状态对应到 boot_para 的 security 属性得到。 */
  15. return MRDUMP_SUCCESS_ENABLE;
  16. #endif //============ 增加这块代码 ============
  17. ......
  18. }

更多详细资料与相关方案了解,可咨询 ·新移科技技术论坛 - Powered by Discuz!

MTK核心板|MTK开发板|MTK模块|4G核心板|4G模块|5G核心板|5G模块|安卓核心板|安卓模块|高通核心板-深圳市新移科技有限公司・与您一同创建万物互联的世界

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章