Compare commits

..

17 Commits
v4.14 ... v4.17

Author SHA1 Message Date
Kroese
38148641c0 feat: Install GPU drivers
feat: Install GPU drivers
2023-10-09 03:33:37 +02:00
Kroese
5941eae237 style: Empty line 2023-10-09 03:27:45 +02:00
Kroese
5fa117c4d8 fix: Remove platform dependant packages 2023-10-09 03:23:54 +02:00
Kroese
28fc911f00 feat: Install GPU drivers 2023-10-09 03:21:06 +02:00
Kroese
c8eb659c3c feat: Install GPU drivers 2023-10-09 03:14:41 +02:00
Kroese
16ce7c07cf fix: Install platform dependant packages 2023-10-09 02:50:59 +02:00
Kroese
f745e5e09d build: Dockerfile 2023-10-09 02:42:20 +02:00
Kroese
16b823f69b fix: add GPU drivers only on amd64
fix: add GPU drivers only on amd64
2023-10-09 02:27:46 +02:00
Kroese
d69cceba8d fix: add GPU drivers only on amd64 2023-10-09 02:24:52 +02:00
Kroese
c2cd9f52f4 feat: GPU passthrough support
feat: GPU passthrough support
2023-10-09 02:03:05 +02:00
Kroese
0d2a222af0 docs: GPU passthrough support 2023-10-09 02:00:03 +02:00
Kroese
868c7d1661 feat: GPU passthrough support 2023-10-09 01:54:25 +02:00
Kroese
b6ca62da34 feat: GPU passthrough support 2023-10-09 01:42:01 +02:00
Kroese
da4555925b Merge pull request #330 from amintong/master
dnat rule add dst restrictions
2023-10-08 15:08:25 +02:00
tong min
8c6f7e49ef network in NAT mode, processing packets only with the destination (dst) set to the container IP can prevent packets coming out of the QEMU virtual machine through eth0 from being incorrectly DNAT 2023-10-08 19:48:00 +08:00
Kroese
06829aac67 refactor: Filesystem detection
refactor: Filesystem detection
2023-10-07 12:09:11 +02:00
Kroese
e5b7ade0d0 refactor: Filesystem detection 2023-10-07 12:06:22 +02:00
6 changed files with 59 additions and 37 deletions

View File

@@ -12,7 +12,6 @@ on:
- '.dockerignore' - '.dockerignore'
- '.github/**' - '.github/**'
- '.github/workflows/**' - '.github/workflows/**'
- 'Dockerfile'
jobs: jobs:
shellcheck: shellcheck:

View File

@@ -14,24 +14,24 @@ ARG DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y upgrade && \ RUN apt-get update && apt-get -y upgrade && \
apt-get --no-install-recommends -y install \ apt-get --no-install-recommends -y install \
curl \ curl \
cpio \ cpio \
wget \ wget \
fdisk \ fdisk \
unzip \ unzip \
socat \ socat \
procps \ procps \
xz-utils \ xz-utils \
iptables \ iptables \
iproute2 \ iproute2 \
dnsmasq \ dnsmasq \
net-tools \ net-tools \
ca-certificates \ ca-certificates \
netcat-openbsd \ netcat-openbsd \
qemu-system-x86 \ qemu-system-x86 \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY run/*.sh /run/ COPY run/*.sh /run/
COPY agent/*.sh /agent/ COPY agent/*.sh /agent/
@@ -43,7 +43,7 @@ VOLUME /storage
EXPOSE 22 EXPOSE 22
EXPOSE 80 EXPOSE 80
EXPOSE 139 EXPOSE 139
EXPOSE 445 EXPOSE 445
EXPOSE 5000 EXPOSE 5000

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. 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? * ### 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. 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

@@ -31,15 +31,9 @@ rm -f "$STORAGE"/"$BASE".agent
rm -f "$STORAGE"/"$BASE".boot.img rm -f "$STORAGE"/"$BASE".boot.img
rm -f "$STORAGE"/"$BASE".system.img rm -f "$STORAGE"/"$BASE".system.img
TMP="/tmp/dsm"
FS=$(stat -f -c %T "$STORAGE") FS=$(stat -f -c %T "$STORAGE")
[[ "$FS" == "ext"* ]] && TMP="$STORAGE/tmp"
if [[ "$FS" == "ext"* ]]; then
TMP="$STORAGE/tmp"
else
TMP="/tmp/dsm"
fi
RDC="$STORAGE/dsm.rd"
rm -rf "$TMP" && mkdir -p "$TMP" rm -rf "$TMP" && mkdir -p "$TMP"
# Check free diskspace # Check free diskspace
@@ -49,6 +43,8 @@ SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1)
[[ "${DEBUG}" == [Yy1]* ]] && set -x [[ "${DEBUG}" == [Yy1]* ]] && set -x
RDC="$STORAGE/dsm.rd"
if [ ! -f "${RDC}" ]; then if [ ! -f "${RDC}" ]; then
info "Install: Downloading installer..." info "Install: Downloading installer..."
@@ -106,7 +102,7 @@ if [ -f "${RDC}" ]; then
cp "$TMP/usr/lib/libc.so.6" /lib64/ cp "$TMP/usr/lib/libc.so.6" /lib64/
cp "$TMP/usr/lib/libpthread.so.0" /lib64/ cp "$TMP/usr/lib/libpthread.so.0" /lib64/
cp "$TMP/usr/lib/ld-linux-x86-64.so.2" /lib64/ cp "$TMP/usr/lib/ld-linux-x86-64.so.2" /lib64/
fi fi
mv /run/extract/scemd /run/extract/syno_extract_system_patch mv /run/extract/scemd /run/extract/syno_extract_system_patch
chmod +x /run/extract/syno_extract_system_patch chmod +x /run/extract/syno_extract_system_patch
@@ -131,28 +127,36 @@ if ((SIZE<250000000)); then
error "The specified PAT file is probably an update pack as it's too small." && exit 62 error "The specified PAT file is probably an update pack as it's too small." && exit 62
fi fi
info "Install: Extracting downloaded image..."
if { tar tf "$PAT"; } >/dev/null 2>&1; then if { tar tf "$PAT"; } >/dev/null 2>&1; then
info "Install: Extracting downloaded image..."
tar xpf "$PAT" -C "$TMP/." tar xpf "$PAT" -C "$TMP/."
else else
export DEBCONF_NOWARNINGS="yes"
export DEBIAN_FRONTEND="noninteractive"
if [ "$ARCH" != "amd64" ]; then if [ "$ARCH" != "amd64" ]; then
export DEBCONF_NOWARNINGS="yes" info "Install: Installing QEMU..."
export DEBIAN_FRONTEND="noninteractive"
apt-get -qq update apt-get -qq update && apt-get -qq -y upgrade
apt-get -qq -y upgrade
apt-get -qq --no-install-recommends -y install qemu-user > /dev/null apt-get -qq --no-install-recommends -y install qemu-user > /dev/null
export DEBIAN_FRONTEND="" fi
export DEBCONF_NOWARNINGS=""
if [[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then
info "Install: Installing GPU drivers..."
apt-get -qq update && apt-get -qq -y upgrade
apt-get -qq --no-install-recommends -y install xserver-xorg-video-intel > /dev/null
fi fi
info "Install: Extracting downloaded image..."
export LD_LIBRARY_PATH="/run/extract" export LD_LIBRARY_PATH="/run/extract"
if [ "$ARCH" == "amd64" ]; then if [ "$ARCH" == "amd64" ]; then

View File

@@ -147,9 +147,11 @@ configureNAT () {
ip link set dev "${VM_NET_TAP}" master dockerbridge ip link set dev "${VM_NET_TAP}" master dockerbridge
# Add internet connection to the VM # Add internet connection to the VM
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
iptables -t nat -A POSTROUTING -o "${VM_NET_DEV}" -j MASQUERADE iptables -t nat -A POSTROUTING -o "${VM_NET_DEV}" -j MASQUERADE
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p tcp -j DNAT --to $VM_NET_IP iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -d "${IP}" -p tcp -j DNAT --to $VM_NET_IP
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p udp -j DNAT --to $VM_NET_IP iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -d "${IP}" -p udp -j DNAT --to $VM_NET_IP
if (( KERNEL > 4 )); then if (( KERNEL > 4 )); then
# Hack for guest VMs complaining about "bad udp checksums in 5 packets" # Hack for guest VMs complaining about "bad udp checksums in 5 packets"

View File

@@ -4,6 +4,7 @@ set -Eeuo pipefail
# Docker environment variables # Docker environment variables
: ${URL:=''} # URL of the PAT file : ${URL:=''} # URL of the PAT file
: ${GPU:='N'} # Enable GPU passthrough
: ${DEBUG:='N'} # Enable debug mode : ${DEBUG:='N'} # Enable debug mode
: ${ALLOCATE:='Y'} # Preallocate diskspace : ${ALLOCATE:='Y'} # Preallocate diskspace
: ${ARGUMENTS:=''} # Extra QEMU parameters : ${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 -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" 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="${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 ' ') ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')