From 51b47a355f544ccd831b1c520e12469c05c2bb76 Mon Sep 17 00:00:00 2001 From: DAEYEONG LEE Date: Wed, 21 May 2025 16:16:35 +0900 Subject: [PATCH 1/2] makefile: Fix to compile on multiple kernel versions Signed-off-by: DAEYEONG LEE --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fdaa7a2..1d2f7dd 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ PWD := $(shell pwd) BUILDSYSTEM_DIR ?= /lib/modules/$(shell uname -r)/build -CXL_DIR ?= cxl_6.10 - +CXL_DIR ?= cxl_$(shell uname -r | cut -d '-' -f1 | cut -d '.' -f1,2) INSTALL_MOD_PATH ?= INSTALL_MOD_PATH_ARG := $(if $(strip $(INSTALL_MOD_PATH)),INSTALL_MOD_PATH="$(INSTALL_MOD_PATH)",) @@ -12,10 +11,9 @@ ifneq ($(KERNELRELEASE),) obj-m += $(CXL_DIR)/ else all: - @echo INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules install: all - $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install $(INSTALL_MOD_PATH_ARG) DEPMOD=/bin/true + $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install $(INSTALL_MOD_PATH_ARG) INSTALL_MOD_DIR=updates DEPMOD=/bin/true clean: $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) clean @/bin/rm -f *.ko modules.order *.mod.c *.o *.o.ur-safe .*.o.cmd From dba35918618380b6c9aae28334fb6728a723c817 Mon Sep 17 00:00:00 2001 From: DAEYEONG LEE Date: Wed, 21 May 2025 16:16:54 +0900 Subject: [PATCH 2/2] install.sh: Add uninstall.sh and clean up install.sh Signed-off-by: DAEYEONG LEE --- install.sh | 15 --------------- uninstall.sh | 13 +++++++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) create mode 100755 uninstall.sh diff --git a/install.sh b/install.sh index 835f88f..a0b905a 100755 --- a/install.sh +++ b/install.sh @@ -3,18 +3,3 @@ make clean make install -j$(nproc) depmod -a - -kernel_version=$(uname -r) -mx_dma_path=$(find /lib/modules/${kernel_version}/ -type f -name "mx_dma.ko" 2>/dev/null) - -if [ -n "$mx_dma_path" ]; then - mx_dma_dir=$(dirname "$mx_dma_path") - echo "Found mx_dma.ko at directory: $mx_dma_dir" -else - echo "mx_dma.ko not found." - exit -fi - -sed -i '/cxl_/d' /etc/modules -sed -i '/mx_dma/d' /etc/modules -find "$mx_dma_dir" -type f -name "*.ko" >>/etc/modules diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..494f75f --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +UPDATE_PATH=/lib/modules/$(uname -r)/updates + +for dir in "$UPDATE_PATH"/cxl_*; do + if [[ -d "$dir" ]]; then + rm -rf "$dir" + fi +done + +rm -f "$UPDATE_PATH"/mx_dma.ko + +depmod -a