Michael Schnell <[EMAIL PROTECTED]> wrote: > It would be most useful if it would work on initramfs, as this (IMHO) nowadays > (with cheap RAM available) is the most important boot strategy > (decompressing/loading the important files from ROM during the boot, rather > than directly using a flash file system in realtime). > > > I would be _very_ interested in seeing XIP on initramfs for the NIOS > architecture !
Okay... I think the attached patch should do the trick. David --- [PATCH] NOMMU: Support XIP on initramfs From: David Howells <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> --- init/initramfs.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/init/initramfs.c b/init/initramfs.c index 644fc01..c2e79d4 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -271,6 +271,7 @@ static int __init do_name(void) if (wfd >= 0) { sys_fchown(wfd, uid, gid); sys_fchmod(wfd, mode); + sys_ftruncate(wfd, body_len); state = CopyFile; } } _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev