I tried to change the line 39 to 5.x and added these to the apk add flex bison alpine-sdk build-base
My run.sh looks like this now
#!/bin/sh
# Authors:
# Unai Martinez-Corral
#
# Copyright 2019-2022 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Install missing Alpine Linux kernel modules in the underlying VM of Docker for Mac/Windows
#
# This script is based on:
# * https://github.com/gw0/docker-alpine-kernel-modules
# * https://github.com/virtualhere/docker
cmd () {
echo "> $@"
"$@"
}
#---
# Build usbip kernel module and copy artifacts to subdir dist
module () {
docker run --name usbip -w //tmp/linux-src alpine sh -c "
apk add --no-cache --update ca-certificates curl gcc make musl-dev flex bison alpine-sdk build-base
curl -fsSL https://www.kernel.org/pub/linux/kernel/v5.x/linux-\$(uname -r | cut -d '-' -f 1).tar.gz | tar -xzf - --strip-components=1
make defconfig
([ ! -f /proc/1/root/proc/config.gz ] || zcat /proc/1/root/proc/config.gz > .config)
printf '%s\n' 'CONFIG_USBIP_CORE=m' 'CONFIG_USBIP_VHCI_HCD=m' 'CONFIG_USBIP_VHCI_HC_PORTS=8' 'CONFIG_USBIP_VHCI_NR_HCS=1' >> .config
make oldconfig modules_prepare
make M=drivers/usb/usbip modules
"
if [ ! -d dist ]; then
mkdir -p dist;
fi
for f in usbip-core.ko vhci-hcd.ko Module.symvers; do
docker cp usbip://tmp/linux-src/drivers/usb/usbip/$f ./dist/
done
docker rm -f usbip
}
#---
# Load kernel module in the underlying Alpine VM
load () {
cmd docker run --privileged --rm \
-v /$(pwd)/dist://wrk -w //wrk \
busybox sh -c "
insmod usbip-core.ko
insmod vhci-hcd.ko
lsmod | grep vhci
"
}
#---
# Build vhclient image
virtualhere () {
curl -fsSL https://www.virtualhere.com/sites/default/files/usbclient/vhclientx86_64 -o dist/vhclientx86_64
name="$1"
if [ "x$1" = "x" ]; then
name="vhcli"
fi
base="$2"
if [ "x$1" = "x" ]; then
base="busybox"
fi
docker build -t "$name" -f- . <<-EOF
FROM $base
COPY dist/vhclientx86_64 /opt/virtualhere/
COPY dist/*.ko /lib/modules/$(docker run --rm busybox uname -r)/
ENV HOME=/opt/virtualhere
ENV PATH=\$PATH:/opt/virtualhere
WORKDIR /opt/virtualhere
RUN echo -e '[General]\nAutoFind=0\n' > /opt/virtualhere/.vhui \
&& chmod +x /opt/virtualhere/vhclientx86_64
EOF
}
vhkill () {
cmd docker rm -f vhclient
}
#---
VHEXE="$(command -v winpty) docker exec -it vhclient"
case "$1" in
-l) load ;;
-m) module ;;
-v)
shift
virtualhere "$@"
;;
-s)
vhkill
shift
img="$@"
if [ "x$@" = "x" ]; then
img="vhcli"
fi
cmd docker run -d --privileged --rm --name vhclient "$img" vhclientx86_64
;;
-k)
vhkill
;;
-e)
shift
cmd $VHEXE "$@"
;;
-c)
shift
clicmd="$@"
if [ "x$@" = "x" ]; then
clicmd="LIST"
fi
cmd $VHEXE vhclientx86_64 -t "$clicmd"
;;
*)
cat <<EOF
Usage:
-m
build kernel module
-l
load kernel module (privileged)
-v [NAME BASE] (default: vhcli alpine)
build vhclient image
-s [IMAGE] (default: vhcli)
start container named 'vhclient' (privileged)
-k
kill/remove container 'vhclient'
-e ARGS
interact with the running 'vhclient' container through 'docker exec'
-c "COMMAND" (default: "LIST")
interact with the VirtualHere client running in the container
EOF
esac
Now the following error happening.
How to do this on Kernel 5.x ?
Error:
./run.sh -m
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/40) Installing fakeroot (1.25.3-r3)
(2/40) Installing openssl (1.1.1q-r0)
(3/40) Installing libattr (2.5.1-r1)
(4/40) Installing attr (2.5.1-r1)
(5/40) Installing libacl (2.3.1-r0)
(6/40) Installing tar (1.34-r0)
(7/40) Installing pkgconf (1.8.0-r1)
(8/40) Installing patch (2.7.6-r7)
(9/40) Installing libgcc (11.2.1_git20220219-r2)
(10/40) Installing libstdc++ (11.2.1_git20220219-r2)
(11/40) Installing lzip (1.23-r0)
(12/40) Installing ca-certificates (20220614-r0)
(13/40) Installing brotli-libs (1.0.9-r6)
(14/40) Installing nghttp2-libs (1.47.0-r0)
(15/40) Installing libcurl (7.83.1-r3)
(16/40) Installing curl (7.83.1-r3)
(17/40) Installing abuild (3.9.0-r0)
Executing abuild-3.9.0-r0.pre-install
(18/40) Installing binutils (2.38-r3)
(19/40) Installing libmagic (5.41-r0)
(20/40) Installing file (5.41-r0)
(21/40) Installing libgomp (11.2.1_git20220219-r2)
(22/40) Installing libatomic (11.2.1_git20220219-r2)
(23/40) Installing gmp (6.2.1-r2)
(24/40) Installing isl22 (0.22-r0)
(25/40) Installing mpfr4 (4.1.0-r0)
(26/40) Installing mpc1 (1.2.1-r0)
(27/40) Installing gcc (11.2.1_git20220219-r2)
(28/40) Installing musl-dev (1.2.3-r0)
(29/40) Installing libc-dev (0.7.2-r3)
(30/40) Installing g++ (11.2.1_git20220219-r2)
(31/40) Installing make (4.3-r0)
(32/40) Installing fortify-headers (1.1-r1)
(33/40) Installing build-base (0.5-r3)
(34/40) Installing expat (2.4.9-r0)
(35/40) Installing pcre2 (10.40-r0)
(36/40) Installing git (2.36.2-r0)
(37/40) Installing alpine-sdk (1.0-r1)
(38/40) Installing m4 (1.4.19-r1)
(39/40) Installing bison (3.7.6-r0)
(40/40) Installing flex (2.6.4-r2)
Executing busybox-1.35.0-r17.trigger
Executing ca-certificates-20220614-r0.trigger
OK: 204 MiB in 54 packages
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
.config:4792:warning: override: reassigning to symbol USBIP_CORE
*
* Restart config...
*
*
* USB support
*
USB support (USB_SUPPORT) [Y/n/?] y
USB ULPI PHY interface support (USB_ULPI_BUS) [N/m/y/?] n
Support for Host-side USB (USB) [Y/n/m/?] y
PCI based USB host interface (USB_PCI) [Y/n/?] y
USB announce new devices (USB_ANNOUNCE_NEW_DEVICES) [N/y/?] n
*
* Miscellaneous USB options
*
Enable USB persist by default (USB_DEFAULT_PERSIST) [Y/n/?] y
Limit USB device initialization to only a few retries (USB_FEW_INIT_RETRIES) [N/y/?] n
Dynamic USB minor allocation (USB_DYNAMIC_MINORS) [N/y/?] n
OTG support (USB_OTG) [N/y/?] n
Rely on OTG and EH Targeted Peripherals List (USB_OTG_PRODUCTLIST) [N/y/?] n
Disable external hubs (USB_OTG_DISABLE_EXTERNAL_HUB) [N/y/?] n
Default autosuspend delay (USB_AUTOSUSPEND_DELAY) [2] 2
USB Monitor (USB_MON) [N/m/y/?] n
*
* USB Host Controller Drivers
*
Cypress C67x00 HCD support (USB_C67X00_HCD) [N/m/y/?] n
xHCI HCD (USB 3.0) support (USB_XHCI_HCD) [M/n/y/?] m
xHCI support for debug capability (USB_XHCI_DBGCAP) [N/y/?] n
Support for additional Renesas xHCI controller with firmware (USB_XHCI_PCI_RENESAS) [N/m/?] n
Generic xHCI driver for a platform device (USB_XHCI_PLATFORM) [N/m/?] n
EHCI HCD (USB 2.0) support (USB_EHCI_HCD) [M/n/y/?] m
Root Hub Transaction Translators (USB_EHCI_ROOT_HUB_TT) [N/y/?] n
Improved Transaction Translator scheduling (USB_EHCI_TT_NEWSCHED) [Y/n/?] y
Support for Freescale on-chip EHCI USB controller (USB_EHCI_FSL) [N/m/?] n
Generic EHCI driver for a platform device (USB_EHCI_HCD_PLATFORM) [N/m/?] n
OXU210HP HCD support (USB_OXU210HP_HCD) [N/m/y/?] n
ISP116X HCD support (USB_ISP116X_HCD) [N/m/y/?] n
FOTG210 HCD support (USB_FOTG210_HCD) [N/m/y/?] n
OHCI HCD (USB 1.1) support (USB_OHCI_HCD) [M/n/y/?] m
OHCI support for PCI-bus USB controllers (USB_OHCI_HCD_PCI) [M/n/?] m
Generic OHCI driver for a platform device (USB_OHCI_HCD_PLATFORM) [N/m/?] n
UHCI HCD (most Intel and VIA) support (USB_UHCI_HCD) [M/n/y/?] m
SL811HS HCD support (USB_SL811_HCD) [N/m/y/?] n
R8A66597 HCD support (USB_R8A66597_HCD) [N/m/y/?] n
HCD test mode support (USB_HCD_TEST_MODE) [N/y/?] n
*
* USB Device Class drivers
*
USB Modem (CDC ACM) support (USB_ACM) [N/m/y/?] n
USB Printer support (USB_PRINTER) [N/m/y/?] n
USB Wireless Device Management support (USB_WDM) [N/m/y/?] n
USB Test and Measurement Class support (USB_TMC) [N/m/y/?] n
*
* NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
*
*
* also be needed; see USB_STORAGE Help for more info
*
USB Mass Storage support (USB_STORAGE) [M/n/y/?] m
USB Mass Storage verbose debug (USB_STORAGE_DEBUG) [N/y/?] n
Realtek Card Reader support (USB_STORAGE_REALTEK) [N/m/?] n
Datafab Compact Flash Reader support (USB_STORAGE_DATAFAB) [N/m/?] n
Freecom USB/ATAPI Bridge support (USB_STORAGE_FREECOM) [N/m/?] n
ISD-200 USB/ATA Bridge support (USB_STORAGE_ISD200) [N/m/?] n
USBAT/USBAT02-based storage support (USB_STORAGE_USBAT) [N/m/?] n
SanDisk SDDR-09 (and other SmartMedia, including DPCM) support (USB_STORAGE_SDDR09) [N/m/?] n
SanDisk SDDR-55 SmartMedia support (USB_STORAGE_SDDR55) [N/m/?] n
Lexar Jumpshot Compact Flash Reader (USB_STORAGE_JUMPSHOT) [N/m/?] n
Olympus MAUSB-10/Fuji DPC-R1 support (USB_STORAGE_ALAUDA) [N/m/?] n
Support OneTouch Button on Maxtor Hard Drives (USB_STORAGE_ONETOUCH) [N/m/?] n
Support for Rio Karma music player (USB_STORAGE_KARMA) [N/m/?] n
SAT emulation on Cypress USB/ATA Bridge with ATACB (USB_STORAGE_CYPRESS_ATACB) [N/m/?] n
USB ENE card reader support (USB_STORAGE_ENE_UB6250) [N/m/?] n
USB Attached SCSI (USB_UAS) [N/m/?] n
*
* USB Imaging devices
*
USB Mustek MDC800 Digital Camera support (USB_MDC800) [N/m/y/?] n
Microtek X6USB scanner support (USB_MICROTEK) [N/m/y/?] n
USB/IP support (USBIP_CORE) [M/n/y/?] m
VHCI hcd (USBIP_VHCI_HCD) [M/n/?] m
Number of ports per USB/IP virtual host controller (USBIP_VHCI_HC_PORTS) [8] 8
Number of USB/IP virtual host controllers (USBIP_VHCI_NR_HCS) [1] 1
Host driver (USBIP_HOST) [N/m/?] (NEW)
Debug messages for USB/IP (USBIP_DEBUG) [N/y/?] (NEW)
Cadence USB3 Dual-Role Controller (USB_CDNS3) [N/m/y/?] n
Inventra Highspeed Dual Role Controller (USB_MUSB_HDRC) [N/m/y/?] n
DesignWare USB3 DRD Core Support (USB_DWC3) [N/m/y/?] n
DesignWare USB2 DRD Core Support (USB_DWC2) [N/m/y/?] n
ChipIdea Highspeed Dual Role Controller (USB_CHIPIDEA) [N/m/?] n
NXP ISP 1760/1761 support (USB_ISP1760) [N/m/y/?] n
*
* USB port drivers
*
*
* USB Miscellaneous drivers
*
EMI 6|2m USB Audio interface support (USB_EMI62) [N/m/y/?] n
EMI 2|6 USB Audio interface support (USB_EMI26) [N/m/y/?] n
ADU devices from Ontrak Control Systems (USB_ADUTUX) [N/m/y/?] n
USB 7-Segment LED Display (USB_SEVSEG) [N/m/y/?] n
USB Lego Infrared Tower support (USB_LEGOTOWER) [N/m/y/?] n
USB LCD driver support (USB_LCD) [N/m/y/?] n
Cypress CY7C63xxx USB driver support (USB_CYPRESS_CY7C63) [N/m/y/?] n
Cypress USB thermometer driver support (USB_CYTHERM) [N/m/y/?] n
Siemens ID USB Mouse Fingerprint sensor support (USB_IDMOUSE) [N/m/y/?] n
Elan PCMCIA CardBus Adapter USB Client (USB_FTDI_ELAN) [N/m/y/?] n
Apple Cinema Display support (USB_APPLEDISPLAY) [N/m/y/?] n
Fast charge control for iOS devices (APPLE_MFI_FASTCHARGE) [N/m/y/?] n
USB 2.0 SVGA dongle support (Net2280/SiS315) (USB_SISUSBVGA) [N/m/?] n
USB LD driver (USB_LD) [N/m/y/?] n
PlayStation 2 Trance Vibrator driver support (USB_TRANCEVIBRATOR) [N/m/y/?] n
IO Warrior driver support (USB_IOWARRIOR) [N/m/y/?] n
USB testing driver (USB_TEST) [N/m/y/?] n
USB EHSET Test Fixture driver (USB_EHSET_TEST_FIXTURE) [N/m/y/?] n
iSight firmware loading support (USB_ISIGHTFW) [N/m/y/?] n
USB YUREX driver support (USB_YUREX) [N/m/y/?] n
Functions for loading firmware on EZUSB chips (USB_EZUSB_FX2) [N/m/y/?] n
USB251XB Hub Controller Configuration Driver (USB_HUB_USB251XB) [N/m/y/?] n
USB3503 HSIC to USB20 Driver (USB_HSIC_USB3503) [N/m/y/?] n
USB4604 HSIC to USB20 Driver (USB_HSIC_USB4604) [N/m/y/?] n
USB Link Layer Test driver (USB_LINK_LAYER_TEST) [N/m/y/?] n
ChaosKey random number generator driver support
Error in reading or end of file.
Error in reading or end of file.
(USB_CHAOSKEY) [N/m/y/?] n
USB Role Switch Support (USB_ROLE_SWITCH) [N/m/y/?] n
*
* KCSAN: dynamic data race detector
*
KCSAN: dynamic data race detector (KCSAN) [N/y/?] (NEW)
Error in reading or end of file.
#
# configuration written to .config
#
SYNC include/config/auto.conf.cmd
SYSTBL arch/x86/include/generated/asm/syscalls_32.h
SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/include/generated/asm/syscalls_64.h
HYPERCALLS arch/x86/include/generated/asm/xen-hypercalls.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
HOSTCC scripts/genksyms/genksyms.o
YACC scripts/genksyms/parse.tab.[ch]
HOSTCC scripts/genksyms/parse.tab.o
LEX scripts/genksyms/lex.lex.c
HOSTCC scripts/genksyms/lex.lex.o
HOSTLD scripts/genksyms/genksyms
HOSTCC scripts/kallsyms
HOSTCC scripts/recordmcount
HOSTCC scripts/sorttable
In file included from ./tools/arch/x86/include/asm/orc_types.h:9,
from scripts/sorttable.h:89,
from scripts/sorttable.c:191:
./tools/include/linux/types.h:10:10: fatal error: asm/types.h: No such file or directory
10 | #include <asm/types.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.host:95: scripts/sorttable] Error 1
make[1]: *** [Makefile:1199: scripts] Error 2
make: *** [Makefile:336: __build_one_by_one] Error 2
CC [M] drivers/usb/usbip/usbip_common.o
In file included from ./include/linux/types.h:6,
from ./include/uapi/linux/byteorder/little_endian.h:12,
from ./include/linux/byteorder/little_endian.h:5,
from ./arch/x86/include/uapi/asm/byteorder.h:5,
from drivers/usb/usbip/usbip_common.c:8:
./include/uapi/linux/types.h:5:10: fatal error: asm/types.h: No such file or directory
5 | #include <asm/types.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:280: drivers/usb/usbip/usbip_common.o] Error 1
make: *** [Makefile:1822: drivers/usb/usbip] Error 2
Error: No such container:path: usbip://tmp/linux-src/drivers/usb/usbip/usbip-core.ko
Error: No such container:path: usbip://tmp/linux-src/drivers/usb/usbip/vhci-hcd.ko
Error: No such container:path: usbip://tmp/linux-src/drivers/usb/usbip/Module.symvers
I tried to change the line 39 to 5.x and added these to the apk add
flex bison alpine-sdk build-base
My run.sh looks like this now
Now the following error happening.
How to do this on Kernel 5.x ?
Error: