]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootm: Simplify Android ramdisk addr in bootm_find_images()
authorSimon Glass <sjg@chromium.org>
Sat, 18 Nov 2023 21:05:13 +0000 (14:05 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 13 Dec 2023 16:51:24 +0000 (11:51 -0500)
The Android mechanism uses the loadaddr envrionment-variable to get the
load address, if none is provided. This is equivalent to
image_load_addr so use that instead, converting it to a string as
needed.

This change will permit passing img_addr to this function, in a future
change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
boot/bootm.c

index aae097df0c7fe9df8095ab571265ff3810dce5cf..db1466cecf2d115acb5eac9a9a737d384454c991 100644 (file)
@@ -490,15 +490,20 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
                      ulong size)
 {
        const char *select = NULL;
+       char addr_str[17];
        ulong img_addr;
        void *buf;
        int ret;
 
+       img_addr = argc ? hextoul(argv[0], NULL) : image_load_addr;
+
        if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
                /* Look for an Android boot image */
                buf = map_sysmem(images.os.start, 0);
-               if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
-                       select = argc ? argv[0] : env_get("loadaddr");
+               if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID) {
+                       strcpy(addr_str, simple_xtoa(img_addr));
+                       select = addr_str;
+               }
        }
 
        if (argc >= 2)
@@ -525,7 +530,6 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
        }
 
        if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
-               img_addr = argc ? hextoul(argv[0], NULL) : image_load_addr;
                buf = map_sysmem(img_addr, 0);
 
                /* find flattened device tree */