Refactor, part 7; register XTLDR protocol
This commit is contained in:
parent
c4f1429a3b
commit
6733146b71
@ -6,7 +6,6 @@
|
||||
# Debug - enables the debugging port and consists of two comma-separated parameters: com port and baud rate;
|
||||
# it is also possible to specify custom port address with: COM0:[address],[baud_rate]
|
||||
# Default - specifies which operating system listen in config file will be started if no choice is made
|
||||
# Theme - allows to set a custom theme to personalize XTLDR's look'n'feel
|
||||
# Timeout - sets the countdown timer (in seconds) before the default OS get started automatically
|
||||
# Tune - plays a tune on the pcspeaker right before the XTLDR loads
|
||||
#
|
||||
@ -25,7 +24,6 @@
|
||||
Tune=400 880 2 988 2 783 2 392 2 587 3
|
||||
Debug=COM1,115200
|
||||
Timeout=30
|
||||
Theme=Fancy
|
||||
Default=ExectOS
|
||||
|
||||
[ExectOS]
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include <xtuefi.h>
|
||||
|
||||
|
||||
/* XTLDR directories */
|
||||
#define XTBL_LOADER_DIRECTORY L"\\EFI\\BOOT\\XTLDR\\"
|
||||
#define XTBL_THEMES_DIRECTORY L"\\EFI\\BOOT\\XTLDR\\THEMES\\"
|
||||
|
||||
/* XTLDR Debug Port type definitions */
|
||||
#define XTBL_DEBUGPORT_SCREEN 1
|
||||
#define XTBL_DEBUGPORT_SERIAL 2
|
||||
@ -38,7 +42,6 @@ typedef struct _XTBL_CONFIGURATION
|
||||
PWCHAR Debug;
|
||||
ULONG DebugPort;
|
||||
BOOLEAN Shell;
|
||||
PWCHAR Theme;
|
||||
ULONG Timeout;
|
||||
PWCHAR Tune;
|
||||
} XTBL_CONFIGURATION, *PXTBL_CONFIGURATION;
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpConfigParseCommandLine(VOID)
|
||||
BlpParseCommandLineOptions(VOID)
|
||||
{
|
||||
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
|
||||
PEFI_LOADED_IMAGE_PROTOCOL LoadedImage;
|
||||
@ -32,7 +32,7 @@ BlpConfigParseCommandLine(VOID)
|
||||
if(LoadedImage && LoadedImage->LoadOptions)
|
||||
{
|
||||
/* Update global boot loader configuration */
|
||||
BlpConfigUpdateGlobalConfiguration(LoadedImage->LoadOptions);
|
||||
BlpUpdateGlobalConfiguration(LoadedImage->LoadOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ BlpConfigParseCommandLine(VOID)
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options)
|
||||
BlpUpdateGlobalConfiguration(IN PWCHAR Options)
|
||||
{
|
||||
PWCHAR Argument, LastArg;
|
||||
SIZE_T Length;
|
||||
@ -92,21 +92,6 @@ BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options)
|
||||
/* Force shell mode */
|
||||
BlpConfiguration.Shell = TRUE;
|
||||
}
|
||||
else if(RtlWideStringCompare(Argument, L"THEME=", 6) == 0)
|
||||
{
|
||||
/* Skip to the argument value */
|
||||
Argument += 6;
|
||||
Length = RtlWideStringLength(Argument, 0);
|
||||
|
||||
/* Store theme configuration if not set already */
|
||||
if(BlpConfiguration.Theme == NULL)
|
||||
{
|
||||
/* Save theme in global configuration */
|
||||
BlMemoryAllocatePool(Length, (PVOID *)&BlpConfiguration.Theme);
|
||||
RtlCopyMemory(BlpConfiguration.Theme, Argument, (Length * sizeof(WCHAR)) - 1);
|
||||
BlpConfiguration.Theme[Length] = '\0';
|
||||
}
|
||||
}
|
||||
else if(RtlWideStringCompare(Argument, L"TIMEOUT=", 8) == 0)
|
||||
{
|
||||
/* Skip to the argument value */
|
||||
|
@ -61,6 +61,11 @@ XTCDECL
|
||||
EFI_STATUS
|
||||
BlMemoryFreePool(IN PVOID Memory);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlOpenXtProtocol(OUT PVOID *ProtocolHandler,
|
||||
IN PEFI_GUID ProtocolGuid);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlSleepExecution(IN ULONG_PTR Milliseconds);
|
||||
@ -76,11 +81,11 @@ BlpActivateSerialIOController();
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpConfigParseCommandLine(VOID);
|
||||
BlpParseCommandLineOptions(VOID);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options);
|
||||
BlpUpdateGlobalConfiguration(IN PWCHAR Options);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
@ -108,6 +113,10 @@ BlpInitializeSerialPort(IN ULONG PortNumber,
|
||||
IN ULONG PortAddress,
|
||||
IN ULONG BaudRate);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlpRegisterXtLoaderProtocol();
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine,
|
||||
|
@ -29,12 +29,16 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Set the system table and image handle */
|
||||
EfiImageHandle = ImageHandle;
|
||||
EfiSystemTable = SystemTable;
|
||||
|
||||
/* Initialize XTLDR and early print XTLDR version */
|
||||
BlpInitializeEfiBootLoader();
|
||||
BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION);
|
||||
|
||||
/* Parse configuration options passed from UEFI shell */
|
||||
BlpConfigParseCommandLine();
|
||||
BlpParseCommandLineOptions();
|
||||
|
||||
/* Attempt to early initialize debug console */
|
||||
if(DEBUG)
|
||||
@ -56,6 +60,14 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
|
||||
BlDebugPrint(L"WARNING: Failed to disable watchdog timer\n");
|
||||
}
|
||||
|
||||
/* Register loader protocol */
|
||||
Status = BlpRegisterXtLoaderProtocol();
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to register loader protocol */
|
||||
BlDebugPrint(L"ERROR: Failed to register XTLDR loader protocol\n");
|
||||
}
|
||||
|
||||
/* Temporary infinite loop */
|
||||
for(;;);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user