Skip to content

Commit ef8776a

Browse files
committed
Merge branch 'boot/freeldr-split' of https://github.com/tkreuzer/reactos into xbox
2 parents 4623570 + 9b5c887 commit ef8776a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+662
-225
lines changed

base/setup/lib/bootsup.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ InstallMbrBootCodeToDisk(
880880
InstallMbrBootCode);
881881
}
882882

883-
884883
static
885884
NTSTATUS
886885
InstallBootloaderFiles(
@@ -895,7 +894,19 @@ InstallBootloaderFiles(
895894
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\freeldr.sys");
896895
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.sys");
897896

898-
DPRINT1("Copy: %S ==> %S\n", SrcPath, DstPath);
897+
DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
898+
Status = SetupCopyFile(SrcPath, DstPath, FALSE);
899+
if (!NT_SUCCESS(Status))
900+
{
901+
DPRINT1("SetupCopyFile() failed (Status 0x%08lx)\n", Status);
902+
return Status;
903+
}
904+
905+
/* Copy rosload to the system partition, always overwriting the older version */
906+
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\rosload.exe");
907+
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"rosload.exe");
908+
909+
DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
899910
Status = SetupCopyFile(SrcPath, DstPath, FALSE);
900911
if (!NT_SUCCESS(Status))
901912
{

base/setup/lib/utils/bldrsup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ NtLdrEnumerateBootEntries(
124124
// Question 2: What if many config files are possible?
125125
NTOS_BOOT_LOADER_FILES NtosBootLoaders[] =
126126
{
127-
{FreeLdr, L"freeldr.sys\0", L"freeldr.ini",
127+
{FreeLdr, L"freeldr.sys\0" L"rosload.exe\0", L"freeldr.ini",
128128
OpenIniBootLoaderStore, CloseIniBootLoaderStore, (PENUM_BOOT_STORE_ENTRIES)FreeLdrEnumerateBootEntries},
129129
{NtLdr , L"ntldr\0" L"osloader.exe\0", L"boot.ini",
130130
OpenIniBootLoaderStore, CloseIniBootLoaderStore, (PENUM_BOOT_STORE_ENTRIES)NtLdrEnumerateBootEntries },

boot/freeldr/freeldr/CMakeLists.txt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ list(APPEND FREELDR_BOOTLIB_SOURCE
5858

5959
list(APPEND FREELDR_BOOTMGR_SOURCE
6060
include/freeldr.h
61-
custom.c
62-
# linuxboot.c
63-
miscboot.c
64-
options.c
65-
oslist.c
6661
settings.c
6762
ui/directui.c
6863
# ui/gui.c
@@ -88,10 +83,7 @@ if(ARCH STREQUAL "i386")
8883
# arch/i386/linux.S
8984

9085
list(APPEND FREELDR_ARC_SOURCE
91-
arch/i386/i386bug.c
92-
arch/i386/halstub.c
93-
arch/i386/ntoskrnl.c
94-
disk/scsiport.c)
86+
arch/i386/i386bug.c)
9587

9688
list(APPEND FREELDR_NTLDR_SOURCE
9789
ntldr/arch/i386/winldr.c
@@ -118,23 +110,18 @@ else()
118110
endif()
119111

120112
list(APPEND FREELDR_BASE_SOURCE
121-
bootmgr.c # This file is compiled with custom definitions
122113
freeldr.c
123-
ntldr/setupldr.c ## Strangely enough this file is needed in GCC builds
124-
## even if ${FREELDR_NTLDR_SOURCE} is not added,
125-
## otherwise we get linking errors with Rtl**Bitmap** APIs.
126-
## Do not happen on MSVC builds however...
127-
ntldr/inffile.c
128-
ntldr/ntldropts.c
114+
ntldr/ntldropts.c # Should be in rosload, but is currently needed by machpc.c, etc.
129115
lib/rtl/libsupp.c)
130116

131-
if(ARCH STREQUAL "i386")
117+
if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
132118
# Must be included together with disk/scsiport.c
133119
list(APPEND FREELDR_BASE_SOURCE
134-
${CMAKE_CURRENT_BINARY_DIR}/freeldr_pe.def)
120+
${CMAKE_CURRENT_BINARY_DIR}/freeldr.def)
135121
endif()
136122

137123
include(pcat.cmake)
124+
include(rosload.cmake)
138125
if(NOT ARCH STREQUAL "i386" OR NOT (SARCH STREQUAL "pc98" OR SARCH STREQUAL "xbox"))
139126
include(uefi.cmake)
140127
endif()

boot/freeldr/freeldr/arch/arcemul.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,25 @@ ArcGetRelativeTime(VOID)
4040
return ret;
4141
}
4242

43+
PCONFIGURATION_COMPONENT_DATA
44+
MachHwDetect(_In_opt_ PCSTR Options)
45+
{
46+
return MachVtbl.HwDetect(Options);
47+
}
48+
49+
VOID MachPrepareForReactOS(VOID)
50+
{
51+
MachVtbl.PrepareForReactOS();
52+
}
53+
54+
VOID MachGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
55+
{
56+
MachVtbl.GetExtendedBIOSData(ExtendedBIOSDataArea, ExtendedBIOSDataSize);
57+
}
58+
59+
VOID MachVideoGetFontsFromFirmware(PULONG RomFontPointers)
60+
{
61+
MachVtbl.VideoGetFontsFromFirmware(RomFontPointers);
62+
}
63+
4364
/* EOF */

boot/freeldr/freeldr/arch/archwsup.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,18 @@ FldrCreateComponentKey(
243243
/* Return the child */
244244
*ComponentKey = ComponentData;
245245
}
246+
247+
ULONG ArcGetDiskCount(VOID)
248+
{
249+
return reactos_disk_count;
250+
}
251+
252+
PARC_DISK_SIGNATURE_EX ArcGetDiskInfo(ULONG Index)
253+
{
254+
if (Index >= reactos_disk_count)
255+
{
256+
return NULL;
257+
}
258+
259+
return &reactos_arc_disk_info[Index];
260+
}

boot/freeldr/freeldr/arch/i386/hwacpi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ DBG_DEFAULT_CHANNEL(HWDETECT);
2525

2626
BOOLEAN AcpiPresent = FALSE;
2727

28+
BOOLEAN IsAcpiPresent(VOID)
29+
{
30+
return AcpiPresent;
31+
}
32+
2833
static PRSDP_DESCRIPTOR
2934
FindAcpiBios(VOID)
3035
{

boot/freeldr/freeldr/arch/uefi/uefihw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ BOOLEAN AcpiPresent = FALSE;
2424

2525
/* FUNCTIONS *****************************************************************/
2626

27+
BOOLEAN IsAcpiPresent(VOID)
28+
{
29+
return AcpiPresent;
30+
}
31+
2732
static
2833
PRSDP_DESCRIPTOR
2934
FindAcpiBios(VOID)

boot/freeldr/freeldr/bootmgr.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ WarnDeprecated(
8585
CHAR msgString[300];
8686

8787
/* If the user didn't cancel the timeout, don't display the warning */
88-
if (BootMgrInfo.TimeOut >= 0)
88+
if (GetBootMgrInfo()->TimeOut >= 0)
8989
return;
9090

9191
va_start(ap, MsgFmt);
@@ -183,6 +183,7 @@ BuildArgvForOsLoader(
183183
PCHAR* Argv;
184184
PCHAR* Args;
185185
PCHAR SettingName, SettingValue;
186+
PCCHAR BootPath = FrLdrGetBootPath();
186187

187188
*pArgc = 0;
188189

@@ -208,7 +209,7 @@ BuildArgvForOsLoader(
208209
/* i == 0: Program name */
209210
// TODO: Provide one in the future...
210211
/* i == 1: SystemPartition : from where FreeLdr has been started */
211-
Size += (strlen("SystemPartition=") + strlen(FrLdrBootPath) + 1) * sizeof(CHAR);
212+
Size += (strlen("SystemPartition=") + strlen(BootPath) + 1) * sizeof(CHAR);
212213
/* i == 2: LoadIdentifier : ASCII string that may be used
213214
* to associate an identifier with a set of load parameters */
214215
if (LoadIdentifier)
@@ -236,7 +237,7 @@ BuildArgvForOsLoader(
236237
/* i == 1: SystemPartition */
237238
{
238239
strcpy(SettingName, "SystemPartition=");
239-
strcat(SettingName, FrLdrBootPath);
240+
strcat(SettingName, BootPath);
240241

241242
*Args++ = SettingName;
242243
SettingName += (strlen(SettingName) + 1);
@@ -333,12 +334,13 @@ MainBootMenuKeyPressFilter(
333334
IN PVOID Context OPTIONAL)
334335
{
335336
/* Any key-press cancels the global timeout */
336-
BootMgrInfo.TimeOut = -1;
337+
GetBootMgrInfo()->TimeOut = -1;
337338

338339
switch (KeyPress)
339340
{
340341
case KEY_F8:
341342
DoOptionsMenu(&((OperatingSystemItem*)Context)[SelectedMenuItem]);
343+
DisplayBootTimeOptions();
342344
return TRUE;
343345

344346
#ifdef HAS_OPTION_MENU_EDIT_CMDLINE
@@ -362,12 +364,6 @@ VOID RunLoader(VOID)
362364
ULONG SelectedOperatingSystem;
363365
ULONG i;
364366

365-
if (!MachInitializeBootDevices())
366-
{
367-
UiMessageBoxCritical("Error when detecting hardware.");
368-
return;
369-
}
370-
371367
#ifdef _M_IX86
372368
#ifndef UEFIBOOT
373369
/* Load additional SCSI driver (if any) */
@@ -394,7 +390,7 @@ VOID RunLoader(VOID)
394390
#endif
395391

396392
/* Debugger main initialization */
397-
DebugInit(BootMgrInfo.DebugString);
393+
DebugInit(GetBootMgrInfo()->DebugString);
398394

399395
/* UI main initialization */
400396
if (!UiInitialize(TRUE))
@@ -427,7 +423,7 @@ VOID RunLoader(VOID)
427423
}
428424

429425
/* Find all the message box settings and run them */
430-
UiShowMessageBoxesInSection(BootMgrInfo.FrLdrSection);
426+
UiShowMessageBoxesInSection(GetBootMgrInfo()->FrLdrSection);
431427

432428
for (;;)
433429
{
@@ -438,11 +434,10 @@ VOID RunLoader(VOID)
438434
if (!UiDisplayMenu("Please select the operating system to start:",
439435
"For troubleshooting and advanced startup options for "
440436
"ReactOS, press F8.",
441-
TRUE,
442437
OperatingSystemDisplayNames,
443438
OperatingSystemCount,
444439
DefaultOperatingSystem,
445-
BootMgrInfo.TimeOut,
440+
GetBootMgrInfo()->TimeOut,
446441
&SelectedOperatingSystem,
447442
FALSE,
448443
MainBootMenuKeyPressFilter,
@@ -455,12 +450,12 @@ VOID RunLoader(VOID)
455450
/* Load the chosen operating system */
456451
LoadOperatingSystem(&OperatingSystemList[SelectedOperatingSystem]);
457452

458-
BootMgrInfo.TimeOut = -1;
453+
GetBootMgrInfo()->TimeOut = -1;
459454

460455
/* If we get there, the OS loader failed. As it may have
461456
* messed up the display, re-initialize the UI. */
462457
#ifndef _M_ARM
463-
UiVtbl.UnInitialize();
458+
UiUnInitialize("");
464459
#endif
465460
UiInitialize(TRUE);
466461
}

boot/freeldr/freeldr/custom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ VOID OptionMenuCustomBoot(VOID)
126126
OperatingSystemItem OperatingSystem;
127127

128128
if (!UiDisplayMenu("Please choose a boot method:", NULL,
129-
FALSE,
130129
CustomBootMenuList,
131130
RTL_NUMBER_OF(CustomBootMenuList),
132131
0, -1,

boot/freeldr/freeldr/disk/scsiport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ LoadBootDeviceDriver(VOID)
16471647
#endif
16481648

16491649
/* Create full ntbootdd.sys path */
1650-
strcpy(NtBootDdPath, FrLdrBootPath);
1650+
strcpy(NtBootDdPath, FrLdrGetBootPath());
16511651
strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
16521652

16531653
/* Load ntbootdd.sys */

0 commit comments

Comments
 (0)