Add boot protocol parameters
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 30s
Builds / ExectOS (i686) (push) Successful in 28s

This commit is contained in:
Rafal Kupiec 2023-12-30 16:34:27 +01:00
parent a65c22c9c9
commit 5b64cf21a0
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 50 additions and 11 deletions

View File

@ -79,6 +79,19 @@ typedef VOID (*PBL_TUI_UPDATE_PROGRESS_BAR)(IN PXTBL_DIALOG_HANDLE Handle, IN PW
typedef EFI_STATUS (*PBL_WAIT_FOR_EFI_EVENT)(IN UINT_PTR NumberOfEvents, IN PEFI_EVENT Event, OUT PUINT_PTR Index); typedef EFI_STATUS (*PBL_WAIT_FOR_EFI_EVENT)(IN UINT_PTR NumberOfEvents, IN PEFI_EVENT Event, OUT PUINT_PTR Index);
typedef VOID (*PBL_XT_BOOT_MENU)(); typedef VOID (*PBL_XT_BOOT_MENU)();
/* Boot parameters structure */
typedef struct _XTBL_BOOT_PARAMETERS
{
PEFI_DEVICE_PATH_PROTOCOL DevicePath;
PWCHAR ArcName;
PWCHAR SystemPath;
PWCHAR SystemType;
PWCHAR KernelFile;
PWCHAR InitrdFile;
PWCHAR HalFile;
PWCHAR Parameters;
} XTBL_BOOT_PARAMETERS, *PXTBL_BOOT_PARAMETERS;
/* Boot menu list structure */ /* Boot menu list structure */
typedef struct _XTBL_BOOTMENU_ITEM typedef struct _XTBL_BOOTMENU_ITEM
{ {

View File

@ -110,16 +110,17 @@ XTCDECL
EFI_STATUS EFI_STATUS
BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList) BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
{ {
PWCHAR ModulesList, ProtocolName; XTBL_BOOT_PARAMETERS BootParameters;
PWCHAR ModulesList;
PLIST_ENTRY OptionsListEntry; PLIST_ENTRY OptionsListEntry;
PXTBL_CONFIG_ENTRY Option; PXTBL_CONFIG_ENTRY Option;
SIZE_T ModuleListLength; SIZE_T ModuleListLength;
EFI_STATUS Status; EFI_STATUS Status;
/* Set default values */ /* Initialize boot parameters */
ProtocolName = NULL; RtlZeroMemory(&BootParameters, sizeof(XTBL_BOOT_PARAMETERS));
/* Iterate through all options provided by boot menu entry */ /* Iterate through all options provided by boot menu entry and propagate boot parameters */
OptionsListEntry = OptionsList->Flink; OptionsListEntry = OptionsList->Flink;
while(OptionsListEntry != OptionsList) while(OptionsListEntry != OptionsList)
{ {
@ -127,12 +128,7 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
Option = CONTAIN_RECORD(OptionsListEntry, XTBL_CONFIG_ENTRY, Flink); Option = CONTAIN_RECORD(OptionsListEntry, XTBL_CONFIG_ENTRY, Flink);
/* Look for boot protocol and modules list */ /* Look for boot protocol and modules list */
if(RtlCompareWideStringInsensitive(Option->Name, L"SYSTEMTYPE", 0) == 0) if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0)
{
/* Boot protocol found */
ProtocolName = Option->Value;
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0)
{ {
/* Check a length of modules list */ /* Check a length of modules list */
ModuleListLength = RtlWideStringLength(Option->Value, 0); ModuleListLength = RtlWideStringLength(Option->Value, 0);
@ -148,6 +144,36 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
/* Make a copy of modules list */ /* Make a copy of modules list */
RtlCopyMemory(ModulesList, Option->Value, sizeof(PWCHAR) * ModuleListLength); RtlCopyMemory(ModulesList, Option->Value, sizeof(PWCHAR) * ModuleListLength);
} }
else if(RtlCompareWideStringInsensitive(Option->Name, L"SYSTEMTYPE", 0) == 0)
{
/* Boot protocol found */
BootParameters.SystemType = Option->Value;
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"SYSTEMPATH", 0) == 0)
{
/* System path found, get boot volume */
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"KERNELFILE", 0) == 0)
{
/* Kernel file name found */
BootParameters.KernelFile = Option->Value;
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"INITRDFILE", 0) == 0)
{
/* Initrd file name found */
BootParameters.InitrdFile = Option->Value;
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"HALFILE", 0) == 0)
{
/* Hal file name found */
BootParameters.HalFile = Option->Value;
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"PARAMETERS", 0) == 0)
{
/* Kernel parameters found */
BootParameters.Parameters = Option->Value;
}
/* Move to the next option entry */ /* Move to the next option entry */
OptionsListEntry = OptionsListEntry->Flink; OptionsListEntry = OptionsListEntry->Flink;
@ -163,7 +189,7 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
} }
// TODO: Add support for boot protocol and invoke it // TODO: Add support for boot protocol and invoke it
for(;;); return STATUS_EFI_UNSUPPORTED;
/* This point should never be reached */ /* This point should never be reached */
return STATUS_EFI_SUCCESS; return STATUS_EFI_SUCCESS;