From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 5/5] boot: assign names to bootentry providers
Date: Fri, 12 Dec 2025 17:12:53 +0100 [thread overview]
Message-ID: <20251212161424.1627626-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251212161424.1627626-1-a.fatoum@pengutronix.de>
This allows board- or functionality-specific (like EFI loader support)
to invoke a specific bootentry provider by name.
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- add Sascha's R-b
---
arch/arm/boards/protonic-imx6/board.c | 1 +
common/blspec.c | 1 +
common/boot.c | 15 +++++++++++++++
common/bootchooser.c | 1 +
common/bootdef.c | 1 +
include/boot.h | 2 ++
6 files changed, 21 insertions(+)
diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
index 80558ce15817..c15a349c8a88 100644
--- a/arch/arm/boards/protonic-imx6/board.c
+++ b/arch/arm/boards/protonic-imx6/board.c
@@ -461,6 +461,7 @@ static int prt_imx6_bootentry_generate(struct bootentries *bootentries,
}
static struct bootentry_provider prt_imx6_bootentry_provider = {
+ .name = "prt-imx6",
.generate = prt_imx6_bootentry_generate,
};
diff --git a/common/blspec.c b/common/blspec.c
index bc2c3204ad62..624e4c115272 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -639,6 +639,7 @@ static int blspec_bootentry_generate(struct bootentries *bootentries,
}
static struct bootentry_provider blspec_bootentry_provider = {
+ .name = "blspec",
.generate = blspec_bootentry_generate,
};
diff --git a/common/boot.c b/common/boot.c
index 14525d31ae2d..1059e6d995d3 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -288,6 +288,21 @@ int bootentry_register_provider(struct bootentry_provider *p)
return 0;
}
+struct bootentry_provider *get_bootentry_provider(const char *name)
+{
+ struct bootentry_provider *p;
+
+ if (!name)
+ return NULL;
+
+ list_for_each_entry(p, &bootentry_providers, list) {
+ if (streq_ptr(p->name, name))
+ return p;
+ }
+
+ return NULL;
+}
+
/*
* nfs_find_mountpath - Check if a given url is already mounted
*/
diff --git a/common/bootchooser.c b/common/bootchooser.c
index a79eee8ca2c4..2905a0ca677e 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -962,6 +962,7 @@ static int bootchooser_add_entry(struct bootentries *entries, const char *name)
}
static struct bootentry_provider bootchooser_entry_provider = {
+ .name = "bootchooser",
.generate = bootchooser_add_entry,
};
diff --git a/common/bootdef.c b/common/bootdef.c
index e8140d3a6bce..85471d92d3c5 100644
--- a/common/bootdef.c
+++ b/common/bootdef.c
@@ -31,6 +31,7 @@ static int bootdef_add_entry(struct bootentries *entries, const char *name)
}
static struct bootentry_provider bootdef_entry_provider = {
+ .name = "bootdef",
.generate = bootdef_add_entry,
};
diff --git a/include/boot.h b/include/boot.h
index c1676364cadc..ae32b9ead93f 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -26,12 +26,14 @@ struct bootentry {
int bootentries_add_entry(struct bootentries *entries, struct bootentry *entry);
struct bootentry_provider {
+ const char *name;
int (*generate)(struct bootentries *bootentries, const char *name);
/* internal fields */
struct list_head list;
};
int bootentry_register_provider(struct bootentry_provider *provider);
+struct bootentry_provider *get_bootentry_provider(const char *name);
#define bootentries_for_each_entry(bootentries, entry) \
list_for_each_entry(entry, &bootentries->entries, list)
--
2.47.3
next prev parent reply other threads:[~2025-12-12 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 16:12 [PATCH v2 1/5] cdev-alias: support referencing diskuuid without child partition Ahmad Fatoum
2025-12-12 16:12 ` [PATCH v2 2/5] cdev-alias: fix memory leak in diskuuid handling Ahmad Fatoum
2025-12-12 16:12 ` [PATCH v2 3/5] cdev-alias: add support for storage{.removable,.builtin} Ahmad Fatoum
2025-12-12 16:12 ` [PATCH v2 4/5] boot: try builtin and removable media before net for boot.default Ahmad Fatoum
2025-12-12 16:12 ` Ahmad Fatoum [this message]
2025-12-15 8:15 ` [PATCH v2 1/5] cdev-alias: support referencing diskuuid without child partition Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251212161424.1627626-5-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox