Skip to content

Commit

Permalink
DKMS関連ファイルを更新した
Browse files Browse the repository at this point in the history
  • Loading branch information
shirow-github committed Mar 19, 2024
1 parent f1c41b6 commit ceb4263
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*~
.*.cmd
*.swp
*.bak
/driver-pt1/pt1_drv.ko
/driver-pt1/.tmp_versions/
/driver-pt1/.tmp_versions/*
Expand Down
42 changes: 31 additions & 11 deletions driver-pt1/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
TARGET := pt1_drv.ko
VERBOSITY = 0
REL_VERSION = "1.1.6"
REL_DATE = "2023-07-26"
EXTRA_CFLAGS += -Wformat=2
KVER ?= `uname -r`

KBUILD = /lib/modules/$(KVER)/build
INSTALL_DIR = /lib/modules/$(KVER)/kernel/drivers/video

all: ${TARGET}

pt1_drv.ko: pt1_pci.c pt1_i2c.c pt1_tuner.c pt1_tuner_data.c version.h
make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) modules
make -C $(KBUILD) M=`pwd` V=$(VERBOSITY) modules

clean:
make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) clean
make -C $(KBUILD) M=`pwd` V=$(VERBOSITY) clean

obj-m := pt1_drv.o

Expand All @@ -19,16 +21,34 @@ pt1_drv-objs := pt1_pci.o pt1_i2c.o pt1_tuner.o pt1_tuner_data.o
clean-files := *.o *.ko *.mod.[co] *~ version.h

version.h:
revh=`hg parents --template '#define DRV_VERSION "r{rev}:{node|short}"\n#define DRV_RELDATE "{date|shortdate}"\n' 2>/dev/null`; \
if [ -n "$$revh" ] ; then \
echo "$$revh" > $@; \
eval `sed -e "s/\[0\]//" ./dkms.conf`; \
GREV=`git rev-list HEAD | wc -l 2> /dev/null`; \
if [ $$GREV != 0 ] ; then \
printf "#define DRV_VERSION \"$${PACKAGE_VERSION}rev$$GREV\"\n#define DRV_RELDATE \"`git show --date=short --format=%ad | sed -n '1p' 2> /dev/null`\"\n#define DRV_NAME \"$${BUILT_MODULE_NAME}\"\n" > $@; \
else \
printf "#define DRV_VERSION \"$(REL_VERSION)\"\n#define DRV_RELDATE \"$(REL_DATE)\"\n" > $@; \
printf "#define DRV_VERSION \"$${PACKAGE_VERSION}\"\n#define DRV_RELDATE \"$$PACKAGE_RELDATE\"\n#define DRV_NAME \"$${BUILT_MODULE_NAME}\"\n" > $@; \
fi

install: $(TARGET)
install -m 644 $(TARGET) /lib/modules/`uname -r`/kernel/drivers/video
uninstall:
rm -vf $(INSTALL_DIR)/$(TARGET)* /etc/udev/rules.d/99-pt1.rules

dkms: $(TARGET)
if [ -d /etc/udev/rules.d -a ! -f /etc/udev/rules.d/99-pt1.rules ] ; then \
install -m 644 etc/99-pt1.rules /etc/udev/rules.d ; \
fi
depmod -a

install: uninstall dkms
install -d $(INSTALL_DIR)
install -m 644 $(TARGET) $(INSTALL_DIR)
depmod -a $(KVER)

install_compress: install
. $(KBUILD)/.config ; \
if [ $$CONFIG_DECOMPRESS_XZ = "y" ] ; then \
xz -9e $(INSTALL_DIR)/$(TARGET); \
elif [ $$CONFIG_DECOMPRESS_BZIP2 = "y" ] ; then \
bzip2 -9 $(INSTALL_DIR)/$(TARGET); \
elif [ $$CONFIG_DECOMPRESS_GZIP = "y" ] ; then \
gzip -9 $(INSTALL_DIR)/$(TARGET); \
fi
depmod -a $(KVER)
3 changes: 1 addition & 2 deletions driver-pt1/dkms.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
PACKAGE_NAME="pt1_drv"
PACKAGE_VERSION="1.1.6"
PACKAGE_RELDATE="2023-07-26"
MAKE[0]="make KVER=${kernelver} dkms"
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"
MAKE[0]="make KVER=${kernelver}"
CLEAN="make clean"
AUTOINSTALL="yes"
2 changes: 1 addition & 1 deletion dkms.install → driver-pt1/dkms.install
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
. ./dkms.uninstall

su -c "
cp -a `pwd`/driver-pt1 /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION;
cp -a `pwd` /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION;
dkms add -m $PACKAGE_NAME -v $PACKAGE_VERSION;
dkms build -m $PACKAGE_NAME -v $PACKAGE_VERSION;
dkms install -m $PACKAGE_NAME -v $PACKAGE_VERSION"
2 changes: 1 addition & 1 deletion dkms.uninstall → driver-pt1/dkms.uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if [ "$ZSH_NAME" = "zsh" ];then
setopt localoptions ksharrays
fi

. ./driver/dkms.conf
. ./dkms.conf

su -c "
dkms remove -m $PACKAGE_NAME -v $PACKAGE_VERSION --all;
Expand Down
2 changes: 1 addition & 1 deletion driver-pt1/pt1_pci.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- tab-width: 4; indent-tabs-mode: t -*- */
/* pt1-pci.c: A PT1 on PCI bus driver for Linux. */
#define DRV_NAME "pt1-pci"

#include "version.h"

#include <linux/module.h>
Expand Down

0 comments on commit ceb4263

Please sign in to comment.