1################################################################################ 2# 3# spidev_test 4# 5################################################################################ 6 7# Build the latest version that is compatible with the toolchain's kernel headers 8# v3.15+ requires SPI_TX_QUAD/SPI_RX_QUAD to build 9# Normally kernel headers can't be newer than kernel so switch based on that. 10# If you need quad-pumped spi support you need to upgrade your toolchain. 11# Note that the location of spidev_test.c changes from v4.5 onwards. 12 13ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_8),y) 14SPIDEV_TEST_VERSION = 5.8 15SPIDEV_TEST_PATH = tools/spi 16else ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15),y) 17SPIDEV_TEST_VERSION = 4.10 18SPIDEV_TEST_PATH = tools/spi 19else 20SPIDEV_TEST_VERSION = 3.0 21SPIDEV_TEST_PATH = Documentation/spi 22endif 23 24SPIDEV_TEST_SITE = http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/$(SPIDEV_TEST_PATH) 25SPIDEV_TEST_SOURCE = spidev_test.c?id=v$(SPIDEV_TEST_VERSION) 26SPIDEV_TEST_LICENSE = GPL-2.0 27 28# musl libc requires linux/ioctl.h for _IOC_SIZEBITS. Do a sed patch to keep 29# compatibility with different spidev_test.c versions that we support. 30define SPIDEV_TEST_ADD_LINUX_IOCTL 31 $(SED) 's~^#include <sys/ioctl.h>~#include <sys/ioctl.h>\n#include <linux/ioctl.h>~' \ 32 $(@D)/spidev_test.c 33endef 34 35SPIDEV_TEST_POST_PATCH_HOOKS += SPIDEV_TEST_ADD_LINUX_IOCTL 36 37define SPIDEV_TEST_EXTRACT_CMDS 38 cp $(SPIDEV_TEST_DL_DIR)/$(SPIDEV_TEST_SOURCE) $(@D)/spidev_test.c 39endef 40 41define SPIDEV_TEST_BUILD_CMDS 42 $(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) \ 43 -o $(@D)/spidev_test $(@D)/spidev_test.c 44endef 45 46define SPIDEV_TEST_INSTALL_TARGET_CMDS 47 $(INSTALL) -D -m 755 $(@D)/spidev_test \ 48 $(TARGET_DIR)/usr/sbin/spidev_test 49endef 50 51$(eval $(generic-package)) 52