Premature checkin to bypass MBT checking problems, includes some more USB work.

This commit is contained in:
kudzu_cp 2008-03-21 23:50:47 +00:00
parent 4dc7245ace
commit 34e55ca181
5 changed files with 77 additions and 54 deletions

View file

@ -1,7 +1,7 @@
<Window x:Class="Cosmos.Build.Windows.BuildOptionsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BuildOptionsWindow" WindowStartupLocation="CenterScreen">
Title="BuildOptionsWindow" WindowStartupLocation="CenterScreen" Width="600">
<FlowDocumentScrollViewer>
<FlowDocument Name="RootDoc">
<BlockUIContainer>
@ -54,11 +54,15 @@
<LineBreak/>
<Span Name="spanISOPath"></Span>
</Paragraph>
<Paragraph Name="paraPXEOptions">
<Bold>PXE Options</Bold>
<Paragraph Name="paraPXEOptions">
<Bold>PXE Options</Bold>
<LineBreak/>After building, start up another PC with network boot enabled and Cosmos will boot on to it automatically.
</Paragraph>
<Paragraph>
</Paragraph>
<Paragraph Name="paraUSBOptions">
<Bold>USB Options</Bold>
<LineBreak/>USB must be done manually. Please see the website. We are working on integrating it into this builder currently.
</Paragraph>
<Paragraph>
<InlineUIContainer><CheckBox Name="buildCheckBox" IsChecked="True"/></InlineUIContainer>
Skip IL compilation.
</Paragraph>

View file

@ -38,6 +38,8 @@ namespace Cosmos.Build.Windows {
rdioISO.Unchecked += new RoutedEventHandler(rdioISO_Unchecked);
rdioPXE.Checked += new RoutedEventHandler(rdioPXE_Checked);
rdioPXE.Unchecked += new RoutedEventHandler(rdioPXE_Unchecked);
rdioUSB.Checked += new RoutedEventHandler(rdioUSB_Checked);
rdioUSB.Unchecked += new RoutedEventHandler(rdioUSB_Unchecked);
spanBuildPath.Inlines.Add(mBuilder.BuildPath);
spanISOPath.Inlines.Add(mBuilder.BuildPath + "Cosmos.iso");
@ -48,10 +50,18 @@ namespace Cosmos.Build.Windows {
RootDoc.Blocks.Remove(paraVPCOptions);
RootDoc.Blocks.Remove(paraISOOptions);
RootDoc.Blocks.Remove(paraPXEOptions);
RootDoc.Blocks.Remove(paraUSBOptions);
LoadSettingsFromRegistry();
}
void rdioUSB_Checked(object sender, RoutedEventArgs e) {
RootDoc.Blocks.InsertAfter(mOptionsBlockPrefix, paraUSBOptions);
}
void rdioUSB_Unchecked(object sender, RoutedEventArgs e) {
RootDoc.Blocks.Remove(paraUSBOptions);
}
void rdioISO_Checked(object sender, RoutedEventArgs e) {
RootDoc.Blocks.InsertAfter(mOptionsBlockPrefix, paraISOOptions);
}
@ -109,46 +119,42 @@ namespace Cosmos.Build.Windows {
mTarget = Builder.Target.ISO;
} else if (rdioPXE.IsChecked.Value) {
mTarget = Builder.Target.PXE;
} else if (rdioUSB.IsChecked.Value) {
mTarget = Builder.Target.USB;
}
SaveSettingsToRegistry();
this.DialogResult = true;
DialogResult = true;
}
void butnCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
void butnCancel_Click(object sender, RoutedEventArgs e) {
DialogResult = false;
}
void SaveSettingsToRegistry()
{
string key = "BuildType";
if (rdioQEMU.IsChecked.Value)
BuildRegistry.Write(key, "QEMU");
else if (rdioVMWare.IsChecked.Value)
BuildRegistry.Write(key, "VMWare");
else if (rdioVPC.IsChecked.Value)
BuildRegistry.Write(key, "VPC");
else if (rdioISO.IsChecked.Value)
BuildRegistry.Write(key, "ISO");
else if (rdioPXE.IsChecked.Value)
BuildRegistry.Write(key, "PXE");
void SaveSettingsToRegistry() {
//TODO: This can be changed to enum.tostring
string xValue = "QEMU";
if (rdioVMWare.IsChecked.Value) {
xValue = "VMWare";
} else if (rdioVPC.IsChecked.Value) {
xValue = "VPC";
} else if (rdioISO.IsChecked.Value) {
xValue = "ISO";
} else if (rdioPXE.IsChecked.Value) {
xValue = "PXE";
} else if (rdioUSB.IsChecked.Value) {
xValue = "USB";
}
BuildRegistry.Write("BuildType", xValue);
key = "UseGDB";
BuildRegistry.Write(key, chckQEMUUseGDB.IsChecked.Value.ToString());
key = "CreateHDImage";
BuildRegistry.Write(key, chckQEMUUseHD.IsChecked.Value.ToString());
key = "SkipIL";
BuildRegistry.Write(key, buildCheckBox.IsChecked.Value.ToString());
BuildRegistry.Write("UseGDB", chckQEMUUseGDB.IsChecked.Value.ToString());
BuildRegistry.Write("CreateHDImage", chckQEMUUseHD.IsChecked.Value.ToString());
BuildRegistry.Write("SkipIL", buildCheckBox.IsChecked.Value.ToString());
}
void LoadSettingsFromRegistry()
{
string buildType = BuildRegistry.Read("BuildType");
switch (buildType)
{
void LoadSettingsFromRegistry() {
string xBuildType = BuildRegistry.Read("BuildType");
switch (xBuildType) {
case "QEMU":
rdioQEMU.IsChecked = true;
break;
@ -164,9 +170,11 @@ namespace Cosmos.Build.Windows {
case "PXE":
rdioPXE.IsChecked = true;
break;
case "USB":
rdioUSB.IsChecked = true;
break;
}
bool useGDB;
bool.TryParse(BuildRegistry.Read("UseGDB"), out useGDB);
chckQEMUUseGDB.IsChecked = useGDB;
@ -178,10 +186,8 @@ namespace Cosmos.Build.Windows {
bool skipIL;
bool.TryParse(BuildRegistry.Read("SkipIL"), out skipIL);
buildCheckBox.IsChecked = skipIL;
}
#region IBuildConfiguration Members
private Builder.Target mTarget;

View file

@ -14,8 +14,9 @@ namespace Cosmos.Build.Windows {
public readonly string BuildPath;
public readonly string ToolsPath;
public readonly string ISOPath;
public readonly string PXEPath;
public readonly string AsmPath;
public readonly string PXEPath;
public readonly string USBPath;
public readonly string AsmPath;
public readonly string VMWarePath;
public readonly string VPCPath;
protected IBuildConfiguration mConfig;
@ -24,8 +25,9 @@ namespace Cosmos.Build.Windows {
BuildPath = GetBuildPath();
ToolsPath = BuildPath + @"Tools\";
ISOPath = BuildPath + @"ISO\";
PXEPath = BuildPath + @"PXE\";
AsmPath = ToolsPath + @"asm\";
PXEPath = BuildPath + @"PXE\";
PXEPath = BuildPath + @"USB\";
AsmPath = ToolsPath + @"asm\";
VMWarePath = BuildPath + @"VMWare\";
VPCPath = BuildPath + @"VPC\";
}
@ -43,8 +45,7 @@ namespace Cosmos.Build.Windows {
// Problem - noone checked this for user kit mode and no key...
xResult = (string)xKey.GetValue("Build Path");
if (xResult == null)
{
if (xResult == null) {
xResult = Directory.GetCurrentDirectory();
xResult = xResult.Substring(0, xResult.IndexOf("source"));
xResult += @"Build\";
@ -122,6 +123,7 @@ namespace Cosmos.Build.Windows {
public enum Target {
ISO,
PXE,
USB,
QEMU,
QEMU_HardDisk,
QEMU_GDB,
@ -133,9 +135,9 @@ namespace Cosmos.Build.Windows {
public void Build() {
if (mConfig == null) {
BuildOptionsWindow xOptions = new BuildOptionsWindow(this);
if ((bool)!xOptions.ShowDialog())
if ((bool)!xOptions.ShowDialog()) {
return; //Cancel
}
mConfig = xOptions;
}
@ -150,14 +152,26 @@ namespace Cosmos.Build.Windows {
MakeISO();
break;
case Target.PXE:
RemoveFile(PXEPath + @"Boot\output.bin");
File.Move(BuildPath + "output.bin", PXEPath + @"Boot\output.bin");
// *Must* set working dir so tftpd32 will set itself to proper dir
case Target.PXE:
RemoveFile(PXEPath + @"Boot\output.bin");
File.Move(BuildPath + "output.bin", PXEPath + @"Boot\output.bin");
// *Must* set working dir so tftpd32 will set itself to proper dir
Global.Call(PXEPath + "tftpd32.exe", "", PXEPath, false, true);
break;
break;
case Target.QEMU:
case Target.USB:
RemoveFile(USBPath + @"output.bin");
File.Move(BuildPath + @"output.bin", USBPath + @"output.bin");
// Copy to USB device
string xUSBLetter = "I";
File.Copy(USBPath + @"output.bin", xUSBLetter + @":\");
File.Copy(USBPath + @"mboot.c32", xUSBLetter + @":\");
File.Copy(USBPath + @"syslinux.cfg", xUSBLetter + @":\");
// Set MBR
Global.Call(ToolsPath + "syslinux.exe", "-fma " + xUSBLetter + ":", ToolsPath, true, true);
break;
case Target.QEMU:
MakeISO();
RemoveFile(BuildPath + "serial-debug.txt");
Global.Call(ToolsPath + @"qemu\qemu.exe"

View file

@ -18,7 +18,7 @@ namespace Cosmos.Kernel {
// MTW: you could use partial methods for this, but then you dont
// have control of the order in which the individual methods are called..
Cosmos.Hardware.PC.Global.Init();
New.Partitioning.MBT.Initialize();
//MBT.Initialize();
// Now init kernel devices and rest of kernel
Console.WriteLine("Init Keyboard");

View file

@ -73,7 +73,6 @@
<ItemGroup>
<Compile Include="Boot.cs" />
<Compile Include="Global.cs" />
<Compile Include="New\Partitioning\MBT.cs" />
<Compile Include="Old\FileSystem\Ext2.Structs.cs" />
<Compile Include="Old\FileSystem\Fat16.cs" />
<Compile Include="Old\FileSystem\File.cs" />