mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-04-18 05:38:36 +01:00
Implement bare-metal AHCI install wizard.
Fix InstallDrive DriveCheck bug.
This commit is contained in:
parent
fad8608b87
commit
9a0c955bea
2 changed files with 94 additions and 3 deletions
Binary file not shown.
|
@ -3,7 +3,8 @@ U0 InstallDrive(U8 drv_let)
|
|||
U8 *st;
|
||||
|
||||
while (!DriveCheck(blkdev.let_to_drive[drv_let - 'A'], FALSE))
|
||||
Sleep(100);
|
||||
Yield;
|
||||
Sleep(500);
|
||||
|
||||
ExePrint("CopyTree(\"::/\",\"%C:/\");", drv_let);
|
||||
ExePrint("DirMake(\"%C:/Tmp\");", drv_let);
|
||||
|
@ -101,6 +102,96 @@ U0 VMInstallWiz()
|
|||
Kill(task);
|
||||
}
|
||||
|
||||
U0 RegularInstallWiz()
|
||||
{
|
||||
I64 drv_let;
|
||||
U8 *st;
|
||||
I64 ch, res_num;
|
||||
CTask *task;
|
||||
|
||||
task = User;
|
||||
TaskWait(task);
|
||||
task->border_src = BDS_CONST;
|
||||
task->border_attr = LTGRAY << 4 + DriveTextAttrGet(':') & 15;
|
||||
task->text_attr = LTGRAY << 4 + BLUE;
|
||||
task->win_inhibit = WIG_TASK_DEFAULT - WIF_SELF_BORDER;
|
||||
WinHorz(Fs->win_left, Fs->win_right, task);
|
||||
WinVert(Fs->win_top, (Fs->win_top + Fs->win_bottom) >> 2 - 1, task);
|
||||
WinVert(task->win_bottom + 3, Fs->win_bottom);
|
||||
WinToTop(Fs);
|
||||
|
||||
XTalk(task, "Mount;\nC\n");
|
||||
|
||||
"\nSelect the port of the ATA drive to install on.\n";
|
||||
|
||||
"Hard Drive Port: ";
|
||||
while (TRUE)
|
||||
{
|
||||
st = StrGet;
|
||||
if ((0 <= Str2I64(st) < AHCI_MAX_PORTS) &&
|
||||
((&blkdev.ahci_hba->ports[Str2I64(st)])->signature == AHCI_PxSIG_ATA))
|
||||
{
|
||||
break;
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
|
||||
XTalkWait(task, "%s\n\n", st);
|
||||
|
||||
DriveRep;
|
||||
do
|
||||
{
|
||||
st = StrGet("\nDestination Partition Letter: ");
|
||||
if (*st)
|
||||
drv_let = Letter2Letter(*st);
|
||||
else
|
||||
drv_let = 0;
|
||||
Free(st);
|
||||
}
|
||||
while (!('A' <= drv_let <= 'Z'));
|
||||
|
||||
'\n';
|
||||
|
||||
"$$RED$$Format %C Partition?$$FG$$\n", drv_let;
|
||||
if (YorN)
|
||||
{
|
||||
'\n';
|
||||
do
|
||||
{
|
||||
"$$PURPLE$$1$$FG$$) Use FAT32\n"
|
||||
"$$PURPLE$$2$$FG$$) Use RedSea\n"
|
||||
"\nFile System Type: ";
|
||||
ch = CharGet;
|
||||
'\n';
|
||||
}
|
||||
while (!('1' <= ch <= '2'));
|
||||
|
||||
if (ch == '1')
|
||||
Format(drv_let,, FALSE, FSt_FAT32);
|
||||
else
|
||||
Format(drv_let,, FALSE, FSt_REDSEA);
|
||||
}
|
||||
InstallDrive(drv_let);
|
||||
|
||||
|
||||
XTalkWait(task, "BootHDIns('%C');\n\nB\n0x20000\nC\n%s\n\n", drv_let, st);
|
||||
VideoRep;
|
||||
res_num = I64Get("Enter desired list num ($$PURPLE$$<ENTER>$$FG$$ for max res): ",, 1);
|
||||
XTalkWait(task, "%d\n\n\n", res_num); //skip through Disk Cache, Options
|
||||
"$$RED$$Install Master Boot loader?$$FG$$";
|
||||
if (YorN)
|
||||
{
|
||||
'\n';
|
||||
BootMHDIns(drv_let);
|
||||
}
|
||||
|
||||
WinVert(task->win_top, Fs->win_bottom);
|
||||
Kill(task);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
U0 DoInstructions()
|
||||
{
|
||||
CTask *task = User;
|
||||
|
@ -116,7 +207,7 @@ Bool DoInstall(Bool prompt_reboot)
|
|||
I64 res = FALSE, vm_install = TRUE;
|
||||
CSMBIOSSystemInfo *sys_info = SMBIOSStructGet(SMBIOSt_SYSTEM);
|
||||
U8 *company = SMBIOSStr(sys_info, sys_info->manufacturer);
|
||||
|
||||
|
||||
if (StrCompare(company, "VMware, Inc.") && StrCompare(company, "innotek GmbH") && StrCompare(company, "QEMU"))
|
||||
{
|
||||
"\n\n\n\n\nAre you installing inside VMware, QEMU, VirtualBox or a similar virtual machine? ";
|
||||
|
@ -135,7 +226,7 @@ Bool DoInstall(Bool prompt_reboot)
|
|||
"Continue Install Wizard ";
|
||||
if (YorN)
|
||||
{
|
||||
//RegularInstallWiz(); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
RegularInstallWiz();
|
||||
res = TRUE;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue