XTLDR Rewrite #7

Merged
belliash merged 184 commits from xtldr_rewrite into master 2024-01-09 18:51:04 +01:00
6 changed files with 132 additions and 1 deletions
Showing only changes of commit 4076175436 - Show all commits

View File

@ -70,5 +70,5 @@ set_disk_image_size(128)
# Build all subprojects
add_subdirectory(bootdata)
add_subdirectory(xtldr)
add_subdirectory(xtldr2)
add_subdirectory(xtoskrnl)

34
xtldr2/CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
# XT Boot Manager
PROJECT(XTLDR)
# Specify include directories
include_directories(
${EXECTOS_SOURCE_DIR}/sdk/xtdk
${XTLDR_SOURCE_DIR}/includes)
# Specify list of source code files
list(APPEND XTLDR_SOURCE
${XTLDR_SOURCE_DIR}/globals.c
${XTLDR_SOURCE_DIR}/xtldr.c)
# Link static XTLDR library
add_library(libxtldr ${XTLDR_SOURCE})
# Link bootloader executable
add_executable(xtldr ${XTLDR_SOURCE})
# Add linker libraries
target_link_libraries(xtldr libxtos)
# Set proper binary name and install target
if(ARCH STREQUAL "i686")
set(BINARY_NAME "bootia32")
elseif(ARCH STREQUAL "amd64")
set(BINARY_NAME "bootx64")
endif()
set_target_properties(xtldr PROPERTIES OUTPUT_NAME ${BINARY_NAME} SUFFIX .efi)
set_install_target(xtldr efi/boot)
# Set loader entrypoint and subsystem
set_entrypoint(xtldr "BmStartXtLoader")
set_subsystem(xtldr efi_application)

14
xtldr2/README.md Normal file
View File

@ -0,0 +1,14 @@
## XT Boot Manager (XTLDR)
The XTLDR, or XTOS Boot Loader, is an EFI (Extensible Firmware Interface) boot loader specifically designed for XTOS.
As an EFI boot loader, XTLDR operates exclusively with EFI-based hardware and is not compatible with non-EFI systems,
like old and deprecated BIOS.
One of the notable features of XTLDR is its modular design. The boot loader is divided into different modules, with only
the essential core being loaded during the boot process. This modular approach allows for a more efficient and
streamlined boot experience, as only the necessary functionality is loaded, reducing the boot time and system resource
usage.
XTLDR includes various modules that provide specific functionalities required for the boot process. For example, there is
a module dedicated to supporting the XTOS boot protocol, which is the specific protocol used by XTOS for loading and
executing the OS kernel. Additionally, there is a module for handling PE/COFF (Portable Executable) binaries, which is
a commonly used format of executable files used by the XTOS.

16
xtldr2/globals.c Normal file
View File

@ -0,0 +1,16 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/globals.c
* DESCRIPTION: XT Boot Manager global variables
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtbm.h>
/* EFI Image Handle */
EFI_HANDLE EfiImageHandle;
/* EFI System Table */
PEFI_SYSTEM_TABLE EfiSystemTable;

29
xtldr2/includes/xtbm.h Normal file
View File

@ -0,0 +1,29 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/includes/xtbm.h
* DESCRIPTION: Top level header for XTLDR
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#ifndef __XTLDR_XTBM_H
#define __XTLDR_XTBM_H
#include <xtbmapi.h>
#include <xtver.h>
/* EFI Image Handle */
EXTERN EFI_HANDLE EfiImageHandle;
/* EFI System Table */
EXTERN PEFI_SYSTEM_TABLE EfiSystemTable;
/* XTLDR routines forward references */
XTCDECL
EFI_STATUS
BmStartXtLoader(IN EFI_HANDLE ImageHandle,
IN PEFI_SYSTEM_TABLE SystemTable);
#endif /* __XTLDR_XTBM_H */

38
xtldr2/xtldr.c Normal file
View File

@ -0,0 +1,38 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/xtldr.c
* DESCRIPTION: XTOS UEFI Boot Manager
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtbm.h>
/**
* This routine is the entry point of the XT EFI boot manager.
*
* @param ImageHandle
* Firmware-allocated handle that identifies the image.
*
* @param SystemTable
* Provides the EFI system table.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
XTCDECL
EFI_STATUS
BmStartXtLoader(IN EFI_HANDLE ImageHandle,
IN PEFI_SYSTEM_TABLE SystemTable)
{
EFI_STATUS Status;
/* Set the system table and image handle */
EfiImageHandle = ImageHandle;
EfiSystemTable = SystemTable;
/* This point should be never reached, if this happen return error code */
return STATUS_EFI_LOAD_ERROR;
}