initial commit

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964fed03491314c60f5b010e83516acafb0
This commit is contained in:
raf 2025-10-06 09:13:04 +03:00
commit 088254c0c0
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 1136 additions and 0 deletions

49
Makefile Normal file
View file

@ -0,0 +1,49 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-m += deepcool.o
VERSION := 0.1.0
TARGET := $(shell uname -r)
KVERSION := $(shell uname -r)
KDIR := /lib/modules/$(KVERSION)/build
DKMS_ROOT_PATH := /usr/src/deepcool-$(VERSION)
all:
@$(MAKE) -C $(KDIR) M=$(CURDIR) modules
clean:
@$(MAKE) -C $(KDIR) M=$(CURDIR) clean
dkms-install:
mkdir $(DKMS_ROOT_PATH)
cp $(CURDIR)/dkms.conf $(DKMS_ROOT_PATH)
cp $(CURDIR)/Makefile $(DKMS_ROOT_PATH)
cp $(CURDIR)/deepcool.c $(DKMS_ROOT_PATH)
sed -e "s/@CFLGS@/${MCFLAGS}/" \
-e "s/@VERSION@/$(VERSION)/" \
-i $(DKMS_ROOT_PATH)/dkms.conf
dkms add deepcool/$(VERSION)
dkms build deepcool/$(VERSION)
dkms install deepcool/$(VERSION)
dkms-uninstall:
dkms remove zenpower/$(VERSION) --all
rm -rf $(DKMS_ROOT_PATH)
help:
@echo ""
@echo "Targets:"
@echo " all - Build the kernel module (default)"
@echo " clean - Remove build artifacts"
@echo " install - Install the module to the system"
@echo " uninstall - Remove the module from the system"
@echo " load - Load the module"
@echo " unload - Unload the module"
@echo " reload - Unload and reload the module"
@echo ""
@echo "Current kernel version: $(KVERSION)"
.PHONY: all clean install uninstall load unload reload help

1087
deepcool.c Normal file

File diff suppressed because it is too large Load diff