[PATCH 15/18] misc: storage-by-alias: add support barebox,bootsource
Ahmad Fatoum
a.fatoum at pengutronix.de
Sun Apr 13 23:31:49 PDT 2025
This is useful as state backend that need not hardcode a specific device
at compile time and instead uses the bootsource device at runtime.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/misc/Kconfig | 5 +++++
drivers/misc/storage-by-alias.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 73814f36bf9c..e235646ee551 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -60,6 +60,11 @@ config STORAGE_BY_ALIAS
Following compatibles are supported:
+ - "barebox,bootsource"
+
+ Alias the device barebox was booted from. This is useful to have
+ barebox-state come from the same device as barebox itself.
+
- "barebox,storage-by-uuid"
Look for a storage device matching the given DISKUUID and when found
diff --git a/drivers/misc/storage-by-alias.c b/drivers/misc/storage-by-alias.c
index 0bf0059ad41c..ece5929d60ce 100644
--- a/drivers/misc/storage-by-alias.c
+++ b/drivers/misc/storage-by-alias.c
@@ -7,6 +7,9 @@
* - barebox,storage-by-uuid
* Useful for referencing existing EFI disks and their partition
* from device tree by offset
+ * - barebox,bootsource
+ * Reference the boot medium indicated by barebox $bootsource
+ * and $bootsource_instance variable
*/
#include <common.h>
#include <init.h>
@@ -179,6 +182,12 @@ static int storage_by_uuid_init(struct sba *sba)
return 0;
}
+static int storage_by_bootsource_init(struct sba *sba)
+{
+ sba->alias = xasprintf("bootsource");
+ return 0;
+}
+
static int sba_probe(struct device *dev)
{
int (*init)(struct sba *);
@@ -209,6 +218,9 @@ static struct of_device_id sba_dt_ids[] = {
{
.compatible = "barebox,storage-by-uuid",
.data = storage_by_uuid_init
+ }, {
+ .compatible = "barebox,bootsource",
+ .data = storage_by_bootsource_init
}, {
/* sentinel */
}
--
2.39.5
More information about the barebox
mailing list