tools: imx8mimage: Restore the original __ALIGN_MASK() macro
Fabio Estevam
reviewerPATCH v2 1/1 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.
---
Changes since v1:
- Create a custom macro
tools/imx8mimage.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/imx8mimage.c +5 -3
@@ -32,6 +32,8 @@ static uint32_t rom_version = ROM_V1;#define HDMI_FW_SIZE 0x17000/* Use Last 0x1000 for IVT and CSF */ #define ALIGN_SIZE 0x1000 +#define ALIGN_IMX (x, a) __ALIGN_MASK_IMX((x), (__typeof__(x))(a) - 1, a) +#define __ALIGN_MASK_IMX (x, mask, mask2) (((x) + (mask)) / (mask2) * (mask2))static uint32_t get_cfg_value (char *token,char *name,int linenr) {
@@ -342,7 +344,7 @@ static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep, fit_size =fdt_totalsize (&image_header); - fit_size =ALIGN (fit_size,ALIGN_SIZE ); + fit_size =ALIGN_IMX (fit_size,ALIGN_SIZE ); ret =lseek (fd, fit_offset + fit_size,SEEK_SET );if (ret <0 ) {
@@ -446,7 +448,7 @@ void build_image(int ofd)* Aligned to 104KB = 92KB FW image + 0x8000 * (IVT and alignment) + 0x4000 (second IVT + CSF) */ - file_off +=ALIGN (sbuf.st_size, + file_off +=ALIGN_IMX (sbuf.st_size,HDMI_FW_SIZE +0x2000 +0x1000 ); }
@@ -479,7 +481,7 @@ void build_image(int ofd) imx_header[IMAGE_IVT_ID ].boot_data.start = imx_header[IMAGE_IVT_ID ].fhdr.self - ivt_offset; imx_header[IMAGE_IVT_ID ].boot_data.size = -ALIGN (sbuf.st_size +sizeof (imx_header_v3_t) + ivt_offset, +ALIGN_IMX (sbuf.st_size +sizeof (imx_header_v3_t) + ivt_offset, sector_size); image_off = header_image_off +sizeof (imx_header_v3_t);
Signature · 1 line
2.25.1
PATCH v2 1/1 tools: imx8mimage: Restore the original __ALIGN_MASK() macro
Quoted 64 lines · Fabio Estevam
Caution: EXT Email
Since commit
c738adb8dbbf("tool: MoveALIGN_MASKto header as common MACRO")
the i.MX8MQ EVK board no longer boots.The reason is that
imx8mimage.cused a custom__ALIGN_MASK()macro, so
restore the original macro to fix the boot and rename it accordingly.Reported-by Lukas Rusak <[email protected]>Signed-off-by Fabio Estevam <[email protected]>---
Changes since v1:
- Create a custom macro?tools/imx8mimage.c | 8 +++++---
?1 file changed, 5 insertions(+), 3 deletions(-)tools/imx8mimage.c +0
-0@@ -32,6 +32,8 @@ static uint32_t rom_version = ROM_V1;?#define HDMI_FW_SIZE???????????0x17000 /* Use Last
0x1000for IVT and CSF */
?#define ALIGN_SIZE?????????????0x1000
+#defineALIGN_IMX(x, a)????????????????????????__ALIGN_MASK_IMX((x), (__typeof__(x))(a) - 1, a)
+#define__ALIGN_MASK_IMX(x, mask, mask2)???????(((x) + (mask)) / (mask2) * (mask2))?static
uint32_tget_cfg_value(char *token, char *name,??int linenr)?{tools/imx8mimage.c +1
-1@@ -342,7 +344,7 @@ static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep, ????????fit_size = fdt_totalsize(&image_header); -???????fit_size = ALIGN(fit_size, ALIGN_SIZE); +???????fit_size = ALIGN_IMX(fit_size, ALIGN_SIZE); ????????ret = lseek(fd, fit_offset + fit_size, SEEK_SET);????????if (ret < 0) {
tools/imx8mimage.c +0
-0@@ -446,7 +448,7 @@ void build_image(int ofd)?????????????????* Aligned to 104KB = 92KB FW image +
0x8000?????????????????* (IVT and alignment) +0x4000(second IVT + CSF) ?????????????????*/
-???????????????file_off += ALIGN(sbuf.st_size, +???????????????file_off +=ALIGN_IMX(sbuf.st_size, ??????????????????????????????????HDMI_FW_SIZE + 0x2000 + 0x1000); ????????}tools/imx8mimage.c +0
-0@@ -479,7 +481,7 @@ void build_image(int ofd)????????imx_header[IMAGE_IVT_ID].boot_data.start = ????????????????imx_header[IMAGE_IVT_ID].fhdr.self -
ivt_offset; ????????imx_header[IMAGE_IVT_ID].boot_data.size = -???????????????ALIGN(sbuf.st_size +sizeof(imx_header_v3_t)+ivt_offset,
+???????????????ALIGN_IMX(sbuf.st_size +sizeof(imx_header_v3_t)+ivt_offset,
??????????????????????sector_size);
Quoted 4 lines
????????image_off =
header_image_off+sizeof(imx_header_v3_t); --
2.25.1
Best regards,
Ye Li
PATCH v2 1/1 tools: imx8mimage: Restore the original __ALIGN_MASK() macro
In reply to Fabio EstevamQuoted 7 lines
Since commit
c738adb8dbbf("tool: MoveALIGN_MASKto header as common MACRO") the i.MX8MQ EVK board no longer boots.
The reason is thatimx8mimage.cused a custom__ALIGN_MASK()macro, so restore the original macro to fix the boot and rename it accordingly.Reported-by Lukas Rusak <[email protected]>Signed-off-by Fabio Estevam <[email protected]>Tested-by Ye Li <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================