Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38375696rwd; Wed, 12 Jul 2023 06:58:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHFaTNlTQIz7Vh1ZFvLkXJw68C8Bm3X7oCyOzla1vNKqGn00j5O+1z6m+KNtpdJcfduagk1 X-Received: by 2002:a05:6358:528f:b0:134:e964:134c with SMTP id g15-20020a056358528f00b00134e964134cmr21764315rwa.11.1689170338949; Wed, 12 Jul 2023 06:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689170338; cv=none; d=google.com; s=arc-20160816; b=t1WMQU8QUN4B1Q00XBn8QOKHZWMhhwVo+YAgN9EIMxyP5dlBM5bnHpsylKQkTuppS0 mttQ1NE0GKMrnKmUfPpoDtDtQgYJCqpp2yN/X87nHZXd2u2LEwd0ymBhGYhKTCPXLsMf vjweyIKvkOz1z7DtjStbQ1zcm7elxmBQHHZ57ox+qsI3TcQKK01lDZVgD6zDxa4j6vIi 9QWAhoSMMSDYMoU7V5IOGHCXEd/PXFBq6F9iHLogjz0V1lghKd2uim6JG6pc25FqGv89 gd/0OTVCFsiLdtYFAZ2C7+BpamQFv+hwYAOv8eb9GjquhysPpiGYjicICWFNNQDuyiN3 +ISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature:dkim-signature; bh=G+kzlCw/SCEEe9a86Jj/6fxE8wGtEPp1cF0uqUxJXbY=; fh=0XnM2H6ejEEyg0g/ieWHbrD2GNHH6viteU1JtXW3WHI=; b=aEKHCFWz4/i4XhTd1sLT8v9aLK61Jsb9kAU1FkIyTiS5aw9fEnyplbfG93CpbH2prt DZwRlnUr+sHUyWS+96UFUYd4Fa5Oaxi72KJI3mGKzkLGDAkUWVjl/xJDfyEqmDMBKQda 13uuMASop6bn6H2c1lV8aPsLKn4TS07tdZqPnG2ydJGFHNna30VMhZKZcKVmHzOdV0ZW t5y8Gis1486TE3X0cAru0+E5rzdIptbAK8Hhpyy+NLJ7yfycQB6UIs2B+CiDJv+xCmmt OyHedRZuS8BR3RlL6JZ4Ki6mqY7qXDOsz5mQl59SWpp0vWkuasLMTATHuH1WGSAsZ9DF SLtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@suse.de header.s=susede2_rsa header.b=WIilWt8P; dkim=neutral (no key) header.i=@suse.de; 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=fail (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 x14-20020a63170e000000b005574c3ac68dsi3305980pgl.493.2023.07.12.06.58.46; Wed, 12 Jul 2023 06:58:58 -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=fail header.i=@suse.de header.s=susede2_rsa header.b=WIilWt8P; dkim=neutral (no key) header.i=@suse.de; 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=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233126AbjGLNpm (ORCPT + 99 others); Wed, 12 Jul 2023 09:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232952AbjGLNpl (ORCPT ); Wed, 12 Jul 2023 09:45:41 -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 4D3D4E4D; Wed, 12 Jul 2023 06:45:40 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id F41E31F893; Wed, 12 Jul 2023 13:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689169539; 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=G+kzlCw/SCEEe9a86Jj/6fxE8wGtEPp1cF0uqUxJXbY=; b=WIilWt8PA4uZmrnmW+mk+UJaoE5N7LsZBv14GAXDJamGClORjV6AaedgU+81krZ/Dl6yXg 3JWG4czVlAyz5nyQTq7d95HQ5pbybQEVj+uj0SxbedPzkA/yfx0VwZm2S96J65PmkRkDF2 63FhZ77cJ0ffor6VgDjx3zaVTSWF6ho= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689169539; 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=G+kzlCw/SCEEe9a86Jj/6fxE8wGtEPp1cF0uqUxJXbY=; b=umhHv+grXQ8dOfv81wH9k9xTDQjcnRVnp74XMx8ajHLPBEmlUJNyEbOTOR+WfgsG3umNc5 AUWEfD0cN2OK2aAg== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id 9BC152C142; Wed, 12 Jul 2023 13:45:38 +0000 (UTC) From: Michal Suchanek 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 v2--to=linux-modules@vger.kernel.org] depmod: Handle installing modules under a prefix Date: Wed, 12 Jul 2023 15:45:31 +0200 Message-ID: <20230712134533.4419-1-msuchanek@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 To: unlisted-recipients:; (no To-header on input) 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 --- v2: Avoid error on systems with kmod that does not support config command --- Makefile | 4 +++- scripts/depmod.sh | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 47690c28456a..b1fea135bdec 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 &> /dev/null && 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