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" <Window x:Class="Cosmos.Build.Windows.BuildOptionsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BuildOptionsWindow" WindowStartupLocation="CenterScreen"> Title="BuildOptionsWindow" WindowStartupLocation="CenterScreen" Width="600">
<FlowDocumentScrollViewer> <FlowDocumentScrollViewer>
<FlowDocument Name="RootDoc"> <FlowDocument Name="RootDoc">
<BlockUIContainer> <BlockUIContainer>
@ -58,6 +58,10 @@
<Bold>PXE Options</Bold> <Bold>PXE Options</Bold>
<LineBreak/>After building, start up another PC with network boot enabled and Cosmos will boot on to it automatically. <LineBreak/>After building, start up another PC with network boot enabled and Cosmos will boot on to it automatically.
</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> <Paragraph>
<InlineUIContainer><CheckBox Name="buildCheckBox" IsChecked="True"/></InlineUIContainer> <InlineUIContainer><CheckBox Name="buildCheckBox" IsChecked="True"/></InlineUIContainer>
Skip IL compilation. Skip IL compilation.

View file

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

View file

@ -15,6 +15,7 @@ namespace Cosmos.Build.Windows {
public readonly string ToolsPath; public readonly string ToolsPath;
public readonly string ISOPath; public readonly string ISOPath;
public readonly string PXEPath; public readonly string PXEPath;
public readonly string USBPath;
public readonly string AsmPath; public readonly string AsmPath;
public readonly string VMWarePath; public readonly string VMWarePath;
public readonly string VPCPath; public readonly string VPCPath;
@ -25,6 +26,7 @@ namespace Cosmos.Build.Windows {
ToolsPath = BuildPath + @"Tools\"; ToolsPath = BuildPath + @"Tools\";
ISOPath = BuildPath + @"ISO\"; ISOPath = BuildPath + @"ISO\";
PXEPath = BuildPath + @"PXE\"; PXEPath = BuildPath + @"PXE\";
PXEPath = BuildPath + @"USB\";
AsmPath = ToolsPath + @"asm\"; AsmPath = ToolsPath + @"asm\";
VMWarePath = BuildPath + @"VMWare\"; VMWarePath = BuildPath + @"VMWare\";
VPCPath = BuildPath + @"VPC\"; VPCPath = BuildPath + @"VPC\";
@ -43,8 +45,7 @@ namespace Cosmos.Build.Windows {
// Problem - noone checked this for user kit mode and no key... // Problem - noone checked this for user kit mode and no key...
xResult = (string)xKey.GetValue("Build Path"); xResult = (string)xKey.GetValue("Build Path");
if (xResult == null) if (xResult == null) {
{
xResult = Directory.GetCurrentDirectory(); xResult = Directory.GetCurrentDirectory();
xResult = xResult.Substring(0, xResult.IndexOf("source")); xResult = xResult.Substring(0, xResult.IndexOf("source"));
xResult += @"Build\"; xResult += @"Build\";
@ -122,6 +123,7 @@ namespace Cosmos.Build.Windows {
public enum Target { public enum Target {
ISO, ISO,
PXE, PXE,
USB,
QEMU, QEMU,
QEMU_HardDisk, QEMU_HardDisk,
QEMU_GDB, QEMU_GDB,
@ -133,9 +135,9 @@ namespace Cosmos.Build.Windows {
public void Build() { public void Build() {
if (mConfig == null) { if (mConfig == null) {
BuildOptionsWindow xOptions = new BuildOptionsWindow(this); BuildOptionsWindow xOptions = new BuildOptionsWindow(this);
if ((bool)!xOptions.ShowDialog()) {
if ((bool)!xOptions.ShowDialog())
return; //Cancel return; //Cancel
}
mConfig = xOptions; mConfig = xOptions;
} }
@ -157,6 +159,18 @@ namespace Cosmos.Build.Windows {
Global.Call(PXEPath + "tftpd32.exe", "", PXEPath, false, true); Global.Call(PXEPath + "tftpd32.exe", "", PXEPath, false, true);
break; break;
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: case Target.QEMU:
MakeISO(); MakeISO();
RemoveFile(BuildPath + "serial-debug.txt"); RemoveFile(BuildPath + "serial-debug.txt");

View file

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

View file

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