Commit 2e591bbc0d563e12f5a260fbbca0df7d5810910e

Authored by Arjan van de Ven
Committed by Linus Torvalds
1 parent f6337e2af4

[PATCH] 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)

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

... ... @@ -182,6 +182,10 @@
182 182  
183 183 static int __init do_header(void)
184 184 {
  185 + if (memcmp(collected, "070707", 6)==0) {
  186 + error("incorrect cpio method used: use -H newc option");
  187 + return 1;
  188 + }
185 189 if (memcmp(collected, "070701", 6)) {
186 190 error("no cpio magic");
187 191 return 1;