From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24786E68169 for ; Tue, 17 Feb 2026 10:36:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 050F680325; Tue, 17 Feb 2026 11:36:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=nabladev.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=nabladev.com header.i=@nabladev.com header.b="bRbJEisH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7EE3F83CB5; Tue, 17 Feb 2026 11:36:22 +0100 (CET) Received: from mx.nabladev.com (mx.nabladev.com [178.251.229.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 66F8D802C1 for ; Tue, 17 Feb 2026 11:36:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=nabladev.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=hs@nabladev.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 78AD411038C; Tue, 17 Feb 2026 11:36:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nabladev.com; s=dkim; t=1771324572; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=ATGpNX+U6S6/ACuAAnTA1GGAqOsoRdNfv1DVoPonaXU=; b=bRbJEisHKJhBwz6w0RtlCXQrA6QVTRxahxbmzWvm3iGVWwO3GIIUEk2al6svFVvb/oBCm4 LXF3aEk+D5OaKETHWjpYIVrF1yozqXjj/7BZQ6WBSc13HHUhHlVxvub4BZ64wd5Kqa5pUD kKfIxCWOykeLPExRz3hXLhP4neKDLXRipftKEsjmNgZPX9cmZh+xAp+HXwfxm/ymcYr/9o tBBt+bAMtpd8Ykj8Jcuru6GWCZjwCIYlIaT/y2XHlgfYIB9XGDKKxyffgtz9MpfcsKNEIp 5S9MfX/7HgHy86TcLXIqkXiP9ZbeF1pVOwUhC8ZTUQYGeOluj+00Ke7fjUyL7w== From: Heiko Schocher 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 Subject: [PATCH v3 0/2] fastboot: mmc: fix bootloader offset Date: Tue, 17 Feb 2026 11:36:02 +0100 Message-Id: <20260217103604.71029-1-hs@nabladev.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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