improved lots of documentation and fixed a few build issues
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 92b3e8f..20df99b 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -67,8 +67,8 @@
       },
     ], ['PLATFORM=="linux-amd64-gcc"', {
         'make_global_settings': [
-          ['CC', '<(ccache)<!(which gcc)'],
-          ['CXX', '<(ccache)<!(which g++)'],
+          ['CC', '<(ccache)<!(which gcc-4.7)'],
+          ['CXX', '<(ccache)<!(which g++-4.7)'],
         ],
       },
     ], ['PLATFORM=="linux-amd64-gcc_4.8"', {
diff --git a/aos/build/build.py b/aos/build/build.py
index 4ad5021..1a84b1b 100755
--- a/aos/build/build.py
+++ b/aos/build/build.py
@@ -213,8 +213,8 @@
       """
       raise NotImplementedError('build_env should be overriden')
 
-  def check_installed(self):
-    """Makes sure that all packages necessary to build are installed."""
+  def check_installed(self, platforms, is_deploy):
+    """Makes sure that everything necessary to build platforms are installed."""
     raise NotImplementedError('check_installed should be overriden')
   def parse_platforms(self, string):
     """Args:
@@ -254,15 +254,29 @@
 
     Args:
       other_packages: A tuple of platform-specific packages to check for."""
-    all_packages = () + other_packages
+    all_packages = other_packages
+    # Necessary to build stuff.
+    all_packages += ('ccache', 'make')
+    # Necessary to download stuff to build.
+    all_packages += ('wget', 'git', 'subversion', 'patch', 'unzip', 'bzip2')
+    # Necessary to build externals stuff.
+    all_packages += ('python', 'gcc', 'g++')
     try:
       result = subprocess.check_output(
           ('dpkg-query', '--show') + all_packages,
           stdin=open(os.devnull, 'r'),
           stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as e:
-      user_output('Some packages not installed:\n'
-                  + e.output.decode('utf-8').rstrip())
+      output = e.output.decode('utf-8').rstrip()
+      not_found = []
+      for line in output.splitlines(True):
+        match = re.match(r'dpkg-query: no packages found matching (.*)',
+                         line)
+        if match:
+          not_found.append(match.group(1))
+      user_output('Some packages not installed: %s.' % ', '.join(not_found))
+      user_output('Try something like `sudo apt-get install %s`.' %
+          ' '.join(not_found))
       exit(1)
 
 class CRIOProcessor(Processor):
@@ -276,12 +290,12 @@
       self.__wind_base = wind_base
 
     def __repr__(self):
-      return 'CRIOProcessor.Platform(debug=%s)' % self.debug
+      return 'CRIOProcessor.Platform(debug=%s)' % self.debug()
     def __str__(self):
-      return 'crio%s' % ('-debug' if self.debug else '')
+      return 'crio%s' % ('-debug' if self.debug() else '')
 
     def outname(self):
-      return 'crio-debug' if self.debug else 'crio'
+      return 'crio-debug' if self.debug() else 'crio'
     def os(self):
       return 'vxworks'
     def gyp_platform(self):
@@ -290,6 +304,8 @@
       return 'ppc'
     def compiler(self):
       return 'gcc'
+    def sanitizer(self):
+      return 'none'
     def debug(self):
       return self.__debug
     def wind_base(self):
@@ -335,10 +351,11 @@
   def download_externals(self, _):
     call_download_externals('crio')
 
-  def check_installed(self):
-    # TODO(brians): Add powerpc-wrs-vxworks (a new enough version too).
-    self.do_check_installed(
-        ('ncftp',))
+  def check_installed(self, platforms, is_deploy):
+    packages = ('powerpc-wrs-vxworks', 'tcl')
+    if is_deploy:
+      packages += ('ncftp',)
+    self.do_check_installed(packages)
 
 class PrimeProcessor(Processor):
   """A Processor subclass for building prime code."""
@@ -524,6 +541,8 @@
   def parse_platforms(self, string):
     if string is None:
       return self.default_platforms()
+    elif string == 'all':
+      return self.platforms()
     r = self.default_platforms()
     for part in string.split(','):
       if part[0] == '+':
@@ -571,10 +590,25 @@
         debug=debug,
         sanitizer=sanitizer)
 
-  def check_installed(self):
-    self.do_check_installed(
-        ('clang-3.5', 'gcc-4.7-arm-linux-gnueabihf',
-         'g++-4.7-arm-linux-gnueabihf', 'openssh-client'))
+  def check_installed(self, platforms, is_deploy):
+    packages = set(('lzip', 'm4', 'realpath'))
+    packages.add('ruby')
+    # clang-format from here gets used for all versions.
+    packages.add('clang-3.5')
+    packages.add('arm-eabi-gcc')
+    for platform in platforms:
+      if platform.architecture() == 'arm':
+        packages.add('gcc-4.7-arm-linux-gnueabihf')
+        packages.add('g++-4.7-arm-linux-gnueabihf')
+      if platform.compiler() == 'clang' or platform.compiler() == 'gcc_4.8':
+        packages.add('clang-3.5')
+      if is_deploy:
+        packages.add('openssh-client')
+      if platform.compiler() == 'gcc' and platform.architecture() == 'amd64':
+        packages.add('gcc-4.7')
+        packages.add('g++-4.7')
+
+    self.do_check_installed(tuple(packages))
 
 def main():
   class TryParsingAgain(Exception):
@@ -652,7 +686,6 @@
                                args.action_name == 'deploy')
   else:
     parser.exit(status=1, message='Unknown processor "%s".' % args.processor)
-  processor.check_installed()
 
   if 'target' in args:
     targets = args.target[:]
@@ -669,6 +702,7 @@
     user_output("No platforms selected!")
     exit(1)
 
+  processor.check_installed(platforms, args.action_name == 'deploy')
   processor.download_externals(platforms)
 
   class ToolsConfig(object):
@@ -713,8 +747,8 @@
       return True
     dirs = os.listdir(os.path.join(aos_path(), '..'))
     # Looking through these folders takes a long time and isn't useful.
-    dirs.remove('output')
-    dirs.remove('.git')
+    if dirs.count('output'): dirs.remove('output')
+    if dirs.count('.git'): dirs.remove('.git')
     return not not subprocess.check_output(
         ('find',) + tuple(os.path.join(aos_path(), '..', d) for d in dirs)
          + ('-newer', platform.build_ninja(),
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index bb2fe76..106e2db 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -6,6 +6,10 @@
 AOS=$(readlink -f $(dirname $0)/..)
 . $(dirname $0)/tools_config
 
+# A separate variable for stuff that should be in LDFLAGS for everything because
+# the value from CONFIGURE_FLAGS has to get overriden in some places.
+ALL_LDFLAGS=""
+
 if [ "$1" == "arm" ]; then
   COMPILED=${EXTERNALS}/../compiled-arm
 
@@ -29,7 +33,8 @@
 
   export CFLAGS="-fPIE"
   export CXXFLAGS="-fPIE"
-  export LDFLAGS="-fPIE"
+  ALL_LDFLAGS="-fPIE"
+  export LDFLAGS=${ALL_LDFLAGS}
   CONFIGURE_FLAGS="CFLAGS=\"${CFLAGS}\" CXXFLAGS=\"${CXXFLAGS}\" LDFLAGS=\"${LDFLAGS}\""
   IS_CRIO=0
 elif [ "$1" == "crio" ]; then
@@ -170,9 +175,10 @@
         wget ${LIBCDD_URL} -O ${LIBCDD_TAR}
 [ -d ${LIBCDD_DIR} ] || ( mkdir ${LIBCDD_DIR} && tar \
         --strip-components=1 -C ${LIBCDD_DIR} -xf ${LIBCDD_TAR} )
-[ -f ${LIBCDD_LIB} ] || LDFLAGS=-L${GMP_PREFIX}/lib \
+[ -f ${LIBCDD_LIB} ] || \
 	bash -c "cd ${LIBCDD_DIR} && ./configure \
 	--disable-shared ${CONFIGURE_FLAGS} \
+	LDFLAGS=\"${ALL_LDFLAGS} -L${GMP_PREFIX}/lib\"\
 	--prefix=$(readlink -f ${LIBCDD_PREFIX}) \
 	&& make gmpdir=${GMP_PREFIX} && make install"
 
diff --git a/aos/build/queues/compiler.rb b/aos/build/queues/compiler.rb
index 90c88a7..864d1c6 100644
--- a/aos/build/queues/compiler.rb
+++ b/aos/build/queues/compiler.rb
@@ -60,7 +60,7 @@
 end
 def format_pipeline(output)
   read_in, write_in = IO.pipe()
-  child = Process.spawn('clang-format-3.4 --style=google',
+  child = Process.spawn('/opt/clang-3.5/bin/clang-format --style=google',
                         {:in=>read_in, write_in=>:close,
                          :out=>output.fileno})
   read_in.close