All of lore.kernel.org
 help / color / mirror / Atom feed
* [FWIW PATCH] kbuild: create modules.order in sub-directories visited by subdir-y,m
@ 2019-07-25 15:06 Masahiro Yamada
  0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2019-07-25 15:06 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Jan Kiszka, Masahiro Yamada, Michal Marek, linux-kernel

Jan Kiszka reported a module build regression; since commit ff9b45c55b26
("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod"),
a module is no longer built in the following pattern:

  [Makefile]
  subdir-y := some-module

  [some-module/Makefile]
  obj-m := some-module.o

You can make it work by writing like this:

  [Makefile]
  obj-m := some-module/

  [some-module/Makefile]
  obj-m := some-module.o

None of upstream Makefiles is written like the former. In fact, the
former is a bug in upstream since modules.order is not correctly
generated.

For external modules, it was at least known to work, and being used
by some people.

This commit gets it back working, but I do not to want to encourage it
for the upstream code, so I surrounded it by ifeq ($(KBUILD_EXTMOD),).

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

I just wrote a fix-up patch, but I am still wondering if it is correct
to build modules under subdir-y.


 scripts/Makefile.lib | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5241d0751eb0..9568888c97ca 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
 # and -m subdirs.  Just put -y's first.
 modorder	:= $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
 
+ifeq ($(KBUILD_EXTMOD),)
+# External modules may generate modules under subdir-y or subdir-m.
+modorder += $(addsuffix /modules.order, $(subdir-y) $(subdir-m))
+endif
+
 # Handle objects in subdirs
 # ---------------------------------------------------------------------------
 # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-25 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 15:06 [FWIW PATCH] kbuild: create modules.order in sub-directories visited by subdir-y,m Masahiro Yamada

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.