summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/bootm.c2
-rw-r--r--common/image-android.c11
2 files changed, 12 insertions, 1 deletions
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);
diff --git a/common/image-android.c b/common/image-android.c
index 2f38c191e9..c31dcd4465 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)
{