Skip to content

Instantly share code, notes, and snippets.

@bademux
Created June 12, 2025 19:09
Show Gist options
  • Save bademux/a4028133538d2315a42a7ef0dfeb4358 to your computer and use it in GitHub Desktop.
Save bademux/a4028133538d2315a42a7ef0dfeb4358 to your computer and use it in GitHub Desktop.
build RyzenAdj and ryzen_smu kernel module in docker
# use DOCKER_BUILDKIT=1 to cache downloaded layer and --output to export built Artefact
# DOCKER_BUILDKIT=1 docker build --progress=plain --file ryzen_control.Dockerfile --output type=tar,dest=artefact.tar .
# unpack: tar -zxvf /tmp/ryzen_smu.tar.gz
# to install build dkms module use: dkms ldtarball ryzen_smu.dkms.tar.gz
# to check version: dkms status | grep ryzen_smu
# to install: dkms install --modprobe-on-install --force ryzen_smu/0.1.6
ARG UBUNTU_VERSION="25.04"
FROM scratch AS caching-downloader
# change versions of ryzen_adj and ryzen_smu here
ADD https://github.com/FlyGoat/RyzenAdj/archive/refs/tags/v0.17.0.tar.gz /ryzen_adj.tar.gz
ADD https://github.com/amkillam/ryzen_smu/archive/refs/heads/main.tar.gz /ryzen_smu.tar.gz
FROM ubuntu:${UBUNTU_VERSION} AS builder
COPY --from=caching-downloader / /tmp
RUN apt update &&\
apt -y install dkms git build-essential linux-headers-"$(uname -r)" cmake libpci-dev
# build ryzen_smu
WORKDIR /build/ryzen_smu/
RUN tar -zxvf /tmp/ryzen_smu.tar.gz --strip-components=1
RUN sed -i "s/dkms install/dkms mktarball --archive .\/ryzen_smu.dkms.tar.gz /g" Makefile &&\
make dkms-install &&\
echo 'ryzen_smu' > ryzen_smu.conf
# build ryzen_adj
WORKDIR /build/ryzen_adj
RUN tar -zxvf /tmp/ryzen_adj.tar.gz --strip-components=1
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release &&\
make -C build -j"$(nproc)"
FROM scratch AS export-stage
COPY --from=builder --chmod=755 build/ryzen_adj/build/ryzenadj /usr/local/bin/
COPY --from=builder build/ryzen_smu/ryzen_smu.dkms.tar.gz /
COPY --from=builder build/ryzen_smu/ryzen_smu.conf /etc/modules-load.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment