Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

how towrite makefile for driver?

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..

3 Replies