aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-06 08:52:28 -0600
committerTom Rini <trini@konsulko.com>2023-01-16 18:26:50 -0500
commit30f3333d8860fd97e131e24ad33a80f4d46e98b1 (patch)
treefe0fa6615416ff347f43605a20e30212bdb8a03a /common
parent858fefd5fc3ae9006a0f545d7744e6f95270b14d (diff)
downloadu-boot-30f3333d8860fd97e131e24ad33a80f4d46e98b1.zip
u-boot-30f3333d8860fd97e131e24ad33a80f4d46e98b1.tar.gz
u-boot-30f3333d8860fd97e131e24ad33a80f4d46e98b1.tar.bz2
image: Move common image code to image_board and command
We should use the cmd/ directory for commands rather than for common code used elsewhere in U-Boot. Move the common 'source' code into image-board.c to achieve this. The image_source_script() function needs to call run_command_list() so seems to belong better in the command library. Move and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/command.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/command.c b/common/command.c
index 41c91c6..7a86bd7 100644
--- a/common/command.c
+++ b/common/command.c
@@ -13,7 +13,9 @@
#include <command.h>
#include <console.h>
#include <env.h>
+#include <image.h>
#include <log.h>
+#include <mapmem.h>
#include <asm/global_data.h>
#include <linux/ctype.h>
@@ -654,3 +656,20 @@ int cmd_process_error(struct cmd_tbl *cmdtp, int err)
return CMD_RET_SUCCESS;
}
+
+int cmd_source_script(ulong addr, const char *fit_uname, const char *confname)
+{
+ char *data;
+ void *buf;
+ uint len;
+ int ret;
+
+ buf = map_sysmem(addr, 0);
+ ret = image_locate_script(buf, 0, fit_uname, confname, &data, &len);
+ unmap_sysmem(buf);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ debug("** Script length: %d\n", len);
+ return run_command_list(data, len, 0);
+}