Replaces the old vendored BDK with the one from hekate v6.5.5 (CTCaer's 2025/2026 refactors: sdmmc, SE, minerva v1.6, display, heap, return value homogenisation). OmniNX additions re-applied on top: bq24193_charger_connected() and jc_clear_input(); s_vprintf now ships with the BDK. Ported to the new API: - sd_mount(), sdmmc_storage_* and ini_parse() now return 0 on success. The installer checked ini_parse() != 1, which would have made it miss manifest.ini and run every install as a clean install. - SD helpers come from bdk/storage/sd.c (source/nx_sd.* removed), ffsystem.c from the BDK, diskio.c/ffconf.h from hekate (ffconf keeps the sd:/ volume prefix). - minerva_init() needs the minerva storage; the installer still drops to 800 MHz afterwards. - Payload launch follows hekate (sd_file_read, hw_deinit); coreboot path removed upstream. - Stack moved to 0x96000000: the old 0x83100000 is inside the new heap. - GUI/USB/compression parts of the BDK are not built.
67 lines
1.8 KiB
C
67 lines
1.8 KiB
C
/*
|
|
* ----------------------------------------------------------------------------
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
* <m4x@m4xw.net> wrote this file. As long as you retain this notice you can do
|
|
* whatever you want with this stuff. If we meet some day, and you think this
|
|
* stuff is worth it, you can buy me a beer in return. M4xw
|
|
* ----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "elfload.h"
|
|
|
|
#if defined(__arm__)
|
|
|
|
// Taken from http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf
|
|
#define R_ARM_NONE 0
|
|
#define R_ARM_ABS32 2
|
|
#define R_ARM_JUMP_SLOT 22
|
|
#define R_ARM_GLOB_DAT 21
|
|
#define R_ARM_RELATIVE 23
|
|
|
|
el_status el_applyrel(el_ctx *ctx, Elf_Rel *rel)
|
|
{
|
|
u32 sym = ELF_R_SYM(rel->r_info); // Symbol offset
|
|
u32 type = ELF_R_TYPE(rel->r_info); // Relocation Type
|
|
uptr *p = (uptr *)(rel->r_offset + ctx->base_load_paddr); // Target Addr
|
|
|
|
#if 0 // For later symbol usage
|
|
Elf32_Sym *elfSym;
|
|
const char *symbolName;
|
|
|
|
// We resolve relocs from the originating elf-image
|
|
elfSym = (Elf32_Sym *)(ctx->symtab.sh_offset + (char *)buffteg) + sym;
|
|
int strtab_offset = ctx->shstr.sh_offset;
|
|
char *strtab = (char *)buffteg + strtab_offset;
|
|
symbolName = strtab + elfSym->st_name;
|
|
//EL_DEBUG("Str: %s sz: %x val: %x\n", symbolName, elfSym->st_size, elfSym->st_value);
|
|
#endif
|
|
|
|
switch (type)
|
|
{
|
|
case R_ARM_NONE:
|
|
EL_DEBUG("R_ARM_NONE\n");
|
|
break;
|
|
case R_ARM_JUMP_SLOT:
|
|
case R_ARM_ABS32:
|
|
case R_ARM_GLOB_DAT:
|
|
// Stubbed for later purpose
|
|
//*p += elfSym->st_value; // + vaddr from sec
|
|
//*p |= 0; // 1 if Thumb && STT_FUNC, ignored for now
|
|
break;
|
|
case R_ARM_RELATIVE: // Needed for PIE
|
|
if (sym)
|
|
{
|
|
return EL_BADREL;
|
|
}
|
|
*p += ctx->base_load_vaddr;
|
|
break;
|
|
|
|
default:
|
|
return EL_BADREL;
|
|
}
|
|
|
|
return EL_OK;
|
|
}
|
|
|
|
#endif
|