diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/Kconfig | 2 | ||||
-rw-r--r-- | fs/fs.c | 5 | ||||
-rw-r--r-- | fs/sandbox/Kconfig | 2 | ||||
-rw-r--r-- | fs/sandbox/Makefile | 1 | ||||
-rw-r--r-- | fs/sandbox/host_bootdev.c | 56 |
5 files changed, 66 insertions, 0 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index cda9f66cc93..aa13d4faa77 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -16,6 +16,8 @@ source "fs/fat/Kconfig" source "fs/jffs2/Kconfig" +source "fs/sandbox/Kconfig" + source "fs/ubifs/Kconfig" source "fs/cramfs/Kconfig" @@ -36,6 +36,11 @@ static int fs_dev_part; static struct disk_partition fs_partition; static int fs_type = FS_TYPE_ANY; +void fs_set_type(int type) +{ + fs_type = type; +} + static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { diff --git a/fs/sandbox/Kconfig b/fs/sandbox/Kconfig new file mode 100644 index 00000000000..b2af8482428 --- /dev/null +++ b/fs/sandbox/Kconfig @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0+ +# diff --git a/fs/sandbox/Makefile b/fs/sandbox/Makefile index 06090519bf4..880d59dd693 100644 --- a/fs/sandbox/Makefile +++ b/fs/sandbox/Makefile @@ -9,3 +9,4 @@ # Pavel Bartusek, Sysgo Real-Time Solutions AG, pba@sysgo.de obj-y := sandboxfs.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += host_bootdev.o diff --git a/fs/sandbox/host_bootdev.c b/fs/sandbox/host_bootdev.c new file mode 100644 index 00000000000..0d12ee4ef74 --- /dev/null +++ b/fs/sandbox/host_bootdev.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Bootdevice for MMC + * + * Copyright 2021 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#include <common.h> +#include <bootdev.h> +#include <bootflow.h> +#include <bootmeth.h> +#include <dm.h> +#include <fs.h> + +static int host_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, + struct bootflow *bflow) +{ + int ret; + + if (iter->part) + return log_msg_ret("max", -ESHUTDOWN); + + bflow->name = strdup(dev->name); + if (!bflow->name) + return log_msg_ret("name", -ENOMEM); + + ret = bootmeth_check(bflow->method, iter); + if (ret) + return log_msg_ret("check", ret); + + bflow->state = BOOTFLOWST_MEDIA; + bflow->fs_type = FS_TYPE_SANDBOX; + + ret = bootmeth_read_bootflow(bflow->method, bflow); + if (ret) + return log_msg_ret("method", ret); + + return 0; +} + +struct bootdev_ops host_bootdev_ops = { + .get_bootflow = host_get_bootflow, +}; + +static const struct udevice_id host_bootdev_ids[] = { + { .compatible = "sandbox,bootdev-host" }, + { } +}; + +U_BOOT_DRIVER(host_bootdev) = { + .name = "host_bootdev", + .id = UCLASS_BOOTDEV, + .ops = &host_bootdev_ops, + .of_match = host_bootdev_ids, +}; |