Skip to contentSkip to conversation

fix include paths when the kernel source and build directory are different

PATCH In review James Pike 3 participants 6 messages Jun 3, 2009 – Aug 15, 2009

Subsystems (2)
lore
Share & tools
lore

James Pike

author
#0 lore raw

PATCH 1/1 fix include paths when the kernel source and build directory are different

Use correct architecture includes when kernel source and build directory are different.

Makefile +3 -2
index 95e4c81..ad08c45 100644
@@ -27,8 +27,9 @@ all:: prerequisite
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
 		LINUXINCLUDE="-I`pwd`/include -Iinclude \
-		$(if $(KERNELSOURCEDIR),-Iinclude2 -I$(KERNELSOURCEDIR)/include) \
-		-Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+		$(if $(KERNELSOURCEDIR),\
+			-Iinclude2 -I$(KERNELSOURCEDIR)/include -I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+			-Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
 		-include include/linux/autoconf.h \
 		-include `pwd`/$(ARCH_DIR)/external-module-compat.h $(module_defines)" \
 		"$$@"
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · James Pike

Use correct architecture includes when kernel source and build directory are different.

Makefile +0 -0
index 95e4c81..ad08c45 100644
@@ -27,8 +27,9 @@ all:: prerequisite
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat

Makefile all:: prerequisite · line 35

Quoted 10 lines
Makefile +3 -2
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
 		LINUXINCLUDE="-I`pwd`/include -Iinclude \
-		$(if $(KERNELSOURCEDIR),-Iinclude2 -I$(KERNELSOURCEDIR)/include) \
-		-Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+		$(if $(KERNELSOURCEDIR),\
+			-Iinclude2 -I$(KERNELSOURCEDIR)/include -I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+			-Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
 		-include include/linux/autoconf.h \
 		-include `pwd`/$(ARCH_DIR)/external-module-compat.h $(module_defines)" \
 		"$$@"

Just confirmed: Required when building against home-brewed kernels with split source/binaries. Avi, please merge.

Jan

#2 lore raw
In reply to James Pike
Quoted 9 lines · James Pike

Use correct architecture includes when kernel source and build directory are different.

Makefile +0 -0
@@ -27,8 +27,9 @@ all:: prerequisite
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat

Makefile all:: prerequisite · line 35

Quoted 10 lines
Makefile +3 -2
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
 		LINUXINCLUDE="-I`pwd`/include -Iinclude \
-		$(if $(KERNELSOURCEDIR),-Iinclude2 -I$(KERNELSOURCEDIR)/include) \
-		-Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+		$(if $(KERNELSOURCEDIR),\
+			-Iinclude2 -I$(KERNELSOURCEDIR)/include -I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+			-Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
 		-include include/linux/autoconf.h \
 		-include `pwd`/$(ARCH_DIR)/external-module-compat.h $(module_defines)" \
 		"$$@"

This removes -Iarch/${ARCH_DIR}/include when KERNELSOURCEDIR is not defined. What is the reason for this change?

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 17 lines · Avi Kivity
Quoted 16 lines · James Pike

Use correct architecture includes when kernel source and build directory are different.

--- a/Makefile
+++ b/Makefile

Makefile +3 -4
@@ -27,8 +27,9 @@ all:: prerequisite
 #    include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
     $(MAKE) -C $(KERNELDIR) M=`pwd` \
         LINUXINCLUDE="-I`pwd`/include -Iinclude \
-        $(if $(KERNELSOURCEDIR),-Iinclude2
-I$(KERNELSOURCEDIR)/include) \
-        -Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+        $(if $(KERNELSOURCEDIR),\
+            -Iinclude2 -I$(KERNELSOURCEDIR)/include
-I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+            -Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
Quoted 9 lines
Quoted 5 lines
(quoted diff) +0 -0
         -include include/linux/autoconf.h \
         -include `pwd`/$(ARCH_DIR)/external-module-compat.h
$(module_defines)" \
         "$$@"

This removes -Iarch/${ARCH_DIR}/include when KERNELSOURCEDIR is not defined. What is the reason for this change?

As far as I can see (I do wear my glasses today...), -Iarch/${ARCH_DIR}/include is present in the else part of $(if).

The reason for this change is the missing arch include from the source directory in case it's separate from the build dir (yeah, the changelog has room for improvements).

I ran into the same issue after building and installing a recent kernel tree with O=. The split trees SUSE leaves behind do not suffer from this, but they also still work after the change. Same for classic unified trees.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 31 lines · Jan Kiszka
Quoted 18 lines · Avi Kivity
Quoted 16 lines · James Pike

Use correct architecture includes when kernel source and build directory are different.

--- a/Makefile
+++ b/Makefile

Makefile +3 -4
@@ -27,8 +27,9 @@ all:: prerequisite
 #    include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
     $(MAKE) -C $(KERNELDIR) M=`pwd` \
         LINUXINCLUDE="-I`pwd`/include -Iinclude \
-        $(if $(KERNELSOURCEDIR),-Iinclude2
-I$(KERNELSOURCEDIR)/include) \
-        -Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+        $(if $(KERNELSOURCEDIR),\
+            -Iinclude2 -I$(KERNELSOURCEDIR)/include
-I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+            -Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
Quoted 10 lines
Quoted 6 lines
(quoted diff) +0 -0
         -include include/linux/autoconf.h \
         -include `pwd`/$(ARCH_DIR)/external-module-compat.h
$(module_defines)" \
         "$$@"

This removes -Iarch/${ARCH_DIR}/include when KERNELSOURCEDIR is not defined. What is the reason for this change?

Quoted 3 lines

As far as I can see (I do wear my glasses today...), -Iarch/${ARCH_DIR}/include is present in the else part of $(if).

Yeah, I missed the comma. Maybe I need to visit your optometrist.

Quoted 9 lines

The reason for this change is the missing arch include from the source directory in case it's separate from the build dir (yeah, the changelog has room for improvements).

I ran into the same issue after building and installing a recent kernel tree with O=. The split trees SUSE leaves behind do not suffer from this, but they also still work after the change. Same for classic unified trees.

Okay, will apply the patch.

Signature · 1 line
error compiling committee.c: too many arguments to function
author
#5 lore raw
In reply to Avi Kivity
Quoted 2 lines

This removes -Iarch/${ARCH_DIR}/include when KERNELSOURCEDIR is not defined. What is the reason for this change?

No you've interpreted the change wrong. The "else" part of the if clause ensures this is not removed.

Here is how the make if call works:

$(if <string>,<string for true clase>,<string for else clause>)

What my patch does do is *add* this define in for the case when KERNELSOURCEDIR is defined, but at the correct source location.

I'd like to ask again if anybody is testing this builds properly against an out of place kernel build, as I've needed these patches across several different machines running different distributions at work, so I'm very sceptical that it can work for many people, doesn't mean I'm right though..

Thanks, James

Quoted 25 lines · Avi Kivity
Quoted 19 lines · James Pike

Use correct architecture includes when kernel source and build directory are different.

Makefile +3 -2
@@ -27,8 +27,9 @@ all:: prerequisite
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
 		LINUXINCLUDE="-I`pwd`/include -Iinclude \
-		$(if $(KERNELSOURCEDIR),-Iinclude2 -I$(KERNELSOURCEDIR)/include) \
-		-Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
+		$(if $(KERNELSOURCEDIR),\
+			-Iinclude2 -I$(KERNELSOURCEDIR)/include -I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
+			-Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat \
 		-include include/linux/autoconf.h \
 		-include `pwd`/$(ARCH_DIR)/external-module-compat.h $(module_defines)" \
 		"$$@"
Signature · 1 line
error compiling committee.c: too many arguments to function