After kernel 2.6.39, usbip kernel and userspace are in kernel tree
The new kernel modules names have already been updated in openwrt for
kernel > 2.6.39
This patch, allow to build the new corresponding usbip userspace tool
when of the device use a kernel > 2.6.39
And continue to build version 0.1.7 for older version.
Fix #10992
Signed-off-by: Mehdi Abaakouk <sil...@sileht.net>
Index: net/usbip/Makefile
===================================================================
--- net/usbip/Makefile (révision 31217)
+++ net/usbip/Makefile (copie de travail)
@@ -9,13 +9,35 @@
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=usbip
-PKG_VERSION:=0.1.7
PKG_RELEASE:=2
+ifeq ($(strip $(call
CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
+
+PKG_VERSION:=0.1.7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/usbip
PKG_MD5SUM:=d1094b6d4449787864f8be001639232c
+else
+
+# Since kernel 2.6.39.1 userspace tools are inside the kernel tree
+# Package Automatic match version in kernel
+# MD5SUM is not useful kernel package already check it
+
+PKG_VERSION:=$(shell sed -n -e
'/^AC_INIT/s/.*\[\([[:digit:]\.]*\)\].*/\1/gp'
$(LINUX_DIR)/drivers/staging/usbip/userspace/configure.ac)
+PKG_SOURCE:=
+PKG_SOURCE_URL:=
+PKG_MD5SUM:=unknown
+PATCH_DIR:=./patches-$(PKG_VERSION)
+
+define prepare_source_directory
+ rm -rf $(PKG_BUILD_DIR)
+ $(CP) $(LINUX_DIR)/drivers/staging/usbip/userspace $(PKG_BUILD_DIR)
+endef
+Hooks/Prepare/Pre += prepare_source_directory
+
+endif
+
PKG_BUILD_DEPENDS:=glib2 sysfsutils
PKG_FIXUP:=libtool autoreconf
PKG_INSTALL:=1
@@ -51,7 +73,11 @@
define Package/usbip-server
$(call Package/usbip/Default)
TITLE+= (server)
+ ifeq ($(strip $(call
CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
DEPENDS+= usbip +glib2 +kmod-usbip-server
+ else
+ DEPENDS+= usbip usbip-client +glib2 +kmod-usbip-server
+ endif
endef
define KernelPackage/usbip/Default
@@ -100,12 +126,30 @@
include $(INCLUDE_DIR)/kernel-defaults.mk
+ifeq ($(strip $(call
CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
CONFIGURE_PATH:=./src
MAKE_PATH:=./src
LIBTOOL_PATHS:=./src
+else
+define Build/Configure
+ (cd $(PKG_BUILD_DIR); ./autogen.sh );
+ $(call Build/Configure/Default)
+endef
+CONFIGURE_PATH:=.
+MAKE_PATH:=.
+LIBTOOL_PATHS:=.
+MAKE_FLAGS+=CFLAGS="-Wno-implicit-function-declaration"
+endif
CFLAGS+="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
+define Download/usb.ids
+ URL:=http://www.linux-usb.org/
+ FILE:=usb.ids
+ MD5SUM:=01a93bd6c8cce28fa70a2c4504fb0041
+endef
+$(eval $(call Download,usb.ids))
+
define Build/Compile/kmod
$(MAKE) $(KERNEL_MAKEOPTS) \
SUBDIRS="$(LINUX_DIR)/drivers/staging/usbip" \
@@ -123,6 +167,7 @@
$(call Build/Compile/kmod)
endef
+ifeq ($(strip $(call
CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
define Package/usbip/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
@@ -132,7 +177,7 @@
$(CP) \
$(PKG_INSTALL_DIR)/usr/share/usbip/usb.ids \
$(1)/usr/share/usbip/
-endef
+endif
define Package/usbip-client/install
$(INSTALL_DIR) $(1)/usr/bin
@@ -140,7 +185,6 @@
$(PKG_INSTALL_DIR)/usr/bin/usbip \
$(1)/usr/bin/
endef
-
define Package/usbip-server/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) \
@@ -150,7 +194,32 @@
$(PKG_INSTALL_DIR)/usr/bin/bind_driver \
$(1)/usr/bin/usbip_bind_driver
endef
+else
+define Package/usbip/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* \
+ $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/share/hwdata
+ $(CP) \
+ $(DL_DIR)/usb.ids \
+ $(1)/usr/share/hwdata/
+endef
+define Package/usbip-client/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/sbin/usbip \
+ $(1)/usr/sbin/
+endef
+define Package/usbip-server/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/sbin/usbipd \
+ $(1)/usr/sbin/
+endef
+endif
+
$(eval $(call BuildPackage,usbip))
$(eval $(call BuildPackage,usbip-client))
$(eval $(call BuildPackage,usbip-server))
--
Mehdi ABAAKOUK
sil...@sileht.net
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel