| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| import("//build/dist/component_manifest_resources.gni") |
| import("//build/dist/resource.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/zbi/kernel_cmdline.gni") |
| import("//src/storage/testing/isolated_devmgr.gni") |
| import("//tools/cmc/build/cml.gni") |
| |
| declare_args() { |
| # Whether or not to include the live_usb component in the build. |
| with_live_usb = false |
| } |
| |
| if (with_live_usb) { |
| group("bootfs") { |
| deps = [ |
| ":bin", |
| ":meta", |
| ] |
| } |
| } else { |
| group("bootfs") { |
| deps = [ ":empty_manifest" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":live-usb-unittests", |
| "//src/storage/testing:storage-isolated-devmgr", |
| ] |
| } |
| |
| component_manifest_resources("meta") { |
| sources = [ "meta/live-usb.cml" ] |
| } |
| |
| # This is a hack, because component_manager doesn't currently support modifying root.cml on a |
| # per-product basis. As a result, bringup depends on "//src/sys/live_usb:empty_manifest", which |
| # brings in an empty live_usb component. Any products which actually use this component must remove |
| # that dependency from product_bootfs_labels and instead depend on "//src/sys/live_usb:bootfs". |
| cm("meta_empty") { |
| manifest = "meta/empty.cml" |
| output_name = "empty.cm" |
| } |
| |
| resource("empty_manifest") { |
| sources = get_target_outputs(":meta_empty") |
| deps = [ ":meta_empty" ] |
| outputs = [ "meta/live-usb.cm" ] |
| } |
| |
| kernel_cmdline("live_usb_is_system") { |
| args = [ "live_usb.is_system=true" ] |
| deps = [ "//build/validate:non_production_tag" ] |
| } |
| |
| rustc_binary("bin") { |
| name = "live-usb" |
| |
| with_unit_tests = true |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc", |
| "//sdk/fidl/fuchsia.device:fuchsia.device-rustc", |
| "//sdk/fidl/fuchsia.fshost:fuchsia.fshost-rustc", |
| "//sdk/fidl/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition-rustc", |
| "//sdk/fidl/fuchsia.paver:fuchsia.paver-rustc", |
| "//sdk/fidl/fuchsia.pkg.rewrite:fuchsia.pkg.rewrite-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-url", |
| "//src/lib/storage/fuchsia-watch", |
| "//src/lib/storage/ramdevice_client", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/fidl-fuchsia-pkg-rewrite-ext", |
| "//src/sys/lib/payload_streamer", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:gpt", |
| "//third_party/rust_crates:uuid", |
| ] |
| |
| test_deps = |
| [ "//src/lib/isolated_devmgr/v2_component/rust:isolated-driver-manager" ] |
| |
| sources = [ |
| "src/block_wrapper.rs", |
| "src/fvm.rs", |
| "src/gpt.rs", |
| "src/main.rs", |
| "src/pkg.rs", |
| ] |
| } |
| |
| storage_isolated_devmgr_unittest_v2_component("live-usb-test") { |
| deps = [ ":bin_test" ] |
| executable_path = "bin/live_usb_bin_test" |
| runner = "rust_test_runner" |
| } |
| |
| fuchsia_test_package("live-usb-unittests") { |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| test_components = [ ":live-usb-test" ] |
| } |