@@ -11,6 +11,7 @@ patches
cscope.*
*.swp
/lib/asm
+/lib/linux
/config.mak
/*-run
/test.log
@@ -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 \
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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)
deleted file mode 100644
@@ -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
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@redhat.com> --- .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