All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
@ 2007-07-14 20:15 Sven Wegener
  2007-07-15 14:34 ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wegener @ 2007-07-14 20:15 UTC (permalink / raw)
  To: netfilter-devel


[-- Attachment #1.1: Type: text/plain, Size: 383 bytes --]

Setting KERNEL_DIR to the build symlink in /lib/modules is wrong. The
build symlink points to the location of generated object files and the
extension tests use KERNEL_DIR to check the availability of certain
source files. The tests will fail, if build and source point to
different locations. Change KERNEL_DIR from build to source and
introduce KBUILD_OUTPUT for the build symink.

[-- Attachment #1.2: iptables-kbuild-output.patch --]
[-- Type: text/plain, Size: 900 bytes --]

Index: Makefile
===================================================================
--- Makefile	(revision 6905)
+++ Makefile	(working copy)
@@ -12,8 +12,11 @@
 TOPLEVEL_INCLUDED=YES
 
 ifndef KERNEL_DIR
-KERNEL_DIR="/lib/modules/$(shell uname -r)/build"
+KERNEL_DIR="/lib/modules/$(shell uname -r)/source"
 endif
+ifndef KBUILD_OUTPUT
+KBUILD_OUTPUT="/lib/modules/$(shell uname -r)/build"
+endif
 IPTABLES_VERSION:=1.3.8
 OLD_IPTABLES_VERSION:=1.3.7
 
@@ -37,7 +40,7 @@
 endif
 
 COPT_FLAGS:=-O2
-CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -I$(KERNEL_DIR)/include -Iinclude/ -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\" #-g -DDEBUG #-pg # -DIPTC_DEBUG
+CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -I$(KBUILD_OUTPUT)/include -I$(KERNEL_DIR)/include -Iinclude/ -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\" #-g -DDEBUG #-pg # -DIPTC_DEBUG
 
 ifdef NO_SHARED_LIBS
 CFLAGS += -DNO_SHARED_LIBS=1

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

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

* Re: [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
  2007-07-14 20:15 [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT Sven Wegener
@ 2007-07-15 14:34 ` Patrick McHardy
  2007-07-15 15:31   ` Sven Wegener
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2007-07-15 14:34 UTC (permalink / raw)
  To: Sven Wegener; +Cc: netfilter-devel

Sven Wegener wrote:
> Setting KERNEL_DIR to the build symlink in /lib/modules is wrong. The
> build symlink points to the location of generated object files and the
> extension tests use KERNEL_DIR to check the availability of certain
> source files.

Good point.

> The tests will fail, if build and source point to
> different locations. Change KERNEL_DIR from build to source and
> introduce KBUILD_OUTPUT for the build symink.


What do we need KBUILD_OUTPUT for? Just the source tree should be enough.

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

* Re: [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
  2007-07-15 14:34 ` Patrick McHardy
@ 2007-07-15 15:31   ` Sven Wegener
  2007-07-15 15:33     ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wegener @ 2007-07-15 15:31 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

On Sun, Jul 15, 2007 at 04:34:24PM +0200, Patrick McHardy wrote:
> Sven Wegener wrote:
> > Setting KERNEL_DIR to the build symlink in /lib/modules is wrong. The
> > build symlink points to the location of generated object files and the
> > extension tests use KERNEL_DIR to check the availability of certain
> > source files.
> 
> Good point.
> 
> > The tests will fail, if build and source point to
> > different locations. Change KERNEL_DIR from build to source and
> > introduce KBUILD_OUTPUT for the build symink.
> 
> What do we need KBUILD_OUTPUT for? Just the source tree should be enough.

For current kernels, true. Older kernels (before 2006-04-26) and the
whole 2.6.16.y series have a bug where include/linux/netfilter_ipv4.h
includes linux/config.h which includes linux/autoconf.h which is placed
into KBUILD_OUTPUT. Just changing KERNEL_DIR from build to source should
be enough for recent kernels. For older kernels building the iptables
package will fail with "linux/autoconf.h: No such file or directory"
unless we add the KBUILD_OUTPUT bit. That's why I added it. Do we want
to have this workaround here?

Sven

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

* Re: [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
  2007-07-15 15:31   ` Sven Wegener
@ 2007-07-15 15:33     ` Patrick McHardy
  2007-07-15 16:01       ` Sven Wegener
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2007-07-15 15:33 UTC (permalink / raw)
  To: Sven Wegener; +Cc: netfilter-devel

Sven Wegener wrote:
> On Sun, Jul 15, 2007 at 04:34:24PM +0200, Patrick McHardy wrote:
> 
>>What do we need KBUILD_OUTPUT for? Just the source tree should be enough.
> 
> 
> For current kernels, true. Older kernels (before 2006-04-26) and the
> whole 2.6.16.y series have a bug where include/linux/netfilter_ipv4.h
> includes linux/config.h which includes linux/autoconf.h which is placed
> into KBUILD_OUTPUT. Just changing KERNEL_DIR from build to source should
> be enough for recent kernels. For older kernels building the iptables
> package will fail with "linux/autoconf.h: No such file or directory"
> unless we add the KBUILD_OUTPUT bit. That's why I added it. Do we want
> to have this workaround here?


I don't see why not. A short comment in the Makefile explaining the
situation would be nice though.

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

* Re: [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
  2007-07-15 15:33     ` Patrick McHardy
@ 2007-07-15 16:01       ` Sven Wegener
  2007-07-15 16:03         ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wegener @ 2007-07-15 16:01 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

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

On Sun, Jul 15, 2007 at 05:33:50PM +0200, Patrick McHardy wrote:
> I don't see why not. A short comment in the Makefile explaining the
> situation would be nice though.

Updated patch attached.

[-- Attachment #2: iptables-kbuild-output.patch --]
[-- Type: text/plain, Size: 1140 bytes --]

Index: Makefile
===================================================================
--- Makefile	(revision 6905)
+++ Makefile	(working copy)
@@ -11,9 +11,15 @@
 # Standard part of Makefile for topdir.
 TOPLEVEL_INCLUDED=YES
 
+# For recent kernels we only need the source in KERNEL_DIR to build. Older
+# kernels have a bug, where linux/netfilter_ipv4.h includes linux/config.h,
+# which includes linux/autoconf.h, which is placed into KBUILD_OUTPUT.
 ifndef KERNEL_DIR
-KERNEL_DIR="/lib/modules/$(shell uname -r)/build"
+KERNEL_DIR="/lib/modules/$(shell uname -r)/source"
 endif
+ifndef KBUILD_OUTPUT
+KBUILD_OUTPUT="/lib/modules/$(shell uname -r)/build"
+endif
 IPTABLES_VERSION:=1.3.8
 OLD_IPTABLES_VERSION:=1.3.7
 
@@ -37,7 +43,7 @@
 endif
 
 COPT_FLAGS:=-O2
-CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -I$(KERNEL_DIR)/include -Iinclude/ -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\" #-g -DDEBUG #-pg # -DIPTC_DEBUG
+CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -I$(KBUILD_OUTPUT)/include -I$(KERNEL_DIR)/include -Iinclude/ -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\" #-g -DDEBUG #-pg # -DIPTC_DEBUG
 
 ifdef NO_SHARED_LIBS
 CFLAGS += -DNO_SHARED_LIBS=1

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

* Re: [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT
  2007-07-15 16:01       ` Sven Wegener
@ 2007-07-15 16:03         ` Patrick McHardy
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2007-07-15 16:03 UTC (permalink / raw)
  To: Sven Wegener; +Cc: netfilter-devel

Sven Wegener wrote:
> On Sun, Jul 15, 2007 at 05:33:50PM +0200, Patrick McHardy wrote:
>   
>> I don't see why not. A short comment in the Makefile explaining the
>> situation would be nice though.
>>     
>
> Updated patch attached.
>   

Applied, thanks Sven.

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

end of thread, other threads:[~2007-07-15 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 20:15 [PATCH] Change default KERNEL_DIR location and add KBUILD_OUTPUT Sven Wegener
2007-07-15 14:34 ` Patrick McHardy
2007-07-15 15:31   ` Sven Wegener
2007-07-15 15:33     ` Patrick McHardy
2007-07-15 16:01       ` Sven Wegener
2007-07-15 16:03         ` Patrick McHardy

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.