Skip to contentSkip to conversation

mx8m: csf.sh: Fix the calculation of fit_block_size

PATCH In review Fabio Estevam 3 participants 5 messages Aug 13, 2022 – Sep 22, 2022 Arm i.MX and Layerscape

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 mx8m: csf.sh: Fix the calculation of fit_block_size

From: Fabio Estevam <[email protected]>

When running the script to sign SPL/U-Boot on a kontron-sl-mx8mm board, the fit_block_size was calculated as 0x1000 instead of 0x1020.

Add an extra parenthesis pair to fix it.

---
Hi Stefano,

This one applies against u-boot-imx.

Since this one has not reached mainline yet, it is OK if you want to squash this change in the original commit.

 doc/imx/habv4/csf_examples/mx8m/csf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/imx/habv4/csf_examples/mx8m/csf.sh +1 -1
index 6898513be51f..7d267a7218d3 100644
@@ -40,7 +40,7 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc
 # fitImage tree
 fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SYS_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) )
 fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset))
-fit_block_size=$(printf "0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1) + 0x20 )) )
+fit_block_size=$(printf "0x%x" $(( ( ($(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) )
 sed -i "/Blocks = / s@.*@  Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp
 
 # U-Boot
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When running the script to sign SPL/U-Boot on a kontron-sl-mx8mm board, the fit_block_size was calculated as 0x1000 instead of 0x1020.

Add an extra parenthesis pair to fix it.

---
Hi Stefano,

This one applies against u-boot-imx.

Since this one has not reached mainline yet, it is OK if you want to squash this change in the original commit.

  doc/imx/habv4/csf_examples/mx8m/csf.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
doc/imx/habv4/csf_examples/mx8m/csf.sh +0 -0
index 6898513be51f..7d267a7218d3 100644

doc/imx/habv4/csf_examples/mx8m/csf.sh dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc · line 44

Quoted 6 lines
doc/imx/habv4/csf_examples/mx8m/csf.sh +1 -1
@@ -40,7 +40,7 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc
  # fitImage tree
  fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SYS_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) )
  fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset))
-fit_block_size=$(printf "0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1) + 0x20 )) )
+fit_block_size=$(printf "0x%x" $(( ( ($(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) )
  sed -i "/Blocks = / s@.*@  Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp
author reviewer
#2 lore raw

Hi Stefano and Tom,

Quoted 21 lines · Marek Vasut
Quoted 19 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When running the script to sign SPL/U-Boot on a kontron-sl-mx8mm board, the fit_block_size was calculated as 0x1000 instead of 0x1020.

Add an extra parenthesis pair to fix it.

---
Hi Stefano,

This one applies against u-boot-imx.

Since this one has not reached mainline yet, it is OK if you want to squash this change in the original commit.

  doc/imx/habv4/csf_examples/mx8m/csf.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

doc/imx/habv4/csf_examples/mx8m/csf.sh dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc · line 44

Quoted 11 lines
doc/imx/habv4/csf_examples/mx8m/csf.sh +1 -1
index 6898513be51f..7d267a7218d3 100644
@@ -40,7 +40,7 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc
  # fitImage tree
  fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SYS_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) )
  fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset))
-fit_block_size=$(printf "0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1) + 0x20 )) )
+fit_block_size=$(printf "0x%x" $(( ( ($(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) )
  sed -i "/Blocks = / s@.*@  Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp

Could you please consider applying this one as a fix to 2022.10?

Thanks

#3 lore raw

Hi Fabio,

Quoted 38 lines · Fabio Estevam

Hi Stefano and Tom,

Quoted 21 lines · Marek Vasut
Quoted 19 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When running the script to sign SPL/U-Boot on a kontron-sl-mx8mm board, the fit_block_size was calculated as 0x1000 instead of 0x1020.

Add an extra parenthesis pair to fix it.

---
Hi Stefano,

This one applies against u-boot-imx.

Since this one has not reached mainline yet, it is OK if you want to squash this change in the original commit.

   doc/imx/habv4/csf_examples/mx8m/csf.sh | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

doc/imx/habv4/csf_examples/mx8m/csf.sh dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc · line 44

Quoted 11 lines
doc/imx/habv4/csf_examples/mx8m/csf.sh +1 -1
index 6898513be51f..7d267a7218d3 100644
@@ -40,7 +40,7 @@ dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc
   # fitImage tree
   fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SYS_TEXT_BASE=/ s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" .config) - 0x200 - 0x40)) )
   fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset))
-fit_block_size=$(printf "0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1) + 0x20 )) )
+fit_block_size=$(printf "0x%x" $(( ( ($(fdtdump u-boot.itb 2>/dev/null | sed -n "/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) )
   sed -i "/Blocks = / s@.*@  Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", \\\\@" csf_fit.tmp
Quoted 3 lines

Could you please consider applying this one as a fix to 2022.10?

Thanks

I picked up this and "kontron-sl-mx8mm: Let CONFIG_SPL_FIT_IMAGE_TINY be selected", together with Marek's "Deduplicate i.MX8M SNVS LPGPR unlock" and the two patches from Tim. CI is running, I will send then the small PR to Tom if everything is nice.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#4 lore raw

PATCH 1/1 mx8m: csf.sh: Fix the calculation of fit_block_size

In reply to Fabio Estevam
Quoted 6 lines

From: Fabio Estevam <[email protected]>
When running the script to sign SPL/U-Boot on a kontron-sl-mx8mm board, the fit_block_size was calculated as 0x1000 instead of 0x1020. Add an extra parenthesis pair to fix it.

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: [email protected]
=====================================================================