Run ELF within an ELF?

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
jgrimm
Posts: 27
Joined: Sun Nov 29, 2009 2:00 am

Run ELF within an ELF?

Post by jgrimm »

i want to embed code that will run an ELF file like ULaunchELF but automaticly (without user interaction) any ideas?
barf
Posts: 8
Joined: Thu Aug 14, 2008 9:41 pm
Location: Norway

Post by barf »

I suggest intersecting uLauncELF
jgrimm
Posts: 27
Joined: Sun Nov 29, 2009 2:00 am

Post by jgrimm »

yes, thats what i was thinking, but how exactly do i do that? im kinda noob at this. im guessing i include some header or .c from ulauncheELF source right? i just need to know wich file
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

It's not that simple. You have to understand ULaunchELF source code. We will not do it for it, of course :) . If you don't, the only way is to start learning programming.
jgrimm
Posts: 27
Joined: Sun Nov 29, 2009 2:00 am

Post by jgrimm »

ok, im not i t much of a c or c++ person but i can program my ps2, havent looked at ulaunchelf source much though i dont need u to do it for me, but could u tell me how? or at least give me a vauge idea? thx
dlanor
Posts: 258
Joined: Thu Oct 28, 2004 6:28 pm
Location: Stockholm, Sweden

Post by dlanor »

jgrimm wrote:ok, im not i t much of a c or c++ person but i can program my ps2, havent looked at ulaunchelf source much though i dont need u to do it for me, but could u tell me how? or at least give me a vauge idea? thx
If you want the ability to do generic elf launching exactly like uLE, to get the same degree of compatibility to other elfs, then you will need to copy quite a lot of the methods used by uLE into your own program. This includes, but is not limited to, a special 'loader' subprogram that is compiled as a separate elf file which is embedded as data inside the main uLE program file.

uLE normally does not launch an external target elf directly, but instead does it by preparing the full pathname of that target elf and passing this as an argument in launching the 'loader' elf from embedded storage. It is this 'loader' program that then launches the real target elf.

The advantage of such a method, widely used in other PS2 homebrews as well, is that all the memory spaces normally used by uLE are freed up before the real target elf is launched. Thus there will be no memory conflicts with any such elfs, unless they happen to use the same memory segments in which the tiny 'loader' program resides. And those memory segments were of course chosen so as to avoid overlapping any area used by normal programs, including both commercial games and homebrews.

Inside the uLE source package you will find the "loader" subprogram source code in a subfolder with the same name, and the code of the main program that invokes this 'loader' is found in the file "elf.c".

For the rest you're on your own...
Good Luck!

Best regards: dlanor
jgrimm
Posts: 27
Joined: Sun Nov 29, 2009 2:00 am

Post by jgrimm »

Ok thats just about exactly what i needed to know! i thought it had somthing to do with elf.c thanx thats just what i was looking for dlanor
Post Reply