
Attached host images need to be booted with the u-boot built in fs drivers rather than sandboxfs Signed-off-by: Ludwig Nussel <ludwig.nussel@siemens.com> --- drivers/block/Makefile | 2 +- drivers/block/host_bootdev.c | 40 +++++++++++++++++++ fs/sandbox/Makefile | 2 +- .../{host_bootdev.c => sandboxfs_bootdev.c} | 18 ++++----- 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 drivers/block/host_bootdev.c rename fs/sandbox/{host_bootdev.c => sandboxfs_bootdev.c} (65%) diff --git a/drivers/block/Makefile b/drivers/block/Makefile index f5a9d8637a3..acad2488040 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -13,7 +13,7 @@ ifndef CONFIG_XPL_BUILD obj-$(CONFIG_IDE) += ide.o obj-$(CONFIG_RKMTD) += rkmtd.o endif -obj-$(CONFIG_SANDBOX) += sandbox.o host-uclass.o host_dev.o +obj-$(CONFIG_SANDBOX) += sandbox.o host-uclass.o host_dev.o host_bootdev.o obj-$(CONFIG_$(PHASE_)BLOCK_CACHE) += blkcache.o obj-$(CONFIG_$(PHASE_)BLKMAP) += blkmap.o obj-$(CONFIG_$(PHASE_)BLKMAP) += blkmap_helper.o diff --git a/drivers/block/host_bootdev.c b/drivers/block/host_bootdev.c new file mode 100644 index 00000000000..fae35f091bd --- /dev/null +++ b/drivers/block/host_bootdev.c @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Bootdev for host + * + * Copyright 2021 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ +#include <bootdev.h> +#include <dm.h> + +static int host_bootdev_bind(struct udevice *dev) +{ + struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev); + + ucp->prio = BOOTDEVP_2_INTERNAL_FAST; + + return 0; +} + +struct bootdev_ops host_bootdev_ops = { +}; + +static const struct udevice_id host_bootdev_ids[] = { + { .compatible = "u-boot,bootdev-host" }, + { } +}; + +U_BOOT_DRIVER(host_bootdev) = { + .name = "host_bootdev", + .id = UCLASS_BOOTDEV, + .ops = &host_bootdev_ops, + .bind = host_bootdev_bind, + .of_match = host_bootdev_ids, +}; + +BOOTDEV_HUNTER(host_bootdev_hunter) = { + .prio = BOOTDEVP_2_INTERNAL_FAST, + .uclass = UCLASS_HOST, + .drv = DM_DRIVER_REF(host_bootdev), +}; diff --git a/fs/sandbox/Makefile b/fs/sandbox/Makefile index 54ad842d1fe..97926a7f184 100644 --- a/fs/sandbox/Makefile +++ b/fs/sandbox/Makefile @@ -9,4 +9,4 @@ # Pavel Bartusek, Sysgo Real-Time Solutions AG, pba@sysgo.de obj-y := sandboxfs.o -obj-$(CONFIG_$(PHASE_)BOOTSTD) += host_bootdev.o +obj-$(CONFIG_$(PHASE_)BOOTSTD) += sandboxfs_bootdev.o diff --git a/fs/sandbox/host_bootdev.c b/fs/sandbox/sandboxfs_bootdev.c similarity index 65% rename from fs/sandbox/host_bootdev.c rename to fs/sandbox/sandboxfs_bootdev.c index 3f74972a9f8..82eb124d55f 100644 --- a/fs/sandbox/host_bootdev.c +++ b/fs/sandbox/sandboxfs_bootdev.c @@ -12,7 +12,7 @@ #include <dm.h> #include <fs.h> -static int host_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, +static int sandbox_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, struct bootflow *bflow) { int ret; @@ -38,18 +38,18 @@ static int host_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, return 0; } -struct bootdev_ops host_bootdev_ops = { - .get_bootflow = host_get_bootflow, +struct bootdev_ops sandbox_bootdev_ops = { + .get_bootflow = sandbox_get_bootflow, }; -static const struct udevice_id host_bootdev_ids[] = { - { .compatible = "sandbox,bootdev-host" }, +static const struct udevice_id sandbox_bootdev_ids[] = { + { .compatible = "sandbox,bootdev-sandbox" }, { } }; -U_BOOT_DRIVER(host_bootdev) = { - .name = "host_bootdev", +U_BOOT_DRIVER(sandbox_bootdev) = { + .name = "sandbox_bootdev", .id = UCLASS_BOOTDEV, - .ops = &host_bootdev_ops, - .of_match = host_bootdev_ids, + .ops = &sandbox_bootdev_ops, + .of_match = sandbox_bootdev_ids, }; -- 2.34.1