Skip to contentSkip to conversation

spidev_test: new package

PATCH New Gustavo Zacarias 5 participants 12 messages Oct 14, 2014 – Oct 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spidev_test: new package

---
 package/Config.in                  |  1 +
 package/spidev_test/Config.in      | 15 +++++++++++++++
 package/spidev_test/spidev_test.mk | 22 ++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 package/spidev_test/Config.in
 create mode 100644 package/spidev_test/spidev_test.mk
package/Config.in +1 -0
index dda7716..fb8e93d 100644
@@ -84,6 +84,7 @@ endif
 	source "package/ramsmp/Config.in"
 	source "package/ramspeed/Config.in"
 	source "package/rt-tests/Config.in"
+	source "package/spidev_test/Config.in"
 	source "package/strace/Config.in"
 	source "package/stress/Config.in"
 	source "package/sysprof/Config.in"
package/spidev_test/Config.in new file +15 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL
+	help
+	  SPI testing utility (using spidev driver).
+
+	  This package builds and installs the userspace 'spidev_test'
+	  command. It is up to the user to ensure that the kernel
+	  configuration has all the suitable options enabled to allow a
+	  proper operation of 'spidev_test'.
+
+	  https://www.kernel.org/doc/Documentation/spi/spidev_test.c
+
+comment "spidev_test needs Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
package/spidev_test/spidev_test.mk new file +22 -0
new file mode 100644
index 0000000..24c0f89
@@ -0,0 +1,22 @@
+################################################################################
+#
+# spidev_test
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+SPIDEV_TEST_SOURCE =
+SPIDEV_TEST_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+SPIDEV_TEST_DEPENDENCIES = linux
+
+define SPIDEV_TEST_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/spidev_test \
+		$(LINUX_DIR)/Documentation/spi/spidev_test.c
+endef
+
+define SPIDEV_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/spidev_test \
+		$(TARGET_DIR)/usr/sbin/spidev_test
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/1 spidev_test: new package

Gustavo Zacarias <[email protected]> schreef:

Quoted 31 lines

---

package/Config.in                  |  1 +
package/spidev_test/Config.in      | 15 +++++++++++++++
package/spidev_test/spidev_test.mk | 22 ++++++++++++++++++++++
3 files changed, 38 insertions(+)

create mode 100644 package/spidev_test/Config.in create mode 100644 package/spidev_test/spidev_test.mk

package/Config.in +1 -0
index dda7716..fb8e93d 100644
@@ -84,6 +84,7 @@ endif
 	source "package/ramsmp/Config.in"
 	source "package/ramspeed/Config.in"
 	source "package/rt-tests/Config.in"
+	source "package/spidev_test/Config.in"
 	source "package/strace/Config.in"
 	source "package/stress/Config.in"
 	source "package/sysprof/Config.in"
package/spidev_test/Config.in new file +4 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL
+	help

package/spidev_test/Config.in line 14

Quoted 10 lines
package/spidev_test/Config.in new file +10 -0
+	  SPI testing utility (using spidev driver).
+
+	  This package builds and installs the userspace 'spidev_test'
+	  command. It is up to the user to ensure that the kernel
+	  configuration has all the suitable options enabled to allow a
+	  proper operation of 'spidev_test'.
+
+	  https://www.kernel.org/doc/Documentation/spi/spidev_test.c
+
+comment "spidev_test needs Linux kernel to be built"

This should be '... needs a Linux ...'

Quoted 7 lines
package/spidev_test/Config.in new file +1 -0
+	depends on !BR2_LINUX_KERNEL
package/spidev_test/spidev_test.mk new file +0 -0
new file mode 100644
index 0000000..24c0f89

package/spidev_test/spidev_test.mk line 10

Quoted 10 lines
package/spidev_test/spidev_test.mk new file +10 -0
@@ -0,0 +1,22 @@
+################################################################################
+#
+# spidev_test
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+SPIDEV_TEST_SOURCE =
+SPIDEV_TEST_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+SPIDEV_TEST_DEPENDENCIES = linux

Here I think we should define the license and if possible license files, if needed using a hook to copy the license from the kernel...

package/spidev_test/spidev_test.mk line 22

Quoted 12 lines
package/spidev_test/spidev_test.mk new file +12 -0
+
+define SPIDEV_TEST_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/spidev_test \
+		$(LINUX_DIR)/Documentation/spi/spidev_test.c
+endef
+
+define SPIDEV_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/spidev_test \
+		$(TARGET_DIR)/usr/sbin/spidev_test
+endef
+
+$(eval $(generic-package))

Good idea to make this a package. We once copied this test to our own test repo, but this makes more sense.

Best regards,
Thomas

#2 lore raw

PATCH 1/1 spidev_test: new package

Quoted 3 lines · Thomas De Schampheleire
Quoted 1 line

+comment "spidev_test needs Linux kernel to be built"

This should be '... needs a Linux ...'

I'll fix it.

Quoted 1 line

Here I think we should define the license and if possible license files, if needed using a hook to copy the license from the kernel...

Well the kernel & linux-headers aren't defining them either :) And perf (another kernel-source based package) isn't either.

Quoted 1 line

Good idea to make this a package. We once copied this test to our own test repo, but this makes more sense.

This is a "fragile" package though, a new enough kernel version against older headers might not build because of missing spidev defines. On the autobuilder side that's no problem since it depends on the kernel being built which for the time being isn't the case, but it should probably be noted as such.

Regards.

#3 lore raw

PATCH 1/1 spidev_test: new package

In reply to Gustavo Zacarias

Gustavo,

Quoted 8 lines · Gustavo Zacarias
---
 package/Config.in                  |  1 +
 package/spidev_test/Config.in      | 15 +++++++++++++++
 package/spidev_test/spidev_test.mk | 22 ++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 package/spidev_test/Config.in
 create mode 100644 package/spidev_test/spidev_test.mk

I did this exact same thing but never got around to submitting this. This is a very handy tool for checking out SPI devices from command line.

#4 lore raw

PATCH 1/1 spidev_test: new package

In reply to Gustavo Zacarias

Hi Gustavo,

Quoted 1 line · Gustavo Zacarias

[snip]

package/spidev_test/Config.in line 3

Quoted 9 lines
package/spidev_test/Config.in new file +3 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

baruch

Quoted 40 lines
package/spidev_test/Config.in new file +12 -0
+	help
+	  SPI testing utility (using spidev driver).
+
+	  This package builds and installs the userspace 'spidev_test'
+	  command. It is up to the user to ensure that the kernel
+	  configuration has all the suitable options enabled to allow a
+	  proper operation of 'spidev_test'.
+
+	  https://www.kernel.org/doc/Documentation/spi/spidev_test.c
+
+comment "spidev_test needs Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
package/spidev_test/spidev_test.mk new file +22 -0
new file mode 100644
index 0000000..24c0f89
@@ -0,0 +1,22 @@
+################################################################################
+#
+# spidev_test
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+SPIDEV_TEST_SOURCE =
+SPIDEV_TEST_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+SPIDEV_TEST_DEPENDENCIES = linux
+
+define SPIDEV_TEST_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/spidev_test \
+		$(LINUX_DIR)/Documentation/spi/spidev_test.c
+endef
+
+define SPIDEV_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/spidev_test \
+		$(TARGET_DIR)/usr/sbin/spidev_test
+endef
+
+$(eval $(generic-package))
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#5 lore raw

PATCH 1/1 spidev_test: new package

Quoted 7 lines · Baruch Siach

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

baruch

Hi Baruch.
Problem is that makes it need a newish kernel which i don't like since you can't always run the latest and greatest.
For instance i'm using it on a 3.10-ish based kernel at the moment and if i did that i wouldn't be able to use it.
I suspect the same logic will apply to other users as well. Regards.

#6 lore raw

PATCH 1/1 spidev_test: new package

Hi Gustavo,

Quoted 9 lines · Gustavo Zacarias
Quoted 7 lines · Baruch Siach

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

Quoted 5 lines

Problem is that makes it need a newish kernel which i don't like since you can't always run the latest and greatest.
For instance i'm using it on a 3.10-ish based kernel at the moment and if i did that i wouldn't be able to use it.
I suspect the same logic will apply to other users as well.

Then maybe adding a version choice would be best. spidev_test.c didn't change between v2.6.34 and v3.15, so two versions should be enough.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#7 lore raw

PATCH 1/1 spidev_test: new package

In reply to Baruch Siach

Baruch Siach <[email protected]> schreef:

Quoted 7 lines

Hi Gustavo,

Quoted 1 line · Gustavo Zacarias

[snip]

Quoted 15 lines

package/spidev_test/Config.in line 3

Quoted 9 lines
package/spidev_test/Config.in new file +3 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

From where comes this dependency on 3.15/3.17?

The test program was in the kernel for a very long time (2.6.x)...

Also, what is the autobuilder issue you are talking about?

#8 lore raw

PATCH 1/1 spidev_test: new package

Quoted 11 lines · Thomas De Schampheleire
Quoted 5 lines

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

From where comes this dependency on 3.15/3.17?

The test program was in the kernel for a very long time (2.6.x)...

Also, what is the autobuilder issue you are talking about?

SPI_RX_QUAD/SPI_TX_QUAD (quad-pumped spi).
The autobuilder issue is that older kernel headers won't have this defined (example: external toolchains with newish kernel). What Baruch proposes is probably the best solution, otherwise a ton of #ifdefs is option 2 which would probably wouldn't be acceptable upstream. Regards.

#9 lore raw

PATCH 1/1 spidev_test: new package

In reply to Thomas De Schampheleire

Hi Thomas,

Quoted 22 lines · Thomas De Schampheleire

Baruch Siach <[email protected]> schreef:

Quoted 5 lines · Gustavo Zacarias
Quoted 1 line

[snip]

Quoted 15 lines

package/spidev_test/Config.in line 3

Quoted 9 lines
package/spidev_test/Config.in new file +3 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This solves both the autobuilder issue, and the toolchain headers dependency.

Quoted 1 line

From where comes this dependency on 3.15/3.17?

Linux kernel commit c2e78c34ef0 (spi: spidev_test: Add support for Dual/Quad SPI Transfers) added a build dependency on SPI_IOC_{RD,WR}_MODE32 which is only available since v3.15.

Quoted 3 lines

The test program was in the kernel for a very long time (2.6.x)...

Also, what is the autobuilder issue you are talking about?

A dependency on BR2_LINUX_KERNEL means that the autobuilder won't build this package, since the autobuilder does not build kernels, and so never enables BR2_LINUX_KERNEL.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#10 lore raw

PATCH 1/1 spidev_test: new package

In reply to Baruch Siach

Baruch, All,

On 2014-10-14 22:54 +0300, Baruch Siach spake thusly:

Quoted 5 lines · Gustavo Zacarias
Quoted 1 line

[snip]

Quoted 14 lines

package/spidev_test/Config.in line 3

Quoted 9 lines
package/spidev_test/Config.in new file +3 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This

What about directly getting the appropriate one, something like:

    ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15),y)
    SPIDEV_TEST_VERSION = v3.15
    else
    SPIDEV_TEST_VERSION = v3.14
    endif

    SPIDEV_TEST_SOURCE =
    SPIDEV_TEST_EXTRA_DOWNLOADS = http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION)

Since, without the proper kernel headers, it is not possible to build the quad-pump blabla, we can directly get the spidev_test that will indeed compile with our toolchain, no?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

PATCH 1/1 spidev_test: new package

Hi Yann,

Quoted 32 lines · Yann E. MORIN

On 2014-10-14 22:54 +0300, Baruch Siach spake thusly:

Quoted 5 lines · Gustavo Zacarias
Quoted 1 line

[snip]

Quoted 14 lines

package/spidev_test/Config.in line 3

Quoted 9 lines
package/spidev_test/Config.in new file +3 -0
new file mode 100644
index 0000000..c0ed9ef
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SPIDEV_TEST
+	bool "spidev_test"
+	depends on BR2_LINUX_KERNEL

That is a heavy dependency. As you noted in another message, it also make the autobuilder skip this package. I suggest to download just spidev_test.c from
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION),
and make it depend on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 (as of v3.17). This

What about directly getting the appropriate one, something like:

    ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15),y)
    SPIDEV_TEST_VERSION = v3.15
    else
    SPIDEV_TEST_VERSION = v3.14
    endif

    SPIDEV_TEST_SOURCE =
    SPIDEV_TEST_EXTRA_DOWNLOADS = http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=$(SPIDEV_TEST_VERSION)
Quoted 3 lines

Since, without the proper kernel headers, it is not possible to build the quad-pump blabla, we can directly get the spidev_test that will indeed compile with our toolchain, no?

As Gustavo mentioned in another message in this thread, the newer spidev_test is also run-time dependent on kernel v3.15 or newer. An automatic spidev_test version choice would produce a broken binary for users of newer toolchains with pre v3.15 kernels. We should use BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 to disable build of v3.15 spidev_test, as this would break the build. But I don't think we want to force v3.15 spidev_test just because the toolchain kernel headers are post v3.15.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -