From 300d476c3708bc7ca7fc472f36c559a9519bd486 Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 4 Oct 2024 20:20:39 +0200 Subject: [PATCH] Fix dkms builds for linux 6.10 and above --- .gitignore | 8 +++++++- Makefile | 37 ++++--------------------------------- README.md | 16 ++++++++++++---- dkms.conf | 4 ++-- memflow-kmod/Makefile | 23 +++++++++++++++++++++++ 5 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 memflow-kmod/Makefile diff --git a/.gitignore b/.gitignore index b0be0e0..d124484 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ -build +*.o +.*.cmd +*.symvers +*.ko +*.mod.c +*.mod +*.order *.out *.swp target diff --git a/Makefile b/Makefile index 413a831..2a10e65 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,6 @@ -obj-y += memflow-kmod/ - -MCFLAGS += -O3 -ccflags-y += ${MCFLAGS} -CC += ${MCFLAGS} - -ifndef KERNELDIR - KDIR := /lib/modules/$(shell uname -r)/build -else - KDIR := $(KERNELDIR) -endif - -ifndef OUT_DIR - KOUTPUT := $(PWD)/build -else - KOUTPUT := $(OUT_DIR) -endif - -KOUTPUT_MAKEFILE := $(KOUTPUT)/Makefile - -all: $(KOUTPUT_MAKEFILE) - @echo "$(KOUTPUT)" - - make -C $(KDIR) M=$(KOUTPUT) src=$(PWD)/memflow-kmod modules - -$(KOUTPUT): - mkdir -p "$@" - -$(KOUTPUT_MAKEFILE): $(KOUTPUT) - touch "$@" +all: + cd memflow-kmod && make all clean: - make -C $(KDIR) M=$(KOUTPUT) src=$(PWD)/memflow-kmod clean - $(shell rm $(KOUTPUT_MAKEFILE)) - rmdir $(KOUTPUT) + cd memflow-kmod && make clean + diff --git a/README.md b/README.md index fa571fc..8153034 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ KERNEL=="memflow" SUBSYSTEM=="misc" GROUP="memflow" MODE="0660" ``` -## Manually installing +## Manual installation #### Connector @@ -72,12 +72,20 @@ Initialize submodules: git submodule update --init ``` -Run `make`. output will be placed in `build/memflow.ko`. +Run `make`. output will be placed in `memflow-kmod/memflow.ko`. -To then install the built module run +Then to install the module: +``` +source dkms.conf +sudo mkdir /usr/src/$BUILT_MODULE_NAME-$PACKAGE_VERSION +sudo cp -r * /usr/src/$BUILT_MODULE_NAME-$PACKAGE_VERSION +sudo dkms build -m $BUILT_MODULE_NAME -v $PACKAGE_VERSION +sudo dkms install -m $BUILT_MODULE_NAME -v $PACKAGE_VERSION +``` +Then you can load the module: ``` -memflowup build --name memflow-kvm --script install.rhai +sudo modprobe memflow ``` ## FAQ diff --git a/dkms.conf b/dkms.conf index 7cd632f..5801268 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,9 +1,9 @@ MAKE="make KERNELDIR=/lib/modules/${kernelver}/build" CLEAN="make clean" BUILT_MODULE_NAME=memflow -BUILT_MODULE_LOCATION=build/ +BUILT_MODULE_LOCATION=memflow-kmod/ DEST_MODULE_LOCATION="/updates" PACKAGE_NAME=memflow-dkms -PACKAGE_VERSION=0.1.7 +PACKAGE_VERSION=0.1.8 REMAKE_INITRD=no AUTOINSTALL=yes diff --git a/memflow-kmod/Makefile b/memflow-kmod/Makefile new file mode 100644 index 0000000..daca456 --- /dev/null +++ b/memflow-kmod/Makefile @@ -0,0 +1,23 @@ +obj-y += memflow-kmod/ + +MCFLAGS += -O3 +ccflags-y += ${MCFLAGS} +CC += ${MCFLAGS} + +ifndef KERNELDIR + KDIR := /lib/modules/$(shell uname -r)/build +else + KDIR := $(KERNELDIR) +endif + +KOUTPUT := $(PWD) + +all: + @echo "$(KOUTPUT)" + make -C $(KDIR) M=$(KOUTPUT) src=$(PWD) modules + +clean: + make -C $(KDIR) M=$(KOUTPUT) src=$(PWD) clean + rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers