1
Tutorials and FAQs / Re: [Tutorial] Compile network driver
« on: May 24, 2023, 02:57:20 pm »
Hi all, thanks for the tutorial. I'm trying to compile the em intel driver using the currrent version (OPNsense 23.1.7_3, based on FreeBSD 13.1-RELEASE-p7), and I'm getting the following compilation error.
have anyone tried compiling the driver in this version?
Code: [Select]
[root@OPNsense /tmp/em-7.7.8/src]# make
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/device_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/bus_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/pci/pci_if.m -h
touch opt_global.h
Warning: Object directory not changed from original /tmp/em-7.7.8/src
cc -O2 -pipe -DINET -DINET6 -DEM_STANDALONE_BUILD -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -include /tmp/em-7.7.8/src/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -MD -MF.depend.if_em.o -MTif_em.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length -mno-aes -mno-avx -std=iso9899:1999 -c if_em.c -o if_em.o
if_em.c:557:36: error: incompatible pointer types assigning to 'struct device *' from 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
adapter->dev = adapter->osdep.dev = dev;
^ ~~~
if_em.c:1295:18: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_printf(adapter->dev, "Media change is"
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:608:28: note: passing argument to parameter 'dev' here
int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
^
if_em.c:1390:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:1587:7: warning: variable 'ifp' set but not used [-Wunused-but-set-variable]
if_t ifp;
^
if_em.c:1917:17: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_printf(adapter->dev, "Unsupported media type\n");
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:608:28: note: passing argument to parameter 'dev' here
int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
^
if_em.c:2278:10: error: implicit declaration of function 'if_multiaddr_count' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
mcnt = if_multiaddr_count(ifp, MAX_NUM_MULTICAST_ADDRESSES);
^
if_em.c:2317:2: error: implicit declaration of function 'if_multiaddr_array' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if_multiaddr_array(ifp, mta, &mcnt, MAX_NUM_MULTICAST_ADDRESSES);
^
if_em.c:2395:16: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_printf(adapter->dev, "Watchdog timeout Queue[%d]-- resetting\n",
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:608:28: note: passing argument to parameter 'dev' here
int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
^
if_em.c:2411:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2532:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2557:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2586:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2612:26: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_get_nameunit(adapter->dev));
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:594:42: note: passing argument to parameter 'dev' here
const char *device_get_nameunit(device_t dev);
^
if_em.c:2618:26: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_get_nameunit(adapter->dev));
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:594:42: note: passing argument to parameter 'dev' here
const char *device_get_nameunit(device_t dev);
^
if_em.c:2643:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2685:27: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_get_nameunit(adapter->dev), cpu_id);
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:594:42: note: passing argument to parameter 'dev' here
const char *device_get_nameunit(device_t dev);
^
if_em.c:2728:27: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_get_nameunit(adapter->dev), cpu_id);
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:594:42: note: passing argument to parameter 'dev' here
const char *device_get_nameunit(device_t dev);
^
if_em.c:2772:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2852:11: error: incompatible pointer types initializing 'device_t' (aka 'struct _device *') with an expression of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
device_t dev = adapter->dev;
^ ~~~~~~~~~~~~
if_em.c:2874:32: error: incompatible pointer types passing 'struct device *' to parameter of type 'device_t' (aka 'struct _device *') [-Werror,-Wincompatible-pointer-types]
device_printf(adapter->dev,
^~~~~~~~~~~~
/usr/src/sys/sys/bus.h:608:28: note: passing argument to parameter 'dev' here
int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
*** Error code 1
Stop.
make: stopped in /tmp/em-7.7.8/src
have anyone tried compiling the driver in this version?