- ret = write_fcb(buf, fcb_start_block);
- free(buf);
- if (ret) {
- printf("Failed to write FCB to block %lu\n", fcb_start_block);
- return ret;
- }
+ if (fw1_start_block == fcb_start_block) {
+ printf("Programming FCB + U-Boot image from %p to block %lu @ %08llx\n",
+ buf, fw1_start_block, (u64)fw1_start_block * mtd->erasesize);
+ ret = tx53_prog_uboot(buf, fw1_start_block, fw1_skip, size,
+ max_len1);
+ } else {
+ printf("Programming U-Boot image from %p to block %lu @ %08llx\n",
+ buf, fw1_start_block, (u64)fw1_start_block * mtd->erasesize);
+ ret = tx53_prog_uboot(buf, fw1_start_block, fw1_skip, size,
+ max_len1);
+ if (ret)
+ goto out;