-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSM-support is automatically disabled if we enable secure boot for bi… (
#19) * CSM-support is automatically disabled if we enable secure boot for bigtwin servers. Secure boot remains inactive as long as Platform Key(PK) is not enrolled or the system is not in User mode * UpdateBIOS -> ConfigureBIOS
- Loading branch information
Sandro Koll
authored
May 26, 2020
1 parent
fc1b6a3
commit 390024d
Showing
5 changed files
with
227 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/metal-stack/metal-hammer/cmd/event" | ||
"github.com/metal-stack/metal-hammer/pkg/kernel" | ||
"github.com/metal-stack/metal-hammer/pkg/sum" | ||
"time" | ||
|
||
log "github.com/inconshreveable/log15" | ||
) | ||
|
||
// ConfigureBIOS ensures that UEFI boot is enabled and CSM-support is disabled. | ||
// It then reboots the machine. | ||
func (h *Hammer) ConfigureBIOS() error { | ||
s, err := sum.New() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
reboot, err := s.ConfigureBIOS() | ||
if err != nil { | ||
log.Warn("BIOS updates for this machine type are intentionally not supported, skipping ConfigureBIOS", "error", err) | ||
return nil | ||
} | ||
if reboot { | ||
h.EventEmitter.Emit(event.ProvisioningEventPlannedReboot, "update BIOS configuration, need to reboot") | ||
|
||
log.Info("bios", "message", "updated BIOS configuration, reboot in 1 sec") | ||
time.Sleep(1 * time.Second) | ||
err = kernel.Reboot() | ||
if err != nil { | ||
log.Error("reboot", "error", err) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// EnsureBootOrder ensures that the BIOS boot order is properly set, | ||
// i.e. first boot from OS image and then PXE boot | ||
func (h *Hammer) EnsureBootOrder(bootloaderID string) error { | ||
if h.Spec.DevMode { | ||
return nil | ||
} | ||
|
||
s, err := sum.New() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = s.EnsureBootOrder(bootloaderID) | ||
if err != nil { | ||
return err | ||
} | ||
log.Info("bios", "message", "boot order ensured") | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.