| Message ID | 20260426154724.2042569-9-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRBHPHXDHQMGQEAH3DQ7I@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com
[209.85.221.71])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AB6CE3F206
for <linux-amarula@patchwork.amarulasolutions.com>;
Sun, 26 Apr 2026 17:47:42 +0200 (CEST)
Received: by mail-wr1-f71.google.com with SMTP id
ffacd0b85a97d-4411a215f17sf5816931f8f.1
for <linux-amarula@patchwork.amarulasolutions.com>;
Sun, 26 Apr 2026 08:47:42 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1777218462; cv=pass;
d=google.com; s=arc-20240605;
b=ZgvqxYqugHkGFuvAiHtByYTisQfl6+DX4BEGkzTymd3leWYdN7lX6/UnZwpazPhDM1
+0dAw/wEgHcQakjtanz3vtFEj8DJHTsN5WCRKZZUr46arz1ZN2jDEWTUjEeZb9Pzb86x
QL1ylhYbHhhxzWcj2pD8rmO4Dahwob1nanFqUIvsDa9L1CoiSazW/2QIgc3finOVAP3/
To57LCupNalj/h9t2dnz0cPZlmywWk+/HhBHQRSj4Xn4ZPqRwQOJmkTriItNGnXtSrGJ
KDsxW/ew1ZMnOnmIk4Q0P6mVf62PAxgrQO/mmiOElPKdD87AxEvmmY9dF+3GiSn6DsAq
qiuw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=2MO9Jzl1sa5G1L8Vm63XcN+iBf4yY948VK7FKqF9Xd8=;
fh=0yJ34aLpqCd6NtFfB53EnQf3JRYjTNzg+KsyNLYryQg=;
b=ZdjTu5qvHacuMsEqfaG9bVaQvhko1pE95mnB4+bOMScN7nBxyXlnqCmH7Zi1vNbNkH
lqRMsEaTV28Plsm/RPHtAHHC9qs1k5w+tcPOFWdXWwbSTbde/iIS1WAQ+fWPXKq3dr6q
XienldZkicOP/hLmQk5J+VEYO2FCRnRrim1v7POzwLq1tm3HJl8ZomvYj72Oz4NbqIlT
keUBbPmrghQhPuEVI10GTPu/RON4ciwaBpXJ4PdLPWF9yDdZHgkv4pr0cmEnTAGtDszK
KGthQ7a6mfAKwD2rSS2Job1pFWs6C+HVOnSHaCddCl02rRaFLHlqSwUotEEjUdN1znHL
E2hQ==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=ouuJagKe;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amarulasolutions.com; s=google; t=1777218462; x=1777823262;
darn=patchwork.amarulasolutions.com;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:x-original-authentication-results
:x-original-sender:mime-version:references:in-reply-to:message-id
:date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=2MO9Jzl1sa5G1L8Vm63XcN+iBf4yY948VK7FKqF9Xd8=;
b=Jz2FHT7rgXGmZh4Ap5TomjOWxtBLP8yNlmJUmQFQC68/byKvGWVhdlvZIbNuvzqq5i
UV+I4/8V9+qitoxMsSbwlFoJhT7OaU+alLOvHAqEsFhdfdKTOEK/8Zg1bBsW+nmSR14g
5/ozHFGaILkx/saVGLldMlN3Mn5Zdfat0KctU=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1777218462; x=1777823262;
h=list-unsubscribe:list-archive:list-help:list-post
:x-spam-checked-in-group:list-id:mailing-list:precedence
:x-original-authentication-results:x-original-sender:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
:x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=2MO9Jzl1sa5G1L8Vm63XcN+iBf4yY948VK7FKqF9Xd8=;
b=YmEgp5RbDozhTJzPI9qmyYyeQXt7uTF0OJIDi6n/Z96o8TWYYZQXLkyXGEvDee9DfY
EjZ80aH8Wp3KIUIPzt/Z7H4Tx6Nsh4uj1Dbf07lp+o9u0BDi0MykTc31U3f8YWOePzeS
1Djfj9cAhYL5Q8Wyv05ciEG+FiDlFAFjgMONDpT/Qc2BAER+P3WlXsNqrwSYZsLBex1e
Ijib3ckzDSf7VfyULaQhZPaMN4bZCAC1Aa69rpcaXSBs57h2qMmXH6jFAxDc2p5M6EFa
aPFH86aNCtb6fpXRpHotSz8zi8vg/dgQPSFFIMzBufyu2Yudv0wAlF3or2/yZzrtCPOl
iSww==
X-Forwarded-Encrypted: i=2;
AFNElJ89vcD9V7AQmFURs3vFWoU8fn8qpJwQ57reWiGFtPEu2T1DNgRGEf6y6WzRpEZU8kO1SvgGCAbCzMpWKufu@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0YwnpJLPvK1JjXliwJwcAAe4gsh/rGyqizGxYk4JQFGpJbgHic7F
aZAhiqmkLhRbuFR9XN5iEZOQ3WSkDgJYY7M9U1Q4sEoeSqJtq4lS3uIsCVvEToui0iH9wA==
X-Received: by 2002:a05:6000:420a:b0:43c:4810:dc4a with SMTP id
ffacd0b85a97d-43fe3e14f81mr61547676f8f.38.1777218462171;
Sun, 26 Apr 2026 08:47:42 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com;
h="AUV6zMMkJqJi0IE1qNvEBCcjGQuDz0ROpOvWDBr2Mrcvaq5sLQ=="
Received: by 2002:a05:6000:602:b0:43d:6a90:5217 with SMTP id
ffacd0b85a97d-43eb1c671e7ls8595725f8f.1.-pod-prod-05-eu; Sun, 26 Apr 2026
08:47:40 -0700 (PDT)
X-Received: by 2002:a05:6000:184d:b0:43d:7633:2649 with SMTP id
ffacd0b85a97d-43fe3e23dd9mr63480243f8f.45.1777218460559;
Sun, 26 Apr 2026 08:47:40 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1777218460; cv=none;
d=google.com; s=arc-20240605;
b=QQnNNHBwd/oecsEWquuo01vRRvqjTrGkGxq4soOA+oeO1xzmpqIG5+Gt/W74uR/IgA
QvlA2EtVCF9O5oJo1QVOfhnFL5g5Dd9bKF9AXcKSai6K2w7eQfN9hjGQ9DmSNZJtk4uN
vKEjKio0BgTWBqHt5rp0l7FULL/RlE4L33LnVxQf40gJVAOuuRq+r+5DKda8yxj5vpPS
DYm1Ngepr/B4XDx9N009vz+1WyoDeqFgxBrF5f/t4/gwJgCgxd9X8o1WexWIP5G6H4LQ
YYyk5bwJI+FkrVPhi3H5AJ+REZik3/SOG3FabGjQTgTMMj9rZ/w/kjtWbUj05JbqsbAR
/UAg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=pyCTNQQ5HSE9YWFE9QctEWIoRgXv/rGHYVY5OZpmknE=;
fh=A7b4Lcg6d42EDiThJT5tK+BuJbQ+NoCE2BQ6B+bO/SE=;
b=hr9gHJ8qpOc6beB1sz6xRC+XbEnXYbJ0cX+N8ajDZfOihCUZfx+pU2Y4qBzCnu/su9
Gl4qajkFX5+8w8vkCxpRDiTTv/wZu7AX+ewnDuvzlxapza+CxW0+WgRuq7AW3fLtbmIr
Z540NiQZIIiUr5J/taDNJMtMoKAaGK07QgsRP/2lFOx5h5OTnTmiSsm/Q6BruS8jeDCH
Kc/A608CRjGSLR3naZoWiRZpX5CpH2bjTKOrjF9Evk+emSNuX3se+tTY+uWs/TbX4i2g
UctS0wiETLbIcuj9giJ5zCYhqvpmuqaYoyXdzVfWgdYNzPxxThjWTQ7v1ejCXEdqNq79
2JVQ==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=ouuJagKe;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com.
[209.85.220.41])
by mx.google.com with SMTPS id
ffacd0b85a97d-43fe4cb8acfsor4232839f8f.6.2026.04.26.08.47.40
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Sun, 26 Apr 2026 08:47:40 -0700 (PDT)
Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Gm-Gg: AeBDieuP6xddqgeL0pTDOmhL9V8A6PVCmNPpsr8ENwAb07K6Pz7Kd6dBHG2nlpx7NZa
p6kC1ssLIhmGJFUEWvznt3NDOu5JBazA4ZXoqazy49kUlxTs/3aOJj92jmJ/x/bdp6ggKVeW37M
gqwD664z/rxf5v9JOemN5y6Efye5Qt1Fktk877pZBa0rs/F/yZmtBYeHZjj7ctOwa3RnznaF+7W
L3tIeE95OjwTHlyFK6rtix+dk8r6MZaO+ekV5F0fkJABX4+Nq1aRxZW64JwBJrillDhVp+fl4/T
M0TsIDgicO+PlQFA0uK2Nzoq04Epwt4jml9PxQS4Lw0NqrRiueHuORR1LymUl4SMPjIUdxbvjBr
L5Vwvoybxi1iwrvZ2m4KyquyLsB7//Gf2I1AfwJYP3R79H3nh/GfCeAIRRqqbe4xHL3RZt1YO3I
NBzuT7lUOHqfOdcvy73LBNLcnS0XAtMw5lQI21toSumHUpUoinmK2tZW9IaUX/EvKPnh1thPTDX
lgRh78EC2ARTfEtKbxcKrut/WIEgnD7ZoMgsoomuXxavbfBFZyrixdmqcJ+N4HbLYzZbWjv78XK
QHusJa7rcLJGp0GRXTq8BIuWG2TwdzkWr4SR5ePV
X-Received: by 2002:a05:6000:230c:b0:43d:303f:f358 with SMTP id
ffacd0b85a97d-43fe3dc5981mr64165640f8f.2.1777218460103;
Sun, 26 Apr 2026 08:47:40 -0700 (PDT)
Received: from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com
(host-82-56-22-134.retail.telecomitalia.it. [82.56.22.134])
by smtp.gmail.com with ESMTPSA id
ffacd0b85a97d-44123d23e0bsm34489985f8f.15.2026.04.26.08.47.39
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 26 Apr 2026 08:47:39 -0700 (PDT)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: u-boot@lists.denx.de
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Simon Glass <sjg@chromium.org>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Patrick Delaunay <patrick.delaunay@foss.st.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Tom Rini <trini@konsulko.com>,
uboot-stm32@st-md-mailman.stormreply.com
Subject: [PATCH v7 8/8] board: st: stm32mp25: support dynamic A/B bank bootup
Date: Sun, 26 Apr 2026 17:47:01 +0200
Message-ID: <20260426154724.2042569-9-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20260426154724.2042569-1-dario.binacchi@amarulasolutions.com>
References: <20260426154724.2042569-1-dario.binacchi@amarulasolutions.com>
MIME-Version: 1.0
X-Original-Sender: dario.binacchi@amarulasolutions.com
X-Original-Authentication-Results: mx.google.com; dkim=pass
header.i=@amarulasolutions.com header.s=google header.b=ouuJagKe;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list linux-amarula@amarulasolutions.com;
contact linux-amarula+owners@amarulasolutions.com
List-ID: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
Support metadata-driven A/B boot for STM32MP25
|
|
Commit Message
Dario Binacchi
April 26, 2026, 3:47 p.m. UTC
Enable automatic detection of the active A/B bank by retrieving partition GUIDs from FWU metadata. This ensures the system correctly identifies the bootable partitions even in multi-bank scenarios, falling back to a standard bootable flag scan if the UUIDs are missing. To enable A/B bank bootup on stm32mp25 boards, add the following Kconfig options to the stm32mp25_defconfig: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_NUM_BANKS=2 CONFIG_FWU_NUM_IMAGES_PER_BANK=3 CONFIG_CMD_FWU_METADATA=y CONFIG_FWU_MDATA_V2=y Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org> --- (no changes since v5) Changes in v5: - Add Acked-by of Ilias Apalodimas to patch 6/8 "fwu: add helper to get image GUID by type and bank index" Changes in v4: - Add patch 7/8 test: dm: fwu_mdata: add test for fwu_mdata_get_image_guid Changes in v3: - Wrap lines exceeding 80 columns in test/cmd/part.c file. - Combine run_command() and ut_asserteq() -> ut_asserteq(1, run_command( - Add kerneldoc comment for fwu_mdata_get_image_guid() above its declaration in fwu.h. - Add log_warning() messages to fwu_platform_hook() to catch inconsistent FWU metadata (boot GUID found but root GUID missing or viceversa), as suggested by Simon Glass. - Add Reviewed-by tag of Simon Glass. Changes in v2: - Add links to the XBOOTLDR specification in the commit message of patch 1/7 lib: uuid: add partition type GUID for extended bootloader. - Update help for 'part start', 'part size' to mention UUID. - Add kerneldoc comment for fwu_mdata_get_image_guid(). - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid(). - Add patches: 5/7 test: cmd: part: add UUID lookup tests 3/7 test: cmd: add unit tests for part command 2/7 test: dm: part: add test for part_get_info_by_uuid - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid() calls. board/st/stm32mp2/stm32mp2.c | 32 +++++++++++++++++++++++++++ include/configs/stm32mp25_st_common.h | 15 +++++++++++++ 2 files changed, 47 insertions(+)
Comments
On 4/26/26 17:47, Dario Binacchi wrote: > Enable automatic detection of the active A/B bank by retrieving > partition GUIDs from FWU metadata. > > This ensures the system correctly identifies the bootable partitions > even in multi-bank scenarios, falling back to a standard bootable flag > scan if the UUIDs are missing. > > To enable A/B bank bootup on stm32mp25 boards, add the following Kconfig > options to the stm32mp25_defconfig: > > CONFIG_FWU_MULTI_BANK_UPDATE=y > CONFIG_FWU_MDATA=y > CONFIG_FWU_NUM_BANKS=2 > CONFIG_FWU_NUM_IMAGES_PER_BANK=3 > CONFIG_CMD_FWU_METADATA=y > CONFIG_FWU_MDATA_V2=y > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > Reviewed-by: Simon Glass <sjg@chromium.org> > > --- > > (no changes since v5) > > Changes in v5: > - Add Acked-by of Ilias Apalodimas to patch 6/8 "fwu: add helper to get > image GUID by type and bank index" > > Changes in v4: > - Add patch 7/8 test: dm: fwu_mdata: add test for fwu_mdata_get_image_guid > > Changes in v3: > - Wrap lines exceeding 80 columns in test/cmd/part.c file. > - Combine run_command() and ut_asserteq() -> ut_asserteq(1, run_command( > - Add kerneldoc comment for fwu_mdata_get_image_guid() above its declaration > in fwu.h. > - Add log_warning() messages to fwu_platform_hook() to catch inconsistent > FWU metadata (boot GUID found but root GUID missing or viceversa), as > suggested by Simon Glass. > - Add Reviewed-by tag of Simon Glass. > > Changes in v2: > - Add links to the XBOOTLDR specification in the commit message of patch > 1/7 lib: uuid: add partition type GUID for extended bootloader. > - Update help for 'part start', 'part size' to mention UUID. > - Add kerneldoc comment for fwu_mdata_get_image_guid(). > - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid(). > - Add patches: > 5/7 test: cmd: part: add UUID lookup tests > 3/7 test: cmd: add unit tests for part command > 2/7 test: dm: part: add test for part_get_info_by_uuid > - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid() calls. > > board/st/stm32mp2/stm32mp2.c | 32 +++++++++++++++++++++++++++ > include/configs/stm32mp25_st_common.h | 15 +++++++++++++ > 2 files changed, 47 insertions(+) > > diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c > index 43bc583378e6..5cbbbc322a3a 100644 > --- a/board/st/stm32mp2/stm32mp2.c > +++ b/board/st/stm32mp2/stm32mp2.c > @@ -208,4 +208,36 @@ void fwu_plat_get_bootidx(uint *boot_idx) > *boot_idx = (readl(TAMP_FWU_BOOT_INFO_REG) >> > TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; > } > + > +int fwu_platform_hook(struct udevice *dev, struct fwu_data *data) > +{ > + uint boot_idx; > + efi_guid_t boot_uuid, root_uuid; > + const efi_guid_t boot_type_guid = PARTITION_XBOOTLDR; > + const efi_guid_t root_type_guid = > + PARTITION_LINUX_FILE_SYSTEM_DATA_GUID; > + char uuidbuf[UUID_STR_LEN + 1]; > + int retb, retr; > + > + fwu_plat_get_bootidx(&boot_idx); > + > + retb = fwu_mdata_get_image_guid(&boot_uuid, &boot_type_guid, boot_idx); > + retr = fwu_mdata_get_image_guid(&root_uuid, &root_type_guid, boot_idx); > + > + if (!retb && !retr) { > + uuid_bin_to_str(boot_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); > + env_set("boot_partuuid", uuidbuf); > + > + uuid_bin_to_str(root_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); > + env_set("root_partuuid", uuidbuf); > + } else if (!retb && retr) { > + log_warning("%s: found boot GUID but missing root GUID (%d)\n", > + __func__, retr); > + } else if (!retr && retb) { > + log_warning("%s: found root GUID but missing boot GUID (%d)\n", > + __func__, retb); > + } > + > + return 0; > +} > #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ > diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h > index cb679eb1be22..0b0267ae99b0 100644 > --- a/include/configs/stm32mp25_st_common.h > +++ b/include/configs/stm32mp25_st_common.h > @@ -8,7 +8,22 @@ > #ifndef __CONFIG_STM32MP25_ST_COMMON_H__ > #define __CONFIG_STM32MP25_ST_COMMON_H__ > > +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE > +#define SCAN_DEV_FOR_BOOT_PARTS \ > + "setenv devplist; " \ > + "env exists boot_partuuid && " \ > + "part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \ > + "env exists devplist || " \ > + "part list ${devtype} ${devnum} -bootable devplist; " > + > +#define ST_STM32MP25_FWU_ENV \ > + "altbootcmd=${bootcmd}\0" > +#else > +#define ST_STM32MP25_FWU_ENV > +#endif > + > #define STM32MP_BOARD_EXTRA_ENV \ > + ST_STM32MP25_FWU_ENV \ > "usb_pgood_delay=2000\0" \ > "console=ttySTM0\0" > Hi Dario Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Thanks Patrice To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index 43bc583378e6..5cbbbc322a3a 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -208,4 +208,36 @@ void fwu_plat_get_bootidx(uint *boot_idx) *boot_idx = (readl(TAMP_FWU_BOOT_INFO_REG) >> TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; } + +int fwu_platform_hook(struct udevice *dev, struct fwu_data *data) +{ + uint boot_idx; + efi_guid_t boot_uuid, root_uuid; + const efi_guid_t boot_type_guid = PARTITION_XBOOTLDR; + const efi_guid_t root_type_guid = + PARTITION_LINUX_FILE_SYSTEM_DATA_GUID; + char uuidbuf[UUID_STR_LEN + 1]; + int retb, retr; + + fwu_plat_get_bootidx(&boot_idx); + + retb = fwu_mdata_get_image_guid(&boot_uuid, &boot_type_guid, boot_idx); + retr = fwu_mdata_get_image_guid(&root_uuid, &root_type_guid, boot_idx); + + if (!retb && !retr) { + uuid_bin_to_str(boot_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("boot_partuuid", uuidbuf); + + uuid_bin_to_str(root_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("root_partuuid", uuidbuf); + } else if (!retb && retr) { + log_warning("%s: found boot GUID but missing root GUID (%d)\n", + __func__, retr); + } else if (!retr && retb) { + log_warning("%s: found root GUID but missing boot GUID (%d)\n", + __func__, retb); + } + + return 0; +} #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h index cb679eb1be22..0b0267ae99b0 100644 --- a/include/configs/stm32mp25_st_common.h +++ b/include/configs/stm32mp25_st_common.h @@ -8,7 +8,22 @@ #ifndef __CONFIG_STM32MP25_ST_COMMON_H__ #define __CONFIG_STM32MP25_ST_COMMON_H__ +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE +#define SCAN_DEV_FOR_BOOT_PARTS \ + "setenv devplist; " \ + "env exists boot_partuuid && " \ + "part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \ + "env exists devplist || " \ + "part list ${devtype} ${devnum} -bootable devplist; " + +#define ST_STM32MP25_FWU_ENV \ + "altbootcmd=${bootcmd}\0" +#else +#define ST_STM32MP25_FWU_ENV +#endif + #define STM32MP_BOARD_EXTRA_ENV \ + ST_STM32MP25_FWU_ENV \ "usb_pgood_delay=2000\0" \ "console=ttySTM0\0"