Nico Huber has submitted this change. ( https://review.coreboot.org/c/flashrom/+/58627 )
Change subject: Makefile: Revise build options for Linux specific headers ......................................................................
Makefile: Revise build options for Linux specific headers
Clean up the feature target by outsourcing the test to an own variable. Change the print output and don't write to the build-details file.
This is in preparation for further changes.
Change-Id: I18fc27252afb49fa7d1f2787faee2b5b669275aa Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/58627 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M Makefile A Makefile.d/linux_i2c_test.c A Makefile.d/linux_mtd_test.c A Makefile.d/linux_spi_test.c M Makefile.include 5 files changed, 48 insertions(+), 82 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/Makefile b/Makefile index bf363de..9af625e 100644 --- a/Makefile +++ b/Makefile @@ -170,6 +170,9 @@
HAS_UTSNAME := $(call c_compile_test, Makefile.d/utsname_test.c) HAS_CLOCK_GETTIME := $(call c_compile_test, Makefile.d/clock_gettime_test.c) +HAS_LINUX_MTD := $(call c_compile_test, Makefile.d/linux_mtd_test.c) +HAS_LINUX_SPI := $(call c_compile_test, Makefile.d/linux_spi_test.c) +HAS_LINUX_I2C := $(call c_compile_test, Makefile.d/linux_i2c_test.c)
ifeq ($(TARGET_OS), $(filter $(TARGET_OS), FreeBSD OpenBSD DragonFlyBSD)) override CPPFLAGS += -I/usr/local/include @@ -239,9 +242,15 @@ $(call mark_unsupported,$(DEPENDS_ON_LIBUSB1) $(DEPENDS_ON_LIBFTDI) $(DEPENDS_ON_LIBJAYLINK)) endif
-# Android is handled internally as separate OS, but it supports about the same drivers as Linux. -ifneq ($(TARGET_OS), $(filter $(TARGET_OS), Linux Android)) -$(call mark_unsupported,CONFIG_LINUX_MTD CONFIG_LINUX_SPI) +ifeq ($(HAS_LINUX_MTD), no) +$(call mark_unsupported,CONFIG_LINUX_MTD) +endif + +ifeq ($(HAS_LINUX_SPI), no) +$(call mark_unsupported,CONFIG_LINUX_SPI) +endif + +ifeq ($(HAS_LINUX_I2C), no) $(call mark_unsupported,CONFIG_MSTARDDC_SPI CONFIG_LSPCON_I2C_SPI CONFIG_REALTEK_MST_I2C_SPI) endif
@@ -250,10 +259,6 @@ $(call mark_unsupported,CONFIG_RAYER_SPI) endif
-ifeq ($(TARGET_OS), Linux) -CONFIG_LINUX_I2C_HELPER = yes -endif - # Disable the internal programmer on unsupported architectures (everything but x86 and mipsel) ifneq ($(ARCH)-little, $(filter $(ARCH), x86 mips)-$(ENDIAN)) $(call mark_unsupported,CONFIG_INTERNAL) @@ -679,21 +684,17 @@ endif
ifeq ($(CONFIG_LINUX_MTD), yes) -# This is a totally ugly hack. -FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_MTD_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_MTD=1'") +FEATURE_CFLAGS += -D'CONFIG_LINUX_MTD=1' PROGRAMMER_OBJS += linux_mtd.o endif
ifeq ($(CONFIG_LINUX_SPI), yes) -# This is a totally ugly hack. -FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'") +FEATURE_CFLAGS += -D'CONFIG_LINUX_SPI=1' PROGRAMMER_OBJS += linux_spi.o endif
ifeq ($(CONFIG_MSTARDDC_SPI), yes) -# This is a totally ugly hack. -FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'") -NEED_LINUX_I2C += CONFIG_MSTARDDC_SPI +FEATURE_CFLAGS += -D'CONFIG_MSTARDDC_SPI=1' PROGRAMMER_OBJS += mstarddc_spi.o endif
@@ -741,7 +742,7 @@ PROGRAMMER_OBJS += ni845x_spi.o endif
-ifeq ($(CONFIG_LINUX_I2C_HELPER), yes) +ifeq ($(HAS_LINUX_I2C), yes) LIB_OBJS += i2c_helper_linux.o endif
@@ -1023,33 +1024,6 @@ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) } \ 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) endif -ifeq ($(CONFIG_LINUX_MTD), yes) - @printf "Checking if Linux MTD headers are present... " | tee -a $(BUILD_DETAILS_FILE) - @echo "$$LINUX_MTD_TEST" > .featuretest.c - @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE) - @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \ - ( echo "yes."; echo "LINUX_MTD_SUPPORT := yes" >> .features.tmp ) || \ - ( echo "no."; echo "LINUX_MTD_SUPPORT := no" >> .features.tmp ) } \ - 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) -endif -ifeq ($(CONFIG_LINUX_SPI), yes) - @printf "Checking if Linux SPI headers are present... " | tee -a $(BUILD_DETAILS_FILE) - @echo "$$LINUX_SPI_TEST" > .featuretest.c - @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE) - @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \ - ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \ - ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) } \ - 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) -endif -ifneq ($(NEED_LINUX_I2C), ) - @printf "Checking if Linux I2C headers are present... " | tee -a $(BUILD_DETAILS_FILE) - @echo "$$LINUX_I2C_TEST" > .featuretest.c - @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE) - @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \ - ( echo "yes."; echo "LINUX_I2C_SUPPORT := yes" >> .features.tmp ) || \ - ( echo "no."; echo "LINUX_I2C_SUPPORT := no" >> .features.tmp ) } \ - 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) -endif ifeq ($(CONFIG_NI845X_SPI), yes) @printf "Checking for NI USB-845x installation... " | tee -a $(BUILD_DETAILS_FILE) @echo "$$NI845X_TEST" > .featuretest.c @@ -1066,10 +1040,14 @@ exit 1; }; } \ 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1 endif - @echo "Checking for header "sys/utsname.h": $(HAS_UTSNAME)" - @echo "Checking for function "clock_gettime": $(HAS_CLOCK_GETTIME)" @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX) + @echo "Checking for header "mtd/mtd-user.h": $(HAS_LINUX_MTD)" + @echo "Checking for header "linux/spi/spidev.h": $(HAS_LINUX_SPI)" + @echo "Checking for header "linux/i2c-dev.h": $(HAS_LINUX_I2C)" + @echo "Checking for header "linux/i2c.h": $(HAS_LINUX_I2C)" + @echo "Checking for header "sys/utsname.h": $(HAS_UTSNAME)" + @echo "Checking for function "clock_gettime": $(HAS_CLOCK_GETTIME)"
$(PROGRAM).8.html: $(PROGRAM).8 @groff -mandoc -Thtml $< >$@ diff --git a/Makefile.d/linux_i2c_test.c b/Makefile.d/linux_i2c_test.c new file mode 100644 index 0000000..768226b --- /dev/null +++ b/Makefile.d/linux_i2c_test.c @@ -0,0 +1,9 @@ +#include <linux/i2c-dev.h> +#include <linux/i2c.h> + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + return 0; +} diff --git a/Makefile.d/linux_mtd_test.c b/Makefile.d/linux_mtd_test.c new file mode 100644 index 0000000..d254e24 --- /dev/null +++ b/Makefile.d/linux_mtd_test.c @@ -0,0 +1,8 @@ +#include <mtd/mtd-user.h> + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + return 0; +} diff --git a/Makefile.d/linux_spi_test.c b/Makefile.d/linux_spi_test.c new file mode 100644 index 0000000..a4d2657 --- /dev/null +++ b/Makefile.d/linux_spi_test.c @@ -0,0 +1,9 @@ +#include <linux/types.h> +#include <linux/spi/spidev.h> + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + return 0; +} diff --git a/Makefile.include b/Makefile.include index 0ea1234..dccc69d 100644 --- a/Makefile.include +++ b/Makefile.include @@ -130,44 +130,6 @@ endef export FTDI_232H_TEST
-define LINUX_MTD_TEST -#include <mtd/mtd-user.h> - -int main(int argc, char **argv) -{ - (void) argc; - (void) argv; - return 0; -} -endef -export LINUX_MTD_TEST - -define LINUX_SPI_TEST -#include <linux/types.h> -#include <linux/spi/spidev.h> - -int main(int argc, char **argv) -{ - (void) argc; - (void) argv; - return 0; -} -endef -export LINUX_SPI_TEST - -define LINUX_I2C_TEST -#include <linux/i2c-dev.h> -#include <linux/i2c.h> - -int main(int argc, char **argv) -{ - (void) argc; - (void) argv; - return 0; -} -endef -export LINUX_I2C_TEST - define NI845X_TEST #include <ni845x.h>
5 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.