MT6771/6761/6762 dconfig控制mrdump开关去除SOCID绑定
原创
©著作权归作者所有:来自51CTO博客作者Newmobi的原创作品,请联系作者获取转载授权,否则将追究法律责任
[DESCRIPTION]
mrdump如果设定为dconfig控制(参考【FAQ13786】ramdump如何开启?),那么boot_para.img生成是需要绑定SOCID,也就是说,这个boot_para.img只能下载到某一台手机上,其他手机无效。
有时需要放开这个设定,方法如下
[SOLUTION]
去除SOCID绑定:
static int mrdump_get_socid_cert(void)
{
......
<font color="Red"> //uint32_t sec_ret = sec_img_auth_init(DCONFIG_PART, DCONFIG_1STIMG_NAME, GET_SOCID_FROM_CERT2); //============注释这行代码============
uint32_t sec_ret = sec_img_auth_init(DCONFIG_PART, DCONFIG_1STIMG_NAME, 0); //============增加这行代码============</font>
if (sec_ret) {
pal_log_err("%s: dconfig image auth init failed (0x%x)\n", __func__, sec_ret);
return MRDUMP_SEC_IMG_AUTH_INIT_ERROR;
}
#endif
dconfig_hdr = malloc(DCONFIG_HEADER_SIZE + DCONFIG_PLENV_SIZE);
if (dconfig_hdr == NULL) {
pal_log_err("%s: not enough memory\n", __func__);
return MRDUMP_DCONFIG_MALLOC_ERROR;
}
len = mboot_common_load_part(DCONFIG_PART, DCONFIG_1STIMG_NAME, (unsigned long)dconfig_hdr);
if (len <= 0) {
pal_log_err("%s: partition_read failed, return value %d\n", __func__, len);
free(dconfig_hdr);
return MRDUMP_MBOOT_LOAD_PART_ERROR;
}
#ifdef MTK_SECURITY_SW_SUPPORT
sec_ret = sec_img_auth(dconfig_hdr, len);
if (sec_ret) {
pal_log_err("%s: dconfig image verify failed (0x%x)\n", __func__, sec_ret);
free(dconfig_hdr);
return MRDUMP_DCONFIG_IMG_VERIFY_ERROR;
}
<font color="Red">#if 0 //============注释这块代码============
uint8_t socid_cert[SOC_ID_LEN] = {0};
sec_ret = get_socid_cert(socid_cert, SOC_ID_LEN);
if (sec_ret) {
pal_log_err("%s: unable to get socid from certed image (0x%x)\n", __func__, sec_ret);
free(dconfig_hdr);
return MRDUMP_DCONFIG_SOCID_CERT_ERROR;
}
if (strncmp((char *)socid_chip, (char *)socid_cert, SOC_ID_LEN) != 0) {
pal_log_err("%s: socid mismatched\n", __func__);
free(dconfig_hdr);
return MRDUMP_DCNFIG_SOCID_MISMATCH;
}
#endif //============注释这块代码============</font>
#endif
......
}
如果想根据分区属性(是否是secboot,是否是unlock)判断是否需要开mrdump,可以增加修改:
static int mrdump_get_socid_cert(void)
{
uint8_t *dconfig_hdr = NULL;
uint8_t *plenv = NULL;
int len = 0;
#ifdef MTK_SECURITY_SW_SUPPORT
<font color="Red">#if 1 //============增加这块代码============
unsigned int policy_entry_idx = 0;
unsigned int img_auth_required = 0;
seclib_image_buf_init();
policy_entry_idx = get_policy_entry_idx(“boot_para”);
img_auth_required = get_vfy_policy(policy_entry_idx);
seclib_image_buf_free();
if (!img_auth_required) /* 这个img_auth_required只有chip secboot、unlock状态对应到boot_para的security属性得到。 */
return MRDUMP_SUCCESS_ENABLE;
#endif //============增加这块代码============</font>
......
}
以上就是”MT6771/6761/6762 dconfig控制mrdump开关去除SOCID绑定“的内容,想了解更多MTK技术资料可查看深圳市新移科技有限公司官网论坛。