Skip to content

Commit

Permalink
Makefile.in: verify the custom kernel module path before setup
Browse files Browse the repository at this point in the history
Upstream kernel	patch b74d7bb7ca2412ab37bab782591573b5f265872b
"kbuild: Modify default INSTALL_MOD_DIR from extra to updates"
changed extra to updates. This patch adapts Makefile.in under 4.5
to the change. Different distribution may use extra or updates as
they choose. We need to check both paths to be sure.

Signed-off-by: Ping Cheng <[email protected]>
Signed-off-by: Jason Gerecke <[email protected]>
Tested-by: Jason Gerecke <[email protected]>
  • Loading branch information
Ping Cheng authored and jigpu committed Jul 18, 2023
1 parent 72cd1e6 commit 9da885b
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions 4.5/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ signature: all
$(MODSIGN_COMMAND) wacom_w8001.ko
$(MODSIGN_COMMAND) wacom_i2c.ko

install modules_install:
kernel_install:
$(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) modules_install mod_sign_cmd='$(MODSIGN_COMMAND)'

depmod: SEARCH_EXTRA=$(strip $(wildcard /lib/modules/$(MODUTS)/extra/wacom.ko*))
depmod: SEARCH_UPDATES=$(strip $(wildcard /lib/modules/$(MODUTS)/updates/wacom.ko*))
depmod: MODINST_DIR=$(strip $(if $(SEARCH_EXTRA), extra, $(if $(SEARCH_UPDATES), updates)))
depmod:
$(if $(MODINST_DIR),,$(error Could not find where driver was installed))
mkdir -p /etc/depmod.d
echo "override wacom * extra" > /etc/depmod.d/input-wacom.conf
echo "override wacom_w8001 * extra" >> /etc/depmod.d/input-wacom.conf
echo "override wacom_i2c * extra" >> /etc/depmod.d/input-wacom.conf
echo "override wacom * $(MODINST_DIR)" > /etc/depmod.d/input-wacom.conf
echo "override wacom_w8001 * $(MODINST_DIR)" >> /etc/depmod.d/input-wacom.conf
echo "override wacom_i2c * $(MODINST_DIR)" >> /etc/depmod.d/input-wacom.conf
PATH="$(PATH):/bin:/sbin" depmod -a $(MODUTS)
ifdef UPDATE_INITRAMFS
$(UPDATE_INITRAMFS) -u -k $(MODUTS)
Expand All @@ -65,12 +71,17 @@ ifdef DRACUT
$(DRACUT) -f --kver=$(MODUTS)
endif

install modules_install: kernel_install depmod

uninstall: SEARCH_EXTRA=$(strip $(wildcard /lib/modules/$(MODUTS)/extra/wacom.ko*))
uninstall: SEARCH_UPDATES=$(strip $(wildcard /lib/modules/$(MODUTS)/updates/wacom.ko*))
uninstall: MODINST_DIR=$(strip $(if $(SEARCH_EXTRA), extra, $(if $(SEARCH_UPDATES), updates)))
uninstall:
@# Debian uses symlinks in the path to WCM_KERNEL_DIR
@# which causes trouble for tools like 'rm' which don't
@# see the path how you might think. As a workaround,
@# first cd into the directory and then remove.
cd $(WCM_KERNEL_DIR)/../extra; rm wacom*.ko*
cd /lib/modules/$(MODUTS)/$(MODINST_DIR); rm wacom*.ko*
rm -f /etc/depmod.d/input-wacom*.conf
PATH="$(PATH):/bin:/sbin" depmod -a $(MODUTS)
ifdef UPDATE_INITRAMFS
Expand All @@ -96,6 +107,6 @@ distdir:

EMPTY_AUTOMAKE_TARGETS = install-data install-exec uninstall install-info
EMPTY_AUTOMAKE_TARGETS += installdirs check dvi pdf ps info html tags ctags mostlyclean maintainer-clean
EMPTY_AUTOMAKE_TARGETS += signature
EMPTY_AUTOMAKE_TARGETS += signature depmod kernel_install
.PHONY: $(EMPTY_AUTOMAKE_TARGETS)
$(EMPTY_AUTOMAKE_TARGETS):

0 comments on commit 9da885b

Please sign in to comment.