Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
[oweals/u-boot.git] / cmd / source.c
index 6d98a1cfd32b802ac2b0ff80d39fb3ec12fe47de..92f8f77ee6fcc60a1cc56f59d4e26db87f720758 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <image.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -40,11 +41,10 @@ static const char *get_default_image(const void *fit)
 }
 #endif
 
-int
-source (ulong addr, const char *fit_uname)
+int image_source_script(ulong addr, const char *fit_uname)
 {
        ulong           len;
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
        const image_header_t *hdr;
 #endif
        u32             *data;
@@ -61,7 +61,7 @@ source (ulong addr, const char *fit_uname)
 
        buf = map_sysmem(addr, 0);
        switch (genimg_get_format(buf)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
        case IMAGE_FORMAT_LEGACY:
                hdr = buf;
 
@@ -171,7 +171,8 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                addr = CONFIG_SYS_LOAD_ADDR;
                debug ("*  source: default load address = 0x%08lx\n", addr);
 #if defined(CONFIG_FIT)
-       } else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) {
+       } else if (fit_parse_subimage(argv[1], image_load_addr, &addr,
+                                     &fit_uname)) {
                debug ("*  source: subimage '%s' from FIT image at 0x%08lx\n",
                                fit_uname, addr);
 #endif
@@ -181,7 +182,7 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        }
 
        printf ("## Executing script at %08lx\n", addr);
-       rcode = source (addr, fit_uname);
+       rcode = image_source_script(addr, fit_uname);
        return rcode;
 }