Quick code refactor for further modules development
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
26
xtldr/modules/xtos/CMakeLists.txt
Normal file
26
xtldr/modules/xtos/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
# XT Boot Loader
|
||||
PROJECT(XTLDR_XTOS)
|
||||
|
||||
# Specify include directories
|
||||
include_directories(
|
||||
${EXECTOS_SOURCE_DIR}/sdk/xtdk
|
||||
${XTLDR_SOURCE_DIR}/includes)
|
||||
|
||||
# Specify list of source code files
|
||||
list(APPEND XTLDR_XTOS_SOURCE
|
||||
${XTLDR_SOURCE_DIR}/blproto.c
|
||||
${XTLDR_XTOS_SOURCE_DIR}/xtos.c)
|
||||
|
||||
# Link bootloader executable
|
||||
add_executable(xtos ${XTLDR_XTOS_SOURCE})
|
||||
|
||||
# Add linker libraries
|
||||
target_link_libraries(xtos libxtos)
|
||||
|
||||
# Set proper binary name and install target
|
||||
set_target_properties(xtos PROPERTIES SUFFIX .efi)
|
||||
set_install_target(xtos efi/boot/xtldr)
|
||||
|
||||
# Set loader entrypoint, imagebase address, ordinals and subsystem
|
||||
set_entrypoint(xtos "BlXtLdrModuleMain")
|
||||
set_subsystem(xtos efi_boot_service_driver)
|
54
xtldr/modules/xtos/xtos.c
Normal file
54
xtldr/modules/xtos/xtos.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/xtos/xtos.c
|
||||
* DESCRIPTION: XTOS boot protocol support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <blmod.h>
|
||||
|
||||
|
||||
/* EFI Image Handle */
|
||||
EFI_HANDLE EfiImageHandle;
|
||||
|
||||
/* EFI System Table */
|
||||
PEFI_SYSTEM_TABLE EfiSystemTable;
|
||||
|
||||
/* EFI XT Loader Protocol */
|
||||
PXT_BOOT_LOADER_PROTOCOL EfiXtLdrProtocol;
|
||||
|
||||
/**
|
||||
* This routine is the entry point of the XT EFI boot loader module.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
EFI_STATUS
|
||||
BlXtLdrModuleMain(EFI_HANDLE ImageHandle,
|
||||
PEFI_SYSTEM_TABLE SystemTable)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Set the system table and image handle */
|
||||
EfiImageHandle = ImageHandle;
|
||||
EfiSystemTable = SystemTable;
|
||||
|
||||
/* Open the XTLDR protocol */
|
||||
Status = BlGetXtLoaderProtocol(&EfiXtLdrProtocol);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to open loader protocol */
|
||||
return STATUS_EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
/* Return success */
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user