mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
Recalculate the partition value for freeldr. Freeldr uses a different partition numbering like linux.
svn path=/trunk/; revision=3923
This commit is contained in:
parent
efc518af7b
commit
8c7e8c4bbc
|
@ -36,6 +36,14 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#define IsRecognizedPartition(P) \
|
||||
((P) == PARTITION_FAT_12 || \
|
||||
(P) == PARTITION_FAT_16 || \
|
||||
(P) == PARTITION_HUGE || \
|
||||
(P) == PARTITION_IFS || \
|
||||
(P) == PARTITION_FAT32 || \
|
||||
(P) == PARTITION_FAT32_XINT13 || \
|
||||
(P) == PARTITION_XINT13)
|
||||
|
||||
static BOOL
|
||||
LoadKernel(PCHAR szFileName, int nPos)
|
||||
|
@ -442,6 +450,8 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
|||
char* Base;
|
||||
U32 Size;
|
||||
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
U32 rosPartition;
|
||||
|
||||
//
|
||||
// Open the operating system section
|
||||
|
@ -506,6 +516,32 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
|||
((char *)(&mb_info.boot_device))[0] = (char)BootDrive;
|
||||
((char *)(&mb_info.boot_device))[1] = (char)BootPartition;
|
||||
|
||||
/* recalculate the boot partition for freeldr */
|
||||
i = 0;
|
||||
rosPartition = 0;
|
||||
while (1)
|
||||
{
|
||||
if (!DiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
|
||||
{
|
||||
BootPartition = 0;
|
||||
break;
|
||||
}
|
||||
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
|
||||
{
|
||||
if (++rosPartition == BootPartition)
|
||||
{
|
||||
BootPartition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (BootPartition == 0)
|
||||
{
|
||||
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
|
||||
UiMessageBox(MsgBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy ARC path into kernel command line */
|
||||
strcpy(multiboot_kernel_cmdline, value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue