mirror of
https://github.com/lingble/meta-tegra.git
synced 2025-10-28 19:12:39 +00:00
external: update nvidia container recipes for L4T R36.4.3
* Update nvidia-container-toolkit, libnvidia-container to v1.16.2 * Refresh nvidia-container-toolkit alt-roots patch * Drop obsolete backported patch and config.toml template file * Use nvidia-modprobe patch in the libnvidia-container sources instead of maintaining our own copy * Other minor cleanup of obsolete settings in libnvidia-container recipe * Fix PACKAGE_ARCH of libnvidia-container for tegra platforms * Add missing BSD-3-Clause license to nvidia-container-toolkit recipe * Update license checksums in nvidia-container-toolkit recipe; no license-affecting changes. Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
committed by
Matt Madison
parent
8ba317e68e
commit
ffd139ac7a
@@ -1,44 +0,0 @@
|
||||
From cb2fc78b208a26db115fb603e8d3612bc19260b6 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Madison <matt@madison.systems>
|
||||
Date: Sun, 17 Apr 2022 05:20:32 -0700
|
||||
Subject: [PATCH] Expose device file attrs
|
||||
|
||||
Upstream-Status: Inappropriate [OE-specific]
|
||||
Signed-off-by: Matt Madison <matt@madison.systems>
|
||||
|
||||
---
|
||||
deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.c | 8 ++++----
|
||||
deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.h | 1 +
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: git/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.c
|
||||
===================================================================
|
||||
--- git.orig/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.c
|
||||
+++ git/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.c
|
||||
@@ -888,10 +888,10 @@ int nvidia_vgpu_vfio_mknod(int minor_num
|
||||
return mknod_helper(major, minor_num, vgpu_dev_name, NV_PROC_REGISTRY_PATH);
|
||||
}
|
||||
|
||||
-static int nvidia_cap_get_device_file_attrs(const char* cap_file_path,
|
||||
- int *major,
|
||||
- int *minor,
|
||||
- char *name)
|
||||
+int nvidia_cap_get_device_file_attrs(const char* cap_file_path,
|
||||
+ int *major,
|
||||
+ int *minor,
|
||||
+ char *name)
|
||||
{
|
||||
char field[32];
|
||||
FILE *fp;
|
||||
Index: git/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.h
|
||||
===================================================================
|
||||
--- git.orig/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.h
|
||||
+++ git/deps/src/nvidia-modprobe-495.44/modprobe-utils/nvidia-modprobe-utils.h
|
||||
@@ -81,6 +81,7 @@ int nvidia_nvswitch_mknod(int minor);
|
||||
int nvidia_nvswitch_get_file_state(int minor);
|
||||
int nvidia_cap_mknod(const char* cap_file_path, int *minor);
|
||||
int nvidia_cap_get_file_state(const char* cap_file_path);
|
||||
+int nvidia_cap_get_device_file_attrs(const char* cap_file_path, int *major, int *minor, char *name);
|
||||
int nvidia_get_chardev_major(const char *name);
|
||||
int nvidia_msr_modprobe(void);
|
||||
|
||||
@@ -30,28 +30,25 @@ LICENSE = "Apache-2.0 & MIT"
|
||||
|
||||
LIC_FILES_CHKSUM = "\
|
||||
file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
file://deps/src/nvidia-modprobe-${NVIDIA_MODPROBE_VERSION}/modprobe-utils/nvidia-modprobe-utils.c;endline=22;md5=8f11a22ea12c5aecde3340212f7fc9a1 \
|
||||
file://deps/src/nvidia-modprobe-${NVIDIA_MODPROBE_VERSION}/modprobe-utils/nvidia-modprobe-utils.c;endline=22;md5=b6a3106a81660c726888d006853ada63 \
|
||||
file://deps/src/nvidia-modprobe-${NVIDIA_MODPROBE_VERSION}/modprobe-utils/pci-enum.h;endline=29;md5=ca948b6fabc48e616fccbf17247feebf \
|
||||
file://deps/src/nvidia-modprobe-${NVIDIA_MODPROBE_VERSION}/modprobe-utils/pci-sysfs.c;endline=25;md5=0449248350efd54938e7f8d25af965cb \
|
||||
"
|
||||
|
||||
NVIDIA_MODPROBE_VERSION = "495.44"
|
||||
ELF_TOOLCHAIN_VERSION = "0.7.1"
|
||||
LIBTIRPC_VERSION = "1.3.2"
|
||||
NVIDIA_MODPROBE_VERSION = "550.54.14"
|
||||
|
||||
NVIDIA_MODPROBE_SRCURI_DESTSUFFIX = "${@os.path.join(os.path.basename(d.getVar('S')), 'deps', 'src', 'nvidia-modprobe-' + d.getVar('NVIDIA_MODPROBE_VERSION')) + '/'}"
|
||||
|
||||
SRC_URI = "git://github.com/NVIDIA/libnvidia-container.git;protocol=https;name=libnvidia;branch=main \
|
||||
git://github.com/NVIDIA/nvidia-modprobe.git;protocol=https;branch=main;name=modprobe;destsuffix=${NVIDIA_MODPROBE_SRCURI_DESTSUFFIX} \
|
||||
file://0001-OE-cross-build-fixups.patch \
|
||||
file://0002-Expose-device-file-attrs.patch \
|
||||
file://0003-nvcgo-fix-build-with-go-1.24.patch \
|
||||
"
|
||||
|
||||
# tag: v1.14.2
|
||||
SRCREV_libnvidia = "1eb5a30a6ad0415550a9df632ac8832bf7e2bbba"
|
||||
# Nvidia modprobe version 495.44
|
||||
SRCREV_modprobe = "292409904a5d18163fc7d1fbc11f98627324b82a"
|
||||
# tag: v1.16.2
|
||||
SRCREV_libnvidia = "921e2f3197385173cf8670342e96e98afe9b3dd3"
|
||||
# Nvidia modprobe version 550.54.14
|
||||
SRCREV_modprobe = "149440ca0654d928f27df5ebff485a122bfe43b1"
|
||||
SRCREV_FORMAT = "libnvidia_modprobe"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
@@ -65,19 +62,18 @@ PACKAGECONFIG[seccomp] = "WITH_SECCOMP=yes,WITH_SECCOMP=no,libseccomp"
|
||||
EXTRA_OEMAKE = 'EXCLUDE_BUILD_FLAGS=1 PLATFORM=${HOST_ARCH} WITH_LIBELF=yes COMPILER=${@d.getVar('CC').split()[0]} REVISION=${SRCREV_libnvidia} ${PACKAGECONFIG_CONFARGS} \
|
||||
NVIDIA_MODPROBE_EXTRA_CFLAGS="${NVIDIA_MODPROBE_EXTRA_CFLAGS}"'
|
||||
NVIDIA_MODPROBE_EXTRA_CFLAGS ?= "${DEBUG_PREFIX_MAP}"
|
||||
GO_LINKSHARED = ""
|
||||
|
||||
export OBJCPY = "${OBJCOPY}"
|
||||
|
||||
python do_unpack() {
|
||||
bb.build.exec_func('base_do_unpack', d)
|
||||
patch_nv_modprobe() {
|
||||
patch -d ${WORKDIR}/${NVIDIA_MODPROBE_SRCURI_DESTSUFFIX} -p1 < ${S}/mk/nvidia-modprobe.patch
|
||||
touch ${WORKDIR}/${NVIDIA_MODPROBE_SRCURI_DESTSUFFIX}/.download_stamp
|
||||
}
|
||||
|
||||
# Fix me: Create an independent recipe for nvidia-modprobe
|
||||
do_patch[postfuncs] += "patch_nv_modprobe"
|
||||
|
||||
do_configure() {
|
||||
base_do_configure
|
||||
# Mark Nvidia modprobe as downloaded
|
||||
touch ${S}/deps/src/nvidia-modprobe-${NVIDIA_MODPROBE_VERSION}/.download_stamp
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
@@ -103,3 +99,4 @@ FILES:${PN}-staticdev = "${libdir}/*.a ${base_libdir}/*.a ${libdir}/${BPN}/*.a"
|
||||
# - XXX
|
||||
INSANE_SKIP:${PN} = "already-stripped ldflags"
|
||||
RDEPENDS:${PN}:append:tegra = " ldconfig tegra-libraries-cuda"
|
||||
PACKAGE_ARCH:tegra = "${TEGRA_PKGARCH}"
|
||||
@@ -1,7 +1,7 @@
|
||||
From 6a9a2d1ce71d80435aacb8cbebc4042974cf3c77 Mon Sep 17 00:00:00 2001
|
||||
From 0ebc1dee317131b4d635f620561435bdf7ff54c4 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Madison <matt@madison.systems>
|
||||
Date: Sat, 9 Mar 2024 06:17:17 -0800
|
||||
Subject: [PATCH 1/2] Add support for 'alternate' roots for tegra CSV handling
|
||||
Subject: [PATCH] Add support for 'alternate' roots for tegra CSV handling
|
||||
|
||||
So the host OS can provide one or more trees of libraries that
|
||||
should be mounted into containers, overriding the copies in
|
||||
@@ -23,18 +23,18 @@ Signed-off-by: Matt Madison <matt@madison.systems>
|
||||
10 files changed, 116 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/cmd/nvidia-ctk/cdi/generate/generate.go b/cmd/nvidia-ctk/cdi/generate/generate.go
|
||||
index fd46962..89ff4cc 100644
|
||||
index 9f9e994b..f46d4904 100644
|
||||
--- a/cmd/nvidia-ctk/cdi/generate/generate.go
|
||||
+++ b/cmd/nvidia-ctk/cdi/generate/generate.go
|
||||
@@ -52,6 +52,7 @@ type options struct {
|
||||
class string
|
||||
@@ -55,6 +55,7 @@ type options struct {
|
||||
|
||||
configSearchPaths cli.StringSlice
|
||||
librarySearchPaths cli.StringSlice
|
||||
+ altRoots cli.StringSlice
|
||||
|
||||
csv struct {
|
||||
files cli.StringSlice
|
||||
@@ -118,6 +119,11 @@ func (m command) build() *cli.Command {
|
||||
@@ -131,6 +132,11 @@ func (m command) build() *cli.Command {
|
||||
Usage: "Specify the path to search for libraries when discovering the entities that should be included in the CDI specification.\n\tNote: This option only applies to CSV mode.",
|
||||
Destination: &opts.librarySearchPaths,
|
||||
},
|
||||
@@ -44,18 +44,18 @@ index fd46962..89ff4cc 100644
|
||||
+ Destination: &opts.altRoots,
|
||||
+ },
|
||||
&cli.StringFlag{
|
||||
Name: "nvidia-ctk-path",
|
||||
Usage: "Specify the path to use for the nvidia-ctk in the generated CDI specification. If this is left empty, the path will be searched.",
|
||||
@@ -241,6 +247,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
|
||||
nvcdi.WithDeviceNamer(deviceNamer),
|
||||
nvcdi.WithMode(string(opts.mode)),
|
||||
Name: "nvidia-cdi-hook-path",
|
||||
Aliases: []string{"nvidia-ctk-path"},
|
||||
@@ -271,6 +277,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
|
||||
nvcdi.WithMode(opts.mode),
|
||||
nvcdi.WithConfigSearchPaths(opts.configSearchPaths.Value()),
|
||||
nvcdi.WithLibrarySearchPaths(opts.librarySearchPaths.Value()),
|
||||
+ nvcdi.WithAltRoots(opts.altRoots.Value()),
|
||||
nvcdi.WithCSVFiles(opts.csv.files.Value()),
|
||||
nvcdi.WithCSVIgnorePatterns(opts.csv.ignorePatterns.Value()),
|
||||
)
|
||||
diff --git a/internal/config/runtime.go b/internal/config/runtime.go
|
||||
index ed9ea64..356a9e7 100644
|
||||
index ed9ea646..356a9e72 100644
|
||||
--- a/internal/config/runtime.go
|
||||
+++ b/internal/config/runtime.go
|
||||
@@ -43,7 +43,8 @@ type cdiModeConfig struct {
|
||||
@@ -69,7 +69,7 @@ index ed9ea64..356a9e7 100644
|
||||
|
||||
// GetDefaultRuntimeConfig defines the default values for the config
|
||||
diff --git a/internal/config/toml_test.go b/internal/config/toml_test.go
|
||||
index e017db1..d0c47a0 100644
|
||||
index e017db15..d0c47a00 100644
|
||||
--- a/internal/config/toml_test.go
|
||||
+++ b/internal/config/toml_test.go
|
||||
@@ -72,6 +72,7 @@ default-kind = "nvidia.com/gpu"
|
||||
@@ -81,11 +81,11 @@ index e017db1..d0c47a0 100644
|
||||
|
||||
[nvidia-container-runtime-hook]
|
||||
diff --git a/internal/modifier/csv.go b/internal/modifier/csv.go
|
||||
index 56adcdc..c55b6f7 100644
|
||||
index 0905d5da..61eef0aa 100644
|
||||
--- a/internal/modifier/csv.go
|
||||
+++ b/internal/modifier/csv.go
|
||||
@@ -72,6 +72,7 @@ func NewCSVModifier(logger logger.Interface, cfg *config.Config, image image.CUD
|
||||
nvcdi.WithNVIDIACTKPath(cfg.NVIDIACTKConfig.Path),
|
||||
@@ -65,6 +65,7 @@ func NewCSVModifier(logger logger.Interface, cfg *config.Config, image image.CUD
|
||||
nvcdi.WithNVIDIACDIHookPath(cfg.NVIDIACTKConfig.Path),
|
||||
nvcdi.WithMode(nvcdi.ModeCSV),
|
||||
nvcdi.WithCSVFiles(csvFiles),
|
||||
+ nvcdi.WithAltRoots(cfg.NVIDIAContainerRuntimeConfig.Modes.CSV.AltRoots),
|
||||
@@ -93,10 +93,10 @@ index 56adcdc..c55b6f7 100644
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to construct CDI library: %v", err)
|
||||
diff --git a/internal/platform-support/tegra/csv.go b/internal/platform-support/tegra/csv.go
|
||||
index ff2f493..be3bf3a 100644
|
||||
index e47ae9de..5ae1031f 100644
|
||||
--- a/internal/platform-support/tegra/csv.go
|
||||
+++ b/internal/platform-support/tegra/csv.go
|
||||
@@ -43,39 +43,73 @@ func (o tegraOptions) newDiscovererFromCSVFiles() (discover.Discover, error) {
|
||||
@@ -42,39 +42,73 @@ func (o tegraOptions) newDiscovererFromCSVFiles() (discover.Discover, error) {
|
||||
targetsByType[csv.MountSpecDev],
|
||||
)
|
||||
|
||||
@@ -187,13 +187,13 @@ index ff2f493..be3bf3a 100644
|
||||
}
|
||||
|
||||
diff --git a/internal/platform-support/tegra/symlinks.go b/internal/platform-support/tegra/symlinks.go
|
||||
index c64138d..261e607 100644
|
||||
index 37b07e6d..7d59f406 100644
|
||||
--- a/internal/platform-support/tegra/symlinks.go
|
||||
+++ b/internal/platform-support/tegra/symlinks.go
|
||||
@@ -32,6 +32,7 @@ type symlinkHook struct {
|
||||
nvidiaCTKPath string
|
||||
targets []string
|
||||
mountsFrom discover.Discover
|
||||
nvidiaCDIHookPath string
|
||||
targets []string
|
||||
mountsFrom discover.Discover
|
||||
+ root string
|
||||
|
||||
// The following can be overridden for testing
|
||||
@@ -214,7 +214,7 @@ index c64138d..261e607 100644
|
||||
+ }
|
||||
return symlinkHook{
|
||||
logger: o.logger,
|
||||
nvidiaCTKPath: o.nvidiaCTKPath,
|
||||
nvidiaCDIHookPath: o.nvidiaCDIHookPath,
|
||||
targets: targets,
|
||||
mountsFrom: mounts,
|
||||
- symlinkChainLocator: o.symlinkChainLocator,
|
||||
@@ -223,7 +223,7 @@ index c64138d..261e607 100644
|
||||
resolveSymlink: o.resolveSymlink,
|
||||
}
|
||||
}
|
||||
@@ -116,7 +126,15 @@ func (d symlinkHook) getSymlinkCandidates() []string {
|
||||
@@ -117,7 +127,15 @@ func (d symlinkHook) getSymlinkCandidates() []string {
|
||||
d.logger.Warningf("Failed to locate symlink %v", target)
|
||||
continue
|
||||
}
|
||||
@@ -240,7 +240,7 @@ index c64138d..261e607 100644
|
||||
}
|
||||
return candidates
|
||||
}
|
||||
@@ -124,22 +142,13 @@ func (d symlinkHook) getSymlinkCandidates() []string {
|
||||
@@ -125,22 +143,13 @@ func (d symlinkHook) getSymlinkCandidates() []string {
|
||||
func (d symlinkHook) getCSVFileSymlinks() []string {
|
||||
var links []string
|
||||
created := make(map[string]bool)
|
||||
@@ -267,15 +267,14 @@ index c64138d..261e607 100644
|
||||
|
||||
links = append(links, link)
|
||||
diff --git a/internal/platform-support/tegra/tegra.go b/internal/platform-support/tegra/tegra.go
|
||||
index ad5c5b6..ae09245 100644
|
||||
index 1031fc72..85832876 100644
|
||||
--- a/internal/platform-support/tegra/tegra.go
|
||||
+++ b/internal/platform-support/tegra/tegra.go
|
||||
@@ -29,13 +29,15 @@ type tegraOptions struct {
|
||||
logger logger.Interface
|
||||
csvFiles []string
|
||||
driverRoot string
|
||||
@@ -32,12 +32,14 @@ type tegraOptions struct {
|
||||
devRoot string
|
||||
nvidiaCDIHookPath string
|
||||
ldconfigPath string
|
||||
+ altRoots []string
|
||||
nvidiaCTKPath string
|
||||
librarySearchPaths []string
|
||||
ignorePatterns ignoreMountSpecPatterns
|
||||
|
||||
@@ -288,7 +287,7 @@ index ad5c5b6..ae09245 100644
|
||||
// TODO: This should be replaced by a regular mock
|
||||
resolveSymlink func(string) (string, error)
|
||||
}
|
||||
@@ -59,11 +61,20 @@ func New(opts ...Option) (discover.Discover, error) {
|
||||
@@ -64,11 +66,20 @@ func New(opts ...Option) (discover.Discover, error) {
|
||||
)
|
||||
}
|
||||
|
||||
@@ -310,7 +309,7 @@ index ad5c5b6..ae09245 100644
|
||||
}
|
||||
|
||||
if o.resolveSymlink == nil {
|
||||
@@ -113,6 +124,13 @@ func WithDriverRoot(driverRoot string) Option {
|
||||
@@ -126,6 +137,13 @@ func WithDevRoot(devRoot string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,34 +324,34 @@ index ad5c5b6..ae09245 100644
|
||||
func WithCSVFiles(csvFiles []string) Option {
|
||||
return func(o *tegraOptions) {
|
||||
diff --git a/pkg/nvcdi/lib-csv.go b/pkg/nvcdi/lib-csv.go
|
||||
index 09f0b14..9cc3666 100644
|
||||
index 649b801a..944c89a2 100644
|
||||
--- a/pkg/nvcdi/lib-csv.go
|
||||
+++ b/pkg/nvcdi/lib-csv.go
|
||||
@@ -43,6 +43,7 @@ func (l *csvlib) GetAllDeviceSpecs() ([]specs.Device, error) {
|
||||
d, err := tegra.New(
|
||||
tegra.WithLogger(l.logger),
|
||||
tegra.WithDriverRoot(l.driverRoot),
|
||||
@@ -46,6 +46,7 @@ func (l *csvlib) GetAllDeviceSpecs() ([]specs.Device, error) {
|
||||
tegra.WithDevRoot(l.devRoot),
|
||||
tegra.WithNVIDIACDIHookPath(l.nvidiaCDIHookPath),
|
||||
tegra.WithLdconfigPath(l.ldconfigPath),
|
||||
+ tegra.WithAltRoots(l.altRoots),
|
||||
tegra.WithNVIDIACTKPath(l.nvidiaCTKPath),
|
||||
tegra.WithCSVFiles(l.csvFiles),
|
||||
tegra.WithLibrarySearchPaths(l.librarySearchPaths...),
|
||||
tegra.WithIngorePatterns(l.csvIgnorePatterns...),
|
||||
diff --git a/pkg/nvcdi/lib.go b/pkg/nvcdi/lib.go
|
||||
index f8a52c1..44e7544 100644
|
||||
index d2db3b6c..2dea4a99 100644
|
||||
--- a/pkg/nvcdi/lib.go
|
||||
+++ b/pkg/nvcdi/lib.go
|
||||
@@ -44,6 +44,7 @@ type nvcdilib struct {
|
||||
devicelib device.Interface
|
||||
deviceNamer DeviceNamer
|
||||
driverRoot string
|
||||
@@ -51,6 +51,7 @@ type nvcdilib struct {
|
||||
nvidiaCDIHookPath string
|
||||
ldconfigPath string
|
||||
configSearchPaths []string
|
||||
+ altRoots []string
|
||||
nvidiaCTKPath string
|
||||
librarySearchPaths []string
|
||||
|
||||
csvFiles []string
|
||||
diff --git a/pkg/nvcdi/options.go b/pkg/nvcdi/options.go
|
||||
index 61c4c95..0157a3b 100644
|
||||
index 417687b9..0beb7050 100644
|
||||
--- a/pkg/nvcdi/options.go
|
||||
+++ b/pkg/nvcdi/options.go
|
||||
@@ -118,3 +118,11 @@ func WithLibrarySearchPaths(paths []string) Option {
|
||||
@@ -155,3 +155,11 @@ func WithLibrarySearchPaths(paths []string) Option {
|
||||
o.librarySearchPaths = paths
|
||||
}
|
||||
}
|
||||
@@ -365,5 +364,5 @@ index 61c4c95..0157a3b 100644
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.34.1
|
||||
2.43.0
|
||||
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
From 36306d92335871657b8f73aca382c195ad52e20e Mon Sep 17 00:00:00 2001
|
||||
From: Matt Madison <matt@madison.systems>
|
||||
Date: Sun, 28 Apr 2024 07:16:11 -0700
|
||||
Subject: [PATCH 2/2] Add alt-root support
|
||||
|
||||
Upstream-Status: Inappropriate [oe specific]
|
||||
|
||||
Signed-off-by: Matt Madison <matt@madison.systems>
|
||||
---
|
||||
internal/config/config_test.go | 5 +++++
|
||||
internal/config/runtime.go | 4 +++-
|
||||
internal/discover/csv.go | 5 +++--
|
||||
internal/discover/discover.go | 4 +++-
|
||||
internal/discover/gds.go | 2 +-
|
||||
internal/discover/mounts.go | 9 ++-------
|
||||
internal/lookup/file.go | 8 ++++----
|
||||
internal/lookup/symlinks.go | 6 +++---
|
||||
internal/modifier/csv.go | 3 ++-
|
||||
internal/modifier/tegra.go | 2 +-
|
||||
10 files changed, 27 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
|
||||
index f4501bf..7ef536b 100644
|
||||
--- a/internal/config/config_test.go
|
||||
+++ b/internal/config/config_test.go
|
||||
@@ -68,6 +68,7 @@ func TestGetConfig(t *testing.T) {
|
||||
Modes: modesConfig{
|
||||
CSV: csvModeConfig{
|
||||
MountSpecPath: "/etc/nvidia-container-runtime/host-files-for-container.d",
|
||||
+ AltRoots: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -87,6 +88,7 @@ func TestGetConfig(t *testing.T) {
|
||||
"nvidia-container-runtime.runtimes = [\"/some/runtime\",]",
|
||||
"nvidia-container-runtime.mode = \"not-auto\"",
|
||||
"nvidia-container-runtime.modes.csv.mount-spec-path = \"/not/etc/nvidia-container-runtime/host-files-for-container.d\"",
|
||||
+ "nvidia-container-runtime.modes.csv.alt-roots = []",
|
||||
"nvidia-ctk.path = \"/foo/bar/nvidia-ctk\"",
|
||||
},
|
||||
expectedConfig: &Config{
|
||||
@@ -101,6 +103,7 @@ func TestGetConfig(t *testing.T) {
|
||||
Modes: modesConfig{
|
||||
CSV: csvModeConfig{
|
||||
MountSpecPath: "/not/etc/nvidia-container-runtime/host-files-for-container.d",
|
||||
+ AltRoots: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -123,6 +126,7 @@ func TestGetConfig(t *testing.T) {
|
||||
"mode = \"not-auto\"",
|
||||
"[nvidia-container-runtime.modes.csv]",
|
||||
"mount-spec-path = \"/not/etc/nvidia-container-runtime/host-files-for-container.d\"",
|
||||
+ "alt-roots = []",
|
||||
"[nvidia-ctk]",
|
||||
"path = \"/foo/bar/nvidia-ctk\"",
|
||||
},
|
||||
@@ -138,6 +142,7 @@ func TestGetConfig(t *testing.T) {
|
||||
Modes: modesConfig{
|
||||
CSV: csvModeConfig{
|
||||
MountSpecPath: "/not/etc/nvidia-container-runtime/host-files-for-container.d",
|
||||
+ AltRoots: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
diff --git a/internal/config/runtime.go b/internal/config/runtime.go
|
||||
index a4a79d3..d7f71f9 100644
|
||||
--- a/internal/config/runtime.go
|
||||
+++ b/internal/config/runtime.go
|
||||
@@ -53,7 +53,8 @@ type cdiModeConfig struct {
|
||||
}
|
||||
|
||||
type csvModeConfig struct {
|
||||
- MountSpecPath string `toml:"mount-spec-path"`
|
||||
+ MountSpecPath string `toml:"mount-spec-path"`
|
||||
+ AltRoots []string `toml:"alt-roots"`
|
||||
}
|
||||
|
||||
// dummy allows us to unmarshal only a RuntimeConfig from a *toml.Tree
|
||||
@@ -93,6 +94,7 @@ func GetDefaultRuntimeConfig() *RuntimeConfig {
|
||||
Modes: modesConfig{
|
||||
CSV: csvModeConfig{
|
||||
MountSpecPath: "/etc/nvidia-container-runtime/host-files-for-container.d",
|
||||
+ AltRoots: []string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
diff --git a/internal/discover/csv.go b/internal/discover/csv.go
|
||||
index 6235f44..346b758 100644
|
||||
--- a/internal/discover/csv.go
|
||||
+++ b/internal/discover/csv.go
|
||||
@@ -27,13 +27,14 @@ import (
|
||||
// NewFromCSVFiles creates a discoverer for the specified CSV files. A logger is also supplied.
|
||||
// The constructed discoverer is comprised of a list, with each element in the list being associated with a
|
||||
// single CSV files.
|
||||
-func NewFromCSVFiles(logger *logrus.Logger, files []string, root string) (Discover, error) {
|
||||
+func NewFromCSVFiles(logger *logrus.Logger, files []string, root string, altRoots []string) (Discover, error) {
|
||||
if len(files) == 0 {
|
||||
logger.Warnf("No CSV files specified")
|
||||
return None{}, nil
|
||||
}
|
||||
|
||||
- symlinkLocator := lookup.NewSymlinkLocator(logger, root)
|
||||
+ roots := append(altRoots, root)
|
||||
+ symlinkLocator := lookup.NewSymlinkLocator(logger, roots)
|
||||
locators := map[csv.MountSpecType]lookup.Locator{
|
||||
csv.MountSpecDev: lookup.NewCharDeviceLocator(logger, root),
|
||||
csv.MountSpecDir: lookup.NewDirectoryLocator(logger, root),
|
||||
diff --git a/internal/discover/discover.go b/internal/discover/discover.go
|
||||
index e65b360..f6ce83a 100644
|
||||
--- a/internal/discover/discover.go
|
||||
+++ b/internal/discover/discover.go
|
||||
@@ -19,6 +19,7 @@ package discover
|
||||
// Config represents the configuration options for discovery
|
||||
type Config struct {
|
||||
Root string
|
||||
+ AltRoots []string
|
||||
NVIDIAContainerToolkitCLIExecutablePath string
|
||||
}
|
||||
|
||||
@@ -41,8 +42,9 @@ type Hook struct {
|
||||
Args []string
|
||||
}
|
||||
|
||||
-//go:generate moq -stub -out discover_mock.go . Discover
|
||||
// Discover defines an interface for discovering the devices, mounts, and hooks available on a system
|
||||
+//
|
||||
+//go:generate moq -stub -out discover_mock.go . Discover
|
||||
type Discover interface {
|
||||
Devices() ([]Device, error)
|
||||
Mounts() ([]Mount, error)
|
||||
diff --git a/internal/discover/gds.go b/internal/discover/gds.go
|
||||
index dab2f73..719865b 100644
|
||||
--- a/internal/discover/gds.go
|
||||
+++ b/internal/discover/gds.go
|
||||
@@ -45,7 +45,7 @@ func NewGDSDiscoverer(logger *logrus.Logger, root string) (Discover, error) {
|
||||
|
||||
cufile := NewMounts(
|
||||
logger,
|
||||
- lookup.NewFileLocator(logger, root),
|
||||
+ lookup.NewFileLocator(logger, []string{root}),
|
||||
root,
|
||||
[]string{"/etc/cufile.json"},
|
||||
)
|
||||
diff --git a/internal/discover/mounts.go b/internal/discover/mounts.go
|
||||
index 3c026ae..1e6980b 100644
|
||||
--- a/internal/discover/mounts.go
|
||||
+++ b/internal/discover/mounts.go
|
||||
@@ -84,15 +84,10 @@ func (d *mounts) Mounts() ([]Mount, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
- r := d.relativeTo(p)
|
||||
- if r == "" {
|
||||
- r = p
|
||||
- }
|
||||
-
|
||||
- d.logger.Infof("Selecting %v as %v", p, r)
|
||||
+ d.logger.Infof("Selecting %v as %v", p, candidate)
|
||||
uniqueMounts[p] = Mount{
|
||||
HostPath: p,
|
||||
- Path: r,
|
||||
+ Path: candidate,
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/internal/lookup/file.go b/internal/lookup/file.go
|
||||
index ab52d03..b14e03c 100644
|
||||
--- a/internal/lookup/file.go
|
||||
+++ b/internal/lookup/file.go
|
||||
@@ -34,16 +34,16 @@ type file struct {
|
||||
|
||||
// NewFileLocator creates a Locator that can be used to find files at the specified root. A logger
|
||||
// can also be specified.
|
||||
-func NewFileLocator(logger *log.Logger, root string) Locator {
|
||||
- l := newFileLocator(logger, root)
|
||||
+func NewFileLocator(logger *log.Logger, roots []string) Locator {
|
||||
+ l := newFileLocator(logger, roots)
|
||||
|
||||
return &l
|
||||
}
|
||||
|
||||
-func newFileLocator(logger *log.Logger, root string) file {
|
||||
+func newFileLocator(logger *log.Logger, roots []string) file {
|
||||
return file{
|
||||
logger: logger,
|
||||
- prefixes: []string{root},
|
||||
+ prefixes: roots,
|
||||
filter: assertFile,
|
||||
}
|
||||
}
|
||||
diff --git a/internal/lookup/symlinks.go b/internal/lookup/symlinks.go
|
||||
index 43e3712..f892ae6 100644
|
||||
--- a/internal/lookup/symlinks.go
|
||||
+++ b/internal/lookup/symlinks.go
|
||||
@@ -36,7 +36,7 @@ type symlink struct {
|
||||
// A logger can also be specified.
|
||||
func NewSymlinkChainLocator(logger *logrus.Logger, root string) Locator {
|
||||
l := symlinkChain{
|
||||
- file: newFileLocator(logger, root),
|
||||
+ file: newFileLocator(logger, []string{root}),
|
||||
}
|
||||
|
||||
return &l
|
||||
@@ -44,9 +44,9 @@ func NewSymlinkChainLocator(logger *logrus.Logger, root string) Locator {
|
||||
|
||||
// NewSymlinkLocator creats a locator that can be used for locating files through symlinks.
|
||||
// A logger can also be specified.
|
||||
-func NewSymlinkLocator(logger *logrus.Logger, root string) Locator {
|
||||
+func NewSymlinkLocator(logger *logrus.Logger, roots []string) Locator {
|
||||
l := symlink{
|
||||
- file: newFileLocator(logger, root),
|
||||
+ file: newFileLocator(logger, roots),
|
||||
}
|
||||
|
||||
return &l
|
||||
diff --git a/internal/modifier/csv.go b/internal/modifier/csv.go
|
||||
index d2a2f7a..c2b122b 100644
|
||||
--- a/internal/modifier/csv.go
|
||||
+++ b/internal/modifier/csv.go
|
||||
@@ -63,6 +63,7 @@ func NewCSVModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec)
|
||||
|
||||
config := &discover.Config{
|
||||
Root: cfg.NVIDIAContainerCLIConfig.Root,
|
||||
+ AltRoots: cfg.NVIDIAContainerRuntimeConfig.Modes.CSV.AltRoots,
|
||||
NVIDIAContainerToolkitCLIExecutablePath: cfg.NVIDIACTKConfig.Path,
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ func NewCSVModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec)
|
||||
csvFiles = csv.BaseFilesOnly(csvFiles)
|
||||
}
|
||||
|
||||
- csvDiscoverer, err := discover.NewFromCSVFiles(logger, csvFiles, config.Root)
|
||||
+ csvDiscoverer, err := discover.NewFromCSVFiles(logger, csvFiles, config.Root, config.AltRoots)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create CSV discoverer: %v", err)
|
||||
}
|
||||
diff --git a/internal/modifier/tegra.go b/internal/modifier/tegra.go
|
||||
index 459d1f0..2a47f7b 100644
|
||||
--- a/internal/modifier/tegra.go
|
||||
+++ b/internal/modifier/tegra.go
|
||||
@@ -33,7 +33,7 @@ func NewTegraPlatformFiles(logger *logrus.Logger) (oci.SpecModifier, error) {
|
||||
|
||||
tegraSystemMounts := discover.NewMounts(
|
||||
logger,
|
||||
- lookup.NewFileLocator(logger, ""),
|
||||
+ lookup.NewFileLocator(logger, []string{""}),
|
||||
"",
|
||||
[]string{
|
||||
"/etc/nv_tegra_release",
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
From 579e83fac59da8520ad4cdc6fb2d722cbeec13bc Mon Sep 17 00:00:00 2001
|
||||
From: Matt Madison <matt@madison.systems>
|
||||
Date: Mon, 11 Mar 2024 04:32:52 -0700
|
||||
Subject: [PATCH 2/2] cgo LDFLAGS update for go 1.21 and later
|
||||
|
||||
Upstream-Status: Pending [https://github.com/NVIDIA/go-nvml/pull/79]
|
||||
|
||||
Signed-off-by: Matt Madison <matt@madison.systems>
|
||||
---
|
||||
internal/cuda/cuda.go | 2 +-
|
||||
internal/dxcore/dxcore.go | 2 +-
|
||||
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go | 2 +-
|
||||
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go | 2 +-
|
||||
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/internal/cuda/cuda.go b/internal/cuda/cuda.go
|
||||
index 2c70a82..3fc7952 100644
|
||||
--- a/internal/cuda/cuda.go
|
||||
+++ b/internal/cuda/cuda.go
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
/*
|
||||
-#cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
+#cgo LDFLAGS: -Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CUDAAPI __stdcall
|
||||
diff --git a/internal/dxcore/dxcore.go b/internal/dxcore/dxcore.go
|
||||
index 76cc53f..05c4b45 100644
|
||||
--- a/internal/dxcore/dxcore.go
|
||||
+++ b/internal/dxcore/dxcore.go
|
||||
@@ -17,7 +17,7 @@
|
||||
package dxcore
|
||||
|
||||
/*
|
||||
-#cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
+#cgo LDFLAGS: -Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
#include <dxcore.h>
|
||||
*/
|
||||
import "C"
|
||||
diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go
|
||||
index 1a0efaf..a9a3a56 100644
|
||||
--- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go
|
||||
+++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go
|
||||
@@ -18,7 +18,7 @@
|
||||
package nvml
|
||||
|
||||
/*
|
||||
-#cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
+#cgo LDFLAGS: -Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
#cgo CFLAGS: -DNVML_NO_UNVERSIONED_FUNC_DEFS=1
|
||||
#include "nvml.h"
|
||||
#include <stdlib.h>
|
||||
diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go
|
||||
index f63dfe8..bf2d6fc 100644
|
||||
--- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go
|
||||
+++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go
|
||||
@@ -18,7 +18,7 @@
|
||||
package nvml
|
||||
|
||||
/*
|
||||
-#cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
+#cgo LDFLAGS: -Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
#cgo CFLAGS: -DNVML_NO_UNVERSIONED_FUNC_DEFS=1
|
||||
#include "nvml.h"
|
||||
#include <stdlib.h>
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
disable-require = false
|
||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||
#accept-nvidia-visible-devices-as-volume-mounts = false
|
||||
|
||||
[nvidia-container-cli]
|
||||
#root = "/run/nvidia/driver"
|
||||
#path = "/usr/bin/nvidia-container-cli"
|
||||
environment = []
|
||||
#debug = "!LOCALSTATEDIR!/log/nvidia-container-toolkit.log"
|
||||
#ldcache = "/etc/ld.so.cache"
|
||||
load-kmods = true
|
||||
#no-cgroups = false
|
||||
#user = "root:video"
|
||||
ldconfig = "@!BASE_SBINDIR!/ldconfig"
|
||||
|
||||
[nvidia-container-runtime]
|
||||
#debug = "!LOCALSTATEDIR!/log/nvidia-container-runtime.log"
|
||||
log-level = "info"
|
||||
|
||||
# Specify the runtimes to consider. This list is processed in order and the PATH
|
||||
# searched for matching executables unless the entry is an absolute path.
|
||||
runtimes = [
|
||||
"docker-runc",
|
||||
"runc",
|
||||
]
|
||||
|
||||
mode = "auto"
|
||||
|
||||
[nvidia-container-runtime.modes.csv]
|
||||
|
||||
mount-spec-path = "!SYSCONFDIR!/nvidia-container-runtime/host-files-for-container.d"
|
||||
alt-roots = ["!DATADIR!/nvidia-container-passthrough"]
|
||||
@@ -7,11 +7,11 @@ HOMEPAGE = "https://github.com/NVIDIA/nvidia-container-runtime"
|
||||
|
||||
COMPATIBLE_MACHINE = "(tegra)"
|
||||
|
||||
LICENSE = "Apache-2.0 & MIT & ISC & MPL-2.0 & (Apache-2.0 | MIT)"
|
||||
LICENSE = "Apache-2.0 & MIT & ISC & MPL-2.0 & (Apache-2.0 | MIT) & BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
file://src/${GO_IMPORT}/vendor/tags.cncf.io/container-device-interface/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/davecgh/go-spew/LICENSE;md5=c06795ed54b2a35ebeeb543cd3a73e56 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/fsnotify/fsnotify/LICENSE;md5=68f2948d3c4943313d07e084a362486c \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/fsnotify/fsnotify/LICENSE;md5=8bae8b116e2cfd723492b02d9a212fe2 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/NVIDIA/go-nvml/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/opencontainers/runtime-spec/LICENSE;md5=b355a61a394a504dacde901c958f662c \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/opencontainers/runtime-tools/LICENSE;md5=b355a61a394a504dacde901c958f662c \
|
||||
@@ -20,21 +20,20 @@ LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854dd
|
||||
file://src/${GO_IMPORT}/vendor/github.com/sirupsen/logrus/LICENSE;md5=8dadfef729c08ec4e631c4f6fc5d43a0 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/stretchr/testify/LICENSE;md5=188f01994659f3c0d310612333d2a26f \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/syndtr/gocapability/LICENSE;md5=a7304f5073e7be4ba7bffabbf9f2bbca \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/urfave/cli/v2/LICENSE;md5=c542707ca9fc0b7802407ba62310bd8f \
|
||||
file://src/${GO_IMPORT}/vendor/gitlab.com/nvidia/cloud-native/go-nvlib/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
file://src/${GO_IMPORT}/vendor/golang.org/x/mod/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \
|
||||
file://src/${GO_IMPORT}/vendor/golang.org/x/sys/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/urfave/cli/v2/LICENSE;md5=51992c80b05795f59c22028d39f9b74c \
|
||||
file://src/${GO_IMPORT}/vendor/github.com/NVIDIA/go-nvlib/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
file://src/${GO_IMPORT}/vendor/golang.org/x/mod/LICENSE;md5=7998cb338f82d15c0eff93b7004d272a \
|
||||
file://src/${GO_IMPORT}/vendor/golang.org/x/sys/LICENSE;md5=7998cb338f82d15c0eff93b7004d272a \
|
||||
file://src/${GO_IMPORT}/vendor/gopkg.in/yaml.v2/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e \
|
||||
file://src/${GO_IMPORT}/vendor/gopkg.in/yaml.v3/LICENSE;md5=3c91c17266710e16afdbb2b6d15c761c \
|
||||
file://src/${GO_IMPORT}/vendor/sigs.k8s.io/yaml/LICENSE;md5=0ceb9ff3b27d3a8cf451ca3785d73c71 \
|
||||
"
|
||||
|
||||
SRC_URI = "git://github.com/NVIDIA/nvidia-container-toolkit.git;protocol=https;branch=release-1.14;destsuffix=${GO_SRCURI_DESTSUFFIX}"
|
||||
SRCREV = "9ea336070134e612145d342e495f2fc616aab063"
|
||||
SRC_URI = "git://github.com/NVIDIA/nvidia-container-toolkit.git;protocol=https;branch=release-1.16;destsuffix=${GO_SRCURI_DESTSUFFIX}"
|
||||
SRCREV = "a5a5833c14a15fd9c86bcece85d5ec6621b65652"
|
||||
|
||||
SRC_URI += "\
|
||||
file://0001-Add-support-for-alternate-roots-for-tegra-CSV-handli.patch;patchdir=src/${GO_IMPORT} \
|
||||
file://0002-Fix-cgo-LDFLAGS-for-go-1.21-and-later.patch;patchdir=src/${GO_IMPORT} \
|
||||
file://generate-config.sh.in \
|
||||
file://nvidia-container-setup.service.in \
|
||||
"
|
||||
Reference in New Issue
Block a user