Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38421003rwd; Wed, 12 Jul 2023 07:28:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlF9hoIWFytsS4edVeqWGDJGM1/c91j6ssW7mFAMyN4Sv+XDDzGiC9GW/qLRa5OzdMZEG1RL X-Received: by 2002:a05:6402:164a:b0:51d:87c6:bf28 with SMTP id s10-20020a056402164a00b0051d87c6bf28mr16506338edx.3.1689172125760; Wed, 12 Jul 2023 07:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689172125; cv=none; d=google.com; s=arc-20160816; b=t7YeFyzeNNDhfdno96IAmJDcR4RL1klMcxPdnCTjGNwLPv210YJ7Ed7qNTEDK9/4J6 gBYSo+aiR0lzVWEvw3jmF1ZP45V4xfDGSgkk83va8ZA54qPvSwL5UepniEbLqna4CbnU msLZTAnIUavn8VemfiQR0jl1tbJIoP23qiY0Kb7m6SKihi5xdrNq1OCDodW1QuM1hq5h C6qrOTU4TV/AJCvUSq/kZzue68T911pDnqjqBV3e36NRSMOuUdDlR/XXeeawY85PKYJN VTnjuwHzi6ZBSL6QkVpxXBo0bAfUcGolCV8Bk2HNQXWp4pULmJEx9Ck3N8wAJejwF1Sv EErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dKNgnkXOz3OidDCH/exWegPyovJiq1UJa425RLx25K4=; fh=JwJPxIPfeHFiEZ/5KZ2g44ulo77v40ESaRjtbQGn5+U=; b=cASLAbPyEpHLnVOpD7VhGyrlbWculQPPEuPCERGM3IXzhhCeCoorCrZoGWb5sVDQUC xWcZ8+0vTJWthSrfMy+HL98z7/RODQmsmsz8wl9wwMlluTRKZzhtmILQrBUks9OhFTel JgBsclTbT7fyl+uuZvyS8dlbTLp8ESt5yGDJFcIyGKBIBUgS8sgZSw8u8pA3ddmdxTQA tIhCQ70MxxiB3czibtKnAlPxkZnM/wUX3Vp/s3sgmqD6aMvoetRsw5/JTSEaPNVZg3Gu X4nDOQe7hb2ZOxUEop4kmtNJQ17eEMWpKjOp70Tdq0IRSHW1QWh8dqagslRD82XJSUTk W5aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r4SsVzTI; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020aa7c1cc000000b0051e26731172si4591340edp.672.2023.07.12.07.28.19; Wed, 12 Jul 2023 07:28:45 -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=@kernel.org header.s=k20201202 header.b=r4SsVzTI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbjGLOPN (ORCPT + 99 others); Wed, 12 Jul 2023 10:15:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233144AbjGLOPM (ORCPT ); Wed, 12 Jul 2023 10:15:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE561995; Wed, 12 Jul 2023 07:15:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4C95617E5; Wed, 12 Jul 2023 14:15:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 564E3C433CC; Wed, 12 Jul 2023 14:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689171310; bh=by9pgSs091khOfV5UGPr4u/YkRYsIghGJCqG/Dm2vrU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=r4SsVzTITyewNYb8iF71bwHYlSJ1zjHEbUWtlSbzqTJmXbSkA1NM9ZzV6yIYDVH5j W5qTGQ44E6vLu/E0CbnMQAv9kb7fIjXjUjGsME+bCgF99NbM0oXcKLbGF83fcig63C t5RI6I3APWoDsRznA+AFEYZvtXqGNplFCD7yFmbOlP1B5sb2jv5x2E0TIsJcb+LxRh HXLln6oTb6zqN789pXnhmKwZZw1L+tYUtuib32FuYqxK4JdDGEJD5zH6I0XsHMSQgS e5aYTFx5rFXIFSa3NIcH/8+ToWEdoUzVkEPJYlVeC0HM/Y4kVYaqz+I5UYwZR9J6vS abPfNss5BAa4g== Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-1b730eb017bso2603073fac.1; Wed, 12 Jul 2023 07:15:10 -0700 (PDT) X-Gm-Message-State: ABy/qLbwd6eWrn+8dA6UGkGmNZlr1zhetYfnKBb6mRg2IAW/xPA91um2 5Uc+Xgl+bhK5LIgxdRIspOCkWWWeEGW9Q3ewMuE= X-Received: by 2002:a05:6870:fba7:b0:1b0:3075:2f9d with SMTP id kv39-20020a056870fba700b001b030752f9dmr19101840oab.34.1689171309578; Wed, 12 Jul 2023 07:15:09 -0700 (PDT) MIME-Version: 1.0 References: <20230712134533.4419-1-msuchanek@suse.de> In-Reply-To: <20230712134533.4419-1-msuchanek@suse.de> From: Masahiro Yamada Date: Wed, 12 Jul 2023 23:14:33 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2--to=linux-modules@vger.kernel.org] depmod: Handle installing modules under a prefix To: Michal Suchanek Cc: Takashi Iwai , Lucas De Marchi , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Jiri Slaby , Jan Engelhardt , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 On Wed, Jul 12, 2023 at 10:45=E2=80=AFPM 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 ?=3D $(INSTALL_PATH)/dtbs/= $(KERNELRELEASE) > # makefile but the argument can be passed to make if needed. > # > > -MODLIB =3D $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) > +export KERNEL_MODULE_PREFIX :=3D $(shell kmod config &> /dev/null && kmo= d config | jq -r .module_prefix) > + > +MODLIB =3D $(INSTALL_MOD_PATH)$(KERNEL_MODULE_PREFIX)/lib/modules/$(KERN= ELRELEASE) You can do "make modules_install INSTALL_MOD_PATH=3D/usr/what/ever/prefix" This patch is unneeded. > export MODLIB > > 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/$KERNELRELE= ASE/modules.dep" -o \ > + -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELE= ASE/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.$KERNELRELEASE" > ln -s "$KERNELRELEASE" "$symlink" > KERNELRELEASE=3D99.98.$KERNELRELEASE > fi > -- > 2.41.0 > --=20 Best Regards Masahiro Yamada