All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Suchanek <msuchanek@suse.de>
To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Nicolas Schier" <nicolas@fjasle.eu>,
	linux-modules@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
	"Lucas De Marchi" <lucas.de.marchi@gmail.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Jiri Slaby" <jslaby@suse.com>,
	"Jan Engelhardt" <jengelh@inai.de>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Michal Suchanek" <msuchanek@suse.de>
Subject: [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB
Date: Thu,  5 Oct 2023 17:07:28 +0200	[thread overview]
Message-ID: <20231005150728.3429-1-msuchanek@suse.de> (raw)

The default MODLIB value is composed of two variables and the hardcoded
string '/lib/modules/'.

MODLIB = $(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

make 'MODLIB=$(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 <msuchanek@suse.de>
---
 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}/boot/vmlinuz-%{KERNELRELEA
 %{make} %{makeflags} INSTALL_HDR_PATH=%{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/%{KERNELRELEASE}/build
+ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}%{MODLIB}/build
 %if %{with_devel}
 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/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<<EOF
 %define ARCH ${ARCH}
 %define KERNELRELEASE ${KERNELRELEASE}
+%define MODLIB ${MODLIB}
 %define pkg_release $("${srctree}/init/build-version")
 EOF
 
-- 
2.42.0


             reply	other threads:[~2023-10-05 15:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 15:07 Michal Suchanek [this message]
2023-10-06 16:58 ` [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB Nathan Chancellor
2023-10-09  8:31 ` Masahiro Yamada
2023-10-09  8:52   ` Michal Suchánek
2023-10-09 12:34     ` Masahiro Yamada
2023-10-09 14:07       ` Michal Suchánek
2023-10-09 15:14         ` Masahiro Yamada
2023-10-09 16:01           ` Jan Engelhardt
2023-10-10 10:15           ` Michal Suchánek
2023-10-17 10:15             ` Masahiro Yamada
2023-10-17 10:44               ` Michal Suchánek
2023-10-17 12:05                 ` Masahiro Yamada
2023-10-17 12:27                   ` Michal Suchánek
2023-10-17 14:46                     ` Masahiro Yamada
2023-10-17 15:10                       ` Michal Suchánek
2023-10-18  1:12                         ` Jan Engelhardt
2023-11-10 17:44                           ` Michal Suchánek
2023-11-10 17:57                             ` Jan Engelhardt
2023-12-06 19:47                       ` [PATCH v6 1/2] depmod: Handle installing modules under a different directory Michal Suchanek
2023-12-10 18:43                         ` Masahiro Yamada
2023-12-10 18:51                           ` Woody Suwalski
2023-12-10 21:07                           ` Michal Suchánek
2023-12-11  4:29                             ` Masahiro Yamada
2023-12-12 13:03                               ` Michal Suchánek
2023-12-18 14:05                                 ` Masahiro Yamada
2023-12-06 19:47                       ` [PATCH v6 2/2] kbuild: rpm-pkg: Fix build with non-default MODLIB Michal Suchanek
2023-12-10 18:44                         ` Masahiro Yamada
2023-12-10 21:08                           ` Michal Suchánek
2023-12-11  4:33                             ` Masahiro Yamada
2023-12-12 13:12                               ` Michal Suchánek
2023-12-18 14:16                                 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231005150728.3429-1-msuchanek@suse.de \
    --to=msuchanek@suse.de \
    --cc=jengelh@inai.de \
    --cc=jslaby@suse.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=mkoutny@suse.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.