Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp52751rwp; Wed, 12 Jul 2023 09:32:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5laFJWrWdS1oNJy4fixFcN9KHuNPnSY74I7jZoXhJOEr5bfIdrOsrN279Nvn6WS7m27tt X-Received: by 2002:aa7:cf06:0:b0:51d:f37b:1b5c with SMTP id a6-20020aa7cf06000000b0051df37b1b5cmr7817609edy.23.1689179556080; Wed, 12 Jul 2023 09:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689179556; cv=none; d=google.com; s=arc-20160816; b=oUCiGsh4gVIlsyeoXDkwzooB7d7xnaowNlL4oMGRYdXKEkepwoeT4od+HbFRO7qSKf 3FOvBX+7DNNEKt2RCp/06CS/QA/W50lEetOpmNnm4UYtT5izT+pGOUxFNevlbFS3L4MJ JCn7y9pkRk9ARpdPDsoApH8bPUCUmi/f7gb5tjPChgLEM7Kn0EDAh5w4jWHWYJsXu8L1 sH4vZ9ub7zhowELyDYUJjZmn4o1Pl0nE+ZVEjPrJdG9GhRssHQK54j6sZsguK1a2EwFF bOFtiJRyXt7VUKKFleLq2L7OQ1ok3NTNLU9XODlMcqUWZ8pw2hKfhIXvNKu3vu25Kg0Y 5NKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=f+VBw2m9h9l7vvxNuxZsgOqUhypJ0WlLLP87GhZA5AE=; fh=ujRXtJ9Uqy0EmZMlRZXfBY3Erc7fWQmz/2Brsnerlhw=; b=tpDQFy9WOssLGK+dhbMQTNcItl1Pw3jK7mviW3s6vARp7bjS2HAPILOn5sB0MZ5aeq hSvIbX5ZTOzWYF1ucqxyzyL5Lrq5VUJRphvcVmkuNCy/VXS9jAo5lu4cANoTPGkOOC0g pvs3Ios4X4CA6CyiYE9cBQudQRwa8c4VdjKDYTB9naovrEoizmY1hVAQHZB4jckk4jAl tqCJpmHtf1UyBvOzj9m5CqbVaXZnqaconRAOsGNXQJAsJ9br+A7u9+hsCdkPMysuuqt1 5VNTHguTLtSU94CjCnOuUDwlYkyYACGR5/ELXkCKaGSokYsQhKmKXNmIvp3zqWsFKlxZ huUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YSLsdtwZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=AcDoY21O; 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 d9-20020aa7ce09000000b0051e43d9948dsi4738006edv.389.2023.07.12.09.32.11; Wed, 12 Jul 2023 09:32:36 -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=YSLsdtwZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=AcDoY21O; 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 S231774AbjGLQPa (ORCPT + 99 others); Wed, 12 Jul 2023 12:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbjGLQPW (ORCPT ); Wed, 12 Jul 2023 12:15:22 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E292113; Wed, 12 Jul 2023 09:15:18 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A69BA21BF6; Wed, 12 Jul 2023 16:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689178516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+VBw2m9h9l7vvxNuxZsgOqUhypJ0WlLLP87GhZA5AE=; b=YSLsdtwZOTkfjqynfuSJKj0gvd2emXLtxf244R7bExDlFjBODop+V8pZdCoMtk800ot5y1 IGAvjy7xx0LDVfROul9MHc86uhCeGeOVSAjpJXts4n94xNKWkujab22FoWM4Ca8MYoluC9 Ef0qK/McyteLSd3OpzeyQQ3kNOnMbQ0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689178516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+VBw2m9h9l7vvxNuxZsgOqUhypJ0WlLLP87GhZA5AE=; b=AcDoY21OwDC41DctUXzxwi968x4MBiI1tUbqoCeoJ+0xifX83UAemuQdYknb8NdNbQLf4n wR+GMtS7/uRYYCBw== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 37BFD2C142; Wed, 12 Jul 2023 16:15:16 +0000 (UTC) Date: Wed, 12 Jul 2023 18:15:15 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Masahiro Yamada Cc: Takashi Iwai , Lucas De Marchi , Michal =?iso-8859-1?Q?Koutn=FD?= , Jiri Slaby , Jan Engelhardt , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2--to=linux-modules@vger.kernel.org] depmod: Handle installing modules under a prefix Message-ID: <20230712161515.GH9196@kitsune.suse.cz> References: <20230712134533.4419-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 12, 2023 at 11:14:33PM +0900, Masahiro Yamada wrote: > On Wed, Jul 12, 2023 at 10:45 PM Michal Suchanek wrote: > > > > 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) > > You can do "make modules_install INSTALL_MOD_PATH=/usr/what/ever/prefix" > > This patch is unneeded. It's very much needed. INSTALL_MOD_PATH is temporary staging location, KERNEL_MODULE_PREFIX is permanent prefix under which modules are searched. Note that depmod.sh does not use INSTALL_MOD_PATH but uses KERNEL_MODULE_PREFIX. Support for this is added by the corresponding kmod patchset. Thanks Michal > > 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 > > > > > -- > Best Regards > Masahiro Yamada