Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Nov 2011 09:42:33 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Monthadar Al Jaberi <monthadar@gmail.com>
Cc:        freebsd-mips@FreeBSD.org
Subject:   Re: Cross compiling module
Message-ID:  <F3365D29-47B7-4DDD-8CE8-DD7758785249@bsdimp.com>
In-Reply-To: <CA%2BsBSoK0jYhZj=4kjdNp40yyWR7_dQHuv3DsXe6ihb%2Bd81WOWw@mail.gmail.com>
References:  <CA%2BsBSoK0jYhZj=4kjdNp40yyWR7_dQHuv3DsXe6ihb%2Bd81WOWw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Nov 21, 2011, at 6:28 AM, Monthadar Al Jaberi wrote:

> Hi!
>=20
> Not sure if this is the right place :)
>=20
> I have written a kernel module with the following Makefile:
> .PATH:	${.CURDIR}/src
>=20
> # Declare Name of kernel module
> KMOD    =3D moduletest
>=20
> # Enumerate Source files for kernel module
> SRCS    =3D  module.c
>=20
> # Include kernel module makefile
> .include <bsd.kmod.mk>
>=20
> then
> cd  /usr/src
> make TARGET=3Dmips TARGET_ARCH=3Dmipseb buildenv

I usually do

make buildenv
(puts you into a subshell)
cd /root/mymodule
make

> cd /root/mymodule
> make
>=20
> but I get the following error:

I'm surprised you got the mips compiler.  What's your environment look =
like?  What's @ pointing to?

Warner

> Warning: Object directory not changed from original /root/mymodule
> cc -O -pipe -G0 -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -I. -I@
> -I@/contrib/altq -finline-limit=3D8000
> --param inline-unit-growth=3D100 --param large-function-growth=3D1000
> -fno-common  -G0 -fno-pic -mno-abicalls
> -mlong-calls  -msoft-float -ffreestanding -std=3Diso9899:1999 -Wall
> -Wredundant-decls -Wnested-externs -Wstrict-prototypes
>  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
> -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
> -fdiagnostics-show-option -c /root/src/mymodule/src/module.c
> In file included from ./machine/bus.h:76,
>                 from /root/mymodule/module.c:57:
> ./machine/_bus.h:37:26: error: opt_cputype.h: No such file or =
directory
> *** Error code 1
>=20
> Stop in /root/mymodule.
>=20
>=20
> $ which cc
> /usr/obj/mips.mipseb/usr/src/tmp/usr/bin/cc
>=20
> $find /usr -name "opt_cputype.h"
> ...
> /usr/obj/mips.mipseb/usr/src/sys/RSPRO_NFS/opt_cputype.h
>=20
> if I add:
> CFLAGS+=3D-I/usr/obj/mips.mipseb/usr/src/sys/RSPRO_NFS
>=20
> it works now, seems like I am missing something?
>=20
> br,
>=20
> --=20
> Monthadar Al Jaberi
> _______________________________________________
> freebsd-mips@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-mips
> To unsubscribe, send any mail to =
"freebsd-mips-unsubscribe@freebsd.org"
>=20
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F3365D29-47B7-4DDD-8CE8-DD7758785249>