Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3750435rdb; Sun, 10 Dec 2023 20:30:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjWAWGQrsRKpBZDyuaftAyOYGGuo7qdrwSWvKnN3MRuNVn7FM49hHaacenGjq1og3rIJf3 X-Received: by 2002:a05:6a20:244d:b0:18f:d6eb:2627 with SMTP id t13-20020a056a20244d00b0018fd6eb2627mr4478553pzc.49.1702269039611; Sun, 10 Dec 2023 20:30:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702269039; cv=none; d=google.com; s=arc-20160816; b=Q4rXVYH9sfNcEAZxIn1R7Zni9KtAYj9RM7mpdJmiD6cQVksDydEBJpTUHkS14CFO+7 T70PbE7G7SgJJFh4lsFPX9IOSJKnHWtU//wLq01ZMoEcOueeMmV9h4Ri9jASYSXacJ+w MpGyVLN3SFsplKFsDgYrs3bZkanjPmJHlcvQeeJCvBN90BjSKlt2NoISdnsnZ8obDI9P rPoYNx3Bbe2fNh186Jodoyit/r+pivciRsC86NGO+SDIw4UJS/zG0iLAb5GdL6PTEfV5 jTtB3rPvhZGQ4Xbv9Sfra1T0O0M7wpki5h9ypDVw/LBdhoOOmRrfADv7N8t7KU1vQFzO 23eA== 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=fFpdY56nqNtj6FKl/ZTi9jdkjZzoNjtzxelIvD1TVaA=; fh=PigGyr0k2UHxlHDObR4tN2IY8Z8lWBCCEIGD12vhblo=; b=ZBH/Q/zHDtnUmeLN/Tm8YBOh1xJK1xF63uAIMQPic98+tUoHi1UlBDj7lhmNYHSwXD lgQpJnJtuyMR+aOdIXkNp7NW608T2R9Hlv06T2i+f5xstC7jVkLUgMj3zVjAMb4E7n30 3Jt9NOJX3ZMvYJIDFpPpCSCiNNGc+7NFIoL6oPpwv7wHgR9FSoF05MP92vRttVP/RSzj s1DaV0LRCLnD2rvnz0J8U6rPTgYcdsVEhSY5mp3DUQv6pdACGbGVpszPm3x/Zb3XUK2L jMFqkkTD8dzz7O0LXYx3QS4MZZoyF2+/XzZuycIOiIzeL9W7J6JqIjbe6yUHdd4ggChj gRkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YJv6n4JY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q19-20020a62ae13000000b006be3c302801si5315011pff.397.2023.12.10.20.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 20:30:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YJv6n4JY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DF905807A5B2; Sun, 10 Dec 2023 20:30:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjLKE3r (ORCPT + 99 others); Sun, 10 Dec 2023 23:29:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjLKE3q (ORCPT ); Sun, 10 Dec 2023 23:29:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20898EB for ; Sun, 10 Dec 2023 20:29:53 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD1FC433CC; Mon, 11 Dec 2023 04:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702268992; bh=CBIN7qE+dliGQVl5j5og6YUs6cyR0Ka0T/R9rGOhhVU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YJv6n4JYKDZbZnL1IZinNVmq91C5KWjElFWNCAMnFteZnZR+1IGy8rrTFCmWF48g8 0YdpQloW7HStuQfhuaeHBUdVtwQQEyo9bY36scNvK1S2GQzn3c9QFHZGMSHJYyiVjC aUKwIreqnm3T+MySdXu76jR3gS77mEkhhcXtlM5icazEt0XmshYBi0dF3esHVS+iFe +5CdMIrz18pZhkaJBUgQEqYMH0SccaVdJKcYaKD0ybYdn++f7aqWWVsZuR3NuXRIs7 aDay/IHReIFpMd085N7jEafs3LNPioUp1iBS+IU5IQ/SZkhpddzhqAR/tG3JVnQGmL xx00cVIEiHM2A== Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3ba0d0a72dfso171163b6e.1; Sun, 10 Dec 2023 20:29:52 -0800 (PST) X-Gm-Message-State: AOJu0Yx8nDfcbv7S6eKKuBT0TDkwr1EWsTLP5h+gneDc3QaJHLt8ADNH JPCdZkbizvEjXxp+aGJiT3XmNsAin6oIAh3HehQ= X-Received: by 2002:a05:6808:190a:b0:3b9:e87b:a72f with SMTP id bf10-20020a056808190a00b003b9e87ba72fmr2676335oib.25.1702268991724; Sun, 10 Dec 2023 20:29:51 -0800 (PST) MIME-Version: 1.0 References: <32b332af189bfca8acdb231cee294355aa4af290.1701892062.git.msuchanek@suse.de> <20231210210748.GM9696@kitsune.suse.cz> In-Reply-To: <20231210210748.GM9696@kitsune.suse.cz> From: Masahiro Yamada Date: Mon, 11 Dec 2023 13:29:15 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 1/2] depmod: Handle installing modules under a different directory To: =?UTF-8?Q?Michal_Such=C3=A1nek?= Cc: linux-modules@vger.kernel.org, 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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 10 Dec 2023 20:30:37 -0800 (PST) On Mon, Dec 11, 2023 at 6:07=E2=80=AFAM Michal Such=C3=A1nek wrote: > > Hello! > > On Mon, Dec 11, 2023 at 03:43:44AM +0900, Masahiro Yamada wrote: > > On Thu, Dec 7, 2023 at 4:48=E2=80=AFAM Michal Suchanek wrote: > > > > > > Some distributions aim at shipping all files in /usr. > > > > > > The path under which kernel modules are installed is hardcoded to /li= b > > > which conflicts with this goal. > > > > > > When kmod provides kmod.pc, use it to determine the correct module > > > installation path. > > > > > > With kmod that does not provide the config /lib/modules is used as > > > before. > > > > > > While pkg-config does not return an error when a variable does not ex= ist > > > the kmod configure script puts some effort into ensuring that > > > module_directory is non-empty. With that empty module_directory from > > > pkg-config can be used to detect absence of the variable. > > > > > > Signed-off-by: Michal Suchanek > > > --- > > > v6: > > > - use ?=3D instead of :=3D to make it easier to override the value > > > > > > "KERNEL_MODULE_DIRECTORY=3D/local/usr/lib/modules make modules_install" > > will override the install destination, but > > depmod will not be not aware of it. > > At the same time if you know what you are doing you can build a src rpm > for another system that uses a different location. > > > How to avoid the depmod error? > > Not override the variable? You are not answering my question. You intentionally changed :=3D to ?=3D. This implies that KERNEL_MODULE_DIRECTORY is an interface to users, and should be documented in Documentation/kbuild/kbuild.rst However, it never works if it is overridden from the env variable or make command line because there is no way to let depmod know the fact that KERNEL_MODULE_DIRECTORY has been overridden. In my understanding, depmod does not provide an option to specify the module directory from a command line option, does it? If not, is it reasonable to add a new option to depmod? depmod provides the "-b basedir" option, but it only allows adding a prefix to the default "/lib/modules/". (My original idea to provide the prefix_part, it would have worked like -b "${INSTALL_MOD_PATH}${MOD_PREFIX}", which you refused) > Thanks > > Michal > > > > - use shorter expression for determining the module directory assumi= ng > > > it's non-empty > > > --- > > > Makefile | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/Makefile b/Makefile > > > index 511b5616aa41..84f32bd563d4 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -1081,7 +1081,9 @@ export INSTALL_DTBS_PATH ?=3D $(INSTALL_PATH)/d= tbs/$(KERNELRELEASE) > > > # makefile but the argument can be passed to make if needed. > > > # > > > > > > -MODLIB =3D $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) > > > +export KERNEL_MODULE_DIRECTORY ?=3D $(or $(shell pkg-config --variab= le=3Dmodule_directory kmod 2>/dev/null),/lib/modules) > > > + > > > +MODLIB =3D $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELREL= EASE) > > > export MODLIB > > > > > > PHONY +=3D prepare0 > > > -- > > > 2.42.0 > > > > > > > > > > > > -- > > Best Regards > > Masahiro Yamada > --=20 Best Regards Masahiro Yamada