Exemplo n.º 1
0
        private async Task MakeBootable(WindowsVolumes volumes, RaspberryPi phone)
        {
            Log.Information("Making Windows installation bootable...");

            var bcdPath         = Path.Combine(volumes.Boot.RootDir.Name, "EFI", "Microsoft", "Boot", "BCD");
            var bcd             = new BcdInvoker(bcdPath);
            var windowsPath     = Path.Combine(volumes.Windows.RootDir.Name, "Windows");
            var bootDriveLetter = volumes.Boot.Letter;

            if (!bootDriveLetter.HasValue)
            {
                throw new DeploymentException("The Boot volume letter isn't accessible");
            }

            await ProcessUtils.RunProcessAsync(BcdBootPath, $@"{windowsPath} /f UEFI /s {bootDriveLetter}:");

            bcd.Invoke("/set {default} testsigning on");
            bcd.Invoke("/set {default} nointegritychecks on");
            await volumes.Boot.Partition.SetGptType(PartitionType.Esp);

            var updatedBootVolume = await phone.GetBootVolume();

            Log.Verbose("Updated Boot Volume: {@Volume}", new { updatedBootVolume.Label, updatedBootVolume.Partition, });
            if (!Equals(updatedBootVolume.Partition.PartitionType, PartitionType.Esp))
            {
                Log.Warning("The system partition should be {Esp}, but it's {ActualType}", PartitionType.Esp, updatedBootVolume.Partition.PartitionType);
            }
        }
Exemplo n.º 2
0
        private async Task DisableDualBoot()
        {
            Log.Verbose("Disabling Dual Boot...");

            await this.EnsureBootPartitionIs(PartitionType.Esp);

            var bcdInvoker = new BcdInvoker((await GetEfiespVolume()).GetBcdFullFilename());

            bcdInvoker.Invoke($@"/displayorder {{{WinPhoneBcdGuid}}} /remove");

            Log.Verbose("Dual Boot disabled");
        }
Exemplo n.º 3
0
        public async Task RemoveWindowsPhoneBcdEntry()
        {
            Log.Verbose("Removing Windows Phone BCD entry...");

            var efiespVolume = await GetEfiespVolume();

            var bcdInvoker = new BcdInvoker(efiespVolume.GetBcdFullFilename());

            bcdInvoker.Invoke($@"/displayorder {{{Phone.WinPhoneBcdGuid}}} /remove");

            Log.Verbose("Windows Phone BCD entry removed");
        }
Exemplo n.º 4
0
        private async Task DisableDualBoot()
        {
            Log.Information("Disabling Dual Boot...");

            var bootVolume = await GetBootVolume();

            await bootVolume.Partition.SetGptType(PartitionType.Esp);

            var bcdInvoker = new BcdInvoker((await GetEfiespVolume()).GetBcdFullFilename());

            bcdInvoker.Invoke($@"/displayorder {{{WinPhoneBcdGuid}}} /remove");

            Log.Information("Dual Boot disabled");
        }
Exemplo n.º 5
0
        private async Task EnableDualBoot()
        {
            Log.Verbose("Enabling Dual Boot...");

            await this.EnsureBootPartitionIs(PartitionType.Basic);

            var volume = await GetEfiespVolume();

            var bcdInvoker = new BcdInvoker(volume.GetBcdFullFilename());

            bcdInvoker.Invoke($@"/set {{{WinPhoneBcdGuid}}} description ""Windows 10 Phone""");
            bcdInvoker.Invoke($@"/displayorder {{{WinPhoneBcdGuid}}} /addfirst");
            bcdInvoker.Invoke($@"/default {{{WinPhoneBcdGuid}}}");

            Log.Verbose("Dual Boot enabled");
        }
Exemplo n.º 6
0
        private async Task EnableDualBoot()
        {
            Log.Information("Enabling Dual Boot...");

            var winPhoneBcdGuid = Guid.Parse("7619dcc9-fafe-11d9-b411-000476eba25f");

            var bootPartition = await GetBootPartition();

            await bootPartition.SetGptType(PartitionType.Basic);

            var volume = await GetEfiespVolume();

            var bcdInvoker = new BcdInvoker(volume.GetBcdFullFilename());

            bcdInvoker.Invoke($@"/set {{{winPhoneBcdGuid}}} description ""Windows 10 Phone""");
            bcdInvoker.Invoke($@"/displayorder {{{winPhoneBcdGuid}}} /addlast");

            Log.Information("Dual Boot enabled");
        }