Page 1 of 1
Run ELF within an ELF?
Posted: Tue Dec 01, 2009 10:45 am
by jgrimm
i want to embed code that will run an ELF file like ULaunchELF but automaticly (without user interaction) any ideas?
Posted: Wed Dec 02, 2009 5:42 am
by barf
I suggest intersecting uLauncELF
Posted: Wed Dec 02, 2009 6:09 am
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
Posted: Wed Dec 02, 2009 8:14 pm
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.
Posted: Thu Dec 03, 2009 6:45 am
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
Posted: Sat Dec 05, 2009 8:42 am
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
Posted: Sat Dec 05, 2009 10:26 am
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