Author: ion
Date: Fri Jan 8 01:18:08 2016
New Revision: 70542
URL: http://svn.reactos.org/svn/reactos?rev=70542&view=rev
Log:
Three tiny squirmy subtle bugs combined themselves with the bug that was just fixed to make bootmgfw believe it was being booted from a raw removable disk (floppy). Because bootmgfw now correctly enumerates boot devices and detects the DVD/CDROM media, it could no longer 'find itself', believing it was on a floppy.
[BOOTLIB]: When failing to find a block device, keep going searching for more, instead of giving up (critical, because the CDROM FAT12 image is now device path #1, not #0).
[BOOTMGR]: Correctly use the right logical operator in EfiInitpGetDeviceNode to get the deepest-level media device node. We now get the CDROM node, not the raw node.
[CDMAKE]: Don't actually create an EFI/BOOT directory on the CDROM itself, but rather in the FAT12 image. Otherwise, this can confuse UEFI implementations to boot the boot manager off the raw CDROM, instead of the FAT12 image on the CDROM.
Modified:
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/lib/io/device.c
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] Fri Jan 8 01:18:08 2016
@@ -105,5 +105,3 @@
add_dependencies(bootmgfw asm bugcodes)
-add_cd_file(TARGET bootmgfw FILE ${_bootmgfw_output_file} DESTINATION efi/boot NO_CAB FOR bootcd regtest NAME_ON_CD boot${EFI_PLATFORM_ID}.efi)
-
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] Fri Jan 8 01:18:08 2016
@@ -1263,7 +1263,7 @@
if (!NT_SUCCESS(Status))
{
/* Signature invalid, fail boot */
- // goto Failure;
+ goto Failure;
}
}
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] Fri Jan 8 01:18:08 2016
@@ -319,7 +319,7 @@
/* Loop each device path, until we get to the end or to a file path device node */
for ((NextPath = NextDevicePathNode(DevicePath));
- !(IsDevicePathEndType(NextPath)) && ((NextPath->Type != MEDIA_DEVICE_PATH) &&
+ !(IsDevicePathEndType(NextPath)) && ((NextPath->Type != MEDIA_DEVICE_PATH) ||
(NextPath->SubType != MEDIA_FILEPATH_DP));
(NextPath = NextDevicePathNode(NextPath)))
{
Modified: trunk/reactos/boot/environ/lib/io/device.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/device…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] Fri Jan 8 01:18:08 2016
@@ -1276,7 +1276,7 @@
if (!NT_SUCCESS(Status))
{
EfiPrintf(L"EFI create failed: %lx\n", Status);
- break;
+ continue;
}
/* Add the device entry to the device table */
Author: ion
Date: Fri Jan 8 00:15:00 2016
New Revision: 70540
URL: http://svn.reactos.org/svn/reactos?rev=70540&view=rev
Log:
[BOOTLIB]: Fix a few subtle bugs which made us incorrectly believe that we were booting from a raw removable drive. We now correctly detect that we are booting off CDROM media. Of course, now everything else is hopelessly broken and we've regressed to die before we get anywhere. Progress.
Modified:
trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
trunk/reactos/boot/environ/lib/firmware/efi/firmware.c
trunk/reactos/boot/environ/lib/io/device.c
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] Fri Jan 8 00:15:00 2016
@@ -1085,7 +1085,7 @@
EfiPrintf(L"Device Type %d Local Type %d\r\n", BlpBootDevice->DeviceType, BlpBootDevice->Local.Type);
if ((BlpBootDevice->DeviceType == LocalDevice) &&
(BlpBootDevice->Local.Type == CdRomDevice) &&
- (BlpApplicationFlags & BL_APPLICATION_ENTRY_FLAG_NO_GUID))
+ (BlpApplicationFlags & BL_APPLICATION_FLAG_CONVERTED_FROM_EFI))
{
return STATUS_SUCCESS;
}
Modified: trunk/reactos/boot/environ/lib/firmware/efi/firmware.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/firmware/…
==============================================================================
--- trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] Fri Jan 8 00:15:00 2016
@@ -44,14 +44,21 @@
_In_ EFI_DEVICE_PATH *DevicePath2
)
{
+ EFI_DEVICE_PATH* CurrentPath1;
+ EFI_DEVICE_PATH* CurrentPath2;
USHORT Length1, Length2;
+ /* Start with the current nodes */
+ CurrentPath1 = DevicePath1;
+ CurrentPath2 = DevicePath2;
+
/* Loop each element of the device path */
- while (!IsDevicePathEndType(DevicePath1) && !IsDevicePathEndType(DevicePath2))
+ while (!(IsDevicePathEndType(CurrentPath1)) &&
+ !(IsDevicePathEndType(CurrentPath2)))
{
/* Check if the element has a different length */
- Length1 = DevicePathNodeLength(DevicePath1);
- Length2 = DevicePathNodeLength(DevicePath2);
+ Length1 = DevicePathNodeLength(CurrentPath1);
+ Length2 = DevicePathNodeLength(CurrentPath2);
if (Length1 != Length2)
{
/* Then they're not related */
@@ -59,25 +66,25 @@
}
/* Check if the rest of the element data matches */
- if (RtlCompareMemory(DevicePath1, DevicePath2, Length1) != Length1)
+ if (RtlCompareMemory(CurrentPath1, CurrentPath2, Length1) != Length1)
{
/* Nope, not related */
return NULL;
}
/* Move to the next element */
- DevicePath1 = NextDevicePathNode(DevicePath1);
- DevicePath2 = NextDevicePathNode(DevicePath2);
+ CurrentPath1 = NextDevicePathNode(CurrentPath1);
+ CurrentPath2 = NextDevicePathNode(CurrentPath2);
}
/* If the last element in path 1 is empty, then path 2 is the child (deeper) */
- if (!IsDevicePathEndType(DevicePath1))
+ if (!IsDevicePathEndType(CurrentPath1))
{
return DevicePath2;
}
/* If the last element in path 2 is empty, then path 1 is the child (deeper) */
- if (!IsDevicePathEndType(DevicePath2))
+ if (!IsDevicePathEndType(CurrentPath2))
{
return DevicePath1;
}
Modified: trunk/reactos/boot/environ/lib/io/device.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/device…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] Fri Jan 8 00:15:00 2016
@@ -920,7 +920,8 @@
/* Yup, return back to caller */
ChildProtocolInterface->Handle = Handle;
ChildProtocolInterface->Interface = DevicePath;
- break;
+ Status = STATUS_SUCCESS;
+ goto Quickie;
}
/* Close the device path */
@@ -930,6 +931,7 @@
/* If we got here, nothing was found */
Status = STATUS_NO_SUCH_DEVICE;
+Quickie:
/* Free the handle array buffer */
BlMmFreeHeap(DeviceHandles);
return Status;
@@ -981,6 +983,7 @@
/* Iteratate twice -- once for the top level, once for the bottom */
for (i = 0, Found = FALSE; Found == FALSE && Protocol[i].Handle; i++)
{
+ /* Check what kind of leaf node device this is */
LeafNode = EfiGetLeafNode(Protocol[i].Interface);
EfiPrintf(L"Pass %d, Leaf node: %p Type: %d\r\n", i, LeafNode, LeafNode->Type);
if (LeafNode->Type == ACPI_DEVICE_PATH)