From 81908c8cc95e035c67f17bd6bad9c2e90c48a660 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 7 Jul 2023 15:26:26 +0200 Subject: [PATCH] Search custom firmware paths first Signed-off-by: Evan Lezar --- CHANGELOG.md | 1 + pkg/nvcdi/driver-nvml.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5fd23f..751986b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Add option to create device nodes when creating `/dev/char` symlinks * Create ouput folders if required when running `nvidia-ctk runtime configure` * Generate default config as post-install step. +* Added support for detecting GSP firmware at custom paths when generating CDI specifications. * [libnvidia-container] Support OpenSSL 3 with the Encrypt/Decrypt library diff --git a/pkg/nvcdi/driver-nvml.go b/pkg/nvcdi/driver-nvml.go index 8b63beaa..bc8171a3 100644 --- a/pkg/nvcdi/driver-nvml.go +++ b/pkg/nvcdi/driver-nvml.go @@ -110,23 +110,26 @@ func getUTSRelease() (string, error) { } func getFirmwareSearchPaths(logger logger.Interface) ([]string, error) { + + var firmwarePaths []string + if p := getCustomFirmwareClassPath(logger); p != "" { + logger.Debugf("using custom firmware class path: %s", p) + firmwarePaths = append(firmwarePaths, p) + } + utsRelease, err := getUTSRelease() if err != nil { return nil, fmt.Errorf("failed to get UTS_RELEASE: %v", err) } - firmwarePaths := []string{ + standardPaths := []string{ filepath.Join("/lib/firmware/updates/", utsRelease), filepath.Join("/lib/firmware/updates/"), filepath.Join("/lib/firmware/", utsRelease), filepath.Join("/lib/firmware/"), } - if p := getCustomFirmwareClassPath(logger); p != "" { - logger.Debugf("using custom firmware class path: %s", p) - firmwarePaths = append(firmwarePaths, p) - } - return firmwarePaths, nil + return append(firmwarePaths, standardPaths...), nil } // getCustomFirmwareClassPath returns the custom firmware class path if it exists.