-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
58 lines (52 loc) · 1.77 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Install missing Alpine Linux kernel modules from a privileged Docker container (Docker for Mac/Windows)
#
# Usage:
# docker build --build-arg KERNELVER=$(uname -r | cut -d '-' -f 1) -t alpine-kernel-modules .
# docker run -it --rm --privileged alpine-kernel-modules modprobe vhci-hcd
FROM alpine:3.4
MAINTAINER gw0 [http://gw.tnode.com/] <[email protected]>
# install alpine packages
RUN apk add --no-cache --update \
# build essentials
abuild \
bc \
binutils \
build-base \
cmake \
gcc \
ncurses-dev \
sed \
# tools
ca-certificates \
wget
# download kernel sources
ARG KERNELVER=4.9.4
RUN wget -nv -P /srv https://www.kernel.org/pub/linux/kernel/v4.x/linux-$KERNELVER.tar.gz \
&& tar -C /srv -zxf /srv/linux-$KERNELVER.tar.gz \
&& rm -f /srv/linux-$KERNELVER.tar.gz
# build kernel modules
RUN cd /srv/linux-$KERNELVER \
&& make defconfig \
&& ([ ! -f /proc/1/root/proc/config.gz ] || zcat /proc/1/root/proc/config.gz > .config) \
# enable modules
&& echo 'CONFIG_USB=m' >> .config \
&& echo 'CONFIG_USB_HID=m' >> .config \
&& echo 'CONFIG_USB_SUPPORT=y' >> .config \
&& echo 'CONFIG_USB_COMMON=m' >> .config \
&& echo 'CONFIG_USB_ARCH_HAS_HCD=y' >> .config \
&& echo 'CONFIG_USB_DEFAULT_PERSIST=y' >> .config \
&& echo 'CONFIG_USBIP_CORE=m' >> .config \
&& echo 'CONFIG_USBIP_VHCI_HCD=m' >> .config \
&& echo 'CONFIG_USBIP_VHCI_HC_PORTS=8' >> .config \
&& echo 'CONFIG_USBIP_VHCI_NR_HCS=1' >> .config \
&& echo 'CONFIG_USBIP_HOST=m' >> .config \
# patch modules
&& sed -i'.bak' '/hcd->amd_resume_bug/{s/^/\/\//;n;s/^/\/\//}' ./drivers/usb/core/hcd-pci.c \
# build modules
&& make oldconfig \
&& make modules_prepare \
&& make modules \
&& make modules_install \
&& make clean
WORKDIR /srv/linux-$KERNELVER
#CMD modprobe vhci-hcd