These are the current changes required for running flashrom on Windows. You will need DirectIO for Windows (To be released soon) Signed-off-by: Stefan Reinauer Index: flash.h =================================================================== --- flash.h (revision 671) +++ flash.h (working copy) @@ -30,7 +30,11 @@ #include #include #include +#ifdef __MINGW32_VERSION +#include "directio.h" +#else #include +#endif /* for iopl and outb under Solaris */ #if defined (__sun) && (defined(__i386) || defined(__amd64)) Index: serprog.c =================================================================== --- serprog.c (revision 671) +++ serprog.c (working copy) @@ -23,18 +23,21 @@ #include #include #include + +#if SERPROG_SUPPORT == 1 #include #include #include #include #include #include +#include +#endif #include #include #include #include #include -#include #include "flash.h" char *serprog_param = NULL; Index: physmap.c =================================================================== --- physmap.c (revision 671) +++ physmap.c (working copy) @@ -24,6 +24,21 @@ #include #include "flash.h" +#ifdef __MINGW32_VERSION +#define MEM_DEV "DirectIO" + +void *sys_physmap(unsigned long phys_addr, size_t len) +{ + return map_physical_addr_range(phys_addr, len); +} + +void physunmap(void *virt_addr, size_t len) +{ + unmap_physical_addr_range(virt_addr, len); +} + + +#else #ifdef __DARWIN__ #include @@ -77,6 +92,7 @@ munmap(virt_addr, len); } #endif +#endif void *physmap(const char *descr, unsigned long phys_addr, size_t len) { Index: Makefile =================================================================== --- Makefile (revision 671) +++ Makefile (working copy) @@ -19,7 +19,7 @@ PROGRAM = flashrom -CC ?= gcc +CC = gcc STRIP = strip INSTALL = install DIFF = diff @@ -41,7 +41,11 @@ LDFLAGS += -L/usr/local/lib endif +ifeq ($(OS), Windows_NT) +LIBS += -L. -ldirectio +else LIBS += -lpci -lz +endif OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \ sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o \ @@ -68,8 +72,10 @@ $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS) FEATURE_CFLAGS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'") -# Always enable serprog for now. Needs to be disabled on Windows. + +ifneq ($(OS), Windows_NT) FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1' +endif FEATURE_LIBS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-lftdi") @@ -102,6 +108,7 @@ rm -f .test.c .test; exit 1) @rm -f .test.c .test +ifneq ($(OS), Windows_NT) pciutils: compiler @printf "Checking for pciutils and zlib... " @$(shell ( echo "#include "; \ @@ -114,6 +121,7 @@ echo "See README for more information."; echo; \ rm -f .test.c .test; exit 1) @rm -f .test.c .test +endif .features: features Index: cbtable.c =================================================================== --- cbtable.c (revision 671) +++ cbtable.c (working copy) @@ -205,8 +205,15 @@ start = forward->forward; start &= ~(getpagesize() - 1); physunmap(table_area, BYTES_TO_MAP); +#if defined(__MINGW32_VERSION) + /* For some reason MINGW/directio does not like + * mapping the high table area yet + */ + lb_table=NULL; +#else table_area = physmap("high tables", start, BYTES_TO_MAP); lb_table = find_lb_table(table_area, 0x00000, 0x1000); +#endif } }