Skip to content

Commit

Permalink
Fix dkms builds for linux 6.10 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1N committed Oct 4, 2024
1 parent c7d72fd commit 300d476
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 40 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
build
*.o
.*.cmd
*.symvers
*.ko
*.mod.c
*.mod
*.order
*.out
*.swp
target
37 changes: 4 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ KERNEL=="memflow" SUBSYSTEM=="misc" GROUP="memflow" MODE="0660"
```


## Manually installing
## Manual installation

#### Connector

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dkms.conf
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions memflow-kmod/Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 300d476

Please sign in to comment.