[openwrt/openwrt] sdk: add spidev-test to the bundle of userspace sources

LEDE Commits lede-commits at lists.infradead.org
Fri Jul 22 15:56:03 PDT 2022


chunkeey pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/41e0dc5db9c508d794714f6bc1f2d0fbeb3e0e70

commit 41e0dc5db9c508d794714f6bc1f2d0fbeb3e0e70
Author: Christian Lamparter <chunkeey at gmail.com>
AuthorDate: Sat Jul 16 01:34:44 2022 +0200

    sdk: add spidev-test to the bundle of userspace sources
    
    moves and extends the current facilities, which have been
    added some time ago for the the usbip utility, to support
    more utilites that are shipped with the Linux kernel tree
    to the SDK.
    
    this allows to drop all the hand-waving and code for
    failed previous attempts to mitigate the SDK build failures.
    
    Fixes: bdaaf66e28bd ("utils/spidev_test: build package directly from Linux")
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
    (cherry picked from commit b479db9062b721776be44b976961a1031c1344ea)
    (cherry picked from commit eb8d0da88a0dcf7f10f05ad10c48e3a691f5a8d1)
---
 package/utils/spidev_test/Makefile |  5 +++--
 target/sdk/Makefile                | 15 +++++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/package/utils/spidev_test/Makefile b/package/utils/spidev_test/Makefile
index 0f288ad010..fef5c8f646 100644
--- a/package/utils/spidev_test/Makefile
+++ b/package/utils/spidev_test/Makefile
@@ -10,7 +10,6 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=spidev-test
 PKG_RELEASE:=$(LINUX_VERSION)
-PKG_FLAGS:=nonshared
 PKG_BUILD_DIR:=$(LINUX_DIR)/tools/spi-$(TARGET_DIR_NAME)
 PKG_BUILD_PARALLEL:=1
 
@@ -19,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/spidev-test
   SECTION:=utils
   CATEGORY:=Utilities
-  DEPENDS:=+kmod-spi-dev @!IN_SDK
+  DEPENDS:=+kmod-spi-dev
   TITLE:=SPI testing utility
   VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
   URL:=http://www.kernel.org
@@ -30,6 +29,8 @@ define Package/spidev-test/description
 endef
 
 define Build/Prepare
+	# For SDK: Sources are copied by target/sdk/Makefile's
+	# USERSPACE_UTILS(_FILES)
 	$(CP) $(LINUX_DIR)/tools/spi/* $(PKG_BUILD_DIR)/
 endef
 
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 0606621192..be7e1ebf51 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -82,6 +82,18 @@ KERNEL_FILES_BASE := \
 
 KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE))))
 
+# The kernel source hosts various userspace utilities sources.
+# These are packaged separately from the kernel and kernel modules.
+# The source has to be included here to be buildable by the SDK.
+#
+USERSPACE_UTILS_FILES := \
+	tools/build \
+	tools/scripts \
+	tools/usb/usbip \
+	tools/spi
+
+USERSPACE_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(USERSPACE_UTILS_FILES))))
+
 all: compile
 
 $(BIN_DIR)/$(SDK_NAME).tar.xz: clean
@@ -100,8 +112,7 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean
 		$(SDK_DIRS) $(KERNEL_FILES) | \
 		$(TAR) -xf - -C $(SDK_BUILD_DIR)
 
-	# Copy usbip sources, this is required for the usbip userspace packages to be buildable by the SDK.
-	$(TAR) -cf - -C $(TOPDIR) $(KDIR_BASE)/tools/usb/usbip/ | \
+	$(TAR) -cf - -C $(TOPDIR) $(USERSPACE_FILES) | \
 		$(TAR) -xf - -C $(SDK_BUILD_DIR)
 
 	(cd $(SDK_BUILD_DIR); find $(STAGING_SUBDIR_HOST)/bin $(STAGING_SUBDIR_HOST)/usr/bin \




More information about the lede-commits mailing list