Re: 2.6.13-rc3-mm2 (kbuild broken for external modules)

Sam Ravnborg
2005-07-27T19:18:55Z

On Wed, Jul 27, 2005 at 02:08:57PM +0200, Miklos Szeredi wrote:
> > git-kbuild.patch
>
> This breaks building of external modules:
>
> make -C /usr/src/linux-2.6.13-rc3-mm2 M=/home/miko/fuse/kernel modules
> make[1]: Entering directory `/usr/src/linux-2.6.13-rc3-mm2'
>
> WARNING: Symbol version dump /usr/src/linux-2.6.13-rc3-mm2/Module.symvers
> is missing; modules will have no dependencies and modversions.
>
> scripts/Makefile.build:14: /usr/src/linux-2.6.13-rc3-mm2//home/miko/fuse/kernel/Makefile: No such file or directory
> make[2]: *** No rule to make target `/usr/src/linux-2.6.13-rc3-mm2//home/miko/fuse/kernel/Makefile'. Stop.
> make[1]: *** [_module_/home/miko/fuse/kernel] Error 2
> make[1]: Leaving directory `/usr/src/linux-2.6.13-rc3-mm2'
> make: *** [all-spec] Error 2

Thanks for the report. I had overlooked this usage when modifying this
part of kbuild.
The following fix it - and work in the following test setups:
make
make O=
make M=
make O= M=

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -11,8 +11,8 @@ __build:
-include .config

# The filename Kbuild has precedence over Makefile
-include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
- $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
+kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)

include scripts/Kbuild.include
include scripts/Makefile.lib
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -13,8 +13,8 @@ __clean:
clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj

# The filename Kbuild has precedence over Makefile
-include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
- $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
+kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)

# Figure out what we need to build from the various variables
# ==========================================================================