mirror of
https://github.com/h7x4/usbip-dkms-devcontainer-feature.git
synced 2025-12-15 23:24:21 +01:00
Initial commit
This commit is contained in:
28
features/usbip-dkms/devcontainer-feature.json
Normal file
28
features/usbip-dkms/devcontainer-feature.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "USBIP DKMS Module",
|
||||
"id": "usbip-dkms",
|
||||
"version": "0.1.0",
|
||||
"description": "DKMS module for USBIP",
|
||||
|
||||
"installsAfter": [
|
||||
"ghcr.io/devcontainers/features/common-utils"
|
||||
],
|
||||
|
||||
"options": {
|
||||
"kernelVersion": {
|
||||
"type": "string",
|
||||
"proposals": [
|
||||
"v4.4",
|
||||
"v4.14",
|
||||
"v4.19",
|
||||
"v5.4",
|
||||
"v5.10",
|
||||
"v5.15",
|
||||
"v6.1",
|
||||
"v6.3",
|
||||
"v6.4"
|
||||
],
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
17
features/usbip-dkms/dkms.conf
Normal file
17
features/usbip-dkms/dkms.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
PACKAGE_NAME="usbip"
|
||||
PACKAGE_VERSION="#MODULE_VERSION#"
|
||||
|
||||
BUILT_MODULE_NAME[0]="usbip-core"
|
||||
DEST_MODULE_LOCATION[0]="/kernel/drivers/usb/usbip"
|
||||
|
||||
BUILT_MODULE_NAME[1]="vhci-hcd"
|
||||
DEST_MODULE_LOCATION[1]="/kernel/drivers/usb/usbip"
|
||||
|
||||
BUILT_MODULE_NAME[2]="usbip-host"
|
||||
DEST_MODULE_LOCATION[2]="/kernel/drivers/usb/usbip"
|
||||
|
||||
BUILT_MODULE_NAME[3]="usbip-vudc"
|
||||
DEST_MODULE_LOCATION[3]="/kernel/drivers/usb/usbip"
|
||||
|
||||
AUTOINSTALL="YES"
|
||||
|
||||
35
features/usbip-dkms/install.sh
Normal file
35
features/usbip-dkms/install.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
KERNEL_VERSION="${KERNELVERSION:-}"
|
||||
|
||||
set -euo
|
||||
|
||||
if [ -z "$KERNEL_VERSION" ]; then
|
||||
KERNEL_VERSION="v$(uname -r | grep -Po '\d\.\d+')"
|
||||
if [ "$KERNEL_VERSION" == 'v' ]; then
|
||||
>&2 echo "Could not automatically determine kernel version. Please set kernelVersion in the feature config."
|
||||
fi
|
||||
fi
|
||||
|
||||
apt update
|
||||
apt install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
dkms \
|
||||
git \
|
||||
"linux-headers-$(uname -r)" \
|
||||
subversion
|
||||
|
||||
# Trick to be able to only download the usbip folder
|
||||
svn export "https://github.com/torvalds/linux/tags/${KERNEL_VERSION}/drivers/usb/usbip" "/usr/src/usbip-${KERNEL_VERSION}"
|
||||
install -m644 dkms.conf "/usr/src/usbip-${KERNEL_VERSION}/dkms.conf"
|
||||
|
||||
sed -i "s|#MODULE_VERSION#|${KERNEL_VERSION}|" "/usr/src/usbip-${KERNEL_VERSION}/dkms.conf"
|
||||
|
||||
export CONFIG_USBIP_CORE=m
|
||||
export CONFIG_VHCI_HCD=m
|
||||
export CONFIG_USBIP_HOST=m
|
||||
export CONFIG_USBIP_VUDC=m
|
||||
|
||||
dkms add -m usbip -v "${KERNEL_VERSION}"
|
||||
dkms build -m usbip -v "${KERNEL_VERSION}"
|
||||
dkms install -m usbip -v "${KERNEL_VERSION}"
|
||||
Reference in New Issue
Block a user