linux-mips
[Top] [All Lists]

Re: Exec from Memory

To: turcotte@broadcom.com
Subject: Re: Exec from Memory
From: Justin Carlson <justinca@cs.cmu.edu>
Date: 18 Feb 2003 17:22:29 -0500
Cc: linux-mips@linux-mips.org
In-reply-to: <NDBBKEAAOJECIDBJKLIHCEOGCHAA.turcotte@broadcom.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <NDBBKEAAOJECIDBJKLIHCEOGCHAA.turcotte@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
On Tue, 2003-02-18 at 17:08, Maurice Turcotte wrote:
> Greetings:
> 
> I have a hypothetical linux-mips question posed by a colleage.
> 
> Suppose there is no file system available, since there is no disk. And
> suppose that I had the capability to place an elf file in a known location
> in memory. How would I execute it? It seems like exec really wants a file
> name. BTW, this needs to run in use space, not kernel.
> 

There's no easy way (that know of) around the filesystem abstraction. 
You're going to have to deal with it in some manner.  Really basic
stuff, like the elf loader, depends on vfs abstractions.  While it's
possible to bypass all that, it would be a *lot* of work, and a lot of
nearly-duplicated code.

I can see a couple of options.  Other people might have better
suggestions.  :)

1) Use the embedded root ramdisk functionality in the kernel.  Make your
elf file /sbin/init, and run with it.

2) Hack a quick filesystem that uses a contiguous chunk of memory that
you either hardcode or pass in on the kernel command line.

-Justin



<Prev in Thread] Current Thread [Next in Thread>