docker build -t nuc_driver_container .
docker run --cap-add SYS_MODULE -v /proc:/writable_proc -e COLOR=cyan -it --rm nuc_driver_container
from debian:stretch-slim as builder | |
RUN apt-get -y update | |
RUN apt-get -y install build-essential linux-headers-$(uname -r) | |
RUN apt-get -y install debhelper dkms kmod unzip | |
RUN curl -LO https://github.com/milesp20/intel_nuc_led/archive/master.zip && unzip master.zip | |
RUN cd intel_nuc_led-master && make clean && make dkms-install | |
from alpine as base | |
RUN apk update --no-cache && apk add kmod --no-cache | |
COPY safe_load_modules.sh /root/ | |
from base | |
RUN mkdir -p /root/4.9.0-7-amd64/ | |
COPY --from=builder /lib/modules/4.9.0-7-amd64/updates/dkms/nuc_led.ko /root/4.9.0-7-amd64/nuc_led-1.0.ko | |
VOLUME /writeable_proc | |
WORKDIR /root/ | |
ENV COLOR=blue | |
CMD ["./safe_load_modules.sh","nuc_led-1.0.ko"] |
#!/bin/sh | |
"${COLOR?Need to set COLOR}" | |
KERNEL_VERSION=`uname -r` | |
MODULE_VERSION=`modinfo -F vermagic $KERNEL_VERSION/$1 |cut -f1 -d' '` | |
echo "$KERNEL_VERSION = $MODULE_VERSION" | |
if [ "$KERNEL_VERSION" = "$MODULE_VERSION" ] ; then | |
echo "adding $1 to the kernel" | |
insmod $KERNEL_VERSION/$1 | |
fi | |
echo "ring,80,blink_medium,$COLOR" > /writable_proc/acpi/nuc_led |