mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-06 17:41:24 -04:00
[stage2] Remove printk, introduce UTF-8 console stdio
This commit is contained in:
parent
02217bde55
commit
8648cac77b
15 changed files with 246 additions and 149 deletions
|
@ -1,3 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#include "utils.h"
|
||||
#include "nxboot.h"
|
||||
#include "key_derivation.h"
|
||||
|
@ -5,7 +6,6 @@
|
|||
#include "loader.h"
|
||||
#include "splash_screen.h"
|
||||
#include "exocfg.h"
|
||||
#include "lib/printk.h"
|
||||
#include "display/video_fb.h"
|
||||
#include "lib/ini.h"
|
||||
#include "hwinit/cluster.h"
|
||||
|
@ -26,45 +26,45 @@ static int exosphere_ini_handler(void *user, const char *section, const char *na
|
|||
|
||||
void nxboot_configure_exosphere(void) {
|
||||
exosphere_config_t exo_cfg = {0};
|
||||
|
||||
|
||||
exo_cfg.magic = MAGIC_EXOSPHERE_BOOTCONFIG;
|
||||
exo_cfg.target_firmware = EXOSPHERE_TARGET_FIRMWARE_MAX;
|
||||
|
||||
|
||||
if (ini_parse_string(get_loader_ctx()->bct0, exosphere_ini_handler, &exo_cfg) < 0) {
|
||||
printk("Error: Failed to parse BCT.ini!\n");
|
||||
printf("Error: Failed to parse BCT.ini!\n");
|
||||
generic_panic();
|
||||
}
|
||||
|
||||
|
||||
if (exo_cfg.target_firmware < EXOSPHERE_TARGET_FIRMWARE_MIN || exo_cfg.target_firmware > EXOSPHERE_TARGET_FIRMWARE_MAX) {
|
||||
printk("Error: Invalid Exosphere target firmware!\n");
|
||||
printf("Error: Invalid Exosphere target firmware!\n");
|
||||
generic_panic();
|
||||
}
|
||||
|
||||
|
||||
*(MAILBOX_EXOSPHERE_CONFIGURATION) = exo_cfg;
|
||||
}
|
||||
|
||||
/* This is the main function responsible for booting Horizon. */
|
||||
void nxboot_main(void) {
|
||||
loader_ctx_t *loader_ctx = get_loader_ctx();
|
||||
|
||||
|
||||
/* TODO: Validate that we're capable of booting. */
|
||||
|
||||
|
||||
/* TODO: Initialize Boot Reason. */
|
||||
|
||||
|
||||
/* TODO: How should we deal with bootconfig? */
|
||||
|
||||
|
||||
/* Setup boot configuration for Exosphere. */
|
||||
nxboot_configure_exosphere();
|
||||
|
||||
|
||||
/* Derive keydata. */
|
||||
derive_nx_keydata(MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware);
|
||||
|
||||
|
||||
/* Patch package2, adding thermosphere + custom KIPs. */
|
||||
package2_patch((void *)loader_ctx->package2_loadfile.load_address);
|
||||
|
||||
|
||||
/* Boot up Exosphere. */
|
||||
MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE = 0;
|
||||
if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware <= EXOSPHERE_TARGET_FIRMWARE_400) {
|
||||
if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware <= EXOSPHERE_TARGET_FIRMWARE_400) {
|
||||
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_LOADED_PACKAGE2;
|
||||
} else {
|
||||
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_LOADED_PACKAGE2_4X;
|
||||
|
@ -73,14 +73,14 @@ void nxboot_main(void) {
|
|||
while (MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE == 0) {
|
||||
/* Wait for Exosphere to wake up. */
|
||||
}
|
||||
if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware <= EXOSPHERE_TARGET_FIRMWARE_400) {
|
||||
if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware <= EXOSPHERE_TARGET_FIRMWARE_400) {
|
||||
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_FINISHED;
|
||||
} else {
|
||||
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_FINISHED_4X;
|
||||
}
|
||||
|
||||
|
||||
/* Display splash screen. */
|
||||
display_splash_screen_bmp(loader_ctx->custom_splash_path);
|
||||
|
||||
|
||||
/* TODO: Halt ourselves. */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue