diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-06 08:52:28 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-16 18:26:50 -0500 |
commit | 30f3333d8860fd97e131e24ad33a80f4d46e98b1 (patch) | |
tree | fe0fa6615416ff347f43605a20e30212bdb8a03a /common/command.c | |
parent | 858fefd5fc3ae9006a0f545d7744e6f95270b14d (diff) |
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/command.c')
-rw-r--r-- | common/command.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/command.c b/common/command.c index 41c91c6d8c..7a86bd76a4 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); +} |