改为 在压缩前添加 oem_ext 但固件启动不起来

This commit is contained in:
2024-10-28 19:37:39 +08:00
parent 538d4b4ac4
commit 8b0435853d
8 changed files with 128 additions and 100 deletions

View File

@@ -764,7 +764,7 @@ e_err:
* @param hdr: pointer to save header information.
* @return ERR_FAIL: failed; ERR_OK: succeed.
*/
static uint32_t mtd_get_hdr(uint8_t part_num, imgHdr *hdr)
uint32_t mtd_get_hdr(uint8_t part_num, imgHdr *hdr)
{
int fd;
static uint8_t last_part = PART_NUM_INVALID;

View File

@@ -418,10 +418,13 @@ uint32_t board_load_oem_cfg()
g_board_cpu_idx = cpu_get_mhartid();
#endif
iot_printf("start load oemcfg\n");
iot_printf("%s:%d\n"__FILE__,__LINE__);
ret = iot_oem_get_cfg(&oemcfg);
if (ret != ERR_OK) {
goto out;
}
iot_printf("%s:%d\n"__FILE__,__LINE__);
g_board_info.board_id = oemcfg->board_id;
IOT_ASSERT(oemcfg->board_cfg_ver == IOT_OEM_VER_V1);
@@ -437,16 +440,19 @@ uint32_t board_load_oem_cfg()
goto out;
}
// 读取oem的差分部分
iot_printf("%s:%d\n"__FILE__,__LINE__);
ret = iot_oem_read_mtd(buf_oem, oem_part_size - oem_diff_offset,
oem_diff_offset);
if (ret != ERR_OK) {
goto out;
}
iot_printf("%s:%d\n"__FILE__,__LINE__);
ret = ERR_FAIL;
hw_ver_cal = iot_board_hw_version_hex();
/* if hw_version is not written during production test, it defaults to f */
if (hw_ver_cal == 0xffffffff) {
iot_printf("%s:%d\n"__FILE__,__LINE__);
hw_ver_cal = 0;
}
// ptr_rc 是 iot_board_info_v1_t 类型的指针
@@ -457,7 +463,7 @@ uint32_t board_load_oem_cfg()
hdr_check:
if (hw_ver_cal != hw_ver_rc) {
if (ptr_hdr->have_next == 0) {
if(read_oem_ext_flag ||
if(read_oem_ext_flag ||
iot_oem_read_mtd_ext(&buf_oem[offset],BOARD_OEM_INFO_SIZE_MAX-offset)){
goto out;
} else {