Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37074299rwd; Tue, 11 Jul 2023 09:07:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlG8OuL7w2yT39x4kcY1RnJ7wIJA65AFudopbdyI85ovGy2IAXh3m6IZPV3qhFqdzjVTvo0V X-Received: by 2002:a05:6a21:7891:b0:12b:f2bf:c3d9 with SMTP id bf17-20020a056a21789100b0012bf2bfc3d9mr14276485pzc.55.1689091629566; Tue, 11 Jul 2023 09:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689091629; cv=none; d=google.com; s=arc-20160816; b=bSFTQ9FZhggE3dBa9rEgayyUFHwQWheHQEpBhAVe583F3lKkC7swSHJTv5gnRidLF9 MaaT7HUeRRNE/5sI9q8xZ2IIlqemKTcuSwpLtoFksx9Bu1sT8CTJccrJBdi9XhcWxHSy UwQeJXg6NFVjy2i9MDcXcQOcLt6nJgwJ7I+WS0oQiEtz9drjzBM6t+KJEhmPgsvvc4eh W2x7hU6ZTEy8PLevaZb6oiIa8A30W26Ekhf2p9DQcX/3rUu59x1LXRDhaOu88BtBxtc6 pTCSY3hXh/SsdfyUsLaQtMaT7L2b1ZOA7S+cpP/+tjirzbcJCIWFA55H2JZMGt5VAMm9 vIyw== 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=GphF7AY62AISo2U3bJWb8pTQ4C+Mrfr5BrDuaVD87rY=; fh=AVdnBkCzYGOB5oRrOKcaACuRLonL9A4Pn6PwCHl69B0=; b=qy68T5VnkUmx1e31EwgHJ/3dVw5XZbr8no6YmrlJ4DpylpnVpQzd6iYekalGRqo5wj lE1X/bPHs7b0BvJ2vGF+JACB49XNjBz5tTKjHNhHX+mhleGKIrvS/3mK1p6Mbc7aUirB UJvG6Di61HGFGLxwTYrjM537edF+T6shUb9PkBFT2+97lCHQLYCGL0EMRjJzVJDuYHFO le0eO6eO699kswS2dwikREmAB9zvkZL6bUN6GnwW8MbBiyBGS6y4PLTyREgagsTa71Ps 35wfjO4UHGkyBe5s1+BxPUyfr84rAbhuC0f+pSD1Wsm0qFzPP61s+GiBA9faz5q0I07J lS3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MOYDbv9r; dkim=neutral (no key) header.i=@suse.de header.b="0/NCsbIA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g123-20020a636b81000000b0055c1f8ca4cbsi1601377pgc.373.2023.07.11.09.06.42; Tue, 11 Jul 2023 09:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MOYDbv9r; dkim=neutral (no key) header.i=@suse.de header.b="0/NCsbIA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231210AbjGKPfG (ORCPT + 99 others); Tue, 11 Jul 2023 11:35:06 -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: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ?= $(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_PREFIX := $(shell kmod config | jq -r .module_prefix) + +MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_PREFIX)/lib/modules/$(KERNELRELEASE) export MODLIB PHONY += 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=true tmp_dir=$(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/modules.dep" -o \ + -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE/modules.dep.bin"; then depmod_hack_needed=false fi fi rm -rf "$tmp_dir" if $depmod_hack_needed; then - symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE" + symlink="$INSTALL_MOD_PATH$KERNEL_MODULE_PREFIX/lib/modules/99.98.$KERNELRELEASE" ln -s "$KERNELRELEASE" "$symlink" KERNELRELEASE=99.98.$KERNELRELEASE fi -- 2.41.0