[patch] Make initramfs printk a warning on incorrect cpio type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It turns out that the "-c" option of cpio is highly unportable even
between distros let alone unix variants, and may actually make the wrong
type of cpio archive. I just wasted quite some time on this, and the
kernel can detect this and warn about it (it's __init memory so it gets
thrown away and thus there is no runtime overhead)

Signed-off-by: Arjan van de Ven <[email protected]>

--- linux-2.6.18/init/initramfs.c.old	2006-11-04 23:18:30.000000000 +0100
+++ linux-2.6.18/init/initramfs.c	2006-11-04 23:19:19.000000000 +0100
@@ -182,6 +182,10 @@ static int __init do_collect(void)
 
 static int __init do_header(void)
 {
+	if (memcmp(collected, "070707", 6)==0) {
+		error("incorrect cpio method used: use -H newc option");
+		return 1;
+	}
 	if (memcmp(collected, "070701", 6)) {
 		error("no cpio magic");
 		return 1;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux