mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
[ROSLOAD]: Create directory and build rules. rosload.efi is now dropped in system32\boot just like on the Windows Setup DVD. BlImgLoadBootApplication is able to find it.
[BOOTMGR/BOOTLIB]: Fix factorings that were incorrect but not noticed when bootmgr was the only bootlib user. Now with rosload in the picture, they became obvious. [EFISYS]: BCD should not be on the EFISYS.BIN, only on the boot volume, just like a Windows DVD. svn path=/trunk/; revision=70626
This commit is contained in:
parent
5126de14b6
commit
e7cbf6ea1b
10 changed files with 141 additions and 11 deletions
|
@ -16,7 +16,7 @@ else()
|
|||
endif()
|
||||
|
||||
add_custom_target(efisys
|
||||
COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 EFIBOOT -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi -add ${CMAKE_BINARY_DIR}/boot/bootdata/BCD EFI/BOOT/BCD
|
||||
COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 EFIBOOT -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi
|
||||
DEPENDS native-fatten fat bootmgfw bcd_hive
|
||||
VERBATIM)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ list(APPEND BOOTLIB_SOURCE
|
|||
lib/misc/image.c
|
||||
lib/misc/resource.c
|
||||
lib/misc/font.c
|
||||
lib/misc/rtlcompat.c
|
||||
lib/firmware/fwutil.c
|
||||
lib/firmware/efi/firmware.c
|
||||
lib/mm/mm.c
|
||||
|
@ -73,7 +74,6 @@ add_dependencies(bootlib bugcodes bootmsg xdk)
|
|||
list(APPEND BOOTMGR_BASE_SOURCE
|
||||
app/bootmgr/efiemu.c
|
||||
app/bootmgr/bootmgr.c
|
||||
app/bootmgr/rtlcompat.c
|
||||
)
|
||||
|
||||
add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE} app/bootmgr/bootmgr.rc)
|
||||
|
@ -105,3 +105,37 @@ endif()
|
|||
|
||||
add_dependencies(bootmgfw asm bugcodes)
|
||||
|
||||
list(APPEND ROSLOAD_BASE_SOURCE
|
||||
app/rosload/rosload.c
|
||||
)
|
||||
|
||||
add_executable(rosload ${ROSLOAD_BASE_SOURCE})
|
||||
set_target_properties(rosload PROPERTIES SUFFIX ".efi")
|
||||
|
||||
if(MSVC)
|
||||
add_target_link_flags(rosload "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
|
||||
else()
|
||||
add_target_link_flags(rosload "-Wl,--strip-all,--exclude-all-symbols")
|
||||
endif()
|
||||
|
||||
set_image_base(rosload 0x10000)
|
||||
|
||||
if(MSVC)
|
||||
set_subsystem(rosload BOOT_APPLICATION)
|
||||
else()
|
||||
set_subsystem(rosload 14)
|
||||
endif()
|
||||
|
||||
set_entrypoint(rosload OslMain@4)
|
||||
|
||||
target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr)
|
||||
|
||||
if(STACK_PROTECTOR)
|
||||
target_link_libraries(rosload gcc_ssp)
|
||||
elseif(RUNTIME_CHECKS)
|
||||
target_link_libraries(rosload runtmchk)
|
||||
endif()
|
||||
|
||||
add_dependencies(rosload asm bugcodes)
|
||||
|
||||
add_cd_file(TARGET rosload DESTINATION reactos/system32/boot NO_CAB FOR all)
|
||||
|
|
|
@ -2862,7 +2862,7 @@ BmMain (
|
|||
goto Failure;
|
||||
}
|
||||
XmlLoaded = TRUE;
|
||||
EfiStall(100000000);
|
||||
|
||||
/* Check if there's an active bitmap visible */
|
||||
if (!BlDisplayValidOemBitmap())
|
||||
{
|
||||
|
|
|
@ -22,8 +22,6 @@ typedef struct _BOOT_APPLICATION_PARAMETER_BLOCK_SCRATCH
|
|||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
ULONG BlpApplicationFlags;
|
||||
|
||||
BOOT_APPLICATION_PARAMETER_BLOCK_SCRATCH EfiInitScratch;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
|
39
reactos/boot/environ/app/rosload/rosload.c
Normal file
39
reactos/boot/environ/app/rosload/rosload.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI OS Loader
|
||||
* FILE: boot/environ/app/rosload/rosload.c
|
||||
* PURPOSE: OS Loader Entrypoint
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "rosload.h"
|
||||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*++
|
||||
* @name OslMain
|
||||
*
|
||||
* The BmMain function implements the Windows Boot Application entrypoint for
|
||||
* the OS Loader.
|
||||
*
|
||||
* @param BootParameters
|
||||
* Pointer to the Boot Application Parameter Block.
|
||||
*
|
||||
* @return NT_SUCCESS if the image was loaded correctly, relevant error code
|
||||
* otherwise.
|
||||
*
|
||||
*--*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
OslMain (
|
||||
_In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootParameters
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"ReactOS UEFI OS Loader Initializing...\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
36
reactos/boot/environ/app/rosload/rosload.h
Normal file
36
reactos/boot/environ/app/rosload/rosload.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI OS Loader
|
||||
* FILE: boot/environ/app/rosload/rosload.h
|
||||
* PURPOSE: Main OS Loader Header
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
#ifndef _ROSLOAD_H
|
||||
#define _ROSLOAD_H
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
/* C Headers */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* NT Base Headers */
|
||||
#include <initguid.h>
|
||||
#include <ntifs.h>
|
||||
|
||||
/* UEFI Headers */
|
||||
#include <Uefi.h>
|
||||
|
||||
/* Boot Library Headers */
|
||||
#include <bl.h>
|
||||
|
||||
/* BCD Headers */
|
||||
#include <bcd.h>
|
||||
|
||||
/* STRUCTURES ****************************************************************/
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#endif
|
|
@ -134,6 +134,9 @@ DEFINE_GUID(BadMemoryGuid, 0x54B8275B, 0xD431, 0x473F, 0xAC, 0xFB, 0xE5, 0x36, 0
|
|||
#define BL_FILE_ENTRY_READ_ACCESS 0x02
|
||||
#define BL_FILE_ENTRY_WRITE_ACCESS 0x04
|
||||
#define BL_FILE_ENTRY_UNKNOWN_ACCESS 0x10
|
||||
#define BL_FILE_ENTRY_DIRECTORY 0x10000
|
||||
|
||||
#define BL_ETFS_FILE_ENTRY_DIRECTORY 0x01
|
||||
|
||||
#define BL_IMG_VALID_FILE 0x01
|
||||
#define BL_IMG_MEMORY_FILE 0x02
|
||||
|
|
|
@ -18,6 +18,7 @@ PWCHAR BlpApplicationBaseDirectory;
|
|||
PBOOT_APPLICATION_PARAMETER_BLOCK BlpApplicationParameters;
|
||||
BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
|
||||
BOOLEAN BlpLibraryParametersInitialized;
|
||||
ULONG BlpApplicationFlags;
|
||||
|
||||
ULONG PdPersistAllocations;
|
||||
LIST_ENTRY BlpPdListHead;
|
||||
|
|
|
@ -573,15 +573,18 @@ EtfsOpen (
|
|||
&FileSize,
|
||||
&IsDirectory);
|
||||
|
||||
/* Allocate a file entry */
|
||||
NewFile = BlMmAllocateHeap(sizeof(*NewFile));
|
||||
if (!NewFile)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Zero it out */
|
||||
RtlZeroMemory(NewFile, sizeof(*NewFile));
|
||||
|
||||
/* Figure out the size of the path and filename plus a slash and NUL */
|
||||
Size = wcslen(Directory->FilePath) + wcslen(FileName) + 2;
|
||||
|
||||
FilePath = BlMmAllocateHeap(Size * sizeof(WCHAR));
|
||||
if (!FilePath)
|
||||
{
|
||||
|
@ -589,6 +592,7 @@ EtfsOpen (
|
|||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Allocate an ETFS file entry */
|
||||
EtfsFile = (PBL_ETFS_FILE)BlMmAllocateHeap(sizeof(*EtfsFile));
|
||||
if (!EtfsFile)
|
||||
{
|
||||
|
@ -596,48 +600,63 @@ EtfsOpen (
|
|||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Zero it out */
|
||||
RtlZeroMemory(NewFile, sizeof(*EtfsFile));
|
||||
|
||||
/* Capture the device ID of the directory */
|
||||
NewFile->DeviceId = Directory->DeviceId;
|
||||
|
||||
/* Check if this is the root or a filename\directory under */
|
||||
FormatString = L"%ls%ls";
|
||||
if (Directory->FilePath[1])
|
||||
{
|
||||
FormatString = L"%ls\\%ls";
|
||||
}
|
||||
|
||||
/* Combine the paths, and save the final path in the file entry */
|
||||
_snwprintf(FilePath, Size, FormatString, Directory->FilePath, FileName);
|
||||
NewFile->FilePath = FilePath;
|
||||
|
||||
/* Copy the ETFS function callbacks into the file netry */
|
||||
RtlCopyMemory(&NewFile->Callbacks,
|
||||
&EtfsFunctionTable,
|
||||
sizeof(NewFile->Callbacks));
|
||||
|
||||
/* Fill out the rest of the details */
|
||||
EtfsFile->DiskOffset = FileOffset;
|
||||
EtfsFile->DirOffset = DirOffset;
|
||||
EtfsFile->Size = FileSize;
|
||||
EtfsFile->DeviceId = DeviceId;
|
||||
|
||||
/* Check if this is a directory */
|
||||
if (IsDirectory)
|
||||
{
|
||||
EtfsFile->Flags |= 1;
|
||||
NewFile->Flags |= 0x10000;
|
||||
EtfsFile->Flags |= BL_ETFS_FILE_ENTRY_DIRECTORY;
|
||||
NewFile->Flags |= BL_FILE_ENTRY_DIRECTORY;
|
||||
}
|
||||
|
||||
/* Write down the name of the filesytem */
|
||||
EtfsFile->FsName = L"cdfs";
|
||||
|
||||
/* All done, return the file entry, and save the ETFS side */
|
||||
NewFile->FsSpecificData = EtfsFile;
|
||||
*FileEntry = NewFile;
|
||||
return Status;
|
||||
|
||||
Quickie:
|
||||
|
||||
/* Failure path -- free the file path if we had one */
|
||||
if (NewFile->FilePath)
|
||||
{
|
||||
BlMmFreeHeap(NewFile->FilePath);
|
||||
}
|
||||
|
||||
/* Free the ETFS file entry if we had one */
|
||||
if (NewFile->FsSpecificData)
|
||||
{
|
||||
BlMmFreeHeap(NewFile->FsSpecificData);
|
||||
}
|
||||
|
||||
/* Free the file entry itself, and return the error code */
|
||||
BlMmFreeHeap(NewFile);
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Manager
|
||||
* FILE: boot/environ/app/bootmgr/rtlcompat.c
|
||||
* FILE: boot/environ/lib/misc/rtlcompat.c
|
||||
* PURPOSE: RTL Library Compatibility Routines
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bootmgr.h"
|
||||
#include "bl.h"
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
Loading…
Reference in a new issue