diff options
author | José Luis Salvador Rufo <[email protected]> | 2021-10-01 19:44:34 +0200 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-02-10 11:18:29 -0800 |
commit | a35125e3d5a176075882aab2d4b657387cf064f1 (patch) | |
tree | 2f896b5f2968adae65046ced09562180785407f8 /module | |
parent | fe8b0a33d4ad903683404cfe2b1f38f3247fc0dd (diff) |
Proper support for DESTDIR and INSTALL_MOD_PATH
The environment variables DESTDIR and INSTALL_MOD_PATH must
be mutually exclusive.
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
https://www.kernel.org/doc/Documentation/kbuild/modules.txt
This issue was discussed in this Buildroot thread:
https://lists.buildroot.org/pipermail/buildroot/2021-August/621350.html
I saw this behavior in other different projects, as:
- Yocto Project:
https://www.yoctoproject.org/pipermail/meta-freescale/2013-August/004307.html
- Google IA Coral:
https://coral.googlesource.com/linux-imx-debian/+/refs/heads/master/debian/rules
For the above reasons, INSTALL_MOD_PATH will be set as DESTDIR
by default.
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: José Luis Salvador Rufo <[email protected]>
Signed-off-by: Romain Naour <[email protected]>
Closes #12577
Diffstat (limited to 'module')
-rw-r--r-- | module/Makefile.in | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/module/Makefile.in b/module/Makefile.in index 05c673231..b15ab9109 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -1,6 +1,7 @@ include Kbuild INSTALL_MOD_DIR ?= extra +INSTALL_MOD_PATH ?= $(DESTDIR) SUBDIR_TARGETS = icp lua zstd @@ -81,15 +82,15 @@ clean: clean-@ac_system@ modules_install-Linux: @# Install the kernel modules $(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \ - INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \ + INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \ INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \ KERNELRELEASE=@LINUX_VERSION@ @# Remove extraneous build products when packaging - kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ + kmoddir=$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ if [ -n "$(DESTDIR)" ]; then \ find $$kmoddir -name 'modules.*' | xargs $(RM); \ fi - sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ + sysmap=$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ if [ -f $$sysmap ]; then \ depmod -ae -F $$sysmap @LINUX_VERSION@; \ fi @@ -102,7 +103,7 @@ modules_install: modules_install-@ac_system@ modules_uninstall-Linux: @# Uninstall the kernel modules - kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ + kmoddir=$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ for objdir in $(ZFS_MODULES); do \ $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \ done |