added my Recipes
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
ACTION=="remove", SUBSYSTEM=="usb", RUN+="/usr/sbin/stm32mp-usbip-bind-unbind.sh remove %p"
|
||||
|
||||
ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", RUN+="/usr/sbin/stm32mp-usbip-bind-unbind.sh add %p"
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
USB IP:
|
||||
------
|
||||
REF:
|
||||
https://developer.ridgerun.com/wiki/index.php?title=How_to_setup_and_use_USB/IP
|
||||
|
||||
|
||||
Server configuration:
|
||||
---------------------
|
||||
The package usbip provide the tools and service to enable a serveur for usbip.
|
||||
|
||||
To enable it on server:
|
||||
$> systemctl enable usbip
|
||||
$> systemctl start usbip
|
||||
|
||||
|
||||
Client configuration and way of working (Linux ubuntu PC):
|
||||
----------------------------------------------------------
|
||||
Pre-requisite on ubuntu:
|
||||
sudo apt-get install sysfsutils libwrap0-dev libglib2.0-dev libtool automake autoconf pkg-config linux-tools-generic
|
||||
|
||||
Download ids file and install it:
|
||||
wget http://www.linux-usb.org/usb.ids
|
||||
sudo mkdir -p /usr/share/hwdata/
|
||||
sudo cp usb.ids /usr/share/hwdata/
|
||||
|
||||
Setup:
|
||||
sudo modprobe usbip-core
|
||||
sudo modprobe vhci-hcd
|
||||
Can be automaticaly load at runtime by putting it on module load:
|
||||
echo "usbip-core" > /etc/modules-load.d/usbip.conf
|
||||
echo "vhci-hcd" >> /etc/modules-load.d/usbip.conf
|
||||
|
||||
List usb remote available on specific server:
|
||||
sudo usbip list -r <server IP>
|
||||
|
||||
attach an USB:
|
||||
sudo usbip attach -r <server IP> -b <USB ID>
|
||||
Detach
|
||||
sudo usbip port
|
||||
sudo usbip detach -p 00
|
||||
|
||||
NOTE: if "usbip attach" return an error like:
|
||||
"usbip: info: no exportable devices found on 10.48.0.144"
|
||||
That meanin there is no usb device plugged on server.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh -
|
||||
#echo "Parameter number $#" >> /tmp/usbip.log
|
||||
action=$1
|
||||
devpath=$2
|
||||
#echo "Parameter: $1" >> /tmp/usbip.log
|
||||
#echo "Parameter: $2" >> /tmp/usbip.log
|
||||
|
||||
case $1 in
|
||||
unload)
|
||||
modprobe -r usbip-core
|
||||
modprobe -r usbip-host
|
||||
kill -9 `pgrep usbipd`
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
subpath=$(echo $2 | sed "s|.*/\([^/]*\)|\1|")
|
||||
#echo "subpath >$subpath<" >> /tmp/usbip.log
|
||||
if $(echo $subpath | grep -q ":");
|
||||
then
|
||||
#echo "No valid path" >> /tmp/usbip.log
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if usbip-core are not loaded, do nothing
|
||||
if [ -z "$(cat /proc/modules | grep usbip_core)" ]; then
|
||||
#echo "no module usbip_core loaded" >> /tmp/usbip.log
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
add)
|
||||
#echo ">>> bind $subpath" >> /tmp/usbip.log
|
||||
usbip bind -b $subpath
|
||||
;;
|
||||
remove)
|
||||
#echo "<<< unbind $subpath" >> /tmp/usbip.log
|
||||
usbip unbind -b $subpath
|
||||
;;
|
||||
esac
|
||||
|
||||
21885
meta-st/meta-st-openstlinux/recipes-kernel/usbip/files/usb.ids
Normal file
21885
meta-st/meta-st-openstlinux/recipes-kernel/usbip/files/usb.ids
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
blacklist usbip-core
|
||||
blacklist usbip-host
|
||||
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=USB-IP Bindind
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre=-/sbin/modprobe usbip-core
|
||||
ExecStartPre=-/sbin/modprobe usbip-host
|
||||
ExecStart=/usr/sbin/usbipd -D
|
||||
ExecStop=/usr/sbin/stm32mp-usbip-bind-unbind.sh unload
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
66
meta-st/meta-st-openstlinux/recipes-kernel/usbip/usbip.bb
Normal file
66
meta-st/meta-st-openstlinux/recipes-kernel/usbip/usbip.bb
Normal file
@@ -0,0 +1,66 @@
|
||||
SUMMARY = "USB ip tools"
|
||||
DESCRIPTION = "USB ip tools from linux kernel"
|
||||
HOMEPAGE = "https://www.kernel.org"
|
||||
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
PV = "2.0"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI += " \
|
||||
file://99-usb-usbip.rules \
|
||||
file://stm32mp-usbip-bind-unbind.sh \
|
||||
file://usb.ids \
|
||||
file://usbip.service \
|
||||
file://usbip.conf \
|
||||
"
|
||||
|
||||
DEPENDS = " \
|
||||
tcp-wrappers \
|
||||
systemd \
|
||||
"
|
||||
|
||||
USBIP_SRC ?= "tools/usb/usbip"
|
||||
|
||||
do_configure[depends] += "virtual/kernel:do_shared_workdir"
|
||||
|
||||
inherit linux-kernel-base kernel-arch manpages
|
||||
|
||||
do_populate_lic[depends] += "virtual/kernel:do_patch"
|
||||
|
||||
inherit kernelsrc
|
||||
|
||||
S = "${WORKDIR}/tools/usb/usbip"
|
||||
|
||||
inherit autotools gettext pkgconfig systemd
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "usbip.service"
|
||||
SYSTEMD_AUTO_ENABLE:${PN} = "disable"
|
||||
|
||||
EXTRA_OECONF += "--with-tcp-wrappers"
|
||||
|
||||
do_configure[prefuncs] += "base_do_unpack"
|
||||
|
||||
do_configure:prepend() {
|
||||
# copy source source from kernel to workdir
|
||||
mkdir -p ${WORKDIR}/${USBIP_SRC}
|
||||
tar --xattrs --xattrs-include='*' -cf - -S -C ${STAGING_KERNEL_DIR}/${USBIP_SRC} -p . | tar --xattrs --xattrs-include='*' -xf - -C ${WORKDIR}/${USBIP_SRC}
|
||||
}
|
||||
do_install:append() {
|
||||
install -d ${D}${datadir}/hwdata/
|
||||
install -m 0644 ${WORKDIR}/usb.ids ${D}${datadir}/hwdata/
|
||||
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/stm32mp-usbip-bind-unbind.sh ${D}${sbindir}/
|
||||
|
||||
install -d ${D}${sysconfdir}/udev/rules.d/
|
||||
install -m 0644 ${WORKDIR}/99-usb-usbip.rules ${D}${sysconfdir}/udev/rules.d/
|
||||
|
||||
install -d ${D}${sysconfdir}/modprobe.d/
|
||||
install -m 0644 ${WORKDIR}/usbip.conf ${D}${sysconfdir}/modprobe.d/
|
||||
|
||||
install -d ${D}${systemd_system_unitdir}/
|
||||
install -m 0644 ${WORKDIR}/usbip.service ${D}${systemd_system_unitdir}/
|
||||
}
|
||||
FILES:${PN} += "${datadir}/hwdata/ ${sbindir} ${sysconfdir}/udev/rules.d/ ${systemd_system_unitdir}/ ${sysconfdir}/modprobe.d/"
|
||||
Reference in New Issue
Block a user