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

incusd/instance/edk2: Always prefer the EDK2 override #1847

Merged
merged 1 commit into from
Mar 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions internal/server/instance/drivers/edk2/driver_edk2.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,29 +194,24 @@ func GetArchitectureFirmwarePairsForUsage(hostArch int, usage FirmwareUsage) ([]
for _, installation := range GetArchitectureInstallations(hostArch) {
usage, found := installation.Usage[usage]
if found {
searchPath := installation.Path

// If listed path doesn't exist, consider EDK2 override path.
if !util.PathExists(searchPath) {
if incusEdk2Path == "" {
// No fallback path, skip entirely.
// Prefer the EDK2 override path if provided.
for _, searchPath := range []string{incusEdk2Path, installation.Path} {
if searchPath == "" || !util.PathExists(searchPath) {
continue
}

searchPath = incusEdk2Path
}

for _, firmwarePair := range usage {
codePath := filepath.Join(searchPath, firmwarePair.Code)
varsPath := filepath.Join(searchPath, firmwarePair.Vars)
if !util.PathExists(codePath) || !util.PathExists(varsPath) {
continue
for _, firmwarePair := range usage {
codePath := filepath.Join(searchPath, firmwarePair.Code)
varsPath := filepath.Join(searchPath, firmwarePair.Vars)
if !util.PathExists(codePath) || !util.PathExists(varsPath) {
continue
}

firmwares = append(firmwares, FirmwarePair{
Code: codePath,
Vars: varsPath,
})
}

firmwares = append(firmwares, FirmwarePair{
Code: codePath,
Vars: varsPath,
})
}
}
}
Expand Down