[PATCH 49/71] bootstd: Set the distro_bootpart env var with scripts

Simon Glass sjg at chromium.org
Wed Dec 7 09:51:15 CET 2022


This environment variable is supposed to be set so that the script knows
which partition holds the script. Set it before invoking the script.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 boot/bootmeth_script.c | 3 +++
 include/bootflow.h     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c
index e438580d9e1..a1d31524efc 100644
--- a/boot/bootmeth_script.c
+++ b/boot/bootmeth_script.c
@@ -87,6 +87,8 @@ static int script_boot(struct udevice *dev, struct bootflow *bflow)
 	ret = env_set("devtype", blk_get_devtype(bflow->blk));
 	if (!ret)
 		ret = env_set_hex("devnum", desc->devnum);
+	if (!ret)
+		ret = env_set_hex("distro_bootpart", bflow->part);
 	if (!ret)
 		ret = env_set("prefix", bflow->subdir);
 	if (!ret && IS_ENABLED(CONFIG_ARCH_SUNXI) &&
@@ -97,6 +99,7 @@ static int script_boot(struct udevice *dev, struct bootflow *bflow)
 
 	log_debug("devtype: %s\n", env_get("devtype"));
 	log_debug("devnum: %s\n", env_get("devnum"));
+	log_debug("distro_bootpart: %s\n", env_get("distro_bootpart"));
 	log_debug("prefix: %s\n", env_get("prefix"));
 	log_debug("mmc_bootdev: %s\n", env_get("mmc_bootdev"));
 
diff --git a/include/bootflow.h b/include/bootflow.h
index f7b821fa10e..75f2064f47c 100644
--- a/include/bootflow.h
+++ b/include/bootflow.h
@@ -133,6 +133,8 @@ enum bootflow_flags_t {
  *	appear first, then the global ones, if any
  * @doing_global: true if we are iterating through the global bootmeths (which
  *	happens before the normal ones)
+ * @method_flags: flags controlling which methods should be used for this @dev
+ * (enum bootflow_meth_flags_t)
  */
 struct bootflow_iter {
 	int flags;
@@ -150,6 +152,7 @@ struct bootflow_iter {
 	int first_glob_method;
 	struct udevice **method_order;
 	bool doing_global;
+	int method_flags;
 };
 
 /**
-- 
2.39.0.rc0.267.gcb52ba06e7-goog



More information about the U-Boot-Custodians mailing list