Skip to contentSkip to conversation

kbuild: Support building a tree of modules with -M=<root>

PATCH In review Shaun Tancheff 2 participants 6 messages Aug 9, 2019 – Aug 13, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover kbuild: Support building a tree of modules with -M=<root>

Currently when building lustre against 5.3 kernel modules fail to generate <module>.ko files.

Lustre builds a tree of modules however the numerous modules.order files are created but only the modules.order file at the root appears to be read.

This changes the the scheme for KBUILD_EXTMOD to write to and read from a single modules.order file at the root.

Shaun Tancheff (1):
kbuild: recursive build of external kernel modules

 Makefile               | 1 +
 scripts/Makefile.build | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 kbuild: recursive build of external kernel modules

When building a tree of external modules stage 2 fails silently as the root modules.order is empty.

Modify the modules.order location to be fixed to the root when KBUILD_EXTMOD is specified and write all module paths to the single modules.order file.

---
 Makefile               | 1 +
 scripts/Makefile.build | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Makefile +1 -0
index 23cdf1f41364..a9964492f47e 100644
@@ -1622,6 +1622,7 @@ $(module-dirs): prepare $(objtree)/Module.symvers
 
 modules: $(module-dirs)
 	@$(kecho) '  Building modules, stage 2.';
+	$(Q)$rm -f $(KBUILD_EXTMOD)/modules.order
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
 PHONY += modules_install
scripts/Makefile.build +7 -1
index 0d434d0afc0b..f9908b3d59e0 100644
@@ -64,7 +64,13 @@ builtin-target := $(obj)/built-in.a
 endif
 
 ifeq ($(CONFIG_MODULES)$(need-modorder),y1)
+ifneq ($(KBUILD_EXTMOD),)
+modorder-target := $(KBUILD_EXTMOD)/modules.order
+modorder-add := >>
+else
 modorder-target := $(obj)/modules.order
+modorder-add := >
+endif
 endif
 
 mod-targets := $(patsubst %.o, %.mod, $(obj-m))
@@ -423,7 +429,7 @@ endif # builtin-target
 $(modorder-target): $(subdir-ym) FORCE
 	$(Q){ $(foreach m, $(modorder), \
 	$(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
-	| $(AWK) '!x[$$0]++' - > $@
+	| $(AWK) '!x[$$0]++' - $(modorder-add) $@
 
 #
 # Rule to compile a set of .o files into one .a file (with symbol table)
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 1/1] kbuild: recursive build of external kernel modules

Quoted 7 lines · Shaun Tancheff

When building a tree of external modules stage 2 fails silently as the root modules.order is empty.

Modify the modules.order location to be fixed to the root when KBUILD_EXTMOD is specified and write all module paths to the single modules.order file.

Could you try v5.3-rc4 please?

Quoted 48 lines
---
 Makefile               | 1 +
 scripts/Makefile.build | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Makefile +1 -0
index 23cdf1f41364..a9964492f47e 100644
@@ -1622,6 +1622,7 @@ $(module-dirs): prepare $(objtree)/Module.symvers
 
 modules: $(module-dirs)
        @$(kecho) '  Building modules, stage 2.';
+       $(Q)$rm -f $(KBUILD_EXTMOD)/modules.order
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
 PHONY += modules_install
scripts/Makefile.build +7 -2
index 0d434d0afc0b..f9908b3d59e0 100644
@@ -64,7 +64,13 @@ builtin-target := $(obj)/built-in.a
 endif
 
 ifeq ($(CONFIG_MODULES)$(need-modorder),y1)
+ifneq ($(KBUILD_EXTMOD),)
+modorder-target := $(KBUILD_EXTMOD)/modules.order
+modorder-add := >>
+else
 modorder-target := $(obj)/modules.order
+modorder-add := >
+endif
 endif
 
 mod-targets := $(patsubst %.o, %.mod, $(obj-m))
@@ -423,7 +429,7 @@ endif # builtin-target
 $(modorder-target): $(subdir-ym) FORCE
        $(Q){ $(foreach m, $(modorder), \
        $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
-       | $(AWK) '!x[$$0]++' - > $@
+       | $(AWK) '!x[$$0]++' - $(modorder-add) $@
 
 #
 # Rule to compile a set of .o files into one .a file (with symbol table)
--

2.20.1

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

Re: [PATCH 1/1] kbuild: recursive build of external kernel modules

Quoted 11 lines · Masahiro Yamada
Quoted 7 lines · Shaun Tancheff

When building a tree of external modules stage 2 fails silently as the root modules.order is empty.

Modify the modules.order location to be fixed to the root when KBUILD_EXTMOD is specified and write all module paths to the single modules.order file.

Could you try v5.3-rc4 please?

So it seems we are using 'subdir-m' but that is now gone?

Is there a recommend pattern for backward compatibility?

Thanks!

Quoted 54 lines
Quoted 47 lines
---
 Makefile               | 1 +
 scripts/Makefile.build | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Makefile +1 -0
index 23cdf1f41364..a9964492f47e 100644
@@ -1622,6 +1622,7 @@ $(module-dirs): prepare $(objtree)/Module.symvers
 
 modules: $(module-dirs)
        @$(kecho) '  Building modules, stage 2.';
+       $(Q)$rm -f $(KBUILD_EXTMOD)/modules.order
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
 PHONY += modules_install
scripts/Makefile.build +7 -2
index 0d434d0afc0b..f9908b3d59e0 100644
@@ -64,7 +64,13 @@ builtin-target := $(obj)/built-in.a
 endif
 
 ifeq ($(CONFIG_MODULES)$(need-modorder),y1)
+ifneq ($(KBUILD_EXTMOD),)
+modorder-target := $(KBUILD_EXTMOD)/modules.order
+modorder-add := >>
+else
 modorder-target := $(obj)/modules.order
+modorder-add := >
+endif
 endif
 
 mod-targets := $(patsubst %.o, %.mod, $(obj-m))
@@ -423,7 +429,7 @@ endif # builtin-target
 $(modorder-target): $(subdir-ym) FORCE
        $(Q){ $(foreach m, $(modorder), \
        $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
-       | $(AWK) '!x[$$0]++' - > $@
+       | $(AWK) '!x[$$0]++' - $(modorder-add) $@
 
 #
 # Rule to compile a set of .o files into one .a file (with symbol table)
--
Quoted 2 lines

2.20.1

--
Best Regards
Masahiro Yamada

#4 lore raw

Re: [PATCH 1/1] kbuild: recursive build of external kernel modules

Quoted 13 lines · Shaun Tancheff
Quoted 10 lines · Masahiro Yamada
Quoted 7 lines · Shaun Tancheff

When building a tree of external modules stage 2 fails silently as the root modules.order is empty.

Modify the modules.order location to be fixed to the root when KBUILD_EXTMOD is specified and write all module paths to the single modules.order file.

Quoted 7 lines
Quoted 1 line

Could you try v5.3-rc4 please?

So it seems we are using 'subdir-m' but that is now gone?

Is there a recommend pattern for backward compatibility?

Thanks!

Please convert

subdir-m += dir1
subdir-m += dir2

into

obj-m += dir1/
obj-m += dir2/

Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
#5 lore raw

Re: [PATCH 1/1] kbuild: recursive build of external kernel modules

Quoted 26 lines · Masahiro Yamada
Quoted 13 lines · Shaun Tancheff
Quoted 10 lines · Masahiro Yamada
Quoted 7 lines · Shaun Tancheff

When building a tree of external modules stage 2 fails silently as the root modules.order is empty.

Modify the modules.order location to be fixed to the root when KBUILD_EXTMOD is specified and write all module paths to the single modules.order file.

Quoted 7 lines
Quoted 1 line

Could you try v5.3-rc4 please?

So it seems we are using 'subdir-m' but that is now gone?

Is there a recommend pattern for backward compatibility?

Thanks!

Please convert

Quoted 7 lines

subdir-m += dir1
subdir-m += dir2

into

obj-m += dir1/
obj-m += dir2/

After working through some local quirks everything is working now. Thanks!

Quoted 7 lines

Thanks.

--
Best Regards
Masahiro Yamada