Add libfdt external component
Create external component to download the libfdt sources. After download
libfdt is patched to enable using libfdt's implementation of strnlen().
This is necessary because newlib doesn't export strnlen() for ISO C
sources (we build SPs as ISO C99).
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: Iac5fc19086c57aee409d2c0661cb498713b750e5
diff --git a/external/libfdt/fix-strnlen.patch b/external/libfdt/fix-strnlen.patch
new file mode 100644
index 0000000..7a7bb7d
--- /dev/null
+++ b/external/libfdt/fix-strnlen.patch
@@ -0,0 +1,30 @@
+This patch enables using libfdt's strlen() implementation.
+
+diff --git i/libfdt/libfdt_env.h w/libfdt/libfdt_env.h
+index 73b6d40..3a2d38c 100644
+--- i/libfdt/libfdt_env.h
++++ w/libfdt/libfdt_env.h
+@@ -66,13 +66,6 @@ static inline fdt64_t cpu_to_fdt64(uint64_t x)
+ #undef CPU_TO_FDT16
+ #undef EXTRACT_BYTE
+
+-#ifdef __APPLE__
+-#include <AvailabilityMacros.h>
+-
+-/* strnlen() is not available on Mac OS < 10.7 */
+-# if !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED < \
+- MAC_OS_X_VERSION_10_7)
+-
+ #define strnlen fdt_strnlen
+
+ /*
+@@ -88,9 +81,4 @@ static inline size_t fdt_strnlen(const char *string, size_t max_count)
+ return p ? p - string : max_count;
+ }
+
+-#endif /* !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED <
+- MAC_OS_X_VERSION_10_7) */
+-
+-#endif /* __APPLE__ */
+-
+ #endif /* LIBFDT_ENV_H */