How can i build a standalone kernel modules?

Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions
Author Message
duy.ipad
DD-WRT Novice


Joined: 03 Jan 2014
Posts: 11

PostPosted: Fri Jan 03, 2014 18:16    Post subject: How can i build a standalone kernel modules? Reply with quote
I would like to write my custom kernel modules but I cannot "make" it.

My source filename is "hellomodule.c".
My Makefile is:
Code:
obj-m = hellomodule.o
KERNEL_HEADER:=~/linux.v24
CROSS_COMPILE_PATH:=~/toolchain/toolchain-mipsel_3.3.6_BRCM24/bin/mipsel-linux-uclibc-
all:
   clear
   make ARCH=mips CROSS_COMPILE=$(CROSS_COMPILE_PATH) -C $(KERNEL_HEADER) M=$(PWD) modules
clean:
   clear
   make ARCH=mips CROSS_COMPILE=$(CROSS_COMPILE_PATH) -C $(KERNEL_HEADER) M=$(PWD) clean


* "~/linux.v24" is downloaded from svn
* "~/toolchain/toolchain-mipsel_3.3.6_BRCM24/bin/mipsel-linux-uclibc-" is downloaded from "https://secure.dd-wrt.com/dd-wrtv2/downloads/others/sourcecode/toolchains/current-toolchains.tar.bz2".

//My router is WRT54GL

Thank you.
Sponsor
BrainSlayer
Site Admin


Joined: 06 Jun 2006
Posts: 7492
Location: Dresden, Germany

PostPosted: Fri Jan 03, 2014 21:38    Post subject: Reply with quote
you missed to post your error. i dont see any compile log here. what i see is that you're using a symbolic link to your kernel. use always absolute paths
_________________
"So you tried to use the computer and it started smoking? Sounds like a Mac to me.." - Louis Rossmann https://www.youtube.com/watch?v=eL_5YDRWqGE&t=60s
duy.ipad
DD-WRT Novice


Joined: 03 Jan 2014
Posts: 11

PostPosted: Sat Jan 04, 2014 11:22    Post subject: Reply with quote
I've tried to compile new kernel via "svn co svn://svn.dd-wrt.com/DD-WRT/src/linux/brcm/linux.v24_2" but when I "make dep" it was an error:
Code:

make -C brcm fastdep
make: Entering an unknown directory
make: *** brcm: No such file or directory.  Stop.
make: Leaving an unknown directory
make[5]: *** [_sfdep_brcm] Error 2
make[5]: Leaving directory `/home/ubuntu/linux.v24_2/drivers/net'
make[4]: *** [fastdep] Error 2
make[4]: Leaving directory `/home/ubuntu/linux.v24_2/drivers/net'
make[3]: *** [_sfdep_net] Error 2
make[3]: Leaving directory `/home/ubuntu/linux.v24_2/drivers'
make[2]: *** [fastdep] Error 2
make[2]: Leaving directory `/home/ubuntu/linux.v24_2/drivers'
make[1]: *** [_sfdep_drivers] Error 2
make[1]: Leaving directory `/home/ubuntu/linux.v24_2'
make: *** [dep-files] Error 2


Thank you.
duy.ipad
DD-WRT Novice


Joined: 03 Jan 2014
Posts: 11

PostPosted: Sun Jan 05, 2014 9:26    Post subject: Reply with quote
duy.ipad wrote:
I've tried to compile new kernel via "svn co svn://svn.dd-wrt.com/DD-WRT/src/linux/brcm/linux.v24_2" but when I "make dep" it was an error:
Code:
make -C brcm fastdep
make: Entering an unknown directory
make: *** brcm: No such file or directory.  Stop.
make: Leaving an unknown directory
make[5]: *** [_sfdep_brcm] Error 2
make[5]: Leaving directory `/home/ubuntu/linux.v24_2/drivers/net'
make[4]: *** [fastdep] Error 2
make[4]: Leaving directory `/home/ubuntu/linux.v24_2/drivers/net'
make[3]: *** [_sfdep_net] Error 2
make[3]: Leaving directory `/home/ubuntu/linux.v24_2/drivers'
make[2]: *** [fastdep] Error 2
make[2]: Leaving directory `/home/ubuntu/linux.v24_2/drivers'
make[1]: *** [_sfdep_drivers] Error 2
make[1]: Leaving directory `/home/ubuntu/linux.v24_2'
make: *** [dep-files] Error 2


Thank you.


Thanks you for your reply.

I've changed my Makefile:
Code:
obj-m = hellomodule.o
KERNEL_HEADER   := /home/ubuntu/linux.v24
ARCH      := mips
all:
   make ARCH=$(ARCH) -C $(KERNEL_HEADER) SUBDIRS=$(PWD) modules
clean:
   make ARCH=$(ARCH) -C $(KERNEL_HEADER) SUBDIRS=$(PWD) clean


When I ran "make", there was an error:
Code:
make ARCH=mips -C /home/ubuntu/linux.v24 SUBDIRS=/home/ubuntu/Desktop/hello modules
make[1]: Entering directory `/home/ubuntu/linux.v24'
make -C  /home/ubuntu/Desktop/hello CFLAGS="-D__KERNEL__ -I/home/ubuntu/linux.v24/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-builtin-strpbrk -fno-builtin-sprintf -fomit-frame-pointer   -fno-delayed-branch  -I /home/ubuntu/linux.v24/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -DBCMGPIO2  -finline-limit=100000 -O2 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -DMODULE -mlong-calls -fno-common" MAKING_MODULES=1 modules
make[2]: Entering directory `/home/ubuntu/Desktop/hello'
make[2]: *** No rule to make target `modules'.  Stop.
make[2]: Leaving directory `/home/ubuntu/Desktop/hello'
make[1]: *** [_mod_/home/ubuntu/Desktop/hello] Error 2
make[1]: Leaving directory `/home/ubuntu/linux.v24'
make: *** [all] Error 2
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum