Newer
Older
#
#ifeq ($(KERNELRELEASE),)
#
# # Assume the source tree is where the running kernel was built
# # You should set KERNELDIR in the environment if it's elsewhere
#
# #BUILDSYSTEM_DIR ?= /lib/modules/$(shell uname -r)/build
# # The current directory is passed to sub-makes as argument
# #PWD := $(shell pwd)
#
#modules:
# $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) KBUILD_EXTRA_SYMBOLS=$(EXTRA_SYMBOLS) modules
#
#modules_install:
# $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install
#
#clean:
# rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.o.d *.mod
#
#.PHONY: modules modules_install clean
#
#else
# # called from kernel build system: just declare what our modules are
# obj-m := flxnet_dev.o flxnet_target.o flxnet_pcie.o
# flxnet_dev-y := flx_net_dev.o
# flxnet_target-y := flx_net_target.o
# flxnet_pcie-y := flx_net_pcie.o
#
#endif

Nayib Boukadida
committed
export ARCH:=arm64
export CROSS_COMPILE:=aarch64-linux-gnu-

Nayib Boukadida
committed
CC=$(CROSS_COMPILE)gcc
# If we are running by kernel building system
ifneq ($(KERNELRELEASE),)
#$(TARGET_MODULE)-objs := main.o device_file.o
obj-m := flx_net_dev.o flx_net_target.o
# If we running without kernel build system
BUILDSYSTEM_DIR:=/lib/modules/$(shell uname -r)/build
PWD:=$(shell pwd)
all :
# run kernel build system to make module
$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules
clean:
# run kernel build system to cleanup in current directory
$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) clean
load:
insmod ./flx_net_dev.ko
insmod ./flx_net_target.ko
rmmod ./flx_net_dev.ko
rmmod ./flx_net_target.ko
rmmod ./flx_net_dev.ko
rmmod ./flx_net_target.ko
insmod ./flx_net_dev.ko
insmod ./flx_net_target.ko