From 2a346543d6cb16c4e7e638641cc947c73fb43068 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Mon, 15 Sep 2014 11:40:01 +0200
Subject: [PATCH 12/14] lib/sdb: bb fixes (to be ported in fpga-config-space)

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 lib/sdb/libsdbfs-kernel.h |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/sdb/libsdbfs-kernel.h b/lib/sdb/libsdbfs-kernel.h
index 16e359e..a121d0e 100644
--- a/lib/sdb/libsdbfs-kernel.h
+++ b/lib/sdb/libsdbfs-kernel.h
@@ -1,7 +1,11 @@
 
 #include <linux/types.h>
 #include <linux/string.h>
-#include <linux/errno.h>
+#ifdef __BAREBOX__
+#  include <errno.h>
+#else /* really linux */
+#  include <linux/errno.h>
+#endif
 #include <asm/byteorder.h>
 
 /*
@@ -13,7 +17,9 @@
  * is not installed in /usr/include/linux/types.h, so use it to check.
  */
 #ifndef DECLARE_BITMAP
-#  error "Please point LINUX to a source tree if you define __KERNEL__"
+#  ifndef __BAREBOX__ /* Barebox looks like the kernel and misses the define */
+#    error "Please point LINUX to a source tree if you define __KERNEL__"
+#  endif
 #endif
 
 #define SDB_KERNEL	1
-- 
1.7.10.4

