summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2011-07-03 19:44:12 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2011-07-03 19:44:12 +0000
commitd5e85d674b512b542c5e0f1b383b1cf5a0e2f6b8 (patch)
tree5069863aa7d5100dfc18010d20f19fd8d8df2884
parent10b3e228703c8d5b42555a60954daf3ea01c2f16 (diff)
downloadast2050-flashrom-d5e85d674b512b542c5e0f1b383b1cf5a0e2f6b8.zip
ast2050-flashrom-d5e85d674b512b542c5e0f1b383b1cf5a0e2f6b8.tar.gz
Fix and improve Windows/MinGW/MSYS build
- Makefile: Use $(OS_ARCH) to add some MinGW-specific workarounds and settings, so that a simple "make" is sufficient on MinGW (instead of manual Makefile hacking). - Explicitly set CC=gcc in the Makefile, otherwise you get an error like "cc: command not found" on MinGW. - MinGW doesn't have ffs(), use gcc's __builtin_ffs() instead. - Add /usr/local/include and /usr/local/lib to CPPFLAGS/LDFLAGS, that's where libusb-win32 and libftdi stuff is usually placed on MinGW/MSYS. - Disable serprog (no sockets) and all PCI-based programmers (no libpci) for now. That leaves dummy, ft2232_spi, and buspirate_spi enabled on MinGW per default. - serial.c: Use correct type for 'tmp', both on Windows/MinGW (DWORD) and POSIX (ssize_t). Corresponding to flashrom svn r1363. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
-rw-r--r--Makefile82
-rw-r--r--serial.c12
2 files changed, 92 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 456c6ae..ea61fb0 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,88 @@ override CONFIG_FT2232_SPI = no
endif
endif
+ifeq ($(OS_ARCH), MINGW32_NT-5.1)
+# Explicitly set CC = gcc on MinGW, otherwise: "cc: command not found".
+CC = gcc
+# MinGW doesn't have the ffs() function, but we can use gcc's __builtin_ffs().
+CFLAGS += -Dffs=__builtin_ffs
+# libusb-win32/libftdi stuff is usually installed in /usr/local.
+CPPFLAGS += -I/usr/local/include
+LDFLAGS += -L/usr/local/lib
+# Serprog is not supported under Windows/MinGW (missing sockets support).
+ifeq ($(CONFIG_SERPROG), yes)
+UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
+else
+override CONFIG_SERPROG = no
+endif
+# For now we disable all PCI-based programmers on Windows/MinGW (no libpci).
+ifeq ($(CONFIG_INTERNAL), yes)
+UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
+else
+override CONFIG_INTERNAL = no
+endif
+ifeq ($(CONFIG_RAYER_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
+else
+override CONFIG_RAYER_SPI = no
+endif
+ifeq ($(CONFIG_NIC3COM), yes)
+UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
+else
+override CONFIG_NIC3COM = no
+endif
+ifeq ($(CONFIG_GFXNVIDIA), yes)
+UNSUPPORTED_FEATURES += CONFIG_GFXNVIDIA=yes
+else
+override CONFIG_GFXNVIDIA = no
+endif
+ifeq ($(CONFIG_SATASII), yes)
+UNSUPPORTED_FEATURES += CONFIG_SATASII=yes
+else
+override CONFIG_SATASII = no
+endif
+ifeq ($(CONFIG_ATAHPT), yes)
+UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
+else
+override CONFIG_ATAHPT = no
+endif
+ifeq ($(CONFIG_DRKAISER), yes)
+UNSUPPORTED_FEATURES += CONFIG_DRKAISER=yes
+else
+override CONFIG_DRKAISER = no
+endif
+ifeq ($(CONFIG_NICREALTEK), yes)
+UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
+else
+override CONFIG_NICREALTEK = no
+endif
+ifeq ($(CONFIG_NICNATSEMI), yes)
+UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
+else
+override CONFIG_NICNATSEMI = no
+endif
+ifeq ($(CONFIG_NICINTEL), yes)
+UNSUPPORTED_FEATURES += CONFIG_NICINTEL=yes
+else
+override CONFIG_NICINTEL = no
+endif
+ifeq ($(CONFIG_NICINTEL_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_NICINTEL_SPI=yes
+else
+override CONFIG_NICINTEL_SPI = no
+endif
+ifeq ($(CONFIG_OGP_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_OGP_SPI=yes
+else
+override CONFIG_OGP_SPI = no
+endif
+ifeq ($(CONFIG_SATAMV), yes)
+UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
+else
+override CONFIG_SATAMV = no
+endif
+endif
+
ifeq ($(OS_ARCH), libpayload)
CC:=CC=i386-elf-gcc lpgcc
AR:=i386-elf-ar
diff --git a/serial.c b/serial.c
index 37ea422..5cc2fe0 100644
--- a/serial.c
+++ b/serial.c
@@ -192,7 +192,11 @@ int serialport_shutdown(void *data)
int serialport_write(unsigned char *buf, unsigned int writecnt)
{
- long tmp = 0;
+#ifdef _WIN32
+ DWORD tmp = 0;
+#else
+ ssize_t tmp = 0;
+#endif
while (writecnt > 0) {
#ifdef _WIN32
@@ -215,7 +219,11 @@ int serialport_write(unsigned char *buf, unsigned int writecnt)
int serialport_read(unsigned char *buf, unsigned int readcnt)
{
- long tmp = 0;
+#ifdef _WIN32
+ DWORD tmp = 0;
+#else
+ ssize_t tmp = 0;
+#endif
while (readcnt > 0) {
#ifdef _WIN32
OpenPOWER on IntegriCloud