Skip to content

Commit 2e591bb

Browse files
fenrus75Linus Torvalds
authored andcommitted
[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>
1 parent f6337e2 commit 2e591bb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎init/initramfs.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ static int __init do_collect(void)
182182

183183
static int __init do_header(void)
184184
{
185+
if (memcmp(collected, "070707", 6)==0) {
186+
error("incorrect cpio method used: use -H newc option");
187+
return 1;
188+
}
185189
if (memcmp(collected, "070701", 6)) {
186190
error("no cpio magic");
187191
return 1;

0 commit comments

Comments
 (0)