[Concept,08/12] bootstd: Show entry number in bootflow info
Commit Message
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(-)
@@ -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)) {
@@ -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
@@ -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)");