blob: 22833ffc3aafb43bacb3bf22bb98d479d67b87ce [file] [log] [blame]
# 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/driver_test_realm.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" ]
}
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") {
edition = "2021"
output_name = "live_usb"
with_unit_tests = true
configs += [ "//build/config/rust:bootfs" ]
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/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:tracing",
"//third_party/rust_crates:uuid",
]
sources = [
"src/block_wrapper.rs",
"src/fvm.rs",
"src/gpt.rs",
"src/main.rs",
"src/pkg.rs",
]
}
storage_driver_test_realm_v2_component("live-usb-test") {
deps = [ ":bin_test" ]
}
fuchsia_test_package("live-usb-unittests") {
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
test_components = [ ":live-usb-test" ]
}