Closed slytomcat closed 5 years ago
Possible example:
efibootmgr -crl "EFI\drivers\ext2_x64.efi" -L "EXT2-4 Driver"
efibootmgr -crfl "EFI\drivers\ext2_x64.efi" -L "EXT2-4 Driver"
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
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.
I've done some changes in my fork to implement this feature. But I'm not sure that I've done everything right.
Can anyone review my solution and give me some feedback?
I've managed to build from master and checked it. It works as expected (at least with UEFI on my laptop).
-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.