Skip to contentSkip to conversation

initramfs: Debug detected compression method

PATCH New Daniel M. Weeks 1 participant 1 message Feb 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 init/initramfs.c | 1 +
 lib/decompress.c | 4 ++++
 2 files changed, 5 insertions(+)
init/initramfs.c +1 -0
index 93b6139..25d88b1 100644
@@ -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);
lib/decompress.c +4 -0
index 4d1cd03..fc508fd 100644
@@ -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;
Signature · 1 line
Daniel M. Weeks