----- Original Message ----
From: Felix Fietkau <n...@openwrt.org>
To: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
Sent: Fri, February 19, 2010 10:14:42 AM
Subject: Re: [OpenWrt-Devel] Compiling outside of buildroot

On 2010-02-19 2:53 PM, David Farrell wrote:
> After OpenWrt was built and installed I wanted to add my own program, 
> ie compile "hello world" and run it. I created a make that points to 
> ./kamikaze/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1
> and uses mips-openwrt-linux-uclibc-gcc and other tools. 
> All build, compile and run are fine.
> Now I want to build a loadable kernel module. With a desktop this is 
> easy obj-m += module.o /lib/modules/<kernel-rev->/build etc.
> How do I do the same using the buildroot created toolchain and kernel?
> I don't see a ../build directory. I assume I point some kernel sources 
> that provide the linux "make" macro expansion but I am not sure where to look.
> I don't want to add my module to the OpenWrt build,
> I just want to treat the OpenWrt system as a general purpose embedded linux 
> box.
Two possibilities:

a) You read about how the Linux kernel is cross compiled, how to build
external kernel module trees and so on using variables like
CROSS_COMPILE, ARCH, M, ...
The kernel sources are in build_dir/linux-*/linux-*/.
You can put the toolchain dir into your PATH and call the make commands
there (pointing at your external tree), either manually or with your
wrapper makefile.

b) You realize that cross-compiling an external kernel module is much
easier with OpenWrt, and simply copy a package dir like
package/spi-ks8995 and adjust it for your own kernel module, then run
make oldconfig and then run make package/<yourpackage>/compile V=99 ;)

- Felix

I have several projects than were originally built for TS-5500 boards from 
T-Systems.
I modified my makefiles slightly to build them using tools created by the 
OpenWrt
build. All is fine for the bulk of the projects.  There are a couple places 
that I use
loadable modules, in the past I only used kernel headers to build them. My 
projects
have nothing to do with wireless or routers, I wanted to stay out of the 
OpenWrt tree.
I also wanted to locate the projects in an area where I can build for my old 
design,
linux desktop or or the new mips based design.  I guess I am trying to leverage 
the
fine work the OpenWrt group has done and make use of the latest tools and kernel
it provides.  I think I will probably try your b) case with V=99 and see what 
gets done.
Thanks,
David.


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to