OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:55 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Force selection of load option in UEFI via C code
PostPosted: Sat Apr 29, 2023 10:45 am 
Offline

Joined: Sat Apr 29, 2023 9:29 am
Posts: 8
Hello, friends.

I am involved in a small project (in California).
We are developing a DXE-driver (by C-language).
We have a task - forced selection of a partition to boot the operating system (set boot option in stage before BDS).

Our current implementation forced sets the BootOrder variable with a single entry - with the necessary index of BootNNNN variable.
Also, we overload the SetVariable() function, and we do not allow changing the BootOrder variable in it.

But this implementation does not fully work - on VmWare everything works with bugs.
Also, for different motherboards, the implementation has different behavior, and it is also not always correct.

Please advise how best to solve the problem? Has anyone had a similar experience.

Thanks.


Top
 Profile  
 
 Post subject: Re: Force selection of load option in UEFI via C code
PostPosted: Sun May 07, 2023 2:34 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
EggHead wrote:
We are developing a DXE-driver (by C-language).
We have a task - forced selection of a partition to boot the operating system (set boot option in stage before BDS).

That's a pretty unusual task for a DXE driver. Are you able to explain your situation in any more detail than that? I'm particularly interested in why you can't write a bootloader that chain-loads the appropriate operating system.

EggHead wrote:
But this implementation does not fully work - on VmWare everything works with bugs.
Also, for different motherboards, the implementation has different behavior, and it is also not always correct.

What kind of bugs?

Some motherboards ignore the BootOrder variable.


Top
 Profile  
 
 Post subject: Re: Force selection of load option in UEFI via C code
PostPosted: Wed Jul 12, 2023 8:37 am 
Offline

Joined: Sat Apr 29, 2023 9:29 am
Posts: 8
Octocontrabass, thanks to answer!

Octocontrabass wrote:
That's a pretty unusual task for a DXE driver. Are you able to explain your situation in any more detail than that? I'm particularly interested in why you can't write a bootloader that chain-loads the appropriate operating system.

I am developing a trusted OS boot control tool with additional functionality (user login and password entry, checking the integrity of hardware, firmware, etc.). The tool itself is in the form of a DXE-module to run before the OS boots. Therefore, I have to allow the user to boot only the allowed OS.

EggHead wrote:
What kind of bugs?

Very different bugs.
I tried to make the BootOrder with a single entry, overwrite SetVariable/GetVariable to return the correct BootOrder and Boot#### variables.
However, on different motherboards, entries in the BootOrder begin to be duplicated or disappear altogether, etc. That is, this approach does not work well.


Top
 Profile  
 
 Post subject: Re: Force selection of load option in UEFI via C code
PostPosted: Wed Jul 12, 2023 8:40 am 
Offline

Joined: Sat Apr 29, 2023 9:29 am
Posts: 8
At the moment I'm trying to manually download efi-boot loader (\EFI\Boot\BOOTX64.efi etc.) using LoadImage/StartImage functions.

However, there are also a number of problems for which I will now create another post - viewtopic.php?f=1&t=56900 =)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Google [Bot] and 58 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group