I want to modify my system's UEFI boot order from within Windows 10. (NOT the BCD store, NOT from wi
4 replies, posted
(I apologize for hostile title, but I'm pretty livid over this at the moment)
So, the idea in my head is pretty simple, and I mentioned it offhand in the Windows 10 thread and decided I wanted to implement it. When either Windows 10 or Linux successfully boots, it modifies the boot order within the UEFI to prioritize itself over the other. Each OS would have a sort of "Switch OS" button that would set the other OS to "boot next", which would cause it to make itself the new default on success.
In Linux, most of this is already done for me; both the "switch OS" button and the "reprioritize boot order" function are accomplished by a single call to efibootmgr, I just have to get off my ass and script it. I figured Windows would have a similar program that I could script, or some function to access the UEFI in C++ so I could do it myself. That's where my plan falls flat. [b][i]Every single Google result across about a dozen different query strings is [u]wrong[/u].[/i][/b] bootcfg and bcdedit do [b]not[/b] edit the UEFI NVRAM with any combination of arguments, the GetFirmwareEnvironmentVariable function is so poorly documented they might as well take the page down from MSDN for all the good it does, and I'm not paying $30 for some program I've never heard of because it supposedly has command line support in the Enterprise edition.
GUI programs to modify the boot order are not acceptable. This absolutely has to, repeat, [i]has to[/i] be something I can use from within a Python script, or it does not qualify.
My Windows 10 doesn't touch the uefi boot-order, and I'm unsure why.
A few questions to maybe get some ideas--: What motherboard do you have? Does it have a [I]Windows SecureBoot TM [/I]feature?
Do you have multiple hard-drives?
My EFI boot sector is on an SSD, while Windows itself is on another HDD. I wonder if that has something to do with Windows not editing it.
[QUOTE=Naelstrom;49514769]A few questions to maybe get some ideas--: What motherboard do you have? Does it have a [I]Windows SecureBoot TM [/I]feature?[/quote]
UEFI Secure Boot is currently disabled until I figure out how to add my own keys to the keyring without wiping out the MS ones. I figured out how to generate those keys, and even sign GRUB and my kernel, but the motherboard is labelled entirely in ASUS Engrish, so I'm not sure which button does what in that section, and I don't want to potentially brick my motherboard.
I am not using any sort of legacy boot mode, either.
[quote]Do you have multiple hard-drives?
My EFI boot sector is on an SSD, while Windows itself is on another HDD. I wonder if that has something to do with Windows not editing it.[/QUOTE]
Yes, but all material relevant to booting either operating system is on the one drive. I can disconnect my 2TB and both OSes will boot as normal.
At the moment, I'm manually switching in the UEFI setup when I want to switch OS.
Wait which bootloader are you using? And what method are you using to boot it? I realized I force my bootloader (rEFInd) to run by putting the executable in /EFI/boot/bootx64.efi
Doesn't matter what order my boot is in since my motherboard just loads that file first regardless.
Yours might be different though.
[QUOTE=Naelstrom;49516949]Wait which bootloader are you using? And what method are you using to boot it? I realized I force my bootloader (rEFInd) to run by putting the executable in /EFI/boot/bootx64.efi
Doesn't matter what order my boot is in since my motherboard just loads that file first regardless.
Yours might be different though.[/QUOTE]
At the moment, I'm using the regular Windows bootloader for Windows, and GRUB 2 for Linux. When I want to switch operating systems, I switch which bootloader loads in the BIOS.
I know for a fact that I can alter the boot order in userspace, I just need a tool I can automate on Windows.
Sorry, you need to Log In to post a reply to this thread.