3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 const CHAR BootDrivePrompt
[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive";
24 const CHAR BootPartitionPrompt
[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
25 const CHAR BootSectorFilePrompt
[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
26 const CHAR LinuxKernelPrompt
[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
27 const CHAR LinuxInitrdPrompt
[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk.";
28 const CHAR LinuxCommandLinePrompt
[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
29 const CHAR ReactOSSystemPathPrompt
[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
30 const CHAR ReactOSOptionsPrompt
[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL";
32 const CHAR CustomBootPrompt
[] = "Press ENTER to boot your custom boot setup.";
34 VOID
OptionMenuCustomBoot(VOID
)
36 PCSTR CustomBootMenuList
[] = {
43 ULONG CustomBootMenuCount
= sizeof(CustomBootMenuList
) / sizeof(CustomBootMenuList
[0]);
44 ULONG SelectedMenuItem
;
46 if (!UiDisplayMenu("Please choose a boot method:",
54 // The user pressed ESC
58 switch (SelectedMenuItem
)
61 OptionMenuCustomBootDisk();
64 OptionMenuCustomBootPartition();
66 case 2: // Boot Sector File
67 OptionMenuCustomBootBootSectorFile();
70 OptionMenuCustomBootLinux();
75 VOID
OptionMenuCustomBootDisk(VOID
)
78 CHAR SectionName
[100];
79 CHAR BootDriveString
[20];
81 OperatingSystemItem OperatingSystem
;
83 RtlZeroMemory(SectionName
, sizeof(SectionName
));
84 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
86 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
91 // Generate a unique section name
92 TimeInfo
= ArcGetTime();
93 sprintf(SectionName
, "CustomBootDisk%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
96 if (!IniAddSection(SectionName
, &SectionId
))
102 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Drive"))
108 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
113 UiMessageBox(CustomBootPrompt
);
115 OperatingSystem
.SystemPartition
= SectionName
;
116 OperatingSystem
.LoadIdentifier
= NULL
;
117 OperatingSystem
.OsLoadOptions
= NULL
;
119 LoadAndBootDrive(&OperatingSystem
, 0);
122 VOID
OptionMenuCustomBootPartition(VOID
)
125 CHAR SectionName
[100];
126 CHAR BootDriveString
[20];
127 CHAR BootPartitionString
[20];
129 OperatingSystemItem OperatingSystem
;
131 RtlZeroMemory(SectionName
, sizeof(SectionName
));
132 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
133 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
135 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
140 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
145 // Generate a unique section name
146 TimeInfo
= ArcGetTime();
147 sprintf(SectionName
, "CustomBootPartition%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
150 if (!IniAddSection(SectionName
, &SectionId
))
156 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Partition"))
162 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
167 // Add the BootPartition
168 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
173 UiMessageBox(CustomBootPrompt
);
175 OperatingSystem
.SystemPartition
= SectionName
;
176 OperatingSystem
.LoadIdentifier
= NULL
;
177 OperatingSystem
.OsLoadOptions
= NULL
;
179 LoadAndBootPartition(&OperatingSystem
, 0);
182 VOID
OptionMenuCustomBootBootSectorFile(VOID
)
185 CHAR SectionName
[100];
186 CHAR BootDriveString
[20];
187 CHAR BootPartitionString
[20];
188 CHAR BootSectorFileString
[200];
190 OperatingSystemItem OperatingSystem
;
192 RtlZeroMemory(SectionName
, sizeof(SectionName
));
193 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
194 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
195 RtlZeroMemory(BootSectorFileString
, sizeof(BootSectorFileString
));
197 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
202 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
207 if (!UiEditBox(BootSectorFilePrompt
, BootSectorFileString
, 200))
212 // Generate a unique section name
213 TimeInfo
= ArcGetTime();
214 sprintf(SectionName
, "CustomBootSectorFile%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
217 if (!IniAddSection(SectionName
, &SectionId
))
223 if (!IniAddSettingValueToSection(SectionId
, "BootType", "BootSector"))
229 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
234 // Add the BootPartition
235 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
240 // Add the BootSectorFile
241 if (!IniAddSettingValueToSection(SectionId
, "BootSectorFile", BootSectorFileString
))
246 UiMessageBox(CustomBootPrompt
);
248 OperatingSystem
.SystemPartition
= SectionName
;
249 OperatingSystem
.LoadIdentifier
= NULL
;
250 OperatingSystem
.OsLoadOptions
= NULL
;
252 LoadAndBootBootSector(&OperatingSystem
, 0);
255 VOID
OptionMenuCustomBootLinux(VOID
)
258 CHAR SectionName
[100];
259 CHAR BootDriveString
[20];
260 CHAR BootPartitionString
[20];
261 CHAR LinuxKernelString
[200];
262 CHAR LinuxInitrdString
[200];
263 CHAR LinuxCommandLineString
[200];
265 OperatingSystemItem OperatingSystem
;
267 RtlZeroMemory(SectionName
, sizeof(SectionName
));
268 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
269 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
270 RtlZeroMemory(LinuxKernelString
, sizeof(LinuxKernelString
));
271 RtlZeroMemory(LinuxInitrdString
, sizeof(LinuxInitrdString
));
272 RtlZeroMemory(LinuxCommandLineString
, sizeof(LinuxCommandLineString
));
274 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
279 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
284 if (!UiEditBox(LinuxKernelPrompt
, LinuxKernelString
, 200))
289 if (!UiEditBox(LinuxInitrdPrompt
, LinuxInitrdString
, 200))
294 if (!UiEditBox(LinuxCommandLinePrompt
, LinuxCommandLineString
, 200))
299 // Generate a unique section name
300 TimeInfo
= ArcGetTime();
301 sprintf(SectionName
, "CustomLinux%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
304 if (!IniAddSection(SectionName
, &SectionId
))
310 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Linux"))
316 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
321 // Add the BootPartition
322 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
328 if (!IniAddSettingValueToSection(SectionId
, "Kernel", LinuxKernelString
))
334 if (strlen(LinuxInitrdString
) > 0)
336 if (!IniAddSettingValueToSection(SectionId
, "Initrd", LinuxInitrdString
))
342 // Add the CommandLine
343 if (!IniAddSettingValueToSection(SectionId
, "CommandLine", LinuxCommandLineString
))
348 UiMessageBox(CustomBootPrompt
);
350 OperatingSystem
.SystemPartition
= SectionName
;
351 OperatingSystem
.LoadIdentifier
= "Custom Linux Setup";
352 OperatingSystem
.OsLoadOptions
= NULL
;
354 LoadAndBootLinux(&OperatingSystem
, 0);
357 VOID
OptionMenuReboot(VOID
)
359 UiMessageBox("The system will now reboot.");
361 DiskStopFloppyMotor();