diff --git a/CMakeLists.txt b/CMakeLists.txt index c635dc0..b9bf79e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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]") # Set the virtual disk image size (in MiB) -set_disk_image_size(16) +set_disk_image_size(128) # Build all subprojects add_subdirectory(bootdata) diff --git a/xtldr2/config.c b/xtldr2/config.c index d5aa967..ebedca7 100644 --- a/xtldr2/config.c +++ b/xtldr2/config.c @@ -18,14 +18,14 @@ * @param Sections * 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 */ XTCDECL -XTSTATUS -BlConfigParseIniFile(IN PWCHAR FileContents, - OUT PLIST_ENTRY Sections) +VOID +BlpConfigParseIniFile(IN PWCHAR FileContents, + OUT PLIST_ENTRY SectionsHead) { PWCHAR CurrentSectionName, Key, Value; PWCHAR Input; @@ -62,31 +62,24 @@ BlConfigParseIniFile(IN PWCHAR FileContents, /* Skip to the next line */ while(*Input != ']' && *Input != 0 && *Input != '\n') { - Input++; SectionLength++; + Input++; } - CurrentSectionName[SectionLength] = 0; Input++; - - BlConsolePrint(L"[%S]\n", CurrentSectionName); } else { /* Get the length of key */ while(*Input != '=' && *Input != 0 && *Input != '\n') { - Input++; KeyLength++; + Input++; } /* Set key */ - Input -= KeyLength; - Key = Input; + Key = Input - KeyLength; Key[KeyLength] = 0; - BlConsolePrint(L"%S=", Key); - - /* Skip to the value */ - Input += KeyLength + 1; + Input++; /* Get the length of value */ while(*Input != 0 && *Input != '\n') @@ -96,17 +89,11 @@ BlConfigParseIniFile(IN PWCHAR FileContents, } /* Set value */ - Input -= ValueLength; - Value = Input; + Value = Input - ValueLength; Value[ValueLength] = 0; - BlConsolePrint(L"%S\n", Value); - Input += ValueLength; - Input++; } } - - return STATUS_SUCCESS; } /** diff --git a/xtldr2/includes/bootman.h b/xtldr2/includes/bootman.h index 5b03b5b..ba0b842 100644 --- a/xtldr2/includes/bootman.h +++ b/xtldr2/includes/bootman.h @@ -79,6 +79,11 @@ XTCDECL EFI_STATUS BlpActivateSerialIOController(); +XTCDECL +VOID +BlpConfigParseIniFile(IN PWCHAR FileContents, + OUT PLIST_ENTRY SectionsHead); + XTCDECL VOID BlpParseCommandLineOptions(VOID); @@ -123,11 +128,6 @@ BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine, IN PUINT16 Format, IN ...); -XTCDECL -XTSTATUS -BlConfigParseIniFile(IN PWCHAR FileContents, - OUT PLIST_ENTRY Sections); - XTCDECL VOID BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine, diff --git a/xtldr2/xtldr.c b/xtldr2/xtldr.c index b76332b..5e33e75 100644 --- a/xtldr2/xtldr.c +++ b/xtldr2/xtldr.c @@ -28,23 +28,16 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle, IN PEFI_SYSTEM_TABLE SystemTable) { EFI_STATUS Status; - LIST_ENTRY ConfigSections; /* Set the system table and image handle */ EfiImageHandle = ImageHandle; EfiSystemTable = SystemTable; - - RtlInitializeListHead(&ConfigSections); - /* Initialize UEFI console and early print XTLDR version */ BlpConsoleInitialize(); - /* Parse INI Configuration file */ - /* Initialize XTLDR and early print XTLDR version */ 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); /* Parse configuration options passed from UEFI shell */