@@ -355,16 +355,20 @@ AFLAGS_KERNEL =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
+# Use USERINCLUDE when you must reference the UAPI directories only.
+USERINCLUDE := \
+ -I$(srctree)/arch/$(hdr-arch)/include/uapi \
+ -Iinclude/uapi \
+ $(if $(KBUILD_SRC), -I$(srctree)/include) \
+ -include include/generated/autoconf.h
+
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := \
-I$(srctree)/arch/$(hdr-arch)/include \
-Iarch/$(hdr-arch)/include/generated \
- -I$(srctree)/arch/$(hdr-arch)/include/uapi \
-Iinclude \
- -Iinclude/uapi \
- $(if $(KBUILD_SRC), -I$(srctree)/include) \
- -include include/generated/autoconf.h
+ $(USERINCLUDE)
KBUILD_CPPFLAGS := -D__KERNEL__
@@ -37,7 +37,7 @@ setup-y += video-bios.o
targets += $(setup-y)
hostprogs-y := mkcpustr tools/build
-HOST_EXTRACFLAGS += $(LINUXINCLUDE)
+HOST_EXTRACFLAGS += $(USERINCLUDE)
$(obj)/cpu.o: $(obj)/cpustr.h
@@ -51,7 +51,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
# How to compile the 16-bit code. Note we always compile for -march=i386,
# that way we can complain to the user if the CPU is insufficient.
-KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
+KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
-DDISABLE_BRANCH_PROFILING \
-Wall -Wstrict-prototypes \
-march=i386 -mregparm=3 \
@@ -15,6 +15,8 @@
#include <stdio.h>
+#include "../include/asm/required-features.h"
+#include "../include/asm/cpufeature.h"
#include "../kernel/cpu/capflags.c"
int main(void)
@@ -4,7 +4,9 @@
#ifndef _ASM_X86_CPUFEATURE_H
#define _ASM_X86_CPUFEATURE_H
+#ifndef _ASM_X86_REQUIRED_FEATURES_H
#include <asm/required-features.h>
+#endif
#define NCAPINTS 10 /* N 32-bit words worth of info */
@@ -8,7 +8,10 @@
open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";
open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
-print OUT "#include <asm/cpufeature.h>\n\n";
+print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
+print OUT "#include <asm/cpufeature.h>\n";
+print OUT "#endif\n";
+print OUT "\n";
print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
while (defined($line = <IN>)) {
Differentiate userspace build and kernelspace build (LINUXINCLUDE) include path sets by adding a new make variable (USERINCLUDE) that has everything barring the kernel-specific include paths, and then make LINUXINCLUDE simply preface that with the kernel-specific include paths. Then use USERINCLUDE in building the x86 boot code. Signed-off-by: David Howells <dhowells@redhat.com> --- Makefile | 12 ++++++++---- arch/x86/boot/Makefile | 4 ++-- arch/x86/boot/mkcpustr.c | 2 ++ arch/x86/include/asm/cpufeature.h | 2 ++ arch/x86/kernel/cpu/mkcapflags.pl | 5 ++++- 5 files changed, 18 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html