[Concept,08/12] bootstd: Show entry number in bootflow info

Message ID 20260324221911.3678307-9-sjg@u-boot.org
State New
Headers
Series bootstd: Support multiple bootflows per partition |

Commit Message

Simon Glass March 24, 2026, 10:19 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Display the entry index in 'bootflow info' output when the bootmeth
supports BOOTMETHF_MULTI

This is shown even for entry 0, so that users can see which entry a
bootflow represents and distinguish between multiple bootflows from the
same partition.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/bootflow.c             |  8 ++++++++
 doc/usage/cmd/bootflow.rst | 11 +++++++++--
 test/boot/bootflow.c       |  3 +++
 3 files changed, 20 insertions(+), 2 deletions(-)
  

Patch

diff --git a/cmd/bootflow.c b/cmd/bootflow.c
index 70eec5919cc..1c40037e6a6 100644
--- a/cmd/bootflow.c
+++ b/cmd/bootflow.c
@@ -9,6 +9,7 @@ 
 #include <bootdev.h>
 #include <bootflow.h>
 #include <bootm.h>
+#include <bootmeth.h>
 #include <bootstd.h>
 #include <command.h>
 #include <console.h>
@@ -371,6 +372,13 @@  static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 	printf("Method:    %s\n", bflow->method ? bflow->method->name : "(none)");
 	printf("State:     %s\n", bootflow_state_get_name(bflow->state));
 	printf("Partition: %d\n", bflow->part);
+	if (bflow->method) {
+		struct bootmeth_uc_plat *ucp;
+
+		ucp = dev_get_uclass_plat(bflow->method);
+		if (ucp->flags & BOOTMETHF_MULTI)
+			printf("Entry:     %d\n", bflow->entry);
+	}
 
 	/* Show encryption status with LUKS version if applicable */
 	if (IS_ENABLED(CONFIG_BLK_LUKS)) {
diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst
index 4507303fb3a..3a21e00a47b 100644
--- a/doc/usage/cmd/bootflow.rst
+++ b/doc/usage/cmd/bootflow.rst
@@ -167,6 +167,7 @@  Type       distro
 Method:    extlinux
 State      ready
 Partition  2
+Entry      0
 Encrypted  no
 Subdir     (none)
 Filename   /extlinux/extlinux.conf
@@ -185,6 +186,12 @@  Device
 Block dev
     Name of the block device, if any. Network devices don't have a block device.
 
+Entry
+    Entry number and name for boot methods that support multiple entries
+    (``BOOTMETHF_MULTI``). For example, an extlinux config with several
+    labels shows the entry index and label name. Only shown when
+    the boot method supports multi-entry.
+
 Encrypted
     Encryption status. Shows ``LUKSv1`` or ``LUKSv2`` if a LUKS-encrypted
     partition was detected on the same device, or ``no`` otherwise. Only
@@ -344,6 +351,7 @@  displayed and booted::
     Method:    distro
     State:     ready
     Partition: 2
+    Entry:     0
     Encrypted: no
     Subdir:    (none)
     Filename:  extlinux/extlinux.conf
@@ -355,8 +363,7 @@  displayed and booted::
     FDT:       <NULL>
     Error:     0
     U-Boot> bootflow boot
-    ** Booting bootflow 'smsc95xx_eth.bootdev.0'
-    Ignoring unknown command: ui
+    ** Booting bootflow 'mmc@7e202000.bootdev.part_2'
     Ignoring malformed menu command:  autoboot
     Ignoring malformed menu command:  hidden
     Ignoring unknown command: totaltimeout
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 2ff203c186c..84d80d9fd10 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -258,6 +258,7 @@  static int bootflow_cmd_info(struct unit_test_state *uts)
 	ut_assert_nextline("Method:    extlinux");
 	ut_assert_nextline("State:     ready");
 	ut_assert_nextline("Partition: 1");
+	ut_assert_nextline("Entry:     0");
 	if (IS_ENABLED(CONFIG_BLK_LUKS))
 		ut_assert_nextline("Encrypted: no");
 	ut_assert_nextline("Subdir:    (none)");
@@ -1845,6 +1846,7 @@  static int bootflow_cmd_info_encrypted(struct unit_test_state *uts)
 	ut_assert_nextline("Method:    extlinux");
 	ut_assert_nextline("State:     ready");
 	ut_assert_nextline("Partition: 1");
+	ut_assert_nextline("Entry:     0");
 	if (IS_ENABLED(CONFIG_BLK_LUKS))
 		ut_assert_nextline("Encrypted: LUKSv2");
 	ut_assert_skip_to_line("Error:     0");
@@ -1890,6 +1892,7 @@  static int bootflow_cmd_bls(struct unit_test_state *uts)
 	ut_assert_nextline("Method:    bls");
 	ut_assert_nextline("State:     ready");
 	ut_assert_nextline("Partition: 1");
+	ut_assert_nextline("Entry:     0");
 	if (IS_ENABLED(CONFIG_BLK_LUKS))
 		ut_assert_nextline("Encrypted: no");
 	ut_assert_nextline("Subdir:    (none)");