History log of /u-boot/tools/imx8mimage.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# b0adbd6f 23-Jan-2024 Jesse Taube <mr.bossman075@gmail.com>

tools: mkimage: Add support for i.MXRT FlexSPI Header

Modify imx8m Flex SPI Configuration Block to work with imxrt.
Add more Flex SPI configuration options to Kconfig.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mn-beacon

# 2972d7d6 29-Mar-2023 This contributor prefers not to receive mails <noreply@example.com>

tools: imagetool: Extend print_header() by params argument

This allows image type print_header() callback to access struct
image_tool_params *params.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 9017785a 23-Nov-2022 Mikhail Ilin <ilin.mikhail.ol@gmail.com>

tools: imx8mimage: Fix handle leak

The handle "fd" was created in imx8mimage.c:178 by calling
the "fopen" function and is lost in imx8mimage.c:210.
Should close the 'fd' file descriptor before exiting
the parse_cfg_file(char *name) function.

Fixes: 6609c2663c9c ("tools: add i.MX8M image support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5fe1d4b5 12-Jul-2022 Mamta Shukla <mamta.shukla@leica-geosystems.com>

tools: mkimage: Add support to generate FlexSPI Header for i.MX8m

Add struct with Flex SPI Configuration Block and enable generating
fspi header using mkimage.

Refer i.MX 8M Mini Application Processor Reference Manual for
detailed information about parameters for FlexSPI Configuration block.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>

# 4f1851d0 29-Jun-2022 Marek Vasut <marex@denx.de>

tools: imx8mimage: Keep IVT reserved1 field zero always

Since fe8acf556c3 ("imx: HAB: Validate IVT before authenticating image")
the U-Boot HAB implementation is checking whether reserved1 field in IVT
is zero or not. In case the field is not zero, IVT validation fails. Stop
setting IVT reserved1 field to non-zero in mkimage imx8m plugin, otherwise
the validation cannot ever work.

Note that this only affects legacy boards which do not use binman.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 2972d7d6 29-Mar-2023 Pali Rohár <pali@kernel.org>

tools: imagetool: Extend print_header() by params argument

This allows image type print_header() callback to access struct
image_tool_params *params.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 9017785a 23-Nov-2022 Mikhail Ilin <ilin.mikhail.ol@gmail.com>

tools: imx8mimage: Fix handle leak

The handle "fd" was created in imx8mimage.c:178 by calling
the "fopen" function and is lost in imx8mimage.c:210.
Should close the 'fd' file descriptor before exiting
the parse_cfg_file(char *name) function.

Fixes: 6609c2663c9c ("tools: add i.MX8M image support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5fe1d4b5 12-Jul-2022 Mamta Shukla <mamta.shukla@leica-geosystems.com>

tools: mkimage: Add support to generate FlexSPI Header for i.MX8m

Add struct with Flex SPI Configuration Block and enable generating
fspi header using mkimage.

Refer i.MX 8M Mini Application Processor Reference Manual for
detailed information about parameters for FlexSPI Configuration block.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>

# 4f1851d0 29-Jun-2022 Marek Vasut <marex@denx.de>

tools: imx8mimage: Keep IVT reserved1 field zero always

Since fe8acf556c3 ("imx: HAB: Validate IVT before authenticating image")
the U-Boot HAB implementation is checking whether reserved1 field in IVT
is zero or not. In case the field is not zero, IVT validation fails. Stop
setting IVT reserved1 field to non-zero in mkimage imx8m plugin, otherwise
the validation cannot ever work.

Note that this only affects legacy boards which do not use binman.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 9017785a 23-Nov-2022 Mikhail Ilin <ilin.mikhail.ol@gmail.com>

tools: imx8mimage: Fix handle leak

The handle "fd" was created in imx8mimage.c:178 by calling
the "fopen" function and is lost in imx8mimage.c:210.
Should close the 'fd' file descriptor before exiting
the parse_cfg_file(char *name) function.

Fixes: 6609c2663c9c ("tools: add i.MX8M image support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5fe1d4b5 12-Jul-2022 Mamta Shukla <mamta.shukla@leica-geosystems.com>

tools: mkimage: Add support to generate FlexSPI Header for i.MX8m

Add struct with Flex SPI Configuration Block and enable generating
fspi header using mkimage.

Refer i.MX 8M Mini Application Processor Reference Manual for
detailed information about parameters for FlexSPI Configuration block.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>

# 4f1851d0 29-Jun-2022 Marek Vasut <marex@denx.de>

tools: imx8mimage: Keep IVT reserved1 field zero always

Since fe8acf556c3 ("imx: HAB: Validate IVT before authenticating image")
the U-Boot HAB implementation is checking whether reserved1 field in IVT
is zero or not. In case the field is not zero, IVT validation fails. Stop
setting IVT reserved1 field to non-zero in mkimage imx8m plugin, otherwise
the validation cannot ever work.

Note that this only affects legacy boards which do not use binman.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5fe1d4b5 12-Jul-2022 Mamta Shukla <mamta.shukla@leica-geosystems.com>

tools: mkimage: Add support to generate FlexSPI Header for i.MX8m

Add struct with Flex SPI Configuration Block and enable generating
fspi header using mkimage.

Refer i.MX 8M Mini Application Processor Reference Manual for
detailed information about parameters for FlexSPI Configuration block.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>

# 4f1851d0 29-Jun-2022 Marek Vasut <marex@denx.de>

tools: imx8mimage: Keep IVT reserved1 field zero always

Since fe8acf556c3 ("imx: HAB: Validate IVT before authenticating image")
the U-Boot HAB implementation is checking whether reserved1 field in IVT
is zero or not. In case the field is not zero, IVT validation fails. Stop
setting IVT reserved1 field to non-zero in mkimage imx8m plugin, otherwise
the validation cannot ever work.

Note that this only affects legacy boards which do not use binman.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 5fe1d4b5 12-Jul-2022 Mamta Shukla <mamta.shukla@leica-geosystems.com>

tools: mkimage: Add support to generate FlexSPI Header for i.MX8m

Add struct with Flex SPI Configuration Block and enable generating
fspi header using mkimage.

Refer i.MX 8M Mini Application Processor Reference Manual for
detailed information about parameters for FlexSPI Configuration block.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>

# 4f1851d0 29-Jun-2022 Marek Vasut <marex@denx.de>

tools: imx8mimage: Keep IVT reserved1 field zero always

Since fe8acf556c3 ("imx: HAB: Validate IVT before authenticating image")
the U-Boot HAB implementation is checking whether reserved1 field in IVT
is zero or not. In case the field is not zero, IVT validation fails. Stop
setting IVT reserved1 field to non-zero in mkimage imx8m plugin, otherwise
the validation cannot ever work.

Note that this only affects legacy boards which do not use binman.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# c7b87111 15-Aug-2021 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 16841a6a 19-Mar-2021 Peng Fan <peng.fan@nxp.com>

tools: imx image: fix write warning

Fix the warning by set the variable zero to uint64_t
"warning: ‘write’ reading 5 bytes from a region of size 4"

Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 325bb40f 22-Feb-2021 Fabio Estevam <festevam@gmail.com>

tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# e5ad99cc 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c738adb8 29-Mar-2020 Kever Yang <kever.yang@rock-chips.com>

tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# b8f16834 15-Sep-2019 Peng Fan <peng.fan@nxp.com>

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>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 4d655bfe 06-Aug-2019 Peng Fan <peng.fan@nxp.com>

tools: imx8mimage: fix HDMI/FIT parsing

Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>

# 6609c266 20-Nov-2018 Peng Fan <peng.fan@nxp.com>

tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>