Commit b8f168346b0bd8a53c5fd7f1981e997bf4e557e4
Committed by
Stefano Babic
1 parent
b1821376ee
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
tools: imx8mimage: add ROM VERSION
The IVT offset is changed on i.MX8MN. Use ROM_VERSION to pass the v1 or v2 to mkimage. v1 is for iMX8MQ and iMX8MM v2 is for iMX8M Nano (iMX8MN) Signed-off-by: Peng Fan <peng.fan@nxp.com>
Showing 2 changed files with 23 additions and 2 deletions Side-by-side Diff
include/imximage.h
tools/imx8mimage.c
... | ... | @@ -21,6 +21,11 @@ |
21 | 21 | static uint32_t ivt_offset; |
22 | 22 | static uint32_t using_fit; |
23 | 23 | |
24 | +#define ROM_V1 1 | |
25 | +#define ROM_V2 2 | |
26 | + | |
27 | +static uint32_t rom_version = ROM_V1; | |
28 | + | |
24 | 29 | #define CSF_SIZE 0x2000 |
25 | 30 | #define HDMI_IVT_ID 0 |
26 | 31 | #define IMAGE_IVT_ID 1 |
... | ... | @@ -71,6 +76,7 @@ |
71 | 76 | {CMD_LOADER, "LOADER", "loader image", }, |
72 | 77 | {CMD_SECOND_LOADER, "SECOND_LOADER", "2nd loader image", }, |
73 | 78 | {CMD_DDR_FW, "DDR_FW", "ddr firmware", }, |
79 | + {CMD_ROM_VERSION, "ROM_VERSION", "rom version", }, | |
74 | 80 | {-1, "", "", }, |
75 | 81 | }; |
76 | 82 | |
... | ... | @@ -90,6 +96,9 @@ |
90 | 96 | token); |
91 | 97 | if (!strncmp(token, "sd", 2)) |
92 | 98 | rom_image_offset = 0x8000; |
99 | + | |
100 | + if (rom_version == ROM_V2) | |
101 | + ivt_offset = 0; | |
93 | 102 | break; |
94 | 103 | case CMD_LOADER: |
95 | 104 | ap_img = token; |
... | ... | @@ -103,6 +112,15 @@ |
103 | 112 | case CMD_DDR_FW: |
104 | 113 | /* Do nothing */ |
105 | 114 | break; |
115 | + case CMD_ROM_VERSION: | |
116 | + if (!strncmp(token, "v2", 2)) { | |
117 | + rom_version = ROM_V2; | |
118 | + ivt_offset = 0; | |
119 | + } else if (!strncmp(token, "v1", 2)) { | |
120 | + rom_version = ROM_V1; | |
121 | + } | |
122 | + break; | |
123 | + | |
106 | 124 | } |
107 | 125 | } |
108 | 126 | |
... | ... | @@ -491,8 +509,10 @@ |
491 | 509 | * Record the second bootloader relative offset in |
492 | 510 | * image's IVT reserved1 |
493 | 511 | */ |
494 | - imx_header[IMAGE_IVT_ID].fhdr.reserved1 = | |
495 | - sld_header_off - header_image_off; | |
512 | + if (rom_version == ROM_V1) { | |
513 | + imx_header[IMAGE_IVT_ID].fhdr.reserved1 = | |
514 | + sld_header_off - header_image_off; | |
515 | + } | |
496 | 516 | sld_fd = open(sld_img, O_RDONLY | O_BINARY); |
497 | 517 | if (sld_fd < 0) { |
498 | 518 | fprintf(stderr, "%s: Can't open: %s\n", |