一个通用的编译模块Makefile,编译结果xxxx.ko

# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
    obj-m := edmaDrv.o
        edmaDrv-objs := edma3_drv.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
#       KERNELDIR ?= /lib/modules/$(shell uname -r)/build
        COMPILE_PREFIX=/opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/bin/arm-arago-linux-gnueabi-
        KERNELDIR ?= /home/zhaochenhui/DVRRDK_04.00.00.03/ti_tools/linux_lsp/kernel/linux-dvr-rdk
        PWD := $(shell pwd)
        EXTRA_CFLAGS += -DUSE_UDEV
        MAKE_ENV = ARCH=arm CROSS_COMPILE=$(COMPILE_PREFIX)
default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD)  $(MAKE_ENV) \
                EXTRA_CFLAGS="$(EXTRA_CFLAGS)" modules
endif
.PHONA : clean
clean:
        $(MAKE) -C $(KERNELDIR) M=$(PWD)  clean

你可能感兴趣的:(kernel,makefile)