diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/bootm.c | 9 | ||||
-rw-r--r-- | common/dlmalloc.c | 3 | ||||
-rw-r--r-- | common/image-android.c | 13 | ||||
-rw-r--r-- | common/image-fdt.c | 2 | ||||
-rw-r--r-- | common/image-fit.c | 12 | ||||
-rw-r--r-- | common/image.c | 2 | ||||
-rw-r--r-- | common/spl/spl_nand.c | 4 | ||||
-rw-r--r-- | common/spl/spl_ymodem.c | 20 |
8 files changed, 52 insertions, 13 deletions
diff --git a/common/bootm.c b/common/bootm.c index 3adbceaa38..b5d37d38db 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -154,7 +154,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, #ifdef CONFIG_ANDROID_BOOT_IMAGE case IMAGE_FORMAT_ANDROID: images.os.type = IH_TYPE_KERNEL; - images.os.comp = IH_COMP_NONE; + images.os.comp = android_image_get_kcomp(os_hdr); images.os.os = IH_OS_LINUX; images.os.end = android_image_get_end(os_hdr); @@ -450,7 +450,6 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress) ulong image_start = os.image_start; ulong image_len = os.image_len; ulong flush_start = ALIGN_DOWN(load, ARCH_DMA_MINALIGN); - ulong flush_len; bool no_overlap; void *load_buf, *image_buf; int err; @@ -465,11 +464,7 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress) return err; } - flush_len = load_end - load; - if (flush_start < load) - flush_len += load - flush_start; - - flush_cache(flush_start, ALIGN(flush_len, ARCH_DMA_MINALIGN)); + flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start); debug(" kernel loaded at 0x%08lx, end = 0x%08lx\n", load, load_end); bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED); diff --git a/common/dlmalloc.c b/common/dlmalloc.c index edaad299bb..6f12a18d54 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1893,8 +1893,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; #if CONFIG_VAL(SYS_MALLOC_F_LEN) if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) { - nb = roundup(bytes, alignment); - return malloc_simple(nb); + return memalign_simple(alignment, bytes); } #endif diff --git a/common/image-android.c b/common/image-android.c index 2f38c191e9..8b0f6b3b8b 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -8,6 +8,7 @@ #include <android_image.h> #include <malloc.h> #include <errno.h> +#include <asm/unaligned.h> #define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR 0x10008000 @@ -126,6 +127,16 @@ ulong android_image_get_kload(const struct andr_img_hdr *hdr) return android_image_get_kernel_addr(hdr); } +ulong android_image_get_kcomp(const struct andr_img_hdr *hdr) +{ + const void *p = (void *)((uintptr_t)hdr + hdr->page_size); + + if (get_unaligned_le32(p) == LZ4F_MAGIC) + return IH_COMP_LZ4; + else + return IH_COMP_NONE; +} + int android_image_get_ramdisk(const struct andr_img_hdr *hdr, ulong *rd_data, ulong *rd_len) { @@ -186,7 +197,7 @@ void android_print_contents(const struct andr_img_hdr *hdr) printf("%skernel size: %x\n", p, hdr->kernel_size); printf("%skernel address: %x\n", p, hdr->kernel_addr); printf("%sramdisk size: %x\n", p, hdr->ramdisk_size); - printf("%sramdisk addrress: %x\n", p, hdr->ramdisk_addr); + printf("%sramdisk address: %x\n", p, hdr->ramdisk_addr); printf("%ssecond size: %x\n", p, hdr->second_size); printf("%ssecond address: %x\n", p, hdr->second_addr); printf("%stags address: %x\n", p, hdr->tags_addr); diff --git a/common/image-fdt.c b/common/image-fdt.c index 01186aeac7..9ed00b7d5b 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -284,7 +284,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, *of_flat_tree = NULL; *of_size = 0; - img_addr = simple_strtoul(argv[0], NULL, 16); + img_addr = (argc == 0) ? load_addr : simple_strtoul(argv[0], NULL, 16); buf = map_sysmem(img_addr, 0); if (argc > 2) diff --git a/common/image-fit.c b/common/image-fit.c index ac901e131c..a74b44f298 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -2118,6 +2118,18 @@ int boot_get_fdt_fit(bootm_headers_t *images, ulong addr, if (next_config) *next_config++ = '\0'; uname = NULL; + + /* + * fit_image_load() would load the first FDT from the + * extra config only when uconfig is specified. + * Check if the extra config contains multiple FDTs and + * if so, load them. + */ + cfg_noffset = fit_conf_get_node(fit, uconfig); + + i = 0; + count = fit_conf_get_prop_node_count(fit, cfg_noffset, + FIT_FDT_PROP); } debug("%d: using uname=%s uconfig=%s\n", i, uname, uconfig); diff --git a/common/image.c b/common/image.c index 4d4248f234..75b84d5009 100644 --- a/common/image.c +++ b/common/image.c @@ -957,7 +957,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, */ buf = map_sysmem(images->os.start, 0); if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID) - select = argv[0]; + select = (argc == 0) ? env_get("loadaddr") : argv[0]; #endif if (argc >= 2) diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 6eb190f1ea..e2bcefb111 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -17,6 +17,10 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, { nand_init(); + printf("Loading U-Boot from 0x%08x (size 0x%08x) to 0x%08x\n", + CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, + CONFIG_SYS_NAND_U_BOOT_DST); + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 25226e9a33..fa539ecd7a 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -89,7 +89,25 @@ static int spl_ymodem_load_image(struct spl_image_info *spl_image, if (res <= 0) goto end_stream; - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && + image_get_magic((struct image_header *)buf) == FDT_MAGIC) { + addr = CONFIG_SYS_LOAD_ADDR; + ih = (struct image_header *)addr; + + memcpy((void *)addr, buf, res); + size += res; + addr += res; + + while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) { + memcpy((void *)addr, buf, res); + size += res; + addr += res; + } + + ret = spl_parse_image_header(spl_image, ih); + if (ret) + return ret; + } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic((struct image_header *)buf) == FDT_MAGIC) { struct spl_load_info load; struct ymodem_fit_info info; |