Makefile: don't install the file as is for DKMS

Using the whole Makefile results in DKMS running commands unrelated to
the build process (like git commands) which only produce confusing error
output.

Just write `obj-m += nct6687.o` to the Makefile for DKMS as that's the
only thing necessary for it to work.

This also gets rid of `MAKE[0]` in `dkms.conf`.
This commit is contained in:
xaizek
2025-06-02 18:41:43 +03:00
parent 2dccefc54d
commit ebbe59b205
2 changed files with 7 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
obj-m += nct6687.o makefile := obj-m += nct6687.o
curpwd := $(shell pwd) curpwd := $(shell pwd)
kver ?= $(shell uname -r) kver ?= $(shell uname -r)
@@ -10,7 +10,8 @@ fedoraver := $(shell sed -n 's/.*Fedora release \([^ ]*\).*/\1/p' /etc/fedora-
build: build:
rm -rf ${curpwd}/${kver} rm -rf ${curpwd}/${kver}
mkdir -p ${curpwd}/${kver} mkdir -p ${curpwd}/${kver}
cp ${curpwd}/Makefile ${curpwd}/nct6687.c ${curpwd}/${kver} cp ${curpwd}/nct6687.c ${curpwd}/${kver}
echo '${makefile}' > ${curpwd}/${kver}/Makefile
cd ${curpwd}/${kver} cd ${curpwd}/${kver}
make -C /lib/modules/${kver}/build M=${curpwd}/${kver} modules make -C /lib/modules/${kver}/build M=${curpwd}/${kver} modules
install: build install: build
@@ -30,7 +31,8 @@ akmod/build:
fi fi
sudo dnf install -y rpmdevtools kmodtool sudo dnf install -y rpmdevtools kmodtool
mkdir -p ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d mkdir -p ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d
cp LICENSE Makefile nct6687.c ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d cp LICENSE nct6687.c ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d
echo '${makefile}' > ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d/Makefile
cd .tmp && tar -czvf nct6687d-1.0.${commitcount}.tar.gz nct6687d-1.0.${commitcount} && cd - cd .tmp && tar -czvf nct6687d-1.0.${commitcount}.tar.gz nct6687d-1.0.${commitcount} && cd -
mkdir -p ${curpwd}/.tmp/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} mkdir -p ${curpwd}/.tmp/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp ${curpwd}/.tmp/nct6687d-1.0.${commitcount}.tar.gz ${curpwd}/.tmp/rpmbuild/SOURCES/ cp ${curpwd}/.tmp/nct6687d-1.0.${commitcount}.tar.gz ${curpwd}/.tmp/rpmbuild/SOURCES/
@@ -54,7 +56,8 @@ dkms/build:
dkms/install: dkms/install:
rm -rf ${curpwd}/dkms rm -rf ${curpwd}/dkms
mkdir -p ${curpwd}/dkms mkdir -p ${curpwd}/dkms
cp ${curpwd}/dkms.conf ${curpwd}/Makefile ${curpwd}/nct6687.c ${curpwd}/dkms cp ${curpwd}/dkms.conf ${curpwd}/nct6687.c ${curpwd}/dkms
echo '${makefile}' > ${curpwd}/dkms/Makefile
sudo rm -rf /usr/src/nct6687d-1 sudo rm -rf /usr/src/nct6687d-1
sudo cp -rT dkms /usr/src/nct6687d-1 sudo cp -rT dkms /usr/src/nct6687d-1
sudo dkms install nct6687d/1 sudo dkms install nct6687d/1

View File

@@ -1,6 +1,5 @@
PACKAGE_NAME="nct6687d" PACKAGE_NAME="nct6687d"
PACKAGE_VERSION="1" PACKAGE_VERSION="1"
MAKE[0]="make kver=${kernelver} dkms/build"
BUILT_MODULE_NAME[0]="nct6687" BUILT_MODULE_NAME[0]="nct6687"
DEST_MODULE_LOCATION[0]="/kernel/drivers/hwmon/" DEST_MODULE_LOCATION[0]="/kernel/drivers/hwmon/"
AUTOINSTALL="yes" AUTOINSTALL="yes"