Try something like this, replacing the linux version with the one you have:
gcc -Wall -D__KERNEL__ -DMODULE -I/usr/src/linux-2.6.28-11-generic/include -O -g -I.. -c -o trendchip.o trendchip.c
Also, here is a generic Makefile.
Put Makefile in the source's directory and enter
make
Code:
# obj-m is a list of what kernel modules to build. The .o and other
# objects will be automatically built from the corresponding .c file -
# no need to list the source files explicitly.
obj-m := trendchip.o
# KDIR is the location of the kernel source. The current standard is
# to link to the associated source tree from the directory containing
# the compiled modules.
KDIR := /lib/modules/$(shell uname -r)/build
# PWD is the current working directory and the location of our module
# source files.
PWD := $(shell pwd)
# default is the default make target. The rule here says to run make
# with a working directory of the directory containing the kernel
# source and compile only the modules in the PWD (local) directory.
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
${MAKE} -C ${KDIR} M=${PWD} clean
Bookmarks