summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sebastien MERMIN <jean-sebastien.mermin@nxp.com>2019-08-02 16:04:14 +0200
committerYe Li <ye.li@nxp.com>2019-08-20 18:35:15 -0700
commitc00cd78d2e80178171d2d7f8d0d1ce6e2ea41ac5 (patch)
treee4e22fd14719e7a166b04e854aab6d9a2583c458
parenta31abfabc31e0b9563920504a9793da9f5e751a4 (diff)
Add the V2X container for DXL Signed-off-by: Jean-Sebastien MERMIN <jean-sebastien.mermin@nxp.com>
-rwxr-xr-xsrc/imx8qxb0.c28
-rwxr-xr-xsrc/mkimage_common.h3
-rwxr-xr-xsrc/mkimage_imx8.c13
3 files changed, 33 insertions, 11 deletions
diff --git a/src/imx8qxb0.c b/src/imx8qxb0.c
index eeb6528..0fafde8 100755
--- a/src/imx8qxb0.c
+++ b/src/imx8qxb0.c
@@ -56,8 +56,6 @@
#define MAX_NUM_OF_CONTAINER 2
-#define FIRST_CONTAINER_HEADER_LENGTH 0x400
-
#define BOOT_IMG_META_MU_RID_SHIFT 10
#define BOOT_IMG_META_PART_ID_SHIFT 20
@@ -427,7 +425,7 @@ void set_image_array_entry(flash_header_v3_t *container, soc_type_t soc,
img->entry = 0x20000000;
break;
case AP:
- if (soc == QX && core == CORE_CA35)
+ if ((soc == QX || soc == DXL) && core == CORE_CA35)
meta = IMAGE_A35_DEFAULT_META(custom_partition);
else if (soc == QM && core == CORE_CA53)
meta = IMAGE_A53_DEFAULT_META(custom_partition);
@@ -523,7 +521,7 @@ void set_container(flash_header_v3_t *container, uint16_t sw_version,
printf("flags: 0x%x\n", container->flags);
}
-int get_container_image_start_pos(image_t *image_stack, uint32_t align)
+int get_container_image_start_pos(image_t *image_stack, uint32_t align, soc_type_t soc, uint32_t *scu_cont_hdr_off)
{
image_t *img_sp = image_stack;
/*8K total container header*/
@@ -539,6 +537,14 @@ int get_container_image_start_pos(image_t *image_stack, uint32_t align)
break;
}
+ if (soc == DXL) {
+ /* Skip SECO container, jump to V2X container */
+ if(lseek(ofd, CONTAINER_ALIGNMENT, SEEK_SET) < 0) {
+ printf("Failure Skip SECO header \n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
if(read(ofd, &header, sizeof(header)) != sizeof(header)) {
printf("Failure Read header \n");
exit(EXIT_FAILURE);
@@ -551,7 +557,14 @@ int get_container_image_start_pos(image_t *image_stack, uint32_t align)
} else if (header.num_images == 0) {
printf("image num is 0 \n");
} else {
- file_off += header.img[header.num_images - 1].size;
+ file_off = header.img[header.num_images - 1].offset + header.img[header.num_images - 1].size;
+ if (soc == DXL) {
+ file_off += CONTAINER_ALIGNMENT;
+ *scu_cont_hdr_off = CONTAINER_ALIGNMENT + ALIGN(header.length, CONTAINER_ALIGNMENT);
+ }
+ else {
+ *scu_cont_hdr_off = CONTAINER_ALIGNMENT;
+ }
file_off = ALIGN(file_off, align);
}
}
@@ -592,13 +605,15 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
fprintf(stdout, "Platform:\ti.MX8QXP B0\n");
else if (soc == QM)
fprintf(stdout, "Platform:\ti.MX8QM B0\n");
+ else if (soc == DXL)
+ fprintf(stdout, "Platform:\ti.MX8DXL A0\n");
set_imx_hdr_v3(&imx_header, dcd_len, ivt_offset, INITIAL_LOAD_ADDR_SCU_ROM, 0);
set_imx_hdr_v3(&imx_header, 0, ivt_offset, INITIAL_LOAD_ADDR_AP_ROM, 1);
printf("ivt_offset:\t%d\n", ivt_offset);
- file_off = get_container_image_start_pos(image_stack, sector_size);
+ file_off = get_container_image_start_pos(image_stack, sector_size, soc, &file_padding);
printf("container image offset (aligned):%x\n", file_off);
/* step through image stack and generate the header */
@@ -705,7 +720,6 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
do {
if (img_sp->option == APPEND) {
copy_file(ofd, img_sp->filename, 0, 0);
- file_padding += FIRST_CONTAINER_HEADER_LENGTH;
}
img_sp++;
} while (img_sp->option != NO_IMG);
diff --git a/src/mkimage_common.h b/src/mkimage_common.h
index 067d861..d0b1c10 100755
--- a/src/mkimage_common.h
+++ b/src/mkimage_common.h
@@ -69,7 +69,8 @@ typedef enum REVISION_TYPE {
typedef enum SOC_TYPE {
NONE = 0,
QX,
- QM
+ QM,
+ DXL,
} soc_type_t;
typedef struct {
diff --git a/src/mkimage_imx8.c b/src/mkimage_imx8.c
index 08f3e7d..ebf30e7 100755
--- a/src/mkimage_imx8.c
+++ b/src/mkimage_imx8.c
@@ -588,6 +588,10 @@ int main(int argc, char **argv)
soc = QX;
else if (!strncmp(optarg, "QM", 2))
soc = QM;
+ else if (!strncmp(optarg, "DXL", 3)) {
+ soc = DXL;
+ sector_size = 0x400;
+ }
else{
fprintf(stdout, "unrecognized SOC: %s \n",optarg);
exit(EXIT_FAILURE);
@@ -620,7 +624,7 @@ int main(int argc, char **argv)
break;
case 'd':
fprintf(stdout, "DCD:\t%s\n", optarg);
- if (rev == B0) {
+ if ((rev == B0) || (soc == DXL)) {
if (!strncmp(optarg, "skip", 4)) {
dcd_skip = true;
} else {
@@ -634,7 +638,7 @@ int main(int argc, char **argv)
}
break;
case 'D':
- if (rev == B0) {
+ if ((rev == B0) || (soc == DXL)) {
fprintf(stdout, "Data:\t%s\n", optarg);
param_stack[p_idx].option = DATA;
param_stack[p_idx].filename = optarg;
@@ -717,7 +721,7 @@ int main(int argc, char **argv)
ivt_offset = IVT_OFFSET_SD;
} else if (!strcmp(optarg, "nand")) {
sector_size = 0x8000;/* sector size for NAND */
- if (rev == B0) {
+ if ((rev == B0) || (soc == DXL)) {
if (optind < argc && *argv[optind] != '-') {
if (!strcmp(argv[optind], "4K")) {
sector_size = 0x1000;
@@ -862,6 +866,9 @@ int main(int argc, char **argv)
else
build_container_qm(sector_size, ivt_offset, ofname, emmc_fastboot, (image_t *) param_stack);
break;
+ case DXL:
+ build_container_qx_qm_b0(soc, sector_size, ivt_offset, ofname, emmc_fastboot, (image_t *) param_stack, dcd_skip, fuse_version, sw_version, images_hash);
+ break;
default:
fprintf(stderr, " unrecognized SOC defined");
exit(EXIT_FAILURE);