From 30f3333d8860fd97e131e24ad33a80f4d46e98b1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:28 -0600 Subject: 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 --- common/command.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'common/command.c') diff --git a/common/command.c b/common/command.c index 41c91c6d8c8..7a86bd76a4c 100644 --- a/common/command.c +++ b/common/command.c @@ -13,7 +13,9 @@ #include #include #include +#include #include +#include #include #include @@ -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); +} -- cgit v1.2.3