diff options
author | David Howells <dhowells@redhat.com> | 2009-01-08 07:04:48 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-01-08 07:04:48 -0500 |
commit | cb6ff208076b5f434db1b8c983429269d719cef5 (patch) | |
tree | 96cc88a4f97965e141eb7577beccc4e27ad2ede2 | |
parent | ab2e83ead4eca9e045daac4cbf66eb1e7a244bb2 (diff) |
NOMMU: Support XIP on initramfs
Support XIP on files unpacked from the initramfs image on NOMMU systems. This
simply requires the length of the file to be preset so that the ramfs fs can
attempt to garner sufficient contiguous storage to store the file (NOMMU mmap
can only map contiguous RAM).
All the other bits to do XIP on initramfs files are present:
(1) ramfs's truncate attempts to allocate a contiguous run of pages when a
file is truncated upwards from nothing.
(2) ramfs sets BDI on its files to indicate direct mapping is possible, and
that its files can be mapped for read, write and exec.
(3) NOMMU mmap() will use the above bits to determine that it can do XIP.
Possibly this needs better controls, because it will _always_ try and do
XIP.
One disadvantage of this very simplistic approach is that sufficient space
will be allocated to store the whole file, and not just the bit that would be
XIP'd. To deal with this, though, the initramfs unpacker would have to be
able to parse the file contents.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | init/initramfs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/init/initramfs.c b/init/initramfs.c index 4f5ba75aaa7c..d9c941c0c3ca 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -317,6 +317,7 @@ static int __init do_name(void) | |||
317 | if (wfd >= 0) { | 317 | if (wfd >= 0) { |
318 | sys_fchown(wfd, uid, gid); | 318 | sys_fchown(wfd, uid, gid); |
319 | sys_fchmod(wfd, mode); | 319 | sys_fchmod(wfd, mode); |
320 | sys_ftruncate(wfd, body_len); | ||
320 | vcollected = kstrdup(collected, GFP_KERNEL); | 321 | vcollected = kstrdup(collected, GFP_KERNEL); |
321 | state = CopyFile; | 322 | state = CopyFile; |
322 | } | 323 | } |