Altera_Forum
Honored Contributor
20 years agoMakefile for simple linux device driver
Hello everyone,
i'm trying to write a device driver. It is an external driver. It should be load with insmod in an running system. My problem is, that i cannot build the module (I started with a 'Hello Kernel' sample). I have reviewed the documentation, which comes along with the linux distribution. I used following makefile source, which can be found in the doc: com.microtronix.nios2linux.kernel_1.4.0\linux-2.6.x\Documentation\kbuild\modules.txt assume this: - the compiled and build kernel is in D:\MyKernel - the new module source is in D:\MyModule - and the linux source is standard path makefile: ------------ ifneq ($(KERNELRELEASE),) # kbuild part of makefile obj-m := mymodule.o else # Normal Makefile # KERNELDIR := /lib/modules/`uname -r`/build KERNELDIR := D:/MyKernel/Build all:: $(MAKE) -C $KERNELDIR M=`pwd` $@ endif Obviously it doesn't work because it tries to build for an x86 architecture so , i set ARCH and CROSS_COMPILE references in the command line. (Note i use the nios ide, of course) But it doesn't work. Maybe i didn't understand it correctly. Does someone have a working sample? I want to use makefile, since i don't want to collect all arch-information and core-depandant in each makefile! Thank you very much.