Author
Message
duy.ipad DD-WRT Novice Joined: 03 Jan 2014 Posts: 11
Posted: Fri Jan 03, 2014 18:16 Post subject: How can i build a standalone kernel modules?
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.
Back to top
Sponsor
BrainSlayer Site Admin Joined: 06 Jun 2006 Posts: 7492 Location: Dresden, Germany
Posted: Fri Jan 03, 2014 21:38 Post subject:
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
Back to top
duy.ipad DD-WRT Novice Joined: 03 Jan 2014 Posts: 11
Posted: Sat Jan 04, 2014 11:22 Post subject:
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.
Back to top
duy.ipad DD-WRT Novice Joined: 03 Jan 2014 Posts: 11
Posted: Sun Jan 05, 2014 9:26 Post subject:
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
Back to top