Skip to content

Commit d0f5519

Browse files
committed
podvm: Add nvidia gpu support for mkosi image
WIP Signed-off-by: Pradipta Banerjee <[email protected]>
1 parent e45bef5 commit d0f5519

File tree

7 files changed

+45
-1
lines changed

7 files changed

+45
-1
lines changed

src/cloud-api-adaptor/podvm-mkosi/mkosi.postinst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mv "${BUILDROOT}/etc/issue.d" "${BUILDROOT}/usr/lib/issue.d" || true
1111
echo "IMAGE_ID=\"podvm\""
1212
echo "IMAGE_VERSION=\"${IMAGE_VERSION-v0.0.0}\""
1313
echo "VARIANT_ID=\"${VARIANT_ID}\""
14-
} >> "${BUILDROOT}/etc/os-release"
14+
} >>"${BUILDROOT}/etc/os-release"
1515

1616
# remove unused units of legacy image
1717
rm -f "${BUILDROOT}"/etc/systemd/system/{run-image,run-kata\x2dcontainers}.mount
@@ -25,3 +25,8 @@ ln -s /dev/null "${BUILDROOT}/etc/systemd/system/[email protected]"
2525
ln -s /dev/null "${BUILDROOT}/etc/systemd/system/systemd-pcrphase-initrd.service"
2626
ln -s /dev/null "${BUILDROOT}/etc/systemd/system/systemd-pcrphase-sysinit.service"
2727
ln -s /dev/null "${BUILDROOT}/etc/systemd/system/systemd-pcrphase.service"
28+
29+
# Update NVIDIA config
30+
#
31+
echo -e "blacklist nouveau\nblacklist nova_core" >/etc/modprobe.d/blacklist_nv_alt.conf
32+
#
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Match]
2+
Distribution=fedora
3+
4+
[Content]
5+
Packages=
6+
nvidia-container-toolkit
7+
# 570.172.08 or newer is required due to: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/893
8+
nvidia-driver-cuda-570.172.08
9+
kmod-nvidia-open-dkms-570.172.08
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[cuda-fedora41-x86_64]
2+
name=cuda-fedora41-x86_64
3+
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/fedora41/x86_64
4+
enabled=1
5+
gpgcheck=1
6+
gpgkey=https://developer.download.nvidia.com/compute/cuda/repos/fedora41/x86_64/D42D0685.pub

src/cloud-api-adaptor/podvm-mkosi/mkosi.skeleton/usr/lib/systemd/system-preset/30-coco.preset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ enable setup-nat-for-imds.service
1010
enable gen-issue.service
1111
enable image-env.service
1212
enable scratch-storage.service
13+
14+
enable nvidia-cdi.service
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../nvidia-cdi.service
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Generate NVIDIA CDI Configuration
3+
Before=kata-agent.service
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/usr/local/bin/generate-nvidia-cdi.sh
8+
RemainAfterExit=true
9+
10+
[Install]
11+
WantedBy=multi-user.target
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
#load drivers
4+
nvidia-ctk -d system create-device-nodes --control-devices --load-kernel-modules
5+
6+
nvidia-persistenced
7+
# set confidential compute to ready state
8+
nvidia-smi conf-compute -srs 1
9+
# Generate NVIDIA CDI configuration
10+
nvidia-ctk cdi generate --output=/var/run/cdi/nvidia.yaml > /var/log/nvidia-cdi-gen.log 2>&1

0 commit comments

Comments
 (0)