From: Marek Vasut <marex@nabladev.com>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@nabladev.com>,
"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
Fabio Estevam <festevam@gmail.com>,
Simon Glass <sjg@chromium.org>,
Stefano Babic <sbabic@nabladev.com>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH] binman: nxp_imx8mcst: Handle FCFB header during SPI NOR boot
Date: Wed, 15 Jul 2026 15:37:04 +0200 [thread overview]
Message-ID: <20260715133716.10449-1-marex@nabladev.com> (raw)
In case the image that is wrapped in the nxp_imx8mcst already contains
an FCFB header which is mandatory for SPI NOR boot, then the IVT is at
offset 0x1000 instead of offset 0x0, but the whole image including the
FCFB header must be signed to prevent attacker from tampering with any
of the headers. Add the FCFB handling.
Signed-off-by: Marek Vasut <marex@nabladev.com>
---
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@nabladev.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
tools/binman/etype/nxp_imx8mcst.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py
index a10f61aa01f..b45d7298037 100644
--- a/tools/binman/etype/nxp_imx8mcst.py
+++ b/tools/binman/etype/nxp_imx8mcst.py
@@ -20,8 +20,9 @@ from binman import elf
from dtoc import fdt_util
from u_boot_pylib import tools
-MAGIC_NXP_IMX_IVT = 0x412000d1
-MAGIC_FITIMAGE = 0xedfe0dd0
+MAGIC_NXP_IMX_IVT = 0x412000d1
+MAGIC_NXP_IMX_FCFB = 0x42464346
+MAGIC_FITIMAGE = 0xedfe0dd0
KEY_NAME = 'sha256_4096_65537_v3_usr_crt'
@@ -125,6 +126,13 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
signsize = struct.unpack('<I', data[24:28])[0] - signbase
# Remove mkimage generated padding from the end of data
data = data[:signsize]
+ elif signtype == MAGIC_NXP_IMX_FCFB: # SPL/imx8mimage with FCFB
+ # Sign the payload including FCFB and imx8mimage headers
+ # (extra 0x1000 and 0x40 bytes before the payload)
+ signbase -= 0x1040
+ signsize = struct.unpack('<I', data[4120:4124])[0] - signbase
+ # Remove mkimage generated padding from the end of data
+ data = data[:signsize]
elif signtype == MAGIC_FITIMAGE: # fitImage
# Align fitImage to 4k
signsize = tools.align(len(data), 0x1000)
--
2.53.0
next reply other threads:[~2026-07-15 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 13:37 Marek Vasut [this message]
2026-07-17 14:05 ` [PATCH] binman: nxp_imx8mcst: Handle FCFB header during SPI NOR boot Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260715133716.10449-1-marex@nabladev.com \
--to=marex@nabladev.com \
--cc=festevam@gmail.com \
--cc=sbabic@nabladev.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox