Patchwork update superiotool support for FreeBSD

login
register
about
Submitter Idwer Vollering
Date 2010-10-17 16:37:27
Message ID <AANLkTim8UG39Ou5X2=_1Ho9V=4soJx1GrraReNaa4Prk@mail.gmail.com>
Download mbox | patch
Permalink /patch/2128/
State Superseded
Delegated to: Warren Turkal
Headers show

Comments

Idwer Vollering - 2010-10-17 16:37:27
Update support for FreeBSD.

Signed-off-by: Idwer Vollering <vidwer@gmail.com>

---

FreeBSD support already existed but doesn't compile without errors on my
fbsd 8.1 machine:

$ gmake
gcc -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing
-Werror-implicit-function-declaration -ansi -pedantic
-D'SUPERIOTOOL_VERSION="5728"' -DPCI_SUPPORT   -c -o superiotool.o
superiotool.c
In file included from superiotool.c:24:
superiotool.h:41:21: error: pci/pci.h: No such file or directory
superiotool.c: In function 'main':
superiotool.c:302: error: implicit declaration of function 'pci_alloc'
cc1: warnings being treated as errors
superiotool.c:302: warning: assignment makes pointer from integer without a
cast
superiotool.c:303: error: implicit declaration of function 'pci_init'
superiotool.c:304: error: implicit declaration of function 'pci_scan_bus'
gmake: *** [superiotool.o] Error 1
Warren Turkal - 2010-10-18 05:32:04
On Sunday, October 17, 2010 09:37:27 am Idwer Vollering wrote:
> Update support for FreeBSD.
> 
> Signed-off-by: Idwer Vollering <vidwer@gmail.com>

A few questions:
* Would it be better set LIBS to -lz and make LDFLAGS default to $(LIBS) on 
all platforms?
* I thought that FreeBSD used GCC?
 - If so, why remove -ansi and -pedantic on FreeBSD?
 - In either case, would it be better to replace -ansi with something like -
std=c90 on all platforms and leave -pedantic? Would that be enough to work?

Thanks,
wt
Andriy Gapon - 2010-10-18 05:40:31
on 17/10/2010 19:37 Idwer Vollering said the following:
> Update support for FreeBSD.
> 
> Signed-off-by: Idwer Vollering <vidwer@gmail.com <mailto:vidwer@gmail.com>>

BTW: http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/superiotool/
Idwer Vollering - 2010-10-18 14:26:39
2010/10/18 Andriy Gapon <avg@icyb.net.ua>

> on 17/10/2010 19:37 Idwer Vollering said the following:
> > Update support for FreeBSD.
> >
> > Signed-off-by: Idwer Vollering <vidwer@gmail.com <mailto:
> vidwer@gmail.com>>
>
> BTW: http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/superiotool/
>

I know of its existence, yes.
Once you have devel/gmake and devel/libpci installed from ports, you can
(with this patch applied) just run gmake. Like you can with flashrom.


> --
> Andriy Gapon
>

Patch

Index: Makefile
===================================================================
--- Makefile	(revision 5954)
+++ Makefile	(working copy)
@@ -39,6 +39,13 @@ 
 ifeq ($(OS_ARCH), Darwin)
 LIBS = -framework IOKit -framework DirectIO -lpci -lz
 endif
+ifeq ($(OS_ARCH), FreeBSD)
+CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
+         -Werror-implicit-function-declaration $(SVNDEF) \
+         -I/usr/local/include
+LDFLAGS += -L/usr/local/lib
+LIBS = -lz
+endif
 
 # Support for PCI-attached "Super I/Os" (e.g. in VIA VT82686A/B).
 CONFIG_PCI = yes