feat: GPU passthrough support

feat: GPU passthrough support
This commit is contained in:
Kroese 2023-10-09 02:03:05 +02:00 committed by GitHub
commit c2cd9f52f4
3 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,7 @@ RUN apt-get update && apt-get -y upgrade && \
ca-certificates \
netcat-openbsd \
qemu-system-x86 \
xserver-xorg-video-intel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -170,6 +170,17 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
With this method, you are able to switch between different versions while keeping your file data.
* ### How do I passthrough my GPU?
To enable this feature, add the following lines to your compose file:
```yaml
environment:
GPU: "Y"
devices:
- /dev/dri
```
* ### What are the differences compared to the standard DSM?
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.

View File

@ -4,6 +4,7 @@ set -Eeuo pipefail
# Docker environment variables
: ${URL:=''} # URL of the PAT file
: ${GPU:='N'} # Enable GPU passthrough
: ${DEBUG:='N'} # Enable debug mode
: ${ALLOCATE:='Y'} # Preallocate diskspace
: ${ARGUMENTS:=''} # Extra QEMU parameters
@ -81,6 +82,11 @@ EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
if [[ "${GPU}" == [Yy1]* ]]; then
DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128"
DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"
fi
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}"
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')