From: Randy Robertson Date: Mon, 13 Apr 2009 21:40:04 +0000 (-0700) Subject: initramfs: fix initramfs to work with hardlinked init X-Git-Tag: v2.6.30-rc2~37 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d20d5a7456d57d8affa88f45f27ae96ea49c29e4;p=pandora-kernel.git initramfs: fix initramfs to work with hardlinked init Change cb6ff208076b5f434db1b8c983429269d719cef5 ("NOMMU: Support XIP on initramfs") seems to have broken booting from initramfs with /sbin/init being a hardlink. It seems like the logic required for XIP on nommu, i.e. ftruncate to reported cpio header file size (body_len) is broken for hardlinks, which have a reported size of 0, and the truncate thus nukes the contents of the file (in my case busybox), making boot impossible and ending with runaway loop modprobe binfmt-0000 - and of course 0000 is not a valid binary format. My fix is to only call ftruncate if size is non-zero which fixes things for me, but I'm not certain whether this will break XIP for those files on nommu systems, although I would guess not. Signed-off-by: Randy Robertson Acked-by: David Howells Acked-by: Paul Mundt Acked-by: H. Peter Anvin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed