Lines Matching +full:dcd +full:- +full:override
1 // SPDX-License-Identifier: GPL-2.0+
13 static int container = -1;
54 {-1, "", "", },
64 {-1, "", "", },
74 {-1, "", "Invalid", },
147 fprintf(stderr, "Error: %s[%d] - Invalid command (%s)\n", name, lineno, token); in parse_cfg_fld()
243 fprintf(stderr, "Error: %s - Can't open cfg file\n", name); in parse_cfg_file()
349 align = ALIGN(size, align) - size; in copy_file_aligned()
411 pad = pad - size; in copy_file()
413 if (write(ifd, (char *)&zero, 4 - tail) != 4 - tail) { in copy_file()
429 pad -= todo; in copy_file()
477 if (img->size == 0) in set_image_hash()
482 sha%dsum tmp_pad; rm -f tmp_pad", in set_image_hash()
483 img->size, filename, hash_type); in set_image_hash()
487 img->hab_flags |= IMG_FLAG_HASH_SHA256; in set_image_hash()
490 img->hab_flags |= IMG_FLAG_HASH_SHA384; in set_image_hash()
493 img->hab_flags |= IMG_FLAG_HASH_SHA512; in set_image_hash()
501 memset(img->hash, 0, HASH_MAX_LEN); in set_image_hash()
515 ret = sscanf(hash + 2 * i, "%02hhx", &img->hash[i]); in set_image_hash()
530 uint64_t entry = image_stack->entry; in set_image_array_entry()
531 uint64_t core = image_stack->ext; in set_image_array_entry()
534 option_type_t type = image_stack->option; in set_image_array_entry()
535 boot_img_t *img = &container->img[container->num_images]; in set_image_array_entry()
537 img->offset = offset; /* Is re-adjusted later */ in set_image_array_entry()
538 img->size = size; in set_image_array_entry()
544 img->hab_flags |= IMG_TYPE_SECO; in set_image_array_entry()
545 img->hab_flags |= CORE_SECO << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
547 img->dst = 0x20C00000; in set_image_array_entry()
548 img->entry = 0x20000000; in set_image_array_entry()
563 img->hab_flags |= IMG_TYPE_EXEC; in set_image_array_entry()
565 img->hab_flags |= CORE_CA53 << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
567 img->dst = entry; in set_image_array_entry()
568 img->entry = entry; in set_image_array_entry()
569 img->meta = meta; in set_image_array_entry()
586 img->hab_flags |= IMG_TYPE_EXEC; in set_image_array_entry()
587 img->hab_flags |= core << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
593 img->dst = entry; in set_image_array_entry()
594 img->entry = entry; in set_image_array_entry()
595 img->meta = meta; in set_image_array_entry()
599 img->hab_flags |= IMG_TYPE_DATA; in set_image_array_entry()
600 img->hab_flags |= CORE_CA35 << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
602 img->dst = entry; in set_image_array_entry()
605 img->hab_flags |= IMG_TYPE_DATA; in set_image_array_entry()
606 img->hab_flags |= CORE_CA35 << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
607 img->meta = core << BOOT_IMG_META_MU_RID_SHIFT; in set_image_array_entry()
609 img->dst = entry; in set_image_array_entry()
612 img->hab_flags |= scfw_flags & 0xFFFF0000; in set_image_array_entry()
613 img->hab_flags |= IMG_TYPE_EXEC; in set_image_array_entry()
614 img->hab_flags |= CORE_SC << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
616 img->dst = 0x1FFE0000; in set_image_array_entry()
617 img->entry = 0x1FFE0000; in set_image_array_entry()
619 /* Lets add the DCD now */ in set_image_array_entry()
621 container->num_images++; in set_image_array_entry()
622 img = &container->img[container->num_images]; in set_image_array_entry()
623 img->hab_flags |= IMG_TYPE_DCD_DDR; in set_image_array_entry()
624 img->hab_flags |= CORE_SC << BOOT_IMG_FLAGS_CORE_SHIFT; in set_image_array_entry()
627 img->offset = offset + img->size; in set_image_array_entry()
628 img->entry = read_dcd_offset(tmp_filename); in set_image_array_entry()
629 img->dst = img->entry - 1; in set_image_array_entry()
639 container->num_images++; in set_image_array_entry()
645 container->sig_blk_hdr.tag = 0x90; in set_container()
646 container->sig_blk_hdr.length = sizeof(sig_blk_hdr_t); in set_container()
647 container->sw_version = sw_version; in set_container()
648 container->padding = alignment; in set_container()
649 container->fuse_version = fuse_version; in set_container()
650 container->flags = flags; in set_container()
651 fprintf(stdout, "container flags: 0x%x\n", container->flags); in set_container()
663 while (img_sp->option != NO_IMG) { in get_container_image_start_pos()
664 if (img_sp->option == APPEND) { in get_container_image_start_pos()
665 fd = fopen(img_sp->filename, "r"); in get_container_image_start_pos()
667 fprintf(stderr, "Fail open first container file %s\n", img_sp->filename); in get_container_image_start_pos()
684 header.img[header.num_images - 1].size; in get_container_image_start_pos()
697 flash_header_v3_t *fhdr_v3 = &imxhdr->fhdr[cont_id]; in set_imx_hdr_v3()
700 fhdr_v3->tag = IVT_HEADER_TAG_B0; in set_imx_hdr_v3()
701 fhdr_v3->version = IVT_VERSION_B0; in set_imx_hdr_v3()
716 flash_header_v3_t *container = &imx_header->fhdr[i]; in flatten_container_header()
718 container->sig_blk_offset = HEADER_IMG_ARRAY_OFFSET + in flatten_container_header()
719 container->num_images * IMG_ARRAY_ENTRY_SIZE; in flatten_container_header()
721 container->length = HEADER_IMG_ARRAY_OFFSET + in flatten_container_header()
722 (IMG_ARRAY_ENTRY_SIZE * container->num_images) + in flatten_container_header()
729 file_offset + size + container->length - in flatten_container_header()
732 size += ALIGN(container->length, container->padding); in flatten_container_header()
745 flash_header_v3_t *container = &imx_header->fhdr[i]; in flatten_container_header()
746 uint32_t container_start_offset = ptr - flat; in flatten_container_header()
752 for (j = 0; j < container->num_images; j++) { in flatten_container_header()
753 container->img[j].offset -= in flatten_container_header()
757 for (j = 0; j < container->num_images; j++) in flatten_container_header()
758 append(ptr, &container->img[j], sizeof(boot_img_t)); in flatten_container_header()
760 append(ptr, &container->sig_blk_hdr, sizeof(sig_blk_hdr_t)); in flatten_container_header()
763 ptr += ALIGN(container->length, container->padding) - in flatten_container_header()
764 container->length; in flatten_container_header()
785 int container = -1; in build_container()
810 while (img_sp->option != NO_IMG) { in build_container()
811 switch (img_sp->option) { in build_container()
822 check_file(&sbuf, img_sp->filename); in build_container()
823 tmp_filename = img_sp->filename; in build_container()
828 img_sp->src = file_off; in build_container()
839 check_file(&sbuf, img_sp->filename); in build_container()
840 tmp_filename = img_sp->filename; in build_container()
847 img_sp->src = file_off; in build_container()
872 * override the flags for scfw in current container in build_container()
875 scfw_flags = img_sp->entry & 0xFFFF0000; in build_container()
878 if (file_off > img_sp->dst) { in build_container()
882 if (img_sp->dst != ALIGN(img_sp->dst, sector_size)) { in build_container()
886 file_off = img_sp->dst; in build_container()
893 custom_partition = img_sp->entry; in build_container()
896 fprintf(stderr, "unrecognized option in input stack (%d)\n", img_sp->option); in build_container()
905 if (img_sp->option == APPEND) { in build_container()
906 copy_file(ofd, img_sp->filename, 0, 0); in build_container()
910 } while (img_sp->option != NO_IMG); in build_container()
930 /* Clean-up memory used by the headers */ in build_container()
939 while (img_sp->option != NO_IMG) { in build_container()
940 if (img_sp->option == M40 || img_sp->option == M41 || in build_container()
941 img_sp->option == AP || img_sp->option == DATA || in build_container()
942 img_sp->option == SCD || img_sp->option == SCFW || in build_container()
943 img_sp->option == SECO || img_sp->option == MSG_BLOCK) { in build_container()
944 copy_file_aligned(ofd, img_sp->filename, img_sp->src, in build_container()
961 fprintf(stdout, "parsing %s\n", mparams->imagename); in imx8image_copy_image()
962 parse_cfg_file(img_sp, mparams->imagename); in imx8image_copy_image()