Menu

Compiling Prex/GBA with latest DevkitPRO

2007-08-21
2013-04-29
  • Niels Brouwers

    Niels Brouwers - 2007-08-21

    Hello,

    I've been wanting to try PREX on the GBA. I've downloaded prex 0.5.0 and got it to compile with DevkitPRO 1.4.4. I ran the configure script with cygwin, with CONFIG_DIAG_VBA turned on. I'm using the arm-eabi version of gcc that comes with devkitARM. Now I have a working GBA image, but it shows a white screen. I'm using VBA 1.7.2. The logger shows this:

    Prex Boot Loader V1.00
    load_image hdr=8002008 info=300605c name=prex
    load_image hdr=800a11c info=300608c name=dev.ko
    Error: Load error

    Somehow this call fails:

    if (elf_load((char *)hdr + sizeof(struct ar_hdr), info))
        panic("Load error");

    So it appears it cannot load dev.ko. I've recompiled with elf debugging output, this is the verbose information from VBA:

    Prex Boot Loader V1.00
    load_image hdr=8002008 info=300605c name=prex

    elf_load
    kernel base=2000000
    phys addr=2000000
    p_flags=5
    p_align=8000
    p_paddr=2000000
    load: offset=2000000 size=783c
    p_flags=6
    p_align=8000
    p_paddr=200783c
    load: offset=200783c size=194
    info size=9000 entry=2000074
    load_image hdr=8009b70 info=300608c name=kmon

    elf_load
    driver base=2009000
    phys addr=2009000
    sh_addr=34
    sh_size=1170
    sh_offset=34
    sh_flags=6
    load: offset=2009034 size=1170
    sh_addr=11a4
    sh_size=560
    sh_offset=11a4
    sh_flags=2
    load: offset=200a1a4 size=560
    sh_addr=1704
    sh_size=0
    sh_offset=1704
    sh_flags=3
    load: offset=200a704 size=0
    info load_base=200b000 info->text=2009000
    info size=2000 entry=2009034
    Error: Load error

    Any ideas on how to get it working?

    /Niels

     
    • Niels Brouwers

      Niels Brouwers - 2007-08-21

      I traced the problem down to the elf relocation code. It appears that the error occurs because of an unknown relocation type. I changed the default case in the switch statement in the 'relocate_rel' function (elf_reloc.c) to

          default:
              elf_dbg("Unsupported ELF32_R_TYPE: %x\n", ELF32_R_TYPE(rel->r_info));
              panic("relocation fail\n");
              return -1;

      This prints the relocation type '1d', or 29. I also encountered relocation type 1c.

      I changed to code to handle types 1d and 1c as R_ARM_PLT32, and the resulting prex rom works on vba! I don't know a lot about the elf format or relocation types 29 and 30, but at least I got it to work.

      Cheers,

      Niels

       

Log in to post a comment.