aboutsummaryrefslogtreecommitdiff
path: root/lib/lz4_wrapper.c
diff options
context:
space:
mode:
authorEugeniu Rosca <erosca@de.adit-jv.com>2019-04-08 17:35:27 +0200
committerTom Rini <trini@konsulko.com>2019-04-24 07:27:32 -0400
commit829ceb28215a1b6178bf690182def5ad56842f49 (patch)
tree2dbfc2ea6f426284576ca4bb4b0d47c01ceb3a75 /lib/lz4_wrapper.c
parent0efe2b8f9ee2f459a2161e19ae1e66918c9f5c3b (diff)
downloadu-boot-829ceb28215a1b6178bf690182def5ad56842f49.zip
u-boot-829ceb28215a1b6178bf690182def5ad56842f49.tar.gz
u-boot-829ceb28215a1b6178bf690182def5ad56842f49.tar.bz2
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 <erosca@de.adit-jv.com>
Diffstat (limited to 'lib/lz4_wrapper.c')
-rw-r--r--lib/lz4_wrapper.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/lz4_wrapper.c b/lib/lz4_wrapper.c
index 487d39e..1c68e67 100644
--- a/lib/lz4_wrapper.c
+++ b/lib/lz4_wrapper.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <compiler.h>
+#include <image.h>
#include <linux/kernel.h>
#include <linux/types.h>
@@ -23,8 +24,6 @@ typedef uint64_t U64;
/* Unaltered (except removing unrelated code) from github.com/Cyan4973/lz4. */
#include "lz4.c" /* #include for inlining, do not link! */
-#define LZ4F_MAGIC 0x184D2204
-
struct lz4_frame_header {
u32 magic;
union {