1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

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>
This commit is contained in:
Peng Fan
2019-09-16 03:09:39 +00:00
committed by Stefano Babic
parent b1821376ee
commit b8f168346b
2 changed files with 23 additions and 2 deletions

View File

@@ -79,6 +79,7 @@ enum imximage_cmd {
CMD_LOADER, CMD_LOADER,
CMD_SECOND_LOADER, CMD_SECOND_LOADER,
CMD_DDR_FW, CMD_DDR_FW,
CMD_ROM_VERSION,
}; };
enum imximage_fld_types { enum imximage_fld_types {

View File

@@ -21,6 +21,11 @@ static uint32_t sld_header_off;
static uint32_t ivt_offset; static uint32_t ivt_offset;
static uint32_t using_fit; static uint32_t using_fit;
#define ROM_V1 1
#define ROM_V2 2
static uint32_t rom_version = ROM_V1;
#define CSF_SIZE 0x2000 #define CSF_SIZE 0x2000
#define HDMI_IVT_ID 0 #define HDMI_IVT_ID 0
#define IMAGE_IVT_ID 1 #define IMAGE_IVT_ID 1
@@ -71,6 +76,7 @@ static table_entry_t imx8mimage_cmds[] = {
{CMD_LOADER, "LOADER", "loader image", }, {CMD_LOADER, "LOADER", "loader image", },
{CMD_SECOND_LOADER, "SECOND_LOADER", "2nd loader image", }, {CMD_SECOND_LOADER, "SECOND_LOADER", "2nd loader image", },
{CMD_DDR_FW, "DDR_FW", "ddr firmware", }, {CMD_DDR_FW, "DDR_FW", "ddr firmware", },
{CMD_ROM_VERSION, "ROM_VERSION", "rom version", },
{-1, "", "", }, {-1, "", "", },
}; };
@@ -90,6 +96,9 @@ static void parse_cfg_cmd(int32_t cmd, char *token, char *name, int lineno)
token); token);
if (!strncmp(token, "sd", 2)) if (!strncmp(token, "sd", 2))
rom_image_offset = 0x8000; rom_image_offset = 0x8000;
if (rom_version == ROM_V2)
ivt_offset = 0;
break; break;
case CMD_LOADER: case CMD_LOADER:
ap_img = token; ap_img = token;
@@ -103,6 +112,15 @@ static void parse_cfg_cmd(int32_t cmd, char *token, char *name, int lineno)
case CMD_DDR_FW: case CMD_DDR_FW:
/* Do nothing */ /* Do nothing */
break; break;
case CMD_ROM_VERSION:
if (!strncmp(token, "v2", 2)) {
rom_version = ROM_V2;
ivt_offset = 0;
} else if (!strncmp(token, "v1", 2)) {
rom_version = ROM_V1;
}
break;
} }
} }
@@ -491,8 +509,10 @@ void build_image(int ofd)
* Record the second bootloader relative offset in * Record the second bootloader relative offset in
* image's IVT reserved1 * image's IVT reserved1
*/ */
imx_header[IMAGE_IVT_ID].fhdr.reserved1 = if (rom_version == ROM_V1) {
sld_header_off - header_image_off; imx_header[IMAGE_IVT_ID].fhdr.reserved1 =
sld_header_off - header_image_off;
}
sld_fd = open(sld_img, O_RDONLY | O_BINARY); sld_fd = open(sld_img, O_RDONLY | O_BINARY);
if (sld_fd < 0) { if (sld_fd < 0) {
fprintf(stderr, "%s: Can't open: %s\n", fprintf(stderr, "%s: Can't open: %s\n",