mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin
@ 2010-03-08 11:20 Michal Marek
  2010-03-11  5:03 ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2010-03-08 11:20 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Eric Miao, linux-kernel

Only regenerate it if the configuration has changed. Also, do this after
the modules build to fix errors with some weird Makefiles that are
generated during build.

Reported-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 Makefile |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 2e74a68..160cada 100644
--- a/Makefile
+++ b/Makefile
@@ -882,9 +882,6 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
 PHONY += $(vmlinux-dirs)
 $(vmlinux-dirs): prepare scripts
 	$(Q)$(MAKE) $(build)=$@
-ifdef CONFIG_MODULES
-	$(Q)$(MAKE) $(modbuiltin)=$@
-endif
 
 # Build the kernel release string
 #
@@ -1089,7 +1086,7 @@ ifdef CONFIG_MODULES
 
 # By default, build modules as well
 
-all: modules
+all: modules modules.builtin
 
 #	Build modules
 #
@@ -1100,11 +1097,16 @@ all: modules
 PHONY += modules
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
-	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin
 	@$(kecho) '  Building modules, stage 2.';
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
 
+modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
+	$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
+
+%/modules.builtin: include/config/auto.conf | modules
+	$(Q)$(MAKE) $(modbuiltin)=$*
+
 
 # Target to prepare building external modules
 PHONY += modules_prepare
-- 
1.6.6.1


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

* Re: [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin
  2010-03-08 11:20 [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin Michal Marek
@ 2010-03-11  5:03 ` Stephen Rothwell
  2010-03-11  8:12   ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2010-03-11  5:03 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Eric Miao, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

Hi Michal,

On Mon,  8 Mar 2010 12:20:22 +0100 Michal Marek <mmarek@suse.cz> wrote:
>
> Only regenerate it if the configuration has changed. Also, do this after
> the modules build to fix errors with some weird Makefiles that are
> generated during build.

This breaks a "make modules modules_install" type build:

$ rm -rf ../ntest.obj ../lib
$ mkdir ../ntest.obj ../lib
$ echo CONFIG_MODULES=y >../ntest.conf
$ KCONFIG_ALLCONFIG=../ntest.conf make O=../ntest.obj allnoconfig
	.
	.
$ make O=../ntest.obj INSTALL_MOD_PATH=../ -s modules modules_install
cp: cannot stat `/home/sfr/kernels/ntest.obj/modules.builtin': No such file or directory

reverting that patch allows that build to work again.

Unfortunately, this breaks our test system which like to do

	make zImage
	make modules
	make modules_install

The last step fails :-(
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin
  2010-03-11  5:03 ` Stephen Rothwell
@ 2010-03-11  8:12   ` Michal Marek
  2010-03-11 10:33     ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2010-03-11  8:12 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kbuild, Eric Miao, linux-kernel

Hi Stephen,

On Thu, Mar 11, 2010 at 04:03:26PM +1100, Stephen Rothwell wrote:
> This breaks a "make modules modules_install" type build:
[...]
> $ make O=../ntest.obj INSTALL_MOD_PATH=../ -s modules modules_install
> cp: cannot stat `/home/sfr/kernels/ntest.obj/modules.builtin': No such file or directory

Andrew reported this yesterday, too. The followin patch should fix it
(added to the for-next branch):

>From 73d1393eb8507ed5fd7f8e696f6b1ecc18035ebe Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 10 Mar 2010 12:28:58 +0100
Subject: [PATCH] kbuild: Generate modules.builtin in make modules_install

The previous approach didn't work if one did
make modules && make modules_install
Add modules.builtin as dependency of _modinst_, which is the target that
actually needs the file.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 160cada..b98943a 100644
--- a/Makefile
+++ b/Makefile
@@ -1086,7 +1086,7 @@ ifdef CONFIG_MODULES
 
 # By default, build modules as well
 
-all: modules modules.builtin
+all: modules
 
 #	Build modules
 #
@@ -1104,7 +1104,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
 modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
 	$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
 
-%/modules.builtin: include/config/auto.conf | modules
+%/modules.builtin: include/config/auto.conf
 	$(Q)$(MAKE) $(modbuiltin)=$*
 
 
@@ -1117,7 +1117,7 @@ PHONY += modules_install
 modules_install: _modinst_ _modinst_post
 
 PHONY += _modinst_
-_modinst_:
+_modinst_: modules.builtin
 	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
 		echo "Warning: you may need to install module-init-tools"; \
 		echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
-- 
1.6.6.1


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

* Re: [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin
  2010-03-11  8:12   ` Michal Marek
@ 2010-03-11 10:33     ` Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2010-03-11 10:33 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Eric Miao, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Hi Michal,

On Thu, 11 Mar 2010 09:12:46 +0100 Michal Marek <mmarek@suse.cz> wrote:
>
> On Thu, Mar 11, 2010 at 04:03:26PM +1100, Stephen Rothwell wrote:
> > This breaks a "make modules modules_install" type build:
> [...]
> > $ make O=../ntest.obj INSTALL_MOD_PATH=../ -s modules modules_install
> > cp: cannot stat `/home/sfr/kernels/ntest.obj/modules.builtin': No such file or directory
> 
> Andrew reported this yesterday, too. The followin patch should fix it
> (added to the for-next branch):

Great, thanks.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2010-03-11 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-08 11:20 [PATCH] kbuild: Do not unnecessarily regenerate modules.builtin Michal Marek
2010-03-11  5:03 ` Stephen Rothwell
2010-03-11  8:12   ` Michal Marek
2010-03-11 10:33     ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®