Add toolchain build information

Change-Id: Ie0d24d8e9a0687c8f119e687631b03cc12ae291a
diff --git a/Build.Info/0001-uclibc-tweak-config.patch b/Build.Info/0001-uclibc-tweak-config.patch
new file mode 100644
index 0000000..4626e1a
--- /dev/null
+++ b/Build.Info/0001-uclibc-tweak-config.patch
@@ -0,0 +1,36 @@
+From c251dd5e23278f306d621056e47fd922e01fa401 Mon Sep 17 00:00:00 2001
+From: Petri Gynther <pgynther@google.com>
+Date: Mon, 8 Aug 2016 17:02:49 -0700
+Subject: [PATCH 1/2] uclibc: tweak config
+
+---
+ package/uclibc/uClibc-ng.config | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/package/uclibc/uClibc-ng.config b/package/uclibc/uClibc-ng.config
+index 2671e06..5d3a5da 100644
+--- a/package/uclibc/uClibc-ng.config
++++ b/package/uclibc/uClibc-ng.config
+@@ -1,3 +1,5 @@
++ARCH_WANTS_LITTLE_ENDIAN=y
++# UCLIBC_HAS_FPU is not set
+ DO_C99_MATH=y
+ DO_XSI_MATH=y
+ KERNEL_HEADERS="/usr/src/linux/include"
+@@ -5,6 +7,7 @@ KERNEL_HEADERS="/usr/src/linux/include"
+ # UCLIBC_STATIC_LDCONFIG is not set
+ LDSO_RUNPATH=y
+ LDSO_RUNPATH_OF_EXECUTABLE=y
++# LDSO_SAFE_RUNPATH is not set
+ MALLOC_GLIBC_COMPAT=y
+ UCLIBC_HAS_OBSTACK=y
+ UCLIBC_HAS_UTMPX=y
+@@ -42,3 +45,5 @@ DEVEL_PREFIX="/usr/"
+ UCLIBC_HAS_SSP=y
+ UCLIBC_BUILD_NOW=y
+ # DOSTRIP is not set
++SUPPORT_LD_DEBUG=y
++UCLIBC_HAS_BACKTRACE=y
+-- 
+2.8.0.rc3.226.g39d4020
+
diff --git a/Build.Info/0002-uclibc-remove-atomic-stuff.patch b/Build.Info/0002-uclibc-remove-atomic-stuff.patch
new file mode 100644
index 0000000..c6b5363
--- /dev/null
+++ b/Build.Info/0002-uclibc-remove-atomic-stuff.patch
@@ -0,0 +1,97 @@
+From 6397a628955c28c2c65f3120b942eca4d64ce38e Mon Sep 17 00:00:00 2001
+From: Petri Gynther <pgynther@google.com>
+Date: Fri, 12 Aug 2016 21:12:59 -0700
+Subject: [PATCH 2/2] uclibc: remove atomic stuff
+
+---
+ package/uclibc/0001-uClibc-no-atomic.patch | 78 ++++++++++++++++++++++++++++++
+ 1 file changed, 78 insertions(+)
+ create mode 100644 package/uclibc/0001-uClibc-no-atomic.patch
+
+diff --git a/package/uclibc/0001-uClibc-no-atomic.patch b/package/uclibc/0001-uClibc-no-atomic.patch
+new file mode 100644
+index 0000000..41305ed
+--- /dev/null
++++ b/package/uclibc/0001-uClibc-no-atomic.patch
+@@ -0,0 +1,78 @@
++diff --git a/Rules.mak b/Rules.mak
++index 405fe39..f78f5f9 100644
++--- a/Rules.mak
+++++ b/Rules.mak
++@@ -496,7 +496,6 @@ ifeq ($(TARGET_ARCH),c6x)
++ endif
++ 
++ ifeq ($(TARGET_ARCH),arc)
++-	CPU_CFLAGS-y += -mlock -mswape
++ 	CPU_CFLAGS-$(CONFIG_ARC_CPU_700) += -mA7
++ 	CPU_CFLAGS-$(CONFIG_ARC_CPU_HS) += -mcpu=archs
++ 	CPU_LDFLAGS-y += $(CPU_CFLAGS) -marclinux
++diff --git a/libc/sysdeps/linux/arc/bits/atomic.h b/libc/sysdeps/linux/arc/bits/atomic.h
++deleted file mode 100644
++index 1fdc83f..0000000
++--- a/libc/sysdeps/linux/arc/bits/atomic.h
+++++ /dev/null
++@@ -1,60 +0,0 @@
++-/*
++- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
++- *
++- * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
++- */
++-
++-#include <stdint.h>
++-#include <sysdep.h>
++-
++-typedef int8_t atomic8_t;
++-typedef uint8_t uatomic8_t;
++-typedef int_fast8_t atomic_fast8_t;
++-typedef uint_fast8_t uatomic_fast8_t;
++-
++-typedef int32_t atomic32_t;
++-typedef uint32_t uatomic32_t;
++-typedef int_fast32_t atomic_fast32_t;
++-typedef uint_fast32_t uatomic_fast32_t;
++-
++-typedef intptr_t atomicptr_t;
++-typedef uintptr_t uatomicptr_t;
++-typedef intmax_t atomic_max_t;
++-typedef uintmax_t uatomic_max_t;
++-
++-void __arc_link_error (void);
++-
++-#ifdef __A7__
++-#define atomic_full_barrier() __asm__ __volatile__("": : :"memory")
++-#else
++-#define atomic_full_barrier() __asm__ __volatile__("dmb 3": : :"memory")
++-#endif
++-
++-/* Atomic compare and exchange. */
++-
++-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
++-  ({ __arc_link_error (); oldval; })
++-
++-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
++-  ({ __arc_link_error (); oldval; })
++-
++-#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval)     \
++-  ({									\
++-	__typeof(oldval) prev;						\
++-									\
++-	__asm__ __volatile__(						\
++-	"1:	llock   %0, [%1]	\n"				\
++-	"	brne    %0, %2, 2f	\n"				\
++-	"	scond   %3, [%1]	\n"				\
++-	"	bnz     1b		\n"				\
++-	"2:				\n"				\
++-	: "=&r"(prev)							\
++-	: "r"(mem), "ir"(oldval),					\
++-	  "r"(newval) /* can't be "ir". scond can't take limm for "b" */\
++-	: "cc", "memory");						\
++-									\
++-	prev;								\
++-  })
++-
++-#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
++-  ({ __arc_link_error (); oldval; })
+-- 
+2.8.0.rc3.226.g39d4020
+
diff --git a/Build.Info/README b/Build.Info/README
new file mode 100644
index 0000000..a3bd1ff
--- /dev/null
+++ b/Build.Info/README
@@ -0,0 +1,85 @@
+ARC toolchain is built with upstream buildroot.
+
+Once the toolchain build completes, simply copy everything from
+<buildroot-dir>/output/host/ to <gfiber-repo-dir>/toolchains/prowl/
+
+1) Clone the upstream buildroot
+
+   cd ~
+   git clone git://git.busybox.net/buildroot
+
+   This creates <buildroot-dir> at ~/buildroot
+
+2) Check out specific commit (optional)
+
+   If you want arc-2016.09-eng008 tools, you should check out
+   the commit below. For the very latest tools, skip this step.
+
+   commit f0e1381ef91ac85ad4fc9ab3db30057279ffe7c5
+   Author: Zakharov Vlad <Vladislav.Zakharov@synopsys.com>
+   Date:   Wed Aug 10 20:10:40 2016 +0300
+   toolchain: Bump ARC tools to arc-2016.09-eng008
+
+   cd ~/buildroot
+   git checkout f0e1381ef91ac85ad4fc9ab3db30057279ffe7c5
+
+3) Patch uClibc
+
+   Copy patches to buildroot directory:
+   cd <gfiber-repo-dir>/toolchains/prowl/Build.Info
+   cp 000*.patch ~/buildroot
+
+   Apply the patches:
+   cd ~/buildroot
+   git am 000*.patch
+
+4) Copy buildroot configuration for the toolchain build
+
+   cd <gfiber-repo-dir>/toolchains/prowl/Build.Info
+   cp prowl_tc_defconfig ~/buildroot/configs/
+
+5) Adjust kernel absolute path in the buildroot config file
+
+   When a new toolchain is built, it should be built against
+   the same Linux kernel source that runs on the target.
+
+   Prowl kernel source is at <gfiber-repo-dir>/kernel/prowl
+
+   Replace <gfiber-repo-dir> with the full absolute path to your gfiber client:
+   BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH="<gfiber-repo-dir>/kernel/prowl"
+                                       ^^^^^^^^^^^^^^^^^
+
+   Verify that version 4.7 is still correct for headers:
+   BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_7=y
+                                         ^^^
+
+   Adjust the above as needed:
+   cd ~/buildroot/configs
+   <edit prowl_tc_defconfig>
+
+6) Build the toolchain with buildroot
+
+   cd ~/buildroot
+   make prowl_tc_defconfig
+
+   Verify that .config file looks good:
+   less .config
+
+   Start the build:
+   make
+
+7) Copy the new toolchain to toolchains/prowl
+
+   Remove the old toolchain:
+   cd <gfiber-repo-dir>/toolchains/prowl
+   repo start master .
+   rm -rf sbin usr
+
+   Copy the new toolchain:
+   cd ~/buildroot/output/host
+   cp -a * <gfiber-repo-dir>/toolchains/prowl/
+
+   Commit the new toolchain:
+   cd <gfiber-repo-dir>/toolchains/prowl
+   git add -A .
+   git commit
diff --git a/Build.Info/prowl_tc_defconfig b/Build.Info/prowl_tc_defconfig
new file mode 100644
index 0000000..5f97ae8
--- /dev/null
+++ b/Build.Info/prowl_tc_defconfig
@@ -0,0 +1,18 @@
+BR2_arcle=y
+BR2_arc750d=y
+BR2_ENABLE_DEBUG=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_7=y
+BR2_TOOLCHAIN_BUILDROOT_INET_RPC=y
+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
+BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
+BR2_PTHREAD_DEBUG=y
+BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_PACKAGE_HOST_GDB_TUI=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_LOCAL=y
+BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH="<gfiber-repo-dir>/kernel/prowl"
+BR2_LINUX_KERNEL_DEFCONFIG="prowl"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="prowl"