1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 11:42:09 +00:00

Fixes to update.bin reloc (breaking!)

This fixes a regression in chainloading update.bin where the added check for if it's update or not, didn't copy the reloc code. And the calling was not updated to reflect this.

Additionally:
- Delete the reloc.S relic
- Force running config_hw in case we change hw init again in the future.
This commit is contained in:
Kostas Missos 2018-12-16 19:04:46 +02:00
parent e809745120
commit 98d715243a
3 changed files with 10 additions and 42 deletions

View file

@ -63,6 +63,7 @@ OBJS += $(addprefix $(BUILD)/$(TARGET)/, \
CUSTOMDEFINES := -DBLVERSIONMJ=$(BLVERSION_MAJOR) -DBLVERSIONMN=$(BLVERSION_MINOR) -DMENU_LOGO_ENABLE
#CUSTOMDEFINES += -DDEBUG
# 0: UART_A, 1: UART_B.
#CUSTOMDEFINES += -DDEBUG_UART_PORT=0
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork

View file

@ -269,6 +269,7 @@ void check_power_off_from_hos()
#define COREBOOT_ADDR (0xD0000000 - 0x100000)
void (*ext_payload_ptr)() = (void *)EXT_PAYLOAD_ADDR;
void (*update_ptr)() = (void *)RCM_PAYLOAD_ADDR;
void reloc_patcher(u32 payload_size)
{
@ -289,7 +290,7 @@ void reloc_patcher(u32 payload_size)
}
}
#define BOOTLOADER_UPDATED_MAGIC 0x424f4f54 // "BOOT".
#define BOOTLOADER_UPDATED_MAGIC 0x424F4F54 // "BOOT".
#define BOOTLOADER_UPDATED_MAGIC_ADDR 0x4003E000
int launch_payload(char *path, bool update)
@ -375,7 +376,10 @@ int launch_payload(char *path, bool update)
}
// Launch our payload.
(*ext_payload_ptr)();
if (!update)
(*ext_payload_ptr)();
else
(*update_ptr)();
}
return 1;
@ -959,7 +963,6 @@ void auto_launch_firmware()
#endif //MENU_LOGO_ENABLE
out:
gfx_clear_grey(&gfx_ctxt, 0x1B);
ini_free(&ini_sections);
if (h_cfg.autoboot_list)
ini_free(&ini_list_sections);
@ -1146,8 +1149,7 @@ extern void pivot_stack(u32 stack_top);
void ipl_main()
{
// Skip config if we just updated the bootloader.
if (*(vu32 *)BOOTLOADER_UPDATED_MAGIC_ADDR != BOOTLOADER_UPDATED_MAGIC)
config_hw();
config_hw();
//Pivot the stack so we have enough space.
pivot_stack(0x90010000);
@ -1164,9 +1166,8 @@ void ipl_main()
set_default_configuration();
// Save sdram lp0 config.
if (*(vu32 *)BOOTLOADER_UPDATED_MAGIC_ADDR != BOOTLOADER_UPDATED_MAGIC)
if (ianos_loader(true, "bootloader/sys/libsys_lp0.bso", DRAM_LIB, (void *)sdram_get_params()))
h_cfg.errors |= ERR_LIBSYS_LP0;
if (ianos_loader(true, "bootloader/sys/libsys_lp0.bso", DRAM_LIB, (void *)sdram_get_params()))
h_cfg.errors |= ERR_LIBSYS_LP0;
display_init();

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2018 naehrwert
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* TODO: the placement of the relocator is a bit fragile atm, maybe we
* should include it in start.S and copy it to some known good
* place in IRAM instead. Basically we want it as far back atm
* as it might be overwritten during relocation.
*/
.section .text.reloc
.arm
.globl _reloc_ipl
.type _reloc_ipl, %function
_reloc_ipl:
LDMIA R0!, {R4-R7}
STMIA R1!, {R4-R7}
SUBS R2, #0x10
BNE _reloc_ipl
BX R3