All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test)
@ 2023-03-27 13:59 Luca Ceresoli via buildroot
  2023-03-27 14:52 ` Herve Codina via buildroot
  2023-03-28 19:56 ` Yann E. MORIN
  0 siblings, 2 replies; 4+ messages in thread
From: Luca Ceresoli via buildroot @ 2023-03-27 13:59 UTC (permalink / raw)
  To: buildroot; +Cc: Herve Codina, Luca Ceresoli, Yann E . MORIN, Thomas Petazzoni

Extend the linux-tools package to also build the userspace USB tools, which
currently include testusb and ffs-test.

These tools are in the kernel tree since a long time, but a Makefile was
added only in 5.9 to allow building in the same way as other tools provided
with the kernel. Here we use the Makefile and thus version >= 5.9 is
required. Support for older kernels may be added later if needed.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

---

Changes in v2:

 - Use ALL_TARGETS to select tools to build and install instead of the ugly
   removal logic
---
 DEVELOPERS                                    |  1 +
 package/linux-tools/Config.in                 | 26 ++++++++++++++
 package/linux-tools/linux-tool-usbtools.mk.in | 34 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-usbtools.mk.in

diff --git a/DEVELOPERS b/DEVELOPERS
index b6d288c54fa9..67c6004ddf2e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1874,6 +1874,7 @@ F:	configs/zynqmp_zcu106_defconfig
 F:	package/agentpp/
 F:	package/exim/
 F:	package/libpjsip/
+F:	package/linux-tools/linux-tool-usbtools.mk.in
 F:	package/qpid-proton/
 F:	package/rtl8188eu/
 F:	package/snmppp/
diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index 8a0b6d5802cc..451b0eeff5bb 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -135,6 +135,32 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS and a toolchain w/ dyna
 	depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS || \
 		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
 
+config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
+	bool "USB test programs"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  Build and install the USB test tools.
+
+	  These tools exist since Linux 2.6.35, but Buildroot can build
+	  them only with kernel versions 5.9 and later.
+
+if BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
+
+config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB
+	bool "testusb"
+	help
+	  testusb issues ioctls to perform the tests implemented by the
+	  kernel driver.  It can generate a variety of transfer
+	  patterns.
+
+	  See http://www.linux-usb.org/usbtest/
+
+config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST
+	bool "ffs-test"
+	help
+	  User mode filesystem api for usb composite function
+endif
+
 config BR2_PACKAGE_LINUX_TOOLS_TMON
 	bool "tmon"
 	depends on BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/linux-tools/linux-tool-usbtools.mk.in b/package/linux-tools/linux-tool-usbtools.mk.in
new file mode 100644
index 000000000000..797758adce51
--- /dev/null
+++ b/package/linux-tools/linux-tool-usbtools.mk.in
@@ -0,0 +1,34 @@
+################################################################################
+#
+# usbtools
+#
+################################################################################
+
+LINUX_TOOLS += usbtools
+
+USBTOOLS_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
+
+LINUX_TOOLS_USBTOOLS_LIST = \
+	$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB),testusb) \
+	$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST),ffs-test)
+
+define USBTOOLS_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/usb/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old to build the USB tools." ; \
+		echo "At least kernel 5.9 must be used." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
+		ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
+		$(USBTOOLS_MAKE_OPTS) \
+		all
+endef
+
+define USBTOOLS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
+		ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
+		$(USBTOOLS_MAKE_OPTS) \
+		DESTDIR=$(TARGET_DIR) \
+		install
+endef
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test)
  2023-03-27 13:59 [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test) Luca Ceresoli via buildroot
@ 2023-03-27 14:52 ` Herve Codina via buildroot
  2023-03-28 19:56 ` Yann E. MORIN
  1 sibling, 0 replies; 4+ messages in thread
From: Herve Codina via buildroot @ 2023-03-27 14:52 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: Yann E . MORIN, Thomas Petazzoni, buildroot

Hi Luca,

On Mon, 27 Mar 2023 15:59:48 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:

> Extend the linux-tools package to also build the userspace USB tools, which
> currently include testusb and ffs-test.
> 
> These tools are in the kernel tree since a long time, but a Makefile was
> added only in 5.9 to allow building in the same way as other tools provided
> with the kernel. Here we use the Makefile and thus version >= 5.9 is
> required. Support for older kernels may be added later if needed.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> 
> ---
> 
> Changes in v2:
> 
>  - Use ALL_TARGETS to select tools to build and install instead of the ugly
>    removal logic
> ---
>  DEVELOPERS                                    |  1 +
>  package/linux-tools/Config.in                 | 26 ++++++++++++++
>  package/linux-tools/linux-tool-usbtools.mk.in | 34 +++++++++++++++++++
>  3 files changed, 61 insertions(+)
>  create mode 100644 package/linux-tools/linux-tool-usbtools.mk.in
> 

Thanks for this v2.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test)
  2023-03-27 13:59 [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test) Luca Ceresoli via buildroot
  2023-03-27 14:52 ` Herve Codina via buildroot
@ 2023-03-28 19:56 ` Yann E. MORIN
  2023-03-29  6:43   ` Luca Ceresoli via buildroot
  1 sibling, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2023-03-28 19:56 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: Herve Codina, Thomas Petazzoni, buildroot

Luca, All,

On 2023-03-27 15:59 +0200, Luca Ceresoli spake thusly:
> Extend the linux-tools package to also build the userspace USB tools, which
> currently include testusb and ffs-test.
> 
> These tools are in the kernel tree since a long time, but a Makefile was
> added only in 5.9 to allow building in the same way as other tools provided

That is not entirely correct.

The Makefile itself has been present since 2.6.39, but indeed only
gained an install rule for 5.9:

    4f22ce7045c1  2011-02-17  USB: tools: Add a Makefile
    9ca325ffcac4  2020-08-19  tools: usb: move to tools buildsystem

So I've tweaked the commit log accordingly.

> with the kernel. Here we use the Makefile and thus version >= 5.9 is
> required. Support for older kernels may be added later if needed.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> 
> Changes in v2:
> 
>  - Use ALL_TARGETS to select tools to build and install instead of the ugly
>    removal logic
> ---
>  DEVELOPERS                                    |  1 +
>  package/linux-tools/Config.in                 | 26 ++++++++++++++
>  package/linux-tools/linux-tool-usbtools.mk.in | 34 +++++++++++++++++++
>  3 files changed, 61 insertions(+)
>  create mode 100644 package/linux-tools/linux-tool-usbtools.mk.in
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index b6d288c54fa9..67c6004ddf2e 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1874,6 +1874,7 @@ F:	configs/zynqmp_zcu106_defconfig
>  F:	package/agentpp/
>  F:	package/exim/
>  F:	package/libpjsip/
> +F:	package/linux-tools/linux-tool-usbtools.mk.in
>  F:	package/qpid-proton/
>  F:	package/rtl8188eu/
>  F:	package/snmppp/
> diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
> index 8a0b6d5802cc..451b0eeff5bb 100644
> --- a/package/linux-tools/Config.in
> +++ b/package/linux-tools/Config.in
> @@ -135,6 +135,32 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS and a toolchain w/ dyna
>  	depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS || \
>  		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
>  
> +config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
> +	bool "USB test programs"
> +	select BR2_PACKAGE_LINUX_TOOLS
> +	help
> +	  Build and install the USB test tools.
> +
> +	  These tools exist since Linux 2.6.35, but Buildroot can build
> +	  them only with kernel versions 5.9 and later.
> +
> +if BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
> +
> +config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB
> +	bool "testusb"
> +	help
> +	  testusb issues ioctls to perform the tests implemented by the
> +	  kernel driver.  It can generate a variety of transfer
> +	  patterns.
> +
> +	  See http://www.linux-usb.org/usbtest/
> +
> +config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST
> +	bool "ffs-test"
> +	help
> +	  User mode filesystem api for usb composite function
> +endif
> +
>  config BR2_PACKAGE_LINUX_TOOLS_TMON
>  	bool "tmon"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/linux-tools/linux-tool-usbtools.mk.in b/package/linux-tools/linux-tool-usbtools.mk.in
> new file mode 100644
> index 000000000000..797758adce51
> --- /dev/null
> +++ b/package/linux-tools/linux-tool-usbtools.mk.in
> @@ -0,0 +1,34 @@
> +################################################################################
> +#
> +# usbtools
> +#
> +################################################################################
> +
> +LINUX_TOOLS += usbtools
> +
> +USBTOOLS_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
> +
> +LINUX_TOOLS_USBTOOLS_LIST = \
> +	$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB),testusb) \
> +	$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST),ffs-test)
> +
> +define USBTOOLS_BUILD_CMDS
> +	$(Q)if ! grep install $(LINUX_DIR)/tools/usb/Makefile >/dev/null 2>&1 ; then \
> +		echo "Your kernel version is too old to build the USB tools." ; \
> +		echo "At least kernel 5.9 must be used." ; \
> +		exit 1 ; \
> +	fi
> +
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
> +		ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
> +		$(USBTOOLS_MAKE_OPTS) \
> +		all
> +endef
> +
> +define USBTOOLS_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
> +		ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
> +		$(USBTOOLS_MAKE_OPTS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		install
> +endef
> -- 
> 2.34.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test)
  2023-03-28 19:56 ` Yann E. MORIN
@ 2023-03-29  6:43   ` Luca Ceresoli via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Luca Ceresoli via buildroot @ 2023-03-29  6:43 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Herve Codina, Thomas Petazzoni, buildroot

Hi Yann,

On Tue, 28 Mar 2023 21:56:59 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Luca, All,
> 
> On 2023-03-27 15:59 +0200, Luca Ceresoli spake thusly:
> > Extend the linux-tools package to also build the userspace USB tools, which
> > currently include testusb and ffs-test.
> > 
> > These tools are in the kernel tree since a long time, but a Makefile was
> > added only in 5.9 to allow building in the same way as other tools provided  
> 
> That is not entirely correct.
> 
> The Makefile itself has been present since 2.6.39, but indeed only
> gained an install rule for 5.9:
> 
>     4f22ce7045c1  2011-02-17  USB: tools: Add a Makefile
>     9ca325ffcac4  2020-08-19  tools: usb: move to tools buildsystem
> 
> So I've tweaked the commit log accordingly.

I think the original sentence somehow had the same meaning, even though
it would possibly take a lawyer to prove that... Your rewrite is way
more clear (and fun). Thanks!

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-29  6:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 13:59 [Buildroot] [PATCH v2] package/linux-tools: add USB tools (testusb and ffs-test) Luca Ceresoli via buildroot
2023-03-27 14:52 ` Herve Codina via buildroot
2023-03-28 19:56 ` Yann E. MORIN
2023-03-29  6:43   ` Luca Ceresoli via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.