From nobody Sun Feb 8 04:34:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D114DEB64DC for ; Tue, 11 Jul 2023 15:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbjGKPfH (ORCPT ); Tue, 11 Jul 2023 11:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbjGKPfE (ORCPT ); Tue, 11 Jul 2023 11:35:04 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BAF7ED; Tue, 11 Jul 2023 08:35:03 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 490741FEC5; Tue, 11 Jul 2023 15:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689089701; 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=GphF7AY62AISo2U3bJWb8pTQ4C+Mrfr5BrDuaVD87rY=; b=MOYDbv9rU8NEWqmF/OGJ48V9KpzB6QrHrcYTWjiETksZkisRkJD6749oIyNQO0jTM/ZUH6 IdhasSRGMt49DQogne5qD38RyruUz0rtP9N1H51YNmDTbZ1GAgLpjf6Afghtizh7fLnbDI JQtaCcFjNeVZIYhGSVCngBSliOGu0dw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689089701; 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=GphF7AY62AISo2U3bJWb8pTQ4C+Mrfr5BrDuaVD87rY=; b=0/NCsbIAanjTCrMmysmJz4GufYTdB0IjyBKPU8RxMzKiFX3XF9872g0N2XXqlgpkvWHgZ0 7/pgy4WSfZ0RWSDQ== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id E4A3C2C142; Tue, 11 Jul 2023 15:35:00 +0000 (UTC) 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] depmod: Handle installing modules under a prefix Date: Tue, 11 Jul 2023 17:34:54 +0200 Message-ID: <20230711153457.29497-1-msuchanek@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711153126.28876-1-msuchanek@suse.de> References: <20230711153126.28876-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some distributions aim at not shipping any files in / ustside of usr. The path under which kernel modules are instaleld is hardcoded to /lib which conflicts with this goal. When kmod provides the config command use it to determine the correct module installation prefix. On kmod that does not provide the command / is used as before. Signed-off-by: Michal Suchanek --- Makefile | 4 +++- scripts/depmod.sh | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 47690c28456a..b05d696f06bd 100644 --- a/Makefile +++ b/Makefile @@ -1165,7 +1165,9 @@ export INSTALL_DTBS_PATH ?=3D $(INSTALL_PATH)/dtbs/$(= KERNELRELEASE) # makefile but the argument can be passed to make if needed. # =20 -MODLIB =3D $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) +export KERNEL_MODULE_PREFIX :=3D $(shell kmod config | jq -r .module_prefi= x) + +MODLIB =3D $(INSTALL_MOD_PATH)$(KERNEL_MODULE_PREFIX)/lib/modules/$(KERNEL= RELEASE) export MODLIB =20 PHONY +=3D prepare0 diff --git a/scripts/depmod.sh b/scripts/depmod.sh index 3643b4f896ed..88ac79056153 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh @@ -27,16 +27,16 @@ fi # numbers, so we cheat with a symlink here depmod_hack_needed=3Dtrue tmp_dir=3D$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX) -mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE" +mkdir -p "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE" if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then - if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \ - -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then + if test -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE/modu= les.dep" -o \ + -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE/modules.dep= .bin"; then depmod_hack_needed=3Dfalse fi fi rm -rf "$tmp_dir" if $depmod_hack_needed; then - symlink=3D"$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE" + symlink=3D"$INSTALL_MOD_PATH$KERNEL_MODULE_PREFIX/lib/modules/99.98.$KERN= ELRELEASE" ln -s "$KERNELRELEASE" "$symlink" KERNELRELEASE=3D99.98.$KERNELRELEASE fi --=20 2.41.0