Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1961729rdb; Mon, 9 Oct 2023 08:16:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFob7yKZ9k1WM/x6gPF7XxKtOiA/4cK3bCN+oo2E095PlVkgHgLoIdxaA09aH11HMcFjBfG X-Received: by 2002:a17:902:ceca:b0:1c8:90bf:4239 with SMTP id d10-20020a170902ceca00b001c890bf4239mr8059616plg.42.1696864573525; Mon, 09 Oct 2023 08:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696864573; cv=none; d=google.com; s=arc-20160816; b=mQJS95r5Sq66WW0d0RNORR+8jmUOBDiP4m8sDKGuDXKjNjFHU/yy4UE2uqZ2ZOlh+i in6uPNmSBJk2FTS5Kc+rkrdK7+aOfp1op3TZZonPzkKwn5rhwxBAyksRHlNxZ0M3B2N+ KgC9GPw817zMsAdvDts1wfxZulRBihmUZT2i+QUO7ouwjdSyuYXeNtkqJTjUcPF9Ee7a jCsKAu7JqMEIO/Xzp2oEv48K1eUohTR0ne08KAHOBI7n5SSA5gx19DE5k6Vz0E3Htb4L T9RhrzVTeIwNgIzyZXTfeiHoolwuVNJKLdJrxGXJqWadvyhxpcXLZAxuBqwTocsce7Z7 /dJA== 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=y9R/GEGvgLKw5+p8v+Ap8jz+s59m1gjdJEdePGDwuhs=; fh=5O9Z7jMC5VVoHpDXA5JzEVHo95a+h5NIAVnStP+aN/8=; b=pd6rAf3lRJrQO9pOFhFwNOmtF3L3H4GzPRinQxwI1+fzfYWRam7bi4CWONccZxyhkK iVDUMzIDKEXLWQugE6QkB9RnFF32wBx4NqdwtspgxwYZphHPZ5pu1xUN8wEO/zLxN9ts hBoNWT6aUz+UK17h02Su5DgMjRy5xYi7fYmfaRspLr8PKHVLhDDjfm0qargQhZQF9TAQ 3KhdfpL0cQLqHAD2vKwZc6FibMzlnCrrzpF2c87B0c3bhbaC7POlwRddcdivIY+LoXaL GiUgeIkhv72PlOJN2H70efNaCNcSxyawqWka2o54BVhoAfWZv72562qhYyEi0sXW6iTR Mg4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpLYQDwI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id r17-20020a170902c61100b001c5fd2a242asi9256760plr.363.2023.10.09.08.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpLYQDwI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id B27CF801C9DE; Mon, 9 Oct 2023 08:16:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377617AbjJIPPg (ORCPT + 99 others); Mon, 9 Oct 2023 11:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377709AbjJIPPI (ORCPT ); Mon, 9 Oct 2023 11:15:08 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF58A11C; Mon, 9 Oct 2023 08:14:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11812C43391; Mon, 9 Oct 2023 15:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696864479; bh=+ZfZqRjLTizvALSqDqCC1fwDOV+CINpIZmqOtUE1B8Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=JpLYQDwIItDww8h1Oe0EKmYLQKZ9gPJ/nBfhUZINrjzcK44E2pH9LbGq4M801/Z7a EpX6F2QfjDIUYddDEH9f24QebJYEInngy55wVMc+zpv9VLkf2UrCmv1UmEO6PFEN55 kUpIEhwl+m/phMPOci7nM8DQs/OpMVks0WW7aKz5kVqZNIOQ8teScG2AeZ7LNJYLLi 1M0Bp0eB9f6v9ufohRq9MDSevU5v0j35GtKY1hDHZYceh2oSVbLPQDAd9TFg1UCyc8 8Xu4CglL2wJfuQjMtlS84+hmS9P5xGqnzFkormcIMpcJ21NLOtO4qEwQR4cJntEBzm lJ/sFKghG7A/w== Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6c615df24c0so3159510a34.1; Mon, 09 Oct 2023 08:14:39 -0700 (PDT) X-Gm-Message-State: AOJu0YweTN9MurDpLcikIUZpSZLvShTOvZZ225AZ6ms/ljgYe5ldyvYw yV6Almplgogud/+wQ2cTsopdqMsib5J09i2SpVg= X-Received: by 2002:a05:6870:e307:b0:1bb:a227:7008 with SMTP id z7-20020a056870e30700b001bba2277008mr17284004oad.3.1696864478369; Mon, 09 Oct 2023 08:14:38 -0700 (PDT) MIME-Version: 1.0 References: <20231005150728.3429-1-msuchanek@suse.de> <20231009085208.GT6241@kitsune.suse.cz> <20231009140733.GV6241@kitsune.suse.cz> In-Reply-To: <20231009140733.GV6241@kitsune.suse.cz> From: Masahiro Yamada Date: Tue, 10 Oct 2023 00:14:01 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB To: =?UTF-8?Q?Michal_Such=C3=A1nek?= Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Schier , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 08:16:10 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 9, 2023 at 11:07=E2=80=AFPM Michal Such=C3=A1nek wrote: > > On Mon, Oct 09, 2023 at 09:34:10PM +0900, Masahiro Yamada wrote: > > On Mon, Oct 9, 2023 at 5:52=E2=80=AFPM Michal Such=C3=A1nek wrote: > > > > > > Hello, > > > > > > On Mon, Oct 09, 2023 at 05:31:02PM +0900, Masahiro Yamada wrote: > > > > On Fri, Oct 6, 2023 at 12:49=E2=80=AFAM Michal Suchanek wrote: > > > > > > > > > > The default MODLIB value is composed of two variables and the har= dcoded > > > > > string '/lib/modules/'. > > > > > > > > > > MODLIB =3D $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) > > > > > > > > > > Defining this middle part as a variable was rejected on the basis= that > > > > > users can pass the whole MODLIB to make, such as > > > > > > > > > > > > In other words, do you want to say > > > > > > > > "If defining this middle part as a variable had been accepted, > > > > this patch would have been unneeded." ? > > > > > > If it were accepted I would not have to guess what the middle part is= , > > > and could use the variable that unambiguosly defines it instead. > > > > > > How? > > > > scripts/package/kernel.spec hardcodes 'lib/modules' > > in a couple of places. > > > > I am asking how to derive the module path. > > Not sure what you are asking here. The path is hardcoded, everywhere. > > The current Makefile has > > MODLIB =3D $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) > > and there is no reliable way to learn what the middle part was after the > fact - $(INSTALL_MOD_PATH) can be non-empty. > > The rejected patch was changing this to a variable, and also default to > adjusting the content to what kmod exports in pkgconfig after applying a > proposed patch to make this hardcoded part configurable: > > export KERNEL_MODULE_DIRECTORY :=3D $(shell pkg-config --print-variables = kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --va= riable=3Dmodule_directory kmod || echo /lib/modules) > > MODLIB =3D $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE= ) > > It would be completely posible to only define the middle part as a > variable that could then be used in rpm-pkg: > > export KERNEL_MODULE_DIRECTORY :=3D /lib/modules > > MODLIB =3D $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE= ) > > Thanks > > Michal > > Let me add more context to my question. I am interested in the timing when 'pkg-config --print-variables kmod | grep module_directory' is executed. 1. Build a SRPM on machine A 2. Copy the SRPM from machine A to machine B 3. Run rpmbuild on machine B to build the SRPM into a RPM 4. Copy the RPM from machine B to machine C 5. Install the RPM to machine C Of course, we are most interested in the module path of machine C, but it is difficult/impossible to guess it at the time of building. We can assume machine B =3D=3D machine C. We are the second most interested in the module path on machine B. The module path of machine A is not important. So, I am asking where you would inject 'pkg-config --print-variables kmod | grep module_directory'. --=20 Best Regards Masahiro Yamada