Set up for compiling:
extraversion="-"$(uname -r|sed 's/[0-9].[0-9].[0-9]-//' ) # extraversion in 3.5.0-17-generic is -17-generic
mkdir ~/tmp/build/
cd ~/tmp/build/
cp /boot/config-`uname -r` .config
cp /usr/src/linux-headers-3.5.0$extraversion/Module.symvers ./
cd /usr/src/linux-source-3.5.0/
make EXTRAVERSION=$extraversion O=~/tmp/build oldconfig
make EXTRAVERSION=$extraversion O=~/tmp/build prepare
make EXTRAVERSION=$extraversion O=~/tmp/build outputmakefile
make EXTRAVERSION=$extraversion O=~/tmp/build archprepare
make EXTRAVERSION=$extraversion O=~/tmp/build modules SUBDIRS=scripts
Now you are ready. To compile module put in the folder of its location. For zd1211
make EXTRAVERSION=$extraversion O=~/tmp/build/ modules SUBDIRS=drivers/net/wireless/zd1211rw
cd into ~/tmp/build/drivers/net/wireless/zd1211rw/ to find the .ko file.
make EXTRAVERSION=-21-generic O=/usr/src/mytree modules SUBDIRS=scripts
it starts at the beginning, and compiles every single module [starting with arch/], which is what I am already doing now. Thanks anyway though. My modules are still compiling, and it has reached the zd1211rw folder, but so far there is no .ko file, just an zd1211rw.o file. I guess it makes .ko's at the end?