[Fuchsia] Source Fuchsia boot images from separate GCS bucket.

Uses boot images supplied externally from the Fuchsia SDK.

Modifies the Cloud Storage download and decompression logic to skip
writing to disk, decompressing directly from the download stream
instead.

Bug: 977018
Change-Id: I06e378b4121853fe19dea4237cfb9eded23a1e0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1668237
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#671059}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 26478c00f7cb2bd744424736f0216286cda294f4
diff --git a/fuchsia/BUILD.gn b/fuchsia/BUILD.gn
index 59da62e..a661b24 100644
--- a/fuchsia/BUILD.gn
+++ b/fuchsia/BUILD.gn
@@ -56,21 +56,22 @@
   libs = [ "zircon" ]
 }
 
-# Writes an extended version of fvm.blk to fvm.extended.blk.
-blobstore_extended_path = "$root_out_dir/fvm.extended.blk"
-action("blobstore_extended_fvm") {
+# Writes an extended version of storage-full.blk to fvm.extended.blk.
+blobstore_extended_path = "$root_out_dir/storage-extended.blk"
+action("blobstore_extended") {
   # The file is grown by 1GB, which should be large enough to hold packaged
   # binaries and assets. The value should be increased if the size becomes a
   # limitation in the future.
   _extend_size = "1073741824"  # 1GB
 
-  _target_dir = "${fuchsia_sdk}/target/${current_cpu}"
+  _blobstore_path =
+      "${fuchsia_sdk}/../images/${current_cpu}/qemu/storage-full.blk"
 
   script = "//build/config/fuchsia/extend_fvm.py"
 
   inputs = [
+    _blobstore_path,
     "${fuchsia_sdk}/tools/fvm",
-    "${_target_dir}/fvm.blk",
   ]
   outputs = [
     blobstore_extended_path,
@@ -78,7 +79,7 @@
 
   args = [
     rebase_path("${fuchsia_sdk}/tools/fvm", root_build_dir),
-    rebase_path("${_target_dir}/fvm.blk", root_build_dir),
+    rebase_path(_blobstore_path, root_build_dir),
     rebase_path(blobstore_extended_path, root_build_dir),
     _extend_size,
   ]
@@ -86,7 +87,7 @@
 
 #  _________________________________________
 # / Create a compressed copy-on-write (COW) \
-# \ image based on fvm.blk.                 /
+# \ image based on storage-extended.blk.    /
 #  -----------------------------------------
 #         \   ^__^
 #          \  (oo)\_______
@@ -97,7 +98,7 @@
   script = "//build/gn_run_binary.py"
 
   deps = [
-    ":blobstore_extended_fvm",
+    ":blobstore_extended",
   ]
   inputs = [
     blobstore_extended_path,
diff --git a/fuchsia/config.gni b/fuchsia/config.gni
index cdf684e..4b88d70 100644
--- a/fuchsia/config.gni
+++ b/fuchsia/config.gni
@@ -20,3 +20,6 @@
 
 # Compute the qemu path.
 qemu_root = "//third_party/qemu-${host_os}-${host_cpu}"
+
+# Compute the path to the arch-specific boot image directory.
+boot_image_root = "${fuchsia_sdk}/../images/${target_cpu}"
diff --git a/fuchsia/rules.gni b/fuchsia/rules.gni
index 11cb4f1..06ea04c 100644
--- a/fuchsia/rules.gni
+++ b/fuchsia/rules.gni
@@ -86,6 +86,7 @@
         "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer",
         "${qemu_root}/",
         "${fuchsia_sdk}/",
+        "${boot_image_root}/",
       ]
 
       data_deps = [