linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: revive single target %.ko
@ 2019-08-02 10:23 Masahiro Yamada
  2019-08-07 15:15 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2019-08-02 10:23 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Don Brace, Arend Van Spriel, Masahiro Yamada, Michal Marek, linux-kernel

I removed the single target %.ko in commit ff9b45c55b26 ("kbuild:
modpost: read modules.order instead of $(MODVERDIR)/*.mod") because
the modpost stage does not work reliably. For instance, the module
dependency, modversion, etc. do not work if we lack symbol information
from the other modules.

Yet, some people still want to build only one module in their interest,
and it may be still useful if it is used within those limitations.

Fixes: ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
Reported-by: Don Brace <don.brace@microsemi.com>
Reported-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index 571cf862d7a4..e4c7211f5a3b 100644
--- a/Makefile
+++ b/Makefile
@@ -997,6 +997,8 @@ endif
 
 PHONY += prepare0
 
+export MODORDER := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order
+
 ifeq ($(KBUILD_EXTMOD),)
 core-y		+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
 
@@ -1766,6 +1768,10 @@ build-dir = $(patsubst %/,%,$(dir $(build-target)))
 	$(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
 %.symtypes: prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
+%.ko: prepare FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(build-target:.ko=.mod)
+	$(Q)echo $(build-target) > $(MODORDER)
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost || { rm -f $(MODORDER); false; }
 
 # Modules
 PHONY += /
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: revive single target %.ko
  2019-08-02 10:23 [PATCH] kbuild: revive single target %.ko Masahiro Yamada
@ 2019-08-07 15:15 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2019-08-07 15:15 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: Don Brace, Arend Van Spriel, Michal Marek, Linux Kernel Mailing List

On Fri, Aug 2, 2019 at 7:24 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> I removed the single target %.ko in commit ff9b45c55b26 ("kbuild:
> modpost: read modules.order instead of $(MODVERDIR)/*.mod") because
> the modpost stage does not work reliably. For instance, the module
> dependency, modversion, etc. do not work if we lack symbol information
> from the other modules.
>
> Yet, some people still want to build only one module in their interest,
> and it may be still useful if it is used within those limitations.
>
> Fixes: ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
> Reported-by: Don Brace <don.brace@microsemi.com>
> Reported-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Applied to linux-kbuild/fixes.

>
>  Makefile | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 571cf862d7a4..e4c7211f5a3b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -997,6 +997,8 @@ endif
>
>  PHONY += prepare0
>
> +export MODORDER := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order
> +
>  ifeq ($(KBUILD_EXTMOD),)
>  core-y         += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
>
> @@ -1766,6 +1768,10 @@ build-dir = $(patsubst %/,%,$(dir $(build-target)))
>         $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
>  %.symtypes: prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
> +%.ko: prepare FORCE
> +       $(Q)$(MAKE) $(build)=$(build-dir) $(build-target:.ko=.mod)
> +       $(Q)echo $(build-target) > $(MODORDER)
> +       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost || { rm -f $(MODORDER); false; }
>
>  # Modules
>  PHONY += /
> --
> 2.17.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-07 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 10:23 [PATCH] kbuild: revive single target %.ko Masahiro Yamada
2019-08-07 15:15 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).