summaryrefslogtreecommitdiff
path: root/tools/imx8image.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-11-05 09:53:31 +0000
committerStefano Babic <sbabic@denx.de>2018-11-06 11:24:10 +0100
commit47f7a9def781c46a956366dc40a6674ea0609c59 (patch)
tree7e521a8fda1a051b17c80c1c98bfee5048c4cbef /tools/imx8image.c
parenta9f7f1c58535af68efda0127322de30a33dd31b7 (diff)
downloadu-boot-47f7a9def781c46a956366dc40a6674ea0609c59.tar.gz
u-boot-47f7a9def781c46a956366dc40a6674ea0609c59.tar.bz2
u-boot-47f7a9def781c46a956366dc40a6674ea0609c59.zip
tools: imx8image: flatten container header only when creating container
If there is no CONTAINER entry, there is no need to flatten container header. Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'tools/imx8image.c')
-rw-r--r--tools/imx8image.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/imx8image.c b/tools/imx8image.c
index ac89c821c9..6e8ac464e7 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -914,17 +914,19 @@ static int build_container(soc_type_t soc, uint32_t sector_size,
exit(EXIT_FAILURE);
}
- /* Note: Image offset are not contained in the image */
- tmp = flatten_container_header(&imx_header, container + 1, &size,
- file_padding);
- /* Write image header */
- if (write(ofd, tmp, size) != size) {
- fprintf(stderr, "error writing image hdr\n");
- exit(EXIT_FAILURE);
- }
+ if (container >= 0) {
+ /* Note: Image offset are not contained in the image */
+ tmp = flatten_container_header(&imx_header, container + 1,
+ &size, file_padding);
+ /* Write image header */
+ if (write(ofd, tmp, size) != size) {
+ fprintf(stderr, "error writing image hdr\n");
+ exit(EXIT_FAILURE);
+ }
- /* Clean-up memory used by the headers */
- free(tmp);
+ /* Clean-up memory used by the headers */
+ free(tmp);
+ }
/*
* step through the image stack again this time copying