l4t: Add L4T loader for T210 and T210B01

This commit is contained in:
CTCaer 2022-12-20 17:00:33 +02:00
parent 50dd458cfd
commit a2a302b9d5
6 changed files with 1311 additions and 5 deletions

View file

@ -26,7 +26,7 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
start.o exception_handlers.o \
main.o heap.o \
gfx.o logos.o tui.o \
fe_info.o fe_tools.o \
l4t.o fe_info.o fe_tools.o \
)
# Hardware.

View file

@ -113,6 +113,12 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
| ---------------------- | ---------------------------------------------------------- |
| payload={FILE path} | Payload launching. Tools, Android/Linux, CFW bootloaders, etc. Any key above when used with that, doesn't get into account. |
| ---------------------- | ---------------------------------------------------------- |
| l4t=1 | L4T Linux/Android native launching. |
| boot_prefixes={FOLDER path} | L4T bootstack directory. |
| ram_oc=0 | L4T RAM Overclocking. Check README_CONFIG.txt for more info. |
| uart_port=0 | Enables logging on serial port for L4T uboot/kernel. |
| Additional keys | Each distro supports more keys. Check README_CONFIG.txt for more info. |
| ---------------------- | ---------------------------------------------------------- |
| id=IDNAME | Identifies boot entry for forced boot via id. Max 7 chars. |
| logopath={FILE path} | If it exists, it will load the specified bitmap. Otherwise `bootloader/bootlogo.bmp` will be used if exists |
| icon={FILE path} | Force Nyx to use the icon defined here. If this is not found, it will check for a bmp named as the boot entry ([Test 2] -> `bootloader/res/Test 2.bmp`). Otherwise defaults will be used. |
@ -160,9 +166,6 @@ hekate has a boot storage in the binary that helps it configure it outside of BP
| '0xA0' emummc_path[120] | When `Boot to emuMMC` is set, it will override the current emuMMC (boot entry or emummc.ini). Must be NULL terminated. |
If the main .ini is not found, it is created on the first hekate boot and only has the `[config]` entry.
### Nyx Configuration keys/values (nyx.ini):
| Config option | Description |

1213
bootloader/l4t/l4t.c Normal file

File diff suppressed because it is too large Load diff

24
bootloader/l4t/l4t.h Normal file
View file

@ -0,0 +1,24 @@
/*
* L4T Loader for Tegra X1
*
* Copyright (c) 2020-2022 CTCaer
*
* 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/>.
*/
#ifndef _L4T_H_
#define _L4T_H_
void launch_l4t(const ini_sec_t *ini_sec, int entry_idx, int is_list, bool t210b01);
#endif

View file

@ -0,0 +1,36 @@
/*
* L4T Loader for Tegra X1
*
* Copyright (c) 2020-2022 CTCaer
*
* 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/>.
*/
// Set to 1 to enable early boot debugging.
#define DEBUG_LOG_ATF 0
#define DEBUG_LOG_BPMPFW 0 // Do not enable if UART setup is hindered during early boot.
// Set to 1 to lock PMC registers that contain LP0 parameters.
#define LOCK_PMC_REGISTERS 0
// Configurable carveout enable config. Only one can be enabled at a time.
#define CARVEOUT_NVDEC_TSEC_ENABLE 0 // Enable for NVDEC bl/prod and full TOS/DRM.
#define CARVEOUT_SECFW_ENABLE 1 // SECFW is always allocated even if carveout is disabled.
/*
* WPR Carveout size config.
*
* L4T: 2MB or 13MB. On non SecureOS env, only 0x100 bytes are used, probably also on full TOS.
* On 4GB+ systems, it's normally placed at BANK1_TOP - SIZE;
*/
#define CARVEOUT_GPUWPR_SIZE_CFG (SZ_8M + SZ_4M + SZ_1M) // Mandatory when CARVEOUT_NVDEC_TSEC_ENABLE is 1.

View file

@ -26,6 +26,7 @@
#include "gfx/tui.h"
#include "hos/hos.h"
#include "hos/secmon_exo.h"
#include "l4t/l4t.h"
#include <ianos/ianos.h>
#include <libs/compr/blz.h>
#include <libs/fatfs/ff.h>
@ -458,6 +459,19 @@ parse_failed:
// Try to launch Payload or L4T.
if (special_path != (char *)-1)
_launch_payload(special_path, false, true);
else
{
u32 entry_idx = 0;
for (u32 i = 0; i < sec_idx; i++)
{
if (ments[i].data == cfg_sec)
{
entry_idx = i;
break;
}
}
launch_l4t(cfg_sec, entry_idx, 1, h_cfg.t210b01);
}
}
else if (!hos_launch(cfg_sec))
{
@ -590,6 +604,19 @@ parse_failed:
// Try to launch Payload or L4T.
if (special_path != (char *)-1)
_launch_payload(special_path, false, true);
else
{
u32 entry_idx = 0;
for (u32 i = 0; i < sec_idx; i++)
{
if (ments[i].data == cfg_sec)
{
entry_idx = i;
break;
}
}
launch_l4t(cfg_sec, entry_idx, 0, h_cfg.t210b01);
}
}
else if (!hos_launch(cfg_sec))
{
@ -904,7 +931,8 @@ skip_list:
// Check if entry is payload or l4t special case.
char *special_path = ini_check_special_section(cfg_sec);
if (!(b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH) && h_cfg.bootwait)
if ((!(b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH) && h_cfg.bootwait) || // Conditional for HOS/Payload.
(special_path && special_path == (char *)-1)) // Always show for L4T.
{
u32 fsize;
u8 *logo_buf = NULL;
@ -987,6 +1015,8 @@ skip_list:
// Try to launch Payload or L4T.
if (special_path != (char *)-1)
_launch_payload(special_path, false, false);
else
launch_l4t(cfg_sec, h_cfg.autoboot, h_cfg.autoboot_list, h_cfg.t210b01);
goto error;
}
else