public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v3 0/2] fastboot: mmc: fix bootloader offset
@ 2026-02-17 10:36 Heiko Schocher
  2026-02-17 10:36 ` [PATCH v3 1/2] fastboot: mmc: make boot partition offset configurable Heiko Schocher
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Heiko Schocher @ 2026-02-17 10:36 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Heiko Schocher, Adrian Freihofer, Dmitrii Merkurev, Fabio Estevam,
	Marek Vasut, Mattijs Korpershoek, NXP i.MX U-Boot Team,
	Neil Armstrong, Stefano Babic, Tom Rini


Not for all SoCs the bootloader start at offset 0x0,
in a hardware partition of an emmc. So we need the possibility to
set the correct offset, where bootloader starts.

Example:

imx8qxp revision C0 emmc Partition layout

| eMMC block / partition | Offset     | Size  | Purpose                        |
| ---------------------- | ---------- | ----- | ------------------------------ |
| /dev/mmcblk0boot0      | 0x0        | 2MB   | imx-boot-container A           |
|                        | 0x00220000 | 128kB | secure boot signature rootfs A |
| /dev/mmcblk0boot1      | 0x0        | 2MB   | imx-boot-container B           |
|                        | 0x00200000 | 8kB   | U-Boot env 0                   |
|                        | 0x00202000 | 8kB   | U-Boot env 1                   |
|                        | 0x00220000 | 128kB | secure boot signature rootfs B |

imx8qxp rev B0 emmc Partition layout

| eMMC block / partition | Offset     | Size  | Purpose                        |
| ---------------------- | ---------- | ----- | ------------------------------ |
| /dev/mmcblk0boot0      | 0x00008000 | 2MB   | imx-boot-container A           |
|                        | 0x00220000 | 128kB | secure boot signature rootfs A |
| /dev/mmcblk0boot1      | 0x0        | 8kB   | U-Boot env 0                   |
|                        | 0x00002000 | 8kB   | U-Boot env 1                   |
|                        | 0x00008000 | 2MB   | imx-boot-container B           |

If we flash now the bootloader image flash.bin on a B0 revision with

uuu FB: flash bootloader flash.bin

we overwrite the environment and board does not boot at all, as offset
is wrong.

To prevent any API change in the above command we propose
the following implementation from this series:

We add a new weak function fb_mmc_get_boot_offset() in drivers/fastboot/fb_block.c
which returns 0 and call this function instead of passing 0 for
the offset where offset is used/passed.

In SoC specific code (currently for IMX8QXP only) we implement this function
that it returns on B0 SoCs the 32k offset and on other SoC revisions the
offset 0.

This is tested on B0 and C0 based boards from siemens.

This patch should have no effect for other SoCs.

Changes in v3:
reworked the logic as Peng suggested, so newer SoC
revisions will also start from offset 0x0

Changes in v2:
- added Reviewed-by from Mattijs
- Used the commit message as Peng suggested (with a small
  checkpatch fix:
  WARNING: 'writting' may be misspelled - perhaps 'writing'?
- rebased to mainline
  b99da05e153 - (tag: v2026.04-rc2, origin/master, origin/HEAD) Prepare v2026.04-rc2
- added Reviewed-by from Mattijs

Adrian Freihofer (2):
  fastboot: mmc: make boot partition offset configurable
  arch: imx8qxp: Override weak fb_mmc_get_boot_offset function

 arch/arm/mach-imx/imx8/cpu.c | 21 +++++++++++++++++++++
 drivers/fastboot/fb_block.c  | 15 +++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

-- 
2.20.1

base-commit: b99da05e1538b8fa153322da82917af2aa27e1d6

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-19 10:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17 10:36 [PATCH v3 0/2] fastboot: mmc: fix bootloader offset Heiko Schocher
2026-02-17 10:36 ` [PATCH v3 1/2] fastboot: mmc: make boot partition offset configurable Heiko Schocher
2026-02-17 10:36 ` [PATCH v3 2/2] arch: imx8qxp: Override weak fb_mmc_get_boot_offset function Heiko Schocher
2026-02-17 12:46   ` Mattijs Korpershoek
2026-02-17 18:55     ` Fabio Estevam
2026-02-19 10:28 ` [PATCH v3 0/2] fastboot: mmc: fix bootloader offset Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox