boot: Move obtaining the label into a common file

The 'bootflow list' command supports looking at the EFI device-path when
available. Move this piece into a common function so it can be used
elsewhere.

This updates the output from 'bootflow list'.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-28 15:51:01 -06:00
parent 2b8858b779
commit bd78e82720
4 changed files with 38 additions and 17 deletions

View File

@@ -70,21 +70,7 @@ static void report_bootflow_err(struct bootflow *bflow, int err)
*/
static void show_bootflow(int index, struct bootflow *bflow, bool errors)
{
const char *name = NULL;
if (IS_ENABLED(CONFIG_EFI_APP)) {
struct efi_device_path *dp;
enum uclass_id id;
int ret;
ret = efi_dp_from_bootflow(bflow, &dp, NULL);
if (!ret)
name = efi_dp_guess_uclass(dp, &id);
} else if (bflow->dev) {
name = dev_get_uclass_name(dev_get_parent(bflow->dev));
}
if (!name)
name = "(none)";
const char *name = bootflow_guess_label(bflow);
printf("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n", index,
bflow->method ? bflow->method->name : "(none)",