From patchwork Sat Aug 1 21:36:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Stewart X-Patchwork-Id: 1339845 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=paral.in Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BJyDL5P9Qz9sTC for ; Sun, 2 Aug 2020 07:37:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1886187D9C; Sat, 1 Aug 2020 21:37:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yvC3TF-wgMa9; Sat, 1 Aug 2020 21:37:34 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id A435487DB0; Sat, 1 Aug 2020 21:37:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 855001BF380 for ; Sat, 1 Aug 2020 21:37:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 823B485E99 for ; Sat, 1 Aug 2020 21:37:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fmd5-qOK1E_B for ; Sat, 1 Aug 2020 21:37:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by fraxinus.osuosl.org (Postfix) with ESMTPS id A623185D45 for ; Sat, 1 Aug 2020 21:37:03 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id ha11so9405956pjb.1 for ; Sat, 01 Aug 2020 14:37:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yp9Hm17TB+m06D3646hPBeLFgZXykjDEe9frbXA/O6Y=; b=m8cfQ56c6f7TX+ERTNsxrUHqq8prqf1L7v4E+cwKbu2NiFBPrsXk3MSgEUwbnTfiiM RcoyZRkSxYtMfyvpOgkonhE9dJ9IvdqmBkGWiPW//DmiwcFuy/JnrTUx0NGFNQq8MNXD l1FeMjd3WSkv/OXVD8jos3tiezE9brKkDRXBf+fy8bR+WkdSD4JF/hWE+FDhPjYPPslu LwXEikfy4VT/qUQk1+UM8xRfV7pS3Orbo4ttmH/h3ZCTr8hX9wGokAAr8PHPofoZ2mxL dtJd7USz7hmla3vSHqz3gK5O8mG2e3oxE1Ox25M84wdQ9IpD0Ni80BW71HGvI2nOcBGu iqzw== X-Gm-Message-State: AOAM533kngPKhMBZl69NUYcLa65UrSIXwGozizXLW2si7z4kZZWctvw7 gdk6Zxd6wz+iWze0e1Ijq0GgWwFkBho= X-Google-Smtp-Source: ABdhPJy0ouH6gPCOyoD+Y0F0SeF4uqcYxD8hm5T9d+6YahRCGBCknxfz/2mTYJ9I6c1Zg7W7A+Xgbw== X-Received: by 2002:a17:90a:230d:: with SMTP id f13mr9422531pje.116.1596317822897; Sat, 01 Aug 2020 14:37:02 -0700 (PDT) Received: from localhost.localdomain (c-24-4-44-62.hsd1.ca.comcast.net. [24.4.44.62]) by smtp.gmail.com with ESMTPSA id z11sm15241477pfg.169.2020.08.01.14.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2020 14:37:02 -0700 (PDT) From: Christian Stewart To: buildroot@buildroot.org Date: Sat, 1 Aug 2020 14:36:55 -0700 Message-Id: <20200801213658.33869-3-christian@paral.in> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200801213658.33869-2-christian@paral.in> References: <20200801213658.33869-2-christian@paral.in> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v1 3/6] package/nvidia-container-runtime: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Korsgaard , Christian Stewart , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" NVIDIA Container Runtime is a fork of runc which adds support for mounting GPUs into containers. https://github.com/NVIDIA/nvidia-container-runtime Signed-off-by: Christian Stewart --- package/Config.in | 1 + package/nvidia-container-runtime/Config.in | 16 +++++++++ package/nvidia-container-runtime/config.toml | 20 +++++++++++ package/nvidia-container-runtime/daemon.json | 12 +++++++ .../nvidia-container-runtime.hash | 3 ++ .../nvidia-container-runtime.mk | 33 +++++++++++++++++++ 6 files changed, 85 insertions(+) create mode 100644 package/nvidia-container-runtime/Config.in create mode 100644 package/nvidia-container-runtime/config.toml create mode 100644 package/nvidia-container-runtime/daemon.json create mode 100644 package/nvidia-container-runtime/nvidia-container-runtime.hash create mode 100644 package/nvidia-container-runtime/nvidia-container-runtime.mk diff --git a/package/Config.in b/package/Config.in index 0d34824128..dfa02217d9 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2385,6 +2385,7 @@ menu "System tools" source "package/netifrc/Config.in" source "package/numactl/Config.in" source "package/nut/Config.in" + source "package/nvidia-container-runtime/Config.in" source "package/openrc/Config.in" source "package/openvmtools/Config.in" source "package/pamtester/Config.in" diff --git a/package/nvidia-container-runtime/Config.in b/package/nvidia-container-runtime/Config.in new file mode 100644 index 0000000000..c029002149 --- /dev/null +++ b/package/nvidia-container-runtime/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_NVIDIA_CONTAINER_RUNTIME + bool "nvidia-container-runtime" + depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_TOOLCHAIN_USES_GLIBC # fexecve + help + NVIDIA Container Runtime is a fork of runc which adds + support for mounting GPUs into containers. + + https://github.com/NVIDIA/nvidia-container-runtime + +comment "nvidia-container-runtime needs a glibc toolchain w/ threads" + depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS && \ + BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS + depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAN_USES_GLIBC diff --git a/package/nvidia-container-runtime/config.toml b/package/nvidia-container-runtime/config.toml new file mode 100644 index 0000000000..21ee9a22b5 --- /dev/null +++ b/package/nvidia-container-runtime/config.toml @@ -0,0 +1,20 @@ +# see below: +# https://raw.githubusercontent.com/NVIDIA/nvidia-container-toolkit/master/config/config.toml.debian + +disable-require = false +#swarm-resource = "DOCKER_RESOURCE_GPU" + +[nvidia-container-cli] +#root = "/run/nvidia/driver" +#path = "/usr/bin/nvidia-container-cli" +environment = [] +#debug = "/var/log/nvidia-container-toolkit.log" +#ldcache = "/etc/ld.so.cache" +load-kmods = true +#no-cgroups = false +#user = "root:video" +ldconfig = "@/sbin/ldconfig" +#alpha-merge-visible-devices-envvars = false + +[nvidia-container-runtime] +#debug = "/var/log/nvidia-container-runtime.log" diff --git a/package/nvidia-container-runtime/daemon.json b/package/nvidia-container-runtime/daemon.json new file mode 100644 index 0000000000..bc01c904ce --- /dev/null +++ b/package/nvidia-container-runtime/daemon.json @@ -0,0 +1,12 @@ +{ + "experimental": true, + "exec-opts": [ + "native.cgroupdriver=systemd" + ], + "runtimes": { + "nvidia": { + "runtimeArgs": [], + "path": "/usr/bin/nvidia-container-runtime" + } + } +} diff --git a/package/nvidia-container-runtime/nvidia-container-runtime.hash b/package/nvidia-container-runtime/nvidia-container-runtime.hash new file mode 100644 index 0000000000..38d4663276 --- /dev/null +++ b/package/nvidia-container-runtime/nvidia-container-runtime.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 c3a2bb76ae1893499e81388e43b791a90c9bced52c473378bbe4333e07604439 nvidia-container-runtime-3.3.0.tar.gz +sha256 552a739c3b25792263f731542238b92f6f8d07e9a488eae27e6c4690038a8243 LICENSE diff --git a/package/nvidia-container-runtime/nvidia-container-runtime.mk b/package/nvidia-container-runtime/nvidia-container-runtime.mk new file mode 100644 index 0000000000..8d9694d2ae --- /dev/null +++ b/package/nvidia-container-runtime/nvidia-container-runtime.mk @@ -0,0 +1,33 @@ +################################################################################ +# +# nvidia-container-runtime +# +################################################################################ + +NVIDIA_CONTAINER_RUNTIME_VERSION = 3.3.0 +NVIDIA_CONTAINER_RUNTIME_SITE = $(call github,NVIDIA,nvidia-container-runtime,v$(NVIDIA_CONTAINER_RUNTIME_VERSION)) +NVIDIA_CONTAINER_RUNTIME_LICENSE = Apache-2.0 +NVIDIA_CONTAINER_RUNTIME_LICENSE_FILES = LICENSE + +NVIDIA_CONTAINER_RUNTIME_LDFLAGS = -X main.gitCommit=$(NVIDIA_CONTAINER_RUNTIME_VERSION) +NVIDIA_CONTAINER_RUNTIME_TAGS = cgo static_build + +ifeq ($(BR2_PACKAGE_LIBSECCOMP),y) +NVIDIA_CONTAINER_RUNTIME_TAGS += seccomp +NVIDIA_CONTAINER_RUNTIME_DEPENDENCIES += libseccomp host-pkgconf +endif + +NVIDIA_CONTAINER_RUNTIME_GOMOD = github.com/NVIDIA/nvidia-container-runtime +NVIDIA_CONTAINER_RUNTIME_BUILD_TARGETS = github.com/NVIDIA/nvidia-container-runtime/src +NVIDIA_CONTAINER_RUNTIME_BIN_NAME = nvidia-container-runtime + +define NVIDIA_CONTAINER_RUNTIME_INSTALL_SUPPORT + $(INSTALL) -D -m 644 $(NVIDIA_CONTAINER_RUNTIME_PKGDIR)/config.toml \ + $(TARGET_DIR)/etc/nvidia-container-runtime/config.toml + $(INSTALL) -D -m 644 $(NVIDIA_CONTAINER_RUNTIME_PKGDIR)/daemon.json \ + $(TARGET_DIR)/etc/docker/daemon.json +endef + +NVIDIA_CONTAINER_RUNTIME_POST_INSTALL_TARGET_HOOKS += NVIDIA_CONTAINER_RUNTIME_INSTALL_SUPPORT + +$(eval $(golang-package))