Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1754864rdb; Mon, 9 Oct 2023 01:32:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaHhu1icYFIK6jPPLQDUascaEgQuV2amWGSx/MYIZdi2ecKzNmEP5MckjWt+iQIEEeuYYP X-Received: by 2002:a05:6a20:da8b:b0:16c:1340:c621 with SMTP id iy11-20020a056a20da8b00b0016c1340c621mr10917214pzb.31.1696840327824; Mon, 09 Oct 2023 01:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696840327; cv=none; d=google.com; s=arc-20160816; b=OPikwCbcVYhKOqtDy8FF5Id9kukoIODhmqaU4dklfMy/pXCpNL5ksqYeufGnqiUaVg cDHaQrs9dvBJURB+tfpK4bWbolWrwgTWJFbDLEIYzFpmCO0fo0YeiTF08/8KBbbAUqr3 fiijNiPSh1MC6UXOWyqdlOt8FXG9RNV9PmzaHtSaJQ6+Xx9+awEBkLjUvi939hwn02l/ fMruStcA9L531cgk1QlCom6H1MPvygElUISDmnQUiUJRrfXGWVQABv7azdsIG4QifNoL v8qwxAGJgYXgwjCPlCb40j/Pso3UCkV+HwxX0BaSp6c8AF5GjN4ikAxy+25F0n6rEKcZ vB3A== 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=TOwCnqGGyA6P7w1lxqFcUtFjLuunHHHrC/PS8beXOl4=; fh=WI8jj9N2gNPwoPAURLqIuIKmvm+eCSu+ckJh2D9Rhnk=; b=mXSJGcQd0tNEWnMc2C4tZkAb6mZifcTXkHUXlLi9ymKSYDRm/Byh7CJesfDL8h+8gr tGYp5l8x1DVkulFvXnyUja+baWmIG8585yBzjVMAtpBfmGM1iU18OaIdA6pUr6CzQdsp PdmnCT/GgmTivEf1USibjTlVtBhE7NJ4/9hhblDIe/7vwT0hFwGglmt304dCe5TR4OPW 3jJT9PLhasjsb3xSowVA5wt37Gijlxi/rvkDGlx7yAZWM3dsaNGlqgUWvNyV9Dgm5GPz Q5ZRxGUmXezS9z+pzy0BAyUCbGgp3g66uejeWlaXFdW71opRgYjOR2QeEBmTOevOW04N 4tQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=guH2wMSM; 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 z19-20020a170903409300b001bbaa5e95fdsi8598548plc.102.2023.10.09.01.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 01:32:07 -0700 (PDT) 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=guH2wMSM; 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 645F5804C497; Mon, 9 Oct 2023 01:32:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234407AbjJIIbn (ORCPT + 99 others); Mon, 9 Oct 2023 04:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234389AbjJIIbl (ORCPT ); Mon, 9 Oct 2023 04:31:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B9F9A3; Mon, 9 Oct 2023 01:31:40 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8368C433C9; Mon, 9 Oct 2023 08:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696840299; bh=k+U5O8rSw/WBFMKyCVGOfUbLEx6tf3XN/L5MZF6Uqa8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=guH2wMSMUCza3wYp4jOLA4YfzvWfYqkGW81raiiNvQHQOOEV4YZXjnvxFarx6CHKG SCkKgmu4jAhc5Pefo7U7YVY4WrYLt4k412V1VX5x8ezqj8LeZ8p7ws1oOHgAE8uRUG zEia8CD6OGSiQJSFXr7i1OWWN/bVENARFtqkvrm5E51Q/FVvWQ1uvKXbMwOWhFCFMl N4IzEYECZV6gD3WoOPuyljoD07eSh1WYrsIpqW+aCKqYwAt8vfV18XhKiLpMi/YKxv GyyKWECp96fexe8ZEQf8DhUmo2mRldh1JSo8MP7X4dQQRrKMBWVvxX3l3SCNQr9fU7 u28yDYbpsWBnw== Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3af64a4c97eso2415831b6e.2; Mon, 09 Oct 2023 01:31:39 -0700 (PDT) X-Gm-Message-State: AOJu0YwqJ2qETXzalIgEi5VNjb2GZDnpYW6+jiC1YKj0Wm6dRCN4J7w8 HbJ5zT44pKa86miee5r7XyWVPTeNGM6XLX1o2n0= X-Received: by 2002:a05:6870:8a0b:b0:1bf:5b4:4a51 with SMTP id p11-20020a0568708a0b00b001bf05b44a51mr13909865oaq.58.1696840299192; Mon, 09 Oct 2023 01:31:39 -0700 (PDT) MIME-Version: 1.0 References: <20231005150728.3429-1-msuchanek@suse.de> In-Reply-To: <20231005150728.3429-1-msuchanek@suse.de> From: Masahiro Yamada Date: Mon, 9 Oct 2023 17:31:02 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB To: Michal Suchanek 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 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]); Mon, 09 Oct 2023 01:32:05 -0700 (PDT) X-Spam-Level: ** 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 hardcoded > 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." ? I do not think so. If your original patch were accepted, how would this patch look like? kernel.spec needs to know the module directory somehow. Would you add the following in scripts/package/mkspec ? %define MODLIB $(pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$' >/dev/null && pkg-config --variable=3Dmodule_directory kmod || echo /lib/modules) > > make 'MODLIB=3D$(INSTALL_MOD_PATH)/usr/lib/modules/$(KERNELRELEASE)' > > However, this middle part of MODLIB is independently hardcoded by > rpm-pkg, and when the user alters MODLIB this is not reflected when > building the package. > > Given that $(INSTALL_MOD_PATH) is overridden during the rpm package build > it is likely going to be empty. Then MODLIB can be passed to the rpm > package, and used in place of the whole > /usr/lib/modules/$(KERNELRELEASE) part. > > Signed-off-by: Michal Suchanek > --- > scripts/package/kernel.spec | 8 ++++---- > scripts/package/mkspec | 1 + > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec > index 3eee0143e0c5..15f49c5077db 100644 > --- a/scripts/package/kernel.spec > +++ b/scripts/package/kernel.spec > @@ -67,7 +67,7 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/b= oot/vmlinuz-%{KERNELRELEA > %{make} %{makeflags} INSTALL_HDR_PATH=3D%{buildroot}/usr headers_install > cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE} > cp .config %{buildroot}/boot/config-%{KERNELRELEASE} > -ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KER= NELRELEASE}/build > +ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}%{MODLIB}/build > %if %{with_devel} > %{make} %{makeflags} run-command KBUILD_RUN_COMMAND=3D'${srctree}/script= s/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE= }' > %endif > @@ -98,8 +98,8 @@ fi > > %files > %defattr (-, root, root) > -/lib/modules/%{KERNELRELEASE} > -%exclude /lib/modules/%{KERNELRELEASE}/build > +%{MODLIB} > +%exclude %{MODLIB}/build > /boot/* > > %files headers > @@ -110,5 +110,5 @@ fi > %files devel > %defattr (-, root, root) > /usr/src/kernels/%{KERNELRELEASE} > -/lib/modules/%{KERNELRELEASE}/build > +%{MODLIB}/build > %endif > diff --git a/scripts/package/mkspec b/scripts/package/mkspec > index d41608efb747..d41b2e5304ac 100755 > --- a/scripts/package/mkspec > +++ b/scripts/package/mkspec > @@ -18,6 +18,7 @@ fi > cat< %define ARCH ${ARCH} > %define KERNELRELEASE ${KERNELRELEASE} > +%define MODLIB ${MODLIB} > %define pkg_release $("${srctree}/init/build-version") > EOF > > -- > 2.42.0 > -- Best Regards Masahiro Yamada