Fix oatdump for boot image extensions.

Fix the ParseCheckBootImage() to check the first component
of a multi-component boot image parameter.

Fix oatdump to fail nicely instead of aborting when it
fails to load any image.

Fix error message for boot image component count mismatch.

Test: m dump-oat (fails; check error message and exit)
Test: Manually run one of the `m dump-oat` commands with
      fixed --image argument (adding the primary image).
Change-Id: I4e143e3415b1239f6afee5fa18899a1724519155
diff --git a/cmdline/cmdline.h b/cmdline/cmdline.h
index 90be30b..c02e91b 100644
--- a/cmdline/cmdline.h
+++ b/cmdline/cmdline.h
@@ -269,6 +269,10 @@
     // Checks for --boot-image location.
     {
       std::string boot_image_location = boot_image_location_;
+      size_t separator_pos = boot_image_location.find(':');
+      if (separator_pos != std::string::npos) {
+        boot_image_location = boot_image_location.substr(/*pos*/ 0u, /*size*/ separator_pos);
+      }
       size_t file_name_idx = boot_image_location.rfind('/');
       if (file_name_idx == std::string::npos) {  // Prevent a InsertIsaDirectory check failure.
         *error_msg = "Boot image location must have a / in it";
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index cfecb61..86b52cb 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -2796,7 +2796,10 @@
   }
 
   gc::Heap* heap = runtime->GetHeap();
-  CHECK(heap->HasBootImageSpace()) << "No image spaces";
+  if (!heap->HasBootImageSpace()) {
+    LOG(ERROR) << "No image spaces";
+    return EXIT_FAILURE;
+  }
   for (gc::space::ImageSpace* image_space : heap->GetBootImageSpaces()) {
     int result = DumpImage(image_space, options, os);
     if (result != EXIT_SUCCESS) {
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 11e5b45..b929560 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1754,7 +1754,7 @@
   if (chunks_.empty() != (boot_image_component_count == 0u)) {
     *error_msg = StringPrintf("Unexpected boot image component count in %s: %u, %s",
                               actual_filename.c_str(),
-                              header.GetImageReservationSize(),
+                              boot_image_component_count,
                               chunks_.empty() ? "should be 0" : "should not be 0");
     return false;
   }