From patchwork Tue Mar 24 22:19:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2055 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390794; bh=riyt6O3qixogOnZcs+LNxLVqrA3i4PZHsLOQ5sV5Mcs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IOvUAylkr3rutlsttmc47YFdOSGAfZEL23Klq0CiTnoNSFErcBocNqn5PgpaQkmbt cknYAAcRk7OdboSL1ljCZinTXZBKnaXf7G+gxfLoJDsoFu2Fz8cNNrmfunk7bCCiIy n8wrKBS+a/aPcuRa3Jy6Aameuu7eQfwSVa0WPxbuqsD2ZdQ/Tmwsz6lZwh6OHK3EGk nTpOxQa99+wTwcd9BGP9Qq0DnR61jigPzu5M8i5jNkGJs+Iv2aHJDYwiVFvpsN82C3 qaQ+GzOKFMrPEtbJ9U4xtd7zTUSEm6lUNBN6q7G4YfGijUz67I7O1AvRqorJUIOw4G AjfnKA2z1TNTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B96126A1FD for ; Tue, 24 Mar 2026 16:19:54 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id V5uEUAlLpgdu for ; Tue, 24 Mar 2026 16:19:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390792; bh=riyt6O3qixogOnZcs+LNxLVqrA3i4PZHsLOQ5sV5Mcs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ReIqUbyZdV4xNN/9riJ9rkfb+0+X6VPbqopWFHhOx3lI3mJ1zPE9Z+NbSdTg9NBIr JIbUL+ZrIbjw5FMUwGB90FXLbuOTLiE9Y/Aw2JzAl9AYYK5WhWUkOh6oJUGc+VXmnZ iyO6BRsTcrs2rgndBnDEPkSf/pBcXJ0Xx3Cc1TkczOB2Xe+rc9laJy8PleAIu+tzXY D+xI6D4pm33Wej1KFKJlmcdM6OKlD3UFXxn9m2kp6FaJTslqpQHDHJhNuRuWHiueaS 5JPkBGz+XQCcmWGR3O3PdmxCDYYNXEVfwFVaDfC5iHLlE2+2fzzPNI7a7HO06au756 ZE7eGFbtqR8jA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 154866A257 for ; Tue, 24 Mar 2026 16:19:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390789; bh=YDJ7izV40lPKGBvWdB+OHvZDM5G+5DE2yqM6A6IQ9WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uN2BRFOogHHq6lFpubmvff++9sDR7WtMHeB2F2c6dOWjjRjZH2DpiE7T2EmcPuIWs yleDJn9rAcUy3C1gYciPWwXkICvYzFw3k8JRZmAYKTAaaaxOkYcqicVJoyujL5KGUu 4EOhuM+bvvry+wPX0PyVg0DbfSaYTlIrlW1T71SMLVnd8Cs7hKXuAT3bveqBYq6wBW 2/DInxjIdPg8/UJqCB6FCv47X6W5wTIDYehCEz0KesBC3ArZBYrM5AtkfuZ6KcY3pr RRuqMkxxHNg/PEquCalW6qAvZSX7KEZxCsi87b/3k4v8OjOYL18gzX8RzvLg70KiGQ wyuZ4dA8u4CPg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 685416A23D; Tue, 24 Mar 2026 16:19:49 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id jbtl5kRp_RhC; Tue, 24 Mar 2026 16:19:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774390787; bh=nmiOhEKemyGRkcRFc+fpaWiK+V03LgGspr+uG3LusqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdrrAkOUEcnNV1NtgMeqQzWH/HR1ydvRBB4IAa93woy4GUwy98804+OPSJ/Q+hM2r Vw42GUeh4YRC0Yfkq2DrCN/W9/ecNQu28t39BUFKEjQtsiargwSNoE/xGaMfmGdRPj FaKdZcbZliLou6LY+/uRIFWvwn9TCLyYwjwWeF8yUTfQfJk3ZW2P5Kyo5LGHoqV4XQ 7nhJBATv9XfQgbJV/FTdiXiQvKbyaNZ1UxCDtRMLWPQBNN8GEv/Cns1qItYua/wyCT FX7prOnLZ4csmNOdoxbwgMaTyaDlwR7LDyI8gCcx0Xo9wuj76xx+DIVLznrC+/ylRM qnN8u6RhTmzfQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 213516A238; Tue, 24 Mar 2026 16:19:47 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 24 Mar 2026 16:19:03 -0600 Message-ID: <20260324221911.3678307-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324221911.3678307-1-sjg@u-boot.org> References: <20260324221911.3678307-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: T3GUR4G7AYWZ2EYHVYARGUA5WNRWQR37 X-Message-ID-Hash: T3GUR4G7AYWZ2EYHVYARGUA5WNRWQR37 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/12] bootstd: Show entry name in bootflow info List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add an entry_name field to struct bootflow to store a short identifier for the entry. For extlinux, this is the label name (e.g. "l0"). For BLS, this is the title field (e.g. "Test Boot"). Display it after the entry number in 'bootflow info', e.g. "Entry: 0: l0", so the user can identify which entry a bootflow represents without relying solely on the OS name. Signed-off-by: Simon Glass --- boot/bootflow.c | 1 + boot/bootmeth_bls.c | 11 ++++++++++- boot/bootmeth_extlinux.c | 7 +++++++ cmd/bootflow.c | 3 ++- doc/usage/cmd/bootflow.rst | 4 ++-- include/bootflow.h | 3 +++ test/boot/bootflow.c | 6 +++--- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index d44ba65c1a9..4247093548b 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -738,6 +738,7 @@ void bootflow_free(struct bootflow *bflow) struct bootflow_img *img; free(bflow->name); + free(bflow->entry_name); free(bflow->subdir); free(bflow->fname); if (!(bflow->flags & BOOTFLOWF_STATIC_BUF)) diff --git a/boot/bootmeth_bls.c b/boot/bootmeth_bls.c index fc9c1bb70a2..85d8dfa91df 100644 --- a/boot/bootmeth_bls.c +++ b/boot/bootmeth_bls.c @@ -364,8 +364,17 @@ static int bls_read_bootflow(struct udevice *dev, struct bootflow *bflow) ret = bls_entry_init(&entry, bflow, size); bls_entry_uninit(&entry); + if (ret) + return ret; - return ret; + /* Use the title as the entry identifier */ + if (bflow->os_name) { + bflow->entry_name = strdup(bflow->os_name); + if (!bflow->entry_name) + return log_msg_ret("ent", -ENOMEM); + } + + return 0; } /** diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c index bfc816f3628..542daf9ab41 100644 --- a/boot/bootmeth_extlinux.c +++ b/boot/bootmeth_extlinux.c @@ -160,6 +160,13 @@ found: return log_msg_ret("os", -ENOMEM); } } + if (label->name) { + bflow->entry_name = strdup(label->name); + if (!bflow->entry_name) { + pxe_cleanup(ctx); + return log_msg_ret("xnt", -ENOMEM); + } + } pxe_cleanup(ctx); diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 1c40037e6a6..a701b960efe 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -377,7 +377,8 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, ucp = dev_get_uclass_plat(bflow->method); if (ucp->flags & BOOTMETHF_MULTI) - printf("Entry: %d\n", bflow->entry); + printf("Entry: %d: %s\n", bflow->entry, + bflow->entry_name); } /* Show encryption status with LUKS version if applicable */ diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index 3a21e00a47b..6a1676a6098 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -167,7 +167,7 @@ Type distro Method: extlinux State ready Partition 2 -Entry 0 +Entry 0: l0 Encrypted no Subdir (none) Filename /extlinux/extlinux.conf @@ -351,7 +351,7 @@ displayed and booted:: Method: distro State: ready Partition: 2 - Entry: 0 + Entry: 0: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) Encrypted: no Subdir: (none) Filename: extlinux/extlinux.conf diff --git a/include/bootflow.h b/include/bootflow.h index 2a4a96c1031..750abafaf6e 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -78,6 +78,8 @@ enum bootflow_flags_t { * @entry: Entry index within this (dev, part, method) combination. Used by * bootmeths with BOOTMETHF_MULTI to select which entry to return (e.g. * which label in an extlinux config). Always 0 for non-multi bootmeths. + * @entry_name: Short identifier for this entry (allocated), e.g. the extlinux + * label name or BLS conf filename. NULL if not set. * @fs_type: Filesystem type (FS_TYPE...) if this is fixed by the media, else 0. * For example, the sandbox host-filesystem bootdev sets this to * FS_TYPE_SANDBOX @@ -114,6 +116,7 @@ struct bootflow { struct udevice *blk; int part; int entry; + char *entry_name; int fs_type; struct udevice *method; char *name; diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 84d80d9fd10..317d7e4c47d 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -258,7 +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"); + ut_assert_nextline("Entry: 0: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)"); if (IS_ENABLED(CONFIG_BLK_LUKS)) ut_assert_nextline("Encrypted: no"); ut_assert_nextline("Subdir: (none)"); @@ -1846,7 +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"); + ut_assert_nextline("Entry: 0: l0"); if (IS_ENABLED(CONFIG_BLK_LUKS)) ut_assert_nextline("Encrypted: LUKSv2"); ut_assert_skip_to_line("Error: 0"); @@ -1892,7 +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"); + ut_assert_nextline("Entry: 0: Test Boot"); if (IS_ENABLED(CONFIG_BLK_LUKS)) ut_assert_nextline("Encrypted: no"); ut_assert_nextline("Subdir: (none)");