diff --git a/source/Cosmos.Build.Tasks/MakeIso.cs b/source/Cosmos.Build.Tasks/MakeIso.cs index 0f8d9d3b75..eaa492790b 100644 --- a/source/Cosmos.Build.Tasks/MakeIso.cs +++ b/source/Cosmos.Build.Tasks/MakeIso.cs @@ -14,6 +14,9 @@ public class MakeIso : ToolTask [Required] public string OutputFile { get; set; } + [Required] + public bool UseUEFI { get; set; } + protected override string ToolName => IsWindows() ? "xorriso.exe" : "xorriso"; protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High; @@ -67,15 +70,24 @@ protected override string GenerateCommandLineCommands() xBuilder.AppendSwitch("-l"); xBuilder.AppendSwitch("-allow-lowercase"); xBuilder.AppendSwitchIfNotNull("-o ", OutputFile); - xBuilder.AppendSwitch(" -b boot/limine-bios-cd.bin"); + xBuilder.AppendSwitch("-b boot/limine-bios-cd.bin"); xBuilder.AppendSwitch("-no-emul-boot"); xBuilder.AppendSwitch("-boot-load-size 4"); xBuilder.AppendSwitch("-boot-info-table"); - xBuilder.AppendSwitch("--efi-boot boot/limine-uefi-cd.bin"); - xBuilder.AppendSwitch("-efi-boot-part"); - xBuilder.AppendSwitch("--efi-boot-image"); - xBuilder.AppendFileNameIfNotNull(IsoDirectory.TrimEnd('\\', '/')); + if (UseUEFI) + { + Log.LogMessage(MessageImportance.High, "UEFI enabled."); + xBuilder.AppendSwitch("--efi-boot boot/limine-uefi-cd.bin"); + xBuilder.AppendSwitch("-efi-boot-part"); + xBuilder.AppendSwitch("--efi-boot-image"); + } + else + { + Log.LogMessage(MessageImportance.High, "UEFI switches will not be added."); + } + + xBuilder.AppendFileNameIfNotNull(IsoDirectory.TrimEnd('\\', '/')); Log.LogMessage(MessageImportance.High, xBuilder.ToString()); return xBuilder.ToString(); diff --git a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets index 3e3be754ab..dfc418d750 100644 --- a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets +++ b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets @@ -84,6 +84,8 @@ False 1 + + True @@ -227,7 +229,7 @@ OutputFormat="$(BinFormat)" ToolPath="$(NasmToolPath)" ToolExe="$(NasmToolExe)" - OptimizationLevel="$(OptimizationLevel)"/> + OptimizationLevel="$(OptimizationLevel)"/> @@ -350,7 +352,7 @@ - <_IsoFile Include="$(LiminePath)boot\limine-uefi-cd.bin" /> + <_IsoFile Include="$(LiminePath)boot\limine-uefi-cd.bin" Condition="'$(UseUEFI)' == 'True'" /> <_IsoFile Include="$(LiminePath)boot\limine-bios-cd.bin" /> <_IsoFile Include="$(LiminePath)boot\limine-bios.sys" /> <_IsoFile Include="$(LiminePath)boot\liminewp.bmp" /> @@ -368,10 +370,10 @@ - - - - + + + + + ToolExe="$(XorrisoToolExe)" + UseUEFI="$(UseUEFI)" />