Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ability to set LOAD_OPTION_FORCE_RECONNECT for driver #108

Closed
slytomcat opened this issue Mar 13, 2019 · 5 comments
Closed

Comments

@slytomcat
Copy link
Contributor

-r option of efibootmgr allows to create DriverXXXX efi variable, but for some cases it is also required to force UEFI to remap devices after driver is loaded. It can be done by setting LOAD_OPTION_FORCE_RECONNECT attribute in driver loading variable.

I think it wold be very good to have an ability to set LOAD_OPTION_FORCE_RECONNECT attribute while creation new Driver option by efibootmgr.

@slytomcat
Copy link
Contributor Author

slytomcat commented Mar 14, 2019

Possible example:

efibootmgr -crl "EFI\drivers\ext2_x64.efi" -L "EXT2-4 Driver"

  • creates the "EXT2-4 Driver" driver option without setting LOAD_OPTION_FORCE_RECONNECT attribute

efibootmgr -crfl "EFI\drivers\ext2_x64.efi" -L "EXT2-4 Driver"

  • creates the "EXT2-4 Driver" driver option with active LOAD_OPTION_FORCE_RECONNECT attribute

Assuming option -f or --force-reconnect of efibootmgr can be used for activation of LOAD_OPTION_FORCE_RECONNECT attribute (applicable only for driver).

-f option should set bit 1 (mask 0x00000002) in load boot option attributes field.

Probably unsetting of LOAD_OPTION_FORCE_RECONNECT attribute is also required as setting of this attribute for many drivers is not recommended (each reconnect requires some amount of time during boot process).
In this case option -F|--do-not-reconnect also required. So, the command:

efibootmgr -r -b0000 -F

  • resets the LOAD_OPTION_FORCE_RECONNECT attribute in Driver0000 load option.

@slytomcat
Copy link
Contributor Author

slytomcat commented Mar 14, 2019

Having such ability in efibootmgr looks excellent as alternative way to set and unset this driver load option requires rather boring routine: remove uefi vars protection by chattr -a, write byte 0x03 (bit active and bit force_reconnect are set in 1) with offset 5 from beginning, restore vars protection by chattr +a. It is not only boring but also dangerous.

@slytomcat
Copy link
Contributor Author

I've done some changes in my fork to implement this feature. But I'm not sure that I've done everything right.

@slytomcat
Copy link
Contributor Author

Can anyone review my solution and give me some feedback?

@slytomcat
Copy link
Contributor Author

I've managed to build from master and checked it. It works as expected (at least with UEFI on my laptop).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant