Rather than import uapi headers, e.g. lib/arm/asm/uapi-psci.h, just include them. For cross compilation we'll need the headers explicitly added to the include path, but doing -I /usr/include won't work, as some of our local header names will collide with /usr/include names. Even just doing -I /usr/include/linux would leave too many potential name collisions. So we create a lib/linux link, and do *not* add -I lib/linux. Doing it this way requires code to include the uapi headers with <linux/header.h>, putting them in their own "linux" namespace. Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> --- .gitignore | 1 + Makefile | 4 ++-- configure | 9 +++++++++ lib/arm/asm/page.h | 2 +- lib/arm/asm/psci.h | 2 +- lib/arm64/asm/page.h | 2 +- lib/arm64/asm/psci.h | 2 +- lib/asm-generic/page.h | 2 +- lib/const.h | 11 ----------- 9 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 lib/const.h diff --git a/.gitignore b/.gitignore index acbb9055212aa..b193802488003 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ patches cscope.* *.swp /lib/asm +/lib/linux /config.mak /*-run /test.log diff --git a/Makefile b/Makefile index 3e60b4f8e4a57..2e76c90bdcea5 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,10 @@ libfdt_clean: $(LIBFDT_objdir)/.*.d distclean: clean libfdt_clean - $(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* + $(RM) lib/linux lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* $(RM) -r tests -cscope: common_dirs = lib lib/libfdt lib/asm lib/asm-generic +cscope: common_dirs = lib lib/libfdt lib/linux lib/asm lib/asm-generic cscope: $(RM) ./cscope.* find -L $(TEST_DIR) lib/$(TEST_DIR) lib/$(ARCH) $(common_dirs) -maxdepth 1 \ diff --git a/configure b/configure index 078b70ce096a6..667cc1b30e119 100755 --- a/configure +++ b/configure @@ -91,6 +91,15 @@ if [ -f $testdir/run ]; then ln -fs $testdir/run $testdir-run fi +# link uapi/linux +rm -f lib/linux +if [ ! -d /usr/include/linux ]; then + echo kernel-headers not installed, aborting... + exit 1 +else + ln -s /usr/include/linux lib/linux +fi + # check for dependent 32 bit libraries if [ "$arch" != "arm" ]; then cat << EOF > lib_test.c diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h index 039e2ddfb8e0f..df76969964ed3 100644 --- a/lib/arm/asm/page.h +++ b/lib/arm/asm/page.h @@ -6,7 +6,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include <const.h> +#include <linux/const.h> #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h index c5fe78184b5ac..11ac45028d787 100644 --- a/lib/arm/asm/psci.h +++ b/lib/arm/asm/psci.h @@ -1,7 +1,7 @@ #ifndef _ASMARM_PSCI_H_ #define _ASMARM_PSCI_H_ #include <libcflat.h> -#include <asm/uapi-psci.h> +#include <linux/psci.h> #define PSCI_INVOKE_ARG_TYPE u32 #define PSCI_FN_CPU_ON PSCI_0_2_FN_CPU_ON diff --git a/lib/arm64/asm/page.h b/lib/arm64/asm/page.h index 29ad1f1f720c4..3144e8efcc7ae 100644 --- a/lib/arm64/asm/page.h +++ b/lib/arm64/asm/page.h @@ -11,7 +11,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include <const.h> +#include <linux/const.h> #define PGTABLE_LEVELS 2 #define VA_BITS 42 diff --git a/lib/arm64/asm/psci.h b/lib/arm64/asm/psci.h index 940d61d34c05d..0a7d7c854e2b3 100644 --- a/lib/arm64/asm/psci.h +++ b/lib/arm64/asm/psci.h @@ -1,7 +1,7 @@ #ifndef _ASMARM64_PSCI_H_ #define _ASMARM64_PSCI_H_ #include <libcflat.h> -#include <asm/uapi-psci.h> +#include <linux/psci.h> #define PSCI_INVOKE_ARG_TYPE u64 #define PSCI_FN_CPU_ON PSCI_0_2_FN64_CPU_ON diff --git a/lib/asm-generic/page.h b/lib/asm-generic/page.h index 66c72a62bb0f7..f872f6fa0dad2 100644 --- a/lib/asm-generic/page.h +++ b/lib/asm-generic/page.h @@ -9,7 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include "const.h" +#include <linux/const.h> #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) diff --git a/lib/const.h b/lib/const.h deleted file mode 100644 index 5cd94d7067541..0000000000000 --- a/lib/const.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _CONST_H_ -#define _CONST_H_ -#ifdef __ASSEMBLY__ -#define _AC(X,Y) X -#define _AT(T,X) X -#else -#define __AC(X,Y) (X##Y) -#define _AC(X,Y) __AC(X,Y) -#define _AT(T,X) ((T)(X)) -#endif -#endif -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html