Skip to content

Commit

Permalink
[PATCH] Make initramfs printk a warning on incorrect cpio type
Browse files Browse the repository at this point in the history
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]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
fenrus75 authored and Linus Torvalds committed Dec 7, 2006
1 parent f6337e2 commit 2e591bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2e591bb

Please sign in to comment.