Commit 2a112566 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fuchsia: extend the size of the blobstore FVM at build time.

This CL grows Fuchsia blobstore by a specified amount, large enough to
accommodate packaged executables installed at machine (QEMU) runtime.

Roll SDK from 32a56ad5 to de50ae25 for "fvm extend" and the inclusion
of fvm.blk.

Bug: 798851, 707030
Change-Id: I5a6b6be21cc443e6ad46271918a2f40e191a26f6
Reviewed-on: https://chromium-review.googlesource.com/987012
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547568}
parent 0c7e0b9b
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/fuchsia/config.gni")
import("//build/config/fuchsia/rules.gni")
import("//build/config/sysroot.gni")
assert(is_fuchsia)
......@@ -61,3 +62,72 @@ config("compiler") {
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") {
# The file is grown by 500MB, 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 = "524288000" # 500MB = 500 * 1024 * 1024
script = "//build/config/fuchsia/extend_fvm.py"
if (current_cpu == "arm64") {
_blobstore_src_path = "//third_party/fuchsia-sdk/sdk/target/aarch64/fvm.blk"
} else if (current_cpu == "x64") {
_blobstore_src_path = "//third_party/fuchsia-sdk/sdk/target/x86_64/fvm.blk"
}
inputs = [
_blobstore_src_path,
]
outputs = [
blobstore_extended_path,
]
args = [
rebase_path("${fuchsia_sdk}/tools/fvm"),
rebase_path(_blobstore_src_path),
rebase_path(blobstore_extended_path),
_extend_size,
]
}
# _________________________________________
# / Create a compressed copy-on-write (COW) \
# \ image based on fvm.blk. /
# -----------------------------------------
# \ ^__^
# \ (oo)\_______
# (__)\ )\/\
# ||----w |
# || ||
action("blobstore_extended_qcow2") {
script = "//build/gn_run_binary.py"
deps = [
":blobstore_extended_fvm",
]
inputs = [
blobstore_extended_path,
]
outputs = [
blobstore_qcow_path,
]
data = [
blobstore_qcow_path,
]
args = [
rebase_path("//third_party/fuchsia-sdk/sdk/qemu/bin/qemu-img",
root_build_dir),
"convert",
"-f",
"raw",
"-O",
"qcow2",
"-c",
rebase_path(blobstore_extended_path),
rebase_path(blobstore_qcow_path),
]
}
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copies a FVM file and extends it by a specified amount.
Arg #1: path to 'fvm'.
#2: the path to the source fvm.blk.
#3: the path that the extended FVM file will be written to.
#4: the additional number of bytes to grow fvm.blk by."""
import os
import shutil
import subprocess
import sys
def ExtendFVM(fvm_tool_path, src_path, dest_path, delta):
old_size = os.path.getsize(src_path)
new_size = old_size + int(delta)
shutil.copyfile(src_path, dest_path)
subprocess.check_call([fvm_tool_path, dest_path, 'extend', '--length',
str(new_size)])
return 0
if __name__ == '__main__':
sys.exit(ExtendFVM(*sys.argv[1:]))
......@@ -7,6 +7,9 @@ assert(is_fuchsia)
import("//build/config/chromecast_build.gni")
import("//build/config/fuchsia/config.gni")
import("//build/config/fuchsia/package.gni")
import("//build/config/sysroot.gni")
blobstore_qcow_path = "$root_out_dir/fvm.blk.qcow2"
template("generate_runner_script") {
# This runtime_deps file is used at runtime and thus cannot go in
......@@ -19,8 +22,8 @@ template("generate_runner_script") {
_pkg_dir = "$root_out_dir/gen/" + get_label_info(invoker.package_name, "dir")
_manifest_path = "$_pkg_dir/${invoker.package_name}.archive_manifest"
_package_path = "$_pkg_dir/${invoker.package_name}.far"
_runner_target = "${target_name}_runner"
_legacy_runner_target = "${target_name}_legacy_runner"
_runner_target = "${target_name}_script"
_legacy_runner_target = "${target_name}_legacy_script"
group(_runtime_deps_target) {
forward_variables_from(invoker,
......@@ -104,6 +107,7 @@ template("generate_runner_script") {
])
deps = [
"//build/config/fuchsia:blobstore_extended_qcow2",
"//testing/buildbot/filters:fuchsia_filters",
]
......
......@@ -69,8 +69,7 @@ class QemuTarget(target.Target):
# any changes.
'-snapshot',
'-drive', 'file=%s,format=qcow2,if=none,id=data,snapshot=on' %
boot_data.GetTargetFile(self._GetTargetSdkArch(),
'fvm.blk.qcow2'),
os.path.join(self._output_dir, 'fvm.blk.qcow2'),
'-drive', 'file=%s,format=qcow2,if=none,id=blobstore,snapshot=on' %
self._MakeQcowDisk(boot_data.ConfigureDataFVM(self._output_dir,
False)),
......
32a56ad54471732034ba802cbfc3c9ff277b9d1c
de50ae25fe0912099c47d7e303f167c95b555e19
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment