diff --git a/.gitignore b/.gitignore index 1b674f6a7..247be5e1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,44 @@ -# User-specific files - -*.suo -*.user -*.userosscache -*.sln.docstates - -# Build results - -[Oo]bj/ -[Bb]in -[Dd]ebug*/ -[Rr]elease*/ - -*.[Oo]bj -*.suo -*.ncb -*.aps -*.user -*.ccscc -*.cache -*.bak -*.swp -*.pidb -*.userprefs -*.FileListAbsolute.txt -*.[Cc]ache -*.tlog -*.vs10x -*.exe.manifest -*.mdb -*.docstates -*.vsp -*.pdb -Thumbs.db -build.force - -Build/VSIP/ -Setup/Output/ -Build/VMWare/Workstation/Cosmos.vmsd -Build/VMWare/Workstation/Cosmos.vmxf - -Setup/Current.iss -Cosmos.Assembler.Log +# User-specific files + +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results + +[Oo]bj/ +[Bb]in +[Dd]ebug*/ +[Rr]elease*/ + +*.[Oo]bj +*.suo +*.ncb +*.aps +*.user +*.ccscc +*.cache +*.bak +*.swp +*.pidb +*.userprefs +*.FileListAbsolute.txt +*.[Cc]ache +*.tlog +*.vs10x +*.exe.manifest +*.mdb +*.docstates +*.vsp +*.pdb +Thumbs.db +build.force + +Build/VSIP/ +Setup/Output/ +Build/VMWare/Workstation/Cosmos.vmsd +Build/VMWare/Workstation/Cosmos.vmxf + +Setup/Current.iss +Cosmos.Assembler.Log diff --git a/Build/Tools/mkisofs/mkisofs.exe b/Build/Tools/mkisofs/mkisofs.exe new file mode 100644 index 000000000..4b131f36b Binary files /dev/null and b/Build/Tools/mkisofs/mkisofs.exe differ diff --git a/Build/Tools/mkisofs/readme.txt b/Build/Tools/mkisofs/readme.txt new file mode 100644 index 000000000..41bfd5987 --- /dev/null +++ b/Build/Tools/mkisofs/readme.txt @@ -0,0 +1,6 @@ + +mkisofs +- GPLv2 +- http://code.google.com/p/mkisofs-md5/ +- Version: 2.01 + diff --git a/Resources/Dependencies/Mosa/Mosa.Utility.IsoImage.dll(old) b/Resources/Dependencies/Mosa/Mosa.Utility.IsoImage.dll(old) deleted file mode 100644 index e3ce6a618..000000000 Binary files a/Resources/Dependencies/Mosa/Mosa.Utility.IsoImage.dll(old) and /dev/null differ diff --git a/Setup/Cosmos.iss b/Setup/Cosmos.iss index 659b7cbe3..f22d25e1d 100644 --- a/Setup/Cosmos.iss +++ b/Setup/Cosmos.iss @@ -156,10 +156,10 @@ Source: ".\Resources\Dependencies\cecil\Mono.Cecil.Pdb.pdb"; DestDir: "{app}\Bui Source: ".\Build\Tools\*.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly Source: ".\Build\Tools\NAsm\*.exe"; DestDir: "{app}\Build\Tools\NAsm"; Flags: ignoreversion uninsremovereadonly Source: ".\Build\Tools\Cygwin\*"; DestDir: "{app}\Build\Tools\cygwin"; Flags: ignoreversion uninsremovereadonly overwritereadonly +Source: ".\Build\Tools\mkisofs\*"; DestDir: "{app}\Build\Tools\mkisofs"; Flags: ignoreversion uninsremovereadonly overwritereadonly ; Source: ".\Build\VSIP\Cosmos.Deploy.USB.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly Source: ".\Build\VSIP\Cosmos.Build.Common.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly -Source: ".\Build\VSIP\Mosa.Utility.IsoImage.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly Source: ".\Resources\Dependencies\Dapper\*.*"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly Source: ".\Build\VSIP\System.Data.SQLite.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly ; diff --git a/source/Cosmos.Build.Common/Cosmos.Build.Common.csproj b/source/Cosmos.Build.Common/Cosmos.Build.Common.csproj index 0f8794d56..5c6683bf4 100644 --- a/source/Cosmos.Build.Common/Cosmos.Build.Common.csproj +++ b/source/Cosmos.Build.Common/Cosmos.Build.Common.csproj @@ -62,9 +62,6 @@ false - - ..\..\Resources\Dependencies\Mosa\Mosa.Utility.IsoImage.dll - 3.5 @@ -84,6 +81,7 @@ + diff --git a/source/Cosmos.Build.Common/IsoMaker.cs b/source/Cosmos.Build.Common/IsoMaker.cs index 500d4b490..76bb81add 100644 --- a/source/Cosmos.Build.Common/IsoMaker.cs +++ b/source/Cosmos.Build.Common/IsoMaker.cs @@ -1,38 +1,53 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; -using Mosa.Utility.IsoImage; +using System.Text; -namespace Cosmos.Build.Common { - public class IsoMaker { +namespace Cosmos.Build.Common +{ + public class IsoMaker + { + static public void Generate(string imageFile, string isoFilename) + { + var destinationDirectory = Path.GetDirectoryName(imageFile); - static public void Generate(string aBuildPath, string xInputPathname, string aIsoPathname) { - string xPath = Path.Combine(aBuildPath, @"ISO"); - if (File.Exists(aIsoPathname)) { - File.Delete(aIsoPathname); - } - - // We copy and rename in the process to Cosmos.bin becaue the .cfg is currently - // hardcoded to Cosmos.bin. - string xOutputBin = Path.Combine(xPath, "Cosmos.bin"); - File.Copy(xInputPathname, xOutputBin, true); + string isoDirectory = Path.Combine(destinationDirectory, "iso"); - string xIsoLinux = Path.Combine(xPath, "isolinux.bin"); - File.SetAttributes(xIsoLinux, FileAttributes.Normal); + if (Directory.Exists(isoDirectory)) + { + Directory.Delete(isoDirectory, true); + } - var xOptions = new Options() { - BootLoadSize = 4, - IsoFileName = aIsoPathname, - BootFileName = xIsoLinux, - BootInfoTable = true - }; - // TODO - Use move or see if we can do this without copying first the Cosmos.bin as they will start to get larger - xOptions.IncludeFiles.Add(xPath); + Directory.CreateDirectory(isoDirectory); + + var buildISO = Path.Combine(CosmosPaths.Build, "ISO"); + + File.Copy(Path.Combine(buildISO, "isolinux.bin"), Path.Combine(isoDirectory, "isolinux.bin")); + File.Copy(Path.Combine(buildISO, "mboot.c32"), Path.Combine(isoDirectory, "mboot.c32")); + File.Copy(Path.Combine(buildISO, "syslinux.cfg"), Path.Combine(isoDirectory, "syslinux.cfg")); + File.Copy(imageFile, Path.Combine(isoDirectory, "Cosmos.bin")); + + string arg = + "-relaxed-filenames" + + " -J -R" + + " -o " + Quote(isoFilename) + + " -b isolinux.bin" + + " -no-emul-boot" + + " -boot-load-size 4" + + " -boot-info-table " + + Quote(isoDirectory); + + var output = ProcessExtension.LaunchApplication( + Path.Combine(Path.Combine(CosmosPaths.Tools, "mkisofs"), "mkisofs.exe"), + arg, + true + ); + + } + + protected static string Quote(string location) + { + return '"' + location + '"'; + } - var xISO = new Iso9660Generator(xOptions); - xISO.Generate(); } - } -} +} \ No newline at end of file diff --git a/source/Cosmos.Build.Common/ProcessExtension.cs b/source/Cosmos.Build.Common/ProcessExtension.cs new file mode 100644 index 000000000..1bb7a5017 --- /dev/null +++ b/source/Cosmos.Build.Common/ProcessExtension.cs @@ -0,0 +1,32 @@ +using System.Diagnostics; + +namespace Cosmos.Build.Common +{ + public static class ProcessExtension + { + public static string LaunchApplication(string app, string args, bool waitForExit) + { + var start = new ProcessStartInfo(); + start.FileName = app; + start.Arguments = args; + start.UseShellExecute = false; + start.CreateNoWindow = true; + start.RedirectStandardOutput = true; + start.RedirectStandardError = true; + + var process = Process.Start(start); + + if (waitForExit) + { + var output = process.StandardOutput.ReadToEnd(); + + process.WaitForExit(); + + var error = process.StandardError.ReadToEnd(); + return output + error; + } + + return string.Empty; + } + } +} \ No newline at end of file diff --git a/source/Cosmos.Build.MSBuild/MakeISO.cs b/source/Cosmos.Build.MSBuild/MakeISO.cs index 25f1e2fcb..426e361fc 100644 --- a/source/Cosmos.Build.MSBuild/MakeISO.cs +++ b/source/Cosmos.Build.MSBuild/MakeISO.cs @@ -31,7 +31,7 @@ namespace Cosmos.Build.MSBuild { #endregion public override bool Execute() { - IsoMaker.Generate(CosmosBuildDir, InputFile, OutputFile); + IsoMaker.Generate(InputFile, OutputFile); return true; } } diff --git a/source/Cosmos.VS.Package/VsProjectConfig.cs b/source/Cosmos.VS.Package/VsProjectConfig.cs index 54f12a029..fced1cea9 100644 --- a/source/Cosmos.VS.Package/VsProjectConfig.cs +++ b/source/Cosmos.VS.Package/VsProjectConfig.cs @@ -40,7 +40,7 @@ namespace Cosmos.VS.Package { string xBinFile = Path.ChangeExtension(xOutputAsm, ".bin"); if (xDeployment == DeploymentType.ISO) { - IsoMaker.Generate(CosmosPaths.Build, xBinFile, xIsoFile); + IsoMaker.Generate(xBinFile, xIsoFile); } else if (xDeployment == DeploymentType.USB) { Process.Start(Path.Combine(CosmosPaths.Tools, "Cosmos.Deploy.USB.exe"), "\"" + xBinFile + "\"");