* Building external modules against objdirs
@ 2006-07-30 16:46 Andi Kleen
2006-07-30 17:51 ` Sam Ravnborg
0 siblings, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2006-07-30 16:46 UTC (permalink / raw)
To: sam; +Cc: linux-kernel, agruen
Hi,
It looks like building external modules against separate objdirs doesn't work
anymore in 2.6.18.
tmod is a simple module I use for some testing.
obj-* are objdirs tree built against separate source with make O=$(pwd) -C ../linux-...
> cat Makefile
obj-m := tmod.o
KERNELDIR := /lib/modules/`uname -r`/build
all:
$(MAKE) -C ${KERNELDIR} M=`pwd`
With 2.6.17 it works great:
> make KERNELDIR=/home/lsrc/obj-2.6.17
make -C /home/lsrc/obj-2.6.17 M=`pwd`
make[1]: Entering directory `/home/lsrc/obj-2.6.17'
make -C /home/lsrc/linux-2.6.17 O=/home/lsrc/obj-2.6.17
Building modules, stage 2.
MODPOST
CC /home/andi/tsrc/tmod/tmod.mod.o
LD [M] /home/andi/tsrc/tmod/tmod.ko
make[1]: Leaving directory `/home/lsrc/obj-2.6.17'
But with 2.6.18-rc3 it doesn't work anymore. I saw this for at least a few weeks already
with 2.6.17-git*, but only realized now it wasn't some stupid mistake on my side.
> make -C /home/lsrc/quilt/obj M=`pwd`
make[1]: Entering directory `/home/lsrc/quilt/obj'
make -C /basil/home/lsrc/quilt/linux O=/basil/home/lsrc/quilt/obj
/home/lsrc/quilt/linux/Makefile:456: *** kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
make[2]: *** [_all] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/lsrc/quilt/obj'
make: *** [all] Error 2
Is there a workaround? It would be good to fix it for 2.6.18 because it will
likely cause trouble for a lot of external projects.
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 17:51 ` Sam Ravnborg
@ 2006-07-30 17:49 ` Andi Kleen
2006-07-30 18:31 ` Sam Ravnborg
2006-07-30 18:34 ` Sam Ravnborg
0 siblings, 2 replies; 11+ messages in thread
From: Andi Kleen @ 2006-07-30 17:49 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, agruen
> Can you check that you really did a 'make prepare' in the relevant
> output directory. Previously only the make *config step was needed.
The output directory is a full build (configuration + make without any targets).
Is that not enough anymore?
Anyways after a make prepare it seems to work - thanks - but I think that
should be really done as part of the standard build like it was in 2.6.17.
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 16:46 Building external modules against objdirs Andi Kleen
@ 2006-07-30 17:51 ` Sam Ravnborg
2006-07-30 17:49 ` Andi Kleen
0 siblings, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2006-07-30 17:51 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, agruen
On Sun, Jul 30, 2006 at 06:46:07PM +0200, Andi Kleen wrote:
>
> Hi,
>
> It looks like building external modules against separate objdirs doesn't work
> anymore in 2.6.18.
I just tried it out with -linus (from a few hours ago).
$> cd ~/kernel/linux-2.6
$> mkdir ../o
$> make O=../o defconfig
$> make O=../o
...
$> cd ~/kernel/external
$> cat Makefile
obj-m := sam.o
sam-y := sam1.o
EXTRA_CFLAGS := -I$(src)/include
$> make M=`pwd` O=~/kernel/o -C ~/kernel/linux-2.6
make: Entering directory `/home/sam/kernel/linux-2.6'
LD /home/sam/kernel/external/built-in.o
CC [M] /home/sam/kernel/external/sam1.o
LD [M] /home/sam/kernel/external/sam.o
Building modules, stage 2.
MODPOST
CC /home/sam/kernel/external/sam.mod.o
LD [M] /home/sam/kernel/external/sam.ko
make: Leaving directory `/home/sam/kernel/linux-2.6'
So it seems to work out fine here.
Can you check that you really did a 'make prepare' in the relevant
output directory. Previously only the make *config step was needed.
Sam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 17:49 ` Andi Kleen
@ 2006-07-30 18:31 ` Sam Ravnborg
2006-07-30 18:37 ` Andi Kleen
2006-07-30 18:34 ` Sam Ravnborg
1 sibling, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2006-07-30 18:31 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, agruen
On Sun, Jul 30, 2006 at 07:49:41PM +0200, Andi Kleen wrote:
>
> > Can you check that you really did a 'make prepare' in the relevant
> > output directory. Previously only the make *config step was needed.
>
> The output directory is a full build (configuration + make without any targets).
> Is that not enough anymore?
>
> Anyways after a make prepare it seems to work - thanks - but I think that
> should be really done as part of the standard build like it was in 2.6.17.
'make prepare' is and has always been part of the standard build.
So I really do not see what is going on.
Can you please check that followign files exists in your output
directory:
.config
include/config/auto.conf.cmd
include/config/auto.conf
the latter should be the latest of the three.
Also try applying following patch to reveal why we trigger this rule:
diff --git a/Makefile b/Makefile
index 1dd58d3..4c30ed5 100644
--- a/Makefile
+++ b/Makefile
@@ -453,6 +453,7 @@ include/config/auto.conf: $(KCONFIG_CONF
ifeq ($(KBUILD_EXTMOD),)
$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
else
+ @echo triggered by - $? -
$(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it)
endif
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 17:49 ` Andi Kleen
2006-07-30 18:31 ` Sam Ravnborg
@ 2006-07-30 18:34 ` Sam Ravnborg
2006-07-30 18:42 ` Andi Kleen
1 sibling, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2006-07-30 18:34 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, agruen
On Sun, Jul 30, 2006 at 07:49:41PM +0200, Andi Kleen wrote:
>
> > Can you check that you really did a 'make prepare' in the relevant
> > output directory. Previously only the make *config step was needed.
>
> The output directory is a full build (configuration + make without any targets).
> Is that not enough anymore?
>
> Anyways after a make prepare it seems to work - thanks - but I think that
> should be really done as part of the standard build like it was in 2.6.17.
It could also be a mis-merge of some suse patches.
Is this with a vanilla kernel or a suse patched one?
If the latter can I then have a full copy to look at.
Sam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 18:31 ` Sam Ravnborg
@ 2006-07-30 18:37 ` Andi Kleen
2006-07-30 19:17 ` Sam Ravnborg
0 siblings, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2006-07-30 18:37 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, agruen
On Sunday 30 July 2006 20:31, Sam Ravnborg wrote:
> On Sun, Jul 30, 2006 at 07:49:41PM +0200, Andi Kleen wrote:
> >
> > > Can you check that you really did a 'make prepare' in the relevant
> > > output directory. Previously only the make *config step was needed.
> >
> > The output directory is a full build (configuration + make without any targets).
> > Is that not enough anymore?
> >
> > Anyways after a make prepare it seems to work - thanks - but I think that
> > should be really done as part of the standard build like it was in 2.6.17.
> 'make prepare' is and has always been part of the standard build.
> So I really do not see what is going on.
To reproduce (on x86-64 at least)
mkdir obj
cd obj
make -C ../linux-2.6.18-... O=$(pwd) defconfig
make
> Can you please check that followign files exists in your output
> directory:
> .config
> include/config/auto.conf.cmd
> include/config/auto.conf
>
> the latter should be the latest of the three.
-rw-r--r-- 1 andi users 28481 2006-07-29 19:01 .config
-rw-r--r-- 1 andi users 7739 2006-07-29 19:07 include/config/auto.conf
-rw-r--r-- 1 andi users 6867 2006-07-29 19:07 include/config/auto.conf.cmd
> Also try applying following patch to reveal why we trigger this rule:
>
> diff --git a/Makefile b/Makefile
> index 1dd58d3..4c30ed5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -453,6 +453,7 @@ include/config/auto.conf: $(KCONFIG_CONF
> ifeq ($(KBUILD_EXTMOD),)
> $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
> else
> + @echo triggered by - $? -
> $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it)
> endif
The echo didn't output for some reason, but adding it to the error gives
/home/lsrc/quilt/linux/Makefile:456: *** triggered by /home/lsrc/quilt/linux/drivers/net/wireless/Kconfig /home/lsrc/quilt/linux/drivers/message/fusion/Kconfig /home/lsrc/quilt/linux/net/ieee80211/Kconfig /home/lsrc/quilt/linux/net/netfilter/Kconfig kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 18:34 ` Sam Ravnborg
@ 2006-07-30 18:42 ` Andi Kleen
0 siblings, 0 replies; 11+ messages in thread
From: Andi Kleen @ 2006-07-30 18:42 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, agruen
On Sunday 30 July 2006 20:34, Sam Ravnborg wrote:
> On Sun, Jul 30, 2006 at 07:49:41PM +0200, Andi Kleen wrote:
> >
> > > Can you check that you really did a 'make prepare' in the relevant
> > > output directory. Previously only the make *config step was needed.
> >
> > The output directory is a full build (configuration + make without any targets).
> > Is that not enough anymore?
> >
> > Anyways after a make prepare it seems to work - thanks - but I think that
> > should be really done as part of the standard build like it was in 2.6.17.
> It could also be a mis-merge of some suse patches.
> Is this with a vanilla kernel or a suse patched one?
vanilla kernel + my x86-64 patchkit, but it doesn't really change
anything significant in Makefiles
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 18:37 ` Andi Kleen
@ 2006-07-30 19:17 ` Sam Ravnborg
2006-07-30 20:06 ` Andi Kleen
2006-07-31 9:39 ` Roman Zippel
0 siblings, 2 replies; 11+ messages in thread
From: Sam Ravnborg @ 2006-07-30 19:17 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, agruen
On Sun, Jul 30, 2006 at 08:37:02PM +0200, Andi Kleen wrote:
>
> The echo didn't output for some reason, but adding it to the error gives
>
> /home/lsrc/quilt/linux/Makefile:456: *** triggered by /home/lsrc/quilt/linux/drivers/net/wireless/Kconfig /home/lsrc/quilt/linux/drivers/message/fusion/Kconfig /home/lsrc/quilt/linux/net/ieee80211/Kconfig /home/lsrc/quilt/linux/net/netfilter/Kconfig kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
What happens is that a few Kconfig files in your quilt tree are updated
after last time you reran 'make'.
And then kbuild say that config is invalid since it has not been updated
since last edit of Kconfig files.
Hmm...
Sam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 19:17 ` Sam Ravnborg
@ 2006-07-30 20:06 ` Andi Kleen
2006-07-31 9:39 ` Roman Zippel
1 sibling, 0 replies; 11+ messages in thread
From: Andi Kleen @ 2006-07-30 20:06 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, agruen
On Sunday 30 July 2006 21:17, Sam Ravnborg wrote:
> On Sun, Jul 30, 2006 at 08:37:02PM +0200, Andi Kleen wrote:
>
> >
> > The echo didn't output for some reason, but adding it to the error gives
> >
> > /home/lsrc/quilt/linux/Makefile:456: *** triggered by /home/lsrc/quilt/linux/drivers/net/wireless/Kconfig /home/lsrc/quilt/linux/drivers/message/fusion/Kconfig /home/lsrc/quilt/linux/net/ieee80211/Kconfig /home/lsrc/quilt/linux/net/netfilter/Kconfig kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
>
> What happens is that a few Kconfig files in your quilt tree are updated
> after last time you reran 'make'.
Yes that happens when I push/pop patches in quilt.
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-30 19:17 ` Sam Ravnborg
2006-07-30 20:06 ` Andi Kleen
@ 2006-07-31 9:39 ` Roman Zippel
2006-08-01 19:42 ` Sam Ravnborg
1 sibling, 1 reply; 11+ messages in thread
From: Roman Zippel @ 2006-07-31 9:39 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Andi Kleen, linux-kernel, agruen
Hi,
On Sun, 30 Jul 2006, Sam Ravnborg wrote:
> On Sun, Jul 30, 2006 at 08:37:02PM +0200, Andi Kleen wrote:
>
> >
> > The echo didn't output for some reason, but adding it to the error gives
> >
> > /home/lsrc/quilt/linux/Makefile:456: *** triggered by /home/lsrc/quilt/linux/drivers/net/wireless/Kconfig /home/lsrc/quilt/linux/drivers/message/fusion/Kconfig /home/lsrc/quilt/linux/net/ieee80211/Kconfig /home/lsrc/quilt/linux/net/netfilter/Kconfig kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
>
> What happens is that a few Kconfig files in your quilt tree are updated
> after last time you reran 'make'.
> And then kbuild say that config is invalid since it has not been updated
> since last edit of Kconfig files.
>
> Hmm...
What we could do is to call silentoldconfig and set
KCONFIG_NOSILENTUPDATE, if the .config is uptodate it will only update
autoconf and abort otherwise.
bye, Roman
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building external modules against objdirs
2006-07-31 9:39 ` Roman Zippel
@ 2006-08-01 19:42 ` Sam Ravnborg
0 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2006-08-01 19:42 UTC (permalink / raw)
To: Roman Zippel; +Cc: Andi Kleen, linux-kernel, agruen, Dave Jones
On Mon, Jul 31, 2006 at 11:39:30AM +0200, Roman Zippel wrote:
> Hi,
>
> On Sun, 30 Jul 2006, Sam Ravnborg wrote:
>
> > On Sun, Jul 30, 2006 at 08:37:02PM +0200, Andi Kleen wrote:
> >
> > >
> > > The echo didn't output for some reason, but adding it to the error gives
> > >
> > > /home/lsrc/quilt/linux/Makefile:456: *** triggered by /home/lsrc/quilt/linux/drivers/net/wireless/Kconfig /home/lsrc/quilt/linux/drivers/message/fusion/Kconfig /home/lsrc/quilt/linux/net/ieee80211/Kconfig /home/lsrc/quilt/linux/net/netfilter/Kconfig kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
> >
> > What happens is that a few Kconfig files in your quilt tree are updated
> > after last time you reran 'make'.
> > And then kbuild say that config is invalid since it has not been updated
> > since last edit of Kconfig files.
> >
> > Hmm...
>
> What we could do is to call silentoldconfig and set
> KCONFIG_NOSILENTUPDATE, if the .config is uptodate it will only update
> autoconf and abort otherwise.
External modules shall to a great extent just rely on the avialble
kernel, and any attempt to do automatic updates are not OK.
The kernel source could be RO and no rights to write in the
directories either.
So it is preferable to bail out in case we cannot build the external
module but to avoid the consistency checks all over.
Following patch does this for the configuration part.
Sam
diff --git a/Makefile b/Makefile
index 110db85..291bb5e 100644
--- a/Makefile
+++ b/Makefile
@@ -436,12 +436,13 @@ core-y := usr/
endif # KBUILD_EXTMOD
ifeq ($(dot-config),1)
-# In this section, we need .config
+# Read in config
+-include include/config/auto.conf
+ifeq ($(KBUILD_EXTMOD),)
# Read in dependencies to all Kconfig* files, make sure to run
# oldconfig if changes are detected.
-include include/config/auto.conf.cmd
--include include/config/auto.conf
# To avoid any implicit rule to kick in, define an empty command
$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
@@ -451,16 +452,27 @@ # with it and forgot to run make oldconf
# if auto.conf.cmd is missing then we are probably in a cleaned tree so
# we execute the config step to be sure to catch updated Kconfig files
include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
-ifeq ($(KBUILD_EXTMOD),)
$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
else
- $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it)
-endif
+# external modules needs include/linux/autoconf.h and include/config/auto.conf
+# but do not care if they are up-to-date. Use auto.conf to trigger the test
+PHONY += include/config/auto.conf
+
+include/config/auto.conf:
+ $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \
+ echo; \
+ echo " ERROR: Kernel configuration is invalid."; \
+ echo " include/linux/autoconf.h or $@ is missing."; \
+ echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
+ echo; \
+ /bin/false)
+
+endif # KBUILD_EXTMOD
else
# Dummy target needed, because used as prerequisite
include/config/auto.conf: ;
-endif
+endif # $(dot-config)
# The all: target is the default when no target is given on the
# command line.
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-08-01 19:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-30 16:46 Building external modules against objdirs Andi Kleen
2006-07-30 17:51 ` Sam Ravnborg
2006-07-30 17:49 ` Andi Kleen
2006-07-30 18:31 ` Sam Ravnborg
2006-07-30 18:37 ` Andi Kleen
2006-07-30 19:17 ` Sam Ravnborg
2006-07-30 20:06 ` Andi Kleen
2006-07-31 9:39 ` Roman Zippel
2006-08-01 19:42 ` Sam Ravnborg
2006-07-30 18:34 ` Sam Ravnborg
2006-07-30 18:42 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox