Author: hpoussin
Date: Fri Dec 26 11:38:43 2014
New Revision: 65833
URL:
http://svn.reactos.org/svn/reactos?rev=65833&view=rev
Log:
[FREELDR] Support custom SystemPath and ramdisk in setup phase
We can now start ReactOS installation via PXE boot.
Modified:
trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c
trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inffi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] Fri Dec 26 11:38:43
2014
@@ -952,8 +952,8 @@
//
// Open the .inf file
//
- FileId = FsOpenFile(FileName);
- if (!FileId)
+ ret = ArcOpen((PCHAR)FileName, OpenReadOnly, &FileId);
+ if (ret != ESUCCESS)
{
return FALSE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] Fri Dec 26 11:38:43
2014
@@ -138,6 +138,12 @@
LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
IN USHORT OperatingSystemVersion)
{
+ ULONG_PTR SectionId;
+ PCSTR SectionName = OperatingSystem->SystemPartition;
+ CHAR SettingsValue[80];
+ BOOLEAN HasSection;
+ CHAR BootOptions2[256];
+ PCHAR File;
CHAR FileName[512];
CHAR BootPath[512];
LPCSTR LoadOptions;
@@ -151,25 +157,74 @@
LPCSTR SystemPath;
LPCSTR SourcePaths[] =
{
- "\\", /* Only for floppy boot */
+ "", /* Only for floppy boot */
#if defined(_M_IX86)
- "\\I386\\",
+ "I386\\",
#elif defined(_M_MPPC)
- "\\PPC\\",
+ "PPC\\",
#elif defined(_M_MRX000)
- "\\MIPS\\",
+ "MIPS\\",
#endif
- "\\reactos\\",
+ "reactos\\",
NULL
};
- /* Get boot path */
- MachDiskGetBootPath(BootPath, sizeof(BootPath));
+ /* Get OS setting value */
+ SettingsValue[0] = ANSI_NULL;
+ IniOpenSection("Operating Systems", &SectionId);
+ IniReadSettingByName(SectionId, SectionName, SettingsValue, sizeof(SettingsValue));
+
+ /* Open the operating system section specified in the .ini file */
+ HasSection = IniOpenSection(SectionName, &SectionId);
+
+ UiDrawBackdrop();
+ UiDrawProgressBarCenter(1, 100, "Loading NT...");
+
+ /* Read the system path is set in the .ini file */
+ if (!HasSection ||
+ !IniReadSettingByName(SectionId, "SystemPath", BootPath,
sizeof(BootPath)))
+ {
+ MachDiskGetBootPath(BootPath, sizeof(BootPath));
+ }
+
+ /* Append a backslash */
+ if ((strlen(BootPath)==0) || BootPath[strlen(BootPath)] != '\\')
+ strcat(BootPath, "\\");
+
+ /* Read booting options */
+ if (!HasSection || !IniReadSettingByName(SectionId, "Options",
BootOptions2, sizeof(BootOptions2)))
+ {
+ /* Get options after the title */
+ PCSTR p = SettingsValue;
+ while (*p == ' ' || *p == '"')
+ p++;
+ while (*p != '\0' && *p != '"')
+ p++;
+ strcpy(BootOptions2, p);
+ TRACE("BootOptions: '%s'\n", BootOptions2);
+ }
+
+ /* Check if a ramdisk file was given */
+ File = strstr(BootOptions2, "/RDPATH=");
+ if (File)
+ {
+ /* Copy the file name and everything else after it */
+ strcpy(FileName, File + 8);
+
+ /* Null-terminate */
+ *strstr(FileName, " ") = ANSI_NULL;
+
+ /* Load the ramdisk */
+ RamDiskLoadVirtualFile(FileName);
+ }
+
+ TRACE("BootPath: '%s'\n", BootPath);
/* And check if we booted from floppy */
BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
/* Open 'txtsetup.sif' from any of source paths */
+ File = BootPath + strlen(BootPath);
for (i = BootFromFloppy ? 0 : 1; ; i++)
{
SystemPath = SourcePaths[i];
@@ -178,10 +233,10 @@
ERR("Failed to open txtsetup.sif\n");
return;
}
- sprintf(FileName, "%stxtsetup.sif", SystemPath);
- if (InfOpenFile (&InfHandle, FileName, &ErrorLine))
+ sprintf(File, "%stxtsetup.sif", SystemPath);
+ if (InfOpenFile (&InfHandle, BootPath, &ErrorLine))
{
- strcat(BootPath, SystemPath);
+ sprintf(File, "%s", SystemPath);
break;
}
}