mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
Merge pull request #22 from tgiphil/mkisofs-merged
Use mkisofs to create ISO file
This commit is contained in:
commit
bf9bd10c0e
10 changed files with 131 additions and 80 deletions
BIN
Build/Tools/mkisofs/mkisofs.exe
Normal file
BIN
Build/Tools/mkisofs/mkisofs.exe
Normal file
Binary file not shown.
6
Build/Tools/mkisofs/readme.txt
Normal file
6
Build/Tools/mkisofs/readme.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
mkisofs
|
||||||
|
- GPLv2
|
||||||
|
- http://code.google.com/p/mkisofs-md5/
|
||||||
|
- Version: 2.01
|
||||||
|
|
||||||
Binary file not shown.
|
|
@ -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\*.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
|
||||||
Source: ".\Build\Tools\NAsm\*.exe"; DestDir: "{app}\Build\Tools\NAsm"; 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\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.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\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: ".\Resources\Dependencies\Dapper\*.*"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
|
||||||
Source: ".\Build\VSIP\System.Data.SQLite.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
|
Source: ".\Build\VSIP\System.Data.SQLite.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,6 @@
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mosa.Utility.IsoImage">
|
|
||||||
<HintPath>..\..\Resources\Dependencies\Mosa\Mosa.Utility.IsoImage.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core">
|
<Reference Include="System.Core">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
|
@ -84,6 +81,7 @@
|
||||||
<Compile Include="Enums.cs" />
|
<Compile Include="Enums.cs" />
|
||||||
<Compile Include="EnumValue.cs" />
|
<Compile Include="EnumValue.cs" />
|
||||||
<Compile Include="ExtensionMethods.cs" />
|
<Compile Include="ExtensionMethods.cs" />
|
||||||
|
<Compile Include="ProcessExtension.cs" />
|
||||||
<Compile Include="IsoMaker.cs" />
|
<Compile Include="IsoMaker.cs" />
|
||||||
<Compile Include="PropertiesBase.cs" />
|
<Compile Include="PropertiesBase.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,53 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Mosa.Utility.IsoImage;
|
using System.Text;
|
||||||
|
|
||||||
namespace Cosmos.Build.Common {
|
namespace Cosmos.Build.Common
|
||||||
public class IsoMaker {
|
{
|
||||||
|
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 isoDirectory = Path.Combine(destinationDirectory, "iso");
|
||||||
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
|
if (Directory.Exists(isoDirectory))
|
||||||
// hardcoded to Cosmos.bin.
|
{
|
||||||
string xOutputBin = Path.Combine(xPath, "Cosmos.bin");
|
Directory.Delete(isoDirectory, true);
|
||||||
File.Copy(xInputPathname, xOutputBin, true);
|
}
|
||||||
|
|
||||||
string xIsoLinux = Path.Combine(xPath, "isolinux.bin");
|
Directory.CreateDirectory(isoDirectory);
|
||||||
File.SetAttributes(xIsoLinux, FileAttributes.Normal);
|
|
||||||
|
|
||||||
var xOptions = new Options() {
|
var buildISO = Path.Combine(CosmosPaths.Build, "ISO");
|
||||||
BootLoadSize = 4,
|
|
||||||
IsoFileName = aIsoPathname,
|
File.Copy(Path.Combine(buildISO, "isolinux.bin"), Path.Combine(isoDirectory, "isolinux.bin"));
|
||||||
BootFileName = xIsoLinux,
|
File.Copy(Path.Combine(buildISO, "mboot.c32"), Path.Combine(isoDirectory, "mboot.c32"));
|
||||||
BootInfoTable = true
|
File.Copy(Path.Combine(buildISO, "syslinux.cfg"), Path.Combine(isoDirectory, "syslinux.cfg"));
|
||||||
};
|
File.Copy(imageFile, Path.Combine(isoDirectory, "Cosmos.bin"));
|
||||||
// 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);
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
32
source/Cosmos.Build.Common/ProcessExtension.cs
Normal file
32
source/Cosmos.Build.Common/ProcessExtension.cs
Normal file
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Cosmos.Build.MSBuild {
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override bool Execute() {
|
public override bool Execute() {
|
||||||
IsoMaker.Generate(CosmosBuildDir, InputFile, OutputFile);
|
IsoMaker.Generate(InputFile, OutputFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Cosmos.VS.Package {
|
||||||
string xBinFile = Path.ChangeExtension(xOutputAsm, ".bin");
|
string xBinFile = Path.ChangeExtension(xOutputAsm, ".bin");
|
||||||
|
|
||||||
if (xDeployment == DeploymentType.ISO) {
|
if (xDeployment == DeploymentType.ISO) {
|
||||||
IsoMaker.Generate(CosmosPaths.Build, xBinFile, xIsoFile);
|
IsoMaker.Generate(xBinFile, xIsoFile);
|
||||||
|
|
||||||
} else if (xDeployment == DeploymentType.USB) {
|
} else if (xDeployment == DeploymentType.USB) {
|
||||||
Process.Start(Path.Combine(CosmosPaths.Tools, "Cosmos.Deploy.USB.exe"), "\"" + xBinFile + "\"");
|
Process.Start(Path.Combine(CosmosPaths.Tools, "Cosmos.Deploy.USB.exe"), "\"" + xBinFile + "\"");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue