* [Buildroot] [PATCHv3] spidev_test: new package
@ 2014-10-24 16:56 Gustavo Zacarias
2014-10-25 8:55 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Zacarias @ 2014-10-24 16:56 UTC (permalink / raw)
To: buildroot
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/Config.in | 1 +
package/spidev_test/Config.in | 17 +++++++++++++++++
package/spidev_test/spidev_test.mk | 32 ++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 package/spidev_test/Config.in
create mode 100644 package/spidev_test/spidev_test.mk
diff --git a/package/Config.in b/package/Config.in
index b0d8a80..a5d4dc9 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -85,6 +85,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"
diff --git a/package/spidev_test/Config.in b/package/spidev_test/Config.in
new file mode 100644
index 0000000..0d8214c
--- /dev/null
+++ b/package/spidev_test/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_SPIDEV_TEST
+ bool "spidev_test"
+ 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 suitable options enabled to allow a
+ proper operation of 'spidev_test'.
+
+ The version used is based on your toolchain headers version,
+ if it's older than 3.15 then 3.0 is used, otherwise 3.15
+ is used.
+ This means you won't have quad-pumped SPI support if your
+ toolchain is too old.
+
+ https://www.kernel.org/doc/Documentation/spi/spidev_test.c
diff --git a/package/spidev_test/spidev_test.mk b/package/spidev_test/spidev_test.mk
new file mode 100644
index 0000000..767d369
--- /dev/null
+++ b/package/spidev_test/spidev_test.mk
@@ -0,0 +1,32 @@
+################################################################################
+#
+# spidev_test
+#
+################################################################################
+
+# v3.15+ requires SPI_TX_QUAD/SPI_RX_QUAD to build
+# Normally kernel headers can't be newer than kernel so switch based on that.
+# If you need quad-pumped spi support you need to upgrade your toolchain.
+ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15),y)
+SPIDEV_TEST_VERSION = v3.15
+else
+SPIDEV_TEST_VERSION = v3.0
+endif
+SPIDEV_TEST_SITE = http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi
+SPIDEV_TEST_SOURCE = spidev_test.c?id=$(SPIDEV_TEST_VERSION)
+SPIDEV_TEST_LICENSE = GPLv2
+
+# Downloaded file is C source
+SPIDEV_TEST_EXTRACT_CMDS =
+
+define SPIDEV_TEST_BUILD_CMDS
+ $(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) -x c \
+ -o $(@D)/spidev_test $(BR2_DL_DIR)/$(SPIDEV_TEST_SOURCE)
+endef
+
+define SPIDEV_TEST_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 755 $(@D)/spidev_test \
+ $(TARGET_DIR)/usr/sbin/spidev_test
+endef
+
+$(eval $(generic-package))
--
2.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCHv3] spidev_test: new package
2014-10-24 16:56 [Buildroot] [PATCHv3] spidev_test: new package Gustavo Zacarias
@ 2014-10-25 8:55 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2014-10-25 8:55 UTC (permalink / raw)
To: buildroot
Dear Gustavo Zacarias,
On Fri, 24 Oct 2014 13:56:10 -0300, Gustavo Zacarias wrote:
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
> package/Config.in | 1 +
> package/spidev_test/Config.in | 17 +++++++++++++++++
> package/spidev_test/spidev_test.mk | 32 ++++++++++++++++++++++++++++++++
> 3 files changed, 50 insertions(+)
> create mode 100644 package/spidev_test/Config.in
> create mode 100644 package/spidev_test/spidev_test.mk
Applied, after doing a small change, see below.
> +# Downloaded file is C source
> +SPIDEV_TEST_EXTRACT_CMDS =
> +
> +define SPIDEV_TEST_BUILD_CMDS
> + $(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) -x c \
> + -o $(@D)/spidev_test $(BR2_DL_DIR)/$(SPIDEV_TEST_SOURCE)
> +endef
I've chosen to actually implement SPIDEV_TEST_EXTRACT_CMDS by copying
the source file from $(BR2_DL_DIR) to $(@D). This allows to have
patches applied on spidev_test, or to do some manual tweaks (for
testing) in the build directory and rebuild the package. Consequently,
I've dropped the "-x c" option since the file is now copied with a .c
extension.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-25 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 16:56 [Buildroot] [PATCHv3] spidev_test: new package Gustavo Zacarias
2014-10-25 8:55 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox