Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1216386rdb; Wed, 6 Dec 2023 11:48:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqbb2qow3CEtA2o8M60IaGVzbpFxUjEkn6cORXEIYOJvQsDzxTww7uQBuKGwCUS2W4yIy7 X-Received: by 2002:a17:902:d652:b0:1d0:9d92:f18d with SMTP id y18-20020a170902d65200b001d09d92f18dmr932976plh.45.1701892102720; Wed, 06 Dec 2023 11:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701892102; cv=none; d=google.com; s=arc-20160816; b=iPF4tRRe0nGa6ARoJUyOOy7iKQfH7FjRiejArj+HrViQGcu57jRP6lBZnOgcNZS++3 yAe4/4FID01AaD4pjDpyb/njbm4rSrCSYj2YuiPKOWOCiQ4se/NMUv1svyc9lUV5ghzi UDKzQV4izDPrDd78EN1AOZVAP2vCI5lYxmNTg7+k32lWvbhMay9taLyaHR3HdyOxsJgE Wjecu8cHF7kDVcucGsHwqYyPrCKEfTicRgToeTJz2gDakhAp1qJL5eqLgPGXf0MNgqa1 +3Thxy+7462RsDFnTiFSWDChfqPEQA5SLSSNerkUHZnpwQxQAvMVCcuHiUAXW8YJ6xAd tr3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ov8zefNWK8DeiwA8wNVUU354vvSd05uhQtoU+uecmDY=; fh=kEv7l62vJ3XIkrK43m8eV/ZlyXa9griX1gawn6N+7MU=; b=vDW/rO8UsDUzoAH5k1ut2DzNFfhVD1AOmPwChlryAU66xvOkin6KDuU+uZPY3T+Zmm TQ4mxTj0IiaiMDgSVoBOciOrRBMIdrzH63f7twLIsF0/iMmBHjxLjAg2Bb3zztkfbWiI Paqe0EBf9NN8YOi6xLEbuIwMi45h9iUvuUxhlW/o/5Wg6gzULEM1KxJRoiw0HbNuqx3P McqV1cwSpEiKL1MlQV7PVTI0HijjFVlp2zS1slcIDEOU2KHFs/L4xu+moN85ZR5ZqwCn s1xJnPtBejZtdQKjXPXoCvUssBnWa+XljazpfXefmqHvg/Pf28fuJhJAdpE5Ia1g3qOB mZnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vxde8W9L; dkim=neutral (no key) header.i=@suse.de header.b="N/kQZ0uf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x23-20020a170902b41700b001cfe0284177si285577plr.102.2023.12.06.11.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 11:48:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vxde8W9L; dkim=neutral (no key) header.i=@suse.de header.b="N/kQZ0uf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 327698026D81; Wed, 6 Dec 2023 11:48:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379412AbjLFTsB (ORCPT + 99 others); Wed, 6 Dec 2023 14:48:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379439AbjLFTr7 (ORCPT ); Wed, 6 Dec 2023 14:47:59 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F17DC122; Wed, 6 Dec 2023 11:48:04 -0800 (PST) Received: from kitsune.suse.cz (unknown [10.100.12.127]) by smtp-out2.suse.de (Postfix) with ESMTP id 5D17F1FD37; Wed, 6 Dec 2023 19:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1701892082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ov8zefNWK8DeiwA8wNVUU354vvSd05uhQtoU+uecmDY=; b=Vxde8W9L32OvzV66naFp5LegxWVnktfLOQxSU4r2/FXOT34vlgbTXtHpxOWhAmLK+B/73L XR7cyCG/NfI/yekcCSh6V7DvfjtfTOZFjGmrc8rJNA3nTr1Mhz5atOsuYiqOU5VArTjIZ2 puZSYGGMG1lLHqUnVgttqtciGYmgU9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1701892082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ov8zefNWK8DeiwA8wNVUU354vvSd05uhQtoU+uecmDY=; b=N/kQZ0ufcHLHHyNCe4PUoNU9JEE5asxwqf4vJAwKHJ8E6geEd+ueA8Yt5ZuVaK/+qC5uLv e8D7K+euUDf37vCA== From: Michal Suchanek To: linux-modules@vger.kernel.org Cc: Michal Suchanek , Takashi Iwai , Lucas De Marchi , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Jiri Slaby , Jan Engelhardt , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/2] depmod: Handle installing modules under a different directory Date: Wed, 6 Dec 2023 20:47:51 +0100 Message-ID: <32b332af189bfca8acdb231cee294355aa4af290.1701892062.git.msuchanek@suse.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 5.20 X-Spamd-Result: default: False [5.20 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[suse.de,suse.com,gmail.com,inai.de,kernel.org,google.com,fjasle.eu,vger.kernel.org]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 11:48:17 -0800 (PST) Some distributions aim at shipping all files in /usr. The path under which kernel modules are installed is hardcoded to /lib which conflicts with this goal. When kmod provides kmod.pc, use it to determine the correct module installation path. With kmod that does not provide the config /lib/modules is used as before. While pkg-config does not return an error when a variable does not exist the kmod configure script puts some effort into ensuring that module_directory is non-empty. With that empty module_directory from pkg-config can be used to detect absence of the variable. Signed-off-by: Michal Suchanek --- v6: - use ?= instead of := to make it easier to override the value - use shorter expression for determining the module directory assuming it's non-empty --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 511b5616aa41..84f32bd563d4 100644 --- a/Makefile +++ b/Makefile @@ -1081,7 +1081,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE) # makefile but the argument can be passed to make if needed. # -MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) +export KERNEL_MODULE_DIRECTORY ?= $(or $(shell pkg-config --variable=module_directory kmod 2>/dev/null),/lib/modules) + +MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE) export MODLIB PHONY += prepare0 -- 2.42.0