From 858fefd5fc3ae9006a0f545d7744e6f95270b14d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:27 -0600 Subject: image: Add a function to find a script in an image Split this functionality out of the 'source' command so it can be used from another place. For now leave it where it is, but a future patch will move it out of cmd/ Signed-off-by: Simon Glass --- include/image.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/image.h') diff --git a/include/image.h b/include/image.h index bed75ce1b38..f7ebe9cbe8c 100644 --- a/include/image.h +++ b/include/image.h @@ -729,6 +729,20 @@ int fit_image_load(struct bootm_headers *images, ulong addr, int image_source_script(ulong addr, const char *fit_uname, const char *confname); +/** + * image_locate_script() - Locate the raw script in an image + * + * @buf: Address of image + * @size: Size of image in bytes + * @fit_uname: Node name of FIT image to read + * @confname: Node name of FIT config to read + * @datap: Returns pointer to raw script on success + * @lenp: Returns size of raw script on success + * @return 0 if OK, non-zero on error + */ +int image_locate_script(void *buf, int size, const char *fit_uname, + const char *confname, char **datap, uint *lenp); + /** * fit_get_node_from_config() - Look up an image a FIT by type * -- cgit v1.2.3 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 --- include/image.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'include/image.h') diff --git a/include/image.h b/include/image.h index f7ebe9cbe8c..7717a4c13d3 100644 --- a/include/image.h +++ b/include/image.h @@ -709,26 +709,6 @@ int fit_image_load(struct bootm_headers *images, ulong addr, int arch, int image_ph_type, int bootstage_id, enum fit_load_op load_op, ulong *datap, ulong *lenp); -/** - * image_source_script() - Execute a script - * @addr: Address of script - * @fit_uname: FIT subimage name - * @confname: FIT config name. The subimage is chosen based on FIT_SCRIPT_PROP. - * - * Executes a U-Boot script at a particular address in memory. The script should - * have a header (FIT or legacy) with the script type (IH_TYPE_SCRIPT). - * - * If @fit_uname is the empty string, then the default image is used. If - * @confname is the empty string, the default config is used. If @confname and - * @fit_uname are both non-%NULL, then @confname is ignored. If @confname and - * @fit_uname are both %NULL, then first the default config is tried, and then - * the default image. - * - * Return: result code (enum command_ret_t) - */ -int image_source_script(ulong addr, const char *fit_uname, - const char *confname); - /** * image_locate_script() - Locate the raw script in an image * -- cgit v1.2.3