diff --git a/Source/Deployer.Lumia/BcdConfigurator.cs b/Source/Deployer.Lumia/BcdConfigurator.cs new file mode 100644 index 0000000..b409a11 --- /dev/null +++ b/Source/Deployer.Lumia/BcdConfigurator.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Source/Deployer.Lumia/LumiaDiskLayoutPreparer.cs b/Source/Deployer.Lumia/LumiaDiskLayoutPreparer.cs index 7a364d4..909cf8d 100644 --- a/Source/Deployer.Lumia/LumiaDiskLayoutPreparer.cs +++ b/Source/Deployer.Lumia/LumiaDiskLayoutPreparer.cs @@ -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\\")); } diff --git a/Source/Deployer.Lumia/PartitionCleaner.cs b/Source/Deployer.Lumia/PartitionCleaner.cs index 7b2c270..f2dcf23 100644 --- a/Source/Deployer.Lumia/PartitionCleaner.cs +++ b/Source/Deployer.Lumia/PartitionCleaner.cs @@ -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) { diff --git a/Source/Deployer.Lumia/Phone.cs b/Source/Deployer.Lumia/Phone.cs index 0971acc..65bf426 100644 --- a/Source/Deployer.Lumia/Phone.cs +++ b/Source/Deployer.Lumia/Phone.cs @@ -65,7 +65,7 @@ public async Task GetDualBootStatus() public override async Task 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) diff --git a/Source/Deployer.Lumia/Tasks/InstallDevMenu.cs b/Source/Deployer.Lumia/Tasks/InstallDevMenu.cs index 5af36d4..bf1bb3f 100644 --- a/Source/Deployer.Lumia/Tasks/InstallDevMenu.cs +++ b/Source/Deployer.Lumia/Tasks/InstallDevMenu.cs @@ -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"); diff --git a/Source/DeployerPlatform b/Source/DeployerPlatform index 8bb5bc6..98ef277 160000 --- a/Source/DeployerPlatform +++ b/Source/DeployerPlatform @@ -1 +1 @@ -Subproject commit 8bb5bc6255b9a7fd3c503e7b183ad325f70d9787 +Subproject commit 98ef2777847d1f21dd65542b8b71cbe98d5ff9e7