Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Mar 2014 15:44:43 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Martin Galvan <omgalvan.86@gmail.com>
Cc:        freebsd-arm@freebsd.org, freebsd-drivers@freebsd.org, freebsd-embedded@freebsd.org
Subject:   Re: Cross-compiling a kernel module?
Message-ID:  <20140326224443.GN60889@funkthat.com>
In-Reply-To: <CAN19L9FL=ure6FENe5=HxkOj=AzmJfks7hKsRnoZXCJxE0vfhQ@mail.gmail.com>
References:  <CAN19L9FL=ure6FENe5=HxkOj=AzmJfks7hKsRnoZXCJxE0vfhQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Martin Galvan wrote this message on Wed, Mar 26, 2014 at 18:48 -0300:
> Hi everyone! I'm trying to cross-compile a simple Hello World module for
> the A10 Cubieboard (which is ARM/Allwinner10 based) but I'm not sure of how
> to write my makefile. What I'm using to test it (on an amd64) is:
> 
> KMOD=hello
> SRCS=hello.c
> 
> .include <bsd.kmod.mk>
> 
> I've been browsing the mailing list a bit and so far I've found a way but
> it involves rebuilding the whole kernel, and I just want to compile this
> module to load/unload in runtime.
> 
> Also, before you answer this: try and be as specific as you can, since I'm
> kind of a newbie at this. Stuff like where should I put/look for files, run
> commands, etc would be appreciated.

$ cd $SRC
$ make kernel-toolchain TARGET_ARCH=armXX
$ make buildenv TARGET_ARCH=armXX BUILDENV_SHELL=/usr/local/bin/shell
$ cd <moduledir>
$ make

The buildenv command sets up the new shell with an environment that is
the same as if you were running under a buildkernel or buildworld
environment..  You can use this to build one off programs like bin/ls
too.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140326224443.GN60889>