summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeo Hall <teo.hall@nxp.com>2018-06-21 10:07:31 -0500
committerTeo Hall <teo.hall@nxp.com>2018-06-21 10:07:31 -0500
commit5c18f544c460747daed2844714c49685ed6ce897 (patch)
tree4f1c75dc424b9b7f076d10cfed3c525a7e6c30dd
parent7bd868e4cfab71ea6f01a9bd9e8c49d1144821a2 (diff)
add msg_blk option to pass in field/debug/fuse options to scfw with a binary block. Fixed to make the image bootable Signed-off-by: Teo Hall <teo.hall@nxp.com>
-rw-r--r--iMX8QX/soc.mak3
-rw-r--r--src/imx8qxb0.c10
-rw-r--r--src/mkimage_common.h11
-rw-r--r--src/mkimage_imx8.c26
4 files changed, 48 insertions, 2 deletions
diff --git a/iMX8QX/soc.mak b/iMX8QX/soc.mak
index f09182f..0d66671 100644
--- a/iMX8QX/soc.mak
+++ b/iMX8QX/soc.mak
@@ -141,6 +141,9 @@ flash_scfw flash_b0_scfw: $(MKIMG) ahab-container.img scfw_tcm.bin
flash_secofw flash_b0_secofw: $(MKIMG) ahabfw.bin
./$(MKIMG) -soc QX -rev B0 -c -seco ahabfw.bin -out flash.bin
+flash_msg_block:
+ ./$(MKIMG) -soc QX -rev B0 -append ahab-container.img -c -scfw scfw_tcm.bin -msg_blk test_block.bin debug 0x83000000 -out flash.bin
+
flash_linux flash_b0_linux: $(MKIMG) Image fsl-imx8qxp-lpddr4-arm2.dtb
./$(MKIMG) -soc QX -rev B0 -c -ap Image a35 0x80280000 --data fsl-imx8qxp-lpddr4-arm2.dtb 0x83000000 -out flash.bin
diff --git a/src/imx8qxb0.c b/src/imx8qxb0.c
index cd652e4..af7e826 100644
--- a/src/imx8qxb0.c
+++ b/src/imx8qxb0.c
@@ -407,6 +407,13 @@ void set_image_array_entry(flash_header_v3_t *container, soc_type_t soc,
tmp_name = "DATA";
img->dst = entry;
break;
+ case MSG_BLOCK:
+ img->hab_flags |= IMG_TYPE_DATA;
+ img->hab_flags |= CORE_CA35 << BOOT_IMG_FLAGS_CORE_SHIFT;
+ img->meta = core << BOOT_IMG_META_MU_RID_SHIFT;
+ tmp_name = "MSG_BLOCK";
+ img->dst = entry;
+ break;
case SCFW:
img->hab_flags |= scfw_flags & 0xFFFF0000;
img->hab_flags |= IMG_TYPE_EXEC;
@@ -530,6 +537,7 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
case SECO:
case SCFW:
case DATA:
+ case MSG_BLOCK:
check_file(&sbuf, img_sp->filename);
tmp_filename = img_sp->filename;
set_image_array_entry(&imx_header.fhdr[container],
@@ -621,7 +629,7 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
img_sp = image_stack;
while (img_sp->option != NO_IMG) { /* stop once we reach null terminator */
if (img_sp->option == M4 || img_sp->option == AP || img_sp->option == DATA || img_sp->option == SCD ||
- img_sp->option == SCFW || img_sp->option == SECO) {
+ img_sp->option == SCFW || img_sp->option == SECO || img_sp->option == MSG_BLOCK) {
copy_file_aligned(ofd, img_sp->filename, img_sp->src, sector_size);
}
img_sp++;
diff --git a/src/mkimage_common.h b/src/mkimage_common.h
index 7396b5f..88f88c4 100644
--- a/src/mkimage_common.h
+++ b/src/mkimage_common.h
@@ -46,7 +46,8 @@ typedef enum option_type {
APPEND,
DATA,
PARTITION,
- FILEOFF
+ FILEOFF,
+ MSG_BLOCK
} option_type_t;
@@ -108,6 +109,14 @@ typedef struct {
#define CORE_CA72 5
#define CORE_SECO 6
+#define SC_R_OTP 357U
+#define SC_R_DEBUG 354U
+#define SC_R_ROM_0 236U
+
+#define MSG_DEBUG_EN SC_R_DEBUG
+#define MSG_FUSE SC_R_OTP
+#define MSG_FIELD SC_R_ROM_0
+
#define IMG_TYPE_CSF 0x01 /* CSF image type */
#define IMG_TYPE_SCD 0x02 /* SCD image type */
#define IMG_TYPE_EXEC 0x03 /* Executable image type */
diff --git a/src/mkimage_imx8.c b/src/mkimage_imx8.c
index 297ceb0..0c42340 100644
--- a/src/mkimage_imx8.c
+++ b/src/mkimage_imx8.c
@@ -530,6 +530,7 @@ int main(int argc, char **argv)
{"append", no_argument, NULL, 'A'},
{"data", required_argument, NULL, 'D'},
{"fileoff", required_argument, NULL, 'P'},
+ {"msg_blk", required_argument, NULL, 'M'},
{NULL, 0, NULL, 0}
};
@@ -737,6 +738,31 @@ int main(int argc, char **argv)
param_stack[p_idx].option = FILEOFF;
param_stack[p_idx++].dst = (uint64_t) strtoll(optarg, NULL, 0);
break;
+ case 'M':
+ fprintf(stdout, "MSG BLOCK:\t%s", optarg);
+ param_stack[p_idx].option = MSG_BLOCK;
+ param_stack[p_idx].filename = optarg;
+ if ((optind < argc && *argv[optind] != '-') && (optind+1 < argc &&*argv[optind+1] != '-' )) {
+ if (!strncmp(argv[optind], "fuse", 4))
+ param_stack[p_idx].ext = SC_R_OTP;
+ else if (!strncmp(argv[optind], "debug", 5))
+ param_stack[p_idx].ext = SC_R_DEBUG;
+ else if (!strncmp(argv[optind], "field", 5))
+ param_stack[p_idx].ext = SC_R_ROM_0;
+ else {
+ fprintf(stderr, "ERROR: MSG type not found %s\n", argv[optind+2]);
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout, "\ttype: %s", argv[optind++]);
+
+ param_stack[p_idx].entry = (uint32_t) strtoll(argv[optind++], NULL, 0);
+
+ fprintf(stdout, " addr: 0x%08" PRIx64 "\n", param_stack[p_idx++].entry);
+ } else {
+ fprintf(stderr, "\nmsg block option require THREE arguments: filename, debug/fuse/field, start address in hex\n\n");
+ exit(EXIT_FAILURE);
+ }
+ break;
case '?':
default:
/* invalid option */