From: "Daniel M. Weeks" <dan@danweeks.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] initramfs: Debug detected compression method
Date: Sat, 15 Feb 2014 18:28:44 -0500 [thread overview]
Message-ID: <20140215232836.GA32257@dev.danweeks.net> (raw)
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.
Signed-off-by: Daniel M. Weeks <dan@danweeks.net>
---
init/initramfs.c | 1 +
lib/decompress.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/init/initramfs.c b/init/initramfs.c
index 93b6139..25d88b1 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);
+ printk(KERN_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 4d1cd03..fc508fd 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -17,6 +17,8 @@
#include <linux/string.h>
#include <linux/init.h>
+#include <linux/printk.h>
+
#ifndef CONFIG_DECOMPRESS_GZIP
# define gunzip NULL
#endif
@@ -61,6 +63,8 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, int len,
if (len < 2)
return NULL; /* Need at least this much... */
+ printk(KERN_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;
--
Daniel M. Weeks
reply other threads:[~2014-02-15 23:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140215232836.GA32257@dev.danweeks.net \
--to=dan@danweeks.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.