diff --git a/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml b/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml index 2ef4000e9..fa79aa67d 100644 --- a/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml +++ b/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml @@ -1,7 +1,7 @@  + Title="BuildOptionsWindow" WindowStartupLocation="CenterScreen" Width="600"> @@ -54,11 +54,15 @@ - - PXE Options + + PXE Options After building, start up another PC with network boot enabled and Cosmos will boot on to it automatically. - - + + + USB Options + USB must be done manually. Please see the website. We are working on integrating it into this builder currently. + + Skip IL compilation. diff --git a/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml.cs b/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml.cs index 3957fa23c..cb0cebf15 100644 --- a/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml.cs +++ b/source/Cosmos.Build.Windows/BuildOptionsWindow.xaml.cs @@ -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; diff --git a/source/Cosmos.Build.Windows/Builder.cs b/source/Cosmos.Build.Windows/Builder.cs index 7659f19d9..f687c071a 100644 --- a/source/Cosmos.Build.Windows/Builder.cs +++ b/source/Cosmos.Build.Windows/Builder.cs @@ -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" diff --git a/source/Cosmos/Cosmos.Kernel/Boot.cs b/source/Cosmos/Cosmos.Kernel/Boot.cs index b48c36aeb..14d8b6822 100644 --- a/source/Cosmos/Cosmos.Kernel/Boot.cs +++ b/source/Cosmos/Cosmos.Kernel/Boot.cs @@ -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"); diff --git a/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj b/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj index 957031e38..fa08d7d51 100644 --- a/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj +++ b/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj @@ -73,7 +73,6 @@ -