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
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to