Rewrite core of the XTLDR boot loader
Reviewed-on: #7 Reviewed-by: Piotr Likoski <likoski@noreply.codingworkshop.git> Co-authored-by: Rafal Kupiec <belliash@codingworkshop.eu.org> Co-committed-by: Rafal Kupiec <belliash@codingworkshop.eu.org>
This commit is contained in:
committed by
CodingWorkshop Signing Team
parent
44905bb71d
commit
4412d4fc98
27
xtldr/modules/dummy/CMakeLists.txt
Normal file
27
xtldr/modules/dummy/CMakeLists.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
# XT Boot Loader Dummy Module
|
||||
PROJECT(XTLDR_DUMMY)
|
||||
|
||||
# Specify include directories
|
||||
include_directories(
|
||||
${EXECTOS_SOURCE_DIR}/sdk/xtdk
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/includes)
|
||||
|
||||
# Specify list of source code files
|
||||
list(APPEND XTLDR_DUMMY_SOURCE
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/dummy.c
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/globals.c)
|
||||
|
||||
# Link bootloader executable
|
||||
add_executable(dummy ${XTLDR_DUMMY_SOURCE})
|
||||
|
||||
# Add linker libraries
|
||||
target_link_libraries(dummy libxtldr)
|
||||
|
||||
# Set proper binary name and install target
|
||||
set_target_properties(dummy PROPERTIES SUFFIX .efi)
|
||||
set_install_target(dummy efi/boot/xtldr/modules)
|
||||
|
||||
# Set module entrypoint and subsystem
|
||||
set_entrypoint(dummy "XtLdrModuleMain")
|
||||
set_linker_map(dummy TRUE)
|
||||
set_subsystem(dummy efi_boot_service_driver)
|
69
xtldr/modules/dummy/dummy.c
Normal file
69
xtldr/modules/dummy/dummy.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/dummy.c
|
||||
* DESCRIPTION: XTLDR Dummy Module
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <dummy.h>
|
||||
|
||||
|
||||
/* Dummy module information */
|
||||
XTBL_MODINFO = L"XTLDR Dummy Module";
|
||||
|
||||
/**
|
||||
* Stub boot routine.
|
||||
*
|
||||
* @param Parameters
|
||||
* Supplies all parameters associated with the chosen boot menu entry.
|
||||
*
|
||||
* @return This routine returns a status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlBootDummyOS(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
{
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 a status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||
{
|
||||
EFI_GUID DummyGuid = XT_XTOS_BOOT_PROTOCOL_GUID;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Open the XTLDR protocol */
|
||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProto);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to open the protocol, return error */
|
||||
return STATUS_EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
/* Set boot protocol routines */
|
||||
BlpDummyProtocol.BootSystem = BlBootDummyOS;
|
||||
|
||||
/* Register XTOS boot protocol */
|
||||
XtLdrProto->Boot.RegisterProtocol(L"XTOS", &DummyGuid);
|
||||
|
||||
/* Register DUMMY protocol as XTOS boot protocol */
|
||||
return XtLdrProto->Protocol.Install(&BlpDummyProtocol, &DummyGuid);
|
||||
}
|
16
xtldr/modules/dummy/globals.c
Normal file
16
xtldr/modules/dummy/globals.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/globals.c
|
||||
* DESCRIPTION: Dummy XTLDR module global variables
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <dummy.h>
|
||||
|
||||
|
||||
/* XTLDR protocol handler */
|
||||
PXTBL_LOADER_PROTOCOL XtLdrProto;
|
||||
|
||||
/* Dummy Boot Protocol handler */
|
||||
XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
26
xtldr/modules/dummy/includes/dummy.h
Normal file
26
xtldr/modules/dummy/includes/dummy.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/includes/dummy.h
|
||||
* DESCRIPTION: XTLDR Dummy Module header file
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __XTLDR_DUMMY_DUMMY_H
|
||||
#define __XTLDR_DUMMY_DUMMY_H
|
||||
|
||||
#include <xtblapi.h>
|
||||
#include <globals.h>
|
||||
|
||||
|
||||
/* Dummy module routines forward references */
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlBootDummyOS(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||
|
||||
#endif/* __XTLDR_DUMMY_DUMMY_H */
|
21
xtldr/modules/dummy/includes/globals.h
Normal file
21
xtldr/modules/dummy/includes/globals.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/includes/globals.h
|
||||
* DESCRIPTION: XTLDR Dummy Module global variables
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __XTLDR_DUMMY_GLOBALS_H
|
||||
#define __XTLDR_DUMMY_GLOBALS_H
|
||||
|
||||
#include <dummy.h>
|
||||
|
||||
|
||||
/* XTLDR protocol handler */
|
||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProto;
|
||||
|
||||
/* Dummy Boot Protocol handler */
|
||||
EXTERN XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
||||
|
||||
#endif/* __XTLDR_DUMMY_GLOBALS_H */
|
Reference in New Issue
Block a user