Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperJMN committed Apr 10, 2019
1 parent 9ba2382 commit ac0744d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 4 deletions.
57 changes: 57 additions & 0 deletions Source/Deployer.Lumia/BcdConfigurator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using Deployer.FileSystem;
using Deployer.Services;
using Deployer.Utils;

namespace Deployer.Lumia
{
public class BcdConfigurator
{
private readonly IBcdInvoker invoker;
private readonly Volume mainOsVolume;

public BcdConfigurator(IBcdInvoker invoker, Volume mainOsVolume)
{
this.invoker = invoker;
this.mainOsVolume = mainOsVolume;
}

public void SetupBcd()
{
var bootShimEntry = CreateBootShim();
SetupBootShim(bootShimEntry);
SetupBootMgr();
SetDisplayOptions(bootShimEntry);
}

private void SetDisplayOptions(Guid entry)
{
invoker.Invoke($@"/displayorder {{{entry}}}");
invoker.Invoke($@"/default {{{entry}}}");
invoker.Invoke($@"/timeout 30");
}

private void SetupBootShim(Guid guid)
{
invoker.Invoke($@"/set {{{guid}}} path \EFI\boot\BootShim.efi");
invoker.Invoke($@"/set {{{guid}}} device partition={mainOsVolume.Root}\EFIESP");
invoker.Invoke($@"/set {{{guid}}} testsigning on");
invoker.Invoke($@"/set {{{guid}}} nointegritychecks on");
}

private void SetupBootMgr()
{
invoker.Invoke($@"/set {{bootmgr}} displaybootmenu on");
invoker.Invoke($@"/deletevalue {{bootmgr}} customactions");
invoker.Invoke($@"/deletevalue {{bootmgr}} custom:54000001");
invoker.Invoke($@"/deletevalue {{bootmgr}} custom:54000002");
invoker.Invoke($@"/deletevalue {{bootmgr}} processcustomactionsfirst");
}

private Guid CreateBootShim()
{
var invokeText = invoker.Invoke(@"/create /d ""Windows 10"" /application BOOTAPP");
return FormattingUtils.GetGuid(invokeText);
}
}
}
1 change: 1 addition & 0 deletions Source/Deployer.Lumia/LumiaDiskLayoutPreparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private async Task PatchBoot()
Log.Verbose("Patching boot");

var bootVol = await disk.GetVolumeByPartitionName(PartitionName.System);

await fileOperations.Copy("Core\\Boot\\bootaa64.efi", Path.Combine(bootVol.Root, "EFI", "Boot\\"));
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Deployer.Lumia/PartitionCleaner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public async Task Clean(IPhone toClean)
Log.Information("Performing partition cleanup");

disk = await toClean.GetDeviceDisk();
dataPartition = await disk.GetPartitionByName(PartitionName.Data);
dataPartition = await disk.GetPartition(PartitionName.Data);

if (dataPartition == null)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Deployer.Lumia/Phone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task<DualBootStatus> GetDualBootStatus()
public override async Task<Partition> GetSystemPartition()
{
var disk = await GetDeviceDisk();
return await disk.GetRequiredPartitionByName(PartitionName.System);
return await disk.GetPartition(PartitionName.System);
}

public async Task ToogleDualBoot(bool isEnabled, bool force = false)
Expand Down
3 changes: 2 additions & 1 deletion Source/Deployer.Lumia/Tasks/InstallDevMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ private async Task CopyDevMenuFiles(string mainOsPath)
private void ConfigureBcd(string mainOsPath)
{
var bcdPath = Path.Combine(mainOsPath, PartitionName.EfiEsp.CombineRelativeBcdPath());
var efiEspPath = Path.Combine(mainOsPath, PartitionName.EfiEsp);
var bcdInvoker = bcdInvokerFactory.Create(bcdPath);
var guid = FormattingUtils.GetGuid(bcdInvoker.Invoke(@"/create /d ""Developer Menu"" /application BOOTAPP"));
bcdInvoker.Invoke($@"/set {{{guid}}} path \Windows\System32\BOOT\developermenu.efi");
bcdInvoker.Invoke($@"/set {{{guid}}} device partition={mainOsPath}");
bcdInvoker.Invoke($@"/set {{{guid}}} device partition={efiEspPath}");
bcdInvoker.Invoke($@"/set {{{guid}}} testsigning on");
bcdInvoker.Invoke($@"/set {{{guid}}} nointegritychecks on");
bcdInvoker.Invoke($@"/displayorder {{{guid}}} /addlast");
Expand Down
2 changes: 1 addition & 1 deletion Source/DeployerPlatform

0 comments on commit ac0744d

Please sign in to comment.