Page 1 of 1

Need help loading an ELF from an ELF :)

Posted: Thu Aug 19, 2004 8:03 pm
by PrimeTime
hi, I'm pretty new to this, but for the past couple of days I've been trying
to load an ELF from a location on my memory card.

the location of the program is mc0:/BOOT/SHARED/JPG.ELF
I uploaded it there myself.

my problem is whenever I call SifLoadElf() it tell me it cannot open this elf file.

Code: Select all

char *path = "mc0:/BOOT/SHARED/JPG.ELF";
ret = SifLoadElf(path, &elfdata);
if (elfdata.epc == 0) {
     scr_printf("EE: Could not load file\n");
     return -1;
    }

I've also tried loading the mcman and and sio2man modules before loading the elf, but that didn't help.

Thanks,
Ryan

Posted: Thu Aug 19, 2004 8:26 pm
by pixel
Can you try to only open the file ? Only to see if everything is okay with your module loadings...

Posted: Thu Aug 19, 2004 10:13 pm
by Raizor
I could be wrong, but I seem to recall loading elf files from memcard is not allowed. You need to use MrBrown's sbv patches to allow it...

Please correct me if I'm wrong ;)

raizor

Posted: Fri Aug 20, 2004 3:05 am
by mrbrown
You're right, you need to use sbv if you use SifLoadElf(), or one of the alternative loading methods (see altimit or Independence).

Posted: Fri Aug 20, 2004 5:41 am
by pixel
Argh, yes, of course :) Why didn't I thought of it ?

Posted: Fri Aug 20, 2004 6:30 am
by PrimeTime
Thanks for your replies.

I've tried using the sbv-lite library to fix the sif problem, however, it doesn't seem to work, I am still getting the same results as before.

Code: Select all

// Initialise
SifInitRpc(0);
init_scr();
hddPreparePoweroff();
hddSetUserPoweroffCallback((void *)poweroffHandler,(void *)pid);
scr_printf("Loading poweroff.irx %i bytes\n", size_poweroff_irx);
sbv_patch_enable_lmb();
sbv_patch_disable_prefix_check();
SifExecModuleBuffer(&poweroff_irx, size_poweroff_irx, 0, NULL, &ret);
scr_printf("Loading %s\n",HDDpath);
pid = pkoLoadElf("mc0:/BOOT/SHARED/JPG.ELF");
scr_printf("pkoLoadElf returned %i\n",pid);
if &#40;pid < 0&#41;
&#123;
  scr_printf&#40;"Could not execute file %s\n", HDDpath&#41;;
  return -1;
&#125;
my pid is < 0 which returns the error. Inside the pkoLoadElf, which I got from a bit of the ps2menu code, the elfdata.epc, elfdata.gp and elfdata.sp are all 0.

I'm not sure what I should do.

Thanks,
Ryan

Posted: Fri Aug 20, 2004 7:14 am
by PrimeTime
I found part of the solution to my problem:

Originally, I have been uploading my ELF file via ftp.
for example my program is named TEST.ELF and this program
calls JPG.ELF.

By default my ps2 calls PS2 Key Launcher upon booting. I configured PS2 Key Launcher to call my TEST.ELF program and then my TEST.ELF calls JPG.ELF. kinda crazy

anyway, when I tried to execute TEST.ELF using ps2link instead of PS2 Key Launcher; everything worked fine. I suppose it may be something with PS2 Key Launcher.

Ryan

Posted: Wed Sep 15, 2004 11:40 am
by MrSiir[S]
PrimeTime wrote:I found part of the solution to my problem:

Originally, I have been uploading my ELF file via ftp.
for example my program is named TEST.ELF and this program
calls JPG.ELF.

By default my ps2 calls PS2 Key Launcher upon booting. I configured PS2 Key Launcher to call my TEST.ELF program and then my TEST.ELF calls JPG.ELF. kinda crazy

anyway, when I tried to execute TEST.ELF using ps2link instead of PS2 Key Launcher; everything worked fine. I suppose it may be something with PS2 Key Launcher.

Ryan
Hi, Though PS2 KeyLauncher does not work very well ;-) , it can be that is not a his fault, ps2link it loads modules in memory and does that the execution of the program not her same from MC or from ps2link

MrSiir

Posted: Mon Sep 20, 2004 6:01 pm
by L-Burna
Hi I know this probably isn't in the right location on the forum here,but I was wondering MrSiir[S] is it possible to launch apps from the keylauncher from the R3 and L3 buttons.I am currently using the keylauncher for my memory card exploit and I do have to say it works like a charm.I am having problems typing in my R3 and L3 buttons though.The example given in the keylauncher exploit doesn't give a example or really explain how to type in the command used for the L3 and R3 buttons for the KL.DAT file.I can get all the other buttons to work except for these two buttons.I used this command for the R3 and L3 buttons,but it seems to always fail me when I try to type it in like this.

Example:
L3=mc0:/BADATA_SYSTEM/PS2LINK.ELF;PS2LINK V1.23

I would appreciate it alot if you could give me an example or tell me where I am going wrong when typing in my command.Thanks in advance and nice exploit MrSiir[S] I appreciate it and it seems to work for me.I have also asked numerous questions all over the place trying to find the answer,but no one that knows is willing to help out or just doesn't know the answer.