Make script_boot() available as bootmeth_script_boot() so another
bootmeth can reuse the device environment setup and script execution
without duplicating the filesystem script bootmeth's handler.

Signed-off-by: He Yong <[email protected]>
---
Changes in v3:
- Split the shared script execution-handler export into its own patch.

 boot/bootmeth_script.c |  4 ++--
 include/bootmeth.h     | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c
index cd50977cc40..9e95cc51e58 100644
--- a/boot/bootmeth_script.c
+++ b/boot/bootmeth_script.c
@@ -188,7 +188,7 @@ static int script_set_bootflow(struct udevice *dev, struct 
bootflow *bflow,
        return 0;
 }
 
-static int script_boot(struct udevice *dev, struct bootflow *bflow)
+int bootmeth_script_boot(struct udevice *dev, struct bootflow *bflow)
 {
        struct blk_desc *desc;
        ulong addr;
@@ -258,7 +258,7 @@ static struct bootmeth_ops script_bootmeth_ops = {
        .read_bootflow  = script_read_bootflow,
        .set_bootflow   = script_set_bootflow,
        .read_file      = bootmeth_common_read_file,
-       .boot           = script_boot,
+       .boot           = bootmeth_script_boot,
 };
 
 static const struct udevice_id script_bootmeth_ids[] = {
diff --git a/include/bootmeth.h b/include/bootmeth.h
index 2a492dfd73a..2d855632a50 100644
--- a/include/bootmeth.h
+++ b/include/bootmeth.h
@@ -425,4 +425,16 @@ int bootmeth_common_read_file(struct udevice *dev, struct 
bootflow *bflow,
  */
 int bootmeth_get_bootflow(struct udevice *dev, struct bootflow *bflow);
 
+/**
+ * bootmeth_script_boot() - Execute a script bootflow
+ *
+ * Set the device and partition environment variables and execute the script
+ * stored in the bootflow buffer.
+ *
+ * @dev: Bootmeth device
+ * @bflow: Bootflow containing the script image
+ * @return 0 on success, or a error code
+ */
+int bootmeth_script_boot(struct udevice *dev, struct bootflow *bflow);
+
 #endif
-- 
2.43.0

Reply via email to