Massive refactoring of external header files.

This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD \
                vboot_reference \
                chromeos-cryptohome \
                chromeos-installer \
                chromeos-u-boot \
                peach-u-boot \
                depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
diff --git a/utility/bmpblk_font.c b/utility/bmpblk_font.c
index 493e87f..75c3385 100644
--- a/utility/bmpblk_font.c
+++ b/utility/bmpblk_font.c
@@ -7,6 +7,7 @@
 #include <getopt.h>
 #include <limits.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -17,6 +18,7 @@
 
 #include "bmpblk_font.h"
 #include "image_types.h"
+#include "vboot_api.h"
 
 static char *progname;
 
diff --git a/utility/bmpblk_util.c b/utility/bmpblk_util.c
index 49573af..abcac0d 100644
--- a/utility/bmpblk_util.c
+++ b/utility/bmpblk_util.c
@@ -6,6 +6,8 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <lzma.h>
+#include <stdint.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
@@ -15,7 +17,7 @@
 
 #include "bmpblk_util.h"
 #include "eficompress.h"
-
+#include "vboot_api.h"
 
 // Returns pointer to buffer containing entire file, sets length.
 static void *read_entire_file(const char *filename, size_t *length) {
diff --git a/utility/bmpblk_utility.cc b/utility/bmpblk_utility.cc
index ea04c22..b3af141 100644
--- a/utility/bmpblk_utility.cc
+++ b/utility/bmpblk_utility.cc
@@ -5,19 +5,21 @@
 // Utility for manipulating firmware screen block (BMPBLOCK) in GBB.
 //
 
-#include "bmpblk_utility.h"
-#include "image_types.h"
-
 #include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <lzma.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <yaml.h>
 
+#include "bmpblk_utility.h"
+#include "image_types.h"
+#include "vboot_api.h"
+
 extern "C" {
 #include "eficompress.h"
 }
diff --git a/utility/dump_kernel_config.c b/utility/dump_kernel_config.c
index e733a0d..ec0ee5a 100644
--- a/utility/dump_kernel_config.c
+++ b/utility/dump_kernel_config.c
@@ -11,9 +11,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-#include "dump_kernel_config.h"
-#include "kernel_blob.h"
-#include "vboot_api.h"
+#include "vboot_host.h"
 
 enum {
   OPT_KLOADADDR = 1000,
@@ -76,7 +74,7 @@
     return PrintHelp();
 
   if (!infile || !*infile) {
-    VbExError("Must specify filename\n");
+    fprintf(stderr, "Must specify filename\n");
     return 1;
   }
 
diff --git a/utility/dump_kernel_config_lib.c b/utility/dump_kernel_config_lib.c
index 464e349..819ca92 100644
--- a/utility/dump_kernel_config_lib.c
+++ b/utility/dump_kernel_config_lib.c
@@ -9,10 +9,10 @@
 #include <string.h>
 #include <sys/mman.h>
 
-#include "dump_kernel_config.h"
 #include "host_common.h"
 #include "kernel_blob.h"
 #include "vboot_api.h"
+#include "vboot_host.h"
 
 static uint8_t* GetKernelConfig(uint8_t* blob, size_t blob_size,
                                 uint64_t kernel_body_load_address) {
diff --git a/utility/gbb_utility.cc b/utility/gbb_utility.cc
index e68bd9b..980521c 100644
--- a/utility/gbb_utility.cc
+++ b/utility/gbb_utility.cc
@@ -5,10 +5,9 @@
 // Utility for manipulating Google Binary Block (GBB)
 //
 
-#include "gbb_utility.h"
-
 #include <assert.h>
 #include <getopt.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -17,6 +16,8 @@
 #include <vector>
 #include <algorithm>
 
+#include "gbb_utility.h"
+
 using std::string;
 
 ///////////////////////////////////////////////////////////////////////
diff --git a/utility/include/dump_kernel_config.h b/utility/include/dump_kernel_config.h
deleted file mode 100644
index cacc561..0000000
--- a/utility/include/dump_kernel_config.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Exports the kernel commandline from a given partition/image file.
- */
-
-#ifndef DUMP_KERNEL_CONFIG_UTILITY_H_
-#define DUMP_KERNEL_CONFIG_UTILITY_H_
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-/* TODO(wfrichar): This needs a better location */
-#define MAX_KERNEL_CONFIG_SIZE     4096
-
-/* Use this to obtain the body load address from the kernel preamble */
-#define USE_PREAMBLE_LOAD_ADDR     (~0)
-
-/* Returns a new copy of the kernel cmdline. The caller must free it. */
-char *FindKernelConfig(const char *filename,
-                       uint64_t kernel_body_load_address);
-
-#endif  // DUMP_KERNEL_CONFIG_UTILITY_H_
diff --git a/utility/tpm_init_temp_fix.c b/utility/tpm_init_temp_fix.c
index d3004a6..8964bee 100644
--- a/utility/tpm_init_temp_fix.c
+++ b/utility/tpm_init_temp_fix.c
@@ -17,6 +17,7 @@
  * "success" when everything worked.
  */
 
+#include <stdint.h>
 #include <stdio.h>
 #include <syslog.h>
 
diff --git a/utility/tpmc.c b/utility/tpmc.c
index 9302dd1..98004e8 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -9,6 +9,8 @@
  * for other errors.
  */
 
+#include <stdint.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <syslog.h>