From 9abf529387ad68171d76f7bb9a6e665a68d0e891 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Fri, 1 May 2009 16:34:32 +0000 Subject: Allow compilation on Solaris Fix compilation on Solaris and tell people how to compile flashrom on Solaris, Darwin/Mac OS X and DragonFly BSD. Thanks to Joerg Schilling and Patrick Georgi for the Solaris part. Corresponding to flashrom svn r452. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Peter Stuge --- README | 11 +++++++++++ flash.h | 18 ++++++++++++++++++ flashrom.c | 7 ------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/README b/README index 70abe0a..b9a253a 100644 --- a/README +++ b/README @@ -21,6 +21,17 @@ To build the flashrom utility you need to install the following packages: * pciutils-devel / pciutils-dev / libpci-dev * zlib-devel / zlib1g-dev +To compile on Solaris, use the commands below: +gmake LDFLAGS="-L$pathtolibpci -lpci -lz" CC="gcc -I$pathtopciheaders" CFLAGS=-O2 + +To compile on DragonFly BSD, use the commands below: +ln -s /usr/pkg/include/pciutils pci +gmake CFLAGS=-I. LDFLAGS="-L/usr/pkg/lib -lpci -lz" + +To compile and run on Darwin/Mac OS X: +Install DirectIO from coresystems GmbH. +DirectIO is available at http://www.coresystems.de/en/directio + Usage / Options --------------- diff --git a/flash.h b/flash.h index c50ba30..f49b808 100644 --- a/flash.h +++ b/flash.h @@ -30,6 +30,14 @@ #include #include +/* for iopl and outb under Solaris */ +#if defined (__sun) && (defined(__i386) || defined(__amd64)) +#include +#include +#include +#include +#endif + #if (defined(__MACH__) && defined(__APPLE__)) #define __DARWIN__ #endif @@ -50,6 +58,15 @@ #define off64_t off_t #define lseek64 lseek #endif +#if defined (__sun) && (defined(__i386) || defined(__amd64)) + /* Note different order for outb */ + #define OUTB(x,y) outb(y, x) + #define OUTW(x,y) outw(y, x) + #define OUTL(x,y) outl(y, x) + #define INB inb + #define INW inw + #define INL inl +#else #define OUTB outb #define OUTW outw #define OUTL outl @@ -57,6 +74,7 @@ #define INW inw #define INL inl #endif +#endif static inline void chip_writeb(uint8_t b, volatile void *addr) { diff --git a/flashrom.c b/flashrom.c index 36d145f..2c77ff3 100644 --- a/flashrom.c +++ b/flashrom.c @@ -30,13 +30,6 @@ #include #include #include -/* for iopl */ -#if defined (__sun) && (defined(__i386) || defined(__amd64)) -#include -#include -#include -#include -#endif #include "flash.h" char *chip_to_probe = NULL; -- cgit v1.1