Skip to contentSkip to conversation

Make initramfs printk a warning on incorrect cpio type

PATCH New Arjan van de Ven 1 participant 1 message Nov 4, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make initramfs printk a warning on incorrect cpio type

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)

init/initramfs.c renamed from init/initramfs.c.old +4 -0
@@ -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;