On Fri, 9 Mar 2012 23:13:24 +0400 "Andrey V. Bondarenko" avbondarenko@gmail.com wrote:
Hello,
I downloaded flashrom-0.9.5.2.tar.bz2. The flashrom does not compile. I think the problem is in SPI of kernel CentOS 5, the log of compilation is below. The kernel is 2.6.18-274.18.1.el5. I didn't find the file linux/spi/spidev.h. How can I compile flashrom without SPI?
Log:
Checking for a C compiler... found. Target arch is x86 Target OS is Linux Checking for libpci headers... found. Checking if libpci is present and sufficient... yes. Checking for FTDI support... not found. Checking for utsname support... found. cc -MMD -Os -Wall -Wshadow -Werror -D'CONFIG_INTERNAL=1' -D'CONFIG_SERPROG=1' -D'CONFIG_RAYER_SPI=1' -D'CONFIG_BITBANG_SPI=1' -D'CONFIG_NIC3COM=1' -D'CONFIG_GFXNVIDIA=1' -D'CONFIG_SATASII=1' -D'CONFIG_DUMMY=1' -D'CONFIG_DRKAISER=1' -D'CONFIG_NICREALTEK=1' -D'CONFIG_NICINTEL=1' -D'CONFIG_NICINTEL_SPI=1' -D'CONFIG_OGP_SPI=1' -D'CONFIG_BUSPIRATE_SPI=1' -D'CONFIG_SATAMV=1' -D'CONFIG_LINUX_SPI=1' -D'NEED_PCI=1' -D'HAVE_UTSNAME=1' -D'FLASHROM_VERSION="0.9.5.2-r1515"' -o linux_spi.o -c linux_spi.c linux_spi.c:27:30: error: linux/spi/spidev.h: No such file or directory linux_spi.c: In function 'linux_spi_init': linux_spi.c:62: error: 'SPI_MODE_0' undeclared (first use in this function) linux_spi.c:62: error: (Each undeclared identifier is reported only once linux_spi.c:62: error: for each function it appears in.) linux_spi.c:93: error: 'SPI_IOC_WR_MAX_SPEED_HZ' undeclared (first use in this function) linux_spi.c:102: error: 'SPI_IOC_WR_MODE' undeclared (first use in this function) linux_spi.c:108: error: 'SPI_IOC_WR_BITS_PER_WORD' undeclared (first use in this function) linux_spi.c: In function 'linux_spi_send_command': linux_spi.c:134: error: array type has incomplete element type linux_spi.c:136: error: field name not in record or union initializer linux_spi.c:136: error: (near initialization for 'msg') linux_spi.c:137: error: field name not in record or union initializer linux_spi.c:137: error: (near initialization for 'msg') linux_spi.c:140: error: field name not in record or union initializer linux_spi.c:140: error: (near initialization for 'msg') linux_spi.c:141: error: field name not in record or union initializer linux_spi.c:141: error: (near initialization for 'msg') cc1: warnings being treated as errors linux_spi.c:155: warning: implicit declaration of function 'SPI_IOC_MESSAGE' linux_spi.c:134: warning: unused variable 'msg' make: *** [linux_spi.o] Error 1
P.S. Was the problem solved with Asus P8B-E/4 (see email in end)?
hello,
sorry! we did merge the linux_spi support without adding a proper check for the linux headers. we will fix that soonish until then you can compile flashrom with the following command without linux_spi support but with all other programmers that are enabled by default: make CONFIG_INTERNAL=yes CONFIG_SERPROG=yes CONFIG_RAYER_SPI=yes CONFIG_BITBANG_SPI=yes CONFIG_NIC3COM=yes CONFIG_GFXNVIDIA=yes CONFIG_SATASII=yes CONFIG_FT2232_SPI=yes CONFIG_DUMMY=yes CONFIG_DRKAISER=yes CONFIG_NICREALTEK=yes CONFIG_NICINTEL=yes CONFIG_NICINTEL_SPI=yes CONFIG_OGP_SPI=yes CONFIG_BUSPIRATE_SPI=yes CONFIG_SATAMV=yes CONFIG_LINUX_SPI=no
the problem with the locked ME is not solved yet, sorry.
Hello,
Thank you for prompt feedback.
10 марта 2012 г. 14:26 пользователь Stefan Tauner < stefan.tauner@student.tuwien.ac.at> написал:
On Fri, 9 Mar 2012 23:13:24 +0400 "Andrey V. Bondarenko" avbondarenko@gmail.com wrote:
Hello,
I downloaded flashrom-0.9.5.2.tar.bz2. The flashrom does not compile. I think the problem is in SPI of kernel CentOS 5, the log of compilation is below. The kernel is 2.6.18-274.18.1.el5. I didn't find the file linux/spi/spidev.h. How can I compile flashrom without SPI?
Log:
Checking for a C compiler... found. Target arch is x86 Target OS is Linux Checking for libpci headers... found. Checking if libpci is present and sufficient... yes. Checking for FTDI support... not found. Checking for utsname support... found. cc -MMD -Os -Wall -Wshadow -Werror -D'CONFIG_INTERNAL=1' -D'CONFIG_SERPROG=1' -D'CONFIG_RAYER_SPI=1' -D'CONFIG_BITBANG_SPI=1' -D'CONFIG_NIC3COM=1' -D'CONFIG_GFXNVIDIA=1' -D'CONFIG_SATASII=1' -D'CONFIG_DUMMY=1' -D'CONFIG_DRKAISER=1' -D'CONFIG_NICREALTEK=1' -D'CONFIG_NICINTEL=1' -D'CONFIG_NICINTEL_SPI=1' -D'CONFIG_OGP_SPI=1' -D'CONFIG_BUSPIRATE_SPI=1' -D'CONFIG_SATAMV=1' -D'CONFIG_LINUX_SPI=1' -D'NEED_PCI=1' -D'HAVE_UTSNAME=1' -D'FLASHROM_VERSION="0.9.5.2-r1515"' -o linux_spi.o -c linux_spi.c linux_spi.c:27:30: error: linux/spi/spidev.h: No such file or directory linux_spi.c: In function 'linux_spi_init': linux_spi.c:62: error: 'SPI_MODE_0' undeclared (first use in this
function)
linux_spi.c:62: error: (Each undeclared identifier is reported only once linux_spi.c:62: error: for each function it appears in.) linux_spi.c:93: error: 'SPI_IOC_WR_MAX_SPEED_HZ' undeclared (first use in this function) linux_spi.c:102: error: 'SPI_IOC_WR_MODE' undeclared (first use in this function) linux_spi.c:108: error: 'SPI_IOC_WR_BITS_PER_WORD' undeclared (first use
in
this function) linux_spi.c: In function 'linux_spi_send_command': linux_spi.c:134: error: array type has incomplete element type linux_spi.c:136: error: field name not in record or union initializer linux_spi.c:136: error: (near initialization for 'msg') linux_spi.c:137: error: field name not in record or union initializer linux_spi.c:137: error: (near initialization for 'msg') linux_spi.c:140: error: field name not in record or union initializer linux_spi.c:140: error: (near initialization for 'msg') linux_spi.c:141: error: field name not in record or union initializer linux_spi.c:141: error: (near initialization for 'msg') cc1: warnings being treated as errors linux_spi.c:155: warning: implicit declaration of function
'SPI_IOC_MESSAGE'
linux_spi.c:134: warning: unused variable 'msg' make: *** [linux_spi.o] Error 1
P.S. Was the problem solved with Asus P8B-E/4 (see email in end)?
hello,
sorry! we did merge the linux_spi support without adding a proper check for the linux headers. we will fix that soonish until then you can compile flashrom with the following command without linux_spi support but with all other programmers that are enabled by default: make CONFIG_INTERNAL=yes CONFIG_SERPROG=yes CONFIG_RAYER_SPI=yes CONFIG_BITBANG_SPI=yes CONFIG_NIC3COM=yes CONFIG_GFXNVIDIA=yes CONFIG_SATASII=yes CONFIG_FT2232_SPI=yes CONFIG_DUMMY=yes CONFIG_DRKAISER=yes CONFIG_NICREALTEK=yes CONFIG_NICINTEL=yes CONFIG_NICINTEL_SPI=yes CONFIG_OGP_SPI=yes CONFIG_BUSPIRATE_SPI=yes CONFIG_SATAMV=yes CONFIG_LINUX_SPI=no
the problem with the locked ME is not solved yet, sorry.
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
On Sat, 10 Mar 2012 11:26:23 +0100 Stefan Tauner stefan.tauner@student.tuwien.ac.at wrote:
you can compile flashrom with the following command without linux_spi support but with all other programmers that are enabled by default: make CONFIG_INTERNAL=yes CONFIG_SERPROG=yes CONFIG_RAYER_SPI=yes CONFIG_BITBANG_SPI=yes CONFIG_NIC3COM=yes CONFIG_GFXNVIDIA=yes CONFIG_SATASII=yes CONFIG_FT2232_SPI=yes CONFIG_DUMMY=yes CONFIG_DRKAISER=yes CONFIG_NICREALTEK=yes CONFIG_NICINTEL=yes CONFIG_NICINTEL_SPI=yes CONFIG_OGP_SPI=yes CONFIG_BUSPIRATE_SPI=yes CONFIG_SATAMV=yes CONFIG_LINUX_SPI=no
or just make CONFIG_LINUX_SPI=no oops. :)
This solution is copied from ft2232_spi and is equally hacky. Thanks to M.K. for investigating the history of <linux/spi/spidev.h>, which led to a hopefully more robust check.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- Andrey could you please test this patch? It should disable linux_spi if it can not find valid headers and compilation of flashrom should then succeed without the need of specifying CONFIG_LINUX_SPI=no.
Makefile | 23 ++++++++++++++++++++++- linux_spi.c | 5 +++++ 2 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index c921a74..4de89e0 100644 --- a/Makefile +++ b/Makefile @@ -485,7 +485,8 @@ NEED_PCI := yes endif
ifeq ($(CONFIG_LINUX_SPI), yes) -FEATURE_CFLAGS += -D'CONFIG_LINUX_SPI=1' +# This is a totally ugly hack. +FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'") PROGRAMMER_OBJS += linux_spi.o endif
@@ -671,6 +672,19 @@ int main(int argc, char **argv) endef export UTSNAME_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 + features: compiler @echo "FEATURES := yes" > .features.tmp ifeq ($(CONFIG_FT2232_SPI), yes) @@ -680,6 +694,13 @@ ifeq ($(CONFIG_FT2232_SPI), yes) ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) endif +ifeq ($(CONFIG_LINUX_SPI), yes) + @printf "Checking if Linux SPI headers are present... " + @echo "$$LINUX_SPI_TEST" > .featuretest.c + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ + ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \ + ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) +endif @printf "Checking for utsname support... " @echo "$$UTSNAME_TEST" > .featuretest.c @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ diff --git a/linux_spi.c b/linux_spi.c index 17d003e..f4d30c9 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#if CONFIG_LINUX_SPI == 1 + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -24,6 +26,7 @@ #include <errno.h> #include <ctype.h> #include <unistd.h> +#include <linux/types.h> #include <linux/spi/spidev.h> #include <sys/ioctl.h> #include "flash.h" @@ -176,3 +179,5 @@ static int linux_spi_write_256(struct flashctx *flash, uint8_t *buf, return spi_write_chunked(flash, buf, start, len, ((unsigned int)getpagesize()) - 4); } + +#endif // CONFIG_LINUX_SPI == 1