# how fast can we cross compiling?



## hilal (Nov 23, 2010)

Hi,

I am trying to learn and play with the wlan driver for a cross compiled system. My problem is that it takes so much time to recompile everything, just because I added a printf somewhere to check things..

I have tried to add 

```
MODULES_OVERRIDE = wlan
```
in /etc/make.conf, but it still takes time... and then I also tried this:
`make -DNO_CLEAN -DNO_KERNELCONFIG -DNO_KERNELCLEAN -DNO_KERNELDEPEND buildkernel`

it still compiles some stuff again, thought I didn't change them... 

I am new to FreeBSD, but shouldn't make just recompile what is modified? 

What can I do more to speed this up? And how fast should I expect the compilation to be at best?

Thank you for any clarifications!


----------



## wblock@ (Nov 23, 2010)

make(1) does what you tell it, and buildkernel, well builds a kernel.  See /usr/src/Makefile.inc1.

If you want to rebuild just a module, change to that directory and build it alone:
`% cd /usr/src/sys/modules/wlan; make`

And then copy or whatever, depending on your cross-compile setup.


----------



## hilal (Nov 24, 2010)

The thing is wlan is built into the kernel...

but I found a another way which is fast too using KERNFAST flag instead of KERNCONF.

but I find it weird, why not just have KERNCONF and make will only compile what is changed and then link everything? what is the reason to clean everything by default? Did I miss something?

Any way here is my complete script for anyone who is interested for incremental changes:


```
setenv TARGET_BIG_ENDIAN y
setenv SRCROOT /usr/src
setenv TARGET mips
setenv TARGET_ARCH mips
setenv TARGET_CPUTYPE mips32
setenv KERNFAST RSPRO_NFS
setenv MAKEOBJDIRPREFIX /usr/just_kernel_nfs/obj
set TFTPBOOT=/usr/just_kernel_nfs/tftpboot

cd ${SRCROOT}
make buildkernel
make DESTDIR=${TFTPBOOT} installkernel
```


----------



## SirDice (Nov 24, 2010)

hilal said:
			
		

> The thing is wlan is built into the kernel...


Why don't you take it out? You're already building a custom kernel, might as well remove this so it'll be a module.


----------



## hilal (Nov 24, 2010)

SirDice said:
			
		

> Why don't you take it out? You're already building a custom kernel, might as well remove this so it'll be a module.



Dont know, no specific reason, but I declare it in the kernel configuration... anyway KERNFAST is what I was searching for


----------



## SIFE (Nov 24, 2010)

Try ccache.


----------

