Author: ion
Date: Wed Jan 20 06:59:12 2016
New Revision: 70626
URL:
http://svn.reactos.org/svn/reactos?rev=70626&view=rev
Log:
[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.
Added:
trunk/reactos/boot/environ/app/rosload/ (with props)
trunk/reactos/boot/environ/app/rosload/rosload.c (with props)
trunk/reactos/boot/environ/app/rosload/rosload.h (with props)
trunk/reactos/boot/environ/lib/misc/rtlcompat.c
- copied, changed from r70605, trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c
Removed:
trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c
Modified:
trunk/reactos/boot/CMakeLists.txt
trunk/reactos/boot/environ/CMakeLists.txt
trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
trunk/reactos/boot/environ/app/bootmgr/efiemu.c
trunk/reactos/boot/environ/include/bl.h
trunk/reactos/boot/environ/lib/bootlib.c
trunk/reactos/boot/environ/lib/io/etfs.c
Modified: trunk/reactos/boot/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/CMakeLists.txt?rev=70…
==============================================================================
--- trunk/reactos/boot/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/CMakeLists.txt [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -16,7 +16,7 @@
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)
Modified: trunk/reactos/boot/environ/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/CMakeLists.tx…
==============================================================================
--- trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -18,6 +18,7 @@
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 @@
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 @@
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)
Modified: trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/b…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] Wed Jan 20 06:59:12
2016
@@ -2862,7 +2862,7 @@
goto Failure;
}
XmlLoaded = TRUE;
- EfiStall(100000000);
+
/* Check if there's an active bitmap visible */
if (!BlDisplayValidOemBitmap())
{
Modified: trunk/reactos/boot/environ/app/bootmgr/efiemu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/e…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/efiemu.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/app/bootmgr/efiemu.c [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -21,8 +21,6 @@
} BOOT_APPLICATION_PARAMETER_BLOCK_SCRATCH;
/* DATA VARIABLES ************************************************************/
-
-ULONG BlpApplicationFlags;
BOOT_APPLICATION_PARAMETER_BLOCK_SCRATCH EfiInitScratch;
Removed: trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/r…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c (removed)
@@ -1,98 +0,0 @@
-/*
-* COPYRIGHT: See COPYING.ARM in the top level directory
-* PROJECT: ReactOS UEFI Boot Manager
-* FILE: boot/environ/app/bootmgr/rtlcompat.c
-* PURPOSE: RTL Library Compatibility Routines
-* PROGRAMMER: Alex Ionescu (alex.ionescu(a)reactos.org)
-*/
-
-/* INCLUDES ******************************************************************/
-
-#include "bootmgr.h"
-
-/* FUNCTIONS *****************************************************************/
-
-#if DBG
-VOID FASTCALL
-CHECK_PAGED_CODE_RTL (
- char *file,
- int line
- )
-{
- // boot-code is always ok
-}
-#endif
-
-PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFF;
-
-PVOID
-NTAPI
-RtlpAllocateMemory (
- _In_ ULONG Bytes,
- _In_ ULONG Tag
- )
-{
- UNREFERENCED_PARAMETER(Tag);
- return BlMmAllocateHeap(Bytes);
-}
-
-VOID
-NTAPI
-RtlpFreeMemory (
- _In_ PVOID Mem,
- _In_ ULONG Tag
- )
-{
- UNREFERENCED_PARAMETER(Tag);
- BlMmFreeHeap(Mem);
-}
-
-NTSTATUS
-NTAPI
-RtlpSafeCopyMemory (
- _Out_writes_bytes_all_(Length) VOID UNALIGNED *Destination,
- _In_reads_bytes_(Length) CONST VOID UNALIGNED *Source,
- _In_ SIZE_T Length
- )
-{
- RtlCopyMemory(Destination, Source, Length);
- return STATUS_SUCCESS;
-}
-
-VOID
-NTAPI
-RtlAssert (
- IN PVOID FailedAssertion,
- IN PVOID FileName,
- IN ULONG LineNumber,
- IN PCHAR Message OPTIONAL
- )
-{
- EfiPrintf(L"*** ASSERTION %s FAILED AT %d in %s (%s) ***\r\n",
- FailedAssertion,
- LineNumber,
- FileName,
- Message);
-}
-
-ULONG
-DbgPrint (
- const char *Format,
- ...
- )
-{
- EfiPrintf(L"%s\r\n", Format);
- return 0;
-}
-
-VOID
-NTAPI
-KeBugCheckEx(
- _In_ ULONG BugCheckCode,
- _In_ ULONG_PTR BugCheckParameter1,
- _In_ ULONG_PTR BugCheckParameter2,
- _In_ ULONG_PTR BugCheckParameter3,
- _In_ ULONG_PTR BugCheckParameter4)
-{
- __assume(0);
-}
Propchange: trunk/reactos/boot/environ/app/rosload/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Wed Jan 20 06:59:12 2016
@@ -0,0 +1 @@
+((CORE|ROSTESTS|ROSAPPS)-\d+)(,? ?((CORE|ROSTESTS|ROSAPPS)-\d+))*(,? ?(and |or
)?((CORE|ROSTESTS|ROSAPPS)-\d+))?
Propchange: trunk/reactos/boot/environ/app/rosload/
------------------------------------------------------------------------------
bugtraq:message = See issue %BUGID% for more details.
Propchange: trunk/reactos/boot/environ/app/rosload/
------------------------------------------------------------------------------
bugtraq:url =
https://jira.reactos.org/browse/%BUGID%
Propchange: trunk/reactos/boot/environ/app/rosload/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/boot/environ/app/rosload/rosload.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/rosload/r…
==============================================================================
--- trunk/reactos/boot/environ/app/rosload/rosload.c (added)
+++ trunk/reactos/boot/environ/app/rosload/rosload.c [iso-8859-1] Wed Jan 20 06:59:12
2016
@@ -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(a)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;
+}
+
Propchange: trunk/reactos/boot/environ/app/rosload/rosload.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/boot/environ/app/rosload/rosload.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/rosload/r…
==============================================================================
--- trunk/reactos/boot/environ/app/rosload/rosload.h (added)
+++ trunk/reactos/boot/environ/app/rosload/rosload.h [iso-8859-1] Wed Jan 20 06:59:12
2016
@@ -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(a)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
Propchange: trunk/reactos/boot/environ/app/rosload/rosload.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/boot/environ/include/bl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
==============================================================================
--- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -134,6 +134,9 @@
#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
Modified: trunk/reactos/boot/environ/lib/bootlib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/bootlib.c…
==============================================================================
--- trunk/reactos/boot/environ/lib/bootlib.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/bootlib.c [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -18,6 +18,7 @@
PBOOT_APPLICATION_PARAMETER_BLOCK BlpApplicationParameters;
BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
BOOLEAN BlpLibraryParametersInitialized;
+ULONG BlpApplicationFlags;
ULONG PdPersistAllocations;
LIST_ENTRY BlpPdListHead;
Modified: trunk/reactos/boot/environ/lib/io/etfs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/etfs.c…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/etfs.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/etfs.c [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -573,15 +573,18 @@
&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 @@
goto Quickie;
}
+ /* Allocate an ETFS file entry */
EtfsFile = (PBL_ETFS_FILE)BlMmAllocateHeap(sizeof(*EtfsFile));
if (!EtfsFile)
{
@@ -596,48 +600,63 @@
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;
}
Copied: trunk/reactos/boot/environ/lib/misc/rtlcompat.c (from r70605,
trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/rtlc…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/rtlcompat.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/rtlcompat.c [iso-8859-1] Wed Jan 20 06:59:12 2016
@@ -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(a)reactos.org)
*/
/* INCLUDES ******************************************************************/
-#include "bootmgr.h"
+#include "bl.h"
/* FUNCTIONS *****************************************************************/