Removed debugging junk for BlpConfigParseIniFile()

This commit is contained in:
Jozef Nagy 2023-12-06 22:49:10 +01:00
parent fabadd013c
commit 46682dcf65
No known key found for this signature in database
GPG Key ID: 5F72C3BF3BD614D8
4 changed files with 15 additions and 35 deletions

View File

@ -66,7 +66,7 @@ file(RELATIVE_PATH _PATH_PREFIX ${EXECTOS_BINARY_DIR} ${EXECTOS_SOURCE_DIR})
add_compiler_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof XTOS_SOURCE_DIR]") add_compiler_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof XTOS_SOURCE_DIR]")
# Set the virtual disk image size (in MiB) # Set the virtual disk image size (in MiB)
set_disk_image_size(16) set_disk_image_size(128)
# Build all subprojects # Build all subprojects
add_subdirectory(bootdata) add_subdirectory(bootdata)

View File

@ -18,14 +18,14 @@
* @param Sections * @param Sections
* Supplies a pointer to a linked list which will be written by this routine. * Supplies a pointer to a linked list which will be written by this routine.
* *
* @return This routine returns a status code. * @return This routine does not return any value.
* *
* @since XT 1.0 * @since XT 1.0
*/ */
XTCDECL XTCDECL
XTSTATUS VOID
BlConfigParseIniFile(IN PWCHAR FileContents, BlpConfigParseIniFile(IN PWCHAR FileContents,
OUT PLIST_ENTRY Sections) OUT PLIST_ENTRY SectionsHead)
{ {
PWCHAR CurrentSectionName, Key, Value; PWCHAR CurrentSectionName, Key, Value;
PWCHAR Input; PWCHAR Input;
@ -62,31 +62,24 @@ BlConfigParseIniFile(IN PWCHAR FileContents,
/* Skip to the next line */ /* Skip to the next line */
while(*Input != ']' && *Input != 0 && *Input != '\n') while(*Input != ']' && *Input != 0 && *Input != '\n')
{ {
Input++;
SectionLength++; SectionLength++;
}
CurrentSectionName[SectionLength] = 0;
Input++; Input++;
}
BlConsolePrint(L"[%S]\n", CurrentSectionName); Input++;
} }
else else
{ {
/* Get the length of key */ /* Get the length of key */
while(*Input != '=' && *Input != 0 && *Input != '\n') while(*Input != '=' && *Input != 0 && *Input != '\n')
{ {
Input++;
KeyLength++; KeyLength++;
Input++;
} }
/* Set key */ /* Set key */
Input -= KeyLength; Key = Input - KeyLength;
Key = Input;
Key[KeyLength] = 0; Key[KeyLength] = 0;
BlConsolePrint(L"%S=", Key); Input++;
/* Skip to the value */
Input += KeyLength + 1;
/* Get the length of value */ /* Get the length of value */
while(*Input != 0 && *Input != '\n') while(*Input != 0 && *Input != '\n')
@ -96,17 +89,11 @@ BlConfigParseIniFile(IN PWCHAR FileContents,
} }
/* Set value */ /* Set value */
Input -= ValueLength; Value = Input - ValueLength;
Value = Input;
Value[ValueLength] = 0; Value[ValueLength] = 0;
BlConsolePrint(L"%S\n", Value);
Input += ValueLength;
Input++; Input++;
} }
} }
return STATUS_SUCCESS;
} }
/** /**

View File

@ -79,6 +79,11 @@ XTCDECL
EFI_STATUS EFI_STATUS
BlpActivateSerialIOController(); BlpActivateSerialIOController();
XTCDECL
VOID
BlpConfigParseIniFile(IN PWCHAR FileContents,
OUT PLIST_ENTRY SectionsHead);
XTCDECL XTCDECL
VOID VOID
BlpParseCommandLineOptions(VOID); BlpParseCommandLineOptions(VOID);
@ -123,11 +128,6 @@ BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine,
IN PUINT16 Format, IN PUINT16 Format,
IN ...); IN ...);
XTCDECL
XTSTATUS
BlConfigParseIniFile(IN PWCHAR FileContents,
OUT PLIST_ENTRY Sections);
XTCDECL XTCDECL
VOID VOID
BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine, BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine,

View File

@ -28,23 +28,16 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
IN PEFI_SYSTEM_TABLE SystemTable) IN PEFI_SYSTEM_TABLE SystemTable)
{ {
EFI_STATUS Status; EFI_STATUS Status;
LIST_ENTRY ConfigSections;
/* Set the system table and image handle */ /* Set the system table and image handle */
EfiImageHandle = ImageHandle; EfiImageHandle = ImageHandle;
EfiSystemTable = SystemTable; EfiSystemTable = SystemTable;
RtlInitializeListHead(&ConfigSections);
/* Initialize UEFI console and early print XTLDR version */ /* Initialize UEFI console and early print XTLDR version */
BlpConsoleInitialize(); BlpConsoleInitialize();
/* Parse INI Configuration file */
/* Initialize XTLDR and early print XTLDR version */ /* Initialize XTLDR and early print XTLDR version */
BlpInitializeEfiBootLoader(); BlpInitializeEfiBootLoader();
BlConfigParseIniFile(L"# This is the XT Boot Loader (XTLDR) configuration file. It follows an INI format and is divided into sections, which\n# contain a properties. Each property has a name and value delimited by an equal (=) character. Comments must start\n# with a semicolon (;) or a hash character (#) and run to the end of the line.\n#\n# Basic section is [XTLDR] which contains a bootloader specific options:\n# Debug - enables the debugging port and consists of two comma-separated parameters: com port and baud rate;\n# it is also possible to specify custom port address with: COM0:[address],[baud_rate]\n# Default - specifies which operating system listen in config file will be started if no choice is made\n# Timeout - sets the countdown timer (in seconds) before the default OS get started automatically\n# Tune - plays a tune on the pcspeaker right before the XTLDR loads\n#\n# Another type of section is [OS-Section] which adds a new position (operating system) to the boot menu. Each type\n# of the operating system provides a set of available parameters. If unsupported option is added, it is being ignored\n# by the XT Boot Loader. The available options are:\n# SystemName - sets a long operating system name that will be shown on the boot menu\n# SystemType - specifies an OS type from a predefined list of supported boot protocols\n# SystemPath - the ARC path, eg. multi(0)disk(0)rdisk(0)partition(1)\n# KernelFile - sets kernel filename with optional path relative to SystemPath\n# InitrdFile - sets initramfs image filename with optional path relative to SystemPath\n# HalFile - sets HAL filename with optional path relative to SystemPath\n# Parameters - specifies extra boot options for the kernel\n\n[XTLDR]\nTune=400 880 2 988 2 783 2 392 2 587 3\nDebug=COM1,115200\nTimeout=30\nDefault=ExectOS\n\n[ExectOS]\nSystemName=\"ExectOS Operating System\"\nSystemType=XTOS\nSystemPath=multi(0)disk(0)rdisk(0)partition(1)/ExectOS\nKernelFile=xtoskrnl.exe\nParameters=DEBUG DEBUGPORT=COM1,115200\n\n[Windows]\nSystemName=\"Microsoft Windows 2000\"\nSystemType=NT50\nSystemPath=multi(0)disk(0)rdisk(0)partition(2)/Windows\nKernelFile=ntoskrnl.exe\nHalFile=hal.dll\nParameters=/NOGUIBOOT /MININT\n\n[Linux]\nSystemName=\"GNU/Linux\"\nSystemType=LINUX\nSystemPath=multi(0)disk(0)rdisk(0)partition(3)/boot\nKernelFile=vmlinuz\nInitrdFile=initramfs.cpio.gz\nParameters=root=/dev/xvda3 rootfstype=ext4", &ConfigSections);
BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION); BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION);
/* Parse configuration options passed from UEFI shell */ /* Parse configuration options passed from UEFI shell */