From b4353b371322b54d8effd8737e3f7ba021950180 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 27 Mar 2019 23:50:09 +0000 Subject: bootm: Simplying cache flush code The cache flush of the kernel load area needs to be aligned outward to the DMA cache alignment. The operations are simpler if we think of this as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find the length of the flushed region by subtracting the former from the latter. Cc: Tom Rini Cc: Simon Glass Cc: Bryan O'Donoghue Signed-off-by: Trent Piepho Reviewed-by: Simon Glass --- common/bootm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'common/bootm.c') diff --git a/common/bootm.c b/common/bootm.c index 3adbceaa38..42358b81fc 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -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); -- cgit From 829ceb28215a1b6178bf690182def5ad56842f49 Mon Sep 17 00:00:00 2001 From: Eugeniu Rosca Date: Mon, 8 Apr 2019 17:35:27 +0200 Subject: image: android: allow booting lz4-compressed kernels According to Android image format [1], kernel image resides at 1 page offset from the boot image address. Grab the magic number from there and allow U-Boot to handle LZ4-compressed KNL binaries instead of hardcoding compression type to IH_COMP_NONE. Other compression types, if needed, can be added later. Tested on H3ULCB-KF using the image detailed in [2]. [1] Excerpt from include/android_image.h +-----------------+ | boot header | 1 page +-----------------+ | kernel | n pages +-----------------+ | ramdisk | m pages +-----------------+ | second stage | o pages +-----------------+ [2] => iminfo 4c000000 ## Checking Image at 4c000000 ... Android image found kernel size: 85b9d1 kernel address: 48080000 ramdisk size: 54ddbc ramdisk addrress: 4a180000 second size: 0 second address: 48000800 tags address: 48000100 page size: 800 os_version: 1200012a (ver: 0.9.0, level: 2018.10) name: cmdline: buildvariant=userdebug Signed-off-by: Eugeniu Rosca --- common/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/bootm.c') diff --git a/common/bootm.c b/common/bootm.c index 42358b81fc..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); -- cgit