From: Daniel M. Weeks Date: Mon, 7 Apr 2014 22:39:16 +0000 (-0700) Subject: initramfs: debug detected compression method X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6aa7a29aa8378fa868fabef6a84b0a40d5d9d677;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git initramfs: debug detected compression method This can greatly aid in narrowing down the real source of initramfs problems such as failures related to the compression of the in-kernel initramfs when an external initramfs is in use as well. Existing errors are ambiguous as to which initramfs is a problem and why. [akpm@linux-foundation.org: use pr_debug()] Signed-off-by: Daniel M. Weeks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/init/initramfs.c b/init/initramfs.c index 93b61396756b..a8497fab1c3d 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -455,6 +455,7 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len) } this_header = 0; decompress = decompress_method(buf, len, &compress_name); + pr_debug("Detected %s compressed data\n", compress_name); if (decompress) { res = decompress(buf, len, NULL, flush_buffer, NULL, &my_inptr, error); diff --git a/lib/decompress.c b/lib/decompress.c index 4d1cd0397aab..86069d74c062 100644 --- a/lib/decompress.c +++ b/lib/decompress.c @@ -16,6 +16,7 @@ #include #include #include +#include #ifndef CONFIG_DECOMPRESS_GZIP # define gunzip NULL @@ -61,6 +62,8 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, int len, if (len < 2) return NULL; /* Need at least this much... */ + pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); + for (cf = compressed_formats; cf->name; cf++) { if (!memcmp(inbuf, cf->magic, 2)) break;