forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 13
USB over IP
NikitaSobolev edited this page May 24, 2019
·
7 revisions
To make usbip available in Buildroot as a package use this patch:
From 1ff7033e499d5d7b9dc5d429ff82a6679b802488 Mon Sep 17 00:00:00 2001
From: Nikita Sobolev <[email protected]>
Date: Fri, 24 May 2019 16:25:47 +0300
Subject: [PATCH] USBIP: Add package to Buildroot
usbip is a tool, that allows to share USB device over IP network.
Signed-off-by: Nikita Sobolev <[email protected]>
---
package/Config.in | 1 +
package/usbip/Config.in | 5 +++++
package/usbip/usbip.mk | 12 ++++++++++++
3 files changed, 18 insertions(+)
create mode 100644 package/usbip/Config.in
create mode 100644 package/usbip/usbip.mk
diff --git a/package/Config.in b/package/Config.in
index f592e74a99..74b0dd5fc3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -7,6 +7,7 @@ menu "Target packages"
» source "package/skeleton-init-none/Config.in"
» source "package/skeleton-init-systemd/Config.in"
» source "package/skeleton-init-sysv/Config.in"
+» source "package/usbip/Config.in"
·
menu "Audio and video applications"
» source "package/alsa-utils/Config.in"
diff --git a/package/usbip/Config.in b/package/usbip/Config.in
new file mode 100644
index 0000000000..ea99bec90c
--- /dev/null
+++ b/package/usbip/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_USBIP
+» bool "usbip"
+» select BR2_PACKAGE_LINUX_TOOLS
+» help
+» usb over ip
diff --git a/package/usbip/usbip.mk b/package/usbip/usbip.mk
new file mode 100644
index 0000000000..e39db3f7cb
--- /dev/null
+++ b/package/usbip/usbip.mk
@@ -0,0 +1,12 @@
+################################################################################
+#
+# usbip
+#
+################################################################################
+
+USBIP_SITE = $(LINUX_DIR)/tools/usb/usbip
+USBIP_SITE_METHOD = local
+USBIP_INTALL_TARGET = YES
+USBIP_AUTORECONF = YES
+
+$(eval $(autotools-package))
--·
2.16.2
Use this defconfig for Buildroot to enable required options:
BR2_arcle=y
BR2_archs38=y
BR2_TARGET_GENERIC_HOSTNAME="hsdk"
BR2_TARGET_GENERIC_ISSUE="Welcome to the HSDK Platform"
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/synopsys/hsdk/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1"
BR2_LINUX_KERNEL_DEFCONFIG="hsdk"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/synopsys/hsdk/linux.fragment"
BR2_PACKAGE_USBIP=y
BR2_PACKAGE_HWDATA=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="hsdk"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_FORMAT_ELF=y
BR2_TARGET_UBOOT_ENVIMAGE=y
BR2_TARGET_UBOOT_ENVIMAGE_SOURCE="board/synopsys/hsdk/uboot.env.txt"
BR2_TARGET_UBOOT_ENVIMAGE_SIZE="0x4000"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
To enable all modules, that are required for work of usbip tool, call:
make linux-menuconfig
Then find next options and press M
to enable them as a module:
CONFIG_USBIP_CORE=m
CONFIG_USBIP_VHCI_HCD=m
CONFIG_USBIP_VHCI_HC_PORTS=8
CONFIG_USBIP_VHCI_NR_HCS=1
CONFIG_USBIP_HOST=m
CONFIG_USBIP_VUDC=m
CONFIG_USB_GADGET=y
Run make
to build everything.
make
Load usbip modules:
modprobe usbip-core
modprobe usbip-host
modprobe vhci-hcd
To check if everything is working right, run:
lsmod | grep usbip
Run usbip server:
usbipd -D
To get Bus ID of USB device, that will be shared, run:
usbip list -l
Output example:
# usbip list -l
- busid 1-1.1 (3538:0058)
Power Quotient International Co., Ltd : unknown product (3538:0058)
To share USB device run:
usbip bind --busid=<busid>
Output example:
# usbip bind --busid=1-1.1
usbip-host 1-1.1: usbip-host: register new device (bus 1 dev 4)
usbip: info: bind device on busid 1-1.1: complete
Now server is ready for work! To check if device is exportable, run:
usbip list -r localhost
Output example:
Exportable USB devices
======================
- localhost
1-1.1: Power Quotient International Co., Ltd : unknown product (3538:0058)
: /sys/devices/platform/soc/f0040000.ehci/usb1/1-1/1-1.1
: (Defined at Interface level) (00/00/00)
Firstly install usbip packages. For Fedora run:
sudo dnf install usbip
Then load required modules:
sudo modprobe usbip-core
sudo modprobe usbip-host
To check if everything is working right, run:
lsmod | grep usbip
Run usbip server:
usbipd -D
To attach to shared device run:
sudo usbip attach --remote=<remote_ip> --busid=<busid>