Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

how towrite makefile for driver?

Altera_Forum
Honored Contributor II
1,068 Views

hello friend 

 

i am using nios IDE.i have written module.c and makefile like 

 

CODE: 

 

ifneq ($(KERNELRELEASE),)# kbuild part of makefile 

obj-m := module.o 

else# Normal Makefile 

ARCH := nios2nommu 

CROSS_COMPILE := nios2-elf- 

 

KERNEL_PLUGIN:= /cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0 

KERNELDIR := $(KERNEL_PLUGIN)/linux-2.6.x 

BUILDDIR := /cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/workspace/jay_07_07/build/include 

 

all:: 

$(MAKE) -C $(KERNELDIR) M=`pwd` O=$(BUILDDIR) modules 

 

endif 

 

and i copy module.c and makefile in my linux application project. 

but when i build it then i get following messege on ide console.. 

 

make -k all  

make -C /cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x M=`pwd` O=/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/workspace/jay_07_07/build/include modules 

make[1]: Entering directory `/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x' 

/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/Makefile:486: .config: No such file or directory 

/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/Makefile:531: /cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/arch/i386/Makefile: No such file or directory 

gcc: not found 

gcc: not found 

make[2]: *** No rule to make target `/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/arch/i386/Makefile'. 

make[2]: Failed to remake makefile `/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/arch/i386/Makefile'. 

CC [M] /cygdrive/e/working_file/test_07_07/module.o 

gcc: not found 

make[3]: *** [/cygdrive/e/working_file/test_07_07/module.o] Error 127 

make[3]: Target `__build' not remade because of errors. 

make[2]: *** [_module_/cygdrive/e/working_file/test_07_07] Error 2 

make[2]: Target `modules' not remade because of errors. 

make[1]: *** [modules] Error 2 

make[1]: Leaving directory `/cygdrive/d/TOOLS/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x' 

make: *** [all] Error 2 

 

 

 

please help me what i have to next..
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
380 Views

 

--- Quote Start ---  

originally posted by helmchen@Jul 7 2006, 08:02 PM 

well look in the forum 

 

http://forum.niosforum.com/forum/index.php...wtopic=2655&hl= (http://forum.niosforum.com/forum/index.php?showtopic=2655&hl=

 

http://forum.niosforum.com/forum/index.php...wtopic=2411&hl= (http://forum.niosforum.com/forum/index.php?showtopic=2411&hl=

 

this has already been done by a lot people. 

 

good luck 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16713) 

--- quote end ---  

 

--- Quote End ---  

 

 

 

hi helmchen 

 

i have folowed your given lonk.and i got module.ko. 

then i have include module.ko in filesystem-romfs(/home) then using nios ide ,i have generated romfs.bin. 

i have load romfs and kernel on my board,but when i try to instole module it is 

not allowing to it,it is giving following mess. 

 

none) login: nios2 

nios2 

Password: uClinux 

 

# cd /bin  

cd /bin # ls 

ls 

agetty busybox cat echo expand init kill login  

ls mount ps pwd sh sync umount # cd .. 

cd ..# cd home 

cd home# ls 

ls 

ftp module.ko # busybox insmode module.ko 

busybox insmode module.ko 

insmode: applet not found#  

 

where am i wrong? please help me .
0 Kudos
Altera_Forum
Honored Contributor II
380 Views

Nice to see that you were sucessfull. 

try insmod instead of insmode. 

 

In addition i would propose to make a ftp connection to transfer your files (programs and module) on your board. It is much easier than to include the new file to your filesystem and upload to your board again and again and again and again... :-).  

 

nfs would work, too.
0 Kudos
Reply